Merge "ONOS-1600 Host Mobility Test - Non-Functional"
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 3b89282..067d268 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -222,7 +222,7 @@
         self.CurrentTestCase = ""
         self.stepResults = []
         self.stepName = ""
-        self.caseExplaination = ""
+        self.caseExplanation = ""
         result = self.TRUE
         self.stepCount = 0
         self.EXPERIMENTAL_MODE = self.FALSE
@@ -256,8 +256,8 @@
                 self.CASERESULT = self.NORESULT
             self.testCaseResult[str(self.CurrentTestCaseNumber)] = self.CASERESULT
             self.logger.updateCaseResults(self)
-            self.log.wiki( "<p>" + self.caseExplaination + "</p>" )
-            self.log.summary( self.caseExplaination )
+            self.log.wiki( "<p>" + self.caseExplanation + "</p>" )
+            self.log.summary( self.caseExplanation )
             self.log.wiki( "<ul>" )
             for line in self.stepCache.splitlines():
                 if re.search( " - PASS$", line ):
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index bb57b9e..f991b09 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -3267,7 +3267,7 @@
                 # Node not leader
                 assert "java.lang.IllegalStateException" not in output
             except AssertionError:
-                main.log.error( "Error in processing 'set-test-add' " +
+                main.log.error( "Error in processing '" + cmdStr + "' " +
                                 "command: " + str( output ) )
                 retryTime = 30  # Conservative time, given by Madan
                 main.log.info( "Waiting " + str( retryTime ) +
@@ -3288,7 +3288,7 @@
                 main.log.debug( self.name + " actual: " + repr( output ) )
                 return main.ERROR
         except AssertionError:
-            main.log.error( "Error in processing 'set-test-add' command: " +
+            main.log.error( "Error in processing '" + cmdStr + "' command: " +
                             str( output ) )
             return main.ERROR
         except TypeError:
@@ -3335,7 +3335,7 @@
                 # Node not leader
                 assert "java.lang.IllegalStateException" not in output
             except AssertionError:
-                main.log.error( "Error in processing 'set-test-add' " +
+                main.log.error( "Error in processing '" + cmdStr + "' " +
                                 "command: " + str( output ) )
                 retryTime = 30  # Conservative time, given by Madan
                 main.log.info( "Waiting " + str( retryTime ) +
@@ -3377,7 +3377,7 @@
             main.log.debug( self.name + " actual: " + repr( output ) )
             return main.ERROR
         except AssertionError:
-            main.log.error( "Error in processing 'set-test-remove' command: " +
+            main.log.error( "Error in processing '" + cmdStr + "' command: " +
                             str( output ) )
             return main.ERROR
         except TypeError:
@@ -3434,7 +3434,7 @@
                 # Node not leader
                 assert "java.lang.IllegalStateException" not in output
             except AssertionError:
-                main.log.error( "Error in processing 'set-test-add' " +
+                main.log.error( "Error in processing '" + cmdStr + "' " +
                                 "command: " + str( output ) )
                 retryTime = 30  # Conservative time, given by Madan
                 main.log.info( "Waiting " + str( retryTime ) +
@@ -3484,7 +3484,7 @@
                 main.log.debug( self.name + " actual: " + repr( output ) )
                 return main.ERROR
         except AssertionError:
-            main.log.error( "Error in processing 'set-test-get' command: " +
+            main.log.error( "Error in processing '" + cmdStr + "' command: " +
                             str( output ) )
             return main.ERROR
         except TypeError:
@@ -3527,7 +3527,7 @@
                 # Node not leader
                 assert "java.lang.IllegalStateException" not in output
             except AssertionError:
-                main.log.error( "Error in processing 'set-test-add' " +
+                main.log.error( "Error in processing '" + cmdStr + "' " +
                                 "command: " + str( output ) )
                 retryTime = 30  # Conservative time, given by Madan
                 main.log.info( "Waiting " + str( retryTime ) +
@@ -3556,7 +3556,7 @@
                 main.log.debug( self.name + " actual: " + repr( output ) )
                 return None
         except AssertionError:
-            main.log.error( "Error in processing 'set-test-get' command: " +
+            main.log.error( "Error in processing '" + cmdStr + "' command: " +
                             str( output ) )
             return None
         except TypeError:
@@ -3607,12 +3607,13 @@
             main.cleanup()
             main.exit()
 
-    def counterTestIncrement( self, counter, inMemory=False ):
+    def counterTestAddAndGet( self, counter, delta=1, inMemory=False ):
         """
-        CLI command to increment and get a distributed counter.
+        CLI command to add a delta to then get a distributed counter.
         Required arguments:
             counter - The name of the counter to increment.
         Optional arguments:
+            delta - The long to add to the counter
             inMemory - use in memory map for the counter
         returns:
             integer value of the counter or
@@ -3620,10 +3621,13 @@
         """
         try:
             counter = str( counter )
+            delta = int( delta )
             cmdStr = "counter-test-increment "
             if inMemory:
                 cmdStr += "-i "
             cmdStr += counter
+            if delta != 1:
+                cmdStr += " " + str( delta )
             output = self.sendline( cmdStr )
             try:
                 # TODO: Maybe make this less hardcoded
@@ -3632,7 +3636,7 @@
                 # Node not leader
                 assert "java.lang.IllegalStateException" not in output
             except AssertionError:
-                main.log.error( "Error in processing 'set-test-add' " +
+                main.log.error( "Error in processing '" + cmdStr + "' " +
                                 "command: " + str( output ) )
                 retryTime = 30  # Conservative time, given by Madan
                 main.log.info( "Waiting " + str( retryTime ) +
@@ -3641,18 +3645,18 @@
                 output = self.sendline( cmdStr )
             assert "Error executing command" not in output
             main.log.info( self.name + ": " + output )
-            pattern = counter + " was updated to (\d+)"
+            pattern = counter + " was updated to (-?\d+)"
             match = re.search( pattern, output )
             if match:
                 return int( match.group( 1 ) )
             else:
-                main.log.error( self.name + ": counterTestIncrement did not" +
+                main.log.error( self.name + ": counterTestAddAndGet did not" +
                                 " match expected output." )
                 main.log.debug( self.name + " expected: " + pattern )
                 main.log.debug( self.name + " actual: " + repr( output ) )
                 return None
         except AssertionError:
-            main.log.error( "Error in processing 'counter-test-increment'" +
+            main.log.error( "Error in processing '" + cmdStr + "'" +
                             " command: " + str( output ) )
             return None
         except TypeError:
@@ -3668,6 +3672,72 @@
             main.cleanup()
             main.exit()
 
+    def counterTestGetAndAdd( self, counter, delta=1, inMemory=False ):
+        """
+        CLI command to get a distributed counter then add a delta to it.
+        Required arguments:
+            counter - The name of the counter to increment.
+        Optional arguments:
+            delta - The long to add to the counter
+            inMemory - use in memory map for the counter
+        returns:
+            integer value of the counter or
+            None on Error
+        """
+        try:
+            counter = str( counter )
+            delta = int( delta )
+            cmdStr = "counter-test-increment -g "
+            if inMemory:
+                cmdStr += "-i "
+            cmdStr += counter
+            if delta != 1:
+                cmdStr += " " + str( delta )
+            output = self.sendline( cmdStr )
+            try:
+                # TODO: Maybe make this less hardcoded
+                # ConsistentMap Exceptions
+                assert "org.onosproject.store.service" not in output
+                # Node not leader
+                assert "java.lang.IllegalStateException" not in output
+            except AssertionError:
+                main.log.error( "Error in processing '" + cmdStr + "' " +
+                                "command: " + str( output ) )
+                retryTime = 30  # Conservative time, given by Madan
+                main.log.info( "Waiting " + str( retryTime ) +
+                               "seconds before retrying." )
+                time.sleep( retryTime )  # Due to change in mastership
+                output = self.sendline( cmdStr )
+            assert "Error executing command" not in output
+            main.log.info( self.name + ": " + output )
+            pattern = counter + " was updated to (-?\d+)"
+            match = re.search( pattern, output )
+            if match:
+                return int( match.group( 1 ) )
+            else:
+                main.log.error( self.name + ": counterTestGetAndAdd did not" +
+                                " match expected output." )
+                main.log.debug( self.name + " expected: " + pattern )
+                main.log.debug( self.name + " actual: " + repr( output ) )
+                return None
+        except AssertionError:
+            main.log.error( "Error in processing '" + cmdStr + "'" +
+                            " command: " + str( output ) )
+            return None
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+
     def summary( self, jsonFormat=True ):
         """
         Description: Execute summary command in onos
diff --git a/TestON/tests/CHOtest/Dependencies/topoAtt.py b/TestON/tests/CHOtest/Dependencies/topoAtt.py
index 0247458..633a255 100755
--- a/TestON/tests/CHOtest/Dependencies/topoAtt.py
+++ b/TestON/tests/CHOtest/Dependencies/topoAtt.py
@@ -12,7 +12,7 @@
 from mininet.cli import CLI
 from mininet.log import setLogLevel
 from mininet.util import dumpNodeConnections
-from mininet.node import ( UserSwitch, OVSSwitch, OVSLegacyKernelSwitch, IVSSwitch )
+from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
 
 class attTopo( Topo ):
 
diff --git a/TestON/tests/CHOtest/Dependencies/topoChordal.py b/TestON/tests/CHOtest/Dependencies/topoChordal.py
index 38eb6a1..542c3ed 100755
--- a/TestON/tests/CHOtest/Dependencies/topoChordal.py
+++ b/TestON/tests/CHOtest/Dependencies/topoChordal.py
@@ -10,7 +10,7 @@
 from mininet.cli import CLI
 from mininet.log import setLogLevel
 from mininet.util import dumpNodeConnections
-from mininet.node import ( UserSwitch, OVSSwitch, OVSLegacyKernelSwitch, IVSSwitch )
+from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
 
 class chordalTopo( Topo ):
 
diff --git a/TestON/tests/CHOtest/Dependencies/topoSpine.py b/TestON/tests/CHOtest/Dependencies/topoSpine.py
index 56fe745..cc681dd 100755
--- a/TestON/tests/CHOtest/Dependencies/topoSpine.py
+++ b/TestON/tests/CHOtest/Dependencies/topoSpine.py
@@ -10,7 +10,7 @@
 from subprocess import call
 from mininet.log import setLogLevel
 from mininet.util import dumpNodeConnections
-from mininet.node import ( UserSwitch, OVSSwitch, OVSLegacyKernelSwitch, IVSSwitch )
+from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
 
 class spineTopo( Topo ):
 
@@ -19,400 +19,400 @@
 
         # Initialize Topology
         Topo.__init__( self, **opts )
-    
-	# add nodes, Leaf switches
-	s1 = self.addSwitch( 's1' )
-	s2 = self.addSwitch( 's2' )
-	s3 = self.addSwitch( 's3' )
-	s4 = self.addSwitch( 's4' )
-	s5 = self.addSwitch( 's5' )
-	s6 = self.addSwitch( 's6' )
-	s7 = self.addSwitch( 's7' )
-	s8 = self.addSwitch( 's8' )
-	s9 = self.addSwitch( 's9' )
-	s10 = self.addSwitch( 's10' )
-	s11 = self.addSwitch( 's11' )
-	s12 = self.addSwitch( 's12' )
-	s13 = self.addSwitch( 's13' )
-	s14 = self.addSwitch( 's14' )
 
-	# add nodes, Spine switches first...
-	s15 = self.addSwitch( 's15' )
-	s16 = self.addSwitch( 's16' )
-	s17 = self.addSwitch( 's17' )
-	s18 = self.addSwitch( 's18' )
-	s19 = self.addSwitch( 's19' )
-	s20 = self.addSwitch( 's20' )
-	s21 = self.addSwitch( 's21' )
-	s22 = self.addSwitch( 's22' )
-	s23 = self.addSwitch( 's23' )
-	s24 = self.addSwitch( 's24' )
-	s25 = self.addSwitch( 's25' )
-	s26 = self.addSwitch( 's26' )
-	s27 = self.addSwitch( 's27' )
-	s28 = self.addSwitch( 's28' )
-	s29 = self.addSwitch( 's29' )
-	s30 = self.addSwitch( 's30' )
-	s31 = self.addSwitch( 's31' )
-	s32 = self.addSwitch( 's32' )
-	s33 = self.addSwitch( 's33' )
-	s34 = self.addSwitch( 's34' )
-	s35 = self.addSwitch( 's35' )
-	s36 = self.addSwitch( 's36' )
-	s37 = self.addSwitch( 's37' )
-	s38 = self.addSwitch( 's38' )
-	s39 = self.addSwitch( 's39' )
-	s40 = self.addSwitch( 's40' )
-	s41 = self.addSwitch( 's41' )
-	s42 = self.addSwitch( 's42' )
-	s43 = self.addSwitch( 's43' )
-	s44 = self.addSwitch( 's44' )
-	s45 = self.addSwitch( 's45' )
-	s46 = self.addSwitch( 's46' )
-	s47 = self.addSwitch( 's47' )
-	s48 = self.addSwitch( 's48' )
-	s49 = self.addSwitch( 's49' )
-	s50 = self.addSwitch( 's50' )
-	s51 = self.addSwitch( 's51' )
-	s52 = self.addSwitch( 's52' )
-	s53 = self.addSwitch( 's53' )
-	s54 = self.addSwitch( 's54' )
-	s55 = self.addSwitch( 's55' )
-	s56 = self.addSwitch( 's56' )
-	s57 = self.addSwitch( 's57' )
-	s58 = self.addSwitch( 's58' )
-	s59 = self.addSwitch( 's59' )
-	s60 = self.addSwitch( 's60' )
-	s61 = self.addSwitch( 's61' )
-	s62 = self.addSwitch( 's62' )
-	s63 = self.addSwitch( 's63' )
-	s64 = self.addSwitch( 's64' )
-	s65 = self.addSwitch( 's65' )
-	s66 = self.addSwitch( 's66' )
-	s67 = self.addSwitch( 's67' )
-	s68 = self.addSwitch( 's68' )
-	s69 = self.addSwitch( 's69' )
-	s70 = self.addSwitch( 's70' )
-	s71 = self.addSwitch( 's71' )
-	s72 = self.addSwitch( 's72' )
-	s73 = self.addSwitch( 's73' )
-	s74 = self.addSwitch( 's74' )
-	s75 = self.addSwitch( 's75' )
-	s76 = self.addSwitch( 's76' )
-	s77 = self.addSwitch( 's77' )
-	s78 = self.addSwitch( 's78' )
+        # add nodes, Leaf switches
+        s1 = self.addSwitch( 's1' )
+        s2 = self.addSwitch( 's2' )
+        s3 = self.addSwitch( 's3' )
+        s4 = self.addSwitch( 's4' )
+        s5 = self.addSwitch( 's5' )
+        s6 = self.addSwitch( 's6' )
+        s7 = self.addSwitch( 's7' )
+        s8 = self.addSwitch( 's8' )
+        s9 = self.addSwitch( 's9' )
+        s10 = self.addSwitch( 's10' )
+        s11 = self.addSwitch( 's11' )
+        s12 = self.addSwitch( 's12' )
+        s13 = self.addSwitch( 's13' )
+        s14 = self.addSwitch( 's14' )
 
-	# ... and now hosts
-	#s1_host = self.addHost( 'h1' )
-	#s2_host = self.addHost( 'h2' )
-	#s3_host = self.addHost( 'h3' )
-	#s4_host = self.addHost( 'h4' )
-	#s5_host = self.addHost( 'h5' )
-	#s6_host = self.addHost( 'h6' )
-	#s7_host = self.addHost( 'h7' )
-	#s8_host = self.addHost( 'h8' )
-	#s9_host = self.addHost( 'h9' )
-	#s10_host = self.addHost( 'h10' )
-	s11_host = self.addHost( 'h11' )
-	s12_host = self.addHost( 'h12' )
-	s13_host = self.addHost( 'h13' )
-	s14_host = self.addHost( 'h14' )
-	s15_host = self.addHost( 'h15' )
-	s16_host = self.addHost( 'h16' )
-	s17_host = self.addHost( 'h17' )
-	s18_host = self.addHost( 'h18' )
-	s19_host = self.addHost( 'h19' )
-	s20_host = self.addHost( 'h20' )
-	s21_host = self.addHost( 'h21' )
-	s22_host = self.addHost( 'h22' )
-	s23_host = self.addHost( 'h23' )
-	s24_host = self.addHost( 'h24' )
-	s25_host = self.addHost( 'h25' )
-	s26_host = self.addHost( 'h26' )
-	s27_host = self.addHost( 'h27' )
-	s28_host = self.addHost( 'h28' )
-	s29_host = self.addHost( 'h29' )
-	s30_host = self.addHost( 'h30' )
-	s31_host = self.addHost( 'h31' )
-	s32_host = self.addHost( 'h32' )
-	s33_host = self.addHost( 'h33' )
-	s34_host = self.addHost( 'h34' )
-	s35_host = self.addHost( 'h35' )
-	s36_host = self.addHost( 'h36' )
-	s37_host = self.addHost( 'h37' )
-	s38_host = self.addHost( 'h38' )
-	s39_host = self.addHost( 'h39' )
-	s40_host = self.addHost( 'h40' )
-	s41_host = self.addHost( 'h41' )
-	s42_host = self.addHost( 'h42' )
-	s43_host = self.addHost( 'h43' )
-	s44_host = self.addHost( 'h44' )
-	s45_host = self.addHost( 'h45' )
-	s46_host = self.addHost( 'h46' )
-	s47_host = self.addHost( 'h47' )
-	s48_host = self.addHost( 'h48' )
-	s49_host = self.addHost( 'h49' )
-	s50_host = self.addHost( 'h50' )
-	s51_host = self.addHost( 'h51' )
-	s52_host = self.addHost( 'h52' )
-	s53_host = self.addHost( 'h53' )
-	s54_host = self.addHost( 'h54' )
-	s55_host = self.addHost( 'h55' )
-	s56_host = self.addHost( 'h56' )
-	s57_host = self.addHost( 'h57' )
-	s58_host = self.addHost( 'h58' )
-	s59_host = self.addHost( 'h59' )
-	s60_host = self.addHost( 'h60' )
-	s61_host = self.addHost( 'h61' )
-	s62_host = self.addHost( 'h62' )
-	s63_host = self.addHost( 'h63' )
-	s64_host = self.addHost( 'h64' )
-	s65_host = self.addHost( 'h65' )
-	s66_host = self.addHost( 'h66' )
-	s67_host = self.addHost( 'h67' )
-	s68_host = self.addHost( 'h68' )
-	s69_host = self.addHost( 'h69' )
-	s70_host = self.addHost( 'h70' )
-	s71_host = self.addHost( 'h71' )
-	s72_host = self.addHost( 'h72' )
-	s73_host = self.addHost( 'h73' )
-	s74_host = self.addHost( 'h74' )
-	s75_host = self.addHost( 'h75' )
-	s76_host = self.addHost( 'h76' )
-	s77_host = self.addHost( 'h77' )
-	s78_host = self.addHost( 'h78' )
+        # add nodes, Spine switches first...
+        s15 = self.addSwitch( 's15' )
+        s16 = self.addSwitch( 's16' )
+        s17 = self.addSwitch( 's17' )
+        s18 = self.addSwitch( 's18' )
+        s19 = self.addSwitch( 's19' )
+        s20 = self.addSwitch( 's20' )
+        s21 = self.addSwitch( 's21' )
+        s22 = self.addSwitch( 's22' )
+        s23 = self.addSwitch( 's23' )
+        s24 = self.addSwitch( 's24' )
+        s25 = self.addSwitch( 's25' )
+        s26 = self.addSwitch( 's26' )
+        s27 = self.addSwitch( 's27' )
+        s28 = self.addSwitch( 's28' )
+        s29 = self.addSwitch( 's29' )
+        s30 = self.addSwitch( 's30' )
+        s31 = self.addSwitch( 's31' )
+        s32 = self.addSwitch( 's32' )
+        s33 = self.addSwitch( 's33' )
+        s34 = self.addSwitch( 's34' )
+        s35 = self.addSwitch( 's35' )
+        s36 = self.addSwitch( 's36' )
+        s37 = self.addSwitch( 's37' )
+        s38 = self.addSwitch( 's38' )
+        s39 = self.addSwitch( 's39' )
+        s40 = self.addSwitch( 's40' )
+        s41 = self.addSwitch( 's41' )
+        s42 = self.addSwitch( 's42' )
+        s43 = self.addSwitch( 's43' )
+        s44 = self.addSwitch( 's44' )
+        s45 = self.addSwitch( 's45' )
+        s46 = self.addSwitch( 's46' )
+        s47 = self.addSwitch( 's47' )
+        s48 = self.addSwitch( 's48' )
+        s49 = self.addSwitch( 's49' )
+        s50 = self.addSwitch( 's50' )
+        s51 = self.addSwitch( 's51' )
+        s52 = self.addSwitch( 's52' )
+        s53 = self.addSwitch( 's53' )
+        s54 = self.addSwitch( 's54' )
+        s55 = self.addSwitch( 's55' )
+        s56 = self.addSwitch( 's56' )
+        s57 = self.addSwitch( 's57' )
+        s58 = self.addSwitch( 's58' )
+        s59 = self.addSwitch( 's59' )
+        s60 = self.addSwitch( 's60' )
+        s61 = self.addSwitch( 's61' )
+        s62 = self.addSwitch( 's62' )
+        s63 = self.addSwitch( 's63' )
+        s64 = self.addSwitch( 's64' )
+        s65 = self.addSwitch( 's65' )
+        s66 = self.addSwitch( 's66' )
+        s67 = self.addSwitch( 's67' )
+        s68 = self.addSwitch( 's68' )
+        s69 = self.addSwitch( 's69' )
+        s70 = self.addSwitch( 's70' )
+        s71 = self.addSwitch( 's71' )
+        s72 = self.addSwitch( 's72' )
+        s73 = self.addSwitch( 's73' )
+        s74 = self.addSwitch( 's74' )
+        s75 = self.addSwitch( 's75' )
+        s76 = self.addSwitch( 's76' )
+        s77 = self.addSwitch( 's77' )
+        s78 = self.addSwitch( 's78' )
 
-	# add edges between switch and corresponding host
-	#self.addLink( s1 , s1_host )
-	#self.addLink( s2 , s2_host )
-	#self.addLink( s3 , s3_host )
-	#self.addLink( s4 , s4_host )
-	#self.addLink( s5 , s5_host )
-	#self.addLink( s6 , s6_host )
-	#self.addLink( s7 , s7_host )
-	#self.addLink( s8 , s8_host )
-	#self.addLink( s9 , s9_host )
-	#self.addLink( s10 , s10_host )
-	self.addLink( s11 , s11_host )
-	self.addLink( s12 , s12_host )
-	self.addLink( s13 , s13_host )
-	self.addLink( s14 , s14_host )
-	self.addLink( s15 , s15_host )
-	self.addLink( s16 , s16_host )
-	self.addLink( s17 , s17_host )
-	self.addLink( s18 , s18_host )
-	self.addLink( s19 , s19_host )
-	self.addLink( s20 , s20_host )
-	self.addLink( s21 , s21_host )
-	self.addLink( s22 , s22_host )
-	self.addLink( s23 , s23_host )
-	self.addLink( s24 , s24_host )
-	self.addLink( s25 , s25_host )
-	self.addLink( s26 , s26_host )
-	self.addLink( s27 , s27_host )
-	self.addLink( s28 , s28_host )
-	self.addLink( s29 , s29_host )
-	self.addLink( s30 , s30_host )
-	self.addLink( s31 , s31_host )
-	self.addLink( s32 , s32_host )
-	self.addLink( s33 , s33_host )
-	self.addLink( s34 , s34_host )
-	self.addLink( s35 , s35_host )
-	self.addLink( s36 , s36_host )
-	self.addLink( s37 , s37_host )
-	self.addLink( s38 , s38_host )
-	self.addLink( s39 , s39_host )
-	self.addLink( s40 , s40_host )
-	self.addLink( s41 , s41_host )
-	self.addLink( s42 , s42_host )
-	self.addLink( s43 , s43_host )
-	self.addLink( s44 , s44_host )
-	self.addLink( s45 , s45_host )
-	self.addLink( s46 , s46_host )
-	self.addLink( s47 , s47_host )
-	self.addLink( s48 , s48_host )
-	self.addLink( s49 , s49_host )
-	self.addLink( s50 , s50_host )
-	self.addLink( s51 , s51_host )
-	self.addLink( s52 , s52_host )
-	self.addLink( s53 , s53_host )
-	self.addLink( s54 , s54_host )
-	self.addLink( s55 , s55_host )
-	self.addLink( s56 , s56_host )
-	self.addLink( s57 , s57_host )
-	self.addLink( s58 , s58_host )
-	self.addLink( s59 , s59_host )
-	self.addLink( s60 , s60_host )
-	self.addLink( s61 , s61_host )
-	self.addLink( s62 , s62_host )
-	self.addLink( s63 , s63_host )
-	self.addLink( s64 , s64_host )
-	self.addLink( s65 , s65_host )
-	self.addLink( s66 , s66_host )
-	self.addLink( s67 , s67_host )
-	self.addLink( s68 , s68_host )
-	self.addLink( s69 , s69_host )
-	self.addLink( s70 , s70_host )
-	self.addLink( s71 , s71_host )
-	self.addLink( s72 , s72_host )
-	self.addLink( s73 , s73_host )
-	self.addLink( s74 , s74_host )
-	self.addLink( s75 , s75_host )
-	self.addLink( s76 , s76_host )
-	self.addLink( s77 , s77_host )
-	self.addLink( s78 , s78_host )
+        # ... and now hosts
+        #s1_host = self.addHost( 'h1' )
+        #s2_host = self.addHost( 'h2' )
+        #s3_host = self.addHost( 'h3' )
+        #s4_host = self.addHost( 'h4' )
+        #s5_host = self.addHost( 'h5' )
+        #s6_host = self.addHost( 'h6' )
+        #s7_host = self.addHost( 'h7' )
+        #s8_host = self.addHost( 'h8' )
+        #s9_host = self.addHost( 'h9' )
+        #s10_host = self.addHost( 'h10' )
+        s11_host = self.addHost( 'h11' )
+        s12_host = self.addHost( 'h12' )
+        s13_host = self.addHost( 'h13' )
+        s14_host = self.addHost( 'h14' )
+        s15_host = self.addHost( 'h15' )
+        s16_host = self.addHost( 'h16' )
+        s17_host = self.addHost( 'h17' )
+        s18_host = self.addHost( 'h18' )
+        s19_host = self.addHost( 'h19' )
+        s20_host = self.addHost( 'h20' )
+        s21_host = self.addHost( 'h21' )
+        s22_host = self.addHost( 'h22' )
+        s23_host = self.addHost( 'h23' )
+        s24_host = self.addHost( 'h24' )
+        s25_host = self.addHost( 'h25' )
+        s26_host = self.addHost( 'h26' )
+        s27_host = self.addHost( 'h27' )
+        s28_host = self.addHost( 'h28' )
+        s29_host = self.addHost( 'h29' )
+        s30_host = self.addHost( 'h30' )
+        s31_host = self.addHost( 'h31' )
+        s32_host = self.addHost( 'h32' )
+        s33_host = self.addHost( 'h33' )
+        s34_host = self.addHost( 'h34' )
+        s35_host = self.addHost( 'h35' )
+        s36_host = self.addHost( 'h36' )
+        s37_host = self.addHost( 'h37' )
+        s38_host = self.addHost( 'h38' )
+        s39_host = self.addHost( 'h39' )
+        s40_host = self.addHost( 'h40' )
+        s41_host = self.addHost( 'h41' )
+        s42_host = self.addHost( 'h42' )
+        s43_host = self.addHost( 'h43' )
+        s44_host = self.addHost( 'h44' )
+        s45_host = self.addHost( 'h45' )
+        s46_host = self.addHost( 'h46' )
+        s47_host = self.addHost( 'h47' )
+        s48_host = self.addHost( 'h48' )
+        s49_host = self.addHost( 'h49' )
+        s50_host = self.addHost( 'h50' )
+        s51_host = self.addHost( 'h51' )
+        s52_host = self.addHost( 'h52' )
+        s53_host = self.addHost( 'h53' )
+        s54_host = self.addHost( 'h54' )
+        s55_host = self.addHost( 'h55' )
+        s56_host = self.addHost( 'h56' )
+        s57_host = self.addHost( 'h57' )
+        s58_host = self.addHost( 'h58' )
+        s59_host = self.addHost( 'h59' )
+        s60_host = self.addHost( 'h60' )
+        s61_host = self.addHost( 'h61' )
+        s62_host = self.addHost( 'h62' )
+        s63_host = self.addHost( 'h63' )
+        s64_host = self.addHost( 'h64' )
+        s65_host = self.addHost( 'h65' )
+        s66_host = self.addHost( 'h66' )
+        s67_host = self.addHost( 'h67' )
+        s68_host = self.addHost( 'h68' )
+        s69_host = self.addHost( 'h69' )
+        s70_host = self.addHost( 'h70' )
+        s71_host = self.addHost( 'h71' )
+        s72_host = self.addHost( 'h72' )
+        s73_host = self.addHost( 'h73' )
+        s74_host = self.addHost( 'h74' )
+        s75_host = self.addHost( 'h75' )
+        s76_host = self.addHost( 'h76' )
+        s77_host = self.addHost( 'h77' )
+        s78_host = self.addHost( 'h78' )
 
-	#info( '*** Add Leaf links\n')
-	self.addLink(s1, s9)
-	self.addLink(s2, s10)
-	self.addLink(s3, s9)
-	self.addLink(s4, s10)
-	self.addLink(s5, s9)
-	self.addLink(s6, s10)
-	self.addLink(s7, s9)
-	self.addLink(s8, s10)
-	self.addLink(s9, s11)
-	self.addLink(s9, s12)
-	self.addLink(s10, s13)
-	self.addLink(s10, s14)
-	self.addLink(s11, s12)
-	self.addLink(s13, s14)
+        # add edges between switch and corresponding host
+        #self.addLink( s1 , s1_host )
+        #self.addLink( s2 , s2_host )
+        #self.addLink( s3 , s3_host )
+        #self.addLink( s4 , s4_host )
+        #self.addLink( s5 , s5_host )
+        #self.addLink( s6 , s6_host )
+        #self.addLink( s7 , s7_host )
+        #self.addLink( s8 , s8_host )
+        #self.addLink( s9 , s9_host )
+        #self.addLink( s10 , s10_host )
+        self.addLink( s11 , s11_host )
+        self.addLink( s12 , s12_host )
+        self.addLink( s13 , s13_host )
+        self.addLink( s14 , s14_host )
+        self.addLink( s15 , s15_host )
+        self.addLink( s16 , s16_host )
+        self.addLink( s17 , s17_host )
+        self.addLink( s18 , s18_host )
+        self.addLink( s19 , s19_host )
+        self.addLink( s20 , s20_host )
+        self.addLink( s21 , s21_host )
+        self.addLink( s22 , s22_host )
+        self.addLink( s23 , s23_host )
+        self.addLink( s24 , s24_host )
+        self.addLink( s25 , s25_host )
+        self.addLink( s26 , s26_host )
+        self.addLink( s27 , s27_host )
+        self.addLink( s28 , s28_host )
+        self.addLink( s29 , s29_host )
+        self.addLink( s30 , s30_host )
+        self.addLink( s31 , s31_host )
+        self.addLink( s32 , s32_host )
+        self.addLink( s33 , s33_host )
+        self.addLink( s34 , s34_host )
+        self.addLink( s35 , s35_host )
+        self.addLink( s36 , s36_host )
+        self.addLink( s37 , s37_host )
+        self.addLink( s38 , s38_host )
+        self.addLink( s39 , s39_host )
+        self.addLink( s40 , s40_host )
+        self.addLink( s41 , s41_host )
+        self.addLink( s42 , s42_host )
+        self.addLink( s43 , s43_host )
+        self.addLink( s44 , s44_host )
+        self.addLink( s45 , s45_host )
+        self.addLink( s46 , s46_host )
+        self.addLink( s47 , s47_host )
+        self.addLink( s48 , s48_host )
+        self.addLink( s49 , s49_host )
+        self.addLink( s50 , s50_host )
+        self.addLink( s51 , s51_host )
+        self.addLink( s52 , s52_host )
+        self.addLink( s53 , s53_host )
+        self.addLink( s54 , s54_host )
+        self.addLink( s55 , s55_host )
+        self.addLink( s56 , s56_host )
+        self.addLink( s57 , s57_host )
+        self.addLink( s58 , s58_host )
+        self.addLink( s59 , s59_host )
+        self.addLink( s60 , s60_host )
+        self.addLink( s61 , s61_host )
+        self.addLink( s62 , s62_host )
+        self.addLink( s63 , s63_host )
+        self.addLink( s64 , s64_host )
+        self.addLink( s65 , s65_host )
+        self.addLink( s66 , s66_host )
+        self.addLink( s67 , s67_host )
+        self.addLink( s68 , s68_host )
+        self.addLink( s69 , s69_host )
+        self.addLink( s70 , s70_host )
+        self.addLink( s71 , s71_host )
+        self.addLink( s72 , s72_host )
+        self.addLink( s73 , s73_host )
+        self.addLink( s74 , s74_host )
+        self.addLink( s75 , s75_host )
+        self.addLink( s76 , s76_host )
+        self.addLink( s77 , s77_host )
+        self.addLink( s78 , s78_host )
 
-	#info( '*** Add Spine-1 links\n')
-	self.addLink(s15, s1)
-	self.addLink(s15, s2)
-	self.addLink(s16, s1)
-	self.addLink(s16, s2)
-	self.addLink(s17, s1)
-	self.addLink(s17, s2)
-	self.addLink(s18, s1)
-	self.addLink(s18, s2)
-	self.addLink(s19, s1)
-	self.addLink(s19, s2)
-	self.addLink(s20, s1)
-	self.addLink(s20, s2)
-	self.addLink(s21, s1)
-	self.addLink(s21, s2)
-	self.addLink(s22, s1)
-	self.addLink(s22, s2)
-	self.addLink(s23, s1)
-	self.addLink(s23, s2)
-	self.addLink(s24, s1)
-	self.addLink(s24, s2)
-	self.addLink(s25, s1)
-	self.addLink(s25, s2)
-	self.addLink(s26, s1)
-	self.addLink(s26, s2)
-	self.addLink(s27, s1)
-	self.addLink(s27, s2)
-	self.addLink(s28, s1)
-	self.addLink(s28, s2)
-	self.addLink(s29, s1)
-	self.addLink(s29, s2)
-	self.addLink(s30, s1)
-	self.addLink(s30, s2)
+        #info( '*** Add Leaf links\n')
+        self.addLink(s1, s9)
+        self.addLink(s2, s10)
+        self.addLink(s3, s9)
+        self.addLink(s4, s10)
+        self.addLink(s5, s9)
+        self.addLink(s6, s10)
+        self.addLink(s7, s9)
+        self.addLink(s8, s10)
+        self.addLink(s9, s11)
+        self.addLink(s9, s12)
+        self.addLink(s10, s13)
+        self.addLink(s10, s14)
+        self.addLink(s11, s12)
+        self.addLink(s13, s14)
 
-	#info( '*** Add Spine-2 links\n')
-	self.addLink(s31, s3)
-	self.addLink(s31, s4)
-	self.addLink(s32, s3)
-	self.addLink(s32, s4)
-	self.addLink(s33, s3)
-	self.addLink(s33, s4)
-	self.addLink(s34, s3)
-	self.addLink(s34, s4)
-	self.addLink(s35, s3)
-	self.addLink(s35, s4)
-	self.addLink(s36, s3)
-	self.addLink(s36, s4)
-	self.addLink(s37, s3)
-	self.addLink(s37, s4)
-	self.addLink(s38, s3)
-	self.addLink(s38, s4)
-	self.addLink(s39, s3)
-	self.addLink(s39, s4)
-	self.addLink(s40, s3)
-	self.addLink(s40, s4)
-	self.addLink(s41, s3)
-	self.addLink(s41, s4)
-	self.addLink(s42, s3)
-	self.addLink(s42, s4)
-	self.addLink(s43, s3)
-	self.addLink(s43, s4)
-	self.addLink(s44, s3)
-	self.addLink(s44, s4)
-	self.addLink(s45, s3)
-	self.addLink(s45, s4)
-	self.addLink(s46, s3)
-	self.addLink(s46, s4)
+        #info( '*** Add Spine-1 links\n')
+        self.addLink(s15, s1)
+        self.addLink(s15, s2)
+        self.addLink(s16, s1)
+        self.addLink(s16, s2)
+        self.addLink(s17, s1)
+        self.addLink(s17, s2)
+        self.addLink(s18, s1)
+        self.addLink(s18, s2)
+        self.addLink(s19, s1)
+        self.addLink(s19, s2)
+        self.addLink(s20, s1)
+        self.addLink(s20, s2)
+        self.addLink(s21, s1)
+        self.addLink(s21, s2)
+        self.addLink(s22, s1)
+        self.addLink(s22, s2)
+        self.addLink(s23, s1)
+        self.addLink(s23, s2)
+        self.addLink(s24, s1)
+        self.addLink(s24, s2)
+        self.addLink(s25, s1)
+        self.addLink(s25, s2)
+        self.addLink(s26, s1)
+        self.addLink(s26, s2)
+        self.addLink(s27, s1)
+        self.addLink(s27, s2)
+        self.addLink(s28, s1)
+        self.addLink(s28, s2)
+        self.addLink(s29, s1)
+        self.addLink(s29, s2)
+        self.addLink(s30, s1)
+        self.addLink(s30, s2)
 
-	#info( '*** Add Spine-3 links\n')
-	self.addLink(s47, s5)
-	self.addLink(s47, s6)
-	self.addLink(s48, s5)
-	self.addLink(s48, s6)
-	self.addLink(s49, s5)
-	self.addLink(s49, s6)
-	self.addLink(s50, s5)
-	self.addLink(s50, s6)
-	self.addLink(s51, s5)
-	self.addLink(s51, s6)
-	self.addLink(s52, s5)
-	self.addLink(s52, s6)
-	self.addLink(s53, s5)
-	self.addLink(s53, s6)
-	self.addLink(s54, s5)
-	self.addLink(s54, s6)
-	self.addLink(s55, s5)
-	self.addLink(s55, s6)
-	self.addLink(s56, s5)
-	self.addLink(s56, s6)
-	self.addLink(s57, s5)
-	self.addLink(s57, s6)
-	self.addLink(s58, s5)
-	self.addLink(s58, s6)
-	self.addLink(s59, s5)
-	self.addLink(s59, s6)
-	self.addLink(s60, s5)
-	self.addLink(s60, s6)
-	self.addLink(s61, s5)
-	self.addLink(s61, s6)
-	self.addLink(s62, s5)
-	self.addLink(s62, s6)
+        #info( '*** Add Spine-2 links\n')
+        self.addLink(s31, s3)
+        self.addLink(s31, s4)
+        self.addLink(s32, s3)
+        self.addLink(s32, s4)
+        self.addLink(s33, s3)
+        self.addLink(s33, s4)
+        self.addLink(s34, s3)
+        self.addLink(s34, s4)
+        self.addLink(s35, s3)
+        self.addLink(s35, s4)
+        self.addLink(s36, s3)
+        self.addLink(s36, s4)
+        self.addLink(s37, s3)
+        self.addLink(s37, s4)
+        self.addLink(s38, s3)
+        self.addLink(s38, s4)
+        self.addLink(s39, s3)
+        self.addLink(s39, s4)
+        self.addLink(s40, s3)
+        self.addLink(s40, s4)
+        self.addLink(s41, s3)
+        self.addLink(s41, s4)
+        self.addLink(s42, s3)
+        self.addLink(s42, s4)
+        self.addLink(s43, s3)
+        self.addLink(s43, s4)
+        self.addLink(s44, s3)
+        self.addLink(s44, s4)
+        self.addLink(s45, s3)
+        self.addLink(s45, s4)
+        self.addLink(s46, s3)
+        self.addLink(s46, s4)
 
-	#info( '*** Add Spine-4 links\n')
-	self.addLink(s63, s7)
-	self.addLink(s63, s8)
-	self.addLink(s64, s7)
-	self.addLink(s64, s8)
-	self.addLink(s65, s7)
-	self.addLink(s65, s8)
-	self.addLink(s66, s7)
-	self.addLink(s66, s8)
-	self.addLink(s67, s7)
-	self.addLink(s67, s8)
-	self.addLink(s68, s7)
-	self.addLink(s68, s8)
-	self.addLink(s69, s7)
-	self.addLink(s69, s8)
-	self.addLink(s70, s7)
-	self.addLink(s70, s8)
-	self.addLink(s71, s7)
-	self.addLink(s71, s8)
-	self.addLink(s72, s7)
-	self.addLink(s72, s8)
-	self.addLink(s73, s7)
-	self.addLink(s73, s8)
-	self.addLink(s74, s7)
-	self.addLink(s74, s8)
-	self.addLink(s75, s7)
-	self.addLink(s75, s8)
-	self.addLink(s76, s7)
-	self.addLink(s76, s8)
-	self.addLink(s77, s7)
-	self.addLink(s77, s8)
-	self.addLink(s78, s7)
-	self.addLink(s78, s8)
+        #info( '*** Add Spine-3 links\n')
+        self.addLink(s47, s5)
+        self.addLink(s47, s6)
+        self.addLink(s48, s5)
+        self.addLink(s48, s6)
+        self.addLink(s49, s5)
+        self.addLink(s49, s6)
+        self.addLink(s50, s5)
+        self.addLink(s50, s6)
+        self.addLink(s51, s5)
+        self.addLink(s51, s6)
+        self.addLink(s52, s5)
+        self.addLink(s52, s6)
+        self.addLink(s53, s5)
+        self.addLink(s53, s6)
+        self.addLink(s54, s5)
+        self.addLink(s54, s6)
+        self.addLink(s55, s5)
+        self.addLink(s55, s6)
+        self.addLink(s56, s5)
+        self.addLink(s56, s6)
+        self.addLink(s57, s5)
+        self.addLink(s57, s6)
+        self.addLink(s58, s5)
+        self.addLink(s58, s6)
+        self.addLink(s59, s5)
+        self.addLink(s59, s6)
+        self.addLink(s60, s5)
+        self.addLink(s60, s6)
+        self.addLink(s61, s5)
+        self.addLink(s61, s6)
+        self.addLink(s62, s5)
+        self.addLink(s62, s6)
+
+        #info( '*** Add Spine-4 links\n')
+        self.addLink(s63, s7)
+        self.addLink(s63, s8)
+        self.addLink(s64, s7)
+        self.addLink(s64, s8)
+        self.addLink(s65, s7)
+        self.addLink(s65, s8)
+        self.addLink(s66, s7)
+        self.addLink(s66, s8)
+        self.addLink(s67, s7)
+        self.addLink(s67, s8)
+        self.addLink(s68, s7)
+        self.addLink(s68, s8)
+        self.addLink(s69, s7)
+        self.addLink(s69, s8)
+        self.addLink(s70, s7)
+        self.addLink(s70, s8)
+        self.addLink(s71, s7)
+        self.addLink(s71, s8)
+        self.addLink(s72, s7)
+        self.addLink(s72, s8)
+        self.addLink(s73, s7)
+        self.addLink(s73, s8)
+        self.addLink(s74, s7)
+        self.addLink(s74, s8)
+        self.addLink(s75, s7)
+        self.addLink(s75, s8)
+        self.addLink(s76, s7)
+        self.addLink(s76, s8)
+        self.addLink(s77, s7)
+        self.addLink(s77, s8)
+        self.addLink(s78, s7)
+        self.addLink(s78, s8)
 
 topos = { 'spine': ( lambda: spineTopo() ) }
 
@@ -433,4 +433,3 @@
     setLogLevel('info')
     #setLogLevel('debug')
     setupNetwork()
-
diff --git a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
index 11ca425..b73e9aa 100644
--- a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
@@ -62,6 +62,9 @@
             expectedLink - Expected link when the switches are down, it should
                            be two links lower than the links before the two
                            switches are down
+        Return:
+            Returns main.TRUE if all verification passed, otherwise return
+            main.FALSE; returns main.FALSE if there is a key error
     """
 
     # Assert variables
@@ -89,50 +92,44 @@
     linkUpResult = main.TRUE
     onosNode = int( onosNode )
 
-    if main.hostsData:
-        if not h1Mac:
-            h1Mac = main.hostsData[ host1 ][ 'mac' ]
-        if not h2Mac:
-            h2Mac = main.hostsData[ host2 ][ 'mac' ]
-        if main.hostsData[ host1 ][ 'vlan' ] != '-1':
-            vlan1 = main.hostsData[ host1 ][ 'vlan' ]
-        if main.hostsData[ host2 ][ 'vlan' ] != '-1':
-            vlan2 = main.hostsData[ host2 ][ 'vlan' ]
-        if not h1Id:
-            h1Id = main.hostsData[ host1 ][ 'id' ]
-        if not h2Id:
-            h2Id = main.hostsData[ host2 ][ 'id' ]
+    try:
+        if main.hostsData:
+            if not h1Mac:
+                h1Mac = main.hostsData[ host1 ][ 'mac' ]
+            if not h2Mac:
+                h2Mac = main.hostsData[ host2 ][ 'mac' ]
+            if main.hostsData[ host1 ].get( 'vlan' ):
+                vlan1 = main.hostsData[ host1 ][ 'vlan' ]
+            if main.hostsData[ host1 ].get( 'vlan' ):
+                vlan2 = main.hostsData[ host2 ][ 'vlan' ]
+            if not h1Id:
+                h1Id = main.hostsData[ host1 ][ 'id' ]
+            if not h2Id:
+                h2Id = main.hostsData[ host2 ][ 'id' ]
 
-    assert h1Id and h2Id, "You must specify host IDs"
-    if not ( h1Id and h2Id ):
-        main.log.info( "There are no host IDs" )
+        assert h1Id and h2Id, "You must specify host IDs"
+        if not ( h1Id and h2Id ):
+            main.log.info( "There are no host IDs" )
+            return main.FALSE
+
+    except KeyError:
+        main.log.error( itemName + ": Key error Exception" )
         return main.FALSE
 
-    # Discover hosts using arping
-    if not main.hostsData:
-        main.log.info( itemName + ": Discover host using arping" )
-        main.Mininet1.arping( host=host1 )
-        main.Mininet1.arping( host=host2 )
-        host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
-        host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
+    # Discover hosts using arping incase pingall discovery failed
+    main.log.info( itemName + ": Discover host using arping" )
+    main.Mininet1.arping( host=host1 )
+    main.Mininet1.arping( host=host2 )
+    host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
+    host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
 
     # Check flows count in each node
     checkFlowsCount( main )
 
-    # Checking connectivity before installing intents
-    main.log.info( itemName + ": Check hosts connection before adding intents" )
-    checkPing = pingallHosts( main, hostNames )
-    if not checkPing:
-        main.log.info( itemName + ": Ping did not go through " +
-                       "before adding intents" )
-    else:
-        main.log.debug( itemName + ": Pinged successful before adding " +
-                        "intents,please check fwd app if it is activated" )
-
     # Adding host intents
     main.log.info( itemName + ": Adding host intents" )
     intent1 = main.CLIs[ onosNode ].addHostIntent( hostIdOne=h1Id,
-                                           hostIdTwo=h2Id )
+                                                   hostIdTwo=h2Id )
     intentsId.append( intent1 )
 
     # Check intents state
@@ -307,16 +304,6 @@
     linkUpResult = main.TRUE
     onosNode = int( onosNode )
 
-    # Checking connectivity before installing intents
-    main.log.info( itemName + ": Check hosts connection before adding intents" )
-    checkPing = pingallHosts( main, hostNames )
-    if not checkPing:
-        main.log.info( itemName + ": Ping did not go through " +
-                       "before adding intents" )
-    else:
-        main.log.debug( itemName + ": Pinged successful before adding " +
-                        "intents,please check fwd app if it is activated" )
-
     # Adding bidirectional point  intents
     main.log.info( itemName + ": Adding point intents" )
     intent1 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
@@ -564,16 +551,6 @@
     # Check flows count in each node
     checkFlowsCount( main )
 
-    # Checking connectivity before installing intents
-    main.log.info( itemName + ": Check hosts connection before adding intents" )
-    checkPing = pingallHosts( main, hostNames )
-    if not checkPing:
-        main.log.info( itemName + ": Ping did not go through " +
-                       "before adding intents" )
-    else:
-        main.log.debug( itemName + ": Pinged successful before adding " +
-                        "intents,please check fwd app if it is activated" )
-
     # Adding bidirectional point  intents
     for i in range( len( devices ) ):
         ingressDevice = devicesCopy[ i ]
@@ -815,16 +792,6 @@
     # Check flows count in each node
     checkFlowsCount( main )
 
-    # Checking connectivity before installing intents
-    main.log.info( itemName + ": Check hosts connection before adding intents" )
-    checkPing = pingallHosts( main, hostNames )
-    if not checkPing:
-        main.log.info( itemName + ": Ping did not go through " +
-                       "before adding intents" )
-    else:
-        main.log.debug( itemName + ": Pinged successful before adding " +
-                        "intents,please check fwd app if it is activated" )
-
     # Adding bidirectional point  intents
     for i in range( len( devices ) ):
         egressDevice = devicesCopy[ i ]
@@ -954,6 +921,7 @@
     getDataResult = main.TRUE
     main.log.info( "Activating reactive forwarding app " )
     activateResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
+    time.sleep( main.fwdSleep )
 
     for i in range( main.numCtrls ):
         appCheck = appCheck and main.CLIs[ i ].appToIDCheck()
@@ -1115,7 +1083,7 @@
         else:
             for i in range( main.numCtrls ):
                 main.log.debug( itemName + ": ONOS node " + str( i ) + " has " +
-                                flowsCount[ i ] + " flows" )
+                                str( flowsCount[ i ] ) + " flows" )
     else:
         main.log.error( "Checking flows count failed, check summary command" )
         return main.FALSE
diff --git a/TestON/tests/FUNCintent/FUNCintent.params b/TestON/tests/FUNCintent/FUNCintent.params
index e34ac26..7b7040a 100644
--- a/TestON/tests/FUNCintent/FUNCintent.params
+++ b/TestON/tests/FUNCintent/FUNCintent.params
@@ -37,6 +37,7 @@
         <startup>15</startup>
         <reroute>5</reroute>
         <checkintent>5</checkintent>
+        <fwd>10</fwd>
     </SLEEP>
 
     <MININET>
diff --git a/TestON/tests/FUNCintent/FUNCintent.py b/TestON/tests/FUNCintent/FUNCintent.py
index 2da9a85..f5554d1 100644
--- a/TestON/tests/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNCintent/FUNCintent.py
@@ -26,6 +26,9 @@
 
         main.case( "Constructing test variables and building ONOS package" )
         main.step( "Constructing test variables" )
+        main.caseExplanation = "This test case is mainly for loading " +\
+                               "from params file, and pull and build the " +\
+                               " latest ONOS package"
         stepResult = main.FALSE
 
         # Test variables
@@ -42,6 +45,7 @@
         main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
         main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
         main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
+        main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
         gitPull = main.params[ 'GIT' ][ 'pull' ]
         main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
         main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
@@ -117,6 +121,10 @@
 
         main.case( "Starting up " + str( main.numCtrls ) +
                    " node(s) ONOS cluster" )
+        main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
+                                " node(s) ONOS cluster"
+
+
 
         #kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
@@ -228,10 +236,14 @@
         """
             Start Mininet topology with OF 1.0 switches
         """
+        main.OFProtocol = "1.0"
         main.log.report( "Start Mininet topology with OF 1.0 switches" )
-        main.log.case( "Start Mininet topology with OF 1.0 switches" )
+        main.case( "Start Mininet topology with OF 1.0 switches" )
+        main.caseExplanation = "Start mininet topology with OF 1.0 " +\
+                                "switches to test intents, exits out if " +\
+                                "topology did not start correctly"
 
-        main.step( "Start Mininet topology with OF 1.0 switches" )
+        main.step( "Starting Mininet topology with OF 1.0 switches" )
         args = "--switch ovs,protocols=OpenFlow10"
         topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
                                                       main.topology,
@@ -250,10 +262,14 @@
         """
             Start Mininet topology with OF 1.3 switches
         """
+        main.OFProtocol = "1.3"
         main.log.report( "Start Mininet topology with OF 1.3 switches" )
-        main.log.case( "Start Mininet topology with OF 1.3 switches" )
+        main.case( "Start Mininet topology with OF 1.3 switches" )
+        main.caseExplanation = "Start mininet topology with OF 1.3 " +\
+                                "switches to test intents, exits out if " +\
+                                "topology did not start correctly"
 
-        main.step( "Start Mininet topology with OF 1.3 switches" )
+        main.step( "Starting Mininet topology with OF 1.3 switches" )
         args = "--switch ovs,protocols=OpenFlow13"
         topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
                                                       main.topology,
@@ -276,6 +292,9 @@
 
         main.case( "Assign switches to controllers" )
         main.step( "Assigning switches to controllers" )
+        main.caseExplanation = "Assign OF " + main.OFProtocol +\
+                                " switches to ONOS nodes"
+
         assignResult = main.TRUE
         switchList = []
 
@@ -327,7 +346,9 @@
             Stop mininet
         """
         main.log.report( "Stop Mininet topology" )
-        main.log.case( "Stop Mininet topology" )
+        main.case( "Stop Mininet topology" )
+        main.caseExplanation = "Stopping the current mininet topology " +\
+                                "to start up fresh"
 
         main.step( "Stopping Mininet Topology" )
         topoResult = main.Mininet1.stopNet( )
@@ -374,7 +395,13 @@
 
         intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
 
-        main.case( "Add host intents between 2 host" )
+        main.case( "TESTING HOST INTENTS" )
+        main.caseExplanation = "This test case tests Host intents using " +\
+                                str( main.numCtrls ) + " node(s) cluster;\n" +\
+                                "Different type of hosts will be tested in " +\
+                                "each step such as IPV4, Dual stack, VLAN " +\
+                                "etc;\nThe test will use OF " + main.OFProtocol\
+                                + "OVS running in Mininet"
 
         main.step( "IPV4: Add host intents between h1 and h9" )
         stepResult = main.TRUE
@@ -509,7 +536,14 @@
         assert main.numSwitch, "Placed the total number of switch topology in \
                                 main.numSwitch"
 
-        main.case( "Add point intents between 2 devices" )
+        main.case( "TESTING POINT INTENTS" )
+        main.caseExplanation = "This test case will test point to point" +\
+                               " intents using " + str( main.numCtrls ) +\
+                               " node(s) cluster;\n" +\
+                               "Different type of hosts will be tested in " +\
+                               "each step such as IPV4, Dual stack, VLAN etc" +\
+                               ";\nThe test will use OF " + main.OFProtocol +\
+                               "OVS running in Mininet"
 
         # No option point intents
         main.step( "NOOPTION: Add point intents between h1 and h9" )
@@ -587,8 +621,15 @@
         stepResult = main.TRUE
         mac1 = main.hostsData[ 'h1' ][ 'mac' ]
         mac2 = main.hostsData[ 'h9' ][ 'mac' ]
-        ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24"
-        ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24"
+        try:
+            ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24"
+            ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24"
+        except KeyError:
+            main.log.debug( "Key Error getting IP addresses of h1 | h9 in" +
+                            "main.hostsData" )
+            ip1 = main.Mininet1.getIPAddress( 'h1')
+            ip2 = main.Mininet1.getIPAddress( 'h9')
+
         ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
         tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
         tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
@@ -740,7 +781,14 @@
         assert main.numSwitch, "Placed the total number of switch topology in \
                                 main.numSwitch"
 
-        main.case( "Add single point to multi point intents between devices" )
+        main.case( "TESTING SINGLE TO MULTI POINT INTENTS" )
+        main.caseExplanation = "This test case will test single point to" +\
+                               " multi point intents using " +\
+                               str( main.numCtrls ) + " node(s) cluster;\n" +\
+                               "Different type of hosts will be tested in " +\
+                               "each step such as IPV4, Dual stack, VLAN etc" +\
+                               ";\nThe test will use OF " + main.OFProtocol +\
+                               "OVS running in Mininet"
 
         main.step( "NOOPTION: Add single point to multi point intents" )
         stepResult = main.TRUE
@@ -862,7 +910,14 @@
         assert main.numSwitch, "Placed the total number of switch topology in \
                                 main.numSwitch"
 
-        main.case( "Add multi point to single point intents between devices" )
+        main.case( "TESTING MULTI TO SINGLE POINT INTENTS" )
+        main.caseExplanation = "This test case will test single point to" +\
+                               " multi point intents using " +\
+                               str( main.numCtrls ) + " node(s) cluster;\n" +\
+                               "Different type of hosts will be tested in " +\
+                               "each step such as IPV4, Dual stack, VLAN etc" +\
+                               ";\nThe test will use OF " + main.OFProtocol +\
+                               "OVS running in Mininet"
 
         main.step( "NOOPTION: Add multi point to single point intents" )
         stepResult = main.TRUE
diff --git a/TestON/tests/HAclusterRestart/HAclusterRestart.params b/TestON/tests/HAclusterRestart/HAclusterRestart.params
index 0435e0b..213fc0d 100644
--- a/TestON/tests/HAclusterRestart/HAclusterRestart.params
+++ b/TestON/tests/HAclusterRestart/HAclusterRestart.params
@@ -1,5 +1,8 @@
 <PARAMS>
     <testcases>1,2,8,3,8,4,5,14,16,17,[6],8,3,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+    <imports>
+        <path> /home/admin/OnosSystemTest/TestON/tests/HAclusterRestart/dependencies/ </path>
+    </imports>
     <ENV>
         <cellName>HA</cellName>
         <appString>drivers,openflow,proxyarp,mobility</appString>
diff --git a/TestON/tests/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HAclusterRestart/HAclusterRestart.py
index 755a89c..8205ac9 100644
--- a/TestON/tests/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HAclusterRestart/HAclusterRestart.py
@@ -47,10 +47,11 @@
         start cli sessions
         start tcpdump
         """
+        import imp
         main.log.info( "ONOS HA test: Restart all ONOS nodes - " +
                          "initialization" )
         main.case( "Setting up test environment" )
-        main.caseExplaination = "Setup the test environment including " +\
+        main.caseExplanation = "Setup the test environment including " +\
                                 "installing ONOS, starting Mininet and ONOS" +\
                                 "cli sessions."
         # TODO: save all the timers and output them for plotting
@@ -62,12 +63,11 @@
         gitBranch = main.params[ 'branch' ]
         cellName = main.params[ 'ENV' ][ 'cellName' ]
 
-        # set global variables
-        global numControllers
-        numControllers = int( main.params[ 'num_controllers' ] )
+        main.numCtrls = int( main.params[ 'num_controllers' ] )
         if main.ONOSbench.maxNodes:
-            if main.ONOSbench.maxNodes < numControllers:
-                numControllers = int( main.ONOSbench.maxNodes )
+            if main.ONOSbench.maxNodes < main.numCtrls:
+                main.numCtrls = int( main.ONOSbench.maxNodes )
+        # set global variables
         global ONOS1Port
         global ONOS2Port
         global ONOS3Port
@@ -91,15 +91,26 @@
         ONOS6Port = main.params[ 'CTRL' ][ 'port6' ]
         ONOS7Port = main.params[ 'CTRL' ][ 'port7' ]
 
-        global CLIs
-        CLIs = []
-        global nodes
-        nodes = []
+        try:
+            fileName = "Counters"
+            path = main.params[ 'imports' ][ 'path' ]
+            main.Counters = imp.load_source( fileName,
+                                             path + fileName + ".py" )
+        except Exception as e:
+            main.log.exception( e )
+            main.cleanup()
+            main.exit()
+
+        main.CLIs = []
+        main.nodes = []
         ipList = []
-        for i in range( 1, numControllers + 1 ):
-            CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
-            nodes.append( getattr( main, 'ONOS' + str( i ) ) )
-            ipList.append( nodes[ -1 ].ip_address )
+        for i in range( 1, main.numCtrls + 1 ):
+            try:
+                main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+                main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+                ipList.append( main.nodes[ -1 ].ip_address )
+            except AttributeError:
+                break
 
         main.step( "Create cell file" )
         cellAppString = main.params[ 'ENV' ][ 'appString' ]
@@ -115,13 +126,13 @@
         main.ONOSbench.onosRemoveRaftLogs()
 
         main.log.info( "Uninstalling ONOS" )
-        for node in nodes:
+        for node in main.nodes:
             main.ONOSbench.onosUninstall( node.ip_address )
 
         # Make sure ONOS is DEAD
         main.log.info( "Killing any ONOS processes" )
         killResults = main.TRUE
-        for node in nodes:
+        for node in main.nodes:
             killed = main.ONOSbench.onosKill( node.ip_address )
             killResults = killResults and killed
 
@@ -188,7 +199,7 @@
 
         main.step( "Installing ONOS package" )
         onosInstallResult = main.TRUE
-        for node in nodes:
+        for node in main.nodes:
             tmpResult = main.ONOSbench.onosInstall( options="-f",
                                                     node=node.ip_address )
             onosInstallResult = onosInstallResult and tmpResult
@@ -199,7 +210,7 @@
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onosIsupResult = main.TRUE
-            for node in nodes:
+            for node in main.nodes:
                 started = main.ONOSbench.isup( node.ip_address )
                 if not started:
                     main.log.error( node.name + " didn't start!" )
@@ -215,10 +226,10 @@
         main.log.step( "Starting ONOS CLI sessions" )
         cliResults = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].startOnosCli,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].startOnosCli,
                              name="startOnosCli-" + str( i ),
-                             args=[nodes[i].ip_address] )
+                             args=[main.nodes[i].ip_address] )
             threads.append( t )
             t.start()
 
@@ -240,8 +251,8 @@
         main.step( "App Ids check" )
         appCheck = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].appToIDCheck,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].appToIDCheck,
                              name="appToIDCheck-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -251,8 +262,8 @@
             t.join()
             appCheck = appCheck and t.result
         if appCheck != main.TRUE:
-            main.log.warn( CLIs[0].apps() )
-            main.log.warn( CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
         utilities.assert_equals( expect=main.TRUE, actual=appCheck,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -267,12 +278,11 @@
         Assign devices to controllers
         """
         import re
-        import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert ONOS1Port, "ONOS1Port not defined"
         assert ONOS2Port, "ONOS2Port not defined"
         assert ONOS3Port, "ONOS3Port not defined"
@@ -282,14 +292,14 @@
         assert ONOS7Port, "ONOS7Port not defined"
 
         main.case( "Assigning devices to controllers" )
-        main.caseExplaination = "Assign switches to ONOS using 'ovs-vsctl' " +\
+        main.caseExplanation = "Assign switches to ONOS using 'ovs-vsctl' " +\
                                 "and check that an ONOS node becomes the " +\
                                 "master of the device."
         main.step( "Assign switches to controllers" )
 
         ipList = []
-        for i in range( numControllers ):
-            ipList.append( nodes[ i ].ip_address )
+        for i in range( main.numCtrls ):
+            ipList.append( main.nodes[ i ].ip_address )
         swList = []
         for i in range( 1, 29 ):
             swList.append( "s" + str( i ) )
@@ -302,7 +312,7 @@
                 main.log.info( str( response ) )
             except Exception:
                 main.log.info( repr( response ) )
-            for node in nodes:
+            for node in main.nodes:
                 if re.search( "tcp:" + node.ip_address, response ):
                     mastershipCheck = mastershipCheck and main.TRUE
                 else:
@@ -320,13 +330,12 @@
         """
         Assign mastership to controllers
         """
-        import re
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert ONOS1Port, "ONOS1Port not defined"
         assert ONOS2Port, "ONOS2Port not defined"
         assert ONOS3Port, "ONOS3Port not defined"
@@ -336,7 +345,7 @@
         assert ONOS7Port, "ONOS7Port not defined"
 
         main.case( "Assigning Controller roles for switches" )
-        main.caseExplaination = "Check that ONOS is connected to each " +\
+        main.caseExplanation = "Check that ONOS is connected to each " +\
                                 "device. Then manually assign" +\
                                 " mastership to specific ONOS nodes using" +\
                                 " 'device-role'"
@@ -354,45 +363,45 @@
                 # set up correct variables:
                 if i == 1:
                     c = 0
-                    ip = nodes[ c ].ip_address  # ONOS1
+                    ip = main.nodes[ c ].ip_address  # ONOS1
                     deviceId = main.ONOScli1.getDevice( "1000" ).get( 'id' )
                 elif i == 2:
-                    c = 1 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS2
+                    c = 1 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS2
                     deviceId = main.ONOScli1.getDevice( "2000" ).get( 'id' )
                 elif i == 3:
-                    c = 1 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS2
+                    c = 1 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS2
                     deviceId = main.ONOScli1.getDevice( "3000" ).get( 'id' )
                 elif i == 4:
-                    c = 3 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS4
+                    c = 3 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS4
                     deviceId = main.ONOScli1.getDevice( "3004" ).get( 'id' )
                 elif i == 5:
-                    c = 2 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS3
+                    c = 2 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS3
                     deviceId = main.ONOScli1.getDevice( "5000" ).get( 'id' )
                 elif i == 6:
-                    c = 2 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS3
+                    c = 2 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS3
                     deviceId = main.ONOScli1.getDevice( "6000" ).get( 'id' )
                 elif i == 7:
-                    c = 5 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS6
+                    c = 5 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS6
                     deviceId = main.ONOScli1.getDevice( "6007" ).get( 'id' )
                 elif i >= 8 and i <= 17:
-                    c = 4 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS5
+                    c = 4 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS5
                     dpid = '3' + str( i ).zfill( 3 )
                     deviceId = main.ONOScli1.getDevice( dpid ).get( 'id' )
                 elif i >= 18 and i <= 27:
-                    c = 6 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS7
+                    c = 6 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS7
                     dpid = '6' + str( i ).zfill( 3 )
                     deviceId = main.ONOScli1.getDevice( dpid ).get( 'id' )
                 elif i == 28:
                     c = 0
-                    ip = nodes[ c ].ip_address  # ONOS1
+                    ip = main.nodes[ c ].ip_address  # ONOS1
                     deviceId = main.ONOScli1.getDevice( "2800" ).get( 'id' )
                 else:
                     main.log.error( "You didn't write an else statement for " +
@@ -445,11 +454,11 @@
         """
         import time
         import json
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         try:
             labels
         except NameError:
@@ -463,7 +472,7 @@
         # NOTE: we must reinstall intents until we have a persistant intent
         #        datastore!
         main.case( "Adding host Intents" )
-        main.caseExplaination = "Discover hosts by using pingall then " +\
+        main.caseExplanation = "Discover hosts by using pingall then " +\
                                 "assign predetermined host-to-host intents." +\
                                 " After installation, check that the intent" +\
                                 " is distributed to all nodes and the state" +\
@@ -471,7 +480,7 @@
 
         # install onos-app-fwd
         main.step( "Install reactive forwarding app" )
-        installResults = CLIs[0].activateApp( "org.onosproject.fwd" )
+        installResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
         utilities.assert_equals( expect=main.TRUE, actual=installResults,
                                  onpass="Install fwd successful",
                                  onfail="Install fwd failed" )
@@ -479,8 +488,8 @@
         main.step( "Check app ids" )
         appCheck = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].appToIDCheck,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].appToIDCheck,
                              name="appToIDCheck-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -490,8 +499,8 @@
             t.join()
             appCheck = appCheck and t.result
         if appCheck != main.TRUE:
-            main.log.warn( CLIs[0].apps() )
-            main.log.warn( CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
         utilities.assert_equals( expect=main.TRUE, actual=appCheck,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -517,7 +526,7 @@
         time.sleep( 11 )
         # uninstall onos-app-fwd
         main.step( "Uninstall reactive forwarding app" )
-        uninstallResult = CLIs[0].deactivateApp( "org.onosproject.fwd" )
+        uninstallResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
         utilities.assert_equals( expect=main.TRUE, actual=uninstallResult,
                                  onpass="Uninstall fwd successful",
                                  onfail="Uninstall fwd failed" )
@@ -525,8 +534,8 @@
         main.step( "Check app ids" )
         threads = []
         appCheck2 = main.TRUE
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].appToIDCheck,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].appToIDCheck,
                              name="appToIDCheck-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -536,8 +545,8 @@
             t.join()
             appCheck2 = appCheck2 and t.result
         if appCheck2 != main.TRUE:
-            main.log.warn( CLIs[0].apps() )
-            main.log.warn( CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
         utilities.assert_equals( expect=main.TRUE, actual=appCheck2,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -564,8 +573,8 @@
                 host1Id = host1Dict.get( 'id', None )
                 host2Id = host2Dict.get( 'id', None )
             if host1Id and host2Id:
-                nodeNum = ( i % numControllers )
-                tmpId = CLIs[ nodeNum ].addHostIntent( host1Id, host2Id )
+                nodeNum = ( i % main.numCtrls )
+                tmpId = main.CLIs[ nodeNum ].addHostIntent( host1Id, host2Id )
                 if tmpId:
                     main.log.info( "Added intent with id: " + tmpId )
                     intentIds.append( tmpId )
@@ -575,7 +584,7 @@
             else:
                 main.log.error( "Error, getHost() failed for h" + str( i ) +
                                 " and/or h" + str( i + 10 ) )
-                hosts = CLIs[ 0 ].hosts()
+                hosts = main.CLIs[ 0 ].hosts()
                 main.log.warn( "Hosts output: " )
                 try:
                     main.log.warn( json.dumps( json.loads( hosts ),
@@ -656,7 +665,7 @@
             main.log.error( repr( leaders ) )
         # Check all nodes
         if missing:
-            for node in CLIs:
+            for node in main.CLIs:
                 response = node.leaders( jsonFormat=False)
                 main.log.warn( str( node.name ) + " leaders output: \n" +
                                str( response ) )
@@ -700,7 +709,7 @@
         for i in range(100):
             correct = True
             main.log.info( "Submitted intents: " + str( sorted( intentIds ) ) )
-            for cli in CLIs:
+            for cli in main.CLIs:
                 onosIds = []
                 ids = cli.getAllIntentsId()
                 onosIds.append( ids )
@@ -812,7 +821,7 @@
                 main.log.error( repr( leaders ) )
             # Check all nodes
             if missing:
-                for node in CLIs:
+                for node in main.CLIs:
                     response = node.leaders( jsonFormat=False)
                     main.log.warn( str( node.name ) + " leaders output: \n" +
                                    str( response ) )
@@ -853,13 +862,13 @@
         """
         import json
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         main.case( "Verify connectivity by sendind traffic across Intents" )
-        main.caseExplaination = "Ping across added host intents to check " +\
+        main.caseExplanation = "Ping across added host intents to check " +\
                                 "functionality and check the state of " +\
                                 "the intent"
         main.step( "Ping across added host intents" )
@@ -902,6 +911,7 @@
             intents = main.ONOScli1.intents()
             intentStates = []
             main.log.info( "%-6s%-15s%-15s" % ( 'Count', 'ID', 'State' ) )
+            count = 0
             # Iter through intents of a node
             try:
                 for intent in json.loads( intents ):
@@ -962,7 +972,7 @@
             # TODO: Check for a leader of these topics
         # Check all nodes
         if topicCheck:
-            for node in CLIs:
+            for node in main.CLIs:
                 response = node.leaders( jsonFormat=False)
                 main.log.warn( str( node.name ) + " leaders output: \n" +
                                str( response ) )
@@ -1055,7 +1065,7 @@
                 main.log.exception( "Error parsing leaders" )
                 main.log.error( repr( leaders ) )
             if missing:
-                for node in CLIs:
+                for node in main.CLIs:
                     response = node.leaders( jsonFormat=False)
                     main.log.warn( str( node.name ) + " leaders output: \n" +
                                    str( response ) )
@@ -1090,7 +1100,7 @@
                 main.log.exception( "Error parsing pending map" )
                 main.log.error( repr( pendingMap ) )
         # Print flowrules
-        main.log.debug( CLIs[0].flows( jsonFormat=False ) )
+        main.log.debug( main.CLIs[0].flows( jsonFormat=False ) )
         main.step( "Wait a minute then ping again" )
         # the wait is above
         PingResult = main.TRUE
@@ -1129,11 +1139,11 @@
         """
         import json
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         main.case( "Setting up and gathering data for current state" )
         # The general idea for this test case is to pull the state of
@@ -1147,8 +1157,8 @@
         # Assert that each device has a master
         rolesNotNull = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].rolesNotNull,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].rolesNotNull,
                              name="rolesNotNull-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -1169,8 +1179,8 @@
         consistentMastership = True
         rolesResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].roles,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].roles,
                              name="roles-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -1180,7 +1190,7 @@
             t.join()
             ONOSMastership.append( t.result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if not ONOSMastership[i] or "Error" in ONOSMastership[i]:
                 main.log.error( "Error in getting ONOS" + str( i + 1 ) +
                                  " roles" )
@@ -1207,7 +1217,7 @@
             onfail="ONOS nodes have different views of switch roles" )
 
         if rolesResults and not consistentMastership:
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 try:
                     main.log.warn(
                         "ONOS" + str( i + 1 ) + " roles: ",
@@ -1230,8 +1240,8 @@
         consistentIntents = True
         intentsResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].intents,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].intents,
                              name="intents-" + str( i ),
                              args=[],
                              kwargs={ 'jsonFormat': True } )
@@ -1242,7 +1252,7 @@
             t.join()
             ONOSIntents.append( t.result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if not ONOSIntents[ i ] or "Error" in ONOSIntents[ i ]:
                 main.log.error( "Error in getting ONOS" + str( i + 1 ) +
                                  " intents" )
@@ -1276,7 +1286,7 @@
             #  ...        ...         ...
             #  ...        ...         ...
             title = "   Id"
-            for n in range( numControllers ):
+            for n in range( main.numCtrls ):
                 title += " " * 10 + "ONOS" + str( n + 1 )
             main.log.warn( title )
             # get all intent keys in the cluster
@@ -1304,7 +1314,7 @@
                                         sort_keys=True,
                                         indent=4,
                                         separators=( ',', ': ' ) ) )
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 if ONOSIntents[ i ] != ONOSIntents[ -1 ]:
                     main.log.debug( "ONOS" + str( i + 1 ) + " intents: " )
                     main.log.debug( json.dumps( json.loads( ONOSIntents[i] ),
@@ -1312,7 +1322,7 @@
                                                 indent=4,
                                                 separators=( ',', ': ' ) ) )
                 else:
-                    main.log.debug( nodes[ i ].name + " intents match ONOS" +
+                    main.log.debug( main.nodes[ i ].name + " intents match ONOS" +
                                     str( n ) + " intents" )
         elif intentsResults and consistentIntents:
             intentCheck = main.TRUE
@@ -1327,8 +1337,8 @@
         consistentFlows = True
         flowsResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].flows,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].flows,
                              name="flows-" + str( i ),
                              args=[],
                              kwargs={ 'jsonFormat': True } )
@@ -1342,7 +1352,7 @@
             result = t.result
             ONOSFlows.append( result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             num = str( i + 1 )
             if not ONOSFlows[ i ] or "Error" in ONOSFlows[ i ]:
                 main.log.error( "Error in getting ONOS" + num + " flows" )
@@ -1379,7 +1389,7 @@
             onfail="ONOS nodes have different flow counts" )
 
         if flowsResults and not consistentFlows:
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 try:
                     main.log.warn(
                         "ONOS" + str( i + 1 ) + " flows: " +
@@ -1448,8 +1458,8 @@
         main.step( "Collecting topology information from ONOS" )
         devices = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].devices,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].devices,
                              name="devices-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1460,8 +1470,8 @@
             devices.append( t.result )
         hosts = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].hosts,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].hosts,
                              name="hosts-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1480,8 +1490,8 @@
 
         ports = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].ports,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].ports,
                              name="ports-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1492,8 +1502,8 @@
             ports.append( t.result )
         links = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].links,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].links,
                              name="links-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1504,8 +1514,8 @@
             links.append( t.result )
         clusters = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].clusters,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].clusters,
                              name="clusters-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1607,16 +1617,15 @@
         mnSwitches = main.Mininet1.getSwitches()
         mnLinks = main.Mininet1.getLinks()
         mnHosts = main.Mininet1.getHosts()
