Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_extensioncontroller_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_extensioncontroller_extenderprofile_cellular
15 short_description: FortiExtender cellular configuration.
16 version_added: "2.2.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 extensioncontroller_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) 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 multiple_PDN:
150 aliases: ['multiple-PDN']
151 type: str
152 description: Multiple-PDN enable/disable.
153 choices: ['disable', 'enable']
154 pdn1_dataplan:
155 aliases: ['pdn1-dataplan']
156 type: raw
157 description: (list) PDN1-dataplan.
158 pdn2_dataplan:
159 aliases: ['pdn2-dataplan']
160 type: raw
161 description: (list) PDN2-dataplan.
162 pdn3_dataplan:
163 aliases: ['pdn3-dataplan']
164 type: raw
165 description: (list) PDN3-dataplan.
166 pdn4_dataplan:
167 aliases: ['pdn4-dataplan']
168 type: raw
169 description: (list) PDN4-dataplan.
170 modem2:
171 type: dict
172 description: Modem2.
173 suboptions:
174 auto_switch:
175 aliases: ['auto-switch']
176 type: dict
177 description: Auto switch.
178 suboptions:
179 dataplan:
180 type: str
181 description: Automatically switch based on data usage.
182 choices: ['disable', 'enable']
183 disconnect:
184 type: str
185 description: Auto switch by disconnect.
186 choices: ['disable', 'enable']
187 disconnect_period:
188 aliases: ['disconnect-period']
189 type: int
190 description: Automatically switch based on disconnect period.
191 disconnect_threshold:
192 aliases: ['disconnect-threshold']
193 type: int
194 description: Automatically switch based on disconnect threshold.
195 signal:
196 type: str
197 description: Automatically switch based on signal strength.
198 choices: ['disable', 'enable']
199 switch_back:
200 aliases: ['switch-back']
201 type: list
202 elements: str
203 description: Auto switch with switch back multi-options.
204 choices: ['time', 'timer']
205 switch_back_time:
206 aliases: ['switch-back-time']
207 type: str
208 description: Automatically switch over to preferred SIM/carrier at a specified time in UTC
209 switch_back_timer:
210 aliases: ['switch-back-timer']
211 type: int
212 description: Automatically switch over to preferred SIM/carrier after the given time
213 conn_status:
214 aliases: ['conn-status']
215 type: int
216 description: Conn status.
217 default_sim:
218 aliases: ['default-sim']
219 type: str
220 description: Default SIM selection.
221 choices: ['sim1', 'sim2', 'carrier', 'cost']
222 gps:
223 type: str
224 description: FortiExtender GPS enable/disable.
225 choices: ['disable', 'enable']
226 modem_id:
227 aliases: ['modem-id']
228 type: int
229 description: Modem ID.
230 preferred_carrier:
231 aliases: ['preferred-carrier']
232 type: str
233 description: Preferred carrier.
234 redundant_intf:
235 aliases: ['redundant-intf']
236 type: str
237 description: Redundant interface.
238 redundant_mode:
239 aliases: ['redundant-mode']
240 type: str
241 description: FortiExtender mode.
242 choices: ['disable', 'enable']
243 sim1_pin:
244 aliases: ['sim1-pin']
245 type: str
246 description: SIM #1 PIN status.
247 choices: ['disable', 'enable']
248 sim1_pin_code:
249 aliases: ['sim1-pin-code']
250 type: raw
251 description: (list) SIM #1 PIN password.
252 sim2_pin:
253 aliases: ['sim2-pin']
254 type: str
255 description: SIM #2 PIN status.
256 choices: ['disable', 'enable']
257 sim2_pin_code:
258 aliases: ['sim2-pin-code']
259 type: raw
260 description: (list) SIM #2 PIN password.
261 multiple_PDN:
262 aliases: ['multiple-PDN']
263 type: str
264 description: Multiple-PDN enable/disable.
265 choices: ['disable', 'enable']
266 pdn1_dataplan:
267 aliases: ['pdn1-dataplan']
268 type: raw
269 description: (list) PDN1-dataplan.
270 pdn2_dataplan:
271 aliases: ['pdn2-dataplan']
272 type: raw
273 description: (list) PDN2-dataplan.
274 pdn3_dataplan:
275 aliases: ['pdn3-dataplan']
276 type: raw
277 description: (list) PDN3-dataplan.
278 pdn4_dataplan:
279 aliases: ['pdn4-dataplan']
280 type: raw
281 description: (list) PDN4-dataplan.
282 sms_notification:
283 aliases: ['sms-notification']
284 type: dict
285 description: Sms notification.
286 suboptions:
287 alert:
288 type: dict
289 description: Alert.
290 suboptions:
291 data_exhausted:
292 aliases: ['data-exhausted']
293 type: str
294 description: Display string when data exhausted.
295 fgt_backup_mode_switch:
296 aliases: ['fgt-backup-mode-switch']
297 type: str
298 description: Display string when FortiGate backup mode switched.
299 low_signal_strength:
300 aliases: ['low-signal-strength']
301 type: str
302 description: Display string when signal strength is low.
303 mode_switch:
304 aliases: ['mode-switch']
305 type: str
306 description: Display string when mode is switched.
307 os_image_fallback:
308 aliases: ['os-image-fallback']
309 type: str
310 description: Display string when falling back to a previous OS image.
311 session_disconnect:
312 aliases: ['session-disconnect']
313 type: str
314 description: Display string when session disconnected.
315 system_reboot:
316 aliases: ['system-reboot']
317 type: str
318 description: Display string when system rebooted.
319 receiver:
320 type: list
321 elements: dict
322 description: Receiver.
323 suboptions:
324 alert:
325 type: list
326 elements: str
327 description: Alert multi-options.
328 choices: ['system-reboot', 'data-exhausted', 'session-disconnect',
329 'low-signal-strength', 'mode-switch',
330 'os-image-fallback', 'fgt-backup-mode-switch']
331 name:
332 type: str
333 description: FortiExtender SMS notification receiver name.
334 phone_number:
335 aliases: ['phone-number']
336 type: str
337 description: Receiver phone number.
338 status:
339 type: str
340 description: SMS notification receiver status.
341 choices: ['disable', 'enable']
342 status:
343 type: str
344 description: FortiExtender SMS notification status.
345 choices: ['disable', 'enable']
346 '''
347
348 EXAMPLES = '''
349 - name: Example playbook (generated based on argument schema)
350 hosts: fortimanagers
351 connection: httpapi
352 gather_facts: false
353 tasks:
354 - name: FortiExtender cellular configuration.
355 fortinet.fortimanager.fmgr_extensioncontroller_extenderprofile_cellular:
356 # workspace_locking_adom: <global or your adom name>
357 adom: <your own value>
358 extender_profile: <your own value>
359 extensioncontroller_extenderprofile_cellular:
360 # controller_report:
361 # interval: <integer>
362 # signal_threshold: <integer>
363 # status: <value in [disable, enable]>
364 # dataplan: <list or string>
365 # modem1:
366 # auto_switch:
367 # dataplan: <value in [disable, enable]>
368 # disconnect: <value in [disable, enable]>
369 # disconnect_period: <integer>
370 # disconnect_threshold: <integer>
371 # signal: <value in [disable, enable]>
372 # switch_back: ["time", "timer"]
373 # switch_back_time: <string>
374 # switch_back_timer: <integer>
375 # conn_status: <integer>
376 # default_sim: <value in [sim1, sim2, carrier, ...]>
377 # gps: <value in [disable, enable]>
378 # modem_id: <integer>
379 # preferred_carrier: <string>
380 # redundant_intf: <string>
381 # redundant_mode: <value in [disable, enable]>
382 # sim1_pin: <value in [disable, enable]>
383 # sim1_pin_code: <list or string>
384 # sim2_pin: <value in [disable, enable]>
385 # sim2_pin_code: <list or string>
386 # multiple_PDN: <value in [disable, enable]>
387 # pdn1_dataplan: <list or string>
388 # pdn2_dataplan: <list or string>
389 # pdn3_dataplan: <list or string>
390 # pdn4_dataplan: <list or string>
391 # modem2:
392 # auto_switch:
393 # dataplan: <value in [disable, enable]>
394 # disconnect: <value in [disable, enable]>
395 # disconnect_period: <integer>
396 # disconnect_threshold: <integer>
397 # signal: <value in [disable, enable]>
398 # switch_back: ["time", "timer"]
399 # switch_back_time: <string>
400 # switch_back_timer: <integer>
401 # conn_status: <integer>
402 # default_sim: <value in [sim1, sim2, carrier, ...]>
403 # gps: <value in [disable, enable]>
404 # modem_id: <integer>
405 # preferred_carrier: <string>
406 # redundant_intf: <string>
407 # redundant_mode: <value in [disable, enable]>
408 # sim1_pin: <value in [disable, enable]>
409 # sim1_pin_code: <list or string>
410 # sim2_pin: <value in [disable, enable]>
411 # sim2_pin_code: <list or string>
412 # multiple_PDN: <value in [disable, enable]>
413 # pdn1_dataplan: <list or string>
414 # pdn2_dataplan: <list or string>
415 # pdn3_dataplan: <list or string>
416 # pdn4_dataplan: <list or string>
417 # sms_notification:
418 # alert:
419 # data_exhausted: <string>
420 # fgt_backup_mode_switch: <string>
421 # low_signal_strength: <string>
422 # mode_switch: <string>
423 # os_image_fallback: <string>
424 # session_disconnect: <string>
425 # system_reboot: <string>
426 # receiver:
427 # - alert: ["system-reboot", "data-exhausted", "session-disconnect",
428 # "low-signal-strength", "mode-switch", "os-image-fallback",
429 # "fgt-backup-mode-switch"]
430 # name: <string>
431 # phone_number: <string>
432 # status: <value in [disable, enable]>
433 # status: <value in [disable, enable]>
434 '''
435
436 RETURN = '''
437 meta:
438 description: The result of the request.
439 type: dict
440 returned: always
441 contains:
442 request_url:
443 description: The full url requested.
444 returned: always
445 type: str
446 sample: /sys/login/user
447 response_code:
448 description: The status of api request.
449 returned: always
450 type: int
451 sample: 0
452 response_data:
453 description: The api response.
454 type: list
455 returned: always
456 response_message:
457 description: The descriptive message of the api response.
458 type: str
459 returned: always
460 sample: OK.
461 system_information:
462 description: The information of the target system.
463 type: dict
464 returned: always
465 rc:
466 description: The status the request.
467 type: int
468 returned: always
469 sample: 0
470 version_check_warning:
471 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
472 type: list
473 returned: complex
474 '''
475 from ansible.module_utils.basic import AnsibleModule
476 from ansible.module_utils.connection import Connection
477 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
478 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
479
480
481 def main():
482 urls_list = [
483 '/pm/config/adom/{adom}/obj/extension-controller/extender-profile/{extender-profile}/cellular',
484 '/pm/config/global/obj/extension-controller/extender-profile/{extender-profile}/cellular'
485 ]
486 module_arg_spec = {
487 'adom': {'required': True, 'type': 'str'},
488 'extender-profile': {'type': 'str', 'api_name': 'extender_profile'},
489 'extender_profile': {'type': 'str'},
490 'revision_note': {'type': 'str'},
491 'extensioncontroller_extenderprofile_cellular': {
492 'type': 'dict', 'v_range': [['7.2.1', '']],
493 'options': {
494 'controller-report': {
495 'v_range': [['7.2.1', '']],
496 'type': 'dict',
497 'options': {
498 'interval': {'v_range': [['7.2.1', '']], 'type': 'int'},
499 'signal-threshold': {'v_range': [['7.2.1', '']], 'type': 'int'},
500 'status': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
501 }
502 },
503 'dataplan': {'v_range': [['7.2.1', '']], 'type': 'raw'},
504 'modem1': {
505 'v_range': [['7.2.1', '']],
506 'type': 'dict',
507 'options': {
508 'auto-switch': {
509 'v_range': [['7.2.1', '']],
510 'type': 'dict',
511 'options': {
512 'dataplan': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
513 'disconnect': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
514 'disconnect-period': {'v_range': [['7.2.1', '']], 'type': 'int'},
515 'disconnect-threshold': {'v_range': [['7.2.1', '']], 'type': 'int'},
516 'signal': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
517 'switch-back': {'v_range': [['7.2.1', '']], 'type': 'list', 'choices': ['time', 'timer'], 'elements': 'str'},
518 'switch-back-time': {'v_range': [['7.2.1', '']], 'type': 'str'},
519 'switch-back-timer': {'v_range': [['7.2.1', '']], 'type': 'int'}
520 }
521 },
522 'conn-status': {'v_range': [['7.2.1', '']], 'type': 'int'},
523 'default-sim': {'v_range': [['7.2.1', '']], 'choices': ['sim1', 'sim2', 'carrier', 'cost'], 'type': 'str'},
524 'gps': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
525 'modem-id': {'v_range': [['7.2.1', '']], 'type': 'int'},
526 'preferred-carrier': {'v_range': [['7.2.1', '']], 'type': 'str'},
527 'redundant-intf': {'v_range': [['7.2.1', '']], 'type': 'str'},
528 'redundant-mode': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
529 'sim1-pin': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
530 'sim1-pin-code': {'v_range': [['7.2.1', '']], 'type': 'raw'},
531 'sim2-pin': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
532 'sim2-pin-code': {'v_range': [['7.2.1', '']], 'type': 'raw'},
533 'multiple-PDN': {'v_range': [['7.6.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
534 'pdn1-dataplan': {'v_range': [['7.6.2', '']], 'type': 'raw'},
535 'pdn2-dataplan': {'v_range': [['7.6.2', '']], 'type': 'raw'},
536 'pdn3-dataplan': {'v_range': [['7.6.2', '']], 'type': 'raw'},
537 'pdn4-dataplan': {'v_range': [['7.6.2', '']], 'type': 'raw'}
538 }
539 },
540 'modem2': {
541 'v_range': [['7.2.1', '']],
542 'type': 'dict',
543 'options': {
544 'auto-switch': {
545 'v_range': [['7.2.1', '']],
546 'type': 'dict',
547 'options': {
548 'dataplan': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
549 'disconnect': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
550 'disconnect-period': {'v_range': [['7.2.1', '']], 'type': 'int'},
551 'disconnect-threshold': {'v_range': [['7.2.1', '']], 'type': 'int'},
552 'signal': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
553 'switch-back': {'v_range': [['7.2.1', '']], 'type': 'list', 'choices': ['time', 'timer'], 'elements': 'str'},
554 'switch-back-time': {'v_range': [['7.2.1', '']], 'type': 'str'},
555 'switch-back-timer': {'v_range': [['7.2.1', '']], 'type': 'int'}
556 }
557 },
558 'conn-status': {'v_range': [['7.2.1', '']], 'type': 'int'},
559 'default-sim': {'v_range': [['7.2.1', '']], 'choices': ['sim1', 'sim2', 'carrier', 'cost'], 'type': 'str'},
560 'gps': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
561 'modem-id': {'v_range': [['7.2.1', '']], 'type': 'int'},
562 'preferred-carrier': {'v_range': [['7.2.1', '']], 'type': 'str'},
563 'redundant-intf': {'v_range': [['7.2.1', '']], 'type': 'str'},
564 'redundant-mode': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
565 'sim1-pin': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
566 'sim1-pin-code': {'v_range': [['7.2.1', '']], 'type': 'raw'},
567 'sim2-pin': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
568 'sim2-pin-code': {'v_range': [['7.2.1', '']], 'type': 'raw'},
569 'multiple-PDN': {'v_range': [['7.6.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
570 'pdn1-dataplan': {'v_range': [['7.6.2', '']], 'type': 'raw'},
571 'pdn2-dataplan': {'v_range': [['7.6.2', '']], 'type': 'raw'},
572 'pdn3-dataplan': {'v_range': [['7.6.2', '']], 'type': 'raw'},
573 'pdn4-dataplan': {'v_range': [['7.6.2', '']], 'type': 'raw'}
574 }
575 },
576 'sms-notification': {
577 'v_range': [['7.2.1', '']],
578 'type': 'dict',
579 'options': {
580 'alert': {
581 'v_range': [['7.2.1', '']],
582 'type': 'dict',
583 'options': {
584 'data-exhausted': {'v_range': [['7.2.1', '']], 'type': 'str'},
585 'fgt-backup-mode-switch': {'v_range': [['7.2.1', '']], 'type': 'str'},
586 'low-signal-strength': {'v_range': [['7.2.1', '']], 'type': 'str'},
587 'mode-switch': {'v_range': [['7.2.1', '']], 'type': 'str'},
588 'os-image-fallback': {'v_range': [['7.2.1', '']], 'type': 'str'},
589 'session-disconnect': {'v_range': [['7.2.1', '']], 'type': 'str'},
590 'system-reboot': {'v_range': [['7.2.1', '']], 'type': 'str'}
591 }
592 },
593 'receiver': {
594 'v_range': [['7.2.1', '']],
595 'type': 'list',
596 'options': {
597 'alert': {
598 'v_range': [['7.2.1', '']],
599 'type': 'list',
600 'choices': [
601 'system-reboot', 'data-exhausted', 'session-disconnect', 'low-signal-strength', 'mode-switch',
602 'os-image-fallback', 'fgt-backup-mode-switch'
603 ],
604 'elements': 'str'
605 },
606 'name': {'v_range': [['7.2.1', '']], 'type': 'str'},
607 'phone-number': {'v_range': [['7.2.1', '']], 'type': 'str'},
608 'status': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
609 },
610 'elements': 'dict'
611 },
612 'status': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
613 }
614 }
615 }
616 }
617 }
618
619 module_option_spec = get_module_arg_spec('partial crud')
620 module_arg_spec.update(module_option_spec)
621 check_galaxy_version(module_arg_spec)
622 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'extensioncontroller_extenderprofile_cellular'),
623 supports_check_mode=True)
624 if not module._socket_path:
625 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
626 connection = Connection(module._socket_path)
627 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
628 None, 'data', module, connection)
629 fmgr.process_partial_crud()
630 module.exit_json(meta=module.params)
631
632
633 if __name__ == '__main__':
634 main()