Exemple #1
0
    def test_20_launch(self, get_image_data, save_data, get_driver):
        radl_data = """
            network net1 (outbound = 'yes' and provider_id = 'public' and
                          outports = '8080,9000:9100' and sg_name= 'test')
            network net2 (dnsserver='1.1.1.1' and create = 'yes')
            system test (
            cpu.arch='x86_64' and
            cpu.count=1 and
            memory.size=512m and
            instance_tags='key=value,key1=value2' and
            net_interface.1.connection = 'net1' and
            net_interface.0.connection = 'net2' and
            disk.0.os.name = 'linux' and
            disk.0.image.url = 'ost://server.com/ami-id' and
            disk.0.os.credentials.username = '******' and
            disk.1.size=1GB and
            disk.1.device='hdb' and
            disk.2.image.url = 'ost://server.com/vol-id' and
            disk.2.device='hdc'
            )"""
        radl = radl_parse.parse_radl(radl_data)
        radl.check()

        auth = Authentication([{
            'id': 'ost',
            'type': 'OpenStack',
            'username': '******',
            'password': '******',
            'tenant': 'tenant',
            'host': 'https://server.com:5000'
        }, {
            'type': 'InfrastructureManager',
            'username': '******',
            'password': '******'
        }])
        ost_cloud = self.get_ost_cloud()

        driver = MagicMock()
        get_driver.return_value = driver

        node_size = MagicMock()
        node_size.ram = 512
        node_size.price = 1
        node_size.disk = 1
        node_size.vcpus = 1
        node_size.name = "small"
        driver.list_sizes.return_value = [node_size]

        net1 = MagicMock()
        net1.name = "public"
        net1.id = "net1id"
        net1.extra = {'router:external': True}
        net1.cidr = None
        net2 = MagicMock()
        net2.name = "private"
        net2.id = "net2id"
        net2.cidr = "10.0.0.0/24"
        driver.ex_list_networks.return_value = [net2, net1]

        sg = MagicMock()
        sg.name = "sg"
        driver.ex_create_security_group.return_value = sg
        driver.ex_list_security_groups.return_value = []
        driver.ex_create_security_group_rule.return_value = True

        driver.features = {'create_node': ['ssh_key']}

        driver.create_node.side_effect = self.create_node

        driver.ex_create_network.return_value = net2
        subnet1 = MagicMock()
        driver.ex_create_subnet.return_value = subnet1

        router = MagicMock()
        router.id = "id"
        router.name = "name"
        router.extra = {'external_gateway_info': {'network_id': net1.id}}
        driver.ex_list_routers.return_value = [router]
        driver.ex_add_router_subnet.return_value = True

        image = MagicMock()
        image.id = 'imageid'
        driver.get_image.return_value = image
        vol = MagicMock()
        vol.id = 'volid'
        driver.ex_get_volume.return_value = vol

        inf = InfrastructureInfo()
        inf.radl = radl
        inf.auth = auth
        res = ost_cloud.launch_with_retry(inf, radl, radl, 1, auth, 2, 1)
        success, _ = res[0]
        self.assertTrue(success, msg="ERROR: launching a VM.")
        self.assertEqual(driver.create_node.call_args_list[0][1]['networks'],
                         [net1])
        mappings = [{
            'source_type': 'image',
            'uuid': 'imageid',
            'boot_index': 0,
            'delete_on_termination': False,
            'device_name': 'vda'
        }, {
            'guest_format': 'ext3',
            'boot_index': 1,
            'volume_size': 1,
            'device_name': 'vdb',
            'source_type': 'blank',
            'destination_type': 'volume',
            'delete_on_termination': True
        }, {
            'boot_index': 2,
            'delete_on_termination': False,
            'destination_type': 'volume',
            'device_name': 'vdc',
            'source_type': 'volume',
            'uuid': 'volid'
        }]
        self.assertEqual(
            driver.create_node.call_args_list[0][1]['ex_blockdevicemappings'],
            mappings)
        self.assertEqual(driver.ex_create_subnet.call_args_list[0][0][2],
                         "10.0.1.0/24")

        # test with proxy auth data
        auth = Authentication([{
            'id': 'ost',
            'type': 'OpenStack',
            'proxy': 'proxy',
            'tenant': 'tenant',
            'host': 'https://server.com:5000'
        }, {
            'type': 'InfrastructureManager',
            'username': '******',
            'password': '******'
        }])
        inf = InfrastructureInfo()
        inf.auth = auth
        inf.radl = radl
        res = ost_cloud.launch(inf, radl, radl, 1, auth)
        success, _ = res[0]
        self.assertTrue(success, msg="ERROR: launching a VM.")

        get_image_data.return_value = "https://cloud.recas.ba.infn.it:5000", "image_id2", ""
        radl.systems[0].setValue(
            'disk.0.image.url',
            'appdb://CESNET-MetaCloud/egi.ubuntu.16.04?fedcloud.egi.eu')
        res = ost_cloud.launch(inf, radl, radl, 1, auth)
        success, _ = res[0]
        self.assertTrue(success, msg="ERROR: launching a VM.")
        self.assertEqual(driver.get_image.call_args_list[3][0][0], "image_id2")

        radl_data = """
            network net1 (outbound = 'yes')
            network net2 (create = 'yes')
            network net3 (create = 'yes')
            system test (
            cpu.arch='x86_64' and
            cpu.count=1 and
            memory.size=512m and
            instance_tags='key=value,key1=value2' and
            net_interface.1.connection = 'net1' and
            net_interface.0.connection = 'net2' and
            net_interface.2.connection = 'net3' and
            disk.0.os.name = 'linux' and
            disk.0.image.url = 'ost://server.com/ami-id' and
            disk.0.os.credentials.username = '******' and
            disk.1.size=1GB and
            disk.1.device='hdb' and
            disk.2.image.url = 'ost://server.com/vol-id' and
            disk.2.device='hdc'
            )
            """
        radl = radl_parse.parse_radl(radl_data)
        radl.check()

        inf = InfrastructureInfo()
        inf.auth = auth
        inf.radl = radl
        res = ost_cloud.launch(inf, radl, radl, 1, auth)
        success, _ = res[0]
        self.assertTrue(success, msg="ERROR: launching a VM.")
        self.assertEqual(driver.ex_create_subnet.call_args_list[5][0][2],
                         "10.0.2.0/24")