-        for controller in range( numControllers ):
+        for controller in range( main.numCtrls ):
             controllerStr = str( controller + 1 )
             if devices[ controller ] and ports[ controller ] and\
                 "Error" not in devices[ controller ] and\
                 "Error" not in ports[ controller ]:
-
-                currentDevicesResult = main.Mininet1.compareSwitches(
-                        mnSwitches,
-                        json.loads( devices[ controller ] ),
-                        json.loads( ports[ controller ] ) )
+                    currentDevicesResult = main.Mininet1.compareSwitches(
+                            mnSwitches,
+                            json.loads( devices[ controller ] ),
+                            json.loads( ports[ controller ] ) )
             else:
                 currentDevicesResult = main.FALSE
             utilities.assert_equals( expect=main.TRUE,
@@ -1681,11 +1690,11 @@
         The Failure case.
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         try:
             labels
         except NameError:
@@ -1710,7 +1719,7 @@
         main.step( "Killing ONOS nodes" )
         killResults = main.TRUE
         killTime = time.time()
-        for node in nodes:
+        for node in main.nodes:
             killed = main.ONOSbench.onosKill( node.ip_address )
             killResults = killResults and killed
         utilities.assert_equals( expect=main.TRUE, actual=killResults,
@@ -1720,7 +1729,7 @@
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onosIsupResult = main.TRUE
-            for node in nodes:
+            for node in main.nodes:
                 started = main.ONOSbench.isup( node.ip_address )
                 if not started:
                     main.log.error( node.name + " didn't start!" )
@@ -1734,10 +1743,10 @@
         main.log.step( "Starting ONOS CLI sessions" )
         cliResults = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].startOnosCli,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].startOnosCli,
                              name="startOnosCli-" + str( i ),
