-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathztpcli.py
More file actions
29 lines (26 loc) · 691 Bytes
/
Copy pathztpcli.py
File metadata and controls
29 lines (26 loc) · 691 Bytes
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
"""
Configures devices through SSH from Python Service
"""
from netmiko import ConnectHandler
def postScript(device):
""" Post Script after ZTP"""
ztp_device = {
"device_type": "cisco_ios",
"ip": device,
"username": "user",
"password": "password",
"port": 22,
"verbose": False,
}
print("ssh device: %s" % device)
net_connect = ConnectHandler(**ztp_device)
config_commands = [
"!",
"int vlan1",
"desc postScript",
"!",
]
output = net_connect.send_config_set(config_commands)
# Remove if you don't want display output
print(output)
output = net_connect.disconnect()