From 02bd6e30668b477781ab007e82bfe2a207baa8b7 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Sat, 24 Feb 2018 12:09:20 +0100 Subject: Update Functest to meet last snaps updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It removes obsolete mockey patches in Rally unit tests and adds keystone client as params when needed in orchestra_*ims.py [1]. [1] https://gerrit.opnfv.org/gerrit/#/c/52473/ Change-Id: Id02954d16f5f54cc0c390fadb498e14c6bab6ff9 Signed-off-by: Cédric Ollivier --- functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py | 6 ++++-- functest/opnfv_tests/vnf/ims/orchestra_openims.py | 11 +++++++---- functest/tests/unit/openstack/rally/test_rally.py | 4 ---- 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'functest') diff --git a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py index 85c55ec5..7cfdf7b0 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py @@ -376,9 +376,10 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): break else: self.logger.info("Creating floating IP for Open Baton NFVO") + keystone_client = os_utils.get_keystone_client(self.creds) self.mano['details']['fip'] = snaps_utils.neutron_utils.\ create_floating_ip( - neutron_client, + neutron_client, keystone_client, self.mano['details']['external_net_name']) self.logger.info( "Created floating IP for Open Baton NFVO %s", @@ -643,9 +644,10 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): try: neutron_client = os_utils.get_neutron_client(self.creds) + keystone_client = os_utils.get_keystone_client(self.creds) self.logger.info("Deleting Open Baton Port...") port = snaps_utils.neutron_utils.get_port( - neutron_client, + neutron_client, keystone_client, port_name='%s_port' % self.case_name) snaps_utils.neutron_utils.delete_port(neutron_client, port) time.sleep(10) diff --git a/functest/opnfv_tests/vnf/ims/orchestra_openims.py b/functest/opnfv_tests/vnf/ims/orchestra_openims.py index a8a276ca..f4d30b84 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_openims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_openims.py @@ -72,7 +72,7 @@ def get_config(parameter, file_path): def servertest(host, port): """Method to test that a server is reachable at IP:port""" args = socket.getaddrinfo(host, port, socket.AF_INET, socket.SOCK_STREAM) - for family, socktype, proto, canonname, sockaddr in args: + for family, socktype, proto, _, sockaddr in args: sock = socket.socket(family, socktype, proto) try: sock.connect(sockaddr) @@ -361,9 +361,11 @@ class OpenImsVnf(vnf.VnfOnBoarding): break else: self.logger.info("Creating floating IP for Open Baton NFVO") + keystone_client = os_utils.get_keystone_client(self.creds) self.mano['details']['fip'] = ( - snaps_utils.neutron_utils. create_floating_ip( - neutron_client, self.mano['details']['external_net_name'])) + snaps_utils.neutron_utils.create_floating_ip( + neutron_client, keystone_client, + self.mano['details']['external_net_name'])) self.logger.info( "Created floating IP for Open Baton NFVO %s", (self.mano['details']['fip'].ip)) @@ -665,9 +667,10 @@ class OpenImsVnf(vnf.VnfOnBoarding): try: neutron_client = os_utils.get_neutron_client(self.creds) + keystone_client = os_utils.get_keystone_client(self.creds) self.logger.info("Deleting Open Baton Port...") port = snaps_utils.neutron_utils.get_port( - neutron_client, + neutron_client, keystone_client, port_name='%s_port' % self.case_name) snaps_utils.neutron_utils.delete_port(neutron_client, port) time.sleep(10) diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py index 5d82d91f..9cc6bf53 100644 --- a/functest/tests/unit/openstack/rally/test_rally.py +++ b/functest/tests/unit/openstack/rally/test_rally.py @@ -329,8 +329,6 @@ class OSRallyTesting(unittest.TestCase): @mock.patch('snaps.openstack.utils.deploy_utils.create_image') @mock.patch('snaps.openstack.utils.deploy_utils.create_network') @mock.patch('snaps.openstack.utils.deploy_utils.create_router') - @mock.patch('snaps.openstack.utils.keystone_utils.keystone_client') - @mock.patch('snaps.openstack.utils.keystone_utils.get_project') @mock.patch('snaps.openstack.create_flavor.OpenStackFlavor.create', return_value=None) def test_prepare_env_flavor_creation_failed(self, mock_create_flavor, @@ -350,8 +348,6 @@ class OSRallyTesting(unittest.TestCase): @mock.patch('snaps.openstack.utils.deploy_utils.create_image') @mock.patch('snaps.openstack.utils.deploy_utils.create_network') @mock.patch('snaps.openstack.utils.deploy_utils.create_router') - @mock.patch('snaps.openstack.utils.keystone_utils.keystone_client') - @mock.patch('snaps.openstack.utils.keystone_utils.get_project') @mock.patch('snaps.openstack.create_flavor.OpenStackFlavor.create', side_effect=[mock.Mock, None]) def test_prepare_env_flavor_alt_creation_failed(self, mock_create_flavor, -- cgit 1.2.3-korg