diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2015-10-16 11:54:44 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-10-16 11:54:44 +0000 |
commit | b68e0fc717fb462790250bfb0b6ecddc13ae4c51 (patch) | |
tree | 24e2bf38018b45dd6740e4cd7d524ac04d156f9d /testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py | |
parent | 31fec5a3682a38f1124766cde116aea6a5d69bd4 (diff) | |
parent | 15a6d133f8c7689df58306656cc1c6cff46496d5 (diff) |
Merge "Move the configuration from test scripts to config_functest.yaml"
Diffstat (limited to 'testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py')
-rw-r--r-- | testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py b/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py index 2d6b87684..c909d36be 100644 --- a/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py +++ b/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py @@ -7,11 +7,16 @@ Description: import logging import os import time +import yaml class foundation: def __init__(self): - self.dir = os.path.join( os.getcwd(), 'log' ) + + currentpath = os.getcwd() + self.logdir = os.path.join( currentpath, 'log' ) + self.workhome = currentpath[0:currentpath.rfind('testcases')-1] + self.Result_DB = '' def log (self, loginfo): """ @@ -20,7 +25,7 @@ class foundation: loginfo(input): record info """ filename = time.strftime( '%Y-%m-%d-%H-%M-%S' ) + '.log' - filepath = os.path.join( self.dir, filename ) + filepath = os.path.join( self.logdir, filename ) logging.basicConfig( level=logging.INFO, format = '%(asctime)s %(filename)s:%(message)s', datefmt = '%d %b %Y %H:%M:%S', @@ -29,4 +34,31 @@ class foundation: filelog = logging.FileHandler( filepath ) logging.getLogger( 'Functest' ).addHandler( filelog ) print loginfo - logging.info(loginfo)
\ No newline at end of file + logging.info(loginfo) + + def getdefaultpara( self ): + """ + Get Default Parameters value + """ + with open(self.workhome + "testcases/config_functest.yaml") as f: + functest_yaml = yaml.safe_load(f) + f.close() + + self.Result_DB = str(functest_yaml.get("results").get("test_db_url")) + self.masterusername = str(functest_yaml.get("ONOS").get("general").\ + get('onosbench_username')) + self.masterpassword = str(functest_yaml.get("ONOS").get("general").\ + get("onosbench_password")) + self.agentusername = str(functest_yaml.get("ONOS").get("general").\ + get("onoscli_username")) + self.agentpassword = str(functest_yaml.get("ONOS").get("general").\ + get("onoscli_password")) + self.runtimeout = functest_yaml.get("ONOS").get("general").get("runtimeout") + self.OCT = str(functest_yaml.get("ONOS").get("environment").get("OCT")) + self.OC1 = str(functest_yaml.get("ONOS").get("environment").get("OC1")) + self.OC2 = str(functest_yaml.get("ONOS").get("environment").get("OC2")) + self.OC3 = str(functest_yaml.get("ONOS").get("environment").get("OC3")) + self.OCN = str(functest_yaml.get("ONOS").get("environment").get("OCN")) + self.OCN2 = str(functest_yaml.get("ONOS").get("environment").get("OCN2")) + self.localhost = self.OCT + return True
\ No newline at end of file |