Skip to content

Commit

Permalink
[ignore] Modify test cases and documentations to deal with previous A…
Browse files Browse the repository at this point in the history
…PIC version.
  • Loading branch information
gmicol committed Nov 17, 2023
1 parent 799e5a9 commit 339c211
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 35 deletions.
3 changes: 2 additions & 1 deletion plugins/modules/aci_bgp_address_family_context_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@
description:
- The maximum number of equal-cost local paths for redist.
- The APIC defaults to C(0) when unset during creation.
- Can not be configured for APIC version 4.2(7s) and prior.
type: int
bgp_add_path_capability:
description:
- The neighbor system capability.
- To delete this attribute, pass an empty string.
- Can not be configured for APIC version 4.2 and prior.
- Can not be configured for APIC version 6.0(2h) and prior.
type: str
choices: [ receive, send, "" ]
description:
Expand Down
21 changes: 13 additions & 8 deletions plugins/modules/aci_bgp_route_summarization_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@
description:
- The Ucast/Mcast address type AF control.
- The APIC defaults to C(af-ucast) when unset during creation.
- Can not be configured for APIC version 4.2 or prior.
- Can not be configured for APIC version 4.2(7s) or prior.
type: list
elements: str
choices: [ af-label-ucast, af-ucast, af-mcast ]
aliases: [ address_type_control ]
control_state:
description:
- The summary control.
- The C(summary_only) option can not be configured for APIC version 4.2(7s) or prior.
type: list
elements: str
choices: [ as-set, summary-only ]
Expand Down Expand Up @@ -281,15 +282,19 @@ def main():
aci.get_existing()

if state == "present":
class_config = dict(
name=route_summarization_policy,
ctrl=control_state,
descr=description,
nameAlias=name_alias,
)

if address_type_af_control is not None:
class_config.update(dict(addrTCtrl=address_type_af_control))

aci.payload(
aci_class="bgpRtSummPol",
class_config=dict(
name=route_summarization_policy,
addrTCtrl=address_type_af_control,
ctrl=control_state,
descr=description,
nameAlias=name_alias,
),
class_config=class_config,
)

aci.get_diff(aci_class="bgpRtSummPol")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
local_distance: 215
ebgp_max_ecmp: 32
ibgp_max_ecmp: 32
local_max_ecmp: 1
bgp_add_path_capability: receive
state: present
check_mode: true
register: cm_add_bgp_address_family_context_policy
Expand All @@ -67,6 +65,20 @@
<<: *aci_bgp_address_family_context_policy_present
register: nm_add_bgp_address_family_context_policy_idempotency

- name: Add Local max ECMP to BGP address family context policy - APIC version >= 5.0
when: version.current.0.topSystem.attributes.version is version('5.0', '>=')
cisco.aci.aci_bgp_address_family_context_policy: &aci_bgp_address_family_context_policy_present_maxLocalEcmp
<<: *aci_bgp_address_family_context_policy_present
local_max_ecmp: 1
register: nm_add_maxLocalEcmp_bgp_address_family_context_policy

- name: Add Path Capability to BGP address family context policy - APIC version >= 6.0(2h)
when: version.current.0.topSystem.attributes.version is version('6.0(2h)', '>=')
cisco.aci.aci_bgp_address_family_context_policy: &aci_bgp_address_family_context_policy_present_bgpCtxAddlPathPol
<<: *aci_bgp_address_family_context_policy_present_maxLocalEcmp
bgp_add_path_capability: receive
register: nm_add_path_capability_bgp_address_family_context_policy

- name: Add a second BGP address family context policy (normal_mode)
cisco.aci.aci_bgp_address_family_context_policy:
<<: *aci_info
Expand All @@ -89,9 +101,7 @@
- nm_add_bgp_address_family_context_policy.current.0.bgpCtxAfPol.attributes.localDist == "215"
- nm_add_bgp_address_family_context_policy.current.0.bgpCtxAfPol.attributes.maxEcmp == "32"
- nm_add_bgp_address_family_context_policy.current.0.bgpCtxAfPol.attributes.maxEcmpIbgp == "32"
- nm_add_bgp_address_family_context_policy.current.0.bgpCtxAfPol.attributes.maxLocalEcmp == "1"
- nm_add_bgp_address_family_context_policy.current.0.bgpCtxAfPol.attributes.ctrl == "host-rt-leak"
- nm_add_bgp_address_family_context_policy.current.0.bgpCtxAfPol.children.0.bgpCtxAddlPathPol.attributes.capability == "receive"
- nm_add_bgp_address_family_context_policy_idempotency is not changed
- nm_add_bgp_address_family_context_policy_2 is changed
- nm_add_bgp_address_family_context_policy_2.previous == []
Expand All @@ -101,9 +111,23 @@
- nm_add_bgp_address_family_context_policy_2.current.0.bgpCtxAfPol.attributes.localDist == "220"
- nm_add_bgp_address_family_context_policy_2.current.0.bgpCtxAfPol.attributes.maxEcmp == "16"
- nm_add_bgp_address_family_context_policy_2.current.0.bgpCtxAfPol.attributes.maxEcmpIbgp == "16"
- nm_add_bgp_address_family_context_policy_2.current.0.bgpCtxAfPol.attributes.maxLocalEcmp == "0"
- nm_add_bgp_address_family_context_policy_2.current.0.bgpCtxAfPol.attributes.ctrl == ""

