[ONOS-6863] Flxible way to specify number of neighbors in intent/flow throughput test

Change-Id: I8b4482ca4cabc0acf47f428933f8a45002242cd4
diff --git a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.params b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.params
index f948b5a..9d6920d 100644
--- a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.params
+++ b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.params
@@ -16,7 +16,7 @@
         <enableFlowRuleStoreBackup>true</enableFlowRuleStoreBackup>
         <warmUp>5</warmUp>                              #number of runs to warm up the system
         <sampleSize>20</sampleSize>                     #number of runs to take data from
-        <neighbors>0,a</neighbors>                      #list of number of neighbors, a = all
+        <neighbors>0,0,a,0,a,0,a</neighbors>                      #list of number of neighbors, a = all
         <flows>122500</flows>
         <flowObj>false</flowObj>                         #flow objectives will be tested
         <flowObjectives>10000</flowObjectives>
diff --git a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
index 722819d..bfc0301 100644
--- a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
+++ b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
@@ -35,7 +35,6 @@
         self.default = ''
 
     def CASE0( self, main ):
-
         import time
         try:
             from tests.dependencies.ONOSSetup import ONOSSetup
@@ -52,6 +51,7 @@
             BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
             main.scale = ( main.params[ 'SCALE' ]  ).split( "," )
             main.flowRuleCfg = main.params[ 'CFG' ][ 'flowRule' ]
+            main.neighbor = ( main.params[ 'TEST' ][ 'neighbors' ] ).split( "," )
             main.nullProviderCfg = main.params[ 'CFG' ][ 'nullProvider' ]
             isFlowObj = main.params[ 'TEST' ][ 'flowObj' ]
             if isFlowObj == 'true':
@@ -68,7 +68,6 @@
 
     def CASE1( self, main ):
         main.testSetUp.ONOSSetUp( "localhost", main.Cluster, True, cellName=cellName )
-
         main.log.info( "Startup sequence complete" )
         main.ONOSbench.logReport( main.Cluster.active( 0 ).ipAddress, [ "ERROR", "WARNING", "EXCEPT" ], outputMode="d" )
 
@@ -83,22 +82,10 @@
         import datetime
         import traceback
 
-        global currentNeighbors
-        try:
-            currentNeighbors
-        except:
-            currentNeighbors = ( main.params[ 'TEST' ][ 'neighbors' ] ).split( "," )[ 0 ]
-        else:
-            if currentNeighbors == "r":      #reset
-                currentNeighbors = "0"
-            else:
-                currentNeighbors = "a"
-
         testCMD = [ 0, 0, 0, 0 ]
         warmUp = int( main.params[ 'TEST' ][ 'warmUp' ] )
         sampleSize = int( main.params[ 'TEST' ][ 'sampleSize' ] )
         switches = int( main.params[ 'TEST' ][ 'switches' ] )
-        neighborList = ( main.params[ 'TEST' ][ 'neighbors' ] ).split( "," )
         testCMD[ 0 ] = main.params[ 'TEST' ][ 'testCMD0' ]
         testCMD[ 1 ] = main.params[ 'TEST' ][ 'testCMD1' ]
         testCMD[ 2 ] = main.params[ 'TEST' ][ 'testCMD2' ]
@@ -115,232 +102,211 @@
         main.log.info( "Flow Rule Backup is set to:" + flowRuleBackup )
 
         servers = str( main.Cluster.numCtrls )
-
-        if main.Cluster.numCtrls == 1:
-            neighborList = [ '0' ]
-            currentNeighbors = "r"
-        else:
-            if currentNeighbors == "a":
-                neighborList = [ str( main.Cluster.numCtrls - 1 ) ]
-                currentNeighbors = "r"
-            else:
-                neighborList = [ '0' ]
-
-        main.log.info( "neightborlist: " + str( neighborList ) )
-
+        neighbors = '0' if main.neighbor.pop( 0 ) == '0' else str( main.Cluster.numCtrls - 1 )
+        main.log.info( "Number of Neighbors: " + neighbors )
         ts = time.time()
         st = datetime.datetime.fromtimestamp( ts ).strftime( '%Y-%m-%d %H:%M:%S' )
