Debian Codegraph @

ansible_collections/fortinet/fortios/plugins/modules/fortios_firewall_gtp.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3
4 # Copyright: (c) 2022 Fortinet
5 # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
6 #
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11
12 __metaclass__ = type
13
14 ANSIBLE_METADATA = {
15 "status": ["preview"],
16 "supported_by": "community",
17 "metadata_version": "1.1",
18 }
19
20 DOCUMENTATION = """
21 ---
22 module: fortios_firewall_gtp
23 short_description: Configure GTP in Fortinet's FortiOS and FortiGate.
24 description:
25 - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the
26 user to set and modify firewall feature and gtp category.
27 Examples include all parameters and values need to be adjusted to datasources before usage.
28 Tested with FOS v6.0.0
29 version_added: "2.0.0"
30 author:
31 - Link Zheng (@chillancezen)
32 - Jie Xue (@JieX19)
33 - Hongbin Lu (@fgtdev-hblu)
34 - Frank Shen (@frankshen01)
35 - Miguel Angel Munoz (@mamunozgonzalez)
36 - Nicolas Thomas (@thomnico)
37 notes:
38 - Legacy fortiosapi has been deprecated, httpapi is the preferred way to run playbooks
39
40 - The module supports check_mode.
41
42 requirements:
43 - ansible>=2.16
44 options:
45 access_token:
46 description:
47 - Token-based authentication.
48 Generated from GUI of Fortigate.
49 type: str
50 required: false
51 enable_log:
52 description:
53 - Enable/Disable logging for task.
54 type: bool
55 required: false
56 default: false
57 vdom:
58 description:
59 - Virtual domain, among those defined previously. A vdom is a
60 virtual instance of the FortiGate that can be configured and
61 used as a different unit.
62 type: str
63 default: root
64 member_path:
65 type: str
66 description:
67 - Member attribute path to operate on.
68 - Delimited by a slash character if there are more than one attribute.
69 - Parameter marked with member_path is legitimate for doing member operation.
70 member_state:
71 type: str
72 description:
73 - Add or delete a member under specified attribute path.
74 - When member_state is specified, the state option is ignored.
75 choices:
76 - 'present'
77 - 'absent'
78
79 state:
80 description:
81 - Indicates whether to create or remove the object.
82 type: str
83 required: true
84 choices:
85 - 'present'
86 - 'absent'
87 firewall_gtp:
88 description:
89 - Configure GTP.
90 default: null
91 type: dict
92 suboptions:
93 addr_notify:
94 description:
95 - overbilling notify address
96 type: str
97 apn:
98 description:
99 - APN.
100 type: list
101 elements: dict
102 suboptions:
103 action:
104 description:
105 - Action.
106 type: str
107 choices:
108 - 'allow'
109 - 'deny'
110 apnmember:
111 description:
112 - APN member.
113 type: list
114 elements: dict
115 suboptions:
116 name:
117 description:
118 - APN name. Source gtp.apn.name gtp.apngrp.name.
119 required: true
120 type: str
121 id:
122 description:
123 - ID. see <a href='#notes'>Notes</a>.
124 required: true
125 type: int
126 selection_mode:
127 description:
128 - APN selection mode.
129 type: list
130 elements: str
131 choices:
132 - 'ms'
133 - 'net'
134 - 'vrf'
135 apn_filter:
136 description:
137 - apn filter
138 type: str
139 choices:
140 - 'enable'
141 - 'disable'
142 authorized_ggsns:
143 description:
144 - Authorized GGSN/PGW group. Source firewall.address.name firewall.addrgrp.name.
145 type: str
146 authorized_ggsns6:
147 description:
148 - Authorized GGSN/PGW IPv6 group. Source firewall.address6.name firewall.addrgrp6.name.
149 type: str
150 authorized_sgsns:
151 description:
152 - Authorized SGSN/SGW group. Source firewall.address.name firewall.addrgrp.name.
153 type: str
154 authorized_sgsns6:
155 description:
156 - Authorized SGSN/SGW IPv6 group. Source firewall.address6.name firewall.addrgrp6.name.
157 type: str
158 comment:
159 description:
160 - Comment.
161 type: str
162 context_id:
163 description:
164 - Overbilling context.
165 type: int
166 control_plane_message_rate_limit:
167 description:
168 - control plane message rate limit
169 type: int
170 default_apn_action:
171 description:
172 - default apn action
173 type: str
174 choices:
175 - 'allow'
176 - 'deny'
177 default_imsi_action:
178 description:
179 - default imsi action
180 type: str
181 choices:
182 - 'allow'
183 - 'deny'
184 default_ip_action:
185 description:
186 - default action for encapsulated IP traffic
187 type: str
188 choices:
189 - 'allow'
190 - 'deny'
191 default_noip_action:
192 description:
193 - default action for encapsulated non-IP traffic
194 type: str
195 choices:
196 - 'allow'
197 - 'deny'
198 default_policy_action:
199 description:
200 - default advanced policy action
201 type: str
202 choices:
203 - 'allow'
204 - 'deny'
205 denied_log:
206 description:
207 - log denied
208 type: str
209 choices:
210 - 'enable'
211 - 'disable'
212 echo_request_interval:
213 description:
214 - echo request interval (in seconds)
215 type: int
216 echo_requires_path_in_use:
217 description:
218 - Block GTP Echo Request if no active tunnel over the associated GTP path.
219 type: str
220 choices:
221 - 'enable'
222 - 'disable'
223 extension_log:
224 description:
225 - log in extension format
226 type: str
227 choices:
228 - 'enable'
229 - 'disable'
230 forwarded_log:
231 description:
232 - log forwarded
233 type: str
234 choices:
235 - 'enable'
236 - 'disable'
237 global_tunnel_limit:
238 description:
239 - Global tunnel limit. Source gtp.tunnel-limit.name.
240 type: str
241 gtp_in_gtp:
242 description:
243 - gtp in gtp
244 type: str
245 choices:
246 - 'allow'
247 - 'deny'
248 gtpu_denied_log:
249 description:
250 - Enable/disable logging of denied GTP-U packets.
251 type: str
252 choices:
253 - 'enable'
254 - 'disable'
255 gtpu_forwarded_log:
256 description:
257 - Enable/disable logging of forwarded GTP-U packets.
258 type: str
259 choices:
260 - 'enable'
261 - 'disable'
262 gtpu_log_freq:
263 description:
264 - Logging of frequency of GTP-U packets.
265 type: int
266 gtpv0:
267 description:
268 - GTPv0 traffic.
269 type: str
270 choices:
271 - 'allow'
272 - 'deny'
273 half_close_timeout:
274 description:
275 - Half-close tunnel timeout (in seconds).
276 type: int
277 half_open_timeout:
278 description:
279 - Half-open tunnel timeout (in seconds).
280 type: int
281 handover_group:
282 description:
283 - Handover SGSN/SGW group. Source firewall.address.name firewall.addrgrp.name.
284 type: str
285 handover_group6:
286 description:
287 - Handover SGSN/SGW IPv6 group. Source firewall.address6.name firewall.addrgrp6.name.
288 type: str
289 ie_allow_list_v0v1:
290 description:
291 - IE allow list. Source gtp.ie-allow-list.name.
292 type: str
293 ie_allow_list_v2:
294 description:
295 - IE allow list. Source gtp.ie-allow-list.name.
296 type: str
297 ie_remove_policy:
298 description:
299 - IE remove policy.
300 type: list
301 elements: dict
302 suboptions:
303 id:
304 description:
305 - ID. see <a href='#notes'>Notes</a>.
306 required: true
307 type: int
308 remove_ies:
309 description:
310 - GTP IEs to be removed.
311 type: list
312 elements: str
313 choices:
314 - 'apn-restriction'
315 - 'rat-type'
316 - 'rai'
317 - 'uli'
318 - 'imei'
319 sgsn_addr:
320 description:
321 - SGSN address name. Source firewall.address.name firewall.addrgrp.name.
322 type: str
323 sgsn_addr6:
324 description:
325 - SGSN IPv6 address name. Source firewall.address6.name firewall.addrgrp6.name.
326 type: str
327 ie_remover:
328 description:
329 - IE removal policy.
330 type: str
331 choices:
332 - 'enable'
333 - 'disable'
334 ie_validation:
335 description:
336 - IE validation.
337 type: dict
338 suboptions:
339 apn_restriction:
340 description:
341 - Validate APN restriction.
342 type: str
343 choices:
344 - 'enable'
345 - 'disable'
346 charging_gateway_addr:
347 description:
348 - Validate charging gateway address.
349 type: str
350 choices:
351 - 'enable'
352 - 'disable'
353 charging_ID:
354 description:
355 - Validate charging ID.
356 type: str
357 choices:
358 - 'enable'
359 - 'disable'
360 end_user_addr:
361 description:
362 - Validate end user address.
363 type: str
364 choices:
365 - 'enable'
366 - 'disable'
367 gsn_addr:
368 description:
369 - Validate GSN address.
370 type: str
371 choices:
372 - 'enable'
373 - 'disable'
374 imei:
375 description:
376 - Validate IMEI(SV).
377 type: str
378 choices:
379 - 'enable'
380 - 'disable'
381 imsi:
382 description:
383 - Validate IMSI.
384 type: str
385 choices:
386 - 'enable'
387 - 'disable'
388 mm_context:
389 description:
390 - Validate MM context.
391 type: str
392 choices:
393 - 'enable'
394 - 'disable'
395 ms_tzone:
396 description:
397 - Validate MS time zone.
398 type: str
399 choices:
400 - 'enable'
401 - 'disable'
402 ms_validated:
403 description:
404 - Validate MS validated.
405 type: str
406 choices:
407 - 'enable'
408 - 'disable'
409 msisdn:
410 description:
411 - Validate MSISDN.
412 type: str
413 choices:
414 - 'enable'
415 - 'disable'
416 nsapi:
417 description:
418 - Validate NSAPI.
419 type: str
420 choices:
421 - 'enable'
422 - 'disable'
423 pdp_context:
424 description:
425 - Validate PDP context.
426 type: str
427 choices:
428 - 'enable'
429 - 'disable'
430 qos_profile:
431 description:
432 - Validate Quality of Service(QoS) profile.
433 type: str
434 choices:
435 - 'enable'
436 - 'disable'
437 rai:
438 description:
439 - Validate RAI.
440 type: str
441 choices:
442 - 'enable'
443 - 'disable'
444 rat_type:
445 description:
446 - Validate RAT type.
447 type: str
448 choices:
449 - 'enable'
450 - 'disable'
451 reordering_required:
452 description:
453 - Validate re-ordering required.
454 type: str
455 choices:
456 - 'enable'
457 - 'disable'
458 selection_mode:
459 description:
460 - Validate selection mode.
461 type: str
462 choices:
463 - 'enable'
464 - 'disable'
465 uli:
466 description:
467 - Validate user location information.
468 type: str
469 choices:
470 - 'enable'
471 - 'disable'
472 ie_white_list_v0v1:
473 description:
474 - IE white list. Source gtp.ie-white-list.name.
475 type: str
476 ie_white_list_v2:
477 description:
478 - IE white list. Source gtp.ie-white-list.name.
479 type: str
480 imsi:
481 description:
482 - IMSI.
483 type: list
484 elements: dict
485 suboptions:
486 action:
487 description:
488 - Action.
489 type: str
490 choices:
491 - 'allow'
492 - 'deny'
493 apnmember:
494 description:
495 - APN member.
496 type: list
497 elements: dict
498 suboptions:
499 name:
500 description:
501 - APN name. Source gtp.apn.name gtp.apngrp.name.
502 required: true
503 type: str
504 id:
505 description:
506 - ID. see <a href='#notes'>Notes</a>.
507 required: true
508 type: int
509 mcc_mnc:
510 description:
511 - MCC MNC.
512 type: str
513 msisdn_prefix:
514 description:
515 - MSISDN prefix.
516 type: str
517 selection_mode:
518 description:
519 - APN selection mode.
520 type: list
521 elements: str
522 choices:
523 - 'ms'
524 - 'net'
525 - 'vrf'
526 imsi_filter:
527 description:
528 - imsi filter
529 type: str
530 choices:
531 - 'enable'
532 - 'disable'
533 interface_notify:
534 description:
535 - overbilling interface Source system.interface.name.
536 type: str
537 invalid_reserved_field:
538 description:
539 - Invalid reserved field in GTP header
540 type: str
541 choices:
542 - 'allow'
543 - 'deny'
544 invalid_sgsns_to_log:
545 description:
546 - Invalid SGSN group to be logged Source firewall.address.name firewall.addrgrp.name.
547 type: str
548 invalid_sgsns6_to_log:
549 description:
550 - Invalid SGSN IPv6 group to be logged. Source firewall.address6.name firewall.addrgrp6.name.
551 type: str
552 ip_filter:
553 description:
554 - IP filter for encapsulted traffic
555 type: str
556 choices:
557 - 'enable'
558 - 'disable'
559 ip_policy:
560 description:
561 - IP policy.
562 type: list
563 elements: dict
564 suboptions:
565 action:
566 description:
567 - Action.
568 type: str
569 choices:
570 - 'allow'
571 - 'deny'
572 dstaddr:
573 description:
574 - Destination address name. Source firewall.address.name firewall.addrgrp.name.
575 type: str
576 dstaddr6:
577 description:
578 - Destination IPv6 address name. Source firewall.address6.name firewall.addrgrp6.name.
579 type: str
580 id:
581 description:
582 - ID. see <a href='#notes'>Notes</a>.
583 required: true
584 type: int
585 srcaddr:
586 description:
587 - Source address name. Source firewall.address.name firewall.addrgrp.name.
588 type: str
589 srcaddr6:
590 description:
591 - Source IPv6 address name. Source firewall.address6.name firewall.addrgrp6.name.
592 type: str
593 log_freq:
594 description:
595 - Logging of frequency of GTP-C packets.
596 type: int
597 log_gtpu_limit:
598 description:
599 - the user data log limit (0-512 bytes)
600 type: int
601 log_imsi_prefix:
602 description:
603 - IMSI prefix for selective logging.
604 type: str
605 log_msisdn_prefix:
606 description:
607 - the msisdn prefix for selective logging
608 type: str
609 max_message_length:
610 description:
611 - max message length
612 type: int
613 message_filter_v0v1:
614 description:
615 - Message filter. Source gtp.message-filter-v0v1.name.
616 type: str
617 message_filter_v2:
618 description:
619 - Message filter. Source gtp.message-filter-v2.name.
620 type: str
621 message_rate_limit:
622 description:
623 - Message rate limiting.
624 type: dict
625 suboptions:
626 create_aa_pdp_request:
627 description:
628 - Rate limit for create AA PDP context request (packets per second).
629 type: int
630 create_aa_pdp_response:
631 description:
632 - Rate limit for create AA PDP context response (packets per second).
633 type: int
634 create_mbms_request:
635 description:
636 - Rate limit for create MBMS context request (packets per second).
637 type: int
638 create_mbms_response:
639 description:
640 - Rate limit for create MBMS context response (packets per second).
641 type: int
642 create_pdp_request:
643 description:
644 - Rate limit for create PDP context request (packets per second).
645 type: int
646 create_pdp_response:
647 description:
648 - Rate limit for create PDP context response (packets per second).
649 type: int
650 delete_aa_pdp_request:
651 description:
652 - Rate limit for delete AA PDP context request (packets per second).
653 type: int
654 delete_aa_pdp_response:
655 description:
656 - Rate limit for delete AA PDP context response (packets per second).
657 type: int
658 delete_mbms_request:
659 description:
660 - Rate limit for delete MBMS context request (packets per second).
661 type: int
662 delete_mbms_response:
663 description:
664 - Rate limit for delete MBMS context response (packets per second).
665 type: int
666 delete_pdp_request:
667 description:
668 - Rate limit for delete PDP context request (packets per second).
669 type: int
670 delete_pdp_response:
671 description:
672 - Rate limit for delete PDP context response (packets per second).
673 type: int
674 echo_reponse:
675 description:
676 - Rate limit for echo response (packets per second).
677 type: int
678 echo_request:
679 description:
680 - Rate limit for echo requests (packets per second).
681 type: int
682 echo_response:
683 description:
684 - Rate limit for echo response (packets per second).
685 type: int
686 error_indication:
687 description:
688 - Rate limit for error indication (packets per second).
689 type: int
690 failure_report_request:
691 description:
692 - Rate limit for failure report request (packets per second).
693 type: int
694 failure_report_response:
695 description:
696 - Rate limit for failure report response (packets per second).
697 type: int
698 fwd_reloc_complete_ack:
699 description:
700 - Rate limit for forward relocation complete acknowledge (packets per second).
701 type: int
702 fwd_relocation_complete:
703 description:
704 - Rate limit for forward relocation complete (packets per second).
705 type: int
706 fwd_relocation_request:
707 description:
708 - Rate limit for forward relocation request (packets per second).
709 type: int
710 fwd_relocation_response:
711 description:
712 - Rate limit for forward relocation response (packets per second).
713 type: int
714 fwd_srns_context:
715 description:
716 - Rate limit for forward SRNS context (packets per second).
717 type: int
718 fwd_srns_context_ack:
719 description:
720 - Rate limit for forward SRNS context acknowledge (packets per second).
721 type: int
722 g_pdu:
723 description:
724 - Rate limit for G-PDU (packets per second).
725 type: int
726 identification_request:
727 description:
728 - Rate limit for identification request (packets per second).
729 type: int
730 identification_response:
731 description:
732 - Rate limit for identification response (packets per second).
733 type: int
734 mbms_de_reg_request:
735 description:
736 - Rate limit for MBMS de-registration request (packets per second).
737 type: int
738 mbms_de_reg_response:
739 description:
740 - Rate limit for MBMS de-registration response (packets per second).
741 type: int
742 mbms_notify_rej_request:
743 description:
744 - Rate limit for MBMS notification reject request (packets per second).
745 type: int
746 mbms_notify_rej_response:
747 description:
748 - Rate limit for MBMS notification reject response (packets per second).
749 type: int
750 mbms_notify_request:
751 description:
752 - Rate limit for MBMS notification request (packets per second).
753 type: int
754 mbms_notify_response:
755 description:
756 - Rate limit for MBMS notification response (packets per second).
757 type: int
758 mbms_reg_request:
759 description:
760 - Rate limit for MBMS registration request (packets per second).
761 type: int
762 mbms_reg_response:
763 description:
764 - Rate limit for MBMS registration response (packets per second).
765 type: int
766 mbms_ses_start_request:
767 description:
768 - Rate limit for MBMS session start request (packets per second).
769 type: int
770 mbms_ses_start_response:
771 description:
772 - Rate limit for MBMS session start response (packets per second).
773 type: int
774 mbms_ses_stop_request:
775 description:
776 - Rate limit for MBMS session stop request (packets per second).
777 type: int
778 mbms_ses_stop_response:
779 description:
780 - Rate limit for MBMS session stop response (packets per second).
781 type: int
782 note_ms_request:
783 description:
784 - Rate limit for note MS GPRS present request (packets per second).
785 type: int
786 note_ms_response:
787 description:
788 - Rate limit for note MS GPRS present response (packets per second).
789 type: int
790 pdu_notify_rej_request:
791 description:
792 - Rate limit for PDU notify reject request (packets per second).
793 type: int
794 pdu_notify_rej_response:
795 description:
796 - Rate limit for PDU notify reject response (packets per second).
797 type: int
798 pdu_notify_request:
799 description:
800 - Rate limit for PDU notify request (packets per second).
801 type: int
802 pdu_notify_response:
803 description:
804 - Rate limit for PDU notify response (packets per second).
805 type: int
806 ran_info:
807 description:
808 - Rate limit for RAN information relay (packets per second).
809 type: int
810 relocation_cancel_request:
811 description:
812 - Rate limit for relocation cancel request (packets per second).
813 type: int
814 relocation_cancel_response:
815 description:
816 - Rate limit for relocation cancel response (packets per second).
817 type: int
818 send_route_request:
819 description:
820 - Rate limit for send routing information for GPRS request (packets per second).
821 type: int
822 send_route_response:
823 description:
824 - Rate limit for send routing information for GPRS response (packets per second).
825 type: int
826 sgsn_context_ack:
827 description:
828 - Rate limit for SGSN context acknowledgement (packets per second).
829 type: int
830 sgsn_context_request:
831 description:
832 - Rate limit for SGSN context request (packets per second).
833 type: int
834 sgsn_context_response:
835 description:
836 - Rate limit for SGSN context response (packets per second).
837 type: int
838 support_ext_hdr_notify:
839 description:
840 - Rate limit for support extension headers notification (packets per second).
841 type: int
842 update_mbms_request:
843 description:
844 - Rate limit for update MBMS context request (packets per second).
845 type: int
846 update_mbms_response:
847 description:
848 - Rate limit for update MBMS context response (packets per second).
849 type: int
850 update_pdp_request:
851 description:
852 - Rate limit for update PDP context request (packets per second).
853 type: int
854 update_pdp_response:
855 description:
856 - Rate limit for update PDP context response (packets per second).
857 type: int
858 version_not_support:
859 description:
860 - Rate limit for version not supported (packets per second).
861 type: int
862 message_rate_limit_v0:
863 description:
864 - Message rate limiting for GTP version 0.
865 type: dict
866 suboptions:
867 create_pdp_request:
868 description:
869 - Rate limit (packets/s) for create PDP context request.
870 type: int
871 delete_pdp_request:
872 description:
873 - Rate limit (packets/s) for delete PDP context request.
874 type: int
875 echo_request:
876 description:
877 - Rate limit (packets/s) for echo request.
878 type: int
879 message_rate_limit_v1:
880 description:
881 - Message rate limiting for GTP version 1.
882 type: dict
883 suboptions:
884 create_pdp_request:
885 description:
886 - Rate limit (packets/s) for create PDP context request.
887 type: int
888 delete_pdp_request:
889 description:
890 - Rate limit (packets/s) for delete PDP context request.
891 type: int
892 echo_request:
893 description:
894 - Rate limit (packets/s) for echo request.
895 type: int
896 message_rate_limit_v2:
897 description:
898 - Message rate limiting for GTP version 2.
899 type: dict
900 suboptions:
901 create_session_request:
902 description:
903 - Rate limit (packets/s) for create session request.
904 type: int
905 delete_session_request:
906 description:
907 - Rate limit (packets/s) for delete session request.
908 type: int
909 echo_request:
910 description:
911 - Rate limit (packets/s) for echo request.
912 type: int
913 min_message_length:
914 description:
915 - min message length
916 type: int
917 miss_must_ie:
918 description:
919 - Missing mandatory information element
920 type: str
921 choices:
922 - 'allow'
923 - 'deny'
924 monitor_mode:
925 description:
926 - GTP monitor mode.
927 type: str
928 choices:
929 - 'enable'
930 - 'disable'
931 - 'vdom'
932 name:
933 description:
934 - Profile name.
935 required: true
936 type: str
937 noip_filter:
938 description:
939 - non-IP filter for encapsulted traffic
940 type: str
941 choices:
942 - 'enable'
943 - 'disable'
944 noip_policy:
945 description:
946 - No IP policy.
947 type: list
948 elements: dict
949 suboptions:
950 action:
951 description:
952 - Action.
953 type: str
954 choices:
955 - 'allow'
956 - 'deny'
957 end:
958 description:
959 - End of protocol range (0 - 255).
960 type: int
961 id:
962 description:
963 - ID. see <a href='#notes'>Notes</a>.
964 required: true
965 type: int
966 start:
967 description:
968 - Start of protocol range (0 - 255).
969 type: int
970 type:
971 description:
972 - Protocol field type.
973 type: str
974 choices:
975 - 'etsi'
976 - 'ietf'
977 out_of_state_ie:
978 description:
979 - Out of state information element.
980 type: str
981 choices:
982 - 'allow'
983 - 'deny'
984 out_of_state_message:
985 description:
986 - Out of state GTP message
987 type: str
988 choices:
989 - 'allow'
990 - 'deny'
991 per_apn_shaper:
992 description:
993 - Per APN shaper.
994 type: list
995 elements: dict
996 suboptions:
997 apn:
998 description:
999 - APN name. Source gtp.apn.name.
1000 type: str
1001 id:
1002 description:
1003 - ID. see <a href='#notes'>Notes</a>.
1004 required: true
1005 type: int
1006 rate_limit:
1007 description:
1008 - Rate limit (packets/s) for create PDP context request.
1009 type: int
1010 version:
1011 description:
1012 - 'GTP version number: 0 or 1.'
1013 type: int
1014 policy:
1015 description:
1016 - Policy.
1017 type: list
1018 elements: dict
1019 suboptions:
1020 action:
1021 description:
1022 - Action.
1023 type: str
1024 choices:
1025 - 'allow'
1026 - 'deny'
1027 apn_sel_mode:
1028 description:
1029 - APN selection mode.
1030 type: list
1031 elements: str
1032 choices:
1033 - 'ms'
1034 - 'net'
1035 - 'vrf'
1036 apnmember:
1037 description:
1038 - APN member.
1039 type: list
1040 elements: dict
1041 suboptions:
1042 name:
1043 description:
1044 - APN name. Source gtp.apn.name gtp.apngrp.name.
1045 required: true
1046 type: str
1047 id:
1048 description:
1049 - ID. see <a href='#notes'>Notes</a>.
1050 required: true
1051 type: int
1052 imei:
1053 description:
1054 - IMEI pattern.
1055 type: str
1056 imsi:
1057 description:
1058 - IMSI prefix.
1059 type: str
1060 imsi_prefix:
1061 description:
1062 - IMSI prefix.
1063 type: str
1064 max_apn_restriction:
1065 description:
1066 - Maximum APN restriction value.
1067 type: str
1068 choices:
1069 - 'all'
1070 - 'public-1'
1071 - 'public-2'
1072 - 'private-1'
1073 - 'private-2'
1074 messages:
1075 description:
1076 - GTP messages.
1077 type: list
1078 elements: str
1079 choices:
1080 - 'create-req'
1081 - 'create-res'
1082 - 'update-req'
1083 - 'update-res'
1084 msisdn:
1085 description:
1086 - MSISDN prefix.
1087 type: str
1088 msisdn_prefix:
1089 description:
1090 - MSISDN prefix.
1091 type: str
1092 rai:
1093 description:
1094 - RAI pattern.
1095 type: str
1096 rat_type:
1097 description:
1098 - RAT Type.
1099 type: list
1100 elements: str
1101 choices:
1102 - 'any'
1103 - 'utran'
1104 - 'geran'
1105 - 'wlan'
1106 - 'gan'
1107 - 'hspa'
1108 - 'eutran'
1109 - 'virtual'
1110 - 'nbiot'
1111 uli:
1112 description:
1113 - ULI pattern.
1114 type: str
1115 policy_filter:
1116 description:
1117 - Advanced policy filter
1118 type: str
1119 choices:
1120 - 'enable'
1121 - 'disable'
1122 policy_v2:
1123 description:
1124 - Apply allow or deny action to each GTPv2-c packet.
1125 type: list
1126 elements: dict
1127 suboptions:
1128 action:
1129 description:
1130 - Action.
1131 type: str
1132 choices:
1133 - 'allow'
1134 - 'deny'
1135 apn_sel_mode:
1136 description:
1137 - APN selection mode.
1138 type: list
1139 elements: str
1140 choices:
1141 - 'ms'
1142 - 'net'
1143 - 'vrf'
1144 apnmember:
1145 description:
1146 - APN member.
1147 type: list
1148 elements: dict
1149 suboptions:
1150 name:
1151 description:
1152 - APN name. Source gtp.apn.name gtp.apngrp.name.
1153 required: true
1154 type: str
1155 id:
1156 description:
1157 - ID. see <a href='#notes'>Notes</a>.
1158 required: true
1159 type: int
1160 imsi_prefix:
1161 description:
1162 - IMSI prefix.
1163 type: str
1164 max_apn_restriction:
1165 description:
1166 - Maximum APN restriction value.
1167 type: str
1168 choices:
1169 - 'all'
1170 - 'public-1'
1171 - 'public-2'
1172 - 'private-1'
1173 - 'private-2'
1174 mei:
1175 description:
1176 - MEI pattern.
1177 type: str
1178 messages:
1179 description:
1180 - GTP messages.
1181 type: list
1182 elements: str
1183 choices:
1184 - 'create-ses-req'
1185 - 'create-ses-res'
1186 - 'modify-bearer-req'
1187 - 'modify-bearer-res'
1188 msisdn_prefix:
1189 description:
1190 - MSISDN prefix.
1191 type: str
1192 rat_type:
1193 description:
1194 - RAT Type.
1195 type: list
1196 elements: str
1197 choices:
1198 - 'any'
1199 - 'utran'
1200 - 'geran'
1201 - 'wlan'
1202 - 'gan'
1203 - 'hspa'
1204 - 'eutran'
1205 - 'virtual'
1206 - 'nbiot'
1207 - 'ltem'
1208 - 'nr'
1209 uli:
1210 description:
1211 - GTPv2 ULI patterns (in order of CGI SAI RAI TAI ECGI LAI).
1212 type: list
1213 elements: str
1214 port_notify:
1215 description:
1216 - overbilling notify port
1217 type: int
1218 rat_timeout_profile:
1219 description:
1220 - RAT timeout profile. Source gtp.rat-timeout-profile.name.
1221 type: str
1222 rate_limit_mode:
1223 description:
1224 - GTP rate limit mode.
1225 type: str
1226 choices:
1227 - 'per-profile'
1228 - 'per-stream'
1229 - 'per-apn'
1230 rate_limited_log:
1231 description:
1232 - log rate limited
1233 type: str
1234 choices:
1235 - 'enable'
1236 - 'disable'
1237 rate_sampling_interval:
1238 description:
1239 - rate sampling interval (1-3600 seconds)
1240 type: int
1241 remove_if_echo_expires:
1242 description:
1243 - remove if echo response expires
1244 type: str
1245 choices:
1246 - 'enable'
1247 - 'disable'
1248 remove_if_recovery_differ:
1249 description:
1250 - remove upon different Recovery IE
1251 type: str
1252 choices:
1253 - 'enable'
1254 - 'disable'
1255 reserved_ie:
1256 description:
1257 - reserved information element
1258 type: str
1259 choices:
1260 - 'allow'
1261 - 'deny'
1262 send_delete_when_timeout:
1263 description:
1264 - send DELETE request to path endpoints when GTPv0/v1 tunnel timeout.
1265 type: str
1266 choices:
1267 - 'enable'
1268 - 'disable'
1269 send_delete_when_timeout_v2:
1270 description:
1271 - send DELETE request to path endpoints when GTPv2 tunnel timeout.
1272 type: str
1273 choices:
1274 - 'enable'
1275 - 'disable'
1276 spoof_src_addr:
1277 description:
1278 - Spoofed source address for Mobile Station.
1279 type: str
1280 choices:
1281 - 'allow'
1282 - 'deny'
1283 state_invalid_log:
1284 description:
1285 - log state invalid
1286 type: str
1287 choices:
1288 - 'enable'
1289 - 'disable'
1290 sub_second_interval:
1291 description:
1292 - Sub-second interval (0.1, 0.25, or 0.5 sec).
1293 type: str
1294 choices:
1295 - '0.5'
1296 - '0.25'
1297 - '0.1'
1298 sub_second_sampling:
1299 description:
1300 - Enable/disable sub-second sampling.
1301 type: str
1302 choices:
1303 - 'enable'
1304 - 'disable'
1305 traffic_count_log:
1306 description:
1307 - log tunnel traffic counter
1308 type: str
1309 choices:
1310 - 'enable'
1311 - 'disable'
1312 tunnel_limit:
1313 description:
1314 - tunnel limit
1315 type: int
1316 tunnel_limit_log:
1317 description:
1318 - tunnel limit
1319 type: str
1320 choices:
1321 - 'enable'
1322 - 'disable'
1323 tunnel_timeout:
1324 description:
1325 - Established tunnel timeout (in seconds).
1326 type: int
1327 unknown_version_action:
1328 description:
1329 - action for unknown gtp version
1330 type: str
1331 choices:
1332 - 'allow'
1333 - 'deny'
1334 user_plane_message_rate_limit:
1335 description:
1336 - user plane message rate limit
1337 type: int
1338 warning_threshold:
1339 description:
1340 - Warning threshold for rate limiting (0 - 99 percent).
1341 type: int
1342 """
1343
1344 EXAMPLES = """
1345 - name: Configure GTP.
1346 fortinet.fortios.fortios_firewall_gtp:
1347 vdom: "{{ vdom }}"
1348 state: "present"
1349 access_token: "<your_own_value>"
1350 firewall_gtp:
1351 addr_notify: "<your_own_value>"
1352 apn:
1353 -
1354 action: "allow"
1355 apnmember:
1356 -
1357 name: "default_name_7 (source gtp.apn.name gtp.apngrp.name)"
1358 id: "8"
1359 selection_mode: "ms"
1360 apn_filter: "enable"
1361 authorized_ggsns: "<your_own_value> (source firewall.address.name firewall.addrgrp.name)"
1362 authorized_ggsns6: "<your_own_value> (source firewall.address6.name firewall.addrgrp6.name)"
1363 authorized_sgsns: "<your_own_value> (source firewall.address.name firewall.addrgrp.name)"
1364 authorized_sgsns6: "<your_own_value> (source firewall.address6.name firewall.addrgrp6.name)"
1365 comment: "Comment."
1366 context_id: "696"
1367 control_plane_message_rate_limit: "0"
1368 default_apn_action: "allow"
1369 default_imsi_action: "allow"
1370 default_ip_action: "allow"
1371 default_noip_action: "allow"
1372 default_policy_action: "allow"
1373 denied_log: "enable"
1374 echo_request_interval: "0"
1375 echo_requires_path_in_use: "enable"
1376 extension_log: "enable"
1377 forwarded_log: "enable"
1378 global_tunnel_limit: "<your_own_value> (source gtp.tunnel-limit.name)"
1379 gtp_in_gtp: "allow"
1380 gtpu_denied_log: "enable"
1381 gtpu_forwarded_log: "enable"
1382 gtpu_log_freq: "0"
1383 gtpv0: "allow"
1384 half_close_timeout: "10"
1385 half_open_timeout: "300"
1386 handover_group: "<your_own_value> (source firewall.address.name firewall.addrgrp.name)"
1387 handover_group6: "<your_own_value> (source firewall.address6.name firewall.addrgrp6.name)"
1388 ie_allow_list_v0v1: "<your_own_value> (source gtp.ie-allow-list.name)"
1389 ie_allow_list_v2: "<your_own_value> (source gtp.ie-allow-list.name)"
1390 ie_remove_policy:
1391 -
1392 id: "41"
1393 remove_ies: "apn-restriction"
1394 sgsn_addr: "<your_own_value> (source firewall.address.name firewall.addrgrp.name)"
1395 sgsn_addr6: "<your_own_value> (source firewall.address6.name firewall.addrgrp6.name)"
1396 ie_remover: "enable"
1397 ie_validation:
1398 apn_restriction: "enable"
1399 charging_gateway_addr: "enable"
1400 charging_ID: "enable"
1401 end_user_addr: "enable"
1402 gsn_addr: "enable"
1403 imei: "enable"
1404 imsi: "enable"
1405 mm_context: "enable"
1406 ms_tzone: "enable"
1407 ms_validated: "enable"
1408 msisdn: "enable"
1409 nsapi: "enable"
1410 pdp_context: "enable"
1411 qos_profile: "enable"
1412 rai: "enable"
1413 rat_type: "enable"
1414 reordering_required: "enable"
1415 selection_mode: "enable"
1416 uli: "enable"
1417 ie_white_list_v0v1: "<your_own_value> (source gtp.ie-white-list.name)"
1418 ie_white_list_v2: "<your_own_value> (source gtp.ie-white-list.name)"
1419 imsi:
1420 -
1421 action: "allow"
1422 apnmember:
1423 -
1424 name: "default_name_71 (source gtp.apn.name gtp.apngrp.name)"
1425 id: "72"
1426 mcc_mnc: "<your_own_value>"
1427 msisdn_prefix: "<your_own_value>"
1428 selection_mode: "ms"
1429 imsi_filter: "enable"
1430 interface_notify: "<your_own_value> (source system.interface.name)"
1431 invalid_reserved_field: "allow"
1432 invalid_sgsns_to_log: "<your_own_value> (source firewall.address.name firewall.addrgrp.name)"
1433 invalid_sgsns6_to_log: "<your_own_value> (source firewall.address6.name firewall.addrgrp6.name)"
1434 ip_filter: "enable"
1435 ip_policy:
1436 -
1437 action: "allow"
1438 dstaddr: "<your_own_value> (source firewall.address.name firewall.addrgrp.name)"
1439 dstaddr6: "<your_own_value> (source firewall.address6.name firewall.addrgrp6.name)"
1440 id: "86"
1441 srcaddr: "<your_own_value> (source firewall.address.name firewall.addrgrp.name)"
1442 srcaddr6: "<your_own_value> (source firewall.address6.name firewall.addrgrp6.name)"
1443 log_freq: "0"
1444 log_gtpu_limit: "0"
1445 log_imsi_prefix: "<your_own_value>"
1446 log_msisdn_prefix: "<your_own_value>"
1447 max_message_length: "1452"
1448 message_filter_v0v1: "<your_own_value> (source gtp.message-filter-v0v1.name)"
1449 message_filter_v2: "<your_own_value> (source gtp.message-filter-v2.name)"
1450 message_rate_limit:
1451 create_aa_pdp_request: "0"
1452 create_aa_pdp_response: "0"
1453 create_mbms_request: "0"
1454 create_mbms_response: "0"
1455 create_pdp_request: "0"
1456 create_pdp_response: "0"
1457 delete_aa_pdp_request: "0"
1458 delete_aa_pdp_response: "0"
1459 delete_mbms_request: "0"
1460 delete_mbms_response: "0"
1461 delete_pdp_request: "0"
1462 delete_pdp_response: "0"
1463 echo_reponse: "0"
1464 echo_request: "0"
1465 echo_response: "0"
1466 error_indication: "0"
1467 failure_report_request: "0"
1468 failure_report_response: "0"
1469 fwd_reloc_complete_ack: "0"
1470 fwd_relocation_complete: "0"
1471 fwd_relocation_request: "0"
1472 fwd_relocation_response: "0"
1473 fwd_srns_context: "0"
1474 fwd_srns_context_ack: "0"
1475 g_pdu: "0"
1476 identification_request: "0"
1477 identification_response: "0"
1478 mbms_de_reg_request: "0"
1479 mbms_de_reg_response: "0"
1480 mbms_notify_rej_request: "0"
1481 mbms_notify_rej_response: "0"
1482 mbms_notify_request: "0"
1483 mbms_notify_response: "0"
1484 mbms_reg_request: "0"
1485 mbms_reg_response: "0"
1486 mbms_ses_start_request: "0"
1487 mbms_ses_start_response: "0"
1488 mbms_ses_stop_request: "0"
1489 mbms_ses_stop_response: "0"
1490 note_ms_request: "0"
1491 note_ms_response: "0"
1492 pdu_notify_rej_request: "0"
1493 pdu_notify_rej_response: "0"
1494 pdu_notify_request: "0"
1495 pdu_notify_response: "0"
1496 ran_info: "0"
1497 relocation_cancel_request: "0"
1498 relocation_cancel_response: "0"
1499 send_route_request: "0"
1500 send_route_response: "0"
1501 sgsn_context_ack: "0"
1502 sgsn_context_request: "0"
1503 sgsn_context_response: "0"
1504 support_ext_hdr_notify: "0"
1505 update_mbms_request: "0"
1506 update_mbms_response: "0"
1507 update_pdp_request: "0"
1508 update_pdp_response: "0"
1509 version_not_support: "0"
1510 message_rate_limit_v0:
1511 create_pdp_request: "0"
1512 delete_pdp_request: "0"
1513 echo_request: "0"
1514 message_rate_limit_v1:
1515 create_pdp_request: "0"
1516 delete_pdp_request: "0"
1517 echo_request: "0"
1518 message_rate_limit_v2:
1519 create_session_request: "0"
1520 delete_session_request: "0"
1521 echo_request: "0"
1522 min_message_length: "0"
1523 miss_must_ie: "allow"
1524 monitor_mode: "enable"
1525 name: "default_name_171"
1526 noip_filter: "enable"
1527 noip_policy:
1528 -
1529 action: "allow"
1530 end: "0"
1531 id: "176"
1532 start: "0"
1533 type: "etsi"
1534 out_of_state_ie: "allow"
1535 out_of_state_message: "allow"
1536 per_apn_shaper:
1537 -
1538 apn: "<your_own_value> (source gtp.apn.name)"
1539 id: "183"
1540 rate_limit: "0"
1541 version: "1"
1542 policy:
1543 -
1544 action: "allow"
1545 apn_sel_mode: "ms"
1546 apnmember:
1547 -
1548 name: "default_name_190 (source gtp.apn.name gtp.apngrp.name)"
1549 id: "191"
1550 imei: "<your_own_value>"
1551 imsi: "<your_own_value>"
1552 imsi_prefix: "<your_own_value>"
1553 max_apn_restriction: "all"
1554 messages: "create-req"
1555 msisdn: "<your_own_value>"
1556 msisdn_prefix: "<your_own_value>"
1557 rai: "<your_own_value>"
1558 rat_type: "any"
1559 uli: "<your_own_value>"
1560 policy_filter: "enable"
1561 policy_v2:
1562 -
1563 action: "allow"
1564 apn_sel_mode: "ms"
1565 apnmember:
1566 -
1567 name: "default_name_207 (source gtp.apn.name gtp.apngrp.name)"
1568 id: "208"
1569 imsi_prefix: "<your_own_value>"
1570 max_apn_restriction: "all"
1571 mei: "<your_own_value>"
1572 messages: "create-ses-req"
1573 msisdn_prefix: "<your_own_value>"
1574 rat_type: "any"
1575 uli: "<your_own_value>"
1576 port_notify: "21123"
1577 rat_timeout_profile: "<your_own_value> (source gtp.rat-timeout-profile.name)"
1578 rate_limit_mode: "per-profile"
1579 rate_limited_log: "enable"
1580 rate_sampling_interval: "1"
1581 remove_if_echo_expires: "enable"
1582 remove_if_recovery_differ: "enable"
1583 reserved_ie: "allow"
1584 send_delete_when_timeout: "enable"
1585 send_delete_when_timeout_v2: "enable"
1586 spoof_src_addr: "allow"
1587 state_invalid_log: "enable"
1588 sub_second_interval: "0.5"
1589 sub_second_sampling: "enable"
1590 traffic_count_log: "enable"
1591 tunnel_limit: "0"
1592 tunnel_limit_log: "enable"
1593 tunnel_timeout: "86400"
1594 unknown_version_action: "allow"
1595 user_plane_message_rate_limit: "0"
1596 warning_threshold: "0"
1597 """
1598
1599 RETURN = """
1600 build:
1601 description: Build number of the fortigate image
1602 returned: always
1603 type: str
1604 sample: '1547'
1605 http_method:
1606 description: Last method used to provision the content into FortiGate
1607 returned: always
1608 type: str
1609 sample: 'PUT'
1610 http_status:
1611 description: Last result given by FortiGate on last operation applied
1612 returned: always
1613 type: str
1614 sample: "200"
1615 mkey:
1616 description: Master key (id) used in the last call to FortiGate
1617 returned: success
1618 type: str
1619 sample: "id"
1620 name:
1621 description: Name of the table used to fulfill the request
1622 returned: always
1623 type: str
1624 sample: "urlfilter"
1625 path:
1626 description: Path of the table used to fulfill the request
1627 returned: always
1628 type: str
1629 sample: "webfilter"
1630 revision:
1631 description: Internal revision number
1632 returned: always
1633 type: str
1634 sample: "17.0.2.10658"
1635 serial:
1636 description: Serial number of the unit
1637 returned: always
1638 type: str
1639 sample: "FGVMEVYYQT3AB5352"
1640 status:
1641 description: Indication of the operation's result
1642 returned: always
1643 type: str
1644 sample: "success"
1645 vdom:
1646 description: Virtual domain used
1647 returned: always
1648 type: str
1649 sample: "root"
1650 version:
1651 description: Version of the FortiGate
1652 returned: always
1653 type: str
1654 sample: "v5.6.3"
1655 """
1656 from ansible.module_utils.basic import AnsibleModule
1657 from ansible.module_utils.connection import Connection
1658 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1659 FortiOSHandler,
1660 )
1661 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1662 check_legacy_fortiosapi,
1663 )
1664 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1665 schema_to_module_spec,
1666 )
1667 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1668 check_schema_versioning,
1669 )
1670 from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.common import (
1671 FAIL_SOCKET_MSG,
1672 )
1673 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.data_post_processor import (
1674 remove_invalid_fields,
1675 )
1676 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1677 is_same_comparison,
1678 )
1679 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1680 serialize,
1681 )
1682 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1683 find_current_values,
1684 )
1685 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1686 unify_data_format,
1687 )
1688
1689
1690 def filter_firewall_gtp_data(json):
1691 option_list = [
1692 "addr_notify",
1693 "apn",
1694 "apn_filter",
1695 "authorized_ggsns",
1696 "authorized_ggsns6",
1697 "authorized_sgsns",
1698 "authorized_sgsns6",
1699 "comment",
1700 "context_id",
1701 "control_plane_message_rate_limit",
1702 "default_apn_action",
1703 "default_imsi_action",
1704 "default_ip_action",
1705 "default_noip_action",
1706 "default_policy_action",
1707 "denied_log",
1708 "echo_request_interval",
1709 "echo_requires_path_in_use",
1710 "extension_log",
1711 "forwarded_log",
1712 "global_tunnel_limit",
1713 "gtp_in_gtp",
1714 "gtpu_denied_log",
1715 "gtpu_forwarded_log",
1716 "gtpu_log_freq",
1717 "gtpv0",
1718 "half_close_timeout",
1719 "half_open_timeout",
1720 "handover_group",
1721 "handover_group6",
1722 "ie_allow_list_v0v1",
1723 "ie_allow_list_v2",
1724 "ie_remove_policy",
1725 "ie_remover",
1726 "ie_validation",
1727 "ie_white_list_v0v1",
1728 "ie_white_list_v2",
1729 "imsi",
1730 "imsi_filter",
1731 "interface_notify",
1732 "invalid_reserved_field",
1733 "invalid_sgsns_to_log",
1734 "invalid_sgsns6_to_log",
1735 "ip_filter",
1736 "ip_policy",
1737 "log_freq",
1738 "log_gtpu_limit",
1739 "log_imsi_prefix",
1740 "log_msisdn_prefix",
1741 "max_message_length",
1742 "message_filter_v0v1",
1743 "message_filter_v2",
1744 "message_rate_limit",
1745 "message_rate_limit_v0",
1746 "message_rate_limit_v1",
1747 "message_rate_limit_v2",
1748 "min_message_length",
1749 "miss_must_ie",
1750 "monitor_mode",
1751 "name",
1752 "noip_filter",
1753 "noip_policy",
1754 "out_of_state_ie",
1755 "out_of_state_message",
1756 "per_apn_shaper",
1757 "policy",
1758 "policy_filter",
1759 "policy_v2",
1760 "port_notify",
1761 "rat_timeout_profile",
1762 "rate_limit_mode",
1763 "rate_limited_log",
1764 "rate_sampling_interval",
1765 "remove_if_echo_expires",
1766 "remove_if_recovery_differ",
1767 "reserved_ie",
1768 "send_delete_when_timeout",
1769 "send_delete_when_timeout_v2",
1770 "spoof_src_addr",
1771 "state_invalid_log",
1772 "sub_second_interval",
1773 "sub_second_sampling",
1774 "traffic_count_log",
1775 "tunnel_limit",
1776 "tunnel_limit_log",
1777 "tunnel_timeout",
1778 "unknown_version_action",
1779 "user_plane_message_rate_limit",
1780 "warning_threshold",
1781 ]
1782
1783 json = remove_invalid_fields(json)
1784 dictionary = {}
1785
1786 for attribute in option_list:
1787 if attribute in json and json[attribute] is not None:
1788 dictionary[attribute] = json[attribute]
1789
1790 return dictionary
1791
1792
1793 def flatten_single_path(data, path, index):
1794 if (
1795 not data
1796 or index == len(path)
1797 or path[index] not in data
1798 or (not data[path[index]] and not isinstance(data[path[index]], list))
1799 ):
1800 return
1801
1802 if index == len(path) - 1:
1803 data[path[index]] = " ".join(str(elem) for elem in data[path[index]])
1804 if len(data[path[index]]) == 0:
1805 data[path[index]] = None
1806 elif isinstance(data[path[index]], list):
1807 for value in data[path[index]]:
1808 flatten_single_path(value, path, index + 1)
1809 else:
1810 flatten_single_path(data[path[index]], path, index + 1)
1811
1812
1813 def flatten_multilists_attributes(data):
1814 multilist_attrs = [
1815 ["apn", "selection_mode"],
1816 ["imsi", "selection_mode"],
1817 ["policy", "messages"],
1818 ["policy", "apn_sel_mode"],
1819 ["policy", "rat_type"],
1820 ["policy_v2", "messages"],
1821 ["policy_v2", "apn_sel_mode"],
1822 ["policy_v2", "rat_type"],
1823 ["policy_v2", "uli"],
1824 ["ie_remove_policy", "remove_ies"],
1825 ]
1826
1827 for attr in multilist_attrs:
1828 flatten_single_path(data, attr, 0)
1829
1830 return data
1831
1832
1833 def underscore_to_hyphen(data):
1834 new_data = None
1835 if isinstance(data, list):
1836 new_data = []
1837 for i, elem in enumerate(data):
1838 new_data.append(underscore_to_hyphen(elem))
1839 elif isinstance(data, dict):
1840 new_data = {}
1841 for k, v in data.items():
1842 new_data[k.replace("_", "-")] = underscore_to_hyphen(v)
1843 else:
1844 return data
1845 return new_data
1846
1847
1848 def firewall_gtp(data, fos, check_mode=False):
1849
1850 state = None
1851 vdom = data["vdom"]
1852 parameters = None
1853 state = data.get("state", None)
1854 firewall_gtp_data = data["firewall_gtp"]
1855
1856 filtered_data = filter_firewall_gtp_data(firewall_gtp_data)
1857 filtered_data = flatten_multilists_attributes(filtered_data)
1858 converted_data = underscore_to_hyphen(filtered_data)
1859
1860 # check_mode starts from here
1861 if check_mode:
1862 diff = {
1863 "before": "",
1864 "after": filtered_data,
1865 }
1866 mkeyname = fos.get_mkeyname(None, None)
1867 mkey = fos.get_mkey("firewall", "gtp", filtered_data, vdom=vdom)
1868 current_data = fos.get(
1869 "firewall", "gtp", vdom=vdom, mkey=mkey, parameters=parameters
1870 )
1871 is_existed = (
1872 current_data
1873 and current_data.get("http_status") == 200
1874 and (
1875 mkeyname
1876 and isinstance(current_data.get("results"), list)
1877 and len(current_data["results"]) > 0
1878 or not mkeyname
1879 and current_data["results"] # global object response
1880 )
1881 )
1882
1883 # 2. if it exists and the state is 'present' then compare current settings with desired
1884 if state == "present" or state is True or state is None:
1885 # for non global modules, mkeyname must exist and it's a new module when mkey is None
1886 if mkeyname is not None and mkey is None:
1887 return False, True, filtered_data, diff
1888
1889 # if mkey exists then compare each other
1890 # record exits and they're matched or not
1891 copied_filtered_data = filtered_data.copy()
1892 copied_filtered_data.pop(mkeyname, None)
1893 unified_filtered_data = unify_data_format(copied_filtered_data)
1894
1895 current_data_results = current_data.get("results", {})
1896 current_config = (
1897 current_data_results[0]
1898 if mkeyname
1899 and isinstance(current_data_results, list)
1900 and len(current_data_results) > 0
1901 else current_data_results
1902 )
1903 if is_existed:
1904 unified_current_values = find_current_values(
1905 unified_filtered_data,
1906 unify_data_format(current_config),
1907 )
1908
1909 is_same = is_same_comparison(
1910 serialize(unified_current_values), serialize(unified_filtered_data)
1911 )
1912
1913 return (
1914 False,
1915 not is_same,
1916 filtered_data,
1917 {"before": unified_current_values, "after": unified_filtered_data},
1918 )
1919
1920 # record does not exist
1921 return False, True, filtered_data, diff
1922
1923 if state == "absent":
1924 if mkey is None:
1925 return (
1926 False,
1927 False,
1928 filtered_data,
1929 {"before": current_data["results"][0], "after": ""},
1930 )
1931
1932 if is_existed:
1933 return (
1934 False,
1935 True,
1936 filtered_data,
1937 {"before": current_data["results"][0], "after": ""},
1938 )
1939 return False, False, filtered_data, {}
1940
1941 return True, False, {"reason: ": "Must provide state parameter"}, {}
1942 # pass post processed data to member operations
1943 # no need to do underscore_to_hyphen since do_member_operation handles it by itself
1944 data_copy = data.copy()
1945 data_copy["firewall_gtp"] = filtered_data
1946 fos.do_member_operation(
1947 "firewall",
1948 "gtp",
1949 data_copy,
1950 )
1951
1952 if state == "present" or state is True:
1953 return fos.set(
1954 "firewall", "gtp", data=converted_data, vdom=vdom, parameters=parameters
1955 )
1956
1957 elif state == "absent":
1958 return fos.delete(
1959 "firewall",
1960 "gtp",
1961 mkey=converted_data["name"],
1962 vdom=vdom,
1963 parameters=parameters,
1964 )
1965 else:
1966 fos._module.fail_json(msg="state must be present or absent!")
1967
1968
1969 def is_successful_status(resp):
1970 return (
1971 "status" in resp
1972 and resp["status"] == "success"
1973 or "http_status" in resp
1974 and resp["http_status"] == 200
1975 or "http_method" in resp
1976 and resp["http_method"] == "DELETE"
1977 and resp["http_status"] == 404
1978 )
1979
1980
1981 def fortios_firewall(data, fos, check_mode):
1982
1983 if data["firewall_gtp"]:
1984 resp = firewall_gtp(data, fos, check_mode)
1985 else:
1986 fos._module.fail_json(msg="missing task body: %s" % ("firewall_gtp"))
1987 if isinstance(resp, tuple) and len(resp) == 4:
1988 return resp
1989 return (
1990 not is_successful_status(resp),
1991 is_successful_status(resp)
1992 and (resp["revision_changed"] if "revision_changed" in resp else True),
1993 resp,
1994 {},
1995 )
1996
1997
1998 versioned_schema = {
1999 "type": "list",
2000 "elements": "dict",
2001 "children": {
2002 "name": {
2003 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2004 "type": "string",
2005 "required": True,
2006 },
2007 "comment": {
2008 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2009 "type": "string",
2010 },
2011 "remove_if_echo_expires": {
2012 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2013 "type": "string",
2014 "options": [{"value": "enable"}, {"value": "disable"}],
2015 },
2016 "remove_if_recovery_differ": {
2017 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2018 "type": "string",
2019 "options": [{"value": "enable"}, {"value": "disable"}],
2020 },
2021 "send_delete_when_timeout": {
2022 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2023 "type": "string",
2024 "options": [{"value": "enable"}, {"value": "disable"}],
2025 },
2026 "send_delete_when_timeout_v2": {
2027 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2028 "type": "string",
2029 "options": [{"value": "enable"}, {"value": "disable"}],
2030 },
2031 "gtp_in_gtp": {
2032 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2033 "type": "string",
2034 "options": [{"value": "allow"}, {"value": "deny"}],
2035 },
2036 "unknown_version_action": {
2037 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2038 "type": "string",
2039 "options": [{"value": "allow"}, {"value": "deny"}],
2040 },
2041 "gtpv0": {
2042 "v_range": [["v7.6.0", ""]],
2043 "type": "string",
2044 "options": [{"value": "allow"}, {"value": "deny"}],
2045 },
2046 "min_message_length": {
2047 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2048 "type": "integer",
2049 },
2050 "max_message_length": {
2051 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2052 "type": "integer",
2053 },
2054 "control_plane_message_rate_limit": {
2055 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2056 "type": "integer",
2057 },
2058 "sub_second_sampling": {
2059 "v_range": [["v6.2.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2060 "type": "string",
2061 "options": [{"value": "enable"}, {"value": "disable"}],
2062 },
2063 "rate_sampling_interval": {
2064 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2065 "type": "integer",
2066 },
2067 "sub_second_interval": {
2068 "v_range": [["v6.2.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2069 "type": "string",
2070 "options": [{"value": "0.5"}, {"value": "0.25"}, {"value": "0.1"}],
2071 },
2072 "echo_request_interval": {
2073 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2074 "type": "integer",
2075 },
2076 "user_plane_message_rate_limit": {
2077 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2078 "type": "integer",
2079 },
2080 "tunnel_limit": {
2081 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2082 "type": "integer",
2083 },
2084 "global_tunnel_limit": {
2085 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2086 "type": "string",
2087 },
2088 "tunnel_timeout": {
2089 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2090 "type": "integer",
2091 },
2092 "half_open_timeout": {
2093 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2094 "type": "integer",
2095 },
2096 "half_close_timeout": {
2097 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2098 "type": "integer",
2099 },
2100 "default_apn_action": {
2101 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2102 "type": "string",
2103 "options": [{"value": "allow"}, {"value": "deny"}],
2104 },
2105 "default_imsi_action": {
2106 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2107 "type": "string",
2108 "options": [{"value": "allow"}, {"value": "deny"}],
2109 },
2110 "default_policy_action": {
2111 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2112 "type": "string",
2113 "options": [{"value": "allow"}, {"value": "deny"}],
2114 },
2115 "default_ip_action": {
2116 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2117 "type": "string",
2118 "options": [{"value": "allow"}, {"value": "deny"}],
2119 },
2120 "default_noip_action": {
2121 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2122 "type": "string",
2123 "options": [{"value": "allow"}, {"value": "deny"}],
2124 },
2125 "apn_filter": {
2126 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2127 "type": "string",
2128 "options": [{"value": "enable"}, {"value": "disable"}],
2129 },
2130 "imsi_filter": {
2131 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2132 "type": "string",
2133 "options": [{"value": "enable"}, {"value": "disable"}],
2134 },
2135 "policy_filter": {
2136 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2137 "type": "string",
2138 "options": [{"value": "enable"}, {"value": "disable"}],
2139 },
2140 "ie_remover": {
2141 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2142 "type": "string",
2143 "options": [{"value": "enable"}, {"value": "disable"}],
2144 },
2145 "ip_filter": {
2146 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2147 "type": "string",
2148 "options": [{"value": "enable"}, {"value": "disable"}],
2149 },
2150 "noip_filter": {
2151 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2152 "type": "string",
2153 "options": [{"value": "enable"}, {"value": "disable"}],
2154 },
2155 "echo_requires_path_in_use": {
2156 "v_range": [["v7.6.3", ""]],
2157 "type": "string",
2158 "options": [{"value": "enable"}, {"value": "disable"}],
2159 },
2160 "monitor_mode": {
2161 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2162 "type": "string",
2163 "options": [
2164 {"value": "enable"},
2165 {"value": "disable"},
2166 {
2167 "value": "vdom",
2168 "v_range": [
2169 ["v6.2.0", "v7.0.8"],
2170 ["v7.2.0", "v7.2.4"],
2171 ["v7.4.3", ""],
2172 ],
2173 },
2174 ],
2175 },
2176 "forwarded_log": {
2177 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2178 "type": "string",
2179 "options": [{"value": "enable"}, {"value": "disable"}],
2180 },
2181 "denied_log": {
2182 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2183 "type": "string",
2184 "options": [{"value": "enable"}, {"value": "disable"}],
2185 },
2186 "rate_limited_log": {
2187 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2188 "type": "string",
2189 "options": [{"value": "enable"}, {"value": "disable"}],
2190 },
2191 "state_invalid_log": {
2192 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2193 "type": "string",
2194 "options": [{"value": "enable"}, {"value": "disable"}],
2195 },
2196 "tunnel_limit_log": {
2197 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2198 "type": "string",
2199 "options": [{"value": "enable"}, {"value": "disable"}],
2200 },
2201 "extension_log": {
2202 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2203 "type": "string",
2204 "options": [{"value": "enable"}, {"value": "disable"}],
2205 },
2206 "traffic_count_log": {
2207 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2208 "type": "string",
2209 "options": [{"value": "enable"}, {"value": "disable"}],
2210 },
2211 "log_freq": {
2212 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2213 "type": "integer",
2214 },
2215 "gtpu_forwarded_log": {
2216 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2217 "type": "string",
2218 "options": [{"value": "enable"}, {"value": "disable"}],
2219 },
2220 "gtpu_denied_log": {
2221 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2222 "type": "string",
2223 "options": [{"value": "enable"}, {"value": "disable"}],
2224 },
2225 "gtpu_log_freq": {
2226 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2227 "type": "integer",
2228 },
2229 "log_gtpu_limit": {
2230 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2231 "type": "integer",
2232 },
2233 "log_imsi_prefix": {
2234 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2235 "type": "string",
2236 },
2237 "log_msisdn_prefix": {
2238 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2239 "type": "string",
2240 },
2241 "invalid_reserved_field": {
2242 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2243 "type": "string",
2244 "options": [{"value": "allow"}, {"value": "deny"}],
2245 },
2246 "reserved_ie": {
2247 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2248 "type": "string",
2249 "options": [{"value": "allow"}, {"value": "deny"}],
2250 },
2251 "miss_must_ie": {
2252 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2253 "type": "string",
2254 "options": [{"value": "allow"}, {"value": "deny"}],
2255 },
2256 "out_of_state_message": {
2257 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2258 "type": "string",
2259 "options": [{"value": "allow"}, {"value": "deny"}],
2260 },
2261 "out_of_state_ie": {
2262 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2263 "type": "string",
2264 "options": [{"value": "allow"}, {"value": "deny"}],
2265 },
2266 "spoof_src_addr": {
2267 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2268 "type": "string",
2269 "options": [{"value": "allow"}, {"value": "deny"}],
2270 },
2271 "handover_group": {
2272 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2273 "type": "string",
2274 },
2275 "handover_group6": {
2276 "v_range": [
2277 ["v6.4.0", "v6.4.0"],
2278 ["v6.4.4", "v7.0.8"],
2279 ["v7.2.0", "v7.2.4"],
2280 ["v7.4.3", ""],
2281 ],
2282 "type": "string",
2283 },
2284 "authorized_sgsns": {
2285 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2286 "type": "string",
2287 },
2288 "authorized_sgsns6": {
2289 "v_range": [
2290 ["v6.4.0", "v6.4.0"],
2291 ["v6.4.4", "v7.0.8"],
2292 ["v7.2.0", "v7.2.4"],
2293 ["v7.4.3", ""],
2294 ],
2295 "type": "string",
2296 },
2297 "invalid_sgsns_to_log": {
2298 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2299 "type": "string",
2300 },
2301 "invalid_sgsns6_to_log": {
2302 "v_range": [
2303 ["v6.4.0", "v6.4.0"],
2304 ["v6.4.4", "v7.0.8"],
2305 ["v7.2.0", "v7.2.4"],
2306 ["v7.4.3", ""],
2307 ],
2308 "type": "string",
2309 },
2310 "authorized_ggsns": {
2311 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2312 "type": "string",
2313 },
2314 "authorized_ggsns6": {
2315 "v_range": [
2316 ["v6.4.0", "v6.4.0"],
2317 ["v6.4.4", "v7.0.8"],
2318 ["v7.2.0", "v7.2.4"],
2319 ["v7.4.3", ""],
2320 ],
2321 "type": "string",
2322 },
2323 "apn": {
2324 "type": "list",
2325 "elements": "dict",
2326 "children": {
2327 "id": {
2328 "v_range": [
2329 ["v6.0.0", "v7.0.8"],
2330 ["v7.2.0", "v7.2.4"],
2331 ["v7.4.3", ""],
2332 ],
2333 "type": "integer",
2334 "required": True,
2335 },
2336 "apnmember": {
2337 "type": "list",
2338 "elements": "dict",
2339 "children": {
2340 "name": {
2341 "v_range": [
2342 ["v6.0.0", "v7.0.8"],
2343 ["v7.2.0", "v7.2.4"],
2344 ["v7.4.3", ""],
2345 ],
2346 "type": "string",
2347 "required": True,
2348 }
2349 },
2350 "v_range": [
2351 ["v6.0.0", "v7.0.8"],
2352 ["v7.2.0", "v7.2.4"],
2353 ["v7.4.3", ""],
2354 ],
2355 },
2356 "action": {
2357 "v_range": [
2358 ["v6.0.0", "v7.0.8"],
2359 ["v7.2.0", "v7.2.4"],
2360 ["v7.4.3", ""],
2361 ],
2362 "type": "string",
2363 "options": [{"value": "allow"}, {"value": "deny"}],
2364 },
2365 "selection_mode": {
2366 "v_range": [
2367 ["v6.0.0", "v7.0.8"],
2368 ["v7.2.0", "v7.2.4"],
2369 ["v7.4.3", ""],
2370 ],
2371 "type": "list",
2372 "options": [{"value": "ms"}, {"value": "net"}, {"value": "vrf"}],
2373 "multiple_values": True,
2374 "elements": "str",
2375 },
2376 },
2377 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2378 },
2379 "imsi": {
2380 "type": "list",
2381 "elements": "dict",
2382 "children": {
2383 "id": {
2384 "v_range": [
2385 ["v6.0.0", "v7.0.8"],
2386 ["v7.2.0", "v7.2.4"],
2387 ["v7.4.3", ""],
2388 ],
2389 "type": "integer",
2390 "required": True,
2391 },
2392 "mcc_mnc": {
2393 "v_range": [
2394 ["v6.0.0", "v7.0.8"],
2395 ["v7.2.0", "v7.2.4"],
2396 ["v7.4.3", ""],
2397 ],
2398 "type": "string",
2399 },
2400 "msisdn_prefix": {
2401 "v_range": [
2402 ["v6.0.0", "v7.0.8"],
2403 ["v7.2.0", "v7.2.4"],
2404 ["v7.4.3", ""],
2405 ],
2406 "type": "string",
2407 },
2408 "apnmember": {
2409 "type": "list",
2410 "elements": "dict",
2411 "children": {
2412 "name": {
2413 "v_range": [
2414 ["v6.0.0", "v7.0.8"],
2415 ["v7.2.0", "v7.2.4"],
2416 ["v7.4.3", ""],
2417 ],
2418 "type": "string",
2419 "required": True,
2420 }
2421 },
2422 "v_range": [
2423 ["v6.0.0", "v7.0.8"],
2424 ["v7.2.0", "v7.2.4"],
2425 ["v7.4.3", ""],
2426 ],
2427 },
2428 "action": {
2429 "v_range": [
2430 ["v6.0.0", "v7.0.8"],
2431 ["v7.2.0", "v7.2.4"],
2432 ["v7.4.3", ""],
2433 ],
2434 "type": "string",
2435 "options": [{"value": "allow"}, {"value": "deny"}],
2436 },
2437 "selection_mode": {
2438 "v_range": [
2439 ["v6.0.0", "v7.0.8"],
2440 ["v7.2.0", "v7.2.4"],
2441 ["v7.4.3", ""],
2442 ],
2443 "type": "list",
2444 "options": [{"value": "ms"}, {"value": "net"}, {"value": "vrf"}],
2445 "multiple_values": True,
2446 "elements": "str",
2447 },
2448 },
2449 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2450 },
2451 "policy": {
2452 "type": "list",
2453 "elements": "dict",
2454 "children": {
2455 "id": {
2456 "v_range": [
2457 ["v6.0.0", "v7.0.8"],
2458 ["v7.2.0", "v7.2.4"],
2459 ["v7.4.3", ""],
2460 ],
2461 "type": "integer",
2462 "required": True,
2463 },
2464 "apnmember": {
2465 "type": "list",
2466 "elements": "dict",
2467 "children": {
2468 "name": {
2469 "v_range": [
2470 ["v6.0.0", "v7.0.8"],
2471 ["v7.2.0", "v7.2.4"],
2472 ["v7.4.3", ""],
2473 ],
2474 "type": "string",
2475 "required": True,
2476 }
2477 },
2478 "v_range": [
2479 ["v6.0.0", "v7.0.8"],
2480 ["v7.2.0", "v7.2.4"],
2481 ["v7.4.3", ""],
2482 ],
2483 },
2484 "messages": {
2485 "v_range": [
2486 ["v6.0.0", "v7.0.8"],
2487 ["v7.2.0", "v7.2.4"],
2488 ["v7.4.3", ""],
2489 ],
2490 "type": "list",
2491 "options": [
2492 {"value": "create-req"},
2493 {"value": "create-res"},
2494 {"value": "update-req"},
2495 {"value": "update-res"},
2496 ],
2497 "multiple_values": True,
2498 "elements": "str",
2499 },
2500 "apn_sel_mode": {
2501 "v_range": [
2502 ["v6.0.0", "v7.0.8"],
2503 ["v7.2.0", "v7.2.4"],
2504 ["v7.4.3", ""],
2505 ],
2506 "type": "list",
2507 "options": [{"value": "ms"}, {"value": "net"}, {"value": "vrf"}],
2508 "multiple_values": True,
2509 "elements": "str",
2510 },
2511 "max_apn_restriction": {
2512 "v_range": [
2513 ["v6.0.0", "v7.0.8"],
2514 ["v7.2.0", "v7.2.4"],
2515 ["v7.4.3", ""],
2516 ],
2517 "type": "string",
2518 "options": [
2519 {"value": "all"},
2520 {"value": "public-1"},
2521 {"value": "public-2"},
2522 {"value": "private-1"},
2523 {"value": "private-2"},
2524 ],
2525 },
2526 "imsi_prefix": {
2527 "v_range": [
2528 ["v6.2.0", "v7.0.8"],
2529 ["v7.2.0", "v7.2.4"],
2530 ["v7.4.3", ""],
2531 ],
2532 "type": "string",
2533 },
2534 "msisdn_prefix": {
2535 "v_range": [
2536 ["v6.2.0", "v7.0.8"],
2537 ["v7.2.0", "v7.2.4"],
2538 ["v7.4.3", ""],
2539 ],
2540 "type": "string",
2541 },
2542 "rat_type": {
2543 "v_range": [
2544 ["v6.0.0", "v7.0.8"],
2545 ["v7.2.0", "v7.2.4"],
2546 ["v7.4.3", ""],
2547 ],
2548 "type": "list",
2549 "options": [
2550 {"value": "any"},
2551 {"value": "utran"},
2552 {"value": "geran"},
2553 {"value": "wlan"},
2554 {"value": "gan"},
2555 {"value": "hspa"},
2556 {
2557 "value": "eutran",
2558 "v_range": [
2559 ["v6.2.0", "v7.0.8"],
2560 ["v7.2.0", "v7.2.4"],
2561 ["v7.4.3", ""],
2562 ],
2563 },
2564 {
2565 "value": "virtual",
2566 "v_range": [
2567 ["v6.2.0", "v7.0.8"],
2568 ["v7.2.0", "v7.2.4"],
2569 ["v7.4.3", ""],
2570 ],
2571 },
2572 {
2573 "value": "nbiot",
2574 "v_range": [
2575 ["v6.2.0", "v7.0.8"],
2576 ["v7.2.0", "v7.2.4"],
2577 ["v7.4.3", ""],
2578 ],
2579 },
2580 ],
2581 "multiple_values": True,
2582 "elements": "str",
2583 },
2584 "imei": {
2585 "v_range": [
2586 ["v6.0.0", "v7.0.8"],
2587 ["v7.2.0", "v7.2.4"],
2588 ["v7.4.3", ""],
2589 ],
2590 "type": "string",
2591 },
2592 "action": {
2593 "v_range": [
2594 ["v6.0.0", "v7.0.8"],
2595 ["v7.2.0", "v7.2.4"],
2596 ["v7.4.3", ""],
2597 ],
2598 "type": "string",
2599 "options": [{"value": "allow"}, {"value": "deny"}],
2600 },
2601 "rai": {
2602 "v_range": [
2603 ["v6.0.0", "v7.0.8"],
2604 ["v7.2.0", "v7.2.4"],
2605 ["v7.4.3", ""],
2606 ],
2607 "type": "string",
2608 },
2609 "uli": {
2610 "v_range": [
2611 ["v6.0.0", "v7.0.8"],
2612 ["v7.2.0", "v7.2.4"],
2613 ["v7.4.3", ""],
2614 ],
2615 "type": "string",
2616 },
2617 "imsi": {"v_range": [["v6.0.0", "v6.0.11"]], "type": "string"},
2618 "msisdn": {"v_range": [["v6.0.0", "v6.0.11"]], "type": "string"},
2619 },
2620 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2621 },
2622 "policy_v2": {
2623 "type": "list",
2624 "elements": "dict",
2625 "children": {
2626 "id": {
2627 "v_range": [
2628 ["v6.2.0", "v7.0.8"],
2629 ["v7.2.0", "v7.2.4"],
2630 ["v7.4.3", ""],
2631 ],
2632 "type": "integer",
2633 "required": True,
2634 },
2635 "apnmember": {
2636 "type": "list",
2637 "elements": "dict",
2638 "children": {
2639 "name": {
2640 "v_range": [
2641 ["v6.2.0", "v7.0.8"],
2642 ["v7.2.0", "v7.2.4"],
2643 ["v7.4.3", ""],
2644 ],
2645 "type": "string",
2646 "required": True,
2647 }
2648 },
2649 "v_range": [
2650 ["v6.2.0", "v7.0.8"],
2651 ["v7.2.0", "v7.2.4"],
2652 ["v7.4.3", ""],
2653 ],
2654 },
2655 "messages": {
2656 "v_range": [
2657 ["v6.2.0", "v7.0.8"],
2658 ["v7.2.0", "v7.2.4"],
2659 ["v7.4.3", ""],
2660 ],
2661 "type": "list",
2662 "options": [
2663 {"value": "create-ses-req"},
2664 {"value": "create-ses-res"},
2665 {"value": "modify-bearer-req"},
2666 {"value": "modify-bearer-res"},
2667 ],
2668 "multiple_values": True,
2669 "elements": "str",
2670 },
2671 "apn_sel_mode": {
2672 "v_range": [
2673 ["v6.2.0", "v7.0.8"],
2674 ["v7.2.0", "v7.2.4"],
2675 ["v7.4.3", ""],
2676 ],
2677 "type": "list",
2678 "options": [{"value": "ms"}, {"value": "net"}, {"value": "vrf"}],
2679 "multiple_values": True,
2680 "elements": "str",
2681 },
2682 "max_apn_restriction": {
2683 "v_range": [
2684 ["v6.2.0", "v7.0.8"],
2685 ["v7.2.0", "v7.2.4"],
2686 ["v7.4.3", ""],
2687 ],
2688 "type": "string",
2689 "options": [
2690 {"value": "all"},
2691 {"value": "public-1"},
2692 {"value": "public-2"},
2693 {"value": "private-1"},
2694 {"value": "private-2"},
2695 ],
2696 },
2697 "imsi_prefix": {
2698 "v_range": [
2699 ["v6.2.0", "v7.0.8"],
2700 ["v7.2.0", "v7.2.4"],
2701 ["v7.4.3", ""],
2702 ],
2703 "type": "string",
2704 },
2705 "msisdn_prefix": {
2706 "v_range": [
2707 ["v6.2.0", "v7.0.8"],
2708 ["v7.2.0", "v7.2.4"],
2709 ["v7.4.3", ""],
2710 ],
2711 "type": "string",
2712 },
2713 "rat_type": {
2714 "v_range": [
2715 ["v6.2.0", "v7.0.8"],
2716 ["v7.2.0", "v7.2.4"],
2717 ["v7.4.3", ""],
2718 ],
2719 "type": "list",
2720 "options": [
2721 {"value": "any"},
2722 {"value": "utran"},
2723 {"value": "geran"},
2724 {"value": "wlan"},
2725 {"value": "gan"},
2726 {"value": "hspa"},
2727 {"value": "eutran"},
2728 {"value": "virtual"},
2729 {"value": "nbiot"},
2730 {
2731 "value": "ltem",
2732 "v_range": [
2733 ["v6.4.0", "v6.4.0"],
2734 ["v6.4.4", "v7.0.8"],
2735 ["v7.2.0", "v7.2.4"],
2736 ["v7.4.3", ""],
2737 ],
2738 },
2739 {
2740 "value": "nr",
2741 "v_range": [
2742 ["v6.4.0", "v6.4.0"],
2743 ["v6.4.4", "v7.0.8"],
2744 ["v7.2.0", "v7.2.4"],
2745 ["v7.4.3", ""],
2746 ],
2747 },
2748 ],
2749 "multiple_values": True,
2750 "elements": "str",
2751 },
2752 "mei": {
2753 "v_range": [
2754 ["v6.2.0", "v7.0.8"],
2755 ["v7.2.0", "v7.2.4"],
2756 ["v7.4.3", ""],
2757 ],
2758 "type": "string",
2759 },
2760 "action": {
2761 "v_range": [
2762 ["v6.2.0", "v7.0.8"],
2763 ["v7.2.0", "v7.2.4"],
2764 ["v7.4.3", ""],
2765 ],
2766 "type": "string",
2767 "options": [{"value": "allow"}, {"value": "deny"}],
2768 },
2769 "uli": {
2770 "v_range": [
2771 ["v6.2.0", "v7.0.8"],
2772 ["v7.2.0", "v7.2.4"],
2773 ["v7.4.3", ""],
2774 ],
2775 "type": "list",
2776 "multiple_values": True,
2777 "elements": "str",
2778 },
2779 },
2780 "v_range": [["v6.2.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2781 },
2782 "addr_notify": {
2783 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2784 "type": "string",
2785 },
2786 "port_notify": {
2787 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2788 "type": "integer",
2789 },
2790 "interface_notify": {
2791 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2792 "type": "string",
2793 },
2794 "context_id": {
2795 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2796 "type": "integer",
2797 },
2798 "ie_remove_policy": {
2799 "type": "list",
2800 "elements": "dict",
2801 "children": {
2802 "id": {
2803 "v_range": [
2804 ["v6.0.0", "v7.0.8"],
2805 ["v7.2.0", "v7.2.4"],
2806 ["v7.4.3", ""],
2807 ],
2808 "type": "integer",
2809 "required": True,
2810 },
2811 "sgsn_addr": {
2812 "v_range": [
2813 ["v6.0.0", "v7.0.8"],
2814 ["v7.2.0", "v7.2.4"],
2815 ["v7.4.3", ""],
2816 ],
2817 "type": "string",
2818 },
2819 "sgsn_addr6": {
2820 "v_range": [
2821 ["v6.4.0", "v6.4.0"],
2822 ["v6.4.4", "v7.0.8"],
2823 ["v7.2.0", "v7.2.4"],
2824 ["v7.4.3", ""],
2825 ],
2826 "type": "string",
2827 },
2828 "remove_ies": {
2829 "v_range": [
2830 ["v6.0.0", "v7.0.8"],
2831 ["v7.2.0", "v7.2.4"],
2832 ["v7.4.3", ""],
2833 ],
2834 "type": "list",
2835 "options": [
2836 {"value": "apn-restriction"},
2837 {"value": "rat-type"},
2838 {"value": "rai"},
2839 {"value": "uli"},
2840 {"value": "imei"},
2841 ],
2842 "multiple_values": True,
2843 "elements": "str",
2844 },
2845 },
2846 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2847 },
2848 "ip_policy": {
2849 "type": "list",
2850 "elements": "dict",
2851 "children": {
2852 "id": {
2853 "v_range": [
2854 ["v6.0.0", "v7.0.8"],
2855 ["v7.2.0", "v7.2.4"],
2856 ["v7.4.3", ""],
2857 ],
2858 "type": "integer",
2859 "required": True,
2860 },
2861 "srcaddr": {
2862 "v_range": [
2863 ["v6.0.0", "v7.0.8"],
2864 ["v7.2.0", "v7.2.4"],
2865 ["v7.4.3", ""],
2866 ],
2867 "type": "string",
2868 },
2869 "dstaddr": {
2870 "v_range": [
2871 ["v6.0.0", "v7.0.8"],
2872 ["v7.2.0", "v7.2.4"],
2873 ["v7.4.3", ""],
2874 ],
2875 "type": "string",
2876 },
2877 "srcaddr6": {
2878 "v_range": [
2879 ["v6.4.0", "v6.4.0"],
2880 ["v6.4.4", "v7.0.8"],
2881 ["v7.2.0", "v7.2.4"],
2882 ["v7.4.3", ""],
2883 ],
2884 "type": "string",
2885 },
2886 "dstaddr6": {
2887 "v_range": [
2888 ["v6.4.0", "v6.4.0"],
2889 ["v6.4.4", "v7.0.8"],
2890 ["v7.2.0", "v7.2.4"],
2891 ["v7.4.3", ""],
2892 ],
2893 "type": "string",
2894 },
2895 "action": {
2896 "v_range": [
2897 ["v6.0.0", "v7.0.8"],
2898 ["v7.2.0", "v7.2.4"],
2899 ["v7.4.3", ""],
2900 ],
2901 "type": "string",
2902 "options": [{"value": "allow"}, {"value": "deny"}],
2903 },
2904 },
2905 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2906 },
2907 "noip_policy": {
2908 "type": "list",
2909 "elements": "dict",
2910 "children": {
2911 "id": {
2912 "v_range": [
2913 ["v6.0.0", "v7.0.8"],
2914 ["v7.2.0", "v7.2.4"],
2915 ["v7.4.3", ""],
2916 ],
2917 "type": "integer",
2918 "required": True,
2919 },
2920 "type": {
2921 "v_range": [
2922 ["v6.0.0", "v7.0.8"],
2923 ["v7.2.0", "v7.2.4"],
2924 ["v7.4.3", ""],
2925 ],
2926 "type": "string",
2927 "options": [{"value": "etsi"}, {"value": "ietf"}],
2928 },
2929 "start": {
2930 "v_range": [
2931 ["v6.0.0", "v7.0.8"],
2932 ["v7.2.0", "v7.2.4"],
2933 ["v7.4.3", ""],
2934 ],
2935 "type": "integer",
2936 },
2937 "end": {
2938 "v_range": [
2939 ["v6.0.0", "v7.0.8"],
2940 ["v7.2.0", "v7.2.4"],
2941 ["v7.4.3", ""],
2942 ],
2943 "type": "integer",
2944 },
2945 "action": {
2946 "v_range": [
2947 ["v6.0.0", "v7.0.8"],
2948 ["v7.2.0", "v7.2.4"],
2949 ["v7.4.3", ""],
2950 ],
2951 "type": "string",
2952 "options": [{"value": "allow"}, {"value": "deny"}],
2953 },
2954 },
2955 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2956 },
2957 "message_filter_v0v1": {
2958 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2959 "type": "string",
2960 },
2961 "message_filter_v2": {
2962 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2963 "type": "string",
2964 },
2965 "ie_allow_list_v0v1": {
2966 "v_range": [["v7.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2967 "type": "string",
2968 },
2969 "ie_allow_list_v2": {
2970 "v_range": [["v7.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2971 "type": "string",
2972 },
2973 "rat_timeout_profile": {
2974 "v_range": [["v7.0.1", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2975 "type": "string",
2976 },
2977 "ie_validation": {
2978 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2979 "type": "dict",
2980 "children": {
2981 "imsi": {
2982 "v_range": [
2983 ["v6.0.0", "v7.0.8"],
2984 ["v7.2.0", "v7.2.4"],
2985 ["v7.4.3", ""],
2986 ],
2987 "type": "string",
2988 "options": [{"value": "enable"}, {"value": "disable"}],
2989 },
2990 "rai": {
2991 "v_range": [
2992 ["v6.0.0", "v7.0.8"],
2993 ["v7.2.0", "v7.2.4"],
2994 ["v7.4.3", ""],
2995 ],
2996 "type": "string",
2997 "options": [{"value": "enable"}, {"value": "disable"}],
2998 },
2999 "reordering_required": {
3000 "v_range": [
3001 ["v6.0.0", "v7.0.8"],
3002 ["v7.2.0", "v7.2.4"],
3003 ["v7.4.3", ""],
3004 ],
3005 "type": "string",
3006 "options": [{"value": "enable"}, {"value": "disable"}],
3007 },
3008 "ms_validated": {
3009 "v_range": [
3010 ["v6.0.0", "v7.0.8"],
3011 ["v7.2.0", "v7.2.4"],
3012 ["v7.4.3", ""],
3013 ],
3014 "type": "string",
3015 "options": [{"value": "enable"}, {"value": "disable"}],
3016 },
3017 "selection_mode": {
3018 "v_range": [
3019 ["v6.0.0", "v7.0.8"],
3020 ["v7.2.0", "v7.2.4"],
3021 ["v7.4.3", ""],
3022 ],
3023 "type": "string",
3024 "options": [{"value": "enable"}, {"value": "disable"}],
3025 },
3026 "nsapi": {
3027 "v_range": [
3028 ["v6.0.0", "v7.0.8"],
3029 ["v7.2.0", "v7.2.4"],
3030 ["v7.4.3", ""],
3031 ],
3032 "type": "string",
3033 "options": [{"value": "enable"}, {"value": "disable"}],
3034 },
3035 "charging_ID": {
3036 "v_range": [
3037 ["v6.0.0", "v7.0.8"],
3038 ["v7.2.0", "v7.2.4"],
3039 ["v7.4.3", ""],
3040 ],
3041 "type": "string",
3042 "options": [{"value": "enable"}, {"value": "disable"}],
3043 },
3044 "end_user_addr": {
3045 "v_range": [
3046 ["v6.0.0", "v7.0.8"],
3047 ["v7.2.0", "v7.2.4"],
3048 ["v7.4.3", ""],
3049 ],
3050 "type": "string",
3051 "options": [{"value": "enable"}, {"value": "disable"}],
3052 },
3053 "mm_context": {
3054 "v_range": [
3055 ["v6.0.0", "v7.0.8"],
3056 ["v7.2.0", "v7.2.4"],
3057 ["v7.4.3", ""],
3058 ],
3059 "type": "string",
3060 "options": [{"value": "enable"}, {"value": "disable"}],
3061 },
3062 "pdp_context": {
3063 "v_range": [
3064 ["v6.0.0", "v7.0.8"],
3065 ["v7.2.0", "v7.2.4"],
3066 ["v7.4.3", ""],
3067 ],
3068 "type": "string",
3069 "options": [{"value": "enable"}, {"value": "disable"}],
3070 },
3071 "gsn_addr": {
3072 "v_range": [
3073 ["v6.0.0", "v7.0.8"],
3074 ["v7.2.0", "v7.2.4"],
3075 ["v7.4.3", ""],
3076 ],
3077 "type": "string",
3078 "options": [{"value": "enable"}, {"value": "disable"}],
3079 },
3080 "msisdn": {
3081 "v_range": [
3082 ["v6.0.0", "v7.0.8"],
3083 ["v7.2.0", "v7.2.4"],
3084 ["v7.4.3", ""],
3085 ],
3086 "type": "string",
3087 "options": [{"value": "enable"}, {"value": "disable"}],
3088 },
3089 "qos_profile": {
3090 "v_range": [
3091 ["v6.0.0", "v7.0.8"],
3092 ["v7.2.0", "v7.2.4"],
3093 ["v7.4.3", ""],
3094 ],
3095 "type": "string",
3096 "options": [{"value": "enable"}, {"value": "disable"}],
3097 },
3098 "apn_restriction": {
3099 "v_range": [
3100 ["v6.0.0", "v7.0.8"],
3101 ["v7.2.0", "v7.2.4"],
3102 ["v7.4.3", ""],
3103 ],
3104 "type": "string",
3105 "options": [{"value": "enable"}, {"value": "disable"}],
3106 },
3107 "rat_type": {
3108 "v_range": [
3109 ["v6.0.0", "v7.0.8"],
3110 ["v7.2.0", "v7.2.4"],
3111 ["v7.4.3", ""],
3112 ],
3113 "type": "string",
3114 "options": [{"value": "enable"}, {"value": "disable"}],
3115 },
3116 "uli": {
3117 "v_range": [
3118 ["v6.0.0", "v7.0.8"],
3119 ["v7.2.0", "v7.2.4"],
3120 ["v7.4.3", ""],
3121 ],
3122 "type": "string",
3123 "options": [{"value": "enable"}, {"value": "disable"}],
3124 },
3125 "ms_tzone": {
3126 "v_range": [
3127 ["v6.0.0", "v7.0.8"],
3128 ["v7.2.0", "v7.2.4"],
3129 ["v7.4.3", ""],
3130 ],
3131 "type": "string",
3132 "options": [{"value": "enable"}, {"value": "disable"}],
3133 },
3134 "imei": {
3135 "v_range": [
3136 ["v6.0.0", "v7.0.8"],
3137 ["v7.2.0", "v7.2.4"],
3138 ["v7.4.3", ""],
3139 ],
3140 "type": "string",
3141 "options": [{"value": "enable"}, {"value": "disable"}],
3142 },
3143 "charging_gateway_addr": {
3144 "v_range": [
3145 ["v6.0.0", "v7.0.8"],
3146 ["v7.2.0", "v7.2.4"],
3147 ["v7.4.3", ""],
3148 ],
3149 "type": "string",
3150 "options": [{"value": "enable"}, {"value": "disable"}],
3151 },
3152 },
3153 },
3154 "message_rate_limit": {
3155 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
3156 "type": "dict",
3157 "children": {
3158 "echo_request": {
3159 "v_range": [
3160 ["v6.0.0", "v7.0.8"],
3161 ["v7.2.0", "v7.2.4"],
3162 ["v7.4.3", ""],
3163 ],
3164 "type": "integer",
3165 },
3166 "echo_response": {"v_range": [["v7.4.4", ""]], "type": "integer"},
3167 "version_not_support": {
3168 "v_range": [
3169 ["v6.0.0", "v7.0.8"],
3170 ["v7.2.0", "v7.2.4"],
3171 ["v7.4.3", ""],
3172 ],
3173 "type": "integer",
3174 },
3175 "create_pdp_request": {
3176 "v_range": [
3177 ["v6.0.0", "v7.0.8"],
3178 ["v7.2.0", "v7.2.4"],
3179 ["v7.4.3", ""],
3180 ],
3181 "type": "integer",
3182 },
3183 "create_pdp_response": {
3184 "v_range": [
3185 ["v6.0.0", "v7.0.8"],
3186 ["v7.2.0", "v7.2.4"],
3187 ["v7.4.3", ""],
3188 ],
3189 "type": "integer",
3190 },
3191 "update_pdp_request": {
3192 "v_range": [
3193 ["v6.0.0", "v7.0.8"],
3194 ["v7.2.0", "v7.2.4"],
3195 ["v7.4.3", ""],
3196 ],
3197 "type": "integer",
3198 },
3199 "update_pdp_response": {
3200 "v_range": [
3201 ["v6.0.0", "v7.0.8"],
3202 ["v7.2.0", "v7.2.4"],
3203 ["v7.4.3", ""],
3204 ],
3205 "type": "integer",
3206 },
3207 "delete_pdp_request": {
3208 "v_range": [
3209 ["v6.0.0", "v7.0.8"],
3210 ["v7.2.0", "v7.2.4"],
3211 ["v7.4.3", ""],
3212 ],
3213 "type": "integer",
3214 },
3215 "delete_pdp_response": {
3216 "v_range": [
3217 ["v6.0.0", "v7.0.8"],
3218 ["v7.2.0", "v7.2.4"],
3219 ["v7.4.3", ""],
3220 ],
3221 "type": "integer",
3222 },
3223 "create_aa_pdp_request": {
3224 "v_range": [
3225 ["v6.0.0", "v7.0.8"],
3226 ["v7.2.0", "v7.2.4"],
3227 ["v7.4.3", ""],
3228 ],
3229 "type": "integer",
3230 },
3231 "create_aa_pdp_response": {
3232 "v_range": [
3233 ["v6.0.0", "v7.0.8"],
3234 ["v7.2.0", "v7.2.4"],
3235 ["v7.4.3", ""],
3236 ],
3237 "type": "integer",
3238 },
3239 "delete_aa_pdp_request": {
3240 "v_range": [
3241 ["v6.0.0", "v7.0.8"],
3242 ["v7.2.0", "v7.2.4"],
3243 ["v7.4.3", ""],
3244 ],
3245 "type": "integer",
3246 },
3247 "delete_aa_pdp_response": {
3248 "v_range": [
3249 ["v6.0.0", "v7.0.8"],
3250 ["v7.2.0", "v7.2.4"],
3251 ["v7.4.3", ""],
3252 ],
3253 "type": "integer",
3254 },
3255 "error_indication": {
3256 "v_range": [
3257 ["v6.0.0", "v7.0.8"],
3258 ["v7.2.0", "v7.2.4"],
3259 ["v7.4.3", ""],
3260 ],
3261 "type": "integer",
3262 },
3263 "pdu_notify_request": {
3264 "v_range": [
3265 ["v6.0.0", "v7.0.8"],
3266 ["v7.2.0", "v7.2.4"],
3267 ["v7.4.3", ""],
3268 ],
3269 "type": "integer",
3270 },
3271 "pdu_notify_response": {
3272 "v_range": [
3273 ["v6.0.0", "v7.0.8"],
3274 ["v7.2.0", "v7.2.4"],
3275 ["v7.4.3", ""],
3276 ],
3277 "type": "integer",
3278 },
3279 "pdu_notify_rej_request": {
3280 "v_range": [
3281 ["v6.0.0", "v7.0.8"],
3282 ["v7.2.0", "v7.2.4"],
3283 ["v7.4.3", ""],
3284 ],
3285 "type": "integer",
3286 },
3287 "pdu_notify_rej_response": {
3288 "v_range": [
3289 ["v6.0.0", "v7.0.8"],
3290 ["v7.2.0", "v7.2.4"],
3291 ["v7.4.3", ""],
3292 ],
3293 "type": "integer",
3294 },
3295 "support_ext_hdr_notify": {
3296 "v_range": [
3297 ["v6.0.0", "v7.0.8"],
3298 ["v7.2.0", "v7.2.4"],
3299 ["v7.4.3", ""],
3300 ],
3301 "type": "integer",
3302 },
3303 "send_route_request": {
3304 "v_range": [
3305 ["v6.0.0", "v7.0.8"],
3306 ["v7.2.0", "v7.2.4"],
3307 ["v7.4.3", ""],
3308 ],
3309 "type": "integer",
3310 },
3311 "send_route_response": {
3312 "v_range": [
3313 ["v6.0.0", "v7.0.8"],
3314 ["v7.2.0", "v7.2.4"],
3315 ["v7.4.3", ""],
3316 ],
3317 "type": "integer",
3318 },
3319 "failure_report_request": {
3320 "v_range": [
3321 ["v6.0.0", "v7.0.8"],
3322 ["v7.2.0", "v7.2.4"],
3323 ["v7.4.3", ""],
3324 ],
3325 "type": "integer",
3326 },
3327 "failure_report_response": {
3328 "v_range": [
3329 ["v6.0.0", "v7.0.8"],
3330 ["v7.2.0", "v7.2.4"],
3331 ["v7.4.3", ""],
3332 ],
3333 "type": "integer",
3334 },
3335 "note_ms_request": {
3336 "v_range": [
3337 ["v6.0.0", "v7.0.8"],
3338 ["v7.2.0", "v7.2.4"],
3339 ["v7.4.3", ""],
3340 ],
3341 "type": "integer",
3342 },
3343 "note_ms_response": {
3344 "v_range": [
3345 ["v6.0.0", "v7.0.8"],
3346 ["v7.2.0", "v7.2.4"],
3347 ["v7.4.3", ""],
3348 ],
3349 "type": "integer",
3350 },
3351 "identification_request": {
3352 "v_range": [
3353 ["v6.0.0", "v7.0.8"],
3354 ["v7.2.0", "v7.2.4"],
3355 ["v7.4.3", ""],
3356 ],
3357 "type": "integer",
3358 },
3359 "identification_response": {
3360 "v_range": [
3361 ["v6.0.0", "v7.0.8"],
3362 ["v7.2.0", "v7.2.4"],
3363 ["v7.4.3", ""],
3364 ],
3365 "type": "integer",
3366 },
3367 "sgsn_context_request": {
3368 "v_range": [
3369 ["v6.0.0", "v7.0.8"],
3370 ["v7.2.0", "v7.2.4"],
3371 ["v7.4.3", ""],
3372 ],
3373 "type": "integer",
3374 },
3375 "sgsn_context_response": {
3376 "v_range": [
3377 ["v6.0.0", "v7.0.8"],
3378 ["v7.2.0", "v7.2.4"],
3379 ["v7.4.3", ""],
3380 ],
3381 "type": "integer",
3382 },
3383 "sgsn_context_ack": {
3384 "v_range": [
3385 ["v6.0.0", "v7.0.8"],
3386 ["v7.2.0", "v7.2.4"],
3387 ["v7.4.3", ""],
3388 ],
3389 "type": "integer",
3390 },
3391 "fwd_relocation_request": {
3392 "v_range": [
3393 ["v6.0.0", "v7.0.8"],
3394 ["v7.2.0", "v7.2.4"],
3395 ["v7.4.3", ""],
3396 ],
3397 "type": "integer",
3398 },
3399 "fwd_relocation_response": {
3400 "v_range": [
3401 ["v6.0.0", "v7.0.8"],
3402 ["v7.2.0", "v7.2.4"],
3403 ["v7.4.3", ""],
3404 ],
3405 "type": "integer",
3406 },
3407 "fwd_relocation_complete": {
3408 "v_range": [
3409 ["v6.0.0", "v7.0.8"],
3410 ["v7.2.0", "v7.2.4"],
3411 ["v7.4.3", ""],
3412 ],
3413 "type": "integer",
3414 },
3415 "relocation_cancel_request": {
3416 "v_range": [
3417 ["v6.0.0", "v7.0.8"],
3418 ["v7.2.0", "v7.2.4"],
3419 ["v7.4.3", ""],
3420 ],
3421 "type": "integer",
3422 },
3423 "relocation_cancel_response": {
3424 "v_range": [
3425 ["v6.0.0", "v7.0.8"],
3426 ["v7.2.0", "v7.2.4"],
3427 ["v7.4.3", ""],
3428 ],
3429 "type": "integer",
3430 },
3431 "fwd_srns_context": {
3432 "v_range": [
3433 ["v6.0.0", "v7.0.8"],
3434 ["v7.2.0", "v7.2.4"],
3435 ["v7.4.3", ""],
3436 ],
3437 "type": "integer",
3438 },
3439 "fwd_reloc_complete_ack": {
3440 "v_range": [
3441 ["v6.0.0", "v7.0.8"],
3442 ["v7.2.0", "v7.2.4"],
3443 ["v7.4.3", ""],
3444 ],
3445 "type": "integer",
3446 },
3447 "fwd_srns_context_ack": {
3448 "v_range": [
3449 ["v6.0.0", "v7.0.8"],
3450 ["v7.2.0", "v7.2.4"],
3451 ["v7.4.3", ""],
3452 ],
3453 "type": "integer",
3454 },
3455 "ran_info": {
3456 "v_range": [
3457 ["v6.0.0", "v7.0.8"],
3458 ["v7.2.0", "v7.2.4"],
3459 ["v7.4.3", ""],
3460 ],
3461 "type": "integer",
3462 },
3463 "mbms_notify_request": {
3464 "v_range": [
3465 ["v6.0.0", "v7.0.8"],
3466 ["v7.2.0", "v7.2.4"],
3467 ["v7.4.3", ""],
3468 ],
3469 "type": "integer",
3470 },
3471 "mbms_notify_response": {
3472 "v_range": [
3473 ["v6.0.0", "v7.0.8"],
3474 ["v7.2.0", "v7.2.4"],
3475 ["v7.4.3", ""],
3476 ],
3477 "type": "integer",
3478 },
3479 "mbms_notify_rej_request": {
3480 "v_range": [
3481 ["v6.0.0", "v7.0.8"],
3482 ["v7.2.0", "v7.2.4"],
3483 ["v7.4.3", ""],
3484 ],
3485 "type": "integer",
3486 },
3487 "mbms_notify_rej_response": {
3488 "v_range": [
3489 ["v6.0.0", "v7.0.8"],
3490 ["v7.2.0", "v7.2.4"],
3491 ["v7.4.3", ""],
3492 ],
3493 "type": "integer",
3494 },
3495 "create_mbms_request": {
3496 "v_range": [
3497 ["v6.0.0", "v7.0.8"],
3498 ["v7.2.0", "v7.2.4"],
3499 ["v7.4.3", ""],
3500 ],
3501 "type": "integer",
3502 },
3503 "create_mbms_response": {
3504 "v_range": [
3505 ["v6.0.0", "v7.0.8"],
3506 ["v7.2.0", "v7.2.4"],
3507 ["v7.4.3", ""],
3508 ],
3509 "type": "integer",
3510 },
3511 "update_mbms_request": {
3512 "v_range": [
3513 ["v6.0.0", "v7.0.8"],
3514 ["v7.2.0", "v7.2.4"],
3515 ["v7.4.3", ""],
3516 ],
3517 "type": "integer",
3518 },
3519 "update_mbms_response": {
3520 "v_range": [
3521 ["v6.0.0", "v7.0.8"],
3522 ["v7.2.0", "v7.2.4"],
3523 ["v7.4.3", ""],
3524 ],
3525 "type": "integer",
3526 },
3527 "delete_mbms_request": {
3528 "v_range": [
3529 ["v6.0.0", "v7.0.8"],
3530 ["v7.2.0", "v7.2.4"],
3531 ["v7.4.3", ""],
3532 ],
3533 "type": "integer",
3534 },
3535 "delete_mbms_response": {
3536 "v_range": [
3537 ["v6.0.0", "v7.0.8"],
3538 ["v7.2.0", "v7.2.4"],
3539 ["v7.4.3", ""],
3540 ],
3541 "type": "integer",
3542 },
3543 "mbms_reg_request": {
3544 "v_range": [
3545 ["v6.0.0", "v7.0.8"],
3546 ["v7.2.0", "v7.2.4"],
3547 ["v7.4.3", ""],
3548 ],
3549 "type": "integer",
3550 },
3551 "mbms_reg_response": {
3552 "v_range": [
3553 ["v6.0.0", "v7.0.8"],
3554 ["v7.2.0", "v7.2.4"],
3555 ["v7.4.3", ""],
3556 ],
3557 "type": "integer",
3558 },
3559 "mbms_de_reg_request": {
3560 "v_range": [
3561 ["v6.0.0", "v7.0.8"],
3562 ["v7.2.0", "v7.2.4"],
3563 ["v7.4.3", ""],
3564 ],
3565 "type": "integer",
3566 },
3567 "mbms_de_reg_response": {
3568 "v_range": [
3569 ["v6.0.0", "v7.0.8"],
3570 ["v7.2.0", "v7.2.4"],
3571 ["v7.4.3", ""],
3572 ],
3573 "type": "integer",
3574 },
3575 "mbms_ses_start_request": {
3576 "v_range": [
3577 ["v6.0.0", "v7.0.8"],
3578 ["v7.2.0", "v7.2.4"],
3579 ["v7.4.3", ""],
3580 ],
3581 "type": "integer",
3582 },
3583 "mbms_ses_start_response": {
3584 "v_range": [
3585 ["v6.0.0", "v7.0.8"],
3586 ["v7.2.0", "v7.2.4"],
3587 ["v7.4.3", ""],
3588 ],
3589 "type": "integer",
3590 },
3591 "mbms_ses_stop_request": {
3592 "v_range": [
3593 ["v6.0.0", "v7.0.8"],
3594 ["v7.2.0", "v7.2.4"],
3595 ["v7.4.3", ""],
3596 ],
3597 "type": "integer",
3598 },
3599 "mbms_ses_stop_response": {
3600 "v_range": [
3601 ["v6.0.0", "v7.0.8"],
3602 ["v7.2.0", "v7.2.4"],
3603 ["v7.4.3", ""],
3604 ],
3605 "type": "integer",
3606 },
3607 "g_pdu": {
3608 "v_range": [
3609 ["v6.0.0", "v7.0.8"],
3610 ["v7.2.0", "v7.2.4"],
3611 ["v7.4.3", ""],
3612 ],
3613 "type": "integer",
3614 },
3615 "echo_reponse": {
3616 "v_range": [
3617 ["v6.0.0", "v7.0.8"],
3618 ["v7.2.0", "v7.2.4"],
3619 ["v7.4.3", "v7.4.3"],
3620 ],
3621 "type": "integer",
3622 },
3623 },
3624 },
3625 "rate_limit_mode": {
3626 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
3627 "type": "string",
3628 "options": [
3629 {"value": "per-profile"},
3630 {"value": "per-stream"},
3631 {"value": "per-apn"},
3632 ],
3633 },
3634 "warning_threshold": {
3635 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
3636 "type": "integer",
3637 },
3638 "message_rate_limit_v0": {
3639 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
3640 "type": "dict",
3641 "children": {
3642 "echo_request": {
3643 "v_range": [
3644 ["v6.0.0", "v7.0.8"],
3645 ["v7.2.0", "v7.2.4"],
3646 ["v7.4.3", ""],
3647 ],
3648 "type": "integer",
3649 },
3650 "create_pdp_request": {
3651 "v_range": [
3652 ["v6.0.0", "v7.0.8"],
3653 ["v7.2.0", "v7.2.4"],
3654 ["v7.4.3", ""],
3655 ],
3656 "type": "integer",
3657 },
3658 "delete_pdp_request": {
3659 "v_range": [
3660 ["v6.0.0", "v7.0.8"],
3661 ["v7.2.0", "v7.2.4"],
3662 ["v7.4.3", ""],
3663 ],
3664 "type": "integer",
3665 },
3666 },
3667 },
3668 "message_rate_limit_v1": {
3669 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
3670 "type": "dict",
3671 "children": {
3672 "echo_request": {
3673 "v_range": [
3674 ["v6.0.0", "v7.0.8"],
3675 ["v7.2.0", "v7.2.4"],
3676 ["v7.4.3", ""],
3677 ],
3678 "type": "integer",
3679 },
3680 "create_pdp_request": {
3681 "v_range": [
3682 ["v6.0.0", "v7.0.8"],
3683 ["v7.2.0", "v7.2.4"],
3684 ["v7.4.3", ""],
3685 ],
3686 "type": "integer",
3687 },
3688 "delete_pdp_request": {
3689 "v_range": [
3690 ["v6.0.0", "v7.0.8"],
3691 ["v7.2.0", "v7.2.4"],
3692 ["v7.4.3", ""],
3693 ],
3694 "type": "integer",
3695 },
3696 },
3697 },
3698 "message_rate_limit_v2": {
3699 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
3700 "type": "dict",
3701 "children": {
3702 "echo_request": {
3703 "v_range": [
3704 ["v6.0.0", "v7.0.8"],
3705 ["v7.2.0", "v7.2.4"],
3706 ["v7.4.3", ""],
3707 ],
3708 "type": "integer",
3709 },
3710 "create_session_request": {
3711 "v_range": [
3712 ["v6.0.0", "v7.0.8"],
3713 ["v7.2.0", "v7.2.4"],
3714 ["v7.4.3", ""],
3715 ],
3716 "type": "integer",
3717 },
3718 "delete_session_request": {
3719 "v_range": [
3720 ["v6.0.0", "v7.0.8"],
3721 ["v7.2.0", "v7.2.4"],
3722 ["v7.4.3", ""],
3723 ],
3724 "type": "integer",
3725 },
3726 },
3727 },
3728 "per_apn_shaper": {
3729 "type": "list",
3730 "elements": "dict",
3731 "children": {
3732 "id": {
3733 "v_range": [
3734 ["v6.0.0", "v7.0.8"],
3735 ["v7.2.0", "v7.2.4"],
3736 ["v7.4.3", ""],
3737 ],
3738 "type": "integer",
3739 "required": True,
3740 },
3741 "apn": {
3742 "v_range": [
3743 ["v6.0.0", "v7.0.8"],
3744 ["v7.2.0", "v7.2.4"],
3745 ["v7.4.3", ""],
3746 ],
3747 "type": "string",
3748 },
3749 "version": {
3750 "v_range": [
3751 ["v6.0.0", "v7.0.8"],
3752 ["v7.2.0", "v7.2.4"],
3753 ["v7.4.3", ""],
3754 ],
3755 "type": "integer",
3756 },
3757 "rate_limit": {
3758 "v_range": [
3759 ["v6.0.0", "v7.0.8"],
3760 ["v7.2.0", "v7.2.4"],
3761 ["v7.4.3", ""],
3762 ],
3763 "type": "integer",
3764 },
3765 },
3766 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
3767 },
3768 "ie_white_list_v0v1": {"v_range": [["v6.0.0", "v6.4.4"]], "type": "string"},
3769 "ie_white_list_v2": {"v_range": [["v6.0.0", "v6.4.4"]], "type": "string"},
3770 },
3771 "v_range": [["v6.0.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
3772 }
3773
3774
3775 def main():
3776 module_spec = schema_to_module_spec(versioned_schema)
3777 mkeyname = "name"
3778 fields = {
3779 "access_token": {"required": False, "type": "str", "no_log": True},
3780 "enable_log": {"required": False, "type": "bool", "default": False},
3781 "vdom": {"required": False, "type": "str", "default": "root"},
3782 "member_path": {"required": False, "type": "str"},
3783 "member_state": {
3784 "type": "str",
3785 "required": False,
3786 "choices": ["present", "absent"],
3787 },
3788 "state": {"required": True, "type": "str", "choices": ["present", "absent"]},
3789 "firewall_gtp": {
3790 "required": False,
3791 "type": "dict",
3792 "default": None,
3793 "options": {},
3794 },
3795 }
3796 for attribute_name in module_spec["options"]:
3797 fields["firewall_gtp"]["options"][attribute_name] = module_spec["options"][
3798 attribute_name
3799 ]
3800 if mkeyname and mkeyname == attribute_name:
3801 fields["firewall_gtp"]["options"][attribute_name]["required"] = True
3802
3803 module = AnsibleModule(argument_spec=fields, supports_check_mode=True)
3804 check_legacy_fortiosapi(module)
3805
3806 is_error = False
3807 has_changed = False
3808 result = None
3809 diff = None
3810
3811 versions_check_result = None
3812 if module._socket_path:
3813 connection = Connection(module._socket_path)
3814 if "access_token" in module.params:
3815 connection.set_custom_option("access_token", module.params["access_token"])
3816
3817 if "enable_log" in module.params:
3818 connection.set_custom_option("enable_log", module.params["enable_log"])
3819 else:
3820 connection.set_custom_option("enable_log", False)
3821 fos = FortiOSHandler(connection, module, mkeyname, admin_passwd_header=False)
3822 versions_check_result = check_schema_versioning(
3823 fos, versioned_schema, "firewall_gtp"
3824 )
3825
3826 is_error, has_changed, result, diff = fortios_firewall(
3827 module.params, fos, module.check_mode
3828 )
3829
3830 else:
3831 module.fail_json(**FAIL_SOCKET_MSG)
3832
3833 if versions_check_result and versions_check_result["matched"] is False:
3834 module.warn(
3835 "Ansible has detected version mismatch between FortOS system and your playbook, see more details by specifying option -vvv"
3836 )
3837
3838 if not is_error:
3839 if versions_check_result and versions_check_result["matched"] is False:
3840 module.exit_json(
3841 changed=has_changed,
3842 version_check_warning=versions_check_result,
3843 meta=result,
3844 diff=diff,
3845 )
3846 else:
3847 module.exit_json(changed=has_changed, meta=result, diff=diff)
3848 else:
3849 if versions_check_result and versions_check_result["matched"] is False:
3850 module.fail_json(
3851 msg="Error in repo",
3852 version_check_warning=versions_check_result,
3853 meta=result,
3854 )
3855 else:
3856 module.fail_json(msg="Error in repo", meta=result)
3857
3858
3859 if __name__ == "__main__":
3860 main()