-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_config.py
53 lines (43 loc) · 1.02 KB
/
get_config.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
from ncclient import manager
eos=manager.connect(host="10.83.28.203", port="830", timeout=30, username="arista", password="arista", hostkey_verify=False)
domain_name='''
<system>
<config>
<domain-name>
</domain-name>
</config>
</system>
'''
print (eos.get_config(source="running", filter=("subtree", domain_name)))
dns_servers='''
<system>
<dns>
<servers>
</servers>
</dns>
</system>
'''
print (eos.get_config(source="running", filter=("subtree", dns_servers)))
dns_8888='''
<system>
<dns>
<servers>
<server>
<address>8.8.8.8</address>
<config>
</config>
</server>
</servers>
</dns>
</system>
'''
print (eos.get_config(source="running", filter=("subtree", dns_8888)))
Interface_Ethernet3='''
<interfaces>
<interface>
<name>Ethernet3</name>
</interface>
</interfaces>
'''
print(eos.get_config(source="running", filter=("subtree", Interface_Ethernet3)))
eos.close_session()