Merge branch 'master' of https://github.com/OPENNETWORKINGLAB/ONLabTest
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.py b/TestON/tests/TopoPerfNext/TopoPerfNext.py
index 12e53e5..7f464ac 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.py
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.py
@@ -69,7 +69,7 @@
main.ONOSbench.onosUninstall( nodeIp=ONOS4Ip )
main.ONOSbench.onosUninstall( nodeIp=ONOS5Ip )
main.ONOSbench.onosUninstall( nodeIp=ONOS6Ip )
- #main.ONOSbench.onosUninstall( nodeIp=ONOS7Ip )
+ main.ONOSbench.onosUninstall( nodeIp=ONOS7Ip )
main.step( "Creating cell file" )
cellFileResult = main.ONOSbench.createCellFile(
@@ -201,6 +201,12 @@
latencyT0ToDeviceList = []
latencyTcpToOfpList = []
+ # Initialize 2d array for [node][iteration] storage
+ endToEndLatNodeIter = numpy.zeros(( clusterCount, int(numIter) ))
+ ofpToGraphLatNodeIter = numpy.zeros(( clusterCount, int(numIter) ))
+ # tcp-to-ofp measurements are same throughout each iteration
+ tcpToOfpLatIter = []
+
# Directory/file to store tshark results
tsharkOfOutput = "/tmp/tshark_of_topo.txt"
tsharkTcpOutput = "/tmp/tshark_tcp_topo.txt"
@@ -343,15 +349,44 @@
# t0 to device processing latency
deltaDevice1 = int( deviceTimestamp1 ) - int( t0Tcp )
-
# t0 to graph processing latency ( end-to-end )
deltaGraph1 = int( graphTimestamp1 ) - int( t0Tcp )
-
# ofp to graph processing latency ( ONOS processing )
deltaOfpGraph1 = int( graphTimestamp1 ) - int( t0Ofp )
-
# ofp to device processing latency ( ONOS processing )
deltaOfpDevice1 = float( deviceTimestamp1 ) - float( t0Ofp )
+ # tcp to ofp processing latency ( switch connection )
+ deltaTcpOfp1 = int(t0Ofp) - int(t0Tcp)
+
+ if deltaTcpOfp1 > thresholdMin and deltaTcpOfp1 < thresholdMax\
+ and i >= iterIgnore:
+ tcpToOfpLatIter.append(deltaTcpOfp1)
+ main.log.info("iter"+str(i)+" tcp-to-ofp: "+
+ str(deltaTcpOfp1)+" ms")
+ else:
+ tcpToOfpLatIter.append(0)
+ main.log.info("iter"+str(i)+" tcp-to-ofp: "+
+ str(deltaTcpOfp1)+" ms - ignored this iteration")
+
+ # Store initial measurements in data array
+ #This measurement is for node 1
+
+ if deltaGraph1 > thresholdMin and deltaGraph1 < thresholdMax\
+ and i >= iterIgnore:
+ endToEndLatNodeIter[0][i] = deltaGraph1
+ main.log.info("ONOS1 iter"+str(i)+" end-to-end: "+
+ str(deltaGraph1)+" ms")
+ else:
+ main.log.info("ONOS1 iter"+str(i)+" end-to-end: "+
+ str(deltaGraph1)+" ms - ignored this iteration")
+
+
+ if deltaOfpGraph1 > thresholdMin and deltaOfpGraph1 < thresholdMax\
+ and i >= iterIgnore:
+ ofpToGraphLatNodeIter[0][i] = deltaOfpGraph1
+
+ main.log.info("ONOS1 iter"+str(i)+" ofp-to-graph: "+
+ str(deltaOfpGraph1)+" ms")
# TODO: Create even cluster number events
@@ -379,16 +414,31 @@
float( t0Ofp )
deltaOfpDevice3 = float( deviceTimestamp3 ) -\
float( t0Ofp )
- else:
- deltaDevice2 = 0
- deltaDevice3 = 0
- deltaGraph2 = 0
- deltaGraph3 = 0
- deltaOfpGraph2 = 0
- deltaOfpGraph3 = 0
- deltaOfpDevice2 = 0
- deltaOfpDevice3 = 0
+ if deltaGraph2 > thresholdMin and\
+ deltaGraph2 < thresholdMax and i >= iterIgnore:
+ endToEndLatNodeIter[1][i] = deltaGraph2
+ main.log.info("ONOS2 iter"+str(i)+" end-to-end: "+
+ str(deltaGraph2)+" ms")
+
+ if deltaOfpGraph2 > thresholdMin and\
+ deltaOfpGraph2 < thresholdMax and i >= iterIgnore:
+ ofpToGraphLatNodeIter[1][i] = deltaOfpGraph2
+ main.log.info("ONOS2 iter"+str(i)+" ofp-to-graph: "+
+ str(deltaOfpGraph2)+" ms")
+
+ if deltaGraph3 > thresholdMin and\
+ deltaGraph3 < thresholdMax and i >= iterIgnore:
+ endToEndLatNodeIter[2][i] = deltaGraph3
+ main.log.info("ONOS3 iter"+str(i)+" end-to-end: "+
+ str(deltaGraph3)+" ms")
+
+ if deltaOfpGraph3 > thresholdMin and\
+ deltaOfpGraph3 < thresholdMax and i >= iterIgnore:
+ ofpToGraphLatNodeIter[2][i] = deltaOfpGraph3
+ main.log.info("ONOS3 iter"+str(i)+" ofp-to-graph: "+
+ str(deltaOfpGraph3)+" ms")
+
if clusterCount >= 5:
jsonStr4 = main.ONOS4cli.topologyEventsMetrics()
jsonStr5 = main.ONOS5cli.topologyEventsMetrics()
@@ -412,16 +462,32 @@
float( t0Ofp )
deltaOfpDevice5 = float( deviceTimestamp5 ) -\
float( t0Ofp )
- else:
- deltaDevice4 = 0
- deltaDevice5 = 0
- deltaGraph4 = 0
- deltaGraph5 = 0
- deltaOfpGraph4 = 0
- deltaOfpGraph5 = 0
- deltaOfpDevice4 = 0
- deltaOfpDevice5 = 0
+
+ if deltaGraph4 > thresholdMin and\
+ deltaGraph4 < thresholdMax and i >= iterIgnore:
+ endToEndLatNodeIter[3][i] = deltaGraph4
+ main.log.info("ONOS4 iter"+str(i)+" end-to-end: "+
+ str(deltaGraph4)+" ms")
+
+ #TODO:
+ if deltaOfpGraph4 > thresholdMin and\
+ deltaOfpGraph4 < thresholdMax and i >= iterIgnore:
+ ofpToGraphLatNodeIter[3][i] = deltaOfpGraph4
+ main.log.info("ONOS4 iter"+str(i)+" ofp-to-graph: "+
+ str(deltaOfpGraph4)+" ms")
+ if deltaGraph5 > thresholdMin and\
+ deltaGraph5 < thresholdMax and i >= iterIgnore:
+ endToEndLatNodeIter[4][i] = deltaGraph5
+ main.log.info("ONOS5 iter"+str(i)+" end-to-end: "+
+ str(deltaGraph5)+" ms")
+
+ if deltaOfpGraph5 > thresholdMin and\
+ deltaOfpGraph5 < thresholdMax and i >= iterIgnore:
+ ofpToGraphLatNodeIter[4][i] = deltaOfpGraph5
+ main.log.info("ONOS5 iter"+str(i)+" ofp-to-graph: "+
+ str(deltaOfpGraph5)+" ms")
+
if clusterCount >= 7:
jsonStr6 = main.ONOS6cli.topologyEventsMetrics()
jsonStr7 = main.ONOS7cli.topologyEventsMetrics()
@@ -445,119 +511,31 @@
float( t0Ofp )
deltaOfpDevice7 = float( deviceTimestamp7 ) -\
float( t0Ofp )
- else:
- deltaDevice6 = 0
- deltaDevice7 = 0
- deltaGraph6 = 0
- deltaGraph7 = 0
- deltaOfpGraph6 = 0
- deltaOfpGraph7 = 0
- deltaOfpDevice6 = 0
- deltaOfpDevice7 = 0
+
+ if deltaGraph6 > thresholdMin and\
+ deltaGraph6 < thresholdMax and i >= iterIgnore:
+ endToEndLatNodeIter[5][i] = deltaGraph6
+ main.log.info("ONOS6 iter"+str(i)+" end-to-end: "+
+ str(deltaGraph6)+" ms")
+
+ #TODO:
+ if deltaOfpGraph6 > thresholdMin and\
+ deltaOfpGraph6 < thresholdMax and i >= iterIgnore:
+ ofpToGraphLatNodeIter[5][i] = deltaOfpGraph6
+ main.log.info("ONOS6 iter"+str(i)+" ofp-to-graph: "+
+ str(deltaOfpGraph6)+" ms")
- # Get average of delta from all instances
- avgDeltaDevice = \
- ( int( deltaDevice1 ) +
- int( deltaDevice2 ) +
- int( deltaDevice3 ) +
- int( deltaDevice4 ) +
- int( deltaDevice5 ) +
- int( deltaDevice6 ) +
- int( deltaDevice7 ) ) / clusterCount
-
- # Ensure avg delta meets the threshold before appending
- if avgDeltaDevice > 0.0 and avgDeltaDevice < 10000\
- and int( i ) > iterIgnore:
- latencyT0ToDeviceList.append( avgDeltaDevice )
- else:
- main.log.info(
- "Results for t0-to-device ignored" +
- "due to excess in threshold / warmup iteration." )
-
- # Get average of delta from all instances
- # TODO: use max delta graph
- #maxDeltaGraph = max( three )
- avgDeltaGraph = \
- ( int( deltaGraph1 ) +
- int( deltaGraph2 ) +
- int( deltaGraph3 ) +
- int( deltaGraph4 ) +
- int( deltaGraph5 ) +
- int( deltaGraph6 ) +
- int( deltaGraph7 ) ) / clusterCount
-
- # Ensure avg delta meets the threshold before appending
- if avgDeltaGraph > 0.0 and avgDeltaGraph < 10000\
- and int( i ) > iterIgnore:
- latencyEndToEndList.append( avgDeltaGraph )
- else:
- main.log.info( "Results for end-to-end ignored" +
- "due to excess in threshold" )
-
- avgDeltaOfpGraph = \
- ( int( deltaOfpGraph1 ) +
- int( deltaOfpGraph2 ) +
- int( deltaOfpGraph3 ) +
- int( deltaOfpGraph4 ) +
- int( deltaOfpGraph5 ) +
- int( deltaOfpGraph6 ) +
- int( deltaOfpGraph7 ) ) / clusterCount
-
- if avgDeltaOfpGraph > thresholdMin \
- and avgDeltaOfpGraph < thresholdMax\
- and int( i ) > iterIgnore:
- latencyOfpToGraphList.append( avgDeltaOfpGraph )
- elif avgDeltaOfpGraph > ( -10 ) and \
- avgDeltaOfpGraph < 0.0 and\
- int( i ) > iterIgnore:
- main.log.info( "Sub-millisecond result likely; " +
- "negative result was rounded to 0" )
- # NOTE: Current metrics framework does not
- # support sub-millisecond accuracy. Therefore,
- # if the result is negative, we can reasonably
- # conclude sub-millisecond results and just
- # append the best rounded effort - 0 ms.
- latencyOfpToGraphList.append( 0 )
- else:
- main.log.info( "Results for ofp-to-graph " +
- "ignored due to excess in threshold" )
-
- avgDeltaOfpDevice = \
- ( float( deltaOfpDevice1 ) +
- float( deltaOfpDevice2 ) +
- float( deltaOfpDevice3 ) +
- float( deltaOfpDevice4 ) +
- float( deltaOfpDevice5 ) +
- float( deltaOfpDevice6 ) +
- float( deltaOfpDevice7 ) ) / clusterCount
-
- # NOTE: ofp - delta measurements are occasionally negative
- # due to system time misalignment.
- latencyOfpToDeviceList.append( avgDeltaOfpDevice )
-
- deltaOfpTcp = int( t0Ofp ) - int( t0Tcp )
- if deltaOfpTcp > thresholdMin \
- and deltaOfpTcp < thresholdMax and\
- int( i ) > iterIgnore:
- latencyTcpToOfpList.append( deltaOfpTcp )
- else:
- main.log.info( "Results fo tcp-to-ofp " +
- "ignored due to excess in threshold" )
-
- # TODO:
- # Fetch logs upon threshold excess
-
- main.log.info( "ONOS1 delta end-to-end: " +
- str( deltaGraph1 ) + " ms" )
-
- main.log.info( "ONOS1 delta OFP - graph: " +
- str( deltaOfpGraph1 ) + " ms" )
-
- main.log.info( "ONOS1 delta device - t0: " +
- str( deltaDevice1 ) + " ms" )
-
- main.log.info( "TCP to OFP delta: " +
- str( deltaOfpTcp ) + " ms" )
+ if deltaGraph7 > thresholdMin and\
+ deltaGraph7 < thresholdMax and i >= iterIgnore:
+ endToEndLatNodeIter[6][i] = deltaGraph7
+ main.log.info("ONOS7 iter"+str(i)+" end-to-end: "+
+ str(deltaGraph7)+" ms")
+
+ if deltaOfpGraph7 > thresholdMin and\
+ deltaOfpGraph7 < thresholdMax and i >= iterIgnore:
+ ofpToGraphLatNodeIter[6][i] = deltaOfpGraph7
+ main.log.info("ONOS7 iter"+str(i)+" ofp-to-graph: "+
+ str(deltaOfpGraph7)+" ms")
main.step( "Remove switch from controller" )
main.Mininet1.deleteSwController( "s1" )
@@ -566,103 +544,50 @@
# END of for loop iteration
- # If there is at least 1 element in each list,
- # pass the test case
- if len( latencyEndToEndList ) > 0 and\
- len( latencyOfpToGraphList ) > 0 and\
- len( latencyOfpToDeviceList ) > 0 and\
- len( latencyT0ToDeviceList ) > 0 and\
- len( latencyTcpToOfpList ) > 0:
- assertion = main.TRUE
- elif len( latencyEndToEndList ) == 0:
- # The appending of 0 here is to prevent
- # the min,max,sum functions from failing
- # below
- latencyEndToEndList.append( 0 )
- assertion = main.FALSE
- elif len( latencyOfpToGraphList ) == 0:
- latencyOfpToGraphList.append( 0 )
- assertion = main.FALSE
- elif len( latencyOfpToDeviceList ) == 0:
- latencyOfpToDeviceList.append( 0 )
- assertion = main.FALSE
- elif len( latencyT0ToDeviceList ) == 0:
- latencyT0ToDeviceList.append( 0 )
- assertion = main.FALSE
- elif len( latencyTcpToOfpList ) == 0:
- latencyTcpToOfpList.append( 0 )
- assertion = main.FALSE
+ #str( round( numpy.std( latencyT0ToDeviceList ), 1 ) )
- # Calculate min, max, avg of latency lists
- latencyEndToEndMax = \
- int( max( latencyEndToEndList ) )
- latencyEndToEndMin = \
- int( min( latencyEndToEndList ) )
- latencyEndToEndAvg = \
- ( int( sum( latencyEndToEndList ) ) /
- len( latencyEndToEndList ) )
- latencyEndToEndStdDev = \
- str( round( numpy.std( latencyEndToEndList ), 1 ) )
+ endToEndAvg = 0
+ ofpToGraphAvg = 0
+ endToEndList = []
+ ofpToGraphList = []
- latencyOfpToGraphMax = \
- int( max( latencyOfpToGraphList ) )
- latencyOfpToGraphMin = \
- int( min( latencyOfpToGraphList ) )
- latencyOfpToGraphAvg = \
- ( int( sum( latencyOfpToGraphList ) ) /
- len( latencyOfpToGraphList ) )
- latencyOfpToGraphStdDev = \
- str( round( numpy.std( latencyOfpToGraphList ), 1 ) )
+ for node in range( 0, clusterCount ):
+ # The latency 2d array was initialized to 0.
+ # If an iteration was ignored, then we have some 0's in
+ # our calculation. To avoid having this interfere with our
+ # results, we must delete any index where 0 is found...
+ # WARN: Potentially, we could have latency that hovers at
+ # 0 ms once we have optimized code. FIXME for when this is
+ # the case. Being able to obtain sub-millisecond accuracy
+ # can prevent this from happening
+ for item in endToEndLatNodeIter[node]:
+ if item > 0.0:
+ endToEndList.append(item)
+ for item in ofpToGraphLatNodeIter[node]:
+ if item > 0.0:
+ ofpToGraphList.append(item)
- latencyOfpToDeviceMax = \
- int( max( latencyOfpToDeviceList ) )
- latencyOfpToDeviceMin = \
- int( min( latencyOfpToDeviceList ) )
- latencyOfpToDeviceAvg = \
- ( int( sum( latencyOfpToDeviceList ) ) /
- len( latencyOfpToDeviceList ) )
- latencyOfpToDeviceStdDev = \
- str( round( numpy.std( latencyOfpToDeviceList ), 1 ) )
+ endToEndAvg = numpy.mean(endToEndList)
+ ofpToGraphAvg = numpy.mean(ofpToGraphList)
- latencyT0ToDeviceMax = \
- int( max( latencyT0ToDeviceList ) )
- latencyT0ToDeviceMin = \
- int( min( latencyT0ToDeviceList ) )
- latencyT0ToDeviceAvg = \
- ( int( sum( latencyT0ToDeviceList ) ) /
- len( latencyT0ToDeviceList ) )
- latencyOfpToDeviceStdDev = \
- str( round( numpy.std( latencyT0ToDeviceList ), 1 ) )
-
- latencyTcpToOfpMax = \
- int( max( latencyTcpToOfpList ) )
- latencyTcpToOfpMin = \
- int( min( latencyTcpToOfpList ) )
- latencyTcpToOfpAvg = \
- ( int( sum( latencyTcpToOfpList ) ) /
- len( latencyTcpToOfpList ) )
- latencyTcpToOfpStdDev = \
- str( round( numpy.std( latencyTcpToOfpList ), 1 ) )
-
- main.log.report( "Cluster size: " + str( clusterCount ) +
- " node(s)" )
- main.log.report( "Switch add - End-to-end latency: " +
- "Avg: " + str( latencyEndToEndAvg ) + " ms " +
- "Std Deviation: " + latencyEndToEndStdDev + " ms" )
- main.log.report(
- "Switch add - OFP-to-Graph latency: " +
- "Note: results are not accurate to sub-millisecond. " +
- "Any sub-millisecond results are rounded to 0 ms. " )
- main.log.report( "Avg: " + str( latencyOfpToGraphAvg ) + " ms " +
- "Std Deviation: " + latencyOfpToGraphStdDev + " ms" )
- main.log.report( "Switch add - TCP-to-OFP latency: " +
- "Avg: " + str( latencyTcpToOfpAvg ) + " ms " +
- "Std Deviation: " + latencyTcpToOfpStdDev + " ms" )
+ main.log.report( " - Node "+str(node+1)+" Summary - " )
+ main.log.report( " End-to-end Avg: "+
+ str(round(endToEndAvg,2))+" ms"+
+ " End-to-end Std dev: "+
+ str(round(numpy.std(endToEndList),2))+" ms")
+ main.log.report( " Ofp-to-graph Avg: "+
+ str(round(ofpToGraphAvg,2))+" ms"+
+ " Ofp-to-graph Std dev: "+
+ str(round(numpy.std(ofpToGraphList),2))+
+ " ms")
if debugMode == 'on':
main.ONOS1.cpLogsToDir( "/opt/onos/log/karaf.log",
"/tmp/", copyFileName="sw_lat_karaf" )
+ #TODO: correct assert
+ assertion = main.TRUE
+
utilities.assert_equals( expect=main.TRUE, actual=assertion,
onpass="Switch latency test successful",
onfail="Switch latency test failed" )
@@ -1938,7 +1863,7 @@
main.ONOS5cli.startOnosCli( ONOS5Ip )
elif clusterCount == 7:
- main.log.info( "Installing nodes 4 and 5" )
+ main.log.info( "Installing nodes 6 and 7" )
node6Result = \
main.ONOSbench.onosInstall( node=ONOS6Ip )
node7Result = \
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.topo b/TestON/tests/TopoPerfNext/TopoPerfNext.topo
index fc70784..f12d192 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.topo
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.topo
@@ -24,7 +24,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
- <connect_order>2</connect_order>
+ <connect_order>3</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS2cli>
@@ -33,7 +33,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
- <connect_order>2</connect_order>
+ <connect_order>4</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS3cli>
@@ -42,7 +42,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
- <connect_order>2</connect_order>
+ <connect_order>5</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS4cli>
@@ -51,7 +51,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
- <connect_order>2</connect_order>
+ <connect_order>6</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS5cli>
@@ -60,7 +60,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
- <connect_order>2</connect_order>
+ <connect_order>7</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS6cli>
@@ -69,7 +69,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
- <connect_order>2</connect_order>
+ <connect_order>8</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS7cli>
@@ -78,7 +78,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
- <connect_order>3</connect_order>
+ <connect_order>9</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS1>
@@ -87,7 +87,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
- <connect_order>3</connect_order>
+ <connect_order>10</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS2>
@@ -96,7 +96,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
- <connect_order>3</connect_order>
+ <connect_order>11</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS3>
@@ -105,7 +105,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
- <connect_order>3</connect_order>
+ <connect_order>12</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS4>
@@ -114,7 +114,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
- <connect_order>3</connect_order>
+ <connect_order>13</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS5>
@@ -123,7 +123,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
- <connect_order>3</connect_order>
+ <connect_order>14</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS6>
@@ -132,7 +132,7 @@
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
- <connect_order>3</connect_order>
+ <connect_order>15</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS7>
@@ -141,7 +141,7 @@
<user>admin</user>
<password>onos_test</password>
<type>MininetCliDriver</type>
- <connect_order>4</connect_order>
+ <connect_order>16</connect_order>
<COMPONENTS>
<arg1> --custom topo-perf-2sw.py </arg1>
<arg2> --arp --mac --topo mytopo</arg2>
@@ -155,7 +155,7 @@
<user>admin</user>
<password>onos_test</password>
<type>RemoteMininetDriver</type>
- <connect_order>5</connect_order>
+ <connect_order>17</connect_order>
<COMPONENTS> </COMPONENTS>
</Mininet2>