+        main.step( "\tSTARTING TEST" )
+        main.step( "\tLOADING FROM SERVERS:  \t" + str( main.Cluster.numCtrls ) )
+        main.step( "\tNEIGHBORS:\t" + neighbors )
+        main.log.info( "=============================================================" )
+        main.log.info( "=============================================================" )
+        #write file to configure nil link
+        ipCSV = ""
+        for i in range ( main.Cluster.maxCtrls ):
+            tempstr = "ip" + str( i + 1 )
+            ipCSV += main.params[ 'CTRL' ][ tempstr ]
+            if i + 1 < main.Cluster.maxCtrls:
+                ipCSV +=","
 
-        for n in neighborList:
-            main.step( "\tSTARTING TEST" )
-            main.step( "\tLOADING FROM SERVERS:  \t" + str( main.Cluster.numCtrls ) )
-            main.step( "\tNEIGHBORS:\t" + n )
-            main.log.info( "=============================================================" )
-            main.log.info( "=============================================================" )
-            #write file to configure nil link
-            ipCSV = ""
-            for i in range ( main.Cluster.maxCtrls ):
-                tempstr = "ip" + str( i + 1 )
-                ipCSV += main.params[ 'CTRL' ][ tempstr ]
-                if i + 1 < main.Cluster.maxCtrls:
-                    ipCSV +=","
-
+        main.ONOSbench.onosCfgSet( main.Cluster.active( 0 ).ipAddress,
+                                   main.flowRuleCfg,
+                                   "backupCount 1" )
+        for i in range( 3 ):
             main.ONOSbench.onosCfgSet( main.Cluster.active( 0 ).ipAddress,
-                                       main.flowRuleCfg,
-                                       "backupCount 1" )
-            for i in range( 3 ):
-                main.ONOSbench.onosCfgSet( main.Cluster.active( 0 ).ipAddress,
-                                           main.nullProviderCfg,
-                                           "deviceCount 35" )
-                main.ONOSbench.onosCfgSet( main.Cluster.active( 0 ).ipAddress,
-                                           main.nullProviderCfg,
-                                           "topoShape linear" )
-                main.ONOSbench.onosCfgSet( main.Cluster.active( 0 ).ipAddress,
-                                           main.nullProviderCfg,
-                                           "enabled true" )
+                                       main.nullProviderCfg,
+                                       "deviceCount 35" )
+            main.ONOSbench.onosCfgSet( main.Cluster.active( 0 ).ipAddress,
+                                       main.nullProviderCfg,
+                                       "topoShape linear" )
+            main.ONOSbench.onosCfgSet( main.Cluster.active( 0 ).ipAddress,
+                                       main.nullProviderCfg,
+                                       "enabled true" )
 
+            time.sleep( 5 )
+            main.ONOSbench.handle.sendline( "onos $OC1 summary" )
+            main.ONOSbench.handle.expect( ":~" )
+            check = main.ONOSbench.handle.before
+            main.log.info( "\nStart up check: \n" + check + "\n" )
+            if "SCC(s)=1," in check:
+                main.ONOSbench.handle.sendline( "onos $OC1 balance-masters" )
+                main.ONOSbench.handle.expect( ":~" )
                 time.sleep( 5 )
