-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcontrol_message.py
executable file
·94 lines (74 loc) · 2.47 KB
/
control_message.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
#!/usr/bin/env python3.10
'''
Simple runner for message network checks
'''
import sys
import logging
import olcbchecker.setup
import check_me10_init
import check_me20_verify
import check_me30_pip
import check_me40_oir
import check_me50_dup
def prompt() :
print("\nMessage Network Standard checking")
print(" a Run all in sequence")
print(" 1 Node Initialized checking")
print(" 2 Verify Node checking")
print(" 3 Protocol Support Inquiry checking")
print(" 4 Optional Interaction Rejected checking")
print(" 5 Duplicate Node ID Discovery checking")
print(" ")
print(" q go back")
def checkAll(logger=logging.getLogger("MESSAGE")) :
result = 0
logger.info("Node Initialized checking")
result += check_me10_init.check()
logger.info("Verify Node checking")
result += check_me20_verify.check()
logger.info("Protocol Support Inquiry checking")
result += check_me30_pip.check()
logger.info("Optional Interaction Rejected checking")
result += check_me40_oir.check()
logger.info("Duplicate Node ID Discovery checking")
result += check_me50_dup.check()
if result == 0 :
logger.info("Success - all message checks passed")
else:
logger.warning("At least one message check failed")
return result
def main() :
logger = logging.getLogger("MESSAGE")
if olcbchecker.setup.configure.runimmediate :
return (checkAll(logger))
'''
loop to check against Message Network Standard
'''
while True :
prompt()
selection = input(">> ").lower()
match selection :
case "1" :
print("\nNode Initialized checking")
check_me10_init.check()
case "2" :
print("\nVerify Node checking")
check_me20_verify.check()
case "3" :
print("\nProtocol Support Inquiry checking")
check_me30_pip.check()
case "4" :
print("\nOptional Interaction Rejected checking")
check_me40_oir.check()
case "5" :
print("\nDuplicate Node ID Discovery checking")
check_me50_dup.check()
case "a" :
checkAll(logger)
case "q" | "quit" : return
case _ : continue
return
if __name__ == "__main__":
result = main()
olcbchecker.setup.interface.close()
sys.exit(result)