-
Notifications
You must be signed in to change notification settings - Fork 48
Added APIC OOB connectivity checks for CSCwu91693 #418
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
Open
Priyanka-Patil14
wants to merge
5
commits into
datacenter:v4.2.0-dev
Choose a base branch
from
Priyanka-Patil14:CSCwu91693-apic-oob
base: v4.2.0-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b0bea57
Added APIC OOB connectivity checks for CSCwu91693
Priyanka-Patil14 f954a9a
Added APIC OOB connectivity check
Priyanka-Patil14 eeb6f10
Updated aci-preupgrade-validation-script.py & docs/docs/validations.md
Priyanka-Patil14 730be06
Addressed PR comments
Priyanka-Patil14 6f76f21
Addressed PR review comments
Priyanka-Patil14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
tests/checks/apic_oob_connectivity_check/commHttps_custom_port.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [ | ||
| { | ||
| "commHttps": { | ||
| "attributes": { | ||
| "port": "8443" | ||
| } | ||
| } | ||
| } | ||
| ] |
9 changes: 9 additions & 0 deletions
9
tests/checks/apic_oob_connectivity_check/commHttps_default_port.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [ | ||
| { | ||
| "commHttps": { | ||
| "attributes": { | ||
| "port": "443" | ||
| } | ||
| } | ||
| } | ||
| ] |
1 change: 1 addition & 0 deletions
1
tests/checks/apic_oob_connectivity_check/commHttps_invalid_port.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [{"commHttps": {"attributes": {"port": "invalid"}}}] |
159 changes: 159 additions & 0 deletions
159
tests/checks/apic_oob_connectivity_check/test_apic_oob_connectivity_check.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| 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 = "apic_oob_connectivity_check" | ||
|
|
||
| # icurl queries | ||
| topSystem = 'topSystem.json?query-target-filter=eq(topSystem.role,"controller")' | ||
| commHttps = "commHttps.json" | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "icurl_outputs, cversion, tversion, curl_exit_codes, expected_result", | ||
| [ | ||
| # tversion not provided -> MANUAL | ||
| ( | ||
| {topSystem: [], commHttps: []}, | ||
| "6.0(2a)", | ||
| None, | ||
| [], | ||
| script.MANUAL, | ||
| ), | ||
| # tversion < 6.0(2a) -> NA (version not affected) | ||
| ( | ||
| {topSystem: [], commHttps: []}, | ||
| "5.2(7f)", | ||
| "5.2(7f)", | ||
| [], | ||
| script.NA, | ||
| ), | ||
| # tversion >= 6.0(2a), no controller nodes found -> NA | ||
| ( | ||
| {topSystem: [], commHttps: []}, | ||
| "6.0(2a)", | ||
| "6.0(3a)", | ||
| [], | ||
| script.NA, | ||
| ), | ||
| # tversion >= 6.0(2a), all APICs have no OOB configured -> PASS | ||
| ( | ||
| {topSystem: read_data(dir, "topSystem_no_oob.json"), commHttps: []}, | ||
| "6.0(2a)", | ||
| "6.0(3a)", | ||
| [], | ||
| script.PASS, | ||
| ), | ||
| # tversion >= 6.0(2a), all APICs reachable on port 443 -> PASS | ||
| ( | ||
| {topSystem: read_data(dir, "topSystem_3apics_oob.json"), commHttps: []}, | ||
| "6.0(2a)", | ||
| "6.0(3a)", | ||
| [0, 0, 0], | ||
| script.PASS, | ||
| ), | ||
| # cversion >= 6.2(1g), default port 443, all APICs reachable -> PASS | ||
| # (custom port check skipped since commHttps port == 443) | ||
| ( | ||
| { | ||
| topSystem: read_data(dir, "topSystem_3apics_oob.json"), | ||
| commHttps: read_data(dir, "commHttps_default_port.json"), | ||
| }, | ||
| "6.2(1g)", | ||
| "6.2(2a)", | ||
| [0, 0, 0], | ||
| script.PASS, | ||
| ), | ||
| # cversion >= 6.2(1g), custom port 8443, all APICs reachable on both ports -> PASS | ||
| # (default port 443: [0,0,0], custom port 8443: [0,0,0]) | ||
| ( | ||
| { | ||
| topSystem: read_data(dir, "topSystem_3apics_oob.json"), | ||
| commHttps: read_data(dir, "commHttps_custom_port.json"), | ||
| }, | ||
| "6.2(1g)", | ||
| "6.2(2a)", | ||
| [0, 0, 0, 0, 0, 0], | ||
| script.PASS, | ||
| ), | ||
| # tversion >= 6.0(2a), one APIC unreachable on port 443 (exit 28) -> FAIL_UF | ||
| ( | ||
| {topSystem: read_data(dir, "topSystem_3apics_oob.json"), commHttps: []}, | ||
| "6.0(2a)", | ||
| "6.0(3a)", | ||
| [0, 28, 0], | ||
| script.FAIL_UF, | ||
| ), | ||
| # cversion >= 6.2(1g), one APIC unreachable on default port 443 (exit 7) -> FAIL_UF | ||
| ( | ||
| { | ||
| topSystem: read_data(dir, "topSystem_3apics_oob.json"), | ||
| commHttps: read_data(dir, "commHttps_default_port.json"), | ||
| }, | ||
| "6.2(1g)", | ||
| "6.2(2a)", | ||
| [0, 7, 0], | ||
| script.FAIL_UF, | ||
| ), | ||
| # cversion >= 6.2(1g), custom port 8443, all unreachable on custom port -> FAIL_UF | ||
| # (default port 443 all pass: [0,0,0], custom port 8443 all fail: [28,28,28]) | ||
| ( | ||
| { | ||
| topSystem: read_data(dir, "topSystem_3apics_oob.json"), | ||
| commHttps: read_data(dir, "commHttps_custom_port.json"), | ||
| }, | ||
| "6.2(1g)", | ||
| "6.2(2a)", | ||
| [0, 0, 0, 28, 28, 28], | ||
| script.FAIL_UF, | ||
| ), | ||
| # cversion >= 6.2(1g), commHttps returns invalid port value -> ERROR | ||
| ( | ||
| { | ||
| topSystem: read_data(dir, "topSystem_3apics_oob.json"), | ||
| commHttps: read_data(dir, "commHttps_invalid_port.json"), | ||
| }, | ||
| "6.2(1g)", | ||
| "6.2(2a)", | ||
| [0, 0, 0], | ||
| script.ERROR, | ||
| ), | ||
| # IPv6 OOB, all APICs reachable -> PASS | ||
| ( | ||
| {topSystem: read_data(dir, "topSystem_3apics_oob_ipv6.json"), commHttps: []}, | ||
| "6.0(2a)", | ||
| "6.0(3a)", | ||
| [0, 0, 0], | ||
| script.PASS, | ||
| ), | ||
| # IPv6 OOB, one APIC unreachable (exit 28) -> FAIL_UF | ||
| ( | ||
| {topSystem: read_data(dir, "topSystem_3apics_oob_ipv6.json"), commHttps: []}, | ||
| "6.0(2a)", | ||
| "6.0(3a)", | ||
| [0, 28, 0], | ||
| script.FAIL_UF, | ||
| ), | ||
| ], | ||
| ) | ||
| def test_logic(run_check, mock_icurl, monkeypatch, cversion, tversion, curl_exit_codes, expected_result): | ||
| idx = [0] | ||
|
|
||
| def mock_subprocess_call(cmd, shell=False): | ||
| code = curl_exit_codes[idx[0]] if idx[0] < len(curl_exit_codes) else 0 | ||
| idx[0] += 1 | ||
| return code | ||
|
|
||
| monkeypatch.setattr(script.subprocess, "call", mock_subprocess_call) | ||
| result = run_check( | ||
| cversion=script.AciVersion(cversion), | ||
| tversion=script.AciVersion(tversion) if tversion else None, | ||
| ) | ||
| assert result.result == expected_result |
32 changes: 32 additions & 0 deletions
32
tests/checks/apic_oob_connectivity_check/topSystem_3apics_oob.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| [ | ||
|
Priyanka-Patil14 marked this conversation as resolved.
|
||
| { | ||
| "topSystem": { | ||
| "attributes": { | ||
| "id": "1", | ||
| "role": "controller", | ||
| "oobMgmtAddr": "10.30.10.189", | ||
| "oobMgmtAddr6": "::" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "topSystem": { | ||
| "attributes": { | ||
| "id": "2", | ||
| "role": "controller", | ||
| "oobMgmtAddr": "10.30.10.191", | ||
| "oobMgmtAddr6": "::" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "topSystem": { | ||
| "attributes": { | ||
| "id": "3", | ||
| "role": "controller", | ||
| "oobMgmtAddr": "10.30.10.193", | ||
| "oobMgmtAddr6": "::" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
32 changes: 32 additions & 0 deletions
32
tests/checks/apic_oob_connectivity_check/topSystem_3apics_oob_ipv6.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| [ | ||
| { | ||
| "topSystem": { | ||
| "attributes": { | ||
| "id": "1", | ||
| "role": "controller", | ||
| "oobMgmtAddr": "0.0.0.0", | ||
| "oobMgmtAddr6": "2001:db8::1" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "topSystem": { | ||
| "attributes": { | ||
| "id": "2", | ||
| "role": "controller", | ||
| "oobMgmtAddr": "0.0.0.0", | ||
| "oobMgmtAddr6": "2001:db8::2" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "topSystem": { | ||
| "attributes": { | ||
| "id": "3", | ||
| "role": "controller", | ||
| "oobMgmtAddr": "0.0.0.0", | ||
| "oobMgmtAddr6": "2001:db8::3" | ||
| } | ||
| } | ||
| } | ||
| ] |
12 changes: 12 additions & 0 deletions
12
tests/checks/apic_oob_connectivity_check/topSystem_no_oob.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [ | ||
| { | ||
| "topSystem": { | ||
| "attributes": { | ||
| "id": "1", | ||
| "role": "controller", | ||
| "oobMgmtAddr": "0.0.0.0", | ||
| "oobMgmtAddr6": "::" | ||
| } | ||
| } | ||
| } | ||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.