Debian Codegraph @

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

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_extensioncontroller_extenderprofile_lanextension
15 short_description: FortiExtender lan extension configuration.
16 version_added: "2.2.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 extender-profile:
29 description: Deprecated, please use "extender_profile"
30 type: str
31 extender_profile:
32 description: The parameter (extender-profile) in requested url.
33 type: str
34 extensioncontroller_extenderprofile_lanextension:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 backhaul:
40 type: list
41 elements: dict
42 description: Backhaul.
43 suboptions:
44 name:
45 type: str
46 description: FortiExtender LAN extension backhaul name.
47 port:
48 type: str
49 description: FortiExtender uplink port.
50 choices: ['wan', 'lte1', 'lte2', 'port1', 'port2', 'port3', 'port4',
51 'port5', 'sfp']
52 role:
53 type: str
54 description: FortiExtender uplink port.
55 choices: ['primary', 'secondary']
56 weight:
57 type: int
58 description: WRR weight parameter.
59 health_check_fail_cnt:
60 aliases: ['health-check-fail-cnt']
61 type: int
62 description: Number of failures before the link is considered dead
63 health_check_interval:
64 aliases: ['health-check-interval']
65 type: int
66 description: Health monitoring interval in seconds
67 health_check_probe_cnt:
68 aliases: ['health-check-probe-cnt']
69 type: int
70 description: Number of health monitoring probes to send within an interval
71 health_check_probe_tm:
72 aliases: ['health-check-probe-tm']
73 type: int
74 description: Health monitoring probe timeout in seconds
75 health_check_recovery_cnt:
76 aliases: ['health-check-recovery-cnt']
77 type: int
78 description: Number of successful checks before the link is considered alive
79 backhaul_interface:
80 aliases: ['backhaul-interface']
81 type: str
82 description: IPsec phase1 interface.
83 backhaul_ip:
84 aliases: ['backhaul-ip']
85 type: str
86 description: IPsec phase1 IPv4/FQDN.
87 ipsec_tunnel:
88 aliases: ['ipsec-tunnel']
89 type: str
90 description: IPsec tunnel name.
91 link_loadbalance:
92 aliases: ['link-loadbalance']
93 type: str
94 description: LAN extension link load balance strategy.
95 choices: ['activebackup', 'loadbalance']
96 downlinks:
97 type: list
98 elements: dict
99 description: Downlinks.
100 suboptions:
101 name:
102 type: str
103 description: FortiExtender LAN extension downlink config entry name.
104 port:
105 type: str
106 description: FortiExtender LAN extension downlink port.
107 choices: ['port1', 'port2', 'port3', 'port4', 'port5', 'lan1', 'lan2',
108 'lan']
109 pvid:
110 type: int
111 description: FortiExtender LAN extension downlink PVID.
112 type:
113 type: str
114 description: FortiExtender LAN extension downlink type [port/vap].
115 choices: ['port', 'vap']
116 vap:
117 type: raw
118 description: (list) FortiExtender LAN extension downlink vap.
119 vids:
120 type: raw
121 description: (list) FortiExtender LAN extension downlink VIDs.
122 traffic_split_services:
123 aliases: ['traffic-split-services']
124 type: list
125 elements: dict
126 description: Traffic split services.
127 suboptions:
128 address:
129 type: raw
130 description: (list) Address selection.
131 name:
132 type: str
133 description: FortiExtender LAN extension tunnel split entry name.
134 service:
135 type: raw
136 description: (list) Service selection.
137 vsdb:
138 type: str
139 description: Select vsdb [enable/disable].
140 choices: ['disable', 'enable']
141 '''
142
143 EXAMPLES = '''
144 - name: Example playbook (generated based on argument schema)
145 hosts: fortimanagers
146 connection: httpapi
147 gather_facts: false
148 tasks:
149 - name: FortiExtender lan extension configuration.
150 fortinet.fortimanager.fmgr_extensioncontroller_extenderprofile_lanextension:
151 # workspace_locking_adom: <global or your adom name>
152 adom: <your own value>
153 extender_profile: <your own value>
154 extensioncontroller_extenderprofile_lanextension:
155 # backhaul:
156 # - name: <string>
157 # port: <value in [wan, lte1, lte2, ...]>
158 # role: <value in [primary, secondary]>
159 # weight: <integer>
160 # health_check_fail_cnt: <integer>
161 # health_check_interval: <integer>
162 # health_check_probe_cnt: <integer>
163 # health_check_probe_tm: <integer>
164 # health_check_recovery_cnt: <integer>
165 # backhaul_interface: <string>
166 # backhaul_ip: <string>
167 # ipsec_tunnel: <string>
168 # link_loadbalance: <value in [activebackup, loadbalance]>
169 # downlinks:
170 # - name: <string>
171 # port: <value in [port1, port2, port3, ...]>
172 # pvid: <integer>
173 # type: <value in [port, vap]>
174 # vap: <list or string>
175 # vids: <list or integer>
176 # traffic_split_services:
177 # - address: <list or string>
178 # name: <string>
179 # service: <list or string>
180 # vsdb: <value in [disable, enable]>
181 '''
182
183 RETURN = '''
184 meta:
185 description: The result of the request.
186 type: dict
187 returned: always
188 contains:
189 request_url:
190 description: The full url requested.
191 returned: always
192 type: str
193 sample: /sys/login/user
194 response_code:
195 description: The status of api request.
196 returned: always
197 type: int
198 sample: 0
199 response_data:
200 description: The api response.
201 type: list
202 returned: always
203 response_message:
204 description: The descriptive message of the api response.
205 type: str
206 returned: always
207 sample: OK.
208 system_information:
209 description: The information of the target system.
210 type: dict
211 returned: always
212 rc:
213 description: The status the request.
214 type: int
215 returned: always
216 sample: 0
217 version_check_warning:
218 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
219 type: list
220 returned: complex
221 '''
222 from ansible.module_utils.basic import AnsibleModule
223 from ansible.module_utils.connection import Connection
224 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
225 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
226
227
228 def main():
229 urls_list = [
230 '/pm/config/adom/{adom}/obj/extension-controller/extender-profile/{extender-profile}/lan-extension',
231 '/pm/config/global/obj/extension-controller/extender-profile/{extender-profile}/lan-extension'
232 ]
233 module_arg_spec = {
234 'adom': {'required': True, 'type': 'str'},
235 'extender-profile': {'type': 'str', 'api_name': 'extender_profile'},
236 'extender_profile': {'type': 'str'},
237 'revision_note': {'type': 'str'},
238 'extensioncontroller_extenderprofile_lanextension': {
239 'type': 'dict', 'v_range': [['7.2.1', '']],
240 'options': {
241 'backhaul': {
242 'v_range': [['7.2.1', '']],
243 'type': 'list',
244 'options': {
245 'name': {'v_range': [['7.2.1', '']], 'type': 'str'},
246 'port': {
247 'v_range': [['7.2.1', '']],
248 'choices': ['wan', 'lte1', 'lte2', 'port1', 'port2', 'port3', 'port4', 'port5', 'sfp'],
249 'type': 'str'
250 },
251 'role': {'v_range': [['7.2.1', '']], 'choices': ['primary', 'secondary'], 'type': 'str'},
252 'weight': {'v_range': [['7.2.1', '']], 'type': 'int'},
253 'health-check-fail-cnt': {'v_range': [['7.6.5', '']], 'type': 'int'},
254 'health-check-interval': {'v_range': [['7.6.5', '']], 'type': 'int'},
255 'health-check-probe-cnt': {'v_range': [['7.6.5', '']], 'type': 'int'},
256 'health-check-probe-tm': {'v_range': [['7.6.5', '']], 'type': 'int'},
257 'health-check-recovery-cnt': {'v_range': [['7.6.5', '']], 'type': 'int'}
258 },
259 'elements': 'dict'
260 },
261 'backhaul-interface': {'v_range': [['7.2.1', '']], 'type': 'str'},
262 'backhaul-ip': {'v_range': [['7.2.1', '']], 'type': 'str'},
263 'ipsec-tunnel': {'v_range': [['7.2.1', '']], 'type': 'str'},
264 'link-loadbalance': {'v_range': [['7.2.1', '']], 'choices': ['activebackup', 'loadbalance'], 'type': 'str'},
265 'downlinks': {
266 'v_range': [['7.6.0', '']],
267 'type': 'list',
268 'options': {
269 'name': {'v_range': [['7.6.0', '']], 'type': 'str'},
270 'port': {
271 'v_range': [['7.6.0', '']],
272 'choices': ['port1', 'port2', 'port3', 'port4', 'port5', 'lan1', 'lan2', 'lan'],
273 'type': 'str'
274 },
275 'pvid': {'v_range': [['7.6.0', '']], 'type': 'int'},
276 'type': {'v_range': [['7.6.0', '']], 'choices': ['port', 'vap'], 'type': 'str'},
277 'vap': {'v_range': [['7.6.0', '']], 'type': 'raw'},
278 'vids': {'v_range': [['7.6.4', '']], 'type': 'raw'}
279 },
280 'elements': 'dict'
281 },
282 'traffic-split-services': {
283 'v_range': [['7.6.2', '']],
284 'type': 'list',
285 'options': {
286 'address': {'v_range': [['7.6.2', '']], 'type': 'raw'},
287 'name': {'v_range': [['7.6.2', '']], 'type': 'str'},
288 'service': {'v_range': [['7.6.2', '']], 'type': 'raw'},
289 'vsdb': {'v_range': [['7.6.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
290 },
291 'elements': 'dict'
292 }
293 }
294 }
295 }
296
297 module_option_spec = get_module_arg_spec('partial crud')
298 module_arg_spec.update(module_option_spec)
299 check_galaxy_version(module_arg_spec)
300 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'extensioncontroller_extenderprofile_lanextension'),
301 supports_check_mode=True)
302 if not module._socket_path:
303 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
304 connection = Connection(module._socket_path)
305 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
306 None, 'data', module, connection)
307 fmgr.process_partial_crud()
308 module.exit_json(meta=module.params)
309
310
311 if __name__ == '__main__':
312 main()