Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_extendercontroller_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_extendercontroller_extenderprofile_lanextension
15 short_description: FortiExtender lan extension configuration.
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 extender-profile:
29 description: Deprecated, please use "extender_profile"
30 type: str
31 extender_profile:
32 description: The parameter (extender-profile) in requested url.
33 type: str
34 extendercontroller_extenderprofile_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 backhaul_interface:
60 aliases: ['backhaul-interface']
61 type: str
62 description: IPsec phase1 interface.
63 backhaul_ip:
64 aliases: ['backhaul-ip']
65 type: str
66 description: IPsec phase1 IPv4/FQDN.
67 ipsec_tunnel:
68 aliases: ['ipsec-tunnel']
69 type: str
70 description: IPsec tunnel name.
71 link_loadbalance:
72 aliases: ['link-loadbalance']
73 type: str
74 description: LAN extension link load balance strategy.
75 choices: ['activebackup', 'loadbalance']
76 '''
77
78 EXAMPLES = '''
79 - name: Example playbook (generated based on argument schema)
80 hosts: fortimanagers
81 connection: httpapi
82 gather_facts: false
83 tasks:
84 - name: FortiExtender lan extension configuration.
85 fortinet.fortimanager.fmgr_extendercontroller_extenderprofile_lanextension:
86 # workspace_locking_adom: <global or your adom name>
87 adom: <your own value>
88 extender_profile: <your own value>
89 extendercontroller_extenderprofile_lanextension:
90 # backhaul:
91 # - name: <string>
92 # port: <value in [wan, lte1, lte2, ...]>
93 # role: <value in [primary, secondary]>
94 # weight: <integer>
95 # backhaul_interface: <string>
96 # backhaul_ip: <string>
97 # ipsec_tunnel: <string>
98 # link_loadbalance: <value in [activebackup, loadbalance]>
99 '''
100
101 RETURN = '''
102 meta:
103 description: The result of the request.
104 type: dict
105 returned: always
106 contains:
107 request_url:
108 description: The full url requested.
109 returned: always
110 type: str
111 sample: /sys/login/user
112 response_code:
113 description: The status of api request.
114 returned: always
115 type: int
116 sample: 0
117 response_data:
118 description: The api response.
119 type: list
120 returned: always
121 response_message:
122 description: The descriptive message of the api response.
123 type: str
124 returned: always
125 sample: OK.
126 system_information:
127 description: The information of the target system.
128 type: dict
129 returned: always
130 rc:
131 description: The status the request.
132 type: int
133 returned: always
134 sample: 0
135 version_check_warning:
136 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
137 type: list
138 returned: complex
139 '''
140 from ansible.module_utils.basic import AnsibleModule
141 from ansible.module_utils.connection import Connection
142 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
143 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
144
145
146 def main():
147 urls_list = [
148 '/pm/config/adom/{adom}/obj/extender-controller/extender-profile/{extender-profile}/lan-extension',
149 '/pm/config/global/obj/extender-controller/extender-profile/{extender-profile}/lan-extension'
150 ]
151 module_arg_spec = {
152 'adom': {'required': True, 'type': 'str'},
153 'extender-profile': {'type': 'str', 'api_name': 'extender_profile'},
154 'extender_profile': {'type': 'str'},
155 'revision_note': {'type': 'str'},
156 'extendercontroller_extenderprofile_lanextension': {
157 'type': 'dict', 'v_range': [['7.0.2', '']],
158 'options': {
159 'backhaul': {
160 'v_range': [['7.0.2', '']],
161 'type': 'list',
162 'options': {
163 'name': {'v_range': [['7.0.2', '']], 'type': 'str'},
164 'port': {
165 'v_range': [['7.0.2', '']],
166 'choices': ['wan', 'lte1', 'lte2', 'port1', 'port2', 'port3', 'port4', 'port5', 'sfp'],
167 'type': 'str'
168 },
169 'role': {'v_range': [['7.0.2', '']], 'choices': ['primary', 'secondary'], 'type': 'str'},
170 'weight': {'v_range': [['7.0.2', '']], 'type': 'int'}
171 },
172 'elements': 'dict'
173 },
174 'backhaul-interface': {'v_range': [['7.0.2', '']], 'type': 'str'},
175 'backhaul-ip': {'v_range': [['7.0.2', '']], 'type': 'str'},
176 'ipsec-tunnel': {'v_range': [['7.0.2', '']], 'type': 'str'},
177 'link-loadbalance': {'v_range': [['7.0.2', '']], 'choices': ['activebackup', 'loadbalance'], 'type': 'str'}
178 }
179 }
180 }
181
182 module_option_spec = get_module_arg_spec('partial crud')
183 module_arg_spec.update(module_option_spec)
184 check_galaxy_version(module_arg_spec)
185 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'extendercontroller_extenderprofile_lanextension'),
186 supports_check_mode=True)
187 if not module._socket_path:
188 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
189 connection = Connection(module._socket_path)
190 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
191 None, 'data', module, connection)
192 fmgr.process_partial_crud()
193 module.exit_json(meta=module.params)
194
195
196 if __name__ == '__main__':
197 main()