updated script to use push-test-intents and null provider
-may not be useful
diff --git a/TestON/tests/pushTestIntents/pushTestIntents.params b/TestON/tests/pushTestIntents/pushTestIntents.params
index f4de821..c6b79d5 100644
--- a/TestON/tests/pushTestIntents/pushTestIntents.params
+++ b/TestON/tests/pushTestIntents/pushTestIntents.params
@@ -1,13 +1,24 @@
 <PARAMS>
 
-    <testcases>1,3</testcases>
+    <testcases>1,2,3,2,3,2,3</testcases>
 
+    <SCALE>2</SCALE>
+    <availableNodes>7</availableNodes>
+ 
     <ENV>
         <cellName>defaultCell</cellName>
-        <cellFeatures></cellFeatures>
+        <cellFeatures>webconsole,onos-core,onos-api,onos-cli,onos-null,onos-gui,onos-rest,onos-app-metrics,onos-app-metrics-intent,onos-app-metrics-topology </cellFeatures>
     </ENV>
 
-    <SCALE>1</SCALE>
+    <TEST>
+        <skipCleanInstall>yes</skipCleanInstall>
+        <switchCount>7</switchCount>
+        <warmUp>4</warmUp>
+        <sampleSize>10</sampleSize>                     
+        <wait></wait>
+        <intents>1,1000</intents>                       #list format, will be split on ','
+        <debug></debug>                          #empty for false/no
+    </TEST>
 
     <GIT>
         <autopull>on</autopull>
@@ -16,12 +27,28 @@
 
     <CTRL>
         <USER>admin</USER>
+        
         <ip1>10.128.5.51</ip1>
         <port1>6633</port1>
+        
         <ip2>10.128.5.52</ip2>
         <port2>6633</port2>
+        
         <ip3>10.128.5.53</ip3>
         <port3>6633</port3>
+        
+        <ip4>10.128.5.54</ip4>
+        <port4>6633</port4>
+        
+        <ip5>10.128.5.65</ip5>
+        <port5>6633</port5>
+        
+        <ip6>10.128.5.66</ip6>
+        <port6>6633</port6> 
+       
+        <ip7>10.128.5.67</ip7>
+        <port7>6633</port7>
+
     </CTRL>
 
     <MN>
@@ -33,15 +60,6 @@
         <ip1>10.128.5.55</ip1>
     </BENCH>
 
-    <TEST>
-        <loadstart>curl --fail http://localhost:8181/onos/demo/intents/setup -H "Content-Type:application/json" -d '{"type" : "random"}'</loadstart>
-        <loadstop>curl --fail http://localhost:8181/onos/demo/intents/teardown</loadstop>
-        <arping>py [h.cmd("arping -c 1 -w 1 10.0.0.225") for h in net.hosts]</arping>
-        <metric1>push-test-intents</metric1>
-        <cycles>30</cycles>
-        <batch>1,10,100,1000,10000</batch>  #can be any value/length, must not have spaces next to commas!
-    </TEST>
-
     <JSON>
     </JSON>
 
diff --git a/TestON/tests/pushTestIntents/pushTestIntents.py b/TestON/tests/pushTestIntents/pushTestIntents.py
index 5463acf..d5623cf 100644
--- a/TestON/tests/pushTestIntents/pushTestIntents.py
+++ b/TestON/tests/pushTestIntents/pushTestIntents.py
@@ -5,7 +5,7 @@
 # cameron@onlab.us
 
 import sys
-import os
+import os.path
 
 
 class pushTestIntents:
@@ -13,179 +13,242 @@
     def __init__( self ):
         self.default = ''
 
-    def CASE1( self, main ):
-
-        global clusterCount
+    def CASE1( self, main ):            #This is the initialization case
+                                        #this case will clean up all nodes 
+        import time                     #but only node 1 is started in this case
+        
+        global clusterCount             #number of nodes running
+        global ONOSIp                   #list of ONOS IP addresses 
         clusterCount = 1
+        ONOSIp = [ 0 ]
 
+
+        #Load values from params file
         checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
         gitPull = main.params[ 'GIT' ][ 'autopull' ]
         cellName = main.params[ 'ENV' ][ 'cellName' ]
