Skip to content

Commit

Permalink
[ignore] Modify conditions to add missing child classes and add FQCN …
Browse files Browse the repository at this point in the history
…notation in all test cases for aci_tenant_action_rule_profile.
  • Loading branch information
gmicol committed Nov 6, 2023
1 parent aa9c1a2 commit 8594300
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 67 deletions.
14 changes: 9 additions & 5 deletions plugins/modules/aci_tenant_action_rule_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@
description:
- The set action rule based on nexthop unchanged configuration.
- Can not be configured along with C(set_route_tag).
- Can not be configured for APIC version 4.2 and prior.
- The APIC defaults to C(false) when unset.
type: bool
multipath:
description:
- Set action rule based on set redistribute multipath configuration.
- Can not be configured along with C(set_route_tag).
- Can not be configured for APIC version 4.2 and prior.
- The APIC defaults to C(false) when unset.
type: bool
set_preference:
Expand Down Expand Up @@ -381,9 +383,7 @@ def main():
rtctrlSetComm=dict(attribute_input=module.params.get("set_community")),
rtctrlSetDamp=dict(attribute_input=module.params.get("set_dampening")),
rtctrlSetNh=dict(attribute_input=module.params.get("set_next_hop"), attribute_name="addr"),
rtctrlSetNhUnchanged=dict(attribute_input=module.params.get("next_hop_propagation")),
rtctrlSetPref=dict(attribute_input=module.params.get("set_preference"), attribute_name="localPref"),
rtctrlSetRedistMultipath=dict(attribute_input=module.params.get("multipath")),
rtctrlSetRtMetric=dict(attribute_input=module.params.get("set_metric"), attribute_name="metric"),
rtctrlSetRtMetricType=dict(
attribute_input=MATCH_ACTION_RULE_SET_METRIC_TYPE_MAPPING.get(module.params.get("set_metric_type")), attribute_name="metricType"
Expand All @@ -393,9 +393,13 @@ def main():
)

# This condition deal with child classes which do not exist in APIC version 4.2 and prior.
for class_name in ["rtctrlSetNhUnchanged", "rtctrlSetRedistMultipath"]:
if child_classes[class_name].get("attribute_input") is None:
child_classes.pop(class_name)
additional_child_classes = dict(
rtctrlSetNhUnchanged=dict(attribute_input=module.params.get("next_hop_propagation")),
rtctrlSetRedistMultipath=dict(attribute_input=module.params.get("multipath")),
)
for class_name, attribute in additional_child_classes.items():
if attribute.get("attribute_input") is not None:
child_classes[class_name] = attribute

