-
Notifications
You must be signed in to change notification settings - Fork 13
/
run_saniticheck_real_device.py
130 lines (70 loc) · 2.55 KB
/
run_saniticheck_real_device.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import napalm as napalm
from napalm_aos.utils.utils import *
driver = napalm.get_network_driver('aos')
device = driver(hostname='', username='', password='', optional_args={'port': ''})
device.open()
# print("is_alive")
# jprint(device.is_alive())
# print("get_bgp_neighbors")
# jprint(device.get_bgp_neighbors())
# print("get_environment")
# jprint(device.get_environment())
# print("get_arp_table")
# jprint(device.get_arp_table())
# print("get_facts")
# jprint(device.get_facts())
print("get_interfaces")
jprint(device.get_interfaces())
# print("get_interfaces_counters")
# jprint(device.get_interfaces_counters())
# print("get_interfaces_ip")
# jprint(device.get_interfaces_ip())
# print("get_lldp_neighbors")
# jprint(device.get_lldp_neighbors())
# print("get_lldp_neighbors_detail")
# jprint(device.get_lldp_neighbors_detail())
# print("get_config")
# jprint(device.get_config())
# print("get_mac_address_table")
# jprint(device.get_mac_address_table())
# print("get_ntp_peers")
# jprint(device.get_ntp_peers())
# print("get_ntp_servers")
# jprint(device.get_ntp_servers())
# print("get_ntp_stats")
# jprint(device.get_ntp_stats())
# print("get_route_to")
# jprint(device.get_route_to(destination='10.255.0.0/16'))
# print("get_ipv6_neighbors_table")
# jprint(device.get_ipv6_neighbors_table())
# print("get_vlans")
# jprint(device.get_vlans())
# print("get_snmp_information")
# jprint(device.get_snmp_information())
# print("get_users")
# jprint(device.get_users())
# print("ping")
# jprint(device.ping(destination="10.120.0.123"))
# print("traceroute")
# jprint(device.traceroute(destination="10.120.0.123"))
# print("Send command: vlan 700")
# device.cli(["vlan 700"])
# cliOutput = device.cli(["show vlan"])
# tableOutput = AOSTable(cliOutput["show vlan"])
# for index, vlan in enumerate(tableOutput.get_column_by_name("vlan")):
# if(tableOutput.get_column_by_name("vlan")[index] == "700"):
# print("Create vlan 700: Success!")
# break
# print("Send command: no vlan 700")
# flag = 1
# device.cli(["no vlan 700"])
# cliOutput = device.cli(["show vlan"])
# tableOutput = AOSTable(cliOutput["show vlan"])
# for index, vlan in enumerate(tableOutput.get_column_by_name("vlan")):
# if(tableOutput.get_column_by_name("vlan")[index] == "700"):
# flag = 0
# print("Delete vlan 700: False!")
# break
# if(flag == 1):
# print("Delete vlan 700: Success!")
device.close()