Skip to content

Commit

Permalink
chore: auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Nov 15, 2024
1 parent 6d645f0 commit 0f19fe4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
Vrf_address_familyTemplate,
)


class Vrf_address_family(ResourceModule):
"""
The nxos_vrf_address_family config class
Expand Down Expand Up @@ -114,10 +115,10 @@ def _compare_vrf_afs(self, want, have):
haafs = have.get("address_families", {})

address_fam_list = [
("ipv4", "unicast"),
("ipv6", "unicast"),
("ipv4", "multicast"),
("ipv6", "multicast")
("ipv4", "unicast"),
("ipv6", "unicast"),
("ipv4", "multicast"),
("ipv6", "multicast"),
]

for item in address_fam_list:
Expand All @@ -130,9 +131,12 @@ def _compare_vrf_afs(self, want, have):
self._compare_single_af(wantaf={}, haveaf=afv)
if len(self.commands) != begin:
self.commands.insert(
begin, self._tmplt.render({"afi": item[0], "safi": item[1]},
"address_family",
False)
begin,
self._tmplt.render(
{"afi": item[0], "safi": item[1]},
"address_family",
False,
),
)

def _compare_single_af(self, wantaf, haveaf):
Expand Down Expand Up @@ -184,7 +188,9 @@ def _convert_to_dict(self, vrf_af_item: list, parser_item: str) -> dict:

def _filter_have_to_want(self, haved, wantd):
if isinstance(haved, dict) and isinstance(wantd, dict):
filtered = {k: self._filter_have_to_want(haved[k], wantd[k]) for k in haved if k in wantd}
filtered = {
k: self._filter_have_to_want(haved[k], wantd[k]) for k in haved if k in wantd
}
return {k: v for k, v in filtered.items() if v not in [None, {}, []]}
elif isinstance(haved, list) and isinstance(wantd, list):
filtered_list = []
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/modules/network/nxos/test_nxos_vrf_address_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,13 +690,13 @@ def test_vrf_af_deleted(self):
),
)
commands = [
'vrf context VRF2',
'address-family ipv4 unicast',
'no maximum routes 500 60 reinstall 80',
'no route-target export 65512:200',
'no export map 22',
'no export vrf default map 44 allow-vpn',
'no export vrf allow-vpn'
"vrf context VRF2",
"address-family ipv4 unicast",
"no maximum routes 500 60 reinstall 80",
"no route-target export 65512:200",
"no export map 22",
"no export vrf default map 44 allow-vpn",
"no export vrf allow-vpn",
]
result = self.execute_module(changed=True)
self.assertEqual(sorted(result["commands"]), sorted(commands))
self.assertEqual(sorted(result["commands"]), sorted(commands))

0 comments on commit 0f19fe4

Please sign in to comment.