+                main.ONOSbench.handle.sendline( "onos $OC1 roles " )
+                main.ONOSbench.handle.expect ( ":~" )
+                main.log.info( "switch masterships:" + str( main.ONOSbench.handle.before ) )
+                break
+            time.sleep( 5 )
+
+        #divide flows/flowObjectives
+        if isFlowObj == 'true':
+           toInstall = "FlowObjectives"
+           installCount = int( main.params[ 'TEST' ][ 'flowObjectives' ] )
+           ifFailed = "FLOW_OBJ_TESTER.PY FAILURE"
+           resultFile = main.params[ 'TEST' ][ 'flowObjResultFile' ]
+        else:
+           toInstall = "Flows"
+           installCount = int( main.params[ 'TEST' ][ 'flows' ] )
+           ifFailed = "FLOW_TESTER.PY FAILURE"
+           resultFile = main.params[ 'TEST' ][ 'flowResultFile' ]
+        main.log.info( toInstall + " Target  = " + str( installCount ) )
+
+        installCount = ( installCount *max( int ( neighbors ) + 1, int( servers ) ) )/( ( int( neighbors ) + 1 )*int( servers )*( switches ) )
+
+        main.log.info( toInstall + " per switch = " + str( installCount ) )
+        #build list of servers in "$OC1, $OC2...." format
+        serverEnvVars = ""
+        for i in range( int( servers ) ):
+            serverEnvVars += ( "-s " + main.Cluster.active( i ).ipAddress + " " )
+
+        data = [ [ "" ]*int( servers ) ]*int( sampleSize )
+        maxes = [ "" ]*int( sampleSize )
+
+        flowCMD = "python3 " + homeDir + "/onos/tools/test/bin/"
+        if isFlowObj == 'true':
+           flowCMD += testCMD[ 2 ] + " " + str( installCount ) + " " + testCMD[ 1 ]
+           flowCMD += " " + neighbors + " " + testCMD[ 3 ] + " " + str( flowObjType ) + " " + str( serverEnvVars ) + "-j"
+        else:
+           flowCMD += testCMD[ 0 ] + " " + str( installCount ) + " " + testCMD[ 1 ]
+           flowCMD += " " + neighbors + " " + str( serverEnvVars ) + "-j"
+
+        main.log.info( flowCMD )
+        #time.sleep( 60 )
+
+        for test in range( 0, warmUp + sampleSize ):
+            if test < warmUp:
+                main.log.info( "Warm up " + str( test + 1 ) + " of " + str( warmUp ) )
+            else:
+                 main.log.info( "====== Test run: " + str( test-warmUp+1 ) + " ======" )
+
+            main.ONOSbench.handle.sendline( flowCMD )
+            main.ONOSbench.handle.expect( ":~" )
+            rawResult = main.ONOSbench.handle.before
+            main.log.info( "Raw results: \n" + rawResult + "\n" )
+
+            if "failed" in rawResult:
+                main.log.report( ifFailed )
+                main.log.report( " \n" + rawResult + " \n" )
+                for ctrl in main.Cluster.active():
+                    main.log.report( "=======================================================" )
+                    main.log.report( ctrl.name + "LOG REPORT" )
+                    main.ONOSbench.logReport( ctrl.ipAddress, [ "ERROR", "WARNING", "EXCEPT" ], outputMode="d" )
+                main.ONOSbench.handle.sendline( "onos $OC1 flows" )
+                main.ONOSbench.handle.expect( ":~" )
+                main.log.info( main.ONOSbench.handle.before )
+
+                break
+            result = [ "" ]*( main.Cluster.numCtrls )
+
+            rawResult = rawResult.splitlines()
+
+            for node in range( main.Cluster.numCtrls ):
+                for line in rawResult:
+                    #print( "line: " + line )
+                    if main.Cluster.active( node ).ipAddress in line and "server" in line:
+                        temp = line.split( " " )
+                        for word in temp:
+                            #print ( "word: " + word )
+                            if "elapsed" in repr( word ):
+                                index = temp.index( word ) + 1
+                                myParsed = ( temp[ index ] ).replace( ",", "" )
+                                myParsed = myParsed.replace( "}", "" )
+                                myParsed = int( myParsed )
+                                result[ node ] = myParsed
+                                main.log.info( main.Cluster.active( node ).ipAddress + " : " + str( myParsed ) )
+                                break
+
+            if test >= warmUp:
+                for i in result:
+                    if i == "":
+                        main.log.error( "Missing data point, critical failure incoming" )
+
+                print result
+                maxes[ test-warmUp ] = max( result )
+                main.log.info( "Data collection iteration: " + str( test-warmUp ) + " of " + str( sampleSize ) )
+                main.log.info( "Throughput time: " + str( maxes[ test-warmUp ] ) + "(ms)" )
+
+                data[ test-warmUp ] = result
+
+            # wait for flows = 0
+            for checkCount in range( 0, 5 ):
+                time.sleep( 10 )
                 main.ONOSbench.handle.sendline( "onos $OC1 summary" )
                 main.ONOSbench.handle.expect( ":~" )