aci.construct_url(
root_class=dict(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# 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
Expand All @@ -33,22 +33,22 @@
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 new action rule profile
aci_tenant_action_rule_profile: &aci_action_rule_present
cisco.aci.aci_tenant_action_rule_profile: &aci_action_rule_present
<<: *aci_info
tenant: ansible_tenant
action_rule: ansible_action_rule
description: Ansible action rule profile for ansible_tenant tenant
state: present

- name: Add a additional communities action rule (check_mode)
aci_action_rule_additional_communities: &aci_action_rule_additional_communities_present
cisco.aci.aci_action_rule_additional_communities: &aci_action_rule_additional_communities_present
<<: *aci_info
tenant: ansible_tenant
action_rule: ansible_action_rule
Expand All @@ -59,17 +59,17 @@
register: cm_add_action_rule_add_comm

- name: Add a additional communities action rule again (normal_mode)
aci_action_rule_additional_communities:
cisco.aci.aci_action_rule_additional_communities:
<<: *aci_action_rule_additional_communities_present
register: nm_add_action_rule_add_comm

- name: Add a additional communities action rule again - testing idempotency
aci_action_rule_additional_communities:
cisco.aci.aci_action_rule_additional_communities:
<<: *aci_action_rule_additional_communities_present
register: nm_add_action_rule_add_comm_idempotency

- name: Add a additional communities action rule
aci_action_rule_additional_communities:
cisco.aci.aci_action_rule_additional_communities:
<<: *aci_info
tenant: ansible_tenant
action_rule: ansible_action_rule
Expand All @@ -93,13 +93,13 @@
- nm_add_action_rule_add_comm_2.current.0.rtctrlSetAddComm.attributes.setCriteria == "append"

- name: Query all additional communities action rules
aci_action_rule_additional_communities:
cisco.aci.aci_action_rule_additional_communities:
<<: *aci_info
state: query
register: query_all_action_rule_add_comm

- name: Query ansible_action_rule_add_comm additional communities action rule
aci_action_rule_additional_communities:
cisco.aci.aci_action_rule_additional_communities:
<<: *aci_action_rule_additional_communities_present
state: query
register: query_action_rule_add_comm
Expand All @@ -114,19 +114,19 @@
- query_action_rule_add_comm.current.0.rtctrlSetAddComm.attributes.setCriteria == "append"

- name: Remove additional communities action rule (check_mode)
aci_action_rule_additional_communities: &aci_action_rule_additional_communities_absent
cisco.aci.aci_action_rule_additional_communities: &aci_action_rule_additional_communities_absent
<<: *aci_action_rule_additional_communities_present
state: absent
check_mode: true
register: cm_remove_action_rule_add_comm

- name: Remove additional communities action rule (normal_mode)
aci_action_rule_additional_communities:
cisco.aci.aci_action_rule_additional_communities:
<<: *aci_action_rule_additional_communities_absent
register: nm_remove_remove_action_rule_add_comm

- name: Remove additional communities action rule again - testing previous Removal
aci_action_rule_additional_communities:
cisco.aci.aci_action_rule_additional_communities:
<<: *aci_action_rule_additional_communities_absent
register: nm_remove_action_rule_add_comm_idempotency

Expand All @@ -142,6 +142,6 @@
- nm_remove_action_rule_add_comm_idempotency.previous == []

- name: Remove the ansible_tenant - cleanup before ending tests
aci_tenant:
cisco.aci.aci_tenant:
<<: *aci_tenant_present
state: absent
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# 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
Expand All @@ -33,22 +33,22 @@
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 new action rule profile
aci_tenant_action_rule_profile: &aci_action_rule_present
cisco.aci.aci_tenant_action_rule_profile: &aci_action_rule_present
<<: *aci_info
tenant: ansible_tenant
action_rule: ansible_action_rule
description: Ansible action rule profile for ansible_tenant tenant
state: present

- name: Add a set AS path action rule (check_mode)
aci_action_rule_set_as_path: &aci_action_rule_set_as_path_present
cisco.aci.aci_action_rule_set_as_path: &aci_action_rule_set_as_path_present
<<: *aci_info
tenant: ansible_tenant
action_rule: ansible_action_rule
Expand All @@ -59,17 +59,17 @@
register: cm_add_action_rule_set_as_path

- name: Add a set AS path action rule again (normal_mode)
aci_action_rule_set_as_path:
cisco.aci.aci_action_rule_set_as_path:
<<: *aci_action_rule_set_as_path_present
register: nm_add_action_rule_set_as_path

- name: Add a set AS path action rule again - testing idempotency
aci_action_rule_set_as_path:
cisco.aci.aci_action_rule_set_as_path:
<<: *aci_action_rule_set_as_path_present
register: nm_add_action_rule_set_as_path_idempotency

- name: Add a set AS path action rule
aci_action_rule_set_as_path:
cisco.aci.aci_action_rule_set_as_path:
<<: *aci_info
tenant: ansible_tenant
action_rule: ansible_action_rule
Expand All @@ -94,13 +94,13 @@
- nm_add_action_rule_set_as_path_2.current.0.rtctrlSetASPath.attributes.criteria == "prepend-last-as"

- name: Query all set AS path action rules
aci_action_rule_set_as_path:
cisco.aci.aci_action_rule_set_as_path:
<<: *aci_info
state: query
register: query_all_action_rule_set_as_path

- name: Query ansible_action_rule_set_as_path set AS path action rule
aci_action_rule_set_as_path:
cisco.aci.aci_action_rule_set_as_path:
<<: *aci_action_rule_set_as_path_present
state: query
register: query_action_rule_set_as_path
Expand All @@ -115,19 +115,19 @@
- query_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.criteria == "prepend"

- name: Remove set AS path action rule (check_mode)
aci_action_rule_set_as_path: &aci_action_rule_set_as_path_absent
cisco.aci.aci_action_rule_set_as_path: &aci_action_rule_set_as_path_absent
<<: *aci_action_rule_set_as_path_present
state: absent
check_mode: true
register: cm_remove_action_rule_set_as_path

- name: Remove set AS path action rule (normal_mode)
aci_action_rule_set_as_path:
cisco.aci.aci_action_rule_set_as_path:
<<: *aci_action_rule_set_as_path_absent
register: nm_remove_remove_action_rule_set_as_path

- name: Remove set AS path action rule again - testing previous Removal
aci_action_rule_set_as_path:
cisco.aci.aci_action_rule_set_as_path:
<<: *aci_action_rule_set_as_path_absent
register: nm_remove_action_rule_set_as_path_idempotency

Expand All @@ -143,6 +143,6 @@
- nm_remove_action_rule_set_as_path_idempotency.previous == []

- name: Remove the ansible_tenant - cleanup before ending tests
aci_tenant:
cisco.aci.aci_tenant:
<<: *aci_tenant_present
state: absent
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# 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
Expand All @@ -33,30 +33,30 @@
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 new action rule profile
aci_tenant_action_rule_profile: &aci_action_rule_present
cisco.aci.aci_tenant_action_rule_profile: &aci_action_rule_present
<<: *aci_info
tenant: ansible_tenant
action_rule: ansible_action_rule
description: Ansible action rule profile for ansible_tenant tenant
state: present

- name: Add a set AS path action rule
aci_action_rule_set_as_path: &aci_action_rule_set_as_path_present
cisco.aci.aci_action_rule_set_as_path: &aci_action_rule_set_as_path_present
<<: *aci_info
tenant: ansible_tenant
action_rule: ansible_action_rule
criteria: prepend
state: present

- name: Add a set AS path ASN action rule (check_mode)
aci_action_rule_set_as_path_asn: &aci_action_rule_set_as_path_asn_present
cisco.aci.aci_action_rule_set_as_path_asn: &aci_action_rule_set_as_path_asn_present
<<: *aci_info
tenant: ansible_tenant
action_rule: ansible_action_rule
Expand All @@ -67,17 +67,17 @@
register: cm_add_action_rule_set_as_path_asn

- name: Add a set AS path ASN action rule again (normal_mode)
aci_action_rule_set_as_path_asn:
cisco.aci.aci_action_rule_set_as_path_asn:
<<: *aci_action_rule_set_as_path_asn_present
register: nm_add_action_rule_set_as_path_asn

- name: Add a set AS path ASN action rule again - testing idempotency
aci_action_rule_set_as_path_asn:
cisco.aci.aci_action_rule_set_as_path_asn:
<<: *aci_action_rule_set_as_path_asn_present
register: nm_add_action_rule_set_as_path_asn_idempotency

- name: Add a set AS path ASN action rule
aci_action_rule_set_as_path_asn:
cisco.aci.aci_action_rule_set_as_path_asn:
<<: *aci_info
tenant: ansible_tenant
action_rule: ansible_action_rule
Expand All @@ -102,13 +102,13 @@
- nm_add_action_rule_set_as_path_asn_2.current.0.rtctrlSetASPathASN.attributes.order == "2"

- name: Query all set AS path ASN action rules
aci_action_rule_set_as_path_asn:
cisco.aci.aci_action_rule_set_as_path_asn:
<<: *aci_info
state: query
register: query_all_action_rule_set_as_path_asn

- name: Query ansible_action_rule_set_as_path_asn set AS path ASN action rule
aci_action_rule_set_as_path_asn:
cisco.aci.aci_action_rule_set_as_path_asn:
<<: *aci_action_rule_set_as_path_asn_present
state: query
register: query_action_rule_set_as_path_asn
Expand All @@ -123,19 +123,19 @@
- query_action_rule_set_as_path_asn.current.0.rtctrlSetASPathASN.attributes.order == "1"

- name: Remove set AS path ASN action rule (check_mode)
aci_action_rule_set_as_path_asn: &aci_action_rule_set_as_path_asn_absent
cisco.aci.aci_action_rule_set_as_path_asn: &aci_action_rule_set_as_path_asn_absent
<<: *aci_action_rule_set_as_path_asn_present
state: absent
check_mode: true
register: cm_remove_action_rule_set_as_path_asn

- name: Remove set AS path ASN action rule (normal_mode)
aci_action_rule_set_as_path_asn:
cisco.aci.aci_action_rule_set_as_path_asn:
<<: *aci_action_rule_set_as_path_asn_absent
register: nm_remove_remove_action_rule_set_as_path_asn

- name: Remove set AS path ASN action rule again - testing previous Removal
aci_action_rule_set_as_path_asn:
cisco.aci.aci_action_rule_set_as_path_asn:
<<: *aci_action_rule_set_as_path_asn_absent
register: nm_remove_action_rule_set_as_path_asn_idempotency

Expand All @@ -151,6 +151,6 @@
- nm_remove_action_rule_set_as_path_asn_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 8594300

Please sign in to comment.