Convert between short and long versions of cisco interface names.
Project description
Cisco Interface Name Converter
Written because some Cisco CLI commands output a short version of the interface name, and some output a long version of the interface name. I needed a way to consistently map this relationship, and since I couldn't find something like this online, I decided to share the knowledge with the community.
You can use the interface_abbreviations dictionary in your own code, or use the supplied convert_interface method to convert interface names.
Getting started
from CiscoInterfaceNameConverter import converter converter.convert_interface(
- interface_name="GigabitEthernet1/0/1" (REQUIRED)
- return_short=False (Optional)
- return_long=False (Optional)
- simple_mode=True (Optional)
- silent=False (Optional)
)
This will convert the interface name to the opposite of whatever you passed into the function.
You can force the return of the short or long version of the interface name. I tend to do this to all interfaces, even if I know it's already in one form. That way it's always consistent.
Simple mode will use a string slicing method to convert the long to short if the name doesn't match any known abbreviations.
Silent will disable output to stdout when names don't match.
If you don't want to use the converter function, feel free to just take the dictionary.
from CiscoInterfaceNameConverter.converter import interface_abbreviations
This dictionary has the long form as the key and the short form as the value.
Contributing
If suggesting a new abbreviation get added to the dictionary, please do so in a pull request. Please attach screenshots of the output from the Cisco device showing both the long and short versions of the interface name.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file CiscoInterfaceNameConverter-0.0.1.tar.gz.
File metadata
- Download URL: CiscoInterfaceNameConverter-0.0.1.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbf3438be622687d4745ca5a4c0a11bded46c152b263f653f89e810fdb84d9cd
|
|
| MD5 |
6a011faf1fb85935bcc88d67c55e9af2
|
|
| BLAKE2b-256 |
6d700fc4a62aacf1857fc5c2d0e07923b51c70bce564cf526a9a085aa47a2c17
|
File details
Details for the file CiscoInterfaceNameConverter-0.0.1-py3-none-any.whl.
File metadata
- Download URL: CiscoInterfaceNameConverter-0.0.1-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a1a015a077f5fbd0357b759e541a4b001c80a2975cd26f30310fbb8ca0e3976
|
|
| MD5 |
4ab0f67e6f27ddb5eb7f1aa6219e4341
|
|
| BLAKE2b-256 |
bcdecf8a1253a766eaf905c31dc9be47589459d0b5f5c81d3fa9539fc9095c4a
|