aboutsummaryrefslogtreecommitdiffstats
path: root/sfc/tests/functest/run_sfc_tests.py
diff options
context:
space:
mode:
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)