-
Notifications
You must be signed in to change notification settings - Fork 0
/
extract_ansible_res2.py
94 lines (93 loc) · 3.21 KB
/
extract_ansible_res2.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
results = dict()
results = {
"test_results": {
"show chassis alarms": [
{
"count": {
"fail": 0,
"pass": 1
},
"failed": [],
"node_name": "alarm-summary/active-alarm-count",
"passed": [
{
"POST": {},
"PRE": {},
"id": {
"alarm-summary/active-alarm-count": "null"
},
"message": "Test Succeeded!! no chassis alarm"
}
],
"result": "true",
"test_name": "test_chassis_alarm_check",
"testoperation": "not-exists",
"xpath": "//alarm-information"
},
{
"result": "null"
}
],
"show ospf neighbor instance all": [
{
"count": {
"fail": 0,
"pass": 0
},
"expected_node_value": [
"2-Way",
"Full"
],
"failed": [],
"node_name": "ospf-neighbor-state",
"passed": [],
"result": "null",
"test_name": "test_ospf_neighbor",
"testoperation": "is-in",
"xpath": "/ospf-neighbor-information-all/ospf-instance-neighbor/ospf-neighbor"
}
],
"show system core-dumps": [
{
"result": "null"
}
],
"show system memory": [
{
"count": {
"fail": 1,
"pass": 0
},
"expected_node_value": [
70.0,
99.0
],
"failed": [
{
"actual_node_value": "null",
"id": {},
"post": {},
"pre": {},
"xpath_error": "true"
}
],
"node_name": "system-memory-information/system-memory-summary-information/system-memory-free-percent",
"passed": [],
"result": "false",
"test_name": "check_system_memory_usage",
"testoperation": "in-range",
"xpath": "multi-routing-engine-item"
}
]
}
}
#print(results)
for res in results["test_results"]:
#print(results["test_results"][res])
for data in results["test_results"][res]:
#print(data)
for key, value in data.items():
#print(key, value)
if 'test_name' in key:
print(data['test_name'])
print(data['result'])