Exemple #2
0
    def test_20_launch(self, save_data, blockdevicemapping, VPCConnection, get_region):
        radl_data = """
            network net1 (outbound = 'yes' and outports='8080,9000:9100' and sg_name = 'sgname')
            network net2 ()
            system test (
            cpu.arch='x86_64' and
            cpu.count>=1 and
            memory.size>=512m and
            instance_tags = 'key=value,key1=value2' and
            net_interface.0.connection = 'net1' and
            net_interface.0.dns_name = 'test' and
            net_interface.1.connection = 'net2' and
            disk.0.os.name = 'linux' and
            disk.0.image.url = 'aws://us-east-one/ami-id' and
            disk.0.os.credentials.username = '******' and
            disk.1.size=1GB and
            disk.1.device='hdb' and
            disk.1.mount_path='/mnt/path'
            )"""
        radl = radl_parse.parse_radl(radl_data)
        radl.check()

        auth = Authentication([{'id': 'ec2', 'type': 'EC2', 'username': '******', 'password': '******'},
                               {'type': 'InfrastructureManager', 'username': '******', 'password': '******'}])
        ec2_cloud = self.get_ec2_cloud()

        region = MagicMock()
        get_region.return_value = region

        conn = MagicMock()
        VPCConnection.return_value = conn

        image = MagicMock()
        device = MagicMock()
        reservation = MagicMock()
        instance = MagicMock()
        device.snapshot_id = True
        device.volume_id = True
        image.block_device_mapping = {"device": device}
        instance.add_tag.return_value = True
        instance.id = "iid"
        reservation.instances = [instance]
        conn.run_instances.return_value = reservation
        conn.get_image.return_value = image

        subnet = MagicMock()
        subnet.id = "subnet-id"
        conn.get_all_subnets.return_value = [subnet]

        vpc = MagicMock()
        vpc.id = "vpc-id"
        conn.get_all_vpcs.return_value = [vpc]

        sg = MagicMock()
        sg.id = "sgid"
        sg.name = "sgname"
        sg.authorize.return_value = True
        conn.create_security_group.return_value = sg

        conn.get_all_security_groups.return_value = []

        blockdevicemapping.return_value = {'device': ''}

        inf = InfrastructureInfo()
        inf.auth = auth
        inf.radl = radl
        res = ec2_cloud.launch(inf, radl, radl, 1, auth)
        success, _ = res[0]
        self.assertTrue(success, msg="ERROR: launching a VM.")
        self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue())
        self.assertEquals(len(conn.create_security_group.call_args_list), 3)
        self.assertEquals(conn.create_security_group.call_args_list[0][0][0], "im-%s" % inf.id)
        self.assertEquals(conn.create_security_group.call_args_list[1][0][0], "sgname")
        self.assertEquals(conn.create_security_group.call_args_list[2][0][0], "im-%s-net2" % inf.id)

        # Check the case that we do not use VPC
        radl_data = """
            network net1 (outbound = 'yes' and outports='8080')
            network net2 (create='yes' and cidr='10.0.128.0/24')
            network net3 (create='yes' and cidr='10.0.*.0/24')
            network net4 (create='yes')
            system test (
            cpu.arch='x86_64' and
            cpu.count>=1 and
            memory.size>=1g and
            net_interface.0.connection = 'net1' and
            net_interface.0.dns_name = 'test' and
            net_interface.1.connection = 'net2' and
            disk.0.os.name = 'linux' and
            disk.0.image.url = 'aws://us-east-one/ami-id' and
            disk.0.os.credentials.username = '******' and
            #disk.0.os.credentials.private_key = 'private' and
            #disk.0.os.credentials.public_key = 'public' and
            disk.1.size=1GB and
            disk.1.device='hdb' and
            disk.1.mount_path='/mnt/path'
            )"""
        radl = radl_parse.parse_radl(radl_data)

        vpc = MagicMock()
        vpc.id = "vpc-id"
        conn.create_vpc.return_value = vpc
        conn.get_all_vpcs.side_effect = self._get_all_vpcs

        subnet = MagicMock()
        subnet.id = "subnet-id"
        subnet.cidr_block = "10.10.129.0/24"
        conn.create_subnet.return_value = subnet
        conn.get_all_subnets.side_effect = self.get_all_subnets

        inf = InfrastructureInfo()
        inf.auth = auth
        inf.radl = radl
        res = ec2_cloud.launch(inf, radl, radl, 1, auth)
        success, _ = res[0]
        self.assertTrue(success, msg="ERROR: launching a VM.")
        # check the instance_type selected is correct
        self.assertEquals(conn.run_instances.call_args_list[1][1]["instance_type"], "t3a.micro")
        self.assertEquals(conn.create_vpc.call_args_list[0][0][0], "10.0.128.0/22")
        self.assertEquals(conn.create_subnet.call_args_list[0][0], ('vpc-id', '10.0.128.0/24'))
        self.assertEquals(conn.create_subnet.call_args_list[1][0], ('vpc-id', '10.0.129.0/24'))
        self.assertEquals(conn.create_subnet.call_args_list[2][0], ('vpc-id', '10.0.130.0/24'))

        self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue())
