Merge "Case 6000"
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index 3ed6ab3..ebccce0 100644
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -1480,3 +1480,254 @@
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
+
+ def createFlowBatch( self,
+ numSw = 1,
+ swIndex = 1,
+ batchSize = 1,
+ batchIndex = 1,
+ deviceIdpreFix = "of:",
+ appId=0,
+ deviceID="",
+ ingressPort="",
+ egressPort="",
+ ethType="",
+ ethSrc="",
+ ethDst="",
+ vlan="",
+ ipProto="",
+ ipSrc=(),
+ ipDst=(),
+ tcpSrc="",
+ tcpDst="",
+ udpDst="",
+ udpSrc="",
+ mpls="",
+ ip="DEFAULT",
+ port="DEFAULT",
+ debug=False ):
+ """
+ Description:
+ Creates batches of MAC-rule flows for POST.
+ Predefined MAC: 2 MS Hex digit for iterating devices
+ Next 5 Hex digit for iterating batch numbers
+ Next 5 Hex digit for iterating flows within a batch
+ Required:
+ * deviceId: id of the device
+ Optional:
+ * ingressPort: port ingress device
+ * egressPort: port of egress device
+ * ethType: specify ethType
+ * ethSrc: specify ethSrc ( i.e. src mac addr )
+ * ethDst: specify ethDst ( i.e. dst mac addr )
+ * ipProto: specify ip protocol
+ * ipSrc: specify ip source address with mask eg. ip#/24
+ as a tuple (type, ip#)
+ * ipDst: specify ip destination address eg. ip#/24
+ as a tuple (type, ip#)
+ * tcpSrc: specify tcp source port
+ * tcpDst: specify tcp destination port
+ Returns:
+ Returns main.TRUE for successful requests; Returns main.FALSE
+ if error on requests;
+ Returns None for exceptions
+ NOTE:
+ The ip and port option are for the requests input's ip and port
+ of the ONOS node
+ """
+ #from pprint import pprint
+
+ flowJsonList = []
+ flowJsonBatch = {"flows":flowJsonList}
+ dev = swIndex
+
+ for fl in range(1, batchSize + 1):
+ flowJson = { "priority":100,
+ "deviceId":"",
+ "isPermanent":"true",
+ "timeout":0,
+ "treatment":{"instructions":[]},
+ "selector": {"criteria":[]}}
+
+ #main.log.info("fl: " + str(fl))
+ if dev <= numSw:
+ deviceId = deviceIdpreFix + "{0:0{1}x}".format(dev,16)
+ #print deviceId
+ flowJson['deviceId'] = deviceId
+ dev += 1
+ else:
+ dev = 1
+ deviceId = deviceIdpreFix + "{0:0{1}x}".format(dev,16)
+ #print deviceId
+ flowJson['deviceId'] = deviceId
+ dev += 1
+
+ # ethSrc starts with "0"; ethDst starts with "1"
+ # 2 Hex digit of device number; 5 digits of batch index number; 5 digits of batch size
+ ethS = "%02X" %int( "0" + "{0:0{1}b}".format(dev,7), 2 ) + \
+ "{0:0{1}x}".format(batchIndex,5) + "{0:0{1}x}".format(fl,5)
+ ethSrc = ':'.join(ethS[i:i+2] for i in range(0,len(ethS),2))
+ ethD = "%02X" %int( "1" + "{0:0{1}b}".format(dev,7), 2 ) + \
+ "{0:0{1}x}".format(batchIndex,5) + "{0:0{1}x}".format(fl,5)
+ ethDst = ':'.join(ethD[i:i+2] for i in range(0,len(ethD),2))
+
+ if appId:
+ flowJson[ "appId" ] = appId
+
+ if egressPort:
+ flowJson[ 'treatment' ][ 'instructions' ].append( {
+ "type":"OUTPUT",
+ "port":egressPort } )
+ if ingressPort:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":"IN_PORT",
+ "port":ingressPort } )
+ if ethType:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":"ETH_TYPE",
+ "ethType":ethType } )
+ if ethSrc:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":"ETH_SRC",
+ "mac":ethSrc } )
+ if ethDst:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":"ETH_DST",
+ "mac":ethDst } )
+ if vlan:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":"VLAN_VID",
+ "vlanId":vlan } )
+ if mpls:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":"MPLS_LABEL",
+ "label":mpls } )
+ if ipSrc:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":ipSrc[0],
+ "ip":ipSrc[1] } )
+ if ipDst:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":ipDst[0],
+ "ip":ipDst[1] } )
+ if tcpSrc:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":"TCP_SRC",
+ "tcpPort": tcpSrc } )
+ if tcpDst:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":"TCP_DST",
+ "tcpPort": tcpDst } )
+ if udpSrc:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":"UDP_SRC",
+ "udpPort": udpSrc } )
+ if udpDst:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":"UDP_DST",
+ "udpPort": udpDst } )
+ if ipProto:
+ flowJson[ 'selector' ][ 'criteria' ].append( {
+ "type":"IP_PROTO",
+ "protocol": ipProto } )
+ #pprint(flowJson)
+ flowJsonList.append(flowJson)
+
+ main.log.info("Number of flows in batch: " + str( len(flowJsonList) ) )
+ flowJsonBatch['flows'] = flowJsonList
+ #pprint(flowJsonBatch)
+
+ return flowJsonBatch
+
+
+ def sendFlowBatch( self, batch={}, ip="DEFAULT", port="DEFAULT", debug=False ):
+ """
+ Description:
+ Sends a single flow batch through /flows REST API.
+ Required:
+ * The batch of flows
+ Returns:
+ Returns main.TRUE for successful requests; Returns main.FALSE
+ if error on requests;
+ Returns None for exceptions
+ NOTE:
+ The ip and port option are for the requests input's ip and port
+ of the ONOS node
+ """
+ import time
+
+ try:
+ if debug: main.log.debug( "Adding flow: " + self.pprint( batch ) )
+ output = None
+ if ip == "DEFAULT":
+ main.log.warn( "No ip given, reverting to ip from topo file" )
+ ip = self.ip_address
+ if port == "DEFAULT":
+ main.log.warn( "No port given, reverting to port " +
+ "from topo file" )
+ port = self.port
+ url = "/flows/"
+ response = self.send( ip,
+ port,
+ method="POST",
+ url=url,
+ data=json.dumps( batch ) )
+ #main.log.info("Post response is: ", str(response[0]))
+ if response[0] == 200:
+ main.log.info( self.name + ": Successfully POST flow batch" )
+ return main.TRUE, response
+ else:
+ main.log.error( "Error with REST request, response was: " +
+ str( response ) )
+ return main.FALSE
+ except NotImplementedError as e:
+ raise e # Inform the caller
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
+
+ def removeFlowBatch( self, batch={},
+ ip="DEFAULT", port="DEFAULT" ):
+ """
+ Description:
+ Remove a batch of flows
+ Required:
+ flow batch
+ Return:
+ Returns main.TRUE if successfully deletes flows, otherwise
+ Returns main.FALSE, Returns None on error
+ """
+ try:
+ output = None
+ if ip == "DEFAULT":
+ main.log.warn( "No ip given, reverting to ip from topo file" )
+ ip = self.ip_address
+ if port == "DEFAULT":
+ main.log.warn( "No port given, reverting to port " +
+ "from topo file" )
+ port = self.port
+ # NOTE: REST url requires the intent id to be in decimal form
+
+ response = self.send( ip,
+ port,
+ method="DELETE",
+ url="/flows/",
+ data = json.dumps(batch) )
+ if response:
+ if 200 <= response[ 0 ] <= 299:
+ return main.TRUE
+ else:
+ main.log.error( "Error with REST request, response was: " +
+ str( response ) )
+ return main.FALSE
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index b65b887..5a165a2 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -1961,6 +1961,7 @@
elif i == 1:
main.log.info( " Mininet trying to exit while not " +
"in the mininet prompt" )
+ response = main.TRUE
elif i == 2:
main.log.error( "Something went wrong exiting mininet" )
elif i == 3: # timeout
@@ -1984,7 +1985,7 @@
response = main.FALSE
return response
- def arping( self, srcHost="", dstHost="10.128.20.211", ethDevice="", output=main.TRUE ):
+ def arping( self, srcHost="", dstHost="10.128.20.211", ethDevice="", output=True, noResult=False ):
"""
Description:
Sends arp message from mininet host for hosts discovery
@@ -1996,7 +1997,10 @@
"""
if ethDevice:
ethDevice = '-I ' + ethDevice + ' '
- cmd = srcHost + " arping -c1 " + ethDevice + dstHost
+ cmd = srcHost + " arping -c1 "
+ if noResult:
+ cmd += "-w10 " # If we don't want the actural arping result, set -w10, arping will exit after 10 ms.
+ cmd += ethDevice + dstHost
try:
if output:
main.log.info( "Sending: " + cmd )
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index a333be5..e1d298a 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -935,12 +935,10 @@
assert "org.onosproject.store.service" not in handle
# Node not leader
assert "java.lang.IllegalStateException" not in handle
- main.log.error( "Error in processing '" + cmdStr + "' " +
- "command: " + str( handle ) )
return handle
except AssertionError:
main.log.exception( "Error in processing '" + cmdStr + "' " +
- "command: " + str( handle ) )
+ "command: " + str( handle ) )
return None
except TypeError:
main.log.exception( self.name + ": Object not as expected" )
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index eb1f53a..e0a1a6a 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -20,7 +20,8 @@
import types
import pexpect
import os
-import os.path
+import re
+import subprocess
from requests.models import Response
from drivers.common.clidriver import CLI
@@ -34,6 +35,7 @@
self.name = None
self.home = None
self.handle = None
+ self.nicAddr = None
super( CLI, self ).__init__()
def connect( self, **connectargs ):
@@ -183,7 +185,7 @@
main.cleanup()
main.exit()
- def onosPackage( self, opTimeout=120 ):
+ def onosPackage( self, opTimeout=180 ):
"""
Produce a self-contained tar.gz file that can be deployed
and executed on any platform with Java 8 JRE.
@@ -720,6 +722,7 @@
tempList = tempList[ :-1 ]
# Structure the nic string ip
nicAddr = ".".join( tempList ) + ".*"
+ self.nicAddr = nicAddr
onosNicString = "export ONOS_NIC=" + nicAddr
try:
@@ -945,7 +948,7 @@
"ONOS\sis\salready\sinstalled",
"already\sup-to-date",
"\$",
- pexpect.TIMEOUT ], timeout=60 )
+ pexpect.TIMEOUT ], timeout=180 )
if i == 0:
main.log.warn( "Network is unreachable" )
self.handle.expect( "\$" )
@@ -1001,7 +1004,7 @@
"start/running",
"\$",
"Unknown\sinstance",
- pexpect.TIMEOUT ], timeout=120 )
+ pexpect.TIMEOUT ], timeout=180 )
if i == 0:
self.handle.expect( "\$" )
main.log.info( "Service is already running" )
@@ -1043,7 +1046,7 @@
"Could not resolve hostname",
"Unknown\sinstance",
"\$",
- pexpect.TIMEOUT ], timeout=60 )
+ pexpect.TIMEOUT ], timeout=180 )
if i == 0:
self.handle.expect( "\$" )
main.log.info( "ONOS service stopped" )
@@ -1081,9 +1084,9 @@
"""
try:
self.handle.sendline( "" )
- self.handle.expect( "\$", timeout=60 )
+ self.handle.expect( "\$", timeout=180 )
self.handle.sendline( "onos-uninstall " + str( nodeIp ) )
- self.handle.expect( "\$", timeout=60 )
+ self.handle.expect( "\$", timeout=180 )
main.log.info( "ONOS " + nodeIp + " was uninstalled" )
# onos-uninstall command does not return any text
return main.TRUE
@@ -1113,7 +1116,7 @@
i = self.handle.expect( [
"Killing\sONOS",
"ONOS\sprocess\sis\snot\srunning",
- pexpect.TIMEOUT ], timeout=20 )
+ pexpect.TIMEOUT ], timeout=60 )
if i == 0:
main.log.info( "ONOS instance " + str( nodeIp ) +
" was killed and stopped" )
@@ -1149,7 +1152,7 @@
"\$",
"No\sroute\sto\shost",
"password:",
- pexpect.TIMEOUT ], timeout=20 )
+ pexpect.TIMEOUT ], timeout=60 )
if i == 0:
main.log.info(
@@ -1248,7 +1251,7 @@
main.cleanup()
main.exit()
- def isup( self, node="", timeout=120 ):
+ def isup( self, node="", timeout=240 ):
"""
Run's onos-wait-for-start which only returns once ONOS is at run
level 100(ready for use)
@@ -2219,26 +2222,26 @@
serviceConfig.write("""${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """)
serviceConfig.close()
- def createDBFile(self, testData):
+ def createDBFile( self, testData ):
filename = main.TEST + "DB"
DBString = ""
for item in testData:
- if type(item) is string:
+ if type( item ) is string:
item = "'" + item + "'"
- if testData.index(item) < len(testData-1):
+ if testData.index( item ) < len( testData - 1 ):
item += ","
- DBString += str(item)
+ DBString += str( item )
- DBFile = open(filename, "a")
- DBFile.write(DBString)
+ DBFile = open( filename, "a" )
+ DBFile.write( DBString )
DBFile.close()
- def verifySummary(self, ONOSIp,*deviceCount):
+ def verifySummary( self, ONOSIp, *deviceCount ):
- self.handle.sendline("onos " + ONOSIp + " summary")
- self.handle.expect(":~")
+ self.handle.sendline( "onos " + ONOSIp + " summary" )
+ self.handle.expect( ":~" )
summaryStr = self.handle.before
print "\nSummary\n==============\n" + summaryStr + "\n\n"
@@ -2250,18 +2253,65 @@
passed = False
if "SCC(s)=1," in summaryStr:
passed = True
- print("Summary is verifed")
+ print "Summary is verifed"
else:
- print("Summary failed")
+ print "Summary failed"
if deviceCount:
print" ============================="
- checkStr = "devices=" + str(deviceCount[0]) + ","
+ checkStr = "devices=" + str( deviceCount[0] ) + ","
print "Checkstr: " + checkStr
if checkStr not in summaryStr:
passed = False
- print("Device count failed")
+ print "Device count failed"
else:
print "device count verified"
return passed
+
+ def getIpAddr( self ):
+ """
+ Update self.ip_address with numerical ip address. If multiple IP's are
+ located on the device, will attempt to use self.nicAddr to choose the
+ right one. Defaults to 127.0.0.1 if no other address is found or cannot
+ determine the correct address.
+
+ ONLY WORKS WITH IPV4 ADDRESSES
+ """
+ try:
+ localhost = "127.0.0.1"
+ ipPat = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
+ pattern = re.compile( ipPat )
+ match = re.search( pattern, self.ip_address )
+ if self.nicAddr:
+ nicPat = self.nicAddr.replace( ".", "\." ).replace( "\*", r"\d{1,3}" )
+ nicPat = re.compile( nicPat )
+ else:
+ nicPat = None
+ # IF self.ip_address is an ip address and matches
+ # self.nicAddr: return self.ip_address
+ if match:
+ curIp = match.group(0)
+ if nicPat:
+ nicMatch = re.search( nicPat, curIp )
+ if nicMatch:
+ return self.ip_address
+ # ELSE: attempt to get correct address.
+ raw = subprocess.check_output( "ifconfig")
+ ifPat = re.compile( "inet addr:({})".format( ipPat ) )
+ ips = re.findall( ifPat, raw )
+ if nicPat:
+ for ip in ips:
+ curMatch = re.search( nicPat, ip )
+ if curMatch:
+ self.ip_address = ip
+ return ip
+ else:
+ tmpList = [ ip for ip in ips if ip is not localhost ]
+ if len(tmpList) == 1:
+ curIp = tmpList[0]
+ self.ip_address = curIp
+ return curIp
+ return localhost
+ except Exception:
+ main.log.exception( "Uncaught exception" )
diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
index 8c6c8d5..f48ae3b 100644
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
@@ -155,6 +155,7 @@
# main.scale[ 0 ] determines the current number of ONOS controller
main.numCtrls = int( main.scale[ 0 ] )
main.flowCompiler = "Flow Rules"
+ main.initialized = main.TRUE
main.case( "Starting up " + str( main.numCtrls ) +
" node(s) ONOS cluster" )
@@ -233,22 +234,22 @@
for i in range( main.numCtrls ):
onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
- if onosIsUp == main.TRUE:
- main.log.report( "ONOS instance is up and ready" )
- else:
- main.log.report( "ONOS instance may not be up, stop and " +
- "start ONOS again " )
- for i in range( main.numCtrls ):
- stopResult = stopResult and \
- main.ONOSbench.onosStop( main.ONOSip[ i ] )
- for i in range( main.numCtrls ):
- startResult = startResult and \
- main.ONOSbench.onosStart( main.ONOSip[ i ] )
+ if onosIsUp == main.TRUE:
+ main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) )
+ else:
+ main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) +
+ "start ONOS again " )
+ stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] )
+ startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] )
+ if not startResult or stopResult:
+ main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1 ) )
stepResult = onosIsUp and stopResult and startResult
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="ONOS service is ready",
onfail="ONOS service did not start properly" )
+ if not stepResult:
+ main.initialized = main.FALSE
# Start an ONOS cli to provide functionality that is not currently
# supported by the Rest API remove this when Leader Checking is supported
@@ -264,6 +265,8 @@
actual=stepResult,
onpass="Successfully start ONOS cli",
onfail="Failed to start ONOS cli" )
+ if not stepResult:
+ main.initialized = main.FALSE
# Remove the first element in main.scale list
main.scale.remove( main.scale[ 0 ] )
@@ -477,6 +480,9 @@
"""
Start Mininet topology with OF 1.0 switches
"""
+ if main.initialized == main.FALSE:
+ main.log.error( "Test components did not start correctly, skipping further tests" )
+ main.skipCase()
main.OFProtocol = "1.0"
main.log.report( "Start Mininet topology with OF 1.0 switches" )
main.case( "Start Mininet topology with OF 1.0 switches" )
@@ -496,13 +502,15 @@
onfail="Failed to load topology" )
# Exit if topology did not load properly
if not topoResult:
- main.cleanup()
- main.exit()
+ main.initialized = main.FALSE
def CASE11( self, main ):
"""
Start Mininet topology with OF 1.3 switches
"""
+ if main.initialized == main.FALSE:
+ main.log.error( "Test components did not start correctly, skipping further tests" )
+ main.skipCase()
main.OFProtocol = "1.3"
main.log.report( "Start Mininet topology with OF 1.3 switches" )
main.case( "Start Mininet topology with OF 1.3 switches" )
@@ -522,8 +530,7 @@
onfail="Failed to load topology" )
# Exit if topology did not load properly
if not topoResult:
- main.cleanup()
- main.exit()
+ main.initialized = main.FALSE
def CASE12( self, main ):
"""
@@ -531,6 +538,9 @@
"""
import re
+ if main.initialized == main.FALSE:
+ main.log.error( "Test components did not start correctly, skipping further tests" )
+ main.skipCase()
main.case( "Assign switches to controllers" )
main.step( "Assigning switches to controllers" )
main.caseExplanation = "Assign OF " + main.OFProtocol +\
@@ -551,8 +561,9 @@
ip=tempONOSip,
port='6653' )
if not assignResult:
- main.cleanup()
- main.exit()
+ main.log.error( "Problem assigning mastership of switches, skipping further test cases" )
+ main.initialized = main.FALSE
+ main.skipCase()
for i in range( 1, ( main.numSwitch + 1 ) ):
response = main.Mininet1.getSwController( "s" + str( i ) )
@@ -568,11 +579,16 @@
"to controller",
onfail="Failed to assign switches to " +
"controller" )
+ if not stepResult:
+ main.initialized = main.FALSE
def CASE13( self,main ):
"""
Create Scapy components
"""
+ if main.initialized == main.FALSE:
+ main.log.error( "Test components did not start correctly, skipping further tests" )
+ main.skipCase()
main.case( "Create scapy components" )
main.step( "Create scapy components" )
import json
@@ -595,11 +611,16 @@
actual=scapyResult,
onpass="Successfully created Scapy Components",
onfail="Failed to discover Scapy Components" )
+ if not scapyResult:
+ main.initialized = main.FALSE
def CASE14( self, main ):
"""
Discover all hosts and store its data to a dictionary
"""
+ if main.initialized == main.FALSE:
+ main.log.error( "Test components did not start correctly, skipping further tests" )
+ main.skipCase()
main.case( "Discover all hosts" )
stepResult = main.TRUE
@@ -623,17 +644,23 @@
actual=stepResult,
onpass="Successfully discovered hosts",
onfail="Failed to discover hosts" )
+ if not stepResult:
+ main.initialized = main.FALSE
def CASE15( self, main ):
"""
Discover all hosts with scapy arp packets and store its data to a dictionary
"""
+ if main.initialized == main.FALSE:
+ main.log.error( "Test components did not start correctly, skipping further tests" )
+ main.skipCase()
main.case( "Discover all hosts using scapy" )
main.step( "Send packets from each host to the first host and confirm onos discovery" )
import collections
if len( main.scapyHosts ) < 1:
main.log.error( "No scapy hosts have been created" )
+ main.initialized = main.FALSE
main.skipCase()
# Send ARP packets from each scapy host component
@@ -647,6 +674,9 @@
actual=stepResult,
onpass="ONOS correctly discovered all hosts",
onfail="ONOS incorrectly discovered hosts" )
+ if not stepResult:
+ main.initialized = main.FALSE
+ main.skipCase()
main.step( "Populate hostsData" )
stepResult = main.intentFunction.populateHostData( main )
@@ -654,11 +684,16 @@
actual=stepResult,
onpass="Successfully populated hostsData",
onfail="Failed to populate hostsData" )
+ if not stepResult:
+ main.initialized = main.FALSE
def CASE16( self, main ):
"""
Balance Masters
"""
+ if main.initialized == main.FALSE:
+ main.log.error( "Test components did not start correctly, skipping further tests" )
+ main.skipCase()
main.case( "Balance mastership of switches" )
main.step( "Balancing mastership of switches" )
@@ -669,11 +704,16 @@
actual=stepResult,
onpass="Successfully balanced mastership of switches",
onfail="Failed to balance mastership of switches" )
+ if not stepResult:
+ main.initialized = main.FALSE
def CASE17( self, main ):
"""
Use Flow Objectives
"""
+ if main.initialized == main.FALSE:
+ main.log.error( "Test components did not start correctly, skipping further tests" )
+ main.skipCase()
main.case( "Enable intent compilation using Flow Objectives" )
main.step( "Enabling Flow Objectives" )
@@ -688,6 +728,8 @@
actual=stepResult,
onpass="Successfully activated Flow Objectives",
onfail="Failed to activate Flow Objectives" )
+ if not stepResult:
+ main.initialized = main.FALSE
def CASE18( self, main ):
"""
@@ -750,14 +792,31 @@
import time
import json
import re
-
+ if main.initialized == main.FALSE:
+ main.log.error( "Test components did not start correctly, skipping further tests" )
+ main.skipCase()
# Assert variables - These variable's name|format must be followed
# if you want to use the wrapper function
assert main, "There is no main"
- assert main.CLIs, "There is no main.CLIs"
- assert main.Mininet1, "Mininet handle should be named Mininet1"
- assert main.numSwitch, "Placed the total number of switch topology in \
- main.numSwitch"
+ try:
+ assert main.CLIs
+ except AssertionError:
+ main.log.error( "There is no main.CLIs, skipping test cases" )
+ main.initialized = main.FALSE
+ main.skipCase()
+ try:
+ assert main.Mininet1
+ except AssertionError:
+ main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
+ main.initialized = main.FALSE
+ main.skipCase()
+ try:
+ assert main.numSwitch
+ except AssertionError:
+ main.log.error( "Place the total number of switch topology in \
+ main.numSwitch" )
+ main.initialized = main.FALSE
+ main.skipCase()
# Save leader candidates
intentLeadersOld = main.CLIs2[ 0 ].leaderCandidates()
@@ -971,14 +1030,31 @@
import time
import json
import re
-
+ if main.initialized == main.FALSE:
+ main.log.error( "Test components did not start correctly, skipping further tests" )
+ main.skipCase()
# Assert variables - These variable's name|format must be followed
# if you want to use the wrapper function
assert main, "There is no main"
- assert main.CLIs, "There is no main.CLIs"
- assert main.Mininet1, "Mininet handle should be named Mininet1"
- assert main.numSwitch, "Placed the total number of switch topology in \
- main.numSwitch"
+ try:
+ assert main.CLIs
+ except AssertionError:
+ main.log.error( "There is no main.CLIs, skipping test cases" )
+ main.initialized = main.FALSE
+ main.skipCase()
+ try:
+ assert main.Mininet1
+ except AssertionError:
+ main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
+ main.initialized = main.FALSE
+ main.skipCase()
+ try:
+ assert main.numSwitch
+ except AssertionError:
+ main.log.error( "Place the total number of switch topology in \
+ main.numSwitch" )
+ main.initialized = main.FALSE
+ main.skipCase()
main.case( "Point Intents Test - " + str( main.numCtrls ) +
" NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
@@ -1532,58 +1608,35 @@
" to single point intents" )
def CASE5000( self, main ):
- # """
- # Will add description in next patch set
- # """
- # assert main, "There is no main"
- # assert main.CLIs, "There is no main.CLIs"
- # assert main.Mininet1, "Mininet handle should be named Mininet1"
- # assert main.numSwitch, "Placed the total number of switch topology in \
- # main.numSwitch"
- # main.case( "Test host mobility with host intents " )
- # main.step( " Testing host mobility by moving h1 from s5 to s6" )
- # h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
-
- # main.log.info( "Moving h1 from s5 to s6")
-
- # main.Mininet1.moveHost( "h1","s5","s6" )
-
- # main.intentFunction.getHostsData( main )
- # h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
-
- # utilities.assert_equals( expect="of:0000000000000006",
- # actual=h1PostMove,
- # onpass="Mobility: Successfully moved h1 to s6",
- # onfail="Mobility: Failed to moved h1 to s6" +
- # " to single point intents" +
- # " with IPV4 type and MAC addresses" +
- # " in the same VLAN" )
-
- # main.step( "IPV4: Add host intents between h1 and h9" )
- # stepResult = main.TRUE
- # stepResult = main.intentFunction.hostIntent( main,
- # onosNode='0',
- # name='IPV4',
- # host1='h1',
- # host2='h9',
- # host1Id='00:00:00:00:00:01/-1',
- # host2Id='00:00:00:00:00:09/-1' )
-
- # utilities.assert_equals( expect=main.TRUE,
- # actual=stepResult,
- # onpass="IPV4: Host intent test successful " +
- # "between two IPV4 hosts",
- # onfail="IPV4: Host intent test failed " +
- # "between two IPV4 hosts")
"""
Tests Host Mobility
Modifies the topology location of h1
"""
+ if main.initialized == main.FALSE:
+ main.log.error( "Test components did not start correctly, skipping further tests" )
+ main.skipCase()
+ # Assert variables - These variable's name|format must be followed
+ # if you want to use the wrapper function
assert main, "There is no main"
- assert main.CLIs, "There is no main.CLIs"
- assert main.Mininet1, "Mininet handle should be named Mininet1"
- assert main.numSwitch, "Placed the total number of switch topology in \
- main.numSwitch"
+ try:
+ assert main.CLIs
+ except AssertionError:
+ main.log.error( "There is no main.CLIs, skipping test cases" )
+ main.initialized = main.FALSE
+ main.skipCase()
+ try:
+ assert main.Mininet1
+ except AssertionError:
+ main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
+ main.initialized = main.FALSE
+ main.skipCase()
+ try:
+ assert main.numSwitch
+ except AssertionError:
+ main.log.error( "Place the total number of switch topology in \
+ main.numSwitch" )
+ main.initialized = main.FALSE
+ main.skipCase()
main.case( "Test host mobility with host intents " )
main.step( "Testing host mobility by moving h1 from s5 to s6" )
h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
index 900abd5..8a48a13 100644
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
@@ -66,24 +66,31 @@
main.log.info( itemName + ": Adding single point to multi point intents" )
- if not host1.get( "id" ):
- main.log.warn( "ID not given for host1 {0}. Loading from main.hostData".format( host1.get( "name" ) ) )
- main.log.debug( main.hostsData.get( host1.get( "name" ) ) )
- host1[ "id" ] = main.hostsData.get( host1.get( "name" ) ).get( "id" )
+ try:
+ if not host1.get( "id" ):
+ main.log.warn( "ID not given for host1 {0}. Loading from main.hostData".format( host1.get( "name" ) ) )
+ main.log.debug( main.hostsData.get( host1.get( "name" ) ) )
+ host1[ "id" ] = main.hostsData.get( host1.get( "name" ) ).get( "id" )
- if not host2.get( "id" ):
- main.log.warn( "ID not given for host2 {0}. Loading from main.hostData".format( host2.get( "name" ) ) )
- host2[ "id" ] = main.hostsData.get( host2.get( "name" ) ).get( "id" )
+ if not host2.get( "id" ):
+ main.log.warn( "ID not given for host2 {0}. Loading from main.hostData".format( host2.get( "name" ) ) )
+ host2[ "id" ] = main.hostsData.get( host2.get( "name" ) ).get( "id" )
- # Adding host intents
- main.log.info( itemName + ": Adding host intents" )
+ # Adding host intents
+ main.log.info( itemName + ": Adding host intents" )
- intent1 = main.CLIs[ onosNode ].addHostIntent( hostIdOne=host1.get( "id" ),
- hostIdTwo=host2.get( "id" ) )
+ intent1 = main.CLIs[ onosNode ].addHostIntent( hostIdOne=host1.get( "id" ),
+ hostIdTwo=host2.get( "id" ) )
- # Get all intents ID in the system, time delay right after intents are added
- time.sleep( main.addIntentSleep )
- intentsId = main.CLIs[ 0 ].getIntentsId()
+ # Get all intents ID in the system, time delay right after intents are added
+ time.sleep( main.addIntentSleep )
+ intentsId = main.CLIs[ 0 ].getIntentsId()
+ except (KeyError, TypeError):
+ errorMsg = "There was a problem loading the hosts data."
+ if intentsId:
+ errorMsg += " There was a problem installing host to host intent."
+ main.log.error( errorMsg )
+ return main.FALSE
if utilities.retry ( f=checkIntentState, retValue=main.FALSE,
args = (main, intentsId ), sleep=main.checkIntentSleep ):
@@ -157,16 +164,20 @@
main.log.info( itemName + ": Testing Host Intent" )
- if not host1.get( "id" ):
- main.log.warn( "Id not given for host1 {0}. Loading from main.hostData".format( host1.get( "name" ) ) )
- host1[ "id" ] = main.hostsData.get( host1.get( "name" ) ).get( "location" )
+ try:
+ if not host1.get( "id" ):
+ main.log.warn( "Id not given for host1 {0}. Loading from main.hostData".format( host1.get( "name" ) ) )
+ host1[ "id" ] = main.hostsData.get( host1.get( "name" ) ).get( "location" )
- if not host2.get( "id" ):
- main.log.warn( "Id not given for host2 {0}. Loading from main.hostData".format( host2.get( "name" ) ) )
- host2[ "id" ] = main.hostsData.get( host2.get( "name" ) ).get( "location" )
+ if not host2.get( "id" ):
+ main.log.warn( "Id not given for host2 {0}. Loading from main.hostData".format( host2.get( "name" ) ) )
+ host2[ "id" ] = main.hostsData.get( host2.get( "name" ) ).get( "location" )
- senderNames = [ host1.get( "name" ), host2.get( "name" ) ]
- recipientNames = [ host1.get( "name" ), host2.get( "name" ) ]
+ senderNames = [ host1.get( "name" ), host2.get( "name" ) ]
+ recipientNames = [ host1.get( "name" ), host2.get( "name" ) ]
+ except ( KeyError, TypeError ):
+ main.log.error( "There was a problem loading the hosts data." )
+ return main.FALSE
testResult = main.TRUE
main.log.info( itemName + ": Adding single point to multi point intents" )
@@ -336,50 +347,58 @@
main.log.info( itemName + ": Adding single to single point intents" )
- for sender in senders:
- if not sender.get( "device" ):
- main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
- sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
+ try:
+ for sender in senders:
+ if not sender.get( "device" ):
+ main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
+ sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
- for recipient in recipients:
- if not recipient.get( "device" ):
- main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
- recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
+ for recipient in recipients:
+ if not recipient.get( "device" ):
+ main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
+ recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
- ingressDevice = senders[ 0 ].get( "device" )
- egressDevice = recipients[ 0 ].get( "device" )
+ ingressDevice = senders[ 0 ].get( "device" )
+ egressDevice = recipients[ 0 ].get( "device" )
- portIngress = senders[ 0 ].get( "port", "" )
- portEgress = recipients[ 0 ].get( "port", "" )
- main.log.debug( ingressDevice )
- main.log.debug( egressDevice )
+ portIngress = senders[ 0 ].get( "port", "" )
+ portEgress = recipients[ 0 ].get( "port", "" )
+ main.log.debug( ingressDevice )
+ main.log.debug( egressDevice )
- srcMac = senders[ 0 ].get( "mac" )
- dstMac = recipients[ 0 ].get( "mac" )
+ srcMac = senders[ 0 ].get( "mac" )
+ dstMac = recipients[ 0 ].get( "mac" )
- ipSrc = senders[ 0 ].get( "ip" )
- ipDst = recipients[ 0 ].get( "ip" )
+ ipSrc = senders[ 0 ].get( "ip" )
+ ipDst = recipients[ 0 ].get( "ip" )
- intent1 = main.CLIs[ onosNode ].addPointIntent(
- ingressDevice=ingressDevice,
- egressDevice=egressDevice,
- ingressPort=portIngress,
- egressPort=portEgress,
- ethType=ethType,
- ethSrc=srcMac,
- ethDst=dstMac,
- bandwidth=bandwidth,
- lambdaAlloc=lambdaAlloc,
- ipProto=ipProto,
- ipSrc=ipSrc,
- ipDst=ipDst,
- tcpSrc=tcpSrc,
- tcpDst=tcpDst )
+ intent1 = main.CLIs[ onosNode ].addPointIntent(
+ ingressDevice=ingressDevice,
+ egressDevice=egressDevice,
+ ingressPort=portIngress,
+ egressPort=portEgress,
+ ethType=ethType,
+ ethSrc=srcMac,
+ ethDst=dstMac,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ipSrc,
+ ipDst=ipDst,
+ tcpSrc=tcpSrc,
+ tcpDst=tcpDst )
- time.sleep( main.addIntentSleep )
- intentsId = main.CLIs[ 0 ].getIntentsId()
+ time.sleep( main.addIntentSleep )
+ intentsId = main.CLIs[ 0 ].getIntentsId()
+ except (KeyError, TypeError):
+ errorMsg = "There was a problem loading the hosts data."
+ if intentId:
+ errorMsg += " There was a problem installing Point to Point intent."
+ main.log.error( errorMsg )
+ return main.FALSE
+ # Check intent state
if utilities.retry ( f=checkIntentState, retValue=main.FALSE,
args = (main, intentsId ), sleep=main.checkIntentSleep ):
return intentsId
@@ -387,13 +406,6 @@
main.log.error( "Single to Single point intent did not install correctly" )
return main.FALSE
- # Check intents state
- if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentsId ), sleep=main.checkIntentSleep ):
- return intentsId
- else:
- main.log.error( "Point Intent did not install correctly" )
- return main.FALSE
-
def testPointIntent( main,
name,
intentId,
@@ -472,21 +484,25 @@
main.log.info( itemName + ": Testing Point Intent" )
- # Names for scapy
- senderNames = [ x.get( "name" ) for x in senders ]
- recipientNames = [ x.get( "name" ) for x in recipients ]
- badSenderNames = [ x.get( "name" ) for x in badSenders ]
- badRecipientNames = [ x.get( "name" ) for x in badRecipients ]
+ try:
+ # Names for scapy
+ senderNames = [ x.get( "name" ) for x in senders ]
+ recipientNames = [ x.get( "name" ) for x in recipients ]
+ badSenderNames = [ x.get( "name" ) for x in badSenders ]
+ badRecipientNames = [ x.get( "name" ) for x in badRecipients ]
- for sender in senders:
- if not sender.get( "device" ):
- main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
- sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
+ for sender in senders:
+ if not sender.get( "device" ):
+ main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
+ sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
- for recipient in recipients:
- if not recipient.get( "device" ):
- main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
- recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
+ for recipient in recipients:
+ if not recipient.get( "device" ):
+ main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
+ recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
+ except (KeyError, TypeError):
+ main.log.error( "There was a problem loading the hosts data." )
+ return main.FALSE
testResult = main.TRUE
main.log.info( itemName + ": Testing point intents" )
@@ -1534,22 +1550,30 @@
controllerStr = str( controller + 1 ) # ONOS node number
# Compare Hosts
# Load hosts data for controller node
- if hosts[ controller ] and "Error" not in hosts[ controller ]:
- try:
- hostData = json.loads( hosts[ controller ] )
- except ( TypeError, ValueError ):
- main.log.error( "Could not load json:" + str( hosts[ controller ] ) )
- hostFails.append( controllerStr )
+ try:
+ if hosts[ controller ]:
+ main.log.info( "Hosts discovered" )
else:
- onosHostIPs = [ x.get( "ipAddresses" )[ 0 ]
- for x in hostData
- if len( x.get( "ipAddresses" ) ) > 0 ]
- if not set( collections.Counter( scapyHostIPs ) ).issubset( set ( collections.Counter( onosHostIPs ) ) ):
- main.log.warn( "Controller {0} only sees nodes with {1} IPs. It should see all of the following: {2}".format( controllerStr, onosHostIPs, scapyHostIPs ) )
+ main.log.error( "Problem discovering hosts" )
+ if hosts[ controller ] and "Error" not in hosts[ controller ]:
+ try:
+ hostData = json.loads( hosts[ controller ] )
+ except ( TypeError, ValueError ):
+ main.log.error( "Could not load json:" + str( hosts[ controller ] ) )
hostFails.append( controllerStr )
- else:
- main.log.error( "Hosts returned nothing or an error." )
- hostFails.append( controllerStr )
+ else:
+ onosHostIPs = [ x.get( "ipAddresses" )[ 0 ]
+ for x in hostData
+ if len( x.get( "ipAddresses" ) ) > 0 ]
+ if not set( collections.Counter( scapyHostIPs ) ).issubset( set ( collections.Counter( onosHostIPs ) ) ):
+ main.log.warn( "Controller {0} only sees nodes with {1} IPs. It should see all of the following: {2}".format( controllerStr, onosHostIPs, scapyHostIPs ) )
+ hostFails.append( controllerStr )
+ else:
+ main.log.error( "Hosts returned nothing or an error." )
+ hostFails.append( controllerStr )
+ except IndexError:
+ main.log.error( "Hosts returned nothing, Failed to discover hosts." )
+ return main.FALSE
if hostFails:
main.log.error( "List of failed ONOS Nodes:" + ', '.join(map(str, hostFails )) )
@@ -1579,9 +1603,18 @@
hostj[ 'location' ][ 'port' ]
main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
return main.TRUE
+ except ValueError:
+ main.log.error( "ValueError while populating hostsData" )
+ return main.FALSE
except KeyError:
main.log.error( "KeyError while populating hostsData")
return main.FALSE
+ except IndexError:
+ main.log.error( "IndexError while populating hostsData" )
+ return main.FALSE
+ except TypeError:
+ main.log.error( "TypeError while populating hostsData" )
+ return main.FALSE
def scapyCheckConnection( main, senders, recipients, packet=None, packetFilter=None, expectFailure=False ):
"""
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.params b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.params
new file mode 100755
index 0000000..a413601
--- /dev/null
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.params
@@ -0,0 +1,72 @@
+
+<PARAMS>
+ <!--
+ # CASE - Descritpion
+ # 1,2,10,1000,1100,2000,1200,2000,100
+ # 1 - Variable initialization and optional pull and build ONOS package
+ # 2 - package onos, clean by uninstalling onos, install ONOS, start cli
+ # 10 - Start mininet and verify topology
+ # 11 - Start Null Provider linear topology
+ # 110 - check log for errors
+ # 1000 - build flow batches
+ # 2100 - REST POST flow batches in multiple threads and check till all ADDED
+ # 3100 - REST DELETE flow batches in multiple threads and check till all REMOVED
+ -->
+
+ <!-- <testcases>1,10,100,1000,100,2000,100,110</testcases> -->
+ <testcases>1,2,10,100,1000,2100,100,3100,100,110,210</testcases>
+
+ <GLOBAL>
+ <maxNodes>1</maxNodes> # currently only runs in single node onos
+ <numSw>63</numSw> # Number of devices used in topology
+ <numThreads>4</numThreads> #Number of Threads to use for POST and DELETE
+ <cluster>BM</cluster>
+ <SLEEP>
+ <startup>15</startup>
+ <startMN>15</startMN>
+ <addFlow>10</addFlow>
+ <delFlow>10</delFlow>
+ <chkFlow>0.5</chkFlow>
+ <cfg>5</cfg>
+ </SLEEP>
+ </GLOBAL>
+
+ <CASE1>
+ <cellName>temp</cellName>
+ <cellApps>drivers</cellApps>
+ <gitPull>False</gitPull>
+ <gitBranch>master</gitBranch>
+ </CASE1>
+
+ <CASE2>
+ <incPackaging>true</incPackaging>
+ </CASE2>
+
+ <CASE10>
+ <app>org.onosproject.openflow-base</app>
+ <adaptiveFlowenabled>false</adaptiveFlowenabled>
+ <mnArgs> --topo linear,{} --switch ovsk,protocols=OpenFlow13 --controller remote,port=6653</mnArgs>
+ </CASE10>
+
+ <CASE11>
+ <nullTopo>linear</nullTopo>
+ <nullStart>true</nullStart>
+ </CASE11>
+
+ <CASE1000>
+ <batchSize>200</batchSize>
+ <batches>500</batches>
+ </CASE1000>
+
+ <CASE2100>
+ <numThreads>4</numThreads>
+ <RESTchkFlow>main.FALSE</RESTchkFlow>
+ <chkFlowTO>200</chkFlowTO>
+ </CASE2100>
+
+ <CASE3100>
+ <RESTchkFlow>main.FALSE</RESTchkFlow>
+ <chkFlowTO>200</chkFlowTO>
+ </CASE3100>
+
+</PARAMS>
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
new file mode 100755
index 0000000..ca5e240
--- /dev/null
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
@@ -0,0 +1,518 @@
+class SCPFbatchFlowResp:
+ '''
+ Testing end-to-end ONOS response time from POST of batched flows to when ONOS returns
+ response confirmation of all flows ADDED; subsequently testing the response time from when REST DELETE to
+ ONOS confirmation of all flows REMOVED.
+ '''
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ import time
+ import os
+ import imp
+
+ """
+ - Construct tests variables
+ - GIT ( optional )
+ - Checkout ONOS master branch
+ - Pull latest ONOS code
+ - Building ONOS ( optional )
+ - Install ONOS package
+ - Build ONOS package
+ """
+
+ main.case( "Constructing test variables and building ONOS package" )
+ main.step( "Constructing test variables" )
+
+ # Test variables
+ main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
+ main.cellName = main.params[ 'CASE1' ][ 'cellName' ]
+ main.apps = main.params[ 'CASE1' ][ 'cellApps' ]
+ gitBranch = main.params[ 'CASE1' ][ 'gitBranch' ]
+ gitPull = main.params[ 'CASE1' ][ 'gitPull' ]
+ main.maxNodes = int( main.params['GLOBAL'][ 'maxNodes' ] )
+ main.startUpSleep = float( main.params['GLOBAL'][ 'SLEEP' ][ 'startup' ] )
+ main.startMNSleep = float( main.params['GLOBAL'][ 'SLEEP' ][ 'startMN' ] )
+ main.addFlowSleep = float( main.params['GLOBAL'][ 'SLEEP' ][ 'addFlow' ] )
+ main.delFlowSleep = float( main.params['GLOBAL'][ 'SLEEP' ][ 'delFlow' ] )
+ main.chkFlowSleep = float( main.params['GLOBAL']['SLEEP']['chkFlow'])
+ main.cfgSleep = float( main.params['GLOBAL']['SLEEP']['cfg'])
+ main.numSw = int( main.params['GLOBAL']['numSw'])
+ main.numThreads = int( main.params['GLOBAL']['numThreads'] )
+ main.cellData = {} # for creating cell file
+ main.CLIs = []
+ main.ONOSip = []
+ main.ONOSip = main.ONOSbench.getOnosIps()
+ main.commit = main.ONOSbench.getVersion()
+ main.cluster = main.params['GLOBAL']['cluster']
+
+ # Assigning ONOS cli handles to a list
+ for i in range( 1, main.maxNodes + 1 ):
+ main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+
+
+ if main.CLIs:
+ stepResult = main.TRUE
+ else:
+ main.log.error( "Did not properly created list of ONOS CLI handle" )
+ stepResult = main.FALSE
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully construct " +
+ "test variables ",
+ onfail="Failed to construct test variables" )
+
+ if gitPull == 'True':
+ main.step( "Building ONOS in " + gitBranch + " branch" )
+ onosBuildResult = main.startUp.onosBuild( main, gitBranch )
+ stepResult = onosBuildResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully compiled " +
+ "latest ONOS",
+ onfail="Failed to compile " +
+ "latest ONOS" )
+ else:
+ main.log.warn( "Did not pull new code so skipping mvn " +
+ "clean install" )
+
+ def CASE2( self, main ):
+ """
+ - Set up cell
+ - Create cell file
+ - Set cell file
+ - Verify cell file
+ - Kill ONOS process
+ - Uninstall ONOS cluster
+ - Verify ONOS start up
+ - Install ONOS cluster
+ - Connect to cli
+ """
+
+ main.numCtrls = int( main.maxNodes )
+
+ main.case( "Starting up " + str( main.numCtrls ) +
+ " node(s) ONOS cluster" )
+
+ main.log.info( "Safety check, killing all ONOS processes" +
+ " before initiating environment setup" )
+
+ tempOnosIp = []
+ for i in range( main.numCtrls ):
+ tempOnosIp.append( main.ONOSip[i] )
+
+ if main.params['CASE2']['incPackaging'] == "true":
+ main.step("Create onos cell file with: " + main.apps)
+ main.ONOSbench.createCellFile( main.ONOSbench.ip_address, "temp",
+ main.Mininet1.ip_address, main.apps, tempOnosIp )
+
+ main.step( "Apply cell to environment" )
+ cellResult = main.ONOSbench.setCell( "temp" )
+ verifyResult = main.ONOSbench.verifyCell()
+ stepResult = cellResult and verifyResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully applied cell to " + \
+ "environment",
+ onfail="Failed to apply cell to environment " )
+
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage(opTimeout=240)
+ stepResult = packageResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully created ONOS package",
+ onfail="Failed to create ONOS package" )
+ time.sleep( main.startUpSleep )
+
+ main.step( "Uninstalling ONOS package" )
+ onosUninstallResult = main.TRUE
+ for i in range( main.numCtrls ):
+ onosUninstallResult = onosUninstallResult and \
+ main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] )
+ stepResult = onosUninstallResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully uninstalled ONOS package",
+ onfail="Failed to uninstall ONOS package" )
+ time.sleep( main.startUpSleep )
+
+ else:
+ main.log.info("onos Packaging Skipped!")
+
+ main.step( "Installing ONOS package" )
+ onosInstallResult = main.TRUE
+ for i in range( main.numCtrls ):
+ onosInstallResult = onosInstallResult and \
+ main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
+ stepResult = onosInstallResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully installed ONOS package",
+ onfail="Failed to install ONOS package" )
+ time.sleep( main.startUpSleep )
+
+ main.step( "Starting ONOS service" )
+ stopResult = main.TRUE
+ startResult = main.TRUE
+ onosIsUp = main.TRUE
+
+ for i in range( main.numCtrls ):
+ onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+ if onosIsUp == main.TRUE:
+ main.log.report( "ONOS instance is up and ready" )
+ else:
+ main.log.report( "ONOS instance may not be up, stop and " +
+ "start ONOS again " )
+ for i in range( main.numCtrls ):
+ stopResult = stopResult and \
+ main.ONOSbench.onosStop( main.ONOSip[ i ] )
+ for i in range( main.numCtrls ):
+ startResult = startResult and \
+ main.ONOSbench.onosStart( main.ONOSip[ i ] )
+ stepResult = onosIsUp and stopResult and startResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="ONOS service is ready",
+ onfail="ONOS service did not start properly" )
+
+ main.step( "Start ONOS cli" )
+ cliResult = main.TRUE
+ for i in range( i, main.numCtrls ):
+ cliResult = cliResult and \
+ main.CLIs[ i ].startOnosCli( ONOSIp=main.ONOSip[ i ] )
+ main.log.info("ONOSip is: " + main.ONOSip[i])
+ stepResult = cliResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully start ONOS cli",
+ onfail="Failed to start ONOS cli" )
+
+
+
+ def CASE10( self, main ):
+ '''
+ Start Mininet
+ '''
+ import time
+
+ main.case( "Enable openflow-base on onos and start Mininet." )
+
+ main.step("Activate openflow-base App")
+ app = main.params['CASE10']['app']
+ stepResult = main.ONOSbench.onosCli( ONOSIp = main.ONOSip[0],
+ cmdstr = "app activate " + app )
+ time.sleep(main.cfgSleep)
+ main.log.info(stepResult)
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully activate " + app,
+ onfail="Failed to activate app " + app )
+
+ time.sleep(main.cfgSleep)
+
+
+ main.step( "Disable AdaptiveFlowSampling ")
+ stepResult = main.ONOSbench.onosCfgSet( main.ONOSip[0], "org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider",
+ "adaptiveFlowSampling " + main.params['CASE10']['adaptiveFlowenabled'])
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="App Configuration Succeeded! ",
+ onfail="App Configuration Failed!" )
+ time.sleep(main.cfgSleep)
+
+ main.step( "Setup Mininet Linear Topology with " + str(main.numSw) + " switches" )
+ argStr = main.params['CASE10']['mnArgs'].format(main.numSw)
+ stepResult = main.Mininet1.startNet( args = argStr )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully loaded topology",
+ onfail="Failed to load topology" )
+
+ time.sleep( main.startMNSleep )
+
+ main.step( "Assign switches to controller" )
+ for i in range(1, main.numSw + 1):
+ main.Mininet1.assignSwController( "s" + str(i), main.ONOSip[0] )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully assigned switch to controller",
+ onfail="Failed to assign switch to controller" )
+
+ main.deviceIdPrefix = "of:"
+
+ time.sleep( main.startMNSleep )
+
+ def CASE11( self, main ):
+ '''
+ Start Null Provider
+ '''
+ import time
+
+ main.case( "Setup Null Provider for linear Topology" )
+
+ main.step("Activate Null Provider App")
+ stepResult = main.ONOSbench.onosCli( ONOSIp = main.ONOSip[0],
+ cmdstr = "app activate org.onosproject.null" )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully activated org.onosproject.null",
+ onfail="Failed to activate org.onosproject.null" )
+ time.sleep( main.cfgSleep)
+
+ main.step( "Setup Null Provider Linear Topology with " + str(main.numSw) + " devices." )
+ r1 = main.ONOSbench.onosCfgSet( main.ONOSip[0], "org.onosproject.provider.nil.NullProviders", "deviceCount " + str(main.numSw))
+ r2 = main.ONOSbench.onosCfgSet( main.ONOSip[0], "org.onosproject.provider.nil.NullProviders", "topoShape " + main.params['CASE11']['nullTopo'] )
+ r3 = main.ONOSbench.onosCfgSet( main.ONOSip[0], "org.onosproject.provider.nil.NullProviders", "enabled " + main.params['CASE11']['nullStart'])
+ stepResult = r1 & r2 & r3
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="App Configuration Succeeded! ",
+ onfail="App Configuration Failed!" )
+ time.sleep( main.cfgSleep )
+
+ main.log.info("Check to make sure null providers are configured correctly.")
+ main.ONOSbench.handle.sendline("onos $OC1 summary")
+ stepResult = main.ONOSbench.handle.expect(":~")
+ main.log.info("ONOS Summary: " + main.ONOSbench.handle.before)
+
+ main.deviceIdPrefix = "null:"
+
+ time.sleep( main.startMNSleep )
+
+
+
+ def CASE1000( self, main ):
+ '''
+ create JSON object with batched flows
+ '''
+ import numpy
+ import time
+ from pprint import pprint
+
+ main.case( "Create a json object for the batched flows" )
+
+ main.step( "Parse batch creation information" )
+ main.batchSize = int(main.params['CASE1000']['batchSize'])
+ main.log.info("Number of flows in a batch is:" + str(main.batchSize))
+
+ main.flowJsonBatchList = []
+ startSw = 1
+
+ main.step("Creating a full list of batches")
+ for index in range(1, int(main.params['CASE1000']['batches']) + 1):
+ if startSw <= main.numSw:
+ ind = startSw
+ else:
+ startSw = 1
+ ind = startSw
+
+ main.log.info("Creating batch: " + str(index))
+ flowJsonBatch = main.ONOSrest.createFlowBatch( numSw = main.numSw,
+ swIndex = ind,
+ batchSize = main.batchSize,
+ batchIndex = index,
+ deviceIdpreFix=main.deviceIdPrefix,
+ ingressPort = 2,
+ egressPort = 3)
+ main.flowJsonBatchList.append(flowJsonBatch)
+
+ startSw += 1
+ main.log.info( "Number of items created in the batch list is: " + str(len(main.flowJsonBatchList)))
+
+ def CASE2100(self, main):
+ '''
+ Posting flow batches using threads
+ '''
+ main.case("Using REST API /flows/{} to post flow batch - multi-threads")
+ main.step("Using REST API /flows/{} to post flow batch - multi-threads")
+
+ from Queue import Queue
+ from threading import Thread
+ import time
+ import json
+
+ main.threadID = 0
+ main.addedBatchList = []
+ q = Queue()
+ tAllAdded = 0
+
+ def postWorker(id):
+ while True:
+ item = q.get()
+ #print json.dumps(item)
+ status,response = main.ONOSrest.sendFlowBatch(batch = item)
+ main.log.info("Thread {} is working on posting. ".format(id))
+ #print json.dumps(response)
+ main.addedBatchList.append(response[1])
+ q.task_done()
+
+ for i in range( int( main.params['CASE2100']['numThreads'])):
+ threadID = "ThreadID-" + str(i)
+ t = Thread(target = postWorker, name = threadID, args=(threadID,) )
+ t.daemon = True
+ t.start()
+
+ tStartPost = time.time()
+ for item in main.flowJsonBatchList:
+ q.put(item)
+
+ q.join()
+ tLastPostEnd = time.time()
+
+ main.step("Check to ensure all flows are in added state.")
+ #pprint(main.addedBatchList)
+ resp = main.FALSE
+ while resp != main.TRUE and ( tAllAdded - tLastPostEnd < int (main.params['CASE2100']['chkFlowTO']) ):
+ if main.params['CASE2100']['RESTchkFlow'] == main.TRUE:
+ resp = main.ONOSrest.checkFlowsState()
+ else:
+ handle = main.CLIs[0].flows(state = " |grep PEND|wc -l", jsonFormat=False)
+ main.log.info("handle returns PENDING flows: " + handle)
+ if handle == "0":
+ resp = main.TRUE
+
+ time.sleep( main.chkFlowSleep )
+ tAllAdded = time.time()
+
+ if tAllAdded - tLastPostEnd >= int (main.params['CASE2100']['chkFlowTO']):
+ main.log.warn("ONOS Flows still in pending state after: {} seconds.".format(tAllAdded - tLastPostEnd))
+
+ main.numFlows = int(main.params['CASE1000']['batches']) *\
+ int(main.params['CASE1000']['batchSize'])
+ main.log.info("Total number of flows: " + str (main.numFlows) )
+ main.elapsePOST = tLastPostEnd-tStartPost
+ main.log.info("Total POST elapse time: " + str( main.elapsePOST ) )
+ main.log.info("Rate of ADD Controller response: " + str(main.numFlows / ( main.elapsePOST )))
+
+ main.POSTtoCONFRM = tAllAdded - tLastPostEnd
+ main.log.info("Elapse time from end of last REST POST to Flows in ADDED state: " +\
+ str( main.POSTtoCONFRM ))
+ main.log.info("Rate of Confirmed Batch Flow ADD is (flows/sec): " +
+ str( main.numFlows / main.POSTtoCONFRM ))
+ main.log.info("Number of flow Batches in the addedBatchList is: " +
+ str( len(main.addedBatchList)))
+
+ def CASE3100(self, main):
+ '''
+ DELETE flow batches using threads
+ '''
+ main.case("Using REST API /flows/{} to delete flow batch - multi-threads")
+ main.step("Using REST API /flows/{} to delete flow batch - multi-threads")
+
+ from Queue import Queue
+ from threading import Thread
+ import time
+ import json
+
+ main.threadID = 0
+ q = Queue()
+ tAllRemoved = 0
+
+ main.log.info("Number of flow batches at start of remove: " + str( len( main.addedBatchList)))
+ def removeWorker(id):
+ while True:
+ item = q.get()
+ response = main.ONOSrest.removeFlowBatch(batch = json.loads(item) )
+ main.log.info("Thread {} is working on deleting. ".format(id))
+ q.task_done()
+
+ for i in range( int( main.params['CASE2100']['numThreads'])):
+ threadID = "ThreadID-" + str(i)
+ t = Thread(target = removeWorker, name = threadID, args=(threadID,) )
+ t.daemon = True
+ t.start()
+
+ tStartDelete = time.time()
+ for item in main.addedBatchList:
+ q.put(item)
+
+ q.join()
+ tLastDeleteEnd = time.time()
+ main.log.info("Number of flow batches at end of remove: " + str( len( main.addedBatchList)))
+
+ main.step("Check to ensure all flows are in added state.")
+ #pprint(main.addedBatchList)
+ resp = main.FALSE
+ while resp != main.TRUE and ( tAllRemoved - tLastDeleteEnd < int (main.params['CASE3100']['chkFlowTO']) ):
+ if main.params['CASE3100']['RESTchkFlow'] == main.TRUE:
+ resp = main.ONOSrest.checkFlowsState()
+ else:
+ handle = main.CLIs[0].flows(state = " |grep PEND|wc -l", jsonFormat=False)
+ main.log.info("handle returns PENDING flows: " + handle)
+ if handle == "0":
+ resp = main.TRUE
+ time.sleep( main.chkFlowSleep )
+ tAllRemoved = time.time()
+
+ if tLastDeleteEnd - tLastDeleteEnd >= int (main.params['CASE2100']['chkFlowTO']):
+ main.log.warn("ONOS Flows still in pending state after: {} seconds.".format(tAllRemoved - tLastDeleteEnd))
+
+ main.numFlows = int(main.params['CASE1000']['batches']) *\
+ int(main.params['CASE1000']['batchSize'])
+ main.log.info("Total number of flows: " + str (main.numFlows) )
+ main.elapseDELETE = tLastDeleteEnd-tStartDelete
+ main.log.info("Total DELETE elapse time: " + str( main.elapseDELETE ))
+ main.log.info("Rate of DELETE Controller response: " + str(main.numFlows / ( main.elapseDELETE )))
+
+ main.DELtoCONFRM = tAllRemoved - tLastDeleteEnd
+ main.log.info("Elapse time from end of last REST DELETE to Flows in REMOVED state: " +\
+ str( main.DELtoCONFRM ))
+ main.log.info("Rate of Confirmed Batch Flow REMOVED is (flows/sec): " + str( main.numFlows / main.DELtoCONFRM))
+
+ def CASE100(self,main):
+ from pprint import pprint
+
+ main.case( "Check to ensure onos flows." )
+
+ resp = main.ONOSrest.checkFlowsState()
+ #pprint(resp)
+
+ def CASE210(self,main):
+ main.case("Log test results to a data file")
+ main.step("Write test resulted data to a data file")
+ main.scale = main.maxNodes
+
+ try:
+ dbFileName="/tmp/SCPFbatchFlowRespData"
+ dbfile = open(dbFileName, "w+")
+ temp = "'" + main.commit + "',"
+ temp += "'" + str( main.scale ) + "',"
+ temp += "'" + main.cluster + "',"
+ temp += "'" + str( main.elapsePOST ) + "',"
+ temp += "'" + str( main.POSTtoCONFRM ) + "',"
+ temp += "'" + str ( main.elapseDELETE ) + "',"
+ temp += "'" + str ( main.DELtoCONFRM ) + "'\n"
+ dbfile.write( temp )
+ dbfile.close()
+ stepResult = main.TRUE
+ except IOError:
+ main.log.warn("Error opening " + dbFileName + " to write results.")
+ stepResult = main.FALSE
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Succeeded to write results to datafile",
+ onfail="Failed to write results to datafile " )
+
+ def CASE110( self, main ):
+ '''
+ Report errors/warnings/exceptions
+ '''
+ main.log.info("Error report: \n" )
+ main.ONOSbench.logReport( main.ONOSip[ 0 ],
+ [ "INFO",
+ "FOLLOWER",
+ "WARN",
+ "flow",
+ "ERROR",
+ "Except" ],
+ "s" )
+ #main.stop()
+
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.topo b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.topo
new file mode 100755
index 0000000..0e3543e
--- /dev/null
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.topo
@@ -0,0 +1,46 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ <home>~/Projects/onos</home>
+ </COMPONENTS>
+ </ONOSbench>
+
+ <ONOScli1>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOScli1>
+
+ <Mininet1>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>MininetCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </Mininet1>
+
+ <ONOSrest>
+ <host>OC1</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/__init__.py b/TestON/tests/MISC/SCPFbatchFlowResp/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/__init__.py
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
index 385d9e6..ac2b3c6 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
@@ -157,7 +157,7 @@
time.sleep(20)
- main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.store.flow.impl.NewDistributedFlowRuleStore", "backupEnabled " + str(flowRuleBU))
+ main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.store.flow.impl.DistributedFlowRuleStore", "backupEnabled " + str(flowRuleBU))
main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.net.intent.impl.IntentManager", "skipReleaseResourcesOnWithdrawal " + skipRelRsrc)
devices = int(clusterCount)*10
diff --git a/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.py b/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.py
index f3cd037..059552b 100644
--- a/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.py
+++ b/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.py
@@ -158,7 +158,7 @@
time.sleep(20)
- main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.store.flow.impl.NewDistributedFlowRuleStore", "backupEnabled " + str(flowRuleBU))
+ main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.store.flow.impl.DistributedFlowRuleStore", "backupEnabled " + str(flowRuleBU))
main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.net.intent.impl.IntentManager", "skipReleaseResourcesOnWithdrawal " + skipRelRsrc)
devices = int(clusterCount)*10
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
index 7d70d7f..0c4d950 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
@@ -127,7 +127,7 @@
deviceMastership = (main.params[ 'TEST' ][ "s" + str(clusterCount) ]).split(",")
print("Device mastership list: " + str(deviceMastership))
- main.ONOSbench.onosCfgSet( ONOSIp[1], "org.onosproject.store.flow.impl.NewDistributedFlowRuleStore", "backupEnabled false")
+ main.ONOSbench.onosCfgSet( ONOSIp[1], "org.onosproject.store.flow.impl.DistributedFlowRuleStore", "backupEnabled false")
main.log.step("Setting up null provider")
for i in range(3):
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.py b/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.py
index 439ecef..ff158b7 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.py
+++ b/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.py
@@ -127,7 +127,7 @@
deviceMastership = (main.params[ 'TEST' ][ "s" + str(clusterCount) ]).split(",")
print("Device mastership list: " + str(deviceMastership))
- main.ONOSbench.onosCfgSet( ONOSIp[1], "org.onosproject.store.flow.impl.NewDistributedFlowRuleStore", "backupEnabled false")
+ main.ONOSbench.onosCfgSet( ONOSIp[1], "org.onosproject.store.flow.impl.DistributedFlowRuleStore", "backupEnabled false")
main.log.step("Setting up null provider")
for i in range(3):
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
index b44a3c0..90ec8bf 100755
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
@@ -37,7 +37,7 @@
<balance>10</balance>
<nodeSleep>10</nodeSleep>
<pingall>15</pingall>
- <MNsleep>120</MNsleep>
+ <MNsleep>60</MNsleep>
</SLEEP>
<TIMEOUT>
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/dependencies/topo.py b/TestON/tests/SCPF/SCPFscaleTopo/dependencies/topo.py
index 7a8c0c6..f1101fe 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/dependencies/topo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/dependencies/topo.py
@@ -99,6 +99,7 @@
def sendArpPackage( main, hostList ):
import json
+ import time
"""
send arping package from host
return the total hosts number from Onos
@@ -107,7 +108,8 @@
if isinstance(hostList, list):
threads = []
for h in hostList:
- main.Mininet1.arping( srcHost=h, dstHost="10.0.0.1", output=main.FALSE )
+ main.Mininet1.arping( srcHost=h, dstHost="10.0.0.1", output=main.FALSE, noResult=True )
+ time.sleep(1)
else:
main.Mininet1.arping(srcHost=hostList)
summaryStr = json.loads( main.CLIs[0].summary().encode() )
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py b/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
index 58fce87..9ea664b 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
@@ -11,7 +11,7 @@
"""
import os
import imp
- main.log.case( "Setup the Mininet testbed" )
+ main.case( "Setup the Mininet testbed" )
main.dependencyPath = main.testDir + \
main.params[ 'DEPENDENCY' ][ 'path' ]
main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
@@ -81,6 +81,15 @@
ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
ipList = [ ONOS1Ip ]
+ main.step( "Copying config files" )
+ src = os.path.dirname( main.testFile ) + "/network-cfg.json"
+ dst = main.ONOSbench.home + "/tools/package/config/network-cfg.json"
+ status = main.ONOSbench.scp( main.ONOSbench, src, dst, direction="to" )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=status,
+ onpass="Copy config file succeeded",
+ onfail="Copy config file failed" )
+
main.step( "Create cell file" )
cellAppString = main.params[ 'ENV' ][ 'appString' ]
main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
@@ -94,6 +103,7 @@
onpass="Set cell succeeded",
onfail="Set cell failed" )
+ main.step( "Verify cell connectivity" )
verifyResult = main.ONOSbench.verifyCell()
utilities.assert_equals( expect=main.TRUE,
actual=verifyResult,
@@ -261,6 +271,7 @@
bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6
if bgpIntentsActualNum != bgpIntentsExpectedNum:
time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+ getIntentsResult = main.ONOScli.intents( jsonFormat=True )
bgpIntentsActualNum = \
main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
main.log.info( "bgpIntentsExpected num is:" )
@@ -293,6 +304,7 @@
allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
if allRoutesStrActual != allRoutesStrExpected:
time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+ getRoutesResult = main.ONOScli.routes( jsonFormat=True )
allRoutesActual = \
main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
@@ -314,6 +326,7 @@
routeIntentsExpectedNum = 3
if routeIntentsActualNum != routeIntentsExpectedNum:
time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+ getIntentsResult = main.ONOScli.intents( jsonFormat=True )
routeIntentsActualNum = \
main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/USECASE_SdnipI2MN.py b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/USECASE_SdnipI2MN.py
index 59bd0ab..754c03c 100755
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/USECASE_SdnipI2MN.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/USECASE_SdnipI2MN.py
@@ -25,7 +25,7 @@
QUAGGA_DIR = '/usr/lib/quagga'
QUAGGA_RUN_DIR = '/usr/local/var/run/quagga'
-QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE_SdnipFunction/dependencies/'
+QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/'
# onos1IP = '10.254.1.201'
numSw = 39
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
index 7593368..e1c20f5 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
@@ -76,6 +76,15 @@
peer64515 = main.params['config']['peer64515']
peer64516 = main.params['config']['peer64516']
+ main.step( "Copying config files" )
+ src = os.path.dirname( main.testFile ) + "/network-cfg.json"
+ dst = main.ONOSbench.home + "/tools/package/config/network-cfg.json"
+ status = main.ONOSbench.scp( main.ONOSbench, src, dst, direction="to" )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=status,
+ onpass="Copy config file succeeded",
+ onfail="Copy config file failed" )
+
main.step( "Create cell file" )
cellAppString = main.params[ 'ENV' ][ 'appString' ]
main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
@@ -89,6 +98,7 @@
onpass="Set cell succeeded",
onfail="Set cell failed" )
+ main.step( "Verify cell connectivity" )
verifyResult = main.ONOSbench.verifyCell()
utilities.assert_equals( expect=main.TRUE,
actual=verifyResult,
@@ -298,6 +308,7 @@
allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
if allRoutesStrActual != allRoutesStrExpected:
time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+ getRoutesResult = main.ONOScli1.routes( jsonFormat=True )
allRoutesActual = \
main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/USECASE_SdnipI2MN_Cluster.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/USECASE_SdnipI2MN_Cluster.py
index 7afd858..264746c 100755
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/USECASE_SdnipI2MN_Cluster.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/USECASE_SdnipI2MN_Cluster.py
@@ -25,7 +25,7 @@
QUAGGA_DIR = '/usr/lib/quagga'
QUAGGA_RUN_DIR = '/usr/local/var/run/quagga'
-QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE_SdnipFunctionCluster/dependencies/'
+QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/'
numSw = 39
# net = Mininet( controller = RemoteController )
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
index 98c28bb..8ca65a6 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
@@ -10,7 +10,7 @@
Start mininet
"""
import imp
- main.log.case( "Setup the Mininet testbed" )
+ main.case( "Setup the Mininet testbed" )
main.dependencyPath = main.testDir + \
main.params[ 'DEPENDENCY' ][ 'path' ]
main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
@@ -81,6 +81,15 @@
fsfwIp = main.params[ 'CTRL' ][ 'fsfwIp' ]
fsfwPort = main.params[ 'CTRL' ][ 'fsfwPort' ]
+ main.step( "Copying config files" )
+ src = os.path.dirname( main.testFile ) + "/network-cfg.json"
+ dst = main.ONOSbench.home + "/tools/package/config/network-cfg.json"
+ status = main.ONOSbench.scp( main.ONOSbench, src, dst, direction="to" )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=status,
+ onpass="Copy config file succeeded",
+ onfail="Copy config file failed" )
+
main.step( "Create cell file" )
cellAppString = main.params[ 'ENV' ][ 'appString' ]
main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
@@ -94,6 +103,7 @@
onpass="Set cell succeeded",
onfail="Set cell failed" )
+ main.step( "Verify cell connectivity" )
verifyResult = main.ONOSbench.verifyCell()
utilities.assert_equals( expect=main.TRUE,
actual=verifyResult,
@@ -265,6 +275,7 @@
bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6 * 2
if bgpIntentsActualNum != bgpIntentsExpectedNum:
time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+ getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
bgpIntentsActualNum = \
main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
main.log.info( "bgpIntentsExpected num is:" )
@@ -297,6 +308,7 @@
allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
if allRoutesStrActual != allRoutesStrExpected:
time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+ getRoutesResult = main.ONOScli1.routes( jsonFormat=True )
allRoutesActual = \
main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
@@ -318,6 +330,7 @@
routeIntentsExpectedNum = 3
if routeIntentsActualNum != routeIntentsExpectedNum:
time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+ getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
routeIntentsActualNum = \
main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/dependencies/USECASE_SdnipI2MN_Cluster.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/dependencies/USECASE_SdnipI2MN_Cluster.py
index 9ae23fd..ae152bc 100755
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/dependencies/USECASE_SdnipI2MN_Cluster.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/dependencies/USECASE_SdnipI2MN_Cluster.py
@@ -25,7 +25,7 @@
QUAGGA_DIR = '/usr/lib/quagga'
QUAGGA_RUN_DIR = '/usr/local/var/run/quagga'
-QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/dependencies/'
+QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/dependencies/'
numSw = 39
vlanId = 8
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py b/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
index 938b6e0..9183974 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
@@ -11,7 +11,7 @@
"""
import os
import imp
- main.log.case( "Setup the Mininet testbed" )
+ main.case( "Setup the Mininet testbed" )
main.dependencyPath = main.testDir + \
main.params[ 'DEPENDENCY' ][ 'path' ]
main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
@@ -83,13 +83,22 @@
import os
from operator import eq
- main.case( "Setting up test environment" )
+ main.case( "Setting up ONOS environment" )
cellName = main.params[ 'ENV' ][ 'cellName' ]
global ONOS1Ip
ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
ipList = [ ONOS1Ip ]
+ main.step( "Copying config files" )
+ src = os.path.dirname( main.testFile ) + "/network-cfg.json"
+ dst = main.ONOSbench.home + "/tools/package/config/network-cfg.json"
+ status = main.ONOSbench.scp( main.ONOSbench, src, dst, direction="to" )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=status,
+ onpass="Copy config file succeeded",
+ onfail="Copy config file failed" )
+
main.step( "Create cell file" )
cellAppString = main.params[ 'ENV' ][ 'appString' ]
main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
@@ -103,6 +112,7 @@
onpass="Set cell succeeded",
onfail="Set cell failed" )
+ main.step( "Verify cell connectivity" )
verifyResult = main.ONOSbench.verifyCell()
utilities.assert_equals( expect=main.TRUE,
actual=verifyResult,
@@ -244,6 +254,7 @@
bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6
if bgpIntentsActualNum != bgpIntentsExpectedNum:
time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+ getIntentsResult = main.ONOScli.intents( jsonFormat=True )
bgpIntentsActualNum = \
main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
main.log.info( "bgpIntentsExpected num is:" )
@@ -276,6 +287,7 @@
allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
if allRoutesStrActual != allRoutesStrExpected:
time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+ getRoutesResult = main.ONOScli.routes( jsonFormat=True )
allRoutesActual = \
main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
@@ -297,6 +309,7 @@
routeIntentsExpectedNum = 3
if routeIntentsActualNum != routeIntentsExpectedNum:
time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+ getIntentsResult = main.ONOScli.intents( jsonFormat=True )
routeIntentsActualNum = \
main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/dependencies/USECASE_SdnipI2MN.py b/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/dependencies/USECASE_SdnipI2MN.py
index b603875..173db99 100755
--- a/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/dependencies/USECASE_SdnipI2MN.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/dependencies/USECASE_SdnipI2MN.py
@@ -25,7 +25,7 @@
QUAGGA_DIR = '/usr/lib/quagga'
QUAGGA_RUN_DIR = '/usr/local/var/run/quagga'
-QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE_SdnipFunction_fsfw/dependencies/'
+QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/dependencies/'
# onos1IP = '10.254.1.201'
numSw = 39
vlanId = 8
diff --git a/TestON/tests/USECASE/USECASE_SegmentRouting/4x4.json b/TestON/tests/USECASE/USECASE_SegmentRouting/4x4.json
new file mode 100644
index 0000000..dee6bc3
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SegmentRouting/4x4.json
@@ -0,0 +1,200 @@
+{
+ "ports" : {
+ "of:0000000000000001/5" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.1.254/24" ]
+ }
+ ]
+ },
+ "of:0000000000000001/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.1.254/24" ]
+ }
+ ]
+ },
+ "of:0000000000000002/5" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ]
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ]
+ }
+ ]
+ },
+ "of:0000000000000003/5" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ]
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ]
+ }
+ ]
+ },
+ "of:0000000000000004/5" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.4.254/24" ]
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.4.254/24"]
+ }
+ ]
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "basic":{ "driver" : "ofdpa-cpqd" },
+ "segmentrouting" : {
+ "name" : "Leaf-R1",
+ "nodeSid" : 1,
+ "routerIp" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ }
+ },
+ "of:0000000000000002" : {
+ "basic":{ "driver" : "ofdpa-cpqd" },
+ "segmentrouting" : {
+ "name" : "Leaf-R2",
+ "nodeSid" : 2,
+ "routerIp" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ }
+ },
+ "of:0000000000000003" : {
+ "basic" :{ "driver" : "ofdpa-cpqd" },
+ "segmentrouting" : {
+ "name" : "Leaf-R3",
+ "nodeSid" : 3,
+ "routerIp" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:03",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ }
+ },
+ "of:0000000000000004" : {
+ "basic":{ "driver" : "ofdpa-cpqd" },
+ "segmentrouting" : {
+ "name" : "Leaf-R4",
+ "nodeSid" : 4,
+ "routerIp" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:04",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ }
+ },
+ "of:0000000000000101" : {
+ "basic":{ "driver" : "ofdpa-cpqd" },
+ "segmentrouting" : {
+ "name" : "Spine-R1",
+ "nodeSid" : 101,
+ "routerIp" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ }
+ },
+ "of:0000000000000102" : {
+ "basic":{ "driver" : "ofdpa-cpqd" },
+ "segmentrouting" : {
+ "name" : "Spine-R2",
+ "nodeSid" : 102,
+ "routerIp" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ }
+ },
+ "of:0000000000000103" : {
+ "basic":{ "driver" : "ofdpa-cpqd" },
+ "segmentrouting" : {
+ "name" : "Spine-R3",
+ "nodeSid" : 103,
+ "routerIp" : "192.168.0.103",
+ "routerMac" : "00:00:00:00:01:03",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ }
+ },
+ "of:0000000000000104" : {
+ "basic":{ "driver" : "ofdpa-cpqd" },
+ "segmentrouting" : {
+ "name" : "Spine-R4",
+ "nodeSid" : 104,
+ "routerIp" : "192.168.0.104",
+ "routerMac" : "00:00:00:00:01:04",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ }
+ }
+ },
+ "hosts" : {
+ "00:00:00:00:00:01/-1" : {
+ "basic": {
+ "ips": ["10.0.1.1"],
+ "location": "of:0000000000000001/5"
+ }
+ },
+ "00:00:00:00:00:02/-1" : {
+ "basic": {
+ "ips": ["10.0.1.2"],
+ "location": "of:0000000000000001/6"
+ }
+ },
+ "00:00:00:00:00:03/-1" : {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "location": "of:0000000000000002/5"
+ }
+ },
+ "00:00:00:00:00:04/-1" : {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "location": "of:0000000000000002/6"
+ }
+ },
+ "00:00:00:00:00:05/-1" : {
+ "basic": {
+ "ips": ["10.0.3.1"],
+ "location": "of:0000000000000003/5"
+ }
+ },
+ "00:00:00:00:00:06/-1" : {
+ "basic": {
+ "ips": ["10.0.3.2"],
+ "location": "of:0000000000000003/6"
+ }
+ },
+ "00:00:00:00:00:07/-1" : {
+ "basic": {
+ "ips": ["10.0.4.1"],
+ "location": "of:0000000000000004/5"
+ }
+ },
+ "00:00:00:00:00:08/-1" : {
+ "basic": {
+ "ips": ["10.0.4.2"],
+ "location": "of:0000000000000004/6"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.params b/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.params
index 0ceb4f2..eb55d5f 100755
--- a/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.params
+++ b/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>1,2,11,9, 2,11,9</testcases>
+ <testcases>1,2,11,9,2,11,9,2,11,9,2,11,9</testcases>
<SCALE>
<size>1</size>
diff --git a/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.py b/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.py
index 31678fe..7eb4dd7 100644
--- a/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.py
+++ b/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.py
@@ -29,13 +29,16 @@
# Test variables
main.cellName = main.params[ 'ENV' ][ 'cellName' ]
main.apps = main.params[ 'ENV' ][ 'cellApps' ]
- main.diff = ( main.params[ 'ENV' ][ 'diffApps' ] ).split(";")
+ main.diff = []
+ main.diff.extend(( main.params[ 'ENV' ][ 'diffApps' ] ).split(";"))
+ main.diff.extend(( main.params[ 'ENV' ][ 'diffApps' ] ).split(";"))
gitBranch = main.params[ 'GIT' ][ 'branch' ]
- main.dependencyPath = os.path.dirname( main.testFile ) + "/dependencies/"
+ main.path = os.path.dirname( main.testFile )
+ main.dependencyPath = main.path + "/dependencies/"
main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
#main.json = ["4x4"]
- main.json = ["2x2", "2x2"]
- main.args = [" ", " "]
+ main.json = ["2x2", "2x2","4x4","4x4"]
+ main.args = [" ", " ", " --spine 4 --leaf 4 ", " --spine 4 --leaf 4 "]
#main.args = [" --spine 4 --leaf 4 "]
main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
@@ -105,8 +108,11 @@
# main.scale[ 0 ] determines the current number of ONOS controller
main.numCtrls = int( main.scale[ 0 ] )
-
- main.case( "Package and start ONOS")
+ apps=main.apps
+ if main.diff:
+ apps = main.apps+","+main.diff.pop(0)
+ else: main.log.error( "App list is empty" )
+ main.case( "Package and start ONOS using apps:" + apps)
#kill off all onos processes
main.log.info( "Safety check, killing all ONOS processes" +
@@ -120,16 +126,14 @@
tempOnosIp = []
for i in range( main.numCtrls ):
tempOnosIp.append( main.ONOSip[i] )
- apps=main.apps
- if main.diff:
- apps = main.apps+","+main.diff.pop(0)
- else: main.log.error( "App list is empty" )
onosUser = main.params[ 'ENV' ][ 'cellUser' ]
+ main.step("Creating cell file")
main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
"temp",
main.Mininet1.ip_address,
apps,
- tempOnosIp )
+ tempOnosIp,
+ onosUser )
main.step( "Apply cell to environment" )
cellResult = main.ONOSbench.setCell( "temp" )
@@ -142,13 +146,14 @@
onfail="Failed to apply cell to environment " )
main.step( "Creating ONOS package" )
- main.ONOSbench.handle.sendline( "cp ~/OnosSystemTest/TestON/tests/USECASE_SegmentRouting/"+main.json.pop(0)+".json ~/onos/tools/package/config/network-cfg.json")
+ main.jsonFile=main.json.pop(0)
+ main.ONOSbench.handle.sendline( "cp "+main.path+"/"+main.jsonFile+".json ~/onos/tools/package/config/network-cfg.json")
packageResult = main.ONOSbench.onosPackage()
- stepResult = packageResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully created ONOS package",
- onfail="Failed to create ONOS package" )
+ #stepResult = packageResult
+ #utilities.assert_equals( expect=main.TRUE,
+ # actual=stepResult,
+ # onpass="Successfully created ONOS package",
+ # onfail="Failed to create ONOS package" )
time.sleep( main.startUpSleep )
@@ -192,7 +197,10 @@
'''
Report errors/warnings/exceptions
'''
- main.log.case( "Logging test" )
+ main.case( "Logging test for " + main.jsonFile )
+ #if len(main.json) > 0 :
+ main.ONOSbench.cpLogsToDir("/opt/onos/log/karaf.log",main.logdir,
+ copyFileName="karaf.log."+main.jsonFile+str(len(main.json)))
#main.ONOSbench.logReport( main.ONOSip[ 0 ],
# [ "INFO" ],
# "a" )
@@ -210,7 +218,7 @@
"""
Start mininet
"""
- main.log.case( "Start Leaf-Spine 2x2 Mininet Topology" )
+ main.case( "Start Leaf-Spine "+main.jsonFile+" Mininet Topology" )
main.log.report( "Start Mininet topology" )
main.step( "Starting Mininet Topology" )