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
50 changes: 50 additions & 0 deletions aci-preupgrade-validation-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -7320,6 +7320,55 @@ def infravlan_overlap_access_policy_check(tversion, **kwargs):
return Result(result=result, msg=msg, headers=headers, data=data, unformatted_headers=unformatted_headers, unformatted_data=unformatted_data, recommended_action=recommended_action, doc_url=doc_url)


@check_wrapper(check_title='Host Interface Policy Set to Auto')
def host_interface_policy_set_speed_check(tversion, **kwargs):
result = PASS
headers = [
"Host Interface Policy",
"Set Speed",
"Associated Interface Policy Group",
"Group Type",
]
data = []
recommended_action = 'Change the speed to "inherit" to avoid issues with interfaces upon stateless reboot'
doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#host-interface-policy-set-to-auto'
if not tversion:
return Result(result=MANUAL, msg=TVER_MISSING)

policy_group_types = {
"infraAccPortGrp": ("accportgrp-", "Leaf Access"),
"infraAccBndlGrp": ("accbundle-", "PC/vPC"),
"infraAccBndlPolGrp": ("accbundlepolgrp-", "PC/vPC Override"),
"infraSpAccPortGrp": ("spaccportgrp-", "Spine Access"),
}
host_interface_policy_api = 'fabricHIfPol.json'
host_interface_policy_api += '?query-target-filter=and(eq(fabricHIfPol.speed,"auto"))'
host_interface_policy_api += '&rsp-subtree=children&rsp-subtree-class=fabricRtHIfPol'
host_interface_policies = icurl('class', host_interface_policy_api)
if host_interface_policies:
for host_interface_policy in host_interface_policies:
if "children" in host_interface_policy["fabricHIfPol"]:
for policy_group in host_interface_policy["fabricHIfPol"]["children"]:
policy_group_attributes = policy_group["fabricRtHIfPol"]["attributes"]
policy_group_class = policy_group_attributes["tCl"]
policy_group_dn = policy_group_attributes["tDn"]
policy_group_name = policy_group_dn
policy_group_type = policy_group_class
policy_group_details = policy_group_types.get(policy_group_class)
if policy_group_details:
policy_group_prefix = "uni/infra/funcprof/" + policy_group_details[0]
policy_group_type = policy_group_details[1]
if policy_group_dn.startswith(policy_group_prefix):
policy_group_name = policy_group_dn[len(policy_group_prefix):]
fabric_h_if_pol = host_interface_policy["fabricHIfPol"]["attributes"]["dn"]
speed = host_interface_policy["fabricHIfPol"]["attributes"]["speed"]
data.append([fabric_h_if_pol, speed, policy_group_name, policy_group_type])
if data:
result = FAIL_O

return Result(result=result, headers=headers, data=data, recommended_action=recommended_action, doc_url=doc_url)


# ---- Script Execution ----


