Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_switchcontroller_dsl_policy.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_switchcontroller_dsl_policy
15 short_description: DSL policy.
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 switchcontroller_dsl_policy:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 append_padding:
34 type: str
35 description: Device pause frame configuration.
36 choices: ['disable', 'enable']
37 cpe_aele:
38 aliases: ['cpe-aele']
39 type: str
40 description: Cpe AELE.
41 choices: ['disable', 'enable']
42 cpe_aele_mode:
43 aliases: ['cpe-aele-mode']
44 type: str
45 description: Cpe AELE-Mode with given string.
46 choices: ['ELE_M0', 'ELE_DS', 'ELE_PB', 'ELE_MIN']
47 cs:
48 type: list
49 elements: str
50 description: CPE carrier set.
51 choices: ['A43', 'B43', 'A43C', 'V43']
52 ds_bitswap:
53 aliases: ['ds-bitswap']
54 type: str
55 description: Enable/disable bitswap.
56 choices: ['disable', 'enable']
57 name:
58 type: str
59 description: Policy name.
60 required: true
61 pause_frame:
62 aliases: ['pause-frame']
63 type: str
64 description: Device pause frame configuration.
65 choices: ['disable', 'enable']
66 profile:
67 type: str
68 description: Vdsl CPE profile.
69 choices: ['auto-30a', 'auto-17a', 'auto-12ab']
70 type:
71 type: str
72 description: Type.
73 choices: ['Procend', 'Proscend']
74 us_bitswap:
75 aliases: ['us-bitswap']
76 type: str
77 description: Enable/disable bitswap.
78 choices: ['disable', 'enable']
79 '''
80
81 EXAMPLES = '''
82 - name: Example playbook (generated based on argument schema)
83 hosts: fortimanagers
84 connection: httpapi
85 gather_facts: false
86 tasks:
87 - name: DSL policy.
88 fortinet.fortimanager.fmgr_switchcontroller_dsl_policy:
89 # workspace_locking_adom: <global or your adom name>
90 adom: <your own value>
91 state: present # <value in [present, absent]>
92 switchcontroller_dsl_policy:
93 name: "your value" # Required variable, string
94 # append_padding: <value in [disable, enable]>
95 # cpe_aele: <value in [disable, enable]>
96 # cpe_aele_mode: <value in [ELE_M0, ELE_DS, ELE_PB, ...]>
97 # cs: ["A43", "B43", "A43C", "V43"]
98 # ds_bitswap: <value in [disable, enable]>
99 # pause_frame: <value in [disable, enable]>
100 # profile: <value in [auto-30a, auto-17a, auto-12ab]>
101 # type: <value in [Procend, Proscend]>
102 # us_bitswap: <value in [disable, enable]>
103 '''
104
105 RETURN = '''
106 meta:
107 description: The result of the request.
108 type: dict
109 returned: always
110 contains:
111 request_url:
112 description: The full url requested.
113 returned: always
114 type: str
115 sample: /sys/login/user
116 response_code:
117 description: The status of api request.
118 returned: always
119 type: int
120 sample: 0
121 response_data:
122 description: The api response.
123 type: list
124 returned: always
125 response_message:
126 description: The descriptive message of the api response.
127 type: str
128 returned: always
129 sample: OK.
130 system_information:
131 description: The information of the target system.
132 type: dict
133 returned: always
134 rc:
135 description: The status the request.
136 type: int
137 returned: always
138 sample: 0
139 version_check_warning:
140 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
141 type: list
142 returned: complex
143 '''
144 from ansible.module_utils.basic import AnsibleModule
145 from ansible.module_utils.connection import Connection
146 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
147 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
148
149
150 def main():
151 urls_list = [
152 '/pm/config/adom/{adom}/obj/switch-controller/dsl/policy',
153 '/pm/config/global/obj/switch-controller/dsl/policy'
154 ]
155 module_arg_spec = {
156 'adom': {'required': True, 'type': 'str'},
157 'revision_note': {'type': 'str'},
158 'switchcontroller_dsl_policy': {
159 'type': 'dict', 'v_range': [['7.0.3', '']],
160 'options': {
161 'append_padding': {'v_range': [['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
162 'cpe-aele': {'v_range': [['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
163 'cpe-aele-mode': {'v_range': [['7.0.3', '']], 'choices': ['ELE_M0', 'ELE_DS', 'ELE_PB', 'ELE_MIN'], 'type': 'str'},
164 'cs': {'v_range': [['7.0.3', '']], 'type': 'list', 'choices': ['A43', 'B43', 'A43C', 'V43'], 'elements': 'str'},
165 'ds-bitswap': {'v_range': [['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
166 'name': {'v_range': [['7.0.3', '']], 'required': True, 'type': 'str'},
167 'pause-frame': {'v_range': [['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
168 'profile': {'v_range': [['7.0.3', '']], 'choices': ['auto-30a', 'auto-17a', 'auto-12ab'], 'type': 'str'},
169 'type': {'v_range': [['7.0.3', '']], 'choices': ['Procend', 'Proscend'], 'type': 'str'},
170 'us-bitswap': {'v_range': [['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
171 }
172 }
173 }
174
175 module_option_spec = get_module_arg_spec('full crud')
176 module_arg_spec.update(module_option_spec)
177 check_galaxy_version(module_arg_spec)
178 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'switchcontroller_dsl_policy'),
179 supports_check_mode=True)
180 if not module._socket_path:
181 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
182 connection = Connection(module._socket_path)
183 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
184 'name', 'data', module, connection)
185 fmgr.process_crud()
186 module.exit_json(meta=module.params)
187
188
189 if __name__ == '__main__':
190 main()