aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/Controllers/ONOS/Teston
diff options
context:
space:
mode:
Diffstat (limited to 'functest/opnfv_tests/Controllers/ONOS/Teston')
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Teston/adapters/environment.py4
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py46
-rwxr-xr-xfunctest/opnfv_tests/Controllers/ONOS/Teston/onosfunctest.py43
3 files changed, 39 insertions, 54 deletions
diff --git a/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/environment.py b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/environment.py
index f2755b66..01f70b85 100644
--- a/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/environment.py
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/environment.py
@@ -141,8 +141,8 @@ class environment(connection):
result = self.CheckSshNoPasswd(host)
if not result:
self.logger.info(
- "ssh login failed,try to copy master publickey" +
- "to agent " + str(host))
+ "ssh login failed,try to copy master publickey" +
+ "to agent " + str(host))
self.CopyPublicKey(host)
self.OnosPushKeys(handle, "onos-push-keys " + self.OCT, masterpass)
self.OnosPushKeys(handle, "onos-push-keys " + self.OC1, agentpass)
diff --git a/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py
index 603e9933..6f7a40ff 100644
--- a/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py
@@ -17,6 +17,7 @@ import os
import re
import time
+import functest.utils.functest_constants as ft_constants
import functest.utils.functest_utils as ft_utils
@@ -25,8 +26,8 @@ class foundation:
def __init__(self):
# currentpath = os.getcwd()
- REPO_PATH = ft_utils.FUNCTEST_REPO + '/'
- currentpath = REPO_PATH + 'opnfv_tests/Controllers/ONOS/Teston/CI'
+ currentpath = \
+ ft_constants.FUNCTEST_TEST_DIR + '/Controllers/ONOS/Teston/CI'
self.cipath = currentpath
self.logdir = os.path.join(currentpath, 'log')
self.workhome = currentpath[0: currentpath.rfind('opnfv_tests') - 1]
@@ -54,30 +55,23 @@ class foundation:
"""
Get Default Parameters value
"""
- self.Result_DB = str(
- ft_utils.get_functest_config('results.test_db_url'))
- self.masterusername = str(
- ft_utils.get_functest_config('ONOS.general.onosbench_username'))
- self.masterpassword = str(
- ft_utils.get_functest_config('ONOS.general.onosbench_password'))
- self.agentusername = str(
- ft_utils.get_functest_config('ONOS.general.onoscli_username'))
- self.agentpassword = str(
- ft_utils.get_functest_config('ONOS.general.onoscli_password'))
- self.runtimeout = \
- ft_utils.get_functest_config('ONOS.general.runtimeout')
- self.OCT = str(ft_utils.get_functest_config('ONOS.environment.OCT'))
- self.OC1 = str(ft_utils.get_functest_config('ONOS.environment.OC1'))
- self.OC2 = str(ft_utils.get_functest_config('ONOS.environment.OC2'))
- self.OC3 = str(ft_utils.get_functest_config('ONOS.environment.OC3'))
- self.OCN = str(ft_utils.get_functest_config('ONOS.environment.OCN'))
- self.OCN2 = str(ft_utils.get_functest_config('ONOS.environment.OCN2'))
- self.installer_master = str(
- ft_utils.get_functest_config('ONOS.environment.installer_master'))
- self.installer_master_username = str(ft_utils.get_functest_config(
- 'ONOS.environment.installer_master_username'))
- self.installer_master_password = str(ft_utils.get_functest_config(
- 'ONOS.environment.installer_master_password'))
+ self.Result_DB = str(ft_utils.get_db_url())
+ self.masterusername = str(ft_constants.ONOSBENCH_USERNAME)
+ self.masterpassword = str(ft_constants.ONOSBENCH_PASSWORD)
+ self.agentusername = str(ft_constants.ONOSCLI_USERNAME)
+ self.agentpassword = str(ft_constants.ONOSCLI_PASSWORD)
+ self.runtimeout = ft_constants.ONOS_RUNTIMEOUT
+ self.OCT = str(ft_constants.ONOS_OCT)
+ self.OC1 = str(ft_constants.ONOS_OC1)
+ self.OC2 = str(ft_constants.ONOS_OC2)
+ self.OC3 = str(ft_constants.ONOS_OC3)
+ self.OCN = str(ft_constants.ONOS_OCN)
+ self.OCN2 = str(ft_constants.ONOS_OCN2)
+ self.installer_master = str(ft_constants.ONOS_INSTALLER_MASTER)
+ self.installer_master_username = \
+ str(ft_constants.ONOS_INSTALLER_MASTER_USERNAME)
+ self.installer_master_password = \
+ ft_constants.ONOS_INSTALLER_MASTER_PASSWORD
self.hosts = [self.OC1, self.OCN, self.OCN2]
self.localhost = self.OCT
diff --git a/functest/opnfv_tests/Controllers/ONOS/Teston/onosfunctest.py b/functest/opnfv_tests/Controllers/ONOS/Teston/onosfunctest.py
index c8045fd1..300f56d1 100755
--- a/functest/opnfv_tests/Controllers/ONOS/Teston/onosfunctest.py
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/onosfunctest.py
@@ -25,6 +25,8 @@ from neutronclient.v2_0 import client as neutronclient
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_utils as openstack_utils
+import functest.utils.functest_constants as ft_constants
+
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--testcase", help="Testcase name")
@@ -35,27 +37,15 @@ args = parser.parse_args()
logger = ft_logger.Logger("onos").getLogger()
# onos parameters
-TEST_DB = ft_utils.get_functest_config("results.test_db_url")
-ONOS_REPO_PATH = \
- ft_utils.get_functest_config("general.directories.dir_repos")
-ONOS_CONF_DIR = \
- ft_utils.get_functest_config("general.directories.dir_functest_conf")
-
-ONOSCI_PATH = ONOS_REPO_PATH + "/"
+ONOSCI_PATH = ft_constants.REPOS_DIR + "/"
starttime = datetime.datetime.now()
-HOME = os.environ['HOME'] + "/"
-INSTALLER_TYPE = os.environ['INSTALLER_TYPE']
-DEPLOY_SCENARIO = os.environ['DEPLOY_SCENARIO']
-ONOSCI_PATH = ONOS_REPO_PATH + "/"
-GLANCE_IMAGE_NAME = ft_utils.get_functest_config("onos_sfc.image_name")
-GLANCE_IMAGE_FILENAME = \
- ft_utils.get_functest_config("onos_sfc.image_file_name")
-GLANCE_IMAGE_PATH = \
- ft_utils.get_functest_config("general.directories.dir_functest_data") + \
- "/" + GLANCE_IMAGE_FILENAME
-SFC_PATH = ft_utils.FUNCTEST_REPO + "/" + \
- ft_utils.get_functest_config("general.directories.dir_onos_sfc")
+INSTALLER_TYPE = ft_constants.CI_INSTALLER_TYPE
+ONOS_SFC_IMAGE_NAME = ft_constants.ONOS_SFC_IMAGE_NAME
+ONOS_SFC_IMAGE_PATH = os.path.join(ft_constants.FUNCTEST_DATA_DIR,
+ ft_constants.ONOS_SFC_IMAGE_FILENAME)
+ONOS_SFC_PATH = os.path.join(ft_constants.FUNCTEST_REPO_DIR,
+ ft_constants.ONOS_SFC_RELATIVE_PATH)
def RunScript(testname):
@@ -173,18 +163,18 @@ def CleanOnosTest():
def CreateImage():
glance_client = openstack_utils.get_glance_client()
image_id = openstack_utils.create_glance_image(glance_client,
- GLANCE_IMAGE_NAME,
- GLANCE_IMAGE_PATH)
+ ONOS_SFC_IMAGE_NAME,
+ ONOS_SFC_IMAGE_PATH)
EXIT_CODE = -1
if not image_id:
logger.error("Failed to create a Glance image...")
return(EXIT_CODE)
logger.debug("Image '%s' with ID=%s created successfully."
- % (GLANCE_IMAGE_NAME, image_id))
+ % (ONOS_SFC_IMAGE_NAME, image_id))
def SfcTest():
- cmd = "python " + SFC_PATH + "Sfc.py"
+ cmd = "python " + ONOS_SFC_PATH + "/Sfc.py"
logger.debug("Run sfc tests")
os.system(cmd)
@@ -197,8 +187,8 @@ def GetIp(type):
def Replace(before, after):
- file = "Sfc_fun.py"
- cmd = "sed -i 's/" + before + "/" + after + "/g' " + SFC_PATH + file
+ file = "/Sfc_fun.py"
+ cmd = "sed -i 's/" + before + "/" + after + "/g' " + ONOS_SFC_PATH + file
os.system(cmd)
@@ -207,7 +197,7 @@ def SetSfcConf():
Replace("neutron_ip", GetIp("neutron"))
Replace("nova_ip", GetIp("nova"))
Replace("glance_ip", GetIp("glance"))
- pwd = os.environ['OS_PASSWORD']
+ pwd = ft_constants.OS_PASSWORD
Replace("console", pwd)
creds_neutron = openstack_utils.get_credentials("neutron")
neutron_client = neutronclient.Client(**creds_neutron)
@@ -266,5 +256,6 @@ def main():
else:
OnosTest()
+
if __name__ == '__main__':
main()