Here's my script so far. I apologize if sloppy and crude. New to netmiko, and trying to test network cables and make my life easier.
#!/usr/bin/env python from netmiko import Netmiko from netmiko import ConnectHandler import time import re cisco = { 'device_type': 'cisco_ios', 'host': '10.1.1.1', 'username': 'cisco', 'password': 'cisco', 'timeout': 35 * 60, } print() print("running commands...") net_connect = ConnectHandler(**cisco) output = (net_connect.send_command('sh run | i hostname ').split()[1]) print() print() print ('HOSTNAME:') print() print(output) output = (net_connect.send_command('sh run | i ip address 10 ').split()[2]) print(output) print() o1 = net_connect.send_command('show ip int brief | include Ethernet1/1.*up') print(o1)
Output:HOSTNAME:
4500lab
10.1.1.1
GigabitEthernet1/1 unassigned YES unset up up
GigabitEthernet1/11 unassigned YES unset up up
GigabitEthernet1/14 unassigned YES unset up up
GigabitEthernet1/16 unassigned YES unset up up
GigabitEthernet1/17 unassigned YES unset up up
GigabitEthernet1/19 unassigned YES unset up up
Larz60+ write Oct-24-2020, 10:29 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Added for you this time
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Added for you this time