-                check = main.ONOSbench.handle.before
-                main.log.info( "\nStart up check: \n" + check + "\n" )
-                if "SCC(s)=1," in check:
-                    main.ONOSbench.handle.sendline( "onos $OC1 balance-masters" )
-                    main.ONOSbench.handle.expect( ":~" )
-                    time.sleep( 5 )
-                    main.ONOSbench.handle.sendline( "onos $OC1 roles " )
-                    main.ONOSbench.handle.expect ( ":~" )
-                    main.log.info( "switch masterships:" + str( main.ONOSbench.handle.before ) )
+                flowCheck = main.ONOSbench.handle.before
+                if "flows=0," in flowCheck:
+                    main.log.info( toInstall + " removed" )
                     break
-                time.sleep( 5 )
-
-            #divide flows/flowObjectives
-            if isFlowObj == 'true':
-               toInstall = "FlowObjectives"
-               installCount = int( main.params[ 'TEST' ][ 'flowObjectives' ] )
-               ifFailed = "FLOW_OBJ_TESTER.PY FAILURE"
-               resultFile = main.params[ 'TEST' ][ 'flowObjResultFile' ]
-            else:
-               toInstall = "Flows"
-               installCount = int( main.params[ 'TEST' ][ 'flows' ] )
-               ifFailed = "FLOW_TESTER.PY FAILURE"
-               resultFile = main.params[ 'TEST' ][ 'flowResultFile' ]
-
-            main.log.info( toInstall + " Target  = " + str( installCount ) )
-
-            installCount = ( installCount *max( int( n )+1,int( servers ) ) )/( ( int( n ) + 1 )*int( servers )*( switches ) )
-
-            main.log.info( toInstall + " per switch = " + str( installCount ) )
-            #build list of servers in "$OC1, $OC2...." format
-            serverEnvVars = ""
-            for i in range( int( servers ) ):
-                serverEnvVars += ( "-s " + main.Cluster.active( i ).ipAddress + " " )
-
-            data = [ [ "" ]*int( servers ) ]*int( sampleSize )
-            maxes = [ "" ]*int( sampleSize )
-
-            flowCMD = "python3 " + homeDir + "/onos/tools/test/bin/"
-            if isFlowObj == 'true':
-               flowCMD += testCMD[ 2 ] + " " + str( installCount ) + " " + testCMD[ 1 ]
-               flowCMD += " " + str( n ) + " " + testCMD[ 3 ] + " " + str( flowObjType ) + " " + str( serverEnvVars ) + "-j"
-            else:
-               flowCMD += testCMD[ 0 ] + " " + str( installCount ) + " " + testCMD[ 1 ]
-               flowCMD += " " + str( n ) + " " + str( serverEnvVars ) + "-j"
-
-            main.log.info( flowCMD )
-            #time.sleep( 60 )
-
-            for test in range( 0, warmUp + sampleSize ):
-                if test < warmUp:
-                    main.log.info( "Warm up " + str( test + 1 ) + " of " + str( warmUp ) )
                 else:
-                     main.log.info( "====== Test run: " + str( test-warmUp+1 ) + " ======" )
+                    for line in flowCheck.splitlines():
+                        if "flows=" in line:
+                            main.log.info( "Current Summary: " + line )
+                if checkCount == 2:
+                    main.log.info( toInstall + " are stuck, moving on " )
+            time.sleep( 5 )
 