-                             args=[nodes[i].ip_address] )
+                             args=[main.nodes[i].ip_address] )
             threads.append( t )
             t.start()
 
@@ -1758,8 +1767,8 @@
         # FIXME: revisit test plan for election with madan
         # Rerun for election on restarted nodes
         runResults = main.TRUE
-        for cli in CLIs:
-            run = CLIs[0].electionTestRun()
+        for cli in main.CLIs:
+            run = main.CLIs[0].electionTestRun()
             if run != main.TRUE:
                 main.log.error( "Error running for election on " + cli.name )
             runResults = runResults and run
@@ -1769,28 +1778,28 @@
 
         # TODO: Make this configurable
         time.sleep( 60 )
-        main.log.debug( CLIs[0].nodes( jsonFormat=False ) )
-        main.log.debug( CLIs[0].leaders( jsonFormat=False ) )
-        main.log.debug( CLIs[0].partitions( jsonFormat=False ) )
+        main.log.debug( main.CLIs[0].nodes( jsonFormat=False ) )
+        main.log.debug( main.CLIs[0].leaders( jsonFormat=False ) )
+        main.log.debug( main.CLIs[0].partitions( jsonFormat=False ) )
 
     def CASE7( self, main ):
         """
         Check state after ONOS failure
         """
         import json
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         main.case( "Running ONOS Constant State Tests" )
 
         main.step( "Check that each switch has a master" )
         # Assert that each device has a master
         rolesNotNull = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].rolesNotNull,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].rolesNotNull,
                              name="rolesNotNull-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1811,8 +1820,8 @@
         consistentMastership = True
         rolesResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].roles,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].roles,
                              name="roles-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -1822,7 +1831,7 @@
             t.join()
             ONOSMastership.append( t.result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if not ONOSMastership[i] or "Error" in ONOSMastership[i]:
                 main.log.error( "Error in getting ONOS" + str( i + 1 ) +
                                  " roles" )
@@ -1849,7 +1858,7 @@
             onfail="ONOS nodes have different views of switch roles" )
 
         if rolesResults and not consistentMastership:
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 main.log.warn(
                     "ONOS" + str( i + 1 ) + " roles: ",
                     json.dumps(
@@ -1900,8 +1909,8 @@
         consistentIntents = True
         intentsResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].intents,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].intents,
                              name="intents-" + str( i ),
                              args=[],
                              kwargs={ 'jsonFormat': True } )
