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

fix empty imdata result + add empty imdata test #151

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
24 changes: 11 additions & 13 deletions aci-preupgrade-validation-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -2944,19 +2944,17 @@ def uplink_limit_check(index, total_checks, cversion, tversion, **kwargs):

if cversion.older_than("6.0(1a)") and tversion.newer_than("6.0(1a)"):
port_profiles = icurl('class', 'eqptPortP.json?query-target-filter=eq(eqptPortP.ctrl,"uplink")')
if not port_profiles or (len(port_profiles) < 57):
return result

node_count = {}
for pp in port_profiles:
dn = re.search(node_regex, pp['eqptPortP']['attributes']['dn'])
node_id = dn.group("node")
node_count.setdefault(node_id, 0)
node_count[node_id] += 1

for node, count in node_count.items():
if count > 56:
data.append([node, count])
if len(port_profiles) > 56:
node_count = {}
for pp in port_profiles:
dn = re.search(node_regex, pp['eqptPortP']['attributes']['dn'])
node_id = dn.group("node")
node_count.setdefault(node_id, 0)
node_count[node_id] += 1

for node, count in node_count.items():
if count > 56:
data.append([node, count])

if data:
result = FAIL_O
Expand Down
1 change: 1 addition & 0 deletions tests/uplink_limit_check/eqptPortP_empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
8 changes: 8 additions & 0 deletions tests/uplink_limit_check/test_uplink_limit_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
"6.0(2h)",
script.FAIL_O,
),
(
{
eqptPortP: read_data(dir, "eqptPortP_empty.json")
},
"5.2(3g)",
"6.0(2h)",
script.PASS,
),
(
{
eqptPortP: read_data(dir, "eqptPortP_POS.json")
Expand Down