networktocode / netutils

Python library that is a collection of functions and objects for common network automation tasks.
https://netutils.readthedocs.io/
Other
217 stars 50 forks source link

"Abbreviated Interface Name" method does not work for "FourHundredGigabitEthernet" interfaces (iosxr) #282

Closed Kani999 closed 1 year ago

Kani999 commented 1 year ago

Environment

Expected Behavior

Return abbreviated interface name FH0/0/1/4

Observed Behavior

Returned canonical name FourHundredGigabitEthernet0/0/1/4

Steps to Reproduce

from netutils.interface import abbreviated_interface_name

print(abbreviated_interface_name("FourHundredGigabitEthernet0/0/1/4"))
Kani999 commented 1 year ago

Workaround

from netutils.interface import abbreviated_interface_name

BASE_INTERFACES_EXTENDED = {
    "FourHundredGigabitEthernet": "FourHundredGigabitEthernet",
        }

REVERSE_MAPPING_EXTENDED = {
        "FourHundredGigabitEthernet": "FH"
        }

print(abbreviated_interface_name("FourHundredGigabitEthernet0/0/1/4", BASE_INTERFACES_EXTENDED, REVERSE_MAPPING_EXTENDED))

output >> FH0/0/1/4

qduk commented 1 year ago

@Kani999 Thanks for that. #285 has been opened to resolve the issue.