Skip to content

Commit

Permalink
[ignore] Modify documentations, examples and add FQCN notations to te…
Browse files Browse the repository at this point in the history
…st cases.
  • Loading branch information
gmicol committed Nov 9, 2023
1 parent f29d71d commit a98809e
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 60 deletions.
31 changes: 30 additions & 1 deletion plugins/modules/aci_bgp_address_family_context_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,43 @@
description:
- The control state.
- The option to enable/disable host route leak.
- The APIC defaults to C(false) when unset during creation.
type: bool
ebgp_distance:
description:
- The administrative distance of eBGP routes.
- The APIC defaults to C(20) when unset during creation.
type: int
ibgp_distance:
description:
- The administrative distance of iBGP routes.
- The APIC defaults to C(200) when unset during creation.
type: int
local_distance:
description:
- The administrative distance of local routes.
- The APIC defaults to C(220) when unset during creation.
type: int
ebgp_max_ecmp:
description:
- The eBGP max-path.
- The APIC defaults to C(16) when unset during creation.
type: int
ibgp_max_ecmp:
description:
- The iBGP max-path.
- The APIC defaults to C(16) when unset during creation.
type: int
local_max_ecmp:
description:
- The maximum number of equal-cost local paths for redist.
- The APIC defaults to C(0) when unset during creation.
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.
type: str
choices: [ receive, send, "" ]
description:
Expand Down Expand Up @@ -102,10 +110,29 @@
username: admin
password: SomeSecretPassword
bgp_address_family_context_policy: my_bgp_address_family_context_policy
host_route_leak: true
ebgp_distance: 40
ibgp_distance: 210
local_distance: 215
ebgp_max_ecmp: 32
ibgp_max_ecmp: 32
local_max_ecmp: 1
bgp_add_path_capability: receive
tenant: production
state: present
delegate_to: localhost
- name: Delete BGP address family context policy's child
cisco.aci.aci_bgp_address_family_context_policy:
host: apic
username: admin
password: SomeSecretPassword
bgp_address_family_context_policy: my_bgp_address_family_context_policy
bgp_add_path_capability: ""
tenant: production
state: absent
delegate_to: localhost
- name: Delete a BGP address family context policy
cisco.aci.aci_bgp_address_family_context_policy:
host: apic
Expand Down Expand Up @@ -292,7 +319,9 @@ def main():
tenant = module.params.get("tenant")
name_alias = module.params.get("name_alias")

child_classes = ["bgpCtxAddlPathPol"]
child_classes = []
if bgp_add_path_capability is not None:
child_classes.append("bgpCtxAddlPathPol")

