summaryrefslogtreecommitdiffstats
path: root/testcases/Controllers/ONOS/Teston/CI
diff options
context:
space:
mode:
authorQinglong Lan <lanqinglong@huawei.com>2015-10-04 12:52:13 +0800
committerQinglong Lan <lanqinglong@huawei.com>2015-10-04 13:14:36 +0800
commit05db0c76a2eefd2a490573973d417f29eb1303c9 (patch)
tree21355c1064dc4139800933a556ec96119bd1037e /testcases/Controllers/ONOS/Teston/CI
parentef6d69f42a875f1354a953a80670a5bffcbdc05b (diff)
Write a simple adapter in functest project to run TESTON
JIRA:FUNCTEST-46 Change-Id: I146ec926da6cbbd2535d0997326a13bd545f42c6 Signed-off-by: Qinglong Lan <lanqinglong@huawei.com>
Diffstat (limited to 'testcases/Controllers/ONOS/Teston/CI')
-rw-r--r--testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py b/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py
new file mode 100644
index 000000000..2d6b87684
--- /dev/null
+++ b/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py
@@ -0,0 +1,32 @@
+"""
+Description:
+ This file include basis functions
+ lanqinglong@huawei.com
+"""
+
+import logging
+import os
+import time
+
+class foundation:
+
+ def __init__(self):
+ self.dir = os.path.join( os.getcwd(), 'log' )
+
+ def log (self, loginfo):
+ """
+ Record log in log directory for deploying test environment
+ parameters:
+ loginfo(input): record info
+ """
+ filename = time.strftime( '%Y-%m-%d-%H-%M-%S' ) + '.log'
+ filepath = os.path.join( self.dir, filename )
+ logging.basicConfig( level=logging.INFO,
+ format = '%(asctime)s %(filename)s:%(message)s',
+ datefmt = '%d %b %Y %H:%M:%S',
+ filename = filepath,
+ filemode = 'w')
+ filelog = logging.FileHandler( filepath )
+ logging.getLogger( 'Functest' ).addHandler( filelog )
+ print loginfo
+ logging.info(loginfo) \ No newline at end of file