-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathtest_idempotency_network_object.yml
More file actions
140 lines (125 loc) · 4.41 KB
/
Copy pathtest_idempotency_network_object.yml
File metadata and controls
140 lines (125 loc) · 4.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
- hosts: vftd
connection: httpapi
tasks:
- name: addNetworkObject should create a new network
ftd_configuration:
operation: 'addNetworkObject'
data:
name: "ansible-test-network"
description: "Ansible Integration tests in action"
subType: "HOST"
value: "192.22.22.24"
type: "networkobject"
register_as: "testObj"
register: result
- assert:
that:
- result.changed == true
- testObj['name'] == "ansible-test-network"
- testObj['subType'] == "HOST"
- name: addNetworkObject should NOT create a network when the network with the same name exists
ftd_configuration:
operation: 'addNetworkObject'
data:
name: "ansible-test-network"
description: "Ansible Integration tests in action"
subType: "HOST"
value: "192.22.22.24"
type: "networkobject"
register_as: "sameTestObj"
register: result
- assert:
that:
- result.changed == false
- sameTestObj['id'] == testObj['id']
- sameTestObj['name'] == "ansible-test-network"
- name: addNetworkObject should raise an error when the network with the same name but different params exists
ftd_configuration:
operation: 'addNetworkObject'
data:
name: "ansible-test-network"
description: "Ansible Integration tests in action"
subType: "NETWORK"
value: "192.22.22.24/12"
type: "networkobject"
register: result
ignore_errors: yes
- assert:
that:
- result.changed == false
- result.failed == true
- "'An object with the same name but different parameters already exists' in result.msg"
- name: upsertNetworkObject should update the existing network when it exists
ftd_configuration:
operation: 'upsertNetworkObject'
data:
name: "ansible-test-network"
description: "Ansible Integration tests in action"
subType: "NETWORK"
value: "192.23.23.0/24"
type: "networkobject"
register_as: "upsertedTestObj"
register: result
- assert:
that:
- result.changed == true
- upsertedTestObj['id'] == testObj['id']
- upsertedTestObj['subType'] == "NETWORK"
- upsertedTestObj['value'] == "192.23.23.0/24"
- name: editNetworkObject should update the existing network
ftd_configuration:
operation: 'editNetworkObject'
path_params:
objId: "{{ upsertedTestObj['id'] }}"
data:
version: "{{ upsertedTestObj['version'] }}"
name: "ansible-test-network"
description: "Ansible Integration tests in action"
subType: "NETWORK"
value: "192.168.2.0/24"
type: "networkobject"
register_as: "updatedTestObj"
register: result
- assert:
that:
- result.changed == true
- updatedTestObj['id'] == testObj['id']
- updatedTestObj['subType'] == "NETWORK"
- updatedTestObj['value'] == "192.168.2.0/24"
- name: editNetworkObject should NOT update the network if there are no changes
ftd_configuration:
operation: 'editNetworkObject'
path_params:
objId: "{{ updatedTestObj['id'] }}"
data:
version: "{{ updatedTestObj['version'] }}"
name: "ansible-test-network"
description: "Ansible Integration tests in action"
subType: "NETWORK"
value: "192.168.2.0/24"
type: "networkobject"
register_as: "updatedTestObj"
register: result
- assert:
that:
- result.changed == false
- updatedTestObj['id'] == testObj['id']
- name: deleteNetworkObject should delete the network
ftd_configuration:
operation: 'deleteNetworkObject'
path_params:
objId: "{{ testObj['id'] }}"
register: result
- assert:
that:
- result.changed == true
- name: deleteNetworkObject should silently pass when the referenced network does not exist
ftd_configuration:
operation: 'deleteNetworkObject'
path_params:
objId: "{{ testObj['id'] }}"
register: result
- assert:
that:
- result.changed == false
- "'Referenced object does not exist' in result.response.status"