Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_extendercontroller_extenderprofile_cellular.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_extendercontroller_extenderprofile_cellular
15 short_description: FortiExtender cellular configuration.
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_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 extender-profile:
29 description: Deprecated, please use "extender_profile"
30 type: str
31 extender_profile:
32 description: The parameter (extender-profile) in requested url.
33 type: str
34 extendercontroller_extenderprofile_cellular:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 controller_report:
40 aliases: ['controller-report']
41 type: dict
42 description: Controller report.
43 suboptions:
44 interval:
45 type: int
46 description: Controller report interval.
47 signal_threshold:
48 aliases: ['signal-threshold']
49 type: int
50 description: Controller report signal threshold.
51 status:
52 type: str
53 description: FortiExtender controller report status.
54 choices: ['disable', 'enable']
55 dataplan:
56 type: raw
57 description: (list or str) Dataplan names.
58 modem1:
59 type: dict
60 description: Modem1.
61 suboptions:
62 auto_switch:
63 aliases: ['auto-switch']
64 type: dict
65 description: Auto switch.
66 suboptions:
67 dataplan:
68 type: str
69 description: Automatically switch based on data usage.
70 choices: ['disable', 'enable']
71 disconnect:
72 type: str
73 description: Auto switch by disconnect.
74 choices: ['disable', 'enable']
75 disconnect_period:
76 aliases: ['disconnect-period']
77 type: int
78 description: Automatically switch based on disconnect period.
79 disconnect_threshold:
80 aliases: ['disconnect-threshold']
81 type: int
82 description: Automatically switch based on disconnect threshold.
83 signal:
84 type: str
85 description: Automatically switch based on signal strength.
86 choices: ['disable', 'enable']
87 switch_back:
88 aliases: ['switch-back']
89 type: list
90 elements: str
91 description: Auto switch with switch back multi-options.
92 choices: ['time', 'timer']
93 switch_back_time:
94 aliases: ['switch-back-time']
95 type: str
96 description: Automatically switch over to preferred SIM/carrier at a specified time in UTC
97 switch_back_timer:
98 aliases: ['switch-back-timer']
99 type: int
100 description: Automatically switch over to preferred SIM/carrier after the given time
101 conn_status:
102 aliases: ['conn-status']
103 type: int
104 description: Conn status.
105 default_sim:
106 aliases: ['default-sim']
107 type: str
108 description: Default SIM selection.
109 choices: ['sim1', 'sim2', 'carrier', 'cost']
110 gps:
111 type: str
112 description: FortiExtender GPS enable/disable.
113 choices: ['disable', 'enable']
114 modem_id:
115 aliases: ['modem-id']
116 type: int
117 description: Modem ID.
118 preferred_carrier:
119 aliases: ['preferred-carrier']
120 type: str
121 description: Preferred carrier.
122 redundant_intf:
123 aliases: ['redundant-intf']
124 type: str
125 description: Redundant interface.
126 redundant_mode:
127 aliases: ['redundant-mode']
128 type: str
129 description: FortiExtender mode.
130 choices: ['disable', 'enable']
131 sim1_pin:
132 aliases: ['sim1-pin']
133 type: str
134 description: SIM #1 PIN status.
135 choices: ['disable', 'enable']
136 sim1_pin_code:
137 aliases: ['sim1-pin-code']
138 type: raw
139 description: (list) SIM #1 PIN password.
140 sim2_pin:
141 aliases: ['sim2-pin']
142 type: str
143 description: SIM #2 PIN status.
144 choices: ['disable', 'enable']
145 sim2_pin_code:
146 aliases: ['sim2-pin-code']
147 type: raw
148 description: (list) SIM #2 PIN password.
149 modem2:
150 type: dict
151 description: Modem2.
152 suboptions:
153 auto_switch:
154 aliases: ['auto-switch']
155 type: dict
156 description: Auto switch.
157 suboptions:
158 dataplan:
159 type: str
160 description: Automatically switch based on data usage.
161 choices: ['disable', 'enable']
162 disconnect:
163 type: str
164 description: Auto switch by disconnect.
165 choices: ['disable', 'enable']
166 disconnect_period:
167 aliases: ['disconnect-period']
168 type: int
169 description: Automatically switch based on disconnect period.
170 disconnect_threshold:
171 aliases: ['disconnect-threshold']
172 type: int
173 description: Automatically switch based on disconnect threshold.
174 signal:
175 type: str
176 description: Automatically switch based on signal strength.
177 choices: ['disable', 'enable']
178 switch_back:
179 aliases: ['switch-back']
180 type: list
181 elements: str
182 description: Auto switch with switch back multi-options.
183 choices: ['time', 'timer']
184 switch_back_time:
185 aliases: ['switch-back-time']
186 type: str
187 description: Automatically switch over to preferred SIM/carrier at a specified time in UTC
188 switch_back_timer:
189 aliases: ['switch-back-timer']
190 type: int
191 description: Automatically switch over to preferred SIM/carrier after the given time
192 conn_status:
193 aliases: ['conn-status']
194 type: int
195 description: Conn status.
196 default_sim:
197 aliases: ['default-sim']
198 type: str
199 description: Default SIM selection.
200 choices: ['sim1', 'sim2', 'carrier', 'cost']
201 gps:
202 type: str
203 description: FortiExtender GPS enable/disable.
204 choices: ['disable', 'enable']
205 modem_id:
206 aliases: ['modem-id']
207 type: int
208 description: Modem ID.
209 preferred_carrier:
210 aliases: ['preferred-carrier']
211 type: str
212 description: Preferred carrier.
213 redundant_intf:
214 aliases: ['redundant-intf']
215 type: str
216 description: Redundant interface.
217 redundant_mode:
218 aliases: ['redundant-mode']
219 type: str
220 description: FortiExtender mode.
221 choices: ['disable', 'enable']
222 sim1_pin:
223 aliases: ['sim1-pin']
224 type: str
225 description: SIM #1 PIN status.
226 choices: ['disable', 'enable']
227 sim1_pin_code:
228 aliases: ['sim1-pin-code']
229 type: raw
230 description: (list) SIM #1 PIN password.
231 sim2_pin:
232 aliases: ['sim2-pin']
233 type: str
234 description: SIM #2 PIN status.
235 choices: ['disable', 'enable']
236 sim2_pin_code:
237 aliases: ['sim2-pin-code']
238 type: raw
239 description: (list) SIM #2 PIN password.
240 sms_notification:
241 aliases: ['sms-notification']
242 type: dict
243 description: Sms notification.
244 suboptions:
245 alert:
246 type: dict
247 description: Alert.
248 suboptions:
249 data_exhausted:
250 aliases: ['data-exhausted']
251 type: str
252 description: Display string when data exhausted.
253 fgt_backup_mode_switch:
254 aliases: ['fgt-backup-mode-switch']
255 type: str
256 description: Display string when FortiGate backup mode switched.
257 low_signal_strength:
258 aliases: ['low-signal-strength']
259 type: str
260 description: Display string when signal strength is low.
261 mode_switch:
262 aliases: ['mode-switch']
263 type: str
264 description: Display string when mode is switched.
265 os_image_fallback:
266 aliases: ['os-image-fallback']
267 type: str
268 description: Display string when falling back to a previous OS image.
269 session_disconnect:
270 aliases: ['session-disconnect']
271 type: str
272 description: Display string when session disconnected.
273 system_reboot:
274 aliases: ['system-reboot']
275 type: str
276 description: Display string when system rebooted.
277 receiver:
278 type: list
279 elements: dict
280 description: Receiver.
281 suboptions:
282 alert:
283 type: list
284 elements: str
285 description: Alert multi-options.
286 choices: ['system-reboot', 'data-exhausted', 'session-disconnect',
287 'low-signal-strength', 'mode-switch',
288 'os-image-fallback', 'fgt-backup-mode-switch']
289 name:
290 type: str
291 description: FortiExtender SMS notification receiver name.
292 phone_number:
293 aliases: ['phone-number']
294 type: str
295 description: Receiver phone number.
296 status:
297 type: str
298 description: SMS notification receiver status.
299 choices: ['disable', 'enable']
300 status:
301 type: str
302 description: FortiExtender SMS notification status.
303 choices: ['disable', 'enable']
304 '''
305
306 EXAMPLES = '''
307 - name: Example playbook (generated based on argument schema)
308 hosts: fortimanagers
309 connection: httpapi
310 gather_facts: false
311 tasks:
312 - name: FortiExtender cellular configuration.
313 fortinet.fortimanager.fmgr_extendercontroller_extenderprofile_cellular:
314 # workspace_locking_adom: <global or your adom name>
315 adom: <your own value>
316 extender_profile: <your own value>
317 extendercontroller_extenderprofile_cellular:
318 # controller_report:
319 # interval: <integer>
320 # signal_threshold: <integer>
321 # status: <value in [disable, enable]>
322 # dataplan: <list or string>
323 # modem1:
324 # auto_switch:
325 # dataplan: <value in [disable, enable]>
326 # disconnect: <value in [disable, enable]>
327 # disconnect_period: <integer>
328 # disconnect_threshold: <integer>
329 # signal: <value in [disable, enable]>
330 # switch_back: ["time", "timer"]
331 # switch_back_time: <string>
332 # switch_back_timer: <integer>
333 # conn_status: <integer>
334 # default_sim: <value in [sim1, sim2, carrier, ...]>
335 # gps: <value in [disable, enable]>
336 # modem_id: <integer>
337 # preferred_carrier: <string>
338 # redundant_intf: <string>
339 # redundant_mode: <value in [disable, enable]>
340 # sim1_pin: <value in [disable, enable]>
341 # sim1_pin_code: <list or string>
342 # sim2_pin: <value in [disable, enable]>
343 # sim2_pin_code: <list or string>
344 # modem2:
345 # auto_switch:
346 # dataplan: <value in [disable, enable]>
347 # disconnect: <value in [disable, enable]>
348 # disconnect_period: <integer>
349 # disconnect_threshold: <integer>
350 # signal: <value in [disable, enable]>
351 # switch_back: ["time", "timer"]
352 # switch_back_time: <string>
353 # switch_back_timer: <integer>
354 # conn_status: <integer>
355 # default_sim: <value in [sim1, sim2, carrier, ...]>
356 # gps: <value in [disable, enable]>
357 # modem_id: <integer>
358 # preferred_carrier: <string>
359 # redundant_intf: <string>
360 # redundant_mode: <value in [disable, enable]>
361 # sim1_pin: <value in [disable, enable]>
362 # sim1_pin_code: <list or string>
363 # sim2_pin: <value in [disable, enable]>
364 # sim2_pin_code: <list or string>
365 # sms_notification:
366 # alert:
367 # data_exhausted: <string>
368 # fgt_backup_mode_switch: <string>
369 # low_signal_strength: <string>
370 # mode_switch: <string>
371 # os_image_fallback: <string>
372 # session_disconnect: <string>
373 # system_reboot: <string>
374 # receiver:
375 # - alert: ["system-reboot", "data-exhausted", "session-disconnect",
376 # "low-signal-strength", "mode-switch", "os-image-fallback",
377 # "fgt-backup-mode-switch"]
378 # name: <string>
379 # phone_number: <string>
380 # status: <value in [disable, enable]>
381 # status: <value in [disable, enable]>
382 '''
383
384 RETURN = '''
385 meta:
386 description: The result of the request.
387 type: dict
388 returned: always
389 contains:
390 request_url:
391 description: The full url requested.
392 returned: always
393 type: str
394 sample: /sys/login/user
395 response_code:
396 description: The status of api request.
397 returned: always
398 type: int
399 sample: 0
400 response_data:
401 description: The api response.
402 type: list
403 returned: always
404 response_message:
405 description: The descriptive message of the api response.
406 type: str
407 returned: always
408 sample: OK.
409 system_information:
410 description: The information of the target system.
411 type: dict
412 returned: always
413 rc:
414 description: The status the request.
415 type: int
416 returned: always
417 sample: 0
418 version_check_warning:
419 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
420 type: list
421 returned: complex
422 '''
423 from ansible.module_utils.basic import AnsibleModule
424 from ansible.module_utils.connection import Connection
425 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
426 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
427
428
429 def main():
430 urls_list = [
431 '/pm/config/adom/{adom}/obj/extender-controller/extender-profile/{extender-profile}/cellular',
432 '/pm/config/global/obj/extender-controller/extender-profile/{extender-profile}/cellular'
433 ]
434 module_arg_spec = {
435 'adom': {'required': True, 'type': 'str'},
436 'extender-profile': {'type': 'str', 'api_name': 'extender_profile'},
437 'extender_profile': {'type': 'str'},
438 'revision_note': {'type': 'str'},
439 'extendercontroller_extenderprofile_cellular': {
440 'type': 'dict', 'v_range': [['7.0.2', '']],
441 'options': {
442 'controller-report': {
443 'v_range': [['7.0.2', '']],
444 'type': 'dict',
445 'options': {
446 'interval': {'v_range': [['7.0.2', '']], 'type': 'int'},
447 'signal-threshold': {'v_range': [['7.0.2', '']], 'type': 'int'},
448 'status': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
449 }
450 },
451 'dataplan': {'v_range': [['7.0.2', '']], 'type': 'raw'},
452 'modem1': {
453 'v_range': [['7.0.2', '']],
454 'type': 'dict',
455 'options': {
456 'auto-switch': {
457 'v_range': [['7.0.2', '']],
458 'type': 'dict',
459 'options': {
460 'dataplan': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
461 'disconnect': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
462 'disconnect-period': {'v_range': [['7.0.2', '']], 'type': 'int'},
463 'disconnect-threshold': {'v_range': [['7.0.2', '']], 'type': 'int'},
464 'signal': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
465 'switch-back': {'v_range': [['7.0.2', '']], 'type': 'list', 'choices': ['time', 'timer'], 'elements': 'str'},
466 'switch-back-time': {'v_range': [['7.0.2', '']], 'type': 'str'},
467 'switch-back-timer': {'v_range': [['7.0.2', '']], 'type': 'int'}
468 }
469 },
470 'conn-status': {'v_range': [['7.0.2', '']], 'type': 'int'},
471 'default-sim': {'v_range': [['7.0.2', '']], 'choices': ['sim1', 'sim2', 'carrier', 'cost'], 'type': 'str'},
472 'gps': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
473 'modem-id': {'v_range': [['7.0.2', '']], 'type': 'int'},
474 'preferred-carrier': {'v_range': [['7.0.2', '']], 'type': 'str'},
475 'redundant-intf': {'v_range': [['7.0.2', '']], 'type': 'str'},
476 'redundant-mode': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
477 'sim1-pin': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
478 'sim1-pin-code': {'v_range': [['7.0.2', '']], 'type': 'raw'},
479 'sim2-pin': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
480 'sim2-pin-code': {'v_range': [['7.0.2', '']], 'type': 'raw'}
481 }
482 },
483 'modem2': {
484 'v_range': [['7.0.2', '']],
485 'type': 'dict',
486 'options': {
487 'auto-switch': {
488 'v_range': [['7.0.2', '']],
489 'type': 'dict',
490 'options': {
491 'dataplan': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
492 'disconnect': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
493 'disconnect-period': {'v_range': [['7.0.2', '']], 'type': 'int'},
494 'disconnect-threshold': {'v_range': [['7.0.2', '']], 'type': 'int'},
495 'signal': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
496 'switch-back': {'v_range': [['7.0.2', '']], 'type': 'list', 'choices': ['time', 'timer'], 'elements': 'str'},
497 'switch-back-time': {'v_range': [['7.0.2', '']], 'type': 'str'},
498 'switch-back-timer': {'v_range': [['7.0.2', '']], 'type': 'int'}
499 }
500 },
501 'conn-status': {'v_range': [['7.0.2', '']], 'type': 'int'},
502 'default-sim': {'v_range': [['7.0.2', '']], 'choices': ['sim1', 'sim2', 'carrier', 'cost'], 'type': 'str'},
503 'gps': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
504 'modem-id': {'v_range': [['7.0.2', '']], 'type': 'int'},
505 'preferred-carrier': {'v_range': [['7.0.2', '']], 'type': 'str'},
506 'redundant-intf': {'v_range': [['7.0.2', '']], 'type': 'str'},
507 'redundant-mode': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
508 'sim1-pin': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
509 'sim1-pin-code': {'v_range': [['7.0.2', '']], 'type': 'raw'},
510 'sim2-pin': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
511 'sim2-pin-code': {'v_range': [['7.0.2', '']], 'type': 'raw'}
512 }
513 },
514 'sms-notification': {
515 'v_range': [['7.0.2', '']],
516 'type': 'dict',
517 'options': {
518 'alert': {
519 'v_range': [['7.0.2', '']],
520 'type': 'dict',
521 'options': {
522 'data-exhausted': {'v_range': [['7.0.2', '']], 'type': 'str'},
523 'fgt-backup-mode-switch': {'v_range': [['7.0.2', '']], 'type': 'str'},
524 'low-signal-strength': {'v_range': [['7.0.2', '']], 'type': 'str'},
525 'mode-switch': {'v_range': [['7.0.2', '']], 'type': 'str'},
526 'os-image-fallback': {'v_range': [['7.0.2', '']], 'type': 'str'},
527 'session-disconnect': {'v_range': [['7.0.2', '']], 'type': 'str'},
528 'system-reboot': {'v_range': [['7.0.2', '']], 'type': 'str'}
529 }
530 },
531 'receiver': {
532 'v_range': [['7.0.2', '']],
533 'type': 'list',
534 'options': {
535 'alert': {
536 'v_range': [['7.0.2', '']],
537 'type': 'list',
538 'choices': [
539 'system-reboot', 'data-exhausted', 'session-disconnect', 'low-signal-strength', 'mode-switch',
540 'os-image-fallback', 'fgt-backup-mode-switch'
541 ],
542 'elements': 'str'
543 },
544 'name': {'v_range': [['7.0.2', '']], 'type': 'str'},
545 'phone-number': {'v_range': [['7.0.2', '']], 'type': 'str'},
546 'status': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
547 },
548 'elements': 'dict'
549 },
550 'status': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
551 }
552 }
553 }
554 }
555 }
556
557 module_option_spec = get_module_arg_spec('partial crud')
558 module_arg_spec.update(module_option_spec)
559 check_galaxy_version(module_arg_spec)
560 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'extendercontroller_extenderprofile_cellular'),
561 supports_check_mode=True)
562 if not module._socket_path:
563 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
564 connection = Connection(module._socket_path)
565 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
566 None, 'data', module, connection)
567 fmgr.process_partial_crud()
568 module.exit_json(meta=module.params)
569
570
571 if __name__ == '__main__':
572 main()