def test_ucs_installed(self, *args):
        set_module_args(
            dict(ucs="/root/bigip.localhost.localdomain.ucs",
                 server='localhost',
                 password='******',
                 user='******',
                 state='installed'))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)

        # Override methods to force specific logic in the module to happen
        mm = ModuleManager(module=module)
        mm.is_version_v1 = Mock(return_value=False)

        vm = V2Manager(module=module)
        vm.create_on_device = Mock(return_value=True)
        vm.exists = Mock(return_value=True)
        vm.install_on_device = Mock(return_value=True)

        results = vm.exec_module()

        assert results['changed'] is True
    def test_update_interval_larger_than_existing_timeout(self, *args):
        set_module_args(
            dict(name='foo',
                 interval=30,
                 server='localhost',
                 password='******',
                 user='******'))

        current = Parameters(
            params=load_fixture('load_ltm_monitor_tcp_echo.json'))
        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)

        # Override methods in the specific type of manager
        mm = ModuleManager(module=module)
        mm.exists = Mock(return_value=True)
        mm.read_current_from_device = Mock(return_value=current)
        mm.update_on_device = Mock(return_value=True)

        with pytest.raises(F5ModuleError) as ex:
            mm.exec_module()

        assert "must be less than" in str(ex)
    def test_ip_enforcement_update(self, *args):
        set_module_args(
            dict(subscription_id='s-xxxxxxxxxx',
                 state='absent',
                 ip_enforcement=[
                     hacker_ip,
                     devops_ip,
                 ]))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)

        get_subscription_fake = load_fixture(
            'f5_cs_eap_ip_enforcement_get_eap_subscription.json')

        connection = Mock()
        api_client = CloudservicesApi(connection)
        api_client.login = Mock()

        api_client.get_subscription_by_id = Mock(
            return_value=get_subscription_fake)
        api_client.update_subscription = Mock(
            side_effect=self.update_enforcement_list)

        mm = ModuleManager(module=module, client=api_client)
        results = mm.exec_module()

        assert results['changed'] is True
        assert results['subscription_id'] == 's-xxxxxxxxxx'

        bot_ip = results['ip_enforcement'][0]
        assert bot_ip['address'] == '192.168.1.1'
        assert bot_ip['description'] == 'bot_1'
        assert bot_ip['action'] == 'block'
        assert bot_ip['log'] is False
    def test_create_enabled_datacenter(self, *args):
        set_module_args(dict(
            state='enabled',
            password='******',
            server='localhost',
            user='******',
            name='foo'
        ))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode
        )
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        mm.exists = Mock(side_effect=[False, True])
        mm.create_on_device = Mock(return_value=True)
        mm.module_provisioned = Mock(return_value=True)

        results = mm.exec_module()
        assert results['changed'] is True
        assert results['enabled'] is True
        assert results['disabled'] is False
    def test_create_v3_community_2(self, *args):
        set_module_args(dict(
            version='v3',
            access='ro',
            snmp_username='******',
            snmp_auth_protocol='md5',
            snmp_auth_password='******',
            snmp_privacy_protocol='des',
            snmp_privacy_password='******',
            state='present',
            partition='Common',
            provider=dict(
                server='localhost',
                password='******',
                user='******'
            )
        ))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode,
            required_if=self.spec.required_if
        )
        m1 = V2Manager(module=module)

        # Override methods to force specific logic in the module to happen
        m1.exists = Mock(side_effect=[False, True])
        m1.create_on_device = Mock(return_value=True)

        m0 = ModuleManager(module=module)
        m0.get_manager = Mock(return_value=m1)

        with pytest.raises(F5ModuleError) as ex:
            m0.exec_module()

        assert 'oid must be specified when creating a new v3 community.' == str(ex.value)
