def get_azure_cloud(): cloud_info = CloudInfo() cloud_info.type = "Azure" inf = MagicMock() inf.id = "1" cloud = AzureCloudConnector(cloud_info, inf) return cloud
def get_fogbow_cloud(): cloud_info = CloudInfo() cloud_info.type = "FogBow" cloud_info.server = "server.com" cloud_info.port = 8182 cloud = FogBowCloudConnector(cloud_info) return cloud
def get_one_cloud(): cloud_info = CloudInfo() cloud_info.type = "OpenNebula" cloud_info.server = "server.com" cloud_info.port = 2633 one_cloud = OpenNebulaCloudConnector(cloud_info) return one_cloud
def get_ec2_cloud(): cloud_info = CloudInfo() cloud_info.type = "EC2" inf = MagicMock() inf.id = "1" cloud = EC2CloudConnector(cloud_info, inf) return cloud
def get_gce_cloud(): cloud_info = CloudInfo() cloud_info.type = "GCE" inf = MagicMock() inf.id = "1" gce_cloud = GCECloudConnector(cloud_info, inf) return gce_cloud
def test_db(self): """ Test DB data access """ inf = InfrastructureInfo() inf.id = "1" inf.auth = self.getAuth([0], [], [("Dummy", 0)]) cloud = CloudInfo() cloud.type = "Dummy" radl = RADL() radl.add( system( "s0", [Feature("disk.0.image.url", "=", "mock0://linux.for.ev.er")])) radl.add(deploy("s0", 1)) vm1 = VirtualMachine(inf, "1", cloud, radl, radl, None, 1) vm2 = VirtualMachine(inf, "2", cloud, radl, radl, None, 2) inf.vm_list = [vm1, vm2] inf.vm_master = vm1 # first create the DB table Config.DATA_DB = "sqlite:///tmp/ind.dat" InfrastructureList.load_data() success = InfrastructureList._save_data_to_db(Config.DATA_DB, {"1": inf}) self.assertTrue(success) res = InfrastructureList._get_data_from_db(Config.DATA_DB) self.assertEqual(len(res), 1) self.assertEqual(len(res['1'].vm_list), 2) self.assertEqual(res['1'].vm_list[0], res['1'].vm_master) self.assertEqual( res['1'].vm_master.info.systems[0].getValue("disk.0.image.url"), "mock0://linux.for.ev.er") self.assertTrue(res['1'].auth.compare(inf.auth, "InfrastructureManager"))
def get_ost_cloud(): cloud_info = CloudInfo() cloud_info.type = "OpenStack" cloud_info.protocol = "https" cloud_info.server = "server.com" cloud_info.port = 5000 one_cloud = OpenStackCloudConnector(cloud_info) return one_cloud
def get_vsphere_cloud(): cloud_info = CloudInfo() cloud_info.type = "vSphere" cloud_info.server = "vspherehost" inf = MagicMock() inf.id = "1" cloud = vSphereCloudConnector(cloud_info, inf) return cloud
def get_kube_cloud(): cloud_info = CloudInfo() cloud_info.type = "Kubernetes" cloud_info.protocol = "http" cloud_info.server = "server.com" cloud_info.port = 8080 cloud = KubernetesCloudConnector(cloud_info) return cloud
def get_occi_cloud(): cloud_info = CloudInfo() cloud_info.type = "OCCI" cloud_info.protocol = "https" cloud_info.server = "server.com" cloud_info.port = 11443 cloud = OCCICloudConnector(cloud_info) return cloud
def get_docker_cloud(): cloud_info = CloudInfo() cloud_info.type = "Kubernetes" cloud_info.protocol = "http" cloud_info.server = "server.com" cloud_info.port = 2375 cloud = DockerCloudConnector(cloud_info) return cloud
def get_docker_cloud(): cloud_info = CloudInfo() cloud_info.type = "Docker" cloud_info.protocol = "http" cloud_info.server = "server.com" cloud_info.port = 2375 cloud = DockerCloudConnector(cloud_info) return cloud
def get_fogbow_cloud(): cloud_info = CloudInfo() cloud_info.type = "FogBow" cloud_info.server = "server.com" cloud_info.port = 8182 inf = MagicMock() inf.id = "1" cloud = FogBowCloudConnector(cloud_info, inf) return cloud
def get_one_cloud(): cloud_info = CloudInfo() cloud_info.type = "OpenNebula" cloud_info.server = "server.com" cloud_info.port = 2633 inf = MagicMock() inf.id = "1" one_cloud = OpenNebulaCloudConnector(cloud_info, inf) return one_cloud
def get_osc_cloud(): cloud_info = CloudInfo() cloud_info.type = "CloudStack" cloud_info.protocol = "http" cloud_info.server = "server.com" inf = MagicMock() inf.id = "1" cloud = CloudStackCloudConnector(cloud_info, inf) return cloud
def gen_launch_res(self, inf, radl, requested_radl, num_vm, auth_data): res = [] for _ in range(num_vm): cloud = CloudInfo() cloud.type = "Dummy" vm = VirtualMachine(inf, "1234", cloud, radl, requested_radl) vm.get_ssh = Mock(side_effect=self.get_dummy_ssh) vm.state = VirtualMachine.RUNNING res.append((True, vm)) return res
def get_occi_cloud(): cloud_info = CloudInfo() cloud_info.type = "OCCI" cloud_info.protocol = "https" cloud_info.server = "server.com" cloud_info.port = 11443 inf = MagicMock() inf.id = "1" cloud = OCCICloudConnector(cloud_info, inf) return cloud
def gen_launch_res(self, inf, radl, requested_radl, num_vm, auth_data): res = [] for i in range(num_vm): cloud = CloudInfo() cloud.type = "DeployedNode" vm = VirtualMachine(inf, "1234", cloud, radl, requested_radl) # create the mock for the vm finalize function vm.finalize = Mock(return_value=(True, vm)) res.append((True, vm)) return res
def get_docker_cloud(): cloud_info = CloudInfo() cloud_info.type = "Docker" cloud_info.protocol = "http" cloud_info.server = "server.com" cloud_info.port = 2375 inf = MagicMock() inf.id = "1" cloud = DockerCloudConnector(cloud_info, inf) return cloud
def get_ost_cloud(): cloud_info = CloudInfo() cloud_info.type = "OpenStack" cloud_info.protocol = "https" cloud_info.server = "server.com" cloud_info.port = 5000 inf = MagicMock() inf.id = "1" one_cloud = OpenStackCloudConnector(cloud_info, inf) return one_cloud
def get_kube_cloud(): cloud_info = CloudInfo() cloud_info.type = "Kubernetes" cloud_info.protocol = "http" cloud_info.server = "server.com" cloud_info.port = 8080 inf = MagicMock() inf.id = "1" cloud = KubernetesCloudConnector(cloud_info, inf) return cloud
def get_ec2_cloud(): cloud_info = CloudInfo() cloud_info.type = "EC2" cloud = EC2CloudConnector(cloud_info) return cloud
def get_gce_cloud(): cloud_info = CloudInfo() cloud_info.type = "GCE" one_cloud = GCECloudConnector(cloud_info) return one_cloud
def get_lib_cloud(): cloud_info = CloudInfo() cloud_info.type = "LibCloud" cloud = LibCloudCloudConnector(cloud_info) return cloud
def get_azure_cloud(): cloud_info = CloudInfo() cloud_info.type = "Azure" cloud = AzureCloudConnector(cloud_info) return cloud
def get_azure_cloud(): cloud_info = CloudInfo() cloud_info.type = "AzureClassic" cloud = AzureClassicCloudConnector(cloud_info) return cloud