From 165ff17205d99b18df36e5ac6f34ede858e3da17 Mon Sep 17 00:00:00 2001 From: Morgan Richomme Date: Thu, 24 Nov 2016 18:25:52 +0100 Subject: file/dir renaming for consistency JIRA: FUNCTEST-579 Change-Id: Iaa545db70bfb76770df0a3d17871e29ce518ff2d Signed-off-by: Morgan Richomme --- .../Controllers/ONOS/Teston/adapters/foundation.py | 93 ---------------------- 1 file changed, 93 deletions(-) delete mode 100644 functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py (limited to 'functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py') diff --git a/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py deleted file mode 100644 index 6f7a40ff..00000000 --- a/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py +++ /dev/null @@ -1,93 +0,0 @@ -""" -Description: - This file include basis functions - lanqinglong@huawei.com - -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -""" - -import datetime -import logging -import os -import re -import time - -import functest.utils.functest_constants as ft_constants -import functest.utils.functest_utils as ft_utils - - -class foundation: - - def __init__(self): - - # currentpath = os.getcwd() - 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] - self.Result_DB = '' - filename = time.strftime('%Y-%m-%d-%H-%M-%S') + '.log' - self.logfilepath = os.path.join(self.logdir, filename) - self.starttime = datetime.datetime.now() - - def log(self, loginfo): - """ - Record log in log directory for deploying test environment - parameters: - loginfo(input): record info - """ - logging.basicConfig(level=logging.INFO, - format='%(asctime)s %(filename)s:%(message)s', - datefmt='%d %b %Y %H:%M:%S', - filename=self.logfilepath, - filemode='w') - filelog = logging.FileHandler(self.logfilepath) - logging.getLogger('Functest').addHandler(filelog) - logging.info(loginfo) - - def getdefaultpara(self): - """ - Get Default Parameters value - """ - 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 - - def GetResult(self): - cmd = "cat " + self.logfilepath + " | grep Fail" - Resultbuffer = os.popen(cmd).read() - duration = datetime.datetime.now() - self.starttime - time.sleep(2) - - if re.search("[1-9]+", Resultbuffer): - self.log("Testcase Fails\n" + Resultbuffer) - Result = "POK" - else: - self.log("Testcases Pass") - Result = "OK" - payload = {'timestart': str(self.starttime), - 'duration': str(duration), 'status': Result} - - return payload -- cgit 1.2.3-korg