-                main.ONOSbench.handle.sendline( flowCMD )
-                main.ONOSbench.handle.expect( ":~" )
-                rawResult = main.ONOSbench.handle.before
-                main.log.info( "Raw results: \n" + rawResult + "\n" )
-
-                if "failed" in rawResult:
-                    main.log.report( ifFailed )
-                    main.log.report( " \n" + rawResult + " \n" )
-                    for ctrl in main.Cluster.active():
-                        main.log.report( "=======================================================" )
-                        main.log.report( ctrl.name + "LOG REPORT" )
-                        main.ONOSbench.logReport( ctrl.ipAddress, [ "ERROR", "WARNING", "EXCEPT" ], outputMode="d" )
-                    main.ONOSbench.handle.sendline( "onos $OC1 flows" )
-                    main.ONOSbench.handle.expect( ":~" )
-                    main.log.info( main.ONOSbench.handle.before )
-
-                    break
-
-            ########################################################################################
-                result = [ "" ]*( main.Cluster.numCtrls )
-
-                #print( "rawResult: " + rawResult )
-
-                rawResult = rawResult.splitlines()
-
-                for node in range( main.Cluster.numCtrls ):
-                    for line in rawResult:
-                        #print( "line: " + line )
-                        if main.Cluster.active( node ).ipAddress in line and "server" in line:
-                            temp = line.split( " " )
-                            for word in temp:
-                                #print ( "word: " + word )
-                                if "elapsed" in repr( word ):
-                                    index = temp.index( word ) + 1
-                                    myParsed = ( temp[ index ] ).replace( ",", "" )
-                                    myParsed = myParsed.replace( "}", "" )
-                                    myParsed = int( myParsed )
-                                    result[ node ] = myParsed
-                                    main.log.info( main.Cluster.active( node ).ipAddress + " : " + str( myParsed ) )
-                                    break
-
-                if test >= warmUp:
-                    for i in result:
-                        if i == "":
-                            main.log.error( "Missing data point, critical failure incoming" )
-
-                    print result
-                    maxes[ test-warmUp ] = max( result )
-                    main.log.info( "Data collection iteration: " + str( test-warmUp ) + " of " + str( sampleSize ) )
-                    main.log.info( "Throughput time: " + str( maxes[ test-warmUp ] ) + "(ms)" )
-
-                    data[ test-warmUp ] = result
-
-                # wait for flows = 0
-                for checkCount in range( 0, 5 ):
-                    time.sleep( 10 )
-                    main.ONOSbench.handle.sendline( "onos $OC1 summary" )
-                    main.ONOSbench.handle.expect( ":~" )
-                    flowCheck = main.ONOSbench.handle.before
-                    if "flows=0," in flowCheck:
-                        main.log.info( toInstall + " removed" )
-                        break
-                    else:
-                        for line in flowCheck.splitlines():
-                            if "flows=" in line:
-                                main.log.info( "Current Summary: " + line )
-                    if checkCount == 2:
-                        main.log.info( toInstall + " are stuck, moving on " )
+        main.log.info( "raw data: " + str( data ) )
+        main.log.info( "maxes:" + str( maxes ) )
 
 
-                time.sleep( 5 )
+        # report data
+        print( "" )
+        main.log.info( "\t Results (measurments are in milliseconds)" )
+        print( "" )
 
-            main.log.info( "raw data: " + str( data ) )
-            main.log.info( "maxes:" + str( maxes ) )
+        nodeString = ""
+        for i in range( 1, int( servers ) + 1 ):
+            nodeString += ( "\tNode " + str( i ) )
 
+        for test in range( 0, sampleSize ):
+            main.log.info( "\t Test iteration " + str( test + 1 ) )
+            main.log.info( "\t------------------" )
+            main.log.info( nodeString )
+            resultString = ""
 