@@ -1912,7 +1921,7 @@
             t.join()
             ONOSIntents.append( t.result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if not ONOSIntents[ i ] or "Error" in ONOSIntents[ i ]:
                 main.log.error( "Error in getting ONOS" + str( i + 1 ) +
                                  " intents" )
@@ -1939,7 +1948,7 @@
         #  ...        ...         ...
         #  ...        ...         ...
         title = "   ID"
-        for n in range( numControllers ):
+        for n in range( main.numCtrls ):
             title += " " * 10 + "ONOS" + str( n + 1 )
         main.log.warn( title )
         # get all intent keys in the cluster
@@ -1979,7 +1988,7 @@
             main.log.info( dict( out ) )
 
         if intentsResults and not consistentIntents:
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 main.log.warn( "ONOS" + str( i + 1 ) + " intents: " )
                 main.log.warn( json.dumps(
                     json.loads( ONOSIntents[ i ] ),
@@ -2095,7 +2104,7 @@
         # Test of LeadershipElection
         leaderList = []
         leaderResult = main.TRUE
-        for cli in CLIs:
+        for cli in main.CLIs:
             leaderN = cli.electionTestLeader()
             leaderList.append( leaderN )
             if leaderN == main.FALSE:
@@ -2125,14 +2134,14 @@
         """
         import json
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         main.case( "Compare ONOS Topology view to Mininet topology" )
-        main.caseExplaination = "Compare topology objects between Mininet" +\
+        main.caseExplanation = "Compare topology objects between Mininet" +\
                                 " and ONOS"
 
         main.step( "Comparing ONOS topology to MN" )
@@ -2151,8 +2160,8 @@
             cliStart = time.time()
             devices = []
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].devices,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].devices,
                                  name="devices-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2164,8 +2173,8 @@
             hosts = []
             ipResult = main.TRUE
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].hosts,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].hosts,
                                  name="hosts-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2188,8 +2197,8 @@
                         ipResult = main.FALSE
             ports = []
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].ports,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].ports,
                                  name="ports-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2200,8 +2209,8 @@
                 ports.append( t.result )
             links = []
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].links,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].links,
                                  name="links-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2212,8 +2221,8 @@
                 links.append( t.result )
             clusters = []
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].clusters,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].clusters,
                                  name="clusters-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2231,7 +2240,7 @@
             mnSwitches = main.Mininet1.getSwitches()
             mnLinks = main.Mininet1.getLinks()
             mnHosts = main.Mininet1.getHosts()
-            for controller in range( numControllers ):
+            for controller in range( main.numCtrls ):
                 controllerStr = str( controller + 1 )
                 if devices[ controller ] and ports[ controller ] and\
                     "Error" not in devices[ controller ] and\
@@ -2489,8 +2498,8 @@
         nodesOutput = []
         nodeResults = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].nodes,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].nodes,
                              name="nodes-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -2499,7 +2508,7 @@
         for t in threads:
             t.join()
             nodesOutput.append( t.result )
-        ips = [ node.ip_address for node in nodes ]
+        ips = [ node.ip_address for node in main.nodes ]
         for i in nodesOutput:
             try:
                 current = json.loads( i )
@@ -2529,11 +2538,11 @@
         Link s3-s28 down
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         # NOTE: You should probably run a topology check after this
 
         linkSleep = float( main.params[ 'timers' ][ 'LinkDiscovery' ] )
@@ -2557,11 +2566,11 @@
         Link s3-s28 up
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         # NOTE: You should probably run a topology check after this
 
         linkSleep = float( main.params[ 'timers' ][ 'LinkDiscovery' ] )
@@ -2586,11 +2595,11 @@
         """
         # NOTE: You should probably run a topology check after this
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         switchSleep = float( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
 
@@ -2622,11 +2631,11 @@
         """
         # NOTE: You should probably run a topology check after this
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert ONOS1Port, "ONOS1Port not defined"
         assert ONOS2Port, "ONOS2Port not defined"
         assert ONOS3Port, "ONOS3Port not defined"
@@ -2647,8 +2656,8 @@
         for peer in links:
             main.Mininet1.addLink( switch, peer )
         ipList = []
-        for i in range( numControllers ):
-            ipList.append( nodes[ i ].ip_address )
+        for i in range( main.numCtrls ):
+            ipList.append( main.nodes[ i ].ip_address )
         main.Mininet1.assignSwController( sw=switch, ip=ipList )
         main.log.info( "Waiting " + str( switchSleep ) +
                        " seconds for switch up to be discovered" )
@@ -2669,11 +2678,11 @@
         """
         import os
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         # printing colors to terminal
         colors = { 'cyan': '\033[96m', 'purple': '\033[95m',
@@ -2699,7 +2708,7 @@
             # NOTE: must end in /
             dstDir = "~/packet_captures/"
             for f in logFiles:
-                for node in nodes:
+                for node in main.nodes:
                     main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
                                                     ":" + logFolder + f + " " +
                                                     teststationUser + "@" +
@@ -2715,7 +2724,7 @@
             # NOTE: must end in /
             dstDir = "~/packet_captures/"
             for f in logFiles:
-                for node in nodes:
+                for node in main.nodes:
                     main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
                                                     ":" + logFolder + f + " " +
                                                     teststationUser + "@" +
@@ -2735,7 +2744,7 @@
                                  onfail="MN cleanup NOT successful" )
 
         main.step( "Checking ONOS Logs for errors" )
-        for node in nodes:
+        for node in main.nodes:
             print colors[ 'purple' ] + "Checking logs for errors on " + \
                 node.name + ":" + colors[ 'end' ]
             print main.ONOSbench.checkLogs( node.ip_address, restart=True )
@@ -2752,11 +2761,11 @@
         """
         start election app on all onos nodes
         """
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         main.case("Start Leadership Election app")
         main.step( "Install leadership election app" )
@@ -2770,9 +2779,9 @@
         main.step( "Run for election on each node" )
         leaderResult = main.TRUE
         leaders = []
-        for cli in CLIs:
+        for cli in main.CLIs:
             cli.electionTestRun()
-        for cli in CLIs:
+        for cli in main.CLIs:
             leader = cli.electionTestLeader()
             if leader is None or leader == main.FALSE:
                 main.log.error( cli.name + ": Leader for the election app " +
@@ -2803,11 +2812,11 @@
         Check that Leadership Election is still functional
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         leaderResult = main.TRUE
         description = "Check that Leadership Election is still functional"
@@ -2816,9 +2825,9 @@
         main.step( "Run for election on each node" )
         leaderResult = main.TRUE
         leaders = []
-        for cli in CLIs:
+        for cli in main.CLIs:
             cli.electionTestRun()
-        for cli in CLIs:
+        for cli in main.CLIs:
             leader = cli.electionTestLeader()
             if leader is None or leader == main.FALSE:
                 main.log.error( cli.name + ": Leader for the election app " +
@@ -2836,7 +2845,7 @@
         sameLeader = main.TRUE
         if len( set( leaders ) ) != 1:
             sameLeader = main.FALSE
-            main.log.error( "Results of electionTestLeader is order of CLIs:" +
+            main.log.error( "Results of electionTestLeader is order of main.CLIs:" +
                             str( leaders ) )
         utilities.assert_equals(
             expect=main.TRUE,
@@ -2854,9 +2863,9 @@
                 "instead got '" + str( leader ) + "'" )
             leaderResult = main.FALSE
             oldLeader = None
-        for i in range( len( CLIs ) ):
-            if leader == nodes[ i ].ip_address:
-                oldLeader = CLIs[ i ]
+        for i in range( len( main.CLIs ) ):
+            if leader == main.nodes[ i ].ip_address:
+                oldLeader = main.CLIs[ i ]
                 break
         else:  # FOR/ELSE statement
             main.log.error( "Leader election, could not find current leader" )
@@ -2871,7 +2880,7 @@
         main.step( "Make sure new leader is elected" )
         # FIXME: use threads
         leaderList = []
-        for cli in CLIs:
+        for cli in main.CLIs:
             leaderN = cli.electionTestLeader()
             leaderList.append( leaderN )
             if leaderN == leader:
@@ -2943,11 +2952,11 @@
         Install Distributed Primitives app
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         # Variables for the distributed primitives tests
         global pCounterName
@@ -2967,7 +2976,7 @@
         main.case( description )
         main.step( "Install Primitives app" )
         appName = "org.onosproject.distributedprimitives"
-        appResults = CLIs[0].activateApp( appName )
+        appResults = main.CLIs[0].activateApp( appName )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=appResults,
                                  onpass="Primitives app activated",
@@ -2978,13 +2987,12 @@
         """
         Check for basic functionality with distributed primitives
         """
-        import json
         # Make sure variables are defined/set
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert pCounterName, "pCounterName not defined"
         assert iCounterName, "iCounterName not defined"
         assert onosSetName, "onosSetName not defined"
@@ -3012,15 +3020,17 @@
         description = "Check for basic functionality with distributed " +\
                       "primitives"
         main.case( description )
-        main.caseExplaination = "Test the methods of the distributed primitives (counters and sets) throught the cli"
+        main.caseExplanation = "Test the methods of the distributed " +\
+                                "primitives (counters and sets) throught the cli"
         # DISTRIBUTED ATOMIC COUNTERS
-        main.step( "Increment and get a default counter on each node" )
+        # Partitioned counters
+        main.step( "Increment then get a default counter on each node" )
         pCounters = []
         threads = []
         addedPValues = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].counterTestIncrement,
-                             name="counterIncrement-" + str( i ),
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterAddAndGet-" + str( i ),
                              args=[ pCounterName ] )
             pCounterValue += 1
             addedPValues.append( pCounterValue )
@@ -3044,12 +3054,150 @@
                                  onfail="Error incrementing default" +
                                         " counter" )
 
-        main.step( "Increment and get an in memory counter on each node" )
+        main.step( "Get then Increment a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterGetAndAdd-" + str( i ),
+                             args=[ pCounterName ] )
+            addedPValues.append( pCounterValue )
+            pCounterValue += 1
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( pCounterName, pCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
+        main.step( "Add -8 to then get a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ pCounterName ],
+                             kwargs={ "delta": -8 } )
+            pCounterValue += -8
+            addedPValues.append( pCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Add 5 to then get a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ pCounterName ],
+                             kwargs={ "delta": 5 } )
+            pCounterValue += 5
+            addedPValues.append( pCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Get then add 5 to a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterIncrement-" + str( i ),
+                             args=[ pCounterName ],
+                             kwargs={ "delta": 5 } )
+            addedPValues.append( pCounterValue )
+            pCounterValue += 5
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( pCounterName, pCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
+        # In-Memory counters
+        main.step( "Increment and get an in-memory counter on each node" )
         iCounters = []
         addedIValues = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].counterTestIncrement,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
                              name="icounterIncrement-" + str( i ),
                              args=[ iCounterName ],
                              kwargs={ "inMemory": True } )
@@ -3071,15 +3219,153 @@
                                 "counter incremented results" )
         utilities.assert_equals( expect=True,
                                  actual=iCounterResults,
-                                 onpass="In memory counter incremented",
-                                 onfail="Error incrementing in memory" +
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
                                         " counter" )
 
+        main.step( "Get then Increment a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterGetAndAdd-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "inMemory": True } )
+            addedIValues.append( iCounterValue )
+            iCounterValue += 1
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=iCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( iCounterName, iCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
+        main.step( "Add -8 to then get a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "delta": -8, "inMemory": True  } )
+            iCounterValue += -8
+            addedIValues.append( iCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Add 5 to then get a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "delta": 5, "inMemory": True  } )
+            iCounterValue += 5
+            addedIValues.append( iCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Get then add 5 to a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterIncrement-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "delta": 5, "inMemory": True  } )
+            addedIValues.append( iCounterValue )
+            iCounterValue += 5
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=iCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( iCounterName, iCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
         main.step( "Check counters are consistant across nodes" )
         onosCounters = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].counters,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counters,
                              name="counters-" + str( i ) )
             threads.append( t )
             t.start()
@@ -3101,59 +3387,21 @@
                                         "across nodes" )
 
         main.step( "Counters we added have the correct values" )
-        correctResults = main.TRUE
-        for i in range( numControllers ):
-            try:
-                current = json.loads( onosCounters[i] )
-            except ( ValueError, TypeError ):
-                main.log.error( "Could not parse counters response from ONOS" +
-                                str( i + 1 ) )
-                main.log.warn( repr( onosCounters[ i ] ) )
-            pValue = None
-            iValue = None
-            try:
-                for database in current:
-                    partitioned = database.get( 'partitionedDatabaseCounters' )
-                    if partitioned:
-                        for value in partitioned:
-                            if value.get( 'name' ) == pCounterName:
-                                pValue = value.get( 'value' )
-                                break
-                    inMemory = database.get( 'inMemoryDatabaseCounters' )
-                    if inMemory:
-                        for value in inMemory:
-                            if value.get( 'name' ) == iCounterName:
-                                iValue = value.get( 'value' )
-                                break
-            except AttributeError, e:
-                main.log.error( "ONOS" + str( i + 1 ) + " counters result " +
-                                "is not as expected" )
-                correctResults = main.FALSE
-            if pValue == pCounterValue:
-                main.log.info( "Partitioned counter value is correct" )
-            else:
-                main.log.error( "Partitioned counter value is incorrect," +
-                                " expected value: " + str( pCounterValue )
-                                + " current value: " + str( pValue ) )
-                correctResults = main.FALSE
-            if iValue == iCounterValue:
-                main.log.info( "In memory counter value is correct" )
-            else:
-                main.log.error( "In memory counter value is incorrect, " +
-                                "expected value: " + str( iCounterValue ) +
-                                " current value: " + str( iValue ) )
-                correctResults = main.FALSE
+        incrementCheck = main.Counters.counterCheck( iCounterName, iCounterValue )
+        incrementCheck = incrementCheck and \
+                         main.Counters.counterCheck( iCounterName, iCounterValue )
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=correctResults,
+                                 actual=incrementCheck,
                                  onpass="Added counters are correct",
                                  onfail="Added counters are incorrect" )
+
         # DISTRIBUTED SETS
         main.step( "Distributed Set get" )
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3163,7 +3411,7 @@
             getResponses.append( t.result )
 
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3193,8 +3441,8 @@
         main.step( "Distributed Set size" )
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3204,7 +3452,7 @@
             sizeResponses.append( t.result )
 
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3220,8 +3468,8 @@
         onosSet.add( addValue )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAdd-" + str( i ),
                              args=[ onosSetName, addValue ] )
             threads.append( t )
@@ -3234,7 +3482,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3254,8 +3502,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3264,7 +3512,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3288,8 +3536,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3298,7 +3546,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3315,8 +3563,8 @@
         onosSet.update( addAllValue.split() )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAddAll-" + str( i ),
                              args=[ onosSetName, addAllValue ] )
             threads.append( t )
@@ -3329,7 +3577,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3349,8 +3597,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3359,7 +3607,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3383,8 +3631,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3393,7 +3641,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3409,8 +3657,8 @@
         main.step( "Distributed Set contains()" )
         containsResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setContains-" + str( i ),
                              args=[ onosSetName ],
                              kwargs={ "values": addValue } )
@@ -3422,7 +3670,7 @@
             containsResponses.append( t.result )
 
         containsResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if containsResponses[ i ] == main.ERROR:
                 containsResults = main.FALSE
             else:
@@ -3436,8 +3684,8 @@
         main.step( "Distributed Set containsAll()" )
         containsAllResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setContainsAll-" + str( i ),
                              args=[ onosSetName ],
                              kwargs={ "values": addAllValue } )
@@ -3449,7 +3697,7 @@
             containsAllResponses.append( t.result )
 
         containsAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if containsResponses[ i ] == main.ERROR:
                 containsResults = main.FALSE
             else:
@@ -3464,8 +3712,8 @@
         onosSet.remove( addValue )
         removeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestRemove,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestRemove,
                              name="setTestRemove-" + str( i ),
                              args=[ onosSetName, addValue ] )
             threads.append( t )
@@ -3478,7 +3726,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         removeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if removeResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3498,8 +3746,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3508,7 +3756,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3532,8 +3780,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3542,7 +3790,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3560,8 +3808,8 @@
         removeAllResponses = []
         threads = []
         try:
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].setTestRemove,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].setTestRemove,
                                  name="setTestRemoveAll-" + str( i ),
                                  args=[ onosSetName, addAllValue ] )
                 threads.append( t )
@@ -3576,7 +3824,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         removeAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if removeAllResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3596,8 +3844,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3606,7 +3854,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3630,8 +3878,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3640,7 +3888,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3657,8 +3905,8 @@
         onosSet.update( addAllValue.split() )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAddAll-" + str( i ),
                              args=[ onosSetName, addAllValue ] )
             threads.append( t )
@@ -3671,7 +3919,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3691,8 +3939,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3701,7 +3949,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3725,8 +3973,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3735,7 +3983,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3752,8 +4000,8 @@
         onosSet.clear()
         clearResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestRemove,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestRemove,
                              name="setTestClear-" + str( i ),
                              args=[ onosSetName, " "],  # Values doesn't matter
                              kwargs={ "clear": True } )
@@ -3767,7 +4015,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         clearResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if clearResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3787,8 +4035,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3797,7 +4045,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3821,8 +4069,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3831,7 +4079,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3848,8 +4096,8 @@
         onosSet.update( addAllValue.split() )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAddAll-" + str( i ),
                              args=[ onosSetName, addAllValue ] )
             threads.append( t )
@@ -3862,7 +4110,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3882,8 +4130,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3892,7 +4140,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3916,8 +4164,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3926,7 +4174,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3943,8 +4191,8 @@
         onosSet.intersection_update( retainValue.split() )
         retainResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestRemove,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestRemove,
                              name="setTestRetain-" + str( i ),
                              args=[ onosSetName, retainValue ],
                              kwargs={ "retain": True } )
@@ -3958,7 +4206,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         retainResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if retainResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3978,8 +4226,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3988,7 +4236,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -4012,8 +4260,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -4022,7 +4270,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
diff --git a/TestON/tests/HAclusterRestart/dependencies/Counters.py b/TestON/tests/HAclusterRestart/dependencies/Counters.py
new file mode 100644
index 0000000..7abd73a
--- /dev/null
+++ b/TestON/tests/HAclusterRestart/dependencies/Counters.py
@@ -0,0 +1,57 @@
+def __init__( self ):
+    self.default = ''
+
+def counterCheck( counterName, counterValue ):
+    """
+    Add Text here
+    """
+    import json
+    correctResults = main.TRUE
+    # Get onos counters results
+    onosCounters = []
+    threads = []
+    for i in range( main.numCtrls ):
+        t = main.Thread( target=main.CLIs[i].counters,
+                         name="counters-" + str( i ) )
+        threads.append( t )
+        t.start()
+    for t in threads:
+        t.join()
+        onosCounters.append( t.result )
+    tmp = [ i == onosCounters[ 0 ] for i in onosCounters ]
+    if all( tmp ):
+        consistent = main.TRUE
+    else:
+        consistent = main.FALSE
+        main.log.error( "ONOS nodes have different values for counters" )
+        for node in onosCounters:
+            main.log.debug( node )
+
+    # Check for correct values
+    for i in range( main.numCtrls ):
+        try:
+            current = json.loads( onosCounters[i] )
+        except ( ValueError, TypeError ):
+            main.log.error( "Could not parse counters response from ONOS" +
+                            str( i + 1 ) )
+            main.log.warn( repr( onosCounters[ i ] ) )
+        onosValue = None
+        try:
+            for database in current:
+                database = database.values()[0]
+                for counter in database:
+                    if counter.get( 'name' ) == counterName:
+                        onosValue = counter.get( 'value' )
+                        break
+        except AttributeError, e:
+            main.log.error( "ONOS" + str( i + 1 ) + " counters result " +
+                            "is not as expected" )
+            correctResults = main.FALSE
+        if onosValue == counterValue:
+            main.log.info( counterName + " counter value is correct" )
+        else:
+            main.log.error( counterName + " counter value is incorrect," +
+                            " expected value: " + str( counterValue )
+                            + " current value: " + str( onosValue ) )
+            correctResults = main.FALSE
+    return consistent and correctResults
diff --git a/TestON/tests/HAclusterRestart/dependencies/__init__.py b/TestON/tests/HAclusterRestart/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/HAclusterRestart/dependencies/__init__.py
diff --git a/TestON/tests/HAminorityRestart/HAminorityRestart.params b/TestON/tests/HAminorityRestart/HAminorityRestart.params
index f983129..87d1cea 100644
--- a/TestON/tests/HAminorityRestart/HAminorityRestart.params
+++ b/TestON/tests/HAminorityRestart/HAminorityRestart.params
@@ -1,5 +1,8 @@
 <PARAMS>
     <testcases>1,2,8,3,4,5,14,16,17,[6],8,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+    <imports>
+        <path> /home/admin/OnosSystemTest/TestON/tests/HAminorityRestart/dependencies/ </path>
+    </imports>
     <ENV>
         <cellName>HA</cellName>
         <appString>drivers,openflow,proxyarp,mobility</appString>
diff --git a/TestON/tests/HAminorityRestart/HAminorityRestart.py b/TestON/tests/HAminorityRestart/HAminorityRestart.py
index a7f7303..94482ea 100644
--- a/TestON/tests/HAminorityRestart/HAminorityRestart.py
+++ b/TestON/tests/HAminorityRestart/HAminorityRestart.py
@@ -47,10 +47,11 @@
         start cli sessions
         start tcpdump
         """
+        import imp
         main.log.info( "ONOS HA test: Restart minority of ONOS nodes - " +
                          "initialization" )
         main.case( "Setting up test environment" )
-        main.caseExplaination = "Setup the test environment including " +\
+        main.caseExplanation = "Setup the test environment including " +\
                                 "installing ONOS, starting Mininet and ONOS" +\
                                 "cli sessions."
         # TODO: save all the timers and output them for plotting
@@ -62,12 +63,11 @@
         gitBranch = main.params[ 'branch' ]
         cellName = main.params[ 'ENV' ][ 'cellName' ]
 
-        # set global variables
-        global numControllers
-        numControllers = int( main.params[ 'num_controllers' ] )
+        main.numCtrls = int( main.params[ 'num_controllers' ] )
         if main.ONOSbench.maxNodes:
-            if main.ONOSbench.maxNodes < numControllers:
-                numControllers = int( main.ONOSbench.maxNodes )
+            if main.ONOSbench.maxNodes < main.numCtrls:
+                main.numCtrls = int( main.ONOSbench.maxNodes )
+        # set global variables
         global ONOS1Port
         global ONOS2Port
         global ONOS3Port
@@ -86,15 +86,27 @@
         ONOS6Port = main.params[ 'CTRL' ][ 'port6' ]
         ONOS7Port = main.params[ 'CTRL' ][ 'port7' ]
 
-        global CLIs
-        CLIs = []
-        global nodes
-        nodes = []
+        try:
+            fileName = "Counters"
+            # TODO: Maybe make a library folder somewhere?
+            path = main.params[ 'imports' ][ 'path' ]
+            main.Counters = imp.load_source( fileName,
+                                             path + fileName + ".py" )
+        except Exception as e:
+            main.log.exception( e )
+            main.cleanup()
+            main.exit()
+
+        main.CLIs = []
+        main.nodes = []
         ipList = []
-        for i in range( 1, numControllers + 1 ):
-            CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
-            nodes.append( getattr( main, 'ONOS' + str( i ) ) )
-            ipList.append( nodes[ -1 ].ip_address )
+        for i in range( 1, main.numCtrls + 1 ):
+            try:
+                main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+                main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+                ipList.append( main.nodes[ -1 ].ip_address )
+            except AttributeError:
+                break
 
         main.step( "Create cell file" )
         cellAppString = main.params[ 'ENV' ][ 'appString' ]
@@ -110,13 +122,13 @@
         main.ONOSbench.onosRemoveRaftLogs()
 
         main.log.info( "Uninstalling ONOS" )
-        for node in nodes:
+        for node in main.nodes:
             main.ONOSbench.onosUninstall( node.ip_address )
 
         # Make sure ONOS is DEAD
         main.log.info( "Killing any ONOS processes" )
         killResults = main.TRUE
-        for node in nodes:
+        for node in main.nodes:
             killed = main.ONOSbench.onosKill( node.ip_address )
             killResults = killResults and killed
 
@@ -183,7 +195,7 @@
 
         main.step( "Installing ONOS package" )
         onosInstallResult = main.TRUE
-        for node in nodes:
+        for node in main.nodes:
             tmpResult = main.ONOSbench.onosInstall( options="-f",
                                                     node=node.ip_address )
             onosInstallResult = onosInstallResult and tmpResult
@@ -194,7 +206,7 @@
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onosIsupResult = main.TRUE
-            for node in nodes:
+            for node in main.nodes:
                 started = main.ONOSbench.isup( node.ip_address )
                 if not started:
                     main.log.error( node.name + " didn't start!" )
@@ -210,10 +222,10 @@
         main.log.step( "Starting ONOS CLI sessions" )
         cliResults = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].startOnosCli,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].startOnosCli,
                              name="startOnosCli-" + str( i ),
-                             args=[nodes[i].ip_address] )
+                             args=[main.nodes[i].ip_address] )
             threads.append( t )
             t.start()
 
@@ -235,8 +247,8 @@
         main.step( "App Ids check" )
         appCheck = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].appToIDCheck,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].appToIDCheck,
                              name="appToIDCheck-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -246,8 +258,8 @@
             t.join()
             appCheck = appCheck and t.result
         if appCheck != main.TRUE:
-            main.log.warn( CLIs[0].apps() )
-            main.log.warn( CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
         utilities.assert_equals( expect=main.TRUE, actual=appCheck,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -262,12 +274,11 @@
         Assign devices to controllers
         """
         import re
-        import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert ONOS1Port, "ONOS1Port not defined"
         assert ONOS2Port, "ONOS2Port not defined"
         assert ONOS3Port, "ONOS3Port not defined"
@@ -277,14 +288,14 @@
         assert ONOS7Port, "ONOS7Port not defined"
 
         main.case( "Assigning devices to controllers" )
-        main.caseExplaination = "Assign switches to ONOS using 'ovs-vsctl' " +\
+        main.caseExplanation = "Assign switches to ONOS using 'ovs-vsctl' " +\
                                 "and check that an ONOS node becomes the " +\
                                 "master of the device."
         main.step( "Assign switches to controllers" )
 
         ipList = []
-        for i in range( numControllers ):
-            ipList.append( nodes[ i ].ip_address )
+        for i in range( main.numCtrls ):
+            ipList.append( main.nodes[ i ].ip_address )
         swList = []
         for i in range( 1, 29 ):
             swList.append( "s" + str( i ) )
@@ -297,7 +308,7 @@
                 main.log.info( str( response ) )
             except Exception:
                 main.log.info( repr( response ) )
-            for node in nodes:
+            for node in main.nodes:
                 if re.search( "tcp:" + node.ip_address, response ):
                     mastershipCheck = mastershipCheck and main.TRUE
                 else:
@@ -315,13 +326,12 @@
         """
         Assign mastership to controllers
         """
-        import re
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert ONOS1Port, "ONOS1Port not defined"
         assert ONOS2Port, "ONOS2Port not defined"
         assert ONOS3Port, "ONOS3Port not defined"
@@ -331,7 +341,7 @@
         assert ONOS7Port, "ONOS7Port not defined"
 
         main.case( "Assigning Controller roles for switches" )
-        main.caseExplaination = "Check that ONOS is connected to each " +\
+        main.caseExplanation = "Check that ONOS is connected to each " +\
                                 "device. Then manually assign" +\
                                 " mastership to specific ONOS nodes using" +\
                                 " 'device-role'"
@@ -349,45 +359,45 @@
                 # set up correct variables:
                 if i == 1:
                     c = 0
-                    ip = nodes[ c ].ip_address  # ONOS1
+                    ip = main.nodes[ c ].ip_address  # ONOS1
                     deviceId = main.ONOScli1.getDevice( "1000" ).get( 'id' )
                 elif i == 2:
-                    c = 1 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS2
+                    c = 1 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS2
                     deviceId = main.ONOScli1.getDevice( "2000" ).get( 'id' )
                 elif i == 3:
-                    c = 1 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS2
+                    c = 1 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS2
                     deviceId = main.ONOScli1.getDevice( "3000" ).get( 'id' )
                 elif i == 4:
-                    c = 3 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS4
+                    c = 3 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS4
                     deviceId = main.ONOScli1.getDevice( "3004" ).get( 'id' )
                 elif i == 5:
-                    c = 2 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS3
+                    c = 2 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS3
                     deviceId = main.ONOScli1.getDevice( "5000" ).get( 'id' )
                 elif i == 6:
-                    c = 2 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS3
+                    c = 2 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS3
                     deviceId = main.ONOScli1.getDevice( "6000" ).get( 'id' )
                 elif i == 7:
-                    c = 5 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS6
+                    c = 5 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS6
                     deviceId = main.ONOScli1.getDevice( "6007" ).get( 'id' )
                 elif i >= 8 and i <= 17:
-                    c = 4 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS5
+                    c = 4 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS5
                     dpid = '3' + str( i ).zfill( 3 )
                     deviceId = main.ONOScli1.getDevice( dpid ).get( 'id' )
                 elif i >= 18 and i <= 27:
-                    c = 6 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS7
+                    c = 6 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS7
                     dpid = '6' + str( i ).zfill( 3 )
                     deviceId = main.ONOScli1.getDevice( dpid ).get( 'id' )
                 elif i == 28:
                     c = 0
