Debian Codegraph @

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

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_vpn_ipsec_fec
15 short_description: Configure Forward Error Correction
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 vpn_ipsec_fec:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 mappings:
34 type: list
35 elements: dict
36 description: Mappings.
37 suboptions:
38 bandwidth_bi_threshold:
39 aliases: ['bandwidth-bi-threshold']
40 type: int
41 description: Apply FEC parameters when available bi-bandwidth is >= threshold
42 bandwidth_down_threshold:
43 aliases: ['bandwidth-down-threshold']
44 type: int
45 description: Apply FEC parameters when available down bandwidth is >= threshold
46 bandwidth_up_threshold:
47 aliases: ['bandwidth-up-threshold']
48 type: int
49 description: Apply FEC parameters when available up bandwidth is >= threshold
50 base:
51 type: int
52 description: Number of base FEC packets
53 latency_threshold:
54 aliases: ['latency-threshold']
55 type: int
56 description: Apply FEC parameters when latency is
57 packet_loss_threshold:
58 aliases: ['packet-loss-threshold']
59 type: int
60 description: Apply FEC parameters when packet loss is >= threshold
61 redundant:
62 type: int
63 description: Number of redundant FEC packets
64 seqno:
65 type: int
66 description: Sequence number
67 name:
68 type: str
69 description: Profile name.
70 required: true
71 '''
72
73 EXAMPLES = '''
74 - name: Example playbook (generated based on argument schema)
75 hosts: fortimanagers
76 connection: httpapi
77 gather_facts: false
78 tasks:
79 - name: Configure Forward Error Correction
80 fortinet.fortimanager.fmgr_vpn_ipsec_fec:
81 # workspace_locking_adom: <global or your adom name>
82 adom: <your own value>
83 state: present # <value in [present, absent]>
84 vpn_ipsec_fec:
85 name: "your value" # Required variable, string
86 # mappings:
87 # - bandwidth_bi_threshold: <integer>
88 # bandwidth_down_threshold: <integer>
89 # bandwidth_up_threshold: <integer>
90 # base: <integer>
91 # latency_threshold: <integer>
92 # packet_loss_threshold: <integer>
93 # redundant: <integer>
94 # seqno: <integer>
95 '''
96
97 RETURN = '''
98 meta:
99 description: The result of the request.
100 type: dict
101 returned: always
102 contains:
103 request_url:
104 description: The full url requested.
105 returned: always
106 type: str
107 sample: /sys/login/user
108 response_code:
109 description: The status of api request.
110 returned: always
111 type: int
112 sample: 0
113 response_data:
114 description: The api response.
115 type: list
116 returned: always
117 response_message:
118 description: The descriptive message of the api response.
119 type: str
120 returned: always
121 sample: OK.
122 system_information:
123 description: The information of the target system.
124 type: dict
125 returned: always
126 rc:
127 description: The status the request.
128 type: int
129 returned: always
130 sample: 0
131 version_check_warning:
132 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
133 type: list
134 returned: complex
135 '''
136 from ansible.module_utils.basic import AnsibleModule
137 from ansible.module_utils.connection import Connection
138 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
139 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
140
141
142 def main():
143 urls_list = [
144 '/pm/config/adom/{adom}/obj/vpn/ipsec/fec',
145 '/pm/config/global/obj/vpn/ipsec/fec'
146 ]
147 module_arg_spec = {
148 'adom': {'required': True, 'type': 'str'},
149 'revision_note': {'type': 'str'},
150 'vpn_ipsec_fec': {
151 'type': 'dict', 'v_range': [['7.2.0', '']],
152 'options': {
153 'mappings': {
154 'v_range': [['7.2.0', '']],
155 'type': 'list',
156 'options': {
157 'bandwidth-bi-threshold': {'v_range': [['7.2.0', '']], 'type': 'int'},
158 'bandwidth-down-threshold': {'v_range': [['7.2.0', '']], 'type': 'int'},
159 'bandwidth-up-threshold': {'v_range': [['7.2.0', '']], 'type': 'int'},
160 'base': {'v_range': [['7.2.0', '']], 'type': 'int'},
161 'latency-threshold': {'v_range': [['7.2.0', '']], 'type': 'int'},
162 'packet-loss-threshold': {'v_range': [['7.2.0', '']], 'type': 'int'},
163 'redundant': {'v_range': [['7.2.0', '']], 'type': 'int'},
164 'seqno': {'v_range': [['7.2.0', '']], 'type': 'int'}
165 },
166 'elements': 'dict'
167 },
168 'name': {'v_range': [['7.2.0', '']], 'required': True, 'type': 'str'}
169 }
170 }
171 }
172
173 module_option_spec = get_module_arg_spec('full crud')
174 module_arg_spec.update(module_option_spec)
175 check_galaxy_version(module_arg_spec)
176 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'vpn_ipsec_fec'),
177 supports_check_mode=True)
178 if not module._socket_path:
179 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
180 connection = Connection(module._socket_path)
181 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
182 'name', 'data', module, connection)
183 fmgr.process_crud()
184 module.exit_json(meta=module.params)
185
186
187 if __name__ == '__main__':
188 main()