Skip to content

Commit

Permalink
ignore reverse for new mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkala committed Jul 16, 2024
1 parent 768437b commit 9dfe4dd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/user/lib_mapper/ntctemplates_reverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
| ciena_saos || ciena_saos |
| cisco_asa || cisco_asa |
| cisco_ftd || cisco_ftd |
| cisco_ios || cisco_xe |
| cisco_ios || cisco_ios |
| cisco_nxos || cisco_nxos |
| cisco_s300 || cisco_s300 |
| cisco_tp || cisco_tp |
Expand Down
6 changes: 4 additions & 2 deletions netutils/lib_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
# ntc templates is primarily based on netmiko, so a copy is in order
_NTCTEMPLATES_LIB_MAPPER = copy.deepcopy(NETMIKO_LIB_MAPPER)
_NTCTEMPLATES_LIB_MAPPER["aruba_aoscx"] = "aruba_aoscx"
_NTCTEMPLATES_LIB_MAPPER["cisco_xe"] = "cisco_ios"
_NTCTEMPLATES_LIB_MAPPER["cisco_xe"] = "cisco_ios" # no reverse
_NTCTEMPLATES_LIB_MAPPER["huawei_vrp"] = "huawei_vrp"
_NTCTEMPLATES_LIB_MAPPER["vmware_nsxv"] = "vmware_nsxv"
_NTCTEMPLATES_LIB_MAPPER["watchguard_firebox"] = "watchguard_firebox"
Expand All @@ -271,7 +271,9 @@
}
# 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"]
value: key
for key, value in NTCTEMPLATES_LIB_MAPPER.items()
if key not in ["f5_ltm", "f5_tmsh", "f5_linux", "cisco_xe"]
}


Expand Down
7 changes: 6 additions & 1 deletion tests/unit/test_lib_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@ def test_lib_mapper_reverse(lib):
_mapper = getattr(lib_mapper, f"{lib}_LIB_MAPPER").copy()
if lib == "NAPALM":
_mapper.pop("nxos_ssh")
if lib in ["NETMIKO", "NTCTEMPLATES"]:
if lib == "NETMIKO":
_mapper.pop("f5_ltm")
_mapper.pop("f5_tmsh")
_mapper.pop("f5_linux")
if lib == "NTCTEMPLATES":
_mapper.pop("f5_ltm")
_mapper.pop("f5_tmsh")
_mapper.pop("f5_linux")
_mapper.pop("cisco_xe")
if lib in [
"AERLEON",
"ANSIBLE",
Expand Down

0 comments on commit 9dfe4dd

Please sign in to comment.