Reverting core/ and drivers/ directories before change 15514

This reverts commit 23fb21617769f4320de93b5b1805c6ec3ca9b809.

Change-Id: I0c116f8d7195c75c7ef17f296843924d3e2a0961
diff --git a/TestON/core/graph.py b/TestON/core/graph.py
index b5bf9f6..b1cbdb2 100644
--- a/TestON/core/graph.py
+++ b/TestON/core/graph.py
@@ -1,7 +1,7 @@
 #!/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>,
@@ -10,7 +10,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
@@ -20,28 +20,29 @@
     You should have received a copy of the GNU General Public License
     along with TestON.  If not, see <http://www.gnu.org/licenses/>.
 
-"""
+'''
+
+
 import time
 import random
 
-
 class Graph:
-
     """
     Graph class provides implementations of graph algorithms.
     The functions currently supported include:
     - Comparing two graphs with specified attributes for vertices and edges
-    - Getting DFI ( Depth First Index ) and back edges during a DFS
+    - Getting DFI (Depth First Index) and back edges during a DFS
     - Chain decomposition of a graph
-    - Finding ( non- )cut-edges and vertices
+    - Finding (non-)cut-edges and vertices
     """
+
     def __init__( self ):
         # We use a dictionary to store all information about the graph
         self.graphDict = {}
         # Depth-first index of each vertex
         self.DFI = {}
         self.currentDFI = 0
-        # Parent vertex ( and edge to that vertex ) of each vertex in depth-first search tree
+        # Parent vertex (and edge to that vertex) of each vertex in depth-first search tree
         self.parentVertexInDFS = {}
         self.parentEdgeInDFS = {}
         # Back edges of the graph generated during DFS
@@ -59,7 +60,7 @@
           vertex2: { 'edges': ..., 'name': ..., 'protocol': ... } }
         Each vertex should at least have an 'edges' attribute which describes the
         adjacency information. The value of 'edges' attribute is also represented by
-        a dictionary, which maps each edge ( identified by the neighbor vertex ) to a
+        a dictionary, which maps each edge (identified by the neighbor vertex) to a
         list of attributes.
         An example of the edges dictionary:
         'edges': { vertex2: { 'port': ..., 'type': ... },
@@ -68,7 +69,7 @@
         self.graphDict = graphDict
         return main.TRUE
 
-    def compareGraphs( self, graphDictA, graphDictB, vertexAttributes=[ 'edges' ], edgeAttributes=[ 'port' ] ):
+    def compareGraphs( self, graphDictA, graphDictB, vertexAttributes=['edges'], edgeAttributes=['port'] ):
         """
         Compare two graphs.
         By default only the adjacency relationship, i.e. 'port' attribute in
@@ -102,7 +103,7 @@
                         # Compare two attributes
                         attributeValueA = graphDictA[ vertex ][ vertexAttribute ]
                         attributeValueB = graphDictB[ vertex ][ vertexAttribute ]
-                        # FIXME: the comparison may not work for ( sub )attribute values that are of list type
+                        # FIXME: the comparison may not work for (sub)attribute values that are of list type
                         # For attributes except for 'edges', we just rely on '==' for comparison
                         if not vertexAttribute == 'edges':
                             if not attributeValueA == attributeValueB:
@@ -149,8 +150,8 @@
                                                                                                                                    attributeValueA,
                                                                                                                                    attributeValueB ) )
             if not result:
-                # main.log.debug( "Graph: graphDictA: {}".format( graphDictA ) )
-                # main.log.debug( "Graph: graphDictB: {}".format( graphDictB ) )
+                #main.log.debug( "Graph: graphDictA: {}".format( graphDictA ) )
+                #main.log.debug( "Graph: graphDictB: {}".format( graphDictB ) )
                 pass
             return result
         except TypeError:
@@ -165,8 +166,8 @@
 
     def getNonCutEdges( self ):
         """
-        Get a list of non-cut-edges ( non-bridges ).
-        The definition of a cut-edge ( bridge ) is: the deletion of a cut-edge will
+        Get a list of non-cut-edges (non-bridges).
+        The definition of a cut-edge (bridge) is: the deletion of a cut-edge will
         increase the number of connected component of a graph.
         The function is realized by impelementing Schmidt's algorithm based on
         chain decomposition.
@@ -182,7 +183,7 @@
             for chain in self.chains:
                 for edge in chain:
                     nonCutEdges.append( edge )
-            # main.log.debug( 'Non-cut-edges: {}'.format( nonCutEdges ) )
+            #main.log.debug( 'Non-cut-edges: {}'.format( nonCutEdges ) )
             return nonCutEdges
         except Exception:
             main.log.exception( "Graph: Uncaught exception" )
@@ -206,16 +207,16 @@
                 # chain, the chain is a cycle chain
                 if chain[ 0 ][ 0 ] == chain[ -1 ][ 1 ]:
                     cycleChains.append( chain )
-            # main.log.debug( 'Cycle chains: {}'.format( cycleChains ) )
+            #main.log.debug( 'Cycle chains: {}'.format( cycleChains ) )
             # Get a set of vertices which are the first vertices of a cycle chain (excluding the first
             # cycle chain), and these vertices are a subset of all cut-vertices
             subsetOfCutVertices = []
             if len( cycleChains ) > 1:
                 for cycleChain in cycleChains[ 1: ]:
                     subsetOfCutVertices.append( cycleChain[ 0 ][ 0 ] )
-            # main.log.debug( 'Subset of cut vertices: {}'.format( subsetOfCutVertices ) )
+            #main.log.debug( 'Subset of cut vertices: {}'.format( subsetOfCutVertices ) )
             nonCutVertices = []
-            assert nonCutEdges is not None
+            assert nonCutEdges != None
             for vertex in self.graphDict.keys():
                 if vertex in subsetOfCutVertices:
                     continue
@@ -223,12 +224,12 @@
                 for neighbor in self.graphDict[ vertex ][ 'edges' ].keys():
                     edge = [ vertex, neighbor ]
                     backwardEdge = [ neighbor, vertex ]
-                    if edge not in nonCutEdges and backwardEdge not in nonCutEdges:
+                    if not edge in nonCutEdges and not backwardEdge in nonCutEdges:
                         vertexIsNonCut = False
                         break
                 if vertexIsNonCut:
                     nonCutVertices.append( vertex )
-            # main.log.debug( 'Non-cut-vertices: {}'.format( nonCutVertices ) )
+            #main.log.debug( 'Non-cut-vertices: {}'.format( nonCutVertices ) )
             return nonCutVertices
         except KeyError:
             main.log.exception( "Graph: KeyError exception found" )
@@ -246,7 +247,7 @@
         as generates the back edges
         """
         try:
-            assert self.graphDict is not None and len( self.graphDict ) != 0
+            assert self.graphDict != None and len( self.graphDict ) != 0
             for vertex in self.graphDict.keys():
                 self.DFI[ vertex ] = -1
                 self.parentVertexInDFS[ vertex ] = ''
@@ -287,14 +288,14 @@
                 else:
                     key = self.DFI[ neighbor ]
                     if key in self.backEdges.keys():
-                        if edge not in self.backEdges[ key ] and\
-                                backwardEdge not in self.backEdges[ key ]:
+                        if not edge in self.backEdges[ key ] and\
+                        not backwardEdge in self.backEdges[ key ]:
                             self.backEdges[ key ].append( backwardEdge )
                     else:
                         tempKey = self.DFI[ vertex ]
                         if tempKey in self.backEdges.keys():
-                            if edge not in self.backEdges[ tempKey ] and\
-                                    backwardEdge not in self.backEdges[ tempKey ]:
+                            if not edge in self.backEdges[ tempKey ] and\
+                            not backwardEdge in self.backEdges[ tempKey ]:
                                 self.backEdges[ key ] = [ backwardEdge ]
                         else:
                             self.backEdges[ key ] = [ backwardEdge ]
@@ -310,7 +311,8 @@
         """
         This function finds all the chains in chain-decomposition algorithm
         """
-        keyList = sorted( self.backEdges.keys() )
+        keyList = self.backEdges.keys()
+        keyList.sort()
         vertexIsVisited = {}
         self.chains = []
         for vertex in self.graphDict.keys():
@@ -327,7 +329,7 @@
                         nextVertex = currentEdge[ 1 ]
                         vertexIsVisited[ currentVertex ] = True
                         chain.append( currentEdge )
-                        if nextVertex == sourceVertex or vertexIsVisited[ nextVertex ]:
+                        if nextVertex == sourceVertex or vertexIsVisited[ nextVertex ] == True:
                             break
                         currentEdge = self.parentEdgeInDFS[ nextVertex ]
                     self.chains.append( chain )