Merge "support fuel&daisy for doctor in functest"
[functest.git] / functest / tests / unit / odl / test_odl.py
index d803d41..6304d37 100644 (file)
@@ -13,13 +13,12 @@ import logging
 import os
 import unittest
 
-from keystoneauth1.exceptions import auth_plugins
 import mock
 from robot.errors import RobotError
 import six
 from six.moves import urllib
+from xtesting.core import testcase
 
-from functest.core import testcase
 from functest.opnfv_tests.sdn.odl import odl
 
 __author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
@@ -172,6 +171,7 @@ class ODLMainTesting(ODLTesting):
                 'RESTCONFPORT:{}'.format(self._odl_restconfport)]
             args[1].assert_called_once_with(
                 odl.ODLTests.basic_suite_dir, odl.ODLTests.neutron_suite_dir,
+                include=[],
                 log='NONE',
                 output=os.path.join(self.test.res_dir, 'output.xml'),
                 report='NONE', stdout=mock.ANY, variable=variable,
@@ -279,6 +279,15 @@ class ODLRunTesting(ODLTesting):
         args[0].assert_called_once_with()
         args[1].assert_called_once_with(mock.ANY, 'network')
 
+    @mock.patch('snaps.openstack.utils.keystone_utils.get_endpoint',
+                return_value=ODLTesting._neutron_url)
+    @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.'
+                'get_credentials')
+    def _test_missing_value(self, *args):
+        self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR)
+        args[0].assert_called_once_with()
+        args[1].assert_called_once_with(mock.ANY, 'network')
+
     @mock.patch('snaps.openstack.utils.keystone_utils.get_endpoint',
                 return_value=ODLTesting._neutron_url)
     @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.'
@@ -331,7 +340,7 @@ class ODLRunTesting(ODLTesting):
 
     def test_exc(self):
         with mock.patch('snaps.openstack.utils.keystone_utils.get_endpoint',
-                        side_effect=auth_plugins.MissingAuthPlugin()):
+                        side_effect=Exception()):
             self.assertEqual(self.test.run(),
                              testcase.TestCase.EX_RUN_ERROR)
 
@@ -362,7 +371,7 @@ class ODLRunTesting(ODLTesting):
                            odlwebport=self._odl_webport)
 
     def test_no_sdn_controller_ip(self):
-        self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR)
+        self._test_missing_value()
 
     def test_without_installer_type(self):
         os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip
@@ -378,16 +387,21 @@ 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,
-                       odlwebport='8181',
+                       odlip=self._sdn_controller_ip,
+                       odlwebport='8282',
                        odlrestconfport='8282')
 
     def test_apex_no_controller_ip(self):
         os.environ["INSTALLER_TYPE"] = "apex"
-        self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR)
+        self._test_missing_value()
 
     def test_apex(self):
         os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip
@@ -398,7 +412,7 @@ class ODLRunTesting(ODLTesting):
 
     def test_netvirt_no_controller_ip(self):
         os.environ["INSTALLER_TYPE"] = "netvirt"
-        self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR)
+        self._test_missing_value()
 
     def test_netvirt(self):
         os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip
@@ -407,25 +421,16 @@ class ODLRunTesting(ODLTesting):
                        odlip=self._sdn_controller_ip, odlwebport='8081',
                        odlrestconfport='8081')
 
-    def test_joid_no_controller_ip(self):
-        os.environ["INSTALLER_TYPE"] = "joid"
-        self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR)
-
-    def test_joid(self):
-        os.environ["SDN_CONTROLLER"] = self._sdn_controller_ip
-        os.environ["INSTALLER_TYPE"] = "joid"
-        self._test_run(testcase.TestCase.EX_OK, None,
-                       odlip=self._sdn_controller_ip, odlwebport='8080')
-
     def test_compass(self):
+        os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip
         os.environ["INSTALLER_TYPE"] = "compass"
         self._test_run(testcase.TestCase.EX_OK, None,
-                       odlip=urllib.parse.urlparse(self._neutron_url).hostname,
+                       odlip=self._sdn_controller_ip,
                        odlrestconfport='8080')
 
     def test_daisy_no_controller_ip(self):
         os.environ["INSTALLER_TYPE"] = "daisy"
-        self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR)
+        self._test_missing_value()
 
     def test_daisy(self):
         os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip