| 1 |
|
| 2 |
from __future__ import absolute_import, division, print_function |
| 3 |
|
| 4 |
|
| 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_firewall_gtp_ievalidation |
| 15 |
short_description: IE validation. |
| 16 |
version_added: "2.0.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 |
gtp: |
| 29 |
description: The parameter (gtp) in requested url. |
| 30 |
type: str |
| 31 |
required: true |
| 32 |
firewall_gtp_ievalidation: |
| 33 |
description: The top level parameters set. |
| 34 |
required: false |
| 35 |
type: dict |
| 36 |
suboptions: |
| 37 |
apn_restriction: |
| 38 |
aliases: ['apn-restriction'] |
| 39 |
type: str |
| 40 |
description: Validate APN restriction. |
| 41 |
choices: ['disable', 'enable'] |
| 42 |
charging_ID: |
| 43 |
aliases: ['charging-ID'] |
| 44 |
type: str |
| 45 |
description: Validate charging ID. |
| 46 |
choices: ['disable', 'enable'] |
| 47 |
charging_gateway_addr: |
| 48 |
aliases: ['charging-gateway-addr'] |
| 49 |
type: str |
| 50 |
description: Validate charging gateway address. |
| 51 |
choices: ['disable', 'enable'] |
| 52 |
end_user_addr: |
| 53 |
aliases: ['end-user-addr'] |
| 54 |
type: str |
| 55 |
description: Validate end user address. |
| 56 |
choices: ['disable', 'enable'] |
| 57 |
gsn_addr: |
| 58 |
aliases: ['gsn-addr'] |
| 59 |
type: str |
| 60 |
description: Validate GSN address. |
| 61 |
choices: ['disable', 'enable'] |
| 62 |
imei: |
| 63 |
type: str |
| 64 |
description: Validate IMEI |
| 65 |
choices: ['disable', 'enable'] |
| 66 |
imsi: |
| 67 |
type: str |
| 68 |
description: Validate IMSI. |
| 69 |
choices: ['disable', 'enable'] |
| 70 |
mm_context: |
| 71 |
aliases: ['mm-context'] |
| 72 |
type: str |
| 73 |
description: Validate MM context. |
| 74 |
choices: ['disable', 'enable'] |
| 75 |
ms_tzone: |
| 76 |
aliases: ['ms-tzone'] |
| 77 |
type: str |
| 78 |
description: Validate MS time zone. |
| 79 |
choices: ['disable', 'enable'] |
| 80 |
ms_validated: |
| 81 |
aliases: ['ms-validated'] |
| 82 |
type: str |
| 83 |
description: Validate MS validated. |
| 84 |
choices: ['disable', 'enable'] |
| 85 |
msisdn: |
| 86 |
type: str |
| 87 |
description: Validate MSISDN. |
| 88 |
choices: ['disable', 'enable'] |
| 89 |
nsapi: |
| 90 |
type: str |
| 91 |
description: Validate NSAPI. |
| 92 |
choices: ['disable', 'enable'] |
| 93 |
pdp_context: |
| 94 |
aliases: ['pdp-context'] |
| 95 |
type: str |
| 96 |
description: Validate PDP context. |
| 97 |
choices: ['disable', 'enable'] |
| 98 |
qos_profile: |
| 99 |
aliases: ['qos-profile'] |
| 100 |
type: str |
| 101 |
description: Validate Quality of Service |
| 102 |
choices: ['disable', 'enable'] |
| 103 |
rai: |
| 104 |
type: str |
| 105 |
description: Validate RAI. |
| 106 |
choices: ['disable', 'enable'] |
| 107 |
rat_type: |
| 108 |
aliases: ['rat-type'] |
| 109 |
type: str |
| 110 |
description: Validate RAT type. |
| 111 |
choices: ['disable', 'enable'] |
| 112 |
reordering_required: |
| 113 |
aliases: ['reordering-required'] |
| 114 |
type: str |
| 115 |
description: Validate re-ordering required. |
| 116 |
choices: ['disable', 'enable'] |
| 117 |
selection_mode: |
| 118 |
aliases: ['selection-mode'] |
| 119 |
type: str |
| 120 |
description: Validate selection mode. |
| 121 |
choices: ['disable', 'enable'] |
| 122 |
uli: |
| 123 |
type: str |
| 124 |
description: Validate user location information. |
| 125 |
choices: ['disable', 'enable'] |
| 126 |
''' |
| 127 |
|
| 128 |
EXAMPLES = ''' |
| 129 |
- name: Example playbook (generated based on argument schema) |
| 130 |
hosts: fortimanagers |
| 131 |
connection: httpapi |
| 132 |
gather_facts: false |
| 133 |
tasks: |
| 134 |
- name: IE validation. |
| 135 |
fortinet.fortimanager.fmgr_firewall_gtp_ievalidation: |
| 136 |
# workspace_locking_adom: <global or your adom name> |
| 137 |
adom: <your own value> |
| 138 |
gtp: <your own value> |
| 139 |
firewall_gtp_ievalidation: |
| 140 |
# apn_restriction: <value in [disable, enable]> |
| 141 |
# charging_ID: <value in [disable, enable]> |
| 142 |
# charging_gateway_addr: <value in [disable, enable]> |
| 143 |
# end_user_addr: <value in [disable, enable]> |
| 144 |
# gsn_addr: <value in [disable, enable]> |
| 145 |
# imei: <value in [disable, enable]> |
| 146 |
# imsi: <value in [disable, enable]> |
| 147 |
# mm_context: <value in [disable, enable]> |
| 148 |
# ms_tzone: <value in [disable, enable]> |
| 149 |
# ms_validated: <value in [disable, enable]> |
| 150 |
# msisdn: <value in [disable, enable]> |
| 151 |
# nsapi: <value in [disable, enable]> |
| 152 |
# pdp_context: <value in [disable, enable]> |
| 153 |
# qos_profile: <value in [disable, enable]> |
| 154 |
# rai: <value in [disable, enable]> |
| 155 |
# rat_type: <value in [disable, enable]> |
| 156 |
# reordering_required: <value in [disable, enable]> |
| 157 |
# selection_mode: <value in [disable, enable]> |
| 158 |
# uli: <value in [disable, enable]> |
| 159 |
''' |
| 160 |
|
| 161 |
RETURN = ''' |
| 162 |
meta: |
| 163 |
description: The result of the request. |
| 164 |
type: dict |
| 165 |
returned: always |
| 166 |
contains: |
| 167 |
request_url: |
| 168 |
description: The full url requested. |
| 169 |
returned: always |
| 170 |
type: str |
| 171 |
sample: /sys/login/user |
| 172 |
response_code: |
| 173 |
description: The status of api request. |
| 174 |
returned: always |
| 175 |
type: int |
| 176 |
sample: 0 |
| 177 |
response_data: |
| 178 |
description: The api response. |
| 179 |
type: list |
| 180 |
returned: always |
| 181 |
response_message: |
| 182 |
description: The descriptive message of the api response. |
| 183 |
type: str |
| 184 |
returned: always |
| 185 |
sample: OK. |
| 186 |
system_information: |
| 187 |
description: The information of the target system. |
| 188 |
type: dict |
| 189 |
returned: always |
| 190 |
rc: |
| 191 |
description: The status the request. |
| 192 |
type: int |
| 193 |
returned: always |
| 194 |
sample: 0 |
| 195 |
version_check_warning: |
| 196 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 197 |
type: list |
| 198 |
returned: complex |
| 199 |
''' |
| 200 |
from ansible.module_utils.basic import AnsibleModule |
| 201 |
from ansible.module_utils.connection import Connection |
| 202 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 203 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 204 |
|
| 205 |
|
| 206 |
def main(): |
| 207 |
urls_list = [ |
| 208 |
'/pm/config/adom/{adom}/obj/firewall/gtp/{gtp}/ie-validation', |
| 209 |
'/pm/config/global/obj/firewall/gtp/{gtp}/ie-validation' |
| 210 |
] |
| 211 |
module_arg_spec = { |
| 212 |
'adom': {'required': True, 'type': 'str'}, |
| 213 |
'gtp': {'required': True, 'type': 'str'}, |
| 214 |
'revision_note': {'type': 'str'}, |
| 215 |
'firewall_gtp_ievalidation': { |
| 216 |
'type': 'dict', 'v_range': [['6.0.0', '']], |
| 217 |
'options': { |
| 218 |
'apn-restriction': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 219 |
'charging-ID': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 220 |
'charging-gateway-addr': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 221 |
'end-user-addr': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 222 |
'gsn-addr': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 223 |
'imei': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 224 |
'imsi': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 225 |
'mm-context': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 226 |
'ms-tzone': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 227 |
'ms-validated': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 228 |
'msisdn': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 229 |
'nsapi': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 230 |
'pdp-context': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 231 |
'qos-profile': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 232 |
'rai': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 233 |
'rat-type': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 234 |
'reordering-required': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 235 |
'selection-mode': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 236 |
'uli': {'choices': ['disable', 'enable'], 'type': 'str'} |
| 237 |
} |
| 238 |
} |
| 239 |
} |
| 240 |
|
| 241 |
module_option_spec = get_module_arg_spec('partial crud') |
| 242 |
module_arg_spec.update(module_option_spec) |
| 243 |
check_galaxy_version(module_arg_spec) |
| 244 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_gtp_ievalidation'), |
| 245 |
supports_check_mode=True) |
| 246 |
if not module._socket_path: |
| 247 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 248 |
connection = Connection(module._socket_path) |
| 249 |
fmgr = NAPIManager('partial crud', module_arg_spec, urls_list, |
| 250 |
None, 'data', module, connection) |
| 251 |
fmgr.process_partial_crud() |
| 252 |
module.exit_json(meta=module.params) |
| 253 |
|
| 254 |
|
| 255 |
if __name__ == '__main__': |
| 256 |
main() |