-                    ip = nodes[ c ].ip_address  # ONOS1
+                    ip = main.nodes[ c ].ip_address  # ONOS1
                     deviceId = main.ONOScli1.getDevice( "2800" ).get( 'id' )
                 else:
                     main.log.error( "You didn't write an else statement for " +
@@ -440,13 +450,13 @@
         """
         import time
         import json
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         main.case( "Adding host Intents" )
-        main.caseExplaination = "Discover hosts by using pingall then " +\
+        main.caseExplanation = "Discover hosts by using pingall then " +\
                                 "assign predetermined host-to-host intents." +\
                                 " After installation, check that the intent" +\
                                 " is distributed to all nodes and the state" +\
@@ -454,7 +464,7 @@
 
         # install onos-app-fwd
         main.step( "Install reactive forwarding app" )
-        installResults = CLIs[0].activateApp( "org.onosproject.fwd" )
+        installResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
         utilities.assert_equals( expect=main.TRUE, actual=installResults,
                                  onpass="Install fwd successful",
                                  onfail="Install fwd failed" )
@@ -462,8 +472,8 @@
         main.step( "Check app ids" )
         appCheck = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].appToIDCheck,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].appToIDCheck,
                              name="appToIDCheck-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -473,8 +483,8 @@
             t.join()
             appCheck = appCheck and t.result
         if appCheck != main.TRUE:
-            main.log.warn( CLIs[0].apps() )
-            main.log.warn( CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
         utilities.assert_equals( expect=main.TRUE, actual=appCheck,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -500,7 +510,7 @@
         time.sleep( 11 )
         # uninstall onos-app-fwd
         main.step( "Uninstall reactive forwarding app" )
-        uninstallResult = CLIs[0].deactivateApp( "org.onosproject.fwd" )
+        uninstallResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
         utilities.assert_equals( expect=main.TRUE, actual=uninstallResult,
                                  onpass="Uninstall fwd successful",
                                  onfail="Uninstall fwd failed" )
@@ -508,8 +518,8 @@
         main.step( "Check app ids" )
         threads = []
         appCheck2 = main.TRUE
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].appToIDCheck,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].appToIDCheck,
                              name="appToIDCheck-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -519,8 +529,8 @@
             t.join()
             appCheck2 = appCheck2 and t.result
         if appCheck2 != main.TRUE:
-            main.log.warn( CLIs[0].apps() )
-            main.log.warn( CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
         utilities.assert_equals( expect=main.TRUE, actual=appCheck2,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -547,8 +557,8 @@
                 host1Id = host1Dict.get( 'id', None )
                 host2Id = host2Dict.get( 'id', None )
             if host1Id and host2Id:
-                nodeNum = ( i % numControllers )
-                tmpId = CLIs[ nodeNum ].addHostIntent( host1Id, host2Id )
+                nodeNum = ( i % main.numCtrls )
+                tmpId = main.CLIs[ nodeNum ].addHostIntent( host1Id, host2Id )
                 if tmpId:
                     main.log.info( "Added intent with id: " + tmpId )
                     intentIds.append( tmpId )
@@ -558,7 +568,7 @@
             else:
                 main.log.error( "Error, getHost() failed for h" + str( i ) +
                                 " and/or h" + str( i + 10 ) )
-                hosts = CLIs[ 0 ].hosts()
+                hosts = main.CLIs[ 0 ].hosts()
                 main.log.warn( "Hosts output: " )
                 try:
                     main.log.warn( json.dumps( json.loads( hosts ),
@@ -639,7 +649,7 @@
             main.log.error( repr( leaders ) )
         # Check all nodes
         if missing:
-            for node in CLIs:
+            for node in main.CLIs:
                 response = node.leaders( jsonFormat=False)
                 main.log.warn( str( node.name ) + " leaders output: \n" +
                                str( response ) )
@@ -683,7 +693,7 @@
         for i in range(100):
             correct = True
             main.log.info( "Submitted intents: " + str( sorted( intentIds ) ) )
-            for cli in CLIs:
+            for cli in main.CLIs:
                 onosIds = []
                 ids = cli.getAllIntentsId()
                 onosIds.append( ids )
@@ -784,7 +794,7 @@
                 main.log.error( repr( leaders ) )
             # Check all nodes
             if missing:
-                for node in CLIs:
+                for node in main.CLIs:
                     response = node.leaders( jsonFormat=False)
                     main.log.warn( str( node.name ) + " leaders output: \n" +
                                    str( response ) )
@@ -825,13 +835,13 @@
         """
         import json
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         main.case( "Verify connectivity by sendind traffic across Intents" )
-        main.caseExplaination = "Ping across added host intents to check " +\
+        main.caseExplanation = "Ping across added host intents to check " +\
                                 "functionality and check the state of " +\
                                 "the intent"
         main.step( "Ping across added host intents" )
@@ -935,7 +945,7 @@
             # TODO: Check for a leader of these topics
         # Check all nodes
         if topicCheck:
-            for node in CLIs:
+            for node in main.CLIs:
                 response = node.leaders( jsonFormat=False)
                 main.log.warn( str( node.name ) + " leaders output: \n" +
                                str( response ) )
@@ -1028,7 +1038,7 @@
                 main.log.exception( "Error parsing leaders" )
                 main.log.error( repr( leaders ) )
             if missing:
-                for node in CLIs:
+                for node in main.CLIs:
                     response = node.leaders( jsonFormat=False)
                     main.log.warn( str( node.name ) + " leaders output: \n" +
                                    str( response ) )
@@ -1063,7 +1073,7 @@
                 main.log.exception( "Error parsing pending map" )
                 main.log.error( repr( pendingMap ) )
         # Print flowrules
-        main.log.debug( CLIs[0].flows( jsonFormat=False ) )
+        main.log.debug( main.CLIs[0].flows( jsonFormat=False ) )
         main.step( "Wait a minute then ping again" )
         # the wait is above
         PingResult = main.TRUE
@@ -1102,11 +1112,11 @@
         """
         import json
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         main.case( "Setting up and gathering data for current state" )
         # The general idea for this test case is to pull the state of
@@ -1120,8 +1130,8 @@
         # Assert that each device has a master
         rolesNotNull = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].rolesNotNull,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].rolesNotNull,
                              name="rolesNotNull-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -1142,8 +1152,8 @@
         consistentMastership = True
         rolesResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].roles,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].roles,
                              name="roles-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -1153,7 +1163,7 @@
             t.join()
             ONOSMastership.append( t.result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if not ONOSMastership[i] or "Error" in ONOSMastership[i]:
                 main.log.error( "Error in getting ONOS" + str( i + 1 ) +
                                  " roles" )
@@ -1180,7 +1190,7 @@
             onfail="ONOS nodes have different views of switch roles" )
 
         if rolesResults and not consistentMastership:
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 try:
                     main.log.warn(
                         "ONOS" + str( i + 1 ) + " roles: ",
@@ -1203,8 +1213,8 @@
         consistentIntents = True
         intentsResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].intents,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].intents,
                              name="intents-" + str( i ),
                              args=[],
                              kwargs={ 'jsonFormat': True } )
@@ -1215,7 +1225,7 @@
             t.join()
             ONOSIntents.append( t.result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if not ONOSIntents[ i ] or "Error" in ONOSIntents[ i ]:
                 main.log.error( "Error in getting ONOS" + str( i + 1 ) +
                                  " intents" )
@@ -1249,7 +1259,7 @@
             #  ...        ...         ...
             #  ...        ...         ...
             title = "   Id"
-            for n in range( numControllers ):
+            for n in range( main.numCtrls ):
                 title += " " * 10 + "ONOS" + str( n + 1 )
             main.log.warn( title )
             # get all intent keys in the cluster
@@ -1277,7 +1287,7 @@
                                         sort_keys=True,
                                         indent=4,
                                         separators=( ',', ': ' ) ) )
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 if ONOSIntents[ i ] != ONOSIntents[ -1 ]:
                     main.log.debug( "ONOS" + str( i + 1 ) + " intents: " )
                     main.log.debug( json.dumps( json.loads( ONOSIntents[i] ),
@@ -1285,7 +1295,7 @@
                                                 indent=4,
                                                 separators=( ',', ': ' ) ) )
                 else:
-                    main.log.debug( nodes[ i ].name + " intents match ONOS" +
+                    main.log.debug( main.nodes[ i ].name + " intents match ONOS" +
                                     str( n ) + " intents" )
         elif intentsResults and consistentIntents:
             intentCheck = main.TRUE
@@ -1300,8 +1310,8 @@
         consistentFlows = True
         flowsResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].flows,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].flows,
                              name="flows-" + str( i ),
                              args=[],
                              kwargs={ 'jsonFormat': True } )
@@ -1315,7 +1325,7 @@
             result = t.result
             ONOSFlows.append( result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             num = str( i + 1 )
             if not ONOSFlows[ i ] or "Error" in ONOSFlows[ i ]:
                 main.log.error( "Error in getting ONOS" + num + " flows" )
@@ -1352,7 +1362,7 @@
             onfail="ONOS nodes have different flow counts" )
 
         if flowsResults and not consistentFlows:
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 try:
                     main.log.warn(
                         "ONOS" + str( i + 1 ) + " flows: " +
@@ -1421,8 +1431,8 @@
         main.step( "Collecting topology information from ONOS" )
         devices = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].devices,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].devices,
                              name="devices-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1433,8 +1443,8 @@
             devices.append( t.result )
         hosts = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].hosts,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].hosts,
                              name="hosts-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1453,8 +1463,8 @@
 
         ports = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].ports,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].ports,
                              name="ports-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1465,8 +1475,8 @@
             ports.append( t.result )
         links = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].links,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].links,
                              name="links-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1477,8 +1487,8 @@
             links.append( t.result )
         clusters = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].clusters,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].clusters,
                              name="clusters-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1580,7 +1590,7 @@
         mnSwitches = main.Mininet1.getSwitches()
         mnLinks = main.Mininet1.getLinks()
         mnHosts = main.Mininet1.getHosts()
-        for controller in range( numControllers ):
+        for controller in range( main.numCtrls ):
             controllerStr = str( controller + 1 )
             if devices[ controller ] and ports[ controller ] and\
                 "Error" not in devices[ controller ] and\
@@ -1654,23 +1664,23 @@
         The Failure case.
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         main.case( "Restart minority of ONOS nodes" )
         main.step( "Killing 3 ONOS nodes" )
         killTime = time.time()
         # TODO: Randomize these nodes or base this on partitions
         # TODO: use threads in this case
-        killResults = main.ONOSbench.onosKill( nodes[0].ip_address )
+        killResults = main.ONOSbench.onosKill( main.nodes[0].ip_address )
         time.sleep( 10 )
         killResults = killResults and\
-                      main.ONOSbench.onosKill( nodes[1].ip_address )
+                      main.ONOSbench.onosKill( main.nodes[1].ip_address )
         time.sleep( 10 )
         killResults = killResults and\
-                      main.ONOSbench.onosKill( nodes[2].ip_address )
+                      main.ONOSbench.onosKill( main.nodes[2].ip_address )
         utilities.assert_equals( expect=main.TRUE, actual=killResults,
                                  onpass="ONOS Killed successfully",
                                  onfail="ONOS kill NOT successful" )
@@ -1679,9 +1689,9 @@
         count = 0
         onosIsupResult = main.FALSE
         while onosIsupResult == main.FALSE and count < 10:
-            onos1Isup = main.ONOSbench.isup( nodes[0].ip_address )
-            onos2Isup = main.ONOSbench.isup( nodes[1].ip_address )
-            onos3Isup = main.ONOSbench.isup( nodes[2].ip_address )
+            onos1Isup = main.ONOSbench.isup( main.nodes[0].ip_address )
+            onos2Isup = main.ONOSbench.isup( main.nodes[1].ip_address )
+            onos3Isup = main.ONOSbench.isup( main.nodes[2].ip_address )
             onosIsupResult = onos1Isup and onos2Isup and onos3Isup
             count = count + 1
         # TODO: if it becomes an issue, we can retry this step  a few times
@@ -1689,10 +1699,10 @@
                                  onpass="ONOS restarted successfully",
                                  onfail="ONOS restart NOT successful" )
 
-        main.step( "Restarting ONOS CLIs" )
-        cliResult1 = main.ONOScli1.startOnosCli( nodes[0].ip_address )
-        cliResult2 = main.ONOScli2.startOnosCli( nodes[1].ip_address )
-        cliResult3 = main.ONOScli3.startOnosCli( nodes[2].ip_address )
+        main.step( "Restarting ONOS main.CLIs" )
+        cliResult1 = main.ONOScli1.startOnosCli( main.nodes[0].ip_address )
+        cliResult2 = main.ONOScli2.startOnosCli( main.nodes[1].ip_address )
+        cliResult3 = main.ONOScli3.startOnosCli( main.nodes[2].ip_address )
         cliResults = cliResult1 and cliResult2 and cliResult3
         utilities.assert_equals( expect=main.TRUE, actual=cliResults,
                                  onpass="ONOS cli restarted",
@@ -1705,9 +1715,9 @@
         '''
         # FIXME: revisit test plan for election with madan
         # Rerun for election on restarted nodes
-        run1 = CLIs[0].electionTestRun()
-        run2 = CLIs[1].electionTestRun()
-        run3 = CLIs[2].electionTestRun()
+        run1 = main.CLIs[0].electionTestRun()
+        run2 = main.CLIs[1].electionTestRun()
+        run3 = main.CLIs[2].electionTestRun()
         runResults = run1 and run2 and run3
         utilities.assert_equals( expect=main.TRUE, actual=runResults,
                                  onpass="Reran for election",
@@ -1715,28 +1725,28 @@
         '''
         # TODO: MAke this configurable. Also, we are breaking the above timer
         time.sleep( 60 )
-        main.log.debug( CLIs[0].nodes( jsonFormat=False ) )
-        main.log.debug( CLIs[0].leaders( jsonFormat=False ) )
-        main.log.debug( CLIs[0].partitions( jsonFormat=False ) )
+        main.log.debug( main.CLIs[0].nodes( jsonFormat=False ) )
+        main.log.debug( main.CLIs[0].leaders( jsonFormat=False ) )
+        main.log.debug( main.CLIs[0].partitions( jsonFormat=False ) )
 
     def CASE7( self, main ):
         """
         Check state after ONOS failure
         """
         import json
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         main.case( "Running ONOS Constant State Tests" )
 
         main.step( "Check that each switch has a master" )
         # Assert that each device has a master
         rolesNotNull = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].rolesNotNull,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].rolesNotNull,
                              name="rolesNotNull-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1756,8 +1766,8 @@
         consistentMastership = True
         rolesResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].roles,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].roles,
                              name="roles-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -1767,7 +1777,7 @@
             t.join()
             ONOSMastership.append( t.result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if not ONOSMastership[i] or "Error" in ONOSMastership[i]:
                 main.log.error( "Error in getting ONOS" + str( i + 1 ) +
                                  " roles" )
@@ -1794,7 +1804,7 @@
             onfail="ONOS nodes have different views of switch roles" )
 
         if rolesResults and not consistentMastership:
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 main.log.warn(
                     "ONOS" + str( i + 1 ) + " roles: ",
                     json.dumps(
@@ -1843,8 +1853,8 @@
         consistentIntents = True
         intentsResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].intents,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].intents,
                              name="intents-" + str( i ),
                              args=[],
                              kwargs={ 'jsonFormat': True } )
@@ -1855,7 +1865,7 @@
             t.join()
             ONOSIntents.append( t.result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if not ONOSIntents[ i ] or "Error" in ONOSIntents[ i ]:
                 main.log.error( "Error in getting ONOS" + str( i + 1 ) +
                                  " intents" )
@@ -1882,7 +1892,7 @@
         #  ...        ...         ...
         #  ...        ...         ...
         title = "   ID"
-        for n in range( numControllers ):
+        for n in range( main.numCtrls ):
             title += " " * 10 + "ONOS" + str( n + 1 )
         main.log.warn( title )
         # get all intent keys in the cluster
@@ -1922,7 +1932,7 @@
             main.log.info( dict( out ) )
 
         if intentsResults and not consistentIntents:
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 main.log.warn( "ONOS" + str( i + 1 ) + " intents: " )
                 main.log.warn( json.dumps(
                     json.loads( ONOSIntents[ i ] ),
@@ -2033,11 +2043,11 @@
         # Test of LeadershipElection
         leaderList = []
         # FIXME: make sure this matches nodes that were restarted
-        restarted = [ nodes[0].ip_address, nodes[1].ip_address,
-                      nodes[2].ip_address ]
+        restarted = [ main.nodes[0].ip_address, main.nodes[1].ip_address,
+                      main.nodes[2].ip_address ]
 
         leaderResult = main.TRUE
-        for cli in CLIs:
+        for cli in main.CLIs:
             leaderN = cli.electionTestLeader()
             leaderList.append( leaderN )
             if leaderN == main.FALSE:
@@ -2073,14 +2083,14 @@
         """
         import json
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         main.case( "Compare ONOS Topology view to Mininet topology" )
-        main.caseExplaination = "Compare topology objects between Mininet" +\
+        main.caseExplanation = "Compare topology objects between Mininet" +\
                                 " and ONOS"
 
         main.step( "Comparing ONOS topology to MN" )
@@ -2099,8 +2109,8 @@
             cliStart = time.time()
             devices = []
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].devices,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].devices,
                                  name="devices-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2112,8 +2122,8 @@
             hosts = []
             ipResult = main.TRUE
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].hosts,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].hosts,
                                  name="hosts-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2136,8 +2146,8 @@
                         ipResult = main.FALSE
             ports = []
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].ports,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].ports,
                                  name="ports-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2148,8 +2158,8 @@
                 ports.append( t.result )
             links = []
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].links,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].links,
                                  name="links-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2160,8 +2170,8 @@
                 links.append( t.result )
             clusters = []
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].clusters,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].clusters,
                                  name="clusters-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2179,7 +2189,7 @@
             mnSwitches = main.Mininet1.getSwitches()
             mnLinks = main.Mininet1.getLinks()
             mnHosts = main.Mininet1.getHosts()
-            for controller in range( numControllers ):
+            for controller in range( main.numCtrls ):
                 controllerStr = str( controller + 1 )
                 if devices[ controller ] and ports[ controller ] and\
                     "Error" not in devices[ controller ] and\
@@ -2432,8 +2442,8 @@
         nodesOutput = []
         nodeResults = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].nodes,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].nodes,
                              name="nodes-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -2442,7 +2452,7 @@
         for t in threads:
             t.join()
             nodesOutput.append( t.result )
-        ips = [ node.ip_address for node in nodes ]
+        ips = [ node.ip_address for node in main.nodes ]
         for i in nodesOutput:
             try:
                 current = json.loads( i )
@@ -2472,11 +2482,11 @@
         Link s3-s28 down
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         # NOTE: You should probably run a topology check after this
 
         linkSleep = float( main.params[ 'timers' ][ 'LinkDiscovery' ] )
@@ -2500,11 +2510,11 @@
         Link s3-s28 up
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         # NOTE: You should probably run a topology check after this
 
         linkSleep = float( main.params[ 'timers' ][ 'LinkDiscovery' ] )
@@ -2529,11 +2539,11 @@
         """
         # NOTE: You should probably run a topology check after this
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         switchSleep = float( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
 
@@ -2565,11 +2575,11 @@
         """
         # NOTE: You should probably run a topology check after this
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert ONOS1Port, "ONOS1Port not defined"
         assert ONOS2Port, "ONOS2Port not defined"
         assert ONOS3Port, "ONOS3Port not defined"
@@ -2590,8 +2600,8 @@
         for peer in links:
             main.Mininet1.addLink( switch, peer )
         ipList = []
-        for i in range( numControllers ):
-            ipList.append( nodes[ i ].ip_address )
+        for i in range( main.numCtrls ):
+            ipList.append( main.nodes[ i ].ip_address )
         main.Mininet1.assignSwController( sw=switch, ip=ipList )
         main.log.info( "Waiting " + str( switchSleep ) +
                        " seconds for switch up to be discovered" )