Exemple #3
0
    def test_20_launch(self, save_data, credentials, network_client,
                       compute_client, storage_client, resource_client):
        radl_data = """
            network net1 (outbound = 'yes' and outports = '8080,9000:9100' and sg_name = 'nsgname')
            network net2 ()
            system test (
            cpu.arch='x86_64' and
            cpu.count>=1 and
            memory.size>=512m and
            instance_tags = 'key=value,key1=value2' and
            net_interface.0.connection = 'net1' and
            net_interface.0.dns_name = 'test' and
            net_interface.1.connection = 'net2' and
            disk.0.os.name = 'linux' and
            disk.0.image.url = 'azr://Canonical/UbuntuServer/16.04.0-LTS/latest' and
            disk.0.os.credentials.username = '******' and
            disk.0.os.credentials.password = '******' and
            disk.1.size=1GB and
            disk.1.device='hdb' and
            disk.1.mount_path='/mnt/path' and
            disk.2.image.url='RGname/DiskName' and
            disk.2.device='hdb' and
            disk.2.mount_path='/mnt/path2'
            )"""
        radl = radl_parse.parse_radl(radl_data)
        radl.check()

        auth = Authentication([{
            'id': 'azure',
            'type': 'Azure',
            'subscription_id': 'subscription_id',
            'username': '******',
            'password': '******'
        }, {
            'type': 'InfrastructureManager',
            'username': '******',
            'password': '******'
        }])
        azure_cloud = self.get_azure_cloud()

        cclient = MagicMock()
        compute_client.return_value = cclient
        nclient = MagicMock()
        network_client.return_value = nclient
        rclient = MagicMock()
        resource_client.return_value = rclient

        nclient.virtual_networks.get.side_effect = Exception()

        subnet_create = MagicMock()
        subnet_create_res = MagicMock()
        subnet_create_res.id = "subnet-0"
        subnet_create.result.return_value = subnet_create_res
        nclient.subnets.create_or_update.return_value = subnet_create

        public_ip_create = MagicMock()
        public_ip_create_res = MagicMock()
        public_ip_create_res.id = "ip-0"
        public_ip_create.result.return_value = public_ip_create_res
        nclient.public_ip_addresses.create_or_update.return_value = public_ip_create

        instace_type = MagicMock()
        instace_type.name = "instance_type1"
        instace_type.number_of_cores = 1
        instace_type.memory_in_mb = 1024
        instace_type.resource_disk_size_in_mb = 102400
        instace_types = [instace_type]
        cclient.virtual_machine_sizes.list.return_value = instace_types

        cclient.virtual_machines.create_or_update.side_effect = self.create_vm

        disk = MagicMock()
        disk.name = "dname"
        disk.id = "did"
        cclient.disks.get.return_value = disk

        inf = InfrastructureInfo()
        inf.auth = auth
        inf.radl = radl
        res = azure_cloud.launch_with_retry(inf, radl, radl, 3, auth, 2, 0)
        self.assertEqual(len(res), 3)
        self.assertTrue(res[0][0])
        self.assertTrue(res[1][0])
        self.assertTrue(res[2][0])
        self.assertEquals(rclient.resource_groups.delete.call_count, 2)
        self.assertIn("rg-userimage-",
                      rclient.resource_groups.delete.call_args_list[0][0][0])
        self.assertIn("rg-userimage-",
                      rclient.resource_groups.delete.call_args_list[1][0][0])

        json_vm_req = cclient.virtual_machines.create_or_update.call_args_list[
            0][0][2]
        self.assertEquals(
            json_vm_req['storage_profile']['data_disks'][0]['disk_size_gb'], 1)
        self.assertEquals(
            json_vm_req['storage_profile']['data_disks'][1]['managed_disk']
            ['id'], "did")
        image_res = {
            'sku': '16.04.0-LTS',
            'publisher': 'Canonical',
            'version': 'latest',
            'offer': 'UbuntuServer'
        }
        self.assertEquals(json_vm_req['storage_profile']['image_reference'],
                          image_res)
        self.assertEquals(json_vm_req['hardware_profile']['vm_size'],
                          'instance_type1')
        self.assertEquals(json_vm_req['os_profile']['admin_username'], 'user')
        self.assertEquals(json_vm_req['os_profile']['admin_password'], 'pass')
        self.assertEquals(json_vm_req['os_profile']['admin_password'], 'pass')
        self.assertEquals(
            nclient.subnets.create_or_update.call_args_list[0][0][3],
            {'address_prefix': '10.0.1.0/24'})
        self.assertEquals(
            nclient.subnets.create_or_update.call_args_list[1][0][3],
            {'address_prefix': '10.0.2.0/24'})

        radl_data = """
            network net1 (outbound = 'yes')
            network net2 ()
            system test (
            cpu.arch='x86_64' and
            cpu.count>=1 and
            memory.size>=512m and
            instance_tags = 'key=value,key1=value2' and
            net_interface.0.connection = 'net1' and
            net_interface.0.dns_name = 'test' and
            net_interface.1.connection = 'net2' and
            disk.0.os.name = 'linux' and
            disk.0.image.url = 'azr://error/rgname/diskname' and
            disk.0.os.credentials.username = '******' and
            disk.0.os.credentials.password = '******'
            )"""
        radl = radl_parse.parse_radl(radl_data)
        radl.check()
        with self.assertRaises(Exception) as ex:
            azure_cloud.launch(inf, radl, radl, 1, auth)
        self.assertEquals(str(ex.exception),
                          "Incorrect image url: it must be snapshot or disk.")

        radl_data = """
            network net1 (outbound = 'yes')
            network net2 (cidr = '192.168.*.0/24')
            system test (
            cpu.arch='x86_64' and
            cpu.count>=1 and
            memory.size>=512m and
            instance_tags = 'key=value,key1=value2' and
            net_interface.0.connection = 'net1' and
            net_interface.0.dns_name = 'test' and
            net_interface.1.connection = 'net2' and
            disk.0.os.name = 'linux' and
            disk.0.image.url = 'azr://snapshot/rgname/diskname' and
            disk.0.os.credentials.username = '******' and
            disk.0.os.credentials.password = '******'
            )"""
        radl = radl_parse.parse_radl(radl_data)
        radl.check()
        res = azure_cloud.launch(inf, radl, radl, 1, auth)
        json_vm_req = cclient.virtual_machines.create_or_update.call_args_list[
            5][0][2]
        self.assertEquals(json_vm_req['storage_profile']['os_disk']['os_type'],
                          'linux')
        self.assertEquals(
            nclient.subnets.create_or_update.call_args_list[5][0][3],
            {'address_prefix': '192.168.1.0/24'})
