Skip to content

Commit

Permalink
os diff sent to driver
Browse files Browse the repository at this point in the history
  • Loading branch information
itdependsnetworks committed Nov 17, 2017
1 parent bec16e1 commit 9d7487c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
13 changes: 4 additions & 9 deletions napalm/base/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def as_number(as_number_val):
return int(as_number_str)


def canonical_interface(interface, device_os, change, short=False):
def canonical_interface(interface, change, short=False, update_long_to_short=None):
'''
Function to retun interface canonical name
This puposely does not use regex, or first X characters, to ensure
Expand All @@ -268,12 +268,6 @@ def canonical_interface(interface, device_os, change, short=False):
if not change:
return interface

if device_os == "cisco_nxos_ssh":
device_os = "cisco_nxos"
supported_os_list = ["cisco_ios", "cisco_nxos", "cisco_xr", "arista_eos"]
if device_os not in supported_os_list:
return interface

def split_on_match(split_interface):
'''
simple fuction to split on first digit, slash, or space match
Expand All @@ -286,8 +280,9 @@ def split_on_match(split_interface):

base_interfaces = interface_map['base_interfaces']
reverse_mapping = interface_map['reverse_mapping']
if interface_map.get(device_os):
base_interfaces = base_interfaces.update(interface_map.get(device_os))

if isinstance(update_long_to_short, dict):
base_interfaces.update(update_long_to_short)
# check in dict for mapping
if base_interfaces.get(interface_type):
long_int = base_interfaces.get(interface_type)
Expand Down
3 changes: 2 additions & 1 deletion napalm/ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ def commit_config(self):
def _canonical_int(self, interface):
"""Expose the helper function within this class."""
if self.canonical_int is True:
return napalm.base.helpers.canonical_interface(interface, "cisco_ios", True)
return napalm.base.helpers.canonical_interface(interface, True, short=False,
update_long_to_short=None)
else:
return interface

Expand Down

0 comments on commit 9d7487c

Please sign in to comment.