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
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,24 @@
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]
choices: [ breakout, fex, port_channel, switch_port, vpc, fex_port_channel, fex_vpc , fex_profile]
default: switch_port
fex_id:
description:
- Id of the fex profile, a valid FEX ID is between 101 to 199.
type: int
fex_profile:
description:
- The name of the Fex Profile. Value of the fex_profile is overridden by the policy_group.
type: str
aliases: [ fex_profile_name ]
type:
description:
- The type of access port to be created under respective profile.
type: str
aliases: [ profile_type ]
choices: [ fex, leaf ]
default: leaf
state:
Expand Down Expand Up @@ -196,6 +207,23 @@
state: query
delegate_to: localhost
register: query_result

- name: Create and Bind Access Port Selector with Fex Profile Policy Group
cisco.aci.aci_access_port_to_interface_policy_leaf_profile:
host: apic
username: admin
password: SomeSecretPassword
leaf_interface_profile: leafintprftest
fex_profile: fexintprftest
policy_group: fexintprftest
access_port_selector_name: anstest_fex_accessportselector
interface_type: fex_profile
from_port: 13
to_port: 13
port_blk: block2
fex_id: 105
state: present
delegate_to: localhost
"""

RETURN = r"""
Expand Down Expand Up @@ -311,6 +339,7 @@
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,
Expand All @@ -335,9 +364,11 @@ def main():
to_card=dict(type="str", aliases=["to_card_range"]),
policy_group=dict(type="str", aliases=["policy_group_name"]),
interface_type=dict(
type="str", default="switch_port", choices=["breakout", "fex", "port_channel", "switch_port", "vpc", "fex_port_channel", "fex_vpc"]
type="str", default="switch_port", choices=["breakout", "fex", "port_channel", "switch_port", "vpc", "fex_port_channel", "fex_vpc", "fex_profile"]
),
type=dict(type="str", default="leaf", choices=["fex", "leaf"]),
fex_id=dict(type="int"),
fex_profile=dict(type="str", aliases=["fex_profile_name"]),
type=dict(type="str", default="leaf", choices=["fex", "leaf"], aliases=["profile_type"]),
state=dict(type="str", default="present", choices=["absent", "present", "query"]),
)

Expand All @@ -361,6 +392,8 @@ def main():
to_card = module.params.get("to_card")
policy_group = module.params.get("policy_group")
interface_type = module.params.get("interface_type")
fex_id = module.params.get("fex_id")
fex_profile = module.params.get("fex_profile")
state = module.params.get("state")
type_profile = module.params.get("type")

Expand All @@ -382,16 +415,34 @@ def main():

# Add infraRsAccBaseGrp only when policy_group was defined
if policy_group is not None:
child_configs.append(
dict(
infraRsAccBaseGrp=dict(
attributes=dict(
tDn=INTERFACE_TYPE_MAPPING[interface_type].format(policy_group),
),
),
)

infra_rs_acc_base_grp = dict(
infraRsAccBaseGrp=dict(
attributes=dict(),
),
)

if interface_type == "fex_profile":
if type_profile == "fex":
module.fail_json(msg="Invalid Configuration - interface_type fex_profile can not be configured with a profile of type fex")
elif fex_profile is not None:
infra_rs_acc_base_grp["infraRsAccBaseGrp"]["attributes"]["tDn"] = INTERFACE_TYPE_MAPPING[interface_type].format(fex_profile, policy_group)
elif fex_profile is None:
infra_rs_acc_base_grp["infraRsAccBaseGrp"]["attributes"]["tDn"] = INTERFACE_TYPE_MAPPING[interface_type].format(policy_group, policy_group)

if fex_id is not None:
if fex_id in range(101, 200):
infra_rs_acc_base_grp["infraRsAccBaseGrp"]["attributes"]["fexId"] = fex_id
else:
module.fail_json(msg="A valid FEX ID is between 101 to 199")
else:
module.fail_json(msg="The fex_id must not be None, when interface_type is fex_profile")

else:
infra_rs_acc_base_grp["infraRsAccBaseGrp"]["attributes"]["tDn"] = INTERFACE_TYPE_MAPPING[interface_type].format(policy_group)

child_configs.append(infra_rs_acc_base_grp)

aci = ACIModule(module)
aci_class = "infraAccPortP"
aci_rn = "accportprof"
Expand Down
Loading