![](/img/trans.png)
[英]How to reboot the cisco switch with Netmiko SSH (Python)?
[英]How to parse cisco switch output data with Netmiko
我正在 Cisco 交换机上进行 TDR 电缆诊断,我需要知道如何将该信息传输到 Excel(已订购)。
from netmiko import ConnectHandler
#Credenciales
ip = "192.168.xx.xx"
username = "admin"
password = "pass"
pass_enable = "secret"
DEVICE_TYPE = 'cisco_ios'
conexion = ConnectHandler(ip=ip, username=username, password=password, secret=pass_enable, device_type=DEVICE_TYPE)
if not conexion.check_enable_mode():
conexion.enable()
tdr = conexion.send_command('show cable-diagnostics tdr interface Gi1/0/1', use_textfsm=True)
print(tdr)
output 是这样的:
SW1#show cable-diagnostics tdr interface Gi1/0/1
TDR test last run on: December 26 11:40:35
Interface Speed Local pair Pair length Remote pair Pair status
--------- ----- ---------- ------------------ ----------- --------------------
Gi1/0/1 1000M Pair A 55 +/- 10 meters Pair B Normal
Pair B 55 +/- 10 meters Pair A Normal
Pair C 55 +/- 10 meters Pair D Normal
Pair D 55 +/- 10 meters Pair C Normal
我希望你能帮助我,谢谢
我试图将 output 排序为文本文件,但我可以将它传递给 excel 排序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.