Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #552 wrong xe to ntc templates mapping #553

Merged
merged 2 commits into from
Aug 5, 2024
Merged
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
2 changes: 1 addition & 1 deletion docs/user/lib_mapper/ntctemplates.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
| cisco_s300 | → | cisco_s300 |
| cisco_tp | → | cisco_tp |
| cisco_wlc | → | cisco_wlc |
| cisco_xe | → | cisco_xe |
| cisco_xe | → | cisco_ios |
| cisco_xr | → | cisco_xr |
| cloudgenix_ion | → | cloudgenix_ion |
| coriant | → | coriant |
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 @@ -33,7 +33,6 @@
| cisco_s300 | → | cisco_s300 |
| cisco_tp | → | cisco_tp |
| cisco_wlc | → | cisco_wlc |
| cisco_xe | → | cisco_xe |
| cisco_xr | → | cisco_xr |
| cloudgenix_ion | → | cloudgenix_ion |
| coriant | → | coriant |
Expand Down
5 changes: 4 additions & 1 deletion netutils/lib_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +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" # 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 @@ -270,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
Loading