Changes to tests and test names, updates tmplate
diff --git a/TestON/tests/IntentEventTP/IntentEventTP.params b/TestON/tests/IntentEventTP/IntentEventTP.params
new file mode 100644
index 0000000..4a921a3
--- /dev/null
+++ b/TestON/tests/IntentEventTP/IntentEventTP.params
@@ -0,0 +1,49 @@
+<PARAMS>
+
+ <testcases>1,3,2,3,2,3</testcases>
+
+ <ENV>
+ <cellName>defaultCell</cellName>
+ <cellFeatures>onos-app-demo,onos-rest,onos-core,onos-app-proxyarp,onos-app-metrics,onos-app-metrics-intent,onos-app-metrics-topology</cellFeatures>
+ </ENV>
+
+ <SCALE>1</SCALE>
+
+ <GIT>
+ <autopull>on</autopull>
+ <checkout>master</checkout>
+ </GIT>
+
+ <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>
+ </CTRL>
+
+ <MN>
+ <ip1>10.128.5.59</ip1>
+ </MN>
+
+ <BENCH>
+ <user>admin</user>
+ <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>intents-events-metrics|grep "Intent Installed Events"</metric1>
+ <duration>300</duration>
+ <log_interval>25</log_interval>
+ </TEST>
+
+ <JSON>
+ <intents_rate>intentInstalledRate</intents_rate>
+ </JSON>
+
+</PARAMS>
diff --git a/TestON/tests/IntentEventTP/IntentEventTP.py b/TestON/tests/IntentEventTP/IntentEventTP.py
new file mode 100644
index 0000000..c40ebf9
--- /dev/null
+++ b/TestON/tests/IntentEventTP/IntentEventTP.py
@@ -0,0 +1,242 @@
+# ScaleOutTemplate -> NullProviderTest
+#
+# CASE1 starts number of nodes specified in param file
+#
+# cameron@onlab.us
+
+
+class IntentEventTP:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ import os.path
+ global clusterCount
+ global ONOSIp
+ clusterCount = 1
+ ONOSIp = []
+ checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
+ gitPull = main.params[ 'GIT' ][ 'autopull' ]
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+ BENCHUser = main.params[ 'BENCH' ][ 'user' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOSIp.append(ONOS1Ip)
+ ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+ ONOSIp.append(ONOS2Ip)
+ ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+ ONOSIp.append(ONOS3Ip)
+ MN1Ip = main.params[ 'MN' ][ 'ip1' ]
+ Features= main.params[ 'ENV' ][ 'cellFeatures' ]
+
+
+ main.ONOSbench.createCellFile(BENCHIp, cellName, MN1Ip,str(Features), ONOS1Ip, ONOS2Ip, ONOS3Ip)
+
+ main.log.step( "Cleaning Enviornment..." )
+ main.ONOSbench.onosUninstall( ONOS1Ip )
+ main.ONOSbench.onosUninstall( ONOS2Ip )
+ main.ONOSbench.onosUninstall( ONOS3Ip )
+
+ 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" )
+
+ #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.log.info("Modifying org.onosproject.provider.nil.link.impl.NullLinkProvider.cfg: Turning off flicker ")
+ homeDir = os.path.expanduser('~')
+ main.log.info(homeDir)
+ localPath = "/ONOS/tools/package/etc/org.onosproject.provider.nil.link.impl.NullLinkProvider.cfg"
+ filePath = homeDir + localPath
+ main.log.info(filePath)
+
+ configFile = open(filePath, 'w+')
+ main.log.info("file opened")
+ configFile.write("# Sample configurations for the NullLinkProvider.\n")
+ configFile.write("# \n")
+ configFile.write("# If enabled, generates LinkDetected and LinkVanished events\n")
+ configFile.write("# to make the link appear to be flapping.\n")
+ configFile.write("#\n")
+ configFile.write("# flicker = true\n")
+ configFile.write("#\n")
+ configFile.write("# If enabled, sets the time between LinkEvent generation,\n")
+ configFile.write("# in milliseconds.\n")
+ configFile.write("#\n")
+ configFile.write("# eventRate = 2000\n")
+
+ configFile.close()
+ main.log.info("Closing config file")
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ main.step( "Installing ONOS package" )
+ install1Result = main.ONOSbench.onosInstall( node=ONOS1Ip )
+
+ 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 )
+
+ ###### UPGRADE FOR SCALABLILTY ######
+ jenkinsReport = open('IntentEventTP.csv', 'w')
+ jenkinsReport.write("T1 - Node 1, T2 - Node 1, T2 - Node 2, T3 - Node 1, T3 - Node 2, T3 - Node 3\n")
+ jenkinsReport.close
+ #####################################
+
+ def CASE2( self, main ):
+ ''
+ '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 defined
+ 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(ONOS2Ip)
+
+ if clusterCount == 3: main.log.info( "Installing node 3" )
+ install3Result = main.ONOSbench.onosInstall( node=ONOS3Ip )
+ cli3 = main.ONOS3cli.startOnosCli(ONOS3Ip)
+
+
+ def CASE3( self, main ):
+
+ import os.path
+ import sys
+ import json
+ import time
+
+ main.log.info("Cluster Count = " + str(clusterCount))
+
+ defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
+ intentsRate = main.params['JSON']['intents_rate']
+
+ for i in range( 0,clusterCount ): #iterates over nodes
+ switchNum = i
+ while switchNum < 7: #iterates over applicable switches
+ main.Mininet1.assignSwController(sw = switchNum + 1, ip1 = ONOSIp[i], port1 = defaultSwPort)
+ main.log.info("ONOS " + str(i + 1) + " assigned switch : " + str(switchNum+1))
+ switchNum += clusterCount
+
+ main.log.info("running arping")
+ mnArp = main.params['TEST']['arping']
+ main.Mininet1.handle.sendline( mnArp )
+
+ generateLoad = main.params[ 'TEST' ][ 'loadstart' ]
+
+ for node in range(1, clusterCount+1):
+ exec "a = main.ONOS%s.handle.sendline" %str(node)
+ a(generateLoad)
+ main.log.info("Load initiated on node " + str(node))
+
+ #
+ # TODO: Confirm Load somehow
+ #
+
+ getMetric = main.params[ 'TEST' ][ 'metric1' ]
+ testDuration = main.params[ 'TEST' ][ 'duration' ]
+ stop = time.time() + float( testDuration )
+
+ main.log.info( "Starting test loop for " + str(testDuration) + " seconds..." )
+ logInterval = main.params[ 'TEST' ][ 'log_interval' ]
+
+
+ rateResult = [0,0,0,0,0,0,0,0]
+ while time.time() < stop:
+ time.sleep( float( logInterval ) )
+ for node in range (1, clusterCount + 1):
+ exec "a = main.ONOS%scli.intentsEventsMetrics" %str(node)
+ intentsJsonObj = json.loads(a())
+
+ main.log.info( "Node " + str(node) + " rate: " + str( intentsJsonObj[ intentsRate ][ 'm1_rate' ] ) )
+ rateResult[node] = round(intentsJsonObj[ intentsRate ][ 'm1_rate' ], 2)
+
+ stopLoad = main.params[ 'TEST' ][ 'loadstop' ]
+
+ jenkinsReport = open('IntentEventTP.csv', 'a')
+ for node in range(1, clusterCount + 1):
+ main.log.report("Cluster Size = " + str(clusterCount) + " Final on node " + str(node) + ": " + str(rateResult[node]))
+ exec "a = main.ONOS%s.handle.sendline" %str(node)
+ a(stopLoad)
+ jenkinsReport.write(str(rateResult[node]))
+ jenkinsReport.write(", ")
+ jenkinsReport.close()
+
+
+
+
+
+
+
+
+
+
diff --git a/TestON/tests/IntentEventTP/IntentEventTP.topo b/TestON/tests/IntentEventTP/IntentEventTP.topo
new file mode 100644
index 0000000..8f0662e
--- /dev/null
+++ b/TestON/tests/IntentEventTP/IntentEventTP.topo
@@ -0,0 +1,85 @@
+<TOPOLOGY>
+
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>10.128.5.55</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOSbench>
+
+ <ONOS1cli>
+ <host>10.128.5.55</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS1cli>
+
+ <ONOS2cli>
+ <host>10.128.5.55</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS2cli>
+
+ <ONOS3cli>
+ <host>10.128.5.55</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS3cli>
+
+ <ONOS1>
+ <host>10.128.5.51</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS1>
+
+ <ONOS2>
+ <host>10.128.5.52</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS2>
+
+ <ONOS3>
+ <host>10.128.5.53</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>7</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 ~/topo-intentTPtest.py </arg1>
+ <arg2> --mac --topo mytopo</arg2>
+ <arg3> </arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet1>
+
+ </COMPONENT>
+
+</TOPOLOGY>
+
diff --git a/TestON/tests/IntentEventTP/__init__.py b/TestON/tests/IntentEventTP/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/IntentEventTP/__init__.py