netmiko脚本中的ConnectHandler(** device_data)中的**是什么意思?

时间:2018-11-17 11:54:10

标签: python

这是我的第一篇文章,所以我希望我在这里没有做错任何事情。 我从网站上获得了以下带有一些示例netmiko脚本的代码。 预先感谢。

例如,我从一个站点复制了此脚本,并提供了一些netmiko示例:

def render_to_file_and_deploy(self):
        username, acc, password = \
            netrc.netrc().authenticators(self._device.name)

        device_data = {
            'device_type': 'cisco_ios',
            'ip': self._device.name,
            'username': username,
            'password': password,
        }

        f = NamedTemporaryFile(delete=False)
        print('Stored temporary config at {}'.format(f.name))
        f.write(self._device.rendered_config)
        f.flush()

        net_connect = ConnectHandler(**device_data)
        output = net_connect.send_config_from_file(f.name)
        print(output)
        print('Config uploaded!')

        f.close()

        print('Done.') 

0 个答案:

没有答案