-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_ResetService.py
More file actions
115 lines (102 loc) · 4.72 KB
/
test_ResetService.py
File metadata and controls
115 lines (102 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# content of test_sysexit.py
import pytest
import PQ9Client
import time
import json
from PQ9TestHelpers import getAddress
def test_SoftReset(pq9_connection, destination):
print("This function tests the board Soft Reset by requesting the board uptime, performing a soft reset and requesting the uptime again.")
print()
command = {}
command["_send_"] = "GetTelemetry"
command["Destination"] = destination
command["Source"] = "EGSE"
succes, msg = pq9_connection.processCommand(command)
assert succes == True, "Error: System is not responding"
uptimeBeforeReset = int(json.loads(msg["Uptime"])["value"])
if( uptimeBeforeReset < 3 ):
time.sleep(3 - uptimeBeforeReset)
succes, msg = pq9_connection.processCommand(command)
assert succes == True, "Error: System is not responding"
uptimeBeforeReset = int(json.loads(msg["Uptime"])["value"])
print("Uptime before reset:", uptimeBeforeReset, "s")
command["_send_"] = "Reset"
command["Destination"] = destination
command["Source"] = "EGSE"
command["Type"] = "Soft"
succes, msg = pq9_connection.processCommand(command)
assert succes == True, "System is not responding"
time.sleep(1)
command["_send_"] = "GetTelemetry"
command["Destination"] = destination
command["Source"] = "EGSE"
succes, msg = pq9_connection.processCommand(command)
assert succes == True, "Error: System is not responding"
uptimeAfterReset = int(json.loads(msg["Uptime"])["value"])
assert uptimeAfterReset < 2, "Error: Board did not reset"
print("Uptime after reset:", uptimeAfterReset, "s")
print("Soft Reset successful")
def test_HardReset(pq9_connection,destination):
print("This function tests the board Hard Reset by requesting the board uptime, performing a hard reset and requesting the uptime again.")
print()
command = {}
command["_send_"] = "GetTelemetry"
command["Destination"] = destination
command["Source"] = "EGSE"
succes, msg = pq9_connection.processCommand(command)
assert succes == True, "Error: System is not responding"
uptimeBeforeReset = int(json.loads(msg["Uptime"])["value"])
if( uptimeBeforeReset < 3 ):
time.sleep(3 - uptimeBeforeReset)
succes, msg = pq9_connection.processCommand(command)
assert succes == True, "Error: System is not responding"
uptimeBeforeReset = int(json.loads(msg["Uptime"])["value"])
print("Uptime before reset:", uptimeBeforeReset, "s")
command["_send_"] = "Reset"
command["Destination"] = destination
command["Source"] = "EGSE"
command["Type"] = "Hard"
succes, msg = pq9_connection.processCommand(command)
assert succes == True, "System is not responding"
time.sleep(1)
command["_send_"] = "GetTelemetry"
command["Destination"] = destination
command["Source"] = "EGSE"
succes, msg = pq9_connection.processCommand(command)
assert succes == True, "Error: System is not responding"
uptimeAfterReset = int(json.loads(msg["Uptime"])["value"])
assert uptimeAfterReset < 2, "Error: Board did not reset"
print("Uptime after reset:", uptimeAfterReset, "s")
print("Hard Reset successful")
def test_PowerCycle(pq9_connection, destination):
print("This function tests the board power cycle by requesting the board uptime, performing a power cycle and requesting the uptime again.")
print()
command = {}
command["_send_"] = "GetTelemetry"
command["Destination"] = destination
command["Source"] = "EGSE"
succes, msg = pq9_connection.processCommand(command)
assert succes == True, "Error: System is not responding"
uptimeBeforeReset = int(json.loads(msg["Uptime"])["value"])
if( uptimeBeforeReset < 3 ):
time.sleep(3 - uptimeBeforeReset)
succes, msg = pq9_connection.processCommand(command)
assert succes == True, "Error: System is not responding"
uptimeBeforeReset = int(json.loads(msg["Uptime"])["value"])
print("Uptime before reset:", uptimeBeforeReset, "s")
command["_send_"] = "Reset"
command["Destination"] = destination
command["Source"] = "EGSE"
command["Type"] = "PowerCycle"
succes, msg = pq9_connection.processCommand(command)
assert succes == True, "System is not responding"
time.sleep(1)
command["_send_"] = "GetTelemetry"
command["Destination"] = destination
command["Source"] = "EGSE"
succes, msg = pq9_connection.processCommand(command)
assert succes == True, "Error: System is not responding"
uptimeAfterReset = int(json.loads(msg["Uptime"])["value"])
assert uptimeAfterReset < 2, "Error: Board did not reset"
print("Uptime after reset:", uptimeAfterReset, "s")
print("Power Cycle successful")