+        Features= main.params[ 'ENV' ][ 'cellFeatures' ]
         BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
         BENCHUser = main.params[ 'BENCH' ][ 'user' ]
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
-        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
         MN1Ip = main.params[ 'MN' ][ 'ip1' ]
-        Features= main.params[ 'ENV' ][ 'cellFeatures' ]
+        maxNodes = int(main.params[ 'availableNodes' ])
+        Features = main.params[ 'ENV' ][ 'cellFeatures' ]
+        skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
+        switchCount = main.params[ 'TEST' ][ 'switchCount' ]
 
-        main.ONOSbench.createCellFile(BENCHIp, cellName, MN1Ip,str(Features), ONOS1Ip, ONOS2Ip, ONOS3Ip)
+        #Populate ONOSIp with ips from params 
+        for i in range(1, maxNodes + 1): 
+            ipString = 'ip' + str(i) 
+            ONOSIp.append(main.params[ 'CTRL' ][ ipString ])   
+    
+        tempIp = []
+        for node in range( 1, clusterCount + 1):
+            tempIp.append(ONOSIp[node])
 
+        #kill off all onos processes 
+        main.log.step("Safety check, killing all ONOS processes")
+        main.log.step("before initiating enviornment setup")
+        for node in range(1, maxNodes + 1):
+            main.ONOSbench.onosDie(ONOSIp[node])
+
+        #construct the cell file
+        main.log.info("Creating cell file")
+        exec "a = main.ONOSbench.createCellFile"
+        cellIp = []
+        for node in range (1, clusterCount + 1):
+            cellIp.append(ONOSIp[node])
+        a(BENCHIp,cellName,MN1Ip,str(Features), *cellIp)
+
+        main.step( "Applying cell file to environment" )
+        cellApplyResult = main.ONOSbench.setCell( cellName )
+
+        #Uninstall everywhere
         main.log.step( "Cleaning Enviornment..." )
-        main.ONOSbench.onosUninstall( ONOS1Ip )
-        main.ONOSbench.onosUninstall( ONOS2Ip )
-        main.ONOSbench.onosUninstall( ONOS3Ip )
+        for i in range(1, maxNodes + 1):
+            main.log.info(" Uninstalling ONOS " + str(i) )
+            main.ONOSbench.onosUninstall( ONOSIp[i] )
+        
+        #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
+        if skipMvn != "yes":
+            mvnResult = main.ONOSbench.cleanInstall()
+                        
+            #git
+            main.step( "Git checkout and pull " + checkoutBranch )
+            if gitPull == 'on':
+                checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
+                pullResult = main.ONOSbench.gitPull()
 
-        main.step( "Git checkout and pull " + checkoutBranch )
-        if gitPull == 'on':
-            checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
-            pullResult = main.ONOSbench.gitPull()
+            else:
+                checkoutResult = main.TRUE
+                pullResult = main.TRUE
+                main.log.info( "Skipped git checkout and pull" )
 
-        else:
-            checkoutResult = main.TRUE
-            pullResult = main.TRUE
-            main.log.info( "Skipped git checkout and pull" )
-
-        #mvnResult = main.ONOSbench.cleanInstall()
-
-        main.step( "Set cell for ONOS cli env" )
-        main.ONOS1cli.setCell( cellName )
-        main.ONOS2cli.setCell( cellName )
-        main.ONOS3cli.setCell( cellName )
-
+        main.ONOSbench.createLinkGraphFile(BENCHIp, tempIp, switchCount)
+        main.ONOSbench.createNullDevProviderFile(BENCHIp, tempIp, switchCount)
+        main.ONOSbench.createNullLinkProviderFile(BENCHIp)
+ 
         main.step( "Creating ONOS package" )
         packageResult = main.ONOSbench.onosPackage()  
 
         main.step( "Installing ONOS package" )
-        install1Result = main.ONOSbench.onosInstall( node=ONOS1Ip )
+        install1Result = main.ONOSbench.onosInstall( node=ONOSIp[1] )
 
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        main.step( "Applying cell file to environment" )
-        cellApplyResult = main.ONOSbench.setCell( cellName )
         main.step( "verify cells" )
         verifyCellResult = main.ONOSbench.verifyCell()
 
         main.step( "Set cell for ONOS cli env" )
