From 29ac5ae3d0815dc65110d779bcbc9834de2cb2be Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 14 Mar 2022 12:52:50 +0100 Subject: [PATCH 1/4] Add azure dependency --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f9584f36..30dbe907c 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ Azure python SDK (https://azure.microsoft.com/es-es/develop/python/) is used to Microsoft Azure platform. The easiest way is to install all the required packages with pip: ```sh -$ pip install msrest msrestazure azure-common azure-mgmt-storage azure-mgmt-compute azure-mgmt-network azure-mgmt-resource azure-mgmt-dns +$ pip install msrest msrestazure azure-common azure-mgmt-storage azure-mgmt-compute azure-mgmt-network azure-mgmt-resource azure-mgmt-dns azure-identity ``` The VMware vSphere API Python Bindings (https://github.com/vmware/pyvmomi/) are needed by the vSphere From 8b0962862b40401594affbb0c672d46bdc305711 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 14 Mar 2022 13:15:42 +0100 Subject: [PATCH 2/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 30dbe907c..40821a469 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ All the information about this chart is available at the [IM chart README](https ### 3.1 REQUISITES -IM is based on Python, so Python 2.7 or higher (Python 3.5 or higher recommended) runtime and +IM is based on Python, so Python 2.7 or higher (Python 3.6 or higher recommended) runtime and standard library must be installed in the system. If you use pip to install the IM, all the requisites will be installed. From f6695296866a928e1efe804abbffd3a7e42fa5ad Mon Sep 17 00:00:00 2001 From: Karthikeyan Singaravelan Date: Mon, 21 Mar 2022 11:26:40 +0000 Subject: [PATCH 3/4] Refactor deprecated unittest aliases for Python 3.11 compatibility. --- test/integration/TestREST.py | 2 +- test/unit/connectors/Azure.py | 48 +++++++++++++++--------------- test/unit/connectors/CloudStack.py | 2 +- test/unit/connectors/Docker.py | 4 +-- test/unit/connectors/EC2.py | 48 +++++++++++++++--------------- test/unit/connectors/Fogbow.py | 8 ++--- test/unit/connectors/GCE.py | 40 ++++++++++++------------- test/unit/connectors/Linode.py | 12 ++++---- test/unit/connectors/OpenNebula.py | 4 +-- test/unit/connectors/OpenStack.py | 48 +++++++++++++++--------------- test/unit/connectors/Orange.py | 24 +++++++-------- 11 files changed, 120 insertions(+), 120 deletions(-) diff --git a/test/integration/TestREST.py b/test/integration/TestREST.py index 70dd128fe..64bc44fd6 100755 --- a/test/integration/TestREST.py +++ b/test/integration/TestREST.py @@ -452,7 +452,7 @@ def test_94_get_outputs(self): msg="ERROR getting TOSCA outputs:" + resp.text) res = json.loads(resp.text) server_url = str(res['outputs']['server_url'][0]) - self.assertRegexpMatches( + self.assertRegex( server_url, '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', msg="Unexpected outputs: " + resp.text) def test_95_add_tosca(self): diff --git a/test/unit/connectors/Azure.py b/test/unit/connectors/Azure.py index 279478b5c..98a82c619 100755 --- a/test/unit/connectors/Azure.py +++ b/test/unit/connectors/Azure.py @@ -217,20 +217,20 @@ def test_20_launch(self, save_data, credentials, network_client, compute_client, self.assertTrue(res[0][0]) self.assertTrue(res[1][0]) self.assertTrue(res[2][0]) - self.assertEquals(nclient.network_interfaces.begin_delete.call_count, 1) + self.assertEqual(nclient.network_interfaces.begin_delete.call_count, 1) self.assertIn("nic_name", nclient.network_interfaces.begin_delete.call_args_list[0][0][1]) json_vm_req = cclient.virtual_machines.begin_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") + self.assertEqual(json_vm_req['storage_profile']['data_disks'][0]['disk_size_gb'], 1) + self.assertEqual(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'], 'Standard_A1') - 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.begin_create_or_update.call_args_list[0][0][3]['address_prefix'], - '10.0.1.0/24') + self.assertEqual(json_vm_req['storage_profile']['image_reference'], image_res) + self.assertEqual(json_vm_req['hardware_profile']['vm_size'], 'Standard_A1') + self.assertEqual(json_vm_req['os_profile']['admin_username'], 'user') + self.assertEqual(json_vm_req['os_profile']['admin_password'], 'pass') + self.assertEqual(json_vm_req['os_profile']['admin_password'], 'pass') + self.assertEqual(nclient.subnets.begin_create_or_update.call_args_list[0][0][3]['address_prefix'], + '10.0.1.0/24') radl_data = """ network net1 (outbound = 'yes') @@ -252,7 +252,7 @@ def test_20_launch(self, save_data, credentials, network_client, compute_client, 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.") + self.assertEqual(str(ex.exception), "Incorrect image url: it must be snapshot or disk.") radl_data = """ network net1 (outbound = 'yes') @@ -274,9 +274,9 @@ def test_20_launch(self, save_data, credentials, network_client, compute_client, radl.check() res = azure_cloud.launch(inf, radl, radl, 1, auth) json_vm_req = cclient.virtual_machines.begin_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.begin_create_or_update.call_args_list[2][0][3]['address_prefix'], - '192.168.1.0/24') + self.assertEqual(json_vm_req['storage_profile']['os_disk']['os_type'], 'linux') + self.assertEqual(nclient.subnets.begin_create_or_update.call_args_list[2][0][3]['address_prefix'], + '192.168.1.0/24') radl_data = """ network net1 (outbound = 'yes') @@ -304,10 +304,10 @@ def test_20_launch(self, save_data, credentials, network_client, compute_client, subnet_create.address_prefix = "10.0.1.0/24" nclient.subnets.get.return_value = subnet_create res = azure_cloud.launch(inf, radl, radl, 1, auth) - self.assertEquals(nclient.subnets.get.call_args_list[3][0][1], 'vnet') - self.assertEquals(nclient.subnets.get.call_args_list[3][0][2], 'subnet1') - self.assertEquals(nclient.subnets.begin_create_or_update.call_count, 3) - self.assertEquals(nclient.virtual_networks.begin_create_or_update.call_count, 3) + self.assertEqual(nclient.subnets.get.call_args_list[3][0][1], 'vnet') + self.assertEqual(nclient.subnets.get.call_args_list[3][0][2], 'subnet1') + self.assertEqual(nclient.subnets.begin_create_or_update.call_count, 3) + self.assertEqual(nclient.virtual_networks.begin_create_or_update.call_count, 3) @patch('IM.connectors.Azure.NetworkManagementClient') @patch('IM.connectors.Azure.ComputeManagementClient') @@ -393,11 +393,11 @@ def test_30_updateVMInfo(self, credentials, dns_client, compute_client, network_ success, vm = azure_cloud.updateVMInfo(vm, auth) self.assertTrue(success, msg="ERROR: updating VM info.") - self.assertEquals(dclient.zones.create_or_update.call_args_list, - [call('rg0', 'domain.com', {'location': 'global'})]) - self.assertEquals(dclient.record_sets.create_or_update.call_args_list, - [call('rg0', 'domain.com', 'test', 'A', - {'arecords': [{'ipv4_address': '13.0.0.1'}], 'ttl': 300})]) + self.assertEqual(dclient.zones.create_or_update.call_args_list, + [call('rg0', 'domain.com', {'location': 'global'})]) + self.assertEqual(dclient.record_sets.create_or_update.call_args_list, + [call('rg0', 'domain.com', 'test', 'A', + {'arecords': [{'ipv4_address': '13.0.0.1'}], 'ttl': 300})]) self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) @patch('IM.connectors.Azure.ComputeManagementClient') @@ -564,7 +564,7 @@ def test_60_finalize(self, credentials, resource_client, compute_client): self.assertTrue(success, msg="ERROR: finalizing VM info.") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) - self.assertEquals(cclient.virtual_machines.begin_delete.call_count, 2) + self.assertEqual(cclient.virtual_machines.begin_delete.call_count, 2) self.assertEqual(cclient.virtual_machines.begin_delete.call_args_list[0][0], ('rg0', 'vm0')) self.assertEqual(rclient.resource_groups.begin_delete.call_count, 1) self.assertEqual(rclient.resource_groups.begin_delete.call_args_list[0][0], ('rg0',)) diff --git a/test/unit/connectors/CloudStack.py b/test/unit/connectors/CloudStack.py index 98499c069..9bad9d867 100755 --- a/test/unit/connectors/CloudStack.py +++ b/test/unit/connectors/CloudStack.py @@ -206,7 +206,7 @@ def test_30_updateVMInfo(self, get_driver): success, vm = osc_cloud.updateVMInfo(vm, auth) self.assertTrue(success, msg="ERROR: updating VM info.") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) @patch('libcloud.compute.drivers.cloudstack.CloudStackNodeDriver') diff --git a/test/unit/connectors/Docker.py b/test/unit/connectors/Docker.py index 1b7d10dba..f14526587 100755 --- a/test/unit/connectors/Docker.py +++ b/test/unit/connectors/Docker.py @@ -222,7 +222,7 @@ def test_30_updateVMInfo(self, requests): success, vm = docker_cloud.updateVMInfo(vm, auth) self.assertTrue(success, msg="ERROR: updating VM info.") - self.assertEquals(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") + self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) self.activate_swarm() @@ -232,7 +232,7 @@ def test_30_updateVMInfo(self, requests): docker_cloud._swarm = None self.assertTrue(success, msg="ERROR: updating VM info.") - self.assertEquals(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") + self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) @patch('requests.request') diff --git a/test/unit/connectors/EC2.py b/test/unit/connectors/EC2.py index acecffc71..4e643c6f7 100755 --- a/test/unit/connectors/EC2.py +++ b/test/unit/connectors/EC2.py @@ -177,10 +177,10 @@ def test_20_launch(self, save_data, blockdevicemapping, VPCConnection, get_regio 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) + self.assertEqual(len(conn.create_security_group.call_args_list), 3) + self.assertEqual(conn.create_security_group.call_args_list[0][0][0], "im-%s" % inf.id) + self.assertEqual(conn.create_security_group.call_args_list[1][0][0], "sgname") + self.assertEqual(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 = """ @@ -225,10 +225,10 @@ def test_20_launch(self, save_data, blockdevicemapping, VPCConnection, get_regio self.assertTrue(success, msg="ERROR: launching a VM.") # check the instance_type selected is correct self.assertIn(".micro", conn.run_instances.call_args_list[1][1]["instance_type"]) - 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.assertEqual(conn.create_vpc.call_args_list[0][0][0], "10.0.128.0/22") + self.assertEqual(conn.create_subnet.call_args_list[0][0], ('vpc-id', '10.0.128.0/24')) + self.assertEqual(conn.create_subnet.call_args_list[1][0], ('vpc-id', '10.0.129.0/24')) + self.assertEqual(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()) @@ -400,11 +400,11 @@ def test_30_updateVMInfo(self, record_sets, connect_to_region, get_connection): self.assertTrue(success, msg="ERROR: updating VM info.") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) - self.assertEquals(dns_conn.create_zone.call_count, 1) - self.assertEquals(dns_conn.create_zone.call_args_list[0][0][0], "domain.com.") - self.assertEquals(changes.add_change.call_args_list, [call('CREATE', 'test.domain.com.', 'A')]) - self.assertEquals(change.add_value.call_args_list, [call('158.42.1.1')]) - self.assertEquals(conn.create_route.call_args_list, [call('routet-id', '10.0.10.0/24', instance_id='int-id')]) + self.assertEqual(dns_conn.create_zone.call_count, 1) + self.assertEqual(dns_conn.create_zone.call_args_list[0][0][0], "domain.com.") + self.assertEqual(changes.add_change.call_args_list, [call('CREATE', 'test.domain.com.', 'A')]) + self.assertEqual(change.add_value.call_args_list, [call('158.42.1.1')]) + self.assertEqual(conn.create_route.call_args_list, [call('routet-id', '10.0.10.0/24', instance_id='int-id')]) @patch('IM.connectors.EC2.EC2CloudConnector.get_connection') def test_30_updateVMInfo_spot(self, get_connection): @@ -690,17 +690,17 @@ def test_60_finalize(self, record_sets, connect_to_region, sleep, get_connection self.assertTrue(success, msg="ERROR: finalizing VM info.") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) - self.assertEquals(dns_conn.delete_hosted_zone.call_count, 1) - self.assertEquals(dns_conn.delete_hosted_zone.call_args_list[0][0][0], zone.id) - self.assertEquals(changes.add_change.call_args_list, [call('DELETE', 'test.domain.com.', 'A')]) - self.assertEquals(change.add_value.call_args_list, [call('158.42.1.1')]) - self.assertEquals(sg.delete.call_args_list, [call()]) - self.assertEquals(sg1.delete.call_args_list, []) - self.assertEquals(sg2.delete.call_args_list, [call()]) - self.assertEquals(conn.delete_subnet.call_args_list, [call('subnet-id')]) - self.assertEquals(conn.delete_vpc.call_args_list, [call('vpc-id')]) - self.assertEquals(conn.delete_internet_gateway.call_args_list, [call('ig-id')]) - self.assertEquals(conn.detach_internet_gateway.call_args_list, [call('ig-id', 'vpc-id')]) + self.assertEqual(dns_conn.delete_hosted_zone.call_count, 1) + self.assertEqual(dns_conn.delete_hosted_zone.call_args_list[0][0][0], zone.id) + self.assertEqual(changes.add_change.call_args_list, [call('DELETE', 'test.domain.com.', 'A')]) + self.assertEqual(change.add_value.call_args_list, [call('158.42.1.1')]) + self.assertEqual(sg.delete.call_args_list, [call()]) + self.assertEqual(sg1.delete.call_args_list, []) + self.assertEqual(sg2.delete.call_args_list, [call()]) + self.assertEqual(conn.delete_subnet.call_args_list, [call('subnet-id')]) + self.assertEqual(conn.delete_vpc.call_args_list, [call('vpc-id')]) + self.assertEqual(conn.delete_internet_gateway.call_args_list, [call('ig-id')]) + self.assertEqual(conn.detach_internet_gateway.call_args_list, [call('ig-id', 'vpc-id')]) @patch('IM.connectors.EC2.EC2CloudConnector.get_connection') @patch('time.sleep') diff --git a/test/unit/connectors/Fogbow.py b/test/unit/connectors/Fogbow.py index 7283d04ab..f6e2d552a 100755 --- a/test/unit/connectors/Fogbow.py +++ b/test/unit/connectors/Fogbow.py @@ -298,10 +298,10 @@ def test_30_updateVMInfo(self, sleep, requests): self.assertTrue(success, msg="ERROR: updating VM info.") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) - self.assertEquals(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") - self.assertEquals(vm.info.systems[0].getValue("memory.size"), 1073741824) - self.assertEquals(vm.info.systems[0].getValue("disk.1.device"), "/dev/sdb") + self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") + self.assertEqual(vm.info.systems[0].getValue("memory.size"), 1073741824) + self.assertEqual(vm.info.systems[0].getValue("disk.1.device"), "/dev/sdb") data = json.loads(requests.call_args_list[1][1]["data"]) self.assertEqual(data["computeId"], '1') diff --git a/test/unit/connectors/GCE.py b/test/unit/connectors/GCE.py index f026c8738..039a8b1d9 100755 --- a/test/unit/connectors/GCE.py +++ b/test/unit/connectors/GCE.py @@ -296,14 +296,14 @@ def test_30_updateVMInfo(self, get_dns_driver, get_driver): self.assertTrue(success, msg="ERROR: updating VM info.") - self.assertEquals(dns_driver.create_zone.call_count, 1) - self.assertEquals(dns_driver.create_record.call_count, 1) - self.assertEquals(dns_driver.create_zone.call_args_list[0], call('domain.com.')) - self.assertEquals(dns_driver.create_record.call_args_list[0][0][0], 'test.domain.com.') - self.assertEquals(dns_driver.create_record.call_args_list[0][0][2], 'A') - self.assertEquals(dns_driver.create_record.call_args_list[0][0][3], {'rrdatas': ['158.42.1.1'], 'ttl': 300}) - self.assertEquals(vm.info.systems[0].getValue('gpu.count'), 1) - self.assertEquals(vm.info.systems[0].getValue('gpu.model'), 'nvidia-tesla-v100') + self.assertEqual(dns_driver.create_zone.call_count, 1) + self.assertEqual(dns_driver.create_record.call_count, 1) + self.assertEqual(dns_driver.create_zone.call_args_list[0], call('domain.com.')) + self.assertEqual(dns_driver.create_record.call_args_list[0][0][0], 'test.domain.com.') + self.assertEqual(dns_driver.create_record.call_args_list[0][0][2], 'A') + self.assertEqual(dns_driver.create_record.call_args_list[0][0][3], {'rrdatas': ['158.42.1.1'], 'ttl': 300}) + self.assertEqual(vm.info.systems[0].getValue('gpu.count'), 1) + self.assertEqual(vm.info.systems[0].getValue('gpu.model'), 'nvidia-tesla-v100') self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) @@ -327,7 +327,7 @@ def test_40_stop(self, get_driver): self.assertTrue(success, msg="ERROR: stopping VM info.") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) - self.assertEquals(driver.ex_stop_node.call_args_list, [call(node)]) + self.assertEqual(driver.ex_stop_node.call_args_list, [call(node)]) @patch('libcloud.compute.drivers.gce.GCENodeDriver') def test_50_start(self, get_driver): @@ -349,7 +349,7 @@ def test_50_start(self, get_driver): self.assertTrue(success, msg="ERROR: stopping VM info.") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) - self.assertEquals(driver.ex_start_node.call_args_list, [call(node)]) + self.assertEqual(driver.ex_start_node.call_args_list, [call(node)]) @patch('libcloud.compute.drivers.gce.GCENodeDriver') def test_52_reboot(self, get_driver): @@ -371,7 +371,7 @@ def test_52_reboot(self, get_driver): self.assertTrue(success, msg="ERROR: stopping VM info.") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) - self.assertEquals(driver.reboot_node.call_args_list, [call(node)]) + self.assertEqual(driver.reboot_node.call_args_list, [call(node)]) @patch('libcloud.compute.drivers.gce.GCENodeDriver') @patch('libcloud.dns.drivers.google.GoogleDNSDriver') @@ -439,12 +439,12 @@ def test_60_finalize(self, sleep, get_dns_driver, get_driver): self.assertTrue(success, msg="ERROR: finalizing VM info.") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) - self.assertEquals(dns_driver.delete_record.call_count, 1) - self.assertEquals(dns_driver.delete_record.call_args_list[0][0][0].name, 'test.domain.com.') - self.assertEquals(node.destroy.call_args_list, [call()]) - self.assertEquals(net.destroy.call_args_list, [call()]) - self.assertEquals(fw.destroy.call_args_list, [call()]) - self.assertEquals(route.destroy.call_args_list, [call()]) + self.assertEqual(dns_driver.delete_record.call_count, 1) + self.assertEqual(dns_driver.delete_record.call_args_list[0][0][0].name, 'test.domain.com.') + self.assertEqual(node.destroy.call_args_list, [call()]) + self.assertEqual(net.destroy.call_args_list, [call()]) + self.assertEqual(fw.destroy.call_args_list, [call()]) + self.assertEqual(route.destroy.call_args_list, [call()]) def test_70_get_custom_instance(self): radl_data = """ @@ -462,8 +462,8 @@ def test_70_get_custom_instance(self): driver = MagicMock() driver.list_sizes.return_value = [size] instance = gce_cloud.get_instance_type(driver, radl.systems[0]) - self.assertEquals(instance.name, "custom-2-2048") - self.assertEquals(instance.extra['selfLink'], "/some/path/custom-2-2048") + self.assertEqual(instance.name, "custom-2-2048") + self.assertEqual(instance.extra['selfLink'], "/some/path/custom-2-2048") size2 = MagicMock() size2.extra = {"selfLink": "/some/path/sizenamne", "guestCpus": 2} @@ -471,7 +471,7 @@ def test_70_get_custom_instance(self): size2.name = "sizenamne" driver.list_sizes.return_value = [size, size2] instance = gce_cloud.get_instance_type(driver, radl.systems[0]) - self.assertEquals(instance.name, "sizenamne") + self.assertEqual(instance.name, "sizenamne") @patch('libcloud.compute.drivers.gce.GCENodeDriver') def test_get_cloud_info(self, get_driver): diff --git a/test/unit/connectors/Linode.py b/test/unit/connectors/Linode.py index 651a8464f..93a53db98 100755 --- a/test/unit/connectors/Linode.py +++ b/test/unit/connectors/Linode.py @@ -210,12 +210,12 @@ def test_30_updateVMInfo(self, get_dns_driver, get_driver): self.assertEqual(driver.create_volume.call_args_list[0][0][1], 10) self.assertEqual(driver.create_volume.call_args_list[0][1]['node'], node) - self.assertEquals(dns_driver.create_zone.call_count, 1) - self.assertEquals(dns_driver.create_record.call_count, 1) - self.assertEquals(dns_driver.create_zone.call_args_list[0][0][0], 'domain.com') - self.assertEquals(dns_driver.create_record.call_args_list[0][0][0], 'test') - self.assertEquals(dns_driver.create_record.call_args_list[0][0][2], 'A') - self.assertEquals(dns_driver.create_record.call_args_list[0][0][3], '8.8.8.8') + self.assertEqual(dns_driver.create_zone.call_count, 1) + self.assertEqual(dns_driver.create_record.call_count, 1) + self.assertEqual(dns_driver.create_zone.call_args_list[0][0][0], 'domain.com') + self.assertEqual(dns_driver.create_record.call_args_list[0][0][0], 'test') + self.assertEqual(dns_driver.create_record.call_args_list[0][0][2], 'A') + self.assertEqual(dns_driver.create_record.call_args_list[0][0][3], '8.8.8.8') self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) diff --git a/test/unit/connectors/OpenNebula.py b/test/unit/connectors/OpenNebula.py index 0376b95f4..5aabc7ad0 100755 --- a/test/unit/connectors/OpenNebula.py +++ b/test/unit/connectors/OpenNebula.py @@ -190,8 +190,8 @@ def test_30_updateVMInfo(self, server_proxy): server_proxy.return_value = one_server success, vm = one_cloud.updateVMInfo(vm, auth) - self.assertEquals(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.01") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ip"), "158.42.1.1") + self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.01") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "158.42.1.1") self.assertTrue(success, msg="ERROR: updating VM info.") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) diff --git a/test/unit/connectors/OpenStack.py b/test/unit/connectors/OpenStack.py index 3e04e75fa..ffe6a0399 100644 --- a/test/unit/connectors/OpenStack.py +++ b/test/unit/connectors/OpenStack.py @@ -424,17 +424,17 @@ def test_30_updateVMInfo(self, request, get_driver): success, vm = ost_cloud.updateVMInfo(vm, auth) self.assertTrue(success, msg="ERROR: updating VM info.") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ipv6"), "fec0:4801:7808:52:16:3eff:fe6e:b7e2") - self.assertEquals(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") - self.assertEquals(driver.ex_update_subnet.call_args_list[0][0][0].id, "subnet1") - self.assertEquals(driver.ex_update_subnet.call_args_list[0][1], - {'host_routes': [{'nexthop': '10.0.0.1', 'destination': '10.0.0.0/16'}]}) - self.assertEquals(vm.info.systems[0].getValue("disk.1.device"), "vdb") - self.assertEquals(vm.info.systems[0].getValue("disk.1.image.url"), "ost://server.com/vol1") - self.assertEquals(vm.info.systems[0].getValue("gpu.count"), 1) - self.assertEquals(vm.info.systems[0].getValue("gpu.model"), 'Tesla V100') - self.assertEquals(vm.info.systems[0].getValue("gpu.vendor"), 'NVIDIA') + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ipv6"), "fec0:4801:7808:52:16:3eff:fe6e:b7e2") + self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") + self.assertEqual(driver.ex_update_subnet.call_args_list[0][0][0].id, "subnet1") + self.assertEqual(driver.ex_update_subnet.call_args_list[0][1], + {'host_routes': [{'nexthop': '10.0.0.1', 'destination': '10.0.0.0/16'}]}) + self.assertEqual(vm.info.systems[0].getValue("disk.1.device"), "vdb") + self.assertEqual(vm.info.systems[0].getValue("disk.1.image.url"), "ost://server.com/vol1") + self.assertEqual(vm.info.systems[0].getValue("gpu.count"), 1) + self.assertEqual(vm.info.systems[0].getValue("gpu.model"), 'Tesla V100') + self.assertEqual(vm.info.systems[0].getValue("gpu.vendor"), 'NVIDIA') # In this case the Node has the float ip assigned # node.public_ips = ['8.8.8.8'] @@ -445,14 +445,14 @@ def test_30_updateVMInfo(self, request, get_driver): success, vm = ost_cloud.updateVMInfo(vm, auth) self.assertTrue(success, msg="ERROR: updating VM info.") - self.assertEquals(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") + self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") # In this case the Node addresses are not available and it uses the old method node.extra = {'flavorId': 'small'} success, vm = ost_cloud.updateVMInfo(vm, auth) - self.assertEquals(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") + self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") self.assertTrue(success, msg="ERROR: updating VM info.") @@ -468,8 +468,8 @@ def test_30_updateVMInfo(self, request, get_driver): success, vm = ost_cloud.updateVMInfo(vm, auth) self.assertTrue(success, msg="ERROR: updating VM info.") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ipv6"), "2001:630:12:581:f816:3eff:fe92:2146") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ipv6"), "2001:630:12:581:f816:3eff:fe92:2146") url = 'https://nsupdate.fedcloud.eu/nic/update?hostname=test.domain.com&myip=8.8.8.8' self.assertEqual(request.call_args_list[0][0][0], url) @@ -956,13 +956,13 @@ def test_get_cloud_info(self, get_driver): self.maxDiff = None res = ost_cloud.get_quotas(auth) - self.assertEquals(res, {"cores": {"used": 2, "limit": 4}, - "ram": {"used": 2, "limit": 4}, - "instances": {"used": 2, "limit": 4}, - "floating_ips": {"used": 4, "limit": 6}, - "security_groups": {"used": 4, "limit": 6}, - 'volume_storage': {'limit': 6, 'used': 4}, - 'volumes': {'limit': 6, 'used': 4}}) + self.assertEqual(res, {"cores": {"used": 2, "limit": 4}, + "ram": {"used": 2, "limit": 4}, + "instances": {"used": 2, "limit": 4}, + "floating_ips": {"used": 4, "limit": 6}, + "security_groups": {"used": 4, "limit": 6}, + 'volume_storage': {'limit': 6, 'used': 4}, + 'volumes': {'limit': 6, 'used': 4}}) @patch('libcloud.compute.drivers.openstack.OpenStackNodeDriver') def test_get_driver(self, get_driver): diff --git a/test/unit/connectors/Orange.py b/test/unit/connectors/Orange.py index 4e74215c9..8b5eb3288 100644 --- a/test/unit/connectors/Orange.py +++ b/test/unit/connectors/Orange.py @@ -293,12 +293,12 @@ def test_30_updateVMInfo(self, get_driver): success, vm = ora_cloud.updateVMInfo(vm, auth) self.assertTrue(success, msg="ERROR: updating VM info.") - self.assertEquals(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") - self.assertEquals(driver.ex_update_subnet.call_args_list[0][0][0].id, "subnet1") - self.assertEquals(driver.ex_update_subnet.call_args_list[0][1], - {'host_routes': [{'nexthop': '10.0.0.1', 'destination': '10.0.0.0/16'}]}) - self.assertEquals(vm.info.systems[0].getValue("disk.1.device"), "vdb") - self.assertEquals(vm.info.systems[0].getValue("disk.1.image.url"), "ora://na-east-0/vol1") + self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") + self.assertEqual(driver.ex_update_subnet.call_args_list[0][0][0].id, "subnet1") + self.assertEqual(driver.ex_update_subnet.call_args_list[0][1], + {'host_routes': [{'nexthop': '10.0.0.1', 'destination': '10.0.0.0/16'}]}) + self.assertEqual(vm.info.systems[0].getValue("disk.1.device"), "vdb") + self.assertEqual(vm.info.systems[0].getValue("disk.1.image.url"), "ora://na-east-0/vol1") # In this case the Node has the float ip assigned # node.public_ips = ['8.8.8.8'] @@ -309,14 +309,14 @@ def test_30_updateVMInfo(self, get_driver): success, vm = ora_cloud.updateVMInfo(vm, auth) self.assertTrue(success, msg="ERROR: updating VM info.") - self.assertEquals(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") + self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") # In this case the Node addresses are not available and it uses the old method node.extra = {'flavorId': 'small'} success, vm = ora_cloud.updateVMInfo(vm, auth) - self.assertEquals(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") + self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") self.assertTrue(success, msg="ERROR: updating VM info.") @@ -332,8 +332,8 @@ def test_30_updateVMInfo(self, get_driver): success, vm = ora_cloud.updateVMInfo(vm, auth) self.assertTrue(success, msg="ERROR: updating VM info.") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") - self.assertEquals(vm.info.systems[0].getValue("net_interface.0.ipv6"), "2001:630:12:581:f816:3eff:fe92:2146") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ipv6"), "2001:630:12:581:f816:3eff:fe92:2146") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) @patch('libcloud.compute.drivers.openstack.OpenStackNodeDriver') From db9b0e72c7fe14c18174c5cfcba0c7cef3aa0477 Mon Sep 17 00:00:00 2001 From: Sebastian Luna-Valero Date: Wed, 23 Mar 2022 11:21:54 +0100 Subject: [PATCH 4/4] minor amendments to docs --- doc/source/client.rst | 4 +++- doc/source/gstarted.rst | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/source/client.rst b/doc/source/client.rst index 260ffc2b6..98d84b7ed 100644 --- a/doc/source/client.rst +++ b/doc/source/client.rst @@ -196,7 +196,7 @@ The :program:`im_client` is called like this:: Authorization File ------------------ -To access the IM service an authenticatio file must be created. +To access the IM service an authentication file must be created. It must have one line per authentication element. **It must have at least one line with the authentication data for the IM service** and another one for the Cloud/s provider/s the user want to access. @@ -410,6 +410,8 @@ An example of the auth file:: # InfrastructureManager auth type = InfrastructureManager; username = user; password: pass type = InfrastructureManager: token = access_token_value + # Having at least one of the two lines above is mandatory for all auth files. + # The lines below are concrete examples for each infrastructure. Please add only the ones that are relevant to you. # Vault auth type = Vault; host = https://vault.com:8200; token = access_token_value; role = role; path = path # OpenNebula site diff --git a/doc/source/gstarted.rst b/doc/source/gstarted.rst index a0f07ba75..8cb4cc08e 100644 --- a/doc/source/gstarted.rst +++ b/doc/source/gstarted.rst @@ -37,13 +37,13 @@ In this first examples we will use the IM-client tool to create, manage and fina Authentication file ^^^^^^^^^^^^^^^^^^^ -To access the IM service an authenticatio file must be created. It must have one line per authentication element. +To access the IM service an authentication file must be created. It must have one line per authentication element. **It must have at least one line with the authentication data for the IM service** and another one for the Cloud/s provider/s the user want to access. An example to access an OpenNebula and/or an OpenStack site:: - id = im; type = InfrastructureManager; username = user; password = pass + id = im; type = InfrastructureManager; username = user; password = pass # mandatory id = one; type = OpenNebula; host = osenserver:2633; username = user; password = pass id = ost; type = OpenStack; host = https://ostserver:5000; username = user; password = pass; tenant = tenant