0

我最近一直在使用带有 Netmiko 的 Nornir 从我的设备中获取一些输出。

当我运行以下代码时:

    from nornir import InitNornir
    from nornir.core.filter import F
    from nornir_netmiko.tasks import netmiko_send_command, netmiko_send_config
    from nornir_utils.plugins.functions import print_result
    
    nr = InitNornir(config_file="config.yml")
    test = nr.filter(platform="Cisco")
    result = test.run(netmiko_send_command, command_string="sh ver")
    print_result(result)

我收到以下错误:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/nornir/core/task.py", line 99, in start
    r = self.task(self, **self.params)
  File "/home/benanater/.local/lib/python3.8/site-packages/nornir_netmiko/tasks/netmiko_send_command.py", line 26, in netmiko_send_command
    net_connect = task.host.get_connection(CONNECTION_NAME, task.nornir.config)
  File "/usr/local/lib/python3.8/dist-packages/nornir/core/inventory.py", line 494, in get_connection
    self.open_connection(
  File "/usr/local/lib/python3.8/dist-packages/nornir/core/inventory.py", line 546, in open_connection
    conn_obj.open(
  File "/home/benanater/.local/lib/python3.8/site-packages/nornir_netmiko/connections/netmiko.py", line 59, in open
    connection = ConnectHandler(**parameters)
  File "/home/benanater/.local/lib/python3.8/site-packages/netmiko/ssh_dispatcher.py", line 321, in ConnectHandler
    raise ValueError(
ValueError: Unsupported 'device_type' currently supported platforms are:
a10

任何有关为什么会产生此错误的帮助将不胜感激。

4

1 回答 1

1

您将平台设置Cisco为未映射netmiko_plugin到任何受支持的平台device_type。您应该阅读netmiko_plugin上的文档。平台应该等同于cisco_ioscisco_ios_telnet

于 2021-06-13T18:39:59.253 回答