-        cli1 = main.ONOS1cli.startOnosCli( ONOS1Ip )
+        cli1 = main.ONOS1cli.startOnosCli( ONOSIp[1] )
 
+        
     def CASE2( self, main ):
-        ''
+        # This case increases the cluster size by whatever scale is
+        # Note: 'scale' is the size of the step
+        # if scaling is not a part of your test, simply run this case
+        # once after CASE1 to set up your enviornment for your desired 
+        # cluster size. If scaling is a part of you test call this case each time 
+        # you want to increase cluster size
+
+        ''                                                         
         'Increase number of nodes and initiate CLI'
         ''
         import time
-
         global clusterCount
-
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
-        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
-        #ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ]
-        #ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ]
-        #ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ]
-        #ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ]
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        scale = int( main.params[ 'SCALE' ] )
-
-        # Cluster size increased everytime the case is run
-        clusterCount += scale
-
-        main.log.report( "Increasing cluster size to " +
-                         str( clusterCount ) )
-        installResult = main.FALSE
-
-        if scale == 2:
-            if clusterCount == 3:
-                main.log.info( "Installing nodes 2 and 3" )
-                install2Result = main.ONOSbench.onosInstall( node=ONOS2Ip )
-                install3Result = main.ONOSbench.onosInstall( node=ONOS3Ip )
-                cli2 = main.ONOS2cli.startOnosCli(ONOS2Ip)
-                cli3 = main.ONOS3cli.startOnosCli(ONOS3Ip)
-
-            
-            #elif clusterCount == 5:
-
-            #    main.log.info( "Installing nodes 4 and 5" )
-            #    node4Result = main.ONOSbench.onosInstall( node=ONOS4Ip )
-            #    node5Result = main.ONOSbench.onosInstall( node=ONOS5Ip )
-            #    installResult = node4Result and node5Result
-            #    time.sleep( 5 )
-
-            #    main.ONOS4cli.startOnosCli( ONOS4Ip )
-            #    main.ONOS5cli.startOnosCli( ONOS5Ip )
-
-            #elif clusterCount == 7:
-
-            #    main.log.info( "Installing nodes 4 and 5" )
-            #    node6Result = main.ONOSbench.onosInstall( node=ONOS6Ip )
-            #    node7Result = main.ONOSbench.onosInstall( node=ONOS7Ip )
-            #    installResult = node6Result and node7Result
-            #    time.sleep( 5 )
-    
-            #    main.ONOS6cli.startOnosCli( ONOS6Ip )
-            #    main.ONOS7cli.startOnosCli( ONOS7Ip )
-            #
-
-        if scale == 1:
-            if clusterCount == 2:
-                main.log.info( "Installing node 2" )
-                install2Result = main.ONOSbench.onosInstall( node=ONOS2Ip )
-                cli2 = main.ONOS2cli.startOnosCli(ONOS2_ip)
-
-            if clusterCount == 3:
-                main.log.info( "Installing node 3" )
-                install3Result = main.ONOSbench.onosInstall( node=ONOS3Ip )
-                cli3 = main.ONOS3cli.startOnosCli(ONOS3_ip)
-
-
-    def CASE3( self, main ):
-
-        import subprocess 
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-        defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
-
-        main.Mininet1.assignSwController(
-            sw="1",
-            ip1=ONOS1Ip,
-            port1=defaultSwPort )
-        main.Mininet1.assignSwController(
-            sw="2",
-            ip1=ONOS1Ip,
-            port1=defaultSwPort )
-        main.Mininet1.assignSwController(
-            sw="3",
-            ip1=ONOS1Ip,
-            port1=defaultSwPort )
-        main.Mininet1.assignSwController(
-            sw="4",
-            ip1=ONOS1Ip,
-            port1=defaultSwPort )
-        main.Mininet1.assignSwController(
-            sw="5",
-            ip1=ONOS1Ip,
-            port1=defaultSwPort )
-        main.Mininet1.assignSwController(
-            sw="6",
-            ip1=ONOS1Ip,
-            port1=defaultSwPort )
-        main.Mininet1.assignSwController(
-            sw="7",
-            ip1=ONOS1Ip,
-            port1=defaultSwPort )
-
-        mnArp = main.params[ 'TEST' ][ 'arping' ]
-        main.Mininet1.handle.sendline( mnArp ) 
-
-        getMetric = main.params[ 'TEST' ][ 'metric1' ]
         
