Specific attributes for netmiko in nornir inventory or call enable()
See original GitHub issueHello,
I have a lot of old Procurve switches only with telnet, where disable paging and enable mode doesn’t work in automatic way.
Reading a similar post, I could solve it using the next lines:
con = netmiko.ConnectHandler(
device_type="hp_procurve_telnet"
ip=ip, username=username,
password=password,
secret=password
)
con.enable(default_username=user)
con.send_command ("terminal len 1000") //for disable paging
r = con.send_command (command)
print (r)
Now, I would like to use it with nornir (I am learning it yet). I guess if I can overwrite default_username for enable function, it is done (from nornir inventory, it would be perfect).
If it is not possible with inventory attributes, how can send it in the call to do something similar to next line? target_host.run (task=netmiko_send_command, command_string=command, enable=True, default_username=user)
At the same time, is there a doc with all possible netmiko attributes for nornir inventory?
Thanks.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Nornir 101 - Network Automation - Packet Coders
The Nornir inventory structure consists of: hosts - individual hosts and any related attributes; groups - group definitions and any related ...
Read more >4. Nornir Netmiko send command Configuration Example
Returns: Result object with the following attributes set: * result: Result of the show command (generally a string, but depends on use of...
Read more >Connections — nornir 2.5.0 documentation
This plugin connects to the device using the Netmiko driver and sets the relevant connection. Inventory: extras: maps to argument passed to ConnectHandler...
Read more >Nornir using an Ansible Inventory (Part2)
We'll also use Nornir plus NAPALM to retrieve and save the current ... a checkpoint file instead of simply using the get_config() method....
Read more >Exploring Nornir, the Python Automation Framework
As you can see from the initial test, the username value can be accessed either as an attribute or as a key in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Summarizing,
I had 2 problems:
It was hard to find how use attributes in nornir (basically the next lines). When I found them, no problem, working fine.
connection_options: netmiko: extras: {"secret": xxx}
I need to change enable default_username with these devices (it is not “manager”, it is the same as I use for login with radius authentication). The problem is that base_connection has no this option or param and I can not change it. So I overwrite netmiko_send_command and it is working fine. However I do not like to modify original files for next updates. In this case I can not see any issue or incompatibility, it is simple. I would like to take a look and you consider add it.
Explain of my procurve scenarios (all of them with radius authentication):
At the same time they use different command for disable paging. Do you have a method for testing a new device type for adding to Netmiko? or with this minimal difference, do you consider better another choice like another param? It would be similar at above case.
Thanks.
I am going to close this–just re-open if there is some pending action here.