Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS-XR: return the is_alive flag for the SSH channel #623

Merged
merged 2 commits into from
Jan 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions napalm/iosxr/iosxr.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ def close(self):

def is_alive(self):
"""Returns a flag with the state of the connection."""
# Simply returns the flag from Netmiko
return {
'is_alive': self.device.device.is_alive()
}
if self.device is None:
return {'is_alive': False}
# Simply returns the flag from pyIOSXR
return {'is_alive': self.device.is_alive()}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In __init__ method should we just set:

self.device = None

and then not create the IOSXR object until the open() call? In other words, move lines 90 - 96 to be in the open() method.

Also should the close() method be setting self.device = None. I looked in the NAPALM IOS driver and in __init__ I am setting self.device = None (and don't create the Netmiko object until open() call). I am not doing the self.close though (i.e. I think we should be setting self.device = None in close).

What do you think on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it shouldn't matter whether we put do the self.device = None or not as long as the API behaves as documented. Would be nice to be consistent amongst devices that use netmiko though.


def load_replace_candidate(self, filename=None, config=None):
self.pending_changes = True
Expand Down