ktbyers / nornir_netmiko

Netmiko Plugins for Nornir
Apache License 2.0
80 stars 25 forks source link

nornir-netmiko file transfer is not working if platform is set to juniper #47

Open nanisyako opened 1 year ago

nanisyako commented 1 year ago

env: netmiko==4.1.1 nornir-netmiko==0.2.0

task:

        for file in file_name:
            try:
                transfer_results = task.run(
                    netmiko_file_transfer,
                    source_file=file,
                    dest_file=file,
                    direction="get",
                )
            except:
                print(f"file could not be copied")

error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/nornir/core/task.py", line 99, in start
    r = self.task(self, **self.params)
  File "/usr/local/lib/python3.8/site-packages/nornir_netmiko/tasks/netmiko_file_transfer.py", line 26, in netmiko_file_transfer
    scp_result = file_transfer(
  File "/usr/local/lib/python3.8/site-packages/netmiko/scp_functions.py", line 122, in file_transfer
    with TransferClass(**scp_args) as scp_transfer:
  File "/usr/local/lib/python3.8/site-packages/netmiko/ssh_dispatcher.py", line 459, in FileTransfer
    raise ValueError(
ValueError: Unsupported SCP device_type: currently supported platforms are:
arista_eos
arista_eos_ssh
ciena_saos
ciena_saos_ssh
cisco_asa
cisco_asa_ssh
cisco_ios
cisco_ios_ssh
cisco_nxos
cisco_nxos_ssh
cisco_xe
cisco_xe_ssh
cisco_xr
cisco_xr_ssh
dell_os10
dell_os10_ssh
extreme_exos
extreme_exos_ssh
juniper_junos
juniper_junos_ssh
linux
linux_ssh
mikrotik_routeros
mikrotik_routeros_ssh
nokia_sros
nokia_sros_ssh

it seems the netconnect.device_type makred as juniper instead

net_connect.device_type
'juniper'
ktbyers commented 1 year ago

Temporary workaround is to use a platform value of juniper_junos, but this should be fixed in Netmiko to support juniper as an SCP device type.