【问题标题】:Changing cisco ios description with python - excel input使用 python 更改 cisco ios 描述 - excel 输入
【发布时间】:2019-07-15 14:02:37
【问题描述】:

我要做的是用 python 编写一个脚本,以一个 excel 文件作为输入,然后读取其中写入的交换机接口的数量和描述,然后 ssh 到一个 cisco 交换机和用之前在 excel 中添加的值更改描述。 任何人都可以给我一个提示吗?

【问题讨论】:

  • 我已经更改了标签。 ios 适用于 Apple iOS - 不适用于 Cisco IOS。

标签: cisco cisco-ios


【解决方案1】:

尝试检查 netmiko 模块。我可以使用 netmiko 做一些接近您需要的事情,但现在我使用 ansible ios_command,这对于非程序员网络工程师来说要容易得多。

【讨论】:

    【解决方案2】:

    从 Paramiko 或 Netmiko 开始,Netmiko 是更好的版本。我也会重新考虑实际项目,而不是考虑一个开关,而是考虑所有开关,看看你是否有一些通用的事情需要在所有开关中做而不是一个。

    For this project you could do below. 
    1 . save date in CSV 
    2 . Open CSV file 
    3.  Create a dictionary and Save interface name as key , and description as values
    4. Create a list where you can save all your keys --> l = d.keys() 
    4.  SSH to the sw via paramiko/Netmiko . 
    5.  Run a loop in the list l 
    on each iteration send below commands 
    interface l[i]
    description d[l[i]]
    
    this will translate to below 
    interface eth1/1
    description d['eth1/1'] ( d['eth1/1'] will be value/description of whatever you are gonna get from CSV)
    

    如果你真的尝试学习 python,那么它是一个好的开始,但是如果你时间紧迫,Ansible 是更容易的选择

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-19
      • 1970-01-01
      • 2019-04-16
      • 2018-05-01
      • 2015-04-20
      • 1970-01-01
      相关资源
      最近更新 更多