From c3ec5d0df3950850f28836671ebc6e9df2b94e71 Mon Sep 17 00:00:00 2001
From: Cédric Ollivier <cedric.ollivier@orange.com>
Date: Wed, 11 Apr 2018 08:51:42 +0200
Subject: Leverage on SDN_CONTROLLER_IP if fuel
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It conforms with [1].

[1] https://jira.opnfv.org/browse/FUEL-352

Change-Id: Idae142de8de09203509c73c35c2e7fea5a5d880b
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit 492b5543103a25b51740b82a291b087f68d932eb)
---
 functest/opnfv_tests/sdn/odl/odl.py | 8 +-------
 functest/tests/unit/odl/test_odl.py | 7 ++++++-
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py
index ac471b285..7c61e88df 100644
--- a/functest/opnfv_tests/sdn/odl/odl.py
+++ b/functest/opnfv_tests/sdn/odl/odl.py
@@ -160,8 +160,7 @@ class ODLTests(robotframework.RobotFramework):
             snaps_creds = snaps_utils.get_credentials()
             kwargs = {'neutronurl': keystone_utils.get_endpoint(
                 snaps_creds, 'network')}
-            kwargs['odlip'] = urllib.parse.urlparse(
-                kwargs['neutronurl']).hostname
+            kwargs['odlip'] = env.get('SDN_CONTROLLER_IP')
             kwargs['odlwebport'] = '8080'
             kwargs['odlrestconfport'] = '8181'
             kwargs['odlusername'] = 'admin'
@@ -179,18 +178,13 @@ class ODLTests(robotframework.RobotFramework):
                 kwargs['odlwebport'] = '8282'
                 kwargs['odlrestconfport'] = '8282'
             elif installer_type == 'apex' or installer_type == 'netvirt':
-                kwargs['odlip'] = env.get('SDN_CONTROLLER_IP')
                 kwargs['odlwebport'] = '8081'
                 kwargs['odlrestconfport'] = '8081'
             elif installer_type == 'compass':
-                kwargs['odlip'] = env.get('SDN_CONTROLLER_IP')
                 kwargs['odlrestconfport'] = '8080'
             elif installer_type == 'daisy':
-                kwargs['odlip'] = env.get('SDN_CONTROLLER_IP')
                 kwargs['odlwebport'] = '8181'
                 kwargs['odlrestconfport'] = '8087'
-            else:
-                kwargs['odlip'] = env.get('SDN_CONTROLLER_IP')
             assert kwargs['odlip']
         except KeyError as ex:
             self.__logger.error("Cannot run ODL testcases. "
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py
index e025e180f..6304d37a3 100644
--- a/functest/tests/unit/odl/test_odl.py
+++ b/functest/tests/unit/odl/test_odl.py
@@ -387,10 +387,15 @@ class ODLRunTesting(ODLTesting):
             odlip=self._sdn_controller_ip,
             odlwebport=self._odl_webport)
 
+    def test_fuel_no_controller_ip(self):
+        os.environ["INSTALLER_TYPE"] = "fuel"
+        self._test_missing_value()
+
     def test_fuel(self):
+        os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip
         os.environ["INSTALLER_TYPE"] = "fuel"
         self._test_run(testcase.TestCase.EX_OK, None,
-                       odlip=urllib.parse.urlparse(self._neutron_url).hostname,
+                       odlip=self._sdn_controller_ip,
                        odlwebport='8282',
                        odlrestconfport='8282')
 
-- 
cgit