aboutsummaryrefslogtreecommitdiffstats
path: root/sfc/tests/functest/run_sfc_tests.py
diff options
context:
space:
mode:
authorDimitrios Markou <mardim@intracom-telecom.com>2017-08-25 10:43:22 +0300
committerDimitrios Markou <mardim@intracom-telecom.com>2017-08-31 11:25:56 +0300
commit4a607daea35b21b86d063a9f32a332396ce5681a (patch)
tree51fb90e63874b90ae9dda3c9a2cde48ac9a7abcc /sfc/tests/functest/run_sfc_tests.py
parent60f2b2cf578fbf2a9e0efba4709d4aa6aa8a2f79 (diff)
Adapt the testcases to multiple installers
Right now the testcases are dependent to only one installer. So when we are trying to run the testcases to multiple installers the tests are failing. This patch make the testcases independent to the installer that they run. The testcases are running until the point which they hit the tacker client commands.They are failing in the tacker client commands because we need the new library for the upstream tacker API. The testaces have already tested to two installers (Fuel,Apex-ha). Also this patch contains the changes which are required for the adaptation to the new functest. For more information see the Jira tickets [0],[1],[2]. [0]: https://jira.opnfv.org/browse/SFC-100 [1]: https://jira.opnfv.org/browse/SFC-101 [2]: https://jira.opnfv.org/browse/SFC-102 Change-Id: Id1e5d5c94a65ab8bdea9584fa833bfa0cdec6632 Signed-off-by: Dimitrios Markou <mardim@intracom-telecom.com>
Diffstat (limited to 'sfc/tests/functest/run_sfc_tests.py')
-rw-r--r--sfc/tests/functest/run_sfc_tests.py76
1 files changed, 62 insertions, 14 deletions
diff --git a/sfc/tests/functest/run_sfc_tests.py b/sfc/tests/functest/run_sfc_tests.py
index c569165b..edf9595e 100644
--- a/sfc/tests/functest/run_sfc_tests.py
+++ b/sfc/tests/functest/run_sfc_tests.py
@@ -14,8 +14,8 @@ import time
import sys
import yaml
-from functest.core import testcase
from functest.utils import openstack_utils as os_utils
+from functest.core import testcase
from opnfv.utils import ovs_logger as ovs_log
from opnfv.deployment.factory import Factory as DeploymentFactory
from sfc.lib import cleanup as sfc_cleanup
@@ -40,8 +40,43 @@ class SfcFunctest(testcase.OSGCTestCase):
logger.info("found tackerc file")
return rc_file
- def __disable_heat_resource_finder_cache(self, nodes):
- controllers = [node for node in nodes if node.is_controller()]
+ def __disable_heat_resource_finder_cache_apex(self, controllers):
+ remote_heat_conf_etc = '/etc/heat/heat.conf'
+ remote_heat_conf_home = '/home/heat-admin/heat.conf'
+ local_heat_conf = '/tmp/heat.conf'
+ cmd_restart_heat = ("sudo"
+ " /bin/systemctl"
+ " restart"
+ " openstack-heat-engine.service"
+ )
+ for controller in controllers:
+ logger.info("Fetch {0} from controller {1}"
+ .format(remote_heat_conf_etc, controller.ip))
+ controller.run_cmd('sudo cp {0} /home/heat-admin/'
+ .format(remote_heat_conf_etc))
+ controller.run_cmd('sudo chmod 777 {0}'
+ .format(remote_heat_conf_home))
+ controller.get_file(remote_heat_conf_home, local_heat_conf)
+ with open(local_heat_conf, 'a') as cfg:
+ cfg.write('\n[resource_finder_cache]\n')
+ cfg.write('caching=False\n')
+ logger.info("Replace {0} with {1} in controller {2}"
+ .format(remote_heat_conf_etc,
+ local_heat_conf,
+ controller.ip))
+ controller.run_cmd('sudo rm -f {0}'.format(remote_heat_conf_home))
+ controller.run_cmd('sudo rm -f {0}'.format(remote_heat_conf_etc))
+ controller.put_file(local_heat_conf,
+ remote_heat_conf_home)
+ controller.run_cmd('sudo cp {0} /etc/heat/'
+ .format(remote_heat_conf_home))
+ logger.info("Restart heat-engine in {0}".format(controller.ip))
+ controller.run_cmd(cmd_restart_heat)
+ os.remove(local_heat_conf)
+ logger.info("Waiting for heat-engine to restart in controllers")
+ time.sleep(10)
+
+ def __disable_heat_resource_finder_cache_fuel(self, controllers):
remote_heat_conf = '/etc/heat/heat.conf'
local_heat_conf = '/tmp/heat.conf'
for controller in controllers:
@@ -63,32 +98,45 @@ class SfcFunctest(testcase.OSGCTestCase):
logger.info("Waiting for heat-engine to restart in controllers")
time.sleep(10)
+ def __disable_heat_resource_finder_cache(self, nodes, installer_type):
+ controllers = [node for node in nodes if node.is_controller()]
+
+ if installer_type == 'apex':
+ self.__disable_heat_resource_finder_cache_apex(controllers)
+ elif installer_type == "fuel":
+ self.__disable_heat_resource_finder_cache_fuel(controllers)
+ else:
+ raise Exception('Unsupported installer')
+
def run(self):
deploymentHandler = DeploymentFactory.get_handler(
COMMON_CONFIG.installer_type,
COMMON_CONFIG.installer_ip,
COMMON_CONFIG.installer_user,
- installer_pwd=COMMON_CONFIG.installer_password)
+ COMMON_CONFIG.installer_password,
+ COMMON_CONFIG.installer_key_file)
cluster = COMMON_CONFIG.installer_cluster
nodes = (deploymentHandler.get_nodes({'cluster': cluster})
if cluster is not None
else deploymentHandler.get_nodes())
- a_controller = [node for node in nodes
- if node.is_controller()][0]
+ self.__disable_heat_resource_finder_cache(nodes,
+ COMMON_CONFIG.installer_type)
- self.__disable_heat_resource_finder_cache(nodes)
+ if COMMON_CONFIG.installer_type == 'fuel':
+ a_controller = [node for node in nodes
+ if node.is_controller()][0]
- rc_file = self.__fetch_tackerc_file(a_controller)
- os_utils.source_credentials(rc_file)
+ rc_file = self.__fetch_tackerc_file(a_controller)
+ os_utils.source_credentials(rc_file)
- logger.info("Updating env with {0}".format(rc_file))
- logger.info("OS credentials:")
- for var, value in os.environ.items():
- if var.startswith("OS_"):
- logger.info("\t{0}={1}".format(var, value))
+ logger.info("Updating env with {0}".format(rc_file))
+ logger.info("OS credentials:")
+ for var, value in os.environ.items():
+ if var.startswith("OS_"):
+ logger.info("\t{0}={1}".format(var, value))
odl_ip, odl_port = sfc_utils.get_odl_ip_port(nodes)