@@ -2612,11 +2622,11 @@
         """
         import os
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         # printing colors to terminal
         colors = { 'cyan': '\033[96m', 'purple': '\033[95m',
@@ -2642,7 +2652,7 @@
             # NOTE: must end in /
             dstDir = "~/packet_captures/"
             for f in logFiles:
-                for node in nodes:
+                for node in main.nodes:
                     main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
                                                     ":" + logFolder + f + " " +
                                                     teststationUser + "@" +
@@ -2658,7 +2668,7 @@
             # NOTE: must end in /
             dstDir = "~/packet_captures/"
             for f in logFiles:
-                for node in nodes:
+                for node in main.nodes:
                     main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
                                                     ":" + logFolder + f + " " +
                                                     teststationUser + "@" +
@@ -2678,7 +2688,7 @@
                                  onfail="MN cleanup NOT successful" )
 
         main.step( "Checking ONOS Logs for errors" )
-        for node in nodes:
+        for node in main.nodes:
             print colors[ 'purple' ] + "Checking logs for errors on " + \
                 node.name + ":" + colors[ 'end' ]
             print main.ONOSbench.checkLogs( node.ip_address, restart=True )
@@ -2697,11 +2707,11 @@
         """
         start election app on all onos nodes
         """
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         main.case("Start Leadership Election app")
         main.step( "Install leadership election app" )
@@ -2715,9 +2725,9 @@
         main.step( "Run for election on each node" )
         leaderResult = main.TRUE
         leaders = []
-        for cli in CLIs:
+        for cli in main.CLIs:
             cli.electionTestRun()
-        for cli in CLIs:
+        for cli in main.CLIs:
             leader = cli.electionTestLeader()
             if leader is None or leader == main.FALSE:
                 main.log.error( cli.name + ": Leader for the election app " +
@@ -2735,7 +2745,7 @@
         sameLeader = main.TRUE
         if len( set( leaders ) ) != 1:
             sameLeader = main.FALSE
-            main.log.error( "Results of electionTestLeader is order of CLIs:" +
+            main.log.error( "Results of electionTestLeader is order of main.CLIs:" +
                             str( leaders ) )
         utilities.assert_equals(
             expect=main.TRUE,
@@ -2748,11 +2758,11 @@
         Check that Leadership Election is still functional
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         leaderResult = main.TRUE
         description = "Check that Leadership Election is still functional"
@@ -2761,12 +2771,12 @@
         main.step( "Check that each node shows the same leader" )
         sameLeader = main.TRUE
         leaders = []
-        for cli in CLIs:
+        for cli in main.CLIs:
             leader = cli.electionTestLeader()
             leaders.append( leader )
         if len( set( leaders ) ) != 1:
             sameLeader = main.FALSE
-            main.log.error( "Results of electionTestLeader is order of CLIs:" +
+            main.log.error( "Results of electionTestLeader is order of main.CLIs:" +
                             str( leaders ) )
         utilities.assert_equals(
             expect=main.TRUE,
@@ -2784,9 +2794,9 @@
                 "instead got '" + str( leader ) + "'" )
             leaderResult = main.FALSE
             oldLeader = None
-        for i in range( len( CLIs ) ):
-            if leader == nodes[ i ].ip_address:
-                oldLeader = CLIs[ i ]
+        for i in range( len( main.CLIs ) ):
+            if leader == main.nodes[ i ].ip_address:
+                oldLeader = main.CLIs[ i ]
                 break
         else:  # FOR/ELSE statement
             main.log.error( "Leader election, could not find current leader" )
@@ -2801,7 +2811,7 @@
         main.step( "Make sure new leader is elected" )
         # FIXME: use threads
         leaderList = []
-        for cli in CLIs:
+        for cli in main.CLIs:
             leaderN = cli.electionTestLeader()
             leaderList.append( leaderN )
             if leaderN == leader:
@@ -2873,11 +2883,11 @@
         Install Distributed Primitives app
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         # Variables for the distributed primitives tests
         global pCounterName
@@ -2897,7 +2907,7 @@
         main.case( description )
         main.step( "Install Primitives app" )
         appName = "org.onosproject.distributedprimitives"
-        appResults = CLIs[0].activateApp( appName )
+        appResults = main.CLIs[0].activateApp( appName )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=appResults,
                                  onpass="Primitives app activated",
@@ -2908,13 +2918,12 @@
         """
         Check for basic functionality with distributed primitives
         """
-        import json
         # Make sure variables are defined/set
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert pCounterName, "pCounterName not defined"
         assert iCounterName, "iCounterName not defined"
         assert onosSetName, "onosSetName not defined"
@@ -2942,15 +2951,17 @@
         description = "Check for basic functionality with distributed " +\
                       "primitives"
         main.case( description )
-        main.caseExplaination = "Test the methods of the distributed primitives (counters and sets) throught the cli"
+        main.caseExplanation = "Test the methods of the distributed " +\
+                                "primitives (counters and sets) throught the cli"
         # DISTRIBUTED ATOMIC COUNTERS
-        main.step( "Increment and get a default counter on each node" )
+        # Partitioned counters
+        main.step( "Increment then get a default counter on each node" )
         pCounters = []
         threads = []
         addedPValues = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].counterTestIncrement,
-                             name="counterIncrement-" + str( i ),
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterAddAndGet-" + str( i ),
                              args=[ pCounterName ] )
             pCounterValue += 1
             addedPValues.append( pCounterValue )
@@ -2974,12 +2985,150 @@
                                  onfail="Error incrementing default" +
                                         " counter" )
 
-        main.step( "Increment and get an in memory counter on each node" )
+        main.step( "Get then Increment a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterGetAndAdd-" + str( i ),
+                             args=[ pCounterName ] )
+            addedPValues.append( pCounterValue )
+            pCounterValue += 1
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( pCounterName, pCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
+        main.step( "Add -8 to then get a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ pCounterName ],
+                             kwargs={ "delta": -8 } )
+            pCounterValue += -8
+            addedPValues.append( pCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Add 5 to then get a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ pCounterName ],
+                             kwargs={ "delta": 5 } )
+            pCounterValue += 5
+            addedPValues.append( pCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Get then add 5 to a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterIncrement-" + str( i ),
+                             args=[ pCounterName ],
+                             kwargs={ "delta": 5 } )
+            addedPValues.append( pCounterValue )
+            pCounterValue += 5
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( pCounterName, pCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
+        # In-Memory counters
+        main.step( "Increment and get an in-memory counter on each node" )
         iCounters = []
         addedIValues = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].counterTestIncrement,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
                              name="icounterIncrement-" + str( i ),
                              args=[ iCounterName ],
                              kwargs={ "inMemory": True } )
@@ -3001,15 +3150,153 @@
                                 "counter incremented results" )
         utilities.assert_equals( expect=True,
                                  actual=iCounterResults,
-                                 onpass="In memory counter incremented",
-                                 onfail="Error incrementing in memory" +
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
                                         " counter" )
 
+        main.step( "Get then Increment a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterGetAndAdd-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "inMemory": True } )
+            addedIValues.append( iCounterValue )
+            iCounterValue += 1
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=iCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( iCounterName, iCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
+        main.step( "Add -8 to then get a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "delta": -8, "inMemory": True  } )
+            iCounterValue += -8
+            addedIValues.append( iCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Add 5 to then get a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "delta": 5, "inMemory": True  } )
+            iCounterValue += 5
+            addedIValues.append( iCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Get then add 5 to a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterIncrement-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "delta": 5, "inMemory": True  } )
+            addedIValues.append( iCounterValue )
+            iCounterValue += 5
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=iCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( iCounterName, iCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
         main.step( "Check counters are consistant across nodes" )
         onosCounters = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].counters,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counters,
                              name="counters-" + str( i ) )
             threads.append( t )
             t.start()
@@ -3031,59 +3318,21 @@
                                         "across nodes" )
 
         main.step( "Counters we added have the correct values" )
-        correctResults = main.TRUE
-        for i in range( numControllers ):
-            try:
-                current = json.loads( onosCounters[i] )
-            except ( ValueError, TypeError ):
-                main.log.error( "Could not parse counters response from ONOS" +
-                                str( i + 1 ) )
-                main.log.warn( repr( onosCounters[ i ] ) )
-            pValue = None
-            iValue = None
-            try:
-                for database in current:
-                    partitioned = database.get( 'partitionedDatabaseCounters' )
-                    if partitioned:
-                        for value in partitioned:
-                            if value.get( 'name' ) == pCounterName:
-                                pValue = value.get( 'value' )
-                                break
-                    inMemory = database.get( 'inMemoryDatabaseCounters' )
-                    if inMemory:
-                        for value in inMemory:
-                            if value.get( 'name' ) == iCounterName:
-                                iValue = value.get( 'value' )
-                                break
-            except AttributeError, e:
-                main.log.error( "ONOS" + str( i + 1 ) + " counters result " +
-                                "is not as expected" )
-                correctResults = main.FALSE
-            if pValue == pCounterValue:
-                main.log.info( "Partitioned counter value is correct" )
-            else:
-                main.log.error( "Partitioned counter value is incorrect," +
-                                " expected value: " + str( pCounterValue )
-                                + " current value: " + str( pValue ) )
-                correctResults = main.FALSE
-            if iValue == iCounterValue:
-                main.log.info( "In memory counter value is correct" )
-            else:
-                main.log.error( "In memory counter value is incorrect, " +
-                                "expected value: " + str( iCounterValue ) +
-                                " current value: " + str( iValue ) )
-                correctResults = main.FALSE
+        incrementCheck = main.Counters.counterCheck( iCounterName, iCounterValue )
+        incrementCheck = incrementCheck and \
+                         main.Counters.counterCheck( iCounterName, iCounterValue )
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=correctResults,
+                                 actual=incrementCheck,
                                  onpass="Added counters are correct",
                                  onfail="Added counters are incorrect" )
+
         # DISTRIBUTED SETS
         main.step( "Distributed Set get" )
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3093,7 +3342,7 @@
             getResponses.append( t.result )
 
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3123,8 +3372,8 @@
         main.step( "Distributed Set size" )
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3134,7 +3383,7 @@
             sizeResponses.append( t.result )
 
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3150,8 +3399,8 @@
         onosSet.add( addValue )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAdd-" + str( i ),
                              args=[ onosSetName, addValue ] )
             threads.append( t )
@@ -3164,7 +3413,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3184,8 +3433,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3194,7 +3443,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3218,8 +3467,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3228,7 +3477,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3245,8 +3494,8 @@
         onosSet.update( addAllValue.split() )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAddAll-" + str( i ),
                              args=[ onosSetName, addAllValue ] )
             threads.append( t )
@@ -3259,7 +3508,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3279,8 +3528,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3289,7 +3538,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3313,8 +3562,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3323,7 +3572,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3339,8 +3588,8 @@
         main.step( "Distributed Set contains()" )
         containsResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setContains-" + str( i ),
                              args=[ onosSetName ],
                              kwargs={ "values": addValue } )
@@ -3352,7 +3601,7 @@
             containsResponses.append( t.result )
 
         containsResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if containsResponses[ i ] == main.ERROR:
                 containsResults = main.FALSE
             else:
@@ -3366,8 +3615,8 @@
         main.step( "Distributed Set containsAll()" )
         containsAllResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setContainsAll-" + str( i ),
                              args=[ onosSetName ],
                              kwargs={ "values": addAllValue } )
@@ -3379,7 +3628,7 @@
             containsAllResponses.append( t.result )
 
         containsAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if containsResponses[ i ] == main.ERROR:
                 containsResults = main.FALSE
             else:
@@ -3394,8 +3643,8 @@
         onosSet.remove( addValue )
         removeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestRemove,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestRemove,
                              name="setTestRemove-" + str( i ),
                              args=[ onosSetName, addValue ] )
             threads.append( t )
@@ -3408,7 +3657,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         removeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if removeResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3428,8 +3677,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3438,7 +3687,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3462,8 +3711,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3472,7 +3721,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3490,8 +3739,8 @@
         removeAllResponses = []
         threads = []
         try:
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].setTestRemove,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].setTestRemove,
                                  name="setTestRemoveAll-" + str( i ),
                                  args=[ onosSetName, addAllValue ] )
                 threads.append( t )
@@ -3506,7 +3755,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         removeAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if removeAllResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3526,8 +3775,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3536,7 +3785,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3560,8 +3809,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3570,7 +3819,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3587,8 +3836,8 @@
         onosSet.update( addAllValue.split() )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAddAll-" + str( i ),
                              args=[ onosSetName, addAllValue ] )
             threads.append( t )
@@ -3601,7 +3850,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3621,8 +3870,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3631,7 +3880,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3655,8 +3904,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3665,7 +3914,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3682,8 +3931,8 @@
         onosSet.clear()
         clearResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestRemove,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestRemove,
                              name="setTestClear-" + str( i ),
                              args=[ onosSetName, " "],  # Values doesn't matter
                              kwargs={ "clear": True } )
@@ -3697,7 +3946,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         clearResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if clearResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3717,8 +3966,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3727,7 +3976,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3751,8 +4000,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3761,7 +4010,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3778,8 +4027,8 @@
         onosSet.update( addAllValue.split() )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAddAll-" + str( i ),
                              args=[ onosSetName, addAllValue ] )
             threads.append( t )
@@ -3792,7 +4041,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3812,8 +4061,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3822,7 +4071,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3846,8 +4095,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3856,7 +4105,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3873,8 +4122,8 @@
         onosSet.intersection_update( retainValue.split() )
         retainResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestRemove,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestRemove,
                              name="setTestRetain-" + str( i ),
                              args=[ onosSetName, retainValue ],
                              kwargs={ "retain": True } )
@@ -3888,7 +4137,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         retainResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if retainResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3908,8 +4157,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3918,7 +4167,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3942,8 +4191,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3952,7 +4201,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
diff --git a/TestON/tests/HAminorityRestart/dependencies/Counters.py b/TestON/tests/HAminorityRestart/dependencies/Counters.py
new file mode 100644
index 0000000..7abd73a
--- /dev/null
+++ b/TestON/tests/HAminorityRestart/dependencies/Counters.py
@@ -0,0 +1,57 @@
+def __init__( self ):
+    self.default = ''
+
+def counterCheck( counterName, counterValue ):
+    """
+    Add Text here
+    """
+    import json
+    correctResults = main.TRUE
+    # Get onos counters results
+    onosCounters = []
+    threads = []
+    for i in range( main.numCtrls ):
+        t = main.Thread( target=main.CLIs[i].counters,
+                         name="counters-" + str( i ) )
+        threads.append( t )
+        t.start()
+    for t in threads:
+        t.join()
+        onosCounters.append( t.result )
+    tmp = [ i == onosCounters[ 0 ] for i in onosCounters ]
+    if all( tmp ):
+        consistent = main.TRUE
+    else:
+        consistent = main.FALSE
+        main.log.error( "ONOS nodes have different values for counters" )
+        for node in onosCounters:
+            main.log.debug( node )
+
+    # Check for correct values
+    for i in range( main.numCtrls ):
+        try:
+            current = json.loads( onosCounters[i] )
+        except ( ValueError, TypeError ):
+            main.log.error( "Could not parse counters response from ONOS" +
+                            str( i + 1 ) )
+            main.log.warn( repr( onosCounters[ i ] ) )
+        onosValue = None
+        try:
+            for database in current:
+                database = database.values()[0]
+                for counter in database:
+                    if counter.get( 'name' ) == counterName:
+                        onosValue = counter.get( 'value' )
+                        break
+        except AttributeError, e:
+            main.log.error( "ONOS" + str( i + 1 ) + " counters result " +
+                            "is not as expected" )
+            correctResults = main.FALSE
+        if onosValue == counterValue:
+            main.log.info( counterName + " counter value is correct" )
+        else:
+            main.log.error( counterName + " counter value is incorrect," +
+                            " expected value: " + str( counterValue )
+                            + " current value: " + str( onosValue ) )
+            correctResults = main.FALSE
+    return consistent and correctResults
diff --git a/TestON/tests/HAminorityRestart/dependencies/__init__.py b/TestON/tests/HAminorityRestart/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/HAminorityRestart/dependencies/__init__.py
diff --git a/TestON/tests/HAsanity/HAsanity.params b/TestON/tests/HAsanity/HAsanity.params
index 4ec3ad4..abc5385 100644
--- a/TestON/tests/HAsanity/HAsanity.params
+++ b/TestON/tests/HAsanity/HAsanity.params
@@ -17,8 +17,11 @@
     #CASE15: Check that Leadership Election is still functional
     #CASE16: Install Distributed Primitives app
     #CASE17: Check for basic functionality with distributed primitives
-    #1,2,8,3,4,5,14,16,17,[6],8,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13
+    #1,2,8,21,8,3,4,5,14,16,17,[6],8,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13
     <testcases>1,2,8,21,8,3,4,5,14,16,17,[6],8,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+    <imports>
+        <path> /home/admin/OnosSystemTest/TestON/tests/HAsanity/dependencies/ </path>
+    </imports>
     <ENV>
         <cellName>HA</cellName>
         <appString>drivers,openflow,proxyarp,mobility</appString>
diff --git a/TestON/tests/HAsanity/HAsanity.py b/TestON/tests/HAsanity/HAsanity.py
index c223c3f..b52943c 100644
--- a/TestON/tests/HAsanity/HAsanity.py
+++ b/TestON/tests/HAsanity/HAsanity.py
@@ -48,9 +48,10 @@
         start cli sessions
         start tcpdump
         """
+        import imp
         main.log.info( "ONOS HA Sanity test - initialization" )
         main.case( "Setting up test environment" )
-        main.caseExplaination = "Setup the test environment including " +\
+        main.caseExplanation = "Setup the test environment including " +\
                                 "installing ONOS, starting Mininet and ONOS" +\
                                 "cli sessions."
         # TODO: save all the timers and output them for plotting
@@ -62,13 +63,12 @@
         gitBranch = main.params[ 'branch' ]
         cellName = main.params[ 'ENV' ][ 'cellName' ]
 
-        # set global variables
-        global numControllers
-        numControllers = int( main.params[ 'num_controllers' ] )
+        main.numCtrls = int( main.params[ 'num_controllers' ] )
         if main.ONOSbench.maxNodes:
-            if main.ONOSbench.maxNodes < numControllers:
-                numControllers = int( main.ONOSbench.maxNodes )
+            if main.ONOSbench.maxNodes < main.numCtrls:
+                main.numCtrls = int( main.ONOSbench.maxNodes )
         # TODO: refactor how to get onos port, maybe put into component tag?
+        # set global variables
         global ONOS1Port
         global ONOS2Port
         global ONOS3Port
@@ -87,15 +87,26 @@
         ONOS6Port = main.params[ 'CTRL' ][ 'port6' ]
         ONOS7Port = main.params[ 'CTRL' ][ 'port7' ]
 
-        global CLIs
-        CLIs = []
-        global nodes
-        nodes = []
+        try:
+            fileName = "Counters"
+            path = main.params[ 'imports' ][ 'path' ]
+            main.Counters = imp.load_source( fileName,
+                                             path + fileName + ".py" )
+        except Exception as e:
+            main.log.exception( e )
+            main.cleanup()
+            main.exit()
+
+        main.CLIs = []
+        main.nodes = []
         ipList = []
-        for i in range( 1, numControllers + 1 ):
-            CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
-            nodes.append( getattr( main, 'ONOS' + str( i ) ) )
-            ipList.append( nodes[ -1 ].ip_address )
+        for i in range( 1, main.numCtrls + 1 ):
+            try:
+                main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+                main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+                ipList.append( main.nodes[ -1 ].ip_address )
+            except AttributeError:
+                break
 
         main.step( "Create cell file" )
         cellAppString = main.params[ 'ENV' ][ 'appString' ]
@@ -111,13 +122,13 @@
         main.ONOSbench.onosRemoveRaftLogs()
 
         main.log.info( "Uninstalling ONOS" )
-        for node in nodes:
+        for node in main.nodes:
             main.ONOSbench.onosUninstall( node.ip_address )
 
         # Make sure ONOS is DEAD
         main.log.info( "Killing any ONOS processes" )
         killResults = main.TRUE
-        for node in nodes:
+        for node in main.nodes:
             killed = main.ONOSbench.onosKill( node.ip_address )
             killResults = killResults and killed
 
@@ -184,7 +195,7 @@
 
         main.step( "Installing ONOS package" )
         onosInstallResult = main.TRUE
-        for node in nodes:
+        for node in main.nodes:
             tmpResult = main.ONOSbench.onosInstall( options="-f",
                                                     node=node.ip_address )
             onosInstallResult = onosInstallResult and tmpResult
@@ -195,7 +206,7 @@
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onosIsupResult = main.TRUE
-            for node in nodes:
+            for node in main.nodes:
                 started = main.ONOSbench.isup( node.ip_address )
                 if not started:
                     main.log.error( node.name + " didn't start!" )
@@ -211,10 +222,10 @@
         main.log.step( "Starting ONOS CLI sessions" )
         cliResults = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].startOnosCli,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].startOnosCli,
                              name="startOnosCli-" + str( i ),
-                             args=[nodes[i].ip_address] )
+                             args=[main.nodes[i].ip_address] )
             threads.append( t )
             t.start()
 
@@ -236,8 +247,8 @@
         main.step( "App Ids check" )
         appCheck = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].appToIDCheck,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].appToIDCheck,
                              name="appToIDCheck-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -247,8 +258,8 @@
             t.join()
             appCheck = appCheck and t.result
         if appCheck != main.TRUE:
-            main.log.warn( CLIs[0].apps() )
-            main.log.warn( CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
         utilities.assert_equals( expect=main.TRUE, actual=appCheck,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -263,12 +274,11 @@
         Assign devices to controllers
         """
         import re
-        import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert ONOS1Port, "ONOS1Port not defined"
         assert ONOS2Port, "ONOS2Port not defined"
         assert ONOS3Port, "ONOS3Port not defined"
@@ -278,14 +288,14 @@
         assert ONOS7Port, "ONOS7Port not defined"
 
         main.case( "Assigning devices to controllers" )
-        main.caseExplaination = "Assign switches to ONOS using 'ovs-vsctl' " +\
+        main.caseExplanation = "Assign switches to ONOS using 'ovs-vsctl' " +\
                                 "and check that an ONOS node becomes the " +\
                                 "master of the device."
         main.step( "Assign switches to controllers" )
 
         ipList = []
-        for i in range( numControllers ):
-            ipList.append( nodes[ i ].ip_address )
+        for i in range( main.numCtrls ):
+            ipList.append( main.nodes[ i ].ip_address )
         swList = []
         for i in range( 1, 29 ):
             swList.append( "s" + str( i ) )
@@ -298,7 +308,7 @@
                 main.log.info( str( response ) )
             except Exception:
                 main.log.info( repr( response ) )
-            for node in nodes:
+            for node in main.nodes:
                 if re.search( "tcp:" + node.ip_address, response ):
                     mastershipCheck = mastershipCheck and main.TRUE
                 else:
@@ -316,13 +326,12 @@
         """
         Assign mastership to controllers
         """
-        import re
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert ONOS1Port, "ONOS1Port not defined"
         assert ONOS2Port, "ONOS2Port not defined"
         assert ONOS3Port, "ONOS3Port not defined"
@@ -332,7 +341,7 @@
         assert ONOS7Port, "ONOS7Port not defined"
 
         main.case( "Assigning Controller roles for switches" )
-        main.caseExplaination = "Check that ONOS is connected to each " +\
+        main.caseExplanation = "Check that ONOS is connected to each " +\
                                 "device. Then manually assign" +\
                                 " mastership to specific ONOS nodes using" +\
                                 " 'device-role'"
@@ -350,45 +359,45 @@
                 # set up correct variables:
                 if i == 1:
                     c = 0
-                    ip = nodes[ c ].ip_address  # ONOS1
+                    ip = main.nodes[ c ].ip_address  # ONOS1
                     deviceId = main.ONOScli1.getDevice( "1000" ).get( 'id' )
                 elif i == 2:
-                    c = 1 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS2
+                    c = 1 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS2
                     deviceId = main.ONOScli1.getDevice( "2000" ).get( 'id' )
                 elif i == 3:
-                    c = 1 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS2
+                    c = 1 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS2
                     deviceId = main.ONOScli1.getDevice( "3000" ).get( 'id' )
                 elif i == 4:
-                    c = 3 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS4
+                    c = 3 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS4
                     deviceId = main.ONOScli1.getDevice( "3004" ).get( 'id' )
                 elif i == 5:
-                    c = 2 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS3
+                    c = 2 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS3
                     deviceId = main.ONOScli1.getDevice( "5000" ).get( 'id' )
                 elif i == 6:
-                    c = 2 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS3
+                    c = 2 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS3
                     deviceId = main.ONOScli1.getDevice( "6000" ).get( 'id' )
                 elif i == 7:
-                    c = 5 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS6
+                    c = 5 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS6
                     deviceId = main.ONOScli1.getDevice( "6007" ).get( 'id' )
                 elif i >= 8 and i <= 17:
-                    c = 4 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS5
+                    c = 4 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS5
                     dpid = '3' + str( i ).zfill( 3 )
                     deviceId = main.ONOScli1.getDevice( dpid ).get( 'id' )
                 elif i >= 18 and i <= 27:
-                    c = 6 % numControllers
-                    ip = nodes[ c ].ip_address  # ONOS7
+                    c = 6 % main.numCtrls
+                    ip = main.nodes[ c ].ip_address  # ONOS7
                     dpid = '6' + str( i ).zfill( 3 )
                     deviceId = main.ONOScli1.getDevice( dpid ).get( 'id' )
                 elif i == 28:
                     c = 0
-                    ip = nodes[ c ].ip_address  # ONOS1
+                    ip = main.nodes[ c ].ip_address  # ONOS1
                     deviceId = main.ONOScli1.getDevice( "2800" ).get( 'id' )
                 else:
                     main.log.error( "You didn't write an else statement for " +
@@ -441,13 +450,13 @@
         """
         import time
         import json
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         main.case( "Adding host Intents" )
-        main.caseExplaination = "Discover hosts by using pingall then " +\
+        main.caseExplanation = "Discover hosts by using pingall then " +\
                                 "assign predetermined host-to-host intents." +\
                                 " After installation, check that the intent" +\
                                 " is distributed to all nodes and the state" +\
@@ -455,7 +464,7 @@
 
         # install onos-app-fwd
         main.step( "Install reactive forwarding app" )
-        installResults = CLIs[0].activateApp( "org.onosproject.fwd" )
+        installResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
         utilities.assert_equals( expect=main.TRUE, actual=installResults,
                                  onpass="Install fwd successful",
                                  onfail="Install fwd failed" )
@@ -463,8 +472,8 @@
         main.step( "Check app ids" )
         appCheck = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].appToIDCheck,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].appToIDCheck,
                              name="appToIDCheck-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -474,8 +483,8 @@
             t.join()
             appCheck = appCheck and t.result
         if appCheck != main.TRUE:
-            main.log.warn( CLIs[0].apps() )
-            main.log.warn( CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
         utilities.assert_equals( expect=main.TRUE, actual=appCheck,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -501,7 +510,7 @@
         time.sleep( 11 )
         # uninstall onos-app-fwd
         main.step( "Uninstall reactive forwarding app" )
-        uninstallResult = CLIs[0].deactivateApp( "org.onosproject.fwd" )
+        uninstallResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
         utilities.assert_equals( expect=main.TRUE, actual=uninstallResult,
                                  onpass="Uninstall fwd successful",
                                  onfail="Uninstall fwd failed" )
@@ -514,8 +523,8 @@
         main.step( "Check app ids" )
         threads = []
         appCheck2 = main.TRUE
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].appToIDCheck,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].appToIDCheck,
                              name="appToIDCheck-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -525,8 +534,8 @@
             t.join()
             appCheck2 = appCheck2 and t.result
         if appCheck2 != main.TRUE:
-            main.log.warn( CLIs[0].apps() )
-            main.log.warn( CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
         utilities.assert_equals( expect=main.TRUE, actual=appCheck2,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -553,8 +562,8 @@
                 host1Id = host1Dict.get( 'id', None )
                 host2Id = host2Dict.get( 'id', None )
             if host1Id and host2Id:
-                nodeNum = ( i % numControllers )
-                tmpId = CLIs[ nodeNum ].addHostIntent( host1Id, host2Id )
+                nodeNum = ( i % main.numCtrls )
+                tmpId = main.CLIs[ nodeNum ].addHostIntent( host1Id, host2Id )
                 if tmpId:
                     main.log.info( "Added intent with id: " + tmpId )
                     intentIds.append( tmpId )
@@ -564,7 +573,7 @@
             else:
                 main.log.error( "Error, getHost() failed for h" + str( i ) +
                                 " and/or h" + str( i + 10 ) )
-                hosts = CLIs[ 0 ].hosts()
+                hosts = main.CLIs[ 0 ].hosts()
                 main.log.warn( "Hosts output: " )
                 try:
                     main.log.warn( json.dumps( json.loads( hosts ),
@@ -645,7 +654,7 @@
             main.log.error( repr( leaders ) )
         # Check all nodes
         if missing:
-            for node in CLIs:
+            for node in main.CLIs:
                 response = node.leaders( jsonFormat=False)
                 main.log.warn( str( node.name ) + " leaders output: \n" +
                                str( response ) )
@@ -689,7 +698,7 @@
         for i in range(100):
             correct = True
             main.log.info( "Submitted intents: " + str( sorted( intentIds ) ) )
-            for cli in CLIs:
+            for cli in main.CLIs:
                 onosIds = []
                 ids = cli.getAllIntentsId()
                 onosIds.append( ids )
@@ -790,7 +799,7 @@
                 main.log.error( repr( leaders ) )
             # Check all nodes
             if missing:
-                for node in CLIs:
+                for node in main.CLIs:
                     response = node.leaders( jsonFormat=False)
                     main.log.warn( str( node.name ) + " leaders output: \n" +
                                    str( response ) )
@@ -831,13 +840,13 @@
         """
         import json
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         main.case( "Verify connectivity by sendind traffic across Intents" )
-        main.caseExplaination = "Ping across added host intents to check " +\
+        main.caseExplanation = "Ping across added host intents to check " +\
                                 "functionality and check the state of " +\
                                 "the intent"
         main.step( "Ping across added host intents" )
@@ -941,7 +950,7 @@
             # TODO: Check for a leader of these topics
         # Check all nodes
         if topicCheck:
-            for node in CLIs:
+            for node in main.CLIs:
                 response = node.leaders( jsonFormat=False)
                 main.log.warn( str( node.name ) + " leaders output: \n" +
                                str( response ) )
@@ -1034,7 +1043,7 @@
                 main.log.exception( "Error parsing leaders" )
                 main.log.error( repr( leaders ) )
             if missing:
-                for node in CLIs:
+                for node in main.CLIs:
                     response = node.leaders( jsonFormat=False)
                     main.log.warn( str( node.name ) + " leaders output: \n" +
                                    str( response ) )
@@ -1069,7 +1078,7 @@
                 main.log.exception( "Error parsing pending map" )
                 main.log.error( repr( pendingMap ) )
         # Print flowrules
-        main.log.debug( CLIs[0].flows( jsonFormat=False ) )
+        main.log.debug( main.CLIs[0].flows( jsonFormat=False ) )
         main.step( "Wait a minute then ping again" )
         # the wait is above
         PingResult = main.TRUE
@@ -1108,11 +1117,11 @@
         """
         import json
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         main.case( "Setting up and gathering data for current state" )
         # The general idea for this test case is to pull the state of
@@ -1126,8 +1135,8 @@
         # Assert that each device has a master
         rolesNotNull = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].rolesNotNull,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].rolesNotNull,
                              name="rolesNotNull-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -1148,8 +1157,8 @@
         consistentMastership = True
         rolesResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].roles,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].roles,
                              name="roles-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -1159,7 +1168,7 @@
             t.join()
             ONOSMastership.append( t.result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if not ONOSMastership[i] or "Error" in ONOSMastership[i]:
                 main.log.error( "Error in getting ONOS" + str( i + 1 ) +
                                  " roles" )
@@ -1186,7 +1195,7 @@
             onfail="ONOS nodes have different views of switch roles" )
 
         if rolesResults and not consistentMastership:
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 try:
                     main.log.warn(
                         "ONOS" + str( i + 1 ) + " roles: ",
@@ -1209,8 +1218,8 @@
         consistentIntents = True
         intentsResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].intents,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].intents,
                              name="intents-" + str( i ),
                              args=[],
                              kwargs={ 'jsonFormat': True } )
@@ -1221,7 +1230,7 @@
             t.join()
             ONOSIntents.append( t.result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if not ONOSIntents[ i ] or "Error" in ONOSIntents[ i ]:
                 main.log.error( "Error in getting ONOS" + str( i + 1 ) +
                                  " intents" )
@@ -1255,9 +1264,10 @@
             #  ...        ...         ...
             #  ...        ...         ...
             title = "   Id"
-            for n in range( numControllers ):
+            for n in range( main.numCtrls ):
                 title += " " * 10 + "ONOS" + str( n + 1 )
             main.log.warn( title )
+            # get all intent keys in the cluster
             keys = []
             try:
                 # Get the set of all intent keys
@@ -1288,7 +1298,7 @@
                                         sort_keys=True,
                                         indent=4,
                                         separators=( ',', ': ' ) ) )
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 if ONOSIntents[ i ] != ONOSIntents[ -1 ]:
                     main.log.debug( "ONOS" + str( i + 1 ) + " intents: " )
                     main.log.debug( json.dumps( json.loads( ONOSIntents[i] ),
@@ -1296,7 +1306,7 @@
                                                 indent=4,
                                                 separators=( ',', ': ' ) ) )
                 else:
-                    main.log.debug( nodes[ i ].name + " intents match ONOS" +
+                    main.log.debug( main.nodes[ i ].name + " intents match ONOS" +
                                     str( n ) + " intents" )
         elif intentsResults and consistentIntents:
             intentCheck = main.TRUE
@@ -1311,8 +1321,8 @@
         consistentFlows = True
         flowsResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].flows,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].flows,
                              name="flows-" + str( i ),
                              args=[],
                              kwargs={ 'jsonFormat': True } )
@@ -1326,7 +1336,7 @@
             result = t.result
             ONOSFlows.append( result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             num = str( i + 1 )
             if not ONOSFlows[ i ] or "Error" in ONOSFlows[ i ]:
                 main.log.error( "Error in getting ONOS" + num + " flows" )
@@ -1363,7 +1373,7 @@
             onfail="ONOS nodes have different flow counts" )
 
         if flowsResults and not consistentFlows:
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 try:
                     main.log.warn(
                         "ONOS" + str( i + 1 ) + " flows: " +
@@ -1432,8 +1442,8 @@
         main.step( "Collecting topology information from ONOS" )
         devices = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].devices,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].devices,
                              name="devices-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1444,8 +1454,8 @@
             devices.append( t.result )
         hosts = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].hosts,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].hosts,
                              name="hosts-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1464,8 +1474,8 @@
 
         ports = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].ports,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].ports,
                              name="ports-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1476,8 +1486,8 @@
             ports.append( t.result )
         links = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].links,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].links,
                              name="links-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1488,8 +1498,8 @@
             links.append( t.result )
         clusters = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].clusters,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].clusters,
                              name="clusters-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1591,7 +1601,7 @@
         mnSwitches = main.Mininet1.getSwitches()
         mnLinks = main.Mininet1.getLinks()
         mnHosts = main.Mininet1.getHosts()
-        for controller in range( numControllers ):
+        for controller in range( main.numCtrls ):
             controllerStr = str( controller + 1 )
             if devices[ controller ] and ports[ controller ] and\
                 "Error" not in devices[ controller ] and\