-            # report data
-            print( "" )
-            main.log.info( "\t Results (measurments are in milliseconds)" )
-            print( "" )
+            for i in range( 0, int( servers ) ):
+                resultString += ( "\t" + str( data[ test ][ i ] ) )
+            main.log.info( resultString )
+            print( "\n" )
 
-            nodeString = ""
-            for i in range( 1, int( servers ) + 1 ):
-                nodeString += ( "\tNode " + str( i ) )
+        avgOfMaxes = numpy.mean( maxes )
+        main.log.info( "Average of max value from each test iteration: " + str( avgOfMaxes ) )
 
-            for test in range( 0, sampleSize ):
-                main.log.info( "\t Test iteration " + str( test + 1 ) )
-                main.log.info( "\t------------------" )
-                main.log.info( nodeString )
-                resultString = ""
+        stdOfMaxes = numpy.std( maxes )
+        main.log.info( "Standard Deviation of max values: " + str( stdOfMaxes ) )
+        print( "\n\n" )
 
-                for i in range( 0, int( servers ) ):
-                    resultString += ( "\t" + str( data[ test ][ i ] ) )
-                main.log.info( resultString )
+        avgTP = int( installCount )  / avgOfMaxes #result in kflows/second
 
-                print( "\n" )
+        tp = []
+        for i in maxes:
+            tp.append( ( int( installCount ) / i ) )
 
-            avgOfMaxes = numpy.mean( maxes )
-            main.log.info( "Average of max value from each test iteration: " + str( avgOfMaxes ) )
+        stdTP = numpy.std( tp )
 
-            stdOfMaxes = numpy.std( maxes )
-            main.log.info( "Standard Deviation of max values: " + str( stdOfMaxes ) )
-            print( "\n\n" )
+        main.log.info( "Average thoughput:  " + str( avgTP ) + " K" + toInstall + "/second" )
+        main.log.info( "Standard deviation of throughput: " + str( stdTP ) + " K" + toInstall + "/second" )
 
-            avgTP = int( installCount )  / avgOfMaxes #result in kflows/second
+        resultsLog = open( str( resultFile ), "a" )
+        resultString = ( "'" + main.commit + "'," )
+        resultString += ( "'1gig'," )
+        resultString += ( str( installCount ) + "," )
+        resultString += ( str( main.Cluster.numCtrls ) + "," )
+        resultString += ( neighbors + "," )
+        resultString += ( str( avgTP ) + "," + str( stdTP ) + "\n" )
+        resultsLog.write( resultString )
+        resultsLog.close()
 
-            tp = []
-            for i in maxes:
-                tp.append( ( int( installCount ) / i ) )
-
-            stdTP = numpy.std( tp )
-
-            main.log.info( "Average thoughput:  " + str( avgTP ) + " K" + toInstall + "/second" )
-            main.log.info( "Standard deviation of throughput: " + str( stdTP ) + " K" + toInstall + "/second" )
-
-            resultsLog = open( str( resultFile ), "a" )
-            resultString = ( "'" + main.commit + "'," )
-            resultString += ( "'1gig'," )
-            resultString += ( str( installCount ) + "," )
-            resultString += ( str( main.Cluster.numCtrls ) + "," )
-            resultString += ( str( n ) + "," )
-            resultString += ( str( avgTP ) + "," + str( stdTP ) + "\n" )
-            resultsLog.write( resultString )
-            resultsLog.close()
-
-            main.log.report( "Result line to file: " + resultString )
+        main.log.report( "Result line to file: " + resultString )
 
         main.ONOSbench.logReport( main.Cluster.active( 0 ).ipAddress, [ "ERROR", "WARNING", "EXCEPT" ], outputMode="d" )
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params
index 6914862..cf5e7e8 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params
@@ -65,7 +65,7 @@
         <numKeys>40000</numKeys>
         <numKeysFlowObj>4000</numKeysFlowObj>
         <cyclePeriod>1000</cyclePeriod>
