Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/765.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a Library Mapper for LibreNMS obtained values in order to map with existing network_drivers.
12 changes: 12 additions & 0 deletions development_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@
"_dict": lib_mapper.HIERCONFIG_LIB_MAPPER_REVERSE,
"_file": "docs/user/lib_mapper/hierconfig_reverse.md",
},
"librenms": {
"header_src": "LIBRENMS",
"header_dst": "NORMALIZED",
"_dict": lib_mapper.LIBRENMS_LIB_MAPPER,
"_file": "docs/user/lib_mapper/librenms.md",
},
"librenms_reverse": {
"header_src": "NORMALIZED",
"header_dst": "LIBRENMS",
"_dict": lib_mapper.LIBRENMS_LIB_MAPPER_REVERSE,
"_file": "docs/user/lib_mapper/librenms_reverse.md",
},
"napalm": {
"header_src": "NAPALM",
"header_dst": "NORMALIZED",
Expand Down
8 changes: 8 additions & 0 deletions docs/user/lib_mapper/librenms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
| LIBRENMS | | NORMALIZED |
| ---------- | -- | ------ |
| arista_eos | → | arista_eos |
| iosxe | → | cisco_xe |
| iosxr | → | cisco_xr |
| junos | → | juniper_junos |
| nxos | → | cisco_nxos |
| procera | → | applogic_procera |
8 changes: 8 additions & 0 deletions docs/user/lib_mapper/librenms_reverse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
| NORMALIZED | | LIBRENMS |
| ---------- | -- | ------ |
| applogic_procera | → | procera |
| arista_eos | → | arista_eos |
| cisco_nxos | → | nxos |
| cisco_xe | → | iosxe |
| cisco_xr | → | iosxr |
| juniper_junos | → | junos |
25 changes: 24 additions & 1 deletion netutils/lib_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,17 @@
# REMOVE IN 2.X, kept for backward compatibility
DNA_CENTER_LIB_MAPPER_REVERSE = copy.deepcopy(DNACENTER_LIB_MAPPER_REVERSE)

# Normalized | Netmiko
# LibreNMS | Normalized
LIBRENMS_LIB_MAPPER: t.Dict[str, str] = {
"arista_eos": "arista_eos",
"iosxe": "cisco_xe",
"iosxr": "cisco_xr",
"junos": "juniper_junos",
"nxos": "cisco_nxos",
"procera": "applogic_procera",
}

# Netmiko | Normalized
NETMIKO_LIB_MAPPER: t.Dict[str, str] = {
"a10": "a10",
"accedian": "accedian",
Expand Down Expand Up @@ -656,6 +666,16 @@
"paloalto_panos": "PAN_OS",
}

# Normalized | LibreNMS
LIBRENMS_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
"applogic_procera": "procera",
"arista_eos": "arista_eos",
"cisco_nxos": "nxos",
"cisco_xe": "iosxe",
"cisco_xr": "iosxr",
"juniper_junos": "junos",
}

# Normalized | NIST
NIST_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
"arista_eos": "arista:eos",
Expand All @@ -672,6 +692,7 @@
# Deep copy the reverse, where there is no actual translation happening with special
# consideration for OS's not in netmiko.
_MAIN_LIB_MAPPER = copy.deepcopy(NETMIKO_LIB_MAPPER)
_MAIN_LIB_MAPPER["applogic_procera"] = "applogic_procera"
_MAIN_LIB_MAPPER["aruba_aoscx"] = "aruba_aoscx"
_MAIN_LIB_MAPPER["cisco_aireos"] = "cisco_aireos"
_MAIN_LIB_MAPPER["cisco_dnac"] = "cisco_dnac"
Expand Down Expand Up @@ -709,6 +730,7 @@
"dna_center": DNACENTER_LIB_MAPPER,
"forward_networks": FORWARDNETWORKS_LIB_MAPPER,
"hier_config": HIERCONFIG_LIB_MAPPER,
"librenms": LIBRENMS_LIB_MAPPER,
"napalm": NAPALM_LIB_MAPPER,
"netmiko": NETMIKO_LIB_MAPPER,
"netutils_parser": NETUTILSPARSER_LIB_MAPPER,
Expand All @@ -727,6 +749,7 @@
"dna_center": DNACENTER_LIB_MAPPER_REVERSE,
"forward_networks": FORWARDNETWORKS_LIB_MAPPER_REVERSE,
"hier_config": HIERCONFIG_LIB_MAPPER_REVERSE,
"librenms": LIBRENMS_LIB_MAPPER_REVERSE,
"napalm": NAPALM_LIB_MAPPER_REVERSE,
"netmiko": NETMIKO_LIB_MAPPER_REVERSE,
"netutils_parser": NETUTILSPARSER_LIB_MAPPER_REVERSE,
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_lib_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"CAPIRCA",
"FORWARDNETWORKS",
"HIERCONFIG",
"LIBRENMS",
"NETMIKO",
"NETUTILSPARSER",
"NTCTEMPLATES",
Expand Down
Loading