Skip to content

Commit d36e36f

Browse files
akinrosslhercot
authored andcommitted
[ignore] fix tests for aci_action_rule_set_as_path
1 parent abe4efb commit d36e36f

1 file changed

Lines changed: 100 additions & 50 deletions

File tree

  • tests/integration/targets/aci_action_rule_set_as_path/tasks

tests/integration/targets/aci_action_rule_set_as_path/tasks/main.yml

Lines changed: 100 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,100 +19,150 @@
1919
use_proxy: '{{ aci_use_proxy | default(true) }}'
2020
output_level: debug
2121

22-
# CLEAN ENVIRONMENT
23-
- name: Remove the ansible_tenant
24-
cisco.aci.aci_tenant: &aci_tenant_absent
25-
<<: *aci_info
26-
tenant: ansible_tenant
27-
state: absent
28-
2922
- name: Verify Cloud and Non-Cloud Sites in use.
3023
ansible.builtin.include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml
3124

3225
- name: Execute tasks only for non-cloud sites
3326
when: query_cloud.current == [] # This condition will execute only non-cloud sites
3427
block: # block specifies execution of tasks within, based on conditions
35-
- name: Add a new tenant
36-
cisco.aci.aci_tenant: &aci_tenant_present
28+
29+
- name: Remove the ansible_tenant
30+
cisco.aci.aci_tenant: &aci_tenant_absent
3731
<<: *aci_info
3832
tenant: ansible_tenant
39-
description: Ansible tenant
33+
state: absent
34+
35+
- name: Add a new tenant
36+
cisco.aci.aci_tenant:
37+
<<: *aci_tenant_absent
4038
state: present
4139

42-
- name: Add a new action rule profile
43-
cisco.aci.aci_tenant_action_rule_profile: &aci_action_rule_present
40+
- name: Add a two action rule profiles
41+
cisco.aci.aci_tenant_action_rule_profile:
4442
<<: *aci_info
4543
tenant: ansible_tenant
46-
action_rule: ansible_action_rule
47-
description: Ansible action rule profile for ansible_tenant tenant
44+
action_rule: "{{ item }}"
45+
description: description_on_create
4846
state: present
47+
loop:
48+
- ansible_action_rule
49+
- ansible_action_rule_2
4950

5051
- name: Add a set AS path action rule (check_mode)
5152
cisco.aci.aci_action_rule_set_as_path: &aci_action_rule_set_as_path_present
5253
<<: *aci_info
5354
tenant: ansible_tenant
5455
action_rule: ansible_action_rule
55-
last_as_number: 0
5656
criteria: prepend
5757
state: present
5858
check_mode: true
5959
register: cm_add_action_rule_set_as_path
6060

61-
- name: Add a set AS path action rule again (normal_mode)
61+
- name: Add a set AS path action rule again
6262
cisco.aci.aci_action_rule_set_as_path:
6363
<<: *aci_action_rule_set_as_path_present
6464
register: nm_add_action_rule_set_as_path
6565

6666
- name: Add a set AS path action rule again - testing idempotency
6767
cisco.aci.aci_action_rule_set_as_path:
6868
<<: *aci_action_rule_set_as_path_present
69-
register: nm_add_action_rule_set_as_path_idempotency
70-
71-
- name: Add a set AS path action rule
72-
cisco.aci.aci_action_rule_set_as_path:
73-
<<: *aci_info
74-
tenant: ansible_tenant
75-
action_rule: ansible_action_rule
76-
last_as_number: 2
77-
criteria: prepend-last-as
78-
state: present
79-
register: nm_add_action_rule_set_as_path_2
69+
register: nm_add_action_rule_set_as_path_again
8070

8171
- name: Asserts for set AS path action rule creation tasks
8272
ansible.builtin.assert:
8373
that:
8474
- cm_add_action_rule_set_as_path is changed
8575
- cm_add_action_rule_set_as_path.previous == []
8676
- cm_add_action_rule_set_as_path.current == []
77+
- cm_add_action_rule_set_as_path.proposed.rtctrlSetASPath.attributes.lastnum is not defined
78+
- cm_add_action_rule_set_as_path.proposed.rtctrlSetASPath.attributes.criteria == "prepend"
79+
- cm_add_action_rule_set_as_path.proposed.rtctrlSetASPath.attributes.descr is not defined
8780
- nm_add_action_rule_set_as_path is changed
8881
- nm_add_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.lastnum == "0"
8982
- nm_add_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.criteria == "prepend"
90-
- nm_add_action_rule_set_as_path_idempotency is not changed
91-
- nm_add_action_rule_set_as_path_2 is changed
92-
- nm_add_action_rule_set_as_path_2.previous == []
93-
- nm_add_action_rule_set_as_path_2.current.0.rtctrlSetASPath.attributes.lastnum == "2"
94-
- nm_add_action_rule_set_as_path_2.current.0.rtctrlSetASPath.attributes.criteria == "prepend-last-as"
83+
- nm_add_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.descr == ""
84+
- nm_add_action_rule_set_as_path_again is not changed
85+
- nm_add_action_rule_set_as_path_again.previous == nm_add_action_rule_set_as_path_again.current == nm_add_action_rule_set_as_path.current
86+
87+
- name: Update a set AS path action rule (check_mode)
88+
cisco.aci.aci_action_rule_set_as_path: &update_action_rule_set_as_path
89+
<<: *aci_action_rule_set_as_path_present
90+
description: description_on_update
91+
check_mode: true
92+
register: cm_update_action_rule_set_as_path
93+
94+
- name: Update a set AS path action rule
95+
cisco.aci.aci_action_rule_set_as_path:
96+
<<: *update_action_rule_set_as_path
97+
register: nm_update_action_rule_set_as_path
98+
99+
- name: Update a set AS path action rule again
100+
cisco.aci.aci_action_rule_set_as_path:
101+
<<: *update_action_rule_set_as_path
102+
register: nm_update_action_rule_set_as_path_again
103+
104+
- name: Asserts for set AS path action rule update tasks
105+
ansible.builtin.assert:
106+
that:
107+
- cm_update_action_rule_set_as_path is changed
108+
- cm_update_action_rule_set_as_path.previous == nm_add_action_rule_set_as_path.current
109+
- cm_update_action_rule_set_as_path.proposed.rtctrlSetASPath.attributes.lastnum is not defined
110+
- cm_update_action_rule_set_as_path.proposed.rtctrlSetASPath.attributes.criteria == "prepend"
111+
- cm_update_action_rule_set_as_path.proposed.rtctrlSetASPath.attributes.descr == "description_on_update"
112+
- nm_update_action_rule_set_as_path is changed
113+
- nm_update_action_rule_set_as_path.previous == nm_add_action_rule_set_as_path.current
114+
- nm_update_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.lastnum == "0"
115+
- nm_update_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.criteria == "prepend"
116+
- nm_update_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.descr == "description_on_update"
117+
- nm_update_action_rule_set_as_path_again is not changed
118+
- nm_update_action_rule_set_as_path_again.previous == nm_update_action_rule_set_as_path_again.current == nm_update_action_rule_set_as_path.current
119+
120+
- name: Create another set AS path action rule with prepend-last-as criteria
121+
cisco.aci.aci_action_rule_set_as_path: &aci_action_rule_set_as_path_2_present
122+
<<: *aci_action_rule_set_as_path_present
123+
action_rule: ansible_action_rule_2
124+
last_as: 2
125+
criteria: prepend-last-as
126+
register: nm_create_another_action_rule_set_as_path
127+
128+
- name: Update another set AS path action rule with prepend-last-as criteria
129+
cisco.aci.aci_action_rule_set_as_path:
130+
<<: *aci_action_rule_set_as_path_2_present
131+
last_as: 4
132+
register: nm_update_another_action_rule_set_as_path
133+
134+
- name: Asserts for set AS path action rule update tasks
135+
ansible.builtin.assert:
136+
that:
137+
- nm_create_another_action_rule_set_as_path is changed
138+
- nm_create_another_action_rule_set_as_path.previous == []
139+
- nm_create_another_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.lastnum == "2"
140+
- nm_create_another_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.criteria == "prepend-last-as"
141+
- nm_update_another_action_rule_set_as_path is changed
142+
- nm_update_another_action_rule_set_as_path.previous == nm_create_another_action_rule_set_as_path.current
143+
- nm_update_another_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.lastnum == "4"
144+
- nm_update_another_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.criteria == "prepend-last-as"
95145

96146
- name: Query all set AS path action rules
97147
cisco.aci.aci_action_rule_set_as_path:
98148
<<: *aci_info
99149
state: query
100-
register: query_all_action_rule_set_as_path
150+
register: query_all
101151

102152
- name: Query ansible_action_rule_set_as_path set AS path action rule
103153
cisco.aci.aci_action_rule_set_as_path:
104154
<<: *aci_action_rule_set_as_path_present
105155
state: query
106-
register: query_action_rule_set_as_path
156+
register: query_one
107157

108158
- name: Asserts query tasks
109159
ansible.builtin.assert:
110160
that:
111-
- query_all_action_rule_set_as_path is not changed
112-
- query_all_action_rule_set_as_path.current|length >= 2
113-
- query_action_rule_set_as_path is not changed
114-
- query_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.lastnum == "0"
115-
- query_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.criteria == "prepend"
161+
- query_all is not changed
162+
- query_all.current | length >= 2
163+
- query_one is not changed
164+
- query_one.current.0.rtctrlSetASPath.attributes.lastnum == "0"
165+
- query_one.current.0.rtctrlSetASPath.attributes.criteria == "prepend"
116166

117167
- name: Remove set AS path action rule (check_mode)
118168
cisco.aci.aci_action_rule_set_as_path: &aci_action_rule_set_as_path_absent
@@ -121,28 +171,28 @@
121171
check_mode: true
122172
register: cm_remove_action_rule_set_as_path
123173

124-
- name: Remove set AS path action rule (normal_mode)
174+
- name: Remove set AS path action rule
125175
cisco.aci.aci_action_rule_set_as_path:
126176
<<: *aci_action_rule_set_as_path_absent
127-
register: nm_remove_remove_action_rule_set_as_path
177+
register: nm_remove_action_rule_set_as_path
128178

129-
- name: Remove set AS path action rule again - testing previous Removal
179+
- name: Remove set AS path action rule again
130180
cisco.aci.aci_action_rule_set_as_path:
131181
<<: *aci_action_rule_set_as_path_absent
132-
register: nm_remove_action_rule_set_as_path_idempotency
182+
register: nm_remove_action_rule_set_as_path_again
133183

134184
- name: Asserts deletion tasks
135185
ansible.builtin.assert:
136186
that:
137187
- cm_remove_action_rule_set_as_path is changed
138188
- cm_remove_action_rule_set_as_path.proposed == {}
139-
- nm_remove_remove_action_rule_set_as_path is changed
140-
- nm_remove_remove_action_rule_set_as_path.previous != []
141-
- nm_remove_remove_action_rule_set_as_path.method == "DELETE"
142-
- nm_remove_action_rule_set_as_path_idempotency is not changed
143-
- nm_remove_action_rule_set_as_path_idempotency.previous == []
189+
- cm_remove_action_rule_set_as_path.previous == nm_update_action_rule_set_as_path.current
190+
- nm_remove_action_rule_set_as_path is changed
191+
- nm_remove_action_rule_set_as_path.previous == nm_update_action_rule_set_as_path.current
192+
- nm_remove_action_rule_set_as_path.current == []
193+
- nm_remove_action_rule_set_as_path_again is not changed
194+
- nm_remove_action_rule_set_as_path_again.previous == nm_remove_action_rule_set_as_path_again.current == nm_remove_action_rule_set_as_path.current
144195

145196
- name: Remove the ansible_tenant - cleanup before ending tests
146197
cisco.aci.aci_tenant:
147-
<<: *aci_tenant_present
148-
state: absent
198+
<<: *aci_tenant_absent

0 commit comments

Comments
 (0)