-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial fabric_port_down_check function (#114)
* initial fabric_port_down_check function * fabric_port_down_check check + tests + doc * Update aci-preupgrade-validation-script.py Co-authored-by: takishida <[email protected]> * Update aci-preupgrade-validation-script.py Co-authored-by: takishida <[email protected]> --------- Co-authored-by: takishida <[email protected]>
- Loading branch information
Showing
4 changed files
with
153 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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,29 @@ | ||
[ | ||
{ | ||
"faultInst": { | ||
"attributes": { | ||
"descr": "Port is down, reason:err-disabled-link-flaps(err-disabled), used by:Fabric", | ||
"dn": "topology/pod-1/node-105/sys/phys-[eth1/53]/phys/fault-F1394", | ||
"rule": "ethpm-if-port-down-fabric" | ||
} | ||
} | ||
}, | ||
{ | ||
"faultInst": { | ||
"attributes": { | ||
"descr": "Port is down, reason:linkNotConnected(connected), used by:Fabric", | ||
"dn": "topology/pod-1/node-101/sys/phys-[eth1/53]/phys/fault-F1394", | ||
"rule": "ethpm-if-port-down-fabric" | ||
} | ||
} | ||
}, | ||
{ | ||
"faultInst": { | ||
"attributes": { | ||
"descr": "Port is down, reason:linkNotConnected(connected), used by:Fabric", | ||
"dn": "topology/pod-1/node-102/sys/phys-eth1/53/phys/fault-F1394", | ||
"rule": "ethpm-if-port-down-fabric" | ||
} | ||
} | ||
} | ||
] |
38 changes: 38 additions & 0 deletions
38
tests/fabric_port_down_check/test_fabric_port_down_check.py
This file contains 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,38 @@ | ||
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__)) | ||
|
||
|
||
# icurl queries | ||
faultInsts = 'faultInst.json' | ||
faultInsts += '?&query-target-filter=and(eq(faultInst.code,"F1394")' | ||
faultInsts += ',eq(faultInst.rule,"ethpm-if-port-down-fabric"))' | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"icurl_outputs, expected_result", | ||
[ | ||
( | ||
{ | ||
faultInsts: read_data(dir, "faultInst_pos.json"), | ||
}, | ||
script.FAIL_O, | ||
), | ||
( | ||
{ | ||
faultInsts: [], | ||
}, | ||
script.PASS, | ||
), | ||
], | ||
) | ||
def test_logic(mock_icurl, expected_result): | ||
result = script.fabric_port_down_check(1, 1) | ||
assert result == expected_result |