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/+nokia-sros-mapper.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated Netmiko and ntc-templates lib mappers to map `alcatel_sros` to the normalized `nokia_sros` platform.
2 changes: 1 addition & 1 deletion docs/user/lib_mapper/netmiko.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
| adva_fsp150f2 | → | adva_fsp150f2 |
| adva_fsp150f3 | → | adva_fsp150f3 |
| alcatel_aos | → | alcatel_aos |
| alcatel_sros | → | alcatel_sros |
| alcatel_sros | → | nokia_sros |
| allied_telesis_awplus | → | allied_telesis_awplus |
| apresia_aeos | → | apresia_aeos |
| arista_eos | → | arista_eos |
Expand Down
1 change: 0 additions & 1 deletion docs/user/lib_mapper/netmiko_reverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
| adva_fsp150f2 | → | adva_fsp150f2 |
| adva_fsp150f3 | → | adva_fsp150f3 |
| alcatel_aos | → | alcatel_aos |
| alcatel_sros | → | alcatel_sros |
| allied_telesis_awplus | → | allied_telesis_awplus |
| apresia_aeos | → | apresia_aeos |
| arista_eos | → | arista_eos |
Expand Down
2 changes: 1 addition & 1 deletion docs/user/lib_mapper/ntctemplates.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
| adva_fsp150f2 | → | adva_fsp150f2 |
| adva_fsp150f3 | → | adva_fsp150f3 |
| alcatel_aos | → | alcatel_aos |
| alcatel_sros | → | alcatel_sros |
| alcatel_sros | → | nokia_sros |
| allied_telesis_awplus | → | allied_telesis_awplus |
| apresia_aeos | → | apresia_aeos |
| arista_eos | → | arista_eos |
Expand Down
1 change: 0 additions & 1 deletion docs/user/lib_mapper/ntctemplates_reverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
| adva_fsp150f2 | → | adva_fsp150f2 |
| adva_fsp150f3 | → | adva_fsp150f3 |
| alcatel_aos | → | alcatel_aos |
| alcatel_sros | → | alcatel_sros |
| allied_telesis_awplus | → | allied_telesis_awplus |
| apresia_aeos | → | apresia_aeos |
| arista_eos | → | arista_eos |
Expand Down
73 changes: 38 additions & 35 deletions netutils/lib_mapper.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""Variable definitions to map from network automation library to network automation library."""

import copy
import typing as t

# AERLEON | Normalized
AERLEON_LIB_MAPPER: t.Dict[str, str] = {
AERLEON_LIB_MAPPER: dict[str, str] = {
"arista": "arista_eos",
"aruba": "aruba_aoscx",
"brocade": "brocade_nos",
Expand Down Expand Up @@ -36,7 +35,7 @@
}

# Normalized | AERLEON
AERLEON_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
AERLEON_LIB_MAPPER_REVERSE: dict[str, str] = {
"arista_eos": "arista",
"aruba_aoscx": "aruba",
"brocade_nos": "brocade",
Expand Down Expand Up @@ -65,7 +64,7 @@


# CAPIRCA | Normalized
CAPIRCA_LIB_MAPPER: t.Dict[str, str] = {
CAPIRCA_LIB_MAPPER: dict[str, str] = {
"arista": "arista_eos",
"aruba": "aruba_aoscx",
"brocade": "brocade_nos",
Expand Down Expand Up @@ -97,7 +96,7 @@
}

# Normalized | CAPIRCA
CAPIRCA_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
CAPIRCA_LIB_MAPPER_REVERSE: dict[str, str] = {
"arista_eos": "arista",
"aruba_aoscx": "aruba",
"brocade_nos": "brocade",
Expand Down Expand Up @@ -146,14 +145,14 @@
DNA_CENTER_LIB_MAPPER_REVERSE = copy.deepcopy(DNACENTER_LIB_MAPPER_REVERSE)

# Normalized | Netmiko
NETMIKO_LIB_MAPPER: t.Dict[str, str] = {
NETMIKO_LIB_MAPPER: dict[str, str] = {
"a10": "a10",
"accedian": "accedian",
"adtran_os": "adtran_os",
"adva_fsp150f2": "adva_fsp150f2",
"adva_fsp150f3": "adva_fsp150f3",
"alcatel_aos": "alcatel_aos",
"alcatel_sros": "alcatel_sros",
"alcatel_sros": "nokia_sros",
"allied_telesis_awplus": "allied_telesis_awplus",
"apresia_aeos": "apresia_aeos",
"arista_eos": "arista_eos",
Expand Down Expand Up @@ -263,8 +262,10 @@
}
# netmiko is the base name, so every key is a value, this ensure that.
# Netmiko | Normalized
NETMIKO_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
value: key for key, value in NETMIKO_LIB_MAPPER.items() if key not in ["f5_ltm", "f5_tmsh", "f5_linux"]
NETMIKO_LIB_MAPPER_REVERSE: dict[str, str] = {
value: key
for key, value in NETMIKO_LIB_MAPPER.items()
if key not in ["f5_ltm", "f5_tmsh", "f5_linux", "alcatel_sros"]
}

# ntc templates is primarily based on netmiko, so a copy is in order
Expand All @@ -276,20 +277,22 @@
_NTCTEMPLATES_LIB_MAPPER["watchguard_firebox"] = "watchguard_firebox"

# NTCTemplates | Normalized
NTCTEMPLATES_LIB_MAPPER: t.Dict[str, str] = {
NTCTEMPLATES_LIB_MAPPER: dict[str, str] = {
key: _NTCTEMPLATES_LIB_MAPPER[key] for key in sorted(_NTCTEMPLATES_LIB_MAPPER)
}
# Normalized | NTCTemplates
_NTCTEMPLATES_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
value: key for key, value in NTCTEMPLATES_LIB_MAPPER.items() if key not in ["f5_ltm", "f5_tmsh", "f5_linux"]
_NTCTEMPLATES_LIB_MAPPER_REVERSE: dict[str, str] = {
value: key
for key, value in NTCTEMPLATES_LIB_MAPPER.items()
if key not in ["f5_ltm", "f5_tmsh", "f5_linux", "alcatel_sros"]
}

_NTCTEMPLATES_LIB_MAPPER_REVERSE["cisco_xe"] = "cisco_ios" # only reverse

NTCTEMPLATES_LIB_MAPPER_REVERSE = copy.deepcopy(_NTCTEMPLATES_LIB_MAPPER_REVERSE)

# NAPALM | Normalized
NAPALM_LIB_MAPPER: t.Dict[str, str] = {
NAPALM_LIB_MAPPER: dict[str, str] = {
"aoscx": "aruba_aoscx",
"asa": "cisco_asa",
"cisco_wlc_ssh": "cisco_wlc",
Expand All @@ -310,7 +313,7 @@
}

# Running config command
RUNNING_CONFIG_MAPPER: t.Dict[str, str] = {
RUNNING_CONFIG_MAPPER: dict[str, str] = {
"adva_fsp150f2": "show running-config",
"adva_fsp150f3": "show running-config delta",
"arista_eos": "show running-config",
Expand Down Expand Up @@ -345,7 +348,7 @@
}

# PYTNC | Normalized
PYNTC_LIB_MAPPER: t.Dict[str, str] = {
PYNTC_LIB_MAPPER: dict[str, str] = {
"arista_eos_eapi": "arista_eos",
"cisco_aireos_ssh": "cisco_wlc",
"cisco_asa_ssh": "cisco_asa",
Expand All @@ -356,7 +359,7 @@
}

# Ansible | Normalized
ANSIBLE_LIB_MAPPER: t.Dict[str, str] = {
ANSIBLE_LIB_MAPPER: dict[str, str] = {
"a10.acos_axapi.a10": "a10",
"arista.eos.eos": "arista_eos",
"arubanetworks.aoscx": "aruba_aoscx",
Expand Down Expand Up @@ -392,7 +395,7 @@
}

# PYATS | Normalized
PYATS_LIB_MAPPER: t.Dict[str, str] = {
PYATS_LIB_MAPPER: dict[str, str] = {
"asa": "cisco_asa",
"bigip": "bigip_f5",
"dnac": "cisco_dnac",
Expand All @@ -407,7 +410,7 @@
}

# SCRAPLI | Normalized
SCRAPLI_LIB_MAPPER: t.Dict[str, str] = {
SCRAPLI_LIB_MAPPER: dict[str, str] = {
"arista_eos": "arista_eos",
"aruba_aoscx": "aruba_aoscx",
"cisco_iosxe": "cisco_ios",
Expand All @@ -418,7 +421,7 @@
}

# HIERCONFIG | Normalized
HIERCONFIG_LIB_MAPPER: t.Dict[str, str] = {
HIERCONFIG_LIB_MAPPER: dict[str, str] = {
"eos": "arista_eos",
"fastiron": "ruckus_fastiron",
"ios": "cisco_ios",
Expand All @@ -430,7 +433,7 @@
}

# Netutils Parser | Normalized
NETUTILSPARSER_LIB_MAPPER: t.Dict[str, str] = {
NETUTILSPARSER_LIB_MAPPER: dict[str, str] = {
"adva_fsp150f2": "adva_fsp150f2",
"adva_fsp150f3": "adva_fsp150f3",
"arista_eos": "arista_eos",
Expand Down Expand Up @@ -463,7 +466,7 @@
}

# Forward Networks Parser | Normalized
FORWARDNETWORKS_LIB_MAPPER: t.Dict[str, str] = {
FORWARDNETWORKS_LIB_MAPPER: dict[str, str] = {
"ARISTA_EOS": "arista_eos",
"ARUBA_SWITCH": "aruba_aoscx",
"ASA": "cisco_asa",
Expand All @@ -483,7 +486,7 @@
}

# NIST | Normalized
NIST_LIB_MAPPER: t.Dict[str, str] = {
NIST_LIB_MAPPER: dict[str, str] = {
"arista:eos": "arista_eos",
"arubanetworks:arubaos": "aruba_os",
"cisco:adaptive_security_appliance_software": "cisco_asa",
Expand All @@ -496,7 +499,7 @@
}

# Normalized | NAPALM
NAPALM_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
NAPALM_LIB_MAPPER_REVERSE: dict[str, str] = {
"arista_eos": "eos",
"aruba_aoscx": "aoscx",
"bigip_f5": "f5",
Expand All @@ -517,7 +520,7 @@
}

# Normalized | PYTNC
PYNTC_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
PYNTC_LIB_MAPPER_REVERSE: dict[str, str] = {
"arista_eos": "arista_eos_eapi",
"bigip_f5": "f5_tmos_icontrol",
"cisco_asa": "cisco_asa_ssh",
Expand All @@ -529,7 +532,7 @@
}

# Normalized | ANSIBLE
ANSIBLE_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
ANSIBLE_LIB_MAPPER_REVERSE: dict[str, str] = {
"a10": "a10.acos_axapi.a10",
"arista_eos": "arista.eos.eos",
"aruba_aoscx": "arubanetworks.aoscx",
Expand Down Expand Up @@ -566,7 +569,7 @@
}

# Normalized | PYATS
PYATS_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
PYATS_LIB_MAPPER_REVERSE: dict[str, str] = {
"bigip_f5": "bigip",
"cisco_asa": "asa",
"cisco_dnac": "dnac",
Expand All @@ -581,7 +584,7 @@
}

# Normalized | Scrapli
SCRAPLI_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
SCRAPLI_LIB_MAPPER_REVERSE: dict[str, str] = {
"arista_eos": "arista_eos",
"aruba_aoscx": "aruba_aoscx",
"cisco_ios": "cisco_iosxe",
Expand All @@ -593,7 +596,7 @@
}

# Normalized | HIERCONFIG
HIERCONFIG_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
HIERCONFIG_LIB_MAPPER_REVERSE: dict[str, str] = {
"arista_eos": "eos",
"cisco_ios": "ios",
"cisco_nxos": "nxos",
Expand All @@ -605,7 +608,7 @@
}

# Normalized | Netutils Parser
NETUTILSPARSER_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
NETUTILSPARSER_LIB_MAPPER_REVERSE: dict[str, str] = {
"adva_fsp150f2": "adva_fsp150f2",
"adva_fsp150f3": "adva_fsp150f3",
"arista_eos": "arista_eos",
Expand Down Expand Up @@ -639,7 +642,7 @@
}

# Normalized | Forward Networks Parser
FORWARDNETWORKS_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
FORWARDNETWORKS_LIB_MAPPER_REVERSE: dict[str, str] = {
"arista_eos": "ARISTA_EOS",
"aruba_aoscx": "ARUBA_SWITCH",
"bigip_f5": "F5",
Expand All @@ -657,7 +660,7 @@
}

# Normalized | NIST
NIST_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
NIST_LIB_MAPPER_REVERSE: dict[str, str] = {
"arista_eos": "arista:eos",
"aruba_os": "arubanetworks:arubaos",
"cisco_asa": "cisco:adaptive_security_appliance_software",
Expand Down Expand Up @@ -700,9 +703,9 @@
_MAIN_LIB_MAPPER["vmware_nsxt"] = "vmware_nsxt"
_MAIN_LIB_MAPPER["watchguard_firebox"] = "watchguard_firebox"
_MAIN_LIB_MAPPER["windows"] = "windows"
MAIN_LIB_MAPPER: t.Dict[str, str] = {key: _MAIN_LIB_MAPPER[key] for key in sorted(_MAIN_LIB_MAPPER)}
MAIN_LIB_MAPPER: dict[str, str] = {key: _MAIN_LIB_MAPPER[key] for key in sorted(_MAIN_LIB_MAPPER)}

NAME_TO_LIB_MAPPER: t.Dict[str, t.Dict[str, str]] = {
NAME_TO_LIB_MAPPER: dict[str, dict[str, str]] = {
"aerleon": AERLEON_LIB_MAPPER,
"ansible": ANSIBLE_LIB_MAPPER,
"capirca": CAPIRCA_LIB_MAPPER,
Expand All @@ -720,7 +723,7 @@
}


NAME_TO_LIB_MAPPER_REVERSE: t.Dict[str, t.Dict[str, str]] = {
NAME_TO_LIB_MAPPER_REVERSE: dict[str, dict[str, str]] = {
"aerleon": AERLEON_LIB_MAPPER_REVERSE,
"ansible": ANSIBLE_LIB_MAPPER_REVERSE,
"capirca": CAPIRCA_LIB_MAPPER_REVERSE,
Expand Down Expand Up @@ -748,7 +751,7 @@
# "ansible": "cisco.nxos.nxos",
# "napalm": "nxos",
# },
NAME_TO_ALL_LIB_MAPPER: t.Dict[str, t.Dict[str, str]] = {}
NAME_TO_ALL_LIB_MAPPER: dict[str, dict[str, str]] = {}

for tool_name, mappings in NAME_TO_LIB_MAPPER_REVERSE.items():
for normalized_name, mapped_name in mappings.items():
Expand Down
Loading