-        <neighbors>0,a</neighbors>           #a == all nodes (-1)
+        <neighbors>0,0,a,0,a,0,a</neighbors>           #a == all nodes (-1)
         <skipReleaseResourcesOnWithdrawal>true</skipReleaseResourcesOnWithdrawal>
         <flowObj>False</flowObj>
     </TEST>
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
index 70fcfb0..a781698 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
@@ -74,6 +74,7 @@
             main.nullProviderCfg = main.params[ 'CFG' ][ 'nullProvider' ]
             main.linkCollectionIntentCfg = main.params[ 'CFG' ][ 'linkCollectionIntent' ]
             main.intentPerfInstallerCfg = main.params[ 'CFG' ][ 'intentPerfInstaller' ]
+            main.neighbor = ( main.params[ 'TEST' ][ 'neighbors' ] ).split( "," )
             main.timeout = int( main.params[ 'SLEEP' ][ 'timeout' ] )
             main.cyclePeriod = main.params[ 'TEST' ][ 'cyclePeriod' ]
             if main.flowObj == "True":
@@ -90,9 +91,6 @@
             main.log.info( "Create Database file " + main.dbFileName )
             resultsDB = open( main.dbFileName, "w+" )
             resultsDB.close()
-
-            # set neighbors
-            main.neighbors = "1"
         except Exception as e:
             main.testSetUp.envSetupException( e )
         main.testSetUp.evnSetupConclusion( stepResult )
@@ -104,7 +102,6 @@
         main.maxNumBatch = 0
         main.testSetUp.ONOSSetUp( main.MN1Ip, main.Cluster, True,
                                   cellName=main.cellName, killRemoveMax=False )
-
         # config apps
         main.Cluster.active( 0 ).CLI.setCfg( main.intentManagerCfg,
                                              "skipReleaseResourcesOnWithdrawal " + main.skipRelRsrc )
@@ -123,27 +120,17 @@
         # balanceMasters
         main.Cluster.active( 0 ).CLI.balanceMasters()
         time.sleep( main.startUpSleep )
-
     def CASE2( self, main ):
         import numpy
 
         main.log.info( "Cluster Count = " + str( main.Cluster.numCtrls ) )
-        # adjust neighbors
-        if main.Cluster.numCtrls == 1:
-            main.neighbors = "0"
-            main.log.info( "Neighbors: 0" )
-        elif main.neighbors != "0":
-            main.neighbors = "0"
-            main.log.info( "Neighbors: 0" )
-        elif main.neighbors == "0":
-            main.neighbors = str( main.Cluster.numCtrls - 1 )
-            main.log.info( "Neighbors: " + main.neighbors )
-
+        neighbors = '0' if main.neighbor.pop( 0 ) == '0' else str( main.Cluster.numCtrls - 1 )
+        main.log.info( "Neighbors: " + neighbors )
         main.log.info( "Config intent-perf app" )
         main.Cluster.active( 0 ).CLI.setCfg( main.intentPerfInstallerCfg,
                                              "numKeys " + main.numKeys )
         main.Cluster.active( 0 ).CLI.setCfg( main.intentPerfInstallerCfg,
-                                             "numNeighbors " + str( main.neighbors ) )
+                                             "numNeighbors " + neighbors )
         main.Cluster.active( 0 ).CLI.setCfg( main.intentPerfInstallerCfg,
                                              "cyclePeriod " + main.cyclePeriod )
 
@@ -172,7 +159,7 @@
                 resultString += "'1gig',"
                 resultString += str( main.Cluster.numCtrls ) + ","
                 resultString += "'baremetal" + str( nodes + 1 ) + "',"
-                resultString += main.neighbors + ","
+                resultString += neighbors + ","
                 resultString += result[ main.Cluster.active( nodes ).ipAddress ] + ","
                 resultString += str( 0 ) + "\n"  # no stddev
                 resultDB.write( resultString )