Merge pull request #138 from kkhalasi/master
Adding proof of concept scale test purely in Robot Framework
diff --git a/README.md b/README.md
index ef2c912..f84882a 100644
--- a/README.md
+++ b/README.md
@@ -51,11 +51,7 @@
$ sudo pip install numpy
-4. STS - This can be installed by:
-
- $ git clone https://github.com/jhall11/sts.git
-
-5. Linc-OE - Some testcases use this to emulate optical devices
+4. Linc-OE - Some testcases use this to emulate optical devices
Requirements:
diff --git a/TestON/bin/cleanup.sh b/TestON/bin/cleanup.sh
new file mode 100755
index 0000000..d921147
--- /dev/null
+++ b/TestON/bin/cleanup.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+# This script will kill any TestON, ssh, and Mininet sessions that are running.
+sudo kill -9 `ps -ef | grep "./cli.py" | grep -v grep | awk '{print $2}'`
+sudo kill -9 `ps -ef | grep "ssh -X" | grep -v grep | awk '{print $2}'`
+sudo mn -c
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 2661715..7e99ffd 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -32,7 +32,7 @@
import new
import xmldict
import importlib
-import os
+import threading
module = new.module("test")
import openspeak
global path, drivers_path, core_path, tests_path,logs_path
@@ -91,6 +91,8 @@
self.logs_path = logs_path
self.driver = ''
self.Thread = Thread
+ self.cleanupFlag = False
+ self.cleanupLock = threading.Lock()
self.configparser()
verifyOptions(options)
@@ -298,7 +300,7 @@
else:
self.stepCache += "No Result\n"
self.stepResults.append(self.STEPRESULT)
- except StandardError as e:
+ except StandardError:
self.log.exception( "\nException in the following section of" +
" code: " + str(testCaseNumber) + "." +
str(step) + ": " + self.stepName )
@@ -351,33 +353,51 @@
def cleanup(self):
'''
- Release all the component handles and the close opened file handles.
- This will return TRUE if all the component handles and log handles closed properly,
- else return FALSE
+ Print a summary of the current test's results then attempt to release
+ all the component handles and the close opened file handles.
+ This function shouldbe threadsafe such that cleanup will only be
+ executed once per test.
+
+ This will return TRUE if all the component handles and log handles
+ closed properly, else return FALSE.
'''
result = self.TRUE
- self.logger.testSummary(self)
-
- #self.reportFile.close()
-
- #utilities.send_mail()
- for component in self.componentDictionary.keys():
- try :
- tempObject = vars(self)[component]
- print "Disconnecting from " + str(tempObject.name) + ": " + \
- str(tempObject)
- tempObject.disconnect()
- #tempObject.execute(cmd="exit",prompt="(.*)",timeout=120)
-
- except (Exception):
- self.log.exception( "Exception while disconnecting from " +
- str( component ) )
- result = self.FALSE
- # Closing all the driver's session files
- for driver in self.componentDictionary.keys():
- vars(self)[driver].close_log_handles()
-
+ lock = self.cleanupLock
+ if lock.acquire( False ):
+ try:
+ if self.cleanupFlag is False: # First thread to run this
+ self.cleanupFlag = True
+ self.logger.testSummary(self)
+ for component in self.componentDictionary.keys():
+ try :
+ tempObject = vars(self)[component]
+ print "Disconnecting from " + str(tempObject.name) + ": " + \
+ str(tempObject)
+ tempObject.disconnect()
+ except Exception:
+ self.log.exception( "Exception while disconnecting from " +
+ str( component ) )
+ result = self.FALSE
+ # Closing all the driver's session files
+ for driver in self.componentDictionary.keys():
+ try:
+ vars(self)[driver].close_log_handles()
+ except Exception:
+ self.log.exception( "Exception while closing log files for " +
+ str( driver ) )
+ result = self.FALSE
+ else:
+ pass # Someone else already ran through this function
+ finally:
+ lock.release()
+ else: # Someone already has a lock
+ # NOTE: This could cause problems if we don't release the lock
+ # correctly
+ lock.acquire() # Wait for the other thread to finish
+ # NOTE: If we don't wait, exit could be called while the thread
+ # with the lock is still cleaning up
+ lock.release()
return result
def pause(self):
@@ -585,6 +605,12 @@
def exit(self):
__builtin__.testthread = None
+ for thread in threading.enumerate():
+ if thread.isAlive():
+ try:
+ thread._Thread__stop()
+ except:
+ print(str(thread.getName()) + ' could not be terminated' )
sys.exit()
def verifyOptions(options):
@@ -614,7 +640,7 @@
main.classPath = "examples."+main.TEST+"."+main.TEST
else :
print "Test or Example not specified please specify the --test <test name > or --example <example name>"
- self.exit()
+ main.exit()
def verifyExample(options):
if options.example:
@@ -806,21 +832,5 @@
print sys.exc_info()[1]
main.exit()
-def load_defaultlogger():
- '''
- It will load the default parser which is xml parser to parse the params and topology file.
- '''
- moduleList = main.loggerPath.split("/")
- newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
- try :
- loggerClass = main.loggerClass
- loggerModule = __import__(newModule, globals(), locals(), [loggerClass], -1)
- loggerClass = getattr(loggerModule, loggerClass)
- main.logger = loggerClass()
-
- except ImportError:
- print sys.exc_info()[1]
- main.exit()
-
def _echo(self):
print "THIS IS ECHO"
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 57d8c9b..bdc9307 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -18,12 +18,8 @@
You should have received a copy of the GNU General Public License
along with TestON. If not, see <http://www.gnu.org/licenses/>.
-
MininetCliDriver is the basic driver which will handle the Mininet functions
-Some functions rely on STS module. To install this,
- git clone https://github.com/jhall11/sts.git
-
Some functions rely on a modified version of Mininet. These functions
should all be noted in the comments. To get this MN version run these commands
from within your Mininet folder:
@@ -38,6 +34,7 @@
import pexpect
import re
import sys
+import types
sys.path.append( "../" )
from math import pow
from drivers.common.cli.emulatordriver import Emulator
@@ -95,12 +92,20 @@
main.cleanup()
main.exit()
- def startNet( self, topoFile='', args='', timeout=120 ):
+ def startNet( self, topoFile='', args='', mnCmd='', timeout=120 ):
"""
- Starts Mininet accepts a topology(.py) file and/or an optional
- argument ,to start the mininet, as a parameter.
- Returns main.TRUE if the mininet starts successfully and
- main.FALSE otherwise
+ Description:
+ Starts Mininet accepts a topology(.py) file and/or an optional
+ argument, to start the mininet, as a parameter.
+ Can also send regular mininet command to load up desired topology.
+ Eg. Pass in a string 'sudo mn --topo=tree,3,3' to mnCmd
+ Options:
+ topoFile = file path for topology file (.py)
+ args = extra option added when starting the topology from the file
+ mnCmd = Mininet command use to start topology
+ Returns:
+ main.TRUE if the mininet starts successfully, main.FALSE
+ otherwise
"""
if self.handle:
# make sure old networks are cleaned up
@@ -130,26 +135,33 @@
"Mininet took too long... " )
# Craft the string to start mininet
cmdString = "sudo "
- if topoFile is None or topoFile == '': # If no file is given
- main.log.info( self.name + ": building fresh Mininet" )
- cmdString += "mn "
- if args is None or args == '':
- # If no args given, use args from .topo file
- args = self.options[ 'arg1' ] +\
- " " + self.options[ 'arg2' ] +\
- " --mac --controller " +\
- self.options[ 'controller' ] + " " +\
- self.options[ 'arg3' ]
- else: # else only use given args
- pass
- # TODO: allow use of topo args and method args?
- else: # Use given topology file
- main.log.info( "Starting Mininet from topo file " + topoFile )
- cmdString += topoFile + " "
- if args is None:
- args = ''
- # TODO: allow use of args from .topo file?
- cmdString += args
+ if not mnCmd:
+ if topoFile is None or topoFile == '': # If no file is given
+ main.log.info( self.name + ": building fresh Mininet" )
+ cmdString += "mn "
+ if args is None or args == '':
+ # If no args given, use args from .topo file
+ args = self.options[ 'arg1' ] +\
+ " " + self.options[ 'arg2' ] +\
+ " --mac --controller " +\
+ self.options[ 'controller' ] + " " +\
+ self.options[ 'arg3' ]
+ else: # else only use given args
+ pass
+ # TODO: allow use of topo args and method args?
+ else: # Use given topology file
+ main.log.info(
+ "Starting Mininet from topo file " +
+ topoFile )
+ cmdString += topoFile + " "
+ if args is None:
+ args = ''
+ # TODO: allow use of args from .topo file?
+ cmdString += args
+ else:
+ main.log.info( "Starting Mininet topology using '" + mnCmd +
+ "' command" )
+ cmdString += mnCmd
# Send the command and check if network started
self.handle.sendline( "" )
self.handle.expect( '\$' )
@@ -170,7 +182,7 @@
self.handle.after )
self.handle.expect( '\$' )
response += str( self.handle.before +
- self.handle.after )
+ self.handle.after )
main.log.error(
self.name +
": Launching Mininet failed: " + response )
@@ -246,13 +258,13 @@
topoDict = self.numSwitchesNlinks( *topoArgList )
return topoDict
- def pingall( self, timeout=300, shortCircuit=False, acceptableFailed=0):
+ def pingall( self, timeout=300, shortCircuit=False, acceptableFailed=0 ):
"""
Verifies the reachability of the hosts using pingall command.
Optional parameter timeout allows you to specify how long to
wait for pingall to complete
Optional:
- timeout(seconds) - How long to wait before breaking the pingall
+ timeout( seconds ) - How long to wait before breaking the pingall
shortCircuit - Break the pingall based on the number of failed hosts
ping
acceptableFailed - Set the number of acceptable failed pings for the
@@ -274,12 +286,12 @@
self.handle.sendline( "pingall" )
startTime = time.time()
while True:
- i = self.handle.expect( [ "mininet>","X",
+ i = self.handle.expect( [ "mininet>", "X",
pexpect.EOF,
pexpect.TIMEOUT ],
- timeout )
+ timeout )
if i == 0:
- main.log.info( self.name + ": pingall finished")
+ main.log.info( self.name + ": pingall finished" )
response += self.handle.before
break
elif i == 1:
@@ -369,23 +381,22 @@
def pingallHosts( self, hostList, pingType='ipv4' ):
"""
- Ping all specified hosts with a specific ping type
-
- Acceptable pingTypes:
- - 'ipv4'
+ Ping all specified hosts with a specific ping type
+
+ Acceptable pingTypes:
+ - 'ipv4'
- 'ipv6'
-
+
Acceptable hostList:
- - ['h1','h2','h3','h4']
-
- Returns main.TRUE if all hosts specified can reach
+ - [ 'h1','h2','h3','h4' ]
+
+ Returns main.TRUE if all hosts specified can reach
each other
-
+
Returns main.FALSE if one or more of hosts specified
cannot reach each other"""
-
if pingType == "ipv4":
- cmd = " ping -c 1 -i 1 -W 8 "
+ cmd = " ping -c 1 -i 1 -W 8 "
elif pingType == "ipv6":
cmd = " ping6 -c 1 -i 1 -W 8 "
else:
@@ -394,30 +405,32 @@
try:
main.log.info( "Testing reachability between specified hosts" )
-
+
isReachable = main.TRUE
for host in hostList:
- listIndex = hostList.index(host)
+ listIndex = hostList.index( host )
# List of hosts to ping other than itself
- pingList = hostList[:listIndex] + hostList[(listIndex+1):]
-
+ pingList = hostList[ :listIndex ] + \
+ hostList[ ( listIndex + 1 ): ]
+
for temp in pingList:
# Current host pings all other hosts specified
- pingCmd = str(host) + cmd + str(temp)
+ pingCmd = str( host ) + cmd + str( temp )
self.handle.sendline( pingCmd )
i = self.handle.expect( [ pingCmd, pexpect.TIMEOUT ] )
j = self.handle.expect( [ "mininet>", pexpect.TIMEOUT ] )
response = self.handle.before
if re.search( ',\s0\%\spacket\sloss', response ):
- main.log.info( str(host) + " -> " + str(temp) )
+ main.log.info( str( host ) + " -> " + str( temp ) )
else:
- main.log.info( str(host) + " -> X ("+str(temp)+") "
- " Destination Unreachable" )
+ main.log.info(
+ str( host ) + " -> X (" + str( temp ) + ") "
+ " Destination Unreachable" )
# One of the host to host pair is unreachable
isReachable = main.FALSE
- return isReachable
+ return isReachable
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
@@ -533,19 +546,19 @@
Note: The intf between host and oldSw when detached
using detach(), will still show up in the 'net'
cmd, because switch.detach() doesn't affect switch.intfs[]
- (which is correct behavior since the interfaces
- haven't moved).
+ ( which is correct behavior since the interfaces
+ haven't moved ).
"""
if self.handle:
try:
# Bring link between oldSw-host down
- cmd = "py net.configLinkStatus('" + oldSw + "'," + "'"+ host +\
+ cmd = "py net.configLinkStatus('" + oldSw + "'," + "'" + host +\
"'," + "'down')"
print "cmd1= ", cmd
response = self.execute( cmd=cmd,
prompt="mininet>",
timeout=10 )
-
+
# Determine hostintf and Oldswitchintf
cmd = "px hintf,sintf = " + host + ".connectionsTo(" + oldSw +\
")[0]"
@@ -563,7 +576,7 @@
print "cmd3= ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
-
+
# Detach interface between oldSw-host
cmd = "px " + oldSw + ".detach( sintf )"
print "cmd4= ", cmd
@@ -575,20 +588,20 @@
print "cmd5= ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
-
+
# Determine hostintf and Newswitchintf
cmd = "px hintf,sintf = " + host + ".connectionsTo(" + newSw +\
")[0]"
print "cmd6= ", cmd
self.handle.sendline( cmd )
- self.handle.expect( "mininet>" )
+ self.handle.expect( "mininet>" )
# Attach interface between newSw-host
cmd = "px " + newSw + ".attach( sintf )"
print "cmd3= ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
-
+
# Set ipaddress of the host-newSw interface
cmd = "px " + host + ".setIP( ip = ipaddr, intf = hintf)"
print "cmd7 = ", cmd
@@ -600,7 +613,7 @@
print "cmd8 = ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
-
+
cmd = "net"
print "cmd9 = ", cmd
self.handle.sendline( cmd )
@@ -613,7 +626,7 @@
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
print "ifconfig o/p = ", self.handle.before
-
+
return main.TRUE
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
@@ -896,6 +909,18 @@
main.exit()
return response
+ def links( self ):
+ main.log.info( self.name + ": List network links" )
+ try:
+ response = self.execute( cmd='links', prompt='mininet>',
+ timeout=10 )
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ return response
+
def iperf( self, host1, host2 ):
main.log.info(
self.name +
@@ -1058,7 +1083,7 @@
return main.TRUE
def getVersion( self ):
- #FIXME: What uses this? This should be refactored to get
+ # FIXME: What uses this? This should be refactored to get
# version from MN and not some other file
fileInput = path + '/lib/Mininet/INSTALL'
version = super( Mininet, self ).getVersion()
@@ -1092,49 +1117,133 @@
main.cleanup()
main.exit()
- def assignSwController( self, **kwargs ):
+ def assignSwController( self, sw, ip, port="6633", ptcp="" ):
"""
- count is only needed if there is more than 1 controller"""
- args = utilities.parse_args( [ "COUNT" ], **kwargs )
- count = args[ "COUNT" ] if args != {} else 1
+ Description:
+ Assign switches to the controllers ( for ovs use only )
+ Required:
+ sw - Name of the switch. This can be a list or a string.
+ ip - Ip addresses of controllers. This can be a list or a string.
+ Optional:
+ port - ONOS use port 6633, if no list of ports is passed, then
+ the all the controller will use 6633 as their port number
+ ptcp - ptcp number, This can be a string or a list that has
+ the same length as switch. This is optional and not required
+ when using ovs switches.
+ NOTE: If switches and ptcp are given in a list type they should have the
+ same length and should be in the same order, Eg. sw=[ 's1' ... n ]
+ ptcp=[ '6637' ... n ], s1 has ptcp number 6637 and so on.
- argstring = "SW"
- for j in range( count ):
- argstring = argstring + ",IP" + \
- str( j + 1 ) + ",PORT" + str( j + 1 )
- args = utilities.parse_args( argstring.split( "," ), **kwargs )
-
- sw = args[ "SW" ] if args[ "SW" ] is not None else ""
- ptcpA = int( args[ "PORT1" ] ) + \
- int( sw ) if args[ "PORT1" ] is not None else ""
- ptcpB = "ptcp:" + str( ptcpA ) if ptcpA != "" else ""
-
- command = "sh ovs-vsctl set-controller s" + \
- str( sw ) + " " + ptcpB + " "
- for j in range( count ):
- i = j + 1
- args = utilities.parse_args(
- [ "IP" + str( i ), "PORT" + str( i ) ], **kwargs )
- ip = args[
- "IP" +
- str( i ) ] if args[
- "IP" +
- str( i ) ] is not None else ""
- port = args[
- "PORT" +
- str( i ) ] if args[
- "PORT" +
- str( i ) ] is not None else ""
- tcp = "tcp:" + str( ip ) + ":" + str( port ) + \
- " " if ip != "" else ""
- command = command + tcp
+ Return:
+ Returns main.TRUE if mininet correctly assigned switches to
+ controllers, otherwise it will return main.FALSE or an appropriate
+ exception(s)
+ """
+ assignResult = main.TRUE
+ # Initial ovs command
+ commandList = []
+ command = "sh ovs-vsctl set-controller "
+ onosIp = ""
try:
- self.execute( cmd=command, prompt="mininet>", timeout=5 )
- except pexpect.EOF:
- main.log.error( self.name + ": EOF exception found" )
- main.log.error( self.name + ": " + self.handle.before )
- main.cleanup()
- main.exit()
+ if isinstance( ip, types.StringType ):
+ onosIp = "tcp:" + str( ip ) + ":"
+ if isinstance( port, types.StringType ) or \
+ isinstance( port, types.IntType ):
+ onosIp += str( port )
+ elif isinstance( port, types.ListType ):
+ main.log.error( self.name + ": Only one controller " +
+ "assigned and a list of ports has" +
+ " been passed" )
+ return main.FALSE
+ else:
+ main.log.error( self.name + ": Invalid controller port " +
+ "number. Please specify correct " +
+ "controller port" )
+ return main.FALSE
+
+ elif isinstance( ip, types.ListType ):
+ if isinstance( port, types.StringType ) or \
+ isinstance( port, types.IntType ):
+ for ipAddress in ip:
+ onosIp += "tcp:" + str( ipAddress ) + ":" + \
+ str( port ) + " "
+ elif isinstance( port, types.ListType ):
+ if ( len( ip ) != len( port ) ):
+ main.log.error( self.name + ": Port list = " +
+ str( len( port ) ) +
+ "should be the same as controller" +
+ " ip list = " + str( len( ip ) ) )
+ return main.FALSE
+ else:
+ onosIp = ""
+ for ipAddress, portNum in zip( ip, port ):
+ onosIp += "tcp:" + str( ipAddress ) + ":" + \
+ str( portNum ) + " "
+ else:
+ main.log.error( self.name + ": Invalid controller port " +
+ "number. Please specify correct " +
+ "controller port" )
+ return main.FALSE
+ else:
+ main.log.error( self.name + ": Invalid ip address" )
+ return main.FALSE
+
+ if isinstance( sw, types.StringType ):
+ command += sw + " "
+ if ptcp:
+ if isinstance( ptcp, types.StringType ):
+ command += "ptcp:" + str( ptcp ) + " "
+ elif isinstance( ptcp, types.ListType ):
+ main.log.error( self.name + ": Only one switch is " +
+ "being set and multiple PTCP is " +
+ "being passed " )
+ else:
+ main.log.error( self.name + ": Invalid PTCP" )
+ ptcp = ""
+ command += onosIp
+ commandList.append( command )
+
+ elif isinstance( sw, types.ListType ):
+ if ptcp:
+ if isinstance( ptcp, types.ListType ):
+ if len( ptcp ) != len( sw ):
+ main.log.error( self.name + ": PTCP length = " +
+ str( len( ptcp ) ) +
+ " is not the same as switch" +
+ " length = " +
+ str( len( sw ) ) )
+ return main.FALSE
+ else:
+ for switch, ptcpNum in zip( sw, ptcp ):
+ tempCmd = "sh ovs-vsctl set-controller "
+ tempCmd += switch + " ptcp:" + \
+ str( ptcpNum ) + " "
+ tempCmd += onosIp
+ commandList.append( tempCmd )
+ else:
+ main.log.error( self.name + ": Invalid PTCP" )
+ return main.FALSE
+ else:
+ for switch in sw:
+ tempCmd = "sh ovs-vsctl set-controller "
+ tempCmd += switch + " " + onosIp
+ commandList.append( tempCmd )
+ else:
+ main.log.error( self.name + ": Invalid switch type " )
+ return main.FALSE
+
+ for cmd in commandList:
+ try:
+ self.execute( cmd=cmd, prompt="mininet>", timeout=5 )
+ except pexpect.TIMEOUT:
+ main.log.error( self.name + ": pexpect.TIMEOUT found" )
+ return main.FALSE
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ return main.TRUE
except Exception:
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
@@ -1365,9 +1474,9 @@
Called at the end of the test to stop the mininet and
disconnect the handle.
"""
- self.handle.sendline('')
+ self.handle.sendline( '' )
i = self.handle.expect( [ 'mininet>', pexpect.EOF, pexpect.TIMEOUT ],
- timeout=2)
+ timeout=2 )
response = main.TRUE
if i == 0:
response = self.stopNet()
@@ -1382,7 +1491,7 @@
main.log.error( "Connection failed to the host" )
return response
- def stopNet( self, fileName = "", timeout=5):
+ def stopNet( self, fileName="", timeout=5 ):
"""
Stops mininet.
Returns main.TRUE if the mininet successfully stops and
@@ -1390,12 +1499,11 @@
Will cleanup and exit the test if mininet fails to stop
"""
-
main.log.info( self.name + ": Stopping mininet..." )
response = ''
if self.handle:
try:
- self.handle.sendline("")
+ self.handle.sendline( "" )
i = self.handle.expect( [ 'mininet>',
'\$',
pexpect.EOF,
@@ -1403,15 +1511,14 @@
timeout )
if i == 0:
main.log.info( "Exiting mininet..." )
-
response = self.execute(
cmd="exit",
prompt="(.*)",
timeout=120 )
- main.log.info( self.name + ": Stopped")
+ main.log.info( self.name + ": Stopped" )
self.handle.sendline( "sudo mn -c" )
response = main.TRUE
-
+
if i == 1:
main.log.info( " Mininet trying to exit while not " +
"in the mininet prompt" )
@@ -1420,11 +1527,14 @@
elif i == 3: # timeout
main.log.error( "Something went wrong exiting mininet " +
"TIMEOUT" )
-
+
if fileName:
- self.handle.sendline("")
- self.handle.expect('\$')
- self.handle.sendline("sudo kill -9 \`ps -ef | grep \""+ fileName +"\" | grep -v grep | awk '{print $2}'\`")
+ self.handle.sendline( "" )
+ self.handle.expect( '\$' )
+ self.handle.sendline(
+ "sudo kill -9 \`ps -ef | grep \"" +
+ fileName +
+ "\" | grep -v grep | awk '{print $2}'\`" )
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
@@ -1447,7 +1557,7 @@
"""
if ethDevice:
ethDevice = '-I ' + ethDevice + ' '
- cmd = " py " + host + ".cmd(\"arping -c 1 " + ethDevice + ip + "\")"
+ cmd = " py " + host + ".cmd(\"arping -c 1 " + ethDevice + ip + "\")"
try:
main.log.warn( "Sending: " + cmd )
self.handle.sendline( cmd )
@@ -1584,46 +1694,191 @@
main.cleanup()
main.exit()
- def compareSwitches( self, topo, switchesJson ):
+ def getPorts( self, nodeName, verbose=False ):
+ """
+ Read ports from a Mininet switch.
+
+ Returns a json structure containing information about the
+ ports of the given switch.
+ """
+ response = self.getInterfaces( nodeName )
+ # TODO: Sanity check on response. log if no such switch exists
+ ports = []
+ for line in response.split( "\n" ):
+ if not line.startswith( "name=" ):
+ continue
+ portVars = {}
+ for var in line.split( "," ):
+ key, value = var.split( "=" )
+ portVars[ key ] = value
+ isUp = portVars.pop( 'enabled', "True" )
+ isUp = "True" in isUp
+ if verbose:
+ main.log.info( "Reading switch port %s(%s)" %
+ ( portVars[ 'name' ], portVars[ 'mac' ] ) )
+ mac = portVars[ 'mac' ]
+ if mac == 'None':
+ mac = None
+ ips = []
+ ip = portVars[ 'ip' ]
+ if ip == 'None':
+ ip = None
+ ips.append( ip )
+ name = portVars[ 'name' ]
+ if name == 'None':
+ name = None
+ portRe = r'[^\-]\d\-eth(?P<port>\d+)'
+ if name == 'lo':
+ portNo = 0xfffe # TODO: 1.0 value - Should we just return lo?
+ else:
+ portNo = re.search( portRe, name ).group( 'port' )
+ ports.append( { 'of_port': portNo,
+ 'mac': str( mac ).replace( '\'', '' ),
+ 'name': name,
+ 'ips': ips,
+ 'enabled': isUp } )
+ return ports
+
+ def getSwitches( self, verbose=False ):
+ """
+ Read switches from Mininet.
+
+ Returns a dictionary whose keys are the switch names and the value is
+ a dictionary containing information about the switch.
+ """
+ # FIXME: This currently only works with OVS Switches
+
+ # Regex patterns to parse dump output
+ # Example Switch:
+ # <OVSSwitch s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None,s1-eth3:None pid=5238>
+ # <OVSSwitch{ 'protocols': 'OpenFlow10' } s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None pid=25974>
+ swRE = r"<OVSSwitch(\{.*\})?\s(?P<name>[^:]+)\:\s" +\
+ "(?P<ports>([^,]+,)*[^,\s]+)"
+ # Update mn port info
+ self.update()
+ output = {}
+ dump = self.dump().split( "\n" )
+ for line in dump:
+ if line.startswith( "<OVSSwitch" ):
+ result = re.search( swRE, line, re.I )
+ name = result.group( 'name' )
+ dpid = str( self.getSwitchDPID( name ) ).zfill( 16 )
+ if verbose:
+ main.log.info( "Reading switch %s(%s)" % ( name, dpid ) )
+ ports = self.getPorts( name )
+ output[ name ] = { "dpid": dpid, "ports": ports }
+ return output
+
+ def getHosts( self, verbose=False ):
+ """
+ Read hosts from Mininet.
+
+ Returns a dictionary whose keys are the host names and the value is
+ a dictionary containing information about the host.
+ """
+ # Regex patterns to parse dump output
+ # Example host: <Host h1: h1-eth0:10.0.0.1 pid=5227>
+ # or <Host h1: pid=12725>
+ # NOTE: Does not correctly match hosts with multi-links
+ # <Host h2: h2-eth0:10.0.0.2,h2-eth1:10.0.1.2 pid=14386>
+ # FIXME: Fix that
+ hostRE = r"<Host\s(?P<name>[^:]+)\:((\s(?P<ifname>[^:]+)\:" +\
+ "(?P<ip>[^\s]+))|(\s)\spid=(?P<pid>[^>]+))"
+ # update mn port info
+ self.update()
+ # Get mininet dump
+ dump = self.dump().split( "\n" )
+ hosts = {}
+ for line in dump:
+ if line.startswith( "<Host" ):
+ result = re.search( hostRE, line )
+ name = result.group( 'name' )
+ interfaces = []
+ response = self.getInterfaces( name )
+ # Populate interface info
+ for line in response.split( "\n" ):
+ if line.startswith( "name=" ):
+ portVars = {}
+ for var in line.split( "," ):
+ key, value = var.split( "=" )
+ portVars[ key ] = value
+ isUp = portVars.pop( 'enabled', "True" )
+ isUp = "True" in isUp
+ if verbose:
+ main.log.info( "Reading host port %s(%s)" %
+ ( portVars[ 'name' ],
+ portVars[ 'mac' ] ) )
+ mac = portVars[ 'mac' ]
+ if mac == 'None':
+ mac = None
+ ips = []
+ ip = portVars[ 'ip' ]
+ if ip == 'None':
+ ip = None
+ ips.append( ip )
+ intfName = portVars[ 'name' ]
+ if name == 'None':
+ name = None
+ interfaces.append( {
+ "name": intfName,
+ "ips": ips,
+ "mac": str( mac ),
+ "isUp": isUp } )
+ hosts[ name ] = { "interfaces": interfaces }
+ return hosts
+
+ def getLinks( self ):
+ """
+ Gathers information about current Mininet links. These links may not
+ be up if one of the ports is down.
+
+ Returns a list of dictionaries with link endpoints.
+
+ The dictionary structure is:
+ { 'node1': str( node1 name )
+ 'node2': str( node2 name )
+ 'port1': str( port1 of_port )
+ 'port2': str( port2 of_port ) }
+ Note: The port number returned is the eth#, not necessarily the of_port
+ number. In Mininet, for OVS switch, these should be the same. For
+ hosts, this is just the eth#.
+ """
+ self.update()
+ response = self.links().split( '\n' )
+
+ # Examples:
+ # s1-eth3<->s2-eth1 (OK OK)
+ # s13-eth3<->h27-eth0 (OK OK)
+ linkRE = "(?P<node1>[\w]+)\-eth(?P<port1>[\d]+)\<\-\>" +\
+ "(?P<node2>[\w]+)\-eth(?P<port2>[\d]+)"
+ links = []
+ for line in response:
+ match = re.search( linkRE, line )
+ if match:
+ node1 = match.group( 'node1' )
+ node2 = match.group( 'node2' )
+ port1 = match.group( 'port1' )
+ port2 = match.group( 'port2' )
+ links.append( { 'node1': node1,
+ 'node2': node2,
+ 'port1': port1,
+ 'port2': port2 } )
+ return links
+
+ def compareSwitches( self, switches, switchesJson, portsJson ):
"""
Compare mn and onos switches
- topo: sts TestONTopology object
- switchesJson: parsed json object from the onos devices api
+ switchesJson: parsed json object from the onos devices api
- This uses the sts TestONTopology object"""
- # main.log.debug( "Switches_json string: ", switchesJson )
- output = { "switches": [] }
- # iterate through the MN topology and pull out switches and and port
- # info
- for switch in topo.graph.switches:
- ports = []
- for port in switch.ports.values():
- ports.append( { 'of_port': port.port_no,
- 'mac': str( port.hw_addr ).replace( '\'', '' ),
- 'name': port.name } )
- output[ 'switches' ].append( {
- "name": switch.name,
- "dpid": str( switch.dpid ).zfill( 16 ),
- "ports": ports } )
-
- # print "mn"
- # print json.dumps( output,
- # sort_keys=True,
- # indent=4,
- # separators=( ',', ': ' ) )
- # print "onos"
- # print json.dumps( switchesJson,
- # sort_keys=True,
- # indent=4,
- # separators=( ',', ': ' ) )
-
+ Dependencies:
+ 1. numpy - "sudo pip install numpy"
+ """
+ from numpy import uint64
# created sorted list of dpid's in MN and ONOS for comparison
mnDPIDs = []
- for switch in output[ 'switches' ]:
+ for swName, switch in switches.iteritems():
mnDPIDs.append( switch[ 'dpid' ].lower() )
mnDPIDs.sort()
- # print "List of Mininet switch DPID's"
- # print mnDPIDs
if switchesJson == "": # if rest call fails
main.log.error(
self.name +
@@ -1639,70 +1894,33 @@
'' ).replace(
"of",
'' ).lower() )
- # else:
- # print "Switch is unavailable:"
- # print switch
onosDPIDs.sort()
- # print "List of ONOS switch DPID's"
- # print onosDPIDs
if mnDPIDs != onosDPIDs:
switchResults = main.FALSE
- main.log.report( "Switches in MN but not in ONOS:" )
+ main.log.error( "Switches in MN but not in ONOS:" )
list1 = [ switch for switch in mnDPIDs if switch not in onosDPIDs ]
- main.log.report( str( list1 ) )
- main.log.report( "Switches in ONOS but not in MN:" )
+ main.log.error( str( list1 ) )
+ main.log.error( "Switches in ONOS but not in MN:" )
list2 = [ switch for switch in onosDPIDs if switch not in mnDPIDs ]
- main.log.report( str( list2 ) )
+ main.log.error( str( list2 ) )
else: # list of dpid's match in onos and mn
switchResults = main.TRUE
- return switchResults
+ finalResults = switchResults
- def comparePorts( self, topo, portsJson ):
- """
- Compare mn and onos ports
- topo: sts TestONTopology object
- portsJson: parsed json object from the onos ports api
-
- Dependencies:
- 1. This uses the sts TestONTopology object
- 2. numpy - "sudo pip install numpy"
-
- """
# FIXME: this does not look for extra ports in ONOS, only checks that
# ONOS has what is in MN
- from numpy import uint64
portsResults = main.TRUE
- output = { "switches": [] }
- # iterate through the MN topology and pull out switches and and port
- # info
- for switch in topo.graph.switches:
- ports = []
- for port in switch.ports.values():
- # print port.hw_addr.toStr( separator='' )
- tmpPort = { 'of_port': port.port_no,
- 'mac': str( port.hw_addr ).replace( '\'', '' ),
- 'name': port.name,
- 'enabled': port.enabled }
-
- ports.append( tmpPort )
- tmpSwitch = { 'name': switch.name,
- 'dpid': str( switch.dpid ).zfill( 16 ),
- 'ports': ports }
-
- output[ 'switches' ].append( tmpSwitch )
# PORTS
- for mnSwitch in output[ 'switches' ]:
+ for name, mnSwitch in switches.iteritems():
mnPorts = []
onosPorts = []
switchResult = main.TRUE
for port in mnSwitch[ 'ports' ]:
if port[ 'enabled' ]:
- mnPorts.append( port[ 'of_port' ] )
+ mnPorts.append( int( port[ 'of_port' ] ) )
for onosSwitch in portsJson:
- # print "Iterating through a new switch as seen by ONOS"
- # print onosSwitch
if onosSwitch[ 'device' ][ 'available' ]:
if onosSwitch[ 'device' ][ 'id' ].replace(
':',
@@ -1719,9 +1937,7 @@
break
mnPorts.sort( key=float )
onosPorts.sort( key=float )
- # print "\nPorts for Switch %s:" % ( mnSwitch[ 'name' ] )
- # print "\tmn_ports[] = ", mnPorts
- # print "\tonos_ports[] = ", onosPorts
+
mnPortsLog = mnPorts
onosPortsLog = onosPorts
mnPorts = [ x for x in mnPorts ]
@@ -1737,6 +1953,7 @@
# many checks and it might override a failure
mnPorts.remove( mnPort )
onosPorts.remove( mnPort )
+
# NOTE: OVS reports this as down since there is no link
# So ignoring these for now
# TODO: Come up with a better way of handling these
@@ -1753,62 +1970,53 @@
"Ports in ONOS but not MN: " +
str( onosPorts ) )
if switchResult == main.FALSE:
- main.log.report(
+ main.log.error(
"The list of ports for switch %s(%s) does not match:" %
- ( mnSwitch[ 'name' ], mnSwitch[ 'dpid' ] ) )
+ ( name, mnSwitch[ 'dpid' ] ) )
main.log.warn( "mn_ports[] = " + str( mnPortsLog ) )
main.log.warn( "onos_ports[] = " + str( onosPortsLog ) )
portsResults = portsResults and switchResult
- return portsResults
+ finalResults = finalResults and portsResults
+ return finalResults
- def compareLinks( self, topo, linksJson ):
+ def compareLinks( self, switches, links, linksJson ):
"""
Compare mn and onos links
- topo: sts TestONTopology object
linksJson: parsed json object from the onos links api
- This uses the sts TestONTopology object"""
+ """
# FIXME: this does not look for extra links in ONOS, only checks that
# ONOS has what is in MN
- output = { "switches": [] }
onos = linksJson
- # iterate through the MN topology and pull out switches and and port
- # info
- for switch in topo.graph.switches:
- # print "Iterating though switches as seen by Mininet"
- # print switch
- ports = []
- for port in switch.ports.values():
- # print port.hw_addr.toStr( separator='' )
- ports.append( { 'of_port': port.port_no,
- 'mac': str( port.hw_addr ).replace( '\'', '' ),
- 'name': port.name } )
- output[ 'switches' ].append( {
- "name": switch.name,
- "dpid": str( switch.dpid ).zfill( 16 ),
- "ports": ports } )
- # LINKS
- mnLinks = [
- link for link in topo.patch_panel.network_links if (
- link.port1.enabled and link.port2.enabled ) ]
+ mnLinks = []
+ for l in links:
+ try:
+ node1 = switches[ l[ 'node1' ] ]
+ node2 = switches[ l[ 'node2' ] ]
+ enabled = True
+ for port in node1[ 'ports' ]:
+ if port[ 'of_port' ] == l[ 'port1' ]:
+ enabled = enabled and port[ 'enabled' ]
+ for port in node2[ 'ports' ]:
+ if port[ 'of_port' ] == l[ 'port2' ]:
+ enabled = enabled and port[ 'enabled' ]
+ if enabled:
+ mnLinks.append( l )
+ except KeyError:
+ pass
if 2 * len( mnLinks ) == len( onos ):
linkResults = main.TRUE
else:
linkResults = main.FALSE
- main.log.report(
+ main.log.error(
"Mininet has " + str( len( mnLinks ) ) +
" bidirectional links and ONOS has " +
str( len( onos ) ) + " unidirectional links" )
# iterate through MN links and check if an ONOS link exists in
# both directions
- # NOTE: Will currently only show mn links as down if they are
- # cut through STS. We can either do everything through STS or
- # wait for upNetworkLinks and downNetworkLinks to be
- # fully implemented.
for link in mnLinks:
- # print "Link: %s" % link
# TODO: Find a more efficient search method
node1 = None
port1 = None
@@ -1816,34 +2024,27 @@
port2 = None
firstDir = main.FALSE
secondDir = main.FALSE
- for switch in output[ 'switches' ]:
- # print "Switch: %s" % switch[ 'name' ]
- if switch[ 'name' ] == link.node1.name:
+ for swName, switch in switches.iteritems():
+ if swName == link[ 'node1' ]:
node1 = switch[ 'dpid' ]
for port in switch[ 'ports' ]:
- if str( port[ 'name' ] ) == str( link.port1 ):
+ if str( port[ 'of_port' ] ) == str( link[ 'port1' ] ):
port1 = port[ 'of_port' ]
if node1 is not None and node2 is not None:
break
- if switch[ 'name' ] == link.node2.name:
+ if swName == link[ 'node2' ]:
node2 = switch[ 'dpid' ]
for port in switch[ 'ports' ]:
- if str( port[ 'name' ] ) == str( link.port2 ):
+ if str( port[ 'of_port' ] ) == str( link[ 'port2' ] ):
port2 = port[ 'of_port' ]
if node1 is not None and node2 is not None:
break
for onosLink in onos:
onosNode1 = onosLink[ 'src' ][ 'device' ].replace(
- ":",
- '' ).replace(
- "of",
- '' )
+ ":", '' ).replace( "of", '' )
onosNode2 = onosLink[ 'dst' ][ 'device' ].replace(
- ":",
- '' ).replace(
- "of",
- '' )
+ ":", '' ).replace( "of", '' )
onosPort1 = onosLink[ 'src' ][ 'port' ]
onosPort2 = onosLink[ 'dst' ][ 'port' ]
@@ -1859,15 +2060,9 @@
str( link ) +
' between ONOS and MN. When checking ONOS for ' +
'link %s/%s -> %s/%s' %
- ( node1,
- port1,
- node2,
- port2 ) +
+ ( node1, port1, node2, port2 ) +
' ONOS has the values %s/%s -> %s/%s' %
- ( onosNode1,
- onosPort1,
- onosNode2,
- onosPort2 ) )
+ ( onosNode1, onosPort1, onosNode2, onosPort2 ) )
# check onos link from node2 to node1
elif ( str( onosNode1 ) == str( node2 ) and
@@ -1881,73 +2076,59 @@
str( link ) +
' between ONOS and MN. When checking ONOS for ' +
'link %s/%s -> %s/%s' %
- ( node2,
- port2,
- node1,
- port1 ) +
+ ( node1, port1, node2, port2 ) +
' ONOS has the values %s/%s -> %s/%s' %
- ( onosNode2,
- onosPort2,
- onosNode1,
- onosPort1 ) )
+ ( onosNode2, onosPort2, onosNode1, onosPort1 ) )
else: # this is not the link you're looking for
pass
if not firstDir:
- main.log.report(
+ main.log.error(
'ONOS does not have the link %s/%s -> %s/%s' %
( node1, port1, node2, port2 ) )
if not secondDir:
- main.log.report(
+ main.log.error(
'ONOS does not have the link %s/%s -> %s/%s' %
( node2, port2, node1, port1 ) )
linkResults = linkResults and firstDir and secondDir
return linkResults
- def compareHosts( self, topo, hostsJson ):
+ def compareHosts( self, hosts, hostsJson ):
"""
- Compare mn and onos Hosts.
- Since Mininet hosts are quiet, ONOS will only know of them when they
- speak. For this reason, we will only check that the hosts in ONOS
- stores are in Mininet, and not vice versa.
- topo: sts TestONTopology object
- hostsJson: parsed json object from the onos hosts api
+ Compare mn and onos Hosts.
+ Since Mininet hosts are quiet, ONOS will only know of them when they
+ speak. For this reason, we will only check that the hosts in ONOS
+ stores are in Mininet, and not vice versa.
- This uses the sts TestONTopology object"""
+ Arguments:
+ hostsJson: parsed json object from the onos hosts api
+ Returns:
+ """
import json
hostResults = main.TRUE
- hosts = []
- # iterate through the MN topology and pull out hosts
- for mnHost in topo.graph.hosts:
- interfaces = []
- for intf in mnHost.interfaces:
- interfaces.append( {
- "name": intf.name, # str
- "ips": [ str( ip ) for ip in intf.ips ], # list of IPAddrs
- # hw_addr is of type EthAddr, Not JSON serializable
- "hw_addr": str( intf.hw_addr ) } )
- hosts.append( {
- "name": mnHost.name, # str
- "interfaces": interfaces } ) # list
for onosHost in hostsJson:
onosMAC = onosHost[ 'mac' ].lower()
match = False
- for mnHost in hosts:
- for mnIntf in mnHost[ 'interfaces' ]:
- if onosMAC == mnIntf[ 'hw_addr' ].lower() :
+ for mnHost, info in hosts.iteritems():
+ for mnIntf in info[ 'interfaces' ]:
+ if onosMAC == mnIntf[ 'mac' ].lower():
match = True
for ip in mnIntf[ 'ips' ]:
if ip in onosHost[ 'ipAddresses' ]:
pass # all is well
else:
# misssing ip
- main.log.error( "ONOS host " + onosHost[ 'id' ]
- + " has a different IP than " +
- "the Mininet host." )
+ main.log.error( "ONOS host " +
+ onosHost[ 'id' ] +
+ " has a different IP(" +
+ str( onosHost[ 'ipAddresses' ] ) +
+ ") than the Mininet host(" +
+ str( ip ) +
+ ")." )
output = json.dumps(
- onosHost,
- sort_keys=True,
- indent=4,
- separators=( ',', ': ' ) )
+ onosHost,
+ sort_keys=True,
+ indent=4,
+ separators=( ',', ': ' ) )
main.log.info( output )
hostResults = main.FALSE
if not match:
@@ -1961,7 +2142,7 @@
main.log.info( output )
return hostResults
- def getHosts( self ):
+ def getHostsOld( self ):
"""
Returns a list of all hosts
Don't ask questions just use it"""
@@ -1986,6 +2167,47 @@
return hostList
+ def getSwitch( self ):
+ """
+ Returns a list of all switches
+ Again, don't ask question just use it...
+ """
+ # get host list...
+ hostList = self.getHosts()
+ # Make host set
+ hostSet = set( hostList )
+
+ # Getting all the nodes in mininet
+ self.handle.sendline( "" )
+ self.handle.expect( "mininet>" )
+
+ self.handle.sendline( "py [ node.name for node in net.values() ]" )
+ self.handle.expect( "mininet>" )
+
+ handlePy = self.handle.before
+ handlePy = handlePy.split( "]\r\n", 1 )[ 1 ]
+ handlePy = handlePy.rstrip()
+
+ self.handle.sendline( "" )
+ self.handle.expect( "mininet>" )
+
+ nodesStr = handlePy.replace( "]", "" )
+ nodesStr = nodesStr.replace( "'", "" )
+ nodesStr = nodesStr.replace( "[", "" )
+ nodesStr = nodesStr.replace( " ", "" )
+ nodesList = nodesStr.split( "," )
+
+ nodesSet = set( nodesList )
+ # discarding default controller(s) node
+ nodesSet.discard( 'c0' )
+ nodesSet.discard( 'c1' )
+ nodesSet.discard( 'c2' )
+
+ switchSet = nodesSet - hostSet
+ switchList = list( switchSet )
+
+ return switchList
+
def update( self ):
"""
updates the port address and status information for
@@ -2010,6 +2232,60 @@
main.cleanup()
main.exit()
+ def assignVLAN( self, host, intf, vlan ):
+ """
+ Add vlan tag to a host.
+ Dependencies:
+ This class depends on the "vlan" package
+ $ sudo apt-get install vlan
+ Configuration:
+ Load the 8021q module into the kernel
+ $sudo modprobe 8021q
+
+ To make this setup permanent:
+ $ sudo su -c 'echo "8021q" >> /etc/modules'
+ """
+ if self.handle:
+ try:
+ # get the ip address of the host
+ main.log.info( "Get the ip address of the host" )
+ ipaddr = self.getIPAddress( host )
+ print repr( ipaddr )
+
+ # remove IP from interface intf
+ # Ex: h1 ifconfig h1-eth0 inet 0
+ main.log.info( "Remove IP from interface " )
+ cmd2 = host + " ifconfig " + intf + " " + " inet 0 "
+ self.handle.sendline( cmd2 )
+ self.handle.expect( "mininet>" )
+ response = self.handle.before
+ main.log.info( "====> %s ", response )
+
+ # create VLAN interface
+ # Ex: h1 vconfig add h1-eth0 100
+ main.log.info( "Create Vlan" )
+ cmd3 = host + " vconfig add " + intf + " " + vlan
+ self.handle.sendline( cmd3 )
+ self.handle.expect( "mininet>" )
+ response = self.handle.before
+ main.log.info( "====> %s ", response )
+
+ # assign the host's IP to the VLAN interface
+ # Ex: h1 ifconfig h1-eth0.100 inet 10.0.0.1
+ main.log.info( "Assign the host IP to the vlan interface" )
+ vintf = intf + "." + vlan
+ cmd4 = host + " ifconfig " + vintf + " " + " inet " + ipaddr
+ self.handle.sendline( cmd4 )
+ self.handle.expect( "mininet>" )
+ response = self.handle.before
+ main.log.info( "====> %s ", response )
+
+ return main.TRUE
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ return main.FALSE
+
if __name__ != "__main__":
import sys
sys.modules[ __name__ ] = MininetCliDriver()
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 5da4a71..fca8f22 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1624,7 +1624,7 @@
main.cleanup()
main.exit()
- def purgeIntents( self ):
+ def purgeWithdrawnIntents( self ):
"""
Purges all WITHDRAWN Intents
"""
@@ -1762,39 +1762,60 @@
main.cleanup()
main.exit()
- def checkIntentState( self, intentsId, expectedState = 'INSTALLED' ):
+ def checkIntentState( self, intentsId, expectedState='INSTALLED' ):
"""
Description:
Check intents state
Required:
intentsId - List of intents ID to be checked
Optional:
- expectedState - Check this expected state of each intents state
- in the list. Defaults to INSTALLED
+ expectedState - Check the expected state(s) of each intents
+ state in the list.
+ *NOTE: You can pass in a list of expected state,
+ Eg: expectedState = [ 'INSTALLED' , 'INSTALLING' ]
Return:
- Returns main.TRUE only if all intent are the same as expectedState,
- , otherwise,returns main.FALSE.
+ Returns main.TRUE only if all intent are the same as expected states
+ , otherwise, returns main.FALSE.
"""
try:
# Generating a dictionary: intent id as a key and state as value
+ returnValue = main.TRUE
intentsDict = self.getIntentState( intentsId )
+
#print "len of intentsDict ", str( len( intentsDict ) )
if len( intentsId ) != len( intentsDict ):
main.log.info( self.name + "There is something wrong " +
"getting intents state" )
return main.FALSE
- returnValue = main.TRUE
- for intents in intentsDict:
- if intents.get( 'state' ) != expectedState:
- main.log.info( self.name + " : " + intents.get( 'id' ) +
- " actual state = " + intents.get( 'state' )
- + " does not equal expected state = "
- + expectedState )
- returnValue = main.FALSE
+
+ if isinstance( expectedState, types.StringType ):
+ for intents in intentsDict:
+ if intents.get( 'state' ) != expectedState:
+ main.log.debug( self.name + " : Intent ID - " +
+ intents.get( 'id' ) +
+ " actual state = " +
+ intents.get( 'state' )
+ + " does not equal expected state = "
+ + expectedState )
+ returnValue = main.FALSE
+
+ elif isinstance( expectedState, types.ListType ):
+ for intents in intentsDict:
+ if not any( state == intents.get( 'state' ) for state in
+ expectedState ):
+ main.log.debug( self.name + " : Intent ID - " +
+ intents.get( 'id' ) +
+ " actual state = " +
+ intents.get( 'state' ) +
+ " does not equal expected states = "
+ + str( expectedState ) )
+ returnValue = main.FALSE
+
if returnValue == main.TRUE:
main.log.info( self.name + ": All " +
str( len( intentsDict ) ) +
- " intents are in " + expectedState + " state")
+ " intents are in " + str( expectedState ) +
+ " state" )
return returnValue
except TypeError:
main.log.exception( self.name + ": Object not as expected" )
@@ -1822,7 +1843,7 @@
cmdStr += " -j"
handle = self.sendline( cmdStr )
if re.search( "Error:", handle ):
- main.log.error( self.name + ".flows() response: " +
+ main.log.error( self.name + ": flows() response: " +
str( handle ) )
return handle
except TypeError:
@@ -1857,9 +1878,11 @@
for flow in device.get( 'flows' ):
if flow.get( 'state' ) != 'ADDED' and flow.get( 'state' ) != \
'PENDING_ADD':
+
main.log.info( self.name + ": flow Id: " +
- flow.get( 'groupId' ) +
- " | state:" + flow.get( 'state' ) )
+ str( flow.get( 'groupId' ) ) +
+ " | state:" +
+ str( flow.get( 'state' ) ) )
returnValue = main.FALSE
return returnValue
@@ -3576,3 +3599,36 @@
main.cleanup()
main.exit()
+ def summary( self, jsonFormat=True ):
+ """
+ Description: Execute summary command in onos
+ Returns: json object ( summary -j ), returns main.FALSE if there is
+ no output
+
+ """
+ try:
+ cmdStr = "summary"
+ if jsonFormat:
+ cmdStr += " -j"
+ handle = self.sendline( cmdStr )
+
+ if re.search( "Error:", handle ):
+ main.log.error( self.name + ": summary() response: " +
+ str( handle ) )
+ if not handle:
+ main.log.error( self.name + ": There is no output in " +
+ "summary command" )
+ return main.FALSE
+ return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 7abbcc6..5de8e2e 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -2258,3 +2258,46 @@
if len(exceptions) > 0:
main.log.info(msg3)
main.log.info("===============================================================\n")
+
+ def getOnosIPfromCell(self):
+ '''
+ Returns the ONOS node names and their IP addresses as defined in the cell and applied to shell environment
+ Example output return: [['OC1', '10.128.40.41'], ['OC2', '10.128.40.42'], ['OC3', '10.128.40.43']]
+ '''
+ import re
+ try:
+ # Clean handle by sending empty and expecting $
+ self.handle.sendline( "" )
+ self.handle.expect( "\$" )
+ self.handle.sendline( "cell" )
+ self.handle.expect( "\$" )
+ handleBefore = self.handle.before
+ handleAfter = self.handle.after
+ # Get the rest of the handle
+ self.handle.sendline( "" )
+ self.handle.expect( "\$" )
+ handleMore = self.handle.before
+ ipList = []
+ cellOutput = handleBefore + handleAfter + handleMore
+ cellOutput = cellOutput.replace("\r\r","")
+ cellOutput = cellOutput.splitlines()
+ for i in range( len(cellOutput) ):
+ if( re.match( "OC", cellOutput[i] ) ):
+ if( re.match( "OCI", cellOutput[i] ) or re.match( "OCN", cellOutput[i] ) ):
+ continue
+ else:
+ onosIP = cellOutput[i].split("=")
+ # below step could be changed to return only IP if node name is not needed.
+ ipList.append(onosIP)
+ return ipList
+ except pexpect.ExceptionPexpect as e:
+ main.log.error( self.name + ": Pexpect exception found of type " +
+ str( type( e ) ) )
+ main.log.error ( e.get_trace() )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 3b94ef7..f75df5f 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -80,7 +80,7 @@
i = 5
while i == 5:
i = self.handle.expect( [
- ssh_newkey,
+ ssh_newkey,
'password:|Password:',
pexpect.EOF,
pexpect.TIMEOUT,
@@ -88,11 +88,11 @@
'teston>',
'>|#|\$' ],
120 )
- if i == 0:
+ if i == 0: # Accept key, then expect either a password prompt or access
main.log.info( "ssh key confirmation received, send yes" )
self.handle.sendline( 'yes' )
- i = self.handle.expect(
- [ ssh_newkey, 'password:', pexpect.EOF ] )
+ i = 5 # Run the loop again
+ continue
if i == 1:
if self.pwd:
main.log.info(
diff --git a/TestON/tests/ClassTest/ClassTest.params b/TestON/tests/ClassTest/ClassTest.params
deleted file mode 100644
index 456881b..0000000
--- a/TestON/tests/ClassTest/ClassTest.params
+++ /dev/null
@@ -1,4 +0,0 @@
-<PARAMS>
- <testcases>1,2</testcases>
-
-</PARAMS>
diff --git a/TestON/tests/ClassTest/ClassTest.py b/TestON/tests/ClassTest/ClassTest.py
deleted file mode 100644
index 0fd8ccc..0000000
--- a/TestON/tests/ClassTest/ClassTest.py
+++ /dev/null
@@ -1,27 +0,0 @@
-
-import time
-import os
-import re
-
-
-class ClassTest:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ):
- import time
- import imp
-
- init = imp.load_source(
- 'ClassInit',
- '/home/admin/ONLabTest/TestON/tests/ClassTest/Dependency/ClassInit.py' )
-
- ip1_from_class = init.getIp1()
- init.printMain( main )
-
- main.log.info( ip1_from_class )
-
- def CASE2( self, main ):
-
- main.log.info( "Case 2" )
diff --git a/TestON/tests/ClassTest/ClassTest.topo b/TestON/tests/ClassTest/ClassTest.topo
deleted file mode 100644
index 1c8bc4f..0000000
--- a/TestON/tests/ClassTest/ClassTest.topo
+++ /dev/null
@@ -1,26 +0,0 @@
-<TOPOLOGY>
- <COMPONENT>
- <ONOSbench>
- <host>10.128.10.20</host>
- <user>admin</user>
- <password></password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOSbench>
-
- <Mininet1>
- <host>10.128.10.24</host>
- <user>admin</user>
- <password></password>
- <type>MininetCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS>
- <arg1> --custom topo-perf-2sw.py </arg1>
- <arg2> --arp --mac --topo mytopo </arg2>
- <arg3> </arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet1>
- </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/ClassTest/Dependency/ClassInit.py b/TestON/tests/ClassTest/Dependency/ClassInit.py
deleted file mode 100644
index 74ff627..0000000
--- a/TestON/tests/ClassTest/Dependency/ClassInit.py
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-def __init__(self):
- self._ip1 = '1'
- self._ip2 = '2'
-
-def getIp1():
- print 'some ip'
-
-def printMain(main):
- print main.log.info("Main from classinit")
diff --git a/TestON/tests/ClassTest/Dependency/__init__.py b/TestON/tests/ClassTest/Dependency/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/ClassTest/Dependency/__init__.py
+++ /dev/null
diff --git a/TestON/tests/ClassTest/Dependencyc b/TestON/tests/ClassTest/Dependencyc
deleted file mode 100644
index bafe4c9..0000000
--- a/TestON/tests/ClassTest/Dependencyc
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/ClassTest/__init__.py b/TestON/tests/ClassTest/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/ClassTest/__init__.py
+++ /dev/null
diff --git a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
index 3f41180..b8598e4 100644
--- a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
@@ -10,6 +10,7 @@
name,
host1,
host2,
+ onosNode=0,
host1Id="",
host2Id="",
mac1="",
@@ -80,6 +81,7 @@
topoResult = main.TRUE
linkDownResult = main.TRUE
linkUpResult = main.TRUE
+ onosNode = int( onosNode )
if main.hostsData:
if not h1Mac:
@@ -101,15 +103,29 @@
return main.FALSE
# Discover hosts using arping
- main.log.info( itemName + ": Discover host using arping" )
- main.Mininet1.arping( host=host1 )
- main.Mininet1.arping( host=host2 )
- host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
- host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
+ if not main.hostsData:
+ main.log.info( itemName + ": Discover host using arping" )
+ main.Mininet1.arping( host=host1 )
+ main.Mininet1.arping( host=host2 )
+ host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
+ host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+
+ # Checking connectivity before installing intents
+ main.log.info( itemName + ": Check hosts connection before adding intents" )
+ checkPing = pingallHosts( main, hostNames )
+ if not checkPing:
+ main.log.info( itemName + ": Ping did not go through " +
+ "before adding intents" )
+ else:
+ main.log.debug( itemName + ": Pinged successful before adding " +
+ "intents,please check fwd app if it is activated" )
# Adding host intents
main.log.info( itemName + ": Adding host intents" )
- intent1 = main.CLIs[ 0 ].addHostIntent( hostIdOne=h1Id,
+ intent1 = main.CLIs[ onosNode ].addHostIntent( hostIdOne=h1Id,
hostIdTwo=h2Id )
intentsId.append( intent1 )
time.sleep( 5 )
@@ -117,11 +133,14 @@
# Check intents state
time.sleep( 30 )
intentResult = checkIntentState( main, intentsId )
+ checkFlowsCount( main )
# Check intents state again if first check fails...
if not intentResult:
intentResult = checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -141,6 +160,8 @@
linkDownResult = link( main, sw1, sw2, "down" )
intentResult = intentResult and checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -162,6 +183,8 @@
linkUpResult = link( main, sw1, sw2, "up" )
time.sleep( 5 )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -191,6 +214,7 @@
name,
host1,
host2,
+ onosNode=0,
deviceId1="",
deviceId2="",
port1="",
@@ -275,10 +299,21 @@
topoResult = main.TRUE
linkDownResult = main.TRUE
linkUpResult = main.TRUE
+ onosNode = int( onosNode )
+
+ # Checking connectivity before installing intents
+ main.log.info( itemName + ": Check hosts connection before adding intents" )
+ checkPing = pingallHosts( main, hostNames )
+ if not checkPing:
+ main.log.info( itemName + ": Ping did not go through " +
+ "before adding intents" )
+ else:
+ main.log.debug( itemName + ": Pinged successful before adding " +
+ "intents,please check fwd app if it is activated" )
# Adding bidirectional point intents
main.log.info( itemName + ": Adding point intents" )
- intent1 = main.CLIs[ 0 ].addPointIntent( ingressDevice=deviceId1,
+ intent1 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
egressDevice=deviceId2,
portIngress=port1,
portEgress=port2,
@@ -295,7 +330,7 @@
intentsId.append( intent1 )
time.sleep( 5 )
- intent2 = main.CLIs[ 0 ].addPointIntent( ingressDevice=deviceId2,
+ intent2 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
egressDevice=deviceId1,
portIngress=port2,
portEgress=port1,
@@ -314,11 +349,15 @@
# Check intents state
time.sleep( 30 )
intentResult = checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Check intents state again if first check fails...
if not intentResult:
intentResult = checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -338,6 +377,8 @@
linkDownResult = link( main, sw1, sw2, "down" )
intentResult = intentResult and checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -359,6 +400,8 @@
linkUpResult = link( main, sw1, sw2, "up" )
time.sleep( 5 )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -387,6 +430,7 @@
def singleToMultiIntent( main,
name,
hostNames,
+ onosNode=0,
devices="",
ports=None,
ethType="",
@@ -461,6 +505,7 @@
itemName = name
tempHostsData = {}
intentsId = []
+ onosNode = int( onosNode )
macsDict = {}
ipDict = {}
@@ -477,10 +522,12 @@
#print "len devices = ", len( devices )
#print "len ports = ", len( ports )
return main.FALSE
- for i in range( len( devices ) ):
- macsDict[ devices[ i ] ] = macs[ i ]
else:
main.log.info( "Device Ports are not specified" )
+ if macs:
+ for i in range( len( devices ) ):
+ macsDict[ devices[ i ] ] = macs[ i ]
+
elif hostNames and not devices and main.hostsData:
devices = []
main.log.info( "singleToMultiIntent function is using main.hostsData" )
@@ -508,6 +555,20 @@
if ports:
portsCopy = copy.copy( ports )
main.log.info( itemName + ": Adding single point to multi point intents" )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+
+ # Checking connectivity before installing intents
+ main.log.info( itemName + ": Check hosts connection before adding intents" )
+ checkPing = pingallHosts( main, hostNames )
+ if not checkPing:
+ main.log.info( itemName + ": Ping did not go through " +
+ "before adding intents" )
+ else:
+ main.log.debug( itemName + ": Pinged successful before adding " +
+ "intents,please check fwd app if it is activated" )
+
# Adding bidirectional point intents
for i in range( len( devices ) ):
ingressDevice = devicesCopy[ i ]
@@ -528,7 +589,8 @@
main.log.debug( "There is no MAC in device - " + ingressDevice )
srcMac = ""
- intentsId.append( main.CLIs[ 0 ].addSinglepointToMultipointIntent(
+ intentsId.append(
+ main.CLIs[ onosNode ].addSinglepointToMultipointIntent(
ingressDevice=ingressDevice,
egressDeviceList=egressDeviceList,
portIngress=portIngress,
@@ -543,6 +605,8 @@
tcpSrc="",
tcpDst="" ) )
+ # Wait some time for the flow to go through when using multi instance
+ time.sleep( 10 )
pingResult = pingallHosts( main, hostNames )
# Check intents state
@@ -553,6 +617,8 @@
if not intentResult:
intentResult = checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -568,6 +634,8 @@
linkDownResult = link( main, sw1, sw2, "down" )
intentResult = intentResult and checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -589,6 +657,8 @@
linkUpResult = link( main, sw1, sw2, "up" )
time.sleep( 5 )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -617,6 +687,7 @@
def multiToSingleIntent( main,
name,
hostNames,
+ onosNode=0,
devices="",
ports=None,
ethType="",
@@ -642,7 +713,7 @@
Verify add-multi-to-single-intent
Steps:
- Get device ids | ports
- - Add single to multi point intents
+ - Add multi to single point intents
- Check intents
- Verify flows
- Ping hosts
@@ -690,6 +761,7 @@
itemName = name
tempHostsData = {}
intentsId = []
+ onosNode = int( onosNode )
macsDict = {}
ipDict = {}
@@ -706,13 +778,14 @@
#print "len devices = ", len( devices )
#print "len ports = ", len( ports )
return main.FALSE
- for i in range( len( devices ) ):
- macsDict[ devices[ i ] ] = macs[ i ]
else:
main.log.info( "Device Ports are not specified" )
+ if macs:
+ for i in range( len( devices ) ):
+ macsDict[ devices[ i ] ] = macs[ i ]
elif hostNames and not devices and main.hostsData:
devices = []
- main.log.info( "singleToMultiIntent function is using main.hostsData" )
+ main.log.info( "multiToSingleIntent function is using main.hostsData" )
for host in hostNames:
devices.append( main.hostsData.get( host ).get( 'location' ) )
macsDict[ main.hostsData.get( host ).get( 'location' ) ] = \
@@ -736,7 +809,21 @@
devicesCopy = copy.copy( devices )
if ports:
portsCopy = copy.copy( ports )
- main.log.info( itemName + ": Adding single point to multi point intents" )
+ main.log.info( itemName + ": Adding multi point to single point intents" )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+
+ # Checking connectivity before installing intents
+ main.log.info( itemName + ": Check hosts connection before adding intents" )
+ checkPing = pingallHosts( main, hostNames )
+ if not checkPing:
+ main.log.info( itemName + ": Ping did not go through " +
+ "before adding intents" )
+ else:
+ main.log.debug( itemName + ": Pinged successful before adding " +
+ "intents,please check fwd app if it is activated" )
+
# Adding bidirectional point intents
for i in range( len( devices ) ):
egressDevice = devicesCopy[ i ]
@@ -757,7 +844,8 @@
main.log.debug( "There is no MAC in device - " + egressDevice )
dstMac = ""
- intentsId.append( main.CLIs[ 0 ].addMultipointToSinglepointIntent(
+ intentsId.append(
+ main.CLIs[ onosNode ].addMultipointToSinglepointIntent(
ingressDeviceList=ingressDeviceList,
egressDevice=egressDevice,
portIngressList=portIngressList,
@@ -782,6 +870,8 @@
if not intentResult:
intentResult = checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -797,6 +887,8 @@
linkDownResult = link( main, sw1, sw2, "down" )
intentResult = intentResult and checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -818,6 +910,8 @@
linkUpResult = link( main, sw1, sw2, "up" )
time.sleep( 5 )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -869,7 +963,8 @@
pingResult = main.Mininet1.pingall()
hostsJson = json.loads( main.CLIs[ 0 ].hosts() )
- hosts = main.Mininet1.getHosts()
+ hosts = main.Mininet1.getHosts().keys()
+ # TODO: Make better use of new getHosts function
for host in hosts:
main.hostsData[ host ] = {}
main.hostsData[ host ][ 'mac' ] = \
@@ -914,13 +1009,39 @@
return statusResult
def checkIntentState( main, intentsId ):
+ """
+ This function will check intent state to make sure all the intents
+ are in INSTALLED state
+ """
intentResult = main.TRUE
+ results = []
main.log.info( itemName + ": Checking intents state" )
+ # First check of intents
for i in range( main.numCtrls ):
- intentResult = intentResult and \
- main.CLIs[ i ].checkIntentState( intentsId=intentsId )
+ tempResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
+ results.append( tempResult )
+
+ expectedState = [ 'INSTALLED', 'INSTALLING' ]
+
+ if all( result == main.TRUE for result in results ):
+ main.log.info( itemName + ": Intents are installed correctly" )
+ else:
+ # Wait for at least 5 second before checking the intents again
+ time.sleep( 5 )
+ results = []
+ # Second check of intents since some of the intents may be in
+ # INSTALLING state, they should be in INSTALLED at this time
+ for i in range( main.numCtrls ):
+ tempResult = main.CLIs[ i ].checkIntentState(
+ intentsId=intentsId )
+ results.append( tempResult )
+ if all( result == main.TRUE for result in results ):
+ main.log.info( itemName + ": Intents are installed correctly" )
+ else:
+ main.log.error( itemName + ": Intents are NOT installed correctly" )
+ intentResult = main.FALSE
return intentResult
@@ -965,3 +1086,36 @@
"successfully removed all the intents." )
removeIntentResult = main.TRUE
return removeIntentResult
+
+def checkFlowsCount( main ):
+ """
+ Check flows count in each node
+ """
+ import json
+
+ flowsCount = []
+ main.log.info( itemName + ": Checking flows count in each ONOS node" )
+ for i in range( main.numCtrls ):
+ summaryResult = main.CLIs[ i ].summary()
+ if not summaryResult:
+ main.log.error( itemName + ": There is something wrong with " +
+ "summary command" )
+ return main.FALSE
+ else:
+ summaryJson = json.loads( summaryResult )
+ flowsCount.append( summaryJson.get( 'flows' ) )
+
+ if flowsCount:
+ if all( flows==flowsCount[ 0 ] for flows in flowsCount ):
+ main.log.info( itemName + ": There are " + str( flowsCount[ 0 ] ) +
+ " flows in all ONOS node" )
+ else:
+ for i in range( main.numCtrls ):
+ main.log.debug( itemName + ": ONOS node " + str( i ) + " has " +
+ flowsCount[ i ] + " flows" )
+ else:
+ main.log.error( "Checking flows count failed, check summary command" )
+ return main.FALSE
+
+ return main.TRUE
+
diff --git a/TestON/tests/FuncIntent/FuncIntent.params b/TestON/tests/FuncIntent/FuncIntent.params
new file mode 100644
index 0000000..e7c8b40
--- /dev/null
+++ b/TestON/tests/FuncIntent/FuncIntent.params
@@ -0,0 +1,34 @@
+<PARAMS>
+
+ <testcases>10,11,12,13,1003</testcases>
+
+ <SCALE>1,3</SCALE>
+ <availableNodes>3</availableNodes>
+ <ENV>
+ <cellName>functionality</cellName>
+ <cellApps>drivers,openflow,proxyarp,mobility</cellApps>
+ </ENV>
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+ <CTRL>
+ <num>3</num>
+ <ip1>OC1</ip1>
+ <port1>6633</port1>
+ <ip2>OC2</ip2>
+ <port2>6633</port2>
+ <ip3>OC3</ip3>
+ <port3>6633</port3>
+ </CTRL>
+ <BENCH>
+ <user>admin</user>
+ <ip1>OCN</ip1>
+ </BENCH>
+ <MININET>
+ <switch>7</switch>
+ <links>20</links>
+ <topo>~/mininet/custom/newFuncTopo.py</topo>
+ </MININET>
+
+</PARAMS>
diff --git a/TestON/tests/FuncIntent/FuncIntent.py b/TestON/tests/FuncIntent/FuncIntent.py
index d5dc2a7..3a716ee 100644
--- a/TestON/tests/FuncIntent/FuncIntent.py
+++ b/TestON/tests/FuncIntent/FuncIntent.py
@@ -223,11 +223,19 @@
main.case( "Assign switches to controllers" )
main.step( "Assigning switches to controllers" )
assignResult = main.TRUE
+ switchList = []
+
+ # Creates a list switch name, use getSwitch() function later...
for i in range( 1, ( main.numSwitch + 1 ) ):
- main.Mininet1.assignSwController( sw=str( i ),
- count=1,
- ip1=main.ONOSip[ 0 ],
- port1=main.ONOSport[ 0 ] )
+ switchList.append( 's' + str( i ) )
+
+ assignResult = main.Mininet1.assignSwController( sw=switchList,
+ ip=main.ONOSip,
+ port=main.ONOSport )
+ if not assignResult:
+ main.cleanup()
+ main.exit()
+
for i in range( 1, ( main.numSwitch + 1 ) ):
response = main.Mininet1.getSwController( "s" + str( i ) )
print( "Response is " + str( response ) )
@@ -256,6 +264,25 @@
onpass="Successfully discovered hosts",
onfail="Failed to discover hosts" )
+ def CASE14( self, main ):
+ """
+ Stop mininet
+ """
+ main.log.report( "Stop Mininet topology" )
+ main.log.case( "Stop Mininet topology" )
+
+ main.step( "Stopping Mininet Topology" )
+ topoResult = main.Mininet1.stopNet( )
+ stepResult = topoResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully stop mininet",
+ onfail="Failed to stop mininet" )
+ # Exit if topology did not load properly
+ if not topoResult:
+ main.cleanup()
+ main.exit()
+
def CASE1001( self, main ):
"""
Add host intents between 2 host:
@@ -292,6 +319,7 @@
stepResult = main.TRUE
main.step( "IPV4: Add host intents between h1 and h9" )
stepResult = main.wrapper.hostIntent( main,
+ onosNode='0',
name='IPV4',
host1='h1',
host2='h9',
@@ -305,8 +333,8 @@
actual=stepResult,
onpass="IPV4: Add host intent successful",
onfail="IPV4: Add host intent failed" )
- stepResult = main.TRUE
+ stepResult = main.TRUE
main.step( "DUALSTACK1: Add host intents between h3 and h11" )
stepResult = main.wrapper.hostIntent( main,
name='DUALSTACK',
@@ -325,7 +353,7 @@
onfail="DUALSTACK1: Add host intent failed" )
stepResult = main.TRUE
- main.step( "DUALSTACK2: Add host intents between h1 and h9" )
+ main.step( "DUALSTACK2: Add host intents between h1 and h11" )
stepResult = main.wrapper.hostIntent( main,
name='DUALSTACK2',
host1='h1',
@@ -340,6 +368,51 @@
" successful",
onfail="DUALSTACK2: Add host intent failed" )
+ stepResult = main.TRUE
+ main.step( "1HOP: Add host intents between h1 and h3" )
+ stepResult = main.wrapper.hostIntent( main,
+ name='1HOP',
+ host1='h1',
+ host2='h3' )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="1HOP: Add host intent" +
+ " successful",
+ onfail="1HOP: Add host intent failed" )
+
+ stepResult = main.TRUE
+ main.step( "VLAN1: Add vlan host intents between h4 and h12" )
+ stepResult = main.wrapper.hostIntent( main,
+ name='VLAN1',
+ host1='h4',
+ host2='h12',
+ host1Id='00:00:00:00:00:04/100',
+ host2Id='00:00:00:00:00:0C/100',
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="VLAN1: Add vlan host" +
+ " intent successful",
+ onfail="VLAN1: Add vlan host intent failed" )
+
+ stepResult = main.TRUE
+ main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
+ stepResult = main.wrapper.hostIntent( main,
+ name='VLAN2',
+ host1='h13',
+ host2='h20' )
+
+ utilities.assert_equals( expect=main.FALSE,
+ actual=stepResult,
+ onpass="VLAN2: Add inter vlan host" +
+ " intent successful",
+ onfail="VLAN2: Add inter vlan host" +
+ " intent failed" )
+
def CASE1002( self, main ):
"""
Add point intents between 2 hosts:
@@ -374,7 +447,26 @@
main.case( "Add point intents between 2 devices" )
stepResult = main.TRUE
- main.step( "IPV4: Add point intents between h1 and h9" )
+ # No option point intents
+ main.step( "NOOPTION: Add point intents between h1 and h9" )
+ stepResult = main.wrapper.pointIntent(
+ main,
+ name="NOOPTION",
+ host1="h1",
+ host2="h9",
+ deviceId1="of:0000000000000005/1",
+ deviceId2="of:0000000000000006/1",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ stepResult = main.TRUE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="NOOPTION: Add point intent successful",
+ onfail="NOOPTION: Add point intent failed" )
+
+ stepResult = main.TRUE
stepResult = main.wrapper.pointIntent(
main,
name="IPV4",
@@ -404,6 +496,28 @@
onfail="IPV4: Add point intent failed" )
stepResult = main.TRUE
+ stepResult = main.wrapper.pointIntent(
+ main,
+ name="IPV4_2",
+ host1="h1",
+ host2="h9",
+ deviceId1="of:0000000000000005/1",
+ deviceId2="of:0000000000000006/1",
+ ipProto=1,
+ ip1="",
+ ip2="",
+ tcp1="",
+ tcp2="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="IPV4_2: Add point intent successful",
+ onfail="IPV4_2: Add point intent failed" )
+
+ stepResult = main.TRUE
main.step( "DUALSTACK1: Add point intents between h1 and h9" )
stepResult = main.wrapper.pointIntent(
main,
@@ -432,7 +546,49 @@
actual=stepResult,
onpass="DUALSTACK1: Add point intent" +
" successful",
- onfail="DUALSTACK1: Add point intent failed" )
+ onfail="DUALSTACK1: Add point intent failed" )
+ stepResult = main.TRUE
+ main.step( "VLAN: Add point intents between h5 and h21" )
+ stepResult = main.wrapper.pointIntent(
+ main,
+ name="VLAN",
+ host1="h5",
+ host2="h21",
+ deviceId1="of:0000000000000005/5",
+ deviceId2="of:0000000000000007/5",
+ port1="",
+ port2="",
+ ethType="IPV4",
+ mac1="00:00:00:00:00:05",
+ mac2="00:00:00:00:00:15",
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ip1="",
+ ip2="",
+ tcp1="",
+ tcp2="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="VLAN: Add point intent successful",
+ onfail="VLAN: Add point intent failed" )
+
+ stepResult = main.TRUE
+ main.step( "1HOP: Add point intents between h1 and h3" )
+ stepResult = main.wrapper.hostIntent( main,
+ name='1HOP',
+ host1='h1',
+ host2='h3' )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="1HOP: Add point intent" +
+ " successful",
+ onfail="1HOP: Add point intent failed" )
def CASE1003( self, main ):
"""
@@ -462,11 +618,30 @@
main.case( "Add single point to multi point intents between devices" )
stepResult = main.TRUE
- main.step( "IPV4: Add single point to multi point intents" )
hostNames = [ 'h8', 'h16', 'h24' ]
devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
'of:0000000000000007/8' ]
macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
+
+ main.step( "NOOPTION: Add single point to multi point intents" )
+ stepResult = main.wrapper.singleToMultiIntent(
+ main,
+ name="NOOPTION",
+ hostNames=hostNames,
+ devices=devices,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="NOOPTION: Successfully added single "
+ + " point to multi point intents",
+ onfail="NOOPTION: Failed to add single point" +
+ " to multi point intents" )
+
+ stepResult = main.TRUE
+ main.step( "IPV4: Add single point to multi point intents" )
stepResult = main.wrapper.singleToMultiIntent(
main,
name="IPV4",
@@ -491,6 +666,7 @@
onfail="IPV4: Failed to add single point" +
" to multi point intents" )
+ stepResult = main.TRUE
main.step( "IPV4_2: Add single point to multi point intents" )
hostNames = [ 'h8', 'h16', 'h24' ]
stepResult = main.wrapper.singleToMultiIntent(
@@ -502,10 +678,40 @@
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
- onpass="IPV4_2: Successfully added single point"
- + " to multi point intents",
+ onpass="IPV4_2: Successfully added single "
+ + " point to multi point intents",
onfail="IPV4_2: Failed to add single point" +
" to multi point intents" )
+ stepResult = main.TRUE
+ main.step( "VLAN: Add single point to multi point intents" )
+ hostNames = [ 'h4', 'h12', 'h20' ]
+ devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \
+ 'of:0000000000000007/4' ]
+ macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ]
+ stepResult = main.wrapper.singleToMultiIntent(
+ main,
+ name="VLAN",
+ hostNames=hostNames,
+ devices=devices,
+ ports=None,
+ ethType="IPV4",
+ macs=macs,
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipAddresses="",
+ tcp="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="VLAN: Successfully added single point"
+ + " to multi point intents",
+ onfail="VLAN: Failed to add single point" +
+ " to multi point intents" )
+
def CASE1004( self, main ):
"""
Add multi point to single point intents
@@ -523,7 +729,7 @@
- Verify flows
- Check topology
- Ping hosts
- - Remove intents
+ - Remove intents
"""
assert main, "There is no main"
assert main.CLIs, "There is no main.CLIs"
@@ -534,11 +740,30 @@
main.case( "Add multi point to single point intents between devices" )
stepResult = main.TRUE
- main.step( "IPV4: Add multi point to single point intents" )
hostNames = [ 'h8', 'h16', 'h24' ]
devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
'of:0000000000000007/8' ]
macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
+
+ main.step( "NOOPTION: Add multi point to single point intents" )
+ stepResult = main.wrapper.multiToSingleIntent(
+ main,
+ name="NOOPTION",
+ hostNames=hostNames,
+ devices=devices,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="NOOPTION: Successfully added multi "
+ + " point to single point intents",
+ onfail="NOOPTION: Failed to add multi point" +
+ " to single point intents" )
+
+ stepResult = main.TRUE
+ main.step( "IPV4: Add multi point to single point intents" )
stepResult = main.wrapper.multiToSingleIntent(
main,
name="IPV4",
@@ -563,6 +788,7 @@
onfail="IPV4: Failed to add multi point" +
" to single point intents" )
+ stepResult = main.TRUE
main.step( "IPV4_2: Add multi point to single point intents" )
hostNames = [ 'h8', 'h16', 'h24' ]
stepResult = main.wrapper.multiToSingleIntent(
@@ -578,3 +804,33 @@
+ " to single point intents",
onfail="IPV4_2: Failed to add multi point" +
" to single point intents" )
+
+ stepResult = main.TRUE
+ main.step( "VLAN: Add multi point to single point intents" )
+ hostNames = [ 'h5', 'h13', 'h21' ]
+ devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \
+ 'of:0000000000000007/5' ]
+ macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ]
+ stepResult = main.wrapper.multiToSingleIntent(
+ main,
+ name="VLAN",
+ hostNames=hostNames,
+ devices=devices,
+ ports=None,
+ ethType="IPV4",
+ macs=macs,
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipAddresses="",
+ tcp="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="VLAN: Successfully added multi point"
+ + " to single point intents",
+ onfail="VLAN: Failed to add multi point" +
+ " to single point intents" )
diff --git a/TestON/tests/FuncNext13/FuncNext13.params b/TestON/tests/FuncNext13/FuncNext13.params
deleted file mode 100755
index 13a4691..0000000
--- a/TestON/tests/FuncNext13/FuncNext13.params
+++ /dev/null
@@ -1,37 +0,0 @@
-<PARAMS>
-
- <testcases>1,4,5,3</testcases>
-
- #Environment variables
- <ENV>
- <cellName>driver_test</cellName>
- </ENV>
-
- <CTRL>
- <ip1>10.128.20.11</ip1>
- <port1>6633</port1>
- </CTRL>
-
- <PING>
- <source1>h8</source1>
- <source2>h9</source2>
- <source3>h10</source3>
- <source4>h11</source4>
- <source5>h12</source5>
- <source6>h13</source6>
- <source7>h14</source7>
- <source8>h15</source8>
- <source9>h16</source9>
- <source10>h17</source10>
- <target1>10.0.0.18</target1>
- <target2>10.0.0.19</target2>
- <target3>10.0.0.20</target3>
- <target4>10.0.0.21</target4>
- <target5>10.0.0.22</target5>
- <target6>10.0.0.23</target6>
- <target7>10.0.0.24</target7>
- <target8>10.0.0.25</target8>
- <target9>10.0.0.26</target9>
- <target10>10.0.0.27</target10>
- </PING>
-</PARAMS>
diff --git a/TestON/tests/FuncNext13/FuncNext13.py b/TestON/tests/FuncNext13/FuncNext13.py
deleted file mode 100755
index 6b24695..0000000
--- a/TestON/tests/FuncNext13/FuncNext13.py
+++ /dev/null
@@ -1,608 +0,0 @@
-
-#Testing the basic functionality of ONOS Next
-#For sanity and driver functionality excercises only.
-
-import time
-import sys
-import os
-import re
-import time
-import json
-
-time.sleep(1)
-class FuncNext13:
- def __init__(self):
- self.default = ''
-
- def CASE1(self, main):
- '''
- Startup sequence:
- git pull
- mvn clean install
- onos-package
- cell <name>
- onos-verify-cell
- onos-install -f
- onos-wait-for-start
- '''
-
- cell_name = main.params['ENV']['cellName']
- ONOS1_ip = main.params['CTRL']['ip1']
- ONOS1_port = main.params['CTRL']['port1']
-
- main.case("Setting up test environment")
-
- main.step("Git checkout and pull master and get version")
- main.ONOSbench.git_checkout("master")
- git_pull_result = main.ONOSbench.git_pull()
- print "git_pull_result = ", git_pull_result
- version_result = main.ONOSbench.get_version()
-
- if git_pull_result == 1:
- main.step("Using mvn clean & install")
- clean_install_result = main.ONOSbench.clean_install()
- #clean_install_result = main.TRUE
-
- main.step("Applying cell variable to environment")
- cell_result1 = main.ONOSbench.set_cell(cell_name)
- verify_result = main.ONOSbench.verify_cell()
- cell_result2 = main.ONOS2.set_cell(cell_name)
- #verify_result = main.ONOS2.verify_cell()
- main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-
- cell_result = cell_result1 and cell_result2
-
- main.step("Creating ONOS package")
- package_result = main.ONOSbench.onos_package()
-
- #main.step("Creating a cell")
- #cell_create_result = main.ONOSbench.create_cell_file(**************)
-
- main.step("Installing ONOS package")
- onos_install_result = main.ONOSbench.onos_install()
- onos1_isup = main.ONOSbench.isup()
-
- main.step("Starting ONOS service")
- start_result = main.ONOSbench.onos_start(ONOS1_ip)
-
- case1_result = (package_result and\
- cell_result and verify_result and onos_install_result and\
- onos1_isup and start_result )
- utilities.assert_equals(expect=main.TRUE, actual=case1_result,
- onpass="Test startup successful",
- onfail="Test startup NOT successful")
-
- def CASE11(self, main):
- '''
- Cleanup sequence:
- onos-service <node_ip> stop
- onos-uninstall
-
- TODO: Define rest of cleanup
-
- '''
-
- ONOS1_ip = main.params['CTRL']['ip1']
-
- main.case("Cleaning up test environment")
-
- main.step("Testing ONOS kill function")
- kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
-
- main.step("Stopping ONOS service")
- stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
-
- main.step("Uninstalling ONOS service")
- uninstall_result = main.ONOSbench.onos_uninstall()
-
- def CASE3(self, main):
- '''
- Test 'onos' command and its functionality in driver
- '''
-
- ONOS1_ip = main.params['CTRL']['ip1']
-
- main.case("Testing 'onos' command")
-
- main.step("Sending command 'onos -w <onos-ip> system:name'")
- cmdstr1 = "system:name"
- cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1)
- main.log.info("onos command returned: "+cmd_result1)
-
- main.step("Sending command 'onos -w <onos-ip> onos:topology'")
- cmdstr2 = "onos:topology"
- cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
- main.log.info("onos command returned: "+cmd_result2)
-
-
-
- def CASE4(self, main):
- import re
- import time
- main.case("Pingall Test")
- main.step("Assigning switches to controllers")
- for i in range(1,29):
- if i ==1:
- main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
- elif i>=2 and i<5:
- main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
- elif i>=5 and i<8:
- main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
- elif i>=8 and i<18:
- main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
- elif i>=18 and i<28:
- main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
- else:
- main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
- Switch_Mastership = main.TRUE
- for i in range (1,29):
- if i==1:
- response = main.Mininet1.get_sw_controller("s"+str(i))
- print("Response is " + str(response))
- if re.search("tcp:"+ONOS1_ip,response):
- Switch_Mastership = Switch_Mastership and main.TRUE
- else:
- Switch_Mastership = main.FALSE
- elif i>=2 and i<5:
- response = main.Mininet1.get_sw_controller("s"+str(i))
- print("Response is " + str(response))
- if re.search("tcp:"+ONOS1_ip,response):
- Switch_Mastership = Switch_Mastership and main.TRUE
- else:
- Switch_Mastership = main.FALSE
- elif i>=5 and i<8:
- response = main.Mininet1.get_sw_controller("s"+str(i))
- print("Response is " + str(response))
- if re.search("tcp:"+ONOS1_ip,response):
- Switch_Mastership = Switch_Mastership and main.TRUE
- else:
- Switch_Mastership = main.FALSE
- elif i>=8 and i<18:
- response = main.Mininet1.get_sw_controller("s"+str(i))
- print("Response is " + str(response))
- if re.search("tcp:"+ONOS1_ip,response):
- Switch_Mastership = Switch_Mastership and main.TRUE
- else:
- Switch_Mastership = main.FALSE
- elif i>=18 and i<28:
- response = main.Mininet1.get_sw_controller("s"+str(i))
- print("Response is " + str(response))
- if re.search("tcp:"+ONOS1_ip,response):
- Switch_Mastership = Switch_Mastership and main.TRUE
- else:
- Switch_Mastership = main.FALSE
- else:
- response = main.Mininet1.get_sw_controller("s"+str(i))
- print("Response is" + str(response))
- if re.search("tcp:" +ONOS1_ip,response):
- Switch_Mastership = Switch_Mastership and main.TRUE
- else:
- Switch_Mastership = main.FALSE
-
- if Switch_Mastership == main.TRUE:
- main.log.report("MasterControllers assigned correctly")
- utilities.assert_equals(expect = main.TRUE,actual=Switch_Mastership,
- onpass="MasterControllers assigned correctly")
- '''
- for i in range (1,29):
- main.Mininet1.assign_sw_controller(sw=str(i),count=5,
- ip1=ONOS1_ip,port1=ONOS1_port,
- ip2=ONOS2_ip,port2=ONOS2_port,
- ip3=ONOS3_ip,port3=ONOS3_port,
- ip4=ONOS4_ip,port4=ONOS4_port,
- ip5=ONOS5_ip,port5=ONOS5_port)
- '''
- #REACTIVE FWD test
-
- main.step("Get list of hosts from Mininet")
- host_list = main.Mininet1.get_hosts()
- main.log.info(host_list)
-
- main.step("Get host list in ONOS format")
- host_onos_list = main.ONOS2.get_hosts_id(host_list)
- main.log.info(host_onos_list)
- #time.sleep(5)
-
- #We must use ping from hosts we want to add intents from
- #to make the hosts talk
- #main.Mininet2.handle.sendline("\r")
- #main.Mininet2.handle.sendline("h4 ping 10.1.1.1 -c 1 -W 1")
- #time.sleep(3)
- #main.Mininet2.handle.sendline("h5 ping 10.1.1.1 -c 1 -W 1")
- #time.sleep(5)
-
- main.step("Pingall")
- ping_result = main.FALSE
- while ping_result == main.FALSE:
- time1 = time.time()
- ping_result = main.Mininet1.pingall()
- time2 = time.time()
- print "Time for pingall: %2f seconds" % (time2 - time1)
-
- #Start onos cli again because u might have dropped out of onos prompt to the shell prompt
- #if there was no activity
- main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-
- main.step("Get hosts")
- main.ONOS2.handle.sendline("hosts")
- main.ONOS2.handle.expect("onos>")
- hosts = main.ONOS2.handle.before
- main.log.info(hosts)
-
- main.step("Get all devices id")
- devices_id_list = main.ONOS2.get_all_devices_id()
- main.log.info(devices_id_list)
-
- #ONOS displays the hosts in hex format unlike mininet which does in decimal format
- #So take care while adding intents
-
- main.step("Add host-to-host intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
- hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
- hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
- hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1")
- hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1")
- hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1")
- hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1")
- hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1")
- hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
- hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1")
- hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1")
-
-
-
- print "_____________________________________________________________________________________"
- '''
- main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008", 1, "of:0000000000006018", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006018", 1, "of:0000000000003008", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003009", 1, "of:0000000000006019", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006019", 1, "of:0000000000003009", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003010", 1, "of:0000000000006020", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006020", 1, "of:0000000000003010", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003011", 1, "of:0000000000006021", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006021", 1, "of:0000000000003011", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003012", 1, "of:0000000000006022", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006022", 1, "of:0000000000003012", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003013", 1, "of:0000000000006023", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006023", 1, "of:0000000000003013", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003014", 1, "of:0000000000006024", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006024", 1, "of:0000000000003014", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003015", 1, "of:0000000000006025", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006025", 1, "of:0000000000003015", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003016", 1, "of:0000000000006026", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006026", 1, "of:0000000000003016", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003017", 1, "of:0000000000006027", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006027", 1, "of:0000000000003017", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- print("_______________________________________________________________________________________")
- '''
-
- #Unistall onos-app-fwd app to disable reactive forwarding
- appUninstall_result = main.ONOS2.feature_uninstall("onos-app-fwd")
- main.log.info("onos-app-fwd uninstalled")
-
- #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
- #So sleep for 15s
- time.sleep(15)
-
- flowHandle = main.ONOS2.flows()
- print "flowHandle = ", flowHandle
-
- count = 1
- i = 8
- Ping_Result = main.TRUE
- #while i<10:
- while i <18 :
- main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
- ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
- if ping == main.FALSE and count <5:
- count+=1
- i = 8
- Ping_Result = main.FALSE
- main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
- time.sleep(2)
- elif ping==main.FALSE:
- main.log.report("All ping attempts have failed")
- i=19
- Ping_Result = main.FALSE
- elif ping==main.TRUE:
- main.log.info("Ping test passed!")
- i+=1
- Ping_Result = main.TRUE
- else:
- main.log.info("Unknown error")
- Ping_Result = main.ERROR
- if Ping_Result==main.FALSE:
- main.log.report("Intents have not ben installed correctly. Cleaning up")
- #main.cleanup()
- #main.exit()
- if Ping_Result==main.TRUE:
- main.log.report("Intents have been installed correctly")
-
- case4_result = Switch_Mastership and Ping_Result
- utilities.assert_equals(expect=main.TRUE, actual=case4_result,
- onpass="Pingall Test successful",
- onfail="Pingall Test NOT successful")
-
- def CASE5(self,main) :
- import json
- from subprocess import Popen, PIPE
- from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
- #main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
- deviceResult = main.ONOS2.devices()
- linksResult = main.ONOS2.links()
- portsResult = main.ONOS2.ports()
- print "**************"
- main.step("Start continuous pings")
- main.Mininet2.pingLong(src=main.params['PING']['source1'],
- target=main.params['PING']['target1'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source2'],
- target=main.params['PING']['target2'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source3'],
- target=main.params['PING']['target3'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source4'],
- target=main.params['PING']['target4'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source5'],
- target=main.params['PING']['target5'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source6'],
- target=main.params['PING']['target6'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source7'],
- target=main.params['PING']['target7'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source8'],
- target=main.params['PING']['target8'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source9'],
- target=main.params['PING']['target9'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source10'],
- target=main.params['PING']['target10'],pingTime=500)
-
- main.step("Create TestONTopology object")
- global ctrls
- ctrls = []
- count = 1
- while True:
- temp = ()
- if ('ip' + str(count)) in main.params['CTRL']:
- temp = temp + (getattr(main,('ONOS' + str(count))),)
- temp = temp + ("ONOS"+str(count),)
- temp = temp + (main.params['CTRL']['ip'+str(count)],)
- temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
- ctrls.append(temp)
- count = count + 1
- else:
- break
- global MNTopo
- Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
- MNTopo = Topo
-
- Topology_Check = main.TRUE
- main.step("Compare ONOS Topology to MN Topology")
- devices_json = main.ONOS2.devices()
- links_json = main.ONOS2.links()
- ports_json = main.ONOS2.ports()
- print "devices_json= ", devices_json
-
- result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
- print "***********************"
- result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
- print "***********************"
- result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
-
- result = result1 and result2 and result3
- print "***********************"
- if result == main.TRUE:
- main.log.report("ONOS"+ " Topology matches MN Topology")
- utilities.assert_equals(expect=main.TRUE,actual=result,
- onpass="ONOS" + " Topology matches MN Topology",
- onfail="ONOS" + " Topology does not match MN Topology")
- Topology_Check = Topology_Check and result
- utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
- onpass="Topology checks passed", onfail="Topology checks failed")
-
-
- def CASE7 (self,main):
-
- ONOS1_ip = main.params['CTRL']['ip1']
-
- link_sleep = int(main.params['timers']['LinkDiscovery'])
-
- main.log.report("Killing a link to ensure that link discovery is consistent")
- main.case("Killing a link to Ensure that Link Discovery is Working Properly")
- main.step("Start continuous pings")
-
- main.Mininet2.pingLong(src=main.params['PING']['source1'],
- target=main.params['PING']['target1'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source2'],
- target=main.params['PING']['target2'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source3'],
- target=main.params['PING']['target3'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source4'],
- target=main.params['PING']['target4'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source5'],
- target=main.params['PING']['target5'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source6'],
- target=main.params['PING']['target6'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source7'],
- target=main.params['PING']['target7'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source8'],
- target=main.params['PING']['target8'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source9'],
- target=main.params['PING']['target9'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source10'],
- target=main.params['PING']['target10'],pingTime=500)
-
-
- main.step("Determine the current number of switches and links")
- topology_output = main.ONOS2.topology()
- topology_result = main.ONOS1.get_topology(topology_output)
- activeSwitches = topology_result['devices']
- links = topology_result['links']
- print "activeSwitches = ", type(activeSwitches)
- print "links = ", type(links)
- main.log.info("Currently there are %s switches and %s links" %(str(activeSwitches), str(links)))
-
- main.step("Kill Link between s3 and s28")
- main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
- time.sleep(link_sleep)
- topology_output = main.ONOS2.topology()
- Link_Down = main.ONOS1.check_status(topology_output,activeSwitches,str(int(links)-2))
- if Link_Down == main.TRUE:
- main.log.report("Link Down discovered properly")
- utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
- onpass="Link Down discovered properly",
- onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
-
- main.step("Bring link between s3 and s28 back up")
- Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
- time.sleep(link_sleep)
- topology_output = main.ONOS2.topology()
- Link_Up = main.ONOS1.check_status(topology_output,activeSwitches,str(links))
- if Link_Up == main.TRUE:
- main.log.report("Link up discovered properly")
- utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
- onpass="Link up discovered properly",
- onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
-
-
-
-
- main.step("Compare ONOS Topology to MN Topology")
- Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
- MNTopo = Topo
- Topology_Check = main.TRUE
- devices_json = main.ONOS2.devices()
- links_json = main.ONOS2.links()
- ports_json = main.ONOS2.ports()
- print "devices_json= ", devices_json
-
- result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
- print "***********************"
- result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
- print "***********************"
- result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
-
- result = result1 and result2 and result3
- print "***********************"
- if result == main.TRUE:
- main.log.report("ONOS"+ " Topology matches MN Topology")
- utilities.assert_equals(expect=main.TRUE,actual=result,
- onpass="ONOS" + " Topology matches MN Topology",
- onfail="ONOS" + " Topology does not match MN Topology")
- Topology_Check = Topology_Check and result
- utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
- onpass="Topology checks passed", onfail="Topology checks failed")
-
- result = Link_Down and Link_Up and Topology_Check
- utilities.assert_equals(expect=main.TRUE,actual=result,
- onpass="Link failure is discovered correctly",
- onfail="Link Discovery failed")
-
-
-
diff --git a/TestON/tests/FuncNext13/FuncNext13.topo b/TestON/tests/FuncNext13/FuncNext13.topo
deleted file mode 100755
index 85b6cab..0000000
--- a/TestON/tests/FuncNext13/FuncNext13.topo
+++ /dev/null
@@ -1,61 +0,0 @@
-<TOPOLOGY>
- <COMPONENT>
-
- <ONOSbench>
- <host>10.128.10.11</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOSbench>
-
- <ONOS1>
- <host>10.128.10.11</host>
- <user>sdn</user>
- <password>sdn</password>
- <type>OnosDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1>
-
- <ONOS2>
- <host>10.128.10.11</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2>
-
- <Mininet1>
- <host>10.128.10.11</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>MininetCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS>
- #Specify the Option for mininet
- <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
- <arg2> --topo mytopo </arg2>
- <arg3> --switch ovs,protocols=OpenFlow13</arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet1>
-
- <Mininet2>
- <host>10.128.10.11</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>RemoteMininetDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS>
- #Specify the Option for mininet
- <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
- <arg2> --topo mytopo </arg2>
- <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet2>
- </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/FuncStartTemplate/FuncStartTemplate.params b/TestON/tests/FuncStartTemplate/FuncStartTemplate.params
index 310e5f8..04f6110 100755
--- a/TestON/tests/FuncStartTemplate/FuncStartTemplate.params
+++ b/TestON/tests/FuncStartTemplate/FuncStartTemplate.params
@@ -1,11 +1,10 @@
<PARAMS>
-
<testcases>10,9,10,9</testcases>
- <SCALE>3,1</SCALE>
+ <SCALE>1,3</SCALE>
<availableNodes>3</availableNodes>
<ENV>
- <cellName>single_func</cellName>
+ <cellName>functionality</cellName>
<cellApps>drivers,openflow,proxyarp,mobility</cellApps>
</ENV>
<GIT>
diff --git a/TestON/tests/FuncStartTemplate/FuncStartTemplate.py b/TestON/tests/FuncStartTemplate/FuncStartTemplate.py
index 4beefae..59c242c 100644
--- a/TestON/tests/FuncStartTemplate/FuncStartTemplate.py
+++ b/TestON/tests/FuncStartTemplate/FuncStartTemplate.py
@@ -15,12 +15,13 @@
def CASE10( self, main ):
import time
import os
+ import imp
"""
Startup sequence:
+ git pull
cell <name>
onos-verify-cell
onos-remove-raft-log
- git pull
mvn clean install
onos-package
onos-install -f
@@ -44,6 +45,8 @@
main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
+ main.ONOSport = []
+ main.hostsData = {}
PULLCODE = False
if main.params[ 'GIT' ][ 'pull' ] == 'True':
PULLCODE = True
@@ -51,12 +54,12 @@
main.CLIs = []
for i in range( 1, int( main.numCtrls ) + 1 ):
main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+ main.ONOSport.append( main.params[ 'CTRL' ][ 'port' + str( i ) ] )
# -- INIT SECTION, ONLY RUNS ONCE -- #
if init == False:
init = True
- main.ONOSport = []
main.scale = ( main.params[ 'SCALE' ] ).split( "," )
main.numCtrls = int( main.scale[ 0 ] )
@@ -80,43 +83,21 @@
"clean install" )
globalONOSip = main.ONOSbench.getOnosIps()
-
- maxNodes = ( len(globalONOSip) - 2 )
+
+ maxNodes = ( len( globalONOSip ) - 2 )
main.numCtrls = int( main.scale[ 0 ] )
main.scale.remove( main.scale[ 0 ] )
main.ONOSip = []
- for i in range( maxNodes ):
- main.ONOSip.append( globalONOSip[i] )
+ for i in range( maxNodes ):
+ main.ONOSip.append( globalONOSip[ i ] )
-
-
#kill off all onos processes
main.log.info( "Safety check, killing all ONOS processes" +
" before initiating enviornment setup" )
- for i in range(maxNodes):
+ for i in range( maxNodes ):
main.ONOSbench.onosDie( globalONOSip[ i ] )
-
- """
- main.step( "Apply cell to environment" )
- cellResult = main.ONOSbench.setCell( cellName )
- 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( "Removing raft logs" )
- removeRaftResult = main.ONOSbench.onosRemoveRaftLogs()
- stepResult = removeRaftResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully removed raft logs",
- onfail="Failed to remove raft logs" )
- """
print "NODE COUNT = ", main.numCtrls
main.log.info( "Creating cell file" )
@@ -190,24 +171,31 @@
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( main.numCtrls ):
cliResult = cliResult and \
- main.CLIs[i].startOnosCli( main.ONOSip[ i ] )
+ main.CLIs[ i ].startOnosCli( 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 CASE9( self, main ):
+
+ def CASE9( self, main ):
'''
- Report errors/warnings/exceptions
+ Report errors/warnings/exceptions
'''
- main.log.info("Error report: \n")
- main.ONOSbench.logReport( globalONOSip[0], [ "INFO","FOLLOWER","WARN","flow","ERROR","Except" ], "s" )
+ main.log.info("Error report: \n" )
+ main.ONOSbench.logReport( globalONOSip[ 0 ],
+ [ "INFO",
+ "FOLLOWER",
+ "WARN",
+ "flow",
+ "ERROR",
+ "Except" ],
+ "s" )
#main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
def CASE11( self, main ):
diff --git a/TestON/tests/FuncStartTemplate/FuncStartTemplate.topo b/TestON/tests/FuncStartTemplate/FuncStartTemplate.topo
index 2321da0..e6613de 100755
--- a/TestON/tests/FuncStartTemplate/FuncStartTemplate.topo
+++ b/TestON/tests/FuncStartTemplate/FuncStartTemplate.topo
@@ -8,7 +8,7 @@
<type>OnosDriver</type>
<connect_order>1</connect_order>
<COMPONENTS>
- <home>~/onos</home>
+ <home>~/ONOS</home>
</COMPONENTS>
</ONOSbench>
diff --git a/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py b/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
new file mode 100644
index 0000000..41b3258
--- /dev/null
+++ b/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
@@ -0,0 +1,344 @@
+"""
+ Wrapper function for FuncTopo
+ Includes onosclidriver and mininetclidriver functions
+"""
+import time
+import json
+import re
+
+def __init__( self ):
+ self.default = ''
+
+def testTopology( main, topoFile='', args='', mnCmd='', clean=True ):
+ """
+ Description:
+ This function combines different wrapper functions in this module
+ to simulate a topology test
+ Test Steps:
+ - Load topology
+ - Discover topology
+ - Compare topology
+ - pingall
+ - Bring links down
+ - Compare topology
+ - pingall
+ - Bring links up
+ - Compare topology
+ - pingall
+ Options:
+ clean: Does sudo mn -c to clean mininet residue
+ Please read mininetclidriver.py >> startNet( .. ) function for details
+ Returns:
+ Returns main.TRUE if the test is successful, main.FALSE otherwise
+ """
+ testTopoResult = main.TRUE
+ compareTopoResult = main.TRUE
+ topoObjectResult = main.TRUE
+ stopResult = main.TRUE
+
+ if clean:
+ # Cleans minient
+ stopResult = stopMininet( main )
+
+ # Restart ONOS to clear hosts test new mininet topology
+ restartONOSResult = restartONOS( main )
+
+ # Starts topology
+ startResult = startNewTopology( main, topoFile, args, mnCmd )
+
+ # Gets list of switches in mininet
+ assignSwitch( main )
+
+ # This function activates fwd app then does pingall as well as store
+ # hosts data in a variable main.hostsData
+ getHostsResult = getHostsData( main )
+
+ # Create topology object using sts
+ topoObjectResult = createTopoObject( main )
+
+ # Compare Topology
+ compareTopoResult = compareTopo( main )
+
+ testTopoResult = startResult and topoObjectResult and \
+ compareTopoResult and getHostsResult
+
+
+ return testTopoResult
+
+def startNewTopology( main, topoFile='', args='', mnCmd='' ):
+ """
+ Description:
+ This wrapper function starts new topology
+ Options:
+ Please read mininetclidriver.py >> startNet( .. ) function for details
+ Return:
+ Returns main.TRUE if topology is successfully created by mininet,
+ main.FALSE otherwise
+ NOTE:
+ Assumes Mininet1 is the name of the handler
+ """
+ assert main, "There is no main variable"
+ assert main.Mininet1, "Mininet 1 is not created"
+ result = main.TRUE
+
+ main.log.info( main.topoName + ": Starting new Mininet topology" )
+
+ # log which method is being used
+ if topoFile:
+ main.log.info( main.topoName + ": Starting topology with " +
+ topoFile + "topology file" )
+ elif not topoFile and not mnCmd:
+ main.log.info( main.topoName + ": Starting topology using" +
+ " the topo file" )
+ elif topoFile and mnCmd:
+ main.log.error( main.topoName + ": You can only use one " +
+ "method to start a topology" )
+ elif mnCmd:
+ main.log.info( main.topoName + ": Starting topology with '" +
+ mnCmd + "' Mininet command" )
+
+
+ result = main.Mininet1.startNet( topoFile=topoFile,
+ args=args,
+ mnCmd=mnCmd )
+
+ return result
+
+def stopMininet( main ):
+ """
+ Stops current topology and execute mn -c basically triggers
+ stopNet in mininetclidrivers
+
+ NOTE: Mininet should be running when issuing this command other wise
+ the this function will cause the test to stop
+ """
+ stopResult = main.TRUE
+ stopResult = main.Mininet1.stopNet()
+ time.sleep( 30 )
+ if not stopResult:
+ main.log.info( main.topoName + ": Did not stop Mininet topology" )
+ return stopResult
+
+def createTopoObject( main ):
+ """
+ Creates topology object using sts module
+ """
+ from sts.topology.teston_topology import TestONTopology
+ global MNTopo
+ try:
+ ctrls = []
+ main.log.info( main.topoName + ": Creating topology object" +
+ " from mininet" )
+ for node in main.nodes:
+ temp = ( node, node.name, node.ip_address, 6633 )
+ ctrls.append( temp )
+ MNTopo = TestONTopology( main.Mininet1, ctrls )
+ except Exception:
+ objResult = main.FALSE
+ else:
+ objResult = main.TRUE
+
+ return objResult
+
+def compareTopo( main ):
+ """
+ Compare topology( devices, links, ports, hosts ) between ONOS and
+ mininet using sts
+ """
+ assert MNTopo, "There is no MNTopo object"
+ devices = []
+ links = []
+ ports = []
+ hosts = []
+ switchResult = []
+ linksResult = []
+ portsResult = []
+ hostsResult = []
+ compareTopoResult = main.TRUE
+
+ for i in range( main.numCtrls ):
+ devices.append( json.loads( main.CLIs[ i ].devices() ) )
+ links.append( json.loads( main.CLIs[ i ].links() ) )
+ ports.append( json.loads( main.CLIs[ i ].ports() ) )
+ hosts.append( json.loads( main.CLIs[ i ].hosts() ) )
+
+ # Comparing switches
+ main.log.info( main.topoName + ": Comparing switches in each ONOS nodes" +
+ " with Mininet" )
+ for i in range( main.numCtrls ):
+ tempResult = main.Mininet1.compareSwitches( MNTopo, devices[ i ] )
+ switchResult.append( tempResult )
+ if tempResult == main.FALSE:
+ main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
+ " switch view is incorrect " )
+
+ if all( result == main.TRUE for result in switchResult ):
+ main.log.info( main.topoName + ": Switch view in all ONOS nodes "+
+ "are correct " )
+ else:
+ compareTopoResult = main.FALSE
+
+ # Comparing ports
+ main.log.info( main.topoName + ": Comparing ports in each ONOS nodes" +
+ " with Mininet" )
+ for i in range( main.numCtrls ):
+ tempResult = main.Mininet1.comparePorts( MNTopo, ports[ i ] )
+ portsResult.append( tempResult )
+ if tempResult == main.FALSE:
+ main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
+ " ports view are incorrect " )
+
+ if all( result == main.TRUE for result in portsResult ):
+ main.log.info( main.topoName + ": Ports view in all ONOS nodes "+
+ "are correct " )
+ else:
+ compareTopoResult = main.FALSE
+
+ # Comparing links
+ main.log.info( main.topoName + ": Comparing links in each ONOS nodes" +
+ " with Mininet" )
+ for i in range( main.numCtrls ):
+ tempResult = main.Mininet1.compareLinks( MNTopo, links[ i ] )
+ linksResult.append( tempResult )
+ if tempResult == main.FALSE:
+ main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
+ " links view are incorrect " )
+
+ if all( result == main.TRUE for result in linksResult ):
+ main.log.info( main.topoName + ": Links view in all ONOS nodes "+
+ "are correct " )
+ else:
+ compareTopoResult = main.FALSE
+
+ # Comparing hosts
+ main.log.info( main.topoName + ": Comparing hosts in each ONOS nodes" +
+ " with Mininet" )
+ for i in range( main.numCtrls ):
+ tempResult = main.Mininet1.compareHosts( MNTopo, hosts[ i ] )
+ hostsResult.append( tempResult )
+ if tempResult == main.FALSE:
+ main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
+ " hosts view are incorrect " )
+
+ if all( result == main.TRUE for result in hostsResult ):
+ main.log.info( main.topoName + ": Hosts view in all ONOS nodes "+
+ "are correct " )
+ else:
+ compareTopoResult = main.FALSE
+
+ return compareTopoResult
+
+def assignSwitch( main ):
+ """
+ Returns switch list using getSwitch in Mininet driver
+ """
+ switchList = []
+ assignResult = main.TRUE
+ switchList = main.Mininet1.getSwitch()
+ assignResult = main.Mininet1.assignSwController( sw=switchList,
+ ip=main.ONOSip[ 0 ],
+ port=6633 )
+
+ for sw in switchList:
+ response = main.Mininet1.getSwController( sw )
+ if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
+ assignResult = assignResult and main.TRUE
+ else:
+ assignResult = main.FALSE
+
+ return switchList
+
+def getHostsData( main ):
+ """
+ Use fwd app and pingall to discover all the hosts
+ """
+ activateResult = main.TRUE
+ appCheck = main.TRUE
+ getDataResult = main.TRUE
+ main.log.info( main.topoName + ": Activating reactive forwarding app " )
+ activateResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
+ if main.hostsData:
+ main.hostsData = {}
+ for i in range( main.numCtrls ):
+ appCheck = appCheck and main.CLIs[ i ].appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.CLIs[ i ].apps() )
+ main.log.warn( main.CLIs[ i ].appIDs() )
+
+ pingResult = main.Mininet1.pingall( timeout=900 )
+ hostsJson = json.loads( main.CLIs[ 0 ].hosts() )
+ hosts = main.Mininet1.getHosts()
+ for host in hosts:
+ main.hostsData[ host ] = {}
+ main.hostsData[ host ][ 'mac' ] = \
+ main.Mininet1.getMacAddress( host ).upper()
+ for hostj in hostsJson:
+ if main.hostsData[ host ][ 'mac' ] == hostj[ 'mac' ]:
+ main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
+ main.hostsData[ host ][ 'vlan' ] = hostj[ 'vlan' ]
+ main.hostsData[ host ][ 'location' ] = \
+ hostj[ 'location' ][ 'elementId' ] + '/' + \
+ hostj[ 'location' ][ 'port' ]
+ main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
+
+ if activateResult and main.hostsData:
+ main.log.info( main.topoName + ": Successfully used fwd app" +
+ " to discover hosts " )
+ getDataResult = main.TRUE
+ else:
+ main.log.info( main.topoName + ": Failed to use fwd app" +
+ " to discover hosts " )
+ getDataResult = main.FALSE
+
+ # This data can be use later for intents
+ print main.hostsData
+
+ return getDataResult
+
+def restartONOS( main ):
+ """
+ Description:
+ Stop and start ONOS that clears hosts,devices etc. in order to test
+ new mininet topology
+ Return:
+ Retruns main.TRUE for a successful restart, main.FALSE otherwise.
+ """
+ stopResult = []
+ startResult = []
+ restartResult = main.TRUE
+
+ main.log.info( main.topoName + ": Stopping ONOS cluster" )
+ for node in main.nodes:
+ startResult.append( main.ONOSbench.onosStop( nodeIp=node.ip_address ) )
+
+ if all( result == main.TRUE for result in stopResult ):
+ main.log.info( main.topoName + ": Successfully stopped ONOS cluster" )
+ else:
+ restartResult = main.FALSE
+ main.log.error( main.topoName + ": Failed to stop ONOS cluster" )
+
+ time.sleep( 15 )
+
+ main.log.info( main.topoName + ": Starting ONOS cluster" )
+ for node in main.nodes:
+ startResult.append( main.ONOSbench.onosStart( nodeIp=node.ip_address ) )
+
+ if all( result == main.TRUE for result in startResult ):
+ main.log.info( main.topoName + ": Successfully start ONOS cluster" )
+ else:
+ restartResult = main.FALSE
+ main.log.error( main.topoName + ": Failed to start ONOS cluster" )
+
+ # Start ONOS CLIs again
+ main.log.info( main.topoName + ": Starting ONOS CLI" )
+ cliResult = main.TRUE
+ for i in range( main.numCtrls ):
+ cliResult = cliResult and \
+ main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
+
+ time.sleep( 15 )
+
+ return restartResult
+
+
+
diff --git a/TestON/tests/FuncTopo/FuncTopo.py b/TestON/tests/FuncTopo/FuncTopo.py
new file mode 100644
index 0000000..b2e2a6a
--- /dev/null
+++ b/TestON/tests/FuncTopo/FuncTopo.py
@@ -0,0 +1,218 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+import json
+
+class FuncTopo:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE10( self, main ):
+ import time
+ import os
+ import imp
+ """
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-log
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ """
+ global init
+ global globalONOSip
+ try:
+ if type(init) is not bool:
+ init = False
+ except NameError:
+ init = False
+
+ main.wrapper = imp.load_source( 'FuncTopoFunction', '/home/admin/' +
+ 'TestON/tests/FuncTopo/Dependency/' +
+ 'FuncTopoFunction.py')
+
+ #Local variables
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ apps = main.params[ 'ENV' ][ 'cellApps' ]
+ gitBranch = main.params[ 'GIT' ][ 'branch' ]
+ benchIp = os.environ[ 'OCN' ]
+ benchUser = main.params[ 'BENCH' ][ 'user' ]
+ topology = main.params[ 'MININET' ][ 'topo' ]
+ main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
+ main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
+ main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
+ main.ONOSport = []
+ main.hostsData = {}
+ main.topoName = " "
+ PULLCODE = False
+ if main.params[ 'GIT' ][ 'pull' ] == 'True':
+ PULLCODE = True
+ main.case( "Setting up test environment" )
+ main.CLIs = []
+ main.nodes = []
+ for i in range( 1, int( main.numCtrls ) + 1 ):
+ main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+ main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+ main.ONOSport.append( main.params[ 'CTRL' ][ 'port' + str( i ) ] )
+
+ # -- INIT SECTION, ONLY RUNS ONCE -- #
+ if init == False:
+ init = True
+
+ main.scale = ( main.params[ 'SCALE' ] ).split( "," )
+ main.numCtrls = int( main.scale[ 0 ] )
+
+ if PULLCODE:
+ main.step( "Git checkout and pull " + gitBranch )
+ main.ONOSbench.gitCheckout( gitBranch )
+ gitPullResult = main.ONOSbench.gitPull()
+ if gitPullResult == main.ERROR:
+ main.log.error( "Error pulling git branch" )
+ main.step( "Using mvn clean & install" )
+ cleanInstallResult = main.ONOSbench.cleanInstall()
+ stepResult = cleanInstallResult
+ 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" )
+
+ globalONOSip = main.ONOSbench.getOnosIps()
+ maxNodes = ( len(globalONOSip) - 2 )
+
+ main.numCtrls = int( main.scale[ 0 ] )
+ main.scale.remove( main.scale[ 0 ] )
+
+ main.ONOSip = []
+ for i in range( maxNodes ):
+ main.ONOSip.append( globalONOSip[i] )
+
+ #kill off all onos processes
+ main.log.info( "Safety check, killing all ONOS processes" +
+ " before initiating enviornment setup" )
+ for i in range(maxNodes):
+ main.ONOSbench.onosDie( globalONOSip[ i ] )
+
+ print "NODE COUNT = ", main.numCtrls
+ main.log.info( "Creating cell file" )
+ cellIp = []
+ for i in range( main.numCtrls ):
+ cellIp.append( str( main.ONOSip[ i ] ) )
+ print cellIp
+ main.ONOSbench.createCellFile( benchIp, cellName, "",
+ str( apps ), *cellIp )
+
+ main.step( "Apply cell to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ 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()
+ stepResult = packageResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully created ONOS package",
+ onfail="Failed to create ONOS package" )
+
+ 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( 5 )
+ 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( 10 )
+ 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" )
+
+ def CASE9( self, main ):
+ '''
+ Report errors/warnings/exceptions
+ '''
+ main.log.info("Error report: \n")
+ main.ONOSbench.logReport( globalONOSip[0],
+ [ "INFO","FOLLOWER","WARN",
+ "flow","ERROR","Except" ],
+ "s" )
+ #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
+
+ def CASE1001( self, main ):
+ """
+ Test topology discovery
+ """
+ main.case( "Topology discovery test" )
+
+
+ main.step( "Torus 5-5 topology" )
+ main.topoName = "TORUS5-5"
+ mnCmd = "mn --topo=torus,5,5 --mac"
+ stepResult = main.wrapper.testTopology( main,
+ mnCmd=mnCmd,
+ clean=False )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Torus 5-5 topology successful",
+ onfail="Torus 5-5 topology failed" )
+
+ main.topoName = "TREE3-3"
+ stepResult = main.TRUE
+ main.step( "Tree 3-3 topology" )
+ mnCmd = "mn --topo=tree,3,3 --mac"
+ stepResult = main.wrapper.testTopology( main,
+ mnCmd=mnCmd,
+ clean=True )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Tree 3-3 topology successful",
+ onfail="Tree 3-3 topology failed" )
diff --git a/TestON/tests/FuncNext13/__init__.py b/TestON/tests/FuncTopo/__init__.py
similarity index 100%
rename from TestON/tests/FuncNext13/__init__.py
rename to TestON/tests/FuncTopo/__init__.py
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
index c1bd2f0..4ecc271 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
@@ -270,19 +270,13 @@
"master of the device."
main.step( "Assign switches to controllers" )
- # TODO: rewrite this function to take lists of ips and ports?
- # or list of tuples?
+ ipList = []
+ for i in range( numControllers ):
+ ipList.append( nodes[ i ].ip_address )
+ swList = []
for i in range( 1, 29 ):
- main.Mininet1.assignSwController(
- sw=str( i ),
- count=numControllers,
- ip1=nodes[ 0 ].ip_address, port1=ONOS1Port,
- ip2=nodes[ 1 ].ip_address, port2=ONOS2Port,
- ip3=nodes[ 2 ].ip_address, port3=ONOS3Port,
- ip4=nodes[ 3 ].ip_address, port4=ONOS4Port,
- ip5=nodes[ 4 ].ip_address, port5=ONOS5Port,
- ip6=nodes[ 5 ].ip_address, port6=ONOS6Port,
- ip7=nodes[ 6 ].ip_address, port7=ONOS7Port )
+ swList.append( "s" + str( i ) )
+ main.Mininet1.assignSwController( sw=swList, ip=ipList )
mastershipCheck = main.TRUE
for i in range( 1, 29 ):
@@ -479,12 +473,13 @@
for i in range(2): # Retry if pingall fails first time
time1 = time.time()
pingResult = main.Mininet1.pingall()
- utilities.assert_equals(
- expect=main.TRUE,
- actual=pingResult,
- onpass="Reactive Pingall test passed",
- onfail="Reactive Pingall failed, " +
- "one or more ping pairs failed" )
+ if i == 0:
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=pingResult,
+ onpass="Reactive Pingall test passed",
+ onfail="Reactive Pingall failed, " +
+ "one or more ping pairs failed" )
time2 = time.time()
main.log.info( "Time for pingall: %2f seconds" %
( time2 - time1 ) )
@@ -682,7 +677,7 @@
main.log.debug( "Intents in " + cli.name + ": " +
str( sorted( onosIds ) ) )
if sorted( ids ) != sorted( intentIds ):
- main.log.debug( "Set of intent IDs doesn't match" )
+ main.log.warn( "Set of intent IDs doesn't match" )
correct = False
break
else:
@@ -1109,8 +1104,6 @@
assert utilities.assert_equals, "utilities.assert_equals not defined"
assert CLIs, "CLIs not defined"
assert nodes, "nodes not defined"
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
main.case( "Setting up and gathering data for current state" )
# The general idea for this test case is to pull the state of
@@ -1422,13 +1415,6 @@
target=main.params[ 'PING' ][ 'target10' ],
pingTime=500 )
- main.step( "Create TestONTopology object" )
- ctrls = []
- for node in nodes:
- temp = ( node, node.name, node.ip_address, 6633 )
- ctrls.append( temp )
- MNTopo = TestONTopology( main.Mininet1, ctrls )
-
main.step( "Collecting topology information from ONOS" )
devices = []
threads = []
@@ -1586,14 +1572,21 @@
main.step( "Comparing ONOS topology to MN" )
devicesResults = main.TRUE
- portsResults = main.TRUE
linksResults = main.TRUE
+ hostsResults = main.TRUE
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
+ mnHosts = main.Mininet1.getHosts()
for controller in range( numControllers ):
controllerStr = str( controller + 1 )
- if devices[ controller ] or "Error" not in devices[ controller ]:
+ if devices[ controller ] and ports[ controller ] and\
+ "Error" not in devices[ controller ] and\
+ "Error" not in ports[ controller ]:
+
currentDevicesResult = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices[ controller ] ) )
+ mnSwitches,
+ json.loads( devices[ controller ] ),
+ json.loads( ports[ controller ] ) )
else:
currentDevicesResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -1602,24 +1595,10 @@
" Switches view is correct",
onfail="ONOS" + controllerStr +
" Switches view is incorrect" )
-
- if ports[ controller ] or "Error" not in ports[ controller ]:
- currentPortsResult = main.Mininet1.comparePorts(
- MNTopo,
- json.loads( ports[ controller ] ) )
- else:
- currentPortsResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentPortsResult,
- onpass="ONOS" + controllerStr +
- " ports view is correct",
- onfail="ONOS" + controllerStr +
- " ports view is incorrect" )
-
- if links[ controller ] or "Error" not in links[ controller ]:
+ if links[ controller ] and "Error" not in links[ controller ]:
currentLinksResult = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links[ controller ] ) )
+ mnSwitches, mnLinks,
+ json.loads( links[ controller ] ) )
else:
currentLinksResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -1629,16 +1608,43 @@
onfail="ONOS" + controllerStr +
" links view is incorrect" )
- devicesResults = devicesResults and currentDevicesResult
- portsResults = portsResults and currentPortsResult
- linksResults = linksResults and currentLinksResult
+ if hosts[ controller ] or "Error" not in hosts[ controller ]:
+ currentHostsResult = main.Mininet1.compareHosts(
+ mnHosts,
+ hosts[ controller ] )
+ else:
+ currentHostsResult = main.FALSE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=currentHostsResult,
+ onpass="ONOS" + controllerStr +
+ " hosts exist in Mininet",
+ onfail="ONOS" + controllerStr +
+ " hosts don't match Mininet" )
- topoResult = ( devicesResults and portsResults and linksResults
- and consistentHostsResult and consistentClustersResult
- and clusterResults and ipResult )
- utilities.assert_equals( expect=main.TRUE, actual=topoResult,
- onpass="Topology Check Test successful",
- onfail="Topology Check Test NOT successful" )
+ devicesResults = devicesResults and currentDevicesResult
+ linksResults = linksResults and currentLinksResult
+ hostsResults = hostsResults and currentHostsResult
+
+ main.step( "Device information is correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=devicesResults,
+ onpass="Device information is correct",
+ onfail="Device information is incorrect" )
+
+ main.step( "Links are correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=linksResults,
+ onpass="Link are correct",
+ onfail="Links are incorrect" )
+
+ main.step( "Hosts are correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=hostsResults,
+ onpass="Hosts are correct",
+ onfail="Hosts are incorrect" )
def CASE6( self, main ):
"""
@@ -2084,11 +2090,6 @@
"""
Compare topo
"""
- import sys
- # FIXME add this path to params
- sys.path.append( "/home/admin/sts" )
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
import json
import time
assert numControllers, "numControllers not defined"
@@ -2100,25 +2101,9 @@
main.case( "Compare ONOS Topology view to Mininet topology" )
main.caseExplaination = "Compare topology objects between Mininet" +\
" and ONOS"
- main.step( "Create TestONTopology object" )
- try:
- ctrls = []
- for node in nodes:
- temp = ( node, node.name, node.ip_address, 6633 )
- ctrls.append( temp )
- MNTopo = TestONTopology( main.Mininet1, ctrls )
- except Exception:
- objResult = main.FALSE
- else:
- objResult = main.TRUE
- utilities.assert_equals( expect=main.TRUE, actual=objResult,
- onpass="Created TestONTopology object",
- onfail="Exception while creating " +
- "TestONTopology object" )
main.step( "Comparing ONOS topology to MN" )
devicesResults = main.TRUE
- portsResults = main.TRUE
linksResults = main.TRUE
hostsResults = main.TRUE
hostAttachmentResults = True
@@ -2130,9 +2115,6 @@
# Give time for Gossip to work
while topoResult == main.FALSE and elapsed < 60:
count += 1
- if count > 1:
- # TODO: Deprecate STS usage
- MNTopo = TestONTopology( main.Mininet1, ctrls )
cliStart = time.time()
devices = []
threads = []
@@ -2213,13 +2195,19 @@
print "Elapsed time: " + str( elapsed )
print "CLI time: " + str( cliTime )
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
+ mnHosts = main.Mininet1.getHosts()
for controller in range( numControllers ):
controllerStr = str( controller + 1 )
- if devices[ controller ] or "Error" not in devices[
- controller ]:
+ if devices[ controller ] and ports[ controller ] and\
+ "Error" not in devices[ controller ] and\
+ "Error" not in ports[ controller ]:
+
currentDevicesResult = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices[ controller ] ) )
+ mnSwitches,
+ json.loads( devices[ controller ] ),
+ json.loads( ports[ controller ] ) )
else:
currentDevicesResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -2229,23 +2217,10 @@
onfail="ONOS" + controllerStr +
" Switches view is incorrect" )
- if ports[ controller ] or "Error" not in ports[ controller ]:
- currentPortsResult = main.Mininet1.comparePorts(
- MNTopo,
- json.loads( ports[ controller ] ) )
- else:
- currentPortsResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentPortsResult,
- onpass="ONOS" + controllerStr +
- " ports view is correct",
- onfail="ONOS" + controllerStr +
- " ports view is incorrect" )
-
- if links[ controller ] or "Error" not in links[ controller ]:
+ if links[ controller ] and "Error" not in links[ controller ]:
currentLinksResult = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links[ controller ] ) )
+ mnSwitches, mnLinks,
+ json.loads( links[ controller ] ) )
else:
currentLinksResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -2257,7 +2232,8 @@
if hosts[ controller ] or "Error" not in hosts[ controller ]:
currentHostsResult = main.Mininet1.compareHosts(
- MNTopo, hosts[ controller ] )
+ mnHosts,
+ hosts[ controller ] )
else:
currentHostsResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -2268,7 +2244,7 @@
" hosts don't match Mininet" )
# CHECKING HOST ATTACHMENT POINTS
hostAttachment = True
- zeroHosts = False
+ noHosts = False
# FIXME: topo-HA/obelisk specific mappings:
# key is mac and value is dpid
mappings = {}
@@ -2301,7 +2277,7 @@
if hosts[ controller ] or "Error" not in hosts[ controller ]:
if hosts[ controller ] == []:
main.log.warn( "There are no hosts discovered" )
- zeroHosts = True
+ noHosts = True
else:
for host in hosts[ controller ]:
mac = None
@@ -2345,17 +2321,20 @@
main.log.error( "No hosts json output or \"Error\"" +
" in output. hosts = " +
repr( hosts[ controller ] ) )
- if zeroHosts:
+ if noHosts is False:
# TODO: Find a way to know if there should be hosts in a
# given point of the test
hostAttachment = True
# END CHECKING HOST ATTACHMENT POINTS
devicesResults = devicesResults and currentDevicesResult
- portsResults = portsResults and currentPortsResult
linksResults = linksResults and currentLinksResult
hostsResults = hostsResults and currentHostsResult
- hostAttachmentResults = hostAttachmentResults and hostAttachment
+ hostAttachmentResults = hostAttachmentResults and\
+ hostAttachment
+ topoResult = ( devicesResults and linksResults
+ and hostsResults and ipResult and
+ hostAttachmentResults )
# Compare json objects for hosts and dataplane clusters
@@ -2444,7 +2423,7 @@
onpass="ONOS shows 1 SCC",
onfail="ONOS shows " + str( numClusters ) + " SCCs" )
- topoResult = ( devicesResults and portsResults and linksResults
+ topoResult = ( devicesResults and linksResults
and hostsResults and consistentHostsResult
and consistentClustersResult and clusterResults
and ipResult and hostAttachmentResults )
@@ -2465,13 +2444,6 @@
onpass="Device information is correct",
onfail="Device information is incorrect" )
- main.step( "Port information is correct" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=portsResults,
- onpass="Port information is correct",
- onfail="Port information is incorrect" )
-
main.step( "Links are correct" )
utilities.assert_equals(
expect=main.TRUE,
@@ -2641,22 +2613,10 @@
main.Mininet1.addSwitch( switch, dpid=switchDPID )
for peer in links:
main.Mininet1.addLink( switch, peer )
- main.Mininet1.assignSwController( sw=switch.split( 's' )[ 1 ],
- count=numControllers,
- ip1=nodes[ 0 ].ip_address,
- port1=ONOS1Port,
- ip2=nodes[ 1 ].ip_address,
- port2=ONOS2Port,
- ip3=nodes[ 2 ].ip_address,
- port3=ONOS3Port,
- ip4=nodes[ 3 ].ip_address,
- port4=ONOS4Port,
- ip5=nodes[ 4 ].ip_address,
- port5=ONOS5Port,
- ip6=nodes[ 5 ].ip_address,
- port6=ONOS6Port,
- ip7=nodes[ 6 ].ip_address,
- port7=ONOS7Port )
+ ipList = []
+ for i in range( numControllers ):
+ ipList.append( nodes[ i ].ip_address )
+ main.Mininet1.assignSwController( sw=switch, ip=ipList )
main.log.info( "Waiting " + str( switchSleep ) +
" seconds for switch up to be discovered" )
time.sleep( switchSleep )
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
index 08d81c2..a81845f 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
@@ -265,19 +265,13 @@
"master of the device."
main.step( "Assign switches to controllers" )
- # TODO: rewrite this function to take lists of ips and ports?
- # or list of tuples?
+ ipList = []
+ for i in range( numControllers ):
+ ipList.append( nodes[ i ].ip_address )
+ swList = []
for i in range( 1, 29 ):
- main.Mininet1.assignSwController(
- sw=str( i ),
- count=numControllers,
- ip1=nodes[ 0 ].ip_address, port1=ONOS1Port,
- ip2=nodes[ 1 ].ip_address, port2=ONOS2Port,
- ip3=nodes[ 2 ].ip_address, port3=ONOS3Port,
- ip4=nodes[ 3 ].ip_address, port4=ONOS4Port,
- ip5=nodes[ 4 ].ip_address, port5=ONOS5Port,
- ip6=nodes[ 5 ].ip_address, port6=ONOS6Port,
- ip7=nodes[ 6 ].ip_address, port7=ONOS7Port )
+ swList.append( "s" + str( i ) )
+ main.Mininet1.assignSwController( sw=swList, ip=ipList )
mastershipCheck = main.TRUE
for i in range( 1, 29 ):
@@ -462,12 +456,13 @@
for i in range(2): # Retry if pingall fails first time
time1 = time.time()
pingResult = main.Mininet1.pingall()
- utilities.assert_equals(
- expect=main.TRUE,
- actual=pingResult,
- onpass="Reactive Pingall test passed",
- onfail="Reactive Pingall failed, " +
- "one or more ping pairs failed" )
+ if i == 0:
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=pingResult,
+ onpass="Reactive Pingall test passed",
+ onfail="Reactive Pingall failed, " +
+ "one or more ping pairs failed" )
time2 = time.time()
main.log.info( "Time for pingall: %2f seconds" %
( time2 - time1 ) )
@@ -665,7 +660,7 @@
main.log.debug( "Intents in " + cli.name + ": " +
str( sorted( onosIds ) ) )
if sorted( ids ) != sorted( intentIds ):
- main.log.debug( "Set of intent IDs doesn't match" )
+ main.log.warn( "Set of intent IDs doesn't match" )
correct = False
break
else:
@@ -1082,8 +1077,6 @@
assert utilities.assert_equals, "utilities.assert_equals not defined"
assert CLIs, "CLIs not defined"
assert nodes, "nodes not defined"
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
main.case( "Setting up and gathering data for current state" )
# The general idea for this test case is to pull the state of
@@ -1395,13 +1388,6 @@
target=main.params[ 'PING' ][ 'target10' ],
pingTime=500 )
- main.step( "Create TestONTopology object" )
- ctrls = []
- for node in nodes:
- temp = ( node, node.name, node.ip_address, 6633 )
- ctrls.append( temp )
- MNTopo = TestONTopology( main.Mininet1, ctrls )
-
main.step( "Collecting topology information from ONOS" )
devices = []
threads = []
@@ -1559,14 +1545,21 @@
main.step( "Comparing ONOS topology to MN" )
devicesResults = main.TRUE
- portsResults = main.TRUE
linksResults = main.TRUE
+ hostsResults = main.TRUE
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
+ mnHosts = main.Mininet1.getHosts()
for controller in range( numControllers ):
controllerStr = str( controller + 1 )
- if devices[ controller ] or "Error" not in devices[ controller ]:
+ if devices[ controller ] and ports[ controller ] and\
+ "Error" not in devices[ controller ] and\
+ "Error" not in ports[ controller ]:
+
currentDevicesResult = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices[ controller ] ) )
+ mnSwitches,
+ json.loads( devices[ controller ] ),
+ json.loads( ports[ controller ] ) )
else:
currentDevicesResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -1575,24 +1568,10 @@
" Switches view is correct",
onfail="ONOS" + controllerStr +
" Switches view is incorrect" )
-
- if ports[ controller ] or "Error" not in ports[ controller ]:
- currentPortsResult = main.Mininet1.comparePorts(
- MNTopo,
- json.loads( ports[ controller ] ) )
- else:
- currentPortsResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentPortsResult,
- onpass="ONOS" + controllerStr +
- " ports view is correct",
- onfail="ONOS" + controllerStr +
- " ports view is incorrect" )
-
- if links[ controller ] or "Error" not in links[ controller ]:
+ if links[ controller ] and "Error" not in links[ controller ]:
currentLinksResult = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links[ controller ] ) )
+ mnSwitches, mnLinks,
+ json.loads( links[ controller ] ) )
else:
currentLinksResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -1602,16 +1581,43 @@
onfail="ONOS" + controllerStr +
" links view is incorrect" )
- devicesResults = devicesResults and currentDevicesResult
- portsResults = portsResults and currentPortsResult
- linksResults = linksResults and currentLinksResult
+ if hosts[ controller ] or "Error" not in hosts[ controller ]:
+ currentHostsResult = main.Mininet1.compareHosts(
+ mnHosts,
+ hosts[ controller ] )
+ else:
+ currentHostsResult = main.FALSE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=currentHostsResult,
+ onpass="ONOS" + controllerStr +
+ " hosts exist in Mininet",
+ onfail="ONOS" + controllerStr +
+ " hosts don't match Mininet" )
- topoResult = ( devicesResults and portsResults and linksResults
- and consistentHostsResult and consistentClustersResult
- and clusterResults and ipResult )
- utilities.assert_equals( expect=main.TRUE, actual=topoResult,
- onpass="Topology Check Test successful",
- onfail="Topology Check Test NOT successful" )
+ devicesResults = devicesResults and currentDevicesResult
+ linksResults = linksResults and currentLinksResult
+ hostsResults = hostsResults and currentHostsResult
+
+ main.step( "Device information is correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=devicesResults,
+ onpass="Device information is correct",
+ onfail="Device information is incorrect" )
+
+ main.step( "Links are correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=linksResults,
+ onpass="Link are correct",
+ onfail="Links are incorrect" )
+
+ main.step( "Hosts are correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=hostsResults,
+ onpass="Hosts are correct",
+ onfail="Hosts are incorrect" )
def CASE6( self, main ):
"""
@@ -2032,11 +2038,6 @@
"""
Compare topo
"""
- import sys
- # FIXME add this path to params
- sys.path.append( "/home/admin/sts" )
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
import json
import time
assert numControllers, "numControllers not defined"
@@ -2048,25 +2049,9 @@
main.case( "Compare ONOS Topology view to Mininet topology" )
main.caseExplaination = "Compare topology objects between Mininet" +\
" and ONOS"
- main.step( "Create TestONTopology object" )
- try:
- ctrls = []
- for node in nodes:
- temp = ( node, node.name, node.ip_address, 6633 )
- ctrls.append( temp )
- MNTopo = TestONTopology( main.Mininet1, ctrls )
- except Exception:
- objResult = main.FALSE
- else:
- objResult = main.TRUE
- utilities.assert_equals( expect=main.TRUE, actual=objResult,
- onpass="Created TestONTopology object",
- onfail="Exception while creating " +
- "TestONTopology object" )
main.step( "Comparing ONOS topology to MN" )
devicesResults = main.TRUE
- portsResults = main.TRUE
linksResults = main.TRUE
hostsResults = main.TRUE
hostAttachmentResults = True
@@ -2078,9 +2063,6 @@
# Give time for Gossip to work
while topoResult == main.FALSE and elapsed < 60:
count += 1
- if count > 1:
- # TODO: Deprecate STS usage
- MNTopo = TestONTopology( main.Mininet1, ctrls )
cliStart = time.time()
devices = []
threads = []
@@ -2161,13 +2143,19 @@
print "Elapsed time: " + str( elapsed )
print "CLI time: " + str( cliTime )
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
+ mnHosts = main.Mininet1.getHosts()
for controller in range( numControllers ):
controllerStr = str( controller + 1 )
- if devices[ controller ] or "Error" not in devices[
- controller ]:
+ if devices[ controller ] and ports[ controller ] and\
+ "Error" not in devices[ controller ] and\
+ "Error" not in ports[ controller ]:
+
currentDevicesResult = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices[ controller ] ) )
+ mnSwitches,
+ json.loads( devices[ controller ] ),
+ json.loads( ports[ controller ] ) )
else:
currentDevicesResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -2177,23 +2165,10 @@
onfail="ONOS" + controllerStr +
" Switches view is incorrect" )
- if ports[ controller ] or "Error" not in ports[ controller ]:
- currentPortsResult = main.Mininet1.comparePorts(
- MNTopo,
- json.loads( ports[ controller ] ) )
- else:
- currentPortsResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentPortsResult,
- onpass="ONOS" + controllerStr +
- " ports view is correct",
- onfail="ONOS" + controllerStr +
- " ports view is incorrect" )
-
- if links[ controller ] or "Error" not in links[ controller ]:
+ if links[ controller ] and "Error" not in links[ controller ]:
currentLinksResult = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links[ controller ] ) )
+ mnSwitches, mnLinks,
+ json.loads( links[ controller ] ) )
else:
currentLinksResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -2205,7 +2180,8 @@
if hosts[ controller ] or "Error" not in hosts[ controller ]:
currentHostsResult = main.Mininet1.compareHosts(
- MNTopo, hosts[ controller ] )
+ mnHosts,
+ hosts[ controller ] )
else:
currentHostsResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -2216,7 +2192,7 @@
" hosts don't match Mininet" )
# CHECKING HOST ATTACHMENT POINTS
hostAttachment = True
- noHosts = False
+ zeroHosts = False
# FIXME: topo-HA/obelisk specific mappings:
# key is mac and value is dpid
mappings = {}
@@ -2249,7 +2225,7 @@
if hosts[ controller ] or "Error" not in hosts[ controller ]:
if hosts[ controller ] == []:
main.log.warn( "There are no hosts discovered" )
- noHosts = True
+ zeroHosts = True
else:
for host in hosts[ controller ]:
mac = None
@@ -2293,15 +2269,15 @@
main.log.error( "No hosts json output or \"Error\"" +
" in output. hosts = " +
repr( hosts[ controller ] ) )
- if noHosts is False:
+ if zeroHosts is False:
hostAttachment = True
# END CHECKING HOST ATTACHMENT POINTS
devicesResults = devicesResults and currentDevicesResult
- portsResults = portsResults and currentPortsResult
linksResults = linksResults and currentLinksResult
hostsResults = hostsResults and currentHostsResult
- hostAttachmentResults = hostAttachmentResults and hostAttachment
+ hostAttachmentResults = hostAttachmentResults and\
+ hostAttachment
# Compare json objects for hosts and dataplane clusters
@@ -2390,7 +2366,7 @@
onpass="ONOS shows 1 SCC",
onfail="ONOS shows " + str( numClusters ) + " SCCs" )
- topoResult = ( devicesResults and portsResults and linksResults
+ topoResult = ( devicesResults and linksResults
and hostsResults and consistentHostsResult
and consistentClustersResult and clusterResults
and ipResult and hostAttachmentResults )
@@ -2411,13 +2387,6 @@
onpass="Device information is correct",
onfail="Device information is incorrect" )
- main.step( "Port information is correct" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=portsResults,
- onpass="Port information is correct",
- onfail="Port information is incorrect" )
-
main.step( "Links are correct" )
utilities.assert_equals(
expect=main.TRUE,
@@ -2587,22 +2556,10 @@
main.Mininet1.addSwitch( switch, dpid=switchDPID )
for peer in links:
main.Mininet1.addLink( switch, peer )
- main.Mininet1.assignSwController( sw=switch.split( 's' )[ 1 ],
- count=numControllers,
- ip1=nodes[ 0 ].ip_address,
- port1=ONOS1Port,
- ip2=nodes[ 1 ].ip_address,
- port2=ONOS2Port,
- ip3=nodes[ 2 ].ip_address,
- port3=ONOS3Port,
- ip4=nodes[ 3 ].ip_address,
- port4=ONOS4Port,
- ip5=nodes[ 4 ].ip_address,
- port5=ONOS5Port,
- ip6=nodes[ 5 ].ip_address,
- port6=ONOS6Port,
- ip7=nodes[ 6 ].ip_address,
- port7=ONOS7Port )
+ ipList = []
+ for i in range( numControllers ):
+ ipList.append( nodes[ i ].ip_address )
+ main.Mininet1.assignSwController( sw=switch, ip=ipList )
main.log.info( "Waiting " + str( switchSleep ) +
" seconds for switch up to be discovered" )
time.sleep( switchSleep )
diff --git a/TestON/tests/HATestSanity/HATestSanity.py b/TestON/tests/HATestSanity/HATestSanity.py
index 306e547..8d952c7 100644
--- a/TestON/tests/HATestSanity/HATestSanity.py
+++ b/TestON/tests/HATestSanity/HATestSanity.py
@@ -265,19 +265,13 @@
"master of the device."
main.step( "Assign switches to controllers" )
- # TODO: rewrite this function to take lists of ips and ports?
- # or list of tuples?
+ ipList = []
+ for i in range( numControllers ):
+ ipList.append( nodes[ i ].ip_address )
+ swList = []
for i in range( 1, 29 ):
- main.Mininet1.assignSwController(
- sw=str( i ),
- count=numControllers,
- ip1=nodes[ 0 ].ip_address, port1=ONOS1Port,
- ip2=nodes[ 1 ].ip_address, port2=ONOS2Port,
- ip3=nodes[ 2 ].ip_address, port3=ONOS3Port,
- ip4=nodes[ 3 ].ip_address, port4=ONOS4Port,
- ip5=nodes[ 4 ].ip_address, port5=ONOS5Port,
- ip6=nodes[ 5 ].ip_address, port6=ONOS6Port,
- ip7=nodes[ 6 ].ip_address, port7=ONOS7Port )
+ swList.append( "s" + str( i ) )
+ main.Mininet1.assignSwController( sw=swList, ip=ipList )
mastershipCheck = main.TRUE
for i in range( 1, 29 ):
@@ -462,12 +456,13 @@
for i in range(2): # Retry if pingall fails first time
time1 = time.time()
pingResult = main.Mininet1.pingall()
- utilities.assert_equals(
- expect=main.TRUE,
- actual=pingResult,
- onpass="Reactive Pingall test passed",
- onfail="Reactive Pingall failed, " +
- "one or more ping pairs failed" )
+ if i == 0:
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=pingResult,
+ onpass="Reactive Pingall test passed",
+ onfail="Reactive Pingall failed, " +
+ "one or more ping pairs failed" )
time2 = time.time()
main.log.info( "Time for pingall: %2f seconds" %
( time2 - time1 ) )
@@ -670,7 +665,7 @@
main.log.debug( "Intents in " + cli.name + ": " +
str( sorted( onosIds ) ) )
if sorted( ids ) != sorted( intentIds ):
- main.log.debug( "Set of intent IDs doesn't match" )
+ main.log.warn( "Set of intent IDs doesn't match" )
correct = False
break
else:
@@ -854,6 +849,7 @@
intents = main.ONOScli1.intents()
intentStates = []
main.log.info( "%-6s%-15s%-15s" % ( 'Count', 'ID', 'State' ) )
+ count = 0
# Iter through intents of a node
try:
for intent in json.loads( intents ):
@@ -1086,8 +1082,6 @@
assert utilities.assert_equals, "utilities.assert_equals not defined"
assert CLIs, "CLIs not defined"
assert nodes, "nodes not defined"
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
main.case( "Setting up and gathering data for current state" )
# The general idea for this test case is to pull the state of
@@ -1404,13 +1398,6 @@
target=main.params[ 'PING' ][ 'target10' ],
pingTime=500 )
- main.step( "Create TestONTopology object" )
- ctrls = []
- for node in nodes:
- temp = ( node, node.name, node.ip_address, 6633 )
- ctrls.append( temp )
- MNTopo = TestONTopology( main.Mininet1, ctrls )
-
main.step( "Collecting topology information from ONOS" )
devices = []
threads = []
@@ -1568,14 +1555,21 @@
main.step( "Comparing ONOS topology to MN" )
devicesResults = main.TRUE
- portsResults = main.TRUE
linksResults = main.TRUE
+ hostsResults = main.TRUE
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
+ mnHosts = main.Mininet1.getHosts()
for controller in range( numControllers ):
controllerStr = str( controller + 1 )
- if devices[ controller ] or "Error" not in devices[ controller ]:
+ if devices[ controller ] and ports[ controller ] and\
+ "Error" not in devices[ controller ] and\
+ "Error" not in ports[ controller ]:
+
currentDevicesResult = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices[ controller ] ) )
+ mnSwitches,
+ json.loads( devices[ controller ] ),
+ json.loads( ports[ controller ] ) )
else:
currentDevicesResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -1584,24 +1578,10 @@
" Switches view is correct",
onfail="ONOS" + controllerStr +
" Switches view is incorrect" )
-
- if ports[ controller ] or "Error" not in ports[ controller ]:
- currentPortsResult = main.Mininet1.comparePorts(
- MNTopo,
- json.loads( ports[ controller ] ) )
- else:
- currentPortsResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentPortsResult,
- onpass="ONOS" + controllerStr +
- " ports view is correct",
- onfail="ONOS" + controllerStr +
- " ports view is incorrect" )
-
- if links[ controller ] or "Error" not in links[ controller ]:
+ if links[ controller ] and "Error" not in links[ controller ]:
currentLinksResult = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links[ controller ] ) )
+ mnSwitches, mnLinks,
+ json.loads( links[ controller ] ) )
else:
currentLinksResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -1611,16 +1591,43 @@
onfail="ONOS" + controllerStr +
" links view is incorrect" )
- devicesResults = devicesResults and currentDevicesResult
- portsResults = portsResults and currentPortsResult
- linksResults = linksResults and currentLinksResult
+ if hosts[ controller ] or "Error" not in hosts[ controller ]:
+ currentHostsResult = main.Mininet1.compareHosts(
+ mnHosts,
+ hosts[ controller ] )
+ else:
+ currentHostsResult = main.FALSE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=currentHostsResult,
+ onpass="ONOS" + controllerStr +
+ " hosts exist in Mininet",
+ onfail="ONOS" + controllerStr +
+ " hosts don't match Mininet" )
- topoResult = ( devicesResults and portsResults and linksResults
- and consistentHostsResult and consistentClustersResult
- and clusterResults and ipResult )
- utilities.assert_equals( expect=main.TRUE, actual=topoResult,
- onpass="Topology Check Test successful",
- onfail="Topology Check Test NOT successful" )
+ devicesResults = devicesResults and currentDevicesResult
+ linksResults = linksResults and currentLinksResult
+ hostsResults = hostsResults and currentHostsResult
+
+ main.step( "Device information is correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=devicesResults,
+ onpass="Device information is correct",
+ onfail="Device information is incorrect" )
+
+ main.step( "Links are correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=linksResults,
+ onpass="Link are correct",
+ onfail="Links are incorrect" )
+
+ main.step( "Hosts are correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=hostsResults,
+ onpass="Hosts are correct",
+ onfail="Hosts are incorrect" )
def CASE6( self, main ):
"""
@@ -1983,11 +1990,6 @@
"""
Compare topo
"""
- import sys
- # FIXME add this path to params
- sys.path.append( "/home/admin/sts" )
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
import json
import time
assert numControllers, "numControllers not defined"
@@ -1999,25 +2001,9 @@
main.case( "Compare ONOS Topology view to Mininet topology" )
main.caseExplaination = "Compare topology objects between Mininet" +\
" and ONOS"
- main.step( "Create TestONTopology object" )
- try:
- ctrls = []
- for node in nodes:
- temp = ( node, node.name, node.ip_address, 6633 )
- ctrls.append( temp )
- MNTopo = TestONTopology( main.Mininet1, ctrls )
- except Exception:
- objResult = main.FALSE
- else:
- objResult = main.TRUE
- utilities.assert_equals( expect=main.TRUE, actual=objResult,
- onpass="Created TestONTopology object",
- onfail="Exception while creating " +
- "TestONTopology object" )
main.step( "Comparing ONOS topology to MN" )
devicesResults = main.TRUE
- portsResults = main.TRUE
linksResults = main.TRUE
hostsResults = main.TRUE
hostAttachmentResults = True
@@ -2029,9 +2015,6 @@
# Give time for Gossip to work
while topoResult == main.FALSE and elapsed < 60:
count += 1
- if count > 1:
- # TODO: Deprecate STS usage
- MNTopo = TestONTopology( main.Mininet1, ctrls )
cliStart = time.time()
devices = []
threads = []
@@ -2112,13 +2095,19 @@
print "Elapsed time: " + str( elapsed )
print "CLI time: " + str( cliTime )
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
+ mnHosts = main.Mininet1.getHosts()
for controller in range( numControllers ):
controllerStr = str( controller + 1 )
- if devices[ controller ] or "Error" not in devices[
- controller ]:
+ if devices[ controller ] and ports[ controller ] and\
+ "Error" not in devices[ controller ] and\
+ "Error" not in ports[ controller ]:
+
currentDevicesResult = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices[ controller ] ) )
+ mnSwitches,
+ json.loads( devices[ controller ] ),
+ json.loads( ports[ controller ] ) )
else:
currentDevicesResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -2128,23 +2117,10 @@
onfail="ONOS" + controllerStr +
" Switches view is incorrect" )
- if ports[ controller ] or "Error" not in ports[ controller ]:
- currentPortsResult = main.Mininet1.comparePorts(
- MNTopo,
- json.loads( ports[ controller ] ) )
- else:
- currentPortsResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentPortsResult,
- onpass="ONOS" + controllerStr +
- " ports view is correct",
- onfail="ONOS" + controllerStr +
- " ports view is incorrect" )
-
- if links[ controller ] or "Error" not in links[ controller ]:
+ if links[ controller ] and "Error" not in links[ controller ]:
currentLinksResult = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links[ controller ] ) )
+ mnSwitches, mnLinks,
+ json.loads( links[ controller ] ) )
else:
currentLinksResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -2156,7 +2132,8 @@
if hosts[ controller ] or "Error" not in hosts[ controller ]:
currentHostsResult = main.Mininet1.compareHosts(
- MNTopo, hosts[ controller ] )
+ mnHosts,
+ hosts[ controller ] )
else:
currentHostsResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -2167,7 +2144,7 @@
" hosts don't match Mininet" )
# CHECKING HOST ATTACHMENT POINTS
hostAttachment = True
- noHosts = False
+ zeroHosts = False
# FIXME: topo-HA/obelisk specific mappings:
# key is mac and value is dpid
mappings = {}
@@ -2200,7 +2177,7 @@
if hosts[ controller ] or "Error" not in hosts[ controller ]:
if hosts[ controller ] == []:
main.log.warn( "There are no hosts discovered" )
- noHosts = True
+ zeroHosts = True
else:
for host in hosts[ controller ]:
mac = None
@@ -2244,15 +2221,18 @@
main.log.error( "No hosts json output or \"Error\"" +
" in output. hosts = " +
repr( hosts[ controller ] ) )
- if noHosts is False:
+ if zeroHosts is False:
hostAttachment = True
# END CHECKING HOST ATTACHMENT POINTS
devicesResults = devicesResults and currentDevicesResult
- portsResults = portsResults and currentPortsResult
linksResults = linksResults and currentLinksResult
hostsResults = hostsResults and currentHostsResult
- hostAttachmentResults = hostAttachmentResults and hostAttachment
+ hostAttachmentResults = hostAttachmentResults and\
+ hostAttachment
+ topoResult = ( devicesResults and linksResults
+ and hostsResults and ipResult and
+ hostAttachmentResults )
# Compare json objects for hosts and dataplane clusters
@@ -2341,7 +2321,7 @@
onpass="ONOS shows 1 SCC",
onfail="ONOS shows " + str( numClusters ) + " SCCs" )
- topoResult = ( devicesResults and portsResults and linksResults
+ topoResult = ( devicesResults and linksResults
and hostsResults and consistentHostsResult
and consistentClustersResult and clusterResults
and ipResult and hostAttachmentResults )
@@ -2362,13 +2342,6 @@
onpass="Device information is correct",
onfail="Device information is incorrect" )
- main.step( "Port information is correct" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=portsResults,
- onpass="Port information is correct",
- onfail="Port information is incorrect" )
-
main.step( "Links are correct" )
utilities.assert_equals(
expect=main.TRUE,
@@ -2376,6 +2349,13 @@
onpass="Link are correct",
onfail="Links are incorrect" )
+ main.step( "Hosts are correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=hostsResults,
+ onpass="Hosts are correct",
+ onfail="Hosts are incorrect" )
+
# FIXME: move this to an ONOS state case
main.step( "Checking ONOS nodes" )
nodesOutput = []
@@ -2538,22 +2518,10 @@
main.Mininet1.addSwitch( switch, dpid=switchDPID )
for peer in links:
main.Mininet1.addLink( switch, peer )
- main.Mininet1.assignSwController( sw=switch.split( 's' )[ 1 ],
- count=numControllers,
- ip1=nodes[ 0 ].ip_address,
- port1=ONOS1Port,
- ip2=nodes[ 1 ].ip_address,
- port2=ONOS2Port,
- ip3=nodes[ 2 ].ip_address,
- port3=ONOS3Port,
- ip4=nodes[ 3 ].ip_address,
- port4=ONOS4Port,
- ip5=nodes[ 4 ].ip_address,
- port5=ONOS5Port,
- ip6=nodes[ 5 ].ip_address,
- port6=ONOS6Port,
- ip7=nodes[ 6 ].ip_address,
- port7=ONOS7Port )
+ ipList = []
+ for i in range( numControllers ):
+ ipList.append( nodes[ i ].ip_address )
+ main.Mininet1.assignSwController( sw=switch, ip=ipList )
main.log.info( "Waiting " + str( switchSleep ) +
" seconds for switch up to be discovered" )
time.sleep( switchSleep )
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
index f77ca3d..4dcf0dd 100644
--- a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
@@ -233,10 +233,13 @@
"master of the device."
main.step( "Assign switches to controllers" )
+ ipList = []
+ for i in range( numControllers ):
+ ipList.append( nodes[ i ].ip_address )
+ swList = []
for i in range( 1, 29 ):
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip, port1=ONOS1Port )
+ swList.append( "s" + str( i ) )
+ main.Mininet1.assignSwController( sw=swList, ip=ipList )
mastershipCheck = main.TRUE
for i in range( 1, 29 ):
@@ -386,12 +389,13 @@
for i in range(2): # Retry if pingall fails first time
time1 = time.time()
pingResult = main.Mininet1.pingall()
- utilities.assert_equals(
- expect=main.TRUE,
- actual=pingResult,
- onpass="Reactive Pingall test passed",
- onfail="Reactive Pingall failed, " +
- "one or more ping pairs failed" )
+ if i == 0:
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=pingResult,
+ onpass="Reactive Pingall test passed",
+ onfail="Reactive Pingall failed, " +
+ "one or more ping pairs failed" )
time2 = time.time()
main.log.info( "Time for pingall: %2f seconds" %
( time2 - time1 ) )
@@ -468,7 +472,6 @@
pass # intent submitted is in onos
else:
intentAddResult = False
- # FIXME: DEBUG
if intentAddResult:
intentStop = time.time()
else:
@@ -502,6 +505,7 @@
( str( count ), str( i ), str( s ) ) )
leaders = main.ONOScli1.leaders()
try:
+ missing = False
if leaders:
parsedLeaders = json.loads( leaders )
main.log.warn( json.dumps( parsedLeaders,
@@ -518,11 +522,18 @@
if topic not in ONOStopics:
main.log.error( "Error: " + topic +
" not in leaders" )
+ missing = True
else:
main.log.error( "leaders() returned None" )
except ( ValueError, TypeError ):
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
+ # Check all nodes
+ if missing:
+ response = main.ONOScli1.leaders( jsonFormat=False)
+ main.log.warn( "ONOS1 leaders output: \n" +
+ str( response ) )
+
partitions = main.ONOScli1.partitions()
try:
if partitions :
@@ -569,7 +580,17 @@
main.log.debug( "Intents in " + cli.name + ": " +
str( sorted( onosIds ) ) )
if sorted( ids ) != sorted( intentIds ):
+ main.log.warn( "Set of intent IDs doesn't match" )
correct = False
+ break
+ else:
+ intents = json.loads( cli.intents() )
+ for intent in intents:
+ if intent[ 'state' ] != "INSTALLED":
+ main.log.warn( "Intent " + intent[ 'id' ] +
+ " is " + intent[ 'state' ] )
+ correct = False
+ break
if correct:
break
else:
@@ -625,6 +646,7 @@
( str( count ), str( i ), str( s ) ) )
leaders = main.ONOScli1.leaders()
try:
+ missing = False
if leaders:
parsedLeaders = json.loads( leaders )
main.log.warn( json.dumps( parsedLeaders,
@@ -644,11 +666,17 @@
if topic not in ONOStopics:
main.log.error( "Error: " + topic +
" not in leaders" )
+ missing = True
else:
main.log.error( "leaders() returned None" )
except ( ValueError, TypeError ):
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
+ # Check all nodes
+ if missing:
+ response = main.ONOScli1.leaders( jsonFormat=False)
+ main.log.warn( "ONOS1 leaders output: \n" +
+ str( response ) )
partitions = main.ONOScli1.partitions()
try:
if partitions :
@@ -846,6 +874,7 @@
( str( count ), str( i ), str( s ) ) )
leaders = main.ONOScli1.leaders()
try:
+ missing = False
if leaders:
parsedLeaders = json.loads( leaders )
main.log.warn( json.dumps( parsedLeaders,
@@ -865,11 +894,16 @@
if topic not in ONOStopics:
main.log.error( "Error: " + topic +
" not in leaders" )
+ missing = True
else:
main.log.error( "leaders() returned None" )
except ( ValueError, TypeError ):
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
+ if missing:
+ response = main.ONOScli1.leaders( jsonFormat=False)
+ main.log.warn( "ONOS1 leaders output: \n" +
+ str( response ) )
partitions = main.ONOScli1.partitions()
try:
if partitions :
@@ -941,8 +975,6 @@
assert numControllers, "numControllers not defined"
assert main, "main not defined"
assert utilities.assert_equals, "utilities.assert_equals not defined"
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
main.case( "Setting up and gathering data for current state" )
# The general idea for this test case is to pull the state of
@@ -1008,12 +1040,6 @@
main.log.warn( table )
# TODO: Compare switch flow tables with ONOS flow tables
- main.step( "Create TestONTopology object" )
- ctrls = []
- temp = ( nodes[0], nodes[0].name, nodes[0].ip_address, 6633 )
- ctrls.append( temp )
- MNTopo = TestONTopology( main.Mininet1, ctrls )
-
main.step( "Collecting topology information from ONOS" )
devices = []
devices.append( main.ONOScli1.devices() )
@@ -1060,15 +1086,21 @@
main.step( "Comparing ONOS topology to MN" )
devicesResults = main.TRUE
- portsResults = main.TRUE
linksResults = main.TRUE
hostsResults = main.TRUE
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
+ mnHosts = main.Mininet1.getHosts()
for controller in range( numControllers ):
controllerStr = str( controller + 1 )
- if devices[ controller ] or "Error" not in devices[ controller ]:
+ if devices[ controller ] and ports[ controller ] and\
+ "Error" not in devices[ controller ] and\
+ "Error" not in ports[ controller ]:
+
currentDevicesResult = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices[ controller ] ) )
+ mnSwitches,
+ json.loads( devices[ controller ] ),
+ json.loads( ports[ controller ] ) )
else:
currentDevicesResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -1077,24 +1109,10 @@
" Switches view is correct",
onfail="ONOS" + controllerStr +
" Switches view is incorrect" )
-
- if ports[ controller ] or "Error" not in ports[ controller ]:
- currentPortsResult = main.Mininet1.comparePorts(
- MNTopo,
- json.loads( ports[ controller ] ) )
- else:
- currentPortsResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentPortsResult,
- onpass="ONOS" + controllerStr +
- " ports view is correct",
- onfail="ONOS" + controllerStr +
- " ports view is incorrect" )
-
- if links[ controller ] or "Error" not in links[ controller ]:
+ if links[ controller ] and "Error" not in links[ controller ]:
currentLinksResult = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links[ controller ] ) )
+ mnSwitches, mnLinks,
+ json.loads( links[ controller ] ) )
else:
currentLinksResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -1106,7 +1124,8 @@
if hosts[ controller ] or "Error" not in hosts[ controller ]:
currentHostsResult = main.Mininet1.compareHosts(
- MNTopo, hosts[ controller ] )
+ mnHosts,
+ hosts[ controller ] )
else:
currentHostsResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -1117,15 +1136,29 @@
" hosts don't match Mininet" )
devicesResults = devicesResults and currentDevicesResult
- portsResults = portsResults and currentPortsResult
linksResults = linksResults and currentLinksResult
hostsResults = hostsResults and currentHostsResult
- topoResult = devicesResults and portsResults and linksResults\
- and clusterResults and ipResult and hostsResults
- utilities.assert_equals( expect=main.TRUE, actual=topoResult,
- onpass="Topology Check Test successful",
- onfail="Topology Check Test NOT successful" )
+ main.step( "Device information is correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=devicesResults,
+ onpass="Device information is correct",
+ onfail="Device information is incorrect" )
+
+ main.step( "Links are correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=linksResults,
+ onpass="Link are correct",
+ onfail="Links are incorrect" )
+
+ main.step( "Hosts are correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=hostsResults,
+ onpass="Hosts are correct",
+ onfail="Hosts are incorrect" )
def CASE6( self, main ):
"""
@@ -1250,7 +1283,6 @@
main.log.warn( "ONOS1 intents response: " + repr( ONOS1Intents ) )
else:
intentCheck = main.TRUE
- main.log.error( "Intents are consistent across all ONOS nodes" )
utilities.assert_equals(
expect=main.TRUE,
actual=intentCheck,
@@ -1375,11 +1407,6 @@
"""
Compare topo
"""
- import sys
- # FIXME add this path to params
- sys.path.append( "/home/admin/sts" )
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
import json
import time
assert numControllers, "numControllers not defined"
@@ -1389,27 +1416,12 @@
main.case( "Compare ONOS Topology view to Mininet topology" )
main.caseExplaination = "Compare topology objects between Mininet" +\
" and ONOS"
- main.step( "Create TestONTopology object" )
- try:
- ctrls = []
- node = main.ONOS1
- temp = ( node, node.name, node.ip_address, 6633 )
- ctrls.append( temp )
- MNTopo = TestONTopology( main.Mininet1, ctrls )
- except Exception:
- objResult = main.FALSE
- else:
- objResult = main.TRUE
- utilities.assert_equals( expect=main.TRUE, actual=objResult,
- onpass="Created TestONTopology object",
- onfail="Exception while creating " +
- "TestONTopology object" )
main.step( "Comparing ONOS topology to MN" )
devicesResults = main.TRUE
- portsResults = main.TRUE
linksResults = main.TRUE
hostsResults = main.TRUE
+ hostAttachmentResults = True
topoResult = main.FALSE
elapsed = 0
count = 0
@@ -1418,9 +1430,6 @@
# Give time for Gossip to work
while topoResult == main.FALSE and elapsed < 60:
count += 1
- if count > 1:
- # TODO: Deprecate STS usage
- MNTopo = TestONTopology( main.Mininet1, ctrls )
cliStart = time.time()
devices = []
devices.append( main.ONOScli1.devices() )
@@ -1446,13 +1455,19 @@
cliTime = time.time() - cliStart
print "CLI time: " + str( cliTime )
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
+ mnHosts = main.Mininet1.getHosts()
for controller in range( numControllers ):
controllerStr = str( controller + 1 )
- if devices[ controller ] or "Error" not in devices[
- controller ]:
+ if devices[ controller ] and ports[ controller ] and\
+ "Error" not in devices[ controller ] and\
+ "Error" not in ports[ controller ]:
+
currentDevicesResult = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices[ controller ] ) )
+ mnSwitches,
+ json.loads( devices[ controller ] ),
+ json.loads( ports[ controller ] ) )
else:
currentDevicesResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -1462,23 +1477,10 @@
onfail="ONOS" + controllerStr +
" Switches view is incorrect" )
- if ports[ controller ] or "Error" not in ports[ controller ]:
- currentPortsResult = main.Mininet1.comparePorts(
- MNTopo,
- json.loads( ports[ controller ] ) )
- else:
- currentPortsResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentPortsResult,
- onpass="ONOS" + controllerStr +
- " ports view is correct",
- onfail="ONOS" + controllerStr +
- " ports view is incorrect" )
-
- if links[ controller ] or "Error" not in links[ controller ]:
+ if links[ controller ] and "Error" not in links[ controller ]:
currentLinksResult = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links[ controller ] ) )
+ mnSwitches, mnLinks,
+ json.loads( links[ controller ] ) )
else:
currentLinksResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -1490,7 +1492,8 @@
if hosts[ controller ] or "Error" not in hosts[ controller ]:
currentHostsResult = main.Mininet1.compareHosts(
- MNTopo, hosts[ controller ] )
+ mnHosts,
+ hosts[ controller ] )
else:
currentHostsResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
@@ -1499,11 +1502,94 @@
" hosts exist in Mininet",
onfail="ONOS" + controllerStr +
" hosts don't match Mininet" )
+ # CHECKING HOST ATTACHMENT POINTS
+ hostAttachment = True
+ zeroHosts = False
+ # FIXME: topo-HA/obelisk specific mappings:
+ # key is mac and value is dpid
+ mappings = {}
+ for i in range( 1, 29 ): # hosts 1 through 28
+ # set up correct variables:
+ macId = "00:" * 5 + hex( i ).split( "0x" )[1].upper().zfill(2)
+ if i == 1:
+ deviceId = "1000".zfill(16)
+ elif i == 2:
+ deviceId = "2000".zfill(16)
+ elif i == 3:
+ deviceId = "3000".zfill(16)
+ elif i == 4:
+ deviceId = "3004".zfill(16)
+ elif i == 5:
+ deviceId = "5000".zfill(16)
+ elif i == 6:
+ deviceId = "6000".zfill(16)
+ elif i == 7:
+ deviceId = "6007".zfill(16)
+ elif i >= 8 and i <= 17:
+ dpid = '3' + str( i ).zfill( 3 )
+ deviceId = dpid.zfill(16)
+ elif i >= 18 and i <= 27:
+ dpid = '6' + str( i ).zfill( 3 )
+ deviceId = dpid.zfill(16)
+ elif i == 28:
+ deviceId = "2800".zfill(16)
+ mappings[ macId ] = deviceId
+ if hosts[ controller ] or "Error" not in hosts[ controller ]:
+ if hosts[ controller ] == []:
+ main.log.warn( "There are no hosts discovered" )
+ zeroHosts = True
+ else:
+ for host in hosts[ controller ]:
+ mac = None
+ location = None
+ device = None
+ port = None
+ try:
+ mac = host.get( 'mac' )
+ assert mac, "mac field could not be found for this host object"
+
+ location = host.get( 'location' )
+ assert location, "location field could not be found for this host object"
+
+ # Trim the protocol identifier off deviceId
+ device = str( location.get( 'elementId' ) ).split(':')[1]
+ assert device, "elementId field could not be found for this host location object"
+
+ port = location.get( 'port' )
+ assert port, "port field could not be found for this host location object"
+
+ # Now check if this matches where they should be
+ if mac and device and port:
+ if str( port ) != "1":
+ main.log.error( "The attachment port is incorrect for " +
+ "host " + str( mac ) +
+ ". Expected: 1 Actual: " + str( port) )
+ hostAttachment = False
+ if device != mappings[ str( mac ) ]:
+ main.log.error( "The attachment device is incorrect for " +
+ "host " + str( mac ) +
+ ". Expected: " + mappings[ str( mac ) ] +
+ " Actual: " + device )
+ hostAttachment = False
+ else:
+ hostAttachment = False
+ except AssertionError:
+ main.log.exception( "Json object not as expected" )
+ main.log.error( repr( host ) )
+ hostAttachment = False
+ else:
+ main.log.error( "No hosts json output or \"Error\"" +
+ " in output. hosts = " +
+ repr( hosts[ controller ] ) )
+ if zeroHosts is False:
+ hostAttachment = True
+
devicesResults = devicesResults and currentDevicesResult
- portsResults = portsResults and currentPortsResult
linksResults = linksResults and currentLinksResult
hostsResults = hostsResults and currentHostsResult
+ hostAttachmentResults = hostAttachmentResults and\
+ hostAttachment
# "consistent" results don't make sense for single instance
# there should always only be one cluster
@@ -1517,8 +1603,9 @@
onpass="ONOS shows 1 SCC",
onfail="ONOS shows " + str( numClusters ) + " SCCs" )
- topoResult = ( devicesResults and portsResults and linksResults
- and hostsResults and ipResult and clusterResults )
+ topoResult = ( devicesResults and linksResults
+ and hostsResults and ipResult and clusterResults and
+ hostAttachmentResults )
topoResult = topoResult and int( count <= 2 )
note = "note it takes about " + str( int( cliTime ) ) + \
@@ -1646,9 +1733,10 @@
main.Mininet1.addSwitch( switch, dpid=switchDPID )
for peer in links:
main.Mininet1.addLink( switch, peer )
- main.Mininet1.assignSwController( sw=switch.split( 's' )[ 1 ],
- ip1=ONOS1Ip,
- port1=ONOS1Port )
+ ipList = []
+ for i in range( numControllers ):
+ ipList.append( nodes[ i ].ip_address )
+ main.Mininet1.assignSwController( sw=switch, ip=ipList )
main.log.info( "Waiting " + str( switchSleep ) +
" seconds for switch up to be discovered" )
time.sleep( switchSleep )
diff --git a/TestON/tests/IntentEventTP/IntentEventTP.py b/TestON/tests/IntentEventTP/IntentEventTP.py
index 9682507..44178b2 100644
--- a/TestON/tests/IntentEventTP/IntentEventTP.py
+++ b/TestON/tests/IntentEventTP/IntentEventTP.py
@@ -87,7 +87,10 @@
clusterCount = int(scale[0])
scale.remove(scale[0])
-
+
+ MN1Ip = ONOSIp[len(ONOSIp) -1]
+ BENCHIp = ONOSIp[len(ONOSIp) -2]
+
#kill off all onos processes
main.log.step("Safety check, killing all ONOS processes")
main.log.step("before initiating enviornment setup")
@@ -108,7 +111,7 @@
cellIp = []
for node in range (1, clusterCount + 1):
cellIp.append(ONOSIp[node])
-
+
main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
main.step( "Set Cell" )
diff --git a/TestON/tests/IntentPerfNext/Dependency/IntentClass.py b/TestON/tests/IntentPerfNext/Dependency/IntentClass.py
deleted file mode 100644
index f5b17c2..0000000
--- a/TestON/tests/IntentPerfNext/Dependency/IntentClass.py
+++ /dev/null
@@ -1,56 +0,0 @@
-
-def __init__(self):
- self_ = self
-
-def printLog(main):
- main.log.info("Print log success")
-
-def iptablesDropAllNodes(main, MN_ip, sw_port):
- #INPUT RULES
- main.ONOS1.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
- main.ONOS2.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
- main.ONOS3.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
- main.ONOS4.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
- main.ONOS5.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
- main.ONOS6.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
- main.ONOS7.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
-
- main.ONOS1.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
- main.ONOS2.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
- main.ONOS3.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
- main.ONOS4.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
- main.ONOS5.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
- main.ONOS6.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
- main.ONOS7.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s "+
- MN_ip+" --dport "+sw_port+" -j DROP")
-
-def uninstallAllNodes(main, node_ip_list):
- for node in node_ip_list:
- main.ONOSbench.onos_uninstall(node_ip = node)
diff --git a/TestON/tests/IntentPerfNext/Dependency/__init__.py b/TestON/tests/IntentPerfNext/Dependency/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/IntentPerfNext/Dependency/__init__.py
+++ /dev/null
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.params b/TestON/tests/IntentPerfNext/IntentPerfNext.params
deleted file mode 100644
index 90ef160..0000000
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.params
+++ /dev/null
@@ -1,62 +0,0 @@
-<PARAMS>
- <testcases>1,4,5,4,5,4,5,4</testcases>
-
- <ENV>
- <cellName>intent_perf_test</cellName>
- </ENV>
-
- <GIT>
- #autoPull 'on' or 'off'
- <autoPull>off</autoPull>
- <checkout>master</checkout>
- </GIT>
-
- <CTRL>
- <user>admin</user>
- <ip1>10.128.174.1</ip1>
- <port1>6633</port1>
- <ip2>10.128.174.2</ip2>
- <port2>6633</port2>
- <ip3>10.128.174.3</ip3>
- <port3>6633</port3>
- <ip4>10.128.174.4</ip4>
- <ip5>10.128.174.5</ip5>
- <ip6>10.128.174.6</ip6>
- <ip7>10.128.174.7</ip7>
- </CTRL>
-
- <MN>
- <ip1>10.128.10.90</ip1>
- <ip2>10.128.10.91</ip2>
- </MN>
-
- <BENCH>
- <ip>10.128.174.10</ip>
- </BENCH>
-
- <TEST>
- #Number of times to iterate each case
- <numIter>8</numIter>
- <numIgnore>2</numIgnore>
- <numSwitch>8</numSwitch>
- <batchThresholdMin>0</batchThresholdMin>
- <batchThresholdMax>1000</batchThresholdMax>
- <batchIntentSize>1</batchIntentSize>
- <numMult>1</numMult>
- #Interface to bring down for intent reroute case
- <intfs>s3-eth2</intfs>
- </TEST>
-
- <DB>
- <intentFilePath>
- /home/admin/ONLabTest/TestON/tests/IntentPerfNext/intentLatencyResultDb.log
- </intentFilePath>
- </DB>
-
- <JSON>
- <submittedTime>intentSubmittedTimestamp</submittedTime>
- <installedTime>intentInstalledTimestamp</installedTime>
- <wdRequestTime>intentWithdrawRequestedTimestamp</wdRequestTime>
- <withdrawnTime>intentWithdrawnTimestamp</withdrawnTime>
- </JSON>
-</PARAMS>
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.py b/TestON/tests/IntentPerfNext/IntentPerfNext.py
deleted file mode 100644
index cb226e7..0000000
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.py
+++ /dev/null
@@ -1,1284 +0,0 @@
-# Intent Performance Test for ONOS-next
-#
-# andrew@onlab.us
-#
-# November 5, 2014
-
-
-class IntentPerfNext:
-
- def __init__( self ):
- self.default = ""
-
- def CASE1( self, main ):
- """
- ONOS startup sequence
- """
- import time
- global clusterCount
- global timeToPost
- global runNum
-
- clusterCount = 1
- timeToPost = time.strftime("%Y-%m-%d %H:%M:%S")
- runNum = time.strftime("%d%H%M%S")
-
- cellName = main.params[ 'ENV' ][ 'cellName' ]
-
- gitPull = main.params[ 'GIT' ][ 'autoPull' ]
- checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
- intentFilePath = main.params[ 'DB' ][ 'intentFilePath' ]
-
- ONOSIp = []
- for i in range(1, 8):
- ONOSIp.append(main.params[ 'CTRL' ][ 'ip'+str(i) ])
- main.ONOSbench.onosUninstall( nodeIp = ONOSIp[i-1] )
-
- MN1Ip = main.params[ 'MN' ][ 'ip1' ]
- BENCHIp = main.params[ 'BENCH' ][ 'ip' ]
-
- main.case( "Setting up test environment" )
-
- main.step( "Clearing previous DB log file" )
- fIntentLog = open(intentFilePath, 'w')
- # Overwrite with empty line and close
- fIntentLog.write('')
- fIntentLog.close()
-
- main.step( "Starting mininet topology" )
- main.Mininet1.startNet()
-
- main.step( "Creating cell file" )
- cellFileResult = main.ONOSbench.createCellFile(
- BENCHIp, cellName, MN1Ip,
- ("onos-core,webconsole,onos-api,onos-app-metrics,onos-gui,"
- "onos-cli,onos-openflow"),
- ONOSIp[0] )
-
- main.step( "Applying cell file to environment" )
- cellApplyResult = main.ONOSbench.setCell( cellName )
- verifyCellResult = main.ONOSbench.verifyCell()
-
- main.step( "Removing raft logs" )
- main.ONOSbench.onosRemoveRaftLogs()
-
- main.step( "Git checkout and pull " + checkoutBranch )
- if gitPull == 'on':
- checkoutResult = \
- main.ONOSbench.gitCheckout( checkoutBranch )
- pullResult = main.ONOSbench.gitPull()
-
- # If you used git pull, auto compile
- main.step( "Using onos-build to compile ONOS" )
- buildResult = main.ONOSbench.onosBuild()
- else:
- checkoutResult = main.TRUE
- pullResult = main.TRUE
- buildResult = main.TRUE
- main.log.info( "Git pull skipped by configuration" )
-
- main.log.report( "Commit information - " )
- main.ONOSbench.getVersion( report=True )
-
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
-
- main.step( "Installing ONOS package" )
- install1Result = main.ONOSbench.onosInstall( node=ONOSIp[0] )
-
- main.step( "Set cell for ONOScli env" )
- main.ONOS1cli.setCell( cellName )
-
- time.sleep( 5 )
-
- main.step( "Start onos cli" )
- cli1 = main.ONOS1cli.startOnosCli( ONOSIp[0] )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=cellFileResult and cellApplyResult and
- verifyCellResult and checkoutResult and
- pullResult and buildResult and
- install1Result, # and install2Result and
- # install3Result,
- onpass="ONOS started successfully",
- onfail="Failed to start ONOS" )
-
- def CASE2( self, main ):
- """
- Single intent add latency
-
- """
- import time
- import json
- import requests
- import os
- import numpy
- global clusterCount
-
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
- ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
- ONOSIpList = []
- for i in range( 1, 8 ):
- ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
-
- ONOSUser = main.params[ 'CTRL' ][ 'user' ]
-
- defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
-
- # number of iterations of case
- numIter = main.params[ 'TEST' ][ 'numIter' ]
- numIgnore = int( main.params[ 'TEST' ][ 'numIgnore' ] )
-
- # Timestamp keys for json metrics output
- submitTime = main.params[ 'JSON' ][ 'submittedTime' ]
- installTime = main.params[ 'JSON' ][ 'installedTime' ]
- wdRequestTime = main.params[ 'JSON' ][ 'wdRequestTime' ]
- withdrawnTime = main.params[ 'JSON' ][ 'withdrawnTime' ]
-
- assertion = main.TRUE
-
- intentAddLatList = []
-
- # Distribute switches according to cluster count
- for i in range( 1, 9 ):
- if clusterCount == 1:
- main.Mininet1.assignSwController(
- sw=str( i ), ip1=ONOSIpList[ 0 ],
- port1=defaultSwPort
- )
- elif clusterCount == 3:
- if i < 3:
- index = 0
- elif i < 6 and i >= 3:
- index = 1
- else:
- index = 2
- main.Mininet1.assignSwController(
- sw=str( i ), ip1=ONOSIpList[ index ],
- port1=defaultSwPort
- )
- elif clusterCount == 5:
- if i < 3:
- index = 0
- elif i < 5 and i >= 3:
- index = 1
- elif i < 7 and i >= 5:
- index = 2
- elif i == 7:
- index = 3
- else:
- index = 4
- main.Mininet1.assignSwController(
- sw=str( i ), ip1=ONOSIpList[ index ],
- port1=defaultSwPort
- )
- elif clusterCount == 7:
- if i < 6:
- index = i
- else:
- index = 6
- main.Mininet1.assignSwController(
- sw=str( i ), ip1=ONOSIpList[ index ],
- port1=defaultSwPort
- )
-
- time.sleep( 10 )
-
- main.log.report( "Single intent add latency test" )
-
- devicesJsonStr = main.ONOS1cli.devices()
- devicesJsonObj = json.loads( devicesJsonStr )
-
- if not devicesJsonObj:
- main.log.report( "Devices not discovered" )
- main.log.report( "Aborting test" )
- main.exit()
- else:
- main.log.info( "Devices discovered successfully" )
-
- deviceIdList = []
-
- # Obtain device id list in ONOS format.
- # They should already be in order ( 1,2,3,10,11,12,13, etc )
- for device in devicesJsonObj:
- deviceIdList.append( device[ 'id' ] )
-
- for i in range( 0, int( numIter ) ):
- # addPointIntent( ingrDevice, egrDevice,
- # ingrPort, egrPort )
- main.ONOS1cli.addPointIntent(
- deviceIdList[ 0 ] + "/2", deviceIdList[ 7 ] + "/2" )
-
- # Allow some time for intents to propagate
- time.sleep( 5 )
-
- intentsStr = main.ONOS1cli.intents( jsonFormat=True )
- intentsObj = json.loads( intentsStr )
- for intent in intentsObj:
- if intent[ 'state' ] == "INSTALLED":
- main.log.info( "Intent installed successfully" )
- intentId = intent[ 'id' ]
- main.log.info( "Intent id: " + str( intentId ) )
- else:
- # TODO: Add error handling
- main.log.info( "Intent installation failed" )
- intentId = ""
-
- # Obtain metrics from ONOS 1, 2, 3
- intentsJsonStr1 = main.ONOS1cli.intentsEventsMetrics()
- intentsJsonObj1 = json.loads( intentsJsonStr1 )
- # Parse values from the json object
- intentSubmit1 = \
- intentsJsonObj1[ submitTime ][ 'value' ]
- intentInstall1 = \
- intentsJsonObj1[ installTime ][ 'value' ]
- intentInstallLat1 = \
- int( intentInstall1 ) - int( intentSubmit1 )
-
- if clusterCount == 3:
- intentsJsonStr2 = main.ONOS2cli.intentsEventsMetrics()
- intentsJsonStr3 = main.ONOS3cli.intentsEventsMetrics()
- intentsJsonObj2 = json.loads( intentsJsonStr2 )
- intentsJsonObj3 = json.loads( intentsJsonStr3 )
- intentSubmit2 = \
- intentsJsonObj2[ submitTime ][ 'value' ]
- intentSubmit3 = \
- intentsJsonObj3[ submitTime ][ 'value' ]
- intentInstall2 = \
- intentsJsonObj2[ installTime ][ 'value' ]
- intentInstall3 = \
- intentsJsonObj3[ installTime ][ 'value' ]
- intentInstallLat2 = \
- int( intentInstall2 ) - int( intentSubmit2 )
- intentInstallLat3 = \
- int( intentInstall3 ) - int( intentSubmit3 )
- else:
- intentInstallLat2 = 0
- intentInstallLat3 = 0
-
- if clusterCount == 5:
- intentsJsonStr4 = main.ONOS4cli.intentsEventsMetrics()
- intentsJsonStr5 = main.ONOS5cli.intentsEventsMetrics()
- intentsJsonObj4 = json.loads( intentsJsonStr4 )
- intentsJsonObj5 = json.loads( intentsJsonStr5 )
- intentSubmit4 = \
- intentsJsonObj4[ submitTime ][ 'value' ]
- intentSubmit5 = \
- intentsJsonObj5[ submitTime ][ 'value' ]
- intentInstall4 = \
- intentsJsonObj5[ installTime ][ 'value' ]
- intentInstall5 = \
- intentsJsonObj5[ installTime ][ 'value' ]
- intentInstallLat4 = \
- int( intentInstall4 ) - int( intentSubmit4 )
- intentInstallLat5 = \
- int( intentInstall5 ) - int( intentSubmit5 )
- else:
- intentInstallLat4 = 0
- intentInstallLat5 = 0
-
- if clusterCount == 7:
- intentsJsonStr6 = main.ONOS6cli.intentsEventsMetrics()
- intentsJsonStr7 = main.ONOS7cli.intentsEventsMetrics()
- intentsJsonObj6 = json.loads( intentsJsonStr6 )
- intentsJsonObj7 = json.loads( intentsJsonStr7 )
- intentSubmit6 = \
- intentsJsonObj6[ submitTime ][ 'value' ]
- intentSubmit7 = \
- intentsJsonObj6[ submitTime ][ 'value' ]
- intentInstall6 = \
- intentsJsonObj6[ installTime ][ 'value' ]
- intentInstall7 = \
- intentsJsonObj7[ installTime ][ 'value' ]
- intentInstallLat6 = \
- int( intentInstall6 ) - int( intentSubmit6 )
- intentInstallLat7 = \
- int( intentInstall7 ) - int( intentSubmit7 )
- else:
- intentInstallLat6 = 0
- intentInstallLat7 = 0
-
- intentInstallLatAvg = \
- ( intentInstallLat1 +
- intentInstallLat2 +
- intentInstallLat3 +
- intentInstallLat4 +
- intentInstallLat5 +
- intentInstallLat6 +
- intentInstallLat7 ) / clusterCount
-
- main.log.info( "Intent add latency avg for iteration " + str( i ) +
- ": " + str( intentInstallLatAvg ) + " ms" )
-
- if intentInstallLatAvg > 0.0 and \
- intentInstallLatAvg < 1000 and i > numIgnore:
- intentAddLatList.append( intentInstallLatAvg )
- else:
- main.log.info( "Intent add latency exceeded " +
- "threshold. Skipping iteration " + str( i ) )
-
- time.sleep( 3 )
-
- # TODO: Only remove intents that were installed
- # in this case... Otherwise many other intents
- # may show up distorting the results
- main.log.info( "Removing intents for next iteration" )
- jsonTemp = \
- main.ONOS1cli.intents( jsonFormat=True )
- jsonObjIntents = json.loads( jsonTemp )
- if jsonObjIntents:
- for intents in jsonObjIntents:
- tempId = intents[ 'id' ]
- # main.ONOS1cli.removeIntent( tempId )
- main.log.info( "Removing intent id: " +
- str( tempId ) )
- main.ONOS1cli.removeIntent( tempId )
- else:
- main.log.info( "Intents were not installed correctly" )
-
- time.sleep( 5 )
-
- if intentAddLatList:
- intentAddLatAvg = sum( intentAddLatList ) /\
- len( intentAddLatList )
- else:
- main.log.report( "Intent installation latency test failed" )
- intentAddLatAvg = "NA"
- assertion = main.FALSE
-
- intentAddLatStd = \
- round( numpy.std( intentAddLatList ), 1 )
- # END ITERATION FOR LOOP
- main.log.report( "Single intent add latency - " )
- main.log.report( "Avg: " + str( intentAddLatAvg ) + " ms" )
- main.log.report( "Std Deviation: " + str( intentAddLatStd ) + " ms" )
-
- utilities.assert_equals(
- expect=main.TRUE,
- actual=assertion,
- onpass="Single intent install latency test successful",
- onfail="Single intent install latency test failed" )
-
- def CASE3( self, main ):
- """
- Intent Reroute latency
- """
- import time
- import json
- import requests
- import os
- import numpy
- global clusterCount
-
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
- ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
- ONOSUser = main.params[ 'CTRL' ][ 'user' ]
-
- ONOSIpList = []
- for i in range( 1, 8 ):
- ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
-
- defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
-
- # number of iterations of case
- numIter = main.params[ 'TEST' ][ 'numIter' ]
- numIgnore = int( main.params[ 'TEST' ][ 'numIgnore' ] )
- assertion = main.TRUE
-
- # Timestamp keys for json metrics output
- submitTime = main.params[ 'JSON' ][ 'submittedTime' ]
- installTime = main.params[ 'JSON' ][ 'installedTime' ]
- wdRequestTime = main.params[ 'JSON' ][ 'wdRequestTime' ]
- withdrawnTime = main.params[ 'JSON' ][ 'withdrawnTime' ]
-
- # NOTE: May need to configure interface depending on topology
- intfs = main.params[ 'TEST' ][ 'intfs' ]
-
- # Distribute switches according to cluster count
- for i in range( 1, 9 ):
- if clusterCount == 1:
- main.Mininet1.assignSwController(
- sw=str( i ), ip1=ONOSIpList[ 0 ],
- port1=defaultSwPort
- )
- elif clusterCount == 3:
- if i < 3:
- index = 0
- elif i < 6 and i >= 3:
- index = 1
- else:
- index = 2
- main.Mininet1.assignSwController(
- sw=str( i ), ip1=ONOSIpList[ index ],
- port1=defaultSwPort
- )
- elif clusterCount == 5:
- if i < 3:
- index = 0
- elif i < 5 and i >= 3:
- index = 1
- elif i < 7 and i >= 5:
- index = 2
- elif i == 7:
- index = 3
- else:
- index = 4
- main.Mininet1.assignSwController(
- sw=str( i ), ip1=ONOSIpList[ index ],
- port1=defaultSwPort
- )
- elif clusterCount == 7:
- if i < 6:
- index = i
- else:
- index = 6
- main.Mininet1.assignSwController(
- sw=str( i ), ip1=ONOSIpList[ index ],
- port1=defaultSwPort
- )
-
- time.sleep(10)
-
- devicesJsonStr = main.ONOS1cli.devices()
- devicesJsonObj = json.loads( devicesJsonStr )
-
- deviceIdList = []
-
- # Obtain device id list in ONOS format.
- # They should already be in order ( 1,2,3,10,11,12,13, etc )
- for device in devicesJsonObj:
- deviceIdList.append( device[ 'id' ] )
-
- intentRerouteLatList = []
-
- for i in range( 0, int( numIter ) ):
- # addPointIntent( ingrDevice, ingrPort,
- # egrDevice, egrPort )
- if len( deviceIdList ) > 0:
- main.ONOS1cli.addPointIntent(
- deviceIdList[ 0 ] + "/2", deviceIdList[ 7 ] + "/2" )
- else:
- main.log.info( "Failed to fetch devices from ONOS" )
-
- time.sleep( 5 )
-
- intentsStr = main.ONOS1cli.intents( jsonFormat=True )
- intentsObj = json.loads( intentsStr )
- for intent in intentsObj:
- main.log.info(intent)
- if intent[ 'state' ] == "INSTALLED":
- main.log.info( "Intent installed successfully" )
- intentId = intent[ 'id' ]
- main.log.info( "Intent id: " + str( intentId ) )
- #else:
- #TODO: Add error handling
- #main.log.info( "Intent installation failed" )
- #intentId = ""
-
- main.log.info( "Disabling interface " + intfs )
- t0System = time.time() * 1000
- main.Mininet1.handle.sendline(
- "sh ifconfig " + intfs + " down" )
- main.Mininet1.handle.expect( "mininet>" )
-
- # TODO: Check for correct intent reroute
- time.sleep( 1 )
-
- # Obtain metrics from ONOS 1, 2, 3
- intentsJsonStr1 = main.ONOS1cli.intentsEventsMetrics()
- intentsJsonObj1 = json.loads( intentsJsonStr1 )
- # Parse values from the json object
- intentInstall1 = \
- intentsJsonObj1[ installTime ][ 'value' ]
- intentRerouteLat1 = \
- int( intentInstall1 ) - int( t0System )
-
- if clusterCount == 3:
- intentsJsonStr2 = main.ONOS2cli.intentsEventsMetrics()
- intentsJsonStr3 = main.ONOS3cli.intentsEventsMetrics()
-
- intentsJsonObj2 = json.loads( intentsJsonStr2 )
- intentsJsonObj3 = json.loads( intentsJsonStr3 )
- intentInstall2 = \
- intentsJsonObj2[ installTime ][ 'value' ]
- intentInstall3 = \
- intentsJsonObj3[ installTime ][ 'value' ]
- intentRerouteLat2 = \
- int( intentInstall2 ) - int( t0System )
- intentRerouteLat3 = \
- int( intentInstall3 ) - int( t0System )
- else:
- intentRerouteLat2 = 0
- intentRerouteLat3 = 0
-
- if clusterCount == 5:
- intentsJsonStr4 = main.ONOS4cli.intentsEventsMetrics()
- intentsJsonStr5 = main.ONOS5cli.intentsEventsMetrics()
-
- intentsJsonObj4 = json.loads( intentsJsonStr4 )
- intentsJsonObj5 = json.loads( intentsJsonStr5 )
- intentInstall4 = \
- intentsJsonObj4[ installTime ][ 'value' ]
- intentInstall5 = \
- intentsJsonObj5[ installTime ][ 'value' ]
- intentRerouteLat4 = \
- int( intentInstall4 ) - int( t0System )
- intentRerouteLat5 = \
- int( intentInstall5 ) - int( t0System )
- else:
- intentRerouteLat4 = 0
- intentRerouteLat5 = 0
-
- if clusterCount == 7:
- intentsJsonStr6 = main.ONOS6cli.intentsEventsMetrics()
- intentsJsonStr7 = main.ONOS7cli.intentsEventsMetrics()
-
- intentsJsonObj6 = json.loads( intentsJsonStr6 )
- intentsJsonObj7 = json.loads( intentsJsonStr7 )
- intentInstall6 = \
- intentsJsonObj6[ installTime ][ 'value' ]
- intentInstall7 = \
- intentsJsonObj7[ installTime ][ 'value' ]
- intentRerouteLat6 = \
- int( intentInstall6 ) - int( t0System )
- intentRerouteLat7 = \
- int( intentInstall7 ) - int( t0System )
- else:
- intentRerouteLat6 = 0
- intentRerouteLat7 = 0
-
- intentRerouteLatAvg = \
- ( intentRerouteLat1 +
- intentRerouteLat2 +
- intentRerouteLat3 +
- intentRerouteLat4 +
- intentRerouteLat5 +
- intentRerouteLat6 +
- intentRerouteLat7 ) / clusterCount
-
- main.log.info( "Intent reroute latency avg for iteration " +
- str( i ) + ": " + str( intentRerouteLatAvg )+ " ms")
-
- if intentRerouteLatAvg > 0.0 and \
- intentRerouteLatAvg < 1000 and i > numIgnore:
- intentRerouteLatList.append( intentRerouteLatAvg )
- else:
- main.log.info( "Intent reroute latency exceeded " +
- "threshold. Skipping iteration " + str( i ) )
-
- main.log.info( "Removing intents for next iteration" )
- main.ONOS1cli.removeIntent( intentId )
-
- main.log.info( "Bringing Mininet interface up for next " +
- "iteration" )
- main.Mininet1.handle.sendline(
- "sh ifconfig " + intfs + " up" )
- main.Mininet1.handle.expect( "mininet>" )
-
- if intentRerouteLatList:
- intentRerouteLatAvg = sum( intentRerouteLatList ) /\
- len( intentRerouteLatList )
- else:
- main.log.report( "Intent reroute test failed. Results NA" )
- intentRerouteLatAvg = "NA"
- # NOTE: fails test when list is empty
- assertion = main.FALSE
-
- intentRerouteLatStd = \
- round( numpy.std( intentRerouteLatList ), 1 )
- # END ITERATION FOR LOOP
- main.log.report( "Single intent reroute latency - " )
- main.log.report( "Avg: " + str( intentRerouteLatAvg ) + " ms" )
- main.log.report(
- "Std Deviation: " +
- str( intentRerouteLatStd ) +
- " ms" )
-
- utilities.assert_equals(
- expect=main.TRUE,
- actual=assertion,
- onpass="Single intent reroute latency test successful",
- onfail="Single intent reroute latency test failed" )
-
- def CASE4( self, main ):
- """
- Batch intent install
-
- Supports scale-out scenarios and increasing
- number of intents within each iteration
- """
- import time
- import json
- import requests
- import os
- import numpy
- global clusterCount
- global timeToPost
-
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
- ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
- ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ]
- ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ]
- ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ]
- ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ]
-
- assertion = main.TRUE
-
- ONOSIpList = []
- for i in range( 1, 8 ):
- ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
-
- ONOSUser = main.params[ 'CTRL' ][ 'user' ]
-
- defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
-
- batchIntentSize = int( main.params[ 'TEST' ][ 'batchIntentSize' ] )
- batchThreshMin = int( main.params[ 'TEST' ][ 'batchThresholdMin' ] )
- batchThreshMax = int( main.params[ 'TEST' ][ 'batchThresholdMax' ] )
-
- # number of iterations of case
- numIter = main.params[ 'TEST' ][ 'numIter' ]
- numIgnore = int( main.params[ 'TEST' ][ 'numIgnore' ] )
- numSwitch = int( main.params[ 'TEST' ][ 'numSwitch' ] )
- nThread = main.params[ 'TEST' ][ 'numMult' ]
- #nThread = 105
-
- # DB operation variables
- intentFilePath = main.params[ 'DB' ][ 'intentFilePath' ]
-
- # Switch assignment NOTE: hardcoded
- if clusterCount == 1:
- for i in range( 1, numSwitch + 1 ):
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=defaultSwPort )
- if clusterCount == 3:
- for i in range( 1, 3 ):
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=defaultSwPort )
- for i in range( 3, 6 ):
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS2Ip,
- port1=defaultSwPort )
- for i in range( 6, 9 ):
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS3Ip,
- port1=defaultSwPort )
- if clusterCount == 5:
- main.Mininet1.assignSwController(
- sw="1",
- ip1=ONOS1Ip,
- port1=defaultSwPort )
- main.Mininet1.assignSwController(
- sw="2",
- ip1=ONOS2Ip,
- port1=defaultSwPort )
- for i in range( 3, 6 ):
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS3Ip,
- port1=defaultSwPort )
- main.Mininet1.assignSwController(
- sw="6",
- ip1=ONOS4Ip,
- port1=defaultSwPort )
- main.Mininet1.assignSwController(
- sw="7",
- ip1=ONOS5Ip,
- port1=defaultSwPort )
- main.Mininet1.assignSwController(
- sw="8",
- ip1=ONOS5Ip,
- port1=defaultSwPort )
-
- if clusterCount == 7:
- for i in range( 1, 9 ):
- if i < 8:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOSIpList[ i - 1 ],
- port1=defaultSwPort )
- elif i >= 8:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOSIpList[ 6 ],
- port1=defaultSwPort )
-
- time.sleep( 20 )
-
- main.log.report( "Batch intent installation test of " +
- str( batchIntentSize ) + " intent(s)" )
-
- batchResultList = []
-
- main.log.info( "Getting list of available devices" )
- deviceIdList = []
- jsonStr = main.ONOS1cli.devices()
- jsonObj = json.loads( jsonStr )
- for device in jsonObj:
- deviceIdList.append( device[ 'id' ] )
-
- # List of install / witdhraw latencies for each batch
- batchInstallLat = []
- batchWithdrawLat = []
-
- sleepTime = 10
-
- baseDir = "/tmp/"
-
- # Batch size increase loop
- for batch in range( 0, 5 ):
- # Max intent install measurement of all nodes
- # Resets after each batch calculation
- maxInstallLat = []
- maxWithdrawLat = []
- # Max single intent install measurement of all nodes
- # For example, if batch size is 1000, result latency
- # will be divided by 1000
- maxSingleInstallLat = []
- maxSingleWithdrawLat = []
- # Statistical gathering loop over number of iterations
- for i in range( 0, int( numIter ) ):
- main.log.info( "Pushing " +
- str( int( batchIntentSize ) * int( nThread ) ) +
- " intents. Iteration " + str( i ) )
-
- for node in range( 1, clusterCount + 1 ):
- saveDir = baseDir + "batch_intent_" + str( node ) + ".txt"
- main.ONOSbench.pushTestIntentsShell(
- deviceIdList[ 0 ] + "/2",
- deviceIdList[ 7 ] + "/2",
- batchIntentSize,
- saveDir, ONOSIpList[ node - 1 ],
- numMult=nThread )
-
- # Wait sufficient time for intents to start
- # installing
- time.sleep( sleepTime )
-
- intent = ""
- counter = 300
- while len( intent ) > 0 and counter > 0:
- main.ONOS1cli.handle.sendline(
- "intents | wc -l" )
- main.ONOS1cli.handle.expect(
- "intents | wc -l" )
- main.ONOS1cli.handle.expect(
- "onos>" )
- intentTemp = main.ONOS1cli.handle.before()
- intent = main.ONOS1cli.intents()
- intent = json.loads( intent )
- counter = counter - 1
- time.sleep( 1 )
-
- time.sleep( 5 )
-
- for node in range( 1, clusterCount + 1 ):
- saveDir = baseDir + "batch_intent_" + str( node ) + ".txt"
- with open( saveDir ) as fOnos:
- lineCount = 0
- for line in fOnos:
- line_temp = ""
- main.log.info( "Line read: " + str( line ) )
- line_temp = line[ 1: ]
- line_temp = line_temp.split( ": " )
- #Prevent split method if line doesn't have
- #space
- if " " in str(line_temp):
- result = line_temp[ 1 ].split( " " )[ 0 ]
- else:
- main.log.warn( "Empty line read" )
- result = 0
- # TODO: add parameters before appending latency
- if lineCount == 0:
- if "Failure" in str(line):
- main.log.warn("Intent installation failed")
- result = 'NA'
- else:
- main.log.info("Install result: "+result)
- batchInstallLat.append( int( result ) )
- installResult = result
- elif lineCount == 1:
- if "Failure" in str(line):
- main.log.warn("Intent withdraw failed")
- result = 'NA'
- else:
- main.log.info("Withdraw result: "+result)
- batchWithdrawLat.append( int( result ) )
- withdrawResult = result
- else:
- main.log.warn("Invalid results: excess lines")
- installResult = 'NA'
- withdrawResult = 'NA'
- lineCount += 1
- main.log.info( "Batch install latency for ONOS" +
- str( node ) + " with " +
- str( batchIntentSize ) + "intents: " +
- str( installResult ) + " ms" )
- main.log.info( "Batch withdraw latency for ONOS" +
- str( node ) + " with " +
- str( batchIntentSize ) + "intents: " +
- str( withdrawResult ) + " ms" )
-
- main.log.info( "Single intent install latency ONOS" +
- str( node ) + " with " +
- str( batchIntentSize ) + "intents: " +
- str( float(installResult) /\
- int(batchIntentSize) ) + " ms" )
- main.log.info( "Single intent withdraw latency ONOS" +
- str( node ) + " with " +
- str( batchIntentSize ) + "intents: " +
- str( float(withdrawResult) /\
- int(batchIntentSize) ) + " ms" )
-
- #NOTE: END node loop
-
- if len( batchInstallLat ) > 0 and int( i ) > numIgnore:
- maxInstallLat.append( max( batchInstallLat ) )
- maxSingleInstallLat.append(
- max( batchInstallLat ) / int( batchIntentSize )
- )
- elif len( batchInstallLat ) == 0:
- # If I failed to read anything from the file,
- # increase the wait time before checking intents
- sleepTime += 30
- if len( batchWithdrawLat ) > 0 and int( i ) > numIgnore:
- maxWithdrawLat.append( max( batchWithdrawLat ) )
- maxSingleWithdrawLat.append(
- max( batchWithdrawLat ) / int( batchIntentSize )
- )
- batchInstallLat = []
- batchWithdrawLat = []
-
- # Sleep in between iterations
- time.sleep( 5 )
-
- #NOTE: END iteration loop
-
- if maxInstallLat:
- avgInstallLat = str( round( numpy.average(maxInstallLat)
- , 2 ))
- stdInstallLat = str( round(
- numpy.std(maxInstallLat), 2))
- avgSingleInstallLat = str( round(
- numpy.average(maxSingleInstallLat)
- , 3 ))
- stdSingleInstallLat = str( round(
- numpy.std(maxSingleInstallLat),
- 3 ))
- else:
- avgInstallLat = "NA"
- stdInstallLat = "NA"
- main.log.report( "Batch installation failed" )
- assertion = main.FALSE
-
- if maxWithdrawLat:
- avgWithdrawLat = str( round( numpy.average(maxWithdrawLat)
- , 2 ))
- stdWithdrawLat = str( round(
- numpy.std(maxWithdrawLat), 2))
- avgSingleWithdrawLat = str( round(
- numpy.average(maxSingleWithdrawLat)
- , 3 ))
- stdSingleWithdrawLat = str( round(
- numpy.std(maxSingleWithdrawLat),
- 3 ))
- else:
- avgWithdrawLat = "NA"
- stdWithdrawLat = "NA"
- main.log.report( "Batch withdraw failed" )
- assertion = main.FALSE
-
- main.log.report( "Avg of batch installation latency " +
- "of size " + str( batchIntentSize ) + ": " +
- str( avgInstallLat ) + " ms" )
- main.log.report( "Std Deviation of batch installation latency " +
- ": " +
- str( stdInstallLat ) + " ms" )
- main.log.report( "Avg of single installation latency " +
- "of size " + str( batchIntentSize ) + ": " +
- str( avgSingleInstallLat ) + " ms" )
- main.log.report( "Std Deviation of single installation latency " +
- ": " +
- str( stdSingleInstallLat ) + " ms" )
-
- main.log.report( "Avg of batch withdraw latency " +
- "of size " + str( batchIntentSize ) + ": " +
- str( avgWithdrawLat ) + " ms" )
- main.log.report( "Std Deviation of batch withdraw latency " +
- ": " +
- str( stdWithdrawLat ) + " ms" )
- main.log.report( "Avg of single withdraw latency " +
- "of size " + str( batchIntentSize ) + ": " +
- str( avgSingleWithdrawLat ) + " ms" )
- main.log.report( "Std Deviation of single withdraw latency " +
- ": " +
- str( stdSingleWithdrawLat ) + " ms" )
-
- dbCmd = (
- "INSERT INTO intents_latency_tests VALUES("
- "'"+timeToPost+"','intents_latency_results',"
- ""+runNum+","+str(clusterCount)+","+str(batchIntentSize)+","
- ""+str(avgInstallLat)+","+str(stdInstallLat)+","
- ""+str(avgWithdrawLat)+","+str(stdWithdrawLat)+");"
- )
-
- # Write result to file (which is posted to DB by jenkins)
- fResult = open(intentFilePath, 'a')
- if dbCmd:
- fResult.write(dbCmd+"\n")
- fResult.close()
-
- if batch == 0:
- batchIntentSize = 10
- elif batch == 1:
- batchIntentSize = 100
- elif batch == 2:
- batchIntentSize = 1000
- elif batch == 3:
- batchIntentSize = 2000
- if batch < 4:
- main.log.report( "Increasing batch intent size to " +
- str(batchIntentSize) )
-
- #NOTE: END batch loop
-
- #main.log.info( "Removing all intents for next test case" )
- #jsonTemp = main.ONOS1cli.intents( jsonFormat=True )
- #jsonObjIntents = json.loads( jsonTemp )
- # if jsonObjIntents:
- # for intents in jsonObjIntents:
- # tempId = intents[ 'id' ]
- # main.ONOS1cli.removeIntent( tempId )
- # main.ONOS1cli.removeIntent( tempId )
-
- utilities.assert_equals(
- expect=main.TRUE,
- actual=assertion,
- onpass="Batch intent install/withdraw test successful",
- onfail="Batch intent install/withdraw test failed" )
-
- def CASE5( self, main ):
- """
- Increase number of nodes and initiate CLI
- """
- import time
- import json
-
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
- ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
- ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ]
- ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ]
- ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ]
- ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ]
-
- global clusterCount
- clusterCount += 2
- main.log.report( "Increasing cluster size to " +
- str( clusterCount ) )
-
- installResult = main.FALSE
-
- if clusterCount == 3:
- installResult1 = \
- main.ONOSbench.onosInstall( node=ONOS2Ip )
- installResult2 = \
- main.ONOSbench.onosInstall( node=ONOS3Ip )
- time.sleep( 5 )
-
- main.log.info( "Starting ONOS CLI" )
- main.ONOS2cli.startOnosCli( ONOS2Ip )
- main.ONOS3cli.startOnosCli( ONOS3Ip )
-
- installResult = installResult1 and installResult2
-
- if clusterCount == 5:
- main.log.info( "Installing ONOS on node 4 and 5" )
- installResult1 = \
- main.ONOSbench.onosInstall( node=ONOS4Ip )
- installResult2 = \
- main.ONOSbench.onosInstall( node=ONOS5Ip )
-
- main.log.info( "Starting ONOS CLI" )
- main.ONOS4cli.startOnosCli( ONOS4Ip )
- main.ONOS5cli.startOnosCli( ONOS5Ip )
-
- installResult = installResult1 and installResult2
-
- if clusterCount == 7:
- main.log.info( "Installing ONOS on node 6 and 7" )
- installResult1 = \
- main.ONOSbench.onosInstall( node=ONOS6Ip )
- installResult2 = \
- main.ONOSbench.onosInstall( node=ONOS7Ip )
-
- main.log.info( "Starting ONOS CLI" )
- main.ONOS6cli.startOnosCli( ONOS6Ip )
- main.ONOS7cli.startOnosCli( ONOS7Ip )
-
- installResult = installResult1 and installResult2
-
- time.sleep( 5 )
-
- if installResult == main.TRUE:
- assertion = main.TRUE
- else:
- assertion = main.FALSE
-
- utilities.assert_equals( expect=main.TRUE, actual=assertion,
- onpass="Scale out to " + str( clusterCount ) +
- " nodes successful",
- onfail="Scale out to " + str( clusterCount ) +
- " nodes failed" )
-
- def CASE7( self, main ):
- # TODO: Fix for scale-out scenario
- """
- Batch intent reroute latency
- """
- import time
- import json
- import requests
- import os
- import numpy
- global clusterCount
-
- ONOSIpList = []
- for i in range( 1, 8 ):
- ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
-
- ONOSUser = main.params[ 'CTRL' ][ 'user' ]
- defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
-
- batchIntentSize = main.params[ 'TEST' ][ 'batchIntentSize' ]
- batchThreshMin = int( main.params[ 'TEST' ][ 'batchThresholdMin' ] )
- batchThreshMax = int( main.params[ 'TEST' ][ 'batchThresholdMax' ] )
- intfs = main.params[ 'TEST' ][ 'intfs' ]
- installTime = main.params[ 'JSON' ][ 'installedTime' ]
-
- # number of iterations of case
- numIter = main.params[ 'TEST' ][ 'numIter' ]
- numIgnore = int( main.params[ 'TEST' ][ 'numIgnore' ] )
- numSwitch = int( main.params[ 'TEST' ][ 'numSwitch' ] )
- nThread = main.params[ 'TEST' ][ 'numMult' ]
-
- main.log.report( "Batch intent installation test of " +
- batchIntentSize + " intents" )
-
- batchResultList = []
-
- time.sleep( 10 )
-
- main.log.info( "Getting list of available devices" )
- deviceIdList = []
- jsonStr = main.ONOS1cli.devices()
- jsonObj = json.loads( jsonStr )
- for device in jsonObj:
- deviceIdList.append( device[ 'id' ] )
-
- batchInstallLat = []
- batchWithdrawLat = []
- sleepTime = 10
-
- baseDir = "/tmp/"
- maxInstallLat = []
-
- for i in range( 0, int( numIter ) ):
- main.log.info( "Pushing " +
- str( int( batchIntentSize ) * int( nThread ) ) +
- " intents. Iteration " + str( i ) )
-
- main.ONOSbench.pushTestIntentsShell(
- deviceIdList[ 0 ] + "/2",
- deviceIdList[ 7 ] + "/2",
- batchIntentSize, "/tmp/batch_install.txt",
- ONOSIpList[ 0 ], numMult="1", appId="1",
- report=False, options="--install" )
- # main.ONOSbench.pushTestIntentsShell(
- # "of:0000000000001002/1",
- # "of:0000000000002002/1",
- # 133, "/tmp/temp2.txt", "10.128.174.2",
- # numMult="6", appId="2",report=False )
-
- # TODO: Check for installation success then proceed
- time.sleep( 30 )
-
- # NOTE: this interface is specific to
- # topo-intentFlower.py topology
- # reroute case.
- main.log.info( "Disabling interface " + intfs )
- main.Mininet1.handle.sendline(
- "sh ifconfig " + intfs + " down" )
- t0System = time.time() * 1000
-
- # TODO: Wait sufficient time for intents to install
- time.sleep( 10 )
-
- # TODO: get intent installation time
-
- # Obtain metrics from ONOS 1, 2, 3
- intentsJsonStr1 = main.ONOS1cli.intentsEventsMetrics()
- intentsJsonObj1 = json.loads( intentsJsonStr1 )
- # Parse values from the json object
- intentInstall1 = \
- intentsJsonObj1[ installTime ][ 'value' ]
- intentRerouteLat1 = \
- int( intentInstall1 ) - int( t0System )
-
- if clusterCount == 3:
- intentsJsonStr2 =\
- main.ONOS2cli.intentsEventsMetrics()
- intentsJsonStr3 =\
- main.ONOS3cli.intentsEventsMetrics()
- intentsJsonObj2 = json.loads( intentsJsonStr2 )
- intentsJsonObj3 = json.loads( intentsJsonStr3 )
- intentInstall2 = \
- intentsJsonObj2[ installTime ][ 'value' ]
- intentInstall3 = \
- intentsJsonObj3[ installTime ][ 'value' ]
- intentRerouteLat2 = \
- int( intentInstall2 ) - int( t0System )
- intentRerouteLat3 = \
- int( intentInstall3 ) - int( t0System )
- else:
- intentRerouteLat2 = 0
- intentRerouteLat3 = 0
-
- if clusterCount == 5:
- intentsJsonStr4 =\
- main.ONOS4cli.intentsEventsMetrics()
- intentsJsonStr5 =\
- main.ONOS5cli.intentsEventsMetrics()
- intentsJsonObj4 = json.loads( intentsJsonStr4 )
- intentsJsonObj5 = json.loads( intentsJsonStr5 )
- intentInstall4 = \
- intentsJsonObj4[ installTime ][ 'value' ]
- intentInstall5 = \
- intentsJsonObj5[ installTime ][ 'value' ]
- intentRerouteLat4 = \
- int( intentInstall4 ) - int( t0System )
- intentRerouteLat5 = \
- int( intentInstall5 ) - int( t0System )
- else:
- intentRerouteLat4 = 0
- intentRerouteLat5 = 0
-
- if clusterCount == 7:
- intentsJsonStr6 =\
- main.ONOS6cli.intentsEventsMetrics()
- intentsJsonStr7 =\
- main.ONOS7cli.intentsEventsMetrics()
- intentsJsonObj6 = json.loads( intentsJsonStr6 )
- intentsJsonObj7 = json.loads( intentsJsonStr7 )
- intentInstall6 = \
- intentsJsonObj6[ installTime ][ 'value' ]
- intentInstall7 = \
- intentsJsonObj7[ installTime ][ 'value' ]
- intentRerouteLat6 = \
- int( intentInstall6 ) - int( t0System )
- intentRerouteLat7 = \
- int( intentInstall7 ) - int( t0System )
- else:
- intentRerouteLat6 = 0
- intentRerouteLat7 = 0
-
- intentRerouteLatAvg = \
- ( intentRerouteLat1 +
- intentRerouteLat2 +
- intentRerouteLat3 +
- intentRerouteLat4 +
- intentRerouteLat5 +
- intentRerouteLat6 +
- intentRerouteLat7 ) / clusterCount
-
- main.log.info( "Intent reroute latency avg for iteration " +
- str( i ) + ": " + str( intentRerouteLatAvg ) )
- # TODO: Remove intents for next iteration
-
- time.sleep( 5 )
-
- intentsStr = main.ONOS1cli.intents()
- intentsJson = json.loads( intentsStr )
- for intents in intentsJson:
- intentId = intents[ 'id' ]
- # TODO: make sure this removes all intents
- # print intentId
- if intentId:
- main.ONOS1cli.removeIntent( intentId )
-
- main.Mininet1.handle.sendline(
- "sh ifconfig " + intfs + " up" )
-
- main.log.info( "Intents removed and port back up" )
-
- def CASE9( self, main ):
- count = 0
- swNum1 = 1
- swNum2 = 1
- appid = 0
- portNum1 = 1
- portNum2 = 1
-
- time.sleep( 30 )
-
- while True:
- # main.ONOS1cli.pushTestIntents(
- #"of:0000000000001001/1",
- #"of:0000000000002001/1",
- # 100, numMult="10", appId="1" )
- # main.ONOS2cli.pushTestIntents(
- # "of:0000000000001002/1",
- # "of:0000000000002002/1",
- # 100, numMult="10", appId="2" )
- # main.ONOS2cli.pushTestIntents(
- # "of:0000000000001003/1",
- # "of:0000000000002003/1",
- # 100, numMult="10", appId="3" )
- count += 1
-
- if count >= 100:
- main.ONOSbench.handle.sendline(
- "onos 10.128.174.1 intents-events-metrics >>" +
- " /tmp/metrics_intents_temp.txt &" )
- count = 0
-
- arg1 = "of:000000000000100" + str( swNum1 ) + "/" + str( portNum1 )
- arg2 = "of:000000000000200" + str( swNum2 ) + "/" + str( portNum2 )
-
- swNum1 += 1
-
- if swNum1 > 7:
- swNum1 = 1
- swNum2 += 1
- if swNum2 > 7:
- appid += 1
-
- if swNum2 > 7:
- swNum2 = 1
-
- main.ONOSbench.pushTestIntentsShell(
- arg1,
- arg2,
- 100, "/tmp/temp.txt", "10.128.174.1",
- numMult="10", appId=appid, report=False )
- # main.ONOSbench.pushTestIntentsShell(
- # "of:0000000000001002/1",
- # "of:0000000000002002/1",
- # 133, "/tmp/temp2.txt", "10.128.174.2",
- # numMult="6", appId="2",report=False )
- # main.ONOSbench.pushTestIntentsShell(
- # "of:0000000000001003/1",
- # "of:0000000000002003/1",
- # 133, "/tmp/temp3.txt", "10.128.174.3",
- # numMult="6", appId="3",report=False )
-
- time.sleep( 0.2 )
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.topo b/TestON/tests/IntentPerfNext/IntentPerfNext.topo
deleted file mode 100644
index 5575237..0000000
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.topo
+++ /dev/null
@@ -1,109 +0,0 @@
-<TOPOLOGY>
- <COMPONENT>
-
- <ONOSbench>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOSbench>
-
- <ONOS1cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1cli>
-
- <ONOS2cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2cli>
-
- <ONOS3cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS3cli>
-
- <ONOS4cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS4cli>
-
- <ONOS5cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>6</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS5cli>
-
- <ONOS6cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>7</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS6cli>
-
- <ONOS7cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>8</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS7cli>
-
- <ONOS1>
- <host>10.128.174.1</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>9</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1>
-
- <Mininet1>
- <host>10.128.10.90</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>MininetCliDriver</type>
- <connect_order>10</connect_order>
- <COMPONENTS>
- <arg1> --custom topo-intent-8sw.py </arg1>
- <arg2> --arp --mac --topo mytopo </arg2>
- <arg3> </arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet1>
-
- <Mininet2>
- <host>10.128.10.90</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>RemoteMininetDriver</type>
- <connect_order>11</connect_order>
- <COMPONENTS> </COMPONENTS>
- </Mininet2>
-
- </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/IntentPerfNext/__init__.py b/TestON/tests/IntentPerfNext/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/IntentPerfNext/__init__.py
+++ /dev/null
diff --git a/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py b/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py
index 32477a6..7ddc70f 100644
--- a/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py
+++ b/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py
@@ -116,40 +116,40 @@
if clusterCount == 1:
for i in range(1, numSwitch + 1):
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOS1Ip, port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOS1Ip, port=defaultSwPort)
if clusterCount == 3:
for i in range(1, 3):
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOS1Ip, port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOS1Ip, port=defaultSwPort)
for i in range(3, 6):
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOS2Ip, port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOS2Ip, port=defaultSwPort)
for i in range(6, 9):
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOS3Ip, port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOS3Ip, port=defaultSwPort)
if clusterCount == 5:
- main.Mininet1.assignSwController(sw='1',
- ip1=ONOS1Ip, port1=defaultSwPort)
- main.Mininet1.assignSwController(sw='2',
- ip1=ONOS2Ip, port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw='s1',
+ ip=ONOS1Ip, port=defaultSwPort)
+ main.Mininet1.assignSwController(sw='s2',
+ ip=ONOS2Ip, port=defaultSwPort)
for i in range(3, 6):
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOS3Ip, port1=defaultSwPort)
- main.Mininet1.assignSwController(sw='6',
- ip1=ONOS4Ip, port1=defaultSwPort)
- main.Mininet1.assignSwController(sw='7',
- ip1=ONOS5Ip, port1=defaultSwPort)
- main.Mininet1.assignSwController(sw='8',
- ip1=ONOS5Ip, port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOS3Ip, port=defaultSwPort)
+ main.Mininet1.assignSwController(sw='s6',
+ ip=ONOS4Ip, port=defaultSwPort)
+ main.Mininet1.assignSwController(sw='s7',
+ ip=ONOS5Ip, port=defaultSwPort)
+ main.Mininet1.assignSwController(sw='s8',
+ ip=ONOS5Ip, port=defaultSwPort)
if clusterCount == 7:
for i in range(1, 9):
if i < 8:
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOSIpList[i - 1], port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOSIpList[i - 1], port=defaultSwPort)
elif i >= 8:
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOSIpList[6], port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOSIpList[6], port=defaultSwPort)
time.sleep(20)
@@ -376,40 +376,40 @@
if clusterCount == 1:
for i in range(1, numSwitch + 1):
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOS1Ip, port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOS1Ip, port=defaultSwPort)
if clusterCount == 3:
for i in range(1, 3):
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOS1Ip, port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOS1Ip, port=defaultSwPort)
for i in range(3, 6):
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOS2Ip, port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOS2Ip, port=defaultSwPort)
for i in range(6, 9):
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOS3Ip, port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOS3Ip, port=defaultSwPort)
if clusterCount == 5:
- main.Mininet1.assignSwController(sw='1',
- ip1=ONOS1Ip, port1=defaultSwPort)
- main.Mininet1.assignSwController(sw='2',
- ip1=ONOS2Ip, port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw='s1',
+ ip=ONOS1Ip, port=defaultSwPort)
+ main.Mininet1.assignSwController(sw='s2',
+ ip=ONOS2Ip, port=defaultSwPort)
for i in range(3, 6):
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOS3Ip, port1=defaultSwPort)
- main.Mininet1.assignSwController(sw='6',
- ip1=ONOS4Ip, port1=defaultSwPort)
- main.Mininet1.assignSwController(sw='7',
- ip1=ONOS5Ip, port1=defaultSwPort)
- main.Mininet1.assignSwController(sw='8',
- ip1=ONOS5Ip, port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOS3Ip, port=defaultSwPort)
+ main.Mininet1.assignSwController(sw='s6',
+ ip=ONOS4Ip, port=defaultSwPort)
+ main.Mininet1.assignSwController(sw='s7',
+ ip=ONOS5Ip, port=defaultSwPort)
+ main.Mininet1.assignSwController(sw='s8',
+ ip=ONOS5Ip, port=defaultSwPort)
if clusterCount == 7:
for i in range(1, 9):
if i < 8:
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOSIpList[i - 1], port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOSIpList[i - 1], port=defaultSwPort)
elif i >= 8:
- main.Mininet1.assignSwController(sw=str(i),
- ip1=ONOSIpList[6], port1=defaultSwPort)
+ main.Mininet1.assignSwController(sw="s" + str(i),
+ ip=ONOSIpList[6], port=defaultSwPort)
main.log.report('Batch intent reroute test ')
diff --git a/TestON/tests/LincOETest/LincOETest.params b/TestON/tests/LincOETest/LincOETest.params
deleted file mode 100755
index 46e4f19..0000000
--- a/TestON/tests/LincOETest/LincOETest.params
+++ /dev/null
@@ -1,20 +0,0 @@
-<PARAMS>
-
- <testcases>1,2</testcases>
-
- #Environment variables
- <ENV>
- <cellName>linc_oe_test</cellName>
- </ENV>
-
- <CTRL>
- <ip1>10.128.174.1</ip1>
- <port1>6633</port1>
- </CTRL>
-
- <GIT>
- <autoPull>off</autoPull>
- <checkout>master</checkout>
- </GIT>
-
-</PARAMS>
diff --git a/TestON/tests/LincOETest/LincOETest.py b/TestON/tests/LincOETest/LincOETest.py
deleted file mode 100644
index b693138..0000000
--- a/TestON/tests/LincOETest/LincOETest.py
+++ /dev/null
@@ -1,118 +0,0 @@
-# LincOETest
-#
-# Packet-Optical Intent Testing
-#
-# andrew@onlab.us
-
-
-import time
-import sys
-import os
-import re
-
-
-class LincOETest:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ):
- """
- Startup sequence:
- git pull
- mvn clean install
- onos-package
- cell <name>
- onos-verify-cell
- onos-install -f
- onos-wait-for-start
- """
- import time
-
- cellName = main.params[ 'ENV' ][ 'cellName' ]
-
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
-
- gitPullTrigger = main.params[ 'GIT' ][ 'autoPull' ]
- gitCheckoutBranch = main.params[ 'GIT' ][ 'checkout' ]
-
- main.case( "Setting up test environment" )
-
- main.step( "Creating cell file" )
- # params: ( bench ip, cell name, mininet ip, *onos ips )
- cellFileResult = main.ONOSbench.createCellFile(
- "10.128.20.10", cellName, "10.128.10.90",
- "onos-core-trivial,onos-app-fwd",
- "10.128.174.1" )
-
- main.step( "Applying cell variable to environment" )
- # cellResult = main.ONOSbench.setCell( cellName )
- cellResult = main.ONOSbench.setCell( "temp_cell_2" )
- verifyResult = main.ONOSbench.verifyCell()
-
- if gitPullTrigger == 'on':
- main.step( "Git checkout and pull master" )
- main.ONOSbench.gitCheckout( gitCheckoutBranch )
- gitPullResult = main.ONOSbench.gitPull()
- else:
- main.log.info( "Git checkout and pull skipped by config" )
- gitPullResult = main.TRUE
-
- main.step( "Using mvn clean & install" )
- # cleanInstallResult = main.ONOSbench.cleanInstall()
- cleanInstallResult = main.TRUE
-
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
-
- main.step( "Installing ONOS package" )
- onosInstallResult = main.ONOSbench.onosInstall()
- onos1Isup = main.ONOSbench.isup()
-
- main.step( "Starting ONOS service" )
- startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
- main.step( "Setting cell for ONOScli" )
- main.ONOScli.setCell( cellName )
-
- main.step( "Starting ONOScli" )
- main.ONOScli.startOnosCli( ONOS1Ip )
-
- case1Result = ( cleanInstallResult and packageResult and
- cellResult and verifyResult and onosInstallResult and
- onos1Isup and startResult )
- utilities.assertEquals( expect=main.TRUE, actual=case1Result,
- onpass="Test startup successful",
- onfail="Test startup NOT successful" )
-
- time.sleep( 10 )
-
- def CASE2( self, main ):
- """
- Configure topology
- """
- import time
-
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
- defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
-
- # Assign packet level switches to controller
- main.Mininet1.assignSwController(
- sw="1",
- ip1=ONOS1Ip,
- port1=defaultSwPort )
- main.Mininet1.assignSwController(
- sw="2",
- ip1=ONOS1Ip,
- port1=defaultSwPort )
-
- # Check devices in controller
- # This should include Linc-OE devices as well
- devices = main.ONOScli.devices()
- main.log.info( devices )
-
- def CASE3( self, main ):
- """
- Install multi-layer intents
- """
diff --git a/TestON/tests/LincOETest/LincOETest.topo b/TestON/tests/LincOETest/LincOETest.topo
deleted file mode 100755
index 5d572ca..0000000
--- a/TestON/tests/LincOETest/LincOETest.topo
+++ /dev/null
@@ -1,55 +0,0 @@
-<TOPOLOGY>
- <COMPONENT>
-
- <ONOSbench>
- <host>10.128.20.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOSbench>
-
- <ONOScli>
- <host>10.128.20.10<</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli>
-
- <ONOS1>
- <host>10.128.174.1</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1>
-
- <LincOE>
- <host>10.128.10.90</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>LincOEDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS> </COMPONENTS>
- </LincOE>
-
- <Mininet1>
- <host>10.128.10.90</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>MininetCliDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS>
- <arg1> --custom optical.py </arg1>
- <arg2> --arp --mac</arg2>
- <arg3> --topo optical</arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet1>
-
- </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/LincOETest/__init__.py b/TestON/tests/LincOETest/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/LincOETest/__init__.py
+++ /dev/null
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.params b/TestON/tests/LinkEventTP/LinkEventTP.params
deleted file mode 100644
index 7a47a51..0000000
--- a/TestON/tests/LinkEventTP/LinkEventTP.params
+++ /dev/null
@@ -1,62 +0,0 @@
-<PARAMS>
- <testcases>1,2,3</testcases>
-
- <ENV>
- <cellName>network_tp_test</cellName>
- <cellFeatures>"webconsole,onos-core,onos-api,onos-cli,onos-null,onos-rest,onos-app-metrics,onos-app-metrics-intent,onos-app-metrics-topology"</cellFeatures>
- <onBaremetal>true</onBaremetal> "true"
- </ENV>
-
- <SCALE>6</SCALE>
-
- <availableNodes>7</availableNodes>
-
- <GIT>
- <autopull>off</autopull>
- <checkout>master</checkout>
- </GIT>
-
- <CTRL>
- <USER>admin</USER>
- <ip1>10.254.1.201</ip1>
- <port1>6633</port1>
- <ip2>10.254.1.202</ip2>
- <port2>6633</port2>
- <ip3>10.254.1.203</ip3>
- <port3>6633</port3>
- <ip4>10.254.1.204</ip4>
- <port4>6633</port4>
- <ip5>10.254.1.205</ip5>
- <port5>6633</port5>
- <ip6>10.254.1.206</ip6>
- <port6>6633</port6>
- <ip7>10.254.1.207</ip7>
- <port7>6633</port7>
- </CTRL>
-
- <BENCH>
- <user>admin</user>
- <ip1>localhost</ip1>
- </BENCH>
-
- <TEST> # duration = time the test loop runs
- # log_interval = how often the data is reported
- # wait = time between tests, used to let the averages run down
- <configFile>/onos/tools/package/etc/org.onosproject.net.topology.impl.DefaultTopologyProvider.cfg</configFile>
- <flickerRates>20000,20000,20000,20000,20000,20000,20000</flickerRates>
- <devicesPerNode>40,40,40,40,40,40,40</devicesPerNode>
- <flickerRate>1000</flickerRate>
- <linkgraphdif>.03</linkgraphdif> # 0-1 indicated link/graph rate dif tolerance
- <duration>1800</duration>
- <log_interval>15</log_interval>
- <wait>60</wait>
- <skipCleanInstall>yes</skipCleanInstall>
- <MN>localhost</MN>
- <logFile>link_event_tp_results_LOG</logFile>
- </TEST>
-
- <JSON>
- <intents_rate>intentInstalledRate</intents_rate>
- </JSON>
-
-</PARAMS>
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.py b/TestON/tests/LinkEventTP/LinkEventTP.py
deleted file mode 100644
index a4bc0aa..0000000
--- a/TestON/tests/LinkEventTP/LinkEventTP.py
+++ /dev/null
@@ -1,336 +0,0 @@
-# ScaleOutTemplate --> LinkEventTP
-#
-# CASE1 starts number of nodes specified in param file
-#
-# cameron@onlab.us
-
-import sys
-import os
-
-
-class LinkEventTP:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ): #This is the initialization case
- import os.path #this case will clean up all nodes
- #but only node 1 isnodestarted in this case
-
- global clusterCount #number of nodes running
- global ONOSIp #list of ONOS IP addresses
-
- clusterCount = 1
- ONOSIp = [ 0 ]
-
- #Load values from params file
- checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
- gitPull = main.params[ 'GIT' ][ 'autopull' ]
- cellName = main.params[ 'ENV' ][ 'cellName' ]
- Features= main.params[ 'ENV' ][ 'cellFeatures' ]
- BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
- BENCHUser = main.params[ 'BENCH' ][ 'user' ]
- maxNodes = int(main.params[ 'availableNodes' ])
- Features = main.params[ 'ENV' ][ 'cellFeatures' ]
- skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
- flickerRate = main.params[ 'TEST' ][ 'flickerRate']
- deviceDistribution = (main.params[ 'TEST' ][ 'devicesPerNode']).split(",")
- MNip = main.params[ 'TEST' ][ 'MN' ]
- logFileName = main.params[ 'TEST' ][ 'logFile' ]
- onBaremetal = main.params[ 'ENV' ][ 'onBaremetal' ]
-
- main.ONOSbench.handle.sendline("export TERM=vt100")
- main.ONOSbench.handle.expect(":~")
- homeDir = os.path.expanduser('~')
-
- #Populate ONOSIp with ips from params
- for i in range(1, maxNodes + 1):
- ipString = 'ip' + str(i)
- ONOSIp.append(main.params[ 'CTRL' ][ ipString ])
-
- #kill off all onos processes
- main.log.step("Safety check, killing all ONOS processes")
- main.log.step("before initiating enviornment setup")
- for node in range(1, maxNodes + 1):
- main.ONOSbench.onosDie(ONOSIp[node])
-
- #construct the cell file
- main.log.step("Creating cell file")
- cellIp = []
- for node in range (1, clusterCount + 1):
- cellIp.append(ONOSIp[node])
- main.ONOSbench.createCellFile(BENCHIp,cellName,MNip,str(Features), *cellIp)
-
- main.step( "Set Cell" )
- main.ONOSbench.setCell(cellName)
-
- #Uninstall everywhere
- main.log.step( "Cleaning Enviornment..." )
- for i in range(1, maxNodes + 1):
- main.log.info(" Uninstalling ONOS " + str(i) )
- main.ONOSbench.onosUninstall( ONOSIp[i] )
-
- myDistribution = []
- for node in range (1, clusterCount + 1):
- myDistribution.append(deviceDistribution[node-1])
-
- main.ONOSbench.createLinkGraphFile( BENCHIp,cellIp,myDistribution)
- main.ONOSbench.createNullDevProviderFile( BENCHIp, cellIp, myDistribution)
- main.ONOSbench.createNullLinkProviderFile(BENCHIp)
-
- #git step - skipable
- main.step( "Git checkout and pull " + checkoutBranch )
- if gitPull == 'on':
- checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
- pullResult = main.ONOSbench.gitPull()
-
- else:
- checkoutResult = main.TRUE
- pullResult = main.TRUE
- main.log.info( "Skipped git checkout and pull" )
-
- #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
- if skipMvn != "yes":
- mvnResult = main.ONOSbench.cleanInstall()
-
- ### configure event rate file ###
- main.log.step("Writing Default Topology Provider config file")
- localPath = main.params[ 'TEST' ][ 'configFile' ]
- filePath = homeDir + localPath
- main.log.info(filePath)
- configFile = open(filePath, 'w+')
- main.log.info("File Opened")
- configFile.write("maxEvents = 1\n")
- configFile.write("maxIdleMs = 0\n")
- configFile.write("maxBatchMs = 0\n")
- main.log.info("File written and closed")
- configFile.close()
-
- logFile = open(logFileName, 'w+')
- main.log.info("Created log File")
- logFile.close()
-
- if onBaremetal == "true":
- filename = "/onos/tools/package/bin/onos-service"
- serviceConfig = open(homeDir + filename, 'w+')
- serviceConfig.write("#!/bin/bash\n ")
- serviceConfig.write("#------------------------------------- \n ")
- serviceConfig.write("# Starts ONOS Apache Karaf container\n ")
- serviceConfig.write("#------------------------------------- \n ")
- serviceConfig.write("#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}\n ")
- serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms256m -Xmx8G}" \n """)
- serviceConfig.write("")
- serviceConfig.write("ONOS_HOME=/opt/onos \n ")
- serviceConfig.write("")
- serviceConfig.write("[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..\n")
- serviceConfig.write("""${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """)
- serviceConfig.close()
-
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
-
- main.step( "Installing ONOS package" )
- install1Result = main.ONOSbench.onosInstall( node=ONOSIp[1] )
-
- main.step( "Verify cells" )
- verifyCellResult = main.ONOSbench.verifyCell()
-
- main.step( "Enviornment setup and verification complete." )
- main.ONOS1cli.startOnosCli( ONOSIp[1] )
- main.step( "ONOS 1 is up and running." )
- main.ONOSbench.handle.expect(":~") #there is a dangling sendline somewhere...
-
- def CASE2( self, main ):
- # This case increases the cluster size by whatever scale is
- # Note: 'scale' is the size of the step
- # if scaling is not a part of your test, simply run this case
- # once after CASE1 to set up your enviornment for your desired
- # cluster size. If scaling is a part of you test call this case each time
- # you want to increase cluster size
-
- ''
- 'Increase number of nodes and initiate CLI'
- ''
- import time
- global clusterCount
-
- cellName = main.params[ 'ENV' ][ 'cellName' ]
- Features= main.params[ 'ENV' ][ 'cellFeatures' ]
- BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
- MNip = main.params[ 'TEST' ][ 'MN' ]
- deviceDistribution = (main.params[ 'TEST' ][ 'devicesPerNode']).split(",")
-
- scale = int( main.params[ 'SCALE' ] )
- clusterCount += scale
-
- main.log.step( "Cleaning Enviornment..." )
- for i in range(1, maxNodes + 1):
- main.ONOSbench.onosDie(ONOSIp[i])
- main.log.info(" Uninstalling ONOS " + str(i) )
- main.ONOSbench.onosUninstall( ONOSIp[i] )
-
- myDistribution = []
- for node in range (1, clusterCount + 1):
- myDistribution.append(deviceDistribution[node-1])
-
- main.log.step("Creating cell file")
- cellIp = []
- for node in range (1, clusterCount + 1):
- cellIp.append(ONOSIp[node])
- main.ONOSbench.createCellFile(BENCHIp,cellName,MNip,str(Features), *cellIp)
-
- main.ONOSbench.createLinkGraphFile( BENCHIp,cellIp,myDistribution)
- main.ONOSbench.createNullDevProviderFile( BENCHIp, cellIp, myDistribution)
- main.ONOSbench.createNullLinkProviderFile(BENCHIp)
-
- main.step( "Set Cell" )
- main.ONOSbench.setCell(cellName)
-
- main.step( "Packaging" )
- main.ONOSbench.onosPackage()
-
- main.log.report( "Increasing cluster size to " + str( clusterCount ) )
- for node in range(1, clusterCount + 1):
- time.sleep(10)
- main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
- main.ONOSbench.onosInstall( node=ONOSIp[node] )
- exec "a = main.ONOS%scli.startOnosCli" %str(node)
- a(ONOSIp[node])
-
- for node in range(1, clusterCount + 1):
- for i in range( 2 ):
- isup = main.ONOSbench.isup( ONOSIp[node] )
- if isup:
- main.log.info("ONOS " + str(node) + " is up\n")
- break
- if not isup:
- main.log.report( "ONOS " + str(node) + " didn't start!" )
-
- def CASE3( self, main ):
- import time
- import json
- import string
- import csv
- import os.path
- import requests
- import numpy
-
- sustainability = float(main.params[ 'TEST' ][ 'linkgraphdif' ])
- flickerRates = (main.params[ 'TEST' ][ 'flickerRates']).split(",")
- homeDir = os.path.expanduser('~')
-
- linkResult = main.FALSE
- scale = int( main.params[ 'SCALE' ] )
-
- testDelay = main.params[ 'TEST' ][ 'wait' ]
-
- for node in range(1, clusterCount + 1):
- main.log.info("Writing flicker file to node " + str(node))
- main.ONOSbench.createNullLinkProviderFile( ONOSIp[node], eventRate=flickerRates[node-1], onNode=True )
-
- testDuration = main.params[ 'TEST' ][ 'duration' ]
- stop = time.time() + float( testDuration )
-
- msg = ( "Starting test loop for " + str(testDuration) + " seconds on a " + str(clusterCount) + " node cluster" )
- main.log.info( msg )
- logInterval = main.params[ 'TEST' ][ 'log_interval' ]
-
- linkResults = [0,0,0,0,0,0,0,0]
- graphResults = [0,0,0,0,0,0,0,0]
- JsonStr = [ 0,0,0,0,0,0,0,0 ]
- JsonObj = [ 0,0,0,0,0,0,0,0 ]
-
- while time.time() < stop:
- time.sleep( float( logInterval ) )
- for node in range(1, clusterCount+1):
- main.ONOSbench.handle.sendline("""onos $OC1 topology-events-metrics|grep "Topology Link Events"|cut -d ' ' -f7 """)
- main.ONOSbench.handle.expect(":~")
- raw = (main.ONOSbench.handle.before).splitlines()
- myresult = "--"
- for word in raw:
- if "m1" in word:
- myresult = word
- myresult = myresult.replace("m1=","")
- break
- if myresult == "--":
- main.log.error("Parse error or no data error")
- msg = ( "Node " + str(node) + " Link Event TP: " + str(myresult) )
- main.log.info( msg )
- linkResults[node] = round(float(myresult),2)
- myLinkRate = round(float(myresult),2)
-
- main.ONOSbench.handle.sendline("""onos $OC1 topology-events-metrics|grep "Topology Graph Events"|cut -d ' ' -f7 """)
- main.ONOSbench.handle.expect(":~")
- raw = (main.ONOSbench.handle.before).splitlines()
- myresult = "--"
- for word in raw:
- if "m1" in word:
- myresult = word
- myresult = myresult.replace("m1=","")
- break
- if myresult == "--":
- main.log.error("Parse error or no data error")
- msg = ( "Node " + str(node) + " Graph Event TP: " + str(myresult) )
- main.log.info( msg )
- graphResults[node] = round(float(myresult),2)
- myGraphRate = round(float(myresult),2)
-
- difLinkGraph = float(myLinkRate - myGraphRate)
- difLinkGraph = numpy.absolute(difLinkGraph)
- main.log.info("Node " + str(node) + " abs(Link event - Graph event) = " + str(difLinkGraph))
- tempx = numpy.divide(difLinkGraph,float(myLinkRate))
- if tempx > sustainability:
- main.log.error("Difference in link event rate and graph event rate above " + str(sustainability) + " tolerance")
- print("")
-
- print("")
- print("")
-
- main.log.report("Final Link Event TP Results on " + str(clusterCount) + " node cluster")
- main.log.report("_______________________________________________")
- for node in range(1, clusterCount+1):
- main.log.report("Node " + str(node) + ": " + str(linkResults[node]))
-
- print("")
- print("")
-
- main.log.report("Final Graph Event TP Results on " + str(clusterCount) + " node cluster")
- main.log.report("_______________________________________________")
- for node in range(1, clusterCount+1):
- main.log.report("Node " + str(node) + ": " + str(graphResults[node]))
-
- #################################################################################
- # Data Logging
-
- logFileName = main.params[ 'TEST' ][ 'logFile' ]
- logFile = open(logFileName, 'a')
- main.log.info("Log file opened")
- flickerRate = main.params[ 'TEST' ][ 'flickerRate']
-
- for node in range (1, clusterCount + 1):
- # replare -> logFile.write( str(clusterCount) + "," + flickerNodes + "," )
- logFile.write("'" + "baremetal" + str(node) + "'," )
- logFile.write( testDuration + "," )
- logFile.write( flickerRate + "," )
- logFile.write( str(linkResults[node]) + "," )
- logFile.write( str(graphResults[node]) + "\n" )
-
- logFile.close()
- main.log.info("Log file closed")
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.pyc b/TestON/tests/LinkEventTP/LinkEventTP.pyc
deleted file mode 100644
index 644df6d..0000000
--- a/TestON/tests/LinkEventTP/LinkEventTP.pyc
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.topo b/TestON/tests/LinkEventTP/LinkEventTP.topo
deleted file mode 100644
index 3c24161..0000000
--- a/TestON/tests/LinkEventTP/LinkEventTP.topo
+++ /dev/null
@@ -1,146 +0,0 @@
-<TOPOLOGY>
-
- <COMPONENT>
-
- <ONOSbench>
- <host>10.254.1.200</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS>
- <home>~/onos</home>
- </COMPONENTS>
-
- </ONOSbench>
-
- <ONOS1cli>
- <host>10.254.1.200</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1cli>
-
- <ONOS2cli>
- <host>10.254.1.200</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2cli>
-
- <ONOS3cli>
- <host>10.254.1.200</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS3cli>
-
- <ONOS4cli>
- <host>10.254.1.200</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS4cli>
-
- <ONOS5cli>
- <host>10.254.1.200</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>6</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS5cli>
-
- <ONOS6cli>
- <host>10.254.1.200</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>7</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS6cli>
-
- <ONOS7cli>
- <host>10.254.1.200</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>8</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS7cli>
-
- <ONOS1>
- <host>10.254.1.201</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>9</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1>
-
- <ONOS2>
- <host>10.254.1.202</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>10</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2>
-
- <ONOS3>
- <host>10.254.1.203</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>11</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS3>
-
- <ONOS4>
- <host>10.254.1.204</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>12</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS4>
-
-
- <ONOS5>
- <host>10.254.1.205</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>13</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS5>
-
- <ONOS6>
- <host>10.254.1.206</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>14</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS6>
-
- <ONOS7>
- <host>10.254.1.207</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>15</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS7>
-
- </COMPONENT>
-
-</TOPOLOGY>
diff --git a/TestON/tests/LinkEventTP/__init__.py b/TestON/tests/LinkEventTP/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/LinkEventTP/__init__.py
+++ /dev/null
diff --git a/TestON/tests/LinkEventTP/__init__.pyc b/TestON/tests/LinkEventTP/__init__.pyc
deleted file mode 100644
index 62abfab..0000000
--- a/TestON/tests/LinkEventTP/__init__.pyc
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/MultiProd/MultiProd.py b/TestON/tests/MultiProd/MultiProd.py
index 6bf405b..682b6f1 100644
--- a/TestON/tests/MultiProd/MultiProd.py
+++ b/TestON/tests/MultiProd/MultiProd.py
@@ -255,9 +255,6 @@
def CASE5( self, main ):
import json
- from subprocess import Popen, PIPE
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
@@ -294,6 +291,8 @@
# print "links1 = ", links1
# print "links2 = ", links2
# print "links3 = ", links3
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
print "**************"
@@ -339,97 +338,46 @@
target=main.params[ 'PING' ][ 'target10' ],
pingTime=500 )
- main.step( "Create TestONTopology object" )
- global ctrls
- ctrls = []
- count = 1
- while True:
- temp = ()
- if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
- temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
- temp = temp + ( "ONOS" + str( count ), )
- temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
- temp = temp + \
- ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
- ctrls.append( temp )
- count = count + 1
- else:
- break
- global MNTopo
- Topo = TestONTopology(
- main.Mininet1,
- ctrls ) # can also add Intent API info for intent operations
- MNTopo = Topo
-
TopologyCheck = main.TRUE
main.step( "Compare ONOS Topology to MN Topology" )
switchesResults1 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices1 ) )
+ mnSwitches, json.loads( devices1 ), json.loads( ports1 ) )
print "switches_Result1 = ", switchesResults1
utilities.assertEquals( expect=main.TRUE, actual=switchesResults1,
onpass="ONOS1 Switches view is correct",
onfail="ONOS1 Switches view is incorrect" )
switchesResults2 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices2 ) )
+ mnSwitches, json.loads( devices2 ), json.loads( ports2 ) )
utilities.assertEquals( expect=main.TRUE, actual=switchesResults2,
onpass="ONOS2 Switches view is correct",
onfail="ONOS2 Switches view is incorrect" )
switchesResults3 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices3 ) )
+ mnSwitches, json.loads( devices3 ), json.loads( ports3 ) )
utilities.assertEquals( expect=main.TRUE, actual=switchesResults3,
onpass="ONOS3 Switches view is correct",
onfail="ONOS3 Switches view is incorrect" )
- portsResults1 = main.Mininet1.comparePorts( MNTopo,
- json.loads( ports1 ) )
- utilities.assertEquals( expect=main.TRUE, actual=portsResults1,
- onpass="ONOS1 Ports view is correct",
- onfail="ONOS1 Ports view is incorrect" )
-
- portsResults2 = main.Mininet1.comparePorts( MNTopo,
- json.loads( ports2 ) )
- utilities.assertEquals( expect=main.TRUE, actual=portsResults2,
- onpass="ONOS2 Ports view is correct",
- onfail="ONOS2 Ports view is incorrect" )
-
- portsResults3 = main.Mininet1.comparePorts( MNTopo,
- json.loads( ports3 ) )
- utilities.assertEquals( expect=main.TRUE, actual=portsResults3,
- onpass="ONOS3 Ports view is correct",
- onfail="ONOS3 Ports view is incorrect" )
-
linksResults1 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links1 ) )
+ mnSwitches, mnLinks, json.loads( links1 ) )
utilities.assertEquals( expect=main.TRUE, actual=linksResults1,
onpass="ONOS1 Links view is correct",
onfail="ONOS1 Links view is incorrect" )
linksResults2 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links2 ) )
+ mnSwitches, mnLinks, json.loads( links2 ) )
utilities.assertEquals( expect=main.TRUE, actual=linksResults2,
onpass="ONOS2 Links view is correct",
onfail="ONOS2 Links view is incorrect" )
linksResults3 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links3 ) )
+ mnSwitches, mnLinks, json.loads( links3 ) )
utilities.assertEquals( expect=main.TRUE, actual=linksResults3,
onpass="ONOS2 Links view is correct",
onfail="ONOS2 Links view is incorrect" )
- # topoResult = switchesResults1 and switchesResults2
- # and switchesResults3\
- # and portsResults1 and portsResults2 and portsResults3\
- # and linksResults1 and linksResults2 and linksResults3
-
topoResult = switchesResults1 and switchesResults2 and\
switchesResults3 and linksResults1 and linksResults2 and\
linksResults3
@@ -730,6 +678,8 @@
# print "links1 = ", links1
# print "links2 = ", links2
# print "links3 = ", links3
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
print "**************"
@@ -775,98 +725,47 @@
target=main.params[ 'PING' ][ 'target10' ],
pingTime=500 )
- main.step( "Create TestONTopology object" )
- global ctrls
- ctrls = []
- count = 1
- while True:
- temp = ()
- if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
- temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
- temp = temp + ( "ONOS" + str( count ), )
- temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
- temp = temp + \
- ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
- ctrls.append( temp )
- count = count + 1
- else:
- break
- global MNTopo
- Topo = TestONTopology(
- main.Mininet1,
- ctrls ) # can also add Intent API info for intent operations
- MNTopo = Topo
-
- TopologyCheck = main.TRUE
main.step( "Compare ONOS Topology to MN Topology" )
switchesResults1 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices1 ) )
+ mnSwitches, json.loads( devices1 ), json.loads( ports1 ) )
print "switches_Result1 = ", switchesResults1
utilities.assertEquals( expect=main.TRUE, actual=switchesResults1,
onpass="ONOS1 Switches view is correct",
onfail="ONOS1 Switches view is incorrect" )
switchesResults2 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices2 ) )
+ mnSwitches, json.loads( devices2 ), json.loads( ports2 ) )
utilities.assertEquals( expect=main.TRUE, actual=switchesResults2,
onpass="ONOS2 Switches view is correct",
onfail="ONOS2 Switches view is incorrect" )
switchesResults3 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices3 ) )
+ mnSwitches, json.loads( devices3 ), json.loads( ports3 ) )
utilities.assertEquals( expect=main.TRUE, actual=switchesResults3,
onpass="ONOS3 Switches view is correct",
onfail="ONOS3 Switches view is incorrect" )
- """
- portsResults1 = main.Mininet1.comparePorts( MNTopo,
- json.loads( ports1 ) )
- utilities.assertEquals( expect=main.TRUE, actual=portsResults1,
- onpass="ONOS1 Ports view is correct",
- onfail="ONOS1 Ports view is incorrect" )
-
- portsResults2 = main.Mininet1.comparePorts( MNTopo,
- json.loads( ports2 ) )
- utilities.assertEquals( expect=main.TRUE, actual=portsResults2,
- onpass="ONOS2 Ports view is correct",
- onfail="ONOS2 Ports view is incorrect" )
-
- portsResults3 = main.Mininet1.comparePorts( MNTopo,
- json.loads( ports3 ) )
- utilities.assertEquals( expect=main.TRUE, actual=portsResults3,
- onpass="ONOS3 Ports view is correct",
- onfail="ONOS3 Ports view is incorrect" )
- """
linksResults1 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links1 ) )
+ mnSwitches, mnLinks, json.loads( links1 ) )
utilities.assertEquals( expect=main.TRUE, actual=linksResults1,
onpass="ONOS1 Links view is correct",
onfail="ONOS1 Links view is incorrect" )
linksResults2 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links2 ) )
+ mnSwitches, mnLinks, json.loads( links2 ) )
+
utilities.assertEquals( expect=main.TRUE, actual=linksResults2,
onpass="ONOS2 Links view is correct",
onfail="ONOS2 Links view is incorrect" )
linksResults3 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links3 ) )
+ mnSwitches, mnLinks, json.loads( links3 ) )
+
utilities.assertEquals( expect=main.TRUE, actual=linksResults3,
onpass="ONOS2 Links view is correct",
onfail="ONOS2 Links view is incorrect" )
- # topoResult = switchesResults1 and switchesResults2
- # and switchesResults3\
- # and portsResults1 and portsResults2 and portsResults3\
- # and linksResults1 and linksResults2 and linksResults3
-
topoResult = switchesResults1 and switchesResults2\
and switchesResults3 and linksResults1 and\
linksResults2 and linksResults3
diff --git a/TestON/tests/MultiProd13/MultiProd13.py b/TestON/tests/MultiProd13/MultiProd13.py
index ee62ce7..a458dec 100644
--- a/TestON/tests/MultiProd13/MultiProd13.py
+++ b/TestON/tests/MultiProd13/MultiProd13.py
@@ -255,9 +255,6 @@
def CASE5( self, main ):
import json
- from subprocess import Popen, PIPE
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
@@ -339,97 +336,46 @@
target=main.params[ 'PING' ][ 'target10' ],
pingTime=500 )
- main.step( "Create TestONTopology object" )
- global ctrls
- ctrls = []
- count = 1
- while True:
- temp = ()
- if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
- temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
- temp = temp + ( "ONOS" + str( count ), )
- temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
- temp = temp + \
- ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
- ctrls.append( temp )
- count = count + 1
- else:
- break
- global MNTopo
- Topo = TestONTopology(
- main.Mininet1,
- ctrls ) # can also add Intent API info for intent operations
- MNTopo = Topo
-
- TopologyCheck = main.TRUE
main.step( "Compare ONOS Topology to MN Topology" )
-
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
switchesResults1 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices1 ) )
+ mnSwitches, json.loads( devices1 ), json.loads( ports1 ) )
print "switches_Result1 = ", switchesResults1
utilities.assertEquals( expect=main.TRUE, actual=switchesResults1,
onpass="ONOS1 Switches view is correct",
onfail="ONOS1 Switches view is incorrect" )
switchesResults2 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices2 ) )
+ mnSwitches, json.loads( devices2 ), json.loads( ports2 ) )
utilities.assertEquals( expect=main.TRUE, actual=switchesResults2,
onpass="ONOS2 Switches view is correct",
onfail="ONOS2 Switches view is incorrect" )
switchesResults3 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices3 ) )
+ mnSwitches, json.loads( devices3 ), json.loads( ports3 ) )
utilities.assertEquals( expect=main.TRUE, actual=switchesResults3,
onpass="ONOS3 Switches view is correct",
onfail="ONOS3 Switches view is incorrect" )
- portsResults1 = main.Mininet1.comparePorts( MNTopo,
- json.loads( ports1 ) )
- utilities.assertEquals( expect=main.TRUE, actual=portsResults1,
- onpass="ONOS1 Ports view is correct",
- onfail="ONOS1 Ports view is incorrect" )
-
- portsResults2 = main.Mininet1.comparePorts( MNTopo,
- json.loads( ports2 ) )
- utilities.assertEquals( expect=main.TRUE, actual=portsResults2,
- onpass="ONOS2 Ports view is correct",
- onfail="ONOS2 Ports view is incorrect" )
-
- portsResults3 = main.Mininet1.comparePorts( MNTopo,
- json.loads( ports3 ) )
- utilities.assertEquals( expect=main.TRUE, actual=portsResults3,
- onpass="ONOS3 Ports view is correct",
- onfail="ONOS3 Ports view is incorrect" )
-
linksResults1 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links1 ) )
+ mnSwitches, mnLinks, json.loads( links1 ) )
utilities.assertEquals( expect=main.TRUE, actual=linksResults1,
onpass="ONOS1 Links view is correct",
onfail="ONOS1 Links view is incorrect" )
linksResults2 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links2 ) )
+ mnSwitches, mnLinks, json.loads( links2 ) )
utilities.assertEquals( expect=main.TRUE, actual=linksResults2,
onpass="ONOS2 Links view is correct",
onfail="ONOS2 Links view is incorrect" )
linksResults3 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links3 ) )
+ mnSwitches, mnLinks, json.loads( links3 ) )
utilities.assertEquals( expect=main.TRUE, actual=linksResults3,
onpass="ONOS2 Links view is correct",
onfail="ONOS2 Links view is incorrect" )
- # topoResult = switchesResults1 and switchesResults2
- # and switchesResults3\
- # and portsResults1 and portsResults2 and portsResults3\
- # and linksResults1 and linksResults2 and linksResults3
-
topoResult = switchesResults1 and switchesResults2 and\
switchesResults3 and linksResults1 and linksResults2 and\
linksResults3
@@ -775,98 +721,47 @@
target=main.params[ 'PING' ][ 'target10' ],
pingTime=500 )
- main.step( "Create TestONTopology object" )
- global ctrls
- ctrls = []
- count = 1
- while True:
- temp = ()
- if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
- temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
- temp = temp + ( "ONOS" + str( count ), )
- temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
- temp = temp + \
- ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
- ctrls.append( temp )
- count = count + 1
- else:
- break
- global MNTopo
- Topo = TestONTopology(
- main.Mininet1,
- ctrls ) # can also add Intent API info for intent operations
- MNTopo = Topo
-
- TopologyCheck = main.TRUE
main.step( "Compare ONOS Topology to MN Topology" )
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
switchesResults1 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices1 ) )
+ mnSwitches, json.loads( devices1 ), json.loads( ports1 ) )
print "switches_Result1 = ", switchesResults1
utilities.assertEquals( expect=main.TRUE, actual=switchesResults1,
onpass="ONOS1 Switches view is correct",
onfail="ONOS1 Switches view is incorrect" )
switchesResults2 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices2 ) )
+ mnSwitches, json.loads( devices1 ), json.loads( ports1 ) )
utilities.assertEquals( expect=main.TRUE, actual=switchesResults2,
onpass="ONOS2 Switches view is correct",
onfail="ONOS2 Switches view is incorrect" )
switchesResults3 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devices3 ) )
+ mnSwitches, json.loads( devices1 ), json.loads( ports1 ) )
utilities.assertEquals( expect=main.TRUE, actual=switchesResults3,
onpass="ONOS3 Switches view is correct",
onfail="ONOS3 Switches view is incorrect" )
- """
- portsResults1 = main.Mininet1.comparePorts( MNTopo,
- json.loads( ports1 ) )
- utilities.assertEquals( expect=main.TRUE, actual=portsResults1,
- onpass="ONOS1 Ports view is correct",
- onfail="ONOS1 Ports view is incorrect" )
-
- portsResults2 = main.Mininet1.comparePorts( MNTopo,
- json.loads( ports2 ) )
- utilities.assertEquals( expect=main.TRUE, actual=portsResults2,
- onpass="ONOS2 Ports view is correct",
- onfail="ONOS2 Ports view is incorrect" )
-
- portsResults3 = main.Mininet1.comparePorts( MNTopo,
- json.loads( ports3 ) )
- utilities.assertEquals( expect=main.TRUE, actual=portsResults3,
- onpass="ONOS3 Ports view is correct",
- onfail="ONOS3 Ports view is incorrect" )
- """
linksResults1 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links1 ) )
+ mnSwitches, mnLinks, json.loads( links1 ) )
utilities.assertEquals( expect=main.TRUE, actual=linksResults1,
onpass="ONOS1 Links view is correct",
onfail="ONOS1 Links view is incorrect" )
linksResults2 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links2 ) )
+ mnSwitches, mnLinks, json.loads( links2 ) )
utilities.assertEquals( expect=main.TRUE, actual=linksResults2,
onpass="ONOS2 Links view is correct",
onfail="ONOS2 Links view is incorrect" )
linksResults3 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( links3 ) )
+ mnSwitches, mnLinks, json.loads( links3 ) )
utilities.assertEquals( expect=main.TRUE, actual=linksResults3,
onpass="ONOS2 Links view is correct",
onfail="ONOS2 Links view is incorrect" )
- # topoResult = switchesResults1 and switchesResults2
- # and switchesResults3\
- # and portsResults1 and portsResults2 and portsResults3\
- # and linksResults1 and linksResults2 and linksResults3
-
topoResult = switchesResults1 and switchesResults2\
and switchesResults3 and linksResults1 and\
linksResults2 and linksResults3
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/OnosCHO/OnosCHO.params
index 398ee96..6240fdb 100644
--- a/TestON/tests/OnosCHO/OnosCHO.params
+++ b/TestON/tests/OnosCHO/OnosCHO.params
@@ -18,7 +18,7 @@
</ENV>
<GIT>
#autoPull 'on' or 'off'
- <autoPull>off</autoPull>
+ <autoPull>on</autoPull>
<branch>master</branch>
</GIT>
<TOPO1>
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index 1bd0696..27aa450 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -192,16 +192,21 @@
startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
time.sleep(45)
main.step( "Assign switches to controllers" )
+ onosIps = []
+ onosPort = []
+ onosIps.append( ONOS1_ip )
+ onosIps.append( ONOS2_ip )
+ onosIps.append( ONOS3_ip )
+ onosPort.append( ONOS1_port )
+ onosPort.append( ONOS2_port )
+ onosPort.append( ONOS3_port )
+
for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
main.Mininet1.assignSwController(
- sw=str( i ),
+ sw="s" + str( i ),
count=int( main.numCtrls ),
- ip1=main.ONOS1_ip,
- port1=main.ONOS1_port,
- ip2=main.ONOS2_ip,
- port2=main.ONOS2_port,
- ip3=main.ONOS3_ip,
- port3=main.ONOS3_port )
+ ip=onosIps,
+ port=onosPort )
switch_mastership = main.TRUE
for i in range( 1, ( main.numMNswitches + 1 ) ):
@@ -278,16 +283,21 @@
startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
time.sleep(15)
main.step( "Assign switches to controllers" )
+ onosIps = []
+ onosPort = []
+ onosIps.append( ONOS1_ip )
+ onosIps.append( ONOS2_ip )
+ onosIps.append( ONOS3_ip )
+ onosPort.append( ONOS1_port )
+ onosPort.append( ONOS2_port )
+ onosPort.append( ONOS3_port )
+
for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
main.Mininet1.assignSwController(
- sw=str( i ),
+ sw="s" + str( i ),
count=int( main.numCtrls ),
- ip1=main.ONOS1_ip,
- port1=main.ONOS1_port,
- ip2=main.ONOS2_ip,
- port2=main.ONOS2_port,
- ip3=main.ONOS3_ip,
- port3=main.ONOS3_port )
+ ip=onosIps,
+ port=onosPort )
switch_mastership = main.TRUE
for i in range( 1, ( main.numMNswitches + 1 ) ):
@@ -345,16 +355,21 @@
startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
time.sleep(60)
main.step( "Assign switches to controllers" )
+ onosIps = []
+ onosPort = []
+ onosIps.append( ONOS1_ip )
+ onosIps.append( ONOS2_ip )
+ onosIps.append( ONOS3_ip )
+ onosPort.append( ONOS1_port )
+ onosPort.append( ONOS2_port )
+ onosPort.append( ONOS3_port )
+
for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
main.Mininet1.assignSwController(
- sw=str( i ),
- count=int( main.numCtrls ),
- ip1=main.ONOS1_ip,
- port1=main.ONOS1_port,
- ip2=main.ONOS2_ip,
- port2=main.ONOS2_port,
- ip3=main.ONOS3_ip,
- port3=main.ONOS3_port )
+ sw="s" + str( i ),
+ count=int( main.numCtrls ),
+ ip=onosIps,
+ port=onosPort )
switch_mastership = main.TRUE
for i in range( 1, ( main.numMNswitches + 1 ) ):
@@ -494,10 +509,9 @@
( numOnosDevices , numOnosLinks ) )
main.log.info("Topology does not match, exiting CHO test...")
topoResult = main.FALSE
-
- #time.sleep(300)
- #main.cleanup()
- #main.exit()
+ # It's better exit here from running the test
+ main.cleanup()
+ main.exit()
# just returning TRUE for now as this one just collects data
case3Result = topoResult
@@ -2257,18 +2271,7 @@
main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
time.sleep(10)
main.log.info("Purging WITHDRAWN Intents")
- purgeResult = main.TRUE
- for i in range( int( main.numCtrls) ):
- t = main.Thread( target=main.CLIs[i].purgeIntents,
- threadID=main.threadID,
- name="purgeIntents",
- args=[ ] )
- pool.append(t)
- t.start()
- main.threadID = main.threadID + 1
- for t in pool:
- t.join()
- purgeResult = purgeResult and t.result
+ purgeResult = main.ONOScli2.purgeIntents()
else:
time.sleep(10)
if len( main.ONOScli1.intents()):
diff --git a/TestON/tests/OpticalFunc13/OpticalFunc13.params b/TestON/tests/OpticalFunc13/OpticalFunc13.params
deleted file mode 100755
index 173d48b..0000000
--- a/TestON/tests/OpticalFunc13/OpticalFunc13.params
+++ /dev/null
@@ -1,47 +0,0 @@
-<PARAMS>
-
- <testcases>1,21,22,23</testcases>
-
- #Environment variables
- <ENV>
- <cellName>driver_test</cellName>
- </ENV>
-
- <CTRL>
- <ip1>10.128.20.11</ip1>
- <port1>6633</port1>
- </CTRL>
-
- <PING>
- <source1>h8</source1>
- <source2>h9</source2>
- <source3>h10</source3>
- <source4>h11</source4>
- <source5>h12</source5>
- <source6>h13</source6>
- <source7>h14</source7>
- <source8>h15</source8>
- <source9>h16</source9>
- <source10>h17</source10>
- <target1>10.0.0.18</target1>
- <target2>10.0.0.19</target2>
- <target3>10.0.0.20</target3>
- <target4>10.0.0.21</target4>
- <target5>10.0.0.22</target5>
- <target6>10.0.0.23</target6>
- <target7>10.0.0.24</target7>
- <target8>10.0.0.25</target8>
- <target9>10.0.0.26</target9>
- <target10>10.0.0.27</target10>
- </PING>
-
- <timers>
- <LinkDiscovery>5</LinkDiscovery>
- <SwitchDiscovery>31</SwitchDiscovery>
- </timers>
-
- <OPTICAL>
- <jsonfile> /home/admin/ONOS/tools/test/topos/oe-nonlinear-4.json </jsonfile>
- </OPTICAL>
-
-</PARAMS>
diff --git a/TestON/tests/OpticalFunc13/OpticalFunc13.py b/TestON/tests/OpticalFunc13/OpticalFunc13.py
deleted file mode 100755
index 7ddd532..0000000
--- a/TestON/tests/OpticalFunc13/OpticalFunc13.py
+++ /dev/null
@@ -1,248 +0,0 @@
-
-#Testing the basic functionality of ONOS Next
-#For sanity and driver functionality excercises only.
-
-import time
-import sys
-import os
-import re
-import time
-import json
-
-time.sleep(1)
-class OpticalFunc13:
- def __init__(self):
- self.default = ''
-
- def CASE1(self, main):
- '''
- Startup sequence:
- git pull
- mvn clean install
- onos-package
- cell <name>
- onos-verify-cell
- onos-install -f
- onos-wait-for-start
- '''
-
- cell_name = main.params['ENV']['cellName']
- ONOS1_ip = main.params['CTRL']['ip1']
- ONOS1_port = main.params['CTRL']['port1']
-
- main.case("Setting up test environment")
-
- main.step("Git checkout and pull master and get version")
- main.ONOSbench.git_checkout("master")
- git_pull_result = main.ONOSbench.git_pull()
- print "git_pull_result = ", git_pull_result
- version_result = main.ONOSbench.get_version()
- main.log.report(main.ONOSbench.get_version())
- if git_pull_result == 1:
- main.step("Using mvn clean & install")
- clean_install_result = main.ONOSbench.clean_install()
- #clean_install_result = main.TRUE
-
- main.step("Applying cell variable to environment")
- cell_result1 = main.ONOSbench.set_cell(cell_name)
- verify_result = main.ONOSbench.verify_cell()
- cell_result2 = main.ONOS2.set_cell(cell_name)
- #verify_result = main.ONOS2.verify_cell()
- main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-
- cell_result = cell_result1 and cell_result2
-
- main.step("Creating ONOS package")
- package_result = main.ONOSbench.onos_package()
-
- #main.step("Creating a cell")
- #cell_create_result = main.ONOSbench.create_cell_file(**************)
-
- main.step("Installing ONOS package")
- onos_install_result = main.ONOSbench.onos_install()
- onos1_isup = main.ONOSbench.isup()
-
- main.step("Starting ONOS service")
- start_result = main.ONOSbench.onos_start(ONOS1_ip)
-
- case1_result = (package_result and\
- cell_result and verify_result and onos_install_result and\
- onos1_isup and start_result )
- utilities.assert_equals(expect=main.TRUE, actual=case1_result,
- onpass="Test startup successful",
- onfail="Test startup NOT successful")
-
- def CASE11(self, main):
- '''
- Cleanup sequence:
- onos-service <node_ip> stop
- onos-uninstall
-
- TODO: Define rest of cleanup
-
- '''
-
- ONOS1_ip = main.params['CTRL']['ip1']
-
- main.case("Cleaning up test environment")
-
- main.step("Testing ONOS kill function")
- kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
-
- main.step("Stopping ONOS service")
- stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
-
- main.step("Uninstalling ONOS service")
- uninstall_result = main.ONOSbench.onos_uninstall()
-
-
- def CASE21(self, main):
- import time
- '''
- On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg
- which starts the rest and copies the links json file to the onos instance
- Note that in case of Packet Optical, the links are not learnt from the topology, instead the links are learnt
- from the json config file
- '''
- main.log.report("This testcase starts the packet layer topology and REST")
- main.log.report("_____________________________________________")
- sart_console_result = main.LincOE1.start_console()
- optical_mn_script = main.LincOE2.run_optical_mn_script()
- onos_topo_cfg_result = main.ONOSbench.run_onos_topo_cfg(instance_name = main.params['CTRL']['ip1'], json_file = main.params['OPTICAL']['jsonfile'])
-
-
-
- def CASE22(self, main):
- '''
- Curretly we use, 4 linear switch optical topology and 2 packet layer mininet switches each with one host.
- Therefore, the roadmCount variable = 4, packetLayerSWCount variable = 2, hostCount =2
- and this is hardcoded in the testcase. If the topology changes, these hardcoded values need to be changed
- '''
-
- main.log.report("This testcase compares the optical+packet topology against what is expected")
- main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
- devices_result = main.ONOS2.devices(json_format = False)
-
- print "devices_result = ", devices_result
- devices_linewise = devices_result.split("\n")
- devices_linewise = devices_linewise[1:-1]
- roadmCount = 0
- packetLayerSWCount = 0
- for line in devices_linewise:
- components = line.split(",")
- availability = components[1].split("=")[1]
- type = components[3].split("=")[1]
- if availability == 'true' and type == 'ROADM':
- roadmCount += 1
- elif availability == 'true' and type =='SWITCH':
- packetLayerSWCount += 1
- if roadmCount == 4:
- print "Number of Optical Switches = %d and is correctly detected" %roadmCount
- main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is correctly detected")
- opticalSW_result = main.TRUE
- else:
- print "Number of Optical Switches = %d and is wrong" %roadCount
- main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is wrong")
- opticalSW_result = main.FALSE
-
- if packetLayerSWCount == 2:
- print "Number of Packet layer or mininet Switches = %d and is correctly detected" %packetLayerSWCount
- main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is correctly detected")
- packetSW_result = main.TRUE
- else:
- print "Number of Packet layer or mininet Switches = %d and is wrong" %packetLayerSWCount
- main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is wrong")
- packetSW_result = main.FALSE
- print "_________________________________"
-
- links_result = main.ONOS2.links(json_format = False)
- print "links_result = ", links_result
- print "_________________________________"
-
-
-
- #Discover hosts using pingall
- pingall_result = main.LincOE2.pingall()
-
- hosts_result = main.ONOS2.hosts(json_format = False)
- print "hosts_result = ", hosts_result
- print "_________________________________"
- hosts_linewise = hosts_result.split("\n")
- hosts_linewise = hosts_linewise[1:-1]
- hostCount = 0
- for line in hosts_linewise:
- hostid = line.split(",")[0].split("=")[1]
- hostCount +=1
- if hostCount ==2:
- print "Number of hosts = %d and is correctly detected" %hostCount
- main.log.info("Number of hosts = " + str(hostCount) +" and is correctly detected")
- hostDiscovery = main.TRUE
- else:
- print "Number of hosts = %d and is wrong" %hostCount
- main.log.info("Number of hosts = " + str(hostCount) +" and is wrong")
- hostDiscovery = main.FALSE
-
- case22_result = opticalSW_result and packetSW_result and hostDiscovery
- utilities.assert_equals(expect=main.TRUE, actual=case22_result,
- onpass="Packet optical topology discovery successful",
- onfail="Packet optical topology discovery failed")
-
- def CASE23(self, main):
- import time
- '''
- Add bidirectional point intents between 2 packet layer(mininet) devices and
- ping mininet hosts
- '''
- main.log.report("This testcase adds bidirectional point intents between 2 packet layer(mininet) devices and ping mininet hosts")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000ffffffff0001", 1, "of:0000ffffffff0002", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000ffffffff0002", 1, "of:0000ffffffff0001", 1)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
-
- time.sleep(10)
- flowHandle = main.ONOS2.flows()
- #print "flowHandle = ", flowHandle
- main.log.info("flows :" + flowHandle)
- intentHandle = main.ONOS2.intents()
- main.log.info("intents :" + intentHandle)
-
- Ping_Result = main.TRUE
- count = 1
- main.log.info("\n\nh1 is Pinging h2")
- ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
- #ping = main.LincOE2.pinghost()
- if ping == main.FALSE and count<5:
- count+=1
- Ping_Result = main.FALSE
- main.log.report("Ping between h1 and h2 failed. Making attempt number "+str(count) + " in 2 seconds")
- time.sleep(2)
- ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
- #ping = main.LincOE2.pinghost()
- elif ping==main.FALSE:
- main.log.report("All ping attempts between h1 and h2 have failed")
- Ping_Result = main.FALSE
- elif ping==main.TRUE:
- main.log.info("Ping test between h1 and h2 passed!")
- Ping_Result = main.TRUE
- else:
- main.log.info("Unknown error")
- Ping_Result = main.ERROR
-
- if Ping_Result==main.FALSE:
- main.log.report("Point intents for packet optical have not ben installed correctly. Cleaning up")
- if Ping_Result==main.TRUE:
- main.log.report("Point Intents for packet optical have been installed correctly")
-
- case23_result = Ping_Result
- utilities.assert_equals(expect=main.TRUE, actual=case23_result,
- onpass="Point intents addition for packet optical and Pingall Test successful",
- onfail="Point intents addition for packet optical and Pingall Test NOT successful")
-
-
diff --git a/TestON/tests/OpticalFunc13/OpticalFunc13.topo b/TestON/tests/OpticalFunc13/OpticalFunc13.topo
deleted file mode 100755
index a3d6cfd..0000000
--- a/TestON/tests/OpticalFunc13/OpticalFunc13.topo
+++ /dev/null
@@ -1,94 +0,0 @@
-<TOPOLOGY>
- <COMPONENT>
-
- <ONOSbench>
- <host>10.128.10.11</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOSbench>
-
- <ONOS1>
- <host>10.128.10.11</host>
- <user>sdn</user>
- <password>sdn</password>
- <type>OnosDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1>
-
- <ONOS2>
- <host>10.128.10.11</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2>
-
- <Mininet1>
- <host>10.128.10.11</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>MininetCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS>
- #Specify the Option for mininet
- <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
- <arg2> --topo mytopo </arg2>
- <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet1>
-
- <Mininet2>
- <host>10.128.10.11</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>RemoteMininetDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS>
- #Specify the Option for mininet
- <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
- <arg2> --topo mytopo </arg2>
- <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet2>
-
- <LincOE1>
- <host>10.128.20.30</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>LincOEDriver</type>
- <connect_order>6</connect_order>
- <COMPONENTS>
- <arg1> </arg1>
- </COMPONENTS>
- </LincOE1>
-
- <LincOE2>
- <host>10.128.20.30</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>RemoteMininetDriver</type>
- <connect_order>7</connect_order>
- <COMPONENTS>
- <arg1> sudo python /home/admin/optical.py </arg1>
- <arg2> </arg2>
- </COMPONENTS>
- </LincOE2>
-
- <LincOE3>
- <host>10.128.20.30</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>RemoteMininetDriver</type>
- <connect_order>8</connect_order>
- </LincOE3>
-
-
- </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OpticalFunc13/__init__.py b/TestON/tests/OpticalFunc13/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/OpticalFunc13/__init__.py
+++ /dev/null
diff --git a/TestON/tests/PingallExample/PingallExample.py b/TestON/tests/PingallExample/PingallExample.py
index c03b0f1..914f48e 100644
--- a/TestON/tests/PingallExample/PingallExample.py
+++ b/TestON/tests/PingallExample/PingallExample.py
@@ -118,9 +118,9 @@
for i in range( 1, 14 ):
main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
+ sw="s" + str( i ),
+ ip=ONOS1Ip,
+ port=ONOS1Port )
mastershipCheck = main.TRUE
for i in range( 1, 14 ):
diff --git a/TestON/tests/PingallExample/__init__.py b/TestON/tests/PingallExample/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/PingallExample/__init__.py
+++ /dev/null
diff --git a/TestON/tests/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
index adbdb24..5673173 100644
--- a/TestON/tests/ProdFunc/ProdFunc.py
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -839,7 +839,7 @@
time.sleep( 10 )
main.step( "Get list of hosts from Mininet" )
- hostList = main.Mininet1.getHosts()
+ hostList = main.Mininet1.getHosts().keys()
main.log.info( hostList )
main.step( "Get host list in ONOS format" )
@@ -1122,9 +1122,6 @@
Check ONOS topology matches with mininet
"""
import json
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
- # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
main.log.report( "This testcase is testing if all ONOS nodes" +
" are in topology sync with mininet" )
main.log.report( "__________________________________" )
@@ -1171,43 +1168,19 @@
target=main.params[ 'PING' ][ 'target10' ],
pingTime=500 )
- main.step( "Create TestONTopology object" )
- global ctrls
- ctrls = []
- count = 1
- while True:
- temp = ()
- if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
- temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
- temp = temp + ( "ONOS" + str( count ), )
- temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
- temp = temp + \
- ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
- ctrls.append( temp )
- count = count + 1
- else:
- break
- global MNTopo
- Topo = TestONTopology(
- main.Mininet1,
- ctrls ) # can also add Intent API info for intent operations
- MNTopo = Topo
-
TopologyCheck = main.TRUE
main.step( "Compare ONOS Topology to MN Topology" )
devicesJson = main.ONOS2.devices()
linksJson = main.ONOS2.links()
portsJson = main.ONOS2.ports()
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
result1 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devicesJson ) )
+ mnSwitches, json.loads( devicesJson ), json.loads( portsJson ) )
result2 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( linksJson ) )
+ mnSwitches, mnLinks, json.loads( linksJson ) )
- result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
- # result = result1 and result2 and result3
result = result1 and result2
print "***********************"
@@ -1237,8 +1210,6 @@
down or up properly.
"""
- from sts.topology.teston_topology import TestONTopology
-
linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
main.log.report( "This testscase is killing a link to ensure that" +
@@ -1333,25 +1304,18 @@
# NOTE Check ping result here..add code for it
main.step( "Compare ONOS Topology to MN Topology" )
- Topo = TestONTopology(
- main.Mininet1,
- ctrls ) # can also add Intent API info for intent operations
- MNTopo = Topo
- TopologyCheck = main.TRUE
devicesJson = main.ONOS2.devices()
linksJson = main.ONOS2.links()
portsJson = main.ONOS2.ports()
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
result1 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devicesJson ) )
+ mnSwitches, json.loads( devicesJson ), json.loads( portsJson ) )
result2 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( linksJson ) )
- result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
+ mnSwitches, mnLinks, json.loads( linksJson ) )
- # result = result1 and result2 and result3
result = result1 and result2
print "***********************"
@@ -1381,7 +1345,6 @@
"""
Intent removal
"""
- import time
main.log.report( "This testcase removes any previously added intents" +
" before adding any new set of intents" )
main.log.report( "__________________________________" )
diff --git a/TestON/tests/ProdFunc/ProdFunc.py.save b/TestON/tests/ProdFunc/ProdFunc.py.save
deleted file mode 100644
index 00b895c..0000000
--- a/TestON/tests/ProdFunc/ProdFunc.py.save
+++ /dev/null
@@ -1,1518 +0,0 @@
-
-# Testing the basic functionality of ONOS Next
-# For sanity and driver functionality excercises only.
-
-import time
-# import sys
-# import os
-# import re
-import json
-
-time.sleep( 1 )
-
-
-class ProdFunc:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ):
- import time
- """
- Startup sequence:
- cell <name>
- onos-verify-cell
- onos-remove-raft-log
- git pull
- mvn clean install
- onos-package
- onos-install -f
- onos-wait-for-start
- """
- cellName = main.params[ 'ENV' ][ 'cellName' ]
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
- main.case( "Setting up test environment" )
- main.log.report(
- "This testcase is testing setting up test environment" )
- main.log.report( "__________________________________" )
-
- main.step( "Applying cell variable to environment" )
- cellResult = main.ONOSbench.setCell( cellName )
- verifyResult = main.ONOSbench.verifyCell()
-
- main.step( "Removing raft logs before a clen installation of ONOS" )
- main.ONOSbench.onosRemoveRaftLogs()
-
- main.step( "Git checkout and get version" )
- #main.ONOSbench.gitCheckout( "master" )
- gitPullResult = main.ONOSbench.gitPull()
- main.log.info( "git_pull_result = " + str( gitPullResult ))
- main.ONOSbench.getVersion( report=True )
-
- if gitPullResult == 1:
- main.step( "Using mvn clean & install" )
- main.ONOSbench.cleanInstall()
- elif gitPullResult == 0:
- main.log.report(
- "Git Pull Failed, look into logs for detailed reason" )
- main.cleanup()
- main.exit()
-
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
-
- main.step( "Installing ONOS package" )
- onosInstallResult = main.ONOSbench.onosInstall()
- if onosInstallResult == main.TRUE:
- main.log.report( "Installing ONOS package successful" )
- else:
- main.log.report( "Installing ONOS package failed" )
-
- onos1Isup = main.ONOSbench.isup()
- if onos1Isup == main.TRUE:
- main.log.report( "ONOS instance is up and ready" )
- else:
- main.log.report( "ONOS instance may not be up" )
-
- main.step( "Starting ONOS service" )
- startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
- main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
- main.step( "Starting Mininet CLI..." )
-
- # Starting the mininet using the old way
- main.step( "Starting Mininet ..." )
- netIsUp = main.Mininet1.startNet()
- if netIsUp:
- main.log.info("Mininet CLI is up")
-
- case1Result = ( packageResult and
- cellResult and verifyResult
- and onosInstallResult and
- onos1Isup and startResult )
- utilities.assert_equals( expect=main.TRUE, actual=case1Result,
- onpass="Test startup successful",
- onfail="Test startup NOT successful" )
-
- def CASE2( self, main ):
- """
- Switch Down
- """
- # NOTE: You should probably run a topology check after this
- import time
-
- main.case( "Switch down discovery" )
- main.log.report( "This testcase is testing a switch down discovery" )
- main.log.report( "__________________________________" )
-
- switchSleep = int( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
-
- description = "Killing a switch to ensure it is discovered correctly"
- main.log.report( description )
- main.case( description )
-
- # TODO: Make this switch parameterizable
- main.step( "Kill s28 " )
- main.log.report( "Deleting s28" )
- # FIXME: use new dynamic topo functions
- main.Mininet1.delSwitch( "s28" )
- main.log.info(
- "Waiting " +
- str( switchSleep ) +
- " seconds for switch down to be discovered" )
- time.sleep( switchSleep )
- # Peek at the deleted switch
- device = main.ONOS2.getDevice( dpid="0028" )
- print "device = ", device
- if device[ u'available' ] == 'False':
- case2Result = main.FALSE
- else:
- case2Result = main.TRUE
- utilities.assert_equals( expect=main.TRUE, actual=case2Result,
- onpass="Switch down discovery successful",
- onfail="Switch down discovery failed" )
-
- def CASE101( self, main ):
- """
- Cleanup sequence:
- onos-service <nodeIp> stop
- onos-uninstall
-
- TODO: Define rest of cleanup
-
- """
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
- main.case( "Cleaning up test environment" )
-
- main.step( "Testing ONOS kill function" )
- killResult = main.ONOSbench.onosKill( ONOS1Ip )
-
- main.step( "Stopping ONOS service" )
- stopResult = main.ONOSbench.onosStop( ONOS1Ip )
-
- main.step( "Uninstalling ONOS service" )
- uninstallResult = main.ONOSbench.onosUninstall()
-
- case11Result = killResult and stopResult and uninstallResult
- utilities.assert_equals( expect=main.TRUE, actual=case11Result,
- onpass="Cleanup successful",
- onfail="Cleanup failed" )
-
- def CASE3( self, main ):
- """
- Test 'onos' command and its functionality in driver
- """
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
- main.case( "Testing 'onos' command" )
-
- main.step( "Sending command 'onos -w <onos-ip> system:name'" )
- cmdstr1 = "system:name"
- cmdResult1 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr1 )
- main.log.info( "onos command returned: " + cmdResult1 )
-
- main.step( "Sending command 'onos -w <onos-ip> onos:topology'" )
- cmdstr2 = "onos:topology"
- cmdResult2 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr2 )
- main.log.info( "onos command returned: " + cmdResult2 )
-
- def CASE20( self ):
- """
- Exit from mininet cli
- reinstall ONOS
- """
- cellName = main.params[ 'ENV' ][ 'cellName' ]
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
- main.log.report( "This testcase exits the mininet cli and reinstalls" +
- "ONOS to switch over to Packet Optical topology" )
- main.log.report( "_____________________________________________" )
- main.case( "Disconnecting mininet and restarting ONOS" )
- main.step( "Disconnecting mininet and restarting ONOS" )
- mininetDisconnect = main.Mininet1.disconnect()
- print "mininetDisconnect = ", mininetDisconnect
-
- main.step( "Removing raft logs before a clen installation of ONOS" )
- main.ONOSbench.onosRemoveRaftLogs()
-
- main.step( "Applying cell variable to environment" )
- cellResult = main.ONOSbench.setCell( cellName )
- verifyResult = main.ONOSbench.verifyCell()
-
- onosInstallResult = main.ONOSbench.onosInstall()
- if onosInstallResult == main.TRUE:
- main.log.report( "Installing ONOS package successful" )
- else:
- main.log.report( "Installing ONOS package failed" )
-
- onos1Isup = main.ONOSbench.isup()
- if onos1Isup == main.TRUE:
- main.log.report( "ONOS instance is up and ready" )
- else:
- main.log.report( "ONOS instance may not be up" )
-
- main.step( "Starting ONOS service" )
- startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
- main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
- case20Result = mininetDisconnect and cellResult and verifyResult \
- and onosInstallResult and onos1Isup and \
- startResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case20Result,
- onpass= "Exiting functionality mininet topology and reinstalling" +
- " ONOS successful",
- onfail= "Exiting functionality mininet topology and reinstalling" +
- " ONOS failed" )
-
- def CASE21( self, main ):
- """
- On ONOS bench, run this command:
- ./~/ONOS/tools/test/bin/onos-topo-cfg
- which starts the rest and copies the links
- json file to the onos instance.
- Note that in case of Packet Optical, the links are not learnt
- from the topology, instead the links are learnt
- from the json config file
- """
- main.log.report(
- "This testcase starts the packet layer topology and REST" )
- main.log.report( "_____________________________________________" )
- main.case( "Starting LINC-OE and other components" )
- main.step( "Starting LINC-OE and other components" )
- startConsoleResult = main.LincOE1.startConsole()
- opticalMnScript = main.LincOE2.runOpticalMnScript()
- onosTopoCfgResult = main.ONOSbench.runOnosTopoCfg(
- instanceName=main.params[ 'CTRL' ][ 'ip1' ],
- jsonFile=main.params[ 'OPTICAL' ][ 'jsonfile' ] )
-
- print "start_console_result =", startConsoleResult
- print "optical_mn_script = ", opticalMnScript
- print "onos_topo_cfg_result =", onosTopoCfgResult
-
- case21Result = startConsoleResult and opticalMnScript and \
- onosTopoCfgResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case21Result,
- onpass="Packet optical topology spawned successsfully",
- onfail="Packet optical topology spawning failed" )
-
- def CASE22( self, main ):
- """
- Curretly we use, 4 linear switch optical topology and
- 2 packet layer mininet switches each with one host.
- Therefore, the roadmCount variable = 4,
- packetLayerSWCount variable = 2 and hostCount = 2
- and this is hardcoded in the testcase. If the topology changes,
- these hardcoded values need to be changed
- """
- main.log.report(
- "This testcase compares the optical+packet topology against what" +
- " is expected" )
- main.case( "Topology comparision" )
- main.step( "Topology comparision" )
- main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
- devicesResult = main.ONOS3.devices( jsonFormat=False )
-
- print "devices_result = ", devicesResult
- devicesLinewise = devicesResult.split( "\n" )
- devicesLinewise = devicesLinewise[ 1: ]
- roadmCount = 0
- packetLayerSWCount = 0
- for line in devicesLinewise:
- components = line.split( "," )
- availability = components[ 1 ].split( "=" )[ 1 ]
- type = components[ 3 ].split( "=" )[ 1 ]
- if availability == 'true' and type == 'ROADM':
- roadmCount += 1
- elif availability == 'true' and type == 'SWITCH':
- packetLayerSWCount += 1
- if roadmCount == 4:
- print "Number of Optical Switches = %d and is" % roadmCount +\
- " correctly detected"
- main.log.info(
- "Number of Optical Switches = " +
- str( roadmCount ) +
- " and is correctly detected" )
- opticalSWResult = main.TRUE
- else:
- print "Number of Optical Switches = %d and is wrong" % roadmCount
- main.log.info(
- "Number of Optical Switches = " +
- str( roadmCount ) +
- " and is wrong" )
- opticalSWResult = main.FALSE
-
- if packetLayerSWCount == 2:
- print "Number of Packet layer or mininet Switches = %d "\
- % packetLayerSWCount + "and is correctly detected"
- main.log.info(
- "Number of Packet layer or mininet Switches = " +
- str( packetLayerSWCount ) +
- " and is correctly detected" )
- packetSWResult = main.TRUE
- else:
- print "Number of Packet layer or mininet Switches = %d and"\
- % packetLayerSWCount + " is wrong"
- main.log.info(
- "Number of Packet layer or mininet Switches = " +
- str( packetLayerSWCount ) +
- " and is wrong" )
- packetSWResult = main.FALSE
- print "_________________________________"
-
- linksResult = main.ONOS3.links( jsonFormat=False )
- print "links_result = ", linksResult
- print "_________________________________"
-
- # NOTE:Since only point intents are added, there is no
- # requirement to discover the hosts
- # Therfore, the below portion of the code is commented.
- """
- #Discover hosts using pingall
- pingallResult = main.LincOE2.pingall()
-
- hostsResult = main.ONOS3.hosts( jsonFormat=False )
- main.log.info( "hosts_result = "+hostsResult )
- main.log.info( "_________________________________" )
- hostsLinewise = hostsResult.split( "\n" )
- hostsLinewise = hostsLinewise[ 1:-1 ]
- hostCount = 0
- for line in hostsLinewise:
- hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
- hostCount +=1
- if hostCount ==2:
- print "Number of hosts = %d and is correctly detected" %hostCount
- main.log.info( "Number of hosts = " + str( hostCount ) +" and \
- is correctly detected" )
- hostDiscovery = main.TRUE
- else:
- print "Number of hosts = %d and is wrong" %hostCount
- main.log.info( "Number of hosts = " + str( hostCount ) +" and \
- is wrong" )
- hostDiscovery = main.FALSE
- """
- case22Result = opticalSWResult and packetSWResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case22Result,
- onpass="Packet optical topology discovery successful",
- onfail="Packet optical topology discovery failed" )
-
- def CASE23( self, main ):
- import time
- """
- Add bidirectional point intents between 2 packet layer( mininet )
- devices and
- ping mininet hosts
- """
- main.log.report(
- "This testcase adds bidirectional point intents between 2 " +
- "packet layer( mininet ) devices and ping mininet hosts" )
- main.case( "Topology comparision" )
- main.step( "Adding point intents" )
- ptpIntentResult = main.ONOS3.addPointIntent(
- "of:0000ffffffff0001/1",
- "of:0000ffffffff0002/1" )
- if ptpIntentResult == main.TRUE:
- main.ONOS3.intents( jsonFormat=False )
- main.log.info( "Point to point intent install successful" )
-
- ptpIntentResult = main.ONOS3.addPointIntent(
- "of:0000ffffffff0002/1",
- "of:0000ffffffff0001/1" )
- if ptpIntentResult == main.TRUE:
- main.ONOS3.intents( jsonFormat=False )
- main.log.info( "Point to point intent install successful" )
-
- time.sleep( 10 )
- flowHandle = main.ONOS3.flows()
- main.log.info( "flows :" + flowHandle )
-
- # Sleep for 30 seconds to provide time for the intent state to change
- time.sleep( 30 )
- intentHandle = main.ONOS3.intents( jsonFormat=False )
- main.log.info( "intents :" + intentHandle )
-
- PingResult = main.TRUE
- count = 1
- main.log.info( "\n\nh1 is Pinging h2" )
- ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
- # ping = main.LincOE2.pinghost()
- if ping == main.FALSE and count < 5:
- count += 1
- PingResult = main.FALSE
- main.log.info(
- "Ping between h1 and h2 failed. Making attempt number " +
- str( count ) +
- " in 2 seconds" )
- time.sleep( 2 )
- elif ping == main.FALSE:
- main.log.info( "All ping attempts between h1 and h2 have failed" )
- PingResult = main.FALSE
- elif ping == main.TRUE:
- main.log.info( "Ping test between h1 and h2 passed!" )
- PingResult = main.TRUE
- else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
-
- if PingResult == main.FALSE:
- main.log.report(
- "Point intents for packet optical have not ben installed" +
- " correctly. Cleaning up" )
- if PingResult == main.TRUE:
- main.log.report(
- "Point Intents for packet optical have been " +
- "installed correctly" )
-
- case23Result = PingResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case23Result,
- onpass= "Point intents addition for packet optical and" +
- "Pingall Test successful",
- onfail= "Point intents addition for packet optical and" +
- "Pingall Test NOT successful" )
-
- def CASE24( self, main ):
- import time
- import json
- """
- Test Rerouting of Packet Optical by bringing a port down
- ( port 22 ) of a switch( switchID=1 ), so that link
- ( between switch1 port22 - switch4-port30 ) is inactive
- and do a ping test. If rerouting is successful,
- ping should pass. also check the flows
- """
- main.log.report(
- "This testcase tests rerouting and pings mininet hosts" )
- main.case( "Test rerouting and pings mininet hosts" )
- main.step( "Bring a port down and verify the link state" )
- main.LincOE1.portDown( swId="1", ptId="22" )
- linksNonjson = main.ONOS3.links( jsonFormat=False )
- main.log.info( "links = " + linksNonjson )
-
- links = main.ONOS3.links()
- main.log.info( "links = " + links )
-
- linksResult = json.loads( links )
- linksStateResult = main.FALSE
- for item in linksResult:
- if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
- 'src' ][ 'port' ] == "22":
- if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff04" and item[
- 'dst' ][ 'port' ] == "30":
- linksState = item[ 'state' ]
- if linksState == "INACTIVE":
- main.log.info(
- "Links state is inactive as expected due to one" +
- " of the ports being down" )
- main.log.report(
- "Links state is inactive as expected due to one" +
- " of the ports being down" )
- linksStateResult = main.TRUE
- break
- else:
- main.log.info(
- "Links state is not inactive as expected" )
- main.log.report(
- "Links state is not inactive as expected" )
- linksStateResult = main.FALSE
-
- print "links_state_result = ", linksStateResult
- time.sleep( 10 )
- flowHandle = main.ONOS3.flows()
- main.log.info( "flows :" + flowHandle )
-
- main.step( "Verify Rerouting by a ping test" )
- PingResult = main.TRUE
- count = 1
- main.log.info( "\n\nh1 is Pinging h2" )
- ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
- # ping = main.LincOE2.pinghost()
- if ping == main.FALSE and count < 5:
- count += 1
- PingResult = main.FALSE
- main.log.info(
- "Ping between h1 and h2 failed. Making attempt number " +
- str( count ) +
- " in 2 seconds" )
- time.sleep( 2 )
- elif ping == main.FALSE:
- main.log.info( "All ping attempts between h1 and h2 have failed" )
- PingResult = main.FALSE
- elif ping == main.TRUE:
- main.log.info( "Ping test between h1 and h2 passed!" )
- PingResult = main.TRUE
- else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
-
- if PingResult == main.TRUE:
- main.log.report( "Ping test successful " )
- if PingResult == main.FALSE:
- main.log.report( "Ping test failed" )
-
- case24Result = PingResult and linksStateResult
- utilities.assert_equals( expect=main.TRUE, actual=case24Result,
- onpass="Packet optical rerouting successful",
- onfail="Packet optical rerouting failed" )
-
- def CASE4( self, main ):
- import re
- import time
- main.log.report( "This testcase is testing the assignment of" +
- " all the switches to all the controllers and" +
- " discovering the hosts in reactive mode" )
- main.log.report( "__________________________________" )
- main.case( "Pingall Test" )
- main.step( "Assigning switches to controllers" )
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
- for i in range( 1, 29 ):
- if i == 1:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
- elif i >= 2 and i < 5:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
- elif i >= 5 and i < 8:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
- elif i >= 8 and i < 18:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
- elif i >= 18 and i < 28:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
- else:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
- SwitchMastership = main.TRUE
- for i in range( 1, 29 ):
- if i == 1:
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is " + str( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- SwitchMastership = SwitchMastership and main.TRUE
- else:
- SwitchMastership = main.FALSE
- elif i >= 2 and i < 5:
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is " + str( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- SwitchMastership = SwitchMastership and main.TRUE
- else:
- SwitchMastership = main.FALSE
- elif i >= 5 and i < 8:
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is " + str( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- SwitchMastership = SwitchMastership and main.TRUE
- else:
- SwitchMastership = main.FALSE
- elif i >= 8 and i < 18:
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is " + str( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- SwitchMastership = SwitchMastership and main.TRUE
- else:
- SwitchMastership = main.FALSE
- elif i >= 18 and i < 28:
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is " + str( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- SwitchMastership = SwitchMastership and main.TRUE
- else:
- SwitchMastership = main.FALSE
- else:
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is" + str( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- SwitchMastership = SwitchMastership and main.TRUE
- else:
- SwitchMastership = main.FALSE
-
- if SwitchMastership == main.TRUE:
- main.log.report( "Controller assignmnet successful" )
- else:
- main.log.report( "Controller assignmnet failed" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=SwitchMastership,
- onpass="MasterControllers assigned correctly" )
- """
- for i in range ( 1,29 ):
- main.Mininet1.assignSwController( sw=str( i ),count=5,
- ip1=ONOS1Ip,port1=ONOS1Port,
- ip2=ONOS2Ip,port2=ONOS2Port,
- ip3=ONOS3Ip,port3=ONOS3Port,
- ip4=ONOS4Ip,port4=ONOS4Port,
- ip5=ONOS5Ip,port5=ONOS5Port )
- """
- # REACTIVE FWD test
-
- main.step( "Get list of hosts from Mininet" )
- hostList = main.Mininet1.getHosts()
- main.log.info( hostList )
-
- main.step( "Get host list in ONOS format" )
- hostOnosList = main.ONOS2.getHostsId( hostList )
- main.log.info( hostOnosList )
- # time.sleep( 5 )
-
- main.step( "Pingall" )
- pingResult = main.FALSE
- time1 = time.time()
- pingResult = main.Mininet1.pingall()
- time2 = time.time()
- print "Time for pingall: %2f seconds" % ( time2 - time1 )
-
- # Start onos cli again because u might have dropped out of
- # onos prompt to the shell prompt
- # if there was no activity
- main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-
- case4Result = SwitchMastership and pingResult
- if pingResult == main.TRUE:
- main.log.report( "Pingall Test in reactive mode to" +
- " discover the hosts successful" )
- else:
- main.log.report( "Pingall Test in reactive mode to" +
- " discover the hosts failed" )
-
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case4Result,
- onpass="Controller assignment and Pingall Test successful",
- onfail="Controller assignment and Pingall Test NOT successful" )
-
- def CASE10( self ):
- main.log.report(
- "This testcase uninstalls the reactive forwarding app" )
- main.log.report( "__________________________________" )
- main.case( "Uninstalling reactive forwarding app" )
- # Unistall onos-app-fwd app to disable reactive forwarding
- appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
- main.log.info( "onos-app-fwd uninstalled" )
-
- # After reactive forwarding is disabled, the reactive flows on
- # switches timeout in 10-15s
- # So sleep for 15s
- time.sleep( 15 )
-
- flows = main.ONOS2.flows()
- main.log.info( flows )
-
- case10Result = appUninstallResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case10Result,
- onpass="Reactive forwarding app uninstallation successful",
- onfail="Reactive forwarding app uninstallation failed" )
-
-
- def CASE11( self ):
- # NOTE: This testcase require reactive forwarding mode enabled
- # NOTE: in the beginning and then uninstall it before adding
- # NOTE: point intents. Again the app is installed so that
- # NOTE: testcase 10 can be ran successively
- import time
- main.log.report(
- "This testcase moves a host from one switch to another to add" +
- "point intents between them and then perform ping" )
- main.log.report( "__________________________________" )
- main.log.info( "Moving host from one switch to another" )
- main.case( "Moving host from a device and attach it to another device" )
- main.step( "Moving host h9 from device s9 and attach it to s8" )
- main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
-
- time.sleep(15) #Time delay to have all the flows ready
- main.step( "Pingall" )
- pingResult = main.FALSE
- time1 = time.time()
- pingResult = main.Mininet1.pingall()
- time2 = time.time()
- print "Time for pingall: %2f seconds" % ( time2 - time1 )
-
- hosts = main.ONOS2.hosts( jsonFormat = False )
- main.log.info( hosts )
-
- main.case( "Uninstalling reactive forwarding app" )
- # Unistall onos-app-fwd app to disable reactive forwarding
- appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
- main.log.info( "onos-app-fwd uninstalled" )
-
- main.step( "Add point intents between hosts on the same device")
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003008/1",
- "of:0000000000003008/3" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003008/3",
- "of:0000000000003008/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- main.case( "Ping hosts on the same devices" )
- ping = main.Mininet1.pingHost( src = 'h8', target = 'h9' )
-
- '''
- main.case( "Installing reactive forwarding app" )
- # Install onos-app-fwd app to enable reactive forwarding
- appUninstallResult = main.ONOS2.featureInstall( "onos-app-fwd" )
- main.log.info( "onos-app-fwd installed" )
- '''
-
- if ping == main.FALSE:
- main.log.report(
- "Point intents for hosts on same devices haven't" +
- " been installed correctly. Cleaning up" )
- if ping == main.TRUE:
- main.log.report(
- "Point intents for hosts on same devices" +
- "installed correctly. Cleaning up" )
-
- case11Result = ping and pingResult
- utilities.assert_equals(
- expect = main.TRUE,
- actual = case11Result,
- onpass = "Point intents for hosts on same devices" +
- "Ping Test successful",
- onfail = "Point intents for hosts on same devices" +
- "Ping Test NOT successful" )
-
-
- def CASE12( self ):
- """
- Verify the default flows on each switch in proactive mode
- """
- main.log.report( "This testcase is verifying num of default" +
- " flows on each switch" )
- main.log.report( "__________________________________" )
- main.case( "Verify num of default flows on each switch" )
- main.step( "Obtaining the device id's and flowrule count on them" )
-
- case12Result = main.TRUE
- idList = main.ONOS2.getAllDevicesId()
- for id in idList:
- count = main.ONOS2.FlowAddedCount( id )
- main.log.info("count = " +count)
- if int(count) != 3:
- case12Result = main.FALSE
- break
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case12Result,
- onpass = "Expected default num of flows exist",
- onfail = "Expected default num of flows do not exist")
-
-
-
-
- def CASE6( self ):
- import time
- main.log.report( "This testcase is testing the addition of" +
- " host intents and then does pingall" )
- main.log.report( "__________________________________" )
- main.case( "Obtaining host id's" )
- main.step( "Get hosts" )
- hosts = main.ONOS2.hosts()
- main.log.info( hosts )
-
- main.step( "Get all devices id" )
- devicesIdList = main.ONOS2.getAllDevicesId()
- main.log.info( devicesIdList )
-
- # ONOS displays the hosts in hex format unlike mininet which does
- # in decimal format
- # So take care while adding intents
- """
- main.step( "Add host-to-host intents for mininet hosts h8 and h18 or
- ONOS hosts h8 and h12" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
- print "______________________________________________________"
- """
- for i in range( 8, 18 ):
- main.log.info(
- "Adding host intent between h" + str( i ) +
- " and h" + str( i + 10 ) )
- host1 = "00:00:00:00:00:" + \
- str( hex( i )[ 2: ] ).zfill( 2 ).upper()
- host2 = "00:00:00:00:00:" + \
- str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
- # NOTE: get host can return None
- # TODO: handle this
- host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
-
- host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
- main.ONOS2.addHostIntent( host1Id, host2Id )
-
- time.sleep( 10 )
- hIntents = main.ONOS2.intents( jsonFormat=False )
- main.log.info( "intents:" + hIntents )
- flows = main.ONOS2.flows()
- main.log.info( "flows:" + flows )
-
- count = 1
- i = 8
- PingResult = main.TRUE
- # while i<10:
- while i < 18:
- main.log.info(
- "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
- ping = main.Mininet1.pingHost(
- src="h" + str( i ), target="h" + str( i + 10 ) )
- if ping == main.FALSE and count < 5:
- count += 1
- # i = 8
- PingResult = main.FALSE
- main.log.report( "Ping between h" +
- str( i ) +
- " and h" +
- str( i +
- 10 ) +
- " failed. Making attempt number " +
- str( count ) +
- " in 2 seconds" )
- time.sleep( 2 )
- elif ping == main.FALSE:
- main.log.report( "All ping attempts between h" +
- str( i ) +
- " and h" +
- str( i +
- 10 ) +
- "have failed" )
- i = 19
- PingResult = main.FALSE
- elif ping == main.TRUE:
- main.log.info( "Ping test between h" +
- str( i ) +
- " and h" +
- str( i +
- 10 ) +
- "passed!" )
- i += 1
- PingResult = main.TRUE
- else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
- if PingResult == main.FALSE:
- main.log.report(
- "Ping all test after Host intent addition failed.Cleaning up" )
- # main.cleanup()
- # main.exit()
- if PingResult == main.TRUE:
- main.log.report(
- "Ping all test after Host intent addition successful" )
-
- case6Result = PingResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case6Result,
- onpass="Pingall Test after Host intents addition successful",
- onfail="Pingall Test after Host intents addition failed" )
-
- def CASE5( self, main ):
- import json
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
- # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
- main.log.report( "This testcase is testing if all ONOS nodes" +
- " are in topology sync with mininet" )
- main.log.report( "__________________________________" )
- main.case( "Comparing Mininet topology with the topology of ONOS" )
- main.step( "Start continuous pings" )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source1' ],
- target=main.params[ 'PING' ][ 'target1' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source2' ],
- target=main.params[ 'PING' ][ 'target2' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source3' ],
- target=main.params[ 'PING' ][ 'target3' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source4' ],
- target=main.params[ 'PING' ][ 'target4' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source5' ],
- target=main.params[ 'PING' ][ 'target5' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source6' ],
- target=main.params[ 'PING' ][ 'target6' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source7' ],
- target=main.params[ 'PING' ][ 'target7' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source8' ],
- target=main.params[ 'PING' ][ 'target8' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source9' ],
- target=main.params[ 'PING' ][ 'target9' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source10' ],
- target=main.params[ 'PING' ][ 'target10' ],
- pingTime=500 )
-
- main.step( "Create TestONTopology object" )
- global ctrls
- ctrls = []
- count = 1
- while True:
- temp = ()
- if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
- temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
- temp = temp + ( "ONOS" + str( count ), )
- temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
- temp = temp + \
- ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
- ctrls.append( temp )
- count = count + 1
- else:
- break
- global MNTopo
- Topo = TestONTopology(
- main.Mininet1,
- ctrls ) # can also add Intent API info for intent operations
- MNTopo = Topo
-
- TopologyCheck = main.TRUE
- main.step( "Compare ONOS Topology to MN Topology" )
- devicesJson = main.ONOS2.devices()
- linksJson = main.ONOS2.links()
- # portsJson = main.ONOS2.ports()
-
- result1 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devicesJson ) )
- result2 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( linksJson ) )
- # result3 = main.Mininet1.comparePorts(
- # MNTopo, json.loads( portsJson ) )
-
- # result = result1 and result2 and result3
- result = result1 and result2
-
- print "***********************"
-pr if result == main.TRUE:
- main.log.report( "ONOS" + " Topology matches MN Topology" )
- else:
- main.log.report( "ONOS" + " Topology does not match MN Topology" )
-
- utilities.assert_equals(
- expect=main.TRUE,
- actual=result,
- onpass="ONOS" +
- " Topology matches MN Topology",
- onfail="ONOS" +
- " Topology does not match MN Topology" )
-
- TopologyCheck = TopologyCheck and result
- utilities.assert_equals(
- expect=main.TRUE,
- actual=TopologyCheck,
- onpass="Topology checks passed",
- onfail="Topology checks failed" )
-
- def CASE7( self, main ):
- from sts.topology.teston_topology import TestONTopology
-
- linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
-
- main.log.report( "This testscase is killing a link to ensure that" +
- " link discovery is consistent" )
- main.log.report( "__________________________________" )
- main.log.report( "Killing a link to ensure that link discovery" +
- " is consistent" )
- main.case( "Killing a link to Ensure that Link Discovery" +
- "is Working Properly" )
- """
- main.step( "Start continuous pings" )
-
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source1' ],
- target=main.params[ 'PING' ][ 'target1' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source2' ],
- target=main.params[ 'PING' ][ 'target2' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source3' ],
- target=main.params[ 'PING' ][ 'target3' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source4' ],
- target=main.params[ 'PING' ][ 'target4' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source5' ],
- target=main.params[ 'PING' ][ 'target5' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source6' ],
- target=main.params[ 'PING' ][ 'target6' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source7' ],
- target=main.params[ 'PING' ][ 'target7' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source8' ],
- target=main.params[ 'PING' ][ 'target8' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source9' ],
- target=main.params[ 'PING' ][ 'target9' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source10' ],
- target=main.params[ 'PING' ][ 'target10' ],
- pingTime=500 )
- """
- main.step( "Determine the current number of switches and links" )
- topologyOutput = main.ONOS2.topology()
- topologyResult = main.ONOS1.getTopology( topologyOutput )
- activeSwitches = topologyResult[ 'deviceCount' ]
- links = topologyResult[ 'linkCount' ]
- print "activeSwitches = ", type( activeSwitches )
- print "links = ", type( links )
- main.log.info(
- "Currently there are %s switches and %s links" %
- ( str( activeSwitches ), str( links ) ) )
-
- main.step( "Kill Link between s3 and s28" )
- main.Mininet1.link( END1="s3", END2="s28", OPTION="down" )
- time.sleep( linkSleep )
- topologyOutput = main.ONOS2.topology()
- LinkDown = main.ONOS1.checkStatus(
- topologyOutput, activeSwitches, str(
- int( links ) - 2 ) )
- if LinkDown == main.TRUE:
- main.log.report( "Link Down discovered properly" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=LinkDown,
- onpass="Link Down discovered properly",
- onfail="Link down was not discovered in " +
- str( linkSleep ) +
- " seconds" )
-
- # Check ping result here..add code for it
-
- main.step( "Bring link between s3 and s28 back up" )
- LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" )
- time.sleep( linkSleep )
- topologyOutput = main.ONOS2.topology()
- LinkUp = main.ONOS1.checkStatus(
- topologyOutput,
- activeSwitches,
- str( links ) )
- if LinkUp == main.TRUE:
- main.log.report( "Link up discovered properly" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=LinkUp,
- onpass="Link up discovered properly",
- onfail="Link up was not discovered in " +
- str( linkSleep ) +
- " seconds" )
-
- # NOTE Check ping result here..add code for it
-
- main.step( "Compare ONOS Topology to MN Topology" )
- Topo = TestONTopology(
- main.Mininet1,
- ctrls ) # can also add Intent API info for intent operations
- MNTopo = Topo
- TopologyCheck = main.TRUE
-
- devicesJson = main.ONOS2.devices()
- linksJson = main.ONOS2.links()
- portsJson = main.ONOS2.ports()
-
- result1 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devicesJson ) )
- result2 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( linksJson ) )
- # result3 = main.Mininet1.comparePorts(
- # MNTopo, json.loads( portsJson ) )
-
- # result = result1 and result2 and result3
- result = result1 and result2
- print "***********************"
-
- if result == main.TRUE:
- main.log.report( "ONOS" + " Topology matches MN Topology" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=result,
- onpass="ONOS" +
- " Topology matches MN Topology",
- onfail="ONOS" +
- " Topology does not match MN Topology" )
-
- TopologyCheck = TopologyCheck and result
- utilities.assert_equals(
- expect=main.TRUE,
- actual=TopologyCheck,
- onpass="Topology checks passed",
- onfail="Topology checks failed" )
-
- result = LinkDown and LinkUp and TopologyCheck
- utilities.assert_equals( expect=main.TRUE, actual=result,
- onpass="Link failure is discovered correctly",
- onfail="Link Discovery failed" )
-
- def CASE8( self ):
- """
- Intent removal
- """
- import time
- main.log.report( "This testcase removes any previously added intents" +
- " before adding any new set of intents" )
- main.log.report( "__________________________________" )
- main.log.info( "intent removal" )
- main.case( "Removing installed intents" )
- main.step( "Obtain the intent id's" )
- intentResult = main.ONOS2.intents( jsonFormat=False )
- main.log.info( "intent_result = " + intentResult )
- intentLinewise = intentResult.split( "\n" )
-
- intentList = [line for line in intentLinewise \
- if line.startswith( "id=")]
- intentids = [line.split( "," )[ 0 ].split( "=" )[ 1 ] for line in \
- intentList]
- for id in intentids:
- print "id = ", id
-
- main.step(
- "Iterate through the intentids list and remove each intent" )
- for id in intentids:
- main.ONOS2.removeIntent( intentId=id )
-
- intentResult = main.ONOS2.intents( jsonFormat=False )
- main.log.info( "intent_result = " + intentResult )
-
- intentList = [line for line in intentResult.split( "\n" ) \
- if line.startswith( "id=")]
- intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
- intentList]
- for state in intentState:
- print state
-
- case8Result = main.TRUE
- for state in intentState:
- if state != 'WITHDRAWN':
- case8Result = main.FALSE
- break
-
- if case8Result == main.TRUE:
- main.log.report( "Intent removal successful" )
- else:
- main.log.report( "Intent removal failed" )
-
- PingResult = main.TRUE
- if case8Result == main.TRUE:
- i = 8
- while i < 18:
- main.log.info(
- "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
- ping = main.Mininet1.pingHost(
- src="h" + str( i ), target="h" + str( i + 10 ) )
- if ping == main.TRUE:
- i = 19
- PingResult = PingResult and main.TRUE
- elif ping == main.FALSE:
- i += 1
- PingResult = PingResult and main.FALSE
- else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
-
- # Note: If the ping result failed, that means the intents have been
- # withdrawn correctly.
- if PingResult == main.TRUE:
- main.log.report( "Installed intents have not been withdrawn correctly" )
- # main.cleanup()
- # main.exit()
- if PingResult == main.FALSE:
- main.log.report( "Installed intents have been withdrawn correctly" )
-
- case8Result = case8Result and PingResult
-
- if case8Result == main.FALSE:
- main.log.report( "Intent removal successful" )
- else:
- main.log.report( "Intent removal failed" )
-
- utilities.assert_equals( expect=main.FALSE, actual=case8Result,
- onpass="Intent removal test passed",
- onfail="Intent removal test failed" )
-
- def CASE9( self ):
- main.log.report(
- "This testcase adds point intents and then does pingall" )
- main.log.report( "__________________________________" )
- main.log.info( "Adding point intents" )
- main.case(
- "Adding bidirectional point for mn hosts" +
- "( h8-h18, h9-h19, h10-h20, h11-h21, h12-h22, " +
- "h13-h23, h14-h24, h15-h25, h16-h26, h17-h27 )" )
-
- main.step( "Add point intents for mn hosts h8 and h18 or" +
- "ONOS hosts h8 and h12" )
- # main.step(var1)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003008/1",
- "of:0000000000006018/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006018/1",
- "of:0000000000003008/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
- main.step(var2)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003009/1",
- "of:0000000000006019/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006019/1",
- "of:0000000000003009/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
- main.step(var3)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003010/1",
- "of:0000000000006020/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006020/1",
- "of:0000000000003010/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var4 = "Add point intents for mininet hosts h11 and h21 or" +\
- " ONOS hosts hB and h15"
- main.case(var4)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003011/1",
- "of:0000000000006021/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006021/1",
- "of:0000000000003011/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var5 = "Add point intents for mininet hosts h12 and h22 " +\
- "ONOS hosts hC and h16"
- main.case(var5)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003012/1",
- "of:0000000000006022/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006022/1",
- "of:0000000000003012/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var6 = "Add point intents for mininet hosts h13 and h23 or" +\
- " ONOS hosts hD and h17"
- main.case(var6)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003013/1",
- "of:0000000000006023/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006023/1",
- "of:0000000000003013/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var7 = "Add point intents for mininet hosts h14 and h24 or" +\
- " ONOS hosts hE and h18"
- main.case(var7)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003014/1",
- "of:0000000000006024/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006024/1",
- "of:0000000000003014/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var8 = "Add point intents for mininet hosts h15 and h25 or" +\
- " ONOS hosts hF and h19"
- main.case(var8)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003015/1",
- "of:0000000000006025/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006025/1",
- "of:0000000000003015/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var9 = "Add intents for mininet hosts h16 and h26 or" +\
- " ONOS hosts h10 and h1A"
- main.case(var9)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003016/1",
- "of:0000000000006026/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006026/1",
- "of:0000000000003016/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var10 = "Add point intents for mininet hosts h17 and h27 or" +\
- " ONOS hosts h11 and h1B"
- main.case(var10)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003017/1",
- "of:0000000000006027/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- #main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006027/1",
- "of:0000000000003017/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- #main.log.info( getIntentResult )
-
- print(
- "___________________________________________________________" )
-
- flowHandle = main.ONOS2.flows()
- #main.log.info( "flows :" + flowHandle )
-
- count = 1
- i = 8
- PingResult = main.TRUE
- while i < 18:
- main.log.info(
- "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
- ping = main.Mininet1.pingHost(
- src="h" + str( i ), target="h" + str( i + 10 ) )
- if ping == main.FALSE and count < 5:
- count += 1
- # i = 8
- PingResult = main.FALSE
- main.log.report( "Ping between h" +
- str( i ) +
- " and h" +
- str( i +
- 10 ) +
- " failed. Making attempt number " +
- str( count ) +
- " in 2 seconds" )
- time.sleep( 2 )
- elif ping == main.FALSE:
- main.log.report( "All ping attempts between h" +
- str( i ) +
- " and h" +
- str( i +
- 10 ) +
- "have failed" )
- i = 19
- PingResult = main.FALSE
- elif ping == main.TRUE:
- main.log.info( "Ping test between h" +
- str( i ) +
- " and h" +
- str( i +
- 10 ) +
- "passed!" )
- i += 1
- PingResult = main.TRUE
- else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
-
- if PingResult == main.FALSE:
- main.log.report(
- "Point intents have not ben installed correctly. Cleaning up" )
- # main.cleanup()
- # main.exit()
- if PingResult == main.TRUE:
- main.log.report( "Point Intents have been installed correctly" )
-
- case9Result = PingResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case9Result,
- onpass="Point intents addition and Pingall Test successful",
- onfail="Point intents addition and Pingall Test NOT successful" )
diff --git a/TestON/tests/ProdFunc/ProdFunc2.py b/TestON/tests/ProdFunc/ProdFunc2.py
deleted file mode 100644
index 2cd04c1..0000000
--- a/TestON/tests/ProdFunc/ProdFunc2.py
+++ /dev/null
@@ -1,1542 +0,0 @@
-
-# Testing the basic functionality of ONOS Next
-# For sanity and driver functionality excercises only.
-
-import time
-# import sys
-# import os
-# import re
-import json
-
-time.sleep( 1 )
-
-
-class ProdFunc:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ):
- import time
- """
- Startup sequence:
- cell <name>
- onos-verify-cell
- onos-remove-raft-log
- git pull
- mvn clean install
- onos-package
- onos-install -f
- onos-wait-for-start
- """
- cellName = main.params[ 'ENV' ][ 'cellName' ]
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
- main.case( "Setting up test environment" )
- main.log.report(
- "This testcase is testing setting up test environment" )
- main.log.report( "__________________________________" )
-
- main.step( "Applying cell variable to environment" )
- cellResult = main.ONOSbench.setCell( cellName )
- verifyResult = main.ONOSbench.verifyCell()
-
- main.step( "Removing raft logs before a clen installation of ONOS" )
- main.ONOSbench.onosRemoveRaftLogs()
-
- main.step( "Git checkout and get version" )
- #main.ONOSbench.gitCheckout( "master" )
- gitPullResult = main.ONOSbench.gitPull()
- main.log.info( "git_pull_result = " + str( gitPullResult ))
- main.ONOSbench.getVersion( report=True )
-
- if gitPullResult == 1:
- main.step( "Using mvn clean & install" )
- main.ONOSbench.cleanInstall()
- elif gitPullResult == 0:
- main.log.report(
- "Git Pull Failed, look into logs for detailed reason" )
- main.cleanup()
- main.exit()
-
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
-
- main.step( "Installing ONOS package" )
- onosInstallResult = main.ONOSbench.onosInstall()
- if onosInstallResult == main.TRUE:
- main.log.report( "Installing ONOS package successful" )
- else:
- main.log.report( "Installing ONOS package failed" )
-
- onos1Isup = main.ONOSbench.isup()
- if onos1Isup == main.TRUE:
- main.log.report( "ONOS instance is up and ready" )
- else:
- main.log.report( "ONOS instance may not be up" )
-
- main.step( "Starting ONOS service" )
- startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
- main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
- main.step( "Starting Mininet CLI..." )
-
- # Starting the mininet using the old way
- main.step( "Starting Mininet ..." )
- netIsUp = main.Mininet1.startNet()
- if netIsUp:
- main.log.info("Mininet CLI is up")
-
- case1Result = ( packageResult and
- cellResult and verifyResult
- and onosInstallResult and
- onos1Isup and startResult )
- utilities.assert_equals( expect=main.TRUE, actual=case1Result,
- onpass="Test startup successful",
- onfail="Test startup NOT successful" )
-
- def CASE2( self, main ):
- """
- Switch Down
- """
- # NOTE: You should probably run a topology check after this
- import time
-
- main.case( "Switch down discovery" )
- main.log.report( "This testcase is testing a switch down discovery" )
- main.log.report( "__________________________________" )
-
- switchSleep = int( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
-
- description = "Killing a switch to ensure it is discovered correctly"
- main.log.report( description )
- main.case( description )
-
- # TODO: Make this switch parameterizable
- main.step( "Kill s28 " )
- main.log.report( "Deleting s28" )
- # FIXME: use new dynamic topo functions
- main.Mininet1.delSwitch( "s28" )
- main.log.info(
- "Waiting " +
- str( switchSleep ) +
- " seconds for switch down to be discovered" )
- time.sleep( switchSleep )
- # Peek at the deleted switch
- device = main.ONOS2.getDevice( dpid="0028" )
- print "device = ", device
- if device[ u'available' ] == 'False':
- case2Result = main.FALSE
- else:
- case2Result = main.TRUE
- utilities.assert_equals( expect=main.TRUE, actual=case2Result,
- onpass="Switch down discovery successful",
- onfail="Switch down discovery failed" )
-
- def CASE101( self, main ):
- """
- Cleanup sequence:
- onos-service <nodeIp> stop
- onos-uninstall
-
- TODO: Define rest of cleanup
-
- """
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
- main.case( "Cleaning up test environment" )
-
- main.step( "Testing ONOS kill function" )
- killResult = main.ONOSbench.onosKill( ONOS1Ip )
-
- main.step( "Stopping ONOS service" )
- stopResult = main.ONOSbench.onosStop( ONOS1Ip )
-
- main.step( "Uninstalling ONOS service" )
- uninstallResult = main.ONOSbench.onosUninstall()
-
- case11Result = killResult and stopResult and uninstallResult
- utilities.assert_equals( expect=main.TRUE, actual=case11Result,
- onpass="Cleanup successful",
- onfail="Cleanup failed" )
-
- def CASE3( self, main ):
- """
- Test 'onos' command and its functionality in driver
- """
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
- main.case( "Testing 'onos' command" )
-
- main.step( "Sending command 'onos -w <onos-ip> system:name'" )
- cmdstr1 = "system:name"
- cmdResult1 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr1 )
- main.log.info( "onos command returned: " + cmdResult1 )
-
- main.step( "Sending command 'onos -w <onos-ip> onos:topology'" )
- cmdstr2 = "onos:topology"
- cmdResult2 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr2 )
- main.log.info( "onos command returned: " + cmdResult2 )
-
- def CASE20( self ):
- """
- Exit from mininet cli
- reinstall ONOS
- """
- cellName = main.params[ 'ENV' ][ 'cellName' ]
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
- main.log.report( "This testcase exits the mininet cli and reinstalls" +
- "ONOS to switch over to Packet Optical topology" )
- main.log.report( "_____________________________________________" )
- main.case( "Disconnecting mininet and restarting ONOS" )
- main.step( "Disconnecting mininet and restarting ONOS" )
- mininetDisconnect = main.Mininet1.disconnect()
- print "mininetDisconnect = ", mininetDisconnect
-
- main.step( "Removing raft logs before a clen installation of ONOS" )
- main.ONOSbench.onosRemoveRaftLogs()
-
- main.step( "Applying cell variable to environment" )
- cellResult = main.ONOSbench.setCell( cellName )
- verifyResult = main.ONOSbench.verifyCell()
-
- onosInstallResult = main.ONOSbench.onosInstall()
- if onosInstallResult == main.TRUE:
- main.log.report( "Installing ONOS package successful" )
- else:
- main.log.report( "Installing ONOS package failed" )
-
- onos1Isup = main.ONOSbench.isup()
- if onos1Isup == main.TRUE:
- main.log.report( "ONOS instance is up and ready" )
- else:
- main.log.report( "ONOS instance may not be up" )
-
- main.step( "Starting ONOS service" )
- startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
- main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
- case20Result = mininetDisconnect and cellResult and verifyResult \
- and onosInstallResult and onos1Isup and \
- startResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case20Result,
- onpass= "Exiting functionality mininet topology and reinstalling" +
- " ONOS successful",
- onfail= "Exiting functionality mininet topology and reinstalling" +
- " ONOS failed" )
-
- def CASE21( self, main ):
- """
- On ONOS bench, run this command:
- sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1
- which spawns packet optical topology and copies the links
- json file to the onos instance.
- Note that in case of Packet Optical, the links are not learnt
- from the topology, instead the links are learnt
- from the json config file
- """
- main.log.report(
- "This testcase starts the packet layer topology and REST" )
- main.log.report( "_____________________________________________" )
- main.case( "Starting LINC-OE and other components" )
- main.step( "Starting LINC-OE and other components" )
- appInstallResult = main.ONOS2.featureInstall( "onos-app-optical" )
- opticalMnScript = main.LincOE2.runOpticalMnScript()
-
- case21Result = opticalMnScript and appInstallResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case21Result,
- onpass="Packet optical topology spawned successsfully",
- onfail="Packet optical topology spawning failed" )
-
- def CASE22( self, main ):
- """
- Curretly we use, 10 optical switches(ROADM's) and
- 6 packet layer mininet switches each with one host.
- Therefore, the roadmCount variable = 10,
- packetLayerSWCount variable = 6, hostCount=6 and
- links=42.
- All this is hardcoded in the testcase. If the topology changes,
- these hardcoded values need to be changed
- """
- main.log.report(
- "This testcase compares the optical+packet topology against what" +
- " is expected" )
- main.case( "Topology comparision" )
- main.step( "Topology comparision" )
- main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
- devicesResult = main.ONOS3.devices( jsonFormat=False )
-
- print "devices_result = ", devicesResult
- devicesLinewise = devicesResult.split( "\n" )
- devicesLinewise = devicesLinewise[ 1: ]
- roadmCount = 0
- packetLayerSWCount = 0
- for line in devicesLinewise:
- components = line.split( "," )
- availability = components[ 1 ].split( "=" )[ 1 ]
- type = components[ 3 ].split( "=" )[ 1 ]
- if availability == 'true' and type == 'ROADM':
- roadmCount += 1
- elif availability == 'true' and type == 'SWITCH':
- packetLayerSWCount += 1
- if roadmCount == 10:
- print "Number of Optical Switches = %d and is" % roadmCount +\
- " correctly detected"
- main.log.info(
- "Number of Optical Switches = " +
- str( roadmCount ) +
- " and is correctly detected" )
- opticalSWResult = main.TRUE
- else:
- print "Number of Optical Switches = %d and is wrong" % roadmCount
- main.log.info(
- "Number of Optical Switches = " +
- str( roadmCount ) +
- " and is wrong" )
- opticalSWResult = main.FALSE
-
- if packetLayerSWCount == 6:
- print "Number of Packet layer or mininet Switches = %d "\
- % packetLayerSWCount + "and is correctly detected"
- main.log.info(
- "Number of Packet layer or mininet Switches = " +
- str( packetLayerSWCount ) +
- " and is correctly detected" )
- packetSWResult = main.TRUE
- else:
- print "Number of Packet layer or mininet Switches = %d and"\
- % packetLayerSWCount + " is wrong"
- main.log.info(
- "Number of Packet layer or mininet Switches = " +
- str( packetLayerSWCount ) +
- " and is wrong" )
- packetSWResult = main.FALSE
- print "_________________________________"
-
- linksResult = main.ONOS3.links( jsonFormat=False )
- print "links_result = ", linksResult
- print "_________________________________"
- linkActiveCount = linksResult.count("state=ACTIVE")
- main.log.info( "linkActiveCount = " + str( linkActiveCount ))
- if linkActiveCount == 42:
- linkActiveResult = main.TRUE
- main.log.info(
- "Number of links in ACTIVE state are correct")
- else:
- linkActiveResult = main.FALSE
- main.log.info(
- "Number of links in ACTIVE state are wrong")
-
- # NOTE:Since only point intents are added, there is no
- # requirement to discover the hosts
- # Therfore, the below portion of the code is commented.
- """
- #Discover hosts using pingall
- pingallResult = main.LincOE2.pingall()
-
- hostsResult = main.ONOS3.hosts( jsonFormat=False )
- main.log.info( "hosts_result = "+hostsResult )
- main.log.info( "_________________________________" )
- hostsLinewise = hostsResult.split( "\n" )
- hostsLinewise = hostsLinewise[ 1:-1 ]
- hostCount = 0
- for line in hostsLinewise:
- hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
- hostCount +=1
- if hostCount ==2:
- print "Number of hosts = %d and is correctly detected" %hostCount
- main.log.info( "Number of hosts = " + str( hostCount ) +" and \
- is correctly detected" )
- hostDiscovery = main.TRUE
- else:
- print "Number of hosts = %d and is wrong" %hostCount
- main.log.info( "Number of hosts = " + str( hostCount ) +" and \
- is wrong" )
- hostDiscovery = main.FALSE
- """
- case22Result = opticalSWResult and packetSWResult and \
- linkActiveResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case22Result,
- onpass="Packet optical topology discovery successful",
- onfail="Packet optical topology discovery failed" )
-
- def CASE23( self, main ):
- import time
- """
- Add bidirectional point intents between 2 packet layer( mininet )
- devices and
- ping mininet hosts
- """
- main.log.report(
- "This testcase adds bidirectional point intents between 2 " +
- "packet layer( mininet ) devices and ping mininet hosts" )
- main.case( "Topology comparision" )
- main.step( "Adding point intents" )
- ptpIntentResult = main.ONOS3.addPointIntent(
- "of:0000ffffffff0001/1",
- "of:0000ffffffff0005/1" )
- if ptpIntentResult == main.TRUE:
- main.ONOS3.intents( jsonFormat=False )
- main.log.info( "Point to point intent install successful" )
-
- ptpIntentResult = main.ONOS3.addPointIntent(
- "of:0000ffffffff0005/1",
- "of:0000ffffffff0001/1" )
- if ptpIntentResult == main.TRUE:
- main.ONOS3.intents( jsonFormat=False )
- main.log.info( "Point to point intent install successful" )
-
- time.sleep( 30 )
- flowHandle = main.ONOS3.flows()
- main.log.info( "flows :" + flowHandle )
-
- # Sleep for 30 seconds to provide time for the intent state to change
- time.sleep( 60 )
- intentHandle = main.ONOS3.intents( jsonFormat=False )
- main.log.info( "intents :" + intentHandle )
-
- PingResult = main.TRUE
- count = 1
- main.log.info( "\n\nh1 is Pinging h5" )
- ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
- # ping = main.LincOE2.pinghost()
- if ping == main.FALSE and count < 5:
- count += 1
- PingResult = main.FALSE
- main.log.info(
- "Ping between h1 and h5 failed. Making attempt number " +
- str( count ) +
- " in 2 seconds" )
- time.sleep( 2 )
- elif ping == main.FALSE:
- main.log.info( "All ping attempts between h1 and h5 have failed" )
- PingResult = main.FALSE
- elif ping == main.TRUE:
- main.log.info( "Ping test between h1 and h5 passed!" )
- PingResult = main.TRUE
- else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
-
- if PingResult == main.FALSE:
- main.log.report(
- "Point intents for packet optical have not ben installed" +
- " correctly. Cleaning up" )
- if PingResult == main.TRUE:
- main.log.report(
- "Point Intents for packet optical have been " +
- "installed correctly" )
-
- case23Result = PingResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case23Result,
- onpass= "Point intents addition for packet optical and" +
- "Pingall Test successful",
- onfail= "Point intents addition for packet optical and" +
- "Pingall Test NOT successful" )
-
- def CASE24( self, main ):
- import time
- import json
- """
- LINC uses its own switch IDs. You can use the following
- command on the LINC console to find the mapping between
- DPIDs and LINC IDs.
- rp(application:get_all_key(linc)).
-
- Test Rerouting of Packet Optical by bringing a port down
- ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
- so that link
- ( between switch1 port20 - switch5 port50 ) is inactive
- and do a ping test. If rerouting is successful,
- ping should pass. also check the flows
- """
- main.log.report(
- "This testcase tests rerouting and pings mininet hosts" )
- main.case( "Test rerouting and pings mininet hosts" )
- main.step( "Attach to the Linc-OE session" )
- attachConsole = main.LincOE1.attachLincOESession()
- print "attachConsole = ", attachConsole
-
- main.step( "Bring a port down and verify the link state" )
- main.LincOE1.portDown( swId="9", ptId="20" )
- linksNonjson = main.ONOS3.links( jsonFormat=False )
- main.log.info( "links = " + linksNonjson )
-
- linkInactiveCount = linksNonjson.count("state=INACTIVE")
- main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
- if linkInactiveCount == 2:
- main.log.info(
- "Number of links in INACTIVE state are correct")
- else:
- main.log.info(
- "Number of links in INACTIVE state are wrong")
-
- links = main.ONOS3.links()
- main.log.info( "links = " + links )
-
- linksResult = json.loads( links )
- linksStateResult = main.FALSE
- for item in linksResult:
- if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
- 'src' ][ 'port' ] == "20":
- if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
- 'dst' ][ 'port' ] == "50":
- linksState = item[ 'state' ]
- if linksState == "INACTIVE":
- main.log.info(
- "Links state is inactive as expected due to one" +
- " of the ports being down" )
- main.log.report(
- "Links state is inactive as expected due to one" +
- " of the ports being down" )
- linksStateResult = main.TRUE
- break
- else:
- main.log.info(
- "Links state is not inactive as expected" )
- main.log.report(
- "Links state is not inactive as expected" )
- linksStateResult = main.FALSE
-
- print "links_state_result = ", linksStateResult
- time.sleep( 10 )
- flowHandle = main.ONOS3.flows()
- main.log.info( "flows :" + flowHandle )
-
- main.step( "Verify Rerouting by a ping test" )
- PingResult = main.TRUE
- count = 1
- main.log.info( "\n\nh1 is Pinging h5" )
- ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
- # ping = main.LincOE2.pinghost()
- if ping == main.FALSE and count < 5:
- count += 1
- PingResult = main.FALSE
- main.log.info(
- "Ping between h1 and h5 failed. Making attempt number " +
- str( count ) +
- " in 2 seconds" )
- time.sleep( 2 )
- elif ping == main.FALSE:
- main.log.info( "All ping attempts between h1 and h5 have failed" )
- PingResult = main.FALSE
- elif ping == main.TRUE:
- main.log.info( "Ping test between h1 and h5 passed!" )
- PingResult = main.TRUE
- else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
-
- if PingResult == main.TRUE:
- main.log.report( "Ping test successful " )
- if PingResult == main.FALSE:
- main.log.report( "Ping test failed" )
-
- case24Result = PingResult and linksStateResult
- utilities.assert_equals( expect=main.TRUE, actual=case24Result,
- onpass="Packet optical rerouting successful",
- onfail="Packet optical rerouting failed" )
-
- def CASE4( self, main ):
- import re
- import time
- main.log.report( "This testcase is testing the assignment of" +
- " all the switches to all the controllers and" +
- " discovering the hosts in reactive mode" )
- main.log.report( "__________________________________" )
- main.case( "Pingall Test" )
- main.step( "Assigning switches to controllers" )
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
- for i in range( 1, 29 ):
- if i == 1:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
- elif i >= 2 and i < 5:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
- elif i >= 5 and i < 8:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
- elif i >= 8 and i < 18:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
- elif i >= 18 and i < 28:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
- else:
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
- SwitchMastership = main.TRUE
- for i in range( 1, 29 ):
- if i == 1:
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is " + str( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- SwitchMastership = SwitchMastership and main.TRUE
- else:
- SwitchMastership = main.FALSE
- elif i >= 2 and i < 5:
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is " + str( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- SwitchMastership = SwitchMastership and main.TRUE
- else:
- SwitchMastership = main.FALSE
- elif i >= 5 and i < 8:
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is " + str( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- SwitchMastership = SwitchMastership and main.TRUE
- else:
- SwitchMastership = main.FALSE
- elif i >= 8 and i < 18:
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is " + str( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- SwitchMastership = SwitchMastership and main.TRUE
- else:
- SwitchMastership = main.FALSE
- elif i >= 18 and i < 28:
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is " + str( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- SwitchMastership = SwitchMastership and main.TRUE
- else:
- SwitchMastership = main.FALSE
- else:
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is" + str( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- SwitchMastership = SwitchMastership and main.TRUE
- else:
- SwitchMastership = main.FALSE
-
- if SwitchMastership == main.TRUE:
- main.log.report( "Controller assignmnet successful" )
- else:
- main.log.report( "Controller assignmnet failed" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=SwitchMastership,
- onpass="MasterControllers assigned correctly" )
- """
- for i in range ( 1,29 ):
- main.Mininet1.assignSwController( sw=str( i ),count=5,
- ip1=ONOS1Ip,port1=ONOS1Port,
- ip2=ONOS2Ip,port2=ONOS2Port,
- ip3=ONOS3Ip,port3=ONOS3Port,
- ip4=ONOS4Ip,port4=ONOS4Port,
- ip5=ONOS5Ip,port5=ONOS5Port )
- """
- # REACTIVE FWD test
-
- main.step( "Get list of hosts from Mininet" )
- hostList = main.Mininet1.getHosts()
- main.log.info( hostList )
-
- main.step( "Get host list in ONOS format" )
- hostOnosList = main.ONOS2.getHostsId( hostList )
- main.log.info( hostOnosList )
- # time.sleep( 5 )
-
- main.step( "Pingall" )
- pingResult = main.FALSE
- time1 = time.time()
- pingResult = main.Mininet1.pingall()
- time2 = time.time()
- print "Time for pingall: %2f seconds" % ( time2 - time1 )
-
- # Start onos cli again because u might have dropped out of
- # onos prompt to the shell prompt
- # if there was no activity
- main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-
- case4Result = SwitchMastership and pingResult
- if pingResult == main.TRUE:
- main.log.report( "Pingall Test in reactive mode to" +
- " discover the hosts successful" )
- else:
- main.log.report( "Pingall Test in reactive mode to" +
- " discover the hosts failed" )
-
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case4Result,
- onpass="Controller assignment and Pingall Test successful",
- onfail="Controller assignment and Pingall Test NOT successful" )
-
- def CASE10( self ):
- main.log.report(
- "This testcase uninstalls the reactive forwarding app" )
- main.log.report( "__________________________________" )
- main.case( "Uninstalling reactive forwarding app" )
- # Unistall onos-app-fwd app to disable reactive forwarding
- appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
- main.log.info( "onos-app-fwd uninstalled" )
-
- # After reactive forwarding is disabled, the reactive flows on
- # switches timeout in 10-15s
- # So sleep for 15s
- time.sleep( 15 )
-
- flows = main.ONOS2.flows()
- main.log.info( flows )
-
- case10Result = appUninstallResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case10Result,
- onpass="Reactive forwarding app uninstallation successful",
- onfail="Reactive forwarding app uninstallation failed" )
-
-
- def CASE11( self ):
- # NOTE: This testcase require reactive forwarding mode enabled
- # NOTE: in the beginning and then uninstall it before adding
- # NOTE: point intents. Again the app is installed so that
- # NOTE: testcase 10 can be ran successively
- import time
- main.log.report(
- "This testcase moves a host from one switch to another to add" +
- "point intents between them and then perform ping" )
- main.log.report( "__________________________________" )
- main.log.info( "Moving host from one switch to another" )
- main.case( "Moving host from a device and attach it to another device" )
- main.step( "Moving host h9 from device s9 and attach it to s8" )
- main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
-
- time.sleep(15) #Time delay to have all the flows ready
- main.step( "Pingall" )
- pingResult = main.FALSE
- time1 = time.time()
- pingResult = main.Mininet1.pingall()
- time2 = time.time()
- print "Time for pingall: %2f seconds" % ( time2 - time1 )
-
- hosts = main.ONOS2.hosts( jsonFormat = False )
- main.log.info( hosts )
-
- main.case( "Uninstalling reactive forwarding app" )
- # Unistall onos-app-fwd app to disable reactive forwarding
- appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
- main.log.info( "onos-app-fwd uninstalled" )
-
- main.step( "Add point intents between hosts on the same device")
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003008/1",
- "of:0000000000003008/3" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003008/3",
- "of:0000000000003008/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- main.case( "Ping hosts on the same devices" )
- ping = main.Mininet1.pingHost( src = 'h8', target = 'h9' )
-
- '''
- main.case( "Installing reactive forwarding app" )
- # Install onos-app-fwd app to enable reactive forwarding
- appUninstallResult = main.ONOS2.featureInstall( "onos-app-fwd" )
- main.log.info( "onos-app-fwd installed" )
- '''
-
- if ping == main.FALSE:
- main.log.report(
- "Point intents for hosts on same devices haven't" +
- " been installed correctly. Cleaning up" )
- if ping == main.TRUE:
- main.log.report(
- "Point intents for hosts on same devices" +
- "installed correctly. Cleaning up" )
-
- case11Result = ping and pingResult
- utilities.assert_equals(
- expect = main.TRUE,
- actual = case11Result,
- onpass = "Point intents for hosts on same devices" +
- "Ping Test successful",
- onfail = "Point intents for hosts on same devices" +
- "Ping Test NOT successful" )
-
-
- def CASE12( self ):
- """
- Verify the default flows on each switch in proactive mode
- """
- main.log.report( "This testcase is verifying num of default" +
- " flows on each switch" )
- main.log.report( "__________________________________" )
- main.case( "Verify num of default flows on each switch" )
- main.step( "Obtaining the device id's and flowrule count on them" )
-
- case12Result = main.TRUE
- idList = main.ONOS2.getAllDevicesId()
- for id in idList:
- count = main.ONOS2.FlowAddedCount( id )
- main.log.info("count = " +count)
- if int(count) != 3:
- case12Result = main.FALSE
- break
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case12Result,
- onpass = "Expected default num of flows exist",
- onfail = "Expected default num of flows do not exist")
-
-
-
-
- def CASE6( self ):
- import time
- main.log.report( "This testcase is testing the addition of" +
- " host intents and then does pingall" )
- main.log.report( "__________________________________" )
- main.case( "Obtaining host id's" )
- main.step( "Get hosts" )
- hosts = main.ONOS2.hosts()
- main.log.info( hosts )
-
- main.step( "Get all devices id" )
- devicesIdList = main.ONOS2.getAllDevicesId()
- main.log.info( devicesIdList )
-
- # ONOS displays the hosts in hex format unlike mininet which does
- # in decimal format
- # So take care while adding intents
- """
- main.step( "Add host-to-host intents for mininet hosts h8 and h18 or
- ONOS hosts h8 and h12" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1" )
- hthIntentResult = main.ONOS2.addHostIntent(
- "00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
- print "______________________________________________________"
- """
- for i in range( 8, 18 ):
- main.log.info(
- "Adding host intent between h" + str( i ) +
- " and h" + str( i + 10 ) )
- host1 = "00:00:00:00:00:" + \
- str( hex( i )[ 2: ] ).zfill( 2 ).upper()
- host2 = "00:00:00:00:00:" + \
- str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
- # NOTE: get host can return None
- if host1:
- host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
- if host2:
- host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
- if host1Id and host2Id:
- main.ONOS2.addHostIntent( host1Id, host2Id )
-
- time.sleep( 10 )
- hIntents = main.ONOS2.intents( jsonFormat=False )
- main.log.info( "intents:" + hIntents )
- flows = main.ONOS2.flows()
- main.log.info( "flows:" + flows )
-
- count = 1
- i = 8
- PingResult = main.TRUE
- # while i<10:
- while i < 18:
- main.log.info(
- "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
- ping = main.Mininet1.pingHost(
- src="h" + str( i ), target="h" + str( i + 10 ) )
- if ping == main.FALSE and count < 5:
- count += 1
- # i = 8
- PingResult = main.FALSE
- main.log.report( "Ping between h" +
- str( i ) +
- " and h" +
- str( i +
- 10 ) +
- " failed. Making attempt number " +
- str( count ) +
- " in 2 seconds" )
- time.sleep( 2 )
- elif ping == main.FALSE:
- main.log.report( "All ping attempts between h" +
- str( i ) +
- " and h" +
- str( i +
- 10 ) +
- "have failed" )
- i = 19
- PingResult = main.FALSE
- elif ping == main.TRUE:
- main.log.info( "Ping test between h" +
- str( i ) +
- " and h" +
- str( i +
- 10 ) +
- "passed!" )
- i += 1
- PingResult = main.TRUE
- else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
- if PingResult == main.FALSE:
- main.log.report(
- "Ping all test after Host intent addition failed.Cleaning up" )
- # main.cleanup()
- # main.exit()
- if PingResult == main.TRUE:
- main.log.report(
- "Ping all test after Host intent addition successful" )
-
- case6Result = PingResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case6Result,
- onpass="Pingall Test after Host intents addition successful",
- onfail="Pingall Test after Host intents addition failed" )
-
- def CASE5( self, main ):
- import json
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
- # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
- main.log.report( "This testcase is testing if all ONOS nodes" +
- " are in topology sync with mininet" )
- main.log.report( "__________________________________" )
- main.case( "Comparing Mininet topology with the topology of ONOS" )
- main.step( "Start continuous pings" )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source1' ],
- target=main.params[ 'PING' ][ 'target1' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source2' ],
- target=main.params[ 'PING' ][ 'target2' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source3' ],
- target=main.params[ 'PING' ][ 'target3' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source4' ],
- target=main.params[ 'PING' ][ 'target4' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source5' ],
- target=main.params[ 'PING' ][ 'target5' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source6' ],
- target=main.params[ 'PING' ][ 'target6' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source7' ],
- target=main.params[ 'PING' ][ 'target7' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source8' ],
- target=main.params[ 'PING' ][ 'target8' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source9' ],
- target=main.params[ 'PING' ][ 'target9' ],
- pingTime=500 )
- main.Mininet2.pingLong(
- src=main.params[ 'PING' ][ 'source10' ],
- target=main.params[ 'PING' ][ 'target10' ],
- pingTime=500 )
-
- main.step( "Create TestONTopology object" )
- global ctrls
- ctrls = []
- count = 1
- while True:
- temp = ()
- if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
- temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
- temp = temp + ( "ONOS" + str( count ), )
- temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
- temp = temp + \
- ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
- ctrls.append( temp )
- count = count + 1
- else:
- break
- global MNTopo
- Topo = TestONTopology(
- main.Mininet1,
- ctrls ) # can also add Intent API info for intent operations
- MNTopo = Topo
-
- TopologyCheck = main.TRUE
- main.step( "Compare ONOS Topology to MN Topology" )
- devicesJson = main.ONOS2.devices()
- linksJson = main.ONOS2.links()
- # portsJson = main.ONOS2.ports()
-
- result1 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devicesJson ) )
- result2 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( linksJson ) )
- # result3 = main.Mininet1.comparePorts(
- # MNTopo, json.loads( portsJson ) )
-
- # result = result1 and result2 and result3
- result = result1 and result2
-
- print "***********************"
- if result == main.TRUE:
- main.log.report( "ONOS" + " Topology matches MN Topology" )
- else:
- main.log.report( "ONOS" + " Topology does not match MN Topology" )
-
- utilities.assert_equals(
- expect=main.TRUE,
- actual=result,
- onpass="ONOS" +
- " Topology matches MN Topology",
- onfail="ONOS" +
- " Topology does not match MN Topology" )
-
- TopologyCheck = TopologyCheck and result
- utilities.assert_equals(
- expect=main.TRUE,
- actual=TopologyCheck,
- onpass="Topology checks passed",
- onfail="Topology checks failed" )
-
- def CASE7( self, main ):
- from sts.topology.teston_topology import TestONTopology
-
- linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
-
- main.log.report( "This testscase is killing a link to ensure that" +
- " link discovery is consistent" )
- main.log.report( "__________________________________" )
- main.log.report( "Killing a link to ensure that link discovery" +
- " is consistent" )
- main.case( "Killing a link to Ensure that Link Discovery" +
- "is Working Properly" )
- """
- main.step( "Start continuous pings" )
-
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source1' ],
- target=main.params[ 'PING' ][ 'target1' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source2' ],
- target=main.params[ 'PING' ][ 'target2' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source3' ],
- target=main.params[ 'PING' ][ 'target3' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source4' ],
- target=main.params[ 'PING' ][ 'target4' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source5' ],
- target=main.params[ 'PING' ][ 'target5' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source6' ],
- target=main.params[ 'PING' ][ 'target6' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source7' ],
- target=main.params[ 'PING' ][ 'target7' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source8' ],
- target=main.params[ 'PING' ][ 'target8' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source9' ],
- target=main.params[ 'PING' ][ 'target9' ],
- pingTime=500 )
- main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source10' ],
- target=main.params[ 'PING' ][ 'target10' ],
- pingTime=500 )
- """
- main.step( "Determine the current number of switches and links" )
- topologyOutput = main.ONOS2.topology()
- topologyResult = main.ONOS1.getTopology( topologyOutput )
- activeSwitches = topologyResult[ 'deviceCount' ]
- links = topologyResult[ 'linkCount' ]
- print "activeSwitches = ", type( activeSwitches )
- print "links = ", type( links )
- main.log.info(
- "Currently there are %s switches and %s links" %
- ( str( activeSwitches ), str( links ) ) )
-
- main.step( "Kill Link between s3 and s28" )
- main.Mininet1.link( END1="s3", END2="s28", OPTION="down" )
- time.sleep( linkSleep )
- topologyOutput = main.ONOS2.topology()
- LinkDown = main.ONOS1.checkStatus(
- topologyOutput, activeSwitches, str(
- int( links ) - 2 ) )
- if LinkDown == main.TRUE:
- main.log.report( "Link Down discovered properly" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=LinkDown,
- onpass="Link Down discovered properly",
- onfail="Link down was not discovered in " +
- str( linkSleep ) +
- " seconds" )
-
- # Check ping result here..add code for it
-
- main.step( "Bring link between s3 and s28 back up" )
- LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" )
- time.sleep( linkSleep )
- topologyOutput = main.ONOS2.topology()
- LinkUp = main.ONOS1.checkStatus(
- topologyOutput,
- activeSwitches,
- str( links ) )
- if LinkUp == main.TRUE:
- main.log.report( "Link up discovered properly" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=LinkUp,
- onpass="Link up discovered properly",
- onfail="Link up was not discovered in " +
- str( linkSleep ) +
- " seconds" )
-
- # NOTE Check ping result here..add code for it
-
- main.step( "Compare ONOS Topology to MN Topology" )
- Topo = TestONTopology(
- main.Mininet1,
- ctrls ) # can also add Intent API info for intent operations
- MNTopo = Topo
- TopologyCheck = main.TRUE
-
- devicesJson = main.ONOS2.devices()
- linksJson = main.ONOS2.links()
- portsJson = main.ONOS2.ports()
-
- result1 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devicesJson ) )
- result2 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( linksJson ) )
- # result3 = main.Mininet1.comparePorts(
- # MNTopo, json.loads( portsJson ) )
-
- # result = result1 and result2 and result3
- result = result1 and result2
- print "***********************"
-
- if result == main.TRUE:
- main.log.report( "ONOS" + " Topology matches MN Topology" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=result,
- onpass="ONOS" +
- " Topology matches MN Topology",
- onfail="ONOS" +
- " Topology does not match MN Topology" )
-
- TopologyCheck = TopologyCheck and result
- utilities.assert_equals(
- expect=main.TRUE,
- actual=TopologyCheck,
- onpass="Topology checks passed",
- onfail="Topology checks failed" )
-
- result = LinkDown and LinkUp and TopologyCheck
- utilities.assert_equals( expect=main.TRUE, actual=result,
- onpass="Link failure is discovered correctly",
- onfail="Link Discovery failed" )
-
- def CASE8( self ):
- """
- Intent removal
- """
- import time
- main.log.report( "This testcase removes any previously added intents" +
- " before adding any new set of intents" )
- main.log.report( "__________________________________" )
- main.log.info( "intent removal" )
- main.case( "Removing installed intents" )
- main.step( "Obtain the intent id's" )
- intentResult = main.ONOS2.intents( jsonFormat=False )
- main.log.info( "intent_result = " + intentResult )
- intentLinewise = intentResult.split( "\n" )
-
- intentList = [line for line in intentLinewise \
- if line.startswith( "id=")]
- intentids = [line.split( "," )[ 0 ].split( "=" )[ 1 ] for line in \
- intentList]
- for id in intentids:
- print "id = ", id
-
- main.step(
- "Iterate through the intentids list and remove each intent" )
- for id in intentids:
- main.ONOS2.removeIntent( intentId=id )
-
- intentResult = main.ONOS2.intents( jsonFormat=False )
- main.log.info( "intent_result = " + intentResult )
-
- intentList = [line for line in intentResult.split( "\n" ) \
- if line.startswith( "id=")]
- intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
- intentList]
- for state in intentState:
- print state
-
- case8Result = main.TRUE
- for state in intentState:
- if state != 'WITHDRAWN':
- case8Result = main.FALSE
- break
-
- if case8Result == main.TRUE:
- main.log.report( "Intent removal successful" )
- else:
- main.log.report( "Intent removal failed" )
-
- PingResult = main.TRUE
- if case8Result == main.TRUE:
- i = 8
- while i < 18:
- main.log.info(
- "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
- ping = main.Mininet1.pingHost(
- src="h" + str( i ), target="h" + str( i + 10 ) )
- if ping == main.TRUE:
- i = 19
- PingResult = PingResult and main.TRUE
- elif ping == main.FALSE:
- i += 1
- PingResult = PingResult and main.FALSE
- else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
-
- # Note: If the ping result failed, that means the intents have been
- # withdrawn correctly.
- if PingResult == main.TRUE:
- main.log.report( "Installed intents have not been withdrawn correctly" )
- # main.cleanup()
- # main.exit()
- if PingResult == main.FALSE:
- main.log.report( "Installed intents have been withdrawn correctly" )
-
- case8Result = case8Result and PingResult
-
- if case8Result == main.FALSE:
- main.log.report( "Intent removal successful" )
- else:
- main.log.report( "Intent removal failed" )
-
- utilities.assert_equals( expect=main.FALSE, actual=case8Result,
- onpass="Intent removal test passed",
- onfail="Intent removal test failed" )
-
- def CASE9( self ):
- main.log.report(
- "This testcase adds point intents and then does pingall" )
- main.log.report( "__________________________________" )
- main.log.info( "Adding point intents" )
- main.case(
- "Adding bidirectional point for mn hosts" +
- "( h8-h18, h9-h19, h10-h20, h11-h21, h12-h22, " +
- "h13-h23, h14-h24, h15-h25, h16-h26, h17-h27 )" )
-
- main.step( "Add point intents for mn hosts h8 and h18 or" +
- "ONOS hosts h8 and h12" )
- # main.step(var1)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003008/1",
- "of:0000000000006018/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006018/1",
- "of:0000000000003008/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
- main.step(var2)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003009/1",
- "of:0000000000006019/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006019/1",
- "of:0000000000003009/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
- main.step(var3)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003010/1",
- "of:0000000000006020/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006020/1",
- "of:0000000000003010/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var4 = "Add point intents for mininet hosts h11 and h21 or" +\
- " ONOS hosts hB and h15"
- main.case(var4)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003011/1",
- "of:0000000000006021/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006021/1",
- "of:0000000000003011/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var5 = "Add point intents for mininet hosts h12 and h22 " +\
- "ONOS hosts hC and h16"
- main.case(var5)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003012/1",
- "of:0000000000006022/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006022/1",
- "of:0000000000003012/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var6 = "Add point intents for mininet hosts h13 and h23 or" +\
- " ONOS hosts hD and h17"
- main.case(var6)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003013/1",
- "of:0000000000006023/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006023/1",
- "of:0000000000003013/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var7 = "Add point intents for mininet hosts h14 and h24 or" +\
- " ONOS hosts hE and h18"
- main.case(var7)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003014/1",
- "of:0000000000006024/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006024/1",
- "of:0000000000003014/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var8 = "Add point intents for mininet hosts h15 and h25 or" +\
- " ONOS hosts hF and h19"
- main.case(var8)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003015/1",
- "of:0000000000006025/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006025/1",
- "of:0000000000003015/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var9 = "Add intents for mininet hosts h16 and h26 or" +\
- " ONOS hosts h10 and h1A"
- main.case(var9)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003016/1",
- "of:0000000000006026/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006026/1",
- "of:0000000000003016/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
-
- var10 = "Add point intents for mininet hosts h17 and h27 or" +\
- " ONOS hosts h11 and h1B"
- main.case(var10)
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003017/1",
- "of:0000000000006027/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- #main.log.info( getIntentResult )
-
- ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006027/1",
- "of:0000000000003017/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOS2.intents()
- main.log.info( "Point to point intent install successful" )
- #main.log.info( getIntentResult )
-
- print(
- "___________________________________________________________" )
-
- flowHandle = main.ONOS2.flows()
- #main.log.info( "flows :" + flowHandle )
-
- count = 1
- i = 8
- PingResult = main.TRUE
- while i < 18:
- main.log.info(
- "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
- ping = main.Mininet1.pingHost(
- src="h" + str( i ), target="h" + str( i + 10 ) )
- if ping == main.FALSE and count < 5:
- count += 1
- # i = 8
- PingResult = main.FALSE
- main.log.report( "Ping between h" +
- str( i ) +
- " and h" +
- str( i +
- 10 ) +
- " failed. Making attempt number " +
- str( count ) +
- " in 2 seconds" )
- time.sleep( 2 )
- elif ping == main.FALSE:
- main.log.report( "All ping attempts between h" +
- str( i ) +
- " and h" +
- str( i +
- 10 ) +
- "have failed" )
- i = 19
- PingResult = main.FALSE
- elif ping == main.TRUE:
- main.log.info( "Ping test between h" +
- str( i ) +
- " and h" +
- str( i +
- 10 ) +
- "passed!" )
- i += 1
- PingResult = main.TRUE
- else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
-
- if PingResult == main.FALSE:
- main.log.report(
- "Point intents have not ben installed correctly. Cleaning up" )
- # main.cleanup()
- # main.exit()
- if PingResult == main.TRUE:
- main.log.report( "Point Intents have been installed correctly" )
-
- case9Result = PingResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case9Result,
- onpass="Point intents addition and Pingall Test successful",
- onfail="Point intents addition and Pingall Test NOT successful" )
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.py b/TestON/tests/ProdFunc13/ProdFunc13.py
index ade6d07..a274c07 100644
--- a/TestON/tests/ProdFunc13/ProdFunc13.py
+++ b/TestON/tests/ProdFunc13/ProdFunc13.py
@@ -839,7 +839,7 @@
time.sleep( 10 )
main.step( "Get list of hosts from Mininet" )
- hostList = main.Mininet1.getHosts()
+ hostList = main.Mininet1.getHosts().keys()
main.log.info( hostList )
main.step( "Get host list in ONOS format" )
@@ -1122,9 +1122,6 @@
Check ONOS topology matches with mininet
"""
import json
- # assumes that sts is already in you PYTHONPATH
- from sts.topology.teston_topology import TestONTopology
- # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
main.log.report( "This testcase is testing if all ONOS nodes" +
" are in topology sync with mininet" )
main.log.report( "__________________________________" )
@@ -1171,43 +1168,19 @@
target=main.params[ 'PING' ][ 'target10' ],
pingTime=500 )
- main.step( "Create TestONTopology object" )
- global ctrls
- ctrls = []
- count = 1
- while True:
- temp = ()
- if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
- temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
- temp = temp + ( "ONOS" + str( count ), )
- temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
- temp = temp + \
- ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
- ctrls.append( temp )
- count = count + 1
- else:
- break
- global MNTopo
- Topo = TestONTopology(
- main.Mininet1,
- ctrls ) # can also add Intent API info for intent operations
- MNTopo = Topo
-
TopologyCheck = main.TRUE
main.step( "Compare ONOS Topology to MN Topology" )
devicesJson = main.ONOS2.devices()
linksJson = main.ONOS2.links()
portsJson = main.ONOS2.ports()
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
result1 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devicesJson ) )
+ mnSwitches, json.loads( devicesJson ), json.loads( portsJson ) )
result2 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( linksJson ) )
+ mnSwitches, mnLinks, json.loads( linksJson ) )
- result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
- # result = result1 and result2 and result3
result = result1 and result2
print "***********************"
@@ -1236,9 +1209,6 @@
Link discovery test case. Checks if ONOS can discover a link
down or up properly.
"""
-
- from sts.topology.teston_topology import TestONTopology
-
linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
main.log.report( "This testscase is killing a link to ensure that" +
@@ -1333,25 +1303,19 @@
# NOTE Check ping result here..add code for it
main.step( "Compare ONOS Topology to MN Topology" )
- Topo = TestONTopology(
- main.Mininet1,
- ctrls ) # can also add Intent API info for intent operations
- MNTopo = Topo
TopologyCheck = main.TRUE
devicesJson = main.ONOS2.devices()
linksJson = main.ONOS2.links()
portsJson = main.ONOS2.ports()
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
result1 = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads( devicesJson ) )
+ mnSwitches, json.loads( devicesJson ), json.loads( portsJson ) )
result2 = main.Mininet1.compareLinks(
- MNTopo,
- json.loads( linksJson ) )
- result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
+ mnSwitches, mnLinks, json.loads( linksJson ) )
- # result = result1 and result2 and result3
result = result1 and result2
print "***********************"
diff --git a/TestON/tests/ScaleOutTemplate/README b/TestON/tests/ScaleOutTemplate/README
deleted file mode 100644
index 2d5ae1c..0000000
--- a/TestON/tests/ScaleOutTemplate/README
+++ /dev/null
@@ -1,22 +0,0 @@
--------------------
-----Setup Guide----
--------------------
-
-CASE 1: init case; cleans and sets up enviornment, starts up node 1
-
-CASE 2: Increments scale case; starts up additional nodes, determined by 'SCALE' in params
- Ex: cluster size = 1 and scale = 2 ==> call CASE2 ==> cluster size = 3
-
-Params file:
- SCALE = cluster scale step size
- availableNodes = number of nodes you have provided data for in .topo file
-
- ENV:
- cellName = desired name of cell file to be created at runtime
- cellFeatures = list of features desired
- NOTE: webconsole, onos-api, onos-cli and onos-openflow are loaded automatically.
- adjust your test and feature list accordingly
- TEST:
- skipCleanInstall = set yes if you want to skip for the sake of test debugging, otherwise set no
-
-
diff --git a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.params b/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.params
deleted file mode 100644
index 4e3ffdb..0000000
--- a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.params
+++ /dev/null
@@ -1,60 +0,0 @@
-<PARAMS>
-
- <testcases>1,2,1,2,1,2,1,2</testcases>
-
- <SCALE>1,3,5,7</SCALE>
- <availableNodes>7</availableNodes>
-
- <ENV>
- <cellName>defaultCell</cellName>
- <cellApps></cellApps>
- </ENV>
-
- <TEST>
- <skipCleanInstall>yes</skipCleanInstall>
- </TEST>
-
- <GIT>
- <autopull>off</autopull>
- <checkout>master</checkout>
- </GIT>
-
- <CTRL>
- <USER>admin</USER>
-
- <ip1>OC1</ip1>
- <port1>6633</port1>
-
- <ip2>OC2</ip2>
- <port2>6633</port2>
-
- <ip3>OC3</ip3>
- <port3>6633</port3>
-
- <ip4>OC4</ip4>
- <port4>6633</port4>
-
- <ip5>OC5</ip5>
- <port5>6633</port5>
-
- <ip6>OC6</ip6>
- <port6>6633</port6>
-
- <ip7>OC7</ip7>
- <port7>6633</port7>
-
- </CTRL>
-
- <MN>
- <ip1>OCN</ip1>
- </MN>
-
- <BENCH>
- <user>admin</user>
- <ip1>OCN</ip1>
- </BENCH>
-
- <JSON>
- </JSON>
-
-</PARAMS>
diff --git a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.py b/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.py
deleted file mode 100644
index a8d21d2..0000000
--- a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.py
+++ /dev/null
@@ -1,121 +0,0 @@
-# ScaleOutTemplate
-#
-# CASE1 starts number of nodes specified in param file
-#
-# cameron@onlab.us
-
-import sys
-import os.path
-
-
-class ScaleOutTemplate:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ):
-
- import time
- global init
-
- try:
- if type(init) is not bool:
- init = False
- except NameError:
- init = False
-
- #Load values from params file
- checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
- gitPull = main.params[ 'GIT' ][ 'autopull' ]
- cellName = main.params[ 'ENV' ][ 'cellName' ]
- Apps = main.params[ 'ENV' ][ 'cellApps' ]
- BENCHUser = main.params[ 'BENCH' ][ 'user' ]
- maxNodes = int(main.params[ 'availableNodes' ])
- skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
- cellName = main.params[ 'ENV' ][ 'cellName' ]
-
- # -- INIT SECTION, ONLY RUNS ONCE -- #
- if init == False:
- init = True
- global clusterCount #number of nodes running
- global ONOSIp #list of ONOS IP addresses
- global scale
-
- clusterCount = 0
- ONOSIp = [ 0 ]
- scale = (main.params[ 'SCALE' ]).split(",")
- clusterCount = int(scale[0])
-
- #Populate ONOSIp with ips from params
- ONOSIp = [0]
- ONOSIp.extend(main.ONOSbench.getOnosIps())
- MN1Ip = ONOSIp[len(ONOSIp) -1]
- BENCHIp = ONOSIp[len(ONOSIp) -2]
-
- #git
- main.step( "Git checkout and pull " + checkoutBranch )
- if gitPull == 'on':
- checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
- pullResult = main.ONOSbench.gitPull()
- else:
- main.log.info( "Skipped git checkout and pull" )
-
- if skipMvn != "yes":
- mvnResult = main.ONOSbench.cleanInstall()
-
- # -- END OF INIT SECTION --#
-
- clusterCount = int(scale[0])
- scale.remove(scale[0])
-
- #kill off all onos processes
- main.log.step("Safety check, killing all ONOS processes")
- main.log.step("before initiating enviornment setup")
- for node in range(1, maxNodes + 1):
- main.ONOSbench.onosDie(ONOSIp[node])
-
- #Uninstall everywhere
- main.log.step( "Cleaning Enviornment..." )
- for i in range(1, maxNodes + 1):
- main.log.info(" Uninstalling ONOS " + str(i) )
- main.ONOSbench.onosUninstall( ONOSIp[i] )
-
- #construct the cell file
- main.log.info("Creating cell file")
- cellIp = []
- for node in range (1, clusterCount + 1):
- cellIp.append(ONOSIp[node])
-
- main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
-
- main.step( "Set Cell" )
- main.ONOSbench.setCell(cellName)
-
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
-
- main.step( "verify cells" )
- verifyCellResult = main.ONOSbench.verifyCell()
-
- main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." )
- for node in range(1, clusterCount + 1):
- main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
- main.ONOSbench.onosInstall( ONOSIp[node])
-
- for node in range(1, clusterCount + 1):
- for i in range( 2 ):
- isup = main.ONOSbench.isup( ONOSIp[node] )
- if isup:
- main.log.info("ONOS " + str(node) + " is up\n")
- break
- if not isup:
- main.log.report( "ONOS " + str(node) + " didn't start!" )
- main.log.info("Startup sequence complete")
-
- def CASE2( self, main ):
-
- print ("clusterCount: " + str(clusterCount))
- print ("scale: " + str(scale))
- print ("ONOSIp: " + str(ONOSIp))
- print ("INIT: " + str(init))
-
diff --git a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.topo b/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.topo
deleted file mode 100644
index d82f3fd..0000000
--- a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.topo
+++ /dev/null
@@ -1,144 +0,0 @@
-<TOPOLOGY>
-
- <COMPONENT>
-
- <ONOSbench>
- <host>OCN</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS><home>~/onos</home></COMPONENTS>
- </ONOSbench>
-
- <ONOS1cli>
- <host>OCN</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1cli>
-
- <ONOS2cli>
- <host>OCN</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2cli>
-
- <ONOS3cli>
- <host>OCN</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS3cli>
-
- <ONOS4cli>
- <host>OCN</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS4cli>
-
- <ONOS5cli>
- <host>OCN</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>6</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS5cli>
-
- <ONOS6cli>
- <host>OCN</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>7</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS6cli>
-
- <ONOS7cli>
- <host>OCN</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>8</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS7cli>
-
- <ONOS1>
- <host>OC1</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>9</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1>
-
- <ONOS2>
- <host>OC2</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>10</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2>
-
- <ONOS3>
- <host>OC3</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>11</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS3>
-
- <ONOS4>
- <host>OC4</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>12</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS4>
-
-
- <ONOS5>
- <host>OC5</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>13</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS5>
-
- <ONOS6>
- <host>OC6</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>14</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS6>
-
- <ONOS7>
- <host>OC7</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>15</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS7>
-
- </COMPONENT>
-
-</TOPOLOGY>
-
diff --git a/TestON/tests/ScaleOutTemplate/__init__.py b/TestON/tests/ScaleOutTemplate/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/ScaleOutTemplate/__init__.py
+++ /dev/null
diff --git a/TestON/tests/TopoConvNext/TopoConvNext.params b/TestON/tests/TopoConvNext/TopoConvNext.params
deleted file mode 100644
index 198befb..0000000
--- a/TestON/tests/TopoConvNext/TopoConvNext.params
+++ /dev/null
@@ -1,69 +0,0 @@
-<PARAMS>
- <testcases>1,2,3,2,3,2,3,2,4,2,3,2,3,2,3,2</testcases>
-
- <ENV>
- <cellName>topo_conv_test</cellName>
- </ENV>
-
- <GIT>
- #autoPull 'on' or 'off'
- <autoPull>off</autoPull>
- <checkout>master</checkout>
- </GIT>
-
- <CTRL>
- <user>admin</user>
- <ip1>10.128.174.1</ip1>
- <port1>6633</port1>
- <ip2>10.128.174.2</ip2>
- <port2>6633</port2>
- <ip3>10.128.174.3</ip3>
- <port3>6633</port3>
- <ip4>10.128.174.4</ip4>
- <port4>6633</port4>
- <ip5>10.128.174.5</ip5>
- <port5>6633</port5>
- <ip6>10.128.174.6</ip6>
- <port6>6633</port6>
- <ip7>10.128.174.7</ip7>
- <port7>6633</port7>
- </CTRL>
-
- <MN>
- <ip1>10.128.10.90</ip1>
- <ip2>10.128.10.91</ip2>
- </MN>
-
- <BENCH>
- <ip>10.128.174.10</ip>
- </BENCH>
-
- <TEST>
- <onosLogFile>/opt/onos/log/karaf*</onosLogFile>
-
- #Number of times to iterate each case
- <numIter>3</numIter>
- <numSwitch1>500</numSwitch1>
- <numSwitch2>400</numSwitch2>
- <numSwitch3>200</numSwitch3>
- <numSwitch4>300</numSwitch4>
- #Number of iterations to ignore initially
- <iterIgnore>1</iterIgnore>
-
- <topo_accumulator_config>
- large_topo_event_accumulator.cfg
- </topo_accumulator_config>
- <topo_config_name>
- org.onlab.onos.net.topology.impl.DefaultTopologyProvider.cfg
- </topo_config_name>
-
- <swDisc100Threshold>0,100000</swDisc100Threshold>
- </TEST>
-
- <JSON>
- <deviceTimestamp>topologyDeviceEventTimestamp</deviceTimestamp>
- <hostTimestamp>topologyHostEventTimestamp</hostTimestamp>
- <linkTimestamp>topologyLinkEventTimestamp</linkTimestamp>
- <graphTimestamp>topologyGraphEventTimestamp</graphTimestamp>
- </JSON>
-</PARAMS>
diff --git a/TestON/tests/TopoConvNext/TopoConvNext.py b/TestON/tests/TopoConvNext/TopoConvNext.py
deleted file mode 100644
index c114e48..0000000
--- a/TestON/tests/TopoConvNext/TopoConvNext.py
+++ /dev/null
@@ -1,1379 +0,0 @@
-# TopoPerfNext
-#
-# Topology Convergence scale-out test for ONOS-next
-# NOTE: This test supports up to 7 nodes scale-out scenario
-#
-# NOTE: Ensure that you have 'tablet.json' file
-# in the onos/tools/package/config directory
-# NOTE: You must start this test initially with 3 nodes
-#
-# andrew@onlab.us
-
-import time
-import sys
-import os
-import re
-
-
-class TopoConvNext:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ):
- """
- ONOS startup sequence
- """
- import time
-
- #******
- # Global cluster count for scale-out purposes
- global cluster_count
- global topo_iteration
- topo_iteration = 1
- cluster_count = 1
- #******
- cell_name = main.params[ 'ENV' ][ 'cellName' ]
-
- git_pull = main.params[ 'GIT' ][ 'autoPull' ]
- checkout_branch = main.params[ 'GIT' ][ 'checkout' ]
-
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
- ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
- ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
- ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
- ONOS6_ip = main.params[ 'CTRL' ][ 'ip6' ]
- ONOS7_ip = main.params[ 'CTRL' ][ 'ip7' ]
- MN1_ip = main.params[ 'MN' ][ 'ip1' ]
- BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
-
- main.case( "Setting up test environment" )
- main.log.info( "copying topology event accumulator config file" +
- " to ONOS package/etc/ directory" )
- topo_config_name = main.params[ 'TEST' ][ 'topo_config_name' ]
- topo_config =\
- main.params[ 'TEST' ][ 'topo_accumulator_config' ]
- main.ONOSbench.handle.sendline( "cp ~/" + topo_config +
- " ~/ONOS/tools/package/etc/" +
- topo_config_name )
- main.ONOSbench.handle.expect( "\$" )
-
- main.log.info( "Uninstalling previous instances" )
- #main.ONOSbench.onos_uninstall( node_ip=ONOS1_ip )
- main.ONOSbench.onos_uninstall( node_ip=ONOS2_ip )
- main.ONOSbench.onos_uninstall( node_ip=ONOS3_ip )
- main.ONOSbench.onos_uninstall( node_ip=ONOS4_ip )
- main.ONOSbench.onos_uninstall( node_ip=ONOS5_ip )
- main.ONOSbench.onos_uninstall( node_ip=ONOS6_ip )
- main.ONOSbench.onos_uninstall( node_ip=ONOS7_ip )
-
- main.log.report( "Setting up test environment" )
-
- main.step( "Creating cell file" )
- cell_file_result = main.ONOSbench.create_cell_file(
- BENCH_ip, cell_name, MN1_ip,
- "onos-core,onos-app-metrics",
- # ONOS1_ip, ONOS2_ip, ONOS3_ip )
- ONOS1_ip )
-
- main.step( "Applying cell file to environment" )
- cell_apply_result = main.ONOSbench.set_cell( cell_name )
- verify_cell_result = main.ONOSbench.verify_cell()
-
- main.step( "Removing raft logs" )
- main.ONOSbench.onos_remove_raft_logs()
- time.sleep( 10 )
-
- main.step( "Git checkout and pull " + checkout_branch )
- if git_pull == 'on':
- checkout_result = \
- main.ONOSbench.git_checkout( checkout_branch )
- pull_result = main.ONOSbench.git_pull()
- else:
- checkout_result = main.TRUE
- pull_result = main.TRUE
- main.log.info( "Skipped git checkout and pull" )
-
- main.log.report( "Commit information - " )
- main.ONOSbench.get_version()
-
- main.step( "Using mvn clean & install" )
- #mvn_result = main.ONOSbench.clean_install()
- mvn_result = main.TRUE
-
- main.step( "Set cell for ONOS cli env" )
- main.ONOS1cli.set_cell( cell_name )
- # main.ONOS2cli.set_cell( cell_name )
- # main.ONOS3cli.set_cell( cell_name )
-
- main.step( "Creating ONOS package" )
- package_result = main.ONOSbench.onos_package()
-
- # Start test with single node only
- main.step( "Installing ONOS package" )
- install1_result = main.ONOSbench.onos_install( node=ONOS1_ip )
- #install2_result = main.ONOSbench.onos_install( node=ONOS2_ip )
- #install3_result = main.ONOSbench.onos_install( node=ONOS3_ip )
-
- time.sleep( 10 )
-
- main.step( "Start onos cli" )
- cli1 = main.ONOS1cli.start_onos_cli( ONOS1_ip )
- #cli2 = main.ONOS2cli.start_onos_cli( ONOS2_ip )
- #cli3 = main.ONOS3cli.start_onos_cli( ONOS3_ip )
-
- main.step( "Enable metrics feature" )
- # main.ONOS1cli.feature_install( "onos-app-metrics" )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=cell_file_result and cell_apply_result and
- verify_cell_result and checkout_result and
- pull_result and mvn_result and
- install1_result, # and install2_result and
- # install3_result,
- onpass="Test Environment setup successful",
- onfail="Failed to setup test environment" )
-
- def CASE2( self, main ):
- """
- 100 Switch discovery latency
-
- Important:
- This test case can be potentially dangerous if
- your machine has previously set iptables rules.
- One of the steps of the test case will flush
- all existing iptables rules.
- Note:
- You can specify the number of switches in the
- params file to adjust the switch discovery size
- ( and specify the corresponding topology in Mininet1
- .topo file )
- """
- import time
- import subprocess
- import os
- import requests
- import json
- import numpy
-
- ONOS_ip_list = []
- ONOS_ip_list.append( '0' )
- ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip1' ] )
- ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip2' ] )
- ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip3' ] )
- ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip4' ] )
- ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip5' ] )
- ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip6' ] )
- ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip7' ] )
- MN1_ip = main.params[ 'MN' ][ 'ip1' ]
- ONOS_user = main.params[ 'CTRL' ][ 'user' ]
-
- default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
-
- # Number of iterations of case
- num_iter = main.params[ 'TEST' ][ 'numIter' ]
- iter_ignore = int( main.params[ 'TEST' ][ 'iterIgnore' ] )
-
- #***********
- # Global number of switches that change
- # throughout the test
- global num_sw
- global topo_iteration
- global cluster_count
- if topo_iteration == 1:
- num_sw = main.params[ 'TEST' ][ 'numSwitch1' ]
- elif topo_iteration == 2:
- num_sw = main.params[ 'TEST' ][ 'numSwitch2' ]
- elif topo_iteration == 3:
- num_sw = main.params[ 'TEST' ][ 'numSwitch3' ]
- elif topo_iteration == 4:
- num_sw = main.params[ 'TEST' ][ 'numSwitch4' ]
- #***********
-
- # Timestamp 'keys' for json metrics output.
- # These are subject to change, hence moved into params
- deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
- graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
-
- # Threshold for this test case
- sw_disc_threshold_str = main.params[ 'TEST' ][ 'swDisc100Threshold' ]
- sw_disc_threshold_obj = sw_disc_threshold_str.split( "," )
- sw_disc_threshold_min = int( sw_disc_threshold_obj[ 0 ] )
- sw_disc_threshold_max = int( sw_disc_threshold_obj[ 1 ] )
-
- assertion = main.TRUE
- sw_discovery_lat_list = []
- syn_ack_delta_list = []
-
- main.case( str( num_sw ) + " switches distributed across " +
- str( cluster_count ) + " nodes convergence latency" )
-
- main.log.report( "Large topology convergence and scale-out test" )
- main.log.report( "Currently active ONOS node(s): " )
- report_str = "Node "
- for node in range( 1, cluster_count + 1 ):
- report_str += ( str( node ) + " " )
- main.log.report( report_str )
- main.log.report( "Topology size: " + str( num_sw ) + " switches" )
-
- main.step( "Distributing " + num_sw + " switches to each ONOS" )
- index = 1
- for node in range( 1, cluster_count + 1 ):
- for i in range( index, ( int( num_sw ) / cluster_count ) + index ):
- main.Mininet1.assign_sw_controller(
- sw=str( i ),
- ip1=ONOS_ip_list[ node ],
- port1=default_sw_port )
- index = i + 1
- # for i in range( 1, int( num_sw )+1 ):
- # main.Mininet1.assign_sw_controller(
- # sw=str( i ),
- # ip1="10.128.174.1",
- # port1="6633" )
-
- main.log.info( "Please check ptpd configuration to ensure " +
- "all nodes' system times are in sync" )
-
- time.sleep( 10 )
-
- for i in range( 0, int( num_iter ) ):
- main.step( "Set iptables rule to block sw connections" )
-
- # INPUT rules
- main.ONOS1.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
- main.ONOS2.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
- main.ONOS3.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
- main.ONOS4.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
- main.ONOS5.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
- main.ONOS6.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
- main.ONOS7.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-
- # OUTPUT rules
- main.ONOS1.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
- main.ONOS2.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
- main.ONOS3.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
- main.ONOS4.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
- main.ONOS5.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
- main.ONOS6.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
- main.ONOS7.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s " +
- MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-
- main.log.info( "Please wait for switch connection to timeout" )
-
- # time.sleep( 60 )
- # if cluster_count >= 3:
- # time.sleep( 60 )
- # if cluster_count >= 5:
- # time.sleep( 30 )
- # if cluster_count >= 6:
- # time.sleep( 30 )
-
- if cluster_count >= 3:
- main.ONOS1.handle.sendline(
- "tshark -i eth0 -t e | " +
- "grep 'SYN, ACK' | grep '6633' >" +
- "/tmp/syn_ack_onos1_iter" +
- str( i ) +
- ".txt &" )
- main.ONOS2.handle.sendline(
- "tshark -i eth0 -t e | " +
- "grep 'SYN, ACK' | grep '6633' >" +
- "/tmp/syn_ack_onos2_iter" +
- str( i ) +
- ".txt &" )
- main.ONOS3.handle.sendline(
- "tshark -i eth0 -t e | " +
- "grep 'SYN, ACK' | grep '6633' >" +
- "/tmp/syn_ack_onos3_iter" +
- str( i ) +
- ".txt &" )
- if cluster_count >= 4:
- main.ONOS4.handle.sendline(
- "tshark -i eth0 -t e | " +
- "grep 'SYN, ACK' | grep '6633' >" +
- "/tmp/syn_ack_onos4_iter" +
- str( i ) +
- ".txt &" )
- if cluster_count >= 5:
- main.ONOS5.handle.sendline(
- "tshark -i eth0 -t e | " +
- "grep 'SYN, ACK' | grep '6633' >" +
- "/tmp/syn_ack_onos5_iter" +
- str( i ) +
- ".txt &" )
- if cluster_count >= 6:
- main.ONOS6.handle.sendline(
- "tshark -i eth0 -t e | " +
- "grep 'SYN, ACK' | grep '6633' >" +
- "/tmp/syn_ack_onos6_iter" +
- str( i ) +
- ".txt &" )
- if cluster_count == 7:
- main.ONOS7.handle.sendline(
- "tshark -i eth0 -t e | " +
- "grep 'SYN, ACK' | grep '6633' >" +
- "/tmp/syn_ack_onos6_iter" +
- str( i ) +
- ".txt &" )
-
- # NOTE:
- # Delay before checking devices to
- # help prevent timing out from CLI
- # due to multiple command issuing
- time.sleep( 20 )
-
- loop = True
- loop_count = 0
- device_count = 0
- while loop_count < 60 and loop:
- main.log.info( "Checking devices for device down" )
-
- temp_len = 0
- device_str1 = main.ONOS1cli.devices(
- node_ip=ONOS_ip_list[ 1 ] )
- device_json1 = json.loads( device_str1 )
- json_len = len( device_json1 )
-
- # NOTE: May want to check the rest of
- # the ONOS instances for device down as well
-
- for device1 in device_json1:
- temp_len = temp_len + 1
- if device1[ 'available' ]:
- loop = True
- break
- # if I'm on the last json object and I still haven't
- # broken out of the loop, it means there were
- # no available devices
- elif temp_len == json_len - 1:
- main.log.info( "Temp length: " + str( temp_len ) )
- main.step( "Flushing iptables and obtaining t0" )
- t0_system = time.time() * 1000
-
- main.ONOS1.handle.sendline( "sudo iptables -F" )
- main.ONOS2.handle.sendline( "sudo iptables -F" )
- main.ONOS3.handle.sendline( "sudo iptables -F" )
- main.ONOS4.handle.sendline( "sudo iptables -F" )
- main.ONOS5.handle.sendline( "sudo iptables -F" )
- main.ONOS6.handle.sendline( "sudo iptables -F" )
- main.ONOS7.handle.sendline( "sudo iptables -F" )
-
- loop = False
- break
-
- loop_count += 1
- time.sleep( 1 )
-
- main.log.info( "System time t0: " + str( t0_system ) )
-
- counter_loop = 0
- counter_avail1 = 0
- counter_avail2 = 0
- counter_avail3 = 0
- counter_avail4 = 0
- counter_avail5 = 0
- counter_avail6 = 0
- counter_avail7 = 0
- onos1_dev = False
- onos2_dev = False
- onos3_dev = False
- onos4_dev = False
- onos5_dev = False
- onos6_dev = False
- onos7_dev = False
-
- # TODO: Think of a more elegant way to check all
- # switches across all nodes
- # Goodluck debugging this loop
- while counter_loop < 60:
- for node in range( 1, cluster_count + 1 ):
- if node == 1 and not onos1_dev:
- main.log.info( "Checking node 1 for device " +
- "discovery" )
- device_str_obj1 = main.ONOS1cli.devices(
- node_ip=ONOS_ip_list[ 1 ] )
- device_json1 = json.loads( device_str_obj1 )
- for device1 in device_json1:
- if device1[ 'available' ]:
- counter_avail1 += 1
- if counter_avail1 == int( num_sw ):
- onos1_dev = True
- main.log.info( "All devices have been" +
- " discovered on ONOS1" )
- else:
- counter_avail1 = 0
- if node == 2 and not onos2_dev:
- main.log.info( "Checking node 2 for device " +
- "discovery" )
- device_str_obj2 = main.ONOS2cli.devices(
- node_ip=ONOS_ip_list[ 2 ] )
- device_json2 = json.loads( device_str_obj2 )
- for device2 in device_json2:
- if device2[ 'available' ]:
- counter_avail2 += 1
- if counter_avail2 == int( num_sw ):
- onos2_dev = True
- main.log.info( "All devices have been" +
- " discovered on ONOS2" )
- else:
- counter_avail2 = 0
- if node == 3 and not onos3_dev:
- main.log.info( "Checking node 3 for device " +
- "discovery" )
- device_str_obj3 = main.ONOS3cli.devices(
- node_ip=ONOS_ip_list[ 3 ] )
- device_json3 = json.loads( device_str_obj3 )
- for device3 in device_json3:
- if device3[ 'available' ]:
- counter_avail3 += 1
- if counter_avail3 == int( num_sw ):
- onos3_dev = True
- main.log.info( "All devices have been" +
- " discovered on ONOS3" )
- else:
- counter_avail3 = 0
- if node == 4 and not onos4_dev:
- main.log.info( "Checking node 4 for device " +
- "discovery" )
- device_str_obj4 = main.ONOS4cli.devices(
- node_ip=ONOS_ip_list[ 4 ] )
- device_json4 = json.loads( device_str_obj4 )
- for device4 in device_json4:
- if device4[ 'available' ]:
- counter_avail4 += 1
- if counter_avail4 == int( num_sw ):
- onos4_dev = True
- main.log.info( "All devices have been" +
- " discovered on ONOS4" )
- else:
- counter_avail4 = 0
- if node == 5 and not onos5_dev:
- main.log.info( "Checking node 5 for device " +
- "discovery" )
- device_str_obj5 = main.ONOS5cli.devices(
- node_ip=ONOS_ip_list[ 5 ] )
- device_json5 = json.loads( device_str_obj5 )
- for device5 in device_json5:
- if device5[ 'available' ]:
- counter_avail5 += 1
- if counter_avail5 == int( num_sw ):
- onos5_dev = True
- main.log.info( "All devices have been" +
- " discovered on ONOS5" )
- else:
- counter_avail5 = 0
- if node == 6 and not onos6_dev:
- main.log.info( "Checking node 6 for device " +
- "discovery" )
- device_str_obj6 = main.ONOS6cli.devices(
- node_ip=ONOS_ip_list[ 6 ] )
- device_json6 = json.loads( device_str_obj6 )
- for device6 in device_json6:
- if device6[ 'available' ]:
- counter_avail6 += 1
- if counter_avail6 == int( num_sw ):
- onos6_dev = True
- main.log.info( "All devices have been" +
- " discovered on ONOS6" )
- else:
- counter_avail6 = 0
- if node == 7 and not onos7_dev:
- main.log.info( "Checking node 7 for device " +
- "discovery" )
- device_str_obj7 = main.ONOS7cli.devices(
- node_ip=ONOS_ip_list[ 7 ] )
- device_json7 = json.loads( device_str_obj7 )
- for device7 in device_json7:
- if device7[ 'available' ]:
- counter_avail7 += 1
- if counter_avail7 == int( num_sw ):
- onos7_dev = True
- main.log.info( "All devices have been" +
- " discovered on ONOS7" )
- else:
- counter_avail7 = 0
- # END node loop
-
- # TODO: clean up this mess of an if statements if possible
- # Treat each if as a separate test case with the given
- # cluster count. Hence when the cluster count changes
- # the desired calculations will be made
- if cluster_count == 1:
- if onos1_dev:
- main.log.info( "All devices have been discovered" +
- " on all ONOS instances" )
- time.sleep( 5 )
- json_str_metrics_1 =\
- main.ONOS1cli.topology_events_metrics()
- json_obj_1 = json.loads( json_str_metrics_1 )
- graph_timestamp_1 =\
- json_obj_1[ graphTimestamp ][ 'value' ]
-
- graph_lat_1 = \
- int( graph_timestamp_1 ) - int( t0_system )
-
- main.log.info( "Graph Timestamp ONOS1: " +
- str( graph_timestamp_1 ) )
-
- if graph_lat_1 > sw_disc_threshold_min\
- and graph_lat_1 < sw_disc_threshold_max\
- and int( i ) > iter_ignore:
- sw_discovery_lat_list.append(
- graph_lat_1 )
- main.log.info(
- "Sw discovery latency of " +
- str( cluster_count ) +
- " node(s): " +
- str( graph_lat_1 ) +
- " ms" )
- else:
- main.log.info( "Switch discovery latency " +
- "exceeded the threshold." )
- main.log.info( str( graph_lat_1 ) + " ms" )
- # Break while loop
- break
- if cluster_count == 2:
- if onos1_dev and onos2_dev:
- main.log.info( "All devices have been discovered" +
- " on all " + str( cluster_count ) +
- " ONOS instances" )
- time.sleep( 5 )
-
- json_str_metrics_1 =\
- main.ONOS1cli.topology_events_metrics()
- json_str_metrics_2 =\
- main.ONOS2cli.topology_events_metrics()
- json_obj_1 = json.loads( json_str_metrics_1 )
- json_obj_2 = json.loads( json_str_metrics_2 )
- graph_timestamp_1 =\
- json_obj_1[ graphTimestamp ][ 'value' ]
- graph_timestamp_2 =\
- json_obj_2[ graphTimestamp ][ 'value' ]
-
- graph_lat_1 = \
- int( graph_timestamp_1 ) - int( t0_system )
- graph_lat_2 = \
- int( graph_timestamp_2 ) - int( t0_system )
-
- main.log.info( "Graph Timestamp ONOS1: " +
- str( graph_timestamp_1 ) )
- main.log.info( "Graph Timestamp ONOS2: " +
- str( graph_timestamp_2 ) )
-
- max_graph_lat = max( graph_lat_1,
- graph_lat_2, graph_lat_3 )
-
- if max_graph_lat > sw_disc_threshold_min\
- and max_graph_lat < sw_disc_threshold_max\
- and int( i ) > iter_ignore:
- sw_discovery_lat_list.append(
- max_graph_lat )
- main.log.info(
- "Sw discovery latency of " +
- str( cluster_count ) +
- " node(s): " +
- str( max_graph_lat ) +
- " ms" )
- else:
- main.log.info( "Switch discovery latency " +
- "exceeded the threshold." )
- main.log.info( str( max_graph_lat ) + " ms" )
- break
- if cluster_count == 3:
- if onos1_dev and onos2_dev and onos3_dev:
- main.log.info( "All devices have been discovered" +
- " on all " + str( cluster_count ) +
- " ONOS instances" )
-
- # TODO: Investigate this sleep
- # added to 'pad' the results with
- # plenty of time to 'catch up'
- time.sleep( 5 )
-
- json_str_metrics_1 =\
- main.ONOS1cli.topology_events_metrics()
- json_str_metrics_2 =\
- main.ONOS2cli.topology_events_metrics()
- json_str_metrics_3 =\
- main.ONOS3cli.topology_events_metrics()
- json_obj_1 = json.loads( json_str_metrics_1 )
- json_obj_2 = json.loads( json_str_metrics_2 )
- json_obj_3 = json.loads( json_str_metrics_3 )
- graph_timestamp_1 =\
- json_obj_1[ graphTimestamp ][ 'value' ]
- graph_timestamp_2 =\
- json_obj_2[ graphTimestamp ][ 'value' ]
- graph_timestamp_3 =\
- json_obj_3[ graphTimestamp ][ 'value' ]
-
- graph_lat_1 = \
- int( graph_timestamp_1 ) - int( t0_system )
- graph_lat_2 = \
- int( graph_timestamp_2 ) - int( t0_system )
- graph_lat_3 = \
- int( graph_timestamp_3 ) - int( t0_system )
-
- main.log.info( "Graph Timestamp ONOS1: " +
- str( graph_timestamp_1 ) )
- main.log.info( "Graph Timestamp ONOS2: " +
- str( graph_timestamp_2 ) )
- main.log.info( "Graph Timestamp ONOS3: " +
- str( graph_timestamp_3 ) )
-
- max_graph_lat = max( graph_lat_1,
- graph_lat_2,
- graph_lat_3 )
-
- if max_graph_lat > sw_disc_threshold_min\
- and max_graph_lat < sw_disc_threshold_max\
- and int( i ) > iter_ignore:
- sw_discovery_lat_list.append(
- max_graph_lat )
- main.log.info(
- "Sw discovery latency of " +
- str( cluster_count ) +
- " node(s): " +
- str( max_graph_lat ) +
- " ms" )
- else:
- main.log.info( "Switch discovery latency " +
- "exceeded the threshold." )
- main.log.info( str( max_graph_lat ) + " ms" )
-
- break
- if cluster_count == 4:
- if onos1_dev and onos2_dev and onos3_dev and\
- onos4_dev:
- main.log.info( "All devices have been discovered" +
- " on all ONOS instances" )
- json_str_metrics_1 =\
- main.ONOS1cli.topology_events_metrics()
- json_str_metrics_2 =\
- main.ONOS2cli.topology_events_metrics()
- json_str_metrics_3 =\
- main.ONOS3cli.topology_events_metrics()
- json_str_metrics_4 =\
- main.ONOS4cli.topology_events_metrics()
- json_obj_1 = json.loads( json_str_metrics_1 )
- json_obj_2 = json.loads( json_str_metrics_2 )
- json_obj_3 = json.loads( json_str_metrics_3 )
- json_obj_4 = json.loads( json_str_metrics_4 )
- graph_timestamp_1 =\
- json_obj_1[ graphTimestamp ][ 'value' ]
- graph_timestamp_2 =\
- json_obj_2[ graphTimestamp ][ 'value' ]
- graph_timestamp_3 =\
- json_obj_3[ graphTimestamp ][ 'value' ]
- graph_timestamp_4 =\
- json_obj_4[ graphTimestamp ][ 'value' ]
-
- graph_lat_1 = \
- int( graph_timestamp_1 ) - int( t0_system )
- graph_lat_2 = \
- int( graph_timestamp_2 ) - int( t0_system )
- graph_lat_3 = \
- int( graph_timestamp_3 ) - int( t0_system )
- graph_lat_4 = \
- int( graph_timestamp_4 ) - int( t0_system )
-
- main.log.info( "Graph Timestamp ONOS1: " +
- str( graph_timestamp_1 ) )
- main.log.info( "Graph Timestamp ONOS2: " +
- str( graph_timestamp_2 ) )
- main.log.info( "Graph Timestamp ONOS3: " +
- str( graph_timestamp_3 ) )
- main.log.info( "Graph Timestamp ONOS4: " +
- str( graph_timestamp_4 ) )
-
- max_graph_lat = max( graph_lat_1,
- graph_lat_2,
- graph_lat_3,
- graph_lat_4 )
-
- if max_graph_lat > sw_disc_threshold_min\
- and max_graph_lat < sw_disc_threshold_max\
- and int( i ) > iter_ignore:
- sw_discovery_lat_list.append(
- max_graph_lat )
- main.log.info(
- "Sw discovery latency of " +
- str( cluster_count ) +
- " node(s): " +
- str( max_graph_lat ) +
- " ms" )
- else:
- main.log.info( "Switch discovery latency " +
- "exceeded the threshold." )
- main.log.info( str( max_graph_lat ) + " ms" )
-
- break
- if cluster_count == 5:
- if onos1_dev and onos2_dev and onos3_dev and\
- onos4_dev and onos5_dev:
- main.log.info( "All devices have been discovered" +
- " on all ONOS instances" )
-
- # TODO: Investigate this sleep
- # added to 'pad' the results with
- # plenty of time to 'catch up'
- time.sleep( 5 )
-
- json_str_metrics_1 =\
- main.ONOS1cli.topology_events_metrics()
- json_str_metrics_2 =\
- main.ONOS2cli.topology_events_metrics()
- json_str_metrics_3 =\
- main.ONOS3cli.topology_events_metrics()
- json_str_metrics_4 =\
- main.ONOS4cli.topology_events_metrics()
- json_str_metrics_5 =\
- main.ONOS5cli.topology_events_metrics()
- json_obj_1 = json.loads( json_str_metrics_1 )
- json_obj_2 = json.loads( json_str_metrics_2 )
- json_obj_3 = json.loads( json_str_metrics_3 )
- json_obj_4 = json.loads( json_str_metrics_4 )
- json_obj_5 = json.loads( json_str_metrics_5 )
- graph_timestamp_1 =\
- json_obj_1[ graphTimestamp ][ 'value' ]
- graph_timestamp_2 =\
- json_obj_2[ graphTimestamp ][ 'value' ]
- graph_timestamp_3 =\
- json_obj_3[ graphTimestamp ][ 'value' ]
- graph_timestamp_4 =\
- json_obj_4[ graphTimestamp ][ 'value' ]
- graph_timestamp_5 =\
- json_obj_5[ graphTimestamp ][ 'value' ]
-
- graph_lat_1 = \
- int( graph_timestamp_1 ) - int( t0_system )
- graph_lat_2 = \
- int( graph_timestamp_2 ) - int( t0_system )
- graph_lat_3 = \
- int( graph_timestamp_3 ) - int( t0_system )
- graph_lat_4 = \
- int( graph_timestamp_4 ) - int( t0_system )
- graph_lat_5 = \
- int( graph_timestamp_5 ) - int( t0_system )
-
- main.log.info( "Graph Timestamp ONOS1: " +
- str( graph_timestamp_1 ) )
- main.log.info( "Graph Timestamp ONOS2: " +
- str( graph_timestamp_2 ) )
- main.log.info( "Graph Timestamp ONOS3: " +
- str( graph_timestamp_3 ) )
- main.log.info( "Graph Timestamp ONOS4: " +
- str( graph_timestamp_4 ) )
- main.log.info( "Graph Timestamp ONOS5: " +
- str( graph_timestamp_5 ) )
-
- max_graph_lat = max( graph_lat_1,
- graph_lat_2,
- graph_lat_3,
- graph_lat_4,
- graph_lat_5 )
-
- if max_graph_lat > sw_disc_threshold_min\
- and max_graph_lat < sw_disc_threshold_max\
- and int( i ) > iter_ignore:
- sw_discovery_lat_list.append(
- max_graph_lat )
- main.log.info(
- "Sw discovery latency of " +
- str( cluster_count ) +
- " node(s): " +
- str( max_graph_lat ) +
- " ms" )
- else:
- main.log.info( "Switch discovery latency " +
- "exceeded the threshold." )
- main.log.info( str( max_graph_lat ) + " ms" )
-
- break
- if cluster_count == 6:
- if onos1_dev and onos2_dev and onos3_dev and\
- onos4_dev and onos5_dev and onos6_dev:
- main.log.info( "All devices have been discovered" +
- " on all ONOS instances" )
- json_str_metrics_1 =\
- main.ONOS1cli.topology_events_metrics()
- json_str_metrics_2 =\
- main.ONOS2cli.topology_events_metrics()
- json_str_metrics_3 =\
- main.ONOS3cli.topology_events_metrics()
- json_str_metrics_4 =\
- main.ONOS4cli.topology_events_metrics()
- json_str_metrics_5 =\
- main.ONOS5cli.topology_events_metrics()
- json_str_metrics_6 =\
- main.ONOS6cli.topology_events_metrics()
- json_obj_1 = json.loads( json_str_metrics_1 )
- json_obj_2 = json.loads( json_str_metrics_2 )
- json_obj_3 = json.loads( json_str_metrics_3 )
- json_obj_4 = json.loads( json_str_metrics_4 )
- json_obj_5 = json.loads( json_str_metrics_5 )
- json_obj_6 = json.loads( json_str_metrics_6 )
- graph_timestamp_1 =\
- json_obj_1[ graphTimestamp ][ 'value' ]
- graph_timestamp_2 =\
- json_obj_2[ graphTimestamp ][ 'value' ]
- graph_timestamp_3 =\
- json_obj_3[ graphTimestamp ][ 'value' ]
- graph_timestamp_4 =\
- json_obj_4[ graphTimestamp ][ 'value' ]
- graph_timestamp_5 =\
- json_obj_5[ graphTimestamp ][ 'value' ]
- graph_timestamp_6 =\
- json_obj_6[ graphTimestamp ][ 'value' ]
-
- graph_lat_1 = \
- int( graph_timestamp_1 ) - int( t0_system )
- graph_lat_2 = \
- int( graph_timestamp_2 ) - int( t0_system )
- graph_lat_3 = \
- int( graph_timestamp_3 ) - int( t0_system )
- graph_lat_4 = \
- int( graph_timestamp_4 ) - int( t0_system )
- graph_lat_5 = \
- int( graph_timestamp_5 ) - int( t0_system )
- graph_lat_6 = \
- int( graph_timestamp_6 ) - int( t0_system )
-
- main.log.info( "Graph Timestamp ONOS1: " +
- str( graph_timestamp_1 ) )
- main.log.info( "Graph Timestamp ONOS2: " +
- str( graph_timestamp_2 ) )
- main.log.info( "Graph Timestamp ONOS3: " +
- str( graph_timestamp_3 ) )
- main.log.info( "Graph Timestamp ONOS4: " +
- str( graph_timestamp_4 ) )
- main.log.info( "Graph Timestamp ONOS5: " +
- str( graph_timestamp_5 ) )
- main.log.info( "Graph Timestamp ONOS6: " +
- str( graph_timestamp_6 ) )
-
- max_graph_lat = max( graph_lat_1,
- graph_lat_2,
- graph_lat_3,
- graph_lat_4,
- graph_lat_5,
- graph_lat_6 )
-
- if max_graph_lat > sw_disc_threshold_min\
- and max_graph_lat < sw_disc_threshold_max\
- and int( i ) > iter_ignore:
- sw_discovery_lat_list.append(
- max_graph_lat )
- main.log.info(
- "Sw discovery latency of " +
- str( cluster_count ) +
- " node(s): " +
- str( max_graph_lat ) +
- " ms" )
- else:
- main.log.info( "Switch discovery latency " +
- "exceeded the threshold." )
- main.log.info( str( max_graph_lat ) + " ms" )
-
- break
- if cluster_count == 7:
- if onos1_dev and onos2_dev and onos3_dev and\
- onos4_dev and onos5_dev and onos6_dev and\
- onos7_dev:
- main.log.info( "All devices have been discovered" +
- " on all ONOS instances" )
-
- # TODO: Investigate this sleep
- # added to 'pad' the results with
- # plenty of time to 'catch up'
- time.sleep( 5 )
-
- json_str_metrics_1 =\
- main.ONOS1cli.topology_events_metrics()
- json_str_metrics_2 =\
- main.ONOS2cli.topology_events_metrics()
- json_str_metrics_3 =\
- main.ONOS3cli.topology_events_metrics()
- json_str_metrics_4 =\
- main.ONOS4cli.topology_events_metrics()
- json_str_metrics_5 =\
- main.ONOS5cli.topology_events_metrics()
- json_str_metrics_6 =\
- main.ONOS6cli.topology_events_metrics()
- json_str_metrics_7 =\
- main.ONOS7cli.topology_events_metrics()
- json_obj_1 = json.loads( json_str_metrics_1 )
- json_obj_2 = json.loads( json_str_metrics_2 )
- json_obj_3 = json.loads( json_str_metrics_3 )
- json_obj_4 = json.loads( json_str_metrics_4 )
- json_obj_5 = json.loads( json_str_metrics_5 )
- json_obj_6 = json.loads( json_str_metrics_6 )
- json_obj_7 = json.loads( json_str_metrics_7 )
- graph_timestamp_1 =\
- json_obj_1[ graphTimestamp ][ 'value' ]
- graph_timestamp_2 =\
- json_obj_2[ graphTimestamp ][ 'value' ]
- graph_timestamp_3 =\
- json_obj_3[ graphTimestamp ][ 'value' ]
- graph_timestamp_4 =\
- json_obj_4[ graphTimestamp ][ 'value' ]
- graph_timestamp_5 =\
- json_obj_5[ graphTimestamp ][ 'value' ]
- graph_timestamp_6 =\
- json_obj_6[ graphTimestamp ][ 'value' ]
- graph_timestamp_7 =\
- json_obj_7[ graphTimestamp ][ 'value' ]
-
- graph_lat_1 = \
- int( graph_timestamp_1 ) - int( t0_system )
- graph_lat_2 = \
- int( graph_timestamp_2 ) - int( t0_system )
- graph_lat_3 = \
- int( graph_timestamp_3 ) - int( t0_system )
- graph_lat_4 = \
- int( graph_timestamp_4 ) - int( t0_system )
- graph_lat_5 = \
- int( graph_timestamp_5 ) - int( t0_system )
- graph_lat_6 = \
- int( graph_timestamp_6 ) - int( t0_system )
- graph_lat_7 = \
- int( graph_timestamp_7 ) - int( t0_system )
-
- main.log.info( "Graph Timestamp ONOS1: " +
- str( graph_timestamp_1 ) )
- main.log.info( "Graph Timestamp ONOS2: " +
- str( graph_timestamp_2 ) )
- main.log.info( "Graph Timestamp ONOS3: " +
- str( graph_timestamp_3 ) )
- main.log.info( "Graph Timestamp ONOS4: " +
- str( graph_timestamp_4 ) )
- main.log.info( "Graph Timestamp ONOS5: " +
- str( graph_timestamp_5 ) )
- main.log.info( "Graph Timestamp ONOS6: " +
- str( graph_timestamp_6 ) )
- main.log.info( "Graph Timestamp ONOS7: " +
- str( graph_timestamp_7 ) )
-
- max_graph_lat = max( graph_lat_1,
- graph_lat_2,
- graph_lat_3,
- graph_lat_4,
- graph_lat_5,
- graph_lat_6,
- graph_lat_7 )
-
- if max_graph_lat > sw_disc_threshold_min\
- and max_graph_lat < sw_disc_threshold_max\
- and int( i ) > iter_ignore:
- sw_discovery_lat_list.append(
- max_graph_lat )
- main.log.info(
- "Sw discovery latency of " +
- str( cluster_count ) +
- " node(s): " +
- str( max_graph_lat ) +
- " ms" )
- else:
- main.log.info( "Switch discovery latency " +
- "exceeded the threshold." )
- main.log.info( str( max_graph_lat ) + " ms" )
-
- break
-
- counter_loop += 1
- time.sleep( 3 )
- # END WHILE LOOP
-
- # Below is used for reporting SYN / ACK timing
- # of all switches
- main.ONOS1.tshark_stop()
- syn_ack_timestamp_list = []
- if cluster_count < 3:
- # TODO: capture synack on nodes less than 3
- syn_ack_timestamp_list.append( 0 )
-
- if cluster_count >= 3:
- main.ONOS2.tshark_stop()
- main.ONOS3.tshark_stop()
- time.sleep( 5 )
- os.system(
- "scp " +
- ONOS_user +
- "@" +
- ONOS1_ip +
- ":" +
- "/tmp/syn_ack_onos1_iter" +
- str( i ) +
- ".txt /tmp/" )
- os.system(
- "scp " +
- ONOS_user +
- "@" +
- ONOS2_ip +
- ":" +
- "/tmp/syn_ack_onos2_iter" +
- str( i ) +
- ".txt /tmp/" )
- os.system(
- "scp " +
- ONOS_user +
- "@" +
- ONOS3_ip +
- ":" +
- "/tmp/syn_ack_onos3_iter" +
- str( i ) +
- ".txt /tmp/" )
- time.sleep( 5 )
- # Read each of the files and append all
- # SYN / ACK timestamps to the list
- with open( "/tmp/syn_ack_onos1_iter" + str( i ) + ".txt" ) as\
- f_onos1:
- for line in f_onos1:
- line = line.split( " " )
- try:
- float( line[ 1 ] )
- syn_ack_timestamp_list.append( line[ 1 ] )
- except ValueError:
- main.log.info( "String cannot be converted" )
- with open( "/tmp/syn_ack_onos2_iter" + str( i ) + ".txt" ) as\
- f_onos2:
- for line in f_onos2:
- line = line.split( " " )
- try:
- float( line[ 1 ] )
- syn_ack_timestamp_list.append( line[ 1 ] )
- except ValueError:
- main.log.info( "String cannot be converted" )
- with open( "/tmp/syn_ack_onos3_iter" + str( i ) + ".txt" ) as\
- f_onos3:
- for line in f_onos3:
- line = line.split( " " )
- try:
- float( line[ 1 ] )
- syn_ack_timestamp_list.append( line[ 1 ] )
- except ValueError:
- main.log.info( "String cannot be converted" )
- if cluster_count >= 4:
- main.ONOS4.tshark_stop()
- time.sleep( 5 )
- os.system(
- "scp " +
- ONOS_user +
- "@" +
- ONOS4_ip +
- ":" +
- "/tmp/syn_ack_onos4_iter" +
- str( i ) +
- ".txt /tmp/" )
- time.sleep( 5 )
- with open( "/tmp/syn_ack_onos4_iter" + str( i ) + ".txt" ) as\
- f_onos4:
- for line in f_onos4:
- line = line.split( " " )
- try:
- float( line[ 1 ] )
- syn_ack_timestamp_list.append( line[ 1 ] )
- except ValueError:
- main.log.info( "String cannot be converted" )
- if cluster_count >= 5:
- main.ONOS5.tshark_stop()
- time.sleep( 5 )
- os.system(
- "scp " +
- ONOS_user +
- "@" +
- ONOS5_ip +
- ":" +
- "/tmp/syn_ack_onos5_iter" +
- str( i ) +
- ".txt /tmp/" )
- time.sleep( 5 )
- with open( "/tmp/syn_ack_onos5_iter" + str( i ) + ".txt" ) as\
- f_onos5:
- for line in f_onos5:
- line = line.split( " " )
- try:
- float( line[ 1 ] )
- syn_ack_timestamp_list.append( line[ 1 ] )
- except ValueError:
- main.log.info( "String cannot be converted" )
- if cluster_count >= 6:
- main.ONOS6.tshark_stop()
- time.sleep( 5 )
- os.system(
- "scp " +
- ONOS_user +
- "@" +
- ONOS6_ip +
- ":" +
- "/tmp/syn_ack_onos6_iter" +
- str( i ) +
- ".txt /tmp/" )
- time.sleep( 5 )
- with open( "/tmp/syn_ack_onos6_iter" + str( i ) + ".txt" ) as\
- f_onos6:
- for line in f_onos6:
- line = line.split( " " )
- try:
- float( line[ 1 ] )
- syn_ack_timestamp_list.append( line[ 1 ] )
- except ValueError:
- main.log.info( "String cannot be converted" )
- if cluster_count == 7:
- main.ONOS7.tshark_stop()
- time.sleep( 5 )
- os.system(
- "scp " +
- ONOS_user +
- "@" +
- ONOS7_ip +
- ":" +
- "/tmp/syn_ack_onos7_iter" +
- str( i ) +
- ".txt /tmp/" )
- time.sleep( 5 )
- with open( "/tmp/syn_ack_onos7_iter" + str( i ) + ".txt" ) as\
- f_onos7:
- for line in f_onos7:
- line = line.split( " " )
- try:
- float( line[ 1 ] )
- syn_ack_timestamp_list.append( line[ 1 ] )
- except ValueError:
- main.log.info( "String cannot be converted" )
-
- # Sort the list by timestamp
- syn_ack_timestamp_list = sorted( syn_ack_timestamp_list )
- print "syn_ack_-1 " + str( syn_ack_timestamp_list )
-
- syn_ack_delta =\
- int( float( syn_ack_timestamp_list[ -1 ] ) * 1000 ) -\
- int( float( syn_ack_timestamp_list[ 0 ] ) * 1000 )
-
- main.log.info( "Switch connection attempt delta iteration " +
- str( i ) + ": " + str( syn_ack_delta ) )
- syn_ack_delta_list.append( syn_ack_delta )
- # END ITERATION LOOP
- # REPORT HERE
-
- if len( sw_discovery_lat_list ) > 0:
- sw_lat_avg = sum( sw_discovery_lat_list ) / \
- len( sw_discovery_lat_list )
- sw_lat_dev = numpy.std( sw_discovery_lat_list )
- else:
- sw_lat_avg = 0
- sw_lat_dev = 0
- assertion = main.FALSE
-
- main.log.report( "Switch connection attempt time avg " +
- "(last sw SYN/ACK time - first sw SYN/ACK time) " +
- str( sum( syn_ack_delta_list ) /
- len( syn_ack_delta_list ) ) +
- " ms" )
- main.log.report( str( num_sw ) + " Switch discovery lat for " +
- str( cluster_count ) + " instance(s): " )
- main.log.report( "Avg: " +
- str( sw_lat_avg ) +
- " ms " +
- "Std Deviation: " +
- str( round( sw_lat_dev, 1 ) ) +
- " ms" )
-
- utilities.assert_equals(
- expect=main.TRUE,
- actual=assertion,
- onpass="Switch discovery convergence latency" +
- " for " +
- str( cluster_count ) +
- " nodes successful",
- onfail="Switch discovery convergence latency" +
- " test failed" )
-
- def CASE3( self, main ):
- """
- Increase number of nodes and initiate CLI
- """
- import time
- import subprocess
- import os
- import requests
- import json
-
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
- ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
- ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
- ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
- ONOS6_ip = main.params[ 'CTRL' ][ 'ip6' ]
- ONOS7_ip = main.params[ 'CTRL' ][ 'ip7' ]
-
- cell_name = main.params[ 'ENV' ][ 'cellName' ]
-
- MN1_ip = main.params[ 'MN' ][ 'ip1' ]
- BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
-
- # NOTE:We start with cluster_count at 3. The first
- # case already initialized ONOS1. Increase the
- # cluster count and start from 3.
- # You can optionally change the increment to
- # test steps of node sizes, such as 3,5,7
-
- global cluster_count
- cluster_count += 2
- main.log.report( "Increasing cluster size to " +
- str( cluster_count ) )
-
- install_result = main.FALSE
- # Supports up to 7 node configuration
- # TODO: Cleanup this ridiculous repetitive code
- if cluster_count == 3:
- install_result = \
- main.ONOSbench.onos_install( node=ONOS2_ip )
- install_result = \
- main.ONOSbench.onos_install( node=ONOS3_ip )
- time.sleep( 5 )
- main.log.info( "Starting CLI" )
- main.ONOS2cli.start_onos_cli( ONOS2_ip )
- main.ONOS3cli.start_onos_cli( ONOS3_ip )
- main.ONOS1cli.add_node( ONOS2_ip, ONOS2_ip )
- main.ONOS1cli.add_node( ONOS3_ip, ONOS3_ip )
-
- if cluster_count == 4:
- main.log.info( "Installing ONOS on node 4" )
- install_result = \
- main.ONOSbench.onos_install( node=ONOS4_ip )
- time.sleep( 5 )
- main.log.info( "Starting CLI" )
- main.ONOS4cli.start_onos_cli( ONOS4_ip )
- main.ONOS1cli.add_node( ONOS4_ip, ONOS4_ip )
-
- elif cluster_count == 5:
- main.log.info( "Installing ONOS on nodes 4 and 5" )
- install_result2 = \
- main.ONOSbench.onos_install( options="", node=ONOS4_ip )
- install_result3 = \
- main.ONOSbench.onos_install( options="", node=ONOS5_ip )
- time.sleep( 5 )
- main.log.info( "Starting CLI" )
- main.ONOS4cli.start_onos_cli( ONOS4_ip )
- main.ONOS5cli.start_onos_cli( ONOS5_ip )
- main.ONOS1cli.add_node( ONOS4_ip, ONOS4_ip )
- main.ONOS1cli.add_node( ONOS5_ip, ONOS5_ip )
- install_result = install_result2 and install_result3
-
- elif cluster_count == 6:
- main.log.info( "Installing ONOS on nodes 4, 5,and 6" )
- install_result1 = \
- main.ONOSbench.onos_install( options="", node=ONOS4_ip )
- install_result2 = \
- main.ONOSbench.onos_install( options="", node=ONOS5_ip )
- install_result3 = \
- main.ONOSbench.onos_install( node=ONOS6_ip )
- time.sleep( 5 )
- main.log.info( "Starting CLI" )
- main.ONOS4cli.start_onos_cli( ONOS4_ip )
- main.ONOS5cli.start_onos_cli( ONOS5_ip )
- main.ONOS6cli.start_onos_cli( ONOS6_ip )
- main.ONOS1cli.add_node( ONOS4_ip, ONOS4_ip )
- main.ONOS1cli.add_node( ONOS5_ip, ONOS5_ip )
- main.ONOS1cli.add_node( ONOS6_ip, ONOS6_ip )
- install_result = install_result1 and install_result2 and\
- install_result3
-
- elif cluster_count == 7:
- main.log.info( "Installing ONOS on nodes 4, 5, 6,and 7" )
- install_result3 = \
- main.ONOSbench.onos_install( node=ONOS6_ip )
- install_result4 = \
- main.ONOSbench.onos_install( node=ONOS7_ip )
- main.log.info( "Starting CLI" )
- main.ONOS4cli.start_onos_cli( ONOS4_ip )
- main.ONOS5cli.start_onos_cli( ONOS5_ip )
- main.ONOS6cli.start_onos_cli( ONOS6_ip )
- main.ONOS7cli.start_onos_cli( ONOS7_ip )
- main.ONOS1cli.add_node( ONOS4_ip, ONOS4_ip )
- main.ONOS1cli.add_node( ONOS5_ip, ONOS5_ip )
- main.ONOS1cli.add_node( ONOS6_ip, ONOS6_ip )
- main.ONOS1cli.add_node( ONOS7_ip, ONOS7_ip )
-
- install_result = \
- install_result3 and install_result4
-
- time.sleep( 5 )
-
- if install_result == main.TRUE:
- assertion = main.TRUE
- else:
- assertion = main.FALSE
-
- utilities.assert_equals(
- expect=main.TRUE,
- actual=assertion,
- onpass="Scale out to " +
- str( cluster_count ) +
- " nodes successful",
- onfail="Scale out to " +
- str( cluster_count ) +
- " nodes failed" )
-
- def CASE4( self, main ):
- """
- Cleanup ONOS nodes and Increase topology size
- """
- # TODO: use meaningful assertion
- assertion = main.TRUE
-
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
- ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
- ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
- ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
- ONOS6_ip = main.params[ 'CTRL' ][ 'ip6' ]
- ONOS7_ip = main.params[ 'CTRL' ][ 'ip7' ]
- MN1_ip = main.params[ 'MN' ][ 'ip1' ]
- BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
-
- main.log.info( "Uninstalling previous instances" )
- main.ONOSbench.onos_uninstall( node_ip=ONOS2_ip )
- main.ONOSbench.onos_uninstall( node_ip=ONOS3_ip )
- main.ONOSbench.onos_uninstall( node_ip=ONOS4_ip )
- main.ONOSbench.onos_uninstall( node_ip=ONOS5_ip )
- main.ONOSbench.onos_uninstall( node_ip=ONOS6_ip )
- main.ONOSbench.onos_uninstall( node_ip=ONOS7_ip )
-
- global topo_iteration
- global cluster_count
- cluster_count = 1
- topo_iteration += 1
-
- main.log.report( "Increasing topology size" )
- utilities.assert_equals( expect=main.TRUE, actual=assertion,
- onpass="Topology size increased successfully",
- onfail="Topology size was not increased" )
diff --git a/TestON/tests/TopoConvNext/TopoConvNext.topo b/TestON/tests/TopoConvNext/TopoConvNext.topo
deleted file mode 100644
index b7e9e96..0000000
--- a/TestON/tests/TopoConvNext/TopoConvNext.topo
+++ /dev/null
@@ -1,163 +0,0 @@
-<TOPOLOGY>
- <COMPONENT>
-
- <ONOSbench>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOSbench>
-
- <ONOS1cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1cli>
-
- <ONOS2cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2cli>
-
- <ONOS3cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS3cli>
-
- <ONOS4cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS4cli>
-
- <ONOS5cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>6</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS5cli>
-
- <ONOS6cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>7</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS6cli>
-
- <ONOS7cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>8</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS7cli>
-
- <ONOS1>
- <host>10.128.174.1</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>9</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1>
-
- <ONOS2>
- <host>10.128.174.2</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>10</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2>
-
- <ONOS3>
- <host>10.128.174.3</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>11</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS3>
-
- <ONOS4>
- <host>10.128.174.4</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>12</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS4>
-
- <ONOS5>
- <host>10.128.174.5</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>13</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS5>
-
- <ONOS6>
- <host>10.128.174.6</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>14</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS6>
-
- <ONOS7>
- <host>10.128.174.7</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>15</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS7>
-
- <Mininet1>
- <host>10.128.10.90</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>MininetCliDriver</type>
- <connect_order>16</connect_order>
- <COMPONENTS>
- <arg1> --custom topo-500sw.py </arg1>
- <arg2> --arp --mac --topo mytopo</arg2>
- <arg3> </arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet1>
-
- <Mininet2>
- <host>10.128.10.90</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>RemoteMininetDriver</type>
- <connect_order>17</connect_order>
- <COMPONENTS> </COMPONENTS>
- </Mininet2>
-
- </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/TopoConvNext/__init__.py b/TestON/tests/TopoConvNext/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/TopoConvNext/__init__.py
+++ /dev/null
diff --git a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params
deleted file mode 100644
index f797706..0000000
--- a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params
+++ /dev/null
@@ -1,45 +0,0 @@
-<PARAMS>
- <testcases>1,2,3,4,5</testcases>
-
- <ENV>
- <cellName>topo_perf_test</cellName>
- </ENV>
-
- <GIT>
- #autoPull 'on' or 'off'
- <autoPull>off</autoPull>
- <checkout>master</checkout>
- </GIT>
-
- <CTRL>
- <user>admin</user>
- <ip1>10.128.174.1</ip1>
- <port1>6633</port1>
- <ip2>10.128.174.2</ip2>
- <port2>6633</port2>
- <ip3>10.128.174.3</ip3>
- <port3>6633</port3>
- </CTRL>
-
- <MN>
- <ip1>10.128.10.90</ip1>
- <ip2>10.128.10.91</ip2>
- </MN>
-
- <BENCH>
- <ip>10.128.174.10</ip>
- </BENCH>
-
- <TEST>
- #Number of times to iterate each case
- <numIter>5</numIter>
- <numSwitch>100</numSwitch>
- </TEST>
-
- <JSON>
- <deviceTimestamp>topologyDeviceEventTimestamp</deviceTimestamp>
- <hostTimestamp>topologyHostEventTimestamp</hostTimestamp>
- <linkTimestamp>topologyLinkEventTimestamp</linkTimestamp>
- <graphTimestamp>topologyGraphEventTimestamp</graphTimestamp>
- </JSON>
-</PARAMS>
diff --git a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py
deleted file mode 100644
index e81d905..0000000
--- a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py
+++ /dev/null
@@ -1,1113 +0,0 @@
-# TopoPerfNext
-#
-# Topology Performance test for ONOS-next
-#*** Revised for single node operation ***
-#
-# andrew@onlab.us
-
-import time
-import sys
-import os
-import re
-
-
-class TopoPerfNextSingleNode:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ):
- """
- ONOS startup sequence
- """
- import time
-
- cell_name = main.params[ 'ENV' ][ 'cellName' ]
-
- git_pull = main.params[ 'GIT' ][ 'autoPull' ]
- checkout_branch = main.params[ 'GIT' ][ 'checkout' ]
-
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
- MN1_ip = main.params[ 'MN' ][ 'ip1' ]
- BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
-
- main.case( "Setting up test environment" )
-
- main.step( "Creating cell file" )
- cell_file_result = main.ONOSbench.create_cell_file(
- BENCH_ip, cell_name, MN1_ip, "onos-core",
- ONOS1_ip )
-
- main.step( "Applying cell file to environment" )
- cell_apply_result = main.ONOSbench.set_cell( cell_name )
- verify_cell_result = main.ONOSbench.verify_cell()
-
- main.step( "Git checkout and pull " + checkout_branch )
- if git_pull == 'on':
- checkout_result = \
- main.ONOSbench.git_checkout( checkout_branch )
- pull_result = main.ONOSbench.git_pull()
- else:
- checkout_result = main.TRUE
- pull_result = main.TRUE
- main.log.info( "Skipped git checkout and pull" )
-
- main.step( "Using mvn clean & install" )
- #mvn_result = main.ONOSbench.clean_install()
- mvn_result = main.TRUE
-
- main.step( "Creating ONOS package" )
- package_result = main.ONOSbench.onos_package()
-
- main.step( "Installing ONOS package" )
- install1_result = main.ONOSbench.onos_install( node=ONOS1_ip )
-
- # NOTE: This step may be unnecessary
- #main.step( "Starting ONOS service" )
- #start_result = main.ONOSbench.onos_start( ONOS1_ip )
-
- main.step( "Set cell for ONOS cli env" )
- main.ONOS1cli.set_cell( cell_name )
-
- time.sleep( 10 )
-
- main.step( "Start onos cli" )
- cli1 = main.ONOS1cli.start_onos_cli( ONOS1_ip )
-
- main.step( "Enable metrics feature" )
- main.ONOS1cli.feature_install( "onos-app-metrics" )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=cell_file_result and cell_apply_result and
- verify_cell_result and checkout_result and
- pull_result and mvn_result and
- install1_result,
- onpass="ONOS started successfully",
- onfail="Failed to start ONOS" )
-
- def CASE2( self, main ):
- """
- Assign s1 to ONOS1 and measure latency
-
- There are 4 levels of latency measurements to this test:
- 1 ) End-to-end measurement: Complete end-to-end measurement
- from TCP ( SYN/ACK ) handshake to Graph change
- 2 ) OFP-to-graph measurement: 'ONOS processing' snippet of
- measurement from OFP Vendor message to Graph change
- 3 ) OFP-to-device measurement: 'ONOS processing without
- graph change' snippet of measurement from OFP vendor
- message to Device change timestamp
- 4 ) T0-to-device measurement: Measurement that includes
- the switch handshake to devices timestamp without
- the graph view change. ( TCP handshake -> Device
- change )
- """
- import time
- import subprocess
- import json
- import requests
- import os
-
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS_user = main.params[ 'CTRL' ][ 'user' ]
-
- default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
-
- # Number of iterations of case
- num_iter = main.params[ 'TEST' ][ 'numIter' ]
-
- # Timestamp 'keys' for json metrics output.
- # These are subject to change, hence moved into params
- deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
- graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
-
- # List of switch add latency collected from
- # all iterations
- latency_end_to_end_list = []
- latency_ofp_to_graph_list = []
- latency_ofp_to_device_list = []
- latency_t0_to_device_list = []
-
- # Directory/file to store tshark results
- tshark_of_output = "/tmp/tshark_of_topo.txt"
- tshark_tcp_output = "/tmp/tshark_tcp_topo.txt"
-
- # String to grep in tshark output
- tshark_tcp_string = "TCP 74 " + default_sw_port
- tshark_of_string = "OFP 86 Vendor"
-
- # Initialize assertion to TRUE
- assertion = main.TRUE
-
- main.log.report( "Latency of adding one switch" )
-
- for i in range( 0, int( num_iter ) ):
- main.log.info( "Starting tshark capture" )
-
- #* TCP [ ACK, SYN ] is used as t0_a, the
- # very first "exchange" between ONOS and
- # the switch for end-to-end measurement
- #* OFP [ Stats Reply ] is used for t0_b
- # the very last OFP message between ONOS
- # and the switch for ONOS measurement
- main.ONOS1.tshark_grep( tshark_tcp_string,
- tshark_tcp_output )
- main.ONOS1.tshark_grep( tshark_of_string,
- tshark_of_output )
-
- # Wait and ensure tshark is started and
- # capturing
- time.sleep( 10 )
-
- main.log.info( "Assigning s1 to controller" )
-
- main.Mininet1.assign_sw_controller(
- sw="1",
- ip1=ONOS1_ip,
- port1=default_sw_port )
-
- # Wait and ensure switch is assigned
- # before stopping tshark
- time.sleep( 30 )
-
- main.log.info( "Stopping all Tshark processes" )
- main.ONOS1.stop_tshark()
-
- # tshark output is saved in ONOS. Use subprocess
- # to copy over files to TestON for parsing
- main.log.info( "Copying over tshark files" )
-
- # TCP CAPTURE ****
- # Copy the tshark output from ONOS machine to
- # TestON machine in tshark_tcp_output directory>file
- os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
- tshark_tcp_output + " /tmp/" )
- tcp_file = open( tshark_tcp_output, 'r' )
- temp_text = tcp_file.readline()
- temp_text = temp_text.split( " " )
-
- main.log.info( "Object read in from TCP capture: " +
- str( temp_text ) )
- if len( temp_text ) > 1:
- t0_tcp = float( temp_text[ 1 ] ) * 1000.0
- else:
- main.log.error( "Tshark output file for TCP" +
- " returned unexpected results" )
- t0_tcp = 0
- assertion = main.FALSE
-
- tcp_file.close()
- #****************
-
- # OF CAPTURE ****
- os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
- tshark_of_output + " /tmp/" )
- of_file = open( tshark_of_output, 'r' )
-
- line_ofp = ""
- # Read until last line of file
- while True:
- temp_text = of_file.readline()
- if temp_text != '':
- line_ofp = temp_text
- else:
- break
- obj = line_ofp.split( " " )
-
- main.log.info( "Object read in from OFP capture: " +
- str( line_ofp ) )
-
- if len( line_ofp ) > 1:
- t0_ofp = float( obj[ 1 ] ) * 1000.0
- else:
- main.log.error( "Tshark output file for OFP" +
- " returned unexpected results" )
- t0_ofp = 0
- assertion = main.FALSE
-
- of_file.close()
- #****************
-
- json_str_1 = main.ONOS1cli.topology_events_metrics()
-
- json_obj_1 = json.loads( json_str_1 )
-
- # Obtain graph timestamp. This timestsamp captures
- # the epoch time at which the topology graph was updated.
- graph_timestamp_1 = \
- json_obj_1[ graphTimestamp ][ 'value' ]
-
- # Obtain device timestamp. This timestamp captures
- # the epoch time at which the device event happened
- device_timestamp_1 = \
- json_obj_1[ deviceTimestamp ][ 'value' ]
-
- # t0 to device processing latency
- delta_device_1 = int( device_timestamp_1 ) - int( t0_tcp )
-
- # Get average of delta from all instances
- avg_delta_device = ( int( delta_device_1 ) )
-
- # Ensure avg delta meets the threshold before appending
- if avg_delta_device > 0.0 and avg_delta_device < 10000:
- latency_t0_to_device_list.append( avg_delta_device )
- else:
- main.log.info( "Results for t0-to-device ignored" +
- "due to excess in threshold" )
-
- # t0 to graph processing latency ( end-to-end )
- delta_graph_1 = int( graph_timestamp_1 ) - int( t0_tcp )
-
- # Get average of delta from all instances
- avg_delta_graph = int( delta_graph_1 )
-
- # Ensure avg delta meets the threshold before appending
- if avg_delta_graph > 0.0 and avg_delta_graph < 10000:
- latency_end_to_end_list.append( avg_delta_graph )
- else:
- main.log.info( "Results for end-to-end ignored" +
- "due to excess in threshold" )
-
- # ofp to graph processing latency ( ONOS processing )
- delta_ofp_graph_1 = int( graph_timestamp_1 ) - int( t0_ofp )
-
- avg_delta_ofp_graph = int( delta_ofp_graph_1 )
-
- if avg_delta_ofp_graph > 0.0 and avg_delta_ofp_graph < 10000:
- latency_ofp_to_graph_list.append( avg_delta_ofp_graph )
- else:
- main.log.info( "Results for ofp-to-graph " +
- "ignored due to excess in threshold" )
-
- # ofp to device processing latency ( ONOS processing )
- delta_ofp_device_1 = float( device_timestamp_1 ) - float( t0_ofp )
-
- avg_delta_ofp_device = float( delta_ofp_device_1 )
-
- # NOTE: ofp - delta measurements are occasionally negative
- # due to system time misalignment.
- latency_ofp_to_device_list.append( avg_delta_ofp_device )
-
- # TODO:
- # Fetch logs upon threshold excess
-
- main.log.info( "ONOS1 delta end-to-end: " +
- str( delta_graph_1 ) + " ms" )
-
- main.log.info( "ONOS1 delta OFP - graph: " +
- str( delta_ofp_graph_1 ) + " ms" )
-
- main.log.info( "ONOS1 delta device - t0: " +
- str( delta_device_1 ) + " ms" )
-
- main.step( "Remove switch from controller" )
- main.Mininet1.delete_sw_controller( "s1" )
-
- time.sleep( 5 )
-
- # END of for loop iteration
-
- # If there is at least 1 element in each list,
- # pass the test case
- if len( latency_end_to_end_list ) > 0 and\
- len( latency_ofp_to_graph_list ) > 0 and\
- len( latency_ofp_to_device_list ) > 0 and\
- len( latency_t0_to_device_list ) > 0:
- assertion = main.TRUE
- elif len( latency_end_to_end_list ) == 0:
- # The appending of 0 here is to prevent
- # the min,max,sum functions from failing
- # below
- latency_end_to_end_list.append( 0 )
- assertion = main.FALSE
- elif len( latency_ofp_to_graph_list ) == 0:
- latency_ofp_to_graph_list.append( 0 )
- assertion = main.FALSE
- elif len( latency_ofp_to_device_list ) == 0:
- latency_ofp_to_device_list.append( 0 )
- assertion = main.FALSE
- elif len( latency_t0_to_device_list ) == 0:
- latency_t0_to_device_list.append( 0 )
- assertion = main.FALSE
-
- # Calculate min, max, avg of latency lists
- latency_end_to_end_max = \
- int( max( latency_end_to_end_list ) )
- latency_end_to_end_min = \
- int( min( latency_end_to_end_list ) )
- latency_end_to_end_avg = \
- ( int( sum( latency_end_to_end_list ) ) /
- len( latency_end_to_end_list ) )
-
- latency_ofp_to_graph_max = \
- int( max( latency_ofp_to_graph_list ) )
- latency_ofp_to_graph_min = \
- int( min( latency_ofp_to_graph_list ) )
- latency_ofp_to_graph_avg = \
- ( int( sum( latency_ofp_to_graph_list ) ) /
- len( latency_ofp_to_graph_list ) )
-
- latency_ofp_to_device_max = \
- int( max( latency_ofp_to_device_list ) )
- latency_ofp_to_device_min = \
- int( min( latency_ofp_to_device_list ) )
- latency_ofp_to_device_avg = \
- ( int( sum( latency_ofp_to_device_list ) ) /
- len( latency_ofp_to_device_list ) )
-
- latency_t0_to_device_max = \
- float( max( latency_t0_to_device_list ) )
- latency_t0_to_device_min = \
- float( min( latency_t0_to_device_list ) )
- latency_t0_to_device_avg = \
- ( float( sum( latency_t0_to_device_list ) ) /
- len( latency_ofp_to_device_list ) )
-
- main.log.report( "Switch add - End-to-end latency: \n" +
- "Min: " + str( latency_end_to_end_min ) + "\n" +
- "Max: " + str( latency_end_to_end_max ) + "\n" +
- "Avg: " + str( latency_end_to_end_avg ) )
- main.log.report( "Switch add - OFP-to-Graph latency: \n" +
- "Min: " + str( latency_ofp_to_graph_min ) + "\n" +
- "Max: " + str( latency_ofp_to_graph_max ) + "\n" +
- "Avg: " + str( latency_ofp_to_graph_avg ) )
- main.log.report( "Switch add - t0-to-Device latency: \n" +
- "Min: " + str( latency_t0_to_device_min ) + "\n" +
- "Max: " + str( latency_t0_to_device_max ) + "\n" +
- "Avg: " + str( latency_t0_to_device_avg ) )
-
- utilities.assert_equals( expect=main.TRUE, actual=assertion,
- onpass="Switch latency test successful",
- onfail="Switch latency test failed" )
-
- def CASE3( self, main ):
- """
- Bring port up / down and measure latency.
- Port enable / disable is simulated by ifconfig up / down
-
- In ONOS-next, we must ensure that the port we are
- manipulating is connected to another switch with a valid
- connection. Otherwise, graph view will not be updated.
- """
- import time
- import subprocess
- import os
- import requests
- import json
-
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS_user = main.params[ 'CTRL' ][ 'user' ]
-
- default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
-
- assertion = main.TRUE
- # Number of iterations of case
- num_iter = main.params[ 'TEST' ][ 'numIter' ]
-
- # Timestamp 'keys' for json metrics output.
- # These are subject to change, hence moved into params
- deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
- graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
-
- # NOTE: Some hardcoded variables you may need to configure
- # besides the params
-
- tshark_port_status = "OFP 130 Port Status"
-
- tshark_port_up = "/tmp/tshark_port_up.txt"
- tshark_port_down = "/tmp/tshark_port_down.txt"
- interface_config = "s1-eth1"
-
- main.log.report( "Port enable / disable latency" )
-
- main.step( "Assign switches s1 and s2 to controller 1" )
- main.Mininet1.assign_sw_controller( sw="1", ip1=ONOS1_ip,
- port1=default_sw_port )
- main.Mininet1.assign_sw_controller( sw="2", ip1=ONOS1_ip,
- port1=default_sw_port )
-
- # Give enough time for metrics to propagate the
- # assign controller event. Otherwise, these events may
- # carry over to our measurements
- time.sleep( 10 )
-
- main.step( "Verify switch is assigned correctly" )
- result_s1 = main.Mininet1.get_sw_controller( sw="s1" )
- result_s2 = main.Mininet1.get_sw_controller( sw="s2" )
- if result_s1 == main.FALSE or result_s2 == main.FALSE:
- main.log.info( "Switch s1 was not assigned correctly" )
- assertion = main.FALSE
- else:
- main.log.info( "Switch s1 was assigned correctly" )
-
- port_up_device_to_ofp_list = []
- port_up_graph_to_ofp_list = []
- port_down_device_to_ofp_list = []
- port_down_graph_to_ofp_list = []
-
- for i in range( 0, int( num_iter ) ):
- main.step( "Starting wireshark capture for port status down" )
- main.ONOS1.tshark_grep( tshark_port_status,
- tshark_port_down )
-
- time.sleep( 10 )
-
- # Disable interface that is connected to switch 2
- main.step( "Disable port: " + interface_config )
- main.Mininet2.handle.sendline( "sudo ifconfig " +
- interface_config + " down" )
- main.Mininet2.handle.expect( "\$" )
- time.sleep( 10 )
-
- main.ONOS1.tshark_stop()
- time.sleep( 5 )
-
- # Copy tshark output file from ONOS to TestON instance
- #/tmp directory
- os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
- tshark_port_down + " /tmp/" )
-
- f_port_down = open( tshark_port_down, 'r' )
- # Get first line of port down event from tshark
- f_line = f_port_down.readline()
- obj_down = f_line.split( " " )
- if len( f_line ) > 0:
- timestamp_begin_pt_down = int( float( obj_down[ 1 ] ) ) * 1000
- main.log.info( "Port down begin timestamp: " +
- str( timestamp_begin_pt_down ) )
- else:
- main.log.info( "Tshark output file returned unexpected" +
- " results: " + str( obj_down ) )
- timestamp_begin_pt_down = 0
-
- f_port_down.close()
-
- main.log.info( "TEST tshark obj: " + str( obj_down ) )
-
- main.step( "Obtain t1 by REST call" )
- json_str_1 = main.ONOS1cli.topology_events_metrics()
-
- main.log.info( "TEST json_str 1: " + str( json_str_1 ) )
-
- json_obj_1 = json.loads( json_str_1 )
-
- time.sleep( 5 )
-
- # Obtain graph timestamp. This timestsamp captures
- # the epoch time at which the topology graph was updated.
- graph_timestamp_1 = \
- json_obj_1[ graphTimestamp ][ 'value' ]
-
- # Obtain device timestamp. This timestamp captures
- # the epoch time at which the device event happened
- device_timestamp_1 = \
- json_obj_1[ deviceTimestamp ][ 'value' ]
-
- # Get delta between graph event and OFP
- pt_down_graph_to_ofp_1 = int( graph_timestamp_1 ) -\
- int( timestamp_begin_pt_down )
-
- # Get delta between device event and OFP
- pt_down_device_to_ofp_1 = int( device_timestamp_1 ) -\
- int( timestamp_begin_pt_down )
-
- # Caluclate average across clusters
- pt_down_graph_to_ofp_avg = int( pt_down_graph_to_ofp_1 )
- pt_down_device_to_ofp_avg = int( pt_down_device_to_ofp_1 )
-
- if pt_down_graph_to_ofp_avg > 0.0 and \
- pt_down_graph_to_ofp_avg < 1000:
- port_down_graph_to_ofp_list.append(
- pt_down_graph_to_ofp_avg )
- main.log.info( "Port down: graph to ofp avg: " +
- str( pt_down_graph_to_ofp_avg ) + " ms" )
- else:
- main.log.info( "Average port down graph-to-ofp result" +
- " exceeded the threshold: " +
- str( pt_down_graph_to_ofp_avg ) )
-
- if pt_down_device_to_ofp_avg > 0 and \
- pt_down_device_to_ofp_avg < 1000:
- port_down_device_to_ofp_list.append(
- pt_down_device_to_ofp_avg )
- main.log.info( "Port down: device to ofp avg: " +
- str( pt_down_device_to_ofp_avg ) + " ms" )
- else:
- main.log.info( "Average port down device-to-ofp result" +
- " exceeded the threshold: " +
- str( pt_down_device_to_ofp_avg ) )
-
- # Port up events
- main.step( "Enable port and obtain timestamp" )
- main.step( "Starting wireshark capture for port status up" )
- main.ONOS1.tshark_grep( "OFP 130 Port Status", tshark_port_up )
- time.sleep( 5 )
-
- main.Mininet2.handle.sendline( "sudo ifconfig " +
- interface_config + " up" )
- main.Mininet2.handle.expect( "\$" )
- time.sleep( 10 )
-
- main.ONOS1.tshark_stop()
-
- os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
- tshark_port_up + " /tmp/" )
-
- f_port_up = open( tshark_port_up, 'r' )
- f_line = f_port_up.readline()
- obj_up = f_line.split( " " )
- if len( f_line ) > 0:
- timestamp_begin_pt_up = int( float( obj_up[ 1 ] ) ) * 1000
- main.log.info( "Port up begin timestamp: " +
- str( timestamp_begin_pt_up ) )
- else:
- main.log.info( "Tshark output file returned unexpected" +
- " results." )
- timestamp_begin_pt_up = 0
-
- f_port_up.close()
-
- main.step( "Obtain t1 by REST call" )
- json_str_1 = main.ONOS1cli.topology_events_metrics()
-
- json_obj_1 = json.loads( json_str_1 )
-
- # Obtain graph timestamp. This timestsamp captures
- # the epoch time at which the topology graph was updated.
- graph_timestamp_1 = \
- json_obj_1[ graphTimestamp ][ 'value' ]
-
- # Obtain device timestamp. This timestamp captures
- # the epoch time at which the device event happened
- device_timestamp_1 = \
- json_obj_1[ deviceTimestamp ][ 'value' ]
-
- # Get delta between graph event and OFP
- pt_up_graph_to_ofp_1 = int( graph_timestamp_1 ) -\
- int( timestamp_begin_pt_up )
-
- # Get delta between device event and OFP
- pt_up_device_to_ofp_1 = int( device_timestamp_1 ) -\
- int( timestamp_begin_pt_up )
-
- pt_up_graph_to_ofp_avg = float( pt_up_graph_to_ofp_1 )
-
- pt_up_device_to_ofp_avg = float( pt_up_device_to_ofp_1 )
-
- if pt_up_graph_to_ofp_avg > 0 and \
- pt_up_graph_to_ofp_avg < 1000:
- port_up_graph_to_ofp_list.append(
- pt_up_graph_to_ofp_avg )
- main.log.info( "Port down: graph to ofp avg: " +
- str( pt_up_graph_to_ofp_avg ) + " ms" )
- else:
- main.log.info( "Average port up graph-to-ofp result" +
- " exceeded the threshold: " +
- str( pt_up_graph_to_ofp_avg ) )
-
- if pt_up_device_to_ofp_avg > 0 and \
- pt_up_device_to_ofp_avg < 1000:
- port_up_device_to_ofp_list.append(
- pt_up_device_to_ofp_avg )
- main.log.info( "Port up: device to ofp avg: " +
- str( pt_up_device_to_ofp_avg ) + " ms" )
- else:
- main.log.info( "Average port up device-to-ofp result" +
- " exceeded the threshold: " +
- str( pt_up_device_to_ofp_avg ) )
-
- # END ITERATION FOR LOOP
-
- # Check all list for latency existence and set assertion
- if ( port_down_graph_to_ofp_list and port_down_device_to_ofp_list
- and port_up_graph_to_ofp_list and port_up_device_to_ofp_list ):
- assertion = main.TRUE
-
- # Calculate and report latency measurements
- port_down_graph_to_ofp_min = min( port_down_graph_to_ofp_list )
- port_down_graph_to_ofp_max = max( port_down_graph_to_ofp_list )
- port_down_graph_to_ofp_avg = \
- ( sum( port_down_graph_to_ofp_list ) /
- len( port_down_graph_to_ofp_list ) )
-
- main.log.report( "Port down graph-to-ofp Min: " +
- str( port_down_graph_to_ofp_min ) + " ms Max: " +
- str( port_down_graph_to_ofp_max ) + " ms Avg: " +
- str( port_down_graph_to_ofp_avg ) )
-
- port_down_device_to_ofp_min = min( port_down_device_to_ofp_list )
- port_down_device_to_ofp_max = max( port_down_device_to_ofp_list )
- port_down_device_to_ofp_avg = \
- ( sum( port_down_device_to_ofp_list ) /
- len( port_down_device_to_ofp_list ) )
-
- main.log.report( "Port down device-to-ofp Min: " +
- str( port_down_device_to_ofp_min ) + " ms Max: " +
- str( port_down_device_to_ofp_max ) + " ms Avg: " +
- str( port_down_device_to_ofp_avg ) )
-
- port_up_graph_to_ofp_min = min( port_up_graph_to_ofp_list )
- port_up_graph_to_ofp_max = max( port_up_graph_to_ofp_list )
- port_up_graph_to_ofp_avg = \
- ( sum( port_up_graph_to_ofp_list ) /
- len( port_up_graph_to_ofp_list ) )
-
- main.log.report( "Port up graph-to-ofp Min: " +
- str( port_up_graph_to_ofp_min ) + " ms Max: " +
- str( port_up_graph_to_ofp_max ) + " ms Avg: " +
- str( port_up_graph_to_ofp_avg ) )
-
- port_up_device_to_ofp_min = min( port_up_device_to_ofp_list )
- port_up_device_to_ofp_max = max( port_up_device_to_ofp_list )
- port_up_device_to_ofp_avg = \
- ( sum( port_up_device_to_ofp_list ) /
- len( port_up_device_to_ofp_list ) )
-
- main.log.report( "Port up device-to-ofp Min: " +
- str( port_up_device_to_ofp_min ) + " ms Max: " +
- str( port_up_device_to_ofp_max ) + " ms Avg: " +
- str( port_up_device_to_ofp_avg ) )
-
- utilities.assert_equals(
- expect=main.TRUE,
- actual=assertion,
- onpass="Port discovery latency calculation successful",
- onfail="Port discovery test failed" )
-
- def CASE4( self, main ):
- """
- Link down event using loss rate 100%
-
- Important:
- Use a simple 2 switch topology with 1 link between
- the two switches. Ensure that mac addresses of the
- switches are 1 / 2 respectively
- """
- import time
- import subprocess
- import os
- import requests
- import json
-
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS_user = main.params[ 'CTRL' ][ 'user' ]
-
- default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
-
- # Number of iterations of case
- num_iter = main.params[ 'TEST' ][ 'numIter' ]
-
- # Timestamp 'keys' for json metrics output.
- # These are subject to change, hence moved into params
- deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
- linkTimestamp = main.params[ 'JSON' ][ 'linkTimestamp' ]
- graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
-
- assertion = main.TRUE
- # Link event timestamp to system time list
- link_down_link_to_system_list = []
- link_up_link_to_system_list = []
- # Graph event timestamp to system time list
- link_down_graph_to_system_list = []
- link_up_graph_to_system_list = []
-
- main.log.report( "Add / remove link latency between " +
- "two switches" )
-
- main.step( "Assign all switches" )
- main.Mininet1.assign_sw_controller(
- sw="1",
- ip1=ONOS1_ip,
- port1=default_sw_port )
- main.Mininet1.assign_sw_controller(
- sw="2",
- ip1=ONOS1_ip,
- port1=default_sw_port )
-
- main.step( "Verifying switch assignment" )
- result_s1 = main.Mininet1.get_sw_controller( sw="s1" )
- result_s2 = main.Mininet1.get_sw_controller( sw="s2" )
-
- # Allow time for events to finish before taking measurements
- time.sleep( 10 )
-
- link_down = False
- # Start iteration of link event test
- for i in range( 0, int( num_iter ) ):
- main.step( "Getting initial system time as t0" )
-
- timestamp_link_down_t0 = time.time() * 1000
- # Link down is simulated by 100% loss rate using traffic
- # control command
- main.Mininet1.handle.sendline(
- "sh tc qdisc add dev s1-eth1 root netem loss 100%" )
-
- # TODO: Iterate through 'links' command to verify that
- # link s1 -> s2 went down ( loop timeout 30 seconds )
- # on all 3 ONOS instances
- main.log.info( "Checking ONOS for link update" )
- loop_count = 0
- while( not link_down and loop_count < 30 ):
- json_str = main.ONOS1cli.links()
-
- if not json_str:
- main.log.error( "CLI command returned error " )
- break
- else:
- json_obj = json.loads( json_str )
- for obj in json_obj:
- if '01' not in obj[ 'src' ][ 'device' ]:
- link_down = True
- main.log.report( "Link down from " +
- "s1 -> s2 on ONOS1 detected" )
- loop_count += 1
- # If CLI doesn't like the continuous requests
- # and exits in this loop, increase the sleep here.
- # Consequently, while loop timeout will increase
- time.sleep( 1 )
-
- # Give time for metrics measurement to catch up
- # NOTE: May need to be configured more accurately
- time.sleep( 10 )
- # If we exited the while loop and link down 1,2,3 are still
- # false, then ONOS has failed to discover link down event
- if not link_down:
- main.log.info( "Link down discovery failed" )
-
- link_down_lat_graph1 = 0
- link_down_lat_device1 = 0
- assertion = main.FALSE
- else:
- json_topo_metrics_1 =\
- main.ONOS1cli.topology_events_metrics()
- json_topo_metrics_1 = json.loads( json_topo_metrics_1 )
-
- main.log.info( "Obtaining graph and device timestamp" )
- graph_timestamp_1 = \
- json_topo_metrics_1[ graphTimestamp ][ 'value' ]
-
- link_timestamp_1 = \
- json_topo_metrics_1[ linkTimestamp ][ 'value' ]
-
- if graph_timestamp_1 and link_timestamp_1:
- link_down_lat_graph1 = int( graph_timestamp_1 ) -\
- timestamp_link_down_t0
-
- link_down_lat_link1 = int( link_timestamp_1 ) -\
- timestamp_link_down_t0
- else:
- main.log.error( "There was an error calculating" +
- " the delta for link down event" )
- link_down_lat_graph1 = 0
-
- link_down_lat_device1 = 0
-
- main.log.report( "Link down latency ONOS1 iteration " +
- str( i ) + " (end-to-end): " +
- str( link_down_lat_graph1 ) + " ms" )
-
- main.log.report( "Link down latency ONOS1 iteration " +
- str( i ) + " (link-event-to-system-timestamp): " +
- str( link_down_lat_link1 ) + " ms" )
-
- # Calculate avg of node calculations
- link_down_lat_graph_avg = link_down_lat_graph1
- link_down_lat_link_avg = link_down_lat_link1
-
- # Set threshold and append latency to list
- if link_down_lat_graph_avg > 0.0 and\
- link_down_lat_graph_avg < 30000:
- link_down_graph_to_system_list.append(
- link_down_lat_graph_avg )
- else:
- main.log.info( "Link down latency exceeded threshold" )
- main.log.info( "Results for iteration " + str( i ) +
- "have been omitted" )
- if link_down_lat_link_avg > 0.0 and\
- link_down_lat_link_avg < 30000:
- link_down_link_to_system_list.append(
- link_down_lat_link_avg )
- else:
- main.log.info( "Link down latency exceeded threshold" )
- main.log.info( "Results for iteration " + str( i ) +
- "have been omitted" )
-
- # NOTE: To remove loss rate and measure latency:
- # 'sh tc qdisc del dev s1-eth1 root'
- timestamp_link_up_t0 = time.time() * 1000
- main.Mininet1.handle.sendline( "sh tc qdisc del dev " +
- "s1-eth1 root" )
- main.Mininet1.handle.expect( "mininet>" )
-
- main.log.info( "Checking ONOS for link update" )
-
- link_down1 = True
- loop_count = 0
- while( link_down1 and loop_count < 30 ):
- json_str1 = main.ONOS1cli.links()
- if not json_str1:
- main.log.error( "CLI command returned error " )
- break
- else:
- json_obj1 = json.loads( json_str1 )
-
- for obj1 in json_obj1:
- if '01' in obj1[ 'src' ][ 'device' ]:
- link_down1 = False
- main.log.report( "Link up from " +
- "s1 -> s2 on ONOS1 detected" )
- loop_count += 1
- time.sleep( 1 )
-
- if link_down1:
- main.log.info( "Link up discovery failed" )
- link_up_lat_graph1 = 0
- link_up_lat_device1 = 0
- assertion = main.FALSE
- else:
- json_topo_metrics_1 =\
- main.ONOS1cli.topology_events_metrics()
- json_topo_metrics_1 = json.loads( json_topo_metrics_1 )
-
- main.log.info( "Obtaining graph and device timestamp" )
- graph_timestamp_1 = \
- json_topo_metrics_1[ graphTimestamp ][ 'value' ]
-
- link_timestamp_1 = \
- json_topo_metrics_1[ linkTimestamp ][ 'value' ]
-
- if graph_timestamp_1 and link_timestamp_1:
- link_up_lat_graph1 = int( graph_timestamp_1 ) -\
- timestamp_link_up_t0
- link_up_lat_link1 = int( link_timestamp_1 ) -\
- timestamp_link_up_t0
- else:
- main.log.error( "There was an error calculating" +
- " the delta for link down event" )
- link_up_lat_graph1 = 0
- link_up_lat_device1 = 0
-
- main.log.info( "Link up latency ONOS1 iteration " +
- str( i ) + " (end-to-end): " +
- str( link_up_lat_graph1 ) + " ms" )
-
- main.log.info( "Link up latency ONOS1 iteration " +
- str( i ) + " (link-event-to-system-timestamp): " +
- str( link_up_lat_link1 ) + " ms" )
-
- # Calculate avg of node calculations
- link_up_lat_graph_avg = link_up_lat_graph1
- link_up_lat_link_avg = link_up_lat_link1
-
- # Set threshold and append latency to list
- if link_up_lat_graph_avg > 0.0 and\
- link_up_lat_graph_avg < 30000:
- link_up_graph_to_system_list.append(
- link_up_lat_graph_avg )
- else:
- main.log.info( "Link up latency exceeded threshold" )
- main.log.info( "Results for iteration " + str( i ) +
- "have been omitted" )
- if link_up_lat_link_avg > 0.0 and\
- link_up_lat_link_avg < 30000:
- link_up_link_to_system_list.append(
- link_up_lat_link_avg )
- else:
- main.log.info( "Link up latency exceeded threshold" )
- main.log.info( "Results for iteration " + str( i ) +
- "have been omitted" )
-
- # Calculate min, max, avg of list and report
- link_down_min = min( link_down_graph_to_system_list )
- link_down_max = max( link_down_graph_to_system_list )
- link_down_avg = sum( link_down_graph_to_system_list ) / \
- len( link_down_graph_to_system_list )
- link_up_min = min( link_up_graph_to_system_list )
- link_up_max = max( link_up_graph_to_system_list )
- link_up_avg = sum( link_up_graph_to_system_list ) / \
- len( link_up_graph_to_system_list )
-
- main.log.report( "Link down latency - Min: " +
- str( link_down_min ) + "ms Max: " +
- str( link_down_max ) + "ms Avg: " +
- str( link_down_avg ) + "ms" )
- main.log.report( "Link up latency - Min: " +
- str( link_up_min ) + "ms Max: " +
- str( link_up_max ) + "ms Avg: " +
- str( link_up_avg ) + "ms" )
-
- utilities.assert_equals(
- expect=main.TRUE,
- actual=assertion,
- onpass="Link discovery latency calculation successful",
- onfail="Link discovery latency case failed" )
-
- def CASE5( self, main ):
- """
- 100 Switch discovery latency
-
- Important:
- This test case can be potentially dangerous if
- your machine has previously set iptables rules.
- One of the steps of the test case will flush
- all existing iptables rules.
- Note:
- You can specify the number of switches in the
- params file to adjust the switch discovery size
- ( and specify the corresponding topology in Mininet1
- .topo file )
- """
- import time
- import subprocess
- import os
- import requests
- import json
-
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
- MN1_ip = main.params[ 'MN' ][ 'ip1' ]
- ONOS_user = main.params[ 'CTRL' ][ 'user' ]
-
- default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
-
- # Number of iterations of case
- num_iter = main.params[ 'TEST' ][ 'numIter' ]
- num_sw = main.params[ 'TEST' ][ 'numSwitch' ]
-
- # Timestamp 'keys' for json metrics output.
- # These are subject to change, hence moved into params
- deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
- graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
-
- tshark_ofp_output = "/tmp/tshark_ofp_" + num_sw + "sw.txt"
- tshark_tcp_output = "/tmp/tshark_tcp_" + num_sw + "sw.txt"
-
- tshark_ofp_result_list = []
- tshark_tcp_result_list = []
-
- main.case( num_sw + " Switch discovery latency" )
- main.step( "Assigning all switches to ONOS1" )
- for i in range( 1, int( num_sw ) + 1 ):
- main.Mininet1.assign_sw_controller(
- sw=str( i ),
- ip1=ONOS1_ip,
- port1=default_sw_port )
-
- # Ensure that nodes are configured with ptpd
- # Just a warning message
- main.log.info( "Please check ptpd configuration to ensure" +
- " All nodes' system times are in sync" )
- time.sleep( 5 )
-
- for i in range( 0, int( num_iter ) ):
-
- main.step( "Set iptables rule to block incoming sw connections" )
- # Set iptables rule to block incoming switch connections
- # The rule description is as follows:
- # Append to INPUT rule,
- # behavior DROP that matches following:
- # * packet type: tcp
- # * source IP: MN1_ip
- # * destination PORT: 6633
- main.ONOS1.handle.sendline(
- "sudo iptables -A INPUT -p tcp -s " + MN1_ip +
- " --dport " + default_sw_port + " -j DROP" )
- main.ONOS1.handle.expect( "\$" )
- # Append to OUTPUT rule,
- # behavior DROP that matches following:
- # * packet type: tcp
- # * source IP: MN1_ip
- # * destination PORT: 6633
- main.ONOS1.handle.sendline(
- "sudo iptables -A OUTPUT -p tcp -s " + MN1_ip +
- " --dport " + default_sw_port + " -j DROP" )
- main.ONOS1.handle.expect( "\$" )
- # Give time to allow rule to take effect
- # NOTE: Sleep period may need to be configured
- # based on the number of switches in the topology
- main.log.info( "Please wait for switch connection to " +
- "time out" )
- time.sleep( 60 )
-
- # Gather vendor OFP with tshark
- main.ONOS1.tshark_grep( "OFP 86 Vendor",
- tshark_ofp_output )
- main.ONOS1.tshark_grep( "TCP 74 ",
- tshark_tcp_output )
-
- # NOTE: Remove all iptables rule quickly ( flush )
- # Before removal, obtain TestON timestamp at which
- # removal took place
- # ( ensuring nodes are configured via ptp )
- # sudo iptables -F
-
- t0_system = time.time() * 1000
- main.ONOS1.handle.sendline(
- "sudo iptables -F" )
-
- # Counter to track loop count
- counter_loop = 0
- counter_avail1 = 0
- onos1_dev = False
- while counter_loop < 60:
- # Continue to check devices for all device
- # availability. When all devices in all 3
- # ONOS instances indicate that devices are available
- # obtain graph event timestamp for t1.
- device_str_obj1 = main.ONOS1cli.devices()
- device_json1 = json.loads( device_str_obj1 )
-
- for device1 in device_json1:
- if device1[ 'available' ]:
- counter_avail1 += 1
- if counter_avail1 == int( num_sw ):
- onos1_dev = True
- main.log.info( "All devices have been " +
- "discovered on ONOS1" )
- else:
- counter_avail1 = 0
-
- if onos1_dev:
- main.log.info( "All devices have been discovered " +
- "on all ONOS instances" )
- json_str_topology_metrics_1 =\
- main.ONOS1cli.topology_events_metrics()
- # Exit while loop if all devices discovered
- break
-
- counter_loop += 1
- # Give some time in between CLI calls
- #( will not affect measurement )
- time.sleep( 3 )
-
- main.ONOS1.tshark_stop()
-
- os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
- tshark_ofp_output + " /tmp/" )
- os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
- tshark_tcp_output + " /tmp/" )
- ofp_file = open( tshark_ofp_output, 'r' )
-
- # The following is for information purpose only.
- # TODO: Automate OFP output analysis
- main.log.info( "Tshark OFP Vendor output: " )
- for line in ofp_file:
- tshark_ofp_result_list.append( line )
- main.log.info( line )
-
- ofp_file.close()
-
- tcp_file = open( tshark_tcp_output, 'r' )
- main.log.info( "Tshark TCP 74 output: " )
- for line in tcp_file:
- tshark_tcp_result_list.append( line )
- main.log.info( line )
-
- tcp_file.close()
-
- json_obj_1 = json.loads( json_str_topology_metrics_1 )
-
- graph_timestamp_1 = \
- json_obj_1[ graphTimestamp ][ 'value' ]
-
- main.log.info(
- int( graph_timestamp_1 ) - int( t0_system ) )
diff --git a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo
deleted file mode 100644
index 3fc7bdc..0000000
--- a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo
+++ /dev/null
@@ -1,55 +0,0 @@
-<TOPOLOGY>
- <COMPONENT>
-
- <ONOSbench>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOSbench>
-
- <ONOS1cli>
- <host>10.128.174.10</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1cli>
-
- <ONOS1>
- <host>10.128.174.1</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1>
-
- <Mininet1>
- <host>10.128.10.90</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>MininetCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS>
- <arg1> --custom topo-100sw.py </arg1>
- <arg2> --arp --mac --topo mytopo</arg2>
- <arg3> </arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet1>
-
- <Mininet2>
- <host>10.128.10.90</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>RemoteMininetDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS> </COMPONENTS>
- </Mininet2>
-
- </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/TopoPerfNextSingleNode/__init__.py b/TestON/tests/TopoPerfNextSingleNode/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/TopoPerfNextSingleNode/__init__.py
+++ /dev/null
diff --git a/TestON/tests/prevFuncNext/FuncNext.params b/TestON/tests/prevFuncNext/FuncNext.params
deleted file mode 100755
index 13a4691..0000000
--- a/TestON/tests/prevFuncNext/FuncNext.params
+++ /dev/null
@@ -1,37 +0,0 @@
-<PARAMS>
-
- <testcases>1,4,5,3</testcases>
-
- #Environment variables
- <ENV>
- <cellName>driver_test</cellName>
- </ENV>
-
- <CTRL>
- <ip1>10.128.20.11</ip1>
- <port1>6633</port1>
- </CTRL>
-
- <PING>
- <source1>h8</source1>
- <source2>h9</source2>
- <source3>h10</source3>
- <source4>h11</source4>
- <source5>h12</source5>
- <source6>h13</source6>
- <source7>h14</source7>
- <source8>h15</source8>
- <source9>h16</source9>
- <source10>h17</source10>
- <target1>10.0.0.18</target1>
- <target2>10.0.0.19</target2>
- <target3>10.0.0.20</target3>
- <target4>10.0.0.21</target4>
- <target5>10.0.0.22</target5>
- <target6>10.0.0.23</target6>
- <target7>10.0.0.24</target7>
- <target8>10.0.0.25</target8>
- <target9>10.0.0.26</target9>
- <target10>10.0.0.27</target10>
- </PING>
-</PARAMS>
diff --git a/TestON/tests/prevFuncNext/FuncNext.py b/TestON/tests/prevFuncNext/FuncNext.py
deleted file mode 100755
index e556fa4..0000000
--- a/TestON/tests/prevFuncNext/FuncNext.py
+++ /dev/null
@@ -1,311 +0,0 @@
-
-#Testing the basic functionality of ONOS Next
-#For sanity and driver functionality excercises only.
-
-import time
-import sys
-import os
-import re
-import time
-
-time.sleep(1)
-class FuncNext:
- def __init__(self):
- self.default = ''
-
- def CASE1(self, main):
- '''
- Startup sequence:
- git pull
- mvn clean install
- onos-package
- cell <name>
- onos-verify-cell
- onos-install -f
- onos-wait-for-start
- '''
-
- cell_name = main.params['ENV']['cellName']
- ONOS1_ip = main.params['CTRL']['ip1']
- ONOS1_port = main.params['CTRL']['port1']
-
- main.case("Setting up test environment")
-
- main.step("Git checkout and pull master and get version")
- main.ONOSbench.git_checkout("master")
- git_pull_result = main.ONOSbench.git_pull()
- version_result = main.ONOSbench.get_version()
-
- main.step("Using mvn clean & install")
- #clean_install_result = main.ONOSbench.clean_install()
- #clean_install_result = main.TRUE
-
- main.step("Applying cell variable to environment")
- cell_result = main.ONOSbench.set_cell(cell_name)
- verify_result = main.ONOSbench.verify_cell()
- cell_result = main.ONOS2.set_cell(cell_name)
- #verify_result = main.ONOS2.verify_cell()
- main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-
- main.step("Creating ONOS package")
- package_result = main.ONOSbench.onos_package()
-
- #main.step("Creating a cell")
- #cell_create_result = main.ONOSbench.create_cell_file(**************)
-
- main.step("Installing ONOS package")
- onos_install_result = main.ONOSbench.onos_install()
- onos1_isup = main.ONOSbench.isup()
-
- main.step("Starting ONOS service")
- start_result = main.ONOSbench.onos_start(ONOS1_ip)
-
- case1_result = (package_result and\
- cell_result and verify_result and onos_install_result and\
- onos1_isup and start_result )
- utilities.assert_equals(expect=main.TRUE, actual=case1_result,
- onpass="Test startup successful",
- onfail="Test startup NOT successful")
-
- def CASE11(self, main):
- '''
- Cleanup sequence:
- onos-service <node_ip> stop
- onos-uninstall
-
- TODO: Define rest of cleanup
-
- '''
-
- ONOS1_ip = main.params['CTRL']['ip1']
-
- main.case("Cleaning up test environment")
-
- main.step("Testing ONOS kill function")
- kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
-
- main.step("Stopping ONOS service")
- stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
-
- main.step("Uninstalling ONOS service")
- uninstall_result = main.ONOSbench.onos_uninstall()
-
- def CASE3(self, main):
- '''
- Test 'onos' command and its functionality in driver
- '''
-
- ONOS1_ip = main.params['CTRL']['ip1']
-
- main.case("Testing 'onos' command")
-
- main.step("Sending command 'onos -w <onos-ip> system:name'")
- cmdstr1 = "system:name"
- cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1)
- main.log.info("onos command returned: "+cmd_result1)
-
- main.step("Sending command 'onos -w <onos-ip> onos:topology'")
- cmdstr2 = "onos:topology"
- cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
- main.log.info("onos command returned: "+cmd_result2)
-
-
-
- def CASE4(self, main):
- import re
- import time
- main.case("Pingall Test")
- main.step("Assigning switches to controllers")
- for i in range(1,29):
- if i ==1:
- main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
- elif i>=2 and i<5:
- main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
- elif i>=5 and i<8:
- main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
- elif i>=8 and i<18:
- main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
- elif i>=18 and i<28:
- main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
- else:
- main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
- Switch_Mastership = main.TRUE
- for i in range (1,29):
- if i==1:
- response = main.Mininet1.get_sw_controller("s"+str(i))
- print("Response is " + str(response))
- if re.search("tcp:"+ONOS1_ip,response):
- Switch_Mastership = Switch_Mastership and main.TRUE
- else:
- Switch_Mastership = main.FALSE
- elif i>=2 and i<5:
- response = main.Mininet1.get_sw_controller("s"+str(i))
- print("Response is " + str(response))
- if re.search("tcp:"+ONOS1_ip,response):
- Switch_Mastership = Switch_Mastership and main.TRUE
- else:
- Switch_Mastership = main.FALSE
- elif i>=5 and i<8:
- response = main.Mininet1.get_sw_controller("s"+str(i))
- print("Response is " + str(response))
- if re.search("tcp:"+ONOS1_ip,response):
- Switch_Mastership = Switch_Mastership and main.TRUE
- else:
- Switch_Mastership = main.FALSE
- elif i>=8 and i<18:
- response = main.Mininet1.get_sw_controller("s"+str(i))
- print("Response is " + str(response))
- if re.search("tcp:"+ONOS1_ip,response):
- Switch_Mastership = Switch_Mastership and main.TRUE
- else:
- Switch_Mastership = main.FALSE
- elif i>=18 and i<28:
- response = main.Mininet1.get_sw_controller("s"+str(i))
- print("Response is " + str(response))
- if re.search("tcp:"+ONOS1_ip,response):
- Switch_Mastership = Switch_Mastership and main.TRUE
- else:
- Switch_Mastership = main.FALSE
- else:
- response = main.Mininet1.get_sw_controller("s"+str(i))
- print("Response is" + str(response))
- if re.search("tcp:" +ONOS1_ip,response):
- Switch_Mastership = Switch_Mastership and main.TRUE
- else:
- Switch_Mastership = main.FALSE
-
- if Switch_Mastership == main.TRUE:
- main.log.report("MasterControllers assigned correctly")
- utilities.assert_equals(expect = main.TRUE,actual=Switch_Mastership,
- onpass="MasterControllers assigned correctly")
- '''
- for i in range (1,29):
- main.Mininet1.assign_sw_controller(sw=str(i),count=5,
- ip1=ONOS1_ip,port1=ONOS1_port,
- ip2=ONOS2_ip,port2=ONOS2_port,
- ip3=ONOS3_ip,port3=ONOS3_port,
- ip4=ONOS4_ip,port4=ONOS4_port,
- ip5=ONOS5_ip,port5=ONOS5_port)
- '''
- #REACTIVE FWD test
-
- main.step("Get list of hosts from Mininet")
- host_list = main.Mininet1.get_hosts()
- main.log.info(host_list)
-
- main.step("Get host list in ONOS format")
- host_onos_list = main.ONOS2.get_hosts_id(host_list)
- main.log.info(host_onos_list)
- #time.sleep(5)
-
- #We must use ping from hosts we want to add intents from
- #to make the hosts talk
- #main.Mininet2.handle.sendline("\r")
- #main.Mininet2.handle.sendline("h4 ping 10.1.1.1 -c 1 -W 1")
- #time.sleep(3)
- #main.Mininet2.handle.sendline("h5 ping 10.1.1.1 -c 1 -W 1")
- #time.sleep(5)
-
- main.step("Pingall")
- ping_result = main.FALSE
- while ping_result == main.FALSE:
- time1 = time.time()
- ping_result = main.Mininet1.pingall()
- time2 = time.time()
- print "Time for pingall: %2f seconds" % (time2 - time1)
-
- #Start onos cli again because u might have dropped out of onos prompt to the shell prompt
- #if there was no activity
- main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-
- main.step("Get hosts")
- main.ONOS2.handle.sendline("hosts")
- main.ONOS2.handle.expect("onos>")
- hosts = main.ONOS2.handle.before
- main.log.info(hosts)
-
- main.step("Get all devices id")
- devices_id_list = main.ONOS2.get_all_devices_id()
- main.log.info(devices_id_list)
- '''
- main.step("Add point-to-point intents")
- ptp_intent_result = main.ONOS2.add_point_intent(
- devices_id_list[0], 1, devices_id_list[1], 2)
- if ptp_intent_result == main.TRUE:
- get_intent_result = main.ONOS2.intents()
- main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
- '''
-
- case4_result = Switch_Mastership and ping_result
- utilities.assert_equals(expect=main.TRUE, actual=case4_result,
- onpass="Pingall Test successful",
- onfail="Pingall Test NOT successful")
-
- def CASE5(self,main) :
- import time
- from subprocess import Popen, PIPE
- from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
- #main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
- deviceResult = main.ONOS2.devices()
- linksResult = main.ONOS2.links()
- portsResult = main.ONOS2.ports()
- print "**************"
- main.step("Start continuous pings")
- main.Mininet2.pingLong(src=main.params['PING']['source1'],
- target=main.params['PING']['target1'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source2'],
- target=main.params['PING']['target2'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source3'],
- target=main.params['PING']['target3'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source4'],
- target=main.params['PING']['target4'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source5'],
- target=main.params['PING']['target5'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source6'],
- target=main.params['PING']['target6'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source7'],
- target=main.params['PING']['target7'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source8'],
- target=main.params['PING']['target8'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source9'],
- target=main.params['PING']['target9'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source10'],
- target=main.params['PING']['target10'],pingTime=500)
-
- main.step("Create TestONTopology object")
- global ctrls
- ctrls = []
- count = 1
- while True:
- temp = ()
- if ('ip' + str(count)) in main.params['CTRL']:
- temp = temp + (getattr(main,('ONOS' + str(count))),)
- temp = temp + ("ONOS"+str(count),)
- temp = temp + (main.params['CTRL']['ip'+str(count)],)
- temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
- ctrls.append(temp)
- count = count + 1
- else:
- break
- global MNTopo
- Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
- MNTopo = Topo
-
- Topology_Check = main.TRUE
- main.step("Compare ONOS Topology to MN Topology")
- '''for n in range(1,6):
- result = main.Mininet1.compare_topo(MNTopo,
- main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+ \
- main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
- if result == main.TRUE:
- main.log.report("ONOS"+str(n) + " Topology matches MN Topology")
- utilities.assert_equals(expect=main.TRUE,actual=result,
- onpass="ONOS" + str(n) + " Topology matches MN Topology",
- onfail="ONOS" + str(n) + " Topology does not match MN Topology")
- Topology_Check = Topology_Check and result
- utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
- onpass="Topology checks passed", onfail="Topology checks failed")
- '''
-
-
diff --git a/TestON/tests/prevFuncNext/FuncNext.topo b/TestON/tests/prevFuncNext/FuncNext.topo
deleted file mode 100755
index 5d453a6..0000000
--- a/TestON/tests/prevFuncNext/FuncNext.topo
+++ /dev/null
@@ -1,61 +0,0 @@
-<TOPOLOGY>
- <COMPONENT>
-
- <ONOSbench>
- <host>10.128.10.11</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOSbench>
-
- <ONOS1>
- <host>10.128.10.11</host>
- <user>sdn</user>
- <password>sdn</password>
- <type>OnosDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1>
-
- <ONOS2>
- <host>10.128.10.11</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2>
-
- <Mininet1>
- <host>10.128.10.11</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>MininetCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS>
- #Specify the Option for mininet
- <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
- <arg2> --topo mytopo </arg2>
- <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet1>
-
- <Mininet2>
- <host>10.128.10.11</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>RemoteMininetDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS>
- #Specify the Option for mininet
- <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
- <arg2> --topo mytopo </arg2>
- <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet2>
- </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/prevFuncNext/__init__.py b/TestON/tests/prevFuncNext/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/prevFuncNext/__init__.py
+++ /dev/null