Adds any ip proto to virtual server module (#47779)

pull/47780/head
Tim Rupp 6 years ago committed by GitHub
parent 8edbfb488c
commit 92cf066514
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- 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)
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).
choices:
- ah
- any
- bna
- esp
- etherip
@ -629,6 +630,7 @@ security_log_profiles:
sample: ['/Common/profile1', '/Common/profile2']
'''
import os
import re
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."
)
@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
def has_message_routing_profiles(self):
if self.profiles is None:
@ -1055,19 +1070,6 @@ class ApiParameters(Parameters):
result = self._format_destination(destination.ip, destination.port, destination.route_domain)
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
def destination_tuple(self):
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)
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
def port(self):
if self._values['port'] is None:
@ -1451,9 +1440,10 @@ class ModuleParameters(Parameters):
tmp['fullPath'] = fq_name(self.partition, tmp['name'])
self._handle_clientssl_profile_nuances(tmp)
else:
tmp['name'] = profile
full_path = fq_name(self.partition, profile)
tmp['name'] = os.path.basename(profile)
tmp['context'] = 'all'
tmp['fullPath'] = fq_name(self.partition, tmp['name'])
tmp['fullPath'] = full_path
self._handle_clientssl_profile_nuances(tmp)
result.append(tmp)
mutually_exclusive = [x['name'] for x in result if x in self.profiles_mutex]
@ -2128,7 +2118,7 @@ class VirtualServerValidator(object):
# - udp
# - sctp
# - 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(
"The 'message-routing' server type does not support the specified 'ip_protocol'."
)
@ -2870,7 +2860,7 @@ class ModuleManager(object):
return True
return False
def exists(self):
def exists(self): # lgtm [py/similar-function]
uri = "https://{0}:{1}/mgmt/tm/ltm/virtual/{2}".format(
self.client.provider['server'],
self.client.provider['server_port'],
@ -3029,7 +3019,7 @@ class ArgumentSpec(object):
port_translation=dict(type='bool'),
ip_protocol=dict(
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',
'sctp', 'tcp', 'udp', 'udplite'
]

Loading…
Cancel
Save