Debian Codegraph @

ansible_collections/dellemc/enterprise_sonic/docs/dellemc.enterprise_sonic.sonic_pms_module.rst

raw
1 .. _dellemc.enterprise_sonic.sonic_pms_module:
2
3
4 **********************************
5 dellemc.enterprise_sonic.sonic_pms
6 **********************************
7
8 **Configure interface mode port security settings on SONiC.**
9
10
11 Version added: 3.1.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module provides configuration management of port security interface mode parameters on devices running SONiC.
21 - Configure switchport before configuring port security in interfaces.
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="2">Parameter</th>
34 <th>Choices/<font color="blue">Defaults</font></th>
35 <th width="100%">Comments</th>
36 </tr>
37 <tr>
38 <td colspan="2">
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 the port security interface configurations.</div>
51 </td>
52 </tr>
53 <tr>
54 <td class="elbow-placeholder"></td>
55 <td colspan="1">
56 <div class="ansibleOptionAnchor" id="parameter-"></div>
57 <b>max_allowed_macs</b>
58 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
59 <div style="font-size: small">
60 <span style="color: purple">integer</span>
61 </div>
62 </td>
63 <td>
64 </td>
65 <td>
66 <div>Maximum no. of secure MACs allowed on the interface. (1 to 4097)</div>
67 <div>If <em>port_security_enable=True</em> and <em>max_allowed_macs</em> not configured, default is <code>1</code>.</div>
68 </td>
69 </tr>
70 <tr>
71 <td class="elbow-placeholder"></td>
72 <td colspan="1">
73 <div class="ansibleOptionAnchor" id="parameter-"></div>
74 <b>name</b>
75 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
76 <div style="font-size: small">
77 <span style="color: purple">string</span>
78 / <span style="color: red">required</span>
79 </div>
80 </td>
81 <td>
82 </td>
83 <td>
84 <div>Full name of the interface, i.e. Ethernet1.</div>
85 </td>
86 </tr>
87 <tr>
88 <td class="elbow-placeholder"></td>
89 <td colspan="1">
90 <div class="ansibleOptionAnchor" id="parameter-"></div>
91 <b>port_security_enable</b>
92 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
93 <div style="font-size: small">
94 <span style="color: purple">boolean</span>
95 / <span style="color: red">required</span>
96 </div>
97 </td>
98 <td>
99 <ul style="margin: 0; padding: 0"><b>Choices:</b>
100 <li>no</li>
101 <li>yes</li>
102 </ul>
103 </td>
104 <td>
105 <div>Enables port security at interface level.</div>
106 <div>If <em>port_security_enable=False</em>, entire port security configurations will be deleted.</div>
107 </td>
108 </tr>
109 <tr>
110 <td class="elbow-placeholder"></td>
111 <td colspan="1">
112 <div class="ansibleOptionAnchor" id="parameter-"></div>
113 <b>sticky_mac</b>
114 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
115 <div style="font-size: small">
116 <span style="color: purple">boolean</span>
117 </div>
118 </td>
119 <td>
120 <ul style="margin: 0; padding: 0"><b>Choices:</b>
121 <li>no</li>
122 <li>yes</li>
123 </ul>
124 </td>
125 <td>
126 <div>Enable sticky MAC feature on the interface.</div>
127 <div>If <em>port_security_enable=True</em> and <em>sticky_mac</em> not configured, default is <code>False</code>.</div>
128 </td>
129 </tr>
130 <tr>
131 <td class="elbow-placeholder"></td>
132 <td colspan="1">
133 <div class="ansibleOptionAnchor" id="parameter-"></div>
134 <b>violation</b>
135 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
136 <div style="font-size: small">
137 <span style="color: purple">string</span>
138 </div>
139 </td>
140 <td>
141 <ul style="margin: 0; padding: 0"><b>Choices:</b>
142 <li>SHUTDOWN</li>
143 <li>PROTECT</li>
144 </ul>
145 </td>
146 <td>
147 <div>Configure the action to be taken in the event of security violation.</div>
148 <div><code>SHUTDOWN</code> - Shutdown the interface.</div>
149 <div><code>PROTECT</code> - Drop packets received on the interface.</div>
150 <div>If <em>port_security_enable=True</em> and <em>violation</em> not configured, default is <code>PROTECT</code>.</div>
151 </td>
152 </tr>
153
154 <tr>
155 <td colspan="2">
156 <div class="ansibleOptionAnchor" id="parameter-"></div>
157 <b>state</b>
158 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
159 <div style="font-size: small">
160 <span style="color: purple">string</span>
161 </div>
162 </td>
163 <td>
164 <ul style="margin: 0; padding: 0"><b>Choices:</b>
165 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
166 <li>deleted</li>
167 <li>replaced</li>
168 <li>overridden</li>
169 </ul>
170 </td>
171 <td>
172 <div>Specifies the operation to be performed on the port security related interfaces configured on the device.</div>
173 <div>In case of merged, the input configuration will be merged with the existing port security interfaces related configuration on the device.</div>
174 <div>In case of deleted, the existing OSPFv2 interfaces configuration will be removed from the device.</div>
175 <div>In case of overridden, all the existing OSPFv2 interfaces configuration will be deleted and the specified input configuration will be installed.</div>
176 <div>In case of replaced, the existing interface configuration on the device will be replaced by the configuration in the playbook for each interface group configured by the playbook.</div>
177 </td>
178 </tr>
179 </table>
180 <br/>
181
182
183 Notes
184 -----
185
186 .. note::
187 - Supports ``check_mode``.
188 - Tested against Enterprise SONiC Distribution by Dell Technologies.
189
190
191
192 Examples
193 --------
194
195 .. code-block:: yaml
196
197 # Using "deleted" state
198
199 # Before state:
200 # -------------
201 #
202 # sonic# show port-security
203 #
204 # Secure Port isEnabled MaxSecureAddr FdbCount ViolationCount SecurityAction StickyMac
205 # ---------------------------------------------------------------------------------------------------------
206 # Ethernet0 Y 1 0 0 PROTECT N
207 # Ethernet10 N 1 0 0 PROTECT Y
208 # sonic#
209
210 - name: Delete the PMS configurations
211 sonic_pms:
212 config:
213 - name: 'Ethernet0'
214 port_security_enable: true
215 - name: 'Ethernet10'
216 port_security_enable: false
217 sticky_mac: true
218 state: deleted
219
220 # After state:
221 # ------------
222 #
223 # sonic# show port-security
224 #
225 # Secure Port isEnabled MaxSecureAddr FdbCount ViolationCount SecurityAction StickyMac
226 # ---------------------------------------------------------------------------------------------------------
227 # Ethernet10 N 1 0 0 PROTECT N
228 # sonic#
229
230
231 # Using "deleted" state
232
233 # Before state:
234 # -------------
235 #
236 # sonic# show port-security
237 #
238 # Secure Port isEnabled MaxSecureAddr FdbCount ViolationCount SecurityAction StickyMac
239 # ---------------------------------------------------------------------------------------------------------
240 # Ethernet0 Y 1 0 0 PROTECT N
241 # Ethernet3 Y 10 0 0 PROTECT N
242 # Ethernet4 N 15 0 0 SHUTDOWN N
243 # Ethernet5 Y 30 0 0 SHUTDOWN N
244 # Ethernet10 N 1 0 0 PROTECT Y
245 # sonic#
246
247 - name: Delete all the PMS configurations
248 sonic_pms:
249 config: []
250 state: deleted
251
252 # After state:
253 # ------------
254 #
255 # sonic# show port-security
256 # sonic#
257
258
259 # Using "merged" state
260
261 # Before state:
262 # -------------
263 #
264 # sonic# show port-security
265 # sonic#
266
267 - name: Add the PMS configurations new to interfaces
268 sonic_pms:
269 config:
270 - name: 'Ethernet0'
271 sticky_mac: true
272 port_security_enable: true
273 max_allowed_macs: 10
274 - name: 'Ethernet3'
275 port_security_enable: false
276 max_allowed_macs: 10
277 - name: 'Ethernet4'
278 port_security_enable: true
279 violation: SHUTDOWN
280 state: merged
281
282 # After state:
283 # ------------
284 #
285 # sonic# show port-security
286 #
287 # Secure Port isEnabled MaxSecureAddr FdbCount ViolationCount SecurityAction StickyMac
288 # ---------------------------------------------------------------------------------------------------------
289 # Ethernet0 Y 10 0 0 PROTECT Y
290 # Ethernet3 N 10 0 0 PROTECT N
291 # Ethernet4 Y 1 0 0 SHUTDOWN N
292 # sonic#
293
294
295 # Using "merged" state
296
297 # Before state:
298 # -------------
299 #
300 # sonic# show port-security
301 #
302 # Secure Port isEnabled MaxSecureAddr FdbCount ViolationCount SecurityAction StickyMac
303 # ---------------------------------------------------------------------------------------------------------
304 # Ethernet0 Y 10 0 0 PROTECT Y
305 # Ethernet3 N 10 0 0 PROTECT N
306 # Ethernet4 Y 1 0 0 SHUTDOWN N
307 # sonic#
308
309 - name: Disable a PMS interface by merge
310 sonic_pms:
311 config:
312 - name: 'Ethernet10'
313 port_security_enable: false
314 max_allowed_macs: 12
315 violation: SHUTDOWN
316 sticky_mac: true
317 - name: 'Ethernet4'
318 port_security_enable: false
319 state: merged
320
321 # After state:
322 # ------------
323 #
324 # sonic# show port-security
325 #
326 # Secure Port isEnabled MaxSecureAddr FdbCount ViolationCount SecurityAction StickyMac
327 # ---------------------------------------------------------------------------------------------------------
328 # Ethernet0 Y 10 0 0 PROTECT Y
329 # Ethernet3 N 10 0 0 PROTECT N
330 # Ethernet10 N 12 0 0 SHUTDOWN Y
331 # sonic#
332
333
334 # Using "replaced" state
335
336 # Before state:
337 # -------------
338 #
339 # sonic# show port-security
340 #
341 # Secure Port isEnabled MaxSecureAddr FdbCount ViolationCount SecurityAction StickyMac
342 # ---------------------------------------------------------------------------------------------------------
343 # Ethernet0 Y 1 0 0 PROTECT N
344 # Ethernet3 Y 10 0 0 PROTECT N
345 # Ethernet4 N 15 0 0 SHUTDOWN N
346 # Ethernet5 Y 30 0 0 SHUTDOWN N
347 # Ethernet10 N 12 0 0 SHUTDOWN Y
348 # sonic#
349
350 - name: Replace the PMS configurations by interface level
351 sonic_pms:
352 config:
353 - name: 'Ethernet10'
354 port_security_enable: true
355 - name: 'Ethernet3'
356 port_security_enable: false
357 violation: 'PROTECT'
358 sticky_mac: true
359 - name: 'Ethernet7'
360 port_security_enable: true
361 state: replaced
362
363 # After state:
364 # ------------
365 #
366 # sonic# show port-security
367 #
368 # Secure Port isEnabled MaxSecureAddr FdbCount ViolationCount SecurityAction StickyMac
369 # ---------------------------------------------------------------------------------------------------------
370 # Ethernet0 Y 1 0 0 PROTECT N
371 # Ethernet3 N 10 0 0 PROTECT Y
372 # Ethernet4 N 15 0 0 SHUTDOWN N
373 # Ethernet5 Y 30 0 0 SHUTDOWN N
374 # Ethernet7 Y 1 0 0 PROTECT N
375 # Ethernet10 Y 1 0 0 PROTECT N
376 # sonic#
377
378
379 # Using "overridden" state
380
381 # Before state:
382 # -------------
383 #
384 # sonic# show port-security
385 #
386 # Secure Port isEnabled MaxSecureAddr FdbCount ViolationCount SecurityAction StickyMac
387 # ---------------------------------------------------------------------------------------------------------
388 # Ethernet0 Y 1 0 0 PROTECT N
389 # Ethernet3 Y 10 0 0 PROTECT N
390 # Ethernet4 N 15 0 0 SHUTDOWN N
391 # Ethernet5 Y 30 0 0 SHUTDOWN N
392 # Ethernet10 N 12 0 0 SHUTDOWN Y
393 # sonic#
394
395 - name: Override the PMS configurations
396 sonic_pms:
397 config:
398 - name: 'Ethernet7'
399 port_security_enable: true
400 - name: 'Ethernet10'
401 port_security_enable: false
402 max_allowed_macs: 12
403 violation: SHUTDOWN
404 sticky_mac: true
405 state: overridden
406
407 # After state:
408 # ------------
409 #
410 # sonic# show port-security
411 #
412 # Secure Port isEnabled MaxSecureAddr FdbCount ViolationCount SecurityAction StickyMac
413 # ---------------------------------------------------------------------------------------------------------
414 # Ethernet7 Y 1 0 0 PROTECT N
415 # Ethernet10 N 12 0 0 SHUTDOWN Y
416 # sonic#
417
418
419
420 Return Values
421 -------------
422 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:
423
424 .. raw:: html
425
426 <table border=0 cellpadding=0 class="documentation-table">
427 <tr>
428 <th colspan="1">Key</th>
429 <th>Returned</th>
430 <th width="100%">Description</th>
431 </tr>
432 <tr>
433 <td colspan="1">
434 <div class="ansibleOptionAnchor" id="return-"></div>
435 <b>after</b>
436 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
437 <div style="font-size: small">
438 <span style="color: purple">list</span>
439 </div>
440 </td>
441 <td>when changed</td>
442 <td>
443 <div>The configuration resulting from module invocation.</div>
444 <br/>
445 <div style="font-size: smaller"><b>Sample:</b></div>
446 <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
447 of the parameters above.</div>
448 </td>
449 </tr>
450 <tr>
451 <td colspan="1">
452 <div class="ansibleOptionAnchor" id="return-"></div>
453 <b>after_generated</b>
454 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
455 <div style="font-size: small">
456 <span style="color: purple">list</span>
457 </div>
458 </td>
459 <td>when <code>check_mode</code></td>
460 <td>
461 <div>The configuration that would be generated by non-check-mode module invocation.</div>
462 <br/>
463 <div style="font-size: smaller"><b>Sample:</b></div>
464 <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
465 of the parameters above.</div>
466 </td>
467 </tr>
468 <tr>
469 <td colspan="1">
470 <div class="ansibleOptionAnchor" id="return-"></div>
471 <b>before</b>
472 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
473 <div style="font-size: small">
474 <span style="color: purple">list</span>
475 </div>
476 </td>
477 <td>always</td>
478 <td>
479 <div>The configuration prior to the module invocation.</div>
480 <br/>
481 <div style="font-size: smaller"><b>Sample:</b></div>
482 <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
483 of the parameters above.</div>
484 </td>
485 </tr>
486 <tr>
487 <td colspan="1">
488 <div class="ansibleOptionAnchor" id="return-"></div>
489 <b>commands</b>
490 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
491 <div style="font-size: small">
492 <span style="color: purple">list</span>
493 </div>
494 </td>
495 <td>always</td>
496 <td>
497 <div>The set of commands pushed to the remote device.</div>
498 <br/>
499 <div style="font-size: smaller"><b>Sample:</b></div>
500 <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>
501 </td>
502 </tr>
503 </table>
504 <br/><br/>
505
506
507 Status
508 ------
509
510
511 Authors
512 ~~~~~~~
513
514 - Santhosh kumar T (@santhosh-kt)