aboutsummaryrefslogtreecommitdiffstats
path: root/sfc/lib
diff options
context:
space:
mode:
authorPanagiotis Karalis <pkaralis@intracom-telecom.com>2019-04-05 19:29:50 +0300
committerPanagiotis Karalis <pkaralis@intracom-telecom.com>2019-05-10 14:02:04 +0300
commitb5c8c8e7a782099cc9f0c53324ae16f321203e16 (patch)
treec1360f04a852dcce83a468cbced7fc282e262716 /sfc/lib
parent6369a784f56c30b66c9aa79c251d06780fc4811d (diff)
Allow TCs to consume config info from user's file
The SFC TCs are bound by the installers. This means that the SFC TCs could not run on server or VM which all components (e.g. OS, ODL, etc) are deployed manually and not by an installer, because some information are retrieved directly from installer through deploy factory module. A new yaml file is created by user in order for the important information to be consumed by the respective test scenario during test execution. JIRA: SFC-142 Change-Id: I051bb6406b8aa433c19e4df10396b4789448d42b Signed-off-by: Panagiotis Karalis <pkaralis@intracom-telecom.com>
Diffstat (limited to 'sfc/lib')
-rw-r--r--sfc/lib/config.py74
-rw-r--r--sfc/lib/odl_utils.py19
2 files changed, 67 insertions, 26 deletions
diff --git a/sfc/lib/config.py b/sfc/lib/config.py
index 507142c9..bf9864a5 100644
--- a/sfc/lib/config.py
+++ b/sfc/lib/config.py
@@ -46,33 +46,55 @@ class CommonConfig(object):
self.config_file = os.path.join(self.sfc_test_dir, "config.yaml")
self.vim_file = os.path.join(self.sfc_test_dir, "register-vim.json")
- self.installer_type = env.get('INSTALLER_TYPE')
-
- self.installer_fields = test_utils.fill_installer_dict(
- self.installer_type)
-
- self.installer_ip = env.get('INSTALLER_IP')
-
- self.installer_user = ft_utils.get_parameter_from_yaml(
- self.installer_fields['user'], self.config_file)
-
- try:
- self.installer_password = ft_utils.get_parameter_from_yaml(
- self.installer_fields['password'], self.config_file)
- except Exception:
- self.installer_password = None
-
- try:
- self.installer_key_file = ft_utils.get_parameter_from_yaml(
- self.installer_fields['pkey_file'], self.config_file)
- except Exception:
- self.installer_key_file = None
-
- try:
- self.installer_cluster = ft_utils.get_parameter_from_yaml(
- self.installer_fields['cluster'], self.config_file)
- except Exception:
+ pod_yaml_exists = os.path.isfile(self.sfc_test_dir + "/pod.yaml")
+
+ if pod_yaml_exists:
+ self.pod_file = os.path.join(self.sfc_test_dir, "pod.yaml")
+ self.nodes_pod = ft_utils.get_parameter_from_yaml(
+ "nodes", self.pod_file)
+ self.host_ip = self.nodes_pod[0]['ip']
+ self.host_user = self.nodes_pod[0]['user']
+
+ self.installer_type = 'configByUser'
+ self.installer_ip = self.host_ip
+ self.installer_user = self.host_user
self.installer_cluster = None
+ try:
+ self.installer_password = self.host_ip[0]['password']
+ except Exception:
+ self.installer_password = None
+
+ try:
+ self.installer_key_file = self.host_ip[0]['key_filename']
+ except Exception:
+ self.installer_key_file = None
+ else:
+ self.nodes_pod = None
+ self.host_ip = None
+ self.installer_type = env.get('INSTALLER_TYPE')
+ self.installer_fields = test_utils.fill_installer_dict(
+ self.installer_type)
+ self.installer_ip = env.get('INSTALLER_IP')
+ self.installer_user = ft_utils.get_parameter_from_yaml(
+ self.installer_fields['user'], self.config_file)
+
+ try:
+ self.installer_password = ft_utils.get_parameter_from_yaml(
+ self.installer_fields['password'], self.config_file)
+ except Exception:
+ self.installer_password = None
+
+ try:
+ self.installer_key_file = ft_utils.get_parameter_from_yaml(
+ self.installer_fields['pkey_file'], self.config_file)
+ except Exception:
+ self.installer_key_file = None
+
+ try:
+ self.installer_cluster = ft_utils.get_parameter_from_yaml(
+ self.installer_fields['cluster'], self.config_file)
+ except Exception:
+ self.installer_cluster = None
self.flavor = ft_utils.get_parameter_from_yaml(
"defaults.flavor", self.config_file)
diff --git a/sfc/lib/odl_utils.py b/sfc/lib/odl_utils.py
index 459c83ec..2c657a13 100644
--- a/sfc/lib/odl_utils.py
+++ b/sfc/lib/odl_utils.py
@@ -252,6 +252,25 @@ def get_odl_ip_port(nodes):
return ip, port
+def get_odl_ip_port_no_installer(nodes_pod):
+ node_index = 0
+ for n in nodes_pod:
+ if n['role'] == 'Controller':
+ break
+ node_index += 1
+ remote_ml2_conf_etc = '/etc/neutron/plugins/ml2/ml2_conf.ini'
+ os.system('scp {0}@{1}:{2} .'.
+ format(nodes_pod[node_index]['user'],
+ nodes_pod[node_index]['ip'],
+ remote_ml2_conf_etc))
+ file = open('ml2_conf.ini', 'r')
+ string = re.findall(r'[0-9]+(?:\.[0-9]+){3}\:[0-9]+', file.read())
+ file.close()
+ ip = string[0].split(':')[0]
+ port = string[0].split(':')[1]
+ return ip, port
+
+
def get_odl_username_password():
local_ml2_conf_file = os.path.join(os.getcwd(), 'ml2_conf.ini')
con_par = ConfigParser.RawConfigParser()