-
Notifications
You must be signed in to change notification settings - Fork 555
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
add canonical_interface #493
Merged
ktbyers
merged 15 commits into
napalm-automation:develop
from
itdependsnetworks:canonical_interface
Nov 18, 2017
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9e54e2c
add canonical_interface
itdependsnetworks 9f5a8b6
implment suggested changes
itdependsnetworks 892643b
fix test reverse mapping
itdependsnetworks 4bb8673
update pep
itdependsnetworks b2d2bfa
Merge branch 'develop' into canonical_interface
itdependsnetworks a86dc53
update mapping
itdependsnetworks f19a7c4
Merge branch 'develop' into canonical_interface
itdependsnetworks bec16e1
pylama
itdependsnetworks 9d7487c
os diff sent to driver
itdependsnetworks a5fac96
move to base class
itdependsnetworks 24c5b39
updates as per kirk recommendations
itdependsnetworks 6ff2c96
split methods, and update names
itdependsnetworks 3b7be7d
move change check to base not helper
itdependsnetworks 1bcd70d
bug fixes
itdependsnetworks 09a4772
update pylama
itdependsnetworks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
from __future__ import print_function | ||
from __future__ import unicode_literals | ||
|
||
|
||
base_interfaces = { | ||
"ATM": "ATM", | ||
"AT": "ATM", | ||
"EOBC": "EOBC", | ||
"EO": "EOBC", | ||
"Ethernet": "Ethernet", | ||
"Eth": "Ethernet", | ||
"Et": "Ethernet", | ||
"FastEthernet": "FastEthernet", | ||
"FastEth": "FastEthernet", | ||
"FastE": "FastEthernet", | ||
"Fast": "FastEthernet", | ||
"Fas": "FastEthernet", | ||
"FE": "FastEthernet", | ||
"Fa": "FastEthernet", | ||
"Fddi": "Fddi", | ||
"FD": "Fddi", | ||
"FortyGigabitEthernet": "FortyGigabitEthernet", | ||
"FortyGigEthernet": "FortyGigabitEthernet", | ||
"FortyGigEth": "FortyGigabitEthernet", | ||
"FortyGigE": "FortyGigabitEthernet", | ||
"FortyGig": "FortyGigabitEthernet", | ||
"FGE": "FortyGigabitEthernet", | ||
"FO": "FortyGigabitEthernet", | ||
"Fo": "FortyGigabitEthernet", | ||
"GigabitEthernet": "GigabitEthernet", | ||
"GigEthernet": "GigabitEthernet", | ||
"GigEth": "GigabitEthernet", | ||
"GigE": "GigabitEthernet", | ||
"Gig": "GigabitEthernet", | ||
"GE": "GigabitEthernet", | ||
"Gi": "GigabitEthernet", | ||
"HundredGigabitEthernet": "HundredGigabitEthernet", | ||
"HundredGigEthernet": "HundredGigabitEthernet", | ||
"HundredGigEth": "HundredGigabitEthernet", | ||
"HundredGigE": "HundredGigabitEthernet", | ||
"HundredGig": "HundredGigabitEthernet", | ||
"Hu": "HundredGigabitEthernet", | ||
"Loopback": "Loopback", | ||
"Lo": "Loopback", | ||
"Management": "Management", | ||
"Mgmt": "Management", | ||
"Ma": "Management", | ||
"Management_short": "Ma", | ||
"MFR": "MFR", | ||
"Multilink": "Multilink", | ||
"Mu": "Multilink", | ||
"PortChannel": "PortChannel", | ||
"Port-Channel": "PortChannel", | ||
"Po": "PortChannel", | ||
"POS": "POS", | ||
"PO": "POS", | ||
"Serial": "Serial", | ||
"Se": "Serial", | ||
"S": "Serial", | ||
"TenGigabitEthernet": "TenGigabitEthernet", | ||
"TenGigEthernet": "TenGigabitEthernet", | ||
"TenGigEth": "TenGigabitEthernet", | ||
"TenGig": "TenGigabitEthernet", | ||
"TeGig": "TenGigabitEthernet", | ||
"Ten": "TenGigabitEthernet", | ||
"T": "TenGigabitEthernet", | ||
"Te": "TenGigabitEthernet", | ||
"Tunnel": "Tunnel", | ||
"Tun": "Tunnel", | ||
"Tu": "Tunnel", | ||
"Virtual-Access": "Virtual-Access", | ||
"Vi": "Virtual-Access", | ||
"Virtual-Template": "Virtual-Template", | ||
"Vt": "Virtual-Template", | ||
"VLAN": "VLAN", | ||
"V": "VLAN", | ||
"Vl": "VLAN" | ||
} | ||
|
||
reverse_mapping = { | ||
"ATM": "At", | ||
"EOBC": "EO", | ||
"Ethernet": "Et", | ||
"FastEthernet": "Fa", | ||
"Fddi": "FD", | ||
"FortyGigabitEthernet": "Fo", | ||
"GigabitEthernet": "Gi", | ||
"HundredGigabitEthernet": "Hu", | ||
"Loopback": "Lo", | ||
"Management": "Ma", | ||
"MFR": "MFR", | ||
"Multilink": "Mu", | ||
"PortChannel": "Po", | ||
"POS": "PO", | ||
"Serial": "Se", | ||
"TenGigabitEthernet": "Te", | ||
"Tunnel": "Tu", | ||
"Virtual-Access": "Vi", | ||
"Virtual-Template": "Vt", | ||
"VLAN": "Vl" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regexes are case sensitive so
po.*
andPo.*
are not going to cause any false positives. regexes has the advantage the code becomes simpler and more reliable as it should work if cisco in their next version decide to come up with yet another combination of short letters.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am usually regex heavy, but having been bit by this issue nearly a decade ago, I am cautious about it. As an example, there is Virtual-Access and Virtual-Template, the idea of getting this right the first time, without being explicit does not seem likely.
This should be helpful only, and like I said, knowing the pain it has caused me before, I try and do as much as possible to to avoid false positive's.