Reverting core/ and drivers/ directories before change 15514

This reverts commit 23fb21617769f4320de93b5b1805c6ec3ca9b809.

Change-Id: I0c116f8d7195c75c7ef17f296843924d3e2a0961
diff --git a/TestON/drivers/common/api/dockerapidriver.py b/TestON/drivers/common/api/dockerapidriver.py
index 3b9b77a..3fac610 100644
--- a/TestON/drivers/common/api/dockerapidriver.py
+++ b/TestON/drivers/common/api/dockerapidriver.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 """
-Copyright 2016 Open Networking Foundation ( ONF )
+Copyright 2016 Open Networking Foundation (ONF)
 
 Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
 the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
@@ -9,7 +9,7 @@
     TestON is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation, either version 2 of the License, or
-    ( at your option ) any later version.
+    (at your option) any later version.
 
     TestON is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,6 +19,7 @@
     You should have received a copy of the GNU General Public License
     along with TestON.  If not, see <http://www.gnu.org/licenses/>.
 """
+
 import json
 import os
 import re
@@ -27,7 +28,6 @@
 from docker import errors
 from drivers.common.apidriver import API
 
-
 class DockerApiDriver( API ):
 
     def __init__( self ):
@@ -55,7 +55,7 @@
                 self.home = "/var/tmp"
 
             self.handle = super( DockerApiDriver, self ).connect()
-            self.dockerClient = Client( base_url='unix://var/run/docker.sock' )
+            self.dockerClient = Client(base_url='unix://var/run/docker.sock')
             return self.handle
         except Exception as e:
             main.log.exception( e )
@@ -72,29 +72,29 @@
                 if imageDict[ 'RepoTags' ] is not None:
                     if len( imageDict[ 'RepoTags' ] ) > 1:
                         duplicateTagDetected = 1
-                    imageListToSend.append( imageDict[ 'RepoTags' ][ 0 ].encode( 'UTF8' ).split( ':' )[ 1 ] )
+                    imageListToSend.append( imageDict['RepoTags'][0].encode('UTF8').split(':')[1] )
             return imageListToSend, duplicateTagDetected
         except Exception as e:
             main.log.exception( e )
 
-    def dockerPull( self, onosRepo="onosproject/onos", onosTag="latest" ):
+    def dockerPull( self, onosRepo ="onosproject/onos", onosTag="latest" ):
         """
         Pulls Docker image from repository
         """
         try:
             main.log.info( self.name +
-                           ": Pulling Docker image " + onosRepo + ":" + onosTag )
-            for line in self.dockerClient.pull( repository=onosRepo,
-                                                tag=onosTag, stream=True ):
-                print "#",
-            main.log.info( json.dumps( json.loads( line ), indent=4 ) )
+                           ": Pulling Docker image " + onosRepo + ":"+ onosTag )
+            for line in self.dockerClient.pull( repository = onosRepo, \
+                    tag = onosTag, stream = True ):
+                    print "#",
+            main.log.info(json.dumps(json.loads(line), indent =4))
 
-            # response = json.dumps( json.load( pullResult ), indent=4 )
+            #response = json.dumps( json.load( pullResult ), indent=4 )
             if re.search( "for onosproject/onos:" + onosTag, line ):
                 main.log.info( "onos docker image pulled is: " + line )
                 return main.TRUE
             else:
-                main.log.error( "Failed to download image from: " + onosRepo + ":" + onosTag )
+                main.log.error( "Failed to download image from: " + onosRepo +":"+ onosTag )
                 main.log.error( "Error respone: " )
                 main.log.error( line )
                 return main.FALSE
@@ -109,17 +109,17 @@
         try:
             main.log.info( self.name +
                            ": Creating Docker container for node: " + onosNode )
-            response = self.dockerClient.create_container( image=onosImage,
-                                                           tty=True, name=onosNode, detach=True )
-            # print response
-            # print response.get( "Id" )
-            # print response.get( "Warnings" )
-            if( str( response.get( "Warnings" ) ) == 'None' ):
-                main.log.info( "Created container for node: " + onosNode + "; container id is: " + response.get( "Id" ) )
-                return ( main.TRUE, response.get( "Id" ) )
+            response = self.dockerClient.create_container( image=onosImage, \
+                    tty=True, name=onosNode, detach=True )
+            #print response
+            #print response.get("Id")
+            #print response.get("Warnings")
+            if( str( response.get("Warnings") ) == 'None' ):
+                main.log.info( "Created container for node: " + onosNode + "; container id is: " + response.get("Id") )
+                return ( main.TRUE, response.get("Id") )
             else:
                 main.log.info( "Noticed warnings during create" )
-                return ( main.FALSE, null )
+                return ( main.FALSE, null)
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
@@ -131,7 +131,7 @@
         try:
             main.log.info( self.name +
                            ": Starting Docker conatiner Id " + ctID )
-            response = self.dockerClient.start( container=ctID )
+            response = self.dockerClient.start( container = ctID )
             if response is None:
                 main.log.info( "Started container for Id: " + ctID )
                 return main.TRUE
@@ -157,11 +157,11 @@
                 main.log.info( "Noticed warnings during stop" )
                 return main.FALSE
         except errors.NotFound:
-            main.log.info( ctName + " not found! Continue on tests..." )
+            main.log.info( ctName + " not found! Continue on tests...")
             return main.TRUE
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            # main.cleanAndExit()
+            #main.cleanAndExit()
 
     def dockerRestartCT( self, ctName ):
         """
@@ -181,27 +181,27 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
-    def dockerCheckCTName( self, ctName ):
+    def dockerCheckCTName( self, ctName):
         """
             Check Docker conatiner status
         """
         try:
             main.log.info( self.name +
                            ": Checking Docker Status for CT with 'Names'  " + ctName )
-            namelist = [ response[ "Names" ] for response in self.dockerClient.containers( all=True ) if not [] ]
-            main.log.info( "Name list is: " + str( namelist ) )
-            if( [ ctName ] in namelist ):
+            namelist = [response["Names"] for response in self.dockerClient.containers(all=True) if not []]
+            main.log.info("Name list is: " + str(namelist) )
+            if( [ctName] in namelist):
                 main.log.info( "Container " + ctName + " exists" )
                 return main.TRUE
             else:
                 main.log.info( "Container " + ctName + " does not exist" )
                 return main.FALSE
         except errors.NotFound:
-            main.log.warn( ctName + "not found! Continue with the tests..." )
+            main.log.warn( ctName + "not found! Continue with the tests...")
             return main.FALSE
         except Exception:
             main.log.exception( self.name + ": Uncaught exception! Continue tests..." )
-            # main.cleanAndExit()
+            #main.cleanAndExit()
 
     def dockerRemoveCT( self, ctName ):
         """
@@ -215,15 +215,15 @@
                 main.log.info( "Removed container for node: " + ctName )
                 return main.TRUE
             else:
-                main.log.info( "Noticed warnings during Remove " + ctName )
+                main.log.info( "Noticed warnings during Remove " + ctName)
                 return main.FALSE
-            main.log.exception( self.name + ": not found, continuing..." )
+            main.log.exception(self.name + ": not found, continuing...")
         except errors.NotFound:
-            main.log.warn( ctName + "not found! Continue with the tests..." )
+            main.log.warn( ctName + "not found! Continue with the tests...")
             return main.TRUE
         except Exception:
             main.log.exception( self.name + ": Uncaught exception! Continuing..." )
-            # main.cleanAndExit()
+            #main.cleanAndExit()
 
     def dockerRemoveImage( self, imageRepoTag=None ):
         """
@@ -234,13 +234,13 @@
             main.log.info( "No docker image found" )
             return rmResult
         else:
-            imageList = [ image[ "Id" ] for image in self.dockerClient.images()
-                                        if image[ "RepoTags" ] is None
-                                           or imageRepoTag in image[ "RepoTags" ] ]
+            imageList = [ image["Id"] for image in self.dockerClient.images()
+                                        if image["RepoTags"] is None
+                                           or imageRepoTag in image["RepoTags"] ]
             for id in imageList:
                 try:
                     main.log.info( self.name + ": Removing Docker image " + id )
-                    response = self.dockerClient.remove_image( id, force=True )
+                    response = self.dockerClient.remove_image(id, force = True)
                     if response is None:
                         main.log.info( "Removed Docker image: " + id )
                         rmResult = rmResult and main.TRUE
@@ -248,12 +248,12 @@
                         main.log.info( "Noticed warnings during Remove " + id )
                         rmResult = rmResult and main.FALSE
                 except errors.NotFound:
-                    main.log.warn( image + "not found! Continue with the tests..." )
+                    main.log.warn( image + "not found! Continue with the tests...")
                     rmResult = rmResult and main.TRUE
                 except Exception:
                     main.log.exception( self.name + ": Uncaught exception! Continuing..." )
                     rmResult = rmResult and main.FALSE
-                    # main.cleanAndExit()
+                    #main.cleanAndExit()
         return rmResult
 
     def fetchLatestClusterFile( self, branch="master" ):
@@ -263,7 +263,7 @@
         try:
             command = "wget -N https://raw.githubusercontent.com/opennetworkinglab/\
                     onos/" + branch + "/tools/package/bin/onos-form-cluster"
-            subprocess.call( command )  # output checks are missing for now
+            subprocess.call( command ) # output checks are missing for now
             command = "chmod u+x " + "onos-form-cluster"
             subprocess.call( command )
             return main.TRUE
@@ -276,7 +276,7 @@
             From ONOS cluster for IP addresses in onosIPs list
         """
         try:
-            onosIPs = " ".join( onosIPs )
+            onosIPs = " ".join(onosIPs)
             command = "{}/onos-form-cluster -u {} -p {} {}".format( cmdPath,
                                                                     user,
                                                                     passwd,
@@ -285,7 +285,7 @@
             if result == 0:
                 return main.TRUE
             else:
-                main.log.info( "Something is not right in forming cluster>" )
+                main.log.info("Something is not right in forming cluster>")
                 return main.FALSE
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
@@ -297,10 +297,11 @@
         """
         try:
             output = self.dockerClient.inspect_container( ctName )
-            nodeIP = output[ 'NetworkSettings' ][ 'IPAddress' ]
-            main.log.info( " Docker IP " + str( nodeIP ) )
-            return str( nodeIP )
+            nodeIP = output['NetworkSettings']['IPAddress']
+            main.log.info( " Docker IP " + str(nodeIP) )
+            return str(nodeIP)
 
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
+