aci.construct_url(
root_class=dict(
Expand Down
4 changes: 4 additions & 0 deletions plugins/modules/aci_bgp_peer_prefix_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
username: admin
password: SomeSecretPassword
peer_prefix_policy: my_bgp_peer_prefix_policy
action: restart
restart_time: 10
max_prefix: 10000
threshold: 80
tenant: production
state: present
delegate_to: localhost
Expand Down
3 changes: 3 additions & 0 deletions plugins/modules/aci_bgp_route_summarization_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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.
type: list
elements: str
choices: [ af-label-ucast, af-ucast, af-mcast ]
Expand Down Expand Up @@ -82,6 +83,8 @@
username: admin
password: SomeSecretPassword
route_summarization_policy: my_route_summarization_policy
address_type_af_control: [af-mcast, af-ucast]
control_state: [as-set, summary-only]
tenant: production
state: present
delegate_to: localhost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

- name: Test that we have an ACI APIC host, ACI username and ACI password
fail:
ansible.builtin.fail:
msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.'
when: aci_hostname is not defined or aci_username is not defined or aci_password is not defined

- name: Set vars
set_fact:
ansible.builtin.set_fact:
aci_info: &aci_info
host: "{{ aci_hostname }}"
username: "{{ aci_username }}"
Expand All @@ -21,26 +21,26 @@

# CLEAN ENVIRONMENT
- name: Remove the ansible_tenant
aci_tenant: &aci_tenant_absent
cisco.aci.aci_tenant: &aci_tenant_absent
<<: *aci_info
tenant: ansible_tenant
state: absent

- name: Verify Cloud and Non-Cloud Sites in use.
include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml
ansible.builtin.include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml

- name: Execute tasks only for non-cloud sites
when: query_cloud.current == [] # This condition will execute only non-cloud sites
block: # block specifies execution of tasks within, based on conditions
- name: Add a new tenant
aci_tenant: &aci_tenant_present
cisco.aci.aci_tenant: &aci_tenant_present
<<: *aci_info
tenant: ansible_tenant
description: Ansible tenant
state: present

- name: Add a BGP address family context policy (check_mode)
aci_bgp_address_family_context_policy: &aci_bgp_address_family_context_policy_present
cisco.aci.aci_bgp_address_family_context_policy: &aci_bgp_address_family_context_policy_present
<<: *aci_info
tenant: ansible_tenant
address_family_context_policy: ansible_bgp_address_family_context_policy_1
Expand All @@ -58,17 +58,17 @@
register: cm_add_bgp_address_family_context_policy

- name: Add a BGP address family context policy (normal_mode)
aci_bgp_address_family_context_policy:
cisco.aci.aci_bgp_address_family_context_policy:
<<: *aci_bgp_address_family_context_policy_present
register: nm_add_bgp_address_family_context_policy

- name: Add the first BGP address family context policy again - testing idempotency
aci_bgp_address_family_context_policy:
cisco.aci.aci_bgp_address_family_context_policy:
<<: *aci_bgp_address_family_context_policy_present
register: nm_add_bgp_address_family_context_policy_idempotency

- name: Add a second BGP address family context policy (normal_mode)
aci_bgp_address_family_context_policy:
cisco.aci.aci_bgp_address_family_context_policy:
<<: *aci_info
tenant: ansible_tenant
address_family_context_policy: ansible_bgp_address_family_context_policy_2
Expand All @@ -77,7 +77,7 @@
register: nm_add_bgp_address_family_context_policy_2

- name: Asserts for BGP address family context policys creation tasks
assert:
ansible.builtin.assert:
that:
- cm_add_bgp_address_family_context_policy is changed
- cm_add_bgp_address_family_context_policy.previous == []
Expand Down Expand Up @@ -105,19 +105,19 @@
- nm_add_bgp_address_family_context_policy_2.current.0.bgpCtxAfPol.attributes.ctrl == ""

- name: Query all BGP address family context policies
aci_bgp_address_family_context_policy:
cisco.aci.aci_bgp_address_family_context_policy:
<<: *aci_info
state: query
register: query_all_bgp_address_family_context_policy

- name: Query ansible_bgp_address_family_context_policy_1
aci_bgp_address_family_context_policy:
cisco.aci.aci_bgp_address_family_context_policy:
<<: *aci_bgp_address_family_context_policy_present
state: query
register: query_ansible_bgp_address_family_context_policy_1

- name: Asserts query tasks
assert:
ansible.builtin.assert:
that:
- query_all_bgp_address_family_context_policy is not changed
- query_all_bgp_address_family_context_policy.current|length >= 2
Expand All @@ -133,24 +133,24 @@
- 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)
aci_bgp_address_family_context_policy: &bgp_address_family_context_policy_delet_children
cisco.aci.aci_bgp_address_family_context_policy: &bgp_address_family_context_policy_delet_children
<<: *aci_bgp_address_family_context_policy_present
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)
aci_bgp_address_family_context_policy:
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
aci_bgp_address_family_context_policy:
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
assert:
ansible.builtin.assert:
that:
- cm_remove_children_bgp_address_family_context_policy is changed
- cm_remove_children_bgp_address_family_context_policy.current == cm_remove_children_bgp_address_family_context_policy.previous
Expand All @@ -159,24 +159,24 @@
- nm_remove_children_bgp_address_family_context_policy_idempotency is not changed

- name: Remove BGP address family context policy (check_mode)
aci_bgp_address_family_context_policy: &bgp_address_family_context_policy_absent
cisco.aci.aci_bgp_address_family_context_policy: &bgp_address_family_context_policy_absent
<<: *aci_bgp_address_family_context_policy_present
state: absent
check_mode: true
register: cm_remove_bgp_address_family_context_policy

- name: Remove BGP address family context policy (normal_mode)
aci_bgp_address_family_context_policy:
cisco.aci.aci_bgp_address_family_context_policy:
<<: *bgp_address_family_context_policy_absent
register: nm_remove_bgp_address_family_context_policy

- name: Remove BGP address family context policy - testing idempotency
aci_bgp_address_family_context_policy:
cisco.aci.aci_bgp_address_family_context_policy:
<<: *bgp_address_family_context_policy_absent
register: nm_remove_bgp_address_family_context_policy_idempotency

- name: Asserts deletion tasks
assert:
ansible.builtin.assert:
that:
- cm_remove_bgp_address_family_context_policy is changed
- cm_remove_bgp_address_family_context_policy.proposed == {}
Expand All @@ -187,6 +187,6 @@
- nm_remove_bgp_address_family_context_policy_idempotency.previous == []

- name: Remove the ansible_tenant - cleanup before ending tests
aci_tenant:
cisco.aci.aci_tenant:
<<: *aci_tenant_present
state: absent
Loading

0 comments on commit a98809e

Please sign in to comment.