Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_arrpprofile.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_arrpprofile
15 short_description: Configure WiFi Automatic Radio Resource Provisioning
16 version_added: "2.1.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 arrpprofile:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 comment:
34 type: str
35 description: Comment.
36 darrp_optimize:
37 aliases: ['darrp-optimize']
38 type: int
39 description: Time for running Dynamic Automatic Radio Resource Provisioning
40 darrp_optimize_schedules:
41 aliases: ['darrp-optimize-schedules']
42 type: raw
43 description: (list) Firewall schedules for DARRP running time.
44 include_dfs_channel:
45 aliases: ['include-dfs-channel']
46 type: str
47 description: Enable/disable use of DFS channel in DARRP channel selection phase 1
48 choices: ['no', 'disable', 'yes', 'enable']
49 include_weather_channel:
50 aliases: ['include-weather-channel']
51 type: str
52 description: Enable/disable use of weather channel in DARRP channel selection phase 1
53 choices: ['no', 'disable', 'yes', 'enable']
54 monitor_period:
55 aliases: ['monitor-period']
56 type: int
57 description: Period in seconds to measure average transmit retries and receive errors
58 name:
59 type: str
60 description: WiFi ARRP profile name.
61 required: true
62 override_darrp_optimize:
63 aliases: ['override-darrp-optimize']
64 type: str
65 description: Enable to override setting darrp-optimize and darrp-optimize-schedules
66 choices: ['disable', 'enable']
67 selection_period:
68 aliases: ['selection-period']
69 type: int
70 description: Period in seconds to measure average channel load, noise floor, spectral RSSI
71 threshold_ap:
72 aliases: ['threshold-ap']
73 type: int
74 description: Threshold to reject channel in DARRP channel selection phase 1 due to surrounding APs
75 threshold_channel_load:
76 aliases: ['threshold-channel-load']
77 type: int
78 description: Threshold in percentage to reject channel in DARRP channel selection phase 1 due to channel load
79 threshold_noise_floor:
80 aliases: ['threshold-noise-floor']
81 type: str
82 description: Threshold in dBm to reject channel in DARRP channel selection phase 1 due to noise floor
83 threshold_rx_errors:
84 aliases: ['threshold-rx-errors']
85 type: int
86 description: Threshold in percentage for receive errors to trigger channel reselection in DARRP monitor stage
87 threshold_spectral_rssi:
88 aliases: ['threshold-spectral-rssi']
89 type: str
90 description: Threshold in dBm to reject channel in DARRP channel selection phase 1 due to spectral RSSI
91 threshold_tx_retries:
92 aliases: ['threshold-tx-retries']
93 type: int
94 description: Threshold in percentage for transmit retries to trigger channel reselection in DARRP monitor stage
95 weight_channel_load:
96 aliases: ['weight-channel-load']
97 type: int
98 description: Weight in DARRP channel score calculation for channel load
99 weight_dfs_channel:
100 aliases: ['weight-dfs-channel']
101 type: int
102 description: Weight in DARRP channel score calculation for DFS channel
103 weight_managed_ap:
104 aliases: ['weight-managed-ap']
105 type: int
106 description: Weight in DARRP channel score calculation for managed APs
107 weight_noise_floor:
108 aliases: ['weight-noise-floor']
109 type: int
110 description: Weight in DARRP channel score calculation for noise floor
111 weight_rogue_ap:
112 aliases: ['weight-rogue-ap']
113 type: int
114 description: Weight in DARRP channel score calculation for rogue APs
115 weight_spectral_rssi:
116 aliases: ['weight-spectral-rssi']
117 type: int
118 description: Weight in DARRP channel score calculation for spectral RSSI
119 weight_weather_channel:
120 aliases: ['weight-weather-channel']
121 type: int
122 description: Weight in DARRP channel score calculation for weather channel
123 '''
124
125 EXAMPLES = '''
126 - name: Example playbook (generated based on argument schema)
127 hosts: fortimanagers
128 connection: httpapi
129 gather_facts: false
130 tasks:
131 - name: Configure WiFi Automatic Radio Resource Provisioning
132 fortinet.fortimanager.fmgr_arrpprofile:
133 # workspace_locking_adom: <global or your adom name>
134 adom: <your own value>
135 state: present # <value in [present, absent]>
136 arrpprofile:
137 name: "your value" # Required variable, string
138 # comment: <string>
139 # darrp_optimize: <integer>
140 # darrp_optimize_schedules: <list or string>
141 # include_dfs_channel: <value in [no, disable, yes, ...]>
142 # include_weather_channel: <value in [no, disable, yes, ...]>
143 # monitor_period: <integer>
144 # override_darrp_optimize: <value in [disable, enable]>
145 # selection_period: <integer>
146 # threshold_ap: <integer>
147 # threshold_channel_load: <integer>
148 # threshold_noise_floor: <string>
149 # threshold_rx_errors: <integer>
150 # threshold_spectral_rssi: <string>
151 # threshold_tx_retries: <integer>
152 # weight_channel_load: <integer>
153 # weight_dfs_channel: <integer>
154 # weight_managed_ap: <integer>
155 # weight_noise_floor: <integer>
156 # weight_rogue_ap: <integer>
157 # weight_spectral_rssi: <integer>
158 # weight_weather_channel: <integer>
159 '''
160
161 RETURN = '''
162 meta:
163 description: The result of the request.
164 type: dict
165 returned: always
166 contains:
167 request_url:
168 description: The full url requested.
169 returned: always
170 type: str
171 sample: /sys/login/user
172 response_code:
173 description: The status of api request.
174 returned: always
175 type: int
176 sample: 0
177 response_data:
178 description: The api response.
179 type: list
180 returned: always
181 response_message:
182 description: The descriptive message of the api response.
183 type: str
184 returned: always
185 sample: OK.
186 system_information:
187 description: The information of the target system.
188 type: dict
189 returned: always
190 rc:
191 description: The status the request.
192 type: int
193 returned: always
194 sample: 0
195 version_check_warning:
196 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
197 type: list
198 returned: complex
199 '''
200 from ansible.module_utils.basic import AnsibleModule
201 from ansible.module_utils.connection import Connection
202 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
203 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
204
205
206 def main():
207 urls_list = [
208 '/pm/config/adom/{adom}/obj/wireless-controller/arrp-profile',
209 '/pm/config/global/obj/wireless-controller/arrp-profile'
210 ]
211 module_arg_spec = {
212 'adom': {'required': True, 'type': 'str'},
213 'revision_note': {'type': 'str'},
214 'arrpprofile': {
215 'type': 'dict', 'v_range': [['7.0.3', '']],
216 'options': {
217 'comment': {'v_range': [['7.0.3', '']], 'type': 'str'},
218 'darrp-optimize': {'v_range': [['7.0.3', '']], 'type': 'int'},
219 'darrp-optimize-schedules': {'v_range': [['7.0.3', '']], 'type': 'raw'},
220 'include-dfs-channel': {'v_range': [['7.0.3', '']], 'choices': ['no', 'disable', 'yes', 'enable'], 'type': 'str'},
221 'include-weather-channel': {'v_range': [['7.0.3', '']], 'choices': ['no', 'disable', 'yes', 'enable'], 'type': 'str'},
222 'monitor-period': {'v_range': [['7.0.3', '']], 'type': 'int'},
223 'name': {'v_range': [['7.0.3', '']], 'required': True, 'type': 'str'},
224 'override-darrp-optimize': {'v_range': [['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
225 'selection-period': {'v_range': [['7.0.3', '']], 'type': 'int'},
226 'threshold-ap': {'v_range': [['7.0.3', '']], 'type': 'int'},
227 'threshold-channel-load': {'v_range': [['7.0.3', '']], 'type': 'int'},
228 'threshold-noise-floor': {'v_range': [['7.0.3', '']], 'type': 'str'},
229 'threshold-rx-errors': {'v_range': [['7.0.3', '']], 'type': 'int'},
230 'threshold-spectral-rssi': {'v_range': [['7.0.3', '']], 'type': 'str'},
231 'threshold-tx-retries': {'v_range': [['7.0.3', '']], 'type': 'int'},
232 'weight-channel-load': {'v_range': [['7.0.3', '']], 'type': 'int'},
233 'weight-dfs-channel': {'v_range': [['7.0.3', '']], 'type': 'int'},
234 'weight-managed-ap': {'v_range': [['7.0.3', '']], 'type': 'int'},
235 'weight-noise-floor': {'v_range': [['7.0.3', '']], 'type': 'int'},
236 'weight-rogue-ap': {'v_range': [['7.0.3', '']], 'type': 'int'},
237 'weight-spectral-rssi': {'v_range': [['7.0.3', '']], 'type': 'int'},
238 'weight-weather-channel': {'v_range': [['7.0.3', '']], 'type': 'int'}
239 }
240 }
241 }
242
243 module_option_spec = get_module_arg_spec('full crud')
244 module_arg_spec.update(module_option_spec)
245 check_galaxy_version(module_arg_spec)
246 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'arrpprofile'),
247 supports_check_mode=True)
248 if not module._socket_path:
249 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
250 connection = Connection(module._socket_path)
251 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
252 'name', 'data', module, connection)
253 fmgr.process_crud()
254 module.exit_json(meta=module.params)
255
256
257 if __name__ == '__main__':
258 main()