From 65e832cc579b86fd82864612bd35b387e3ada5e1 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Fri, 8 Sep 2017 07:33:23 +0200 Subject: Update ODL testcase to Keystone v3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As basic neutron tests have been updated [1], ODL testcase must manage user domain and project domain names. [1] https://git.opendaylight.org/gerrit/#/c/62846/ JIRA: FUNCTEST-862 Change-Id: I61ef622f840b8d825cf45a3557bd6da14a4d3cb7 Signed-off-by: Cédric Ollivier --- docker/Dockerfile | 2 +- docker/smoke/Dockerfile | 2 +- functest/opnfv_tests/sdn/odl/odl.py | 17 ++++++++++++++++- functest/tests/unit/odl/test_odl.py | 29 ++++++++++++++++++++++++++--- 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 603bc38b9..072ea1da9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,7 +14,7 @@ LABEL version="0.1" description="OPNFV Functest Docker container" # Environment variables ARG BRANCH=master ARG RALLY_TAG=stable/0.9 -ARG ODL_TAG=27b7911a5c2315145f2cf06726303dadfe508940 +ARG ODL_TAG=35e415b6873b39d72775c88a337e92dac26012e2 ARG OPENSTACK_TAG=stable/ocata ARG VIMS_TAG=stable ARG REPOS_DIR=/home/opnfv/repos diff --git a/docker/smoke/Dockerfile b/docker/smoke/Dockerfile index 3b1e8d2e7..3e73d195b 100644 --- a/docker/smoke/Dockerfile +++ b/docker/smoke/Dockerfile @@ -2,7 +2,7 @@ FROM opnfv/functest-core ARG BRANCH=master ARG OPENSTACK_TAG=stable/ocata -ARG ODL_TAG=27b7911a5c2315145f2cf06726303dadfe508940 +ARG ODL_TAG=35e415b6873b39d72775c88a337e92dac26012e2 ARG FDS_TAG=master COPY thirdparty-requirements.txt thirdparty-requirements.txt diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py index ab70ba107..d09532cb0 100644 --- a/functest/opnfv_tests/sdn/odl/odl.py +++ b/functest/opnfv_tests/sdn/odl/odl.py @@ -157,7 +157,11 @@ class ODLTests(testcase.TestCase): 'NEUTRON:' + kwargs['neutronip'], 'OS_AUTH_URL:"' + osauthurl + '"', 'OSUSERNAME:"' + kwargs['osusername'] + '"', + ('OSUSERDOMAINNAME:"' + + kwargs['osuserdomainname'] + '"'), 'OSTENANTNAME:"' + kwargs['ostenantname'] + '"', + ('OSPROJECTDOMAINNAME:"' + + kwargs['osprojectdomainname'] + '"'), 'OSPASSWORD:"' + kwargs['ospassword'] + '"', 'ODL_SYSTEM_IP:' + kwargs['odlip'], 'PORT:' + kwargs['odlwebport'], @@ -221,7 +225,11 @@ class ODLTests(testcase.TestCase): if 'INSTALLER_TYPE' in os.environ: installer_type = os.environ['INSTALLER_TYPE'] kwargs['osusername'] = os.environ['OS_USERNAME'] + kwargs['osuserdomainname'] = os.environ.get( + 'OS_USER_DOMAIN_NAME', 'Default') kwargs['ostenantname'] = os.environ['OS_TENANT_NAME'] + kwargs['osprojectdomainname'] = os.environ.get( + 'OS_PROJECT_DOMAIN_NAME', 'Default') kwargs['osauthurl'] = os.environ['OS_AUTH_URL'] kwargs['ospassword'] = os.environ['OS_PASSWORD'] if installer_type == 'fuel': @@ -263,13 +271,20 @@ class ODLParser(object): # pylint: disable=too-few-public-methods default='127.0.0.1') self.parser.add_argument( '-k', '--osauthurl', help='OS_AUTH_URL as defined by OpenStack', - default='http://127.0.0.1:5000/v2.0') + default='http://127.0.0.1:5000/v3') self.parser.add_argument( '-a', '--osusername', help='Username for OpenStack', default='admin') + self.parser.add_argument( + '-f', '--osuserdomainname', help='User domain name for OpenStack', + default='Default') self.parser.add_argument( '-b', '--ostenantname', help='Tenantname for OpenStack', default='admin') + self.parser.add_argument( + '-g', '--osprojectdomainname', + help='Project domain name for OpenStack', + default='Default') self.parser.add_argument( '-c', '--ospassword', help='Password for OpenStack', default='admin') diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py index 878d47dda..338a4e69d 100644 --- a/functest/tests/unit/odl/test_odl.py +++ b/functest/tests/unit/odl/test_odl.py @@ -69,7 +69,7 @@ class ODLTesting(unittest.TestCase): _keystone_ip = "127.0.0.1" _neutron_ip = "127.0.0.2" _sdn_controller_ip = "127.0.0.3" - _os_auth_url = "http://{}:5000/v2.0".format(_keystone_ip) + _os_auth_url = "http://{}:5000/v3".format(_keystone_ip) _os_tenantname = "admin" _os_username = "admin" _os_password = "admin" @@ -77,6 +77,8 @@ class ODLTesting(unittest.TestCase): _odl_restconfport = "8181" _odl_username = "admin" _odl_password = "admin" + _os_userdomainname = 'Default' + _os_projectdomainname = 'Default' def setUp(self): for var in ("INSTALLER_TYPE", "SDN_CONTROLLER", "SDN_CONTROLLER_IP"): @@ -84,15 +86,20 @@ class ODLTesting(unittest.TestCase): del os.environ[var] os.environ["OS_AUTH_URL"] = self._os_auth_url os.environ["OS_USERNAME"] = self._os_username + os.environ["OS_USER_DOMAIN_NAME"] = self._os_userdomainname os.environ["OS_PASSWORD"] = self._os_password os.environ["OS_TENANT_NAME"] = self._os_tenantname + os.environ["OS_PROJECT_DOMAIN_NAME"] = self._os_projectdomainname + os.environ["OS_PASSWORD"] = self._os_password self.test = odl.ODLTests(case_name='odl', project_name='functest') self.defaultargs = {'odlusername': self._odl_username, 'odlpassword': self._odl_password, 'neutronip': self._keystone_ip, 'osauthurl': self._os_auth_url, 'osusername': self._os_username, + 'osuserdomainname': self._os_userdomainname, 'ostenantname': self._os_tenantname, + 'osprojectdomainname': self._os_projectdomainname, 'ospassword': self._os_password, 'odlip': self._keystone_ip, 'odlwebport': self._odl_webport, @@ -211,7 +218,9 @@ class ODLMainTesting(ODLTesting): 'neutronip': self._neutron_ip, 'osauthurl': self._os_auth_url, 'osusername': self._os_username, + 'osuserdomainname': self._os_userdomainname, 'ostenantname': self._os_tenantname, + 'osprojectdomainname': self._os_projectdomainname, 'ospassword': self._os_password, 'odlip': self._sdn_controller_ip, 'odlwebport': self._odl_webport, @@ -231,7 +240,11 @@ class ODLMainTesting(ODLTesting): 'NEUTRON:{}'.format(self._neutron_ip), 'OS_AUTH_URL:"{}"'.format(self._os_auth_url), 'OSUSERNAME:"{}"'.format(self._os_username), + 'OSUSERDOMAINNAME:"{}"'.format( + self._os_userdomainname), 'OSTENANTNAME:"{}"'.format(self._os_tenantname), + 'OSPROJECTDOMAINNAME:"{}"'.format( + self._os_projectdomainname), 'OSPASSWORD:"{}"'.format(self._os_password), 'ODL_SYSTEM_IP:{}'.format(self._sdn_controller_ip), 'PORT:{}'.format(self._odl_webport), @@ -383,7 +396,9 @@ class ODLRunTesting(ODLTesting): odlusername=self._odl_username, odlwebport=odlwebport, osauthurl=self._os_auth_url, ospassword=self._os_password, ostenantname=self._os_tenantname, - osusername=self._os_username) + osusername=self._os_username, + osprojectdomainname=self._os_projectdomainname, + osuserdomainname=self._os_userdomainname) def _test_multiple_suites(self, suites, status=testcase.TestCase.EX_OK, **kwargs): @@ -404,7 +419,9 @@ class ODLRunTesting(ODLTesting): odlusername=self._odl_username, odlwebport=odlwebport, osauthurl=self._os_auth_url, ospassword=self._os_password, ostenantname=self._os_tenantname, - osusername=self._os_username) + osusername=self._os_username, + osprojectdomainname=self._os_projectdomainname, + osuserdomainname=self._os_userdomainname) def test_exc(self): with mock.patch('functest.utils.openstack_utils.get_endpoint', @@ -579,9 +596,15 @@ class ODLArgParserTesting(ODLTesting): def test_osusername(self): self._test_arg('osusername', 'foo') + def test_osuserdomainname(self): + self._test_arg('osuserdomainname', 'domain') + def test_ostenantname(self): self._test_arg('ostenantname', 'foo') + def test_osprojectdomainname(self): + self._test_arg('osprojectdomainname', 'domain') + def test_ospassword(self): self._test_arg('ospassword', 'foo') -- cgit 1.2.3-korg