Esempio n. 6
0
    def test_update_route_domain(self, *args):
        set_module_args(
            dict(name='foo',
                 route_domain=1,
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        current = ApiParameters(
            params=load_fixture('load_tm_auth_partition.json'))
        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)

        # Override methods in the specific type of manager
        mm = ModuleManager(module=module)
        mm.exists = Mock(return_value=True)
        mm.read_current_from_device = Mock(return_value=current)
        mm.update_on_device = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
        assert results['route_domain'] == 1
Esempio n. 7
0
    def test_create_topology_region(self, *args):
        set_module_args(
            dict(name='foobar',
                 region_members=[
                     dict(country='Poland', negate=True),
                     dict(datacenter='bazcenter')
                 ],
                 partition='Common',
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)

        # Override methods in the specific type of manager
        mm = ModuleManager(module=module)
        mm.exists = Mock(return_value=False)
        mm.create_on_device = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
Esempio n. 8
0
    def test_update_ntp_servers(self, *args):
        ntp = ['10.1.1.1', '10.1.1.2']
        set_module_args(
            dict(ntp_servers=ntp,
                 server='localhost',
                 user='******',
                 password='******'))

        # Configure the parameters that would be returned by querying the
        # remote device
        current = Parameters(params=load_fixture('load_ntp.json'))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        mm.update_on_device = Mock(return_value=True)
        mm.read_current_from_device = Mock(return_value=current)

        results = mm.exec_module()
        assert results['changed'] is True
        assert results['ntp_servers'] == ntp
Esempio n. 9
0
    def test_create(self, *args):
        set_module_args(
            dict(name='foo',
                 description='this is a description',
                 addresses=['1.1.1.1', '2.2.2.2'],
                 address_ranges=['3.3.3.3-4.4.4.4', '5.5.5.5-6.6.6.6'],
                 address_lists=['/Common/foo', 'foo'],
                 geo_locations=[
                     dict(country='US', region='Los Angeles'),
                     dict(country='China'),
                     dict(country='EU')
                 ],
                 fqdns=['google.com', 'mit.edu'],
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        mm.exists = Mock(return_value=False)
        mm.create_on_device = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
        assert 'addresses' in results
        assert 'address_lists' in results
        assert 'address_ranges' in results
        assert len(results['addresses']) == 2
        assert len(results['address_ranges']) == 2
        assert len(results['address_lists']) == 2
        assert results['description'] == 'this is a description'
    def test_create_route_to_vlan(self, *args):
        set_module_args(
            dict(name='test-route',
                 password='******',
                 server='localhost',
                 user='******',
                 state='present',
                 destination='10.10.10.10',
                 netmask='255.255.255.255',
                 vlan="test-vlan"))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            mutually_exclusive=self.spec.mutually_exclusive,
            supports_check_mode=self.spec.supports_check_mode)
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        mm.exists = Mock(return_value=False)
        mm.create_on_device = Mock(return_value=True)
        results = mm.exec_module()

        assert results['changed'] is True
        assert results['vlan'] == '/Common/test-vlan'
    def test_update_agent_status_traps(self, *args):
        set_module_args(
            dict(agent_status_traps='enabled',
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        # Configure the parameters that would be returned by querying the
        # remote device
        current = ApiParameters(params=dict(agent_status_traps='disabled'))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        mm.update_on_device = Mock(return_value=True)
        mm.read_current_from_device = Mock(return_value=current)

        results = mm.exec_module()

        assert results['changed'] is True
        assert results['agent_status_traps'] == 'enabled'
Esempio n. 12
0
    def test_update(self, *args):
        set_module_args(
            dict(arp_log_level='debug',
                 layer4_log_level='debug',
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        # Configure the parameters that would be returned by querying the
        # remote device
        current = ApiParameters(params=load_fixture('load_tmm_log.json'))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        mm.exists = Mock(return_value=False)
        mm.read_current_from_device = Mock(return_value=current)
        mm.update_on_device = Mock(return_value=True)

        results = mm.exec_module()
        assert results['changed'] is True
    def test_create(self, *args):
        set_module_args(
            dict(name='foo',
                 description='this is a description',
                 rules=['rule1', 'rule2', 'rule3'],
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        mm.exists = Mock(side_effect=[False, True])
        mm.create_on_device = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
        assert 'rules' in results
        assert len(results['rules']) == 3
        assert results['description'] == 'this is a description'
    def test_update_time_until_up(self, *args):
        set_module_args(
            dict(name='foo',
                 time_until_up=300,
                 server='localhost',
                 password='******',
                 user='******'))

        current = Parameters(
            params=load_fixture('load_ltm_monitor_tcp_echo.json'))
        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)

        # Override methods in the specific type of manager
        mm = ModuleManager(module=module)
        mm.exists = Mock(return_value=True)
        mm.read_current_from_device = Mock(return_value=current)
        mm.update_on_device = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
        assert results['time_until_up'] == 300
    def test_get_facts(self, *args):
        set_module_args(
            dict(gather_subset=['system-info'],
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        fixture1 = load_fixture('load_shared_system_setup_1.json')

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)

        tm = SystemInfoFactManager(module=module)
        tm.read_collection_from_device = Mock(return_value=fixture1)

        # Override methods to force specific logic in the module to happen
        mm = ModuleManager(module=module)
        mm.get_manager = Mock(return_value=tm)

        results = mm.exec_module()

        assert results['changed'] is True
        assert 'system_info' in results
Esempio n. 16
0
    def test_create_monitor(self, *args):
        set_module_args(
            dict(name='foo',
                 ip='10.10.10.10',
                 port=80,
                 interval=20,
                 timeout=30,
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)

        # Override methods in the specific type of manager
        mm = ModuleManager(module=module)
        mm.exists = Mock(side_effect=[False, True])
        mm.create_on_device = Mock(return_value=True)
        mm.module_provisioned = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
    def test_create_with_description(self, *args):
        set_module_args(
            dict(name='foo',
                 parent='/Common/gateway-icmp',
                 interval=20,
                 timeout=30,
                 time_until_up=60,
                 description='Important Description',
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)

        # Override methods in the specific type of manager
        mm = ModuleManager(module=module)
        mm.exists = Mock(side_effect=[False, True])
        mm.create_on_device = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
    def test_create_v3_community_1(self, *args):
        set_module_args(dict(
            version='v3',
            oid='.1',
            access='ro',
            snmp_username='******',
            snmp_auth_protocol='md5',
            snmp_auth_password='******',
            snmp_privacy_protocol='des',
            snmp_privacy_password='******',
            state='present',
            partition='Common',
            provider=dict(
                server='localhost',
                password='******',
                user='******'
            )
        ))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode,
            required_if=self.spec.required_if
        )
        m1 = V2Manager(module=module)

        # Override methods to force specific logic in the module to happen
        m1.exists = Mock(side_effect=[False, True])
        m1.create_on_device = Mock(return_value=True)

        m0 = ModuleManager(module=module)
        m0.get_manager = Mock(return_value=m1)

        results = m0.exec_module()

        assert results['changed'] is True
    def test_create_snat_pool(self, *args):
        set_module_args(
            dict(name='my-snat-pool',
                 state='present',
                 members=['10.10.10.10', '20.20.20.20'],
                 password='******',
                 server='localhost',
                 user='******'))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        mm.exists = Mock(side_effect=[False, True])
        mm.create_on_device = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
        assert len(results['members']) == 2
        assert '/Common/10.10.10.10' in results['members']
        assert '/Common/20.20.20.20' in results['members']
Esempio n. 20
0
    def test_create_blackhole(self, *args):
        set_module_args(
            dict(key='provision.cpu.afm',
                 value='1',
                 state='present',
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        # Configure the parameters that would be returned by querying the
        # remote device
        current = Parameters(
            dict(
                kind="tm:sys:db:dbstate",
                name="provision.cpu.afm",
                fullPath="provision.cpu.afm",
                generation=1,
                selfLink=
                "https://localhost/mgmt/tm/sys/db/provision.cpu.afm?ver=11.6.1",
                defaultValue="0",
                scfConfig="false",
                value="0",
                valueRange="integer min:0 max:100"))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode)
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        mm.exists = Mock(return_value=False)
        mm.read_current_from_device = Mock(return_value=current)
        mm.update_on_device = Mock(return_value=True)

        results = mm.exec_module()
        assert results['changed'] is True
    def test_update_virtual_server(self, *args):
        set_module_args(
            dict(profiles=[dict(name='http'),
                           dict(name='clientssl')],
                 description="foo virtual",
                 destination="1.1.1.1",
                 name="my-virtual-server",
                 partition="Common",
                 port="8443",
                 snat="snat-pool1",
                 state="disabled",
                 source='1.2.3.4/32',
                 irules=['irule1', 'irule2'],
                 policies=['policy1', 'policy2'],
                 enabled_vlans=['vlan1', 'vlan2'],
                 pool='my-pool',
                 default_persistence_profile='source_addr',
                 fallback_persistence_profile='dest_addr',
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        # Configure the parameters that would be returned by querying the
        # remote device
        current = ApiParameters(params=load_fixture('load_ltm_virtual_3.json'))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            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
        mm = ModuleManager(module=module)
        mm.exists = Mock(return_value=True)
        mm.read_current_from_device = Mock(return_value=current)
        mm.update_on_device = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
        assert results['source'] == '1.2.3.4/32'
        assert results['description'] == 'foo virtual'
        assert results['snat'] == '/Common/snat-pool1'
        assert results['destination'] == '1.1.1.1'
        assert results['port'] == 8443
        assert results['default_persistence_profile'] == '/Common/source_addr'
        assert results['fallback_persistence_profile'] == '/Common/dest_addr'

        # policies
        assert len(results['policies']) == 2
        assert '/Common/policy1' in results['policies']
        assert '/Common/policy2' in results['policies']

        # irules
        assert len(results['irules']) == 2
        assert '/Common/irule1' in results['irules']
        assert '/Common/irule2' in results['irules']

        # vlans
        assert len(results['enabled_vlans']) == 2
        assert '/Common/vlan1' in results['enabled_vlans']
        assert '/Common/vlan2' in results['enabled_vlans']

        # profiles
        assert len(results['profiles']) == 2
        assert 'name' in results['profiles'][0]
        assert 'context' in results['profiles'][0]
        assert results['profiles'][0]['name'] == 'http'
        assert results['profiles'][0]['context'] == 'all'
        assert 'name' in results['profiles'][1]
        assert 'context' in results['profiles'][1]
        assert results['profiles'][1]['name'] == 'clientssl'
        assert results['profiles'][1]['context'] == 'clientside'
    def test_create_LSN_pool(self, *args):
        set_module_args(
            dict(name='foo',
                 description='foobar',
                 client_conn_limit=300,
                 harpin_mode='yes',
                 icmp_echo='no',
                 inbound_connections='explicit',
                 mode='pba',
                 persistence_mode='address-port',
                 persistence_timeout=180,
                 route_advertisement='yes',
                 pba_block_idle_timeout=50,
                 pba_block_lifetime=1800,
                 pba_block_size=10,
                 pba_client_block_limit=1,
                 pba_zombie_timeout=10,
                 port_range_low=1080,
                 port_range_high=1090,
                 egress_intf_enabled='yes',
                 egress_interfaces=['tunnel1', 'tunnel2'],
                 members=['10.10.10.0/25', '10.10.10.128/25'],
                 backup_members=['12.12.12.0/25', '12.12.12.128/25'],
                 log_profile='foo_profile',
                 log_publisher='baz_publisher',
                 partition='Common',
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode,
            required_together=self.spec.required_together,
        )

        # Override methods in the specific type of manager
        mm = ModuleManager(module=module)
        mm.exists = Mock(return_value=False)
        mm.create_on_device = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
        assert results['description'] == 'foobar'
        assert results['client_conn_limit'] == 300
        assert results['harpin_mode'] == 'yes'
        assert results['icmp_echo'] == 'no'
        assert results['inbound_connections'] == 'explicit'
        assert results['mode'] == 'pba'
        assert results['persistence_mode'] == 'address-port'
        assert results['persistence_timeout'] == 180
        assert results['route_advertisement'] == 'yes'
        assert results['pba_block_idle_timeout'] == 50
        assert results['pba_block_lifetime'] == 1800
        assert results['pba_block_size'] == 10
        assert results['pba_client_block_limit'] == 1
        assert results['pba_zombie_timeout'] == 10
        assert results['port_range_low'] == 1080
        assert results['port_range_high'] == 1090
        assert results['egress_intf_enabled'] == 'yes'
        assert '/Common/tunnel1' and '/Common/tunnel2' in results[
            'egress_interfaces']
        assert '12.12.10.0/25' and '12.12.12.128/25' in results[
            'backup_members']
        assert '10.10.10.0/25' and '10.10.10.128/25' in results['members']
        assert results['log_profile'] == '/Common/foo_profile'
        assert results['log_publisher'] == '/Common/baz_publisher'
Esempio n. 23
0
    def test_create_asm_dos_profile(self, *args):
        set_module_args(
            dict(profile='dos_foo',
                 geolocations=dict(blacklist=['Argentina', 'Montenegro'],
                                   whitelist=['France', 'Belgium']),
                 heavy_urls=dict(auto_detect=True,
                                 latency_threshold=3000,
                                 exclude=['/exclude1.html', '/exclude2.html'],
                                 include=[
                                     dict(url='include1.html',
                                          threshold='auto'),
                                     dict(url='include2.html',
                                          threshold='2000')
                                 ]),
                 mobile_detection=dict(
                     enabled=True,
                     allow_android_rooted_device=True,
                     allow_any_android_package=True,
                     allow_any_ios_package=True,
                     allow_jailbroken_devices=True,
                     allow_emulators=True,
                     client_side_challenge_mode='cshui',
                     ios_allowed_package_names=['foo', 'bar'],
                     android_publishers=['cert1.crt', 'cert2.crt']),
                 rtbh_duration=180,
                 rtbh_enable=True,
                 scrubbing_duration=360,
                 scrubbing_enable=True,
                 single_page_application=True,
                 trigger_irule=False,
                 partition='Common',
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode,
        )

        # Override methods in the specific type of manager
        mm = ModuleManager(module=module)
        mm.exists = Mock(return_value=False)
        mm.create_on_device = Mock(return_value=True)
        mm.version_less_than_13_1 = Mock(return_value=False)

        results = mm.exec_module()

        assert results['changed'] is True
        assert results['geolocations'] == dict(
            blacklist=['Argentina', 'Montenegro'],
            whitelist=['France', 'Belgium'])
        assert results['heavy_urls'] == dict(
            auto_detect='yes',
            latency_threshold=3000,
            exclude=['/exclude1.html', '/exclude2.html'],
            include=[
                dict(url='/include1.html', threshold='auto'),
                dict(url='/include2.html', threshold='2000')
            ])
        assert results['mobile_detection'] == dict(
            enabled='yes',
            allow_android_rooted_device='yes',
            allow_any_android_package='yes',
            allow_any_ios_package='yes',
            allow_jailbroken_devices='yes',
            allow_emulators='yes',
            client_side_challenge_mode='cshui',
            ios_allowed_package_names=['foo', 'bar'],
            android_publishers=['/Common/cert1.crt', '/Common/cert2.crt'])
        assert results['rtbh_duration'] == 180
        assert results['rtbh_enable'] == 'yes'
        assert results['scrubbing_duration'] == 360
        assert results['scrubbing_enable'] == 'yes'
        assert results['single_page_application'] == 'yes'
        assert results['trigger_irule'] == 'no'
Esempio n. 24
0
    def test_create(self, *args):
        set_module_args(dict(
            server='lb.mydomain.com',
            user='******',
            password='******',
            name='GTM_Server',
            datacenter='/Common/New York',
            server_type='bigip',
            link_discovery='disabled',
            virtual_server_discovery='disabled',
            devices=[
                dict(
                    name='server_1',
                    address='1.1.1.1'
                ),
                dict(
                    name='server_2',
                    address='2.2.2.1',
                    translation='192.168.2.1'
                ),
                dict(
                    name='server_2',
                    address='2.2.2.2'
                ),
                dict(
                    name='server_3',
                    addresses=[
                        dict(
                            address='3.3.3.1'
                        ),
                        dict(
                            address='3.3.3.2'
                        )
                    ]
                ),
                dict(
                    name='server_4',
                    addresses=[
                        dict(
                            address='4.4.4.1',
                            translation='192.168.14.1'
                        ),
                        dict(
                            address='4.4.4.2'
                        )
                    ]
                )
            ]
        ))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode
        )

        m1 = V2Manager(module=module)
        m1.exists = Mock(side_effect=[False, True])
        m1.create_on_device = Mock(return_value=True)
        m1.client = Mock()
        m1.client.api.tmos_version = '13.1.0'

        # Override methods in the specific type of manager
        mm = ModuleManager(module=module)
        mm.get_manager = Mock(return_value=m1)
        mm.version_is_less_than = Mock(return_value=False)
        mm.gtm_provisioned = Mock(return_value=True)
        mm.module_provisioned = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
        assert results['server_type'] == 'bigip'