Skip to content
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
26 changes: 16 additions & 10 deletions aci-preupgrade-validation-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -5978,9 +5978,9 @@ def aes_encryption_check(tversion, **kwargs):
@check_wrapper(check_title='Service Graph BD Forceful Routing')
def service_bd_forceful_routing_check(cversion, tversion, **kwargs):
result = PASS
headers = ["Bridge Domain (Tenant:BD)", "Service Graph Device (Tenant:Device)"]
headers = ["Bridge Domain (Tenant:BD)", "Contract (Tenant:Contract)", "Service Graph (Tenant:Service Graph)", "Node", "Connector"]
data = []
unformatted_headers = ["DN of fvRtEPpInfoToBD"]
unformatted_headers = ["DN of fvRtLIfCtxToBD"]
unformatted_data = []
recommended_action = (
"\n\tConfirm that within these BDs there is no bridging traffic with the destination IP that doesn't belong to them."
Expand All @@ -5995,18 +5995,24 @@ def service_bd_forceful_routing_check(cversion, tversion, **kwargs):
return Result(result=NA, msg=VER_NOT_AFFECTED)

dn_regex = r"uni/tn-(?P<bd_tn>[^/]+)/BD-(?P<bd>[^/]+)/"
dn_regex += r"rtvnsEPpInfoToBD-\[uni/tn-(?P<sg_tn>[^/])+/LDevInst-\[uni/tn-(?P<ldev_tn>[^/]+)/lDevVip-(?P<ldev>[^\]]+)\].*\]"

fvRtEPpInfoToBDs = icurl("class", "fvRtEPpInfoToBD.json")
for fvRtEPpInfoToBD in fvRtEPpInfoToBDs:
m = re.search(dn_regex, fvRtEPpInfoToBD["fvRtEPpInfoToBD"]["attributes"]["dn"])
dn_regex += r"rtvnsLIfCtxToBD-\[uni/tn-(?P<ldevctx_tn>[^/]+)/"
dn_regex += r"ldevCtx-c-(?P<contract>.+?)-g-(?P<graph>.+?)-n-(?P<node>.+?)/"
dn_regex += r"lIfCtx-c-(?P<conn>[^\]]+)\]"

fvRtLIfCtxToBDs = icurl("class", "fvRtLIfCtxToBD.json")
for fvRtLIfCtxToBD in fvRtLIfCtxToBDs:
dn = fvRtLIfCtxToBD["fvRtLIfCtxToBD"]["attributes"]["dn"]
m = re.search(dn_regex, dn)
if not m:
log.error("Failed to match %s", fvRtEPpInfoToBD["fvRtEPpInfoToBD"]["attributes"]["dn"])
unformatted_data.append([fvRtEPpInfoToBD["fvRtEPpInfoToBD"]["attributes"]["dn"]])
log.error("Failed to match %s", dn)
unformatted_data.append([dn])
continue
data.append([
"{}:{}".format(m.group("bd_tn"), m.group("bd")),
"{}:{}".format(m.group("ldev_tn"), m.group("ldev")),
"{}:{}".format(m.group("ldevctx_tn"), m.group("contract")),
"{}:{}".format(m.group("ldevctx_tn"), m.group("graph")),
m.group("node"),
m.group("conn"),
])

if data or unformatted_data:
Expand Down

This file was deleted.

93 changes: 93 additions & 0 deletions tests/checks/service_bd_forceful_routing_check/fvRtLIfCtxToBD.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
[
{
"fvRtLIfCtxToBD": {
"attributes": {
"childAction": "",
"dn": "uni/tn-TK/BD-BD4/rtvnsLIfCtxToBD-[uni/tn-TK/ldevCtx-c-N9K_PBR_C-g-N9K_PBR-n-N1/lIfCtx-c-provider]",
"lcOwn": "local",
"modTs": "2026-09-04T17:33:01.891-07:00",
"status": "",
"tCl": "vnsLIfCtx",
"tDn": "uni/tn-TK/ldevCtx-c-N9K_PBR_C-g-N9K_PBR-n-N1/lIfCtx-c-provider"
}
}
},
{
"fvRtLIfCtxToBD": {
"attributes": {
"childAction": "",
"dn": "uni/tn-TK/BD-BD3/rtvnsLIfCtxToBD-[uni/tn-TK/ldevCtx-c-N9K_PBR_C-g-N9K_PBR-n-N1/lIfCtx-c-consumer]",
"lcOwn": "local",
"modTs": "2026-09-04T17:33:01.891-07:00",
"status": "",
"tCl": "vnsLIfCtx",
"tDn": "uni/tn-TK/ldevCtx-c-N9K_PBR_C-g-N9K_PBR-n-N1/lIfCtx-c-consumer"
}
}
},
{
"fvRtLIfCtxToBD": {
"attributes": {
"childAction": "",
"dn": "uni/tn-TK/BD-BD_PBR/rtvnsLIfCtxToBD-[uni/tn-TK/ldevCtx-c-PBR-g-FW_PBR-n-N1/lIfCtx-c-provider]",
"lcOwn": "local",
"modTs": "2026-07-07T21:34:53.735-07:00",
"status": "",
"tCl": "vnsLIfCtx",
"tDn": "uni/tn-TK/ldevCtx-c-PBR-g-FW_PBR-n-N1/lIfCtx-c-provider"
}
}
},
{
"fvRtLIfCtxToBD": {
"attributes": {
"childAction": "",
"dn": "uni/tn-TK/BD-BD_PBR/rtvnsLIfCtxToBD-[uni/tn-TK/ldevCtx-c-PBR-g-FW_PBR-n-N1/lIfCtx-c-consumer]",
"lcOwn": "local",
"modTs": "2026-07-07T21:34:53.735-07:00",
"status": "",
"tCl": "vnsLIfCtx",
"tDn": "uni/tn-TK/ldevCtx-c-PBR-g-FW_PBR-n-N1/lIfCtx-c-consumer"
}
}
},
{
"fvRtLIfCtxToBD": {
"attributes": {
"childAction": "",
"dn": "uni/tn-TK/BD-BD_PBR_inside/rtvnsLIfCtxToBD-[uni/tn-common/ldevCtx-c-CMN_LB_C-g-CMN_LB-n-N1/lIfCtx-c-cluster-if1]",
"lcOwn": "local",
"modTs": "2026-09-04T17:35:11.123-07:00",
"status": "",
"tCl": "vnsLIfCtx",
"tDn": "uni/tn-common/ldevCtx-c-CMN_LB_C-g-CMN_LB-n-N1/lIfCtx-c-cluster-if1"
}
}
},
{
"fvRtLIfCtxToBD": {
"attributes": {
"childAction": "",
"dn": "uni/tn-TK/BD-BD_PBR_outside/rtvnsLIfCtxToBD-[uni/tn-common/ldevCtx-c-CMN_LB_C-g-CMN_LB-n-N1/lIfCtx-c-cluster-if1]",
"lcOwn": "local",
"modTs": "2026-09-04T17:35:11.123-07:00",
"status": "",
"tCl": "vnsLIfCtx",
"tDn": "uni/tn-common/ldevCtx-c-CMN_LB_C-g-CMN_LB-n-N1/lIfCtx-c-cluster-if1"
}
}
},
{
"fvRtLIfCtxToBD": {
"attributes": {
"childAction": "",
"dn": "uni/tn-TK/BD-BD1/rtvnsLIfCtxToBD-[unexpected-dn-format]",
"lcOwn": "local",
"modTs": "2026-09-04T17:36:22.456-07:00",
"status": "",
"tCl": "vnsLIfCtx",
"tDn": "unexpected-dn-format"
}
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,71 @@
test_function = "service_bd_forceful_routing_check"

# icurl queries
fvRtEPpInfoToBD = "fvRtEPpInfoToBD.json"
fvRtLIfCtxToBD = "fvRtLIfCtxToBD.json"


@pytest.mark.parametrize(
"icurl_outputs, cversion, tversion, expected_result",
"icurl_outputs, cversion, tversion, expected_result, expected_data, expected_unformatted_data",
[
# tversion missing
(
{fvRtEPpInfoToBD: read_data(dir, "fvRtEPpInfoToBD.json")},
{fvRtLIfCtxToBD: read_data(dir, "fvRtLIfCtxToBD.json")},
"5.2(8h)",
None,
script.MANUAL
script.MANUAL,
[],
[],
),
# Version not affected (both new)
(
{fvRtEPpInfoToBD: read_data(dir, "fvRtEPpInfoToBD.json")},
{fvRtLIfCtxToBD: read_data(dir, "fvRtLIfCtxToBD.json")},
"6.0(2h)",
"6.1(3b)",
script.NA,
[],
[],
),
# Version not affected (both old)
(
{fvRtEPpInfoToBD: read_data(dir, "fvRtEPpInfoToBD.json")},
{fvRtLIfCtxToBD: read_data(dir, "fvRtLIfCtxToBD.json")},
"4.2(7s)",
"6.0(1h)",
script.NA,
[],
[],
),
# Version affected with L4L7 service graph BD
(
{fvRtEPpInfoToBD: read_data(dir, "fvRtEPpInfoToBD.json")},
{fvRtLIfCtxToBD: read_data(dir, "fvRtLIfCtxToBD.json")},
"5.2(8h)",
"6.0(2h)",
script.MANUAL
script.MANUAL,
[
["TK:BD4", "TK:N9K_PBR_C", "TK:N9K_PBR", "N1", "provider"],
["TK:BD3", "TK:N9K_PBR_C", "TK:N9K_PBR", "N1", "consumer"],
["TK:BD_PBR", "TK:PBR", "TK:FW_PBR", "N1", "provider"],
["TK:BD_PBR", "TK:PBR", "TK:FW_PBR", "N1", "consumer"],
["TK:BD_PBR_inside", "common:CMN_LB_C", "common:CMN_LB", "N1", "cluster-if1"],
["TK:BD_PBR_outside", "common:CMN_LB_C", "common:CMN_LB", "N1", "cluster-if1"],
],
[["uni/tn-TK/BD-BD1/rtvnsLIfCtxToBD-[unexpected-dn-format]"]],
),
# Version affected without L4L7 service graph BD
(
{fvRtEPpInfoToBD: []},
{fvRtLIfCtxToBD: []},
"5.2(8h)",
"6.0(2h)",
script.PASS,
[],
[],
),
],
)
def test_logic(run_check, mock_icurl, cversion, tversion, expected_result):
def test_logic(run_check, mock_icurl, cversion, tversion, expected_result, expected_data, expected_unformatted_data):
result = run_check(
cversion=script.AciVersion(cversion),
tversion=script.AciVersion(tversion) if tversion else None,
)
assert result.result == expected_result
assert result.data == expected_data
assert result.unformatted_data == expected_unformatted_data
Loading