Expand Down Expand Up @@ -7498,6 +7547,7 @@ class CheckManager:
n9k_c93180yc_fx3_switch_memory_check,
stale_dbgacEpgSummaryTask_check,
infravlan_overlap_access_policy_check,
host_interface_policy_set_speed_check,

]
ssh_checks = [
Expand Down
12 changes: 12 additions & 0 deletions docs/docs/validations.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Items | Faults | This Script
[AVE End-of-life][c23] | :white_check_mark: | :no_entry_sign:
[Shared Service with vzAny Consumer][c24] | :white_check_mark: | :no_entry_sign:
[Preferred Group Shared Service Provider][c25] | :white_check_mark: | :no_entry_sign:
[Host interface policy set to auto][c26] | :white_check_mark: | :no_entry_sign:

[c1]: #vpc-paired-leaf-switches
[c2]: #overlapping-vlan-pool
Expand All @@ -168,6 +169,7 @@ Items | Faults | This Script
[c23]: #ave-end-of-life
[c24]: #shared-service-with-vzany-consumer
[c25]: #preferred-group-shared-service-provider
[c26]: #host-interface-policy-set-to-auto

### Defect Condition Checks

Expand Down Expand Up @@ -2329,6 +2331,15 @@ Starting with 6.0(1g), ordinary EPG-to-EPG shared service is allowed. The unsupp
Before upgrading, use the provider and consumer DNs shown in the result to remove the provider from the Preferred Group, stop it from providing the shared-service contract, or remove the unsupported relationship. See the [ACI Policy Model][78] for additional background.


### Host interface policy set to auto
As detailed in the [Cisco APIC Basic Configuration Guide][79], for **Interface Speed**, use the default value, `Inherit`.
With this value, Cisco APIC determines the interface speed based on the transceiver installed in the switch port.

In case the link speed is set to "auto", interfaces may not come up after an upgrade (stateless reboot).
Changing the speed to "inherit" resolves this situation, which is also a best practice.
Only policies referenced by an interface policy group are reported. The associated group identifies where the host interface policy is consumed.


## Defect Check Details

### EP Announce Compatibility
Expand Down Expand Up @@ -2905,3 +2916,4 @@ To avoid this issue, modify the user VLAN pool ranges so that the InfraVLAN does
[76]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwt38698
[77]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwt58626
[78]: https://www.cisco.com/c/en/us/td/docs/switches/datacenter/aci/apic/sw/5-x/aci-fundamentals/cisco-aci-fundamentals-50x/m_policy-model.html#concept_tds_vcc_fy
[79]: https://www.cisco.com/c/en/us/td/docs/dcn/aci/apic/6x/basic-configuration/cisco-apic-basic-configuration-guide-62x/provisioning-core-aci-fabric-services-62x.html#Cisco_Task_in_List_GUI.dita_45856d2e-8ddd-41bd-93f7-91207aea2061
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
[
{
"fabricHIfPol": {
"attributes": {
"annotation": "orchestrator:msc",
"autoNeg": "on",
"childAction": "",
"creator": "USER",
"descr": "",
"dfeDelayMs": "0",
"dn": "uni/infra/hintfpol-fernandh_interface",
"emiRetrain": "disable",
"extMngdBy": "",
"fecMode": "inherit",
"lcOwn": "local",
"linkDebounce": "100",
"modTs": "2025-05-07T23:54:47.082+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "fernandh_interface",
"nameAlias": "",
"ownerKey": "",
"ownerTag": "",
"portPhyMediaType": "auto",
"speed": "auto",
"status": "",
"uid": "0",
"userdom": ":all:"
},
"children": [
{
"fabricRtHIfPol": {
"attributes": {
"childAction": "",
"lcOwn": "local",
"modTs": "2025-05-07T23:54:47.082+00:00",
"rn": "rtinfraHIfPol-[uni/infra/funcprof/accportgrp-fernandh_interface]",
"status": "",
"tCl": "infraAccPortGrp",
"tDn": "uni/infra/funcprof/accportgrp-fernandh_interface"
}
}
}
]
}
},
{
"fabricHIfPol": {
"attributes": {
"annotation": "",
"autoNeg": "on",
"childAction": "",
"creator": "USER",
"descr": "",
"dfeDelayMs": "0",
"dn": "uni/infra/hintfpol-AUTO",
"emiRetrain": "disable",
"extMngdBy": "",
"fecMode": "inherit",
"lcOwn": "local",
"linkDebounce": "100",
"modTs": "2025-06-03T23:21:03.594+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "AUTO",
"nameAlias": "",
"ownerKey": "",
"ownerTag": "",
"portPhyMediaType": "auto",
"speed": "auto",
"status": "",
"uid": "15374",
"userdom": ":all:"
},
"children": [
{
"fabricRtHIfPol": {
"attributes": {
"childAction": "",
"lcOwn": "local",
"modTs": "2025-06-03T23:21:07.485+00:00",
"rn": "rtinfraHIfPol-[uni/infra/funcprof/accportgrp-av_accessB]",
"status": "",
"tCl": "infraAccPortGrp",
"tDn": "uni/infra/funcprof/accportgrp-av_accessB"
}
}
},
{
"fabricRtHIfPol": {
"attributes": {
"childAction": "",
"lcOwn": "local",
"modTs": "2025-06-05T04:53:53.112+00:00",
"rn": "rtinfraHIfPol-[uni/infra/funcprof/accbundle-av-access]",
"status": "",
"tCl": "infraAccBndlGrp",
"tDn": "uni/infra/funcprof/accbundle-av-access"
}
}
},
{
"fabricRtHIfPol": {
"attributes": {
"childAction": "",
"lcOwn": "local",
"modTs": "2025-06-05T04:53:53.112+00:00",
"rn": "rtinfraHIfPol-[uni/infra/funcprof/accbundlepolgrp-av-override]",
"status": "",
"tCl": "infraAccBndlPolGrp",
"tDn": "uni/infra/funcprof/accbundlepolgrp-av-override"
}
}
},
{
"fabricRtHIfPol": {
"attributes": {
"childAction": "",
"lcOwn": "local",
"modTs": "2025-06-05T04:53:53.112+00:00",
"rn": "rtinfraHIfPol-[uni/infra/funcprof/spaccportgrp-spine-access]",
"status": "",
"tCl": "infraSpAccPortGrp",
"tDn": "uni/infra/funcprof/spaccportgrp-spine-access"
}
}
}
]
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import os
import pytest
import importlib
from helpers.utils import read_data

script = importlib.import_module("aci-preupgrade-validation-script")

dir = os.path.dirname(os.path.abspath(__file__))
test_function = "host_interface_policy_set_speed_check"


# icurl queries
host_interface_policy_api = 'fabricHIfPol.json'
host_interface_policy_api += '?query-target-filter=and(eq(fabricHIfPol.speed,"auto"))'
host_interface_policy_api += '&rsp-subtree=children&rsp-subtree-class=fabricRtHIfPol'

@pytest.mark.parametrize( "icurl_outputs, tversion, expected_result",
[
# MANUAL Cases
# No tversion given
(
{host_interface_policy_api: read_data(dir, "fabricHIfPol-pos.json")},
None,
script.MANUAL,
),
# FAIL_O Cases
# fabricHIfPol with 'auto' speed found
(
{host_interface_policy_api: read_data(dir, "fabricHIfPol-pos.json")},
"6.0(9d)",
script.FAIL_O,
),
# PASS Cases
# No fabricHIfPol with 'auto' speed found
(
{host_interface_policy_api: []},
"6.0(1g)",
script.PASS,
),
],
)
def test_logic(run_check, mock_icurl, tversion, expected_result):
result = run_check(
tversion=script.AciVersion(tversion) if tversion else None,
)
assert result.result == expected_result


def test_policy_group_types(run_check, mock_icurl, icurl_outputs):
icurl_outputs[host_interface_policy_api] = read_data(
dir, "fabricHIfPol-pos.json"
)
result = run_check(
tversion=script.AciVersion("6.0(9d)"),
)

assert result.result == script.FAIL_O
assert result.headers == [
"Host Interface Policy",
"Set Speed",
"Associated Interface Policy Group",
"Group Type",
]
assert result.data == [
[
"uni/infra/hintfpol-fernandh_interface",
"auto",
"fernandh_interface",
"Leaf Access",
],
["uni/infra/hintfpol-AUTO", "auto", "av_accessB", "Leaf Access"],
["uni/infra/hintfpol-AUTO", "auto", "av-access", "PC/vPC"],
[
"uni/infra/hintfpol-AUTO",
"auto",
"av-override",
"PC/vPC Override",
],
[
"uni/infra/hintfpol-AUTO",
"auto",
"spine-access",
"Spine Access",
],
]
Loading