blob: a662a2e6f592853cc018c20ff5d24ac676aa3f29 (
plain)
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
---
- debug: msg="START connection={{ ansible_connection }} nxos_bgp parameter test"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: "Disable feature BGP"
nxos_feature:
feature: bgp
state: disabled
ignore_errors: yes
- name: "Enable feature BGP"
nxos_feature:
feature: bgp
state: enabled
ignore_errors: yes
- block:
- name: "set multi vrf params"
nxos_bgp: &set_multi_vrf
asn: 65535
vrf: "{{ item }}"
router_id: 192.0.2.1
bestpath_always_compare_med: true
bestpath_aspath_multipath_relax: true
bestpath_compare_routerid: true
bestpath_cost_community_ignore: true
bestpath_med_confed: true
bestpath_med_missing_as_worst: true
bestpath_med_non_deterministic: true
# grace_restart is failing with error code -32603 only on CLI transport, nxapi ok
# graceful_restart: false
graceful_restart_helper: true
log_neighbor_changes: true
maxas_limit: 50
with_items: "{{ vrfs }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Check Idempotence"
nxos_bgp: *set_multi_vrf
with_items: "{{ vrfs }}"
register: result
- assert: &false
that:
- "result.changed == false"
- name: "reset multi vrf params"
nxos_bgp: &reset_multi_vrf
asn: 65535
vrf: "{{ item }}"
bestpath_always_compare_med: false
bestpath_aspath_multipath_relax: false
bestpath_compare_routerid: false
bestpath_cost_community_ignore: false
bestpath_med_confed: false
bestpath_med_missing_as_worst: false
bestpath_med_non_deterministic: false
graceful_restart_helper: false
log_neighbor_changes: false
maxas_limit: default
router_id: default
with_items: "{{ vrfs }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp: *reset_multi_vrf
with_items: "{{ vrfs }}"
register: result
- assert: *false
- name: "set clusterid"
nxos_bgp: &set_cluster_id
asn: 65535
vrf: "{{ item }}"
cluster_id: 10.0.0.1
with_items: "{{ vrfs }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp: *set_cluster_id
with_items: "{{ vrfs }}"
register: result
- assert: *false
- name: "reset cluster_id"
nxos_bgp: &reset_cluster_id
asn: 65535
vrf: "{{ item }}"
cluster_id: default
with_items: "{{ vrfs }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp: *reset_cluster_id
with_items: "{{ vrfs }}"
register: result
- assert: *false
- name: "set confederation"
nxos_bgp: &set_confederation
asn: 65535
confederation_id: 99
confederation_peers:
- 16
- 22
- 18
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp: *set_confederation
register: result
- assert: *false
- name: "reset confederation"
nxos_bgp: &reset_confederation
asn: 65535
confederation_id: default
confederation_peers: default
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp: *reset_confederation
register: result
- assert: *false
- name: "set confederation_local_as"
nxos_bgp: &set_confederation_la
asn: 65535
vrf: myvrf
local_as: 33
confederation_id: 99
confederation_peers:
- 16
- 22
- 18
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp: *set_confederation_la
register: result
- assert: *false
- name: "reset confederation local_as"
nxos_bgp: &reset_confederation_la
asn: 65535
vrf: myvrf
local_as: default
confederation_id: default
confederation_peers: default
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp: *reset_confederation_la
register: result
- assert: *false
- name: "set local_as"
nxos_bgp: &set_local_as
asn: 65535
vrf: myvrf
local_as: 33
confederation_id: 99
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp: *set_local_as
register: result
- assert: *false
- name: "reset local_as"
nxos_bgp: &reset_local_as
asn: 65535
vrf: myvrf
confederation_id: default
local_as: default
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp: *reset_local_as
register: result
- assert: *false
- name: "set default vrf params"
nxos_bgp: &set_def_vrf
asn: 65535
event_history_cli: size_medium
event_history_detail: size_large
event_history_events: size_medium
event_history_periodic: size_small
enforce_first_as: false
fast_external_fallover: false
flush_routes: true
shutdown: true
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp: *set_def_vrf
register: result
- assert: *false
- name: "reset default vrf params"
nxos_bgp: &reset_def_vrf
asn: 65535
event_history_detail: default
enforce_first_as: true
fast_external_fallover: true
flush_routes: false
shutdown: false
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp: *reset_def_vrf
register: result
- assert: *false
always:
- name: "Disable feature bgp"
nxos_feature:
feature: bgp
state: disabled
ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_bgp parameter test"
|