@@ -1665,11 +1675,11 @@
         The Failure case. Since this is the Sanity test, we do nothing.
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         main.case( "Wait 60 seconds instead of inducing a failure" )
         time.sleep( 60 )
         utilities.assert_equals(
@@ -1683,19 +1693,19 @@
         Check state after ONOS failure
         """
         import json
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         main.case( "Running ONOS Constant State Tests" )
 
         main.step( "Check that each switch has a master" )
         # Assert that each device has a master
         rolesNotNull = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].rolesNotNull,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].rolesNotNull,
                              name="rolesNotNull-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -1716,8 +1726,8 @@
         consistentMastership = True
         rolesResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].roles,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].roles,
                              name="roles-" + str( i ),
                              args=[] )
             threads.append( t )
@@ -1727,7 +1737,7 @@
             t.join()
             ONOSMastership.append( t.result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if not ONOSMastership[i] or "Error" in ONOSMastership[i]:
                 main.log.error( "Error in getting ONOS" + str( i + 1 ) +
                                  " roles" )
@@ -1754,7 +1764,7 @@
             onfail="ONOS nodes have different views of switch roles" )
 
         if rolesResults and not consistentMastership:
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 main.log.warn(
                     "ONOS" + str( i + 1 ) + " roles: ",
                     json.dumps(
@@ -1803,8 +1813,8 @@
         consistentIntents = True
         intentsResults = True
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].intents,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].intents,
                              name="intents-" + str( i ),
                              args=[],
                              kwargs={ 'jsonFormat': True } )
@@ -1815,7 +1825,7 @@
             t.join()
             ONOSIntents.append( t.result )
 
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if not ONOSIntents[ i ] or "Error" in ONOSIntents[ i ]:
                 main.log.error( "Error in getting ONOS" + str( i + 1 ) +
                                  " intents" )
@@ -1842,7 +1852,7 @@
         #  ...        ...         ...
         #  ...        ...         ...
         title = "   ID"
-        for n in range( numControllers ):
+        for n in range( main.numCtrls ):
             title += " " * 10 + "ONOS" + str( n + 1 )
         main.log.warn( title )
         # get all intent keys in the cluster
@@ -1882,7 +1892,7 @@
             main.log.info( dict( out ) )
 
         if intentsResults and not consistentIntents:
-            for i in range( numControllers ):
+            for i in range( main.numCtrls ):
                 main.log.warn( "ONOS" + str( i + 1 ) + " intents: " )
                 main.log.warn( json.dumps(
                     json.loads( ONOSIntents[ i ] ),
@@ -1993,9 +2003,9 @@
         # Test of LeadershipElection
         # NOTE: this only works for the sanity test. In case of failures,
         #       leader will likely change
-        leader = nodes[ 0 ].ip_address
+        leader = main.nodes[ 0 ].ip_address
         leaderResult = main.TRUE
-        for cli in CLIs:
+        for cli in main.CLIs:
             leaderN = cli.electionTestLeader()
             # verify leader is ONOS1
             if leaderN == leader:
@@ -2026,14 +2036,14 @@
         """
         import json
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         main.case( "Compare ONOS Topology view to Mininet topology" )
-        main.caseExplaination = "Compare topology objects between Mininet" +\
+        main.caseExplanation = "Compare topology objects between Mininet" +\
                                 " and ONOS"
 
         main.step( "Comparing ONOS topology to MN" )
@@ -2052,8 +2062,8 @@
             cliStart = time.time()
             devices = []
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].devices,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].devices,
                                  name="devices-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2065,8 +2075,8 @@
             hosts = []
             ipResult = main.TRUE
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].hosts,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].hosts,
                                  name="hosts-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2089,8 +2099,8 @@
                         ipResult = main.FALSE
             ports = []
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].ports,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].ports,
                                  name="ports-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2101,8 +2111,8 @@
                 ports.append( t.result )
             links = []
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].links,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].links,
                                  name="links-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2113,8 +2123,8 @@
                 links.append( t.result )
             clusters = []
             threads = []
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].clusters,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].clusters,
                                  name="clusters-" + str( i ),
                                  args=[ ] )
                 threads.append( t )
@@ -2132,7 +2142,7 @@
             mnSwitches = main.Mininet1.getSwitches()
             mnLinks = main.Mininet1.getLinks()
             mnHosts = main.Mininet1.getHosts()
-            for controller in range( numControllers ):
+            for controller in range( main.numCtrls ):
                 controllerStr = str( controller + 1 )
                 if devices[ controller ] and ports[ controller ] and\
                     "Error" not in devices[ controller ] and\
@@ -2395,8 +2405,8 @@
         nodesOutput = []
         nodeResults = main.TRUE
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].nodes,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].nodes,
                              name="nodes-" + str( i ),
                              args=[ ] )
             threads.append( t )
@@ -2405,7 +2415,7 @@
         for t in threads:
             t.join()
             nodesOutput.append( t.result )
-        ips = [ node.ip_address for node in nodes ]
+        ips = [ node.ip_address for node in main.nodes ]
         for i in nodesOutput:
             try:
                 current = json.loads( i )
@@ -2435,11 +2445,11 @@
         Link s3-s28 down
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         # NOTE: You should probably run a topology check after this
 
         linkSleep = float( main.params[ 'timers' ][ 'LinkDiscovery' ] )
@@ -2463,11 +2473,11 @@
         Link s3-s28 up
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         # NOTE: You should probably run a topology check after this
 
         linkSleep = float( main.params[ 'timers' ][ 'LinkDiscovery' ] )
@@ -2492,11 +2502,11 @@
         """
         # NOTE: You should probably run a topology check after this
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         switchSleep = float( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
 
@@ -2528,11 +2538,11 @@
         """
         # NOTE: You should probably run a topology check after this
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert ONOS1Port, "ONOS1Port not defined"
         assert ONOS2Port, "ONOS2Port not defined"
         assert ONOS3Port, "ONOS3Port not defined"
@@ -2553,8 +2563,8 @@
         for peer in links:
             main.Mininet1.addLink( switch, peer )
         ipList = []
-        for i in range( numControllers ):
-            ipList.append( nodes[ i ].ip_address )
+        for i in range( main.numCtrls ):
+            ipList.append( main.nodes[ i ].ip_address )
         main.Mininet1.assignSwController( sw=switch, ip=ipList )
         main.log.info( "Waiting " + str( switchSleep ) +
                        " seconds for switch up to be discovered" )
@@ -2575,11 +2585,11 @@
         """
         import os
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         # printing colors to terminal
         colors = { 'cyan': '\033[96m', 'purple': '\033[95m',
@@ -2605,7 +2615,7 @@
             # NOTE: must end in /
             dstDir = "~/packet_captures/"
             for f in logFiles:
-                for node in nodes:
+                for node in main.nodes:
                     main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
                                                     ":" + logFolder + f + " " +
                                                     teststationUser + "@" +
@@ -2621,7 +2631,7 @@
             # NOTE: must end in /
             dstDir = "~/packet_captures/"
             for f in logFiles:
-                for node in nodes:
+                for node in main.nodes:
                     main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
                                                     ":" + logFolder + f + " " +
                                                     teststationUser + "@" +
@@ -2641,7 +2651,7 @@
                                  onfail="MN cleanup NOT successful" )
 
         main.step( "Checking ONOS Logs for errors" )
-        for node in nodes:
+        for node in main.nodes:
             print colors[ 'purple' ] + "Checking logs for errors on " + \
                 node.name + ":" + colors[ 'end' ]
             print main.ONOSbench.checkLogs( node.ip_address )
@@ -2660,11 +2670,11 @@
         """
         start election app on all onos nodes
         """
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         main.case("Start Leadership Election app")
         main.step( "Install leadership election app" )
@@ -2678,9 +2688,9 @@
         main.step( "Run for election on each node" )
         leaderResult = main.TRUE
         leaders = []
-        for cli in CLIs:
+        for cli in main.CLIs:
             cli.electionTestRun()
-        for cli in CLIs:
+        for cli in main.CLIs:
             leader = cli.electionTestLeader()
             if leader is None or leader == main.FALSE:
                 main.log.error( cli.name + ": Leader for the election app " +
@@ -2698,7 +2708,7 @@
         sameLeader = main.TRUE
         if len( set( leaders ) ) != 1:
             sameLeader = main.FALSE
-            main.log.error( "Results of electionTestLeader is order of CLIs:" +
+            main.log.error( "Results of electionTestLeader is order of main.CLIs:" +
                             str( leaders ) )
         utilities.assert_equals(
             expect=main.TRUE,
@@ -2711,11 +2721,11 @@
         Check that Leadership Election is still functional
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         leaderResult = main.TRUE
         description = "Check that Leadership Election is still functional"
@@ -2724,12 +2734,12 @@
         main.step( "Check that each node shows the same leader" )
         sameLeader = main.TRUE
         leaders = []
-        for cli in CLIs:
+        for cli in main.CLIs:
             leader = cli.electionTestLeader()
             leaders.append( leader )
         if len( set( leaders ) ) != 1:
             sameLeader = main.FALSE
-            main.log.error( "Results of electionTestLeader is order of CLIs:" +
+            main.log.error( "Results of electionTestLeader is order of main.CLIs:" +
                             str( leaders ) )
         utilities.assert_equals(
             expect=main.TRUE,
@@ -2747,9 +2757,9 @@
                 "instead got '" + str( leader ) + "'" )
             leaderResult = main.FALSE
             oldLeader = None
-        for i in range( len( CLIs ) ):
-            if leader == nodes[ i ].ip_address:
-                oldLeader = CLIs[ i ]
+        for i in range( len( main.CLIs ) ):
+            if leader == main.nodes[ i ].ip_address:
+                oldLeader = main.CLIs[ i ]
                 break
         else:  # FOR/ELSE statement
             main.log.error( "Leader election, could not find current leader" )
@@ -2764,7 +2774,7 @@
         main.step( "Make sure new leader is elected" )
         # FIXME: use threads
         leaderList = []
-        for cli in CLIs:
+        for cli in main.CLIs:
             leaderN = cli.electionTestLeader()
             leaderList.append( leaderN )
             if leaderN == leader:
@@ -2836,11 +2846,11 @@
         Install Distributed Primitives app
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         # Variables for the distributed primitives tests
         global pCounterName
@@ -2860,7 +2870,7 @@
         main.case( description )
         main.step( "Install Primitives app" )
         appName = "org.onosproject.distributedprimitives"
-        appResults = CLIs[0].activateApp( appName )
+        appResults = main.CLIs[0].activateApp( appName )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=appResults,
                                  onpass="Primitives app activated",
@@ -2871,13 +2881,12 @@
         """
         Check for basic functionality with distributed primitives
         """
-        import json
         # Make sure variables are defined/set
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert pCounterName, "pCounterName not defined"
         assert iCounterName, "iCounterName not defined"
         assert onosSetName, "onosSetName not defined"
@@ -2905,15 +2914,17 @@
         description = "Check for basic functionality with distributed " +\
                       "primitives"
         main.case( description )
-        main.caseExplaination = "Test the methods of the distributed primitives (counters and sets) throught the cli"
+        main.caseExplanation = "Test the methods of the distributed " +\
+                                "primitives (counters and sets) throught the cli"
         # DISTRIBUTED ATOMIC COUNTERS
-        main.step( "Increment and get a default counter on each node" )
+        # Partitioned counters
+        main.step( "Increment then get a default counter on each node" )
         pCounters = []
         threads = []
         addedPValues = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].counterTestIncrement,
-                             name="counterIncrement-" + str( i ),
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterAddAndGet-" + str( i ),
                              args=[ pCounterName ] )
             pCounterValue += 1
             addedPValues.append( pCounterValue )
@@ -2937,12 +2948,150 @@
                                  onfail="Error incrementing default" +
                                         " counter" )
 
-        main.step( "Increment and get an in memory counter on each node" )
+        main.step( "Get then Increment a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterGetAndAdd-" + str( i ),
+                             args=[ pCounterName ] )
+            addedPValues.append( pCounterValue )
+            pCounterValue += 1
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( pCounterName, pCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
+        main.step( "Add -8 to then get a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ pCounterName ],
+                             kwargs={ "delta": -8 } )
+            pCounterValue += -8
+            addedPValues.append( pCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Add 5 to then get a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ pCounterName ],
+                             kwargs={ "delta": 5 } )
+            pCounterValue += 5
+            addedPValues.append( pCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Get then add 5 to a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterIncrement-" + str( i ),
+                             args=[ pCounterName ],
+                             kwargs={ "delta": 5 } )
+            addedPValues.append( pCounterValue )
+            pCounterValue += 5
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( pCounterName, pCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
+        # In-Memory counters
+        main.step( "Increment and get an in-memory counter on each node" )
         iCounters = []
         addedIValues = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].counterTestIncrement,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
                              name="icounterIncrement-" + str( i ),
                              args=[ iCounterName ],
                              kwargs={ "inMemory": True } )
@@ -2964,15 +3113,153 @@
                                 "counter incremented results" )
         utilities.assert_equals( expect=True,
                                  actual=iCounterResults,
-                                 onpass="In memory counter incremented",
-                                 onfail="Error incrementing in memory" +
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
                                         " counter" )
 
+        main.step( "Get then Increment a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterGetAndAdd-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "inMemory": True } )
+            addedIValues.append( iCounterValue )
+            iCounterValue += 1
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=iCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( iCounterName, iCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
+        main.step( "Add -8 to then get a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "delta": -8, "inMemory": True  } )
+            iCounterValue += -8
+            addedIValues.append( iCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Add 5 to then get a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "delta": 5, "inMemory": True  } )
+            iCounterValue += 5
+            addedIValues.append( iCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Get then add 5 to a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterIncrement-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "delta": 5, "inMemory": True  } )
+            addedIValues.append( iCounterValue )
+            iCounterValue += 5
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=iCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( iCounterName, iCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
         main.step( "Check counters are consistant across nodes" )
         onosCounters = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].counters,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counters,
                              name="counters-" + str( i ) )
             threads.append( t )
             t.start()
@@ -2994,59 +3281,21 @@
                                         "across nodes" )
 
         main.step( "Counters we added have the correct values" )
-        correctResults = main.TRUE
-        for i in range( numControllers ):
-            try:
-                current = json.loads( onosCounters[i] )
-            except ( ValueError, TypeError ):
-                main.log.error( "Could not parse counters response from ONOS" +
-                                str( i + 1 ) )
-                main.log.warn( repr( onosCounters[ i ] ) )
-            pValue = None
-            iValue = None
-            try:
-                for database in current:
-                    partitioned = database.get( 'partitionedDatabaseCounters' )
-                    if partitioned:
-                        for value in partitioned:
-                            if value.get( 'name' ) == pCounterName:
-                                pValue = value.get( 'value' )
-                                break
-                    inMemory = database.get( 'inMemoryDatabaseCounters' )
-                    if inMemory:
-                        for value in inMemory:
-                            if value.get( 'name' ) == iCounterName:
-                                iValue = value.get( 'value' )
-                                break
-            except AttributeError, e:
-                main.log.error( "ONOS" + str( i + 1 ) + " counters result " +
-                                "is not as expected" )
-                correctResults = main.FALSE
-            if pValue == pCounterValue:
-                main.log.info( "Partitioned counter value is correct" )
-            else:
-                main.log.error( "Partitioned counter value is incorrect," +
-                                " expected value: " + str( pCounterValue )
-                                + " current value: " + str( pValue ) )
-                correctResults = main.FALSE
-            if iValue == iCounterValue:
-                main.log.info( "In memory counter value is correct" )
-            else:
-                main.log.error( "In memory counter value is incorrect, " +
-                                "expected value: " + str( iCounterValue ) +
-                                " current value: " + str( iValue ) )
-                correctResults = main.FALSE
+        incrementCheck = main.Counters.counterCheck( iCounterName, iCounterValue )
+        incrementCheck = incrementCheck and \
+                         main.Counters.counterCheck( iCounterName, iCounterValue )
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=correctResults,
+                                 actual=incrementCheck,
                                  onpass="Added counters are correct",
                                  onfail="Added counters are incorrect" )
+
         # DISTRIBUTED SETS
         main.step( "Distributed Set get" )
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3056,7 +3305,7 @@
             getResponses.append( t.result )
 
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3086,8 +3335,8 @@
         main.step( "Distributed Set size" )
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3097,7 +3346,7 @@
             sizeResponses.append( t.result )
 
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3113,8 +3362,8 @@
         onosSet.add( addValue )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAdd-" + str( i ),
                              args=[ onosSetName, addValue ] )
             threads.append( t )
@@ -3127,7 +3376,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3147,8 +3396,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3157,7 +3406,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3181,8 +3430,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3191,7 +3440,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3208,8 +3457,8 @@
         onosSet.update( addAllValue.split() )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAddAll-" + str( i ),
                              args=[ onosSetName, addAllValue ] )
             threads.append( t )
@@ -3222,7 +3471,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3242,8 +3491,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3252,7 +3501,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3276,8 +3525,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3286,7 +3535,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3302,8 +3551,8 @@
         main.step( "Distributed Set contains()" )
         containsResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setContains-" + str( i ),
                              args=[ onosSetName ],
                              kwargs={ "values": addValue } )
@@ -3315,7 +3564,7 @@
             containsResponses.append( t.result )
 
         containsResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if containsResponses[ i ] == main.ERROR:
                 containsResults = main.FALSE
             else:
@@ -3329,8 +3578,8 @@
         main.step( "Distributed Set containsAll()" )
         containsAllResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setContainsAll-" + str( i ),
                              args=[ onosSetName ],
                              kwargs={ "values": addAllValue } )
@@ -3342,7 +3591,7 @@
             containsAllResponses.append( t.result )
 
         containsAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if containsResponses[ i ] == main.ERROR:
                 containsResults = main.FALSE
             else:
@@ -3357,8 +3606,8 @@
         onosSet.remove( addValue )
         removeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestRemove,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestRemove,
                              name="setTestRemove-" + str( i ),
                              args=[ onosSetName, addValue ] )
             threads.append( t )
@@ -3371,7 +3620,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         removeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if removeResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3391,8 +3640,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3401,7 +3650,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3425,8 +3674,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3435,7 +3684,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3453,8 +3702,8 @@
         removeAllResponses = []
         threads = []
         try:
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].setTestRemove,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].setTestRemove,
                                  name="setTestRemoveAll-" + str( i ),
                                  args=[ onosSetName, addAllValue ] )
                 threads.append( t )
@@ -3469,7 +3718,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         removeAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if removeAllResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3489,8 +3738,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3499,7 +3748,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3523,8 +3772,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3533,7 +3782,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3550,8 +3799,8 @@
         onosSet.update( addAllValue.split() )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAddAll-" + str( i ),
                              args=[ onosSetName, addAllValue ] )
             threads.append( t )
@@ -3564,7 +3813,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3584,8 +3833,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3594,7 +3843,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3618,8 +3867,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3628,7 +3877,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3645,8 +3894,8 @@
         onosSet.clear()
         clearResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestRemove,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestRemove,
                              name="setTestClear-" + str( i ),
                              args=[ onosSetName, " "],  # Values doesn't matter
                              kwargs={ "clear": True } )
@@ -3660,7 +3909,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         clearResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if clearResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3680,8 +3929,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3690,7 +3939,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3714,8 +3963,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3724,7 +3973,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3741,8 +3990,8 @@
         onosSet.update( addAllValue.split() )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAddAll-" + str( i ),
                              args=[ onosSetName, addAllValue ] )
             threads.append( t )
@@ -3755,7 +4004,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3775,8 +4024,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3785,7 +4034,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3809,8 +4058,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3819,7 +4068,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -3836,8 +4085,8 @@
         onosSet.intersection_update( retainValue.split() )
         retainResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestRemove,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestRemove,
                              name="setTestRetain-" + str( i ),
                              args=[ onosSetName, retainValue ],
                              kwargs={ "retain": True } )
@@ -3851,7 +4100,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         retainResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if retainResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -3871,8 +4120,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3881,7 +4130,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3905,8 +4154,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3915,7 +4164,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
diff --git a/TestON/tests/HAsanity/dependencies/Counters.py b/TestON/tests/HAsanity/dependencies/Counters.py
new file mode 100644
index 0000000..7abd73a
--- /dev/null
+++ b/TestON/tests/HAsanity/dependencies/Counters.py
@@ -0,0 +1,57 @@
+def __init__( self ):
+    self.default = ''
+
+def counterCheck( counterName, counterValue ):
+    """
+    Add Text here
+    """
+    import json
+    correctResults = main.TRUE
+    # Get onos counters results
+    onosCounters = []
+    threads = []
+    for i in range( main.numCtrls ):
+        t = main.Thread( target=main.CLIs[i].counters,
+                         name="counters-" + str( i ) )
+        threads.append( t )
+        t.start()
+    for t in threads:
+        t.join()
+        onosCounters.append( t.result )
+    tmp = [ i == onosCounters[ 0 ] for i in onosCounters ]
+    if all( tmp ):
+        consistent = main.TRUE
+    else:
+        consistent = main.FALSE
+        main.log.error( "ONOS nodes have different values for counters" )
+        for node in onosCounters:
+            main.log.debug( node )
+
+    # Check for correct values
+    for i in range( main.numCtrls ):
+        try:
+            current = json.loads( onosCounters[i] )
+        except ( ValueError, TypeError ):
+            main.log.error( "Could not parse counters response from ONOS" +
+                            str( i + 1 ) )
+            main.log.warn( repr( onosCounters[ i ] ) )
+        onosValue = None
+        try:
+            for database in current:
+                database = database.values()[0]
+                for counter in database:
+                    if counter.get( 'name' ) == counterName:
+                        onosValue = counter.get( 'value' )
+                        break
+        except AttributeError, e:
+            main.log.error( "ONOS" + str( i + 1 ) + " counters result " +
+                            "is not as expected" )
+            correctResults = main.FALSE
+        if onosValue == counterValue:
+            main.log.info( counterName + " counter value is correct" )
+        else:
+            main.log.error( counterName + " counter value is incorrect," +
+                            " expected value: " + str( counterValue )
+                            + " current value: " + str( onosValue ) )
+            correctResults = main.FALSE
+    return consistent and correctResults
diff --git a/TestON/tests/HAsanity/dependencies/__init__.py b/TestON/tests/HAsanity/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/HAsanity/dependencies/__init__.py
diff --git a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.params b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.params
index c43bea1..b0b644e 100644
--- a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.params
+++ b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.params
@@ -15,6 +15,9 @@
     #CASE14: start election app on all onos nodes
     #CASE15: Check that Leadership Election is still functional
     <testcases>1,2,8,3,4,5,14,15,16,17,[6],8,3,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+    <imports>
+        <path> /home/admin/OnosSystemTest/TestON/tests/HAsingleInstanceRestart/dependencies/ </path>
+    </imports>
     <ENV>
         <cellName>HA</cellName>
         <appString>drivers,openflow,proxyarp,mobility</appString>
diff --git a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index dad6099..1fa2e33 100644
--- a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -47,10 +47,11 @@
         start cli sessions
         start tcpdump
         """
+        import imp
         main.log.info( "ONOS Single node cluster restart " +
                          "HA test - initialization" )
         main.case( "Setting up test environment" )
-        main.caseExplaination = "Setup the test environment including " +\
+        main.caseExplanation = "Setup the test environment including " +\
                                 "installing ONOS, starting Mininet and ONOS" +\
                                 "cli sessions."
         # TODO: save all the timers and output them for plotting
@@ -62,23 +63,29 @@
         gitBranch = main.params[ 'branch' ]
         cellName = main.params[ 'ENV' ][ 'cellName' ]
 
-        # set global variables
-        global numControllers
-        numControllers = int( main.params[ 'num_controllers' ] )
+        main.numCtrls = int( main.params[ 'num_controllers' ] )
         if main.ONOSbench.maxNodes:
-            if main.ONOSbench.maxNodes < numControllers:
-                numControllers = int( main.ONOSbench.maxNodes )
+            if main.ONOSbench.maxNodes < main.numCtrls:
+                main.numCtrls = int( main.ONOSbench.maxNodes )
 
-        global CLIs
-        CLIs = []
-        global nodes
-        nodes = []
+        try:
+            fileName = "Counters"
+            path = main.params[ 'imports' ][ 'path' ]
+            main.Counters = imp.load_source( fileName,
+                                             path + fileName + ".py" )
+        except Exception as e:
+            main.log.exception( e )
+            main.cleanup()
+            main.exit()
+
+        main.CLIs = []
+        main.nodes = []
         ipList = []
         for i in range( 1, int( main.ONOSbench.maxNodes ) + 1 ):
             try:
-                CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
-                nodes.append( getattr( main, 'ONOS' + str( i ) ) )
-                ipList.append( nodes[ -1 ].ip_address )
+                main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+                main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+                ipList.append( main.nodes[ -1 ].ip_address )
             except AttributeError:
                 break
 
@@ -96,13 +103,13 @@
         main.ONOSbench.onosRemoveRaftLogs()
 
         main.log.info( "Uninstalling ONOS" )
-        for node in nodes:
+        for node in main.nodes:
             main.ONOSbench.onosUninstall( node.ip_address )
 
         # Make sure ONOS is DEAD
         main.log.info( "Killing any ONOS processes" )
         killResults = main.TRUE
-        for node in nodes:
+        for node in main.nodes:
             killed = main.ONOSbench.onosKill( node.ip_address )
             killResults = killResults and killed
 
@@ -161,13 +168,13 @@
         graphs += '</ac:structured-macro>\n'
         main.log.wiki(graphs)
 
-        CLIs = []
-        nodes = []
+        main.CLIs = []
+        main.nodes = []
         ipList = []
-        for i in range( 1, numControllers + 1 ):
-            CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
-            nodes.append( getattr( main, 'ONOS' + str( i ) ) )
-            ipList.append( nodes[ -1 ].ip_address )
+        for i in range( 1, main.numCtrls + 1 ):
+            main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+            main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+            ipList.append( main.nodes[ -1 ].ip_address )
 
         main.ONOSbench.createCellFile( main.ONOSbench.ip_address, "SingleHA",
                                        main.Mininet1.ip_address,
@@ -182,14 +189,14 @@
 
         main.step( "Installing ONOS package" )
         onosInstallResult = main.ONOSbench.onosInstall(
-                options="-f", node=nodes[0].ip_address )
+                options="-f", node=main.nodes[0].ip_address )
         utilities.assert_equals( expect=main.TRUE, actual=onosInstallResult,
                                  onpass="ONOS install successful",
                                  onfail="ONOS install failed" )
 
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
-            onos1Isup = main.ONOSbench.isup( nodes[0].ip_address )
+            onos1Isup = main.ONOSbench.isup( main.nodes[0].ip_address )
             if onos1Isup:
                 break
         utilities.assert_equals( expect=main.TRUE, actual=onos1Isup,
@@ -197,7 +204,7 @@
                                  onfail="ONOS startup failed" )
 
         main.log.step( "Starting ONOS CLI sessions" )
-        cliResults = main.ONOScli1.startOnosCli( nodes[0].ip_address )
+        cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address )
         utilities.assert_equals( expect=main.TRUE, actual=cliResults,
                                  onpass="ONOS cli startup successful",
                                  onfail="ONOS cli startup failed" )
@@ -213,8 +220,8 @@
         main.step( "App Ids check" )
         appCheck = main.ONOScli1.appToIDCheck()
         if appCheck != main.TRUE:
-            main.log.warn( CLIs[0].apps() )
-            main.log.warn( CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
         utilities.assert_equals( expect=main.TRUE, actual=appCheck,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -229,20 +236,19 @@
         Assign devices to controllers
         """
         import re
-        import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
 
         main.case( "Assigning devices to controllers" )
-        main.caseExplaination = "Assign switches to ONOS using 'ovs-vsctl' " +\
+        main.caseExplanation = "Assign switches to ONOS using 'ovs-vsctl' " +\
                                 "and check that an ONOS node becomes the " +\
                                 "master of the device."
         main.step( "Assign switches to controllers" )
 
         ipList = []
-        for i in range( numControllers ):
-            ipList.append( nodes[ i ].ip_address )
+        for i in range( main.numCtrls ):
+            ipList.append( main.nodes[ i ].ip_address )
         swList = []
         for i in range( 1, 29 ):
             swList.append( "s" + str( i ) )
@@ -255,7 +261,7 @@
                 main.log.info( str( response ) )
             except Exception:
                 main.log.info( repr( response ) )
-            if re.search( "tcp:" + nodes[0].ip_address, response ):
+            if re.search( "tcp:" + main.nodes[0].ip_address, response ):
                 mastershipCheck = mastershipCheck and main.TRUE
             else:
                 mastershipCheck = main.FALSE
@@ -271,16 +277,14 @@
         """
         Assign mastership to controllers
         """
-        import re
-        import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         main.case( "Assigning Controller roles for switches" )
-        main.caseExplaination = "Check that ONOS is connected to each " +\
+        main.caseExplanation = "Check that ONOS is connected to each " +\
                                 "device. Then manually assign" +\
                                 " mastership to specific ONOS nodes using" +\
                                 " 'device-role'"
@@ -289,7 +293,7 @@
         roleCheck = main.TRUE
         try:
             for i in range( 1, 29 ):  # switches 1 through 28
-                ip = nodes[ 0 ].ip_address  # ONOS1
+                ip = main.nodes[ 0 ].ip_address  # ONOS1
                 # set up correct variables:
                 if i == 1:
                     deviceId = main.ONOScli1.getDevice( "1000" ).get( 'id' )
@@ -354,13 +358,13 @@
         """
         import time
         import json
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
         # NOTE: we must reinstall intents until we have a persistant intent
         #        datastore!
         main.case( "Adding host Intents" )
-        main.caseExplaination = "Discover hosts by using pingall then " +\
+        main.caseExplanation = "Discover hosts by using pingall then " +\
                                 "assign predetermined host-to-host intents." +\
                                 " After installation, check that the intent" +\
                                 " is distributed to all nodes and the state" +\
@@ -368,7 +372,7 @@
 
         # install onos-app-fwd
         main.step( "Install reactive forwarding app" )
-        installResults = CLIs[0].activateApp( "org.onosproject.fwd" )
+        installResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
         utilities.assert_equals( expect=main.TRUE, actual=installResults,
                                  onpass="Install fwd successful",
                                  onfail="Install fwd failed" )
@@ -376,8 +380,8 @@
         main.step( "Check app ids" )
         appCheck = main.ONOScli1.appToIDCheck()
         if appCheck != main.TRUE:
-            main.log.warn( CLIs[0].apps() )
-            main.log.warn( CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
         utilities.assert_equals( expect=main.TRUE, actual=appCheck,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -403,7 +407,7 @@
         time.sleep( 11 )
         # uninstall onos-app-fwd
         main.step( "Uninstall reactive forwarding app" )
-        uninstallResult = CLIs[0].deactivateApp( "org.onosproject.fwd" )
+        uninstallResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
         utilities.assert_equals( expect=main.TRUE, actual=uninstallResult,
                                  onpass="Uninstall fwd successful",
                                  onfail="Uninstall fwd failed" )
@@ -411,8 +415,8 @@
         main.step( "Check app ids" )
         appCheck2 = main.ONOScli1.appToIDCheck()
         if appCheck2 != main.TRUE:
-            main.log.warn( CLIs[0].apps() )
-            main.log.warn( CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
         utilities.assert_equals( expect=main.TRUE, actual=appCheck2,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -573,7 +577,7 @@
         for i in range(100):
             correct = True
             main.log.info( "Submitted intents: " + str( sorted( intentIds ) ) )
-            for cli in CLIs:
+            for cli in main.CLIs:
                 onosIds = []
                 ids = cli.getAllIntentsId()
                 onosIds.append( ids )
@@ -713,11 +717,11 @@
         """
         import json
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
         main.case( "Verify connectivity by sendind traffic across Intents" )
-        main.caseExplaination = "Ping across added host intents to check " +\
+        main.caseExplanation = "Ping across added host intents to check " +\
                                 "functionality and check the state of " +\
                                 "the intent"
         main.step( "Ping across added host intents" )
@@ -934,7 +938,7 @@
                 main.log.exception( "Error parsing pending map" )
                 main.log.error( repr( pendingMap ) )
         # Print flowrules
-        main.log.debug( CLIs[0].flows( jsonFormat=False ) )
+        main.log.debug( main.CLIs[0].flows( jsonFormat=False ) )
         main.step( "Wait a minute then ping again" )
         # the wait is above
         PingResult = main.TRUE
@@ -972,7 +976,7 @@
         Reading state of ONOS
         """
         import json
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
 
@@ -1091,7 +1095,7 @@
         mnSwitches = main.Mininet1.getSwitches()
         mnLinks = main.Mininet1.getLinks()
         mnHosts = main.Mininet1.getHosts()
-        for controller in range( numControllers ):
+        for controller in range( main.numCtrls ):
             controllerStr = str( controller + 1 )
             if devices[ controller ] and ports[ controller ] and\
                 "Error" not in devices[ controller ] and\
@@ -1165,7 +1169,7 @@
         The Failure case.
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
 
@@ -1177,10 +1181,10 @@
             iCounterValue = 0
 
         main.case( "Restart ONOS node" )
-        main.caseExplaination = "Killing ONOS process and restart cli " +\
+        main.caseExplanation = "Killing ONOS process and restart cli " +\
                                 "sessions once onos is up."
         main.step( "Killing ONOS processes" )
-        killResult = main.ONOSbench.onosKill( nodes[0].ip_address )
+        killResult = main.ONOSbench.onosKill( main.nodes[0].ip_address )
         start = time.time()
         utilities.assert_equals( expect=main.TRUE, actual=killResult,
                                  onpass="ONOS Killed",
@@ -1189,7 +1193,7 @@
         main.step( "Checking if ONOS is up yet" )
         count = 0
         while count < 10:
-            onos1Isup = main.ONOSbench.isup( nodes[0].ip_address )
+            onos1Isup = main.ONOSbench.isup( main.nodes[0].ip_address )
             if onos1Isup == main.TRUE:
                 elapsed = time.time() - start
                 break
@@ -1200,7 +1204,7 @@
                                  onfail="ONOS failed to start" )
 
         main.log.step( "Starting ONOS CLI sessions" )
-        cliResults = main.ONOScli1.startOnosCli( nodes[0].ip_address )
+        cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address )
         utilities.assert_equals( expect=main.TRUE, actual=cliResults,
                                  onpass="ONOS cli startup successful",
                                  onfail="ONOS cli startup failed" )
@@ -1220,7 +1224,7 @@
         Check state after ONOS failure
         """
         import json
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
         main.case( "Running ONOS Constant State Tests" )
@@ -1373,9 +1377,9 @@
         main.step( "Leadership Election is still functional" )
         # Test of LeadershipElection
 
-        leader = nodes[0].ip_address
+        leader = main.nodes[0].ip_address
         leaderResult = main.TRUE
-        for controller in range( 1, numControllers + 1 ):
+        for controller in range( 1, main.numCtrls + 1 ):
             # loop through ONOScli handlers
             node = getattr( main, ( 'ONOScli' + str( controller ) ) )
             leaderN = node.electionTestLeader()
@@ -1409,12 +1413,12 @@
         """
         import json
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
 
         main.case( "Compare ONOS Topology view to Mininet topology" )
-        main.caseExplaination = "Compare topology objects between Mininet" +\
+        main.caseExplanation = "Compare topology objects between Mininet" +\
                                 " and ONOS"
 
         main.step( "Comparing ONOS topology to MN" )
@@ -1458,7 +1462,7 @@
             mnSwitches = main.Mininet1.getSwitches()
             mnLinks = main.Mininet1.getLinks()
             mnHosts = main.Mininet1.getHosts()
-            for controller in range( numControllers ):
+            for controller in range( main.numCtrls ):
                 controllerStr = str( controller + 1 )
                 if devices[ controller ] and ports[ controller ] and\
                     "Error" not in devices[ controller ] and\
@@ -1584,7 +1588,6 @@
                 if zeroHosts is False:
                     hostAttachment = True
 
-
                 devicesResults = devicesResults and currentDevicesResult
                 linksResults = linksResults and currentLinksResult
                 hostsResults = hostsResults and currentHostsResult
@@ -1624,7 +1627,7 @@
         Link s3-s28 down
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
         # NOTE: You should probably run a topology check after this
@@ -1650,7 +1653,7 @@
         Link s3-s28 up
         """
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
         # NOTE: You should probably run a topology check after this
@@ -1677,7 +1680,7 @@
         """
         # NOTE: You should probably run a topology check after this
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
 
@@ -1711,7 +1714,7 @@
         """
         # NOTE: You should probably run a topology check after this
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
 
@@ -1727,8 +1730,8 @@
         for peer in links:
             main.Mininet1.addLink( switch, peer )
         ipList = []
-        for i in range( numControllers ):
-            ipList.append( nodes[ i ].ip_address )
+        for i in range( main.numCtrls ):
+            ipList.append( main.nodes[ i ].ip_address )
         main.Mininet1.assignSwController( sw=switch, ip=ipList )
         main.log.info( "Waiting " + str( switchSleep ) +
                        " seconds for switch up to be discovered" )
@@ -1749,7 +1752,7 @@
         """
         import os
         import time
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
         # printing colors to terminal
@@ -1776,7 +1779,7 @@
             # NOTE: must end in /
             dstDir = "~/packet_captures/"
             for f in logFiles:
-                main.ONOSbench.handle.sendline( "scp sdn@" + nodes[0].ip_address + ":" +
+                main.ONOSbench.handle.sendline( "scp sdn@" + main.nodes[0].ip_address + ":" +
                                                 logFolder + f + " " +
                                                 teststationUser + "@" +
                                                 teststationIP + ":" + dstDir +
@@ -1790,7 +1793,7 @@
             # NOTE: must end in /
             dstDir = "~/packet_captures/"
             for f in logFiles:
-                main.ONOSbench.handle.sendline( "scp sdn@" + nodes[0].ip_address + ":" +
+                main.ONOSbench.handle.sendline( "scp sdn@" + main.nodes[0].ip_address + ":" +
                                                 logFolder + f + " " +
                                                 teststationUser + "@" +
                                                 teststationIP + ":" + dstDir +
@@ -1810,7 +1813,7 @@
         main.step( "Checking ONOS Logs for errors" )
         print colors[ 'purple' ] + "Checking logs for errors on ONOS1:" + \
             colors[ 'end' ]
-        print main.ONOSbench.checkLogs( nodes[0].ip_address, restart=True )
+        print main.ONOSbench.checkLogs( main.nodes[0].ip_address, restart=True )
 
         try:
             timerLog = open( main.logdir + "/Timers.csv", 'w')
@@ -1826,7 +1829,7 @@
         """
         start election app on all onos nodes
         """
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
 
@@ -1844,7 +1847,7 @@
         # check for leader
         leader = main.ONOScli1.electionTestLeader()
         # verify leader is ONOS1
-        if leader == nodes[0].ip_address:
+        if leader == main.nodes[0].ip_address:
             # all is well
             pass
         elif leader is None:
@@ -1875,7 +1878,7 @@
         """
         Check that Leadership Election is still functional
         """
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
         leaderResult = main.TRUE
@@ -1885,7 +1888,7 @@
         leader = main.ONOScli1.electionTestLeader()
         # do some sanity checking on leader before using it
         withdrawResult = main.FALSE
-        if leader == nodes[0].ip_address:
+        if leader == main.nodes[0].ip_address:
             oldLeader = getattr( main, "ONOScli1" )
         elif leader is None or leader == main.FALSE:
             main.log.error(
@@ -1943,7 +1946,7 @@
         main.step( "Node became leader when it ran for election" )
         afterRun = main.ONOScli1.electionTestLeader()
         # verify leader is ONOS1
-        if afterRun == nodes[0].ip_address:
+        if afterRun == main.nodes[0].ip_address:
             afterResult = main.TRUE
         else:
             afterResult = main.FALSE
@@ -1959,11 +1962,11 @@
         """
         Install Distributed Primitives app
         """
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
 
         # Variables for the distributed primitives tests
         global pCounterName
@@ -1983,7 +1986,7 @@
         main.case( description )
         main.step( "Install Primitives app" )
         appName = "org.onosproject.distributedprimitives"
-        appResults = CLIs[0].activateApp( appName )
+        appResults = main.CLIs[0].activateApp( appName )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=appResults,
                                  onpass="Primitives app activated",
@@ -1993,13 +1996,12 @@
         """
         Check for basic functionality with distributed primitives
         """
-        import json
         # Make sure variables are defined/set
-        assert numControllers, "numControllers not defined"
+        assert main.numCtrls, "main.numCtrls not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        assert CLIs, "CLIs not defined"
-        assert nodes, "nodes not defined"
+        assert main.CLIs, "main.CLIs not defined"
+        assert main.nodes, "main.nodes not defined"
         assert pCounterName, "pCounterName not defined"
         assert iCounterName, "iCounterName not defined"
         assert onosSetName, "onosSetName not defined"
@@ -2027,15 +2029,17 @@
         description = "Check for basic functionality with distributed " +\
                       "primitives"
         main.case( description )
-        main.caseExplaination = "Test the methods of the distributed primitives (counters and sets) throught the cli"
+        main.caseExplanation = "Test the methods of the distributed " +\
+                                "primitives (counters and sets) throught the cli"
         # DISTRIBUTED ATOMIC COUNTERS
-        main.step( "Increment and get a default counter on each node" )
+        # Partitioned counters
+        main.step( "Increment then get a default counter on each node" )
         pCounters = []
         threads = []
         addedPValues = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].counterTestIncrement,
-                             name="counterIncrement-" + str( i ),
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterAddAndGet-" + str( i ),
                              args=[ pCounterName ] )
             pCounterValue += 1
             addedPValues.append( pCounterValue )
@@ -2059,12 +2063,150 @@
                                  onfail="Error incrementing default" +
                                         " counter" )
 
-        main.step( "Increment and get an in memory counter on each node" )
+        main.step( "Get then Increment a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterGetAndAdd-" + str( i ),
+                             args=[ pCounterName ] )
+            addedPValues.append( pCounterValue )
+            pCounterValue += 1
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( pCounterName, pCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
+        main.step( "Add -8 to then get a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ pCounterName ],
+                             kwargs={ "delta": -8 } )
+            pCounterValue += -8
+            addedPValues.append( pCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Add 5 to then get a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ pCounterName ],
+                             kwargs={ "delta": 5 } )
+            pCounterValue += 5
+            addedPValues.append( pCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Get then add 5 to a default counter on each node" )
+        pCounters = []
+        threads = []
+        addedPValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterIncrement-" + str( i ),
+                             args=[ pCounterName ],
+                             kwargs={ "delta": 5 } )
+            addedPValues.append( pCounterValue )
+            pCounterValue += 5
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            pCounters.append( t.result )
+        # Check that counter incremented numController times
+        pCounterResults = True
+        for i in addedPValues:
+            tmpResult = i in pCounters
+            pCounterResults = pCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in partitioned "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="Default counter incremented",
+                                 onfail="Error incrementing default" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( pCounterName, pCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
+        # In-Memory counters
+        main.step( "Increment and get an in-memory counter on each node" )
         iCounters = []
         addedIValues = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].counterTestIncrement,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
                              name="icounterIncrement-" + str( i ),
                              args=[ iCounterName ],
                              kwargs={ "inMemory": True } )
@@ -2086,15 +2228,153 @@
                                 "counter incremented results" )
         utilities.assert_equals( expect=True,
                                  actual=iCounterResults,
-                                 onpass="In memory counter incremented",
-                                 onfail="Error incrementing in memory" +
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
                                         " counter" )
 
+        main.step( "Get then Increment a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterGetAndAdd-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "inMemory": True } )
+            addedIValues.append( iCounterValue )
+            iCounterValue += 1
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=iCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( iCounterName, iCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
+        main.step( "Add -8 to then get a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "delta": -8, "inMemory": True  } )
+            iCounterValue += -8
+            addedIValues.append( iCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Add 5 to then get a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestAddAndGet,
+                             name="counterIncrement-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "delta": 5, "inMemory": True  } )
+            iCounterValue += 5
+            addedIValues.append( iCounterValue )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=pCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Get then add 5 to a in-memory counter on each node" )
+        iCounters = []
+        threads = []
+        addedIValues = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counterTestGetAndAdd,
+                             name="counterIncrement-" + str( i ),
+                             args=[ iCounterName ],
+                             kwargs={ "delta": 5, "inMemory": True  } )
+            addedIValues.append( iCounterValue )
+            iCounterValue += 5
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            iCounters.append( t.result )
+        # Check that counter incremented numController times
+        iCounterResults = True
+        for i in addedIValues:
+            tmpResult = i in iCounters
+            iCounterResults = iCounterResults and tmpResult
+            if not tmpResult:
+                main.log.error( str( i ) + " is not in in-memory "
+                                "counter incremented results" )
+        utilities.assert_equals( expect=True,
+                                 actual=iCounterResults,
+                                 onpass="In-memory counter incremented",
+                                 onfail="Error incrementing in-memory" +
+                                        " counter" )
+
+        main.step( "Counters we added have the correct values" )
+        incrementCheck = main.Counters.counterCheck( iCounterName, iCounterValue )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=incrementCheck,
+                                 onpass="Added counters are correct",
+                                 onfail="Added counters are incorrect" )
+
         main.step( "Check counters are consistant across nodes" )
         onosCounters = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].counters,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].counters,
                              name="counters-" + str( i ) )
             threads.append( t )
             t.start()
@@ -2116,59 +2396,21 @@
                                         "across nodes" )
 
         main.step( "Counters we added have the correct values" )
-        correctResults = main.TRUE
-        for i in range( numControllers ):
-            try:
-                current = json.loads( onosCounters[i] )
-            except ( ValueError, TypeError ):
-                main.log.error( "Could not parse counters response from ONOS" +
-                                str( i + 1 ) )
-                main.log.warn( repr( onosCounters[ i ] ) )
-            pValue = None
-            iValue = None
-            try:
-                for database in current:
-                    partitioned = database.get( 'partitionedDatabaseCounters' )
-                    if partitioned:
-                        for value in partitioned:
-                            if value.get( 'name' ) == pCounterName:
-                                pValue = value.get( 'value' )
-                                break
-                    inMemory = database.get( 'inMemoryDatabaseCounters' )
-                    if inMemory:
-                        for value in inMemory:
-                            if value.get( 'name' ) == iCounterName:
-                                iValue = value.get( 'value' )
-                                break
-            except AttributeError, e:
-                main.log.error( "ONOS" + str( i + 1 ) + " counters result " +
-                                "is not as expected" )
-                correctResults = main.FALSE
-            if pValue == pCounterValue:
-                main.log.info( "Partitioned counter value is correct" )
-            else:
-                main.log.error( "Partitioned counter value is incorrect," +
-                                " expected value: " + str( pCounterValue )
-                                + " current value: " + str( pValue ) )
-                correctResults = main.FALSE
-            if iValue == iCounterValue:
-                main.log.info( "In memory counter value is correct" )
-            else:
-                main.log.error( "In memory counter value is incorrect, " +
-                                "expected value: " + str( iCounterValue ) +
-                                " current value: " + str( iValue ) )
-                correctResults = main.FALSE
+        incrementCheck = main.Counters.counterCheck( iCounterName, iCounterValue )
+        incrementCheck = incrementCheck and \
+                         main.Counters.counterCheck( iCounterName, iCounterValue )
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=correctResults,
+                                 actual=incrementCheck,
                                  onpass="Added counters are correct",
                                  onfail="Added counters are incorrect" )
+
         # DISTRIBUTED SETS
         main.step( "Distributed Set get" )
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2178,7 +2420,7 @@
             getResponses.append( t.result )
 
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -2208,8 +2450,8 @@
         main.step( "Distributed Set size" )
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2219,7 +2461,7 @@
             sizeResponses.append( t.result )
 
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -2235,8 +2477,8 @@
         onosSet.add( addValue )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAdd-" + str( i ),
                              args=[ onosSetName, addValue ] )
             threads.append( t )
@@ -2249,7 +2491,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -2269,8 +2511,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2279,7 +2521,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -2303,8 +2545,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2313,7 +2555,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -2330,8 +2572,8 @@
         onosSet.update( addAllValue.split() )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAddAll-" + str( i ),
                              args=[ onosSetName, addAllValue ] )
             threads.append( t )
@@ -2344,7 +2586,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -2364,8 +2606,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2374,7 +2616,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -2398,8 +2640,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2408,7 +2650,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -2424,8 +2666,8 @@
         main.step( "Distributed Set contains()" )
         containsResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setContains-" + str( i ),
                              args=[ onosSetName ],
                              kwargs={ "values": addValue } )
@@ -2437,7 +2679,7 @@
             containsResponses.append( t.result )
 
         containsResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if containsResponses[ i ] == main.ERROR:
                 containsResults = main.FALSE
             else:
@@ -2451,8 +2693,8 @@
         main.step( "Distributed Set containsAll()" )
         containsAllResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setContainsAll-" + str( i ),
                              args=[ onosSetName ],
                              kwargs={ "values": addAllValue } )
@@ -2464,7 +2706,7 @@
             containsAllResponses.append( t.result )
 
         containsAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if containsResponses[ i ] == main.ERROR:
                 containsResults = main.FALSE
             else:
@@ -2479,8 +2721,8 @@
         onosSet.remove( addValue )
         removeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestRemove,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestRemove,
                              name="setTestRemove-" + str( i ),
                              args=[ onosSetName, addValue ] )
             threads.append( t )
@@ -2493,7 +2735,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         removeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if removeResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -2513,8 +2755,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2523,7 +2765,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -2547,8 +2789,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2557,7 +2799,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -2575,8 +2817,8 @@
         removeAllResponses = []
         threads = []
         try:
-            for i in range( numControllers ):
-                t = main.Thread( target=CLIs[i].setTestRemove,
+            for i in range( main.numCtrls ):
+                t = main.Thread( target=main.CLIs[i].setTestRemove,
                                  name="setTestRemoveAll-" + str( i ),
                                  args=[ onosSetName, addAllValue ] )
                 threads.append( t )
@@ -2591,7 +2833,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         removeAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if removeAllResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -2611,8 +2853,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2621,7 +2863,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -2645,8 +2887,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2655,7 +2897,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -2672,8 +2914,8 @@
         onosSet.update( addAllValue.split() )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAddAll-" + str( i ),
                              args=[ onosSetName, addAllValue ] )
             threads.append( t )
@@ -2686,7 +2928,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -2706,8 +2948,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2716,7 +2958,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -2740,8 +2982,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2750,7 +2992,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -2767,8 +3009,8 @@
         onosSet.clear()
         clearResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestRemove,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestRemove,
                              name="setTestClear-" + str( i ),
                              args=[ onosSetName, " "],  # Values doesn't matter
                              kwargs={ "clear": True } )
@@ -2782,7 +3024,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         clearResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if clearResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -2802,8 +3044,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2812,7 +3054,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -2836,8 +3078,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2846,7 +3088,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -2863,8 +3105,8 @@
         onosSet.update( addAllValue.split() )
         addResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestAdd,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestAdd,
                              name="setTestAddAll-" + str( i ),
                              args=[ onosSetName, addAllValue ] )
             threads.append( t )
@@ -2877,7 +3119,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         addAllResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if addResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -2897,8 +3139,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2907,7 +3149,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -2931,8 +3173,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -2941,7 +3183,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
@@ -2958,8 +3200,8 @@
         onosSet.intersection_update( retainValue.split() )
         retainResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestRemove,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestRemove,
                              name="setTestRetain-" + str( i ),
                              args=[ onosSetName, retainValue ],
                              kwargs={ "retain": True } )
@@ -2973,7 +3215,7 @@
         # main.FALSE = action resulted in no change in set
         # main.ERROR - Some error in executing the function
         retainResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if retainResponses[ i ] == main.TRUE:
                 # All is well
                 pass
@@ -2993,8 +3235,8 @@
         size = len( onosSet )
         getResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestGet,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestGet,
                              name="setTestGet-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3003,7 +3245,7 @@
             t.join()
             getResponses.append( t.result )
         getResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if isinstance( getResponses[ i ], list):
                 current = set( getResponses[ i ] )
                 if len( current ) == len( getResponses[ i ] ):
@@ -3027,8 +3269,8 @@
                 getResults = main.FALSE
         sizeResponses = []
         threads = []
-        for i in range( numControllers ):
-            t = main.Thread( target=CLIs[i].setTestSize,
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].setTestSize,
                              name="setTestSize-" + str( i ),
                              args=[ onosSetName ] )
             threads.append( t )
@@ -3037,7 +3279,7 @@
             t.join()
             sizeResponses.append( t.result )
         sizeResults = main.TRUE
-        for i in range( numControllers ):
+        for i in range( main.numCtrls ):
             if size != sizeResponses[ i ]:
                 sizeResults = main.FALSE
                 main.log.error( "ONOS" + str( i + 1 ) +
diff --git a/TestON/tests/HAsingleInstanceRestart/dependencies/Counters.py b/TestON/tests/HAsingleInstanceRestart/dependencies/Counters.py
new file mode 100644
index 0000000..7abd73a
--- /dev/null
+++ b/TestON/tests/HAsingleInstanceRestart/dependencies/Counters.py
@@ -0,0 +1,57 @@
+def __init__( self ):
+    self.default = ''
+
+def counterCheck( counterName, counterValue ):
+    """
+    Add Text here
+    """
+    import json
+    correctResults = main.TRUE
+    # Get onos counters results
+    onosCounters = []
+    threads = []
+    for i in range( main.numCtrls ):
+        t = main.Thread( target=main.CLIs[i].counters,
+                         name="counters-" + str( i ) )
+        threads.append( t )
+        t.start()
+    for t in threads:
+        t.join()
+        onosCounters.append( t.result )
+    tmp = [ i == onosCounters[ 0 ] for i in onosCounters ]
+    if all( tmp ):
+        consistent = main.TRUE
+    else:
+        consistent = main.FALSE
+        main.log.error( "ONOS nodes have different values for counters" )
+        for node in onosCounters:
+            main.log.debug( node )
+
+    # Check for correct values
+    for i in range( main.numCtrls ):
+        try:
+            current = json.loads( onosCounters[i] )
+        except ( ValueError, TypeError ):
+            main.log.error( "Could not parse counters response from ONOS" +
+                            str( i + 1 ) )
+            main.log.warn( repr( onosCounters[ i ] ) )
+        onosValue = None
+        try:
+            for database in current:
+                database = database.values()[0]
+                for counter in database:
+                    if counter.get( 'name' ) == counterName:
+                        onosValue = counter.get( 'value' )
+                        break
+        except AttributeError, e:
+            main.log.error( "ONOS" + str( i + 1 ) + " counters result " +
+                            "is not as expected" )
+            correctResults = main.FALSE
+        if onosValue == counterValue:
+            main.log.info( counterName + " counter value is correct" )
+        else:
+            main.log.error( counterName + " counter value is incorrect," +
+                            " expected value: " + str( counterValue )
+                            + " current value: " + str( onosValue ) )
+            correctResults = main.FALSE
+    return consistent and correctResults
diff --git a/TestON/tests/HAsingleInstanceRestart/dependencies/__init__.py b/TestON/tests/HAsingleInstanceRestart/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/HAsingleInstanceRestart/dependencies/__init__.py