mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Adds missing fields for iapp service (#26507)
The iApp service module worked fine previously, but this patch adds enhancements to it to include more fields that can be specified when creating iapp services.
This commit is contained in:
parent
deae1499ed
commit
37ca55bf71
3 changed files with 46 additions and 1 deletions
|
@ -159,7 +159,8 @@ from deepdiff import DeepDiff
|
|||
class Parameters(AnsibleF5Parameters):
|
||||
returnables = []
|
||||
api_attributes = [
|
||||
'tables', 'variables', 'template', 'lists'
|
||||
'tables', 'variables', 'template', 'lists', 'deviceGroup',
|
||||
'inheritedDevicegroup', 'inheritedTrafficGroup', 'trafficGroup'
|
||||
]
|
||||
updatables = ['tables', 'variables', 'lists']
|
||||
|
||||
|
@ -282,6 +283,14 @@ class Parameters(AnsibleF5Parameters):
|
|||
self.variables = value['variables']
|
||||
if 'lists' in value:
|
||||
self.lists = value['lists']
|
||||
if 'deviceGroup' in value:
|
||||
self.deviceGroup = value['deviceGroup']
|
||||
if 'inheritedDevicegroup' in value:
|
||||
self.inheritedDevicegroup = value['inheritedDevicegroup']
|
||||
if 'inheritedTrafficGroup' in value:
|
||||
self.inheritedTrafficGroup = value['inheritedTrafficGroup']
|
||||
if 'trafficGroup' in value:
|
||||
self.trafficGroup = value['trafficGroup']
|
||||
|
||||
@property
|
||||
def template(self):
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
"name": "http_example",
|
||||
"partition": "Common",
|
||||
"template": "/Common/f5.http",
|
||||
"inheritedDevicegroup": "true",
|
||||
"deviceGroup": "none",
|
||||
"inheritedTrafficGroup": "true",
|
||||
"trafficGroup": "/Common/traffic-group-local-only",
|
||||
"lists": [
|
||||
{
|
||||
"name": "irules__irules",
|
||||
|
|
|
@ -83,6 +83,10 @@ class TestParameters(unittest.TestCase):
|
|||
assert p.name == 'http_example'
|
||||
assert p.partition == 'Common'
|
||||
assert p.template == '/Common/f5.http'
|
||||
assert p.deviceGroup == 'none'
|
||||
assert p.inheritedTrafficGroup == 'true'
|
||||
assert p.inheritedDevicegroup == 'true'
|
||||
assert p.trafficGroup == '/Common/traffic-group-local-only'
|
||||
|
||||
def test_module_parameters_lists(self):
|
||||
args = load_fixture('create_iapp_service_parameters_f5_http.json')
|
||||
|
@ -197,6 +201,34 @@ class TestParameters(unittest.TestCase):
|
|||
assert p.tables[0]['rows'][0]['row'] == ['12.12.12.12', '80', '0']
|
||||
assert p.tables[0]['rows'][1]['row'] == ['13.13.13.13', '443', '10']
|
||||
|
||||
def test_api_parameters_device_group(self):
|
||||
args = dict(
|
||||
deviceGroup='none'
|
||||
)
|
||||
p = Parameters(args)
|
||||
assert p.deviceGroup == 'none'
|
||||
|
||||
def test_api_parameters_inherited_traffic_group(self):
|
||||
args = dict(
|
||||
inheritedTrafficGroup='true'
|
||||
)
|
||||
p = Parameters(args)
|
||||
assert p.inheritedTrafficGroup == 'true'
|
||||
|
||||
def test_api_parameters_inherited_devicegroup(self):
|
||||
args = dict(
|
||||
inheritedDevicegroup='true'
|
||||
)
|
||||
p = Parameters(args)
|
||||
assert p.inheritedDevicegroup == 'true'
|
||||
|
||||
def test_api_parameters_traffic_group(self):
|
||||
args = dict(
|
||||
trafficGroup='/Common/traffic-group-local-only'
|
||||
)
|
||||
p = Parameters(args)
|
||||
assert p.trafficGroup == '/Common/traffic-group-local-only'
|
||||
|
||||
def test_module_template_same_partition(self):
|
||||
args = dict(
|
||||
template='foo',
|
||||
|
|
Loading…
Reference in a new issue