mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Various f5 modules fixes (#40037)
* Add members to bigip_gtm_pool * Add monitors to bigip_gtm_pool * Add availability_requirements to bigip_gtm_pool * Refactor bigip_gtm_pool * Normalize the product value returned by gtm facts * Corrected various documentation * Updated various F5 coding conventions * Add partition to bigip_static_route * Added more unit tests
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"kind": "tm:gtm:pool:a:astate",
|
||||
"name": "foo",
|
||||
"partition": "Common",
|
||||
"fullPath": "/Common/foo",
|
||||
"generation": 142,
|
||||
"selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo?expandSubcollections=true&ver=12.0.0",
|
||||
"alternateMode": "round-robin",
|
||||
"dynamicRatio": "disabled",
|
||||
"enabled": true,
|
||||
"fallbackIp": "any",
|
||||
"fallbackMode": "return-to-dns",
|
||||
"limitMaxBps": 0,
|
||||
"limitMaxBpsStatus": "disabled",
|
||||
"limitMaxConnections": 0,
|
||||
"limitMaxConnectionsStatus": "disabled",
|
||||
"limitMaxPps": 0,
|
||||
"limitMaxPpsStatus": "disabled",
|
||||
"loadBalancingMode": "round-robin",
|
||||
"manualResume": "disabled",
|
||||
"maxAnswersReturned": 1,
|
||||
"monitor": "default",
|
||||
"qosHitRatio": 5,
|
||||
"qosHops": 0,
|
||||
"qosKilobytesSecond": 3,
|
||||
"qosLcs": 30,
|
||||
"qosPacketRate": 1,
|
||||
"qosRtt": 50,
|
||||
"qosTopology": 0,
|
||||
"qosVsCapacity": 0,
|
||||
"qosVsScore": 0,
|
||||
"ttl": 30,
|
||||
"verifyMemberAvailability": "enabled",
|
||||
"membersReference": {
|
||||
"link": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo/members?ver=12.0.0",
|
||||
"isSubcollection": true,
|
||||
"items": [
|
||||
{
|
||||
"kind": "tm:gtm:pool:a:members:membersstate",
|
||||
"name": "server1:vs1",
|
||||
"partition": "Common",
|
||||
"fullPath": "/Common/server1:vs1",
|
||||
"generation": 141,
|
||||
"selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo/members/~Common~server1:vs1?ver=12.0.0",
|
||||
"enabled": true,
|
||||
"limitMaxBps": 0,
|
||||
"limitMaxBpsStatus": "disabled",
|
||||
"limitMaxConnections": 0,
|
||||
"limitMaxConnectionsStatus": "disabled",
|
||||
"limitMaxPps": 0,
|
||||
"limitMaxPpsStatus": "disabled",
|
||||
"memberOrder": 0,
|
||||
"monitor": "default",
|
||||
"ratio": 1
|
||||
},
|
||||
{
|
||||
"kind": "tm:gtm:pool:a:members:membersstate",
|
||||
"name": "server1:vs2",
|
||||
"partition": "Common",
|
||||
"fullPath": "/Common/server1:vs2",
|
||||
"generation": 142,
|
||||
"selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo/members/~Common~server1:vs1?ver=12.0.0",
|
||||
"enabled": true,
|
||||
"limitMaxBps": 0,
|
||||
"limitMaxBpsStatus": "disabled",
|
||||
"limitMaxConnections": 0,
|
||||
"limitMaxConnectionsStatus": "disabled",
|
||||
"limitMaxPps": 0,
|
||||
"limitMaxPpsStatus": "disabled",
|
||||
"memberOrder": 1,
|
||||
"monitor": "/Common/tcp ",
|
||||
"ratio": 1
|
||||
},
|
||||
{
|
||||
"kind": "tm:gtm:pool:a:members:membersstate",
|
||||
"name": "server1:vs3",
|
||||
"partition": "Common",
|
||||
"fullPath": "/Common/server1:vs3",
|
||||
"generation": 141,
|
||||
"selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo/members/~Common~server1:vs3?ver=12.0.0",
|
||||
"enabled": true,
|
||||
"limitMaxBps": 0,
|
||||
"limitMaxBpsStatus": "disabled",
|
||||
"limitMaxConnections": 0,
|
||||
"limitMaxConnectionsStatus": "disabled",
|
||||
"limitMaxPps": 0,
|
||||
"limitMaxPpsStatus": "disabled",
|
||||
"memberOrder": 2,
|
||||
"monitor": "default",
|
||||
"ratio": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -20,17 +20,19 @@ from ansible.compat.tests.mock import patch
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from library.bigip_gtm_pool import Parameters
|
||||
from library.bigip_gtm_pool import ModuleManager
|
||||
from library.bigip_gtm_pool import ArgumentSpec
|
||||
from library.bigip_gtm_pool import UntypedManager
|
||||
from library.bigip_gtm_pool import TypedManager
|
||||
from library.modules.bigip_gtm_pool import ApiParameters
|
||||
from library.modules.bigip_gtm_pool import ModuleParameters
|
||||
from library.modules.bigip_gtm_pool import ModuleManager
|
||||
from library.modules.bigip_gtm_pool import ArgumentSpec
|
||||
from library.modules.bigip_gtm_pool import UntypedManager
|
||||
from library.modules.bigip_gtm_pool import TypedManager
|
||||
from library.module_utils.network.f5.common import F5ModuleError
|
||||
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
||||
from test.unit.modules.utils import set_module_args
|
||||
except ImportError:
|
||||
try:
|
||||
from ansible.modules.network.f5.bigip_gtm_pool import Parameters
|
||||
from ansible.modules.network.f5.bigip_gtm_pool import ApiParameters
|
||||
from ansible.modules.network.f5.bigip_gtm_pool import ModuleParameters
|
||||
from ansible.modules.network.f5.bigip_gtm_pool import ModuleManager
|
||||
from ansible.modules.network.f5.bigip_gtm_pool import ArgumentSpec
|
||||
from ansible.modules.network.f5.bigip_gtm_pool import UntypedManager
|
||||
@@ -73,7 +75,7 @@ class TestParameters(unittest.TestCase):
|
||||
fallback_ip='10.10.10.10',
|
||||
type='a'
|
||||
)
|
||||
p = Parameters(params=args)
|
||||
p = ModuleParameters(params=args)
|
||||
assert p.name == 'foo'
|
||||
assert p.preferred_lb_method == 'topology'
|
||||
assert p.alternate_lb_method == 'ratio'
|
||||
@@ -81,6 +83,20 @@ class TestParameters(unittest.TestCase):
|
||||
assert p.fallback_ip == '10.10.10.10'
|
||||
assert p.type == 'a'
|
||||
|
||||
def test_module_parameters_members(self):
|
||||
args = dict(
|
||||
partition='Common',
|
||||
members=[
|
||||
dict(
|
||||
server='foo',
|
||||
virtual_server='bar'
|
||||
)
|
||||
]
|
||||
)
|
||||
p = ModuleParameters(params=args)
|
||||
assert len(p.members) == 1
|
||||
assert p.members[0] == '/Common/foo:bar'
|
||||
|
||||
def test_api_parameters(self):
|
||||
args = dict(
|
||||
name='foo',
|
||||
@@ -89,13 +105,21 @@ class TestParameters(unittest.TestCase):
|
||||
fallbackMode='fewest-hops',
|
||||
fallbackIp='10.10.10.10'
|
||||
)
|
||||
p = Parameters(params=args)
|
||||
p = ApiParameters(params=args)
|
||||
assert p.name == 'foo'
|
||||
assert p.preferred_lb_method == 'topology'
|
||||
assert p.alternate_lb_method == 'ratio'
|
||||
assert p.fallback_lb_method == 'fewest-hops'
|
||||
assert p.fallback_ip == '10.10.10.10'
|
||||
|
||||
def test_api_parameters_members(self):
|
||||
args = load_fixture('load_gtm_pool_a_with_members_1.json')
|
||||
p = ApiParameters(params=args)
|
||||
assert len(p.members) == 3
|
||||
assert p.members[0] == '/Common/server1:vs1'
|
||||
assert p.members[1] == '/Common/server1:vs2'
|
||||
assert p.members[2] == '/Common/server1:vs3'
|
||||
|
||||
|
||||
class TestUntypedManager(unittest.TestCase):
|
||||
|
||||
@@ -148,7 +172,7 @@ class TestUntypedManager(unittest.TestCase):
|
||||
supports_check_mode=self.spec.supports_check_mode
|
||||
)
|
||||
|
||||
current = Parameters(params=load_fixture('load_gtm_pool_untyped_default.json'))
|
||||
current = ApiParameters(params=load_fixture('load_gtm_pool_untyped_default.json'))
|
||||
|
||||
# Override methods in the specific type of manager
|
||||
tm = UntypedManager(module=module)
|
||||
@@ -252,7 +276,7 @@ class TestTypedManager(unittest.TestCase):
|
||||
supports_check_mode=self.spec.supports_check_mode
|
||||
)
|
||||
|
||||
current = Parameters(params=load_fixture('load_gtm_pool_a_default.json'))
|
||||
current = ApiParameters(params=load_fixture('load_gtm_pool_a_default.json'))
|
||||
|
||||
# Override methods in the specific type of manager
|
||||
tm = TypedManager(module=module)
|
||||
|
||||
@@ -20,15 +20,17 @@ from ansible.compat.tests.mock import patch
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from library.bigip_hostname import Parameters
|
||||
from library.bigip_hostname import ModuleManager
|
||||
from library.bigip_hostname import ArgumentSpec
|
||||
from library.modules.bigip_hostname import ApiParameters
|
||||
from library.modules.bigip_hostname import ModuleParameters
|
||||
from library.modules.bigip_hostname import ModuleManager
|
||||
from library.modules.bigip_hostname import ArgumentSpec
|
||||
from library.module_utils.network.f5.common import F5ModuleError
|
||||
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
||||
from test.unit.modules.utils import set_module_args
|
||||
except ImportError:
|
||||
try:
|
||||
from ansible.modules.network.f5.bigip_hostname import Parameters
|
||||
from ansible.modules.network.f5.bigip_hostname import ApiParameters
|
||||
from ansible.modules.network.f5.bigip_hostname import ModuleParameters
|
||||
from ansible.modules.network.f5.bigip_hostname import ModuleManager
|
||||
from ansible.modules.network.f5.bigip_hostname import ArgumentSpec
|
||||
from ansible.module_utils.network.f5.common import F5ModuleError
|
||||
@@ -64,7 +66,7 @@ class TestParameters(unittest.TestCase):
|
||||
args = dict(
|
||||
hostname='foo.internal.com'
|
||||
)
|
||||
p = Parameters(params=args)
|
||||
p = ModuleParameters(params=args)
|
||||
assert p.hostname == 'foo.internal.com'
|
||||
|
||||
|
||||
@@ -83,8 +85,8 @@ class TestManager(unittest.TestCase):
|
||||
|
||||
# Configure the parameters that would be returned by querying the
|
||||
# remote device
|
||||
current = Parameters(
|
||||
dict(
|
||||
current = ApiParameters(
|
||||
params=dict(
|
||||
hostname='foo.internal.com'
|
||||
)
|
||||
)
|
||||
|
||||
@@ -20,9 +20,9 @@ from ansible.compat.tests.mock import patch
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from library.bigip_iapp_service import Parameters
|
||||
from library.bigip_iapp_service import ModuleManager
|
||||
from library.bigip_iapp_service import ArgumentSpec
|
||||
from library.modules.bigip_iapp_service import Parameters
|
||||
from library.modules.bigip_iapp_service import ModuleManager
|
||||
from library.modules.bigip_iapp_service import ArgumentSpec
|
||||
from library.module_utils.network.f5.common import F5ModuleError
|
||||
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
||||
from test.unit.modules.utils import set_module_args
|
||||
|
||||
@@ -20,9 +20,9 @@ from ansible.compat.tests.mock import patch
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from library.bigip_iapp_template import Parameters
|
||||
from library.bigip_iapp_template import ModuleManager
|
||||
from library.bigip_iapp_template import ArgumentSpec
|
||||
from library.modules.bigip_iapp_template import Parameters
|
||||
from library.modules.bigip_iapp_template import ModuleManager
|
||||
from library.modules.bigip_iapp_template import ArgumentSpec
|
||||
from library.module_utils.network.f5.common import F5ModuleError
|
||||
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
||||
from test.unit.modules.utils import set_module_args
|
||||
|
||||
@@ -20,9 +20,9 @@ from ansible.compat.tests.mock import patch
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from library.bigip_iapp_template import Parameters
|
||||
from library.bigip_iapp_template import ModuleManager
|
||||
from library.bigip_iapp_template import ArgumentSpec
|
||||
from library.modules.bigip_iapp_template import Parameters
|
||||
from library.modules.bigip_iapp_template import ModuleManager
|
||||
from library.modules.bigip_iapp_template import ArgumentSpec
|
||||
from library.module_utils.network.f5.common import F5ModuleError
|
||||
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
||||
from test.unit.modules.utils import set_module_args
|
||||
|
||||
Reference in New Issue
Block a user