BIGIP: Bugfix.multiple modules 3 (#53969)

* Moving comparision functions to compare.py from common.py

* Refactors main() function and module manager in multiple modules in line with recent changes
Adds variable types to docs
Refactors unit tests to remove deprecated parameters
This commit is contained in:
Wojciech Wypior 2019-03-19 06:03:47 +01:00 committed by Tim Rupp
parent 284565c39e
commit 9744ef80a0
12 changed files with 229 additions and 168 deletions

View file

@ -23,39 +23,46 @@ options:
name: name:
description: description:
- Specifies the name of the monitor. - Specifies the name of the monitor.
type: str
required: True required: True
parent: parent:
description: description:
- The parent template of this monitor template. Once this value has - The parent template of this monitor template. Once this value has
been set, it cannot be changed. By default, this value is the C(http) been set, it cannot be changed. By default, this value is the C(http)
parent on the C(Common) partition. parent on the C(Common) partition.
type: str
default: "/Common/external" default: "/Common/external"
arguments: arguments:
description: description:
- Specifies any command-line arguments that the script requires. - Specifies any command-line arguments that the script requires.
type: str
ip: ip:
description: description:
- IP address part of the IP/port definition. If this parameter is not - IP address part of the IP/port definition. If this parameter is not
provided when creating a new monitor, then the default value will be provided when creating a new monitor, then the default value will be
'*'. '*'.
type: str
port: port:
description: description:
- Port address part of the IP/port definition. If this parameter is not - Port address part of the IP/port definition. If this parameter is not
provided when creating a new monitor, then the default value will be provided when creating a new monitor, then the default value will be
'*'. Note that if specifying an IP address, a value between 1 and 65535 '*'. Note that if specifying an IP address, a value between 1 and 65535
must be specified. must be specified.
type: str
external_program: external_program:
description: description:
- Specifies the name of the file for the monitor to use. In order to reference - Specifies the name of the file for the monitor to use. In order to reference
a file, you must first import it using options on the System > File Management > External a file, you must first import it using options on the System > File Management > External
Monitor Program File List > Import screen. The BIG-IP system automatically Monitor Program File List > Import screen. The BIG-IP system automatically
places the file in the proper location on the file system. places the file in the proper location on the file system.
type: str
interval: interval:
description: description:
- The interval specifying how frequently the monitor instance of this - The interval specifying how frequently the monitor instance of this
template will run. If this parameter is not provided when creating template will run. If this parameter is not provided when creating
a new monitor, then the default value will be 30. This value B(must) a new monitor, then the default value will be 30. This value B(must)
be less than the C(timeout) value. be less than the C(timeout) value.
type: int
timeout: timeout:
description: description:
- The number of seconds in which the node or service must respond to - The number of seconds in which the node or service must respond to
@ -65,22 +72,26 @@ options:
number to any number you want, however, it should be 3 times the number to any number you want, however, it should be 3 times the
interval number of seconds plus 1 second. If this parameter is not interval number of seconds plus 1 second. If this parameter is not
provided when creating a new monitor, then the default value will be 120. provided when creating a new monitor, then the default value will be 120.
type: int
variables: variables:
description: description:
- Specifies any variables that the script requires. - Specifies any variables that the script requires.
- Note that double quotes in values will be suppressed. - Note that double quotes in values will be suppressed.
type: dict
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the monitor exists. - When C(present), ensures that the monitor exists.
- When C(absent), ensures the monitor is removed. - When C(absent), ensures the monitor is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -162,26 +173,20 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
from library.module_utils.network.f5.common import fq_name from library.module_utils.network.f5.common import fq_name
from library.module_utils.network.f5.common import f5_argument_spec from library.module_utils.network.f5.common import f5_argument_spec
from library.module_utils.network.f5.common import transform_name from library.module_utils.network.f5.common import transform_name
from library.module_utils.network.f5.common import exit_json from library.module_utils.network.f5.compare import compare_dictionary
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import compare_dictionary
from library.module_utils.network.f5.icontrol import module_provisioned from library.module_utils.network.f5.icontrol import module_provisioned
from library.module_utils.network.f5.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
from ansible.module_utils.network.f5.common import fq_name from ansible.module_utils.network.f5.common import fq_name
from ansible.module_utils.network.f5.common import f5_argument_spec from ansible.module_utils.network.f5.common import f5_argument_spec
from ansible.module_utils.network.f5.common import transform_name from ansible.module_utils.network.f5.common import transform_name
from ansible.module_utils.network.f5.common import exit_json from ansible.module_utils.network.f5.compare import compare_dictionary
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import compare_dictionary
from ansible.module_utils.network.f5.icontrol import module_provisioned from ansible.module_utils.network.f5.icontrol import module_provisioned
from ansible.module_utils.network.f5.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
@ -429,7 +434,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -689,16 +694,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -25,15 +25,18 @@ options:
name: name:
description: description:
- Specifies the name of the virtual server. - Specifies the name of the virtual server.
type: str
version_added: 2.6 version_added: 2.6
server_name: server_name:
description: description:
- Specifies the name of the server that the virtual server is associated with. - Specifies the name of the server that the virtual server is associated with.
type: str
version_added: 2.6 version_added: 2.6
address: address:
description: description:
- Specifies the IP Address of the virtual server. - Specifies the IP Address of the virtual server.
- When creating a new GTM virtual server, this parameter is required. - When creating a new GTM virtual server, this parameter is required.
type: str
version_added: 2.6 version_added: 2.6
port: port:
description: description:
@ -42,12 +45,14 @@ options:
- To specify all ports, use an C(*). - To specify all ports, use an C(*).
- When creating a new GTM virtual server, if this parameter is not specified, a - When creating a new GTM virtual server, if this parameter is not specified, a
default of C(*) will be used. default of C(*) will be used.
type: int
translation_address: translation_address:
description: description:
- Specifies the translation IP address for the virtual server. - Specifies the translation IP address for the virtual server.
- To unset this parameter, provide an empty string (C("")) as a value. - To unset this parameter, provide an empty string (C("")) as a value.
- When creating a new GTM virtual server, if this parameter is not specified, a - When creating a new GTM virtual server, if this parameter is not specified, a
default of C(::) will be used. default of C(::) will be used.
type: str
version_added: 2.6 version_added: 2.6
translation_port: translation_port:
description: description:
@ -55,24 +60,31 @@ options:
- To specify all ports, use an C(*). - To specify all ports, use an C(*).
- When creating a new GTM virtual server, if this parameter is not specified, a - When creating a new GTM virtual server, if this parameter is not specified, a
default of C(*) will be used. default of C(*) will be used.
type: str
version_added: 2.6 version_added: 2.6
availability_requirements: availability_requirements:
description: description:
- Specifies, if you activate more than one health monitor, the number of health - Specifies, if you activate more than one health monitor, the number of health
monitors that must receive successful responses in order for the link to be monitors that must receive successful responses in order for the link to be
considered available. considered available.
type: dict
suboptions: suboptions:
type: type:
description: description:
- Monitor rule type when C(monitors) is specified. - Monitor rule type when C(monitors) is specified.
- When creating a new virtual, if this value is not specified, the default of 'all' will be used. - When creating a new virtual, if this value is not specified, the default of 'all' will be used.
choices: ['all', 'at_least', 'require'] type: str
choices:
- all
- at_least
- require
at_least: at_least:
description: description:
- Specifies the minimum number of active health monitors that must be successful - Specifies the minimum number of active health monitors that must be successful
before the link is considered up. before the link is considered up.
- This parameter is only relevant when a C(type) of C(at_least) is used. - This parameter is only relevant when a C(type) of C(at_least) is used.
- This parameter will be ignored if a type of either C(all) or C(require) is used. - This parameter will be ignored if a type of either C(all) or C(require) is used.
type: int
number_of_probes: number_of_probes:
description: description:
- Specifies the minimum number of probes that must succeed for this server to be declared up. - Specifies the minimum number of probes that must succeed for this server to be declared up.
@ -81,6 +93,7 @@ options:
- The value of this parameter should always be B(lower) than, or B(equal to), the value of C(number_of_probers). - The value of this parameter should always be B(lower) than, or B(equal to), the value of C(number_of_probers).
- This parameter is only relevant when a C(type) of C(require) is used. - This parameter is only relevant when a C(type) of C(require) is used.
- This parameter will be ignored if a type of either C(all) or C(at_least) is used. - This parameter will be ignored if a type of either C(all) or C(at_least) is used.
type: int
number_of_probers: number_of_probers:
description: description:
- Specifies the number of probers that should be used when running probes. - Specifies the number of probers that should be used when running probes.
@ -89,30 +102,36 @@ options:
- The value of this parameter should always be B(higher) than, or B(equal to), the value of C(number_of_probers). - The value of this parameter should always be B(higher) than, or B(equal to), the value of C(number_of_probers).
- This parameter is only relevant when a C(type) of C(require) is used. - This parameter is only relevant when a C(type) of C(require) is used.
- This parameter will be ignored if a type of either C(all) or C(at_least) is used. - This parameter will be ignored if a type of either C(all) or C(at_least) is used.
type: int
version_added: 2.6 version_added: 2.6
monitors: monitors:
description: description:
- Specifies the health monitors that the system currently uses to monitor this resource. - Specifies the health monitors that the system currently uses to monitor this resource.
- When C(availability_requirements.type) is C(require), you may only have a single monitor in the - When C(availability_requirements.type) is C(require), you may only have a single monitor in the
C(monitors) list. C(monitors) list.
type: list
version_added: 2.6 version_added: 2.6
virtual_server_dependencies: virtual_server_dependencies:
description: description:
- Specifies the virtual servers on which the current virtual server depends. - Specifies the virtual servers on which the current virtual server depends.
- If any of the specified servers are unavailable, the current virtual server is also listed as unavailable. - If any of the specified servers are unavailable, the current virtual server is also listed as unavailable.
type: list
suboptions: suboptions:
server: server:
description: description:
- Server which the dependant virtual server is part of. - Server which the dependant virtual server is part of.
type: str
required: True required: True
virtual_server: virtual_server:
description: description:
- Virtual server to depend on. - Virtual server to depend on.
type: str
required: True required: True
version_added: 2.6 version_added: 2.6
link: link:
description: description:
- Specifies a link to assign to the server or virtual server. - Specifies a link to assign to the server or virtual server.
type: str
version_added: 2.6 version_added: 2.6
limits: limits:
description: description:
@ -123,6 +142,7 @@ options:
threshold limit requirement, the system marks the entire server as unavailable and directs load-balancing threshold limit requirement, the system marks the entire server as unavailable and directs load-balancing
traffic to another resource. traffic to another resource.
- The limit settings available depend on the type of server. - The limit settings available depend on the type of server.
type: dict
suboptions: suboptions:
bits_enabled: bits_enabled:
description: description:
@ -143,30 +163,35 @@ options:
description: description:
- Specifies the maximum allowable data throughput rate, in bits per second, for the virtual servers on the server. - Specifies the maximum allowable data throughput rate, in bits per second, for the virtual servers on the server.
- If the network traffic volume exceeds this limit, the system marks the server as unavailable. - If the network traffic volume exceeds this limit, the system marks the server as unavailable.
type: int
packets_limit: packets_limit:
description: description:
- Specifies the maximum allowable data transfer rate, in packets per second, for the virtual servers on the server. - Specifies the maximum allowable data transfer rate, in packets per second, for the virtual servers on the server.
- If the network traffic volume exceeds this limit, the system marks the server as unavailable. - If the network traffic volume exceeds this limit, the system marks the server as unavailable.
type: int
connections_limit: connections_limit:
description: description:
- Specifies the maximum number of concurrent connections, combined, for all of the virtual servers on the server. - Specifies the maximum number of concurrent connections, combined, for all of the virtual servers on the server.
- If the connections exceed this limit, the system marks the server as unavailable. - If the connections exceed this limit, the system marks the server as unavailable.
type: int
version_added: 2.6 version_added: 2.6
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
version_added: 2.6 version_added: 2.6
state: state:
description: description:
- When C(present), ensures that the resource exists. - When C(present), ensures that the resource exists.
- When C(absent), ensures the resource is removed. - When C(absent), ensures the resource is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
- enabled - enabled
- disabled - disabled
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -250,13 +275,10 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
from library.module_utils.network.f5.common import fq_name from library.module_utils.network.f5.common import fq_name
from library.module_utils.network.f5.common import f5_argument_spec from library.module_utils.network.f5.common import f5_argument_spec
from library.module_utils.network.f5.common import transform_name from library.module_utils.network.f5.common import transform_name
from library.module_utils.network.f5.common import exit_json from library.module_utils.network.f5.compare import compare_complex_list
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import compare_complex_list
from library.module_utils.network.f5.icontrol import module_provisioned from library.module_utils.network.f5.icontrol import module_provisioned
from library.module_utils.network.f5.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.ipaddress import validate_ip_v6_address from library.module_utils.network.f5.ipaddress import validate_ip_v6_address
@ -265,13 +287,10 @@ except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
from ansible.module_utils.network.f5.common import fq_name from ansible.module_utils.network.f5.common import fq_name
from ansible.module_utils.network.f5.common import f5_argument_spec from ansible.module_utils.network.f5.common import f5_argument_spec
from ansible.module_utils.network.f5.common import transform_name from ansible.module_utils.network.f5.common import transform_name
from ansible.module_utils.network.f5.common import exit_json from ansible.module_utils.network.f5.compare import compare_complex_list
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import compare_complex_list
from ansible.module_utils.network.f5.icontrol import module_provisioned from ansible.module_utils.network.f5.icontrol import module_provisioned
from ansible.module_utils.network.f5.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.ipaddress import validate_ip_v6_address from ansible.module_utils.network.f5.ipaddress import validate_ip_v6_address
@ -886,7 +905,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -1165,16 +1184,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -23,43 +23,51 @@ options:
name: name:
description: description:
- Specifies the name of the monitor. - Specifies the name of the monitor.
type: str
required: True required: True
description: description:
description: description:
- The description of the monitor. - The description of the monitor.
type: str
version_added: 2.7 version_added: 2.7
parent: parent:
description: description:
- The parent template of this monitor template. Once this value has - The parent template of this monitor template. Once this value has
been set, it cannot be changed. By default, this value is the C(http) been set, it cannot be changed. By default, this value is the C(http)
parent on the C(Common) partition. parent on the C(Common) partition.
type: str
default: /Common/external default: /Common/external
arguments: arguments:
description: description:
- Specifies any command-line arguments that the script requires. - Specifies any command-line arguments that the script requires.
type: str
ip: ip:
description: description:
- IP address part of the IP/port definition. If this parameter is not - IP address part of the IP/port definition. If this parameter is not
provided when creating a new monitor, then the default value will be provided when creating a new monitor, then the default value will be
'*'. '*'.
type: str
port: port:
description: description:
- Port address part of the IP/port definition. If this parameter is not - Port address part of the IP/port definition. If this parameter is not
provided when creating a new monitor, then the default value will be provided when creating a new monitor, then the default value will be
'*'. Note that if specifying an IP address, a value between 1 and 65535 '*'. Note that if specifying an IP address, a value between 1 and 65535
must be specified. must be specified.
type: str
external_program: external_program:
description: description:
- Specifies the name of the file for the monitor to use. In order to reference - Specifies the name of the file for the monitor to use. In order to reference
a file, you must first import it using options on the System > File Management > External a file, you must first import it using options on the System > File Management > External
Monitor Program File List > Import screen. The BIG-IP system automatically Monitor Program File List > Import screen. The BIG-IP system automatically
places the file in the proper location on the file system. places the file in the proper location on the file system.
type: str
interval: interval:
description: description:
- The interval specifying how frequently the monitor instance of this - The interval specifying how frequently the monitor instance of this
template will run. If this parameter is not provided when creating template will run. If this parameter is not provided when creating
a new monitor, then the default value will be 5. This value B(must) a new monitor, then the default value will be 5. This value B(must)
be less than the C(timeout) value. be less than the C(timeout) value.
type: int
timeout: timeout:
description: description:
- The number of seconds in which the node or service must respond to - The number of seconds in which the node or service must respond to
@ -71,22 +79,26 @@ options:
3 times the interval number of seconds plus 1 second. 3 times the interval number of seconds plus 1 second.
- If this parameter is not provided when creating a new monitor, then the - If this parameter is not provided when creating a new monitor, then the
default value will be C(16). default value will be C(16).
type: int
variables: variables:
description: description:
- Specifies any variables that the script requires. - Specifies any variables that the script requires.
- Note that double quotes in values will be suppressed. - Note that double quotes in values will be suppressed.
type: dict
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the monitor exists. - When C(present), ensures that the monitor exists.
- When C(absent), ensures the monitor is removed. - When C(absent), ensures the monitor is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -172,26 +184,20 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
from library.module_utils.network.f5.common import fq_name from library.module_utils.network.f5.common import fq_name
from library.module_utils.network.f5.common import f5_argument_spec from library.module_utils.network.f5.common import f5_argument_spec
from library.module_utils.network.f5.common import transform_name from library.module_utils.network.f5.common import transform_name
from library.module_utils.network.f5.common import exit_json from library.module_utils.network.f5.compare import compare_dictionary
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import compare_dictionary
from library.module_utils.network.f5.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
from ansible.module_utils.network.f5.common import fq_name from ansible.module_utils.network.f5.common import fq_name
from ansible.module_utils.network.f5.common import f5_argument_spec from ansible.module_utils.network.f5.common import f5_argument_spec
from ansible.module_utils.network.f5.common import transform_name from ansible.module_utils.network.f5.common import transform_name
from ansible.module_utils.network.f5.common import compare_dictionary from ansible.module_utils.network.f5.compare import compare_dictionary
from ansible.module_utils.network.f5.common import exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none from ansible.module_utils.network.f5.compare import cmp_str_with_none
@ -470,7 +476,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -726,16 +732,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -24,6 +24,7 @@ options:
description: description:
- Specifies the IP address, or hostname, for the remote system to - Specifies the IP address, or hostname, for the remote system to
which the system sends log messages. which the system sends log messages.
type: str
required: True required: True
name: name:
description: description:
@ -31,6 +32,7 @@ options:
- This option is required when multiple C(remote_host) with the same IP - This option is required when multiple C(remote_host) with the same IP
or hostname are present on the device. or hostname are present on the device.
- If C(name) is not provided C(remote_host) is used by default. - If C(name) is not provided C(remote_host) is used by default.
type: str
version_added: 2.8 version_added: 2.8
remote_port: remote_port:
description: description:
@ -38,21 +40,24 @@ options:
remote logging server. remote logging server.
- When creating a remote syslog, if this parameter is not specified, the - When creating a remote syslog, if this parameter is not specified, the
default value C(514) is used. default value C(514) is used.
type: str
local_ip: local_ip:
description: description:
- Specifies the local IP address of the system that is logging. To - Specifies the local IP address of the system that is logging. To
provide no local IP, specify the value C(none). provide no local IP, specify the value C(none).
- When creating a remote syslog, if this parameter is not specified, the - When creating a remote syslog, if this parameter is not specified, the
default value C(none) is used. default value C(none) is used.
type: str
state: state:
description: description:
- When C(present), guarantees that the remote syslog exists with the provided - When C(present), guarantees that the remote syslog exists with the provided
attributes. attributes.
- When C(absent), removes the remote syslog from the system. - When C(absent), removes the remote syslog from the system.
default: present type: str
choices: choices:
- absent - absent
- present - present
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -100,11 +105,8 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
from library.module_utils.network.f5.common import f5_argument_spec from library.module_utils.network.f5.common import f5_argument_spec
from library.module_utils.network.f5.common import exit_json from library.module_utils.network.f5.compare import compare_dictionary
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import compare_dictionary
from library.module_utils.network.f5.common import is_valid_hostname from library.module_utils.network.f5.common import is_valid_hostname
from library.module_utils.network.f5.common import fq_name from library.module_utils.network.f5.common import fq_name
from library.module_utils.network.f5.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
@ -112,11 +114,8 @@ except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
from ansible.module_utils.network.f5.common import f5_argument_spec from ansible.module_utils.network.f5.common import f5_argument_spec
from ansible.module_utils.network.f5.common import exit_json from ansible.module_utils.network.f5.compare import compare_dictionary
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import compare_dictionary
from ansible.module_utils.network.f5.common import is_valid_hostname from ansible.module_utils.network.f5.common import is_valid_hostname
from ansible.module_utils.network.f5.common import fq_name from ansible.module_utils.network.f5.common import fq_name
from ansible.module_utils.network.f5.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
@ -258,7 +257,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.pop('module', None) self.module = kwargs.pop('module', None)
self.client = kwargs.pop('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -458,16 +457,12 @@ def main():
supports_check_mode=spec.supports_check_mode supports_check_mode=spec.supports_check_mode
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -23,10 +23,12 @@ options:
name: name:
description: description:
- Specifies the name of the timer policy. - Specifies the name of the timer policy.
type: str
required: True required: True
description: description:
description: description:
- Specifies descriptive text that identifies the timer policy. - Specifies descriptive text that identifies the timer policy.
type: str
rules: rules:
description: description:
- Rules that you want assigned to the timer policy - Rules that you want assigned to the timer policy
@ -34,6 +36,7 @@ options:
name: name:
description: description:
- The name of the rule. - The name of the rule.
type: str
required: True required: True
protocol: protocol:
description: description:
@ -45,6 +48,7 @@ options:
that match the flow, the flow matches all the other ip-protocol rules. that match the flow, the flow matches all the other ip-protocol rules.
- When specifying rules, if this parameter is not specified, the default of - When specifying rules, if this parameter is not specified, the default of
C(all-other) will be used. C(all-other) will be used.
type: str
choices: choices:
- all-other - all-other
- ah - ah
@ -72,6 +76,7 @@ options:
dash (-). dash (-).
- This field is only available if you have selected the C(sctp), C(tcp), or - This field is only available if you have selected the C(sctp), C(tcp), or
C(udp) protocol. C(udp) protocol.
type: list
idle_timeout: idle_timeout:
description: description:
- Specifies an idle timeout, in seconds, for protocol and port pairs that - Specifies an idle timeout, in seconds, for protocol and port pairs that
@ -80,18 +85,22 @@ options:
the timer policy rule have no idle timeout. the timer policy rule have no idle timeout.
- When specifying rules, if this parameter is not specified, the default of - When specifying rules, if this parameter is not specified, the default of
C(unspecified) will be used. C(unspecified) will be used.
type: str
type: list
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the resource exists. - When C(present), ensures that the resource exists.
- When C(absent), ensures the resource is removed. - When C(absent), ensures the resource is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -150,23 +159,17 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
from library.module_utils.network.f5.common import f5_argument_spec from library.module_utils.network.f5.common import f5_argument_spec
from library.module_utils.network.f5.common import transform_name from library.module_utils.network.f5.common import transform_name
from library.module_utils.network.f5.common import exit_json from library.module_utils.network.f5.compare import compare_complex_list
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import compare_complex_list
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
from ansible.module_utils.network.f5.common import fq_name from ansible.module_utils.network.f5.common import fq_name
from ansible.module_utils.network.f5.common import f5_argument_spec from ansible.module_utils.network.f5.common import f5_argument_spec
from ansible.module_utils.network.f5.common import transform_name from ansible.module_utils.network.f5.common import transform_name
from ansible.module_utils.network.f5.common import exit_json from ansible.module_utils.network.f5.compare import compare_complex_list
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import compare_complex_list
class Parameters(AnsibleF5Parameters): class Parameters(AnsibleF5Parameters):
@ -375,7 +378,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -621,16 +624,12 @@ def main():
supports_check_mode=spec.supports_check_mode supports_check_mode=spec.supports_check_mode
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -23,6 +23,7 @@ options:
description: description:
description: description:
- The description to give to the VLAN. - The description to give to the VLAN.
type: str
tagged_interfaces: tagged_interfaces:
description: description:
- Specifies a list of tagged interfaces and trunks that you want to - Specifies a list of tagged interfaces and trunks that you want to
@ -30,6 +31,7 @@ options:
you want to assign a single interface or trunk to multiple VLANs. you want to assign a single interface or trunk to multiple VLANs.
- This parameter is mutually exclusive with the C(untagged_interfaces) - This parameter is mutually exclusive with the C(untagged_interfaces)
and C(interfaces) parameters. and C(interfaces) parameters.
type: list
aliases: aliases:
- tagged_interface - tagged_interface
untagged_interfaces: untagged_interfaces:
@ -38,33 +40,38 @@ options:
configure for the VLAN. configure for the VLAN.
- This parameter is mutually exclusive with the C(tagged_interfaces) - This parameter is mutually exclusive with the C(tagged_interfaces)
and C(interfaces) parameters. and C(interfaces) parameters.
type: list
aliases: aliases:
- untagged_interface - untagged_interface
name: name:
description: description:
- The VLAN to manage. If the special VLAN C(ALL) is specified with - The VLAN to manage. If the special VLAN C(ALL) is specified with
the C(state) value of C(absent) then all VLANs will be removed. the C(state) value of C(absent) then all VLANs will be removed.
type: str
required: True required: True
state: state:
description: description:
- The state of the VLAN on the system. When C(present), guarantees - The state of the VLAN on the system. When C(present), guarantees
that the VLAN exists with the provided attributes. When C(absent), that the VLAN exists with the provided attributes. When C(absent),
removes the VLAN from the system. removes the VLAN from the system.
default: present type: str
choices: choices:
- absent - absent
- present - present
default: present
tag: tag:
description: description:
- Tag number for the VLAN. The tag number can be any integer between 1 - Tag number for the VLAN. The tag number can be any integer between 1
and 4094. The system automatically assigns a tag number if you do not and 4094. The system automatically assigns a tag number if you do not
specify a value. specify a value.
type: int
mtu: mtu:
description: description:
- Specifies the maximum transmission unit (MTU) for traffic on this VLAN. - Specifies the maximum transmission unit (MTU) for traffic on this VLAN.
When creating a new VLAN, if this parameter is not specified, the default When creating a new VLAN, if this parameter is not specified, the default
value used will be C(1500). value used will be C(1500).
- This number must be between 576 to 9198. - This number must be between 576 to 9198.
type: int
version_added: 2.5 version_added: 2.5
cmp_hash: cmp_hash:
description: description:
@ -75,6 +82,7 @@ options:
specifies that the default CMP hash uses L4 ports. specifies that the default CMP hash uses L4 ports.
- When creating a new VLAN, if this parameter is not specified, the default - When creating a new VLAN, if this parameter is not specified, the default
of C(default) is used. of C(default) is used.
type: str
choices: choices:
- default - default
- destination-address - destination-address
@ -96,10 +104,11 @@ options:
- When creating a new VLAN, if this parameter is not specified, the default - When creating a new VLAN, if this parameter is not specified, the default
of C(outer) is used. of C(outer) is used.
- This parameter is not supported on Virtual Editions of BIG-IP. - This parameter is not supported on Virtual Editions of BIG-IP.
version_added: 2.5 type: str
choices: choices:
- inner - inner
- outer - outer
version_added: 2.5
dag_round_robin: dag_round_robin:
description: description:
- Specifies whether some of the stateless traffic on the VLAN should be - Specifies whether some of the stateless traffic on the VLAN should be
@ -108,11 +117,12 @@ options:
and so on. and so on.
- When creating a new VLAN, if this parameter is not specified, the default - When creating a new VLAN, if this parameter is not specified, the default
of (no) is used. of (no) is used.
version_added: 2.5
type: bool type: bool
version_added: 2.5
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
version_added: 2.5 version_added: 2.5
source_check: source_check:
@ -132,11 +142,13 @@ options:
description: description:
- Specifies the number of seconds that a system can run without detecting network - Specifies the number of seconds that a system can run without detecting network
traffic on this VLAN before it takes the C(fail_safe_action). traffic on this VLAN before it takes the C(fail_safe_action).
type: int
version_added: 2.8 version_added: 2.8
fail_safe_action: fail_safe_action:
description: description:
- Specifies the action that the system takes when it does not detect any traffic on - Specifies the action that the system takes when it does not detect any traffic on
this VLAN, and the C(fail_safe_timeout) has expired. this VLAN, and the C(fail_safe_timeout) has expired.
type: str
choices: choices:
- reboot - reboot
- restart-all - restart-all
@ -145,10 +157,12 @@ options:
sflow_poll_interval: sflow_poll_interval:
description: description:
- Specifies the maximum interval in seconds between two pollings. - Specifies the maximum interval in seconds between two pollings.
type: int
version_added: 2.8 version_added: 2.8
sflow_sampling_rate: sflow_sampling_rate:
description: description:
- Specifies the ratio of packets observed to the samples generated. - Specifies the ratio of packets observed to the samples generated.
type: int
version_added: 2.8 version_added: 2.8
interfaces: interfaces:
description: description:
@ -160,12 +174,15 @@ options:
interface: interface:
description: description:
- The name of the interface - The name of the interface
type: str
tagging: tagging:
description: description:
- Whether the interface is C(tagged) or C(untagged). - Whether the interface is C(tagged) or C(untagged).
type: str
choices: choices:
- tagged - tagged
- untagged - untagged
type: list
version_added: 2.8 version_added: 2.8
notes: notes:
- Requires BIG-IP versions >= 12.0.0 - Requires BIG-IP versions >= 12.0.0
@ -290,26 +307,20 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
from library.module_utils.network.f5.common import fq_name from library.module_utils.network.f5.common import fq_name
from library.module_utils.network.f5.common import f5_argument_spec from library.module_utils.network.f5.common import f5_argument_spec
from library.module_utils.network.f5.common import transform_name from library.module_utils.network.f5.common import transform_name
from library.module_utils.network.f5.common import exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import flatten_boolean from library.module_utils.network.f5.common import flatten_boolean
from library.module_utils.network.f5.common import compare_complex_list from library.module_utils.network.f5.compare import compare_complex_list
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
from ansible.module_utils.network.f5.common import fq_name from ansible.module_utils.network.f5.common import fq_name
from ansible.module_utils.network.f5.common import f5_argument_spec from ansible.module_utils.network.f5.common import f5_argument_spec
from ansible.module_utils.network.f5.common import transform_name from ansible.module_utils.network.f5.common import transform_name
from ansible.module_utils.network.f5.common import exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import flatten_boolean from ansible.module_utils.network.f5.common import flatten_boolean
from ansible.module_utils.network.f5.common import compare_complex_list from ansible.module_utils.network.f5.compare import compare_complex_list
class Parameters(AnsibleF5Parameters): class Parameters(AnsibleF5Parameters):
@ -694,7 +705,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -944,16 +955,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
mutually_exclusive=spec.mutually_exclusive mutually_exclusive=spec.mutually_exclusive
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -113,9 +113,11 @@ class TestManager(unittest.TestCase):
interval=20, interval=20,
timeout=30, timeout=30,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -157,9 +157,11 @@ class TestManager(unittest.TestCase):
name='vs1', name='vs1',
address='1.1.1.1', address='1.1.1.1',
state='present', state='present',
password='admin', provider=dict(
server='localhost', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -101,9 +101,11 @@ class TestManager(unittest.TestCase):
interval=20, interval=20,
timeout=30, timeout=30,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -90,9 +90,11 @@ class TestManager(unittest.TestCase):
def test_create_remote_syslog(self, *args): def test_create_remote_syslog(self, *args):
set_module_args(dict( set_module_args(dict(
remote_host='1.1.1.1', remote_host='1.1.1.1',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
fixture = load_fixture('load_tm_sys_syslog_1.json') fixture = load_fixture('load_tm_sys_syslog_1.json')
@ -117,9 +119,11 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='remotesyslog1', name='remotesyslog1',
remote_host='10.10.10.10', remote_host='10.10.10.10',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
fixture = load_fixture('load_tm_sys_syslog_1.json') fixture = load_fixture('load_tm_sys_syslog_1.json')
@ -143,9 +147,11 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
remote_host='10.10.10.10', remote_host='10.10.10.10',
remote_port=800, remote_port=800,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
fixture = load_fixture('load_tm_sys_syslog_1.json') fixture = load_fixture('load_tm_sys_syslog_1.json')
@ -171,9 +177,11 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
remote_host='10.10.10.10', remote_host='10.10.10.10',
local_ip='2.2.2.2', local_ip='2.2.2.2',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
fixture = load_fixture('load_tm_sys_syslog_1.json') fixture = load_fixture('load_tm_sys_syslog_1.json')
@ -199,9 +207,11 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
remote_host='10.10.10.10', remote_host='10.10.10.10',
local_ip='2.2.2.2', local_ip='2.2.2.2',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
fixture = load_fixture('load_tm_sys_syslog_2.json') fixture = load_fixture('load_tm_sys_syslog_2.json')

View file

@ -92,9 +92,11 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
description='my description', description='my description',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -107,15 +107,18 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='somevlan', name='somevlan',
description='fakevlan', description='fakevlan',
server='localhost', partition='Common',
password='password', provider=dict(
user='admin', server='localhost',
partition='Common' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
argument_spec=self.spec.argument_spec, argument_spec=self.spec.argument_spec,
supports_check_mode=self.spec.supports_check_mode supports_check_mode=self.spec.supports_check_mode,
mutually_exclusive=self.spec.mutually_exclusive
) )
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
@ -133,15 +136,18 @@ class TestManager(unittest.TestCase):
name='somevlan', name='somevlan',
tagged_interface=['2.1'], tagged_interface=['2.1'],
tag=213, tag=213,
server='localhost', partition='Common',
password='password', provider=dict(
user='admin', server='localhost',
partition='Common' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
argument_spec=self.spec.argument_spec, argument_spec=self.spec.argument_spec,
supports_check_mode=self.spec.supports_check_mode supports_check_mode=self.spec.supports_check_mode,
mutually_exclusive=self.spec.mutually_exclusive
) )
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
@ -159,15 +165,18 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='somevlan', name='somevlan',
untagged_interface=['2.1'], untagged_interface=['2.1'],
server='localhost', partition='Common',
password='password', provider=dict(
user='admin', server='localhost',
partition='Common' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
argument_spec=self.spec.argument_spec, argument_spec=self.spec.argument_spec,
supports_check_mode=self.spec.supports_check_mode supports_check_mode=self.spec.supports_check_mode,
mutually_exclusive=self.spec.mutually_exclusive
) )
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
@ -185,15 +194,18 @@ class TestManager(unittest.TestCase):
name='somevlan', name='somevlan',
tagged_interface=['2.1', '1.1'], tagged_interface=['2.1', '1.1'],
tag=213, tag=213,
server='localhost', partition='Common',
password='password', provider=dict(
user='admin', server='localhost',
partition='Common' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
argument_spec=self.spec.argument_spec, argument_spec=self.spec.argument_spec,
supports_check_mode=self.spec.supports_check_mode supports_check_mode=self.spec.supports_check_mode,
mutually_exclusive=self.spec.mutually_exclusive
) )
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
@ -211,15 +223,18 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='somevlan', name='somevlan',
untagged_interface=['2.1', '1.1'], untagged_interface=['2.1', '1.1'],
server='localhost',
password='password',
user='admin',
partition='Common', partition='Common',
provider=dict(
server='localhost',
password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
argument_spec=self.spec.argument_spec, argument_spec=self.spec.argument_spec,
supports_check_mode=self.spec.supports_check_mode supports_check_mode=self.spec.supports_check_mode,
mutually_exclusive=self.spec.mutually_exclusive
) )
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
@ -236,15 +251,18 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='somevlan', name='somevlan',
untagged_interface=['2.1'], untagged_interface=['2.1'],
server='localhost',
password='password',
user='admin',
partition='Common', partition='Common',
provider=dict(
server='localhost',
password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
argument_spec=self.spec.argument_spec, argument_spec=self.spec.argument_spec,
supports_check_mode=self.spec.supports_check_mode supports_check_mode=self.spec.supports_check_mode,
mutually_exclusive=self.spec.mutually_exclusive
) )
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
@ -267,15 +285,18 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='somevlan', name='somevlan',
tagged_interface=['2.1'], tagged_interface=['2.1'],
server='localhost',
password='password',
user='admin',
partition='Common', partition='Common',
provider=dict(
server='localhost',
password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
argument_spec=self.spec.argument_spec, argument_spec=self.spec.argument_spec,
supports_check_mode=self.spec.supports_check_mode supports_check_mode=self.spec.supports_check_mode,
mutually_exclusive=self.spec.mutually_exclusive
) )
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
@ -296,15 +317,18 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='somevlan', name='somevlan',
description='changed_that', description='changed_that',
server='localhost',
password='password',
user='admin',
partition='Common', partition='Common',
provider=dict(
server='localhost',
password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
argument_spec=self.spec.argument_spec, argument_spec=self.spec.argument_spec,
supports_check_mode=self.spec.supports_check_mode supports_check_mode=self.spec.supports_check_mode,
mutually_exclusive=self.spec.mutually_exclusive
) )
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen