Merge "vIMS deployment and cleanup"
authorboucherv <valentin.boucher@orange.com>
Mon, 5 Oct 2015 08:15:40 +0000 (08:15 +0000)
committerGerrit Code Review <gerrit@172.30.200.206>
Mon, 5 Oct 2015 08:15:40 +0000 (08:15 +0000)
testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py [new file with mode: 0644]

diff --git a/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py b/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py
new file mode 100644 (file)
index 0000000..2d6b876
--- /dev/null
@@ -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