Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Implemented get_cdp_neighbors() and modified get_lldp_neighbors() #185

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

tommarcoen
Copy link

Modified get_lldp_neighbors() to call get_cdp_neighbors() if need-by.

Some other code changed - which is from a different branch to allow for telnet instead of SSH as the protocol.

@mirceaulinic mirceaulinic added this to the BLOCKED milestone Aug 9, 2017
Copy link
Contributor

@ktbyers ktbyers left a comment

Choose a reason for hiding this comment

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

See comments.

@@ -118,7 +120,7 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None)
except KeyError:
pass
self.global_delay_factor = optional_args.get('global_delay_factor', 1)
self.port = optional_args.get('port', 22)
self.port = optional_args.get('port', {'ssh': 22, 'telnet': 23}[self.transport])
Copy link
Contributor

Choose a reason for hiding this comment

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

This and line 79 are in a separate PR...shouldn't them here (just going to cause issues).

device_type = 'cisco_ios'
if self.transport != 'ssh':
device_type += '_' + self.transport
self.device = ConnectHandler(device_type=device_type,
Copy link
Contributor

Choose a reason for hiding this comment

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

As per above telnet support shouldn't be coupled into this PR.

@@ -670,15 +675,61 @@ def get_optics(self):

return optics_detail

def get_cdp_neighbors(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be a private method i.e. _get_cdp_neighbors(self).

Copy link
Author

Choose a reason for hiding this comment

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

I would agree were it not that it might seem awkward for people running CDP in their network to have to make a call to get_lldp_neighbors().

Copy link
Contributor

Choose a reason for hiding this comment

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

NAPALM requires a uniform interface across all drivers...so we would be (very) unlikely to have a custom Cisco only method call...so yes the call would be to get_lldp_neighbors().

Longer term there should maybe be discussions to rename this or to have a secondary name like get_layer2_neighbors.

If they really want to they can call the private method.

@ktbyers
Copy link
Contributor

ktbyers commented Aug 9, 2017

Also unit tests need to pass...which on quick glance looks like fix the pylama lint issues and make the get_cdp_neighbors method a private method.

Copy link

@TheKnightCoder TheKnightCoder left a comment

Choose a reason for hiding this comment

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

really need this feature for cisco devices

@dbarrosop
Copy link
Member

@TheKnightCoder thanks for your contribution but the code is not passing CI, needs rebasing and there is a code freeze right now as we are migrating all the drivers to a new repo.

@ktbyers
Copy link
Contributor

ktbyers commented Oct 24, 2017

See napalm-automation/napalm#473

This is a post reunification task. The telnet changes have already been implemented.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants