Skip to content

Commit

Permalink
[ignore_changes] Fixing sanity issues
Browse files Browse the repository at this point in the history
  • Loading branch information
anvitha-jain committed Nov 8, 2023
1 parent 12b6895 commit 3d4e551
Show file tree
Hide file tree
Showing 10 changed files with 229 additions and 87 deletions.
23 changes: 10 additions & 13 deletions plugins/modules/aci_bfd_interface_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
description:
- Name of the BFD Interface policy
type: str
aliases: [ bfd_multihop_interface_policy ]
aliases: [ bfd_interface_policy ]
description:
description:
- Description of the BFD Interface policy
Expand All @@ -48,13 +48,13 @@
- Minimum transmit (Tx) interval of the BFD Interface policy
- Allowed range is 250-999.
type: int
default: 250
default: 50
min_receive_interval:
description:
- Minimum receive (Rx) interval of the BFD Interface policy
- Allowed range is 250-999.
type: int
default: 250
default: 50
state:
description:
- Use C(present) or C(absent) for adding or removing.
Expand All @@ -79,14 +79,13 @@

EXAMPLES = r"""
- name: Add a new BFD Interface policy
cisco.aci.aci_bfd_interface_policy:
host: apic
username: admin
password: SomeSecretPassword
tenant: ansible_tenant
name: ansible_bfd_interface_policy
description: Ansible BFD Interface Policy
state: present
cisco.aci.aci_bfd_interface_policy:
host: apic
username: admin
password: SomeSecretPassword
tenant: ansible_tenant
name: ansible_bfd_interface_policy
description: Ansible BFD Interface Policy
state: present
delegate_to: localhost
Expand All @@ -109,7 +108,6 @@
name: ansible_bfd_interface_policy
state: query
delegate_to: localhost
register: query_result
- name: Query all BFD Interface policies in a specific tenant
cisco.aci.aci_bfd_interface_policy:
Expand All @@ -119,7 +117,6 @@
tenant: ansible_tenant
state: query
delegate_to: localhost
register: query_result
"""

RETURN = r"""
Expand Down
17 changes: 7 additions & 10 deletions plugins/modules/aci_bfd_multihop_interface_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,13 @@

EXAMPLES = r"""
- name: Add a new BFD Multihop Interface policy
cisco.aci.aci_bfd_multihop_interface_policy:
host: apic
username: admin
password: SomeSecretPassword
tenant: ansible_tenant
name: ansible_bfd_multihop_interface_policy
description: Ansible BFD Multihop Interface Policy
state: present
cisco.aci.aci_bfd_multihop_interface_policy:
host: apic
username: admin
password: SomeSecretPassword
tenant: ansible_tenant
name: ansible_bfd_multihop_interface_policy
description: Ansible BFD Multihop Interface Policy
state: present
delegate_to: localhost
Expand All @@ -109,7 +108,6 @@
name: ansible_bfd_multihop_interface_policy
state: query
delegate_to: localhost
register: query_result
- name: Query all BFD Multihop Interface policies in a specific tenant
cisco.aci.aci_bfd_multihop_interface_policy:
Expand All @@ -119,7 +117,6 @@
tenant: ansible_tenant
state: query
delegate_to: localhost
register: query_result
"""

RETURN = r"""
Expand Down
8 changes: 6 additions & 2 deletions plugins/modules/aci_bfd_multihop_interface_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@
short_description: Manage BFD Multihop Interface profile.
description:
- Manage BFD Multihop Interface profile (bfdMhIfP) configuration on Cisco ACI fabrics.
- Only available in APIC version 5.2 or later.
- Only available in APIC version 5.2 or later and for non-cloud APICs.
options:
tenant:
description:
- Name of an existing tenant.
type: str
aliases: [ tenant_name ]
l3out:
description:
- Name of an existing L3Out.
type: str
aliases: [ l3out_name ]
l3out_logical_node_profile:
description:
- Name of an existing L3Out Logical Node profile.
Expand All @@ -49,6 +51,7 @@
description:
- Description of the BFD Multihop Interface Profile object.
type: str
aliases: [ descr ]
interface_profile_type:
description:
- Authentication Type of the BFD Multihop Interface Profile object.
Expand Down Expand Up @@ -280,11 +283,12 @@ def main():
interface_profile_type = module.params.get("interface_profile_type")
key = module.params.get("key")
key_id = module.params.get("key_id")
if key_id is not None and key_id not in range(1, 255):
module.fail_json(msg='The "key_id" must be a value between 1 and 255')
bfd_multihop_interface_policy = module.params.get("bfd_multihop_interface_policy")
state = module.params.get("state")

aci = ACIModule(module)
aci.stdout = str("CHECK MODE: ") + str(bfd_multihop_interface_policy)
aci.construct_url(
root_class=dict(
aci_class="fvTenant",
Expand Down
15 changes: 7 additions & 8 deletions plugins/modules/aci_bfd_multihop_node_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,13 @@

EXAMPLES = r"""
- name: Add a new BFD Multihop Node policy
cisco.aci.aci_bfd_multihop_node_policy:
host: apic
username: admin
password: SomeSecretPassword
tenant: ansible_tenant
name: ansible_bfd_multihop_node_policy
description: Ansible BFD Multihop Node Policy
state: present
cisco.aci.aci_bfd_multihop_node_policy:
host: apic
username: admin
password: SomeSecretPassword
tenant: ansible_tenant
name: ansible_bfd_multihop_node_policy
description: Ansible BFD Multihop Node Policy
state: present
delegate_to: localhost
Expand Down
9 changes: 7 additions & 2 deletions plugins/modules/aci_l3out_bfd_interface_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@
short_description: Manage L3Out BFD Interface profile.
description:
- Manage L3Out BFD Interface profile (bfdIfP) configuration on Cisco ACI fabrics.
- Only available in APIC version 5.2 or later.
- Only available in APIC version 5.2 or later and for non-cloud APICs.
options:
tenant:
description:
- Name of an existing tenant.
type: str
aliases: [ tenant_name ]
l3out:
description:
- Name of an existing L3Out.
type: str
aliases: [ l3out_name ]
l3out_logical_node_profile:
description:
- Name of an existing L3Out Logical Node profile.
Expand All @@ -49,6 +51,7 @@
description:
- Description of the L3Out BFD Interface profile object.
type: str
aliases: [ descr ]
interface_profile_type:
description:
- Authentication Type of the L3Out BFD Interface profile object.
Expand Down Expand Up @@ -255,7 +258,7 @@ def main():
name_alias=dict(type="str"),
description=dict(type="str", aliases=["descr"]),
interface_profile_type=dict(type="str", default="none", choices=["none", "sha1"]),
key=dict(type="str"),
key=dict(type="str", no_log=True),
key_id=dict(type="int", default=3),
bfd_interface_policy=dict(type="str", aliases=["interface_policy", "interface_policy_name"]),
state=dict(type="str", default="present", choices=["absent", "present", "query"]),
Expand All @@ -280,6 +283,8 @@ def main():
interface_profile_type = module.params.get("interface_profile_type")
key = module.params.get("key")
key_id = module.params.get("key_id")
if key_id is not None and key_id not in range(1, 255):
module.fail_json(msg='The "key_id" must be a value between 1 and 255')
bfd_interface_policy = module.params.get("bfd_interface_policy")
state = module.params.get("state")

Expand Down
54 changes: 37 additions & 17 deletions tests/integration/targets/aci_bfd_interface_policy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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 @@ -32,13 +32,13 @@

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

- name: Add a new tenant
aci_tenant:
cisco.aci.aci_tenant:
<<: *aci_info
tenant: ansible_tenant
description: Ansible tenant
Expand Down Expand Up @@ -67,13 +67,13 @@
- cm_add_bfd_interface_pol is changed
- nm_add_bfd_interface_pol is changed
- cm_add_bfd_interface_pol.previous == nm_add_bfd_interface_pol.previous == []
- nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.dn == "uni/tn-ansible_tenant/bfdIfPol-ansible_bfd_interface_policy"
- nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.name == "ansible_bfd_interface_policy"
- nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.descr == "Ansible BFD Interface Policy"
- nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.adminSt == "enabled"
- nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.detectMult == "3"
- nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.minRxIntvl == "50"
- nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.minTxIntvl == "50"
- cm_add_bfd_interface_pol.proposed.bfdIfPol.attributes.dn == nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.dn == "uni/tn-ansible_tenant/bfdIfPol-ansible_bfd_interface_policy"
- cm_add_bfd_interface_pol.proposed.bfdIfPol.attributes.name == nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.name == "ansible_bfd_interface_policy"
- cm_add_bfd_interface_pol.proposed.bfdIfPol.attributes.descr == nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.descr == "Ansible BFD Interface Policy"
- cm_add_bfd_interface_pol.proposed.bfdIfPol.attributes.adminSt == nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.adminSt == "enabled"
- cm_add_bfd_interface_pol.proposed.bfdIfPol.attributes.detectMult == nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.detectMult == "3"
- cm_add_bfd_interface_pol.proposed.bfdIfPol.attributes.minRxIntvl == nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.minRxIntvl == "50"
- cm_add_bfd_interface_pol.proposed.bfdIfPol.attributes.minTxIntvl == nm_add_bfd_interface_pol.current.0.bfdIfPol.attributes.minTxIntvl == "50"

- name: Add a new BFD Interface policy again - idempotency
cisco.aci.aci_bfd_interface_policy:
Expand Down Expand Up @@ -163,22 +163,42 @@
- query_result.current.0.bfdIfPol.attributes.dn == "uni/tn-ansible_tenant/bfdIfPol-ansible_bfd_interface_policy"
- query_result.current.0.bfdIfPol.attributes.name == "ansible_bfd_interface_policy"

- name: Remove a BFD Interface policy
- name: Remove a BFD Interface policy - check mode
cisco.aci.aci_bfd_interface_policy:
<<: *aci_info
tenant: ansible_tenant
name: ansible_bfd_interface_policy
state: absent
register: remove_bfd_interface_pol
check_mode: true
register: cm_remove_bfd_interface_pol

- name: Remove a BFD Interface policy - normal mode
cisco.aci.aci_bfd_interface_policy:
<<: *aci_info
tenant: ansible_tenant
name: ansible_bfd_interface_policy
state: absent
register: nm_remove_bfd_interface_pol

- name: Remove a BFD Interface policy again
cisco.aci.aci_bfd_interface_policy:
<<: *aci_info
tenant: ansible_tenant
name: ansible_bfd_interface_policy
state: absent
register: remove_bfd_interface_pol_again

- name: Verify removing BFD Interface Policies
assert:
that:
- remove_bfd_interface_pol is changed
- remove_bfd_interface_pol.previous != []
- remove_bfd_interface_pol.current == []

# Validating out of rage parameters.
- nm_remove_bfd_interface_pol is changed
- cm_remove_bfd_interface_pol is changed
- cm_remove_bfd_interface_pol.proposed == {}
- nm_remove_bfd_interface_pol.previous != []
- remove_bfd_interface_pol_again is not changed
- nm_remove_bfd_interface_pol.current == remove_bfd_interface_pol_again.current == []

# Validating out of range parameters.

# Added BFD Interface policy with out of the range detection_multiplier
- name: Add a new BFD Interface policy - out of the range detection_multiplier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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 Down Expand Up @@ -67,13 +67,13 @@
- cm_add_bfd_multihop_interface_pol is changed
- nm_add_bfd_multihop_interface_pol is changed
- cm_add_bfd_multihop_interface_pol.previous == nm_add_bfd_multihop_interface_pol.previous == []
- nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.dn == "uni/tn-ansible_tenant/bfdMhIfPol-ansible_bfd_multihop_interface_policy"
- nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.name == "ansible_bfd_multihop_interface_policy"
- nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.descr == "Ansible BFD Multihop Interface Policy"
- nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.adminSt == "enabled"
- nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.detectMult == "3"
- nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.minRxIntvl == "250"
- nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.minTxIntvl == "250"
- cm_add_bfd_multihop_interface_pol.proposed.bfdMhIfPol.attributes.dn == nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.dn == "uni/tn-ansible_tenant/bfdMhIfPol-ansible_bfd_multihop_interface_policy"
- cm_add_bfd_multihop_interface_pol.proposed.bfdMhIfPol.attributes.name == nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.name == "ansible_bfd_multihop_interface_policy"
- cm_add_bfd_multihop_interface_pol.proposed.bfdMhIfPol.attributes.descr == nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.descr == "Ansible BFD Multihop Interface Policy"
- cm_add_bfd_multihop_interface_pol.proposed.bfdMhIfPol.attributes.adminSt == nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.adminSt == "enabled"
- cm_add_bfd_multihop_interface_pol.proposed.bfdMhIfPol.attributes.detectMult == nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.detectMult == "3"
- cm_add_bfd_multihop_interface_pol.proposed.bfdMhIfPol.attributes.minRxIntvl == nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.minRxIntvl == "250"
- cm_add_bfd_multihop_interface_pol.proposed.bfdMhIfPol.attributes.minTxIntvl == nm_add_bfd_multihop_interface_pol.current.0.bfdMhIfPol.attributes.minTxIntvl == "250"

- name: Add a new BFD Multihop Interface policy again - idempotency
cisco.aci.aci_bfd_multihop_interface_policy:
Expand Down Expand Up @@ -163,20 +163,40 @@
- query_result.current.0.bfdMhIfPol.attributes.dn == "uni/tn-ansible_tenant/bfdMhIfPol-ansible_bfd_multihop_interface_policy"
- query_result.current.0.bfdMhIfPol.attributes.name == "ansible_bfd_multihop_interface_policy"

- name: Remove a BFD Multihop Interface policy
- name: Remove a BFD Multihop Interface policy - check mode
cisco.aci.aci_bfd_multihop_interface_policy:
<<: *aci_info
tenant: ansible_tenant
name: ansible_bfd_multihop_interface_policy
state: absent
register: remove_bfd_multihop_interface_pol
check_mode: true
register: cm_remove_bfd_multihop_interface_pol

- name: Remove a BFD Multihop Interface policy - normal mode
cisco.aci.aci_bfd_multihop_interface_policy:
<<: *aci_info
tenant: ansible_tenant
name: ansible_bfd_multihop_interface_policy
state: absent
register: nm_remove_bfd_multihop_interface_pol

- name: Remove a BFD Multihop Interface policy again - idempotency
cisco.aci.aci_bfd_multihop_interface_policy:
<<: *aci_info
tenant: ansible_tenant
name: ansible_bfd_multihop_interface_policy
state: absent
register: remove_bfd_multihop_interface_pol_again

- name: Verify removing BFD Multihop Interface Policies
assert:
that:
- remove_bfd_multihop_interface_pol is changed
- remove_bfd_multihop_interface_pol.previous != []
- remove_bfd_multihop_interface_pol.current == []
- nm_remove_bfd_multihop_interface_pol is changed
- cm_remove_bfd_multihop_interface_pol is changed
- cm_remove_bfd_multihop_interface_pol.proposed == nm_remove_bfd_multihop_interface_pol.proposed == {}
- nm_remove_bfd_multihop_interface_pol.previous != []
- remove_bfd_multihop_interface_pol_again is not changed
- nm_remove_bfd_multihop_interface_pol.current == remove_bfd_multihop_interface_pol_again.current == []

# Validating out of rage parameters.

Expand Down
Loading

0 comments on commit 3d4e551

Please sign in to comment.