CiscoDevNet / ansible-aci

Cisco ACI Ansible Collection
https://galaxy.ansible.com/cisco/aci
GNU General Public License v3.0
143 stars 97 forks source link

aci_access_port_to_interface_policy_leaf_profile adding full tDn path in place of just group policy name #473

Closed hsabale closed 1 year ago

hsabale commented 1 year ago

Community Note

Description

When creating an Access Port Selector that is a port channel, with interaface_type as a PC, the policy_group appears to be putting the full tDn path instead of just the policy name

Affected Module Name(s):

aci_access_port_to_interface_policy_leaf_profile

APIC version and APIC Platform

APIC Version: 5.2.(6g) - on-prem and 6.0(2h) - Sandbox

Collection versions

Output/ Error message

Expected Behavior

just the following should have been placed in the Access Port Selector Policy Group Field: PC_TEST_IPG

Actual Behavior

Playbook tasks to Reproduce

[root@myserver]# cat hosts

all: hosts: apic: apic_host: "sandboxapicdc.cisco.com" apic_password: '!v3G@!4@Y' apic_username: admin

vars: apic_use_proxy: yes apic_validate_certs: no

[root@myserver]# cat main.yml

[root@myserver]# cat roles/Server_IP_Config/tasks/main.yml

[root@myserver]# cat roles/Server_IP_Config/var/main.yml connectivity: Access_Port: aep: "HMS-L3OUT-AEP" link_level_policy: "LLP-10G" cdp_policy: "CDP-DISABLE" lldp_policy: "LLDP-DISABLE" mcp_policy: "MCP_On" stp_interface_policy: "Enable_STP" Port_Channel: aep: "HMS-L3OUT-AEP" link_level_policy: "LLP-10G" cdp_policy: "CDP-DISABLE" lldp_policy: "LLDP-DISABLE" mcp_policy: "MCP_On" stp_interface_policy: "Enable_STP" port_channel_policy: "LACP_ACTIVE" Virtual_Port_Channel: aep: "HMS-L3OUT-AEP" link_level_policy: "LLP-10G" cdp_policy: "CDP-DISABLE" lldp_policy: "LLDP-DISABLE" mcp_policy: "MCP_On" port_channel_policy: "LACP_ACTIVE" stp_interface_policy: "Enable_STP"

MappingData: tenant: "11_HMS" Segement1: name: "1.1.1.0/24" ap: "FEED-ANP" *

Important Factoids

LEAF_101_IPF & Interface policy used in playbook should be present before executing it. Directory Tree Structure: aci :

  1. roles - > Server_IP_Config --> a. defaults b. tasks --> main.yml c. templates d. vars --> main.yml
  2. hosts
  3. main.yml

References

akinross commented 1 year ago

Hi @hsabale,

From your configuration it seems that you are not specifying interface_type into the task. Is this assumption correct?

If this is the case, please try providing interface_type into the task:

  interface_type:
    description:
    - The type of interface for the static EPG deployment.
    - The interface_type fex_profile can not be configured with a profile of type fex.
    type: str
    choices: [ breakout, fex, port_channel, switch_port, vpc, fex_port_channel, fex_vpc , fex_profile]
    default: switch_port

The type determines the tDn. See code below from https://github.com/CiscoDevNet/ansible-aci/blob/master/plugins/modules/aci_access_port_to_interface_policy_leaf_profile.py#L337:

port_channels_dn = "uni/infra/funcprof/accbundle-{0}"

INTERFACE_TYPE_MAPPING = dict(
    breakout="uni/infra/funcprof/brkoutportgrp-{0}",
    fex="uni/infra/funcprof/accportgrp-{0}",
    fex_profile="uni/infra/fexprof-{0}/fexbundle-{1}",
    port_channel=port_channels_dn,
    switch_port="uni/infra/funcprof/accportgrp-{0}",
    vpc=port_channels_dn,
    fex_port_channel=port_channels_dn,
    fex_vpc=port_channels_dn,
)
hsabale commented 1 year ago

I didn't see example for configuring IPS with PC/VPC so not used. https://docs.ansible.com/ansible/latest/collections/cisco/aci/aci_access_port_to_interface_policy_leaf_profile_module.html#ansible-collections-cisco-aci-aci-access-port-to-interface-policy-leaf-profile-module

After setting interface_type as port_channel in playbook, its working fine.

akinross commented 1 year ago

Good to hear your issue is resolved.

Correct there is no example for PC/VPC currently there, is this something that you think should be added? I am asking this because in the documentation https://docs.ansible.com/ansible/latest/collections/cisco/aci/aci_access_port_to_interface_policy_leaf_profile_module.html#parameter-interface_type it defines default behaviour of this parameter. I assume upon usage of a module default behaviour is something you would like to know.

akinross commented 1 year ago

@all Add examples for PC and VPC