question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Closing NAPALM connections automatically

See original GitHub issue

When using NAPALM plugins connections stay open and can cause scripts to hang while waiting for the connections to timeout.

Forcing the connections to close using a task helps with this.

task.host.connections["napalm"].close()

Maybe this could be done automatically? It’ll require to find a way to know which connections are not useful anymore.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dbarrosopcommented, Jun 29, 2018

I thought we could look into creating a “close” task so it’s easier for the user to explicitly close the connections or maybe do it automatically via the garbage collector by implementing some code in the del magic method.

1reaction
ktbyerscommented, Aug 29, 2018

The solution for this is in Nornir 2.0 is to use the Context Manager coupled with InitNornir. Should be details on this in PR #195

Read more comments on GitHub >

github_iconTop Results From Across the Web

NetworkDriver — NAPALM 3 documentation
Closes the connection to the device. Commits the changes requested by the method load_replace_candidate or load_merge_candidate. NAPALM drivers that support ' ...
Read more >
NAPALM Documentation - Read the Docs
It handles opening and closing the session automatically and it's the pythonic way: >>> from napalm import get_network_driver.
Read more >
How to Automate Networks with NAPALM and Python!
DescriptionWhat do you do if you have network devices from more than one vendor? Will you have to write Python scripts for each...
Read more >
Automation 9. Comparing data collection with NAPALM and ...
NAPALM interacts with network devices based on some device specific interface (e.g., eAPI for Arista EOS and XML for Cisco IOS XR) and...
Read more >
Network Automation Using Unified API - Napalm - Cisco Blogs
NAPALM supports several methods to connect to the devices, to manipulate configurations or to retrieve data. I had been learning Python for ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found