-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcontrol_frame.py
executable file
·109 lines (82 loc) · 2.66 KB
/
control_frame.py
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
#!/usr/bin/env python3.10
'''
Simple runner for frame transport suite
'''
import sys
import logging
import olcbchecker.setup
import check_fr10_init
import check_fr20_ame
import check_fr30_collide
import check_fr40_highbit
import check_fr50_capacity
import check_fr60_standard
import subprocess
def prompt() :
print("\nFrame Transport Standard checking")
print(" a Run all in sequence")
print(" 1 Initialization checking")
print(" 2 AME checking")
print(" 3 Collision checking")
print(" 4 Reserved bit checking")
print(" 5 Capacity checking")
print(" 6 Standard frame checking")
print(" ")
print(" q go back")
def checkAll(logger=logging.getLogger("FRAME")) :
result = 0
logger.info("Initialization checking")
result += check_fr10_init.check()
logger.info("AME checking")
result += check_fr20_ame.check()
logger.info("Collision checking")
result += check_fr30_collide.check()
logger.info("Reserved bit checking")
result += check_fr40_highbit.check()
logger.info("Capacity checking")
result += check_fr50_capacity.check()
logger.info("Standard frame checking")
result += check_fr60_standard.check()
if result == 0 :
logger.info("Success - all frame checks passed")
else:
logger.warning("At least one frame check failed")
return result
def main() :
logger = logging.getLogger("FRAME")
if olcbchecker.setup.configure.runimmediate :
return (checkAll(logger))
'''
loop to check against Frame Transport Standard
'''
while True :
prompt()
selection = input(">> ").lower()
match selection :
case "1" :
print("\nInitialization checking")
check_fr10_init.check()
case "2" :
print("\nAME checking")
check_fr20_ame.check()
case "3" :
print("\nCollision checking")
check_fr30_collide.check()
case "4" :
print("\nReserved bit checking")
check_fr40_highbit.check()
case "5" :
print("\nCapacity checking")
check_fr50_capacity.check()
case "6" :
print("\nStandard frame checking")
check_fr60_standard.check()
case "a" :
checkAll(logger)
case "q" | "quit" : return
case _ : continue
return
if __name__ == "__main__":
result = main()
olcbchecker.setup.interface.close()
sys.exit(result)