Adds any ip proto to virtual server module (#47779)
This commit is contained in:
parent
8edbfb488c
commit
92cf066514
1 changed files with 22 additions and 32 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017 F5 Networks Inc.
|
# Copyright: (c) 2017, F5 Networks Inc.
|
||||||
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
@ -292,6 +292,7 @@ options:
|
||||||
- When C(type) is C(dhcp), this module will force the C(ip_protocol) parameter to be C(17) (UDP).
|
- When C(type) is C(dhcp), this module will force the C(ip_protocol) parameter to be C(17) (UDP).
|
||||||
choices:
|
choices:
|
||||||
- ah
|
- ah
|
||||||
|
- any
|
||||||
- bna
|
- bna
|
||||||
- esp
|
- esp
|
||||||
- etherip
|
- etherip
|
||||||
|
@ -629,6 +630,7 @@ security_log_profiles:
|
||||||
sample: ['/Common/profile1', '/Common/profile2']
|
sample: ['/Common/profile1', '/Common/profile2']
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
@ -880,6 +882,19 @@ class Parameters(AnsibleF5Parameters):
|
||||||
"Specified ip_protocol was neither a number nor in the list of common protocols."
|
"Specified ip_protocol was neither a number nor in the list of common protocols."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def source(self):
|
||||||
|
if self._values['source'] is None:
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
addr = ip_interface(u'{0}'.format(self._values['source']))
|
||||||
|
result = '{0}/{1}'.format(str(addr.ip), addr.network.prefixlen)
|
||||||
|
return result
|
||||||
|
except ValueError:
|
||||||
|
raise F5ModuleError(
|
||||||
|
"The source IP address must be specified in CIDR format: address/prefix"
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_message_routing_profiles(self):
|
def has_message_routing_profiles(self):
|
||||||
if self.profiles is None:
|
if self.profiles is None:
|
||||||
|
@ -1055,19 +1070,6 @@ class ApiParameters(Parameters):
|
||||||
result = self._format_destination(destination.ip, destination.port, destination.route_domain)
|
result = self._format_destination(destination.ip, destination.port, destination.route_domain)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@property
|
|
||||||
def source(self):
|
|
||||||
if self._values['source'] is None:
|
|
||||||
return None
|
|
||||||
try:
|
|
||||||
addr = ip_interface(u'{0}'.format(self._values['source']))
|
|
||||||
result = '{0}/{1}'.format(str(addr.ip), addr.network.prefixlen)
|
|
||||||
return result
|
|
||||||
except ValueError:
|
|
||||||
raise F5ModuleError(
|
|
||||||
"The source IP address must be specified in CIDR format: address/prefix"
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def destination_tuple(self):
|
def destination_tuple(self):
|
||||||
Destination = namedtuple('Destination', ['ip', 'port', 'route_domain'])
|
Destination = namedtuple('Destination', ['ip', 'port', 'route_domain'])
|
||||||
|
@ -1397,19 +1399,6 @@ class ModuleParameters(Parameters):
|
||||||
result = Destination(ip=addr, port=self.port, route_domain=self.route_domain)
|
result = Destination(ip=addr, port=self.port, route_domain=self.route_domain)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@property
|
|
||||||
def source(self):
|
|
||||||
if self._values['source'] is None:
|
|
||||||
return None
|
|
||||||
try:
|
|
||||||
addr = ip_interface(u'{0}'.format(self._values['source']))
|
|
||||||
result = '{0}/{1}'.format(str(addr.ip), addr.network.prefixlen)
|
|
||||||
return result
|
|
||||||
except ValueError:
|
|
||||||
raise F5ModuleError(
|
|
||||||
"The source IP address must be specified in CIDR format: address/prefix"
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def port(self):
|
def port(self):
|
||||||
if self._values['port'] is None:
|
if self._values['port'] is None:
|
||||||
|
@ -1451,9 +1440,10 @@ class ModuleParameters(Parameters):
|
||||||
tmp['fullPath'] = fq_name(self.partition, tmp['name'])
|
tmp['fullPath'] = fq_name(self.partition, tmp['name'])
|
||||||
self._handle_clientssl_profile_nuances(tmp)
|
self._handle_clientssl_profile_nuances(tmp)
|
||||||
else:
|
else:
|
||||||
tmp['name'] = profile
|
full_path = fq_name(self.partition, profile)
|
||||||
|
tmp['name'] = os.path.basename(profile)
|
||||||
tmp['context'] = 'all'
|
tmp['context'] = 'all'
|
||||||
tmp['fullPath'] = fq_name(self.partition, tmp['name'])
|
tmp['fullPath'] = full_path
|
||||||
self._handle_clientssl_profile_nuances(tmp)
|
self._handle_clientssl_profile_nuances(tmp)
|
||||||
result.append(tmp)
|
result.append(tmp)
|
||||||
mutually_exclusive = [x['name'] for x in result if x in self.profiles_mutex]
|
mutually_exclusive = [x['name'] for x in result if x in self.profiles_mutex]
|
||||||
|
@ -2128,7 +2118,7 @@ class VirtualServerValidator(object):
|
||||||
# - udp
|
# - udp
|
||||||
# - sctp
|
# - sctp
|
||||||
# - all protocols
|
# - all protocols
|
||||||
if self.want.ip_protocol not in [6, 17, 132, 'all']:
|
if self.want.ip_protocol not in [6, 17, 132, 'all', 'any']:
|
||||||
raise F5ModuleError(
|
raise F5ModuleError(
|
||||||
"The 'message-routing' server type does not support the specified 'ip_protocol'."
|
"The 'message-routing' server type does not support the specified 'ip_protocol'."
|
||||||
)
|
)
|
||||||
|
@ -2870,7 +2860,7 @@ class ModuleManager(object):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def exists(self):
|
def exists(self): # lgtm [py/similar-function]
|
||||||
uri = "https://{0}:{1}/mgmt/tm/ltm/virtual/{2}".format(
|
uri = "https://{0}:{1}/mgmt/tm/ltm/virtual/{2}".format(
|
||||||
self.client.provider['server'],
|
self.client.provider['server'],
|
||||||
self.client.provider['server_port'],
|
self.client.provider['server_port'],
|
||||||
|
@ -3029,7 +3019,7 @@ class ArgumentSpec(object):
|
||||||
port_translation=dict(type='bool'),
|
port_translation=dict(type='bool'),
|
||||||
ip_protocol=dict(
|
ip_protocol=dict(
|
||||||
choices=[
|
choices=[
|
||||||
'ah', 'bna', 'esp', 'etherip', 'gre', 'icmp', 'ipencap', 'ipv6',
|
'ah', 'any', 'bna', 'esp', 'etherip', 'gre', 'icmp', 'ipencap', 'ipv6',
|
||||||
'ipv6-auth', 'ipv6-crypt', 'ipv6-icmp', 'isp-ip', 'mux', 'ospf',
|
'ipv6-auth', 'ipv6-crypt', 'ipv6-icmp', 'isp-ip', 'mux', 'ospf',
|
||||||
'sctp', 'tcp', 'udp', 'udplite'
|
'sctp', 'tcp', 'udp', 'udplite'
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue