-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcontrol_cdi.py
executable file
·80 lines (60 loc) · 1.87 KB
/
control_cdi.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
#!/usr/bin/env python3.10
'''
Simple runner for CDI suite
'''
import sys
import logging
import olcbchecker.setup
import check_cd10_valid
import check_cd20_read
import check_cd30_acdi
def prompt() :
print("\nCDI Standard checking")
print(" a Run all in sequence")
print(" 1 CDI Memory Present checking")
print(" 2 Validation checking")
print(" 3 ACDI checking")
print(" ")
print(" q go back")
def checkAll(logger=logging.getLogger("CDI")) :
result = 0
logger.info("CDI Memory Present checking")
result += check_cd10_valid.check()
logger.info("Validation checking")
result += check_cd20_read.check()
logger.info("ACDI checking")
result += check_cd30_acdi.check()
if result == 0 :
logger.info("Success - all CDI checks passed")
else:
logger.warning("At least one CDI check failed")
return result
def main() :
logger = logging.getLogger("CDI")
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("\nCDI Memory Present checking")
check_cd10_valid.check()
case "2" :
print("\nValidation checking")
check_cd20_read.check()
case "3" :
print("\nACDI checking")
check_cd30_acdi.check()
case "a" :
checkAll(logger)
case "q" | "quit" : return
case _ : continue
return
if __name__ == "__main__":
result = main()
olcbchecker.setup.interface.close()
sys.exit(result)