Exemple #4
0
    def test_20_launch(self, save_data, get_driver):
        radl_data = """
            network net1 (outbound = 'yes' and outports = '8080,9000:9100')
            network net2 ()
            system test (
            cpu.arch='x86_64' and
            cpu.count=1 and
            memory.size=512m and
            instance_tags='key=value,key1=value2' and
            net_interface.0.connection = 'net1' and
            net_interface.0.dns_name = 'test' and
            net_interface.1.connection = 'net2' and
            disk.0.os.name = 'linux' and
            disk.0.image.url = 'gce://us-central1-a/centos-6' and
            disk.0.os.credentials.username = '******' and
            disk.1.size=1GB and
            disk.1.device='hdb' and
            disk.1.mount_path='/mnt/path' and
            disk.2.image.url='gce://us-central1-a/somedisk' and
            disk.2.device='hdc' and
            disk.2.mount_path='/mnt2/path'
            )"""
        radl = radl_parse.parse_radl(radl_data)
        radl.check()

        auth = Authentication([{
            'id': 'one',
            'type': 'GCE',
            'username': '******',
            'password': '******',
            'project': 'proj'
        }, {
            'type': 'InfrastructureManager',
            'username': '******',
            'password': '******'
        }])
        gce_cloud = self.get_gce_cloud()

        driver = MagicMock()
        get_driver.return_value = driver

        node_size = MagicMock()
        node_size.ram = 512
        node_size.price = 1
        node_size.disk = 1
        node_size.vcpus = 1
        node_size.name = "small"
        node_size.extra = {'guestCpus': 1}
        driver.list_sizes.return_value = [node_size]

        image = MagicMock()
        image.extra['selfLink'] = "image_selfLink"
        driver.ex_get_image.return_value = image
        driver.ex_create_address.return_value = "ip"
        net = MagicMock()
        net.name = "default"
        driver.ex_list_networks.return_value = [net]

        node = MagicMock()
        node.id = "gce1"
        node.name = "gce1name"
        driver.create_node.return_value = node

        node2 = MagicMock()
        node2.id = "gce2"
        node2.name = "gce2name"
        node3 = MagicMock()
        node3.id = "gce3"
        node3.name = "gce3name"
        driver.ex_create_multiple_nodes.return_value = [node, node2, node3]

        inf = InfrastructureInfo()
        inf.auth = auth
        inf.radl = radl
        res = gce_cloud.launch(inf, radl, radl, 1, auth)
        success, _ = res[0]
        self.assertTrue(success, msg="ERROR: launching a single VM.")
        self.assertNotIn("ERROR",
                         self.log.getvalue(),
                         msg="ERROR found in log: %s" % self.log.getvalue())
        self.assertEqual(driver.create_node.call_args_list[0][1]['ex_network'],
                         "default")
        self.assertEqual(
            driver.create_node.call_args_list[0][1]['external_ip'],
            "ephemeral")
        self.assertEqual(
            driver.create_node.call_args_list[0][1]['ex_disks_gce_struct'][1]
            ['deviceName'], "hdb")
        self.assertEqual(
            driver.create_node.call_args_list[0][1]['ex_disks_gce_struct'][1]
            ['autoDelete'], True)
        self.assertEqual(
            driver.create_node.call_args_list[0][1]['ex_disks_gce_struct'][2]
            ['deviceName'], "hdc")
        self.assertEqual(
            driver.create_node.call_args_list[0][1]['ex_disks_gce_struct'][2]
            ['autoDelete'], False)
        self.assertEqual(driver.ex_create_firewall.call_args_list[0][0][0],
                         "im-%s-default-all" % inf.id)
        self.assertEqual(driver.ex_create_firewall.call_args_list[1][0][0],
                         "im-%s-default" % inf.id)
        self.assertEqual(driver.ex_create_firewall.call_args_list[0][0][1],
                         [{
                             'IPProtocol': 'udp',
                             'ports': '1-65535'
                         }, {
                             'IPProtocol': 'tcp',
                             'ports': '1-65535'
                         }, {
                             'IPProtocol': 'icmp'
                         }])
        self.assertEqual(driver.ex_create_firewall.call_args_list[1][0][1],
                         [{
                             'IPProtocol': 'tcp',
                             'ports': ['22', '8080', '9000-9100']
                         }])

        inf = InfrastructureInfo()
        inf.auth = auth
        inf.radl = radl
        res = gce_cloud.launch(inf, radl, radl, 3, auth)
        success, _ = res[0]
        self.assertTrue(success, msg="ERROR: launching 3 VMs.")
        self.assertNotIn("ERROR",
                         self.log.getvalue(),
                         msg="ERROR found in log: %s" % self.log.getvalue())

        radl_data = """
            network net1 (outbound = 'yes' and outports = '8080,9000:9100')
            network net2 (create='yes' and cidr='10.0.*.0/24')
            system test (
            cpu.arch='x86_64' and
            cpu.count=1 and
            memory.size=512m and
            net_interface.0.connection = 'net1' and
            net_interface.0.dns_name = 'test' and
            net_interface.0.ip = '10.0.0.1' and
            net_interface.1.connection = 'net2' and
            disk.0.os.name = 'linux' and
            disk.0.image.url = 'gce://us-central1-a/centos-6' and
            disk.0.os.credentials.username = '******' and
            disk.1.size=1GB and
            disk.1.device='hdb' and
            disk.1.mount_path='/mnt/path'
            )"""
        radl = radl_parse.parse_radl(radl_data)
        radl.check()
        driver.create_node.side_effect = Exception("Error msg")

        net = MagicMock()
        net.cidr = "10.0.1.0/24"
        driver.ex_list_networks.return_value = [net]

        driver.ex_get_network.return_value = None
        inf = InfrastructureInfo()
        inf.auth = auth
        inf.radl = radl
        res = gce_cloud.launch(inf, radl, radl, 1, auth)
        success, msg = res[0]
        self.assertFalse(success)
        self.assertEqual(msg, "ERROR: Error msg")
        self.assertEqual(driver.ex_destroy_address.call_count, 1)
        self.assertEqual(driver.ex_destroy_address.call_args_list,
                         [call('ip')])
        self.assertEqual(driver.ex_create_network.call_args_list[0][0][0],
                         "im-%s-net2" % inf.id)
        self.assertEqual(driver.ex_create_network.call_args_list[0][0][1],
                         "10.0.2.0/24")
