-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_jsnapy.py
executable file
·40 lines (29 loc) · 1.43 KB
/
run_jsnapy.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
from jnpr.jsnapy import SnapAdmin
js = SnapAdmin()
def call_jsnap(test_file):
failed_flag = False
chk = js.snapcheck(test_file)
for check in chk:
for test in check.test_details:
for subtest in check.test_details[test]:
for item in subtest['failed']:
failed_flag = True
print check.device, "FAILED TEST:", test, item['id'], item['post'], "Expected:",subtest['testoperation'], (subtest['expected_node_value'] if 'expected_node_value' in subtest else subtest['node_name'])
if failed_flag:
return True
else:
return False
print "************************************************************"
print "************************************************************"
print "************************************************************"
if call_jsnap("main_test1.yml"):
print "############################################################"
print "# SOME TESTS FAILED #"
print "############################################################"
else:
print "############################################################"
print "# ALL TESTS PASSED #"
print "############################################################"
print "************************************************************"
print "************************************************************"
print "************************************************************"