Oct-24-2020, 09:09 PM
I'm trying to figure out how to loop over a list of interface and run a TDR (Time Division Reflectometer) on Cisco switch ports.
I'm able to get the list of interfaces I want to test on the switch.
I want to create a variable and split [0] to get the interfaces.
Then use the variable list to run the test command, and then the show command.
1. test cable-diagnostics tdr int $var
2. pause 5 seconds
3. show cable-diagnostics tdr int $var
Any help would be greatly appreciated.
Thank you for your time!
----------
I can get to this point and get this output. I'm using netmiko module, and running on a cisco 4500 in a lab.
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
================================================
var = o1.split0
GigabitEthernet1/1
GigabitEthernet1/11
GigabitEthernet1/14
GigabitEthernet1/16
GigabitEthernet1/17
GigabitEthernet1/19
================================================
# TEST cable-diagnostics tdr interface commands
testdr = [
# test cable-diagnostics tdr interface + $var
# SHOW cable-diagnostics tdr interface commands
shtdr = [
# show cable-diagnostics tdr interface + $var
print (shtdr)
================================================
I'm able to get the list of interfaces I want to test on the switch.
I want to create a variable and split [0] to get the interfaces.
Then use the variable list to run the test command, and then the show command.
1. test cable-diagnostics tdr int $var
2. pause 5 seconds
3. show cable-diagnostics tdr int $var
Any help would be greatly appreciated.
Thank you for your time!
----------
I can get to this point and get this output. I'm using netmiko module, and running on a cisco 4500 in a lab.
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
================================================
var = o1.split0
GigabitEthernet1/1
GigabitEthernet1/11
GigabitEthernet1/14
GigabitEthernet1/16
GigabitEthernet1/17
GigabitEthernet1/19
================================================
# TEST cable-diagnostics tdr interface commands
testdr = [
# test cable-diagnostics tdr interface + $var
# SHOW cable-diagnostics tdr interface commands
shtdr = [
# show cable-diagnostics tdr interface + $var
print (shtdr)
================================================