-
Notifications
You must be signed in to change notification settings - Fork 44
Added validation for CSCwd40071 #332
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6026,6 +6026,35 @@ def apic_downgrade_compat_warning_check(cversion, tversion, **kwargs): | |
| return Result(result=result, headers=headers, data=data, recommended_action=recommended_action, doc_url=doc_url) | ||
|
|
||
|
|
||
| @check_wrapper(check_title="Inband Management Policy Misconfiguration") | ||
| def inband_management_policy_misconfig_check(cversion, tversion, **kwargs): | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no extra space please. |
||
| result = PASS | ||
| headers = ["Node_ID", "Address", "Gateway"] | ||
| data = [] | ||
| recommended_action = " Contact Cisco TAC to remove any identified misconfigured 'mgmtRsInBStNode' objects" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no extra space. |
||
| doc_url = "https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#inband-management-policy-misconfiguration" | ||
|
|
||
| if not tversion: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we really need this. if you don't use this portion, does it not ask for tversion? |
||
| return Result(result=MANUAL, msg=TVER_MISSING) | ||
| if cversion.older_than("6.0(4c)") and (tversion.newer_than("6.0(4c)") or tversion.same_as("6.0(4c)")): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cVersion doesn't matter in this case.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per the mail thread shared by Welkin, even though invalid config mgmtRsInBStNode was present on system before 6.0(4c) it did not affect it. Due to the fix in CSCwh80837, when the APIC upgrade is triggered from 5.2(6g) to 6.0(9d), issue was hitting and introduced starting from 6.0(4c). The issue will only be triggered during upgrades crossing 6.0(4c) due to CSCwh80837. So we are checking the cversion less than 6.0(4c) as discussed with Welkin. Could you please confirm? |
||
| mgmtRsInBStNodes = icurl('class', 'mgmtRsInBStNode.json?query-target-filter=or(eq(mgmtRsInBStNode.addr,"0.0.0.0"),eq(mgmtRsInBStNode.addr,"0.0.0.0/0"),eq(mgmtRsInBStNode.gw,"0.0.0.0"))') | ||
| for mgmtRsInBStNode in mgmtRsInBStNodes: | ||
| attrs = mgmtRsInBStNode["mgmtRsInBStNode"]["attributes"] | ||
| addr = attrs['addr'] | ||
| gw = attrs['gw'] | ||
| node_match = re.search(node_regex, attrs['dn']) | ||
| node_id = node_match.group("node") | ||
| data.append([node_id, addr, gw]) | ||
| else: | ||
| return Result(result=NA, msg=VER_NOT_AFFECTED) | ||
|
|
||
| if data: | ||
| result = FAIL_O | ||
|
|
||
| return Result(result=result, headers=headers, data=data, recommended_action=recommended_action, doc_url=doc_url) | ||
|
|
||
|
|
||
| # ---- Script Execution ---- | ||
|
|
||
|
|
||
|
|
@@ -6188,6 +6217,7 @@ class CheckManager: | |
| standby_sup_sync_check, | ||
| isis_database_byte_check, | ||
| configpush_shard_check, | ||
| inband_management_policy_misconfig_check, | ||
|
|
||
| ] | ||
| ssh_checks = [ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [ | ||
| { | ||
| "mgmtRsInBStNode": { | ||
| "attributes": { | ||
| "tDn": "topology/pod-1/node-103", | ||
| "addr": "0.0.0.0", | ||
| "configurationMode": "static", | ||
| "dn": "uni/tn-mgmt/mgmtp-default/inb-inb/rsinBStNode-[topology/pod-1/node-103]", | ||
| "gw": "0.0.0.0", | ||
| "modTs": "2024-12-20T07:45:21.454+00:00", | ||
| "rType": "mo", | ||
| "rn": "rsinBStNode-[topology/pod-1/node-103]", | ||
| "stateQual": "none", | ||
| "tType": "mo" | ||
| } | ||
| } | ||
| } | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [ | ||
| { | ||
| "mgmtRsInBStNode": { | ||
| "attributes": { | ||
| "tDn": "topology/pod-1/node-103", | ||
| "addr": "0.0.0.0", | ||
| "configurationMode": "static", | ||
| "dn": "uni/tn-mgmt/mgmtp-default/inb-inb/rsinBStNode-[topology/pod-1/node-103]", | ||
| "gw": "191.1.1.1", | ||
| "modTs": "2024-12-20T07:45:21.454+00:00", | ||
| "rType": "mo", | ||
| "rn": "rsinBStNode-[topology/pod-1/node-103]", | ||
| "stateQual": "none", | ||
| "tType": "mo" | ||
| } | ||
| } | ||
| } | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [ | ||
| { | ||
| "mgmtRsInBStNode": { | ||
| "attributes": { | ||
| "tDn": "topology/pod-1/node-103", | ||
| "addr": "191.1.1.153/24", | ||
| "configurationMode": "static", | ||
| "dn": "uni/tn-mgmt/mgmtp-default/inb-inb/rsinBStNode-[topology/pod-1/node-103]", | ||
| "gw": "0.0.0.0", | ||
| "modTs": "2024-12-20T07:45:21.454+00:00", | ||
| "rType": "mo", | ||
| "rn": "rsinBStNode-[topology/pod-1/node-103]", | ||
| "stateQual": "none", | ||
| "tType": "mo" | ||
| } | ||
| } | ||
| } | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| import os | ||
| import pytest | ||
| import logging | ||
| import importlib | ||
| from helpers.utils import read_data | ||
|
|
||
| script = importlib.import_module("aci-preupgrade-validation-script") | ||
|
|
||
| log = logging.getLogger(__name__) | ||
| dir = os.path.dirname(os.path.abspath(__file__)) | ||
|
|
||
| test_function = "inband_management_policy_misconfig_check" | ||
|
|
||
| # icurl query | ||
| mgmtRsInBStNode = 'mgmtRsInBStNode.json?query-target-filter=or(eq(mgmtRsInBStNode.addr,"0.0.0.0"),eq(mgmtRsInBStNode.addr,"0.0.0.0/0"),eq(mgmtRsInBStNode.gw,"0.0.0.0"))' | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "icurl_outputs, cversion, tversion, expected_result", | ||
| [ | ||
| # Target version missing | ||
| ( | ||
| { | ||
| mgmtRsInBStNode: read_data(dir, "mgmtRsInBStNode_invalid_addr_and_gw_config.json"), | ||
| }, | ||
| "5.2(5c)", | ||
| None, | ||
| script.MANUAL, | ||
| ), | ||
| # Current version < 6.0(4c), target version = 6.0(4c), valid data | ||
| ( | ||
| { | ||
| mgmtRsInBStNode: [], | ||
| }, | ||
| "6.0(3g)", | ||
| "6.0(4c)", | ||
| script.PASS, | ||
| ), | ||
| # Current version < 6.0(4c), target version > 6.0(4c), valid data | ||
| ( | ||
| { | ||
| mgmtRsInBStNode: [], | ||
| }, | ||
| "6.0(3e)", | ||
| "6.0(8f)", | ||
| script.PASS, | ||
| ), | ||
| # Current version > 6.0(4c), target version >= 6.0(4c), invalid address | ||
| ( | ||
| { | ||
| mgmtRsInBStNode: read_data(dir, "mgmtRsInBStNode_invalid_address_config.json"), | ||
| }, | ||
| "6.0(4c)", | ||
| "6.0(5h)", | ||
| script.NA, | ||
| ), | ||
|
|
||
| # Current version > 6.0(4c), target version >= 6.0(4c), invalid gateway | ||
| ( | ||
| { | ||
| mgmtRsInBStNode: read_data(dir, "mgmtRsInBStNode_invalid_gateway_config.json"), | ||
| }, | ||
| "6.0(5h)", | ||
| "6.0(5j)", | ||
| script.NA, | ||
| ), | ||
| # Current version > 6.0(4c), target version >= 6.0(4c), invalid both data | ||
| ( | ||
| { | ||
| mgmtRsInBStNode: read_data(dir, "mgmtRsInBStNode_invalid_addr_and_gw_config.json"), | ||
| }, | ||
| "6.0(5j)", | ||
| "6.0(6c)", | ||
| script.NA, | ||
| ), | ||
| # Current version < 6.0(4c), target version < 6.0(4c), invalid both data | ||
| ( | ||
| { | ||
| mgmtRsInBStNode: read_data(dir, "mgmtRsInBStNode_invalid_addr_and_gw_config.json"), | ||
| }, | ||
| "6.0(3g)", | ||
| "6.0(3f)", | ||
| script.NA, | ||
| ), | ||
| # Current version < 6.0(4c), target version >= 6.0(4c), invalid address | ||
| ( | ||
| { | ||
| mgmtRsInBStNode: read_data(dir, "mgmtRsInBStNode_invalid_address_config.json"), | ||
| }, | ||
| "6.0(3g)", | ||
| "6.0(4c)", | ||
| script.FAIL_O, | ||
| ), | ||
| # Current version < 6.0(4c), target version >= 6.0(4c), invalid gateway | ||
| ( | ||
| { | ||
| mgmtRsInBStNode: read_data(dir, "mgmtRsInBStNode_invalid_gateway_config.json"), | ||
| }, | ||
| "5.3(2c)", | ||
| "6.1(4h)", | ||
| script.FAIL_O, | ||
| ), | ||
| # Current version < 6.0(4c), target version >= 6.0(4c), invalid both data | ||
| ( | ||
| { | ||
| mgmtRsInBStNode: read_data(dir, "mgmtRsInBStNode_invalid_addr_and_gw_config.json"), | ||
| }, | ||
| "5.2(8h)", | ||
| "6.1(3f)", | ||
| script.FAIL_O, | ||
| ), | ||
| ], | ||
| ) | ||
| def test_logic(run_check, mock_icurl, cversion, tversion, expected_result): | ||
| result = run_check( | ||
| cversion = script.AciVersion(cversion), | ||
| tversion = script.AciVersion(tversion) if tversion else None, | ||
| ) | ||
| assert result.result == expected_result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change it to mgmtRsInBStNode Missconfig check