- name: Asserts adding Local max ECMP for BGP address family context policys creation tasks - APIC version >= 5.0
when: version.current.0.topSystem.attributes.version is version('5.0', '>=')
ansible.builtin.assert:
that:
- nm_add_maxLocalEcmp_bgp_address_family_context_policy is changed
- nm_add_maxLocalEcmp_bgp_address_family_context_policy.current.0.bgpCtxAfPol.attributes.maxLocalEcmp == "1"
- nm_add_bgp_address_family_context_policy_2.current.0.bgpCtxAfPol.attributes.maxLocalEcmp == "0"

- name: Asserts adding path capability for BGP address family context policys creation tasks - APIC version >= 6.0(2h)
when: version.current.0.topSystem.attributes.version is version('6.0(2h)', '>=')
ansible.builtin.assert:
that:
- nm_add_path_capability_bgp_address_family_context_policy is changed
- nm_add_path_capability_bgp_address_family_context_policy.current.0.bgpCtxAfPol.children.0.bgpCtxAddlPathPol.attributes.capability == "receive"

- name: Query all BGP address family context policies
cisco.aci.aci_bgp_address_family_context_policy:
<<: *aci_info
Expand All @@ -128,28 +152,56 @@
- query_ansible_bgp_address_family_context_policy_1.current.0.bgpCtxAfPol.attributes.localDist == "215"
- query_ansible_bgp_address_family_context_policy_1.current.0.bgpCtxAfPol.attributes.maxEcmp == "32"
- query_ansible_bgp_address_family_context_policy_1.current.0.bgpCtxAfPol.attributes.maxEcmpIbgp == "32"
- query_ansible_bgp_address_family_context_policy_1.current.0.bgpCtxAfPol.attributes.maxLocalEcmp == "1"
- query_ansible_bgp_address_family_context_policy_1.current.0.bgpCtxAfPol.attributes.ctrl == "host-rt-leak"
- query_ansible_bgp_address_family_context_policy_1.current.0.bgpCtxAfPol.children.0.bgpCtxAddlPathPol.attributes.capability == "receive"

- name: Remove children from BGP address family context policy (check_mode)
- name: Query ansible_bgp_address_family_context_policy_1 with updated Local Max ECMP - APIC version >= 5.0
when: version.current.0.topSystem.attributes.version is version('5.0', '>=')
cisco.aci.aci_bgp_address_family_context_policy:
<<: *aci_bgp_address_family_context_policy_present_maxLocalEcmp
state: query
register: query_ansible_bgp_address_family_context_policy_maxLocalEcmp

- name: Asserts path capability - APIC version >= 5.0
when: version.current.0.topSystem.attributes.version is version('5.0', '>=')
ansible.builtin.assert:
that:
- query_ansible_bgp_address_family_context_policy_maxLocalEcmp.current.0.bgpCtxAfPol.attributes.maxLocalEcmp == "1"

- name: Query ansible_bgp_address_family_context_policy_1 with added path capability - APIC version >= 6.0(2h)
when: version.current.0.topSystem.attributes.version is version('6.0(2h)', '>=')
cisco.aci.aci_bgp_address_family_context_policy:
<<: *aci_bgp_address_family_context_policy_present_bgpCtxAddlPathPol
state: query
register: query_ansible_bgp_address_family_context_policy_bgpCtxAddlPathPol

- name: Asserts path capability - APIC version >= 6.0(2h)
when: version.current.0.topSystem.attributes.version is version('6.0(2h)', '>=')
ansible.builtin.assert:
that:
- query_ansible_bgp_address_family_context_policy_bgpCtxAddlPathPol.current.0.bgpCtxAfPol.children.0.bgpCtxAddlPathPol.attributes.capability == "receive"

- name: Remove children from BGP address family context policy (check_mode) - APIC version >= 6.0(2h)
when: version.current.0.topSystem.attributes.version is version('6.0(2h)', '>=')
cisco.aci.aci_bgp_address_family_context_policy: &bgp_address_family_context_policy_delet_children
<<: *aci_bgp_address_family_context_policy_present
<<: *aci_bgp_address_family_context_policy_present_bgpCtxAddlPathPol
bgp_add_path_capability: ""
check_mode: true
register: cm_remove_children_bgp_address_family_context_policy

- name: Remove children from BGP address family context policy (normal_mode)
- name: Remove children from BGP address family context policy (normal_mode) - APIC version >= 6.0(2h)
when: version.current.0.topSystem.attributes.version is version('6.0(2h)', '>=')
cisco.aci.aci_bgp_address_family_context_policy:
<<: *bgp_address_family_context_policy_delet_children
register: nm_remove_children_bgp_address_family_context_policy

- name: Remove children from BGP address family context policy - testing idempotency
- name: Remove children from BGP address family context policy (testing idempotency) - APIC version >= 6.0(2h)
when: version.current.0.topSystem.attributes.version is version('6.0(2h)', '>=')
cisco.aci.aci_bgp_address_family_context_policy:
<<: *bgp_address_family_context_policy_delet_children
register: nm_remove_children_bgp_address_family_context_policy_idempotency

- name: Asserts for children removal tasks for the first address family context policy
- name: Asserts for children removal tasks for the first address family context policy - APIC version >= 6.0(2h)
when: version.current.0.topSystem.attributes.version is version('6.0(2h)', '>=')
ansible.builtin.assert:
that:
- cm_remove_children_bgp_address_family_context_policy is changed
Expand Down
Loading

0 comments on commit 339c211

Please sign in to comment.