-
Notifications
You must be signed in to change notification settings - Fork 1
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
Idea for Hackathon - Normalize Interface #5
Comments
This came up from netbox (see above), I am trying to gauge the core teams willingness to allow? |
Great topic, thanks for raising this, Ken. I like the idea of having the interfaces names normalised (I guess that's one of the few things our getter does not present in a uniform shape). I fear changing the output of the existing getters,
But, as I said, I like the idea, and here's what I would suggest:
>>> d = get_network_driver('junos')
>>> j = d(...)
>>> j.open()
...
>>> j.normalise_interface_name('xe-0/0/0')
TenGigEth0/0/0 (just a dummy return, of course, cause y'all ❤️ crisco) This would be good for various reasons, for whenever the user needs that. And it would also work well to be invoked in Netbox, or anywhere else. If the user trusts this, they can anyway post-process the output from the NAPALM getters with this and get the output they need.
|
Yes, I like what @mirceaulinic proposed here....that sounds like a good solution to this problem. I think we could also have issues on how do we |
Agreed with the approach. I do just want to note, my solution is low impact since it defaults back to the original if there is no match. I use it internally with good results. The real change (and impact ) is with new results when upgrading. |
Would it be sufficient simply to include the port description along with the ID? Here's what we see on a device with an IOS neighbor:
Here's what NAPALM reports:
Including the port description should provide the full name, at least for IOS. This would be enough for us over at NetBox, because we could consider a match on either string to indicate a valid connection. (On the IOS switch I'm looking at, setting a local description on the interface does not appear to change what is reported via LLDP. Junos is less predictable, but it only ever uses one form of interface ID anyway.) |
That would be specific to the getter, and my suggestion would be to open an issue against it to be discussed. This method would be across all getters. I would argue that the issue is still there, in that local interface would still (presumably) be the shortname, depending on vendor implementation. |
@jeremystretch yeah, if you want that info you probably should open an issue for discussion. Current Regarding the whole idea, I like the idea but only partially. If we are to normalize interfaces, which I think we should, I would certainly not use a naming scheme that emulates how Cisco does it because I think it's terrible and basically why we are in this mess. I think basically that interface names should be named after $type$id and that's it. For example:
|
Then there is the matter on how to best deploy this and I agree with the plan @mirceaulinic presented but I'd suggest instead to use an optional_arg to enable it for the whole session so the user doesn't have to specify it in every single method. |
@dbarrosop I would not suggest using regex here. What is the difference between a My intention is to leave it as found in the configuration. I can understand normalizing et, vl, etc... As a value add, but I suspect most use it as I do to have one source of truth of interfaces. In addition, this is a valid cisco config (though both daughter cards never exist at same time)
|
I don't see the problem. In my example code you would have
So the scope is not to normalize but to expand to the longer form of the name? |
@dbarrasop correct, should probably adjust the name |
Ok, I have no opinion then :P |
Normalize Interface
I currently do this in post-processing, but would be nice to have an option to return an normalized interface. This is essentially what I do: https://github.com/itdependsnetworks/Scripts/blob/master/normalize_interface/normalize_interface.py
The text was updated successfully, but these errors were encountered: