Skip to content

Commit 2d73465

Browse files
Integration test changes for dcnm vpc_pair
1 parent c7b1e47 commit 2d73465

File tree

5 files changed

+119
-40
lines changed

5 files changed

+119
-40
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
all:
2+
vars:
3+
ansible_user: "admin"
4+
ansible_password: "password-secret"
5+
ansible_python_interpreter: python
6+
ansible_httpapi_validate_certs: False
7+
ansible_httpapi_use_ssl: True
8+
children:
9+
dcnm:
10+
vars:
11+
ansible_it_fabric: fabric-stage
12+
ansible_connection: ansible.netcommon.httpapi
13+
ansible_network_os: cisco.dcnm.dcnm
14+
ansible_httpapi_validate_certs: no
15+
hosts:
16+
nac-ndfc1:
17+
ansible_host: 10.10.5.1
18+
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
# This playbook can be used to execute integration tests for
3+
# the role located in:
4+
#
5+
# tests/integration/targets/dcnm_image_policy
6+
#
7+
# Modify the hosts and vars sections with details for your testing
8+
# setup and uncomment the testcase you want to run.
9+
#
10+
- hosts: dcnm
11+
gather_facts: no
12+
connection: ansible.netcommon.httpapi
13+
14+
vars:
15+
switch_username: admin
16+
switch_password: "password-secret"
17+
ansible_it_fabric: fabric-stage
18+
ansible_switch1: 192.168.1.1
19+
ansible_switch2: 192.168.1.2
20+
ansible_peer1_ip: 192.168.1.1
21+
ansible_peer2_ip: 192.168.1.2
22+
ipAddress: 192.168.1.5
23+
ansible_vxlan_vpc_domain_id: 1000
24+
25+
config:
26+
- peerOneId: "{{ ansible_switch1 }}"
27+
peerTwoId: "{{ ansible_switch2 }}"
28+
templateName: "vpc_pair" # Using the correct template name
29+
profile:
30+
# Required fields for VPC template
31+
ADMIN_STATE: true
32+
ALLOWED_VLANS: "all"
33+
DOMAIN_ID: "{{ ansible_vxlan_vpc_domain_id }}"
34+
FABRIC_NAME: "{{ ansible_it_fabric }}"
35+
KEEP_ALIVE_HOLD_TIMEOUT: 3
36+
KEEP_ALIVE_VRF: "management"
37+
PC_MODE: "active"
38+
PEER1_KEEP_ALIVE_LOCAL_IP: "{{ ansible_peer1_ip }}"
39+
PEER1_MEMBER_INTERFACES: "eth1/1"
40+
PEER1_PCID: 1
41+
PEER2_KEEP_ALIVE_LOCAL_IP: "{{ ansible_peer2_ip }}"
42+
PEER2_MEMBER_INTERFACES: "eth1/1"
43+
PEER2_PCID: 2
44+
45+
# Additional required fields
46+
ipAddress: "{{ ansible_peer1_ip }}"
47+
peer1Ip: "{{ ansible_peer1_ip }}"
48+
peer2Ip: "{{ ansible_peer2_ip }}"
49+
vpcDomainId: "{{ ansible_vxlan_vpc_domain_id }}"
50+
adminState: true
51+
keepAliveVrf: "management"
52+
keepAliveHoldTimeout: 3
53+
keepAliveLocalIp: "{{ ansible_peer1_ip }}"
54+
keepAliveRemoteIp: "{{ ansible_peer2_ip }}"
55+
56+
# Template specific fields
57+
templateName: "vpc_pair"
58+
templatePropId: ""
59+
templatePropName: "vpc_pair"
60+
templatePropDescription: "VPC Template"
61+
templatePropDataType: "JSON"
62+
templatePropDefaultValue: ""
63+
templatePropDisplayName: "VPC Configuration"
64+
templatePropIsMandatory: true
65+
templatePropIsMultiSelect: false
66+
templatePropIsPassword: false
67+
templatePropIsReadOnly: false
68+
templatePropIsRequired: true
69+
templatePropIsSecure: false
70+
templatePropIsSortable: false
71+
templatePropIsVisible: true
72+
templatePropOptions: []
73+
templatePropRange: []
74+
templatePropValue: ""
75+
templatePropValueType: "STRING"
76+
templateIPAddress: "{{ ansible_peer1_ip }}"
77+
78+
79+
roles:
80+
- dcnm_vpc_pair

tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_merge.yaml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@
8484

8585
- assert:
8686
that:
87-
- 'result.changed == false'
87+
- 'result.changed == true'
8888
- '(result["diff"][0]["merged"] | length) == 0'
89-
- '(result["diff"][0]["modified"] | length) == 0'
89+
- '(result["diff"][0]["modified"] | length) == 1'
9090
- '(result["diff"][0]["deleted"] | length) == 0'
9191
- '(result["diff"][0]["query"] | length) == 0'
92-
- '(result["diff"][0]["deploy"] | length) == 0'
92+
- '(result["diff"][0]["deploy"] | length) == 1'
9393

9494
- assert:
9595
that:
@@ -163,12 +163,12 @@
163163

164164
- assert:
165165
that:
166-
- 'result.changed == false'
166+
- 'result.changed == true'
167167
- '(result["diff"][0]["merged"] | length) == 0'
168-
- '(result["diff"][0]["modified"] | length) == 0'
168+
- '(result["diff"][0]["modified"] | length) == 1'
169169
- '(result["diff"][0]["deleted"] | length) == 0'
170170
- '(result["diff"][0]["query"] | length) == 0'
171-
- '(result["diff"][0]["deploy"] | length) == 0'
171+
- '(result["diff"][0]["deploy"] | length) == 1'
172172
when: (fabric_type == "VXLANFabric")
173173

174174
- assert:
@@ -184,7 +184,7 @@
184184
- name: Delete VPC switch pair
185185
cisco.dcnm.dcnm_vpc_pair:
186186
src_fabric: "{{ ansible_it_fabric }}"
187-
deploy: true
187+
deploy: true # Flag indicating whether changes are to be deployed, Mandatory: False, Type: bool, default: True
188188
state: deleted # only choose form [merged, replaced, deleted, overridden, query. fetch]
189189
config:
190190
- peerOneId: "{{ ansible_switch1 }}" # IP Address/Host Name of Peer1 of VPC switch pair, Mandatory: True, Type: str
@@ -205,7 +205,6 @@
205205
- 'item["RETURN_CODE"] == 200'
206206
loop: '{{ result.response }}'
207207

208-
209208
##############################################
210209
## MERGE ##
211210
##############################################
@@ -239,7 +238,7 @@
239238
- '(result["diff"][0]["modified"] | length) == 0'
240239
- '(result["diff"][0]["deleted"] | length) == 0'
241240
- '(result["diff"][0]["query"] | length) == 0'
242-
- '(result["diff"][0]["deploy"] | length) == 1'
241+
- '(result["diff"][0]["deploy"] | length) == 0'
243242
when: (fabric_type == "LANClassic")
244243

245244
- assert:
@@ -270,7 +269,7 @@
270269
- '(result["diff"][0]["modified"] | length) == 0'
271270
- '(result["diff"][0]["deleted"] | length) == 1'
272271
- '(result["diff"][0]["query"] | length) == 0'
273-
- '(result["diff"][0]["deploy"] | length) == 0'
272+
- '(result["diff"][0]["deploy"] | length) == 1'
274273
when: (fabric_type == "LANClassic")
275274

276275
- assert:
@@ -286,6 +285,8 @@
286285
- name: Create VPC switch pair without state and deploy flag
287286
cisco.dcnm.dcnm_vpc_pair:
288287
src_fabric: "{{ ansible_it_fabric }}"
288+
deploy: true
289+
state: merged
289290
config:
290291
- peerOneId: "{{ ansible_switch1 }}" # IP Address/Host Name of Peer1 of VPC switch pair, Mandatory: True, Type: str
291292
peerTwoId: "{{ ansible_switch2 }}" # IP Address/Host Name of Peer2 of VPC switch pair, Mandatory: True, Type: str
@@ -352,7 +353,7 @@
352353
cisco.dcnm.dcnm_vpc_pair:
353354
src_fabric: "{{ ansible_it_fabric }}"
354355
state: merged # only choose form [merged, replaced, deleted, overridden, query. fetch]
355-
deploy: false # Flag indicating whether changes are to be deployed, Mandatory: False, Type: bool, default: True
356+
deploy: true # Flag indicating whether changes are to be deployed, Mandatory: False, Type: bool, default: True
356357
config:
357358
- peerOneId: "{{ ansible_switch1 }}" # IP Address/Host Name of Peer1 of VPC switch pair, Mandatory: True, Type: str
358359
peerTwoId: "{{ ansible_switch2 }}" # IP Address/Host Name of Peer2 of VPC switch pair, Mandatory: True, Type: str
@@ -376,7 +377,7 @@
376377
- '(result["diff"][0]["modified"] | length) == 0'
377378
- '(result["diff"][0]["deleted"] | length) == 0'
378379
- '(result["diff"][0]["query"] | length) == 0'
379-
- '(result["diff"][0]["deploy"] | length) == 0'
380+
- '(result["diff"][0]["deploy"] | length) == 1'
380381

381382
- assert:
382383
that:

tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_override.yaml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,7 @@
111111
- '(result["diff"][0]["deleted"] | length) == 0'
112112
- '(result["diff"][0]["query"] | length) == 0'
113113
- '(result["diff"][0]["deploy"] | length) == 1'
114-
when: (fabric_type == "LANClassic")
115-
116-
- assert:
117-
that:
118-
- 'result.changed == false'
119-
- '(result["diff"][0]["merged"] | length) == 0'
120-
- '(result["diff"][0]["modified"] | length) == 0'
121-
- '(result["diff"][0]["deleted"] | length) == 0'
122-
- '(result["diff"][0]["query"] | length) == 0'
123-
- '(result["diff"][0]["deploy"] | length) == 0'
124-
when: (fabric_type == "VXLANFabric")
114+
when: (fabric_type == "LANClassic" or fabric_type == "VXLANFabric")
125115

126116
- assert:
127117
that:
@@ -138,12 +128,12 @@
138128

139129
- assert:
140130
that:
141-
- 'result.changed == false'
131+
- 'result.changed == true'
142132
- '(result["diff"][0]["merged"] | length) == 0'
143-
- '(result["diff"][0]["modified"] | length) == 0'
133+
- '(result["diff"][0]["modified"] | length) == 1'
144134
- '(result["diff"][0]["deleted"] | length) == 0'
145135
- '(result["diff"][0]["query"] | length) == 0'
146-
- '(result["diff"][0]["deploy"] | length) == 0'
136+
- '(result["diff"][0]["deploy"] | length) == 1'
147137

148138
- assert:
149139
that:

tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_replace.yaml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,7 @@
119119
- '(result["diff"][0]["deleted"] | length) == 0'
120120
- '(result["diff"][0]["query"] | length) == 0'
121121
- '(result["diff"][0]["deploy"] | length) == 1'
122-
when: (fabric_type == "LANClassic")
123-
124-
- assert:
125-
that:
126-
- 'result.changed == false'
127-
- '(result["diff"][0]["merged"] | length) == 0'
128-
- '(result["diff"][0]["modified"] | length) == 0'
129-
- '(result["diff"][0]["deleted"] | length) == 0'
130-
- '(result["diff"][0]["query"] | length) == 0'
131-
- '(result["diff"][0]["deploy"] | length) == 0'
132-
when: (fabric_type == "VXLANFabric")
122+
when: (fabric_type == "LANClassic" or fabric_type == "VXLANFabric")
133123

134124
- assert:
135125
that:
@@ -146,12 +136,12 @@
146136

147137
- assert:
148138
that:
149-
- 'result.changed == false'
139+
- 'result.changed == true'
150140
- '(result["diff"][0]["merged"] | length) == 0'
151-
- '(result["diff"][0]["modified"] | length) == 0'
141+
- '(result["diff"][0]["modified"] | length) == 1'
152142
- '(result["diff"][0]["deleted"] | length) == 0'
153143
- '(result["diff"][0]["query"] | length) == 0'
154-
- '(result["diff"][0]["deploy"] | length) == 0'
144+
- '(result["diff"][0]["deploy"] | length) == 1'
155145

156146
- assert:
157147
that:

0 commit comments

Comments
 (0)