My questions are:
- How can I use the ConnectHandler in robotframework?
- What is a good workflow to solve the problem of creating robot libraries from existing python packages?
I wish to use netmiko library in robotframework. I imported the module into my python env using pip and confirmed its available by using a robot file.
*** Settings ***
Library netmiko
I now wish to instantiate a "ConnectHandler", I can see from the documentation that it takes a dictionary
https://pynet.twb-tech.com/blog/automation/netmiko.html at the python commandline:
>>> from netmiko import ConnectHandler
>>> cisco_881 = {
... 'device_type': 'cisco_ios',
... 'ip': '10.10.10.227',
... 'username': 'pyclass',
... 'password': 'password',
... }
Source code is here: https://github.com/ktbyers/netmiko
So I edited the robot file to create a dictionary containing key:values , and then passed that as an argument to ConnectHandler.
*** Settings ***
Library netmiko
Library Collections
*** Test Cases ***
My Test
${device}= Create Dictionary device_type cisco_ios
... ip 10.10.10.227
... username pyclass
... password password
Log Dictionary ${device}
ConnectHandler ${device}
The result was
============================================================================== Testnetmiko
============================================================================== My Test
| FAIL | KeyError: u'device_type'
What am I doing wrong here?