Debian Codegraph @

ansible_collections/dellemc/enterprise_sonic/docs/dellemc.enterprise_sonic.sonic_acl_interfaces_module.rst

raw
1 .. _dellemc.enterprise_sonic.sonic_acl_interfaces_module:
2
3
4 *********************************************
5 dellemc.enterprise_sonic.sonic_acl_interfaces
6 *********************************************
7
8 **Manage access control list (ACL) to interface binding on SONiC**
9
10
11 Version added: 2.1.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module provides configuration management of applying access control lists (ACL) to interfaces in devices running SONiC.
21 - ACL needs to be created earlier in the device.
22
23
24
25
26 Parameters
27 ----------
28
29 .. raw:: html
30
31 <table border=0 cellpadding=0 class="documentation-table">
32 <tr>
33 <th colspan="4">Parameter</th>
34 <th>Choices/<font color="blue">Defaults</font></th>
35 <th width="100%">Comments</th>
36 </tr>
37 <tr>
38 <td colspan="4">
39 <div class="ansibleOptionAnchor" id="parameter-"></div>
40 <b>config</b>
41 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
42 <div style="font-size: small">
43 <span style="color: purple">list</span>
44 / <span style="color: purple">elements=dictionary</span>
45 </div>
46 </td>
47 <td>
48 </td>
49 <td>
50 <div>Specifies interface access-group configurations.</div>
51 </td>
52 </tr>
53 <tr>
54 <td class="elbow-placeholder"></td>
55 <td colspan="3">
56 <div class="ansibleOptionAnchor" id="parameter-"></div>
57 <b>access_groups</b>
58 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
59 <div style="font-size: small">
60 <span style="color: purple">list</span>
61 / <span style="color: purple">elements=dictionary</span>
62 </div>
63 </td>
64 <td>
65 </td>
66 <td>
67 <div>Access-group configurations to be set for the interface.</div>
68 </td>
69 </tr>
70 <tr>
71 <td class="elbow-placeholder"></td>
72 <td class="elbow-placeholder"></td>
73 <td colspan="2">
74 <div class="ansibleOptionAnchor" id="parameter-"></div>
75 <b>acls</b>
76 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
77 <div style="font-size: small">
78 <span style="color: purple">list</span>
79 / <span style="color: purple">elements=dictionary</span>
80 </div>
81 </td>
82 <td>
83 </td>
84 <td>
85 <div>List of ACLs for the given type.</div>
86 </td>
87 </tr>
88 <tr>
89 <td class="elbow-placeholder"></td>
90 <td class="elbow-placeholder"></td>
91 <td class="elbow-placeholder"></td>
92 <td colspan="1">
93 <div class="ansibleOptionAnchor" id="parameter-"></div>
94 <b>direction</b>
95 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
96 <div style="font-size: small">
97 <span style="color: purple">string</span>
98 / <span style="color: red">required</span>
99 </div>
100 </td>
101 <td>
102 <ul style="margin: 0; padding: 0"><b>Choices:</b>
103 <li>in</li>
104 <li>out</li>
105 </ul>
106 </td>
107 <td>
108 <div>Specifies the direction of the packets that the ACL will be applied on.</div>
109 </td>
110 </tr>
111 <tr>
112 <td class="elbow-placeholder"></td>
113 <td class="elbow-placeholder"></td>
114 <td class="elbow-placeholder"></td>
115 <td colspan="1">
116 <div class="ansibleOptionAnchor" id="parameter-"></div>
117 <b>name</b>
118 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
119 <div style="font-size: small">
120 <span style="color: purple">string</span>
121 / <span style="color: red">required</span>
122 </div>
123 </td>
124 <td>
125 </td>
126 <td>
127 <div>Name of the ACL to be applied on the interface.</div>
128 </td>
129 </tr>
130
131 <tr>
132 <td class="elbow-placeholder"></td>
133 <td class="elbow-placeholder"></td>
134 <td colspan="2">
135 <div class="ansibleOptionAnchor" id="parameter-"></div>
136 <b>type</b>
137 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
138 <div style="font-size: small">
139 <span style="color: purple">string</span>
140 / <span style="color: red">required</span>
141 </div>
142 </td>
143 <td>
144 <ul style="margin: 0; padding: 0"><b>Choices:</b>
145 <li>mac</li>
146 <li>ipv4</li>
147 <li>ipv6</li>
148 </ul>
149 </td>
150 <td>
151 <div>Type of the ACLs to be applied on the interface.</div>
152 </td>
153 </tr>
154
155 <tr>
156 <td class="elbow-placeholder"></td>
157 <td colspan="3">
158 <div class="ansibleOptionAnchor" id="parameter-"></div>
159 <b>name</b>
160 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
161 <div style="font-size: small">
162 <span style="color: purple">string</span>
163 / <span style="color: red">required</span>
164 </div>
165 </td>
166 <td>
167 </td>
168 <td>
169 <div>Full name of the interface, i.e. Eth1/1.</div>
170 </td>
171 </tr>
172
173 <tr>
174 <td colspan="4">
175 <div class="ansibleOptionAnchor" id="parameter-"></div>
176 <b>state</b>
177 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
178 <div style="font-size: small">
179 <span style="color: purple">string</span>
180 </div>
181 </td>
182 <td>
183 <ul style="margin: 0; padding: 0"><b>Choices:</b>
184 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
185 <li>replaced</li>
186 <li>overridden</li>
187 <li>deleted</li>
188 </ul>
189 </td>
190 <td>
191 <div>The state of the configuration after module completion.</div>
192 <div><em>merged</em> - Merges provided interface access-group configuration with on-device configuration.</div>
193 <div><em>replaced</em> - Replaces on-device access-group configuration of the specified interfaces with provided configuration.</div>
194 <div><em>overridden</em> - Overrides all on-device interface access-group configurations with the provided configuration.</div>
195 <div><em>deleted</em> - Deletes on-device interface access-group configuration.</div>
196 </td>
197 </tr>
198 </table>
199 <br/>
200
201
202 Notes
203 -----
204
205 .. note::
206 - Supports ``check_mode``.
207
208
209
210 Examples
211 --------
212
213 .. code-block:: yaml
214
215 # Using "merged" state
216 #
217 # Before state:
218 # -------------
219 #
220 # sonic# show mac access-group
221 # sonic#
222 # sonic# show ip access-group
223 # sonic#
224 # sonic# show ipv6 access-group
225 # Ingress IPV6 access-list ipv6-acl-1 on Eth1/1
226 # sonic#
227
228 - name: Merge provided interface access-group configurations
229 dellemc.enterprise_sonic.sonic_acl_interfaces:
230 config:
231 - name: 'Eth1/1'
232 access_groups:
233 - type: 'mac'
234 acls:
235 - name: 'mac-acl-1'
236 direction: 'in'
237 - name: 'mac-acl-2'
238 direction: 'out'
239 - type: 'ipv6'
240 acls:
241 - name: 'ipv6-acl-2'
242 direction: 'out'
243 - name: 'Eth1/2'
244 access_groups:
245 - type: 'ipv4'
246 acls:
247 - name: 'ip-acl-1'
248 direction: 'in'
249 state: merged
250
251 # After state:
252 # ------------
253 #
254 # sonic# show mac access-group
255 # Ingress MAC access-list mac-acl-1 on Eth1/1
256 # Egress MAC access-list mac-acl-2 on Eth1/1
257 # sonic#
258 # sonic# show ip access-group
259 # Ingress IP access-list ip-acl-1 on Eth1/2
260 # sonic#
261 # sonic# show ipv6 access-group
262 # Ingress IPV6 access-list ipv6-acl-1 on Eth1/1
263 # Egress IPV6 access-list ipv6-acl-2 on Eth1/1
264 # sonic#
265
266
267 # Using "replaced" state
268 #
269 # Before state:
270 # -------------
271 #
272 # sonic# show mac access-group
273 # Ingress MAC access-list mac-acl-1 on Eth1/1
274 # Egress MAC access-list mac-acl-2 on Eth1/1
275 # sonic#
276 # sonic# show ip access-group
277 # Ingress IP access-list ip-acl-1 on Eth1/2
278 # sonic#
279 # sonic# show ipv6 access-group
280 # Ingress IPV6 access-list ipv6-acl-1 on Eth1/1
281 # Egress IPV6 access-list ipv6-acl-2 on Eth1/1
282 # sonic#
283
284 - name: Replace device access-group configuration of specified interfaces with provided configuration
285 dellemc.enterprise_sonic.sonic_acl_interfaces:
286 config:
287 - name: 'Eth1/2'
288 access_groups:
289 - type: 'ipv6'
290 acls:
291 - name: 'ipv6-acl-2'
292 direction: 'out'
293 - name: 'Eth1/3'
294 access_groups:
295 - type: 'ipv4'
296 acls:
297 - name: 'ip-acl-2'
298 direction: 'out'
299 state: replaced
300
301 # After state:
302 # ------------
303 #
304 # sonic# show mac access-group
305 # Ingress MAC access-list mac-acl-1 on Eth1/1
306 # Egress MAC access-list mac-acl-2 on Eth1/1
307 # sonic#
308 # sonic# show ip access-group
309 # Egress IP access-list ip-acl-2 on Eth1/3
310 # sonic#
311 # sonic# show ipv6 access-group
312 # Ingress IPV6 access-list ipv6-acl-1 on Eth1/1
313 # Egress IPV6 access-list ipv6-acl-2 on Eth1/1
314 # Egress IPV6 access-list ipv6-acl-2 on Eth1/2
315 # sonic#
316
317
318 # Using "overridden" state
319 #
320 # Before state:
321 # -------------
322 #
323 # sonic# show mac access-group
324 # Ingress MAC access-list mac-acl-1 on Eth1/1
325 # Egress MAC access-list mac-acl-2 on Eth1/1
326 # sonic#
327 # sonic# show ip access-group
328 # Egress IP access-list ip-acl-2 on Eth1/3
329 # sonic#
330 # sonic# show ipv6 access-group
331 # Ingress IPV6 access-list ipv6-acl-1 on Eth1/1
332 # Egress IPV6 access-list ipv6-acl-2 on Eth1/1
333 # Egress IPV6 access-list ipv6-acl-2 on Eth1/2
334 # sonic#
335
336 - name: Override all interfaces access-group device configuration with provided configuration
337 dellemc.enterprise_sonic.sonic_acl_interfaces:
338 config:
339 - name: 'Eth1/1'
340 access_groups:
341 - type: 'ip'
342 acls:
343 - name: 'ip-acl-2'
344 direction: 'out'
345 - name: 'Eth1/2'
346 access_groups:
347 - type: 'ip'
348 acls:
349 - name: 'ip-acl-2'
350 direction: 'out'
351 state: overridden
352
353 # After state:
354 # ------------
355 #
356 # sonic# show mac access-group
357 # sonic#
358 # sonic# show ip access-group
359 # Egress IP access-list ip-acl-2 on Eth1/1
360 # Egress IP access-list ip-acl-2 on Eth1/2
361 # sonic#
362 # sonic# show ipv6 access-group
363 # sonic#
364
365
366 # Using "deleted" state
367 #
368 # Before state:
369 # -------------
370 #
371 # sonic# show mac access-group
372 # Ingress MAC access-list mac-acl-1 on Eth1/1
373 # Egress MAC access-list mac-acl-2 on Eth1/1
374 # sonic#
375 # sonic# show ip access-group
376 # Egress IP access-list ip-acl-2 on Eth1/3
377 # sonic#
378 # sonic# show ipv6 access-group
379 # Ingress IPV6 access-list ipv6-acl-1 on Eth1/1
380 # Egress IPV6 access-list ipv6-acl-2 on Eth1/1
381 # Egress IPV6 access-list ipv6-acl-2 on Eth1/2
382 # sonic#
383
384 - name: Delete specified interfaces access-group configurations
385 dellemc.enterprise_sonic.sonic_l2_acls:
386 config:
387 - name: 'Eth1/1'
388 access_groups:
389 - type: 'mac'
390 acls:
391 - name: 'mac-acl-1'
392 direction: 'in'
393 - type: 'ipv6'
394 - name: 'Eth1/2'
395 state: deleted
396
397 # After state:
398 # ------------
399 #
400 # sonic# show mac access-group
401 # Egress MAC access-list mac-acl-2 on Eth1/1
402 # sonic#
403 # sonic# show ip access-group
404 # Egress IP access-list ip-acl-2 on Eth1/3
405 # sonic#
406 # sonic# show ipv6 access-group
407 # sonic#
408
409
410 # Using "deleted" state
411 #
412 # Before state:
413 # -------------
414 #
415 # sonic# show mac access-group
416 # Ingress MAC access-list mac-acl-1 on Eth1/1
417 # Egress MAC access-list mac-acl-2 on Eth1/1
418 # sonic#
419 # sonic# show ip access-group
420 # Egress IP access-list ip-acl-2 on Eth1/3
421 # sonic#
422 # sonic# show ipv6 access-group
423 # Ingress IPV6 access-list ipv6-acl-1 on Eth1/1
424 # Egress IPV6 access-list ipv6-acl-2 on Eth1/1
425 # Egress IPV6 access-list ipv6-acl-2 on Eth1/2
426 # sonic#
427
428 - name: Delete all interface access-group configurations
429 dellemc.enterprise_sonic.sonic_acl_interfaces:
430 config:
431 state: deleted
432
433 # After state:
434 # ------------
435 #
436 # sonic# show mac access-group
437 # sonic#
438 # sonic# show ip access-group
439 # sonic#
440 # sonic# show ipv6 access-group
441 # sonic#
442
443
444
445 Return Values
446 -------------
447 Common return values are documented `here <https://docs.ansible.com/projects/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
448
449 .. raw:: html
450
451 <table border=0 cellpadding=0 class="documentation-table">
452 <tr>
453 <th colspan="1">Key</th>
454 <th>Returned</th>
455 <th width="100%">Description</th>
456 </tr>
457 <tr>
458 <td colspan="1">
459 <div class="ansibleOptionAnchor" id="return-"></div>
460 <b>after</b>
461 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
462 <div style="font-size: small">
463 <span style="color: purple">list</span>
464 </div>
465 </td>
466 <td>when changed</td>
467 <td>
468 <div>The resulting configuration module invocation.</div>
469 <br/>
470 <div style="font-size: smaller"><b>Sample:</b></div>
471 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format as the parameters above.</div>
472 </td>
473 </tr>
474 <tr>
475 <td colspan="1">
476 <div class="ansibleOptionAnchor" id="return-"></div>
477 <b>after_generated</b>
478 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
479 <div style="font-size: small">
480 <span style="color: purple">list</span>
481 </div>
482 </td>
483 <td>when <code>check_mode</code></td>
484 <td>
485 <div>The generated configuration module invocation.</div>
486 <br/>
487 <div style="font-size: smaller"><b>Sample:</b></div>
488 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format as the parameters above.</div>
489 </td>
490 </tr>
491 <tr>
492 <td colspan="1">
493 <div class="ansibleOptionAnchor" id="return-"></div>
494 <b>before</b>
495 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
496 <div style="font-size: small">
497 <span style="color: purple">list</span>
498 </div>
499 </td>
500 <td>always</td>
501 <td>
502 <div>The configuration prior to the module invocation.</div>
503 <br/>
504 <div style="font-size: smaller"><b>Sample:</b></div>
505 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format as the parameters above.</div>
506 </td>
507 </tr>
508 <tr>
509 <td colspan="1">
510 <div class="ansibleOptionAnchor" id="return-"></div>
511 <b>commands</b>
512 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
513 <div style="font-size: small">
514 <span style="color: purple">list</span>
515 </div>
516 </td>
517 <td>always</td>
518 <td>
519 <div>The set of commands pushed to the remote device.</div>
520 <br/>
521 <div style="font-size: smaller"><b>Sample:</b></div>
522 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;command 1&#x27;, &#x27;command 2&#x27;, &#x27;command 3&#x27;]</div>
523 </td>
524 </tr>
525 </table>
526 <br/><br/>
527
528
529 Status
530 ------
531
532
533 Authors
534 ~~~~~~~
535
536 - Arun Saravanan Balachandran (@ArunSaravananBalachandran)