Debian Codegraph @

ansible_collections/dellemc/enterprise_sonic/plugins/modules/sonic_roce.py

raw symbols SCIP
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # Copyright 2025 Dell Inc. or its subsidiaries. All Rights Reserved.
4 # GNU General Public License v3.0+
5 # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 """
8 The module file for sonic_roce
9 """
10
11 from __future__ import absolute_import, division, print_function
12 __metaclass__ = type
13
14 DOCUMENTATION = """
15 ---
16 module: sonic_roce
17 version_added: 2.5.0
18 notes:
19 - Tested against Enterprise SONiC Distribution by Dell Technologies.
20 - Supports C(check_mode).
21 short_description: Manage RoCE QoS configuration on SONiC
22 description:
23 - This module provides configuration management of RoCE(v2) QoS for devices running SONiC
24 author: "S. Talabi (@stalabi1)"
25 options:
26 config:
27 description:
28 - RoCE QoS configuration
29 type: dict
30 suboptions:
31 roce_enable:
32 description:
33 - Enable or disable RoCEv2 default buffer configuration
34 type: bool
35 pfc_priority:
36 description:
37 - Specifies the PFC priorities to enable RoCEv2 buffer default configuration on
38 - Range 0-7, two priority values separated by comma
39 - Ex. '3,4'
40 - Only configurable when RoCE is enabled
41 type: str
42 state:
43 description:
44 - The state of the configuration after module completion.
45 type: str
46 choices:
47 - merged
48 default: merged
49 """
50
51 EXAMPLES = """
52 # Using "merged" state
53 #
54 # Before state:
55 # -------------
56 #
57 # sonic# show running-configuration | grep roce
58 # (No RoCE configuration present)
59
60 - name: Enable RoCE for PFC priorities
61 dellemc.enterprise_sonic.sonic_roce:
62 config:
63 roce_enable: true
64 pfc_priorities: '3,4'
65 state: merged
66
67 # After state:
68 # ------------
69 #
70 # sonic# show running-configuration | grep roce
71 # roce enable pfc-priority 3,4
72 """
73
74 RETURN = """
75 before:
76 description: The configuration prior to the module invocation.
77 returned: always
78 type: list
79 sample: >
80 The configuration returned will always be in the same format
81 as the parameters above.
82 after:
83 description: The configuration from module invocation.
84 returned: when changed
85 type: list
86 sample: >
87 The configuration returned will always be in the same format
88 as the parameters above.
89 after_generated:
90 description: The generated (simulated) configuration expected from module invocation.
91 returned: when C(check_mode)
92 type: list
93 sample: >
94 The configuration returned will always be in the same format
95 as the parameters above.
96 commands:
97 description: The set of commands pushed to the remote device.
98 returned: always
99 type: list
100 sample: ['command 1', 'command 2', 'command 3']
101 """
102
103
104 from ansible.module_utils.basic import AnsibleModule
105 from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.argspec.roce.roce import RoceArgs
106 from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.config.roce.roce import Roce
107
108
109 def main():
110 """
111 Main entry point for module execution
112
113 :returns: the result form module invocation
114 """
115 module = AnsibleModule(argument_spec=RoceArgs.argument_spec,
116 supports_check_mode=True)
117
118 result = Roce(module).execute_module()
119 module.exit_json(**result)
120
121
122 if __name__ == '__main__':
123 main()