Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_qosprofile.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_qosprofile
15 short_description: Configure WiFi quality of service
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 qosprofile:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 bandwidth_admission_control:
34 aliases: ['bandwidth-admission-control']
35 type: str
36 description: Enable/disable WMM bandwidth admission control.
37 choices: ['disable', 'enable']
38 bandwidth_capacity:
39 aliases: ['bandwidth-capacity']
40 type: int
41 description: Maximum bandwidth capacity allowed
42 burst:
43 type: str
44 description: Enable/disable client rate burst.
45 choices: ['disable', 'enable']
46 call_admission_control:
47 aliases: ['call-admission-control']
48 type: str
49 description: Enable/disable WMM call admission control.
50 choices: ['disable', 'enable']
51 call_capacity:
52 aliases: ['call-capacity']
53 type: int
54 description: Maximum number of Voice over WLAN
55 comment:
56 type: str
57 description: Comment.
58 downlink:
59 type: int
60 description: Maximum downlink bandwidth for Virtual Access Points
61 downlink_sta:
62 aliases: ['downlink-sta']
63 type: int
64 description: Maximum downlink bandwidth for clients
65 dscp_wmm_be:
66 aliases: ['dscp-wmm-be']
67 type: raw
68 description: (list) DSCP mapping for best effort access
69 dscp_wmm_bk:
70 aliases: ['dscp-wmm-bk']
71 type: raw
72 description: (list) DSCP mapping for background access
73 dscp_wmm_mapping:
74 aliases: ['dscp-wmm-mapping']
75 type: str
76 description: Enable/disable Differentiated Services Code Point
77 choices: ['disable', 'enable']
78 dscp_wmm_vi:
79 aliases: ['dscp-wmm-vi']
80 type: raw
81 description: (list) DSCP mapping for video access
82 dscp_wmm_vo:
83 aliases: ['dscp-wmm-vo']
84 type: raw
85 description: (list) DSCP mapping for voice access
86 name:
87 type: str
88 description: WiFi QoS profile name.
89 required: true
90 uplink:
91 type: int
92 description: Maximum uplink bandwidth for Virtual Access Points
93 uplink_sta:
94 aliases: ['uplink-sta']
95 type: int
96 description: Maximum uplink bandwidth for clients
97 wmm:
98 type: str
99 description: Enable/disable WiFi multi-media
100 choices: ['disable', 'enable']
101 wmm_uapsd:
102 aliases: ['wmm-uapsd']
103 type: str
104 description: Enable/disable WMM Unscheduled Automatic Power Save Delivery
105 choices: ['disable', 'enable']
106 wmm_be_dscp:
107 aliases: ['wmm-be-dscp']
108 type: int
109 description: DSCP marking for best effort access
110 wmm_bk_dscp:
111 aliases: ['wmm-bk-dscp']
112 type: int
113 description: DSCP marking for background access
114 wmm_dscp_marking:
115 aliases: ['wmm-dscp-marking']
116 type: str
117 description: Enable/disable WMM Differentiated Services Code Point
118 choices: ['disable', 'enable']
119 wmm_vi_dscp:
120 aliases: ['wmm-vi-dscp']
121 type: int
122 description: DSCP marking for video access
123 wmm_vo_dscp:
124 aliases: ['wmm-vo-dscp']
125 type: int
126 description: DSCP marking for voice access
127 '''
128
129 EXAMPLES = '''
130 - name: Example playbook (generated based on argument schema)
131 hosts: fortimanagers
132 connection: httpapi
133 gather_facts: false
134 tasks:
135 - name: Configure WiFi quality of service
136 fortinet.fortimanager.fmgr_qosprofile:
137 # workspace_locking_adom: <global or your adom name>
138 adom: <your own value>
139 state: present # <value in [present, absent]>
140 qosprofile:
141 name: "your value" # Required variable, string
142 # bandwidth_admission_control: <value in [disable, enable]>
143 # bandwidth_capacity: <integer>
144 # burst: <value in [disable, enable]>
145 # call_admission_control: <value in [disable, enable]>
146 # call_capacity: <integer>
147 # comment: <string>
148 # downlink: <integer>
149 # downlink_sta: <integer>
150 # dscp_wmm_be: <list or integer>
151 # dscp_wmm_bk: <list or integer>
152 # dscp_wmm_mapping: <value in [disable, enable]>
153 # dscp_wmm_vi: <list or integer>
154 # dscp_wmm_vo: <list or integer>
155 # uplink: <integer>
156 # uplink_sta: <integer>
157 # wmm: <value in [disable, enable]>
158 # wmm_uapsd: <value in [disable, enable]>
159 # wmm_be_dscp: <integer>
160 # wmm_bk_dscp: <integer>
161 # wmm_dscp_marking: <value in [disable, enable]>
162 # wmm_vi_dscp: <integer>
163 # wmm_vo_dscp: <integer>
164 '''
165
166 RETURN = '''
167 meta:
168 description: The result of the request.
169 type: dict
170 returned: always
171 contains:
172 request_url:
173 description: The full url requested.
174 returned: always
175 type: str
176 sample: /sys/login/user
177 response_code:
178 description: The status of api request.
179 returned: always
180 type: int
181 sample: 0
182 response_data:
183 description: The api response.
184 type: list
185 returned: always
186 response_message:
187 description: The descriptive message of the api response.
188 type: str
189 returned: always
190 sample: OK.
191 system_information:
192 description: The information of the target system.
193 type: dict
194 returned: always
195 rc:
196 description: The status the request.
197 type: int
198 returned: always
199 sample: 0
200 version_check_warning:
201 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
202 type: list
203 returned: complex
204 '''
205 from ansible.module_utils.basic import AnsibleModule
206 from ansible.module_utils.connection import Connection
207 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
208 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
209
210
211 def main():
212 urls_list = [
213 '/pm/config/adom/{adom}/obj/wireless-controller/qos-profile',
214 '/pm/config/global/obj/wireless-controller/qos-profile'
215 ]
216 module_arg_spec = {
217 'adom': {'required': True, 'type': 'str'},
218 'revision_note': {'type': 'str'},
219 'qosprofile': {
220 'type': 'dict', 'v_range': [['6.0.0', '']],
221 'options': {
222 'bandwidth-admission-control': {'choices': ['disable', 'enable'], 'type': 'str'},
223 'bandwidth-capacity': {'type': 'int'},
224 'burst': {'choices': ['disable', 'enable'], 'type': 'str'},
225 'call-admission-control': {'choices': ['disable', 'enable'], 'type': 'str'},
226 'call-capacity': {'type': 'int'},
227 'comment': {'type': 'str'},
228 'downlink': {'type': 'int'},
229 'downlink-sta': {'type': 'int'},
230 'dscp-wmm-be': {'type': 'raw'},
231 'dscp-wmm-bk': {'type': 'raw'},
232 'dscp-wmm-mapping': {'choices': ['disable', 'enable'], 'type': 'str'},
233 'dscp-wmm-vi': {'type': 'raw'},
234 'dscp-wmm-vo': {'type': 'raw'},
235 'name': {'required': True, 'type': 'str'},
236 'uplink': {'type': 'int'},
237 'uplink-sta': {'type': 'int'},
238 'wmm': {'choices': ['disable', 'enable'], 'type': 'str'},
239 'wmm-uapsd': {'choices': ['disable', 'enable'], 'type': 'str'},
240 'wmm-be-dscp': {'v_range': [['6.2.0', '']], 'type': 'int'},
241 'wmm-bk-dscp': {'v_range': [['6.2.0', '']], 'type': 'int'},
242 'wmm-dscp-marking': {'v_range': [['6.2.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
243 'wmm-vi-dscp': {'v_range': [['6.2.0', '']], 'type': 'int'},
244 'wmm-vo-dscp': {'v_range': [['6.2.0', '']], 'type': 'int'}
245 }
246 }
247 }
248
249 module_option_spec = get_module_arg_spec('full crud')
250 module_arg_spec.update(module_option_spec)
251 check_galaxy_version(module_arg_spec)
252 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'qosprofile'),
253 supports_check_mode=True)
254 if not module._socket_path:
255 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
256 connection = Connection(module._socket_path)
257 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
258 'name', 'data', module, connection)
259 fmgr.process_crud()
260 module.exit_json(meta=module.params)
261
262
263 if __name__ == '__main__':
264 main()