Debian Codegraph @

ansible_collections/dellemc/enterprise_sonic/docs/dellemc.enterprise_sonic.sonic_mac_module.rst

raw
1 .. _dellemc.enterprise_sonic.sonic_mac_module:
2
3
4 **********************************
5 dellemc.enterprise_sonic.sonic_mac
6 **********************************
7
8 **Manage MAC configuration 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 MAC for devices running SONiC
21
22
23
24
25 Parameters
26 ----------
27
28 .. raw:: html
29
30 <table border=0 cellpadding=0 class="documentation-table">
31 <tr>
32 <th colspan="4">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th width="100%">Comments</th>
35 </tr>
36 <tr>
37 <td colspan="4">
38 <div class="ansibleOptionAnchor" id="parameter-"></div>
39 <b>config</b>
40 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
41 <div style="font-size: small">
42 <span style="color: purple">list</span>
43 / <span style="color: purple">elements=dictionary</span>
44 </div>
45 </td>
46 <td>
47 </td>
48 <td>
49 <div>A list of MAC configurations.</div>
50 </td>
51 </tr>
52 <tr>
53 <td class="elbow-placeholder"></td>
54 <td colspan="3">
55 <div class="ansibleOptionAnchor" id="parameter-"></div>
56 <b>mac</b>
57 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
58 <div style="font-size: small">
59 <span style="color: purple">dictionary</span>
60 </div>
61 </td>
62 <td>
63 </td>
64 <td>
65 <div>Configuration attributes for MAC.</div>
66 </td>
67 </tr>
68 <tr>
69 <td class="elbow-placeholder"></td>
70 <td class="elbow-placeholder"></td>
71 <td colspan="2">
72 <div class="ansibleOptionAnchor" id="parameter-"></div>
73 <b>aging_time</b>
74 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
75 <div style="font-size: small">
76 <span style="color: purple">integer</span>
77 </div>
78 </td>
79 <td>
80 <b>Default:</b><br/><div style="color: blue">600</div>
81 </td>
82 <td>
83 <div>Time in seconds of inactivity before the MAC entry is timed out.</div>
84 </td>
85 </tr>
86 <tr>
87 <td class="elbow-placeholder"></td>
88 <td class="elbow-placeholder"></td>
89 <td colspan="2">
90 <div class="ansibleOptionAnchor" id="parameter-"></div>
91 <b>dampening_interval</b>
92 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
93 <div style="font-size: small">
94 <span style="color: purple">integer</span>
95 </div>
96 </td>
97 <td>
98 <b>Default:</b><br/><div style="color: blue">5</div>
99 </td>
100 <td>
101 <div>Interval for which mac movements are observed before disabling MAC learning on a port.</div>
102 </td>
103 </tr>
104 <tr>
105 <td class="elbow-placeholder"></td>
106 <td class="elbow-placeholder"></td>
107 <td colspan="2">
108 <div class="ansibleOptionAnchor" id="parameter-"></div>
109 <b>dampening_threshold</b>
110 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
111 <div style="font-size: small">
112 <span style="color: purple">integer</span>
113 </div>
114 </td>
115 <td>
116 <b>Default:</b><br/><div style="color: blue">5</div>
117 </td>
118 <td>
119 <div>Number of MAC movements allowed per second before disabling MAC learning on a port.</div>
120 </td>
121 </tr>
122 <tr>
123 <td class="elbow-placeholder"></td>
124 <td class="elbow-placeholder"></td>
125 <td colspan="2">
126 <div class="ansibleOptionAnchor" id="parameter-"></div>
127 <b>mac_table_entries</b>
128 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
129 <div style="font-size: small">
130 <span style="color: purple">list</span>
131 / <span style="color: purple">elements=dictionary</span>
132 </div>
133 </td>
134 <td>
135 </td>
136 <td>
137 <div>Configuration attributes for MAC table entries.</div>
138 </td>
139 </tr>
140 <tr>
141 <td class="elbow-placeholder"></td>
142 <td class="elbow-placeholder"></td>
143 <td class="elbow-placeholder"></td>
144 <td colspan="1">
145 <div class="ansibleOptionAnchor" id="parameter-"></div>
146 <b>interface</b>
147 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
148 <div style="font-size: small">
149 <span style="color: purple">string</span>
150 </div>
151 </td>
152 <td>
153 </td>
154 <td>
155 <div>Specifies the interface for the MAC table entry.</div>
156 </td>
157 </tr>
158 <tr>
159 <td class="elbow-placeholder"></td>
160 <td class="elbow-placeholder"></td>
161 <td class="elbow-placeholder"></td>
162 <td colspan="1">
163 <div class="ansibleOptionAnchor" id="parameter-"></div>
164 <b>mac_address</b>
165 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
166 <div style="font-size: small">
167 <span style="color: purple">string</span>
168 / <span style="color: red">required</span>
169 </div>
170 </td>
171 <td>
172 </td>
173 <td>
174 <div>MAC address for the dynamic or static MAC table entry.</div>
175 </td>
176 </tr>
177 <tr>
178 <td class="elbow-placeholder"></td>
179 <td class="elbow-placeholder"></td>
180 <td class="elbow-placeholder"></td>
181 <td colspan="1">
182 <div class="ansibleOptionAnchor" id="parameter-"></div>
183 <b>vlan_id</b>
184 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
185 <div style="font-size: small">
186 <span style="color: purple">integer</span>
187 / <span style="color: red">required</span>
188 </div>
189 </td>
190 <td>
191 </td>
192 <td>
193 <div>ID number of VLAN on which the MAC address is present.</div>
194 </td>
195 </tr>
196
197
198 <tr>
199 <td class="elbow-placeholder"></td>
200 <td colspan="3">
201 <div class="ansibleOptionAnchor" id="parameter-"></div>
202 <b>vrf_name</b>
203 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
204 <div style="font-size: small">
205 <span style="color: purple">string</span>
206 </div>
207 </td>
208 <td>
209 <b>Default:</b><br/><div style="color: blue">"default"</div>
210 </td>
211 <td>
212 <div>Specifies the VRF name.</div>
213 </td>
214 </tr>
215
216 <tr>
217 <td colspan="4">
218 <div class="ansibleOptionAnchor" id="parameter-"></div>
219 <b>state</b>
220 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
221 <div style="font-size: small">
222 <span style="color: purple">string</span>
223 </div>
224 </td>
225 <td>
226 <ul style="margin: 0; padding: 0"><b>Choices:</b>
227 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
228 <li>deleted</li>
229 <li>replaced</li>
230 <li>overridden</li>
231 </ul>
232 </td>
233 <td>
234 <div>The state of the configuration after module completion</div>
235 </td>
236 </tr>
237 </table>
238 <br/>
239
240
241 Notes
242 -----
243
244 .. note::
245 - Tested against Enterprise SONiC Distribution by Dell Technologies.
246 - Supports ``check_mode``.
247
248
249
250 Examples
251 --------
252
253 .. code-block:: yaml
254
255 # Using "merged" state
256 #
257 # Before state:
258 # -------------
259 #
260 # sonic# show mac dampening
261 # MAC Move Dampening Threshold : 5
262 # MAC Move Dampening Interval : 5
263 # sonic# show running-configuration | grep mac
264 # (No mac configuration pressent)
265
266 - name: Merge MAC configurations
267 dellemc.enterprise_sonic.sonic_mac:
268 config:
269 - vrf_name: 'default'
270 mac:
271 aging_time: 50
272 dampening_interval: 20
273 dampening_threshold: 30
274 mac_table_entries:
275 - mac_address: '00:00:5e:00:53:af'
276 vlan_id: 1
277 interface: 'Ethernet20'
278 - mac_address: '00:33:33:33:33:33'
279 vlan_id: 2
280 interface: 'Ethernet24'
281 - mac_address: '00:00:4e:00:24:af'
282 vlan_id: 3
283 interface: 'Ethernet28'
284 state: merged
285
286 # After state:
287 # ------------
288 #
289 # sonic# show mac dampening
290 # MAC Move Dampening Threshold : 30
291 # MAC Move Dampening Interval : 20
292 # sonic# show running-configuration | grep mac
293 # mac address-table 00:00:5e:00:53:af Vlan1 Ethernet20
294 # mac address-table 00:33:33:33:33:33 Vlan2 Ethernet24
295 # mac address-table 00:00:4e:00:24:af Vlan3 Ethernet28
296 # mac address-table aging-time 50
297 #
298 #
299 # Using "replaced" state
300 #
301 # Before state:
302 # -------------
303 #
304 # sonic# show mac dampening
305 # MAC Move Dampening Threshold : 30
306 # MAC Move Dampening Interval : 20
307 # sonic# show running-configuration | grep mac
308 # mac address-table 00:00:5e:00:53:af Vlan1 Ethernet20
309 # mac address-table 00:33:33:33:33:33 Vlan2 Ethernet24
310 # mac address-table 00:00:4e:00:24:af Vlan3 Ethernet28
311 # mac address-table aging-time 50
312
313 - name: Replace MAC configurations
314 dellemc.enterprise_sonic.sonic_mac:
315 config:
316 - vrf_name: 'default'
317 mac:
318 aging_time: 45
319 dampening_interval: 30
320 dampening_threshold: 60
321 mac_table_entries:
322 - mac_address: '00:00:5e:00:53:af'
323 vlan_id: 3
324 interface: 'Ethernet24'
325 - mac_address: '00:44:44:44:44:44'
326 vlan_id: 2
327 interface: 'Ethernet20'
328 state: replaced
329
330 # sonic# show mac dampening
331 # MAC Move Dampening Threshold : 60
332 # MAC Move Dampening Interval : 30
333 # sonic# show running-configuration | grep mac
334 # mac address-table 00:00:5e:00:53:af Vlan3 Ethernet24
335 # mac address-table 00:33:33:33:33:33 Vlan2 Ethernet24
336 # mac address-table 00:00:4e:00:24:af Vlan3 Ethernet28
337 # mac address-table 00:44:44:44:44:44 Vlan2 Ethernet20
338 # mac address-table aging-time 45
339 #
340 #
341 # Using "overridden" state
342 #
343 # Before state:
344 # -------------
345 #
346 # sonic# show mac dampening
347 # MAC Move Dampening Threshold : 60
348 # MAC Move Dampening Interval : 30
349 # sonic# show running-configuration | grep mac
350 # mac address-table 00:00:5e:00:53:af Vlan3 Ethernet24
351 # mac address-table 00:33:33:33:33:33 Vlan2 Ethernet24
352 # mac address-table 00:00:4e:00:24:af Vlan3 Ethernet28
353 # mac address-table 00:44:44:44:44:44 Vlan2 Ethernet20
354 # mac address-table aging-time 45
355
356 - name: Override MAC cofigurations
357 dellemc.enterprise_sonic.sonic_mac:
358 config:
359 - vrf_name: 'default'
360 mac:
361 aging_time: 10
362 dampening_interval: 20
363 dampening_threshold: 30
364 mac_table_entries:
365 - mac_address: '00:11:11:11:11:11'
366 vlan_id: 1
367 interface: 'Ethernet20'
368 - mac_address: '00:22:22:22:22:22'
369 vlan_id: 2
370 interface: 'Ethernet24'
371 state: overridden
372
373 # After state:
374 # ------------
375 #
376 # sonic# show mac dampening
377 # MAC Move Dampening Threshold : 30
378 # MAC Move Dampening Interval : 20
379 # sonic# show running-configuration | grep mac
380 # mac address-table 00:11:11:11:11:11 Vlan1 Ethernet20
381 # mac address-table 00:22:22:22:22:22 Vlan2 Ethernet24
382 # mac address-table aging-time 10
383 #
384 #
385 # Using "deleted" state
386 #
387 # Before state:
388 # -------------
389 #
390 # sonic# show mac dampening
391 # MAC Move Dampening Threshold : 30
392 # MAC Move Dampening Interval : 20
393 # sonic# show running-configuration | grep mac
394 # mac address-table 00:11:11:11:11:11 Vlan1 Ethernet20
395 # mac address-table 00:22:22:22:22:22 Vlan2 Ethernet24
396 # mac address-table aging-time 10
397
398 - name: Delete MAC cofigurations
399 dellemc.enterprise_sonic.sonic_mac:
400 config:
401 - vrf_name: 'default'
402 mac:
403 aging_time: 10
404 dampening_interval: 20
405 dampening_threshold: 30
406 mac_table_entries:
407 - mac_address: '00:11:11:11:11:11'
408 vlan_id: 1
409 interface: 'Ethernet20'
410 - mac_address: '00:22:22:22:22:22'
411 vlan_id: 2
412 interface: 'Ethernet24'
413 state: deleted
414
415 # After state:
416 # ------------
417 #
418 # sonic# show mac dampening
419 # MAC Move Dampening Threshold : 5
420 # MAC Move Dampening Interval : 5
421 # sonic# show running-configuration | grep mac
422 # (No mac configuration present)
423
424
425
426 Return Values
427 -------------
428 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:
429
430 .. raw:: html
431
432 <table border=0 cellpadding=0 class="documentation-table">
433 <tr>
434 <th colspan="1">Key</th>
435 <th>Returned</th>
436 <th width="100%">Description</th>
437 </tr>
438 <tr>
439 <td colspan="1">
440 <div class="ansibleOptionAnchor" id="return-"></div>
441 <b>after</b>
442 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
443 <div style="font-size: small">
444 <span style="color: purple">list</span>
445 </div>
446 </td>
447 <td>when changed</td>
448 <td>
449 <div>The resulting configuration module invocation.</div>
450 <br/>
451 <div style="font-size: smaller"><b>Sample:</b></div>
452 <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>
453 </td>
454 </tr>
455 <tr>
456 <td colspan="1">
457 <div class="ansibleOptionAnchor" id="return-"></div>
458 <b>after_generated</b>
459 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
460 <div style="font-size: small">
461 <span style="color: purple">list</span>
462 </div>
463 </td>
464 <td>when <code>check_mode</code></td>
465 <td>
466 <div>The generated configuration module invocation.</div>
467 <br/>
468 <div style="font-size: smaller"><b>Sample:</b></div>
469 <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>
470 </td>
471 </tr>
472 <tr>
473 <td colspan="1">
474 <div class="ansibleOptionAnchor" id="return-"></div>
475 <b>before</b>
476 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
477 <div style="font-size: small">
478 <span style="color: purple">list</span>
479 </div>
480 </td>
481 <td>always</td>
482 <td>
483 <div>The configuration prior to the module invocation.</div>
484 <br/>
485 <div style="font-size: smaller"><b>Sample:</b></div>
486 <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>
487 </td>
488 </tr>
489 <tr>
490 <td colspan="1">
491 <div class="ansibleOptionAnchor" id="return-"></div>
492 <b>commands</b>
493 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
494 <div style="font-size: small">
495 <span style="color: purple">list</span>
496 </div>
497 </td>
498 <td>always</td>
499 <td>
500 <div>The set of commands pushed to the remote device.</div>
501 <br/>
502 <div style="font-size: smaller"><b>Sample:</b></div>
503 <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>
504 </td>
505 </tr>
506 </table>
507 <br/><br/>
508
509
510 Status
511 ------
512
513
514 Authors
515 ~~~~~~~
516
517 - S\. Talabi (@stalabi1)