-
Notifications
You must be signed in to change notification settings - Fork 20
/
get_capabilities.py
executable file
·35 lines (26 loc) · 1 KB
/
get_capabilities.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
#!/usr/bin/env python
from ncclient import manager
import sys
# Set the device variables
DEVICES = ['172.16.30.101', '172.16.30.102']
USER = 'admin'
PASS = 'admin'
PORT = 830
DEVICE_NAMES = {'172.16.30.101': '(nx-osv9000-1)',
'172.16.30.102': '(nx-osv9000-2)' }
# create a main() method
def main():
"""
Main method that prints netconf capabilities of remote device.
"""
for device in DEVICES:
with manager.connect(host=device, port=PORT, username=USER,
password=PASS, hostkey_verify=False,
device_params={'name': 'nexus'},
look_for_keys=False, allow_agent=False) as m:
# print all NETCONF capabilities
print('\n***Remote Devices Capabilities for device {} {}***\n'.format(DEVICE_NAMES[device], device))
for capability in m.server_capabilities:
print(capability.split('?')[0])
if __name__ == '__main__':
sys.exit(main())