Exemple #5
0
    def test_20_launch(self, save_data, requests):
        radl_data = """
            network net1 (outbound = 'yes')
            network net2 (outports = '8080,9000/udp')
            network net3 (federated = 'yes' and providers = 'p1,p2')
            network net4 (federated = 'yes' and providers = ['p1','p2'])
            system test (
            gpu.count=1 and
            cpu.sgx.epc_size=8 and
            cpu.arch='x86_64' and
            cpu.count>=1 and
            memory.size>=512m and
            net_interface.0.connection = 'net1' and
            net_interface.0.dns_name = 'test' and
            net_interface.1.connection = 'net2' and
            net_interface.2.connection = 'net3' and
            net_interface.3.connection = 'net4' and
            availability_zone = 'cloud@site' and
            disk.0.os.name = 'linux' and
            disk.0.image.url = 'fbw://server.com/fogbow-ubuntu' and
            disk.0.os.credentials.username = '******'
            )"""
        radl = radl_parse.parse_radl(radl_data)
        radl.check()

        auth = Authentication([{
            'id': 'fogbow',
            'type': 'FogBow',
            'token': 'user',
            'host': 'server.com'
        }])
        fogbow_cloud = self.get_fogbow_cloud()

        requests.side_effect = self.get_response

        inf = InfrastructureInfo()
        inf.auth = auth
        inf.radl = radl
        res = fogbow_cloud.launch(inf, radl, radl, 1, auth)
        success, _ = res[0]
        self.assertTrue(success, msg="ERROR: launching a VM.")
        self.assertNotIn("ERROR",
                         self.log.getvalue(),
                         msg="ERROR found in log: %s" % self.log.getvalue())

        data = json.loads(requests.call_args_list[4][1]["data"])
        self.assertEqual(data["allocationMode"], "dynamic")

        data = json.loads(requests.call_args_list[7][1]["data"])
        self.assertEqual(
            data, {
                "direction": "IN",
                "protocol": "TCP",
                "etherType": "IPv4",
                "portTo": 8080,
                "portFrom": 8080,
                "cidr": "0.0.0.0/0"
            })
        data = json.loads(requests.call_args_list[8][1]["data"])
        self.assertEqual(
            data, {
                "direction": "IN",
                "protocol": "UDP",
                "etherType": "IPv4",
                "portTo": 9000,
                "portFrom": 9000,
                "cidr": "0.0.0.0/0"
            })

        data = json.loads(requests.call_args_list[9][1]["data"])
        self.assertEqual(data['cidr'], "10.0.2.0/24")

        data = json.loads(requests.call_args_list[13][1]["data"])
        self.assertEqual(data["compute"]["cloudName"], "cloud")
        self.assertEqual(data["compute"]["provider"], "site")
        self.assertEqual(data["compute"]["vCPU"], 1)
        self.assertEqual(data["compute"]["memory"], 512)
        self.assertEqual(data["compute"]["imageId"], "fogbow-ubuntu")
        self.assertEqual(data["compute"]["requirements"], {
            'sgx:epc_size': '8',
            'gpu': 'true'
        })
        self.assertEqual(data["federatedNetworkId"], "1")