-        batch = main.params[ 'TEST' ][ 'batch' ]
-        batchSize = batch.split(",")
-        iterations = main.params[ 'TEST' ][ 'cycles' ]
+        BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+        scale = int( main.params[ 'SCALE' ] )
+        clusterCount += scale
+        switchCount = main.params[ 'TEST' ][ 'switchCount' ]        
 
-        for size in batchSize:
-            commandString = """ "onos """ + ONOS1Ip + " '" + getMetric + " "  + size + "'" + """" """ 
-            output = subprocess.check_output(commandString,shell=True)
-            outjson=json.loads(output) 
-            print outjson 
+        main.log.info("Creating cell file")
+        exec "a = main.ONOSbench.createCellFile"
+        cellIp = []
+        for node in range (1, clusterCount + 1):
+            cellIp.append(ONOSIp[node])
+        a(BENCHIp,cellName,MN1Ip,str(Features), *cellIp) 
+    
+        main.step( "Applying cell file to environment" )
+        cellApplyResult = main.ONOSbench.setCell( cellName )
+
+        #Uninstall everywhere
+        main.log.step( "Cleaning Enviornment..." )
+        for node in range(1, maxNodes + 1):
+            main.ONOSbench.onosDie(ONOSIp[node])
+            main.log.info(" Uninstalling ONOS " + str(node) )
+            main.ONOSbench.onosUninstall( ONOSIp[node] )
+
+        tempIp = []
+        for node in range( 1, clusterCount + 1): 
+            tempIp.append(ONOSIp[node]) 
+
+        main.ONOSbench.createLinkGraphFile(BENCHIp, tempIp, switchCount) 
+        main.ONOSbench.createNullDevProviderFile(BENCHIp, tempIp, switchCount)
+        main.ONOSbench.createNullLinkProviderFile(BENCHIp)
+
+        main.ONOSbench.onosPackage()
+
+        main.log.report( "Increasing cluster size to " + str( clusterCount ) )
+        for node in range(1, clusterCount + 1):
+            main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])    
+            main.ONOSbench.onosInstall( node=ONOSIp[node])
+            if node == 1: 
+                main.ONOS1cli.startOnosCli( ONOSIp[1] )
+            
+        for node in range(1, clusterCount + 1):       
+            for i in range( 2 ):
+                isup = main.ONOSbench.isup( ONOSIp[node] )
+                if isup:
+                    main.log.info("ONOS " + str(node) + " is up\n")
+                    break
+            if not isup:
+                main.log.report( "ONOS " + str(node) + " didn't start!" ) 
+    
+    def CASE3( self, main ): 
+
+        import time 
+        import numpy 
+        
+
+        sampleSize = int(main.params[ 'TEST' ][ 'sampleSize' ]) 
+        warmUp = int(main.params[ 'TEST' ][ 'warmUp' ])
+        intentsList = (main.params[ 'TEST' ][ 'intents' ]).split(",")
+        switchCount = int(main.params[ 'TEST' ][ 'switchCount' ])
+        debug = main.params[ 'TEST' ][ 'switchCount' ]
+        for i in range(0,len(intentsList)):
+            intentsList[i] = int(intentsList[i]) 
+         
+   
+        linkCount = 0
+        while True:
+            main.ONOSbench.handle.sendline("onos $OC1 links|wc -l")
+            main.ONOSbench.handle.expect(":~")
+            linkCount = main.ONOSbench.handle.before    
+            if debug: main.log.info("Link Count check: " + linkCount)   
+            if str((switchCount*2)-2) in linkCount: 
+                break 
+    
+        links = "--" 
+        while "=null:" not in links:
+            if debug: main.log.info("top of loop")
+            main.ONOSbench.handle.sendline("onos $OC1 links") 
+            main.ONOSbench.handle.expect(":~")
+            links = main.ONOSbench.handle.before
+            if debug: main.log.info(str(links)) 
+            time.sleep(1) 
+        links = links.splitlines()
+        templinks = links                
+                                   
+        tempDevices = []
+        for line in links: 
+            temp = line.split(" ") 
+            temp[0].replace("src=","")
+            temp[0] = (temp[0].split("/"))[0]
+            tempDevices.append(temp[0])                    
+
+        tempDevices.sort()
+        devices = []
+        for i in tempDevices: 
+            if "src=null" in i:
+                devices.append(i.replace("src=", ""))       
+        if debug: main.log.info(str(devices))
+
+        ingress = devices[0]
+        egress = devices.pop()               
+        if debug: main.log.info(ingress)
+        if debug: main.log.info(egress)
+
+        for intentSize in intentsList:
+            cmd = "onos $OC1 push-test-intents "
+            cmd += ingress + "/6 "
+            cmd += egress + "/5 "
+            cmd += str(intentSize) + " 1"
+            installed = []
+            withdrawn = []
+
+            for run in range(0, (warmUp + sampleSize)):
+        
+                myRawResult = "--"
+                while "ms" not in myRawResult:
+                    main.ONOSbench.handle.sendline(cmd)
+                    main.ONOSbench.handle.expect(":~")
+                    myRawResult = main.ONOSbench.handle.before
+                    if debug: main.log.info(myRawResult)
+
+                main.log.info(myRawResult)  
+
+                if run >= warmUp: 
+                    myRawResult = myRawResult.splitlines()
+                    for line in myRawResult:
+                        if "install" in line:
+                            installed.append(line.split(" ")[5])  
+                        if "withdrawn" in line: 
+                            withdrawn.append(line.split(" ")[5])
+                    print(installed)
+                    print(withdrawn)
+            
+            main.log.info("Scale: " + str(clusterCount) + "\tIntent batch size: " + str(intentSize)) 
+            
+                
+                time.sleep(5)
 
 
 
@@ -195,14 +258,3 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-       
diff --git a/TestON/tests/pushTestIntents/pushTestIntents.topo b/TestON/tests/pushTestIntents/pushTestIntents.topo
index 88c4d35..30a1467 100644
--- a/TestON/tests/pushTestIntents/pushTestIntents.topo
+++ b/TestON/tests/pushTestIntents/pushTestIntents.topo
@@ -8,7 +8,7 @@
             <password>onos_test</password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
+            <COMPONENTS><home>~/onos</home></COMPONENTS>
         </ONOSbench>
 
         <ONOS1cli>
@@ -19,7 +19,7 @@
             <connect_order>2</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS1cli>
-        
+
         <ONOS2cli>
             <host>10.128.5.55</host>
             <user>admin</user>
@@ -38,12 +38,48 @@
             <COMPONENTS> </COMPONENTS>
         </ONOS3cli>
 
+        <ONOS4cli>
+            <host>10.128.5.55</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS4cli>
+
+        <ONOS5cli>
+            <host>10.128.5.55</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS5cli>
+
+        <ONOS6cli>
+            <host>10.128.5.55</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS6cli>
+
+        <ONOS7cli>
+            <host>10.128.5.55</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS7cli>
+
         <ONOS1>
             <host>10.128.5.51</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
-            <connect_order>5</connect_order>
+            <connect_order>9</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS1>
 
@@ -52,7 +88,7 @@
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
-            <connect_order>6</connect_order>
+            <connect_order>10</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS2>
 
@@ -61,25 +97,50 @@
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
-            <connect_order>7</connect_order>
+            <connect_order>11</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS3>
 
-        <Mininet1>
-            <host>10.128.5.59</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-                <arg1> --custom ~/mininet/custom/topo-2sw-2host.py </arg1>
-                <arg2> --arp --mac --topo mytopo</arg2>
-                <arg3> </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet1>
+        <ONOS4>
+            <host>10.128.5.54</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>12</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS4>
+
+    
+        <ONOS5>
+            <host>10.128.5.65</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>13</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS5>
+
+        <ONOS6>
+            <host>10.128.5.66</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>14</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS6>
+
+        <ONOS7>
+            <host>10.128.5.67</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>15</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS7>
 
     </COMPONENT>
 
 </TOPOLOGY>
 
+
+