From 4a607daea35b21b86d063a9f32a332396ce5681a Mon Sep 17 00:00:00 2001 From: Dimitrios Markou Date: Fri, 25 Aug 2017 10:43:22 +0300 Subject: 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 --- sfc/lib/utils.py | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'sfc/lib/utils.py') diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py index 2a188960..bc7a9ddc 100644 --- a/sfc/lib/utils.py +++ b/sfc/lib/utils.py @@ -7,15 +7,15 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # - +import ConfigParser import os import re import subprocess import requests import time -import xmltodict import yaml + import logging import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as os_utils @@ -559,16 +559,20 @@ def get_nova_id(tacker_client, resource, vnf_id=None, vnf_name=None): def get_odl_ip_port(nodes): - local_jetty = os.path.join(os.getcwd(), 'jetty.xml') - odl_node = next(n for n in nodes if n.is_odl()) - odl_node.get_file('/opt/opendaylight/etc/jetty.xml', local_jetty) - with open(local_jetty) as fd: - parsed = xmltodict.parse(fd.read(), dict_constructor=dict) - - ip = (parsed['Configure']['Call'][0]['Arg']['New'] - ['Set'][0]['Property']['@default']) - port = (parsed['Configure']['Call'][0]['Arg']['New'] - ['Set'][1]['Property']['@default']) + controller_node = next(n for n in nodes if n.is_controller()) + home_folder = controller_node.run_cmd('pwd') + remote_ml2_conf_etc = '/etc/neutron/plugins/ml2/ml2_conf.ini' + remote_ml2_conf_home = '{0}/ml2_conf.ini'.format(home_folder) + local_ml2_conf_file = os.path.join(os.getcwd(), 'ml2_conf.ini') + controller_node.run_cmd('sudo cp {0} {1}/' + .format(remote_ml2_conf_etc, home_folder)) + controller_node.run_cmd('sudo chmod 777 {0}' + .format(remote_ml2_conf_home)) + controller_node.get_file(remote_ml2_conf_home, local_ml2_conf_file) + con_par = ConfigParser.RawConfigParser() + con_par.read(local_ml2_conf_file) + ip, port = re.search(r'[0-9]+(?:\.[0-9]+){3}\:[0-9]+', + con_par.get('ml2_odl', 'url')).group().split(':') return ip, port @@ -651,3 +655,14 @@ def delete_classifier_and_acl(tacker_client, clf_name, odl_ip, odl_port): odl_port, 'ietf-access-control-list:ipv4-acl', clf_name) + + +def fill_installer_dict(installer_type): + default_string = "defaults.installer.{}.".format(installer_type) + installer_yaml_fields = { + "user": default_string+"user", + "password": default_string+"password", + "cluster": default_string+"cluster", + "pkey_file": default_string+"pkey_file" + } + return installer_yaml_fields -- cgit 1.2.3-korg