Merge "modifying FUNCoptical to use new topology"
diff --git a/.gitignore b/.gitignore
index fa270ed..b70404d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,4 @@
*.pyc
.DS_Store
._.DS_Store
-
+.idea/*
diff --git a/README.md b/README.md
index ad22ef6..49ded69 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-TestON, a testing infastructure by Paxterra
+TestON, a testing infastructure by Paxterra and Open Networking Labs
=======================================
-TestON is the testing platform that all the ONOS tests are being run on currently.
+TestON is the testing platform that all the ONOS tests are being run on currently.
Code Style
@@ -11,27 +11,27 @@
Setup
-------------
-0. Pull the git repo from https://github.com/OPENNETWORKINGLAB/OnosSystemTest.git
+0. Pull the git repo from gerrit or github(Read only mirror)
+
+ $ git clone https://gerrit.onosproject.org/OnosSystemTest
+
+ or
$ git clone https://github.com/OPENNETWORKINGLAB/OnosSystemTest.git
-1. Make a symbolic link for TestON on the HOMEDIR
- Execute the following from the home directory
+1. Run the install script
- $ ln -s OnosSystemTest/TestON TestON
+ $ cd OnosSystemTest/TestON
-2. Make sure python path is correct
+ $ install.sh
- $ export PYTHONPATH={PATH TO HOMEDIR}/TestON/
-
- $ echo $PYTHONPATH
Dependencies
------------
-1. ONOS
+1. [ONOS](https://github.com/opennetworkinglab/onos) - The system under test
-2. Mininet - Some driver functions rely on a modified version of Mininet. These functions are noted in the mininet driver file. To checkout this branch from your Mininet folder:
+2. [Mininet](https://github.com/mininet/mininet) - A Network Emulator. NOTE: Some driver functions rely on a modified version of Mininet. These functions are noted in the mininet driver file. To checkout this branch from your Mininet folder:
$ git remote add jhall11 https://github.com/jhall11/mininet.git
@@ -43,13 +43,7 @@
Note that you may need to run 'sudo make develop' if your mnexec.c file changed when switching branches.
-3. Install python packages configObj and pexpect (Note: pexpect 3.3 has a known bug. We recommend using version 3.2 for now). They can be installed as :
-
- $ sudo pip install configObj
-
- $ sudo pip install pexpect==3.2
-
- $ sudo pip install numpy
+3. There are some python modules required by some test cases. These modules should be installed by running the install.sh script.
4. Linc-OE - Some testcases use this to emulate optical devices
@@ -83,53 +77,51 @@
Change the file paths to the appropriate paths
2. The .topo file for each test
-
+
Must change the IPs/login/etc to point to the nodes you want to run on
Running TestON
------------
-1. TestON must be ran from its bin directory
+1. TestON must be ran from its bin directory
$ cd TestON/bin
-2. Launch cli
+2. Run the test
- $ ./cli.py
-
-3. Run the test
-
- teston> run PingallExample
+ $ teston run SAMPstartTemplate_1node
The Tests
-----------------------------------------------
The tests are all located it TestON/tests/
-Each test has its own folder with the following files:
+Each test has its own folder with the following files:
-1. .ospk file
+1. .ospk file (optional)
- This is written in Openspeak, a word based language developed by Paxterra.
- - It defines the cases and sequence of events for the test
+ - It defines the cases and sequence of events for the test
+
+ - TestON will automatically generate the .py file based on the .ospk file if the .ospk file exists.
2. .py file
-
- - This file serves the same exact function as the openspeak file.
- - It will only be used if there is NO .ospk file, so if you like python, delete or rename the .ospk file
-
-3. .topo file
+ - This file serves the same exact function as the openspeak file.
- - This defines all the components that TestON creates for that test and includes data such as IP address, login info, and device drivers
-
- - The Components must be defined in this file to be uesd in the openspeak or python files.
-
+ - It will only be used if there is NO .ospk file, so if you like python, delete or rename the .ospk file
+
+3. .topo file
+
+ - This defines all the components that TestON creates for that test and includes data such as IP address, login info, and device drivers
+
+ - The Components must be defined in this file to be uesd in the openspeak or python files.
+
4. .params file
- - Defines all the test-specific variables that are used by the test.
+ - Defines all the test-specific variables that are used by the test.
- - NOTE: The variable `testcases` which defines which testcases run when the test is ran.
+ - NOTE: The variable `testcases` defines which testcases run when the test is ran.
Troubleshooting
-----------------------------------------------
@@ -137,4 +129,4 @@
1. Double check the topo file for that specific test the nodes must be able to run that specific component ( Mininet IP -> machine with mn installed)
-2. Enable passwordless logins between your nodes and the TestON node.
+2. Enable passwordless logins between your nodes and the TestON node.
diff --git a/TestON/bin/cli.py b/TestON/bin/cli.py
index a91052c..f29a8ec 100755
--- a/TestON/bin/cli.py
+++ b/TestON/bin/cli.py
@@ -267,6 +267,10 @@
index = index+1
options[option] = args[index]
options = self.testcasesInRange(index,option,args,options)
+ elif re.match("--params", option, flags=0):
+ # check if there is a params
+ index = index + 1
+ options['params'].append(args[index])
else :
options['testname'] = option
except IndexError as e:
@@ -284,6 +288,8 @@
options['testdir'] = None
options['testcases'] = None
options['onoscell'] = None
+ # init params as a empty list
+ options['params'] = []
return options
def testcasesInRange(self,index,option,args,options):
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index e798e98..a770490 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -781,7 +781,7 @@
verifyTest( options )
verifyExample( options )
verifyTestScript( options )
- verifyParams()
+ verifyParams( options )
verifyLogdir( options )
verifyMail( options )
verifyTestCases( options )
@@ -929,7 +929,7 @@
main.params = main.parser.parseParams( main.classPath )
main.topology = main.parser.parseTopology( main.classPath )
-def verifyParams():
+def verifyParams( options ):
try:
main.params = main.params['PARAMS']
except KeyError:
@@ -942,6 +942,40 @@
print "Error with the Topology file: Either the file not specified " +\
"or the format is not correct"
main.exit()
+ # Overwrite existing params variables if they are specified from command line
+ if len(options.params) > 0:
+ # Some params variables are specified from command line
+ for param in options.params:
+ if not re.search( ".=.", param ):
+ print( "Error when parsing params: params should follow key=value format" )
+ continue
+ # Split the param string to netest keys and value
+ [ keys, value ] = param.split( "=" )
+ # Split the nested keys according to its hierarchy
+ keyList = keys.split( "/" )
+ # Get the outermost dictionary
+ paramDict = main.params
+ # Get the innermost dictionary
+ try:
+ while len( keyList ) > 1:
+ key = keyList.pop(0)
+ assert isinstance( paramDict[ key ], dict )
+ paramDict = paramDict[ key ]
+ except KeyError:
+ print( "Error when parsing params: key \"" + key + "\" not found in main.params" )
+ main.exit()
+ except AssertionError:
+ print( "Error when parsing params: \"" + key + "\" is already the innermost level in main.params" )
+ main.exit()
+ # Change the value
+ if not paramDict.has_key( keyList[0] ):
+ print( "Error when parsing params: key \"" + keyList[0] + "\" not found in main.params" )
+ main.exit()
+ elif isinstance( paramDict[ keyList[0] ], dict ):
+ print( "Error when parsing params: more levels under key \"" + keyList[0] + "\" in main.params" )
+ main.exit()
+ else:
+ paramDict[ keyList[0] ] = value
def load_parser():
'''
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 1209571..1632fee 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -38,6 +38,7 @@
import os
from math import pow
from drivers.common.cli.emulatordriver import Emulator
+from core.graph import Graph
class MininetCliDriver( Emulator ):
@@ -57,6 +58,7 @@
self.hostPrompt = "~#"
self.bashPrompt = "\$"
self.scapyPrompt = ">>>"
+ self.graph = Graph()
def connect( self, **connectargs ):
"""
@@ -1827,6 +1829,72 @@
main.cleanup()
main.exit()
+ def getSwitchRandom( self, timeout=60, nonCut=True ):
+ """
+ Randomly get a switch from Mininet topology.
+ If nonCut is True, it gets a list of non-cut switches (the deletion
+ of a non-cut switch will not increase the number of connected
+ components of a graph) and randomly returns one of them, otherwise
+ it just randomly returns one switch from all current switches in
+ Mininet.
+ Returns the name of the chosen switch.
+ """
+ import random
+ candidateSwitches = []
+ try:
+ if not nonCut:
+ switches = self.getSwitches( timeout=timeout )
+ assert len( switches ) != 0
+ for switchName in switches.keys():
+ candidateSwitches.append( switchName )
+ else:
+ graphDict = self.getGraphDict( timeout=timeout, useId=False )
+ if graphDict == None:
+ return None
+ self.graph.update( graphDict )
+ candidateSwitches = self.graph.getNonCutVertices()
+ if candidateSwitches == None:
+ return None
+ elif len( candidateSwitches ) == 0:
+ main.log.info( self.name + ": No candidate switch for deletion" )
+ return None
+ else:
+ switch = random.sample( candidateSwitches, 1 )
+ return switch[ 0 ]
+ except KeyError:
+ main.log.exception( self.name + ": KeyError exception found" )
+ return None
+ except AssertionError:
+ main.log.exception( self.name + ": AssertionError exception found" )
+ return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception" )
+ return None
+
+ def delSwitchRandom( self, timeout=60, nonCut=True ):
+ """
+ Randomly delete a switch from Mininet topology.
+ If nonCut is True, it gets a list of non-cut switches (the deletion
+ of a non-cut switch will not increase the number of connected
+ components of a graph) and randomly chooses one for deletion,
+ otherwise it just randomly delete one switch from all current
+ switches in Mininet.
+ Returns the name of the deleted switch
+ """
+ try:
+ switch = self.getSwitchRandom( timeout, nonCut )
+ if switch == None:
+ return None
+ else:
+ deletionResult = self.delSwitch( switch )
+ if deletionResult:
+ return switch
+ else:
+ return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception" )
+ return None
+
def addLink( self, node1, node2 ):
"""
add a link to the mininet topology
@@ -1892,6 +1960,75 @@
main.cleanup()
main.exit()
+ def getLinkRandom( self, timeout=60, nonCut=True ):
+ """
+ Randomly get a link from Mininet topology.
+ If nonCut is True, it gets a list of non-cut links (the deletion
+ of a non-cut link will not increase the number of connected
+ component of a graph) and randomly returns one of them, otherwise
+ it just randomly returns one link from all current links in
+ Mininet.
+ Returns the link as a list, e.g. [ 's1', 's2' ]
+ """
+ import random
+ candidateLinks = []
+ try:
+ if not nonCut:
+ links = self.getLinks( timeout=timeout )
+ assert len( links ) != 0
+ for link in links:
+ # Exclude host-switch link
+ if link[ 'node1' ].startswith( 'h' ) or link[ 'node2' ].startswith( 'h' ):
+ continue
+ candidateLinks.append( [ link[ 'node1' ], link[ 'node2' ] ] )
+ else:
+ graphDict = self.getGraphDict( timeout=timeout, useId=False )
+ if graphDict == None:
+ return None
+ self.graph.update( graphDict )
+ candidateLinks = self.graph.getNonCutEdges()
+ if candidateLinks == None:
+ return None
+ elif len( candidateLinks ) == 0:
+ main.log.info( self.name + ": No candidate link for deletion" )
+ return None
+ else:
+ link = random.sample( candidateLinks, 1 )
+ return link[ 0 ]
+ except KeyError:
+ main.log.exception( self.name + ": KeyError exception found" )
+ return None
+ except AssertionError:
+ main.log.exception( self.name + ": AssertionError exception found" )
+ return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception" )
+ return None
+
+ def delLinkRandom( self, timeout=60, nonCut=True ):
+ """
+ Randomly delete a link from Mininet topology.
+ If nonCut is True, it gets a list of non-cut links (the deletion
+ of a non-cut link will not increase the number of connected
+ component of a graph) and randomly chooses one for deletion,
+ otherwise it just randomly delete one link from all current links
+ in Mininet.
+ Returns the deleted link as a list, e.g. [ 's1', 's2' ]
+ """
+ try:
+ link = self.getLinkRandom( timeout, nonCut )
+ if link == None:
+ return None
+ else:
+ deletionResult = self.delLink( link[ 0 ], link[ 1 ] )
+ if deletionResult:
+ return link
+ else:
+ return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception" )
+ return None
+
def addHost( self, hostname, **kwargs ):
"""
Add a host to the mininet topology
@@ -2476,6 +2613,48 @@
'enabled': isUp } )
return ports
+ def getOVSPorts( self, nodeName ):
+ """
+ Read ports from OVS by executing 'ovs-ofctl dump-ports-desc' command.
+
+ Returns a list of dictionaries containing information about each
+ port of the given switch.
+ """
+ command = "sh ovs-ofctl dump-ports-desc " + str( nodeName )
+ try:
+ response = self.execute(
+ cmd=command,
+ prompt="mininet>",
+ timeout=10 )
+ ports = []
+ if response:
+ for line in response.split( "\n" ):
+ # Regex patterns to parse 'ovs-ofctl dump-ports-desc' output
+ # Example port:
+ # 1(s1-eth1): addr:ae:60:72:77:55:51
+ pattern = "(?P<index>\d+)\((?P<name>[^-]+-eth(?P<port>\d+))\):\saddr:(?P<mac>([a-f0-9]{2}:){5}[a-f0-9]{2})"
+ result = re.search( pattern, line )
+ if result:
+ index = result.group( 'index' )
+ name = result.group( 'name' )
+ # This port number is extracted from port name
+ port = result.group( 'port' )
+ mac = result.group( 'mac' )
+ ports.append( { 'index': index,
+ 'name': name,
+ 'port': port,
+ 'mac': mac } )
+ return ports
+ 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()
+
def getSwitches( self, verbose=False ):
"""
Read switches from Mininet.
@@ -2963,6 +3142,100 @@
return switchList
+ def getGraphDict( self, timeout=60, useId=True, includeHost=False ):
+ """
+ Return a dictionary which describes the latest Mininet topology data as a
+ graph.
+ An example of the dictionary:
+ { vertex1: { 'edges': ..., 'name': ..., 'protocol': ... },
+ vertex2: { 'edges': ..., 'name': ..., 'protocol': ... } }
+ Each vertex should at least have an 'edges' attribute which describes the
+ adjacency information. The value of 'edges' attribute is also represented by
+ a dictionary, which maps each edge (identified by the neighbor vertex) to a
+ list of attributes.
+ An example of the edges dictionary:
+ 'edges': { vertex2: { 'port': ..., 'weight': ... },
+ vertex3: { 'port': ..., 'weight': ... } }
+ If useId == True, dpid/mac will be used instead of names to identify
+ vertices, which is helpful when e.g. comparing Mininet topology with ONOS
+ topology.
+ If includeHost == True, all hosts (and host-switch links) will be included
+ in topology data.
+ Note that link or switch that are brought down by 'link x x down' or 'switch
+ x down' commands still show in the output of Mininet CLI commands such as
+ 'links', 'dump', etc. Thus, to ensure the correctness of this function, it is
+ recommended to use delLink() or delSwitch functions to simulate link/switch
+ down, and addLink() or addSwitch to add them back.
+ """
+ graphDict = {}
+ try:
+ links = self.getLinks( timeout=timeout )
+ portDict = {}
+ if useId:
+ switches = self.getSwitches()
+ if includeHost:
+ hosts = self.getHosts()
+ for link in links:
+ # FIXME: support 'includeHost' argument
+ if link[ 'node1' ].startswith( 'h' ) or link[ 'node2' ].startswith( 'h' ):
+ continue
+ nodeName1 = link[ 'node1' ]
+ nodeName2 = link[ 'node2' ]
+ port1 = link[ 'port1' ]
+ port2 = link[ 'port2' ]
+ # Loop for two nodes
+ for i in range( 2 ):
+ # Get port index from OVS
+ # The index extracted from port name may be inconsistent with ONOS
+ portIndex = -1
+ if not nodeName1 in portDict.keys():
+ portList = self.getOVSPorts( nodeName1 )
+ if len( portList ) == 0:
+ main.log.warn( self.name + ": No port found on switch " + nodeName1 )
+ return None
+ portDict[ nodeName1 ] = portList
+ for port in portDict[ nodeName1 ]:
+ if port[ 'port' ] == port1:
+ portIndex = port[ 'index' ]
+ break
+ if portIndex == -1:
+ main.log.warn( self.name + ": Cannot find port index for interface {}-eth{}".format( nodeName1, port1 ) )
+ return None
+ if useId:
+ node1 = 'of:' + str( switches[ nodeName1 ][ 'dpid' ] )
+ node2 = 'of:' + str( switches[ nodeName2 ][ 'dpid' ] )
+ else:
+ node1 = nodeName1
+ node2 = nodeName2
+ if not node1 in graphDict.keys():
+ if useId:
+ graphDict[ node1 ] = { 'edges':{},
+ 'dpid':switches[ nodeName1 ][ 'dpid' ],
+ 'name':nodeName1,
+ 'ports':switches[ nodeName1 ][ 'ports' ],
+ 'swClass':switches[ nodeName1 ][ 'swClass' ],
+ 'pid':switches[ nodeName1 ][ 'pid' ],
+ 'options':switches[ nodeName1 ][ 'options' ] }
+ else:
+ graphDict[ node1 ] = { 'edges':{} }
+ else:
+ # Assert node2 is not connected to any current links of node1
+ assert node2 not in graphDict[ node1 ][ 'edges' ].keys()
+ graphDict[ node1 ][ 'edges' ][ node2 ] = { 'port':portIndex }
+ # Swap two nodes/ports
+ nodeName1, nodeName2 = nodeName2, nodeName1
+ port1, port2 = port2, port1
+ return graphDict
+ except KeyError:
+ main.log.exception( self.name + ": KeyError exception found" )
+ return None
+ except AssertionError:
+ main.log.exception( self.name + ": AssertionError exception found" )
+ return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception" )
+ return None
+
def update( self ):
"""
updates the port address and status information for
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 1262b09..32a08e9 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -23,6 +23,7 @@
import time
import os
from drivers.common.clidriver import CLI
+from core.graph import Graph
class OnosCliDriver( CLI ):
@@ -34,6 +35,7 @@
self.name = None
self.home = None
self.handle = None
+ self.graph = Graph()
super( CLI, self ).__init__()
def connect( self, **connectargs ):
@@ -811,8 +813,8 @@
Dependencies: checkMasters() and summary()
- Returns main.True if the devices are balanced
- Returns main.False if the devices are unbalanced
+ Returns main.TRUE if the devices are balanced
+ Returns main.FALSE if the devices are unbalanced
Exits on Exception
Returns None on TypeError
"""
@@ -1837,7 +1839,7 @@
-p or --purge: Purge the intent from the store after removal
Returns:
- main.False on error and
+ main.FALSE on error and
cli output otherwise
"""
try:
@@ -4855,3 +4857,72 @@
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
+
+ def getGraphDict( self, timeout=60, includeHost=False ):
+ """
+ Return a dictionary which describes the latest network topology data as a
+ graph.
+ An example of the dictionary:
+ { vertex1: { 'edges': ..., 'name': ..., 'protocol': ... },
+ vertex2: { 'edges': ..., 'name': ..., 'protocol': ... } }
+ Each vertex should at least have an 'edges' attribute which describes the
+ adjacency information. The value of 'edges' attribute is also represented by
+ a dictionary, which maps each edge (identified by the neighbor vertex) to a
+ list of attributes.
+ An example of the edges dictionary:
+ 'edges': { vertex2: { 'port': ..., 'weight': ... },
+ vertex3: { 'port': ..., 'weight': ... } }
+ If includeHost == True, all hosts (and host-switch links) will be included
+ in topology data.
+ """
+ graphDict = {}
+ try:
+ links = self.links()
+ links = json.loads( links )
+ devices = self.devices()
+ devices = json.loads( devices )
+ idToDevice = {}
+ for device in devices:
+ idToDevice[ device[ 'id' ] ] = device
+ if includeHost:
+ hosts = self.hosts()
+ # FIXME: support 'includeHost' argument
+ for link in links:
+ nodeA = link[ 'src' ][ 'device' ]
+ nodeB = link[ 'dst' ][ 'device' ]
+ assert idToDevice[ nodeA ][ 'available' ] and idToDevice[ nodeB ][ 'available' ]
+ if not nodeA in graphDict.keys():
+ graphDict[ nodeA ] = { 'edges':{},
+ 'dpid':idToDevice[ nodeA ][ 'id' ][3:],
+ 'type':idToDevice[ nodeA ][ 'type' ],
+ 'available':idToDevice[ nodeA ][ 'available' ],
+ 'role':idToDevice[ nodeA ][ 'role' ],
+ 'mfr':idToDevice[ nodeA ][ 'mfr' ],
+ 'hw':idToDevice[ nodeA ][ 'hw' ],
+ 'sw':idToDevice[ nodeA ][ 'sw' ],
+ 'serial':idToDevice[ nodeA ][ 'serial' ],
+ 'chassisId':idToDevice[ nodeA ][ 'chassisId' ],
+ 'annotations':idToDevice[ nodeA ][ 'annotations' ]}
+ else:
+ # Assert nodeB is not connected to any current links of nodeA
+ assert nodeB not in graphDict[ nodeA ][ 'edges' ].keys()
+ graphDict[ nodeA ][ 'edges' ][ nodeB ] = { 'port':link[ 'src' ][ 'port' ],
+ 'type':link[ 'type' ],
+ 'state':link[ 'state' ] }
+ return graphDict
+ except ( TypeError, ValueError ):
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except KeyError:
+ main.log.exception( self.name + ": KeyError exception found" )
+ return None
+ except AssertionError:
+ main.log.exception( self.name + ": AssertionError exception found" )
+ return None
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ return None
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index f6c3143..e749ce2 100755
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -1847,7 +1847,7 @@
deviceCount - number of switches to be assigned
'''
- main.log.step("Creating link graph configuration file." )
+ main.log.info("Creating link graph configuration file." )
linkGraphPath = self.home + "/tools/package/etc/linkGraph.cfg"
tempFile = "/tmp/linkGraph.cfg"
@@ -1923,13 +1923,13 @@
numPorts = number of ports per device. Defaults to 10 both in this function and in ONOS. Optional arg
'''
- main.log.step("Configuring Null Device Provider" )
+ main.log.info("Configuring Null Device Provider" )
clusterCount = len(ONOSIpList)
try:
if type(deviceCount) is int or type(deviceCount) is str:
- main.log.step("Creating device distribution")
+ main.log.info("Creating device distribution")
deviceCount = int(deviceCount)
switchList = [0]*(clusterCount+1)
baselineSwitchCount = deviceCount/clusterCount
diff --git a/TestON/install.sh b/TestON/install.sh
index fbbd5a5..dee85c9 100755
--- a/TestON/install.sh
+++ b/TestON/install.sh
@@ -63,10 +63,10 @@
echo "Installing TestON dependencies"
if [ "$DIST" = "Fedora" ]; then
# Fedora may have vlan enabled by default. Still need to confirm and update later
- $install python-pip build-essential python-dev pep8 arping
+ $install python-pip build-essential python-dev pep8 arping python3-requests
$pipinstall pexpect==3.2 configobj==4.7.2 numpy
else
- $install python-pip build-essential python-dev pep8 vlan arping
+ $install python-pip build-essential python-dev pep8 vlan arping python3-requests
$pipinstall pexpect==3.2 configobj==4.7.2 numpy
fi
diff --git a/TestON/tests/CHO/CHOtest/CHOtest.py b/TestON/tests/CHO/CHOtest/CHOtest.py
index 8c92c20..94990c3 100644
--- a/TestON/tests/CHO/CHOtest/CHOtest.py
+++ b/TestON/tests/CHO/CHOtest/CHOtest.py
@@ -146,7 +146,7 @@
main.step( "Start ONOS CLI on all nodes" )
cliResult = main.TRUE
- main.log.step(" Start ONOS cli using thread ")
+ main.step(" Start ONOS cli using thread ")
startCliResult = main.TRUE
pool = []
time1 = time.time()
@@ -499,7 +499,7 @@
import time
main.log.report( "Clean up ONOS" )
- main.log.case( "Stop topology and remove hosts and devices" )
+ main.case( "Stop topology and remove hosts and devices" )
main.step( "Stop Topology" )
stopStatus = main.Mininet1.stopNet()
@@ -2114,7 +2114,7 @@
main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
main.log.report( "___________________________________________________________________________" )
- main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
+ main.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
main.step( "Bring some core links down" )
linkIndex = range(4)
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
index c3a7346..848e4cc 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
@@ -15,18 +15,19 @@
# 50. Set FlowObjective to True
# 51. Set FlowObjective to False
# 60. Rebalance devices across controllers
+ # 70. Randomly generate events
# 90. Sleep for some time
# 100. Do something else
# Sample sequence: 0,1,2,3,[10,30,21,31,10,32,21,33,50,10,30,21,31,10,32,21,33,51,40,60,10,30,21,31,10,32,21,33,50,10,30,21,31,10,32,21,33,51,41,60]*500,100
<testcases>
- 0,1,2,3,10,[30,21,31,32,21,33,50,30,21,31,32,21,33,51]*500,100
+ 0,1,2,3,70,[30,21,31,32,21,33]*500,100
</testcases>
<TEST>
<topo>1</topo>
<IPv6>on</IPv6>
<numCtrl>3</numCtrl>
- <pauseTest>on</pauseTest>
+ <pauseTest>off</pauseTest>
<caseSleep>0</caseSleep>
<setIPv6CfgSleep>5</setIPv6CfgSleep>
<loadTopoSleep>5</loadTopoSleep>
@@ -382,6 +383,14 @@
<linkDownUpInterval>1</linkDownUpInterval>
</CASE21>
+ <CASE70>
+ <sleepSec>2</sleepSec>
+ <addHostIntentWeight>3</addHostIntentWeight>
+ <addPointIntentWeight>3</addPointIntentWeight>
+ <linkDownWeight>3</linkDownWeight>
+ <deviceDownWeight>2</deviceDownWeight>
+ </CASE70>
+
<CASE90>
<sleepSec>60</sleepSec>
</CASE90>
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
index 314bde9..11459b3 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
@@ -32,6 +32,7 @@
"""
import time
from threading import Lock, Condition
+ from core.graph import Graph
from tests.CHOTestMonkey.dependencies.elements.ONOSElement import Controller
from tests.CHOTestMonkey.dependencies.EventGenerator import EventGenerator
from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduler
@@ -58,6 +59,7 @@
if main.params[ 'EVENT' ][ eventName ][ 'status' ] == 'on':
main.enabledEvents[ int( main.params[ 'EVENT' ][ eventName ][ 'typeIndex' ] ) ] = eventName
print main.enabledEvents
+ main.graph = Graph()
main.eventScheduler = EventScheduler()
main.eventGenerator = EventGenerator()
main.variableLock = Lock()
@@ -246,7 +248,7 @@
startStatus = main.Mininet1.startNet( topoFile = topoPath )
main.mininetSwitches = main.Mininet1.getSwitches()
main.mininetHosts = main.Mininet1.getHosts()
- main.mininetLinks = main.Mininet1.getLinks()
+ main.mininetLinks = main.Mininet1.getLinks( timeout=60 )
utilities.assert_equals( expect=main.TRUE,
actual=startStatus,
onpass="Start Mininet topology test PASS",
@@ -760,6 +762,104 @@
onfail="Balance masters test failed" )
time.sleep( main.caseSleep )
+ def CASE70( self, main ):
+ """
+ Randomly generate events
+ """
+ import time
+ import random
+ from tests.CHOTestMonkey.dependencies.events.Event import EventType
+ from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduleMethod
+
+ main.log.report( "Randomly generate events" )
+ main.log.report( "__________________________________________________" )
+ main.case( "Randomly generate events" )
+ main.step( "Randomly generate events" )
+ main.caseResult = main.TRUE
+ sleepSec = int( main.params[ 'CASE70' ][ 'sleepSec' ] )
+ hostIntentNum = 0
+ pointIntentNum = 0
+ downDeviceNum = 0
+ downLinkNum = 0
+ upControllers = [ 1, 2, 3 ]
+ while True:
+ events = []
+ for i in range( int( main.params[ 'CASE70' ][ 'addHostIntentWeight' ] ) ):
+ events.append( 'add-host-intent' )
+ for i in range( int( main.params[ 'CASE70' ][ 'addPointIntentWeight' ] ) ):
+ events.append( 'add-point-intent' )
+ for i in range( int( main.params[ 'CASE70' ][ 'linkDownWeight' ] ) ):
+ events.append( 'link-down' )
+ for i in range( int( main.params[ 'CASE70' ][ 'deviceDownWeight' ] ) ):
+ events.append( 'device-down' )
+ for i in range( int( pow( hostIntentNum, 1.5 ) / 100 ) ):
+ events.append( 'del-host-intent' )
+ for i in range( int( pow( pointIntentNum/2, 1.5 ) / 100 ) ):
+ events.append( 'del-point-intent' )
+ for i in range( pow( 2, downLinkNum ) - 1 ):
+ events.append( 'link-up' )
+ for i in range( pow( 5, downDeviceNum ) - 1 ):
+ events.append( 'device-up' )
+ main.log.debug( events )
+ event = random.sample( events, 1 )[ 0 ]
+ if event == 'add-host-intent':
+ n = random.randint( 5, 50 )
+ for i in range( n ):
+ cliIndex = random.sample( upControllers, 1 )[ 0 ]
+ main.eventGenerator.triggerEvent( EventType().APP_INTENT_HOST_ADD, EventScheduleMethod().RUN_NON_BLOCK, 'random', 'random', cliIndex )
+ hostIntentNum += 1
+ main.eventGenerator.triggerEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
+ elif event == 'del-host-intent':
+ n = random.randint( 5, hostIntentNum )
+ for i in range( n ):
+ cliIndex = random.sample( upControllers, 1 )[ 0 ]
+ main.eventGenerator.triggerEvent( EventType().APP_INTENT_HOST_DEL, EventScheduleMethod().RUN_NON_BLOCK, 'random', 'random', cliIndex )
+ hostIntentNum -= 1
+ main.eventGenerator.triggerEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
+ elif event == 'add-point-intent':
+ n = random.randint( 5, 50 )
+ for i in range( n ):
+ cliIndex = random.sample( upControllers, 1 )[ 0 ]
+ main.eventGenerator.triggerEvent( EventType().APP_INTENT_POINT_ADD, EventScheduleMethod().RUN_NON_BLOCK, 'random', 'random', cliIndex, 'bidirectional' )
+ pointIntentNum += 1
+ main.eventGenerator.triggerEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
+ elif event == 'del-point-intent':
+ n = random.randint( 5, pointIntentNum )
+ for i in range( n ):
+ cliIndex = random.sample( upControllers, 1 )[ 0 ]
+ main.eventGenerator.triggerEvent( EventType().APP_INTENT_POINT_DEL, EventScheduleMethod().RUN_NON_BLOCK, 'random', 'random', cliIndex, 'bidirectional' )
+ pointIntentNum -= 1
+ main.eventGenerator.triggerEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
+ elif event == 'link-down':
+ main.eventGenerator.triggerEvent( EventType().NETWORK_LINK_DOWN, EventScheduleMethod().RUN_BLOCK, 'random', 'random' )
+ downLinkNum += 1
+ elif event == 'link-up':
+ main.eventGenerator.triggerEvent( EventType().NETWORK_LINK_UP, EventScheduleMethod().RUN_BLOCK, 'random', 'random' )
+ downLinkNum -= 1
+ elif event == 'device-down':
+ main.eventGenerator.triggerEvent( EventType().NETWORK_DEVICE_DOWN, EventScheduleMethod().RUN_BLOCK, 'random' )
+ downDeviceNum += 1
+ elif event == 'device-up':
+ main.eventGenerator.triggerEvent( EventType().NETWORK_DEVICE_UP, EventScheduleMethod().RUN_BLOCK, 'random' )
+ downDeviceNum -= 1
+ else:
+ pass
+ main.eventGenerator.triggerEvent( EventType().CHECK_TOPO, EventScheduleMethod().RUN_NON_BLOCK )
+ main.eventGenerator.triggerEvent( EventType().CHECK_ONOS, EventScheduleMethod().RUN_NON_BLOCK )
+ main.eventGenerator.triggerEvent( EventType().CHECK_TRAFFIC, EventScheduleMethod().RUN_NON_BLOCK )
+ main.eventGenerator.triggerEvent( EventType().CHECK_FLOW, EventScheduleMethod().RUN_NON_BLOCK )
+ main.eventGenerator.triggerEvent( EventType().CHECK_INTENT, EventScheduleMethod().RUN_NON_BLOCK )
+ main.eventGenerator.triggerEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
+ with main.eventScheduler.idleCondition:
+ while not main.eventScheduler.isIdle():
+ main.eventScheduler.idleCondition.wait()
+ #time.sleep( sleepSec )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=main.caseResult,
+ onpass="Randomly generate events test passed",
+ onfail="Randomly generate events test failed" )
+ time.sleep( main.caseSleep )
+
def CASE90( self, main ):
"""
Sleep for some time
diff --git a/TestON/tests/CHOTestMonkey/dependencies/EventGenerator.py b/TestON/tests/CHOTestMonkey/dependencies/EventGenerator.py
index de32193..dd53238 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/EventGenerator.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/EventGenerator.py
@@ -5,7 +5,6 @@
from threading import Lock, Condition
from tests.CHOTestMonkey.dependencies.events.Event import EventType, EventStates, Event
from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduleMethod
-from tests.CHOTestMonkey.dependencies.GraphHelper import GraphHelper
class MessageType:
def __init__( self ):
@@ -169,21 +168,10 @@
main.log.warn( "Event Generator - Too many arguments for randomLinkToggle: %s" % ( args ) )
else:
downUpAvgInterval = int( args[ 0 ] )
- with main.variableLock:
- graphHelper = GraphHelper()
- availableLinks = graphHelper.getNonCutEdges()
- if len( availableLinks ) == 0:
- main.log.warn( "All links are cut edges, aborting event" )
- return
- link = random.sample( availableLinks, 1 )
-
self.eventGeneratorLock.acquire()
main.eventScheduler.scheduleEvent( EventType().NETWORK_LINK_DOWN,
scheduleMethod,
- [ link[ 0 ].deviceA.name, link[ 0 ].deviceB.name ] )
- with main.variableLock:
- link[ 0 ].setPendingDown()
- link[ 0 ].backwardLink.setPendingDown()
+ [ 'random', 'random' ] )
sleepTime = int( main.params[ 'EVENT' ][ 'randomLinkToggle' ][ 'sleepBeforeCheck' ] )
main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
@@ -199,7 +187,7 @@
time.sleep( downUpInterval )
main.eventScheduler.scheduleEvent( EventType().NETWORK_LINK_UP,
scheduleMethod,
- [ link[ 0 ].deviceA.name, link[ 0 ].deviceB.name ] )
+ [ 'random', 'random' ] )
main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
@@ -227,24 +215,12 @@
linkGroupSize = int( args[ 0 ] )
downDownAvgInterval = int( args[ 1 ] )
downUpAvgInterval = int( args[ 2 ] )
- downLinks = []
for i in range( 0, linkGroupSize ):
- with main.variableLock:
- graphHelper = GraphHelper()
- availableLinks = graphHelper.getNonCutEdges()
- if len( availableLinks ) == 0:
- main.log.warn( "All links are cut edges, aborting event" )
- continue
- link = random.sample( availableLinks, 1 )
if i == 0:
self.eventGeneratorLock.acquire()
main.eventScheduler.scheduleEvent( EventType().NETWORK_LINK_DOWN,
scheduleMethod,
- [ link[ 0 ].deviceA.name, link[ 0 ].deviceB.name ] )
- with main.variableLock:
- link[ 0 ].setPendingDown()
- link[ 0 ].backwardLink.setPendingDown()
- downLinks.append( link[ 0 ] )
+ [ 'random', 'random' ] )
sleepTime = int( main.params[ 'EVENT' ][ 'randomLinkGroupToggle' ][ 'sleepBeforeCheck' ] )
main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
@@ -267,10 +243,10 @@
else:
time.sleep( downUpInterval )
- for link in downLinks:
+ for i in range( 0, linkGroupSize ):
main.eventScheduler.scheduleEvent( EventType().NETWORK_LINK_UP,
scheduleMethod,
- [ link.deviceA.name, link.deviceB.name ] )
+ [ 'random', 'random' ] )
main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
@@ -301,20 +277,10 @@
main.log.warn( "Event Generator - Too many arguments for randomDeviceToggle: %s" % ( args ) )
else:
downUpAvgInterval = int( args[ 0 ] )
- with main.variableLock:
- graphHelper = GraphHelper()
- availableDevices = graphHelper.getNonCutVertices()
- if len( availableDevices ) == 0:
- main.log.warn( "All devices are Cut vertices, aborting event" )
- return
- device = random.sample( availableDevices, 1 )
-
self.eventGeneratorLock.acquire()
main.eventScheduler.scheduleEvent( EventType().NETWORK_DEVICE_DOWN,
scheduleMethod,
- [ device[ 0 ].name ] )
- with main.variableLock:
- device[ 0 ].setPendingDown()
+ [ 'random' ] )
sleepTime = int( main.params[ 'EVENT' ][ 'randomLinkToggle' ][ 'sleepBeforeCheck' ] )
main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
@@ -330,7 +296,7 @@
time.sleep( downUpInterval )
main.eventScheduler.scheduleEvent( EventType().NETWORK_DEVICE_UP,
scheduleMethod,
- [ device[ 0 ].name ] )
+ [ 'random' ] )
main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
@@ -358,23 +324,12 @@
deviceGroupSize = int( args[ 0 ] )
downDownAvgInterval = int( args[ 1 ] )
downUpAvgInterval = int( args[ 2 ] )
- downDevices = []
for i in range( 0, deviceGroupSize ):
- with main.variableLock:
- graphHelper = GraphHelper()
- availableDevices = graphHelper.getNonCutVertices()
- if len( availableDevices ) == 0:
- main.log.warn( "All devices are cut vertices, aborting event" )
- continue
- device = random.sample( availableDevices, 1 )
if i == 0:
self.eventGeneratorLock.acquire()
main.eventScheduler.scheduleEvent( EventType().NETWORK_DEVICE_DOWN,
scheduleMethod,
- [ device[ 0 ].name ] )
- with main.variableLock:
- device[ 0 ].setPendingDown()
- downDevices.append( device[ 0 ] )
+ [ 'random' ] )
sleepTime = int( main.params[ 'EVENT' ][ 'randomLinkGroupToggle' ][ 'sleepBeforeCheck' ] )
main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
@@ -397,10 +352,10 @@
else:
time.sleep( downUpInterval )
- for device in downDevices:
+ for i in range( 0, deviceGroupSize ):
main.eventScheduler.scheduleEvent( EventType().NETWORK_DEVICE_UP,
scheduleMethod,
- [ device.name ] )
+ [ 'random' ] )
main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
@@ -445,9 +400,7 @@
main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
sleepTime = int( main.params[ 'EVENT' ][ 'installAllHostIntents' ][ 'sleepBeforeCheck' ] )
main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
- main.eventScheduler.scheduleEvent( EventType().CHECK_INTENT, EventScheduleMethod().RUN_NON_BLOCK )
- main.eventScheduler.scheduleEvent( EventType().CHECK_FLOW, EventScheduleMethod().RUN_NON_BLOCK )
- main.eventScheduler.scheduleEvent( EventType().CHECK_TRAFFIC, EventScheduleMethod().RUN_NON_BLOCK )
+ self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
@@ -482,9 +435,7 @@
main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
sleepTime = int( main.params[ 'EVENT' ][ 'removeAllHostIntents' ][ 'sleepBeforeCheck' ] )
main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
- main.eventScheduler.scheduleEvent( EventType().CHECK_INTENT, EventScheduleMethod().RUN_NON_BLOCK )
- main.eventScheduler.scheduleEvent( EventType().CHECK_FLOW, EventScheduleMethod().RUN_NON_BLOCK )
- main.eventScheduler.scheduleEvent( EventType().CHECK_TRAFFIC, EventScheduleMethod().RUN_NON_BLOCK )
+ self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
@@ -519,9 +470,7 @@
main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
sleepTime = int( main.params[ 'EVENT' ][ 'installAllPointIntents' ][ 'sleepBeforeCheck' ] )
main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
- main.eventScheduler.scheduleEvent( EventType().CHECK_INTENT, EventScheduleMethod().RUN_NON_BLOCK )
- main.eventScheduler.scheduleEvent( EventType().CHECK_FLOW, EventScheduleMethod().RUN_NON_BLOCK )
- main.eventScheduler.scheduleEvent( EventType().CHECK_TRAFFIC, EventScheduleMethod().RUN_NON_BLOCK )
+ self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
@@ -556,8 +505,6 @@
main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
sleepTime = int( main.params[ 'EVENT' ][ 'removeAllPointIntents' ][ 'sleepBeforeCheck' ] )
main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
- main.eventScheduler.scheduleEvent( EventType().CHECK_INTENT, EventScheduleMethod().RUN_NON_BLOCK )
- main.eventScheduler.scheduleEvent( EventType().CHECK_FLOW, EventScheduleMethod().RUN_NON_BLOCK )
- main.eventScheduler.scheduleEvent( EventType().CHECK_TRAFFIC, EventScheduleMethod().RUN_NON_BLOCK )
+ self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
diff --git a/TestON/tests/CHOTestMonkey/dependencies/EventScheduler.py b/TestON/tests/CHOTestMonkey/dependencies/EventScheduler.py
index 7e4c95c..99ead73 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/EventScheduler.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/EventScheduler.py
@@ -172,7 +172,7 @@
if len( self.pendingEvents ) > 0:
events += str( self.pendingEvents[ -1 ].typeIndex )
events += "]"
- main.log.debug( "Event Scheduler - Events: " + events )
+ #main.log.debug( "Event Scheduler - Events: " + events )
def isAvailable( self ):
with self.pendingEventsCondition:
diff --git a/TestON/tests/CHOTestMonkey/dependencies/cli.py b/TestON/tests/CHOTestMonkey/dependencies/cli.py
index d1a8448..a3fb18e 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/cli.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/cli.py
@@ -64,26 +64,28 @@
if cmdList[ 0 ] in commandMap.keys():
num = paramNum[ cmdList[ 0 ] ]
name = commandMap[ cmdList[ 0 ] ]
+ '''
if len( cmdList ) < num + 1:
print 'not enough arguments'
elif len( cmdList ) > num + 1:
print 'Too many arguments'
else:
- result = triggerEvent( debugMode, name, 'RUN_BLOCK', cmdList[ 1: ] )
- if result == 10:
- pass
- elif result == 11:
- print "Scheduler busy...Try later or use debugging mode by entering \'debug\'"
- elif result == 20:
- print "Unknown message to server"
- elif result == 21:
- print "Unknown event type to server"
- elif result == 22:
- print "Unknown schedule method to server"
- elif result == 23:
- print "Not enough argument"
- else:
- print "Unknown response from server"
+ '''
+ result = triggerEvent( debugMode, name, 'RUN_BLOCK', cmdList[ 1: ] )
+ if result == 10:
+ pass
+ elif result == 11:
+ print "Scheduler busy...Try later or use debugging mode by entering \'debug\'"
+ elif result == 20:
+ print "Unknown message to server"
+ elif result == 21:
+ print "Unknown event type to server"
+ elif result == 22:
+ print "Unknown schedule method to server"
+ elif result == 23:
+ print "Not enough argument"
+ else:
+ print "Unknown response from server"
else:
print 'Unknown command'
diff --git a/TestON/tests/CHOTestMonkey/dependencies/elements/NetworkElement.py b/TestON/tests/CHOTestMonkey/dependencies/elements/NetworkElement.py
index 2a18ac7..31a4084 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/elements/NetworkElement.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/elements/NetworkElement.py
@@ -18,9 +18,6 @@
def isRemoved( self ):
return self.status == 'removed'
- def setPendingDown( self ):
- self.status = 'pending_down'
-
def setRemoved( self ):
self.status = 'removed'
@@ -40,7 +37,7 @@
self.outgoingLinks = []
def __str__( self ):
- return "name: " + self.name + ", dpid: " + self.dpid
+ return "name: " + self.name + ", dpid: " + self.dpid + ", status: " + self.status
class Host( NetworkElement ):
def __init__( self, index, name, id, mac, device, devicePort, vlan, ipAddresses ):
@@ -56,7 +53,7 @@
self.handle = None
def __str__( self ):
- return "name: " + self.name + ", mac: " + self.mac + ", device: " + self.device.dpid + ", ipAddresses: " + str( self.ipAddresses )
+ return "name: " + self.name + ", mac: " + self.mac + ", device: " + self.device.dpid + ", ipAddresses: " + str( self.ipAddresses ) + ", status: " + self.status
def setHandle( self, handle ):
self.handle = handle
@@ -74,7 +71,7 @@
self.portB = portB
def __str__( self ):
- return self.deviceA.dpid + "/" + self.portA + " - " + self.deviceB.dpid + "/" + self.portB
+ return self.deviceA.dpid + "/" + self.portA + " - " + self.deviceB.dpid + "/" + self.portB + ", status: " + self.status
def setBackwardLink( self, link ):
self.backwardLink = link
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py
index 7f0ca7c..8113b09 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py
@@ -11,6 +11,47 @@
# The index of the ONOS CLI that is going to run the command
self.CLIIndex = 0
+ def getRandomCorrespondent( self, hostA, connected=True ):
+ import random
+ if connected:
+ candidates = hostA.correspondents
+ else:
+ candidates = [ host for host in main.hosts if host not in hostA.correspondents and host != hostA ]
+ if len( candidates ) == 0:
+ return None
+ hostB = random.sample( candidates, 1 )[0]
+ return hostB
+
+ def getRandomHostPair( self, connected=True ):
+ import random
+ candidateDict = {}
+ with main.variableLock:
+ for host in main.hosts:
+ correspondent = self.getRandomCorrespondent( host, connected=connected )
+ if correspondent != None:
+ candidateDict[ host ] = correspondent
+ if candidateDict == {}:
+ return None
+ hostA = random.sample( candidateDict.keys(), 1 )[0]
+ hostB = candidateDict[ hostA ]
+ return [ hostA, hostB ]
+
+ def getIntentsByType( self, intentType ):
+ intents = []
+ with main.variableLock:
+ for intent in main.intents:
+ if intent.type == intentType:
+ intents.append( intent )
+ return intents
+
+ def getRandomIntentByType( self, intentType ):
+ import random
+ intents = self.getIntentsByType( intentType )
+ if len( intents ) == 0:
+ return None
+ intent = random.sample( intents, 1 )[ 0 ]
+ return intent
+
class HostIntentEvent( IntentEvent ):
def __init__( self ):
IntentEvent.__init__( self )
@@ -30,10 +71,25 @@
elif len( args ) > 3:
main.log.warn( "%s - Too many arguments: %s" % ( self.typeString, args ) )
return EventStates().ABORT
+ if args[ 0 ] == 'random' or args[ 1 ] == 'random':
+ if self.typeIndex == EventType().APP_INTENT_HOST_ADD:
+ hostPairRandom = self.getRandomHostPair( connected=False )
+ if hostPairRandom == None:
+ main.log.warn( "All host pairs are connected, aborting event" )
+ return EventStates().ABORT
+ self.hostA = hostPairRandom[ 0 ]
+ self.hostB = hostPairRandom[ 1 ]
+ elif self.typeIndex == EventType().APP_INTENT_HOST_DEL:
+ intent = self.getRandomIntentByType( 'INTENT_HOST' )
+ if intent == None:
+ main.log.warn( "No host intent for deletion, aborting event" )
+ return EventStates().ABORT
+ self.hostA = intent.hostA
+ self.hostB = intent.hostB
+ elif args[ 0 ] == args[ 1 ]:
+ main.log.warn( "%s - invalid argument: %s, %s" % ( self.typeString, args[ 0 ], args[ 1 ] ) )
+ return EventStates().ABORT
else:
- if args[ 0 ] == args[ 1 ]:
- main.log.warn( "%s - invalid argument: %s" % ( self.typeString, index ) )
- return EventStates().ABORT
for host in main.hosts:
if host.name == args[ 0 ]:
self.hostA = host
@@ -47,15 +103,15 @@
if self.hostB == None:
main.log.warn( "Host %s does not exist: " % ( args[ 1 ] ) )
return EventStates().ABORT
- index = int( args[ 2 ] )
- if index < 1 or index > int( main.numCtrls ):
- main.log.warn( "%s - invalid argument: %s" % ( self.typeString, index ) )
- return EventStates().ABORT
- if not main.controllers[ index - 1 ].isUp():
- main.log.warn( self.typeString + " - invalid argument: onos %s is down" % ( controller.index ) )
- return EventStates().ABORT
- self.CLIIndex = index
- return self.startHostIntentEvent()
+ index = int( args[ 2 ] )
+ if index < 1 or index > int( main.numCtrls ):
+ main.log.warn( "%s - invalid argument: %s" % ( self.typeString, index ) )
+ return EventStates().ABORT
+ if not main.controllers[ index - 1 ].isUp():
+ main.log.warn( self.typeString + " - invalid argument: onos %s is down" % ( controller.index ) )
+ return EventStates().ABORT
+ self.CLIIndex = index
+ return self.startHostIntentEvent()
class AddHostIntent( HostIntentEvent ):
"""
@@ -67,30 +123,36 @@
self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
def startHostIntentEvent( self ):
- assert self.hostA != None and self.hostB != None
- # Check whether there already exists some intent for the host pair
- # For now we should avoid installing overlapping intents
- for intent in main.intents:
- if not intent.type == 'INTENT_HOST':
- continue
- if intent.hostA == self.hostA and intent.hostB == self.hostB or\
- intent.hostB == self.hostA and intent.hostA == self.hostB:
- main.log.warn( self.typeString + " - find an exiting intent for the host pair, abort installation" )
- return EventStates().ABORT
- controller = main.controllers[ self.CLIIndex - 1 ]
- with controller.CLILock:
- id = controller.CLI.addHostIntent( self.hostA.id, self.hostB.id )
- if id == None:
- main.log.warn( self.typeString + " - add host intent failed" )
- return EventStates().FAIL
- with main.variableLock:
- newHostIntent = HostIntent( id, self.hostA, self.hostB )
- main.intents.append( newHostIntent )
- # Update host connectivity status
- # TODO: should we check whether hostA and hostB are already correspondents?
- self.hostB.correspondents.append( self.hostA )
- self.hostA.correspondents.append( self.hostB )
- return EventStates().PASS
+ try:
+ assert self.hostA != None and self.hostB != None
+ # Check whether there already exists some intent for the host pair
+ # For now we should avoid installing overlapping intents
+ for intent in main.intents:
+ if not intent.type == 'INTENT_HOST':
+ continue
+ if intent.hostA == self.hostA and intent.hostB == self.hostB or\
+ intent.hostB == self.hostA and intent.hostA == self.hostB:
+ main.log.warn( self.typeString + " - find an exiting intent for the host pair, abort installation" )
+ return EventStates().ABORT
+ controller = main.controllers[ self.CLIIndex - 1 ]
+ with controller.CLILock:
+ id = controller.CLI.addHostIntent( self.hostA.id, self.hostB.id )
+ if id == None:
+ main.log.warn( self.typeString + " - add host intent failed" )
+ return EventStates().FAIL
+ with main.variableLock:
+ newHostIntent = HostIntent( id, self.hostA, self.hostB )
+ if self.hostA.isDown() or self.hostA.isRemoved() or self.hostB.isDown() or self.hostB.isRemoved():
+ newHostIntent.setFailed()
+ main.intents.append( newHostIntent )
+ # Update host connectivity status
+ # TODO: should we check whether hostA and hostB are already correspondents?
+ self.hostB.correspondents.append( self.hostA )
+ self.hostA.correspondents.append( self.hostB )
+ return EventStates().PASS
+ except Exception:
+ main.log.warn( "Caught exception, aborting event" )
+ return EventStates().ABORT
class DelHostIntent( HostIntentEvent ):
"""
@@ -102,30 +164,34 @@
self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
def startHostIntentEvent( self ):
- assert self.hostA != None and self.hostB != None
- targetIntent = None
- for intent in main.intents:
- if not intent.type == 'INTENT_HOST':
- continue
- if intent.hostA == self.hostA and intent.hostB == self.hostB or\
- intent.hostB == self.hostA and intent.hostA == self.hostB:
- targetIntent = intent
- break
- if targetIntent == None:
- main.log.warn( self.typeString + " - intent does not exist" )
- return EventStates().FAIL
- controller = main.controllers[ self.CLIIndex - 1 ]
- with controller.CLILock:
- result = controller.CLI.removeIntent( targetIntent.id, purge=True )
- if result == None or result == main.FALSE:
- main.log.warn( self.typeString + " - delete host intent failed" )
- return EventStates().FAIL
- with main.variableLock:
- main.intents.remove( targetIntent )
- # Update host connectivity status
- self.hostB.correspondents.remove( self.hostA )
- self.hostA.correspondents.remove( self.hostB )
- return EventStates().PASS
+ try:
+ assert self.hostA != None and self.hostB != None
+ targetIntent = None
+ for intent in main.intents:
+ if not intent.type == 'INTENT_HOST':
+ continue
+ if intent.hostA == self.hostA and intent.hostB == self.hostB or\
+ intent.hostB == self.hostA and intent.hostA == self.hostB:
+ targetIntent = intent
+ break
+ if targetIntent == None:
+ main.log.warn( self.typeString + " - intent does not exist" )
+ return EventStates().FAIL
+ controller = main.controllers[ self.CLIIndex - 1 ]
+ with controller.CLILock:
+ result = controller.CLI.removeIntent( targetIntent.id, purge=True )
+ if result == None or result == main.FALSE:
+ main.log.warn( self.typeString + " - delete host intent failed" )
+ return EventStates().FAIL
+ with main.variableLock:
+ main.intents.remove( targetIntent )
+ # Update host connectivity status
+ self.hostB.correspondents.remove( self.hostA )
+ self.hostA.correspondents.remove( self.hostB )
+ return EventStates().PASS
+ except Exception:
+ main.log.warn( "Caught exception, aborting event" )
+ return EventStates().ABORT
class PointIntentEvent( IntentEvent ):
def __init__( self ):
@@ -143,9 +209,27 @@
if len( args ) < 3:
main.log.warn( "%s - Not enough arguments: %s" % ( self.typeString, args ) )
return EventStates().ABORT
- elif len( args ) > 3:
+ elif len( args ) > 4:
main.log.warn( "%s - Too many arguments: %s" % ( self.typeString, args ) )
return EventStates().ABORT
+ if args[ 0 ] == 'random' or args[ 1 ] == 'random':
+ if self.typeIndex == EventType().APP_INTENT_POINT_ADD:
+ hostPairRandom = self.getRandomHostPair( connected=False )
+ if hostPairRandom == None:
+ main.log.warn( "All host pairs are connected, aborting event" )
+ return EventStates().ABORT
+ self.deviceA = hostPairRandom[ 0 ].device
+ self.deviceB = hostPairRandom[ 1 ].device
+ elif self.typeIndex == EventType().APP_INTENT_POINT_DEL:
+ intent = self.getRandomIntentByType( 'INTENT_POINT' )
+ if intent == None:
+ main.log.warn( "No point intent for deletion, aborting event" )
+ return EventStates().ABORT
+ self.deviceA = intent.deviceA
+ self.deviceB = intent.deviceB
+ elif args[ 0 ] == args[ 1 ]:
+ main.log.warn( "%s - invalid argument: %s" % ( self.typeString, args[ 0 ], args[ 1 ] ) )
+ return EventStates().ABORT
else:
for device in main.devices:
if device.name == args[ 0 ]:
@@ -160,14 +244,24 @@
if self.deviceB == None:
main.log.warn( "Device %s does not exist: " % ( args[ 1 ] ) )
return EventStates().ABORT
- index = int( args[ 2 ] )
- if index < 1 or index > int( main.numCtrls ):
- main.log.warn( "%s - invalid argument: %s" % ( self.typeString, index ) )
- return EventStates().ABORT
- if not main.controllers[ index - 1 ].isUp():
- main.log.warn( self.typeString + " - invalid argument: onos %s is down" % ( controller.index ) )
- return EventStates().ABORT
- self.CLIIndex = index
+ index = int( args[ 2 ] )
+ if index < 1 or index > int( main.numCtrls ):
+ main.log.warn( "%s - invalid argument: %s" % ( self.typeString, index ) )
+ return EventStates().ABORT
+ if not main.controllers[ index - 1 ].isUp():
+ main.log.warn( self.typeString + " - invalid argument: onos %s is down" % ( controller.index ) )
+ return EventStates().ABORT
+ self.CLIIndex = index
+ if len( args ) == 4 and args[ 3 ] == 'bidirectional':
+ # Install point intents for both directions
+ resultA = self.startPointIntentEvent()
+ [ self.deviceA, self.deviceB ] = [ self.deviceB, self.deviceA ]
+ resultB = self.startPointIntentEvent()
+ if resultA == EventStates().PASS and resultB == EventStates().PASS:
+ return EventStates().PASS
+ else:
+ return EventStates().FAIL
+ else:
return self.startPointIntentEvent()
class AddPointIntent( PointIntentEvent ):
@@ -180,35 +274,45 @@
self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
def startPointIntentEvent( self ):
- assert self.deviceA != None and self.deviceB != None
- controller = main.controllers[ self.CLIIndex - 1 ]
- # TODO: the following check only work when we use default port number for point intents
- # Check whether there already exists some intent for the device pair
- # For now we should avoid installing overlapping intents
- for intent in main.intents:
- if not intent.type == 'INTENT_POINT':
- continue
- if intent.deviceA == self.deviceA and intent.deviceB == self.deviceB:
- main.log.warn( self.typeString + " - find an exiting intent for the device pair, abort installation" )
- return EventStates().ABORT
- controller = main.controllers[ self.CLIIndex - 1 ]
- with controller.CLILock:
- # TODO: handle the case that multiple hosts attach to one device
- id = controller.CLI.addPointIntent( self.deviceA.dpid, self.deviceB.dpid,
- 1, 1, '',
- self.deviceA.hosts[ 0 ].mac,
- self.deviceB.hosts[ 0 ].mac )
- if id == None:
- main.log.warn( self.typeString + " - add point intent failed" )
- return EventStates().FAIL
- with main.variableLock:
- newPointIntent = PointIntent( id, self.deviceA, self.deviceB )
- main.intents.append( newPointIntent )
- # Update host connectivity status
- for hostA in self.deviceA.hosts:
- for hostB in self.deviceB.hosts:
- hostA.correspondents.append( hostB )
- return EventStates().PASS
+ try:
+ assert self.deviceA != None and self.deviceB != None
+ controller = main.controllers[ self.CLIIndex - 1 ]
+ # TODO: the following check only work when we use default port number for point intents
+ # Check whether there already exists some intent for the device pair
+ # For now we should avoid installing overlapping intents
+ for intent in main.intents:
+ if not intent.type == 'INTENT_POINT':
+ continue
+ if intent.deviceA == self.deviceA and intent.deviceB == self.deviceB:
+ main.log.warn( self.typeString + " - find an exiting intent for the device pair, abort installation" )
+ return EventStates().ABORT
+ controller = main.controllers[ self.CLIIndex - 1 ]
+ with controller.CLILock:
+ # TODO: handle the case that multiple hosts attach to one device
+ srcMAC = ""
+ dstMAC = ""
+ if len( self.deviceA.hosts ) > 0:
+ srcMAC = self.deviceA.hosts[ 0 ].mac
+ if len( self.deviceB.hosts ) > 0:
+ dstMAC = self.deviceB.hosts[ 0 ].mac
+ id = controller.CLI.addPointIntent( self.deviceA.dpid, self.deviceB.dpid,
+ 1, 1, '', srcMAC, dstMAC )
+ if id == None:
+ main.log.warn( self.typeString + " - add point intent failed" )
+ return EventStates().FAIL
+ with main.variableLock:
+ newPointIntent = PointIntent( id, self.deviceA, self.deviceB )
+ if self.deviceA.isDown() or self.deviceB.isDown() or self.deviceA.isRemoved() or self.deviceB.isRemoved():
+ newPointIntent.setFailed()
+ main.intents.append( newPointIntent )
+ # Update host connectivity status
+ for hostA in self.deviceA.hosts:
+ for hostB in self.deviceB.hosts:
+ hostA.correspondents.append( hostB )
+ return EventStates().PASS
+ except Exception:
+ main.log.warn( "Caught exception, aborting event" )
+ return EventStates().ABORT
class DelPointIntent( PointIntentEvent ):
"""
@@ -220,27 +324,31 @@
self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
def startPointIntentEvent( self ):
- assert self.deviceA != None and self.deviceB != None
- targetIntent = None
- for intent in main.intents:
- if not intent.type == 'INTENT_POINT':
- continue
- if intent.deviceA == self.deviceA and intent.deviceB == self.deviceB:
- targetIntent = intent
- break
- if targetIntent == None:
- main.log.warn( self.typeString + " - intent does not exist" )
- return EventStates().FAIL
- controller = main.controllers[ self.CLIIndex - 1 ]
- with controller.CLILock:
- result = controller.CLI.removeIntent( targetIntent.id, purge=True )
- if result == None or result == main.FALSE:
- main.log.warn( self.typeString + " - delete host intent failed" )
- return EventStates().FAIL
- with main.variableLock:
- main.intents.remove( targetIntent )
- # Update host connectivity status
- for hostA in self.deviceA.hosts:
- for hostB in self.deviceB.hosts:
- hostA.correspondents.remove( hostB )
- return EventStates().PASS
+ try:
+ assert self.deviceA != None and self.deviceB != None
+ targetIntent = None
+ for intent in main.intents:
+ if not intent.type == 'INTENT_POINT':
+ continue
+ if intent.deviceA == self.deviceA and intent.deviceB == self.deviceB:
+ targetIntent = intent
+ break
+ if targetIntent == None:
+ main.log.warn( self.typeString + " - intent does not exist" )
+ return EventStates().FAIL
+ controller = main.controllers[ self.CLIIndex - 1 ]
+ with controller.CLILock:
+ result = controller.CLI.removeIntent( targetIntent.id, purge=True )
+ if result == None or result == main.FALSE:
+ main.log.warn( self.typeString + " - delete point intent failed" )
+ return EventStates().FAIL
+ with main.variableLock:
+ main.intents.remove( targetIntent )
+ # Update host connectivity status
+ for hostA in self.deviceA.hosts:
+ for hostB in self.deviceB.hosts:
+ hostA.correspondents.remove( hostB )
+ return EventStates().PASS
+ except Exception:
+ main.log.warn( "Caught exception, aborting event" )
+ return EventStates().ABORT
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
index 76722f0..fcbf23d 100755
--- a/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
@@ -99,6 +99,8 @@
if not host.isDown() and not host.isRemoved():
upHostNum += 1
clusterNum = 1
+ with main.mininetLock:
+ graphDictMininet = main.Mininet1.getGraphDict( useId=True )
for controller in main.controllers:
if controller.isUp():
with controller.CLILock:
@@ -106,8 +108,14 @@
#if not topoState:
# main.log.warn( "Topo Check - link or device number discoverd by ONOS%s is incorrect" % ( controller.index ) )
# checkResult = EventStates().FAIL
- # Check links
+ # Compare ONOS and Mininet topologies
+ graphDictONOS = controller.CLI.getGraphDict()
+ compareResult = main.graph.compareGraphs( graphDictONOS, graphDictMininet )
+ if not compareResult:
+ checkResult = EventStates().FAIL
+ main.log.warn( "Topo Check - ONOS and Mininet topologies do not match" )
try:
+ # Check links
links = controller.CLI.links()
links = json.loads( links )
if not len( links ) == upLinkNum:
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
index 7247ecf..8ec62a1 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
@@ -4,7 +4,6 @@
"""
from tests.CHOTestMonkey.dependencies.events.Event import EventType, EventStates, Event
from tests.CHOTestMonkey.dependencies.elements.NetworkElement import NetworkElement, Device, Host, Link
-from tests.CHOTestMonkey.dependencies.GraphHelper import GraphHelper
class LinkEvent( Event ):
def __init__( self ):
@@ -28,18 +27,16 @@
main.log.warn( "%s - Too many arguments: %s" % ( self.typeString, args ) )
return EventStates().ABORT
if args[ 0 ] == 'random' or args[ 1 ] == 'random':
- import random
if self.typeIndex == EventType().NETWORK_LINK_DOWN:
- with main.variableLock:
- graphHelper = GraphHelper()
- availableLinks = graphHelper.getNonCutEdges()
- if len( availableLinks ) == 0:
- main.log.warn( "All links are cut edges, aborting event" )
- return EventStates().ABORT
- linkList = random.sample( availableLinks, 1 )
- self.linkA = linkList[ 0 ]
- self.linkB = linkList[ 0 ].backwardLink
+ with main.mininetLock:
+ linkRandom = main.Mininet1.getLinkRandom()
+ if linkRandom == None:
+ main.log.warn( "No link available, aborting event" )
+ return EventStates().ABORT
+ args[ 0 ] = linkRandom[ 0 ]
+ args[ 1 ] = linkRandom[ 1 ]
elif self.typeIndex == EventType().NETWORK_LINK_UP:
+ import random
with main.variableLock:
downLinks = []
for link in main.links:
@@ -54,7 +51,7 @@
elif args[ 0 ] == args[ 1 ]:
main.log.warn( "%s - invalid arguments: %s" % ( self.typeString, args ) )
return EventStates().ABORT
- else:
+ if self.linkA == None or self.linkB == None:
for link in main.links:
if link.deviceA.name == args[ 0 ] and link.deviceB.name == args[ 1 ]:
self.linkA = link
@@ -88,9 +85,13 @@
main.log.warn( "Link Down - link has been removed" )
return EventStates().ABORT
with main.mininetLock:
+ '''
result = main.Mininet1.link( END1=self.linkA.deviceA.name,
END2=self.linkA.deviceB.name,
OPTION="down")
+ '''
+ result = main.Mininet1.delLink( self.linkA.deviceA.name,
+ self.linkA.deviceB.name )
if not result:
main.log.warn( "%s - failed to bring down link" % ( self.typeString ) )
return EventStates().FAIL
@@ -118,9 +119,13 @@
main.log.warn( "Link Up - link has been removed" )
return EventStates().ABORT
with main.mininetLock:
+ '''
result = main.Mininet1.link( END1=self.linkA.deviceA.name,
END2=self.linkA.deviceB.name,
OPTION="up")
+ '''
+ result = main.Mininet1.addLink( self.linkA.deviceA.name,
+ self.linkA.deviceB.name )
if not result:
main.log.warn( "%s - failed to bring up link" % ( self.typeString ) )
return EventStates().FAIL
@@ -152,14 +157,12 @@
if args[ 0 ] == 'random':
import random
if self.typeIndex == EventType().NETWORK_DEVICE_DOWN:
- with main.variableLock:
- graphHelper = GraphHelper()
- availableDevices = graphHelper.getNonCutVertices()
- if len( availableDevices ) == 0:
- main.log.warn( "All devices are cut vertices, aborting event" )
- return EventStates().ABORT
- deviceList = random.sample( availableDevices, 1 )
- self.device = deviceList[ 0 ]
+ with main.mininetLock:
+ switchRandom = main.Mininet1.getSwitchRandom()
+ if switchRandom == None:
+ main.log.warn( "No switch available, aborting event" )
+ return EventStates().ABORT
+ args[ 0 ] = switchRandom
elif self.typeIndex == EventType().NETWORK_DEVICE_UP:
with main.variableLock:
removedDevices = []
@@ -171,7 +174,7 @@
return EventStates().ABORT
deviceList = random.sample( removedDevices, 1 )
self.device = deviceList[ 0 ]
- else:
+ if self.device == None:
for device in main.devices:
if device.name == args[ 0 ]:
self.device = device
diff --git a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
index 0e86351..a56c5c4 100755
--- a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
+++ b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
@@ -141,7 +141,7 @@
utilities.assert_equals( expect=main.TRUE, actual=onos1Isup,
onpass="ONOS startup successful",
onfail="ONOS startup failed" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
print main.nodes[0].ip_address
cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address )
utilities.assert_equals( expect=main.TRUE, actual=cliResults,
diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.topo b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.topo
index 29c38a3..d50c434 100755
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.topo
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.topo
@@ -72,7 +72,7 @@
</ONOScli3>
<Mininet1>
- <host>localhost</host>
+ <host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
diff --git a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.params b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.params
index 373f007..0976c40 100644
--- a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.params
+++ b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.params
@@ -14,8 +14,9 @@
# 24 - Remove NetCfgs
# 25 - Move network-cfg.json to onos directory for prebuild configurations
# 26 - Check that prebuild configurations are correct
+ # 27 - Posting network configurations to the top level web resource
- <testcases>1,25,2,20,11,26,21,22,23,24</testcases>
+ <testcases>1,25,2,20,11,27,26,21,22,23,24</testcases>
<DEPENDENCY>
<path>/tests/FUNC/FUNCnetCfg/dependencies/</path>
@@ -40,5 +41,6 @@
<MININET>
<switch>6</switch>
</MININET>
-
+ <RETRY>5</RETRY>
+ <RetrySleep>2</RetrySleep>
</PARAMS>
diff --git a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
index 0f8812a..e311bf9 100644
--- a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
+++ b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
@@ -48,7 +48,8 @@
main.hostsData = {}
main.nodes = []
main.ONOSip = []
-
+ main.retrytimes = main.params[ 'RETRY' ]
+ main.retrysleep = main.params[ 'RetrySleep' ]
main.ONOSip = main.ONOSbench.getOnosIps()
# Assigning ONOS cli handles to a list
@@ -431,6 +432,7 @@
main.log.error( "ONOS NetCfg doesn't match what was sent" )
main.log.debug( "ONOS config: {}".format( onosCfg ) )
main.log.debug( "Sent config: {}".format( sentCfg ) )
+ utilities.retry( f=main.ONOSrest1.getNetCfg, retValue=False, attempts=main.retrytimes, sleep=main.retrysleep )
utilities.assert_equals( expect=True,
actual=s1Result,
onpass="Net Cfg added for device s1",
@@ -460,6 +462,7 @@
main.log.error( "ONOS NetCfg doesn't match what was sent" )
main.log.debug( "ONOS config: {}".format( onosCfg ) )
main.log.debug( "Sent config: {}".format( sentCfg ) )
+ utilities.retry( f=main.ONOSrest1.getNetCfg, retValue=False, attempts=main.retrytimes, sleep=main.retrysleep )
utilities.assert_equals( expect=True,
actual=s3Result,
onpass="Net Cfg added for device s3",
@@ -499,7 +502,6 @@
onpass="Only allowed devices are in ONOS",
onfail="ONOS devices doesn't match the list" +
" of allowed devices" )
-
main.step( "Check device annotations" )
keys = [ 'name', 'owner', 'rackAddress' ]
try:
@@ -560,6 +562,7 @@
main.log.error( "ONOS NetCfg doesn't match what was sent" )
main.log.debug( "ONOS config: {}".format( onosCfg ) )
main.log.debug( "Sent config: {}".format( sentCfg ) )
+ utilities.retry( f=main.ONOSrest2.getNetCfg, retValue=False, attempts=main.retrytimes, sleep=main.retrysleep )
utilities.assert_equals( expect=True,
actual=s2Result,
onpass="Net Cfg added for device s2",
@@ -571,14 +574,14 @@
"owner": "John",
"allowed": False }
main.s4Json = s4Json
- setS4Disallow = main.ONOSrest4.setNetCfg( s4Json,
+ setS4Disallow = main.ONOSrest3.setNetCfg( s4Json,
subjectClass="devices",
subjectKey="of:0000000000000004",
configKey="basic" )
s4Result = False
if setS4Disallow:
# Check what we set is what is in ONOS
- getS4 = main.ONOSrest4.getNetCfg( subjectClass="devices",
+ getS4 = main.ONOSrest3.getNetCfg( subjectClass="devices",
subjectKey="of:0000000000000004",
configKey="basic" )
onosCfg = pprint( getS4 )
@@ -589,10 +592,12 @@
main.log.error( "ONOS NetCfg doesn't match what was sent" )
main.log.debug( "ONOS config: {}".format( onosCfg ) )
main.log.debug( "Sent config: {}".format( sentCfg ) )
+ main.step( "Retrying main.ONOSrest3.getNetCfg" )
+ utilities.retry( f=main.ONOSrest3.getNetCfg, retValue=False, attempts=main.retrytimes, sleep=main.retrysleep )
utilities.assert_equals( expect=True,
actual=s4Result,
onpass="Net Cfg added for device s4",
- onfail="Net Cfg for device s3 not correctly set" )
+ onfail="Net Cfg for device s4 not correctly set" )
main.netCfg.compareCfg( main, main.gossipTime )
@@ -719,7 +724,7 @@
del s4Json['allowed']
except KeyError:
main.log.exception( "Key not found" )
- setS4 = main.ONOSrest4.setNetCfg( s4Json,
+ setS4 = main.ONOSrest3.setNetCfg( s4Json,
subjectClass="devices",
subjectKey="of:0000000000000004",
configKey="basic" )
@@ -794,10 +799,10 @@
import json
main.case( "Check to see if the pre-startup configurations were set, then remove their allowed status" )
main.step( "Checking configurations for Switches 5 and 6" )
- main.step( "ONOS should only show devices S1, S2, S4, S5, and S6" )
+ main.step( "ONOS should only show devices S1, S2, S4, and S5" ) #and S6
devices = main.ONOSrest1.devices()
main.log.debug( main.ONOSrest1.pprint( devices ) )
- allowedDevices = [ "of:{}".format( str( i ).zfill( 16 ) ) for i in [ 1, 2, 4, 5, 6 ] ]
+ allowedDevices = [ "of:{}".format( str( i ).zfill( 16 ) ) for i in [ 1, 2, 4, 5 ] ] #6
main.log.debug( allowedDevices )
onosDevices = []
try:
@@ -826,4 +831,61 @@
setS1 = main.ONOSrest1.setNetCfg( s6Json,
subjectClass="devices",
subjectKey="of:0000000000000006",
- configKey="basic" )
\ No newline at end of file
+ configKey="basic" )
+
+ def CASE27( self, main ):
+ """
+ 1) A = get /network/configuration
+ 2) Post A
+ 3) Compare A with ONOS
+ 4) Modify A so S6 is disallowed
+ 5) Check
+
+ """
+ import json
+ pprint = main.nodes[0].pprint
+ main.case( "Posting network configurations to the top level web resource" )
+ main.step( "Get json object from Net Cfg" )
+ getinfo = main.ONOSrest1.getNetCfg( )
+ main.log.debug( getinfo )
+ main.step( "Posting json object to Net Cfg" )
+ postinfo = main.ONOSrest1.setNetCfg( json.loads( getinfo ) )
+ main.step( "Compare device with ONOS" )
+ main.netCfg.compareCfg( main )
+ main.step ( "ONOS should only show devices S1, S2, S4, S5 and S6" )
+ devices = main.ONOSrest1.devices( )
+ main.log.debug( main.ONOSrest1.pprint( devices ) )
+ allowedDevices = [ "of:{}".format( str( i ).zfill( 16 ) ) for i in [ 1, 2, 4, 5, 6 ] ]
+ onosDevices = []
+ try:
+ for sw in json.loads( devices ):
+ onosDevices.append( str( sw.get( 'id' ) ) )
+ onosDevices.sort( )
+ failMsg = "ONOS devices doesn't match the list of allowed devices. \n"
+ failMsg += "Expected devices: {}\nActual devices: {}".format( allowedDevices, onosDevices )
+ except( TypeError, ValueError ):
+ main.log.error( "Problem loading devices" )
+ utilities.assert_equals( expect=allowedDevices, actual=onosDevices,
+ onpass="Only allowed devices are in ONOS", onfail=failMsg )
+
+ main.step( "Modify json object so S6 is disallowed" )
+ main.s6Json = { "allowed": False }
+ s6Json = main.s6Json
+ setS6Disallow = main.ONOSrest1.setNetCfg( s6Json, subjectClass="devices",
+ subjectKey="of:0000000000000006", configKey="basic" )
+ s6Result = False
+ if setS6Disallow:
+ getS6 = main.ONOSrest1.getNetCfg( subjectClass="devices",
+ subjectKey="of:0000000000000006", configKey="basic" )
+ onosCfg = pprint( getS6 )
+ sentCfg = pprint( s6Json )
+ if onosCfg == sentCfg:
+ s6Result = True
+ else:
+ main.log.error( "ONOS NetCfg doesn't match what was sent" )
+ main.log.debug( "ONOS config: {}".format( onosCfg ) )
+ main.log.debug( "Sent config: {}".format( sentCfg ) )
+ utilities.retry( f=main.ONOSrest1.getNetCfg, retValue=False, attempts=main.retrytimes, sleep=main.retrysleep )
+ utilities.assert_equals( expect=True, actual=s6Result,
+ onpass="Net Cfg added for devices s6",
+ onfail="Net Cfg for device s6 not correctly set" )
diff --git a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.topo b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.topo
index e1e06eb..4204c78 100755
--- a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.topo
+++ b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.topo
@@ -44,50 +44,6 @@
</COMPONENTS>
</ONOSrest3>
- <ONOSrest4>
- <host>OC4</host>
- <port>8181</port>
- <user>onos</user>
- <password>rocks</password>
- <type>OnosRestDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS>
- </COMPONENTS>
- </ONOSrest4>
-
- <ONOSrest5>
- <host>OC5</host>
- <port>8181</port>
- <user>onos</user>
- <password>rocks</password>
- <type>OnosRestDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS>
- </COMPONENTS>
- </ONOSrest5>
-
- <ONOSrest6>
- <host>OC6</host>
- <port>8181</port>
- <user>onos</user>
- <password>rocks</password>
- <type>OnosRestDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS>
- </COMPONENTS>
- </ONOSrest6>
-
- <ONOSrest7>
- <host>OC7</host>
- <port>8181</port>
- <user>onos</user>
- <password>rocks</password>
- <type>OnosRestDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS>
- </COMPONENTS>
- </ONOSrest7>
-
<Mininet1>
<host>OCN</host>
<user>sdn</user>
diff --git a/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py b/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
index 45e15f4..8d3047e 100644
--- a/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
+++ b/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
@@ -139,7 +139,7 @@
utilities.assert_equals( expect=main.TRUE, actual=onos1Isup,
onpass="ONOS startup successful",
onfail="ONOS startup failed" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
print main.nodes[0].ip_address
cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address )
utilities.assert_equals( expect=main.TRUE, actual=cliResults,
diff --git a/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py b/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
index adf85a2..cf6cdc1 100644
--- a/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
+++ b/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
@@ -155,7 +155,7 @@
onfail="ONOS startup failed" )
time.sleep( main.startUpSleep )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
print main.nodes[0].ip_address
cliResults = main.ONOScli1.startOnosCli(main.nodes[0].ip_address)
diff --git a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
index 69f094d..6ff14ce 100644
--- a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
@@ -222,7 +222,7 @@
onpass="ONOS startup successful",
onfail="ONOS startup failed" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
cliResults = main.TRUE
threads = []
for i in range( main.numCtrls ):
@@ -1834,7 +1834,7 @@
onpass="ONOS restarted",
onfail="ONOS restart NOT successful" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
cliResults = main.TRUE
threads = []
for i in range( main.numCtrls ):
diff --git a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
index a48a460..1b83edf 100644
--- a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
+++ b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
@@ -247,7 +247,7 @@
onpass="ONOS startup successful",
onfail="ONOS startup failed" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
cliResults = main.TRUE
threads = []
for i in range( main.numCtrls ):
@@ -1832,7 +1832,7 @@
onpass="Firewall rules set successfully",
onfail="Error setting firewall rules" )
- main.log.step( "Sleeping 60 seconds" )
+ main.step( "Sleeping 60 seconds" )
time.sleep( 60 )
def CASE62( self, main ):
diff --git a/TestON/tests/HA/HAkillNodes/HAkillNodes.py b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
index 6fb4d6c..c6aa669 100644
--- a/TestON/tests/HA/HAkillNodes/HAkillNodes.py
+++ b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
@@ -254,7 +254,7 @@
onpass="ONOS startup successful",
onfail="ONOS startup failed" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
cliResults = main.TRUE
threads = []
for i in range( main.numCtrls ):
diff --git a/TestON/tests/HA/HAsanity/HAsanity.py b/TestON/tests/HA/HAsanity/HAsanity.py
index aa66574..b18cce8 100644
--- a/TestON/tests/HA/HAsanity/HAsanity.py
+++ b/TestON/tests/HA/HAsanity/HAsanity.py
@@ -223,7 +223,7 @@
onpass="ONOS startup successful",
onfail="ONOS startup failed" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
cliResults = main.TRUE
threads = []
for i in range( main.numCtrls ):
diff --git a/TestON/tests/HA/HAscaling/HAscaling.py b/TestON/tests/HA/HAscaling/HAscaling.py
index 2064f1e..04000ba 100644
--- a/TestON/tests/HA/HAscaling/HAscaling.py
+++ b/TestON/tests/HA/HAscaling/HAscaling.py
@@ -282,7 +282,7 @@
onpass="ONOS startup successful",
onfail="ONOS startup failed" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
cliResults = main.TRUE
threads = []
for i in range( main.numCtrls ):
@@ -1894,7 +1894,7 @@
onpass="ONOS started",
onfail="ONOS start NOT successful" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
cliResults = main.TRUE
threads = []
for i in main.activeNodes:
diff --git a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index 1d4db86..c13b910 100644
--- a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -212,7 +212,7 @@
onpass="ONOS startup successful",
onfail="ONOS startup failed" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
cliResults = main.TRUE
threads = []
for i in range( main.numCtrls ):
@@ -1401,7 +1401,7 @@
onpass="ONOS is back up",
onfail="ONOS failed to start" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address )
utilities.assert_equals( expect=main.TRUE, actual=cliResults,
onpass="ONOS cli startup successful",
diff --git a/TestON/tests/HA/HAstopNodes/HAstopNodes.py b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
index 0f33ec0..7617a7a 100644
--- a/TestON/tests/HA/HAstopNodes/HAstopNodes.py
+++ b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
@@ -247,7 +247,7 @@
onpass="ONOS startup successful",
onfail="ONOS startup failed" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
cliResults = main.TRUE
threads = []
for i in range( main.numCtrls ):
diff --git a/TestON/tests/HA/HAswapNodes/HAswapNodes.py b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
index 8ea1490..1ced5a2 100644
--- a/TestON/tests/HA/HAswapNodes/HAswapNodes.py
+++ b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
@@ -276,7 +276,7 @@
onpass="ONOS startup successful",
onfail="ONOS startup failed" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
cliResults = main.TRUE
threads = []
for i in range( main.numCtrls ):
@@ -1882,7 +1882,7 @@
onpass="ONOS started",
onfail="ONOS start NOT successful" )
- main.log.step( "Starting ONOS CLI sessions" )
+ main.step( "Starting ONOS CLI sessions" )
cliResults = main.TRUE
threads = []
for i in main.activeNodes:
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.topo b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.topo
index b37a17a..05dbe31 100755
--- a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.topo
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.topo
@@ -22,7 +22,7 @@
</ONOScli1>
<Mininet1>
- <host>localhost</host>
+ <host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
diff --git a/TestON/tests/PLAT/PLATdockertest/PLATdockertest.topo b/TestON/tests/PLAT/PLATdockertest/PLATdockertest.topo
index 3501864..f6d50ae 100755
--- a/TestON/tests/PLAT/PLATdockertest/PLATdockertest.topo
+++ b/TestON/tests/PLAT/PLATdockertest/PLATdockertest.topo
@@ -32,7 +32,7 @@
</ONOSbenchDocker>
<Mininet1>
- <host>localhost</host>
+ <host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
index 23bfc09..3ad2f30 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
@@ -180,7 +180,7 @@
topology = main.params['CASE11']['topo']
main.log.report( "Start Mininet topology" )
- main.log.case( "Start Mininet topology" )
+ main.case( "Start Mininet topology" )
main.step( "Starting Mininet Topology" )
topoResult = main.Mininet1.startNet( mnCmd=topology )
@@ -213,7 +213,7 @@
Tests using through ONOS CLI handles
"""
- main.log.case( "Test some onos commands through CLI. ")
+ main.case( "Test some onos commands through CLI. ")
main.log.debug( main.ONOScli1.sendline("summary") )
main.log.debug( main.ONOScli1.sendline("devices") )
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
index a804d4a..4fee9ff 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
@@ -27,7 +27,7 @@
</ONOScli1>
<Mininet1>
- <host>localhost</host>
+ <host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
index 592c8b2..90bfb14 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
@@ -180,7 +180,7 @@
topology = main.params['CASE11']['topo']
main.log.report( "Start Mininet topology" )
- main.log.case( "Start Mininet topology" )
+ main.case( "Start Mininet topology" )
main.step( "Starting Mininet Topology" )
topoResult = main.Mininet1.startNet(mnCmd=topology )
@@ -213,7 +213,7 @@
Tests using through ONOS CLI handles
"""
- main.log.case( "Test some onos commands through CLI. ")
+ main.case( "Test some onos commands through CLI. ")
main.log.debug( main.ONOScli1.sendline("summary") )
main.log.debug( main.ONOScli3.sendline("devices") )
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
index 9f23369..c01bb0a 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
@@ -47,7 +47,7 @@
</ONOScli3>
<Mininet1>
- <host>localhost</host>
+ <host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
diff --git a/TestON/tests/SCPF/SCPFcbench/SCPFcbench.params b/TestON/tests/SCPF/SCPFcbench/SCPFcbench.params
index d862129..fb23e90 100644
--- a/TestON/tests/SCPF/SCPFcbench/SCPFcbench.params
+++ b/TestON/tests/SCPF/SCPFcbench/SCPFcbench.params
@@ -28,7 +28,7 @@
</CTRL>
<MN>
- <ip1>OC1</ip1>
+ <ip1>OCN</ip1>
</MN>
<BENCH>
diff --git a/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py b/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
index 403e0fe..1da2d12 100644
--- a/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
+++ b/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
@@ -77,13 +77,13 @@
scale.remove(scale[0])
#kill off all onos processes
- main.log.step("Safety check, killing all ONOS processes")
- main.log.step("before initiating environment setup")
+ main.step("Safety check, killing all ONOS processes")
+ main.step("before initiating environment setup")
for node in range(1, maxNodes + 1):
main.ONOSbench.onosDie(ONOSIp[node])
#Uninstall everywhere
- main.log.step( "Cleaning Enviornment..." )
+ main.step( "Cleaning Enviornment..." )
for i in range(1, maxNodes + 1):
main.log.info(" Uninstalling ONOS " + str(i) )
main.ONOSbench.onosUninstall( ONOSIp[i] )
diff --git a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
index 4ec605f..a9abacb 100644
--- a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
+++ b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
@@ -85,13 +85,13 @@
main.log.info("CLUSTER COUNT: " + str(clusterCount))
#kill off all onos processes
- main.log.step("Safety check, killing all ONOS processes")
- main.log.step("before initiating environment setup")
+ main.step("Safety check, killing all ONOS processes")
+ main.step("before initiating environment setup")
for node in range(1, main.maxNodes + 1):
main.ONOSbench.onosDie(ONOSIp[node])
#Uninstall everywhere
- main.log.step( "Cleaning Enviornment..." )
+ main.step( "Cleaning Enviornment..." )
for i in range(1, main.maxNodes + 1):
main.log.info(" Uninstalling ONOS " + str(i) )
main.ONOSbench.onosUninstall( ONOSIp[i] )
@@ -191,9 +191,9 @@
st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
for n in neighborList:
- main.log.step("\tSTARTING TEST")
- main.log.step("\tLOADING FROM SERVERS: \t" + str(clusterCount) )
- main.log.step("\tNEIGHBORS:\t" + n )
+ main.step("\tSTARTING TEST")
+ main.step("\tLOADING FROM SERVERS: \t" + str(clusterCount) )
+ main.step("\tNEIGHBORS:\t" + n )
main.log.info("=============================================================")
main.log.info("=============================================================")
#write file to configure nil link
diff --git a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
index c24b6a7..989ccea 100644
--- a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
+++ b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
@@ -180,7 +180,7 @@
main.step( "Start ONOS CLI on all nodes" )
cliResult = main.TRUE
- main.log.step(" Start ONOS cli using thread ")
+ main.step(" Start ONOS cli using thread ")
time.sleep( main.startUpSleep )
startCliResult = main.TRUE
pool = []
diff --git a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.topo b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.topo
index 382d60f..615e957 100644
--- a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.topo
+++ b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.topo
@@ -87,7 +87,7 @@
</ONOS1>
<Mininet1>
- <host>localhost</host>
+ <host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params
index c7c156c..7c7953a 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params
@@ -60,8 +60,12 @@
<neighbors>0,a</neighbors> #a == all nodes (-1)
<flowRuleBUEnabled>true</flowRuleBUEnabled>
<skipReleaseResourcesOnWithdrawal>true</skipReleaseResourcesOnWithdrawal>
+ <flowObj>False</flowObj>
</TEST>
-
+ <DATABASE>
+ <dbName>/tmp/IntentEventTPDB</dbName>
+ <dbFlowObj>/tmp/IntentEventTPflowObjDB</dbFlowObj>
+ </DATABASE>
<METRICS>
<intents_rate>intents-events-metrics|grep "Intent Installed Events"|cut -d ' ' -f7</intents_rate>
<intents_withdrawn>intents-events-metrics|grep "Intent Withdrawn Events"|cut -d ' ' -f7</intents_withdrawn>
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
index 201c28c..a5944ac 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
@@ -41,8 +41,17 @@
numSwitches = (main.params[ 'TEST' ][ 'numSwitches' ]).split(",")
flowRuleBU = main.params[ 'TEST' ][ 'flowRuleBUEnabled' ]
skipRelRsrc = main.params[ 'TEST'][ 'skipReleaseResourcesOnWithdrawal']
+
homeDir = os.path.expanduser('~')
+ main.flowObj = main.params['TEST']['flowObj']
+ if main.flowObj == "True":
+ main.flowObj = True
+ main.dbFileName = main.params['DATABASE']['dbFlowObj']
+ else:
+ main.flowObj = False
+ main.dbFileName = main.params['DATABASE']['dbName']
+
main.exceptions = [0]*11
main.warnings = [0]*11
main.errors = [0]*11
@@ -81,17 +90,17 @@
pullResult = main.TRUE
main.log.info( "Skipped git checkout and pull" )
- main.log.step("Grabbing commit number")
+ main.step("Grabbing commit number")
commit = main.ONOSbench.getVersion()
commit = (commit.split(" "))[1]
- main.log.step("Creating results file")
- resultsDB = open("/tmp/IntentEventTPDB", "w+")
+ main.step("Creating results file")
+ resultsDB = open(main.dbFileName, "w+")
resultsDB.close()
# -- END OF INIT SECTION --#
- main.log.step("Adjusting scale")
+ main.step("Adjusting scale")
print str(scale)
print str(ONOSIp)
clusterCount = int(scale[0])
@@ -101,8 +110,8 @@
BENCHIp = ONOSIp[len(ONOSIp) -2]
#kill off all onos processes
- main.log.step("Safety check, killing all ONOS processes")
- main.log.step("before initiating environment setup")
+ main.step("Safety check, killing all ONOS processes")
+ main.step("before initiating environment setup")
for node in range(maxNodes):
main.ONOSbench.onosDie(ONOSIp[node])
@@ -110,7 +119,7 @@
BENCHIp = ONOSIp[len(ONOSIp) -2]
#Uninstall everywhere
- main.log.step( "Cleaning Enviornment..." )
+ main.step( "Cleaning Enviornment..." )
for i in range(maxNodes):
main.log.info(" Uninstalling ONOS " + str(i) )
main.ONOSbench.onosUninstall( ONOSIp[i] )
@@ -159,9 +168,22 @@
main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.store.flow.impl.DistributedFlowRuleStore", "backupEnabled " + str(flowRuleBU))
main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.net.intent.impl.IntentManager", "skipReleaseResourcesOnWithdrawal " + skipRelRsrc)
+ if main.flowObj:
+ main.step("Set Intent Compiler use Flow Object")
+ stepResult = utilities.retry(main.ONOSbench.onosCfgSet,
+ main.FALSE,
+ args=[ONOSIp[0],
+ "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
+ "useFlowObjectives true"],
+ sleep=3,
+ attempts=3)
+ utilities.assert_equals(expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully set Intent compiler use Flow object",
+ onfail="Failed to set up")
devices = int(clusterCount)*10
- main.log.step("Setting up null provider")
+ main.step("Setting up null provider")
for i in range(3):
main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.provider.nil.NullProviders", "deviceCount " + str(devices))
main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.provider.nil.NullProviders", "topoShape linear")
@@ -307,7 +329,7 @@
main.ONOSbench.handle.expect(":~")
main.log.info("Stopping intentperf" )
- with open("/tmp/IntentEventTPDB", "a") as resultsDB:
+ with open(main.dbFileName, "a") as resultsDB:
for node in groupResult:
resultString = "'" + commit + "',"
resultString += "'1gig',"
diff --git a/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/README b/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/README
deleted file mode 100644
index 30a2549..0000000
--- a/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/README
+++ /dev/null
@@ -1,28 +0,0 @@
-INTENT EVENT THROUGHPUT
-
-Summary: This is a performance test suite to test the intent
- throughput capabilities of ONOS with various controller cluster sizes.
-
-Pre-requisites: To run out-of-the box this test requires 7 NODES. OC1->OC7
- must be set before initiating the test. Passwordless login must be set
- from TestStation "sdn" root user.
-
-***If you wish to run this test with less than 7 nodes the following
- alterations must be made:
-
-NOTE: Only scale sizes 1,3,5 and 7 will be functional
-
-Modifying .params file:
--- Remove any values in the comma separated list in the
- <scale> tag that are above your desired cluster size.
-
--- Remove one instance of “1,2” from the <testcases>
- tag for each value you removed from <scale> (case 1 and 2 are each
- called once for each scale value)
-
--- Change the value in the <max> tag to your desired scale size (1,3, or 5)
-
-Modifying .topo file:
--- Change the <ONOSbench/COMPONENTS/nodes> tag to your desired scale size
-
--- Remove all unneeded <ONOS#cli> tags and their contents
diff --git a/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.params b/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.params
deleted file mode 100644
index 729e3ef..0000000
--- a/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.params
+++ /dev/null
@@ -1,71 +0,0 @@
-<PARAMS>
-
- <testcases>1,3,2,1,3,2,1,3,2,1,3,2,1,3,2,1,3,2,1,3,2</testcases>
-
- <debugMode></debugMode> #nothing means false
-
- <ENV>
- <cellName>intentTP</cellName>
- <cellApps>drivers,null,intentperf</cellApps>
- </ENV>
-
- <SCALE>1,3,3,5,5,7,7</SCALE>
- <max>7</max>
-
- <GIT>
- <autopull>off</autopull>
- <checkout>master</checkout>
- </GIT>
-
- <CTRL>
- <USER>sdn</USER>
-
- <ip1>OC1</ip1>
- <port1>6653</port1>
-
- <ip2>OC2</ip2>
- <port2>6653</port2>
-
- <ip3>OC3</ip3>
- <port3>6653</port3>
-
- <ip4>OC4</ip4>
- <port4>6653</port4>
-
- <ip5>OC5</ip5>
- <port5>6653</port5>
-
- <ip6>OC6</ip6>
- <port6>6653</port6>
-
- <ip7>OC7</ip7>
- <port7>6653</port7>
- </CTRL>
-
- <MN><ip1>OCN</ip1></MN>
-
- <BENCH>
- <user>sdn</user>
- <ip1>OCN</ip1>
- </BENCH>
-
- <TEST>
- <loadFrom>1,1,1,1,1,1,1</loadFrom> #generate load on server, 1 = generator on
- <numSwitches>10,10,10,10,10,10,10</numSwitches>
- <skipCleanInstall>yes</skipCleanInstall>
- <duration>400</duration>
- <log_interval>10</log_interval>
- <numKeys>40000</numKeys>
- <cyclePeriod>1000</cyclePeriod>
- <neighbors>0,a</neighbors> #a == all nodes (-1)
- <flowRuleBUEnabled>true</flowRuleBUEnabled>
- <skipReleaseResourcesOnWithdrawal>true</skipReleaseResourcesOnWithdrawal>
- </TEST>
-
- <METRICS>
- <intents_rate>intents-events-metrics|grep "Intent Installed Events"|cut -d ' ' -f7</intents_rate>
- <intents_withdrawn>intents-events-metrics|grep "Intent Withdrawn Events"|cut -d ' ' -f7</intents_withdrawn>
- <intents_failed>intents-events-metrics|grep "Intent Failed Events"|cut -d ' ' -f7</intents_failed>
- </METRICS>
-
-</PARAMS>
diff --git a/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.py b/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.py
deleted file mode 100644
index 059552b..0000000
--- a/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.py
+++ /dev/null
@@ -1,335 +0,0 @@
-# ScaleOutTemplate
-#
-# CASE1 starts number of nodes specified in param file
-#
-# cameron@onlab.us
-
-import sys
-import os.path
-import time
-
-
-class SCPFintentEventTpWithFlowObj:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ):
- import sys
- import os.path
- 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' ]
- BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
- BENCHUser = main.params[ 'BENCH' ][ 'user' ]
- MN1Ip = main.params[ 'MN' ][ 'ip1' ]
- maxNodes = int(main.params[ 'max' ])
- main.maxNodes = maxNodes
- skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
- cellName = main.params[ 'ENV' ][ 'cellName' ]
- numSwitches = (main.params[ 'TEST' ][ 'numSwitches' ]).split(",")
- flowRuleBU = main.params[ 'TEST' ][ 'flowRuleBUEnabled' ]
- skipRelRsrc = main.params[ 'TEST'][ 'skipReleaseResourcesOnWithdrawal']
- homeDir = os.path.expanduser('~')
-
- main.exceptions = [0]*11
- main.warnings = [0]*11
- main.errors = [0]*11
-
- # -- 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
- global commit
-
- clusterCount = 0
- ONOSIp = main.ONOSbench.getOnosIps()
- print ONOSIp
- print main.ONOSbench.onosIps.values()
-
- scale = (main.params[ 'SCALE' ]).split(",")
- clusterCount = int(scale[0])
-
- #Populate ONOSIp with ips from params
- ONOSIp.extend(main.ONOSbench.getOnosIps())
-
- #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
- if skipMvn != "yes":
- mvnResult = main.ONOSbench.cleanInstall()
-
- #git
- main.step( "Git checkout and pull " + checkoutBranch )
- if gitPull == 'on':
- checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
- pullResult = main.ONOSbench.gitPull()
-
- else:
- checkoutResult = main.TRUE
- pullResult = main.TRUE
- main.log.info( "Skipped git checkout and pull" )
-
- main.log.step("Grabbing commit number")
- commit = main.ONOSbench.getVersion()
- commit = (commit.split(" "))[1]
-
- main.log.step("Creating results file")
- # Create results file with flow object
- flowObjResultsDB = open("/tmp/IntentEventTPflowObjDB", "w+")
- flowObjResultsDB.close()
-
- # -- END OF INIT SECTION --#
-
- main.log.step("Adjusting scale")
- print str(scale)
- print str(ONOSIp)
- 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 environment setup")
- for node in range(maxNodes):
- main.ONOSbench.onosDie(ONOSIp[node])
-
- MN1Ip = ONOSIp[len(ONOSIp) -1]
- BENCHIp = ONOSIp[len(ONOSIp) -2]
-
- #Uninstall everywhere
- main.log.step( "Cleaning Enviornment..." )
- for i in range(maxNodes):
- main.log.info(" Uninstalling ONOS " + str(i) )
- main.ONOSbench.onosUninstall( ONOSIp[i] )
- main.log.info("Sleep 10 second for uninstall to settle...")
- time.sleep(10)
- main.ONOSbench.handle.sendline(" ")
- main.ONOSbench.handle.expect(":~")
-
- #construct the cell file
- main.log.info("Creating cell file")
- cellIp = []
- for node in range (clusterCount):
- cellIp.append(ONOSIp[node])
-
- main.ONOSbench.createCellFile("localhost",cellName,MN1Ip,str(Apps), cellIp)
-
- main.step( "Set Cell" )
- main.ONOSbench.setCell(cellName)
-
- myDistribution = []
- for node in range (clusterCount):
- myDistribution.append(numSwitches[node])
-
- 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(clusterCount):
- main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
- main.ONOSbench.onosInstall( ONOSIp[node])
-
- for node in range(clusterCount):
- 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")
-
- time.sleep(20)
-
- main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.store.flow.impl.DistributedFlowRuleStore", "backupEnabled " + str(flowRuleBU))
- main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.net.intent.impl.IntentManager", "skipReleaseResourcesOnWithdrawal " + skipRelRsrc)
- devices = int(clusterCount)*10
-
- main.log.step("Setting up null provider")
- for i in range(3):
- main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.provider.nil.NullProviders", "deviceCount " + str(devices))
- main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.provider.nil.NullProviders", "topoShape linear")
- main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.provider.nil.NullProviders", "enabled true")
- time.sleep(5)
-
- main.ONOSbench.handle.sendline("onos $OC1 summary")
- main.ONOSbench.handle.expect(":~")
-
- before = main.ONOSbench.handle.before
- if ("devices=" + str(devices)) in before:
- break
-
- main.ONOSbench.handle.sendline("""onos $OC1 "balance-masters" """)
- main.ONOSbench.handle.expect(":~")
- print main.ONOSbench.handle.before
-
- for i in range(3):
- passed = main.ONOSbench.verifySummary( ONOSIp[0] )
- if passed:
- main.log.info("Clusters have converged")
- break
- else:
- main.log.error("Clusters have not converged, retying...")
- time.sleep(3)
-
- main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"])
-
- def CASE2( self, main ):
- import time
- import json
- import string
- import csv
- import numpy
- import os.path
-
- global currentNeighbors
- neighbors = []
-
- try:
- currentNeighbors
- except:
- currentNeighbors = "0"
- neighbors = ['0']
- else:
- if currentNeighbors == "r": #reset
- currentNeighbors = "a"
- neighbors = ['0']
- else:
- currentNeighbors = "r"
- neighbors = ['a']
-
- if clusterCount == 1:
- currentNeighbors = "r"
-
- main.log.info("Cluster Count = " + str(clusterCount))
-
- intentsRate = main.params['METRICS']['intents_rate']
- intentsWithdrawn = main.params[ 'METRICS' ][ 'intents_withdrawn' ]
- intentsFailed = main.params[ 'METRICS' ][ 'intents_failed' ]
- testDuration = main.params[ 'TEST' ][ 'duration' ]
- logInterval = main.params[ 'TEST' ][ 'log_interval' ]
- debug = main.params[ 'debugMode' ]
- numKeys = main.params[ 'TEST' ][ 'numKeys' ]
- cyclePeriod = main.params[ 'TEST' ][ 'cyclePeriod' ]
- #neighbors = (main.params[ 'TEST' ][ 'neighbors' ]).split(",")
- metricList = [intentsRate, intentsWithdrawn, intentsFailed]
-
- for n in range(0, len(neighbors)):
- if neighbors[n] == 'a':
- neighbors[n] = str(clusterCount -1)
- if int(clusterCount) == 1:
- neighbors = neighbors.pop()
-
- for n in neighbors:
- main.log.info("Run with " + n + " neighbors")
- time.sleep(5)
- main.ONOSbench.handle.sendline("onos $OC1 cfg set org.onosproject.intentperf.IntentPerfInstaller numKeys " + numKeys )
- main.ONOSbench.handle.expect(":~")
- main.ONOSbench.handle.sendline("onos $OC1 cfg set org.onosproject.intentperf.IntentPerfInstaller numNeighbors " + n )
- main.ONOSbench.handle.expect(":~")
- main.ONOSbench.handle.sendline("onos $OC1 cfg set org.onosproject.intentperf.IntentPerfInstaller cyclePeriod " + cyclePeriod )
- main.ONOSbench.handle.expect(":~")
-
- cmd = "onos $OC1 intent-perf-start"
- main.ONOSbench.handle.sendline(cmd)
- main.ONOSbench.handle.expect(":~")
- main.log.info("Starting ONOS (all nodes) intent-perf from $OC1" )
-
- main.log.info( "Starting test loop for " + str(testDuration) + " seconds...\n" )
- stop = time.time() + float( testDuration )
-
- while time.time() < stop:
- time.sleep( float( logInterval ) )
- groupResult = []
- for node in range (1, clusterCount + 1):
- groupResult.append(0)
-
- cmd = " onos-ssh $OC" + str(node) + """ cat /opt/onos/log/karaf.log | grep "Throughput:" | tail -1 """
- main.log.info("COMMAND: " + str(cmd))
-
- x = 0
- while True:
- main.ONOSbench.handle.sendline(cmd)
- time.sleep(6)
- main.ONOSbench.handle.expect(":~")
- raw = main.ONOSbench.handle.before
- if "OVERALL=" in raw:
- break
- x += 1
- if x > 10:
- main.log.error("Expected output not being recieved... continuing")
- break
- time.sleep(2)
-
- raw = raw.splitlines()
- splitResults = []
- for line in raw:
- splitResults.extend(line.split(" "))
-
- myResult = "--"
- for field in splitResults:
- if "OVERALL" in field:
- myResult = field
-
- if myResult == "--":
- main.log.error("Parsing/Pexpect error\n" + str(splitResults))
-
- myResult = myResult.replace(";", "")
- myResult = myResult.replace("OVERALL=","")
- myResult = float(myResult)
- groupResult[len(groupResult) -1] = myResult
-
- main.log.info("Node " + str(node) + " overall rate: " + str(myResult))
-
- clusterTotal = str(numpy.sum(groupResult))
- main.log.report("Results from this round of polling: " + str(groupResult))
- main.log.report("Cluster Total: " + clusterTotal + "\n")
-
- cmd = "onos $OC1 intent-perf-stop"
- main.ONOSbench.handle.sendline(cmd)
- main.ONOSbench.handle.expect(":~")
- main.log.info("Stopping intentperf" )
-
- with open("/tmp/IntentEventTPflowObjDB", "a") as resultsDB:
- for node in groupResult:
- resultString = "'" + commit + "',"
- resultString += "'1gig',"
- resultString += str(clusterCount) + ","
- resultString += "'baremetal" + str(int(groupResult.index(node)) + 1) + "',"
- resultString += n + ","
- resultString += str(node) + ","
- resultString += str(0) + "\n" #no stddev
- resultsDB.write(resultString)
- resultsDB.close()
- main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"])
-
- def CASE3( self, main ):
- main.step("Set Intent Compiler use Flow Object")
- stepResult = utilities.retry( main.ONOSbench.onosCfgSet,
- main.FALSE,
- args=[ ONOSIp[0],
- "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
- "useFlowObjectives true" ],
- sleep=3,
- attempts=3 )
- utilities.assert_equals( expect = main.TRUE,
- actual = stepResult,
- onpass = "Successfully set Intent compiler use Flow object",
- onfail = "Failed to set up" )
diff --git a/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.topo b/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.topo
deleted file mode 100644
index 915d033..0000000
--- a/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/SCPFintentEventTpWithFlowObj.topo
+++ /dev/null
@@ -1,147 +0,0 @@
-<TOPOLOGY>
-
- <COMPONENT>
-
- <ONOSbench>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS>
- <home>~/onos</home>
- <nodes>7</nodes>
- </COMPONENTS>
- </ONOSbench>
-
- <ONOS1cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1cli>
-
- <ONOS2cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2cli>
-
- <ONOS3cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS3cli>
-
- <ONOS4cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS4cli>
-
- <ONOS5cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>6</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS5cli>
-
- <ONOS6cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>7</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS6cli>
-
- <ONOS7cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</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/SCPF/SCPFintentEventTpWithFlowObj/__init__.py b/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/SCPF/SCPFintentEventTpWithFlowObj/__init__.py
+++ /dev/null
diff --git a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params
index 7c3e10a..8843c2f 100644
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params
+++ b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params
@@ -18,7 +18,8 @@
<ingress>null:0000000000000001/6</ingress>
<egress>null:0000000000000007/5</egress>
<debug>False</debug>
- </TEST>
+ <flowObj>False</flowObj>
+ </TEST>
<GIT>
<gitPull>off</gitPull>
@@ -26,7 +27,8 @@
</GIT>
<DATABASE>
- <file>/tmp/IntentInstallWithdrawLatDB</file>
+ <dbName>/tmp/IntentInstallWithdrawLatDB</dbName>
+ <dbFlowObj>/tmp/IntentInstallWithdrawLatDBWFO</dbFlowObj>
</DATABASE>
<ATTEMPTS>
<verify>3</verify>
@@ -68,7 +70,7 @@
</CTRL>
<MN>
- <ip1>localhost</ip1>
+ <ip1>OCN</ip1>
</MN>
<BENCH>
diff --git a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
index 730875e..3e84aad 100644
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
+++ b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
@@ -62,7 +62,6 @@
main.maxNodes = int(main.params['max'])
main.cellName = main.params['ENV']['cellName']
main.scale = (main.params['SCALE']).split(",")
- main.dbFileName = main.params['DATABASE']['file']
main.timeout = int(main.params['SLEEP']['timeout'])
main.startUpSleep = int(main.params['SLEEP']['startup'])
main.installSleep = int(main.params['SLEEP']['install'])
@@ -74,6 +73,15 @@
main.ingress = main.params['TEST']['ingress']
main.egress = main.params['TEST']['egress']
main.debug = main.params['TEST']['debug']
+ main.flowObj = main.params['TEST']['flowObj']
+
+ if main.flowObj == "True":
+ main.flowObj = True
+ main.dbFileName = main.params['DATABASE']['dbFlowObj']
+ else:
+ main.flowObj = False
+ main.dbFileName = main.params['DATABASE']['dbName']
+
for i in range(0, len(main.intentsList)):
main.intentsList[i] = int(main.intentsList[i])
# Create DataBase file
@@ -168,7 +176,7 @@
time.sleep(2)
main.step("Start ONOS CLI on all nodes")
cliResult = main.TRUE
- main.log.step(" Start ONOS cli using thread ")
+ main.step(" Start ONOS cli using thread ")
startCliResult = main.TRUE
pool = []
main.threadID = 0
@@ -191,6 +199,9 @@
main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "topoShape", value="linear")
main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
main.CLIs[0].setCfg("org.onosproject.net.intent.impl.IntentManager", "skipReleaseResourcesOnWithdrawal", value="true")
+ if main.flowObj:
+ main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
+ "useFlowObjectives", value="true")
time.sleep(main.startUpSleep)
# balanceMasters
diff --git a/TestON/tests/SCPF/SCPFintentInstallWithdrawLatWithFlowObj/SCPFintentInstallWithdrawLatWithFlowObj.params b/TestON/tests/SCPF/SCPFintentInstallWithdrawLatWithFlowObj/SCPFintentInstallWithdrawLatWithFlowObj.params
deleted file mode 100644
index e1b799a..0000000
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLatWithFlowObj/SCPFintentInstallWithdrawLatWithFlowObj.params
+++ /dev/null
@@ -1,82 +0,0 @@
-<PARAMS>
-
- <testcases>0,1,2,1,2,1,2,1,2</testcases>
-
- <SCALE>1,3,5,7</SCALE>
- <max>7</max>
-
- <ENV>
- <cellName>IntentInstallWithdrawCell</cellName>
- <cellApps>drivers,null</cellApps>
- </ENV>
-
- <TEST>
- <skipCleanInstall>yes</skipCleanInstall>
- <warmUp>5</warmUp>
- <sampleSize>20</sampleSize>
- <intents>1,100</intents> #list format, will be split on ','
- <ingress>null:0000000000000001/6</ingress>
- <egress>null:0000000000000007/5</egress>
- <debug>False</debug>
- </TEST>
-
- <GIT>
- <gitPull>off</gitPull>
- <gitBranch>master</gitBranch>
- </GIT>
-
- <DATABASE>
- <file>/tmp/IntentInstallWithdrawLatDBWFO</file>
- </DATABASE>
- <ATTEMPTS>
- <verify>3</verify>
- </ATTEMPTS>
-
- <SLEEP>
- <startup>10</startup>
- <install>10</install>
- <verify>3</verify>
- <reroute>3</reroute>
- # timeout for pexpect
- <timeout>300</timeout>
- </SLEEP>
-
- <CTRL>
- <USER>sdn</USER>
-
- <ip1>OC1</ip1>
- <port1>6653</port1>
-
- <ip2>OC2</ip2>
- <port2>6653</port2>
-
- <ip3>OC3</ip3>
- <port3>6653</port3>
-
- <ip4>OC4</ip4>
- <port4>6653</port4>
-
- <ip5>OC5</ip5>
- <port5>6653</port5>
-
- <ip6>OC6</ip6>
- <port6>6653</port6>
-
- <ip7>OC7</ip7>
- <port7>6653</port7>
-
- </CTRL>
-
- <MN>
- <ip1>localhost</ip1>
- </MN>
-
- <BENCH>
- <user>sdn</user>
- <ip1>localhost</ip1>
- </BENCH>
-
- <JSON>
- </JSON>
-
-</PARAMS>
diff --git a/TestON/tests/SCPF/SCPFintentInstallWithdrawLatWithFlowObj/SCPFintentInstallWithdrawLatWithFlowObj.py b/TestON/tests/SCPF/SCPFintentInstallWithdrawLatWithFlowObj/SCPFintentInstallWithdrawLatWithFlowObj.py
deleted file mode 100644
index bbcf154..0000000
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLatWithFlowObj/SCPFintentInstallWithdrawLatWithFlowObj.py
+++ /dev/null
@@ -1,324 +0,0 @@
-"""
-SCPFintentInstallWithdrawLatWithFlowObj:
- - Test the latency of intent installed and withdrawn
- - Use Push-test-intents command to push intents
- - Use Null provider with 7 devices and linear topology
- - Always push intents between 1/6 and 7/5
- - The batch size is defined in parm file. (default 1,100)
- - org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator useFlowObjectives set
- to true
- yunpeng@onlab.us
-"""
-
-import sys
-import os.path
-
-
-class SCPFintentInstallWithdrawLatWithFlowObj:
- def __init__( self ):
- self.default = ''
-
- def CASE0( self, main ):
- '''
- - GIT
- - BUILDING ONOS
- Pull specific ONOS branch, then Build ONOS ono ONOS Bench.
- This step is usually skipped. Because in a Jenkins driven automated
- test env. We want Jenkins jobs to pull&build for flexibility to handle
- different versions of ONOS.
- - Construct tests variables
- '''
- gitPull = main.params['GIT']['gitPull']
- gitBranch = main.params['GIT']['gitBranch']
-
- main.case("Pull onos branch and build onos on Teststation.")
-
- if gitPull == 'True':
- main.step("Git Checkout ONOS branch: " + gitBranch)
- stepResult = main.ONOSbench.gitCheckout(branch=gitBranch)
- utilities.assert_equals(expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully checkout onos branch.",
- onfail="Failed to checkout onos branch. Exiting test...")
- if not stepResult: main.exit()
-
- main.step("Git Pull on ONOS branch:" + gitBranch)
- stepResult = main.ONOSbench.gitPull()
- utilities.assert_equals(expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully pull onos. ",
- onfail="Failed to pull onos. Exiting test ...")
- if not stepResult: main.exit()
-
- main.step("Building ONOS branch: " + gitBranch)
- stepResult = main.ONOSbench.cleanInstall(skipTest=True)
- utilities.assert_equals(expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully build onos.",
- onfail="Failed to build onos. Exiting test...")
- if not stepResult: main.exit()
-
- else:
- main.log.warn("Skipped pulling onos and Skipped building ONOS")
-
- main.apps = main.params['ENV']['cellApps']
- main.BENCHUser = main.params['BENCH']['user']
- main.BENCHIp = main.params['BENCH']['ip1']
- main.MN1Ip = main.params['MN']['ip1']
- main.maxNodes = int(main.params['max'])
- main.cellName = main.params['ENV']['cellName']
- main.scale = (main.params['SCALE']).split(",")
- main.dbFileName = main.params['DATABASE']['file']
- main.timeout = int(main.params['SLEEP']['timeout'])
- main.startUpSleep = int(main.params['SLEEP']['startup'])
- main.installSleep = int(main.params['SLEEP']['install'])
- main.verifySleep = int(main.params['SLEEP']['verify'])
- main.verifyAttempts = int(main.params['ATTEMPTS']['verify'])
- main.sampleSize = int(main.params['TEST']['sampleSize'])
- main.warmUp = int(main.params['TEST']['warmUp'])
- main.intentsList = (main.params['TEST']['intents']).split(",")
- main.ingress = main.params['TEST']['ingress']
- main.egress = main.params['TEST']['egress']
- main.debug = main.params['TEST']['debug']
- for i in range(0, len(main.intentsList)):
- main.intentsList[i] = int(main.intentsList[i])
- # Create DataBase file
- main.log.info("Create Database file " + main.dbFileName)
- resultsDB = open(main.dbFileName, "w+")
- resultsDB.close()
-
- def CASE1( self, main ):
- # Clean up test environment and set up
- import time
- main.log.info("Get ONOS cluster IP")
- print(main.scale)
- main.numCtrls = int(main.scale[0])
- main.ONOSip = []
- main.maxNumBatch = 0
- main.AllONOSip = main.ONOSbench.getOnosIps()
- for i in range(main.numCtrls):
- main.ONOSip.append(main.AllONOSip[i])
- main.log.info(main.ONOSip)
- main.CLIs = []
- main.log.info("Creating list of ONOS cli handles")
- for i in range(main.numCtrls):
- main.CLIs.append(getattr(main, 'ONOS%scli' % (i + 1)))
-
- if not main.CLIs:
- main.log.error("Failed to create the list of ONOS cli handles")
- main.cleanup()
- main.exit()
-
- main.commit = main.ONOSbench.getVersion(report=True)
- main.commit = main.commit.split(" ")[1]
- main.log.info("Starting up %s node(s) ONOS cluster" % main.numCtrls)
- main.log.info("Safety check, killing all ONOS processes" +
- " before initiating environment setup")
-
- for i in range(main.numCtrls):
- main.ONOSbench.onosDie(main.ONOSip[i])
-
- main.log.info("NODE COUNT = %s" % main.numCtrls)
- main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
- main.cellName,
- main.MN1Ip,
- main.apps,
- main.ONOSip)
- main.step("Apply cell to environment")
- cellResult = main.ONOSbench.setCell(main.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("Uninstall ONOS package on all Nodes")
- uninstallResult = main.TRUE
- for i in range(int(main.numCtrls)):
- main.log.info("Uninstalling package on ONOS Node IP: " + main.ONOSip[i])
- u_result = main.ONOSbench.onosUninstall(main.ONOSip[i])
- utilities.assert_equals(expect=main.TRUE, actual=u_result,
- onpass="Test step PASS",
- onfail="Test step FAIL")
- uninstallResult = (uninstallResult and u_result)
-
- main.step("Install ONOS package on all Nodes")
- installResult = main.TRUE
- for i in range(int(main.numCtrls)):
- main.log.info("Installing package on ONOS Node IP: " + main.ONOSip[i])
- i_result = main.ONOSbench.onosInstall(node=main.ONOSip[i])
- utilities.assert_equals(expect=main.TRUE, actual=i_result,
- onpass="Test step PASS",
- onfail="Test step FAIL")
- installResult = installResult and i_result
-
- main.step("Verify ONOS nodes UP status")
- statusResult = main.TRUE
- for i in range(int(main.numCtrls)):
- main.log.info("ONOS Node " + main.ONOSip[i] + " status:")
- onos_status = main.ONOSbench.onosStatus(node=main.ONOSip[i])
- utilities.assert_equals(expect=main.TRUE, actual=onos_status,
- onpass="Test step PASS",
- onfail="Test step FAIL")
- statusResult = (statusResult and onos_status)
- time.sleep(2)
- main.step("Start ONOS CLI on all nodes")
- cliResult = main.TRUE
- main.log.step(" Start ONOS cli using thread ")
- startCliResult = main.TRUE
- pool = []
- main.threadID = 0
- for i in range(int(main.numCtrls)):
- t = main.Thread(target=main.CLIs[i].startOnosCli,
- threadID=main.threadID,
- name="startOnosCli",
- args=[main.ONOSip[i]],
- kwargs={"onosStartTimeout": main.timeout})
- pool.append(t)
- t.start()
- main.threadID = main.threadID + 1
- for t in pool:
- t.join()
- startCliResult = startCliResult and t.result
- time.sleep(main.startUpSleep)
-
- # configure apps
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=7)
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "topoShape", value="linear")
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
- main.CLIs[0].setCfg("org.onosproject.net.intent.impl.IntentManager",
- "skipReleaseResourcesOnWithdrawal", value="true")
- main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
- "useFlowObjectives", value="true")
- time.sleep(main.startUpSleep)
-
- # balanceMasters
- main.CLIs[0].balanceMasters()
- time.sleep(main.startUpSleep)
-
- def CASE2( self, main ):
- import time
- import numpy
- import json
- print(main.intentsList)
- for batchSize in main.intentsList:
- main.log.report("Intent Batch size: {}".format(batchSize))
- main.installLatList = []
- main.withdrawLatList = []
- validrun = 0
- invalidrun = 0
- # we use two variables to control the iteration
- while validrun <= main.warmUp + main.sampleSize and invalidrun < 20:
- if validrun >= main.warmUp:
- main.log.info("================================================")
- main.log.info("Starting test iteration " + str(validrun - main.warmUp))
- main.log.info("Total test iteration: " + str(invalidrun + validrun))
- main.log.info("================================================")
- else:
- main.log.info("====================Warm Up=====================")
-
- # push intents
- installResult = main.CLIs[0].pushTestIntents(main.ingress, main.egress, batchSize,
- offset=1, options="-i", timeout=main.timeout,
- getResponse=True)
- if type(installResult) is str:
- if "Failure" in installResult:
- main.log.error("Install Intents failure, ignore this iteration.")
- if validrun < main.warmUp:
- validrun += 1
- continue
- else:
- invalidrun += 1
- continue
-
- try:
- latency = int(installResult.split()[5])
- main.log.info(installResult)
- except:
- main.log.error("Failed to get latency, ignore this iteration.")
- main.log.error("Response from ONOS:")
- print(installResult)
- if validrun < main.warmUp:
- validrun += 1
- continue
- else:
- invalidrun += 1
- continue
-
- if validrun >= main.warmUp:
- main.installLatList.append(latency)
- else:
- invalidrun += 1
- continue
- time.sleep(2)
- # Withdraw Intents
- withdrawResult = main.CLIs[0].pushTestIntents(main.ingress, main.egress, batchSize,
- offset=1, options="-w", timeout=main.timeout,
- getResponse=True)
-
- if type(withdrawResult) is str:
- if "Failure" in withdrawResult:
- main.log.error("withdraw Intents failure, ignore this iteration.")
- if validrun < main.warmUp:
- validrun += 1
- continue
- else:
- invalidrun += 1
- continue
-
- try:
- latency = int(withdrawResult.split()[5])
- main.log.info(withdrawResult)
- except:
- main.log.error("Failed to get latency, ignore this iteration.")
- main.log.error("Response from ONOS:")
- print(withdrawResult)
- if validrun < main.warmUp:
- validrun += 1
- continue
- else:
- invalidrun += 1
- continue
-
- if validrun >= main.warmUp:
- main.withdrawLatList.append(latency)
- else:
- invalidrun += 1
- continue
- time.sleep(2)
- main.CLIs[0].purgeWithdrawnIntents()
- validrun += 1
- installave = numpy.average(main.installLatList)
- installstd = numpy.std(main.installLatList)
- withdrawave = numpy.average(main.withdrawLatList)
- withdrawstd = numpy.std(main.withdrawLatList)
- # log report
- main.log.report("----------------------------------------------------")
- main.log.report("Scale: " + str(main.numCtrls))
- main.log.report("Intent batch: " + str(batchSize))
- main.log.report("Install average: {} std: {}".format(installave, installstd))
- main.log.report("Withdraw average: {} std: {}".format(withdrawave, withdrawstd))
- # write result to database file
- if not (numpy.isnan(installave) or numpy.isnan(installstd) or \
- numpy.isnan(withdrawstd) or numpy.isnan(withdrawave)):
- databaseString = "'" + main.commit + "',"
- databaseString += str(main.numCtrls) + ","
- databaseString += str(batchSize) + ","
- databaseString += str(installave) + ","
- databaseString += str(installstd) + ","
- databaseString += str(withdrawave) + ","
- databaseString += str(withdrawstd) + "\n"
- resultsDB = open(main.dbFileName, "a")
- resultsDB.write(databaseString)
- resultsDB.close()
- del main.scale[0]
diff --git a/TestON/tests/SCPF/SCPFintentInstallWithdrawLatWithFlowObj/SCPFintentInstallWithdrawLatWithFlowObj.topo b/TestON/tests/SCPF/SCPFintentInstallWithdrawLatWithFlowObj/SCPFintentInstallWithdrawLatWithFlowObj.topo
deleted file mode 100644
index 915d033..0000000
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLatWithFlowObj/SCPFintentInstallWithdrawLatWithFlowObj.topo
+++ /dev/null
@@ -1,147 +0,0 @@
-<TOPOLOGY>
-
- <COMPONENT>
-
- <ONOSbench>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS>
- <home>~/onos</home>
- <nodes>7</nodes>
- </COMPONENTS>
- </ONOSbench>
-
- <ONOS1cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1cli>
-
- <ONOS2cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2cli>
-
- <ONOS3cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS3cli>
-
- <ONOS4cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS4cli>
-
- <ONOS5cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>6</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS5cli>
-
- <ONOS6cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>7</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS6cli>
-
- <ONOS7cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</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/SCPF/SCPFintentInstallWithdrawLatWithFlowObj/__init__.py b/TestON/tests/SCPF/SCPFintentInstallWithdrawLatWithFlowObj/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLatWithFlowObj/__init__.py
+++ /dev/null
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params
index 246a177..7dbda89 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params
@@ -18,9 +18,11 @@
<ingress>null:0000000000000001/0</ingress>
<egress>null:0000000000000007/0</egress>
<debug>False</debug>
+ <flowObj>False</flowObj>
</TEST>
<DATABASE>
- <file>/tmp/IntentRerouteLatDB</file>
+ <dbName>/tmp/IntentRerouteLatDB</dbName>
+ <dbFlowObj>/tmp/IntentRerouteLatDBWithFlowObj</dbFlowObj>
</DATABASE>
<GIT>
@@ -69,7 +71,7 @@
</CTRL>
<MN>
- <ip1>localhost</ip1>
+ <ip1>OCN</ip1>
</MN>
<BENCH>
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
index eaffabc..b282ebf 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
@@ -69,7 +69,6 @@
main.skipMvn = main.params['TEST']['skipCleanInstall']
main.cellName = main.params['ENV']['cellName']
main.scale = (main.params['SCALE']).split(",")
- main.dbFileName = main.params['DATABASE']['file']
main.timeout = int(main.params['SLEEP']['timeout'])
main.startUpSleep = int(main.params['SLEEP']['startup'])
main.installSleep = int(main.params['SLEEP']['install'])
@@ -82,6 +81,15 @@
main.ingress = main.params['TEST']['ingress']
main.egress = main.params['TEST']['egress']
main.debug = main.params['TEST']['debug']
+ main.flowObj = main.params['TEST']['flowObj']
+
+ if main.flowObj == "True":
+ main.flowObj = True
+ main.dbFileName = main.params['DATABASE']['dbFlowObj']
+ else:
+ main.flowObj = False
+ main.dbFileName = main.params['DATABASE']['dbName']
+
for i in range(0, len(main.intentsList)):
main.intentsList[i] = int(main.intentsList[i])
# Create DataBase file
@@ -179,7 +187,7 @@
time.sleep(2)
main.step("Start ONOS CLI on all nodes")
cliResult = main.TRUE
- main.log.step(" Start ONOS cli using thread ")
+ main.step(" Start ONOS cli using thread ")
startCliResult = main.TRUE
pool = []
main.threadID = 0
@@ -202,7 +210,9 @@
main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "topoShape", value="reroute")
main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
main.CLIs[0].setCfg("org.onosproject.store.flow.impl.DistributedFlowRuleStore", "backupEnabled", value="false")
-
+ if main.flowObj:
+ main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
+ "useFlowObjectives", value="true")
time.sleep(main.startUpSleep)
# Balance Master
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/README b/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/README
deleted file mode 100644
index 26b551b..0000000
--- a/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/README
+++ /dev/null
@@ -1,29 +0,0 @@
-INTENT REROUTE LATENCY
-
-Summary: This is a performance test designed to benchmark the
- intent reroute speed of ONOS at various controller cluster sizes.
-
-Pre-requisites: To run out-of-the box this test requires 7 NODES.
- OC1->OC7 must be set before initiating the test. Passwordless login
- must be set from TestStation "sdn" root user.
-
-***If you wish to run this test with less than 7 nodes the
- following alterations must be made:
-
-NOTE: Only scale sizes 1,3,5 and 7 will be functional
-
-Modifying .params file:
--- Remove any values in the comma separated list in
- the <scale> tag that are above your desired cluster size.
-
--- Remove one instance of “1,2” from the <testcases> tag for
- each value you removed from <scale> (case1 and 2 are each
- called once for each scale value)
-
--- Change the value in the <max> tag to your desired scale size (1,3,5)
-
-Modifying .topo file:
--- Change the <ONOSbench/COMPONENTS/nodes> tag to
- your desired scale size
-
--- Remove all unneeded <ONOS#cli> tags and their contents
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.params b/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.params
deleted file mode 100644
index 32735bc..0000000
--- a/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.params
+++ /dev/null
@@ -1,83 +0,0 @@
-<PARAMS>
-
- <testcases>0,1,2,1,2,1,2,1,2</testcases>
-
- <SCALE>1,3,5,7</SCALE>
- <max>7</max>
-
- <ENV>
- <cellName>intentRerouteCell</cellName>
- <cellApps>drivers,null,intentperf,metrics</cellApps>
- </ENV>
-
- <TEST>
- <skipCleanInstall>yes</skipCleanInstall>
- <warmUp>5</warmUp>
- <sampleSize>20</sampleSize>
- <intents>1,100</intents> #list format, will be split on ','
- <ingress>null:0000000000000001/0</ingress>
- <egress>null:0000000000000007/0</egress>
- <debug>False</debug>
- </TEST>
- <DATABASE>
- <file>/tmp/IntentRerouteLatDBWithFlowObj</file>
- </DATABASE>
-
- <GIT>
- <gitPull>False</gitPull>
- <gitBranch>master</gitBranch>
- </GIT>
-
- <ATTEMPTS>
- <verify>3</verify>
- </ATTEMPTS>
-
- <SLEEP>
- <startup>10</startup>
- <install>10</install>
- <setmaster>5</setmaster>
- <verify>5</verify>
- <reroute>3</reroute>
- # timeout for pexpect
- <timeout>300</timeout>
- </SLEEP>
-
- <CTRL>
- <USER>sdn</USER>
-
- <ip1>OC1</ip1>
- <port1>6653</port1>
-
- <ip2>OC2</ip2>
- <port2>6653</port2>
-
- <ip3>OC3</ip3>
- <port3>6653</port3>
-
- <ip4>OC4</ip4>
- <port4>6653</port4>
-
- <ip5>OC5</ip5>
- <port5>6653</port5>
-
- <ip6>OC6</ip6>
- <port6>6653</port6>
-
- <ip7>OC7</ip7>
- <port7>6653</port7>
-
- </CTRL>
-
- <MN>
- <ip1>localhost</ip1>
- </MN>
-
- <BENCH>
- <user>sdn</user>
- <ip1>localhost</ip1>
- </BENCH>
-
- <JSON>
- </JSON>
-
-</PARAMS>
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.py b/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.py
deleted file mode 100644
index 70b8a1e..0000000
--- a/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.py
+++ /dev/null
@@ -1,441 +0,0 @@
-# SCPFintentRerouteLatWithFlowObj
-"""
-SCPFintentRerouteLat
- - Test Intent Reroute Latency
- - Test Algorithm:
- 1. Start Null Provider reroute Topology
- 2. Using Push-test-intents to push batch size intents from switch 1 to switch 7
- 3. Cut the link between switch 3 and switch 4 (the path will reroute to switch 8)
- 4. Get the topology time stamp
- 5. Get Intent reroute(Installed) time stamp from each nodes
- 6. Use the latest intent time stamp subtract topology time stamp
- - This test will run 5 warm up by default, warm up iteration can be setup in Param file
- - The intent batch size will default set to 1 and 100, also can be set in Param file
- - The unit of the latency result is milliseconds
- - Ues flowObject set to True
-"""
-
-class SCPFintentRerouteLatWithFlowObj:
- def __init__(self):
- self.default = ''
-
- def CASE0( self, main ):
- '''
- - GIT
- - BUILDING ONOS
- Pull specific ONOS branch, then Build ONOS ono ONOS Bench.
- This step is usually skipped. Because in a Jenkins driven automated
- test env. We want Jenkins jobs to pull&build for flexibility to handle
- different versions of ONOS.
- - Construct tests variables
- '''
- gitPull = main.params['GIT']['gitPull']
- gitBranch = main.params['GIT']['gitBranch']
-
- main.case("Pull onos branch and build onos on Teststation.")
-
- if gitPull == 'True':
- main.step("Git Checkout ONOS branch: " + gitBranch)
- stepResult = main.ONOSbench.gitCheckout(branch=gitBranch)
- utilities.assert_equals(expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully checkout onos branch.",
- onfail="Failed to checkout onos branch. Exiting test...")
- if not stepResult: main.exit()
-
- main.step("Git Pull on ONOS branch:" + gitBranch)
- stepResult = main.ONOSbench.gitPull()
- utilities.assert_equals(expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully pull onos. ",
- onfail="Failed to pull onos. Exiting test ...")
- if not stepResult: main.exit()
-
- main.step("Building ONOS branch: " + gitBranch)
- stepResult = main.ONOSbench.cleanInstall(skipTest=True)
- utilities.assert_equals(expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully build onos.",
- onfail="Failed to build onos. Exiting test...")
- if not stepResult: main.exit()
-
- else:
- main.log.warn("Skipped pulling onos and Skipped building ONOS")
-
- main.apps = main.params['ENV']['cellApps']
- main.BENCHUser = main.params['BENCH']['user']
- main.BENCHIp = main.params['BENCH']['ip1']
- main.MN1Ip = main.params['MN']['ip1']
- main.maxNodes = int(main.params['max'])
- main.skipMvn = main.params['TEST']['skipCleanInstall']
- main.cellName = main.params['ENV']['cellName']
- main.scale = (main.params['SCALE']).split(",")
- main.dbFileName = main.params['DATABASE']['file']
- main.timeout = int(main.params['SLEEP']['timeout'])
- main.startUpSleep = int(main.params['SLEEP']['startup'])
- main.installSleep = int(main.params['SLEEP']['install'])
- main.setMasterSleep = int(main.params['SLEEP']['setmaster'])
- main.verifySleep = int(main.params['SLEEP']['verify'])
- main.verifyAttempts = int(main.params['ATTEMPTS']['verify'])
- main.sampleSize = int(main.params['TEST']['sampleSize'])
- main.warmUp = int(main.params['TEST']['warmUp'])
- main.intentsList = (main.params['TEST']['intents']).split(",")
- main.ingress = main.params['TEST']['ingress']
- main.egress = main.params['TEST']['egress']
- main.debug = main.params['TEST']['debug']
- for i in range(0, len(main.intentsList)):
- main.intentsList[i] = int(main.intentsList[i])
- # Create DataBase file
- main.log.info("Create Database file " + main.dbFileName)
- resultsDB = open(main.dbFileName, "w+")
- resultsDB.close()
-
- def CASE1( self, main ):
- '''
- clean up test environment and set up
- '''
- import time
-
- main.log.info("Get ONOS cluster IP")
- print(main.scale)
- main.numCtrls = int(main.scale[0])
- main.ONOSip = []
- main.maxNumBatch = 0
- main.AllONOSip = main.ONOSbench.getOnosIps()
- for i in range(main.numCtrls):
- main.ONOSip.append(main.AllONOSip[i])
- main.log.info(main.ONOSip)
- main.CLIs = []
- main.log.info("Creating list of ONOS cli handles")
- for i in range(main.numCtrls):
- main.CLIs.append(getattr(main, 'ONOS%scli' % (i + 1)))
-
- if not main.CLIs:
- main.log.error("Failed to create the list of ONOS cli handles")
- main.cleanup()
- main.exit()
-
- main.commit = main.ONOSbench.getVersion(report=True)
- main.commit = main.commit.split(" ")[1]
- main.log.info("Starting up %s node(s) ONOS cluster" % main.numCtrls)
- main.log.info("Safety check, killing all ONOS processes" +
- " before initiating environment setup")
-
- for i in range(main.numCtrls):
- main.ONOSbench.onosDie(main.ONOSip[i])
-
- main.log.info("NODE COUNT = %s" % main.numCtrls)
- main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
- main.cellName,
- main.MN1Ip,
- main.apps,
- main.ONOSip)
- main.step("Apply cell to environment")
- cellResult = main.ONOSbench.setCell(main.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("Uninstall ONOS package on all Nodes")
- uninstallResult = main.TRUE
- for i in range(int(main.numCtrls)):
- main.log.info("Uninstalling package on ONOS Node IP: " + main.ONOSip[i])
- u_result = main.ONOSbench.onosUninstall(main.ONOSip[i])
- utilities.assert_equals(expect=main.TRUE, actual=u_result,
- onpass="Test step PASS",
- onfail="Test step FAIL")
- uninstallResult = (uninstallResult and u_result)
-
- main.step("Install ONOS package on all Nodes")
- installResult = main.TRUE
- for i in range(int(main.numCtrls)):
- main.log.info("Installing package on ONOS Node IP: " + main.ONOSip[i])
- i_result = main.ONOSbench.onosInstall(node=main.ONOSip[i])
- utilities.assert_equals(expect=main.TRUE, actual=i_result,
- onpass="Test step PASS",
- onfail="Test step FAIL")
- installResult = installResult and i_result
-
- main.step("Verify ONOS nodes UP status")
- statusResult = main.TRUE
- for i in range(int(main.numCtrls)):
- main.log.info("ONOS Node " + main.ONOSip[i] + " status:")
- onos_status = main.ONOSbench.onosStatus(node=main.ONOSip[i])
- utilities.assert_equals(expect=main.TRUE, actual=onos_status,
- onpass="Test step PASS",
- onfail="Test step FAIL")
- statusResult = (statusResult and onos_status)
- time.sleep(2)
- main.step("Start ONOS CLI on all nodes")
- cliResult = main.TRUE
- main.log.step(" Start ONOS cli using thread ")
- startCliResult = main.TRUE
- pool = []
- main.threadID = 0
- for i in range(int(main.numCtrls)):
- t = main.Thread(target=main.CLIs[i].startOnosCli,
- threadID=main.threadID,
- name="startOnosCli",
- args=[main.ONOSip[i]],
- kwargs={"onosStartTimeout": main.timeout})
- pool.append(t)
- t.start()
- main.threadID = main.threadID + 1
- for t in pool:
- t.join()
- startCliResult = startCliResult and t.result
- time.sleep(main.startUpSleep)
-
- # configure apps
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=8)
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "topoShape", value="reroute")
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
- main.CLIs[0].setCfg("org.onosproject.store.flow.impl.DistributedFlowRuleStore", "backupEnabled", value="false")
- main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
- "useFlowObjectives", value="true")
-
- time.sleep(main.startUpSleep)
-
- # Balance Master
- main.CLIs[0].balanceMasters()
- if len(main.ONOSip) > 1:
- main.CLIs[0].deviceRole("null:0000000000000003", main.ONOSip[0])
- main.CLIs[0].deviceRole("null:0000000000000004", main.ONOSip[0])
- time.sleep( main.setMasterSleep )
-
- def CASE2( self, main ):
- import time
- import numpy
- import datetime
- import json
- # from scipy import stats
-
- ts = time.time()
- print(main.intentsList)
- for batchSize in main.intentsList:
- main.log.report("Intent Batch size: " + str(batchSize) + "\n ")
- main.LatencyList = []
- validRun = 0
- invalidRun = 0
- while validRun <= main.warmUp + main.sampleSize and invalidRun <= 20:
- if validRun >= main.warmUp:
- main.log.info("================================================")
- main.log.info("Starting test iteration: {} ".format(validRun - main.warmUp))
- main.log.info("Total iteration: {}".format(validRun + invalidRun))
- main.log.info("================================================")
- else:
- main.log.info("====================Warm Up=====================")
-
- # push intents
- main.CLIs[0].pushTestIntents(main.ingress, main.egress, batchSize,
- offset=1, options="-i", timeout=main.timeout)
-
- # check links and flows
- k = 0
- verify = main.FALSE
- linkCheck = 0
- flowsCheck = 0
- while k <= main.verifyAttempts:
- time.sleep(main.verifySleep)
- summary = json.loads(main.CLIs[0].summary(timeout=main.timeout))
- linkCheck = summary.get("links")
- flowsCheck = summary.get("flows")
- if linkCheck == 16 and flowsCheck == batchSize * 7:
- main.log.info("links: {}, flows: {} ".format(linkCheck, flowsCheck))
- verify = main.TRUE
- break
- k += 1
- if not verify:
- main.log.warn("Links or flows number are not match!")
- main.log.warn("links: {}, flows: {} ".format(linkCheck, flowsCheck))
- # bring back topology
- main.log.info("Bring back topology...")
- main.CLIs[0].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
- time.sleep(1)
- main.CLIs[0].purgeWithdrawnIntents()
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=0)
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="false")
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=8)
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
- if validRun >= main.warmUp:
- invalidRun += 1
- continue
- else:
- validRun += 1
- continue
-
- # Bring link down
- main.CLIs[0].link("0000000000000004/1", "0000000000000003/2", "down",
- timeout=main.timeout, showResponse=False)
- verify = main.FALSE
- k = 0
- topoManagerLog = ""
- while k <= main.verifyAttempts:
- time.sleep(main.verifySleep)
- summary = json.loads(main.CLIs[0].summary(timeout=main.timeout))
- linkCheck = summary.get("links")
- flowsCheck = summary.get("flows")
- if linkCheck == 14:
- main.log.info("links: {}, flows: {} ".format(linkCheck, flowsCheck))
- verify = main.TRUE
- break
- k += 1
- if not verify:
- main.log.warn("Links number are not match in TopologyManager log!")
- main.log.warn(topoManagerLog)
- # bring back topology
- main.log.info("Bring back topology...")
- main.CLIs[0].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
- time.sleep(1)
- main.CLIs[0].purgeWithdrawnIntents()
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=0)
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="false")
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=8)
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
- if validRun >= main.warmUp:
- invalidRun += 1
- continue
- else:
- validRun += 1
- continue
-
- try:
- # expect twice to clean the pexpect buffer
- main.ONOSbench.handle.sendline("")
- main.ONOSbench.handle.expect("\$")
- main.ONOSbench.handle.expect("\$")
- # send line by using bench, can't use driver because pexpect buffer problem
- cmd = "onos-ssh $OC1 cat /opt/onos/log/karaf.log | grep TopologyManager| tail -1"
- main.ONOSbench.handle.sendline(cmd)
- time.sleep(1)
- main.ONOSbench.handle.expect(":~")
- topoManagerLog = main.ONOSbench.handle.before
- topoManagerLogTemp = topoManagerLog.splitlines()
- # To make sure we get correct topology log
- for lines in topoManagerLogTemp:
- if "creationTime" in lines:
- topoManagerLog = lines
- main.log.info("Topology Manager log:")
- print(topoManagerLog)
- cutTimestamp = float(topoManagerLog.split("creationTime=")[1].split(",")[0])
- except:
- main.log.error("Topology Log is not correct!")
- print(topoManagerLog)
- # bring back topology
- main.log.info("Bring back topology...")
- verify = main.FALSE
- main.CLIs[0].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
- time.sleep(1)
- main.CLIs[0].purgeWithdrawnIntents()
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=0)
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="false")
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=8)
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
- if validRun >= main.warmUp:
- invalidRun += 1
- else:
- validRun += 1
- # If we got wrong Topology log, we should skip this iteration, and continue for next one
- continue
-
- installedTemp = []
- time.sleep(10)
- for cli in main.CLIs:
- tempJson = json.loads(cli.intentsEventsMetrics())
- Installedtime = tempJson.get('intentInstalledTimestamp').get('value')
- installedTemp.append(float(Installedtime))
- for i in range(0, len(installedTemp)):
- main.log.info("ONOS Node {} Installed Time stemp: {}".format((i + 1), installedTemp[i]))
- maxInstallTime = float(max(installedTemp))
- if validRun >= main.warmUp and verify:
- main.log.info("Installed time stemp: {0:f}".format(maxInstallTime))
- main.log.info("CutTimestamp: {0:f}".format(cutTimestamp))
- # Both timeStemps are milliseconds
- main.log.info("Latency: {0:f}".format(float(maxInstallTime - cutTimestamp)))
- if float(maxInstallTime - cutTimestamp) < 0:
- main.log.info("Latency less than 0!")
- # bring back topology
- main.log.info("Bring back topology...")
- verify = main.FALSE
- main.CLIs[0].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
- time.sleep(1)
- main.CLIs[0].purgeWithdrawnIntents()
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=0)
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="false")
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=8)
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
- if validRun >= main.warmUp:
- invalidRun += 1
- else:
- validRun += 1
- continue
- main.LatencyList.append(float(maxInstallTime - cutTimestamp))
- # We get valid latency, validRun + 1
- validRun += 1
-
- # Verify Summary after we bring up link, and withdrawn intents
- main.CLIs[0].link("0000000000000004/1", "0000000000000003/2", "up",
- timeout=main.timeout)
- k = 0
- verify = main.FALSE
- linkCheck = 0
- flowsCheck = 0
- while k <= main.verifyAttempts:
- time.sleep(main.verifySleep)
- main.CLIs[0].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
- time.sleep(1)
- main.CLIs[0].purgeWithdrawnIntents()
- summary = json.loads(main.CLIs[0].summary())
- linkCheck = summary.get("links")
- flowsCheck = summary.get("flows")
- intentCheck = summary.get("intents")
- if linkCheck == 16 and flowsCheck == 0 and intentCheck == 0:
- main.log.info("links: {}, flows: {}, intents: {} ".format(linkCheck, flowsCheck, intentCheck))
- verify = main.TRUE
- break
- k += 1
- if not verify:
- main.log.error("links, flows, or intents are not correct!")
- main.log.info("links: {}, flows: {}, intents: {} ".format(linkCheck, flowsCheck, intentCheck))
- # bring back topology
- main.log.info("Bring back topology...")
- main.CLIs[0].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
- time.sleep(1)
- main.CLIs[0].purgeWithdrawnIntents()
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=0)
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="false")
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=8)
- main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
- continue
-
- aveLatency = 0
- stdLatency = 0
- aveLatency = numpy.average(main.LatencyList)
- stdLatency = numpy.std(main.LatencyList)
- main.log.report("Scale: " + str(main.numCtrls) + " \tIntent batch: " + str(batchSize))
- main.log.report("Latency average:................" + str(aveLatency))
- main.log.report("Latency standard deviation:....." + str(stdLatency))
- main.log.report("________________________________________________________")
-
- if not (numpy.isnan(aveLatency) or numpy.isnan(stdLatency)):
- # check if got NaN for result
- resultsDB = open(main.dbFileName, "a")
- resultsDB.write("'" + main.commit + "',")
- resultsDB.write(str(main.numCtrls) + ",")
- resultsDB.write(str(batchSize) + ",")
- resultsDB.write(str(aveLatency) + ",")
- resultsDB.write(str(stdLatency) + "\n")
- resultsDB.close()
- del main.scale[0]
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.topo b/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.topo
deleted file mode 100644
index 915d033..0000000
--- a/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/SCPFintentRerouteLatWithFlowObj.topo
+++ /dev/null
@@ -1,147 +0,0 @@
-<TOPOLOGY>
-
- <COMPONENT>
-
- <ONOSbench>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS>
- <home>~/onos</home>
- <nodes>7</nodes>
- </COMPONENTS>
- </ONOSbench>
-
- <ONOS1cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1cli>
-
- <ONOS2cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS2cli>
-
- <ONOS3cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS3cli>
-
- <ONOS4cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS4cli>
-
- <ONOS5cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>6</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS5cli>
-
- <ONOS6cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>7</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS6cli>
-
- <ONOS7cli>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</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/SCPF/SCPFintentRerouteLatWithFlowObj/__init__.py b/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/SCPF/SCPFintentRerouteLatWithFlowObj/__init__.py
+++ /dev/null
diff --git a/TestON/tests/SCPF/SCPFmaxIntents/README b/TestON/tests/SCPF/SCPFmaxIntents/README
deleted file mode 100644
index cb53df8..0000000
--- a/TestON/tests/SCPF/SCPFmaxIntents/README
+++ /dev/null
@@ -1,6 +0,0 @@
-Summary:
- This is a performance test suit, designed to test the upper limits
- of onos and ovsdb with respect to installing intents and rerouting flows.
-NOTE:
- This test is largely based on the hardware used to run onos and mininet.
- Therefore, results will very test station to test station.
diff --git a/TestON/tests/SCPF/SCPFmaxIntents/SCPFmaxIntents.params b/TestON/tests/SCPF/SCPFmaxIntents/SCPFmaxIntents.params
deleted file mode 100755
index 56ad4d8..0000000
--- a/TestON/tests/SCPF/SCPFmaxIntents/SCPFmaxIntents.params
+++ /dev/null
@@ -1,103 +0,0 @@
-<PARAMS>
-
- # 1-init
- # 2-setup
- # 10-null provider setup
- # 11-mininet setup
- # 20-pushing intents, and rerouting intents if reroute is true
- # 1,2,10,20,2,11,20,100
- <testcases>1,2,10,20</testcases>
-
- <reroute>False</reroute>
-
- <SCALE>
- <size>1</size>
- <max>1</max>
- </SCALE>
-
- <DEPENDENCY>
- <path>/tests/SCPFmaxIntents/dependencies/</path>
- <wrapper1>startUp</wrapper1>
- <wrapper2>maxIntentFunctions</wrapper2>
- <topology>rerouteTopo.py</topology>
- </DEPENDENCY>
-
- <ENV>
- <cellName>productionCell</cellName>
- <cellApps>drivers</cellApps>
- </ENV>
-
- <GIT>
- <pull>False</pull>
- <branch>master</branch>
- </GIT>
-
- <CTRL>
- <port>6653</port>
- </CTRL>
-
- <SLEEP>
- <startup>3</startup>
- <install>1</install>
- <verify>5</verify>
- <reroute>3</reroute>
- # timeout for pexpect
- <timeout>120</timeout>
- </SLEEP>
-
- <ATTEMPTS>
- <verify>3</verify>
- <push>3</push>
- </ATTEMPTS>
-
- <DATABASE>
- <file>/tmp/MaxIntentDB</file>
- <nic>1gig</nic>
- <node>baremetal</node>
- </DATABASE>
-
- <LINK>
- <ingress>0000000000000001/9</ingress>
- <egress>0000000000000002/9</egress>
- </LINK>
-
- # CASE10
- <NULL>
- # CASE20
- <PUSH>
- <batch_size>1000</batch_size>
- <min_intents>100000</min_intents>
- <max_intents>1000000</max_intents>
- <check_interval>100000</check_interval>
- </PUSH>
-
- # if reroute is true
- <REROUTE>
- <batch_size>1000</batch_size>
- <min_intents>10000</min_intents>
- <max_intents>10000</max_intents>
- <check_interval>10000</check_interval>
- </REROUTE>
- </NULL>
-
- # CASE11
- <OVS>
- # CASE20
- <PUSH>
- <batch_size>1000</batch_size>
- <min_intents>10000</min_intents>
- <max_intents>500000</max_intents>
- <check_interval>10000</check_interval>
- </PUSH>
-
- # if reroute is true
- <REROUTE>
- <batch_size>1000</batch_size>
- <min_intents>10000</min_intents>
- <max_intents>500000</max_intents>
- <check_interval>10000</check_interval>
- </REROUTE>
- </OVS>
-
-
-</PARAMS>
diff --git a/TestON/tests/SCPF/SCPFmaxIntents/SCPFmaxIntents.py b/TestON/tests/SCPF/SCPFmaxIntents/SCPFmaxIntents.py
deleted file mode 100644
index 4bca4da..0000000
--- a/TestON/tests/SCPF/SCPFmaxIntents/SCPFmaxIntents.py
+++ /dev/null
@@ -1,517 +0,0 @@
-
-# This is a performance scale intent that test onos to see how many intents can
-# be installed and rerouted using the null provider and mininet.
-'''
-This test will not test on reroute and OVS!!!
-If you need test on reroute or OVS, change the params file
-
-Test information:
- - BatchSize: 1000
- - Minimum intents: 10,000
- - Maximum Intents: 1,000,000
- - Check Interval: 10,000
- - Link:
- - ingress: 0000000000000001/9
- - egress: 0000000000000002/9
- - Timeout: 120 Seconds
-'''
-
-class SCPFmaxIntents:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ):
- import time
- import os
- import imp
-
- """
- - Construct tests variables
- - GIT ( optional )
- - Checkout ONOS master branch
- - Pull latest ONOS code
- - Building ONOS ( optional )
- - Install ONOS package
- - Build ONOS package
- - Set up cell
- - Create cell file
- - Set cell file
- - Verify cell file
- - Kill ONOS process
- """
-
- main.case( "Constructing test variables and building ONOS package" )
- main.step( "Constructing test variables" )
- stepResult = main.FALSE
-
- # Test variables
- main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
- main.dependencyPath = main.testOnDirectory + \
- main.params['DEPENDENCY']['path']
- main.cellName = main.params[ 'ENV' ][ 'cellName' ]
- main.apps = main.params[ 'ENV' ][ 'cellApps' ]
- main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
- main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
- main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
- main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
- main.timeout = int(main.params['SLEEP']['timeout'])
- main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
- main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
- main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] )
- main.rerouteSleep = int ( main.params['SLEEP']['reroute'] )
- main.verifyAttempts = int( main.params['ATTEMPTS']['verify'] )
- main.ingress = main.params['LINK']['ingress']
- main.egress = main.params['LINK']['egress']
- main.dbFileName = main.params['DATABASE']['file']
- main.cellData = {} # for creating cell file
- main.reroute = main.params['reroute']
- if main.reroute == "True":
- main.reroute = True
- else:
- main.reroute = False
- main.CLIs = []
- main.ONOSip = []
- main.maxNumBatch = 0
- main.ONOSip = main.ONOSbench.getOnosIps()
- main.log.info(main.ONOSip)
- main.setupSkipped = False
-
- wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
- wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
- gitBranch = main.params[ 'GIT' ][ 'branch' ]
- gitPull = main.params[ 'GIT' ][ 'pull' ]
- nic = main.params['DATABASE']['nic']
- node = main.params['DATABASE']['node']
- nic = main.params['DATABASE']['nic']
- node = main.params['DATABASE']['node']
-
- # main.scale[ 0 ] determines the current number of ONOS controller
- main.numCtrls = int( main.scale[ 0 ] )
-
- main.log.info("Creating list of ONOS cli handles")
- for i in range(main.maxNodes):
- main.CLIs.append( getattr( main, 'ONOScli' + str( i+1 )))
-
- if not main.CLIs:
- main.log.error("Failed to create the list of ONOS cli handles")
- main.cleanup()
- main.exit()
-
- main.log.info("Loading wrapper files")
- main.startUp = imp.load_source( wrapperFile1,
- main.dependencyPath +
- wrapperFile1 +
- ".py" )
-
- main.intentFunctions = imp.load_source( wrapperFile2,
- main.dependencyPath +
- wrapperFile2 +
- ".py" )
-
- copyResult = main.ONOSbench.copyMininetFile( main.topology,
- main.dependencyPath,
- main.Mininet1.user_name,
- main.Mininet1.ip_address )
-
- commit = main.ONOSbench.getVersion(report=True)
- commit = commit.split(" ")[1]
-
- if gitPull == 'True':
- if not main.startUp.onosBuild( main, gitBranch ):
- main.log.error("Failed to build ONOS")
- main.cleanup()
- main.exit()
- else:
- main.log.warn( "Did not pull new code so skipping mvn " +
- "clean install" )
-
- main.log.info( "Starting up %s node(s) ONOS cluster" % main.numCtrls)
- main.log.info( "Safety check, killing all ONOS processes" +
- " before initiating environment setup" )
-
- for i in range( main.maxNodes ):
- main.ONOSbench.onosDie( main.ONOSip[ i ] )
-
- main.log.info( "NODE COUNT = %s" % main.numCtrls)
-
- tempOnosIp = []
- for i in range( main.numCtrls ):
- tempOnosIp.append( main.ONOSip[i] )
-
- main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
- "temp",
- main.Mininet1.ip_address,
- main.apps,
- tempOnosIp )
-
- main.step( "Apply cell to environment" )
- cellResult = main.ONOSbench.setCell( "temp" )
- verifyResult = main.ONOSbench.verifyCell()
- stepResult = cellResult and verifyResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully applied cell to " + \
- "environment",
- onfail="Failed to apply cell to environment " )
-
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
- stepResult = packageResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully created ONOS package",
- onfail="Failed to create ONOS package" )
-
- main.log.info("Creating DB file")
- with open(main.dbFileName, "w+") as dbFile:
- temp = "'" + commit + "',"
- temp += "'" + nic + "',"
- temp += str(main.numCtrls) + ","
- temp += "'" + node + "1" + "'"
- temp += ",0"
- temp += ",0"
- temp += ",0"
- temp += ",0"
- dbFile.write(temp)
-
- def CASE2( self, main ):
- """
- - Uninstall ONOS cluster
- - Verify ONOS start up
- - Install ONOS cluster
- - Connect to cli
- """
-
- main.step( "Installing ONOS with -f" )
- onosInstallResult = main.TRUE
- for i in range( main.numCtrls ):
- onosInstallResult = onosInstallResult and \
- main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
- stepResult = onosInstallResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully installed ONOS package",
- onfail="Failed to install ONOS package" )
-
- time.sleep( main.startUpSleep )
-
- main.step( "Start ONOS cli" )
- cliResult = main.TRUE
- for i in range( main.numCtrls ):
- cliResult = cliResult and \
- 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" )
-
- time.sleep( main.startUpSleep )
-
- def CASE10( self, main ):
- """
- Setting up null-provider
- """
- import json
- # Activate apps
- main.step("Activating null-provider")
- appStatus = utilities.retry( main.CLIs[0].activateApp,
- main.FALSE,
- ['org.onosproject.null'],
- sleep=main.verifySleep,
- attempts=main.verifyAttempts )
- utilities.assert_equals( expect=main.TRUE,
- actual=appStatus,
- onpass="Successfully activated null-provider",
- onfail="Failed activate null-provider" )
-
- # Setup the null-provider
- main.step("Configuring null-provider")
- cfgStatus = utilities.retry( main.ONOSbench.onosCfgSet,
- main.FALSE,
- [ main.ONOSip[0],
- 'org.onosproject.provider.nil.NullProviders', 'deviceCount 3'],
- sleep=main.verifySleep,
- attempts = main.verifyAttempts )
- cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
- main.FALSE,
- [ main.ONOSip[0],
- 'org.onosproject.provider.nil.NullProviders', 'topoShape reroute'],
- sleep=main.verifySleep,
- attempts = main.verifyAttempts )
-
- cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
- main.FALSE,
- [ main.ONOSip[0],
- 'org.onosproject.provider.nil.NullProviders', 'enabled true'],
- sleep=main.verifySleep,
- attempts = main.verifyAttempts )
-
-
- utilities.assert_equals( expect=main.TRUE,
- actual=cfgStatus,
- onpass="Successfully configured null-provider",
- onfail="Failed to configure null-provider" )
-
- # give onos some time to settle
- time.sleep(main.startUpSleep)
-
- main.log.info("Setting default flows to zero")
- main.defaultFlows = 0
-
- main.step("Check status of null-provider setup")
- caseResult = appStatus and cfgStatus
- utilities.assert_equals( expect=main.TRUE,
- actual=caseResult,
- onpass="Setting up null-provider was successfull",
- onfail="Failed to setup null-provider" )
-
- # This tells the following cases if we are using the null-provider or ovs
- main.switchType = "null:"
-
- # If the null-provider setup was unsuccessfull, then there is no point to
- # run the subsequent cases
- if not caseResult:
- main.setupSkipped = True
-
- def CASE11( self, main ):
- '''
- Setting up mininet
- '''
- import json
- import time
-
- time.sleep(main.startUpSleep)
-
- main.step("Activating openflow")
- appStatus = main.CLIs[0].activateApp('org.onosproject.openflow')
- utilities.assert_equals( expect=main.TRUE,
- actual=appStatus,
- onpass="Successfully activated openflow",
- onfail="Failed activate openflow" )
-
- time.sleep(main.startUpSleep)
-
- main.step('Starting mininet topology')
- mnStatus = main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py')
- utilities.assert_equals( expect=main.TRUE,
- actual=mnStatus,
- onpass="Successfully started Mininet",
- onfail="Failed to activate Mininet" )
-
- main.step("Assinging masters to switches")
- switches = main.Mininet1.getSwitches()
- swStatus = main.Mininet1.assignSwController( sw=switches.keys(), ip=main.ONOSip )
- utilities.assert_equals( expect=main.TRUE,
- actual=swStatus,
- onpass="Successfully assigned switches to masters",
- onfail="Failed assign switches to masters" )
-
- time.sleep(main.startUpSleep)
-
- main.log.info("Getting default flows")
- jsonSum = json.loads(main.CLIs[0].summary())
- main.defaultFlows = jsonSum["flows"]
-
- main.step("Check status of Mininet setup")
- caseResult = appStatus and mnStatus and swStatus
- utilities.assert_equals( expect=main.TRUE,
- actual=caseResult,
- onpass="Successfully setup Mininet",
- onfail="Failed setup Mininet" )
-
- # This tells the following cases if we are using the null-provider or ovs
- main.switchType = "of:"
-
- if not caseResult:
- main.setupSkipped = True
-
- def CASE20( self, main ):
- '''
- Pushing intents
- '''
-
- if main.reroute:
- if main.switchType == "of:":
- main.minIntents = int(main.params['OVS']['REROUTE']['min_intents'])
- main.maxIntents = int(main.params['OVS']['REROUTE']['max_intents'])
- main.checkInterval = int(main.params['OVS']['REROUTE']['check_interval'])
- main.batchSize = int(main.params['OVS']['REROUTE']['batch_size'])
- else:
- main.minIntents = int(main.params['NULL']['REROUTE']['min_intents'])
- main.maxIntents = int(main.params['NULL']['REROUTE']['max_intents'])
- main.checkInterval = int(main.params['NULL']['REROUTE']['check_interval'])
- main.batchSize = int(main.params['NULL']['REROUTE']['batch_size'])
- else:
- if main.switchType == "of:":
- main.minIntents = int(main.params['OVS']['PUSH']['min_intents'])
- main.maxIntents = int(main.params['OVS']['PUSH']['max_intents'])
- main.checkInterval = int(main.params['OVS']['PUSH']['check_interval'])
- main.batchSize = int(main.params['OVS']['PUSH']['batch_size'])
- else:
- main.minIntents = int(main.params['NULL']['PUSH']['min_intents'])
- main.maxIntents = int(main.params['NULL']['PUSH']['max_intents'])
- main.checkInterval = int(main.params['NULL']['PUSH']['check_interval'])
- main.batchSize = int(main.params['NULL']['PUSH']['batch_size'])
-
- # check if the case needs to be skipped
- if main.setupSkipped:
- main.setupSkipped = False
- main.skipCase()
-
- # the index where the next intents will be installed
- offset = 0
- # keeps track of how many intents have been installed
- currIntents = 0
- # keeps track of how many flows have been installed
- currFlows = main.defaultFlows
- # limit for the number of intents that can be installed
- limit = main.maxIntents / main.batchSize
-
- main.step( "Pushing intents" )
- for i in range(limit):
- pushResult = main.ONOScli1.pushTestIntents( main.switchType + main.ingress,
- main.switchType + main.egress,
- main.batchSize,
- offset = offset,
- options = "-i",
- timeout = main.timeout )
- if pushResult == None:
- main.log.info( "Timeout!" )
- main.skipCase()
- time.sleep(1)
-
- # Update offset
- offset += main.batchSize
-
- if offset >= main.minIntents and offset % main.checkInterval == 0:
- intentVerify = utilities.retry( main.ONOScli1.checkIntentSummary,
- main.FALSE,
- [main.timeout],
- sleep=main.verifySleep,
- attempts=main.verifyAttempts )
-
- flowVerify = utilities.retry( main.ONOScli1.checkFlowsState,
- main.FALSE,
- [False,main.timeout],
- sleep=main.verifySleep,
- attempts=main.verifyAttempts )
-
- if not intentVerify:
- main.log.error( "Failed to install intents" )
- break
-
- if main.reroute:
- main.step( "Reroute" )
- # tear down a link
- main.log.info("Tearing down link")
- if main.switchType == "of:":
- downlink = main.Mininet1.link( END1 = "s1", END2 = "s3", OPTION = "down" )
- else:
- downlink = main.ONOScli1.link( main.ingress, main.egress, "down")
-
- if downlink:
- main.log.info( "Successfully tear down link" )
- else:
- main.log.warn( "Failed to tear down link" )
-
- time.sleep(main.rerouteSleep)
-
- # Verifying intents
- main.step( "Checking intents and flows" )
- intentVerify = utilities.retry( main.ONOScli1.checkIntentSummary,
- main.FALSE,
- [main.timeout],
- sleep=main.verifySleep,
- attempts=main.verifyAttempts )
- # Verfying flows
- flowVerify = utilities.retry( main.ONOScli1.checkFlowsState,
- main.FALSE,
- [False, main.timeout],
- sleep = main.verifySleep,
- attempts = main.verifyAttempts )
-
- if not intentVerify:
- main.log.error( "Failed to install intents" )
- # Bring link back up
- main.log.info("Bringing link back up")
- if main.switchType == "of:":
- uplink = main.Mininet1.link( END1 = "s1", END2 = "s3", OPTION = "up" )
- else:
- uplink = main.ONOScli1.link( main.ingress, main.egress, "up" )
-
- if uplink:
- main.log.info( "Successfully bring link back up" )
- else:
- main.log.warn( "Failed to bring link back up" )
-
- time.sleep(main.rerouteSleep)
-
- # Verifying intents
- main.step( "Checking intents and flows" )
- intentVerify = utilities.retry( main.ONOScli1.checkIntentSummary,
- main.FALSE,
- [main.timeout],
- sleep=main.verifySleep,
- attempts=main.verifyAttempts )
- # Verfying flows
- flowVerify = utilities.retry( main.ONOScli1.checkFlowsState,
- main.FALSE,
- [False, main.timeout],
- sleep = main.verifySleep,
- attempts = main.verifyAttempts )
-
- if not intentVerify:
- main.log.error( "Failed to install intents" )
-
- rerouteResult = downlink and uplink
- utilities.assert_equals( expect = main.TRUE,
- actual = rerouteResult,
- onpass = "Successfully reroute",
- onfail = "Failed to reroute" )
-
- utilities.assert_equals( expect = main.TRUE,
- actual = intentVerify,
- onpass = "Successfully pushed and verified intents",
- onfail = "Failed to push and verify intents" )
- currIntents = main.ONOScli1.getTotalIntentsNum()
- currFlows = 0
- # Get current flows from REST API
- temp = json.loads( main.ONOSrest1.flows() )
- for t in temp:
- if t.get("state") == "ADDED":
- currFlows = currFlows + 1
- main.log.info( "Total Intents Installed: {}".format( currIntents ) )
- main.log.info( "Total Flows ADDED: {}".format( currFlows ) )
-
- main.log.info("Writing results to DB file")
- with open(main.dbFileName, "a") as dbFile:
- temp = "," + str(currIntents)
- temp += "," + str(currFlows)
- temp += ",0"
- temp += ",0\n"
- dbFile.write(temp)
-
- if main.switchType == "of:":
- main.step( "Stopping mininet" )
- stepResult = main.Mininet1.stopNet()
- utilities.assert_equals( expect = main.TRUE,
- actual = stepResult,
- oppass = "Successfully stop Mininet",
- opfail = "Failed stop Mininet" )
-
-
- def CASE100( self, main ):
- '''
- Report errors/warnings/exceptions
- '''
- main.log.info("Error report: \n")
- main.ONOSbench.logReport( main.ONOSip[ 0 ],
- [ "INFO",
- "FOLLOWER",
- "WARN",
- "flow",
- "ERROR",
- "Except" ],
- "s" )
diff --git a/TestON/tests/SCPF/SCPFmaxIntents/SCPFmaxIntents.topo b/TestON/tests/SCPF/SCPFmaxIntents/SCPFmaxIntents.topo
deleted file mode 100755
index 987f444..0000000
--- a/TestON/tests/SCPF/SCPFmaxIntents/SCPFmaxIntents.topo
+++ /dev/null
@@ -1,46 +0,0 @@
-<TOPOLOGY>
- <COMPONENT>
-
- <ONOSbench>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS>
- </COMPONENTS>
- </ONOSbench>
-
- <ONOScli1>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS>
- </COMPONENTS>
- </ONOScli1>
-
- <ONOSrest1>
- <host>OC1</host>
- <port>8181</port>
- <user>onos</user>
- <password>rocks</password>
- <type>OnosRestDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS>
- </COMPONENTS>
- </ONOSrest1>
-
- <Mininet1>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>MininetCliDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS>
- </COMPONENTS>
- </Mininet1>
-
- </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/SCPF/SCPFmaxIntents/__init__.py b/TestON/tests/SCPF/SCPFmaxIntents/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/SCPF/SCPFmaxIntents/__init__.py
+++ /dev/null
diff --git a/TestON/tests/SCPF/SCPFmaxIntents/dependencies/maxIntentFunctions.py b/TestON/tests/SCPF/SCPFmaxIntents/dependencies/maxIntentFunctions.py
deleted file mode 100644
index 268279c..0000000
--- a/TestON/tests/SCPF/SCPFmaxIntents/dependencies/maxIntentFunctions.py
+++ /dev/null
@@ -1,114 +0,0 @@
-'''
- Wrapper functions for maxIntent
-'''
-
-import json
-import time
-import pexpect
-
-def __init__( self ):
- self.default = ""
-
-def getIntents( main, state="INSTALLED", sleep=1, timeout=120 ):
- intents = 0
- try:
- cmd = "intents | grep " + state + " | wc -l"
- main.log.info("Sending: " + cmd)
- main.CLIs[0].handle.sendline(cmd)
-
- time.sleep(sleep)
-
- main.CLIs[0].handle.expect("onos>", timeout=timeout)
- raw = main.CLIs[0].handle.before
- intents = int(main.CLIs[0].handle.before.split()[7])
- main.log.info(state + " intents: " + str(intents))
- except pexpect.TIMEOUT:
- main.log.exception("Timeout exception caught in getIntent")
- return intents
-
-def getFlows( main, state="ADDED", sleep=1, timeout=120 ):
- flows = 0
- try:
- cmd = "flows | grep " + state + " | wc -l"
- main.log.info("Sending: " + cmd)
- main.CLIs[0].handle.sendline(cmd)
-
- time.sleep(sleep)
-
- main.CLIs[0].handle.expect("onos>", timeout=timeout)
- raw = main.CLIs[0].handle.before
- flows = int(main.CLIs[0].handle.before.split()[7])
- main.log.info(state + " flows: " + str(flows))
- except pexpect.TIMEOUT:
- main.log.exception("Timeout exception caught in getFlows")
- return flows
-
-
-def pushIntents( main,
- switch,
- ingress,
- egress,
- batch,
- offset,
- sleep=1,
- options="",
- timeout=120):
- '''
- Pushes intents using the push-test-intents cli command.
- '''
- try:
- cmd = "push-test-intents " + options + " " + switch + ingress + " " +\
- switch + egress + " " + str(batch) + " " + str(offset)
- main.log.info("Installing " + str(offset+batch) + " intents")
- main.log.debug("Sending: " + cmd)
- main.CLIs[0].handle.sendline(cmd)
- time.sleep(sleep)
- main.CLIs[0].handle.expect("onos>", timeout=timeout)
-
- raw = main.CLIs[0].handle.before
- if "Failure:" not in raw and "GC" not in raw:
- return main.TRUE
- except pexpect.TIMEOUT:
- main.log.exception("Timeout exception caught in pushIntents")
- return main.FALSE
-
-def verifyFlows( main, expectedFlows, state="ADDED", sleep=1, numcheck=10, timeout=120):
- '''
- This function returns main.TRUE if the number of expected flows are in
- the specified state
-
- @params
- expectedFlows: the flows you expect to see in the specified state
- state: the state of the flow to check for
- sleep: how long it should sleep for each check
- numcheck: how many times it should check
- timeout: the timeout for pexpect
- '''
- cmd = "flows | grep " + state + " | wc -l"
- for i in range(numcheck):
- flows = getFlows( main, state, sleep, timeout )
- if expectedFlows == flows:
- return main.TRUE
-
- return main.FALSE
-
-def verifyIntents( main, expectedIntents, state="INSTALLED", sleep=1, numcheck=10, timeout=120):
- '''
- This function returns main.TRUE if the number of expected intents are in
- the specified state
-
- @params
- expectedFlows: the intents you expect to see in the specified state
- state: the state of the intent to check for
- sleep: how long it should sleep for each check
- numcheck: how many times it should check
- timeout: the timeout for pexpect
- '''
- cmd = "intents | grep " + state + " | wc -l"
- for i in range(numcheck):
- intents = getIntents( main, state, sleep, timeout )
- if expectedIntents == intents:
- return main.TRUE
- time.sleep(sleep)
-
- return main.FALSE
diff --git a/TestON/tests/SCPF/SCPFmaxIntents/dependencies/rerouteTopo.py b/TestON/tests/SCPF/SCPFmaxIntents/dependencies/rerouteTopo.py
deleted file mode 100755
index a2fe9fe..0000000
--- a/TestON/tests/SCPF/SCPFmaxIntents/dependencies/rerouteTopo.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/python
-
-"""
-Custom topology for Mininet
-"""
-from mininet.topo import Topo
-from mininet.net import Mininet
-from mininet.node import Host, RemoteController
-from mininet.node import Node
-from mininet.link import TCLink
-from mininet.cli import CLI
-from mininet.log import setLogLevel
-from mininet.util import dumpNodeConnections
-from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
-
-class MyTopo( Topo ):
-
- def __init__( self ):
- # Initialize topology
- Topo.__init__( self )
-
- host1 = self.addHost('h1', ip='10.1.0.1/24')
- host2 = self.addHost('h2', ip='10.1.0.2/24')
- host3 = self.addHost('h3', ip='10.1.0.3/24')
-
- s1 = self.addSwitch( 's1' )
- s2 = self.addSwitch( 's2' )
- s3 = self.addSwitch( 's3' )
-
- self.addLink(s1, host1)
- self.addLink(s2, host2)
- self.addLink(s3, host3)
-
- self.addLink(s1,s2)
- self.addLink(s1,s3)
- self.addLink(s2,s3)
-
- topos = { 'mytopo': ( lambda: MyTopo() ) }
-
-# HERE THE CODE DEFINITION OF THE TOPOLOGY ENDS
-
-def setupNetwork():
- "Create network"
- topo = MyTopo()
- network = Mininet(topo=topo, autoSetMacs=True, controller=None)
- network.start()
- CLI( network )
- network.stop()
-
-if __name__ == '__main__':
- setLogLevel('info')
- #setLogLevel('debug')
- setupNetwork()
diff --git a/TestON/tests/SCPF/SCPFmaxIntents/dependencies/startUp.py b/TestON/tests/SCPF/SCPFmaxIntents/dependencies/startUp.py
deleted file mode 100644
index bf2a2b6..0000000
--- a/TestON/tests/SCPF/SCPFmaxIntents/dependencies/startUp.py
+++ /dev/null
@@ -1,38 +0,0 @@
-"""
- This wrapper function is use for starting up onos instance
-"""
-
-import time
-import os
-import json
-
-def onosBuild( main, gitBranch ):
- """
- This includes pulling ONOS and building it using maven install
- """
-
- buildResult = main.FALSE
-
- # Git checkout a branch of ONOS
- checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
- # Does the git pull on the branch that was checked out
- if not checkOutResult:
- main.log.warn( "Failed to checked out " + gitBranch +
- " branch")
- else:
- main.log.info( "Successfully checked out " + gitBranch +
- " branch")
- gitPullResult = main.ONOSbench.gitPull()
- if gitPullResult == main.ERROR:
- main.log.error( "Error pulling git branch" )
- else:
- main.log.info( "Successfully pulled " + gitBranch + " branch" )
-
- # Maven clean install
- buildResult = main.ONOSbench.cleanInstall()
-
- return buildResult
-
-
-
-
diff --git a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.params b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.params
index 4a758b3..0d8687e 100644
--- a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.params
+++ b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.params
@@ -26,7 +26,7 @@
</CTRL>
<MN>
- <ip1>localhost</ip1>
+ <ip1>OCN</ip1>
</MN>
<BENCH>
diff --git a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.topo b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.topo
index 1a73a2b..c988f13 100644
--- a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.topo
+++ b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.topo
@@ -78,7 +78,7 @@
</ONOS7cli>
<Mininet1>
- <host>localhost</host>
+ <host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
index 90ec8bf..79e8620 100755
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
@@ -8,7 +8,7 @@
# 200 - bring onos node up and balance masters
# 1000 - report logs
- <testcases>1,2,[10,300,11,100,300,11,200,300,11,1000]*3</testcases>
+ <testcases>1,[2,10,300,11,100,300,11,200,300,11,1000]*3</testcases>
<DEPENDENCY>
<path>/tests/SCPF/SCPFscaleTopo/dependencies/</path>
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
index 96ac405..71c7d3a 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
@@ -118,6 +118,13 @@
- Install ONOS cluster
- Connect to cli
"""
+ main.log.info( "Checking if mininet is already running" )
+ if len( main.topoScale ) < main.topoScaleSize:
+ main.log.info( "Mininet is already running. Stopping mininet." )
+ main.Mininet1.stopNet()
+ time.sleep(main.MNSleep)
+ else:
+ main.log.info( "Mininet was not running" )
main.case( "Starting up " + str( main.numCtrls ) +
" node(s) ONOS cluster" )
@@ -211,6 +218,7 @@
main.step( "Start ONOS cli" )
cliResult = main.TRUE
+ main.activeNodes = []
for i in range( main.numCtrls ):
cliResult = cliResult and \
main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
@@ -220,7 +228,7 @@
actual=stepResult,
onpass="Successfully start ONOS cli",
onfail="Failed to start ONOS cli" )
-
+ time.sleep( main.startUpSleep )
def CASE10( self, main ):
"""
@@ -231,27 +239,9 @@
main.case( "Starting up Mininet and verifying topology" )
main.caseExplanation = "Starting Mininet with a scalling topology and " +\
"comparing topology elements between Mininet and ONOS"
-
- main.log.info( "Checking if mininet is already running" )
- if len( main.topoScale ) < main.topoScaleSize:
- main.log.info( "Mininet is already running. Stopping mininet." )
- main.Mininet1.stopNet()
- time.sleep(main.MNSleep)
- else:
- main.log.info( "Mininet was not running" )
-
if main.topoScale:
main.currScale = main.topoScale.pop(0)
else: main.log.error( "topology scale is empty" )
-
- # remove device before setup topology
- devices = main.topo.getAllDevices( main )
- if( devices[0] != '[]' ): # because devices is a list witch contain 3 string, not contain list!
- temp = json.loads( devices[0] )
- devicesIdList = []
- for d in temp:
- main.CLIs[0].deviceRemove( d.get('id').encode() )
-
main.step( "Starting up TORUS %sx%s topology" % (main.currScale, main.currScale) )
main.log.info( "Constructing Mininet command" )
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params
index cb75b01..8510204 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params
@@ -22,7 +22,9 @@
<cellName>productionCell</cellName>
<cellApps>drivers,openflow</cellApps>
</ENV>
-
+ <TEST>
+ <flowObj>False</flowObj>
+ </TEST>
<GIT>
<pull>False</pull>
<branch>master</branch>
@@ -47,7 +49,8 @@
</ATTEMPTS>
<DATABASE>
- <file>/tmp/ScalingMaxIntentDB</file>
+ <dbName>/tmp/ScalingMaxIntentDB</dbName>
+ <dbFlowObj>/tmp/ScalingMaxIntentDBWFO</dbFlowObj>
<nic>1gig</nic>
<node>baremetal</node>
</DATABASE>
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
index a6f4445..c688207 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
@@ -43,9 +43,15 @@
main.verifyAttempts = int( main.params['ATTEMPTS']['verify'] )
main.ingress = main.params['LINK']['ingress']
main.egress = main.params['LINK']['egress']
- main.dbFileName = main.params['DATABASE']['file']
main.cellData = {} # for creating cell file
main.reroute = main.params['reroute']
+ main.flowObj = main.params['TEST']['flowObj']
+ if main.flowObj == "True":
+ main.flowObj = True
+ main.dbFileName = main.params['DATABASE']['dbFlowObj']
+ else:
+ main.flowObj = False
+ main.dbFileName = main.params['DATABASE']['dbName']
main.threadID = 0
if main.reroute == "True":
@@ -198,7 +204,7 @@
main.step( "Start ONOS CLI on all nodes" )
cliResult = main.TRUE
- main.log.step(" Start ONOS cli using thread ")
+ main.step(" Start ONOS cli using thread ")
startCliResult = main.TRUE
pool = []
@@ -312,6 +318,9 @@
main.CLIs[0].deviceRemove( d )
time.sleep(main.startUpSleep)
+ if main.flowObj:
+ main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
+ "useFlowObjectives", value="true")
main.step('Starting mininet topology')
mnStatus = main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py')
utilities.assert_equals( expect=main.TRUE,
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.topo b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.topo
index a1ec149..8e58be7 100755
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.topo
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.topo
@@ -88,7 +88,7 @@
</ONOScli7>
<Mininet1>
- <host>localhost</host>
+ <host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/README b/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/README
deleted file mode 100644
index 0c16859..0000000
--- a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/README
+++ /dev/null
@@ -1,11 +0,0 @@
-Summary:
- This is a performance test suit, designed to test the upper limits
- of onos and ovsdb with respect to installing intents.
- In this test, CASE10 set up null provoder, CASE 11 set up ovs. Start from
- 1 node, and scale to 7 nodes.
- We push intents to every node by using Thread, and when the intents number
- reach to the minimun number, we will verify intents and flows. If intents are
- not installed correctly, test will stop pushing and finish this case.
-NOTE:
- This test is largely based on the hardware used to run onos and mininet.
- Therefore, results will very test station to test station.
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.params b/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.params
deleted file mode 100644
index 8083e7a..0000000
--- a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.params
+++ /dev/null
@@ -1,99 +0,0 @@
-<PARAMS>
-
- # 0-init
- # 1-setup
- # 2-Install
- # 10-null provider setup
- # 20-pushing intents, and rerouting intents if reroute is true
- # 0,1,2,10,20,1,2,10,20,1,2,10,20
- <testcases>0,1,2,11,20,1,2,11,20,1,2,11,20,1,2,11,20</testcases>
-
- <reroute>False</reroute>
-
- <SCALE>1,3,5,7</SCALE>
-
- <DEPENDENCY>
- <path>/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/dependencies/</path>
- <wrapper1>startUp</wrapper1>
- <topology>rerouteTopo.py</topology>
- </DEPENDENCY>
-
- <ENV>
- <cellName>productionCell</cellName>
- <cellApps>drivers,openflow</cellApps>
- </ENV>
-
- <GIT>
- <pull>False</pull>
- <branch>master</branch>
- </GIT>
-
- <CTRL>
- <port>6653</port>
- </CTRL>
-
- <SLEEP>
- <startup>10</startup>
- <install>10</install>
- <verify>15</verify>
- <reroute>3</reroute>
- # timeout for pexpect
- <timeout>300</timeout>
- </SLEEP>
-
- <ATTEMPTS>
- <verify>3</verify>
- <push>3</push>
- </ATTEMPTS>
-
- <DATABASE>
- <file>/tmp/ScalingMaxIntentDBWFO</file>
- <nic>1gig</nic>
- <node>baremetal</node>
- </DATABASE>
-
- <LINK>
- <ingress>0000000000000001/5</ingress>
- <egress>0000000000000007/5</egress>
- </LINK>
-
- # CASE10
- <NULL>
- # CASE20
- <PUSH>
- <batch_size>1000</batch_size>
- <min_intents>10000</min_intents>
- <max_intents>70000</max_intents>
- <check_interval>10000</check_interval>
- </PUSH>
-
- # if reroute is true
- <REROUTE>
- <batch_size>1000</batch_size>
- <min_intents>10000</min_intents>
- <max_intents>1000000</max_intents>
- <check_interval>100000</check_interval>
- </REROUTE>
- </NULL>
-
- # CASE11
- <OVS>
- # CASE20
- <PUSH>
- <batch_size>1000</batch_size>
- <min_intents>10000</min_intents>
- <max_intents>500000</max_intents>
- <check_interval>10000</check_interval>
- </PUSH>
-
- # if reroute is true
- <REROUTE>
- <batch_size>1000</batch_size>
- <min_intents>10000</min_intents>
- <max_intents>500000</max_intents>
- <check_interval>10000</check_interval>
- </REROUTE>
- </OVS>
-
-
-</PARAMS>
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.py b/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.py
deleted file mode 100644
index 438338a..0000000
--- a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.py
+++ /dev/null
@@ -1,516 +0,0 @@
-import sys
-import json
-import time
-import os
-'''
-SCPFscalingMaxIntents
-Push test Intents to onos
-CASE10: set up Null Provider
-CASE11: set up Open Flows
-Scale up when reach the Limited
-Start from 1 nodes, 8 devices. Then Scale up to 3,5,7 nodes
-Recommand batch size: 100, check interval: 100
-'''
-class SCPFscalingMaxIntentsWithFlowObj:
- def __init__( self ):
- self.default = ''
-
- def CASE0( self, main):
- import sys
- import json
- import time
- import os
- import imp
-
- main.case( "Constructing test variables and building ONOS package" )
- main.step( "Constructing test variables" )
- stepResult = main.FALSE
-
- # Test variables
- main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
- main.dependencyPath = main.testOnDirectory + \
- main.params['DEPENDENCY']['path']
- main.cellName = main.params[ 'ENV' ][ 'cellName' ]
- main.apps = main.params[ 'ENV' ][ 'cellApps' ]
- main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
- main.scale = ( main.params[ 'SCALE' ] ).split( "," )
- main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
- main.timeout = int(main.params['SLEEP']['timeout'])
- main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
- main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
- main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] )
- main.rerouteSleep = int ( main.params['SLEEP']['reroute'] )
- main.verifyAttempts = int( main.params['ATTEMPTS']['verify'] )
- main.ingress = main.params['LINK']['ingress']
- main.egress = main.params['LINK']['egress']
- main.dbFileName = main.params['DATABASE']['file']
- main.cellData = {} # for creating cell file
- main.reroute = main.params['reroute']
- main.threadID = 0
-
- if main.reroute == "True":
- main.reroute = True
- else:
- main.reroute = False
-
- main.CLIs = []
- main.setupSkipped = False
-
- wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
- gitBranch = main.params[ 'GIT' ][ 'branch' ]
- gitPull = main.params[ 'GIT' ][ 'pull' ]
- nic = main.params['DATABASE']['nic']
- node = main.params['DATABASE']['node']
- nic = main.params['DATABASE']['nic']
- node = main.params['DATABASE']['node']
- stepResult = main.TRUE
-
- main.log.info("Cresting DB file")
- with open(main.dbFileName, "w+") as dbFile:
- dbFile.write("")
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="environment set up successfull",
- onfail="environment set up Failed" )
-
- def CASE1( self ):
- # main.scale[ 0 ] determines the current number of ONOS controller
- main.CLIs = []
- main.numCtrls = int( main.scale[ 0 ] )
- main.ONOSip = []
- main.maxNumBatch = 0
- main.AllONOSip = main.ONOSbench.getOnosIps()
- for i in range(main.numCtrls):
- main.ONOSip.append(main.AllONOSip[i])
- main.log.info(main.ONOSip)
-
- main.log.info( "Creating list of ONOS cli handles" )
- for i in range(main.numCtrls):
- main.CLIs.append( getattr( main, 'ONOScli%s' % (i+1) ) )
-
- main.log.info(main.CLIs)
- if not main.CLIs:
- main.log.error( "Failed to create the list of ONOS cli handles" )
- main.cleanup()
- main.exit()
-
- main.log.info( "Loading wrapper files" )
- main.startUp = imp.load_source( wrapperFile1,
- main.dependencyPath +
- wrapperFile1 +
- ".py" )
-
- copyResult = main.ONOSbench.copyMininetFile( main.topology,
- main.dependencyPath,
- main.Mininet1.user_name,
- main.Mininet1.ip_address )
-
- commit = main.ONOSbench.getVersion(report=True)
- commit = commit.split(" ")[1]
-
- if gitPull == 'True':
- if not main.startUp.onosBuild( main, gitBranch ):
- main.log.error( "Failed to build ONOS" )
- main.cleanup()
- main.exit()
- else:
- main.log.warn( "Did not pull new code so skipping mvn " +
- "clean install" )
- with open(main.dbFileName, "a") as dbFile:
- temp = "'" + commit + "',"
- temp += "'" + nic + "',"
- dbFile.write(temp)
-
- def CASE2( self, main ):
- """
- - Uninstall ONOS cluster
- - Verify ONOS start up
- - Install ONOS cluster
- - Connect to cli
- """
- main.log.info( "Starting up %s node(s) ONOS cluster" % main.numCtrls)
- main.log.info( "Safety check, killing all ONOS processes" +
- " before initiating environment setup" )
-
- for i in range( main.numCtrls ):
- main.ONOSbench.onosDie( main.ONOSip[ i ] )
-
- main.log.info( "NODE COUNT = %s" % main.numCtrls)
-
- tempOnosIp = []
- for i in range( main.numCtrls ):
- tempOnosIp.append( main.ONOSip[i] )
-
- main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
- "temp",
- main.Mininet1.ip_address,
- main.apps,
- tempOnosIp )
-
- main.step( "Apply cell to environment" )
- cellResult = main.ONOSbench.setCell( "temp" )
- verifyResult = main.ONOSbench.verifyCell()
- stepResult = cellResult and verifyResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully applied cell to " + \
- "environment",
- onfail="Failed to apply cell to environment " )
-
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
- stepResult = packageResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully created ONOS package",
- onfail="Failed to create ONOS package" )
-
- main.step( "Uninstall ONOS package on all Nodes" )
- uninstallResult = main.TRUE
- for i in range( int( main.numCtrls ) ):
- main.log.info( "Uninstalling package on ONOS Node IP: " + main.ONOSip[i] )
- u_result = main.ONOSbench.onosUninstall( main.ONOSip[i] )
- utilities.assert_equals( expect=main.TRUE, actual=u_result,
- onpass="Test step PASS",
- onfail="Test step FAIL" )
- uninstallResult = ( uninstallResult and u_result )
-
- main.step( "Install ONOS package on all Nodes" )
- installResult = main.TRUE
- for i in range( int( main.numCtrls ) ):
- main.log.info( "Installing package on ONOS Node IP: " + main.ONOSip[i] )
- i_result = main.ONOSbench.onosInstall( node=main.ONOSip[i] )
- utilities.assert_equals( expect=main.TRUE, actual=i_result,
- onpass="Test step PASS",
- onfail="Test step FAIL" )
- installResult = installResult and i_result
-
- main.step( "Verify ONOS nodes UP status" )
- statusResult = main.TRUE
- for i in range( int( main.numCtrls ) ):
- main.log.info( "ONOS Node " + main.ONOSip[i] + " status:" )
- onos_status = main.ONOSbench.onosStatus( node=main.ONOSip[i] )
- utilities.assert_equals( expect=main.TRUE, actual=onos_status,
- onpass="Test step PASS",
- onfail="Test step FAIL" )
- statusResult = ( statusResult and onos_status )
-
- main.step( "Start ONOS CLI on all nodes" )
- cliResult = main.TRUE
- main.log.step(" Start ONOS cli using thread ")
- startCliResult = main.TRUE
- pool = []
-
- for i in range( int( main.numCtrls) ):
- t = main.Thread( target=main.CLIs[i].startOnosCli,
- threadID=main.threadID,
- name="startOnosCli",
- args=[ main.ONOSip[i] ],
- kwargs = {"onosStartTimeout":main.timeout} )
- pool.append(t)
- t.start()
- main.threadID = main.threadID + 1
- for t in pool:
- t.join()
- startCliResult = startCliResult and t.result
- time.sleep( main.startUpSleep )
-
- def CASE10( self, main ):
- """
- Setting up null-provider
- """
- import json
- # Activate apps
- main.step("Activating null-provider")
- appStatus = utilities.retry( main.CLIs[0].activateApp,
- main.FALSE,
- ['org.onosproject.null'],
- sleep=main.verifySleep,
- attempts=main.verifyAttempts )
- utilities.assert_equals( expect=main.TRUE,
- actual=appStatus,
- onpass="Successfully activated null-provider",
- onfail="Failed activate null-provider" )
-
- # Setup the null-provider
- main.step("Configuring null-provider")
- cfgStatus = utilities.retry( main.ONOSbench.onosCfgSet,
- main.FALSE,
- [ main.ONOSip[0],
- 'org.onosproject.provider.nil.NullProviders', 'deviceCount 8'],
- sleep=main.verifySleep,
- attempts = main.verifyAttempts )
- cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
- main.FALSE,
- [ main.ONOSip[0],
- 'org.onosproject.provider.nil.NullProviders', 'topoShape reroute'],
- sleep=main.verifySleep,
- attempts = main.verifyAttempts )
-
- cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
- main.FALSE,
- [ main.ONOSip[0],
- 'org.onosproject.provider.nil.NullProviders', 'enabled true'],
- sleep=main.verifySleep,
- attempts = main.verifyAttempts )
-
-
- utilities.assert_equals( expect=main.TRUE,
- actual=cfgStatus,
- onpass="Successfully configured null-provider",
- onfail="Failed to configure null-provider" )
-
- # give onos some time to settle
- time.sleep(main.startUpSleep)
-
- main.log.info("Setting default flows to zero")
- main.defaultFlows = 0
-
- main.step("Check status of null-provider setup")
- caseResult = appStatus and cfgStatus
- utilities.assert_equals( expect=main.TRUE,
- actual=caseResult,
- onpass="Setting up null-provider was successfull",
- onfail="Failed to setup null-provider" )
-
- # This tells the following cases if we are using the null-provider or ovs
- main.switchType = "null:"
-
- # If the null-provider setup was unsuccessfull, then there is no point to
- # run the subsequent cases
-
- time.sleep(main.startUpSleep)
- main.step( "Balancing Masters" )
-
- stepResult = main.FALSE
- stepResult = utilities.retry( main.CLIs[0].balanceMasters,
- main.FALSE,
- [],
- sleep=3,
- attempts=3 )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Balance masters was successfull",
- onfail="Failed to balance masters")
-
- time.sleep( 5 )
- if not caseResult:
- main.setupSkipped = True
-
- def CASE11( self, main):
- '''
- Setting up mininet
- '''
- import json
- import time
- devices = []
- devices = main.CLIs[0].getAllDevicesId()
- for d in devices:
- main.CLIs[0].deviceRemove( d )
-
- main.log.info("Set Intent Compiler use Flow Object")
- main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
- "useFlowObjectives", "true")
- time.sleep(main.startUpSleep)
- main.step('Starting mininet topology')
- mnStatus = main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py')
- utilities.assert_equals( expect=main.TRUE,
- actual=mnStatus,
- onpass="Successfully started Mininet",
- onfail="Failed to activate Mininet" )
-
- main.step("Assinging masters to switches")
- switches = main.Mininet1.getSwitches()
- swStatus = main.Mininet1.assignSwController( sw=switches.keys(), ip=main.ONOSip )
- utilities.assert_equals( expect=main.TRUE,
- actual=swStatus,
- onpass="Successfully assigned switches to masters",
- onfail="Failed assign switches to masters" )
-
- time.sleep(main.startUpSleep)
- # Balancing Masters
- main.step( "Balancing Masters" )
- stepResult = main.FALSE
- stepResult = utilities.retry( main.CLIs[0].balanceMasters,
- main.FALSE,
- [],
- sleep=3,
- attempts=3 )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Balance masters was successfull",
- onfail="Failed to balance masters" )
-
- main.log.info("Getting default flows")
- jsonSum = json.loads(main.CLIs[0].summary())
- main.defaultFlows = jsonSum["flows"]
-
- main.step("Check status of Mininet setup")
- caseResult = mnStatus and swStatus
- utilities.assert_equals( expect=main.TRUE,
- actual=caseResult,
- onpass="Successfully setup Mininet",
- onfail="Failed setup Mininet" )
-
- # This tells the following cases if we are using the null-provider or ovs
- main.switchType = "of:"
-
- time.sleep(main.startUpSleep)
- main.step( "Balancing Masters" )
-
- stepResult = main.FALSE
- stepResult = utilities.retry( main.CLIs[0].balanceMasters,
- main.FALSE,
- [],
- sleep=3,
- attempts=3 )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Balance masters was successfull",
- onfail="Failed to balance masters")
-
- time.sleep(5)
- if not caseResult:
- main.setupSkipped = True
-
-
-
- def CASE20( self, main ):
- if main.reroute:
- main.minIntents = int(main.params['NULL']['REROUTE']['min_intents'])
- main.maxIntents = int(main.params['NULL']['REROUTE']['max_intents'])
- main.checkInterval = int(main.params['NULL']['REROUTE']['check_interval'])
- main.batchSize = int(main.params['NULL']['REROUTE']['batch_size'])
- else:
- main.minIntents = int(main.params['NULL']['PUSH']['min_intents'])
- main.maxIntents = int(main.params['NULL']['PUSH']['max_intents'])
- main.checkInterval = int(main.params['NULL']['PUSH']['check_interval'])
- main.batchSize = int(main.params['NULL']['PUSH']['batch_size'])
-
- # check if the case needs to be skipped
- if main.setupSkipped:
- main.setupSkipped = False
- main.skipCase()
-
- # the index where the next intents will be installed
- offfset = 0
- # keeps track of how many intents have been installed
- currIntents = 0
- # keeps track of how many flows have been installed, set to 0 at start
- currFlows = 0
- # limit for the number of intents that can be installed
- main.batchSize = int( int(main.batchSize)/int(main.numCtrls))
- limit = main.maxIntents / main.batchSize
- # total intents installed
- totalIntents = 0
-
- intentsState = None
-
- offtmp = 0
- main.step( "Pushing intents" )
- stepResult = main.TRUE
- # temp variable to contain the number of flows
- flowsNum = 0
- if main.numCtrls > 1:
- # if more than one onos nodes, we should check more frequently
- main.checkInterval = main.checkInterval/4
-
- # make sure the checkInterval divisible batchSize
- main.checkInterval = int( int( main.checkInterval / main.batchSize ) * main.batchSize )
- flowTemp=0
- totalFlows=0
- verifyTotalIntents=0
- for i in range(limit):
-
- # Threads pool
- pool = []
-
- for j in range( int( main.numCtrls) ):
- if main.numCtrls > 1:
- time.sleep( 1 )
- offtmp = offfset + main.maxIntents * j
- # Push intents by using threads
- t = main.Thread( target=main.CLIs[j].pushTestIntents,
- threadID=main.threadID,
- name="Push-Test-Intents",
- args=[ main.switchType + main.ingress,
- main.switchType + main.egress,
- main.batchSize ],
- kwargs={ "offset": offtmp,
- "options": "-i",
- "timeout": main.timeout,
- "background":False,
- "noExit":True} )
- pool.append(t)
- t.start()
- main.threadID = main.threadID + 1
- for t in pool:
- t.join()
- stepResult = stepResult and t.result
- offfset = offfset + main.batchSize
-
- totalIntents = main.batchSize * main.numCtrls + totalIntents
- if totalIntents >= main.minIntents and totalIntents % main.checkInterval == 0:
- # if reach to minimum number and check interval, verify Intetns and flows
- time.sleep( main.verifySleep * main.numCtrls )
-
- main.log.info("Verify Intents states")
- # k is a control variable for verify retry attempts
- k = 1
-
- while k <= main.verifyAttempts:
- # while loop for check intents by using REST api
- time.sleep(5)
- temp = 0
- intentsState = main.CLIs[0].checkIntentSummary(timeout=600)
- if intentsState:
- verifyTotalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600)
- if temp < verifyTotalIntents:
- temp = verifyTotalIntents
- else:
- verifyTotalIntents = temp
- break
- main.log.info("Total Intents: {}".format( totalIntents) )
- k = k+1
-
- totalFlows = main.CLIs[0].getTotalFlowsNum( timeout=600, noExit=True )
- if flowTemp<totalFlows:
- flowTemp = totalFlows
- else:
- totalFlows = flowTemp
-
- if not intentsState:
- # If some intents are not installed, grep the previous flows list, and finished this test case
- main.log.warn( "Some intens did not install" )
- verifyTotalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600)
- main.log.info("Total Intents: {}".format( totalIntents) )
- break
-
- del main.scale[0]
- utilities.assert_equals( expect = main.TRUE,
- actual = intentsState,
- onpass = "Successfully pushed and verified intents",
- onfail = "Failed to push and verify intents" )
-
- main.log.info( "Total Intents Installed before crash: {}".format( totalIntents ) )
- main.log.info( "Total Flows ADDED before crash: {}".format( totalFlows ) )
-
- main.step('clean up Mininet')
- main.Mininet1.stopNet()
- main.log.info("Writing results to DS file")
- with open(main.dbFileName, "a") as dbFile:
- # Scale number
- temp = str(main.numCtrls)
- temp += ",'" + "baremetal1" + "'"
- # how many intents we installed before crash
- temp += "," + str(totalIntents)
- # how many flows we installed before crash
- temp += "," + str(totalFlows)
- # other columns in database, but we didn't use in this test
- temp += "," + "0,0,0,0,0,0"
- temp += "\n"
- dbFile.write( temp )
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.topo b/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.topo
deleted file mode 100755
index a1ec149..0000000
--- a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.topo
+++ /dev/null
@@ -1,101 +0,0 @@
-<TOPOLOGY>
-
- <COMPONENT>
-
- <ONOSbench>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS>
- <home>~/onos</home>
- <nodes>7</nodes>
- </COMPONENTS>
- </ONOSbench>
-
- <ONOSrest1>
- <host>OC1</host>
- <port>8181</port>
- <user>onos</user>
- <password>rocks</password>
- <type>OnosRestDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS>
- </COMPONENTS>
- </ONOSrest1>
- <ONOScli1>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli1>
-
- <ONOScli2>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli2>
-
- <ONOScli3>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli3>
-
- <ONOScli4>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli4>
-
- <ONOScli5>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>6</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli5>
-
- <ONOScli6>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>7</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli6>
-
- <ONOScli7>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>8</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli7>
-
- <Mininet1>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>MininetCliDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS>
- </COMPONENTS>
- </Mininet1>
-
- </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/__init__.py b/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/__init__.py
+++ /dev/null
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/dependencies/rerouteTopo.py b/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/dependencies/rerouteTopo.py
deleted file mode 100755
index 774f12f..0000000
--- a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/dependencies/rerouteTopo.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/python
-
-"""
-Custom topology for Mininet
-"""
-from mininet.topo import Topo
-from mininet.net import Mininet
-from mininet.node import Host, RemoteController
-from mininet.node import Node
-from mininet.link import TCLink
-from mininet.cli import CLI
-from mininet.log import setLogLevel
-from mininet.util import dumpNodeConnections
-from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
-
-class MyTopo( Topo ):
-
- def __init__( self ):
- # Initialize topology
- Topo.__init__( self )
-
- host1 = self.addHost('h1', ip='10.1.0.1/24')
- host2 = self.addHost('h2', ip='10.1.0.2/24')
- host3 = self.addHost('h3', ip='10.1.0.3/24')
- host4 = self.addHost('h4', ip='10.1.0.4/24')
- host5 = self.addHost('h5', ip='10.1.0.5/24')
- host6 = self.addHost('h6', ip='10.1.0.6/24')
- host7 = self.addHost('h7', ip='10.1.0.7/24')
-
- s1 = self.addSwitch( 's1' )
- s2 = self.addSwitch( 's2' )
- s3 = self.addSwitch( 's3' )
- s4 = self.addSwitch( 's4' )
- s5 = self.addSwitch( 's5' )
- s6 = self.addSwitch( 's6' )
- s7 = self.addSwitch( 's7' )
- s8 = self.addSwitch( 's8' )
-
-
- self.addLink(s1, host1)
- self.addLink(s2, host2)
- self.addLink(s3, host3)
- self.addLink(s4, host4)
- self.addLink(s5, host5)
- self.addLink(s6, host6)
- self.addLink(s7, host7)
-
-
-
- self.addLink(s1,s2)
- self.addLink(s2,s3)
- self.addLink(s3,s4)
- self.addLink(s4,s5)
- self.addLink(s5,s6)
- self.addLink(s6,s7)
- self.addLink(s4,s8)
- self.addLink(s8,s5)
-
- topos = { 'mytopo': ( lambda: MyTopo() ) }
-
-# HERE THE CODE DEFINITION OF THE TOPOLOGY ENDS
-
-def setupNetwork():
- "Create network"
- topo = MyTopo()
- network = Mininet(topo=topo, autoSetMacs=True, controller=None)
- network.start()
- CLI( network )
- network.stop()
-
-if __name__ == '__main__':
- setLogLevel('info')
- #setLogLevel('debug')
- setupNetwork()
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/dependencies/startUp.py b/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/dependencies/startUp.py
deleted file mode 100644
index bf2a2b6..0000000
--- a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/dependencies/startUp.py
+++ /dev/null
@@ -1,38 +0,0 @@
-"""
- This wrapper function is use for starting up onos instance
-"""
-
-import time
-import os
-import json
-
-def onosBuild( main, gitBranch ):
- """
- This includes pulling ONOS and building it using maven install
- """
-
- buildResult = main.FALSE
-
- # Git checkout a branch of ONOS
- checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
- # Does the git pull on the branch that was checked out
- if not checkOutResult:
- main.log.warn( "Failed to checked out " + gitBranch +
- " branch")
- else:
- main.log.info( "Successfully checked out " + gitBranch +
- " branch")
- gitPullResult = main.ONOSbench.gitPull()
- if gitPullResult == main.ERROR:
- main.log.error( "Error pulling git branch" )
- else:
- main.log.info( "Successfully pulled " + gitBranch + " branch" )
-
- # Maven clean install
- buildResult = main.ONOSbench.cleanInstall()
-
- return buildResult
-
-
-
-
diff --git a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.params b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.params
index 6035fba..da371c3 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.params
+++ b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.params
@@ -26,8 +26,7 @@
</CTRL>
<MN>
- <ip1>localhost</ip1>
- <ip2>localhost</ip2>
+ <ip1>OCN</ip1>
</MN>
<BENCH>
diff --git a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
index 7c12549..e905e5a 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
@@ -84,7 +84,7 @@
pullResult = main.TRUE
main.log.info( "Skipped git checkout and pull" )
- main.log.step("Grabbing commit number")
+ main.step("Grabbing commit number")
commit = main.ONOSbench.getVersion() ####
commit = (commit.split(" "))[1]
@@ -103,17 +103,17 @@
# -- END OF INIT SECTION --#
- main.log.step("Adjusting scale")
+ main.step("Adjusting scale")
clusterCount = int(scale[0])
scale.remove(scale[0])
#kill off all onos processes
- main.log.step("Safety check, killing all ONOS processes before initiating environment setup")
+ main.step("Safety check, killing all ONOS processes before initiating environment setup")
for node in range(main.maxNodes):
main.ONOSbench.onosDie(main.ONOSIp[node])
#Uninstall everywhere
- main.log.step( "Cleaning Enviornment..." )
+ main.step( "Cleaning Enviornment..." )
for i in range(main.maxNodes):
main.log.info(" Uninstalling ONOS " + str(i) )
main.ONOSbench.onosUninstall( main.ONOSIp[i] )
diff --git a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.topo b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.topo
index 8b05fd0..4addd4a 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.topo
+++ b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.topo
@@ -87,7 +87,7 @@
</ONOS1>
<Mininet1>
- <host>localhost</host>
+ <host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/README.md b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/README.md
new file mode 100755
index 0000000..21e7773
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/README.md
@@ -0,0 +1,22 @@
+This test verifies control plane resilience from a CLUSTER restart
+
+It consists of
+
+1) Configure and Install ONOS
+2) Start Mininet and check flow state
+3) Pingall
+4) Induce a CLUSTER restart
+5) check flow state
+6) Pingall
+
+Requirements
+
+ - An updated version of the CPQD switch has to be running to make sure it supports group chaining.
+
+The test is executed using the netcfg subsystem:
+ 1) APPS=openflow-base,netcfghostprovider,netcfglinksprovider
+
+The test runs for different topologies:
+ - 2x2 Leaf-Spine and 3-node ONOS cluster
+ - 4x4 Leaf-Spine and 3-node ONOS cluster
+ - Single switch and 3-node ONOS cluster
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.params b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.params
similarity index 100%
copy from TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.params
copy to TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.params
diff --git a/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.py b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.py
new file mode 100755
index 0000000..ae70e00
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.py
@@ -0,0 +1,106 @@
+# CASE1: 2x2 topo + 3-node ONOS CLUSTER + IP connectivity test + CLUSTER restart
+# CASE2: 4x4 topo + 3-node ONOS CLUSTER + IP connectivity test + CLUSTER restart
+# CASE3: Single switch + 3-node ONOS CLUSTER + IP connectivity test + CLUSTER restart
+
+class SRClusterRestart:
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ Sets up 3-node Onos-cluster
+ Start 2x2 Leaf-Spine topology
+ Pingall
+ Induce CLUSTER restart
+ Pingall
+ """
+ description = "Cluster Restart test with 2x2 Leaf-spine "
+ main.case( description )
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ main.cfgName = '2x2'
+ main.numCtrls = 3
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py' )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, "CASE1" )
+ run.killOnos( main, [ 0, 1, 2 ], '4', '8', '0' )
+ run.pingAll( main, 'CASE1_Failure', dumpflows=False )
+ run.recoverOnos( main, [ 0, 1, 2 ], '4', '8', '3' )
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, 'CASE1_Failure' )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE2( self, main ):
+ """
+ Sets up 3-node Onos-cluster
+ Start 4x4 Leaf-Spine topology
+ Pingall
+ Induce Cluster Restart
+ Pingall
+ """
+ description = "Cluster Restart test with 4x4 Leaf-spine "
+ main.case( description )
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ main.cfgName = '4x4'
+ main.numCtrls = 3
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, 'CASE2' )
+ run.killOnos( main, [ 0, 1, 2 ], '8', '32', '0' )
+ run.pingAll( main, 'CASE2_Failure', dumpflows=False )
+ run.recoverOnos( main, [ 0, 1, 2 ], '8', '32', '3' )
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, 'CASE3_Recovery' )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE3( self, main ):
+ """
+ Sets up 3-node Onos-cluster
+ Start single switch topology
+ Pingall
+ Induce Cluster Restart
+ Pingall
+ """
+ description = "Cluster Restart test with single switch "
+ main.case( description )
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ main.cfgName = '0x1'
+ main.numCtrls = 3
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=1 --spine=0" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=15 )
+ run.pingAll( main, 'CASE3' )
+ run.killOnos( main, [ 0, 1, 2 ], '1', '0', '0' )
+ run.pingAll( main, 'CASE3_Failure', dumpflows=False )
+ run.recoverOnos( main, [ 0, 1, 2 ], '1', '0', '3' )
+ run.checkFlows( main, minFlowCount=15 )
+ run.pingAll( main, 'CASE3_Failure' )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.topo b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.topo
similarity index 61%
rename from TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.topo
rename to TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.topo
index 546a023..c531f7d 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.topo
+++ b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.topo
@@ -42,13 +42,45 @@
</COMPONENTS>
</ONOScli3>
+ <ONOSrest1>
+ <host>OC1</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest1>
+
+ <ONOSrest2>
+ <host>OC2</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest2>
+
+ <ONOSrest3>
+ <host>OC3</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest3>
<Mininet1>
<host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
- <connect_order>5</connect_order>
+ <connect_order>7</connect_order>
<COMPONENTS>
<home>~/mininet/custom/</home>
</COMPONENTS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/__init__.py
similarity index 100%
copy from TestON/tests/USECASE/SegmentRouting/SRLinkDown/__init__.py
copy to TestON/tests/USECASE/SegmentRouting/SRClusterRestart/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.py b/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.py
deleted file mode 100755
index db5469d..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.py
+++ /dev/null
@@ -1,107 +0,0 @@
-# This test should always succeed. it runs cases 1,2,3,4
-#CASE1: Get and Build ONOS
-#CASE2: Package and Install ONOS
-#CASE3: Start Mininet and check flows
-#CASE4: Ping all
-#CASE5: Link Failure
-#CASE6: Switch Failure
-#CASE7: ONOS Failure
-#CASE8: CLUSTER Failure
-#CASE10: Logging
-
-class SRLinkDown:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ):
- """
- Sets up 1-node Onos-cluster
- Start 2x2 Leaf-Spine topology
- Pingall
- """
- from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
- if not hasattr(main,'apps'):
- run.initTest(main)
-
- description = "Bridging and Routing sanity test with 2x2 Leaf-spine "
- main.case( description )
-
- main.cfgName = '2x2'
- main.numCtrls = 1
- run.installOnos(main)
- run.startMininet(main, 'cord_fabric.py')
- #pre-configured routing and bridging test
- run.checkFlows(main, flowCount=116)
- run.pingAll(main)
- run.killLink(main, 'spine101', 'leaf2', switches='4', links='6')
- run.pingAll(main, "CASE1_AfterLinkDown")
- run.restoreLink(main, 'spine101', 'leaf2','of:0000000000000101',
- 'of:0000000000000002', '2', '1', '4', '8')
- run.pingAll(main, "CASE1_AfterLinkUp")
- #TODO Dynamic config of hosts in subnet
- #TODO Dynamic config of host not in subnet
- #TODO Dynamic config of vlan xconnect
- #TODO Vrouter integration
- #TODO Mcast integration
- run.cleanup(main)
-
- def CASE2( self, main ):
- """
- Sets up 1-node Onos-cluster
- Start 4x4 Leaf-Spine topology
- Pingall
- """
- from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
- if not hasattr(main,'apps'):
- run.initTest(main)
- description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
- main.case( description )
- main.cfgName = '4x4'
- main.numCtrls = 1
- run.installOnos(main)
- run.startMininet(main, 'cord_fabric.py', args="--leaf=4 --spine=4")
- #pre-configured routing and bridging test
- run.checkFlows(main, flowCount=350)
- run.pingAll(main)
- run.killLink(main, 'spine101', 'leaf2', switches='8', links='30')
- run.pingAll(main, "CASE2_AfterLinkDown")
- run.restoreLink(main, 'spine101', 'leaf2','of:0000000000000101',
- 'of:0000000000000002', '2', '1', '8', '32')
- run.pingAll(main, "CASE2_AfterLinkUp")
- #TODO Dynamic config of hosts in subnet
- #TODO Dynamic config of host not in subnet
- #TODO preconfigured xconnect
- #TODO Vrouter integration
- #TODO Mcast integration
- run.cleanup(main)
-
- def CASE3( self, main ):
- """
- Sets up 3-node Onos-cluster
- Start 2x2 Leaf-Spine topology
- Pingall
- """
- from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
- if not hasattr(main,'apps'):
- run.initTest(main)
- description = "Bridging and Routing sanity test with 2x2 Leaf-spine "
- main.case( description )
- main.cfgName = '2x2'
- main.numCtrls = 3
- run.installOnos(main)
- run.startMininet(main, 'cord_fabric.py')
- #pre-configured routing and bridging test
- run.checkFlows(main, flowCount=116)
- run.pingAll(main)
- run.killLink(main, 'spine101', 'leaf2', switches='4', links='6')
- run.pingAll(main, "CASE3_AfterLinkDown")
- run.restoreLink(main, 'spine101', 'leaf2','of:0000000000000101',
- 'of:0000000000000002', '2', '1', '4', '8')
- run.pingAll(main, "CASE3_AfterLinkUp")
- #TODO Dynamic config of hosts in subnet
- #TODO Dynamic config of host not in subnet
- #TODO Dynamic config of vlan xconnect
- #TODO Vrouter integration
- #TODO Mcast integration
- run.cleanup(main)
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/README.md b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/README.md
similarity index 100%
rename from TestON/tests/USECASE/SegmentRouting/SRLinkDown/README.md
rename to TestON/tests/USECASE/SegmentRouting/SRLinkFailure/README.md
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.params b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.params
new file mode 100755
index 0000000..8f3ade9
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.params
@@ -0,0 +1,46 @@
+<PARAMS>
+
+ <testcases>1,2,4,5</testcases>
+
+ <SCALE>
+ <size>3</size>
+ <max>3</max>
+ </SCALE>
+
+ <DEPENDENCY>
+ <wrapper1>startUp</wrapper1>
+ <topology>cord_fabric.py</topology>
+ </DEPENDENCY>
+
+ <ENV>
+ <cellName>productionCell</cellName>
+ <cellApps>drivers,segmentrouting</cellApps>
+ <diffApps>openflow-base,netcfghostprovider,netcfglinksprovider</diffApps>
+ <cellUser>sdn</cellUser>
+ </ENV>
+
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+
+ <CTRL>
+ <port>6653</port>
+ </CTRL>
+
+ <timers>
+ <LinkDiscovery>12</LinkDiscovery>
+ <SwitchDiscovery>12</SwitchDiscovery>
+ </timers>
+
+ <kill>
+ <switch> spine101 </switch>
+ <dpid> 000000000101 </dpid>
+ <links> leaf1 leaf2 </links>
+ </kill>
+
+ <SLEEP>
+ <startup>10</startup>
+ </SLEEP>
+
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.py b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.py
new file mode 100755
index 0000000..b388a64
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.py
@@ -0,0 +1,147 @@
+# In this test we perform a link failure and then test for connectivity
+# CASE1: 2x2 topo + link failure + IP connectivity test
+# CASE2: 4x4 topo + link failure + IP connectivity test
+# CASE4: 2x2 topo + 3-node ONOS CLUSTER + link failure + IP connectivity test
+# CASE5: 4x4 topo + 3-node ONOS CLUSTER + link failure + IP connectivity test
+
+class SRLinkFailure:
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ Sets up 1-node Onos-cluster
+ Start 2x2 Leaf-Spine topology
+ Pingall
+ Cause link failure
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+
+ description = "Bridging and Routing sanity test with 2x2 Leaf-spine "
+ main.case( description )
+
+ main.cfgName = '2x2'
+ main.numCtrls = 1
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py' )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main )
+ # link failure
+ run.killLink( main, 'spine101', 'leaf2', switches='4', links='6' )
+ run.pingAll( main, "CASE1_Failure" )
+ run.restoreLink( main, 'spine101', 'leaf2', 'of:0000000000000101',
+ 'of:0000000000000002', '2', '1', '4', '8' )
+ run.pingAll( main, "CASE1_Recovery" )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE2( self, main ):
+ """
+ Sets up 1-node Onos-cluster
+ Start 4x4 Leaf-Spine topology
+ Pingall
+ Cause link failure
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
+ main.case( description )
+ main.cfgName = '4x4'
+ main.numCtrls = 1
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main )
+ # link failure
+ run.killLink( main, 'spine101', 'leaf2', switches='8', links='30' )
+ run.pingAll( main, "CASE2_Failure" )
+ run.restoreLink( main, 'spine101', 'leaf2', 'of:0000000000000101',
+ 'of:0000000000000002', '2', '1', '8', '32' )
+ run.pingAll( main, "CASE2_Recovery" )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO preconfigured xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE4( self, main ):
+ """
+ Sets up 3-node Onos-cluster
+ Start 2x2 Leaf-Spine topology
+ Pingall
+ Cause link failure
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ description = "Bridging and Routing sanity test with 2x2 Leaf-spine "
+ main.case( description )
+ main.cfgName = '2x2'
+ main.numCtrls = 3
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py' )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main )
+ # link failure
+ run.killLink( main, 'spine101', 'leaf2', switches='4', links='6' )
+ run.pingAll( main, "CASE3_Failure" )
+ run.restoreLink( main, 'spine101', 'leaf2', 'of:0000000000000101',
+ 'of:0000000000000002', '2', '1', '4', '8' )
+ run.pingAll( main, "CASE3_Recovery" )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE5( self, main ):
+ """
+ Sets up 1-node Onos-cluster
+ Start 4x4 Leaf-Spine topology
+ Pingall
+ Cause link failure
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
+ main.case( description )
+ main.cfgName = '4x4'
+ main.numCtrls = 3
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main )
+ # link failure
+ run.killLink( main, 'spine101', 'leaf2', switches='8', links='30' )
+ run.pingAll( main, "CASE2_Failure" )
+ run.restoreLink( main, 'spine101', 'leaf2', 'of:0000000000000101',
+ 'of:0000000000000002', '2', '1', '8', '32' )
+ run.pingAll( main, "CASE2_Recovery" )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO preconfigured xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.topo b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.topo
similarity index 61%
copy from TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.topo
copy to TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.topo
index 546a023..2d69c35 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.topo
+++ b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.topo
@@ -21,7 +21,7 @@
<COMPONENTS>
</COMPONENTS>
</ONOScli1>
-
+
<ONOScli2>
<host>OC2</host>
<user>sdn</user>
@@ -42,13 +42,45 @@
</COMPONENTS>
</ONOScli3>
+ <ONOSrest1>
+ <host>OC1</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest1>
+
+ <ONOSrest2>
+ <host>OC2</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest2>
+
+ <ONOSrest3>
+ <host>OC3</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest3>
<Mininet1>
<host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
- <connect_order>5</connect_order>
+ <connect_order>8</connect_order>
<COMPONENTS>
<home>~/mininet/custom/</home>
</COMPONENTS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/__init__.py
similarity index 100%
rename from TestON/tests/USECASE/SegmentRouting/SRLinkDown/__init__.py
rename to TestON/tests/USECASE/SegmentRouting/SRLinkFailure/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/SROnosFailure/README.md b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/README.md
new file mode 100755
index 0000000..94677cb
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/README.md
@@ -0,0 +1,22 @@
+This test verifies basic control plane resilience from an ONOS Instance failure using SegmentRouting via pingall
+
+It consists of
+
+1) Configure and Install ONOS
+2) Start Mininet and check flow state
+3) Pingall
+4) Induce a ONOS failure
+5) check flow state
+6) Pingall
+
+Requirements
+
+ - An updated version of the CPQD switch has to be running to make sure it supports group chaining.
+
+The test is executed using the netcfg subsystem:
+ 1) APPS=openflow-base,netcfghostprovider,netcfglinksprovider
+
+The test runs for different topologies:
+ - 2x2 Leaf-Spine and 3-node ONOS cluster
+ - 4x4 Leaf-Spine and 3-node ONOS cluster
+ - Single switch and 3-node ONOS cluster
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.params b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params
similarity index 100%
rename from TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.params
rename to TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params
diff --git a/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.py b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.py
new file mode 100755
index 0000000..53daa33
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.py
@@ -0,0 +1,106 @@
+# CASE1: 2x2 topo + 3-node ONOS CLUSTER + IP connectivity test + Control plane resilience
+# CASE2: 4x4 topo + 3-node ONOS CLUSTER + IP connectivity test + Control plane resilience
+# CASE3: Single switch + 3-node ONOS CLUSTER + IP connectivity test + Control plane resilience
+
+class SROnosFailure:
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ Sets up 3-node Onos-cluster
+ Start 2x2 Leaf-Spine topology
+ Pingall
+ Induce ONOS Failure
+ Pingall
+ """
+ description = "ONOS Failure test with 2x2 Leaf-spine "
+ main.case( description )
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ main.cfgName = '2x2'
+ main.numCtrls = 3
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py' )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, "CASE1" )
+ run.killOnos( main, [ 0 ], '4', '8', '2' )
+ run.pingAll( main, 'CASE1_Failure' )
+ run.recoverOnos( main, [ 0 ], '4', '8', '3' )
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, 'CASE1_Failure' )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE2( self, main ):
+ """
+ Sets up 3-node Onos-cluster
+ Start 4x4 Leaf-Spine topology
+ Pingall
+ Induce ONOS Failure
+ Pingall
+ """
+ description = "ONOS Failure test with 4x4 Leaf-spine "
+ main.case( description )
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ main.cfgName = '4x4'
+ main.numCtrls = 3
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, 'CASE2' )
+ run.killOnos( main, [ 0 ], '8', '32', '2' )
+ run.pingAll( main, 'CASE2_Failure' )
+ run.recoverOnos( main, [ 0 ], '8', '32', '3' )
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, 'CASE3_Recovery' )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE3( self, main ):
+ """
+ Sets up 3-node Onos-cluster
+ Start single switch topology
+ Pingall
+ Induce ONOS Failure
+ Pingall
+ """
+ description = "ONOS Failure test with single switch "
+ main.case( description )
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ main.cfgName = '0x1'
+ main.numCtrls = 3
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=1 --spine=0" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=15 )
+ run.pingAll( main, 'CASE3' )
+ run.killOnos( main, [ 0 ], '1', '0', '2' )
+ run.pingAll( main, 'CASE3_Failure' )
+ run.recoverOnos( main, [ 0 ], '1', '0', '3' )
+ run.checkFlows( main, minFlowCount=15 )
+ run.pingAll( main, 'CASE3_Failure' )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.topo b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.topo
similarity index 61%
copy from TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.topo
copy to TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.topo
index 546a023..c531f7d 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.topo
+++ b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.topo
@@ -42,13 +42,45 @@
</COMPONENTS>
</ONOScli3>
+ <ONOSrest1>
+ <host>OC1</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest1>
+
+ <ONOSrest2>
+ <host>OC2</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest2>
+
+ <ONOSrest3>
+ <host>OC3</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest3>
<Mininet1>
<host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
- <connect_order>5</connect_order>
+ <connect_order>7</connect_order>
<COMPONENTS>
<home>~/mininet/custom/</home>
</COMPONENTS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/__init__.py b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/__init__.py
similarity index 100%
copy from TestON/tests/USECASE/SegmentRouting/SRLinkDown/__init__.py
copy to TestON/tests/USECASE/SegmentRouting/SROnosFailure/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSanity/README.md b/TestON/tests/USECASE/SegmentRouting/SRSanity/README.md
index 59c1214..e20287e 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRSanity/README.md
+++ b/TestON/tests/USECASE/SegmentRouting/SRSanity/README.md
@@ -1,7 +1,6 @@
-This test verifies basic connectivity using SegmentRouting via pingall,
-it should not fail.
+This test verifies basic IP connectivity using SegmentRouting via pingall
-It consists of
+It consists of
1) Configure and Install ONOS
2) Start Mininet and check flow state
@@ -13,4 +12,10 @@
The test is executed using the netcfg subsystem:
1) APPS=openflow-base,netcfghostprovider,netcfglinksprovider
-The topology is a 2x2 Leaf-spine
+The test runs for different topologies:
+ - 2x2 Leaf-Spine and 1-node ONOS cluster
+ - 4x4 Leaf-Spine and 1-node ONOS cluster
+ - Single switch and 1-node ONOS cluster
+ - 2x2 Leaf-Spine and 3-node ONOS cluster
+ - 4x4 Leaf-Spine and 3-node ONOS cluster
+ - Single switch and 3-node ONOS cluster
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.params b/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.params
index 1a58556..a757a48 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>1,2,3</testcases>
+ <testcases>1,2,3,4,5,6</testcases>
<SCALE>
<size>3</size>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.py b/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.py
index 77e90e3..e62dc78 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.py
@@ -1,10 +1,11 @@
-# This test should always succeed. it runs cases 1,2,3
-#CASE1: 2x2 Leaf-Spine topo and test IP connectivity
-#CASE2: 4x4 topo + IP connectivity test
-#CASE3: 2x2 topo + 3-node ONOS CLUSTER + IP connectivity test
+# CASE1: 2x2 Leaf-Spine topo and test IP connectivity
+# CASE2: 4x4 topo + IP connectivity test
+# CASE3: Single switch topo + IP connectivity test
+# CASE4: 2x2 topo + 3-node ONOS CLUSTER + IP connectivity test
+# CASE5: 4x4 topo + 3-node ONOS CLUSTER + IP connectivity test
+# CASE6: Single switch + 3-node ONOS CLUSTER + IP connectivity test
class SRSanity:
-
def __init__( self ):
self.default = ''
@@ -14,26 +15,27 @@
Start 2x2 Leaf-Spine topology
Pingall
"""
- from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
- if not hasattr(main,'apps'):
- run.initTest(main)
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
description = "Bridging and Routing sanity test with 2x2 Leaf-spine "
main.case( description )
main.cfgName = '2x2'
main.numCtrls = 1
- run.installOnos(main)
- run.startMininet(main, 'cord_fabric.py')
- #pre-configured routing and bridging test
- run.checkFlows(main, flowCount=116)
- run.pingAll(main, "CASE1")
- #TODO Dynamic config of hosts in subnet
- #TODO Dynamic config of host not in subnet
- #TODO Dynamic config of vlan xconnect
- #TODO Vrouter integration
- #TODO Mcast integration
- run.cleanup(main)
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py' )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, "CASE1" )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
def CASE2( self, main ):
"""
@@ -41,46 +43,126 @@
Start 4x4 Leaf-Spine topology
Pingall
"""
- from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
- if not hasattr(main,'apps'):
- run.initTest(main)
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
main.case( description )
main.cfgName = '4x4'
main.numCtrls = 1
- run.installOnos(main)
- run.startMininet(main, 'cord_fabric.py', args="--leaf=4 --spine=4")
- #pre-configured routing and bridging test
- run.checkFlows(main, flowCount=350)
- run.pingAll(main, 'CASE2')
- #TODO Dynamic config of hosts in subnet
- #TODO Dynamic config of host not in subnet
- #TODO Dynamic config of vlan xconnect
- #TODO Vrouter integration
- #TODO Mcast integration
- run.cleanup(main)
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, 'CASE2' )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
def CASE3( self, main ):
"""
+ Sets up 1-node Onos-cluster
+ Start single switch topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ description = "Bridging and Routing sanity test with single switch "
+ main.case( description )
+ main.cfgName = '0x1'
+ main.numCtrls = 1
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=1 --spine=0" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=15 )
+ run.pingAll( main, 'CASE3' )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE4( self, main ):
+ """
Sets up 3-node Onos-cluster
Start 2x2 Leaf-Spine topology
Pingall
"""
- from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
- if not hasattr(main,'apps'):
- run.initTest(main)
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
description = "Bridging and Routing sanity test with 2x2 Leaf-spine "
main.case( description )
main.cfgName = '2x2'
main.numCtrls = 3
- run.installOnos(main)
- run.startMininet(main, 'cord_fabric.py')
- #pre-configured routing and bridging test
- run.checkFlows(main, flowCount=116)
- run.pingAll(main, 'CASE3')
- #TODO Dynamic config of hosts in subnet
- #TODO Dynamic config of host not in subnet
- #TODO Dynamic config of vlan xconnect
- #TODO Vrouter integration
- #TODO Mcast integration
- run.cleanup(main)
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py' )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, 'CASE4' )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE5( self, main ):
+ """
+ Sets up 3-node Onos-cluster
+ Start 4x4 Leaf-Spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
+ main.case( description )
+ main.cfgName = '4x4'
+ main.numCtrls = 3
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, 'CASE5' )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE6( self, main ):
+ """
+ Sets up 3-node Onos-cluster
+ Start single switch topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ description = "Bridging and Routing sanity test with single switch "
+ main.case( description )
+ main.cfgName = '0x1'
+ main.numCtrls = 3
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=1 --spine=0" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=15 )
+ run.pingAll( main, 'CASE4' )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.topo b/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.topo
index 546a023..c531f7d 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.topo
+++ b/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.topo
@@ -42,13 +42,45 @@
</COMPONENTS>
</ONOScli3>
+ <ONOSrest1>
+ <host>OC1</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest1>
+
+ <ONOSrest2>
+ <host>OC2</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest2>
+
+ <ONOSrest3>
+ <host>OC3</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest3>
<Mininet1>
<host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
- <connect_order>5</connect_order>
+ <connect_order>7</connect_order>
<COMPONENTS>
<home>~/mininet/custom/</home>
</COMPONENTS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/README.md b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/README.md
similarity index 100%
copy from TestON/tests/USECASE/SegmentRouting/SRLinkDown/README.md
copy to TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/README.md
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.params b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.params
new file mode 100755
index 0000000..8f3ade9
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.params
@@ -0,0 +1,46 @@
+<PARAMS>
+
+ <testcases>1,2,4,5</testcases>
+
+ <SCALE>
+ <size>3</size>
+ <max>3</max>
+ </SCALE>
+
+ <DEPENDENCY>
+ <wrapper1>startUp</wrapper1>
+ <topology>cord_fabric.py</topology>
+ </DEPENDENCY>
+
+ <ENV>
+ <cellName>productionCell</cellName>
+ <cellApps>drivers,segmentrouting</cellApps>
+ <diffApps>openflow-base,netcfghostprovider,netcfglinksprovider</diffApps>
+ <cellUser>sdn</cellUser>
+ </ENV>
+
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+
+ <CTRL>
+ <port>6653</port>
+ </CTRL>
+
+ <timers>
+ <LinkDiscovery>12</LinkDiscovery>
+ <SwitchDiscovery>12</SwitchDiscovery>
+ </timers>
+
+ <kill>
+ <switch> spine101 </switch>
+ <dpid> 000000000101 </dpid>
+ <links> leaf1 leaf2 </links>
+ </kill>
+
+ <SLEEP>
+ <startup>10</startup>
+ </SLEEP>
+
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.py b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.py
new file mode 100755
index 0000000..b516cc0
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.py
@@ -0,0 +1,151 @@
+# In this test we perform a switch failure and then test for connectivity
+# CASE1: 2x2 topo + swtich failure + IP connectivity test
+# CASE2: 4x4 topo + switch failure + IP connectivity test
+# CASE4: 2x2 topo + 3-node ONOS CLUSTER + switch failure + IP connectivity test
+# CASE5: 4x4 topo + 3-node ONOS CLUSTER + switch failure + IP connectivity test
+
+class SRSwitchFailure:
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ Sets up 1-node Onos-cluster
+ Start 2x2 Leaf-Spine topology
+ Pingall
+ Cause switch failure
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+
+ description = "Bridging and Routing sanity test with 2x2 Leaf-spine "
+ main.case( description )
+
+ main.cfgName = '2x2'
+ main.numCtrls = 1
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py' )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main )
+ # switch failure\
+ switch = main.params[ 'kill' ][ 'switch' ]
+ run.killSwitch( main, switch, switches='3', links='4' )
+ run.pingAll( main, "CASE1_Failure" )
+ run.recoverSwitch( main, switch, switches='4', links='8' )
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, "CASE1_Recovery" )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE2( self, main ):
+ """
+ Sets up 1-node Onos-cluster
+ Start 4x4 Leaf-Spine topology
+ Pingall
+ Cause switch failure
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
+ main.case( description )
+ main.cfgName = '4x4'
+ main.numCtrls = 1
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main )
+ # switch failure
+ switch = main.params[ 'kill' ][ 'switch' ]
+ run.killSwitch( main, switch, switches='7', links='24' )
+ run.pingAll( main, "CASE2_Failure" )
+ run.recoverSwitch( main, switch, switches='8', links='32' )
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, "CASE2_Recovery" )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO preconfigured xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE4( self, main ):
+ """
+ Sets up 3-node Onos-cluster
+ Start 2x2 Leaf-Spine topology
+ Pingall
+ Cause link failure
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ description = "Bridging and Routing sanity test with 2x2 Leaf-spine "
+ main.case( description )
+ main.cfgName = '2x2'
+ main.numCtrls = 3
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py' )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main )
+ # switch failure
+ switch = main.params[ 'kill' ][ 'switch' ]
+ run.killSwitch( main, switch, switches='3', links='4' )
+ run.pingAll( main, "CASE3_Failure" )
+ run.recoverSwitch( main, switch, switches='4', links='8' )
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, "CASE3_Recovery" )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO Dynamic config of vlan xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
+
+ def CASE5( self, main ):
+ """
+ Sets up 1-node Onos-cluster
+ Start 4x4 Leaf-Spine topology
+ Pingall
+ Cause link failure
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+ description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
+ main.case( description )
+ main.cfgName = '4x4'
+ main.numCtrls = 3
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main )
+ # switch failure
+ switch = main.params[ 'kill' ][ 'switch' ]
+ run.killSwitch( main, switch, switches='7', links='24' )
+ run.pingAll( main, "CASE4_Failure" )
+ run.recoverSwitch( main, switch, switches='8', links='32' )
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, "CASE4_Recovery" )
+ # TODO Dynamic config of hosts in subnet
+ # TODO Dynamic config of host not in subnet
+ # TODO preconfigured xconnect
+ # TODO Vrouter integration
+ # TODO Mcast integration
+ run.cleanup( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.topo b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.topo
similarity index 61%
copy from TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.topo
copy to TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.topo
index 546a023..2d69c35 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/SRLinkDown.topo
+++ b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.topo
@@ -21,7 +21,7 @@
<COMPONENTS>
</COMPONENTS>
</ONOScli1>
-
+
<ONOScli2>
<host>OC2</host>
<user>sdn</user>
@@ -42,13 +42,45 @@
</COMPONENTS>
</ONOScli3>
+ <ONOSrest1>
+ <host>OC1</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest1>
+
+ <ONOSrest2>
+ <host>OC2</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest2>
+
+ <ONOSrest3>
+ <host>OC3</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest3>
<Mininet1>
<host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
- <connect_order>5</connect_order>
+ <connect_order>8</connect_order>
<COMPONENTS>
<home>~/mininet/custom/</home>
</COMPONENTS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkDown/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/__init__.py
similarity index 100%
copy from TestON/tests/USECASE/SegmentRouting/SRLinkDown/__init__.py
copy to TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/0x1.json b/TestON/tests/USECASE/SegmentRouting/dependencies/0x1.json
new file mode 100755
index 0000000..867785a
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/0x1.json
@@ -0,0 +1,64 @@
+{
+ "ports" : {
+ "of:0000000000000001/1" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.1.254/24" ]
+ }
+ ]
+ },
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.1.254/24" ]
+ }
+ ]
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "basic":{ "driver" : "ofdpa-cpqd" },
+ "segmentrouting" : {
+ "name" : "Leaf-R1",
+ "nodeSid" : 1,
+ "routerIp" : "192.168.0.1",
+ "routerMac" : "10:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ }
+ }
+ },
+ "hosts" : {
+ "00:00:00:00:00:01/-1" : {
+ "basic": {
+ "ips": ["10.0.1.1"],
+ "location": "of:0000000000000001/1"
+ }
+ },
+ "00:00:00:00:00:02/-1" : {
+ "basic": {
+ "ips": ["10.0.1.2"],
+ "location": "of:0000000000000001/2"
+ }
+ }
+ },
+ "apps": {
+ "org.onosproject.segmentrouting": {
+ "xconnect": {
+ "of:0000000000000001": [
+ {
+ "vlan": 5,
+ "ports": [3, 4],
+ "name": "OLT 1"
+ },
+ {
+ "vlan": 10,
+ "ports": [3, 5],
+ "name": "OLT 2"
+ }
+ ]
+ }
+ }
+ }
+
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/2x2.json b/TestON/tests/USECASE/SegmentRouting/dependencies/2x2.json
index a5ec00d..d4fa3fb 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/2x2.json
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/2x2.json
@@ -100,5 +100,23 @@
"location": "of:0000000000000002/4"
}
}
+ },
+ "apps": {
+ "org.onosproject.segmentrouting": {
+ "xconnect": {
+ "of:0000000000000001": [
+ {
+ "vlan": 5,
+ "ports": [5, 6],
+ "name": "OLT 1"
+ },
+ {
+ "vlan": 10,
+ "ports": [5, 7],
+ "name": "OLT 2"
+ }
+ ]
+ }
+ }
}
}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/4x4.json b/TestON/tests/USECASE/SegmentRouting/dependencies/4x4.json
index 7442359..55f3225 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/4x4.json
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/4x4.json
@@ -196,5 +196,23 @@
"location": "of:0000000000000004/6"
}
}
+ },
+ "apps": {
+ "org.onosproject.segmentrouting": {
+ "xconnect": {
+ "of:0000000000000001": [
+ {
+ "vlan": 5,
+ "ports": [7, 8],
+ "name": "OLT 1"
+ },
+ {
+ "vlan": 10,
+ "ports": [7, 9],
+ "name": "OLT 2"
+ }
+ ]
+ }
+ }
}
}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 3bbca7d..37c68c0 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -1,6 +1,7 @@
import os
import imp
import time
+import json
from core import utilities
@@ -17,7 +18,6 @@
- Install ONOS package
- Build ONOS package
"""
- main.case( "Constructing test variables and building ONOS" )
main.step( "Constructing test variables" )
# Test variables
main.cellName = main.params[ 'ENV' ][ 'cellName' ]
@@ -25,21 +25,23 @@
main.diff = main.params[ 'ENV' ][ 'diffApps' ]
gitBranch = main.params[ 'GIT' ][ 'branch' ]
main.path = os.path.dirname( main.testFile )
- main.dependencyPath = main.path +"/../dependencies/"
+ main.dependencyPath = main.path + "/../dependencies/"
main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
- main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
+ main.scale = (main.params[ 'SCALE' ][ 'size' ]).split( "," )
main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
- #main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
+ # main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
- main.cellData = {} # for creating cell file
- main.CLIs = []
- main.ONOSip = []
+ main.cellData = { } # for creating cell file
+ main.CLIs = [ ]
+ main.ONOSip = [ ]
+ main.RESTs = [ ]
# Assigning ONOS cli handles to a list
- for i in range( 1, main.maxNodes + 1 ):
+ for i in range( 1, main.maxNodes + 1 ):
main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
- main.ONOSip.append( main.CLIs[i-1].ip_address )
+ main.RESTs.append( getattr( main, 'ONOSrest' + str( i ) ) )
+ main.ONOSip.append( main.CLIs[ i - 1 ].ip_address )
# -- INIT SECTION, ONLY RUNS ONCE -- #
main.startUp = imp.load_source( wrapperFile1,
main.dependencyPath +
@@ -77,18 +79,19 @@
- Connect to cli
"""
# main.scale[ 0 ] determines the current number of ONOS controller
- apps=main.apps
+ apps = main.apps
if main.diff:
apps = main.apps + "," + main.diff
- else: main.log.error( "App list is empty" )
- main.case( "Package and start ONOS using apps:" + apps)
+ else:
+ main.log.error( "App list is empty" )
+ main.case( "Package and start ONOS using apps:" + apps )
print "NODE COUNT = ", main.numCtrls
print main.ONOSip
- tempOnosIp = []
+ tempOnosIp = [ ]
for i in range( main.numCtrls ):
- tempOnosIp.append( main.ONOSip[i] )
+ tempOnosIp.append( main.ONOSip[ i ] )
onosUser = main.params[ 'ENV' ][ 'cellUser' ]
- main.step("Create and Apply cell file")
+ main.step( "Create and Apply cell file" )
main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
"temp",
main.Mininet1.ip_address,
@@ -96,33 +99,33 @@
tempOnosIp,
onosUser )
cellResult = main.ONOSbench.setCell( "temp" )
- verifyResult = main.ONOSbench.verifyCell()
+ 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 " )
- #kill off all onos processes
+ # kill off all onos processes
main.log.info( "Safety check, killing all ONOS processes" +
" before initiating environment setup" )
for i in range( main.maxNodes ):
main.ONOSbench.onosDie( main.ONOSip[ i ] )
main.step( "Create and Install ONOS package" )
- main.ONOSbench.handle.sendline( "cp "+main.dependencyPath+"/"+main.cfgName+".json ~/onos/tools/package/config/network-cfg.json")
- packageResult = main.ONOSbench.onosPackage()
+ packageResult = main.ONOSbench.onosPackage( )
onosInstallResult = main.TRUE
for i in range( main.numCtrls ):
onosInstallResult = onosInstallResult and \
- main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
+ 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" )
main.step( "Starting ONOS service" )
- stopResult,startResult, onosIsUp= main.TRUE, main.TRUE, main.TRUE,
+ stopResult, startResult, onosIsUp = main.TRUE, main.TRUE, main.TRUE,
for i in range( main.numCtrls ):
onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
if onosIsUp == main.TRUE:
@@ -144,17 +147,18 @@
onfail="ONOS service did not start properly" )
main.step( "Checking if ONOS CLI is ready" )
for i in range( main.numCtrls ):
- main.CLIs[i].startCellCli()
- cliResult = main.CLIs[i].startOnosCli( main.ONOSip[ i ],
- commandlineTimeout=60, onosStartTimeout=100 )
+ main.CLIs[ i ].startCellCli( )
+ cliResult = main.CLIs[ i ].startOnosCli( main.ONOSip[ i ],
+ commandlineTimeout=60,
+ onosStartTimeout=100 )
utilities.assert_equals( expect=main.TRUE,
actual=cliResult,
onpass="ONOS CLI is ready",
onfail="ONOS CLI is not ready" )
- main.active=0
+ main.active = 0
for i in range( 10 ):
ready = True
- output = main.CLIs[main.active].summary()
+ output = main.CLIs[ main.active ].summary( )
if not output:
ready = False
if ready:
@@ -164,23 +168,28 @@
onpass="ONOS summary command succeded",
onfail="ONOS summary command failed" )
+ with open( main.dependencyPath + "/" + main.cfgName + ".json" ) as cfg:
+ main.RESTs[ main.active ].setNetCfg( json.load( cfg ) )
+
if not ready:
main.log.error( "ONOS startup failed!" )
- main.cleanup()
- main.exit()
+ main.cleanup( )
+ main.exit( )
for i in range( main.numCtrls ):
- main.CLIs[i].logSet( "DEBUG", "org.onosproject.segmentrouting" )
- main.CLIs[i].logSet( "DEBUG", "org.onosproject.driver.pipeline" )
- main.CLIs[i].logSet( "DEBUG", "org.onosproject.store.group.impl" )
- main.CLIs[i].logSet( "DEBUG", "org.onosproject.net.flowobjective.impl" )
+ main.CLIs[ i ].logSet( "DEBUG", "org.onosproject.segmentrouting" )
+ main.CLIs[ i ].logSet( "DEBUG", "org.onosproject.driver.pipeline" )
+ main.CLIs[ i ].logSet( "DEBUG", "org.onosproject.store.group.impl" )
+ main.CLIs[ i ].logSet( "DEBUG",
+ "org.onosproject.net.flowobjective.impl" )
@staticmethod
def startMininet( main, topology, args="" ):
main.step( "Starting Mininet Topology" )
arg = "--onos %d %s" % (main.numCtrls, args)
- main.topology=topology
- topoResult = main.Mininet1.startNet( topoFile= main.dependencyPath + main.topology, args=arg )
+ main.topology = topology
+ topoResult = main.Mininet1.startNet(
+ topoFile=main.dependencyPath + main.topology, args=arg )
stepResult = topoResult
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -188,52 +197,63 @@
onfail="Failed to load topology" )
# Exit if topology did not load properly
if not topoResult:
- main.cleanup()
- main.exit()
+ main.cleanup( )
+ main.exit( )
@staticmethod
- def checkFlows( main, flowCount ):
- main.step(" Check whether the flow count is bigger than %s" % flowCount)
- count = utilities.retry( main.CLIs[main.active].checkFlowCount,
- main.FALSE,
- kwargs={'min':flowCount},
- attempts=10,
- sleep=10 )
+ def checkFlows( main, minFlowCount ):
+ main.step(
+ " Check whether the flow count is bigger than %s" % minFlowCount )
+ count = utilities.retry( main.CLIs[ main.active ].checkFlowCount,
+ main.FALSE,
+ kwargs={ 'min': minFlowCount },
+ attempts=10,
+ sleep=10 )
utilities.assertEquals( \
expect=True,
- actual=(count>0),
- onpass="Flow count looks correct: "+str(count),
- onfail="Flow count looks wrong: "+str(count) )
+ actual=(count > 0),
+ onpass="Flow count looks correct: " + str( count ),
+ onfail="Flow count looks wrong: " + str( count ) )
main.step( "Check whether all flow status are ADDED" )
- flowCheck = utilities.retry( main.CLIs[main.active].checkFlowsState,
+ flowCheck = utilities.retry( main.CLIs[ main.active ].checkFlowsState,
main.FALSE,
- kwargs={'isPENDING':False},
+ kwargs={ 'isPENDING': False },
attempts=10,
- sleep=10)
+ sleep=10 )
utilities.assertEquals( \
expect=main.TRUE,
actual=flowCheck,
onpass="Flow status is correct!",
onfail="Flow status is wrong!" )
- main.ONOSbench.dumpFlows( main.ONOSip[main.active],
- main.logdir, "flowsBefore" + main.cfgName)
- main.ONOSbench.dumpGroups( main.ONOSip[0],
- main.logdir, "groupsBefore" + main.cfgName)
+ main.ONOSbench.dumpFlows( main.ONOSip[ main.active ],
+ main.logdir, "flowsBefore" + main.cfgName )
+ main.ONOSbench.dumpGroups( main.ONOSip[ 0 ],
+ main.logdir, "groupsBefore" + main.cfgName )
@staticmethod
- def pingAll( main, tag=""):
+ def pingAll( main, tag="", dumpflows=True ):
main.log.report( "Check full connectivity" )
- main.step("Check full connectivity %s" %tag)
- pa = main.Mininet1.pingall()
+ main.step("Check IP connectivity %s" %tag)
+ hosts = main.Mininet1.getHosts().keys()
+ vlan10 = [ '%s10' % s for s in [ 'olt', 'vsg' ] ]
+ vlan5 = [ '%s5' % s for s in [ 'olt', 'vsg' ] ]
+ IPHosts = [ host for host in hosts if host not in ( vlan10 + vlan5 ) ]
+ pa = main.Mininet1.pingallHosts(IPHosts)
utilities.assert_equals( expect=main.TRUE, actual=pa,
- onpass="Full connectivity successfully tested",
- onfail="Full connectivity failed" )
- ##FIXME choose valid onos instead of 0
- main.ONOSbench.dumpFlows( main.ONOSip[main.active],
- main.logdir, "flowsOn" + tag)
- main.ONOSbench.dumpGroups( main.ONOSip[main.active],
- main.logdir, "groupsOn" + tag)
+ onpass="IP connectivity successfully tested",
+ onfail="IP connectivity failed" )
+ main.step("Check VLAN connectivity %s" %tag)
+ p1 = main.Mininet1.pingallHosts(vlan5)
+ p2 = main.Mininet1.pingallHosts(vlan10)
+ utilities.assert_equals( expect=main.TRUE, actual=p1&p2,
+ onpass="Vlan connectivity successfully tested",
+ onfail="Vlan connectivity failed" )
+ if dumpflows:
+ main.ONOSbench.dumpFlows( main.ONOSip[ main.active ],
+ main.logdir, "flowsOn" + tag )
+ main.ONOSbench.dumpGroups( main.ONOSip[ main.active ],
+ main.logdir, "groupsOn" + tag )
@staticmethod
def killLink( main, end1, end2, switches, links ):
@@ -243,47 +263,50 @@
Kill a link and verify ONOS can see the proper link change
"""
main.linkSleep = float( main.params[ 'timers' ][ 'LinkDiscovery' ] )
- main.step( "Kill link between %s and %s" %(end1, end2))
+ main.step( "Kill link between %s and %s" % (end1, end2) )
LinkDown = main.Mininet1.link( END1=end1, END2=end2, OPTION="down" )
- main.log.info( "Waiting %s seconds for link up to be discovered" % (main.linkSleep) )
- # TODO Maybe parameterize number of expected links
+ main.log.info(
+ "Waiting %s seconds for link down to be discovered" % main.linkSleep )
time.sleep( main.linkSleep )
- ##FIXME CLI for active node instead of 0
- topology = utilities.retry( main.CLIs[main.active].checkStatus,
- main.FALSE,
- kwargs={'numoswitch':switches, 'numolink':links},
- attempts=10,
- sleep=main.linkSleep)
+ topology = utilities.retry( main.CLIs[ main.active ].checkStatus,
+ main.FALSE,
+ kwargs={ 'numoswitch': switches,
+ 'numolink': links },
+ attempts=10,
+ sleep=main.linkSleep )
result = topology & LinkDown
utilities.assert_equals( expect=main.TRUE, actual=result,
onpass="Link down successful",
onfail="Failed to turn off link?" )
@staticmethod
- def restoreLink( main, end1, end2, dpid1, dpid2, port1, port2, switches, links ):
+ def restoreLink( main, end1, end2, dpid1, dpid2, port1, port2, switches,
+ links ):
"""
Params:
end1,end2: identify the end switches, ex.: 'leaf1', 'spine1'
dpid1, dpid2: dpid of the end switches respectively, ex.: 'of:0000000000000002'
- port1, port2: respective port of the end switchs that connects to the link, ex.:'1'
+ port1, port2: respective port of the end switches that connects to the link, ex.:'1'
switches, links: number of expected switches and links after linkDown, ex.: '4', '6'
Kill a link and verify ONOS can see the proper link change
"""
- main.step( "Restore link between %s and %s" %( end1, end2 ) )
+ main.step( "Restore link between %s and %s" % (end1, end2) )
result = False
- count=0
+ count = 0
while True:
- count+=0
+ count += 1
main.Mininet1.link( END1=end1, END2=end2, OPTION="up" )
main.Mininet1.link( END2=end1, END1=end2, OPTION="up" )
- main.log.info( "Waiting %s seconds for link up to be discovered" % (main.linkSleep) )
+ main.log.info(
+ "Waiting %s seconds for link up to be discovered" % main.linkSleep )
time.sleep( main.linkSleep )
- main.CLIs[main.active].portstate( dpid=dpid1, port=port1 )
- main.CLIs[main.active].portstate( dpid=dpid2, port=port2 )
+ main.CLIs[ main.active ].portstate( dpid=dpid1, port=port1 )
+ main.CLIs[ main.active ].portstate( dpid=dpid2, port=port2 )
time.sleep( main.linkSleep )
- result = main.CLIs[main.active].checkStatus( numoswitch=switches, numolink=links )
- if count>5 or result:
+ result = main.CLIs[ main.active ].checkStatus( numoswitch=switches,
+ numolink=links )
+ if count > 5 or result:
break
utilities.assert_equals( expect=main.TRUE, actual=result,
onpass="Link up successful",
@@ -293,19 +316,22 @@
def killSwitch( main, switch, switches, links ):
"""
Params: switches, links: number of expected switches and links after SwitchDown, ex.: '4', '6'
- Kill a switch and verify ONOS can see the proper change
+ Completely kill a switch and verify ONOS can see the proper change
"""
main.switchSleep = float( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
main.step( "Kill " + switch )
main.log.info( "Stopping" + switch )
main.Mininet1.switch( SW=switch, OPTION="stop" )
- main.log.info( "Waiting %s seconds for switch down to be discovered" % ( main.switchSleep ) )
+ # todo make this repeatable
+ main.log.info( "Waiting %s seconds for switch down to be discovered" % (
+ main.switchSleep) )
time.sleep( main.switchSleep )
- topology = utilities.retry( main.CLIs[main.active].checkStatus,
- main.FALSE,
- kwargs={'numoswitch':switches, 'numolink':links},
- attempts=10,
- sleep=main.switchSleep)
+ topology = utilities.retry( main.CLIs[ main.active ].checkStatus,
+ main.FALSE,
+ kwargs={ 'numoswitch': switches,
+ 'numolink': links },
+ attempts=10,
+ sleep=main.switchSleep )
utilities.assert_equals( expect=main.TRUE, actual=topology,
onpass="Kill switch successful",
onfail="Failed to kill switch?" )
@@ -316,16 +342,19 @@
Params: switches, links: number of expected switches and links after SwitchUp, ex.: '4', '6'
Recover a switch and verify ONOS can see the proper change
"""
+ # todo make this repeatable
main.step( "Recovering " + switch )
main.log.info( "Starting" + switch )
- main.Mininet1.switch( SW=switch, OPTION="start")
- main.log.info( "Waiting %s seconds for switch up to be discovered" %(main.switchSleep))
+ main.Mininet1.switch( SW=switch, OPTION="start" )
+ main.log.info( "Waiting %s seconds for switch up to be discovered" % (
+ main.switchSleep) )
time.sleep( main.switchSleep )
- topology = utilities.retry( main.CLIs[main.active].checkStatus,
- main.FALSE,
- kwargs={'numoswitch':switches, 'numolink':links},
- attempts=10,
- sleep=main.switchSleep)
+ topology = utilities.retry( main.CLIs[ main.active ].checkStatus,
+ main.FALSE,
+ kwargs={ 'numoswitch': switches,
+ 'numolink': links },
+ attempts=10,
+ sleep=main.switchSleep )
utilities.assert_equals( expect=main.TRUE, actual=topology,
onpass="Switch recovery successful",
onfail="Failed to recover switch?" )
@@ -337,10 +366,93 @@
Stops Mininet
Copies ONOS log
"""
- main.Mininet1.stopNet()
- main.ONOSbench.scp( main.ONOScli1 ,"/opt/onos/log/karaf.log",
- "/tmp/karaf.log", direction="from" )
- main.ONOSbench.cpLogsToDir("/tmp/karaf.log",main.logdir,
- copyFileName="karaf.log."+main.cfgName)
- for i in range(main.numCtrls):
- main.ONOSbench.onosStop( main.ONOSip[i] )
+ main.Mininet1.stopNet( )
+ main.ONOSbench.scp( main.ONOScli1, "/opt/onos/log/karaf.log",
+ "/tmp/karaf.log", direction="from" )
+ main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
+ copyFileName="karaf.log." + main.cfgName )
+ for i in range( main.numCtrls ):
+ main.ONOSbench.onosStop( main.ONOSip[ i ] )
+
+ @staticmethod
+ def killOnos( main, nodes, switches, links, expNodes ):
+ """
+ Params: nodes, integer array with position of the ONOS nodes in the CLIs array
+ switches, links, nodes: number of expected switches, links and nodes after KillOnos, ex.: '4', '6'
+ Completely Kill an ONOS instance and verify the ONOS cluster can see the proper change
+ """
+ main.step( "Killing ONOS instance" )
+ for i in nodes:
+ killResult = main.ONOSbench.onosDie( main.CLIs[ i ].ip_address )
+ utilities.assert_equals( expect=main.TRUE, actual=killResult,
+ onpass="ONOS instance Killed",
+ onfail="Error killing ONOS instance" )
+ if i == main.active:
+ main.active = (i + 1) % main.numCtrls
+ time.sleep( 12 )
+ if len( nodes ) < main.numCtrls:
+ topology = utilities.retry( main.CLIs[ main.active ].checkStatus,
+ main.FALSE,
+ kwargs={ 'numoswitch': switches,
+ 'numolink': links,
+ 'numoctrl': expNodes },
+ attempts=10,
+ sleep=12 )
+ utilities.assert_equals( expect=main.TRUE, actual=topology,
+ onpass="ONOS Instance down successful",
+ onfail="Failed to turn off ONOS Instance" )
+ else:
+ main.active = -1
+
+ @staticmethod
+ def recoverOnos( main, nodes, switches, links, expNodes ):
+ """
+ Params: nodes, integer array with position of the ONOS nodes in the CLIs array
+ switches, links, nodes: number of expected switches, links and nodes after recoverOnos, ex.: '4', '6'
+ Recover an ONOS instance and verify the ONOS cluster can see the proper change
+ """
+ main.step( "Recovering ONOS instance" )
+ [ main.ONOSbench.onosStart( main.CLIs[ i ].ip_address ) for i in nodes ]
+ for i in nodes:
+ isUp = main.ONOSbench.isup( main.ONOSip[ i ] )
+ utilities.assert_equals( expect=main.TRUE, actual=isUp,
+ onpass="ONOS service is ready",
+ onfail="ONOS service did not start properly" )
+ for i in nodes:
+ main.step( "Checking if ONOS CLI is ready" )
+ main.CLIs[ i ].startCellCli( )
+ cliResult = main.CLIs[ i ].startOnosCli( main.ONOSip[ i ],
+ commandlineTimeout=60,
+ onosStartTimeout=100 )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=cliResult,
+ onpass="ONOS CLI is ready",
+ onfail="ONOS CLI is not ready" )
+ main.active = i if main.active == -1 else main.active
+
+ topology = utilities.retry( main.CLIs[ main.active ].checkStatus,
+ main.FALSE,
+ kwargs={ 'numoswitch': switches,
+ 'numolink': links,
+ 'numoctrl': expNodes },
+ attempts=10,
+ sleep=12 )
+ utilities.assert_equals( expect=main.TRUE, actual=topology,
+ onpass="ONOS Instance down successful",
+ onfail="Failed to turn off ONOS Instance" )
+
+ for i in range( 10 ):
+ ready = True
+ output = main.CLIs[ main.active ].summary( )
+ if not output:
+ ready = False
+ if ready:
+ break
+ time.sleep( 10 )
+ utilities.assert_equals( expect=True, actual=ready,
+ onpass="ONOS summary command succeded",
+ onfail="ONOS summary command failed" )
+ if not ready:
+ main.log.error( "ONOS startup failed!" )
+ main.cleanup( )
+ main.exit( )
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py b/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py
index a2a8a8e..4f52689 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py
@@ -5,89 +5,128 @@
from mininet.net import Mininet
from mininet.topo import Topo
-from mininet.node import RemoteController, UserSwitch, Host
+from mininet.node import RemoteController, UserSwitch, Host, OVSBridge
from mininet.link import TCLink
from mininet.log import setLogLevel
from mininet.cli import CLI
-# Parse command line options and dump results
-def parseOptions():
- """Parse command line options"""
- parser = OptionParser()
- parser.add_option('--spine', dest='spine', type='int', default=2,
- help='number of spine switches, default=2')
- parser.add_option('--leaf', dest='leaf', type='int', default=2,
- help='number of leaf switches, default=2')
- parser.add_option('--fanout', dest='fanout', type='int', default=2,
- help='number of hosts per leaf switch, default=2')
- parser.add_option('--onos', dest='onos', type='int', default=0,
- help='number of ONOS Instances, default=0, 0 means localhost, 1 will use OC1 and so on')
- (options, args) = parser.parse_args()
+# Parse command line options and dump results
+def parseOptions( ):
+ """Parse command line options"""
+ parser = OptionParser( )
+ parser.add_option( '--spine', dest='spine', type='int', default=2,
+ help='number of spine switches, default=2' )
+ parser.add_option( '--leaf', dest='leaf', type='int', default=2,
+ help='number of leaf switches, default=2' )
+ parser.add_option( '--fanout', dest='fanout', type='int', default=2,
+ help='number of hosts per leaf switch, default=2' )
+ parser.add_option( '--onos', dest='onos', type='int', default=0,
+ help='number of ONOS Instances, default=0, 0 means localhost, 1 will use OC1 and so on' )
+ (options, args) = parser.parse_args( )
return options, args
-opts, args = parseOptions()
-class LeafAndSpine(Topo):
- def __init__(self, spine=2, leaf=2, fanout=2, **opts):
+opts, args = parseOptions( )
+
+
+class LeafAndSpine( Topo ):
+ def __init__( self, spine=2, leaf=2, fanout=2, **opts ):
"Create Leaf and Spine Topo."
-
- Topo.__init__(self, **opts)
-
+ Topo.__init__( self, **opts )
# Add spine switches
- spines = {}
- for s in range(spine):
- spines[s] = self.addSwitch('spine10%s' % (s + 1), dpid="00000000010%s" % (s + 1))
+ spines = { }
+ leafs = { }
+ for s in range( spine ):
+ spines[ s ] = self.addSwitch( 'spine10%s' % (s + 1),
+ dpid="00000000010%s" % (s + 1) )
# Set link speeds to 100Mb/s
- linkopts = dict(bw=100)
-
+ linkopts = dict( bw=100 )
# Add Leaf switches
- for ls in range(leaf):
- leafSwitch = self.addSwitch('leaf%s' % (ls + 1), dpid="00000000000%s" % (1+ls))
+ for ls in range( leaf ):
+ leafs[ ls ] = self.addSwitch( 'leaf%s' % (ls + 1),
+ dpid="00000000000%s" % (1 + ls) )
# Connect leaf to all spines
- for s in range(spine):
- switch = spines[s]
- self.addLink(leafSwitch, switch, **linkopts)
+ for s in range( spine ):
+ switch = spines[ s ]
+ self.addLink( leafs[ ls ], switch, **linkopts )
# Add hosts under a leaf, fanout hosts per leaf switch
- for f in range(fanout):
- host = self.addHost('h%s' % (ls * fanout + f + 1),
- cls=IpHost,
- ip='10.0.%s.%s/24' % ((ls + 1), (f + 1)),
- gateway='10.0.%s.254' % (ls + 1))
- self.addLink(host, leafSwitch, **linkopts)
+ for f in range( fanout ):
+ host = self.addHost( 'h%s' % (ls * fanout + f + 1),
+ cls=IpHost,
+ ip='10.0.%s.%s/24' % ((ls + 1), (f + 1)),
+ gateway='10.0.%s.254' % (ls + 1) )
+ self.addLink( host, leafs[ ls ], **linkopts )
+ # Add Xconnect simulation
+ br1 = self.addSwitch( 'br1', cls=OVSBridge )
+ self.addLink( br1, leafs[ 0 ], **linkopts )
+ for vid in [ 5, 10 ]:
+ olt = self.addHost( 'olt%s' % vid, cls=VLANHost, vlan=vid,
+ ip="10.%s.0.1/24" % vid
+ , mac="00:00:%02d:00:00:01" % vid )
+ vsg = self.addHost( 'vsg%s' % vid, cls=VLANHost, vlan=vid,
+ ip="10.%s.0.2/24" % vid
+ , mac="00:00:%02d:00:00:02" % vid )
+ self.addLink( olt, leafs[ 0 ], **linkopts )
+ self.addLink( vsg, br1, **linkopts )
-class IpHost(Host):
- def __init__(self, name, gateway, *args, **kwargs):
- super(IpHost, self).__init__(name, *args, **kwargs)
+
+class IpHost( Host ):
+ def __init__( self, name, gateway, *args, **kwargs ):
+ super( IpHost, self ).__init__( name, *args, **kwargs )
self.gateway = gateway
- def config(self, **kwargs):
- Host.config(self, **kwargs)
- mtu = "ifconfig "+self.name+"-eth0 mtu 1490"
- self.cmd(mtu)
- self.cmd('ip route add default via %s' % self.gateway)
+ def config( self, **kwargs ):
+ Host.config( self, **kwargs )
+ mtu = "ifconfig " + self.name + "-eth0 mtu 1490"
+ self.cmd( mtu )
+ self.cmd( 'ip route add default via %s' % self.gateway )
-def config(opts):
+
+class VLANHost( Host ):
+ "Host connected to VLAN interface"
+
+ def config( self, vlan=100, **params ):
+ """Configure VLANHost according to (optional) parameters:
+ vlan: VLAN ID for default interface"""
+ r = super( VLANHost, self ).config( **params )
+ intf = self.defaultIntf( )
+ # remove IP from default, "physical" interface
+ self.cmd( 'ifconfig %s inet 0' % intf )
+ intf = self.defaultIntf( )
+ # create VLAN interface
+ self.cmd( 'vconfig add %s %d' % (intf, vlan) )
+ self.cmd( 'ifconfig %s.%d %s' % (intf, vlan, params[ 'ip' ]) )
+ # update the intf name and host's intf map
+ self.cmd( 'ifconfig %s.%d mtu 1480' % (intf, vlan) )
+ newName = '%s.%d' % (intf, vlan)
+ # update the (Mininet) interface to refer to VLAN interface name
+ intf.name = newName
+ # add VLAN interface to host's name to intf map
+ self.nameToIntf[ newName ] = intf
+
+
+def config( opts ):
spine = opts.spine
leaf = opts.leaf
- fanout = opts.fanout
- controllers= [ os.environ['OC%s' % i] for i in range(1,opts.onos+1) ] if (opts.onos) else ['127.0.0.1']
- topo = LeafAndSpine(spine=spine, leaf=leaf, fanout=fanout)
- net = Mininet(topo=topo, link=TCLink, build=False,
- switch=UserSwitch,
- controller = None,
- autoSetMacs = True)
+ fanout = opts.fanout
+ controllers = [ os.environ[ 'OC%s' % i ] for i in
+ range( 1, opts.onos + 1 ) ] if (opts.onos) else [
+ '127.0.0.1' ]
+ topo = LeafAndSpine( spine=spine, leaf=leaf, fanout=fanout )
+ net = Mininet( topo=topo, link=TCLink, build=False,
+ switch=UserSwitch, controller=None, autoSetMacs=True )
i = 0
for ip in controllers:
- net.addController( "c%s" % (i), controller=RemoteController, ip=ip)
+ net.addController( "c%s" % (i), controller=RemoteController, ip=ip )
i += 1;
- net.build()
- net.start()
- CLI(net)
- net.stop()
+ net.build( )
+ net.start( )
+ CLI( net )
+ net.stop( )
+
if __name__ == '__main__':
- setLogLevel('info')
- config(opts)
- os.system('sudo mn -c')
-
+ setLogLevel( 'info' )
+ config( opts )
+ os.system( 'sudo mn -c' )
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py b/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
index 9ea664b..50501cf 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
@@ -113,7 +113,7 @@
branchName = main.ONOSbench.getBranchName()
main.log.report( "ONOS is on branch: " + branchName )
- main.log.step( "Uninstalling ONOS" )
+ main.step( "Uninstalling ONOS" )
uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
utilities.assert_equals( expect=main.TRUE,
actual=uninstallResult,
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
index e1c20f5..bb8acb8 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
@@ -108,7 +108,7 @@
branchName = main.ONOSbench.getBranchName()
main.log.report( "ONOS is on branch: " + branchName )
- main.log.step( "Uninstalling ONOS" )
+ main.step( "Uninstalling ONOS" )
uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip ) \
and main.ONOSbench.onosUninstall( ONOS2Ip ) \
and main.ONOSbench.onosUninstall( ONOS3Ip )
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
index 8ca65a6..0499fde 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
@@ -113,7 +113,7 @@
branchName = main.ONOSbench.getBranchName()
main.log.report( "ONOS is on branch: " + branchName )
- main.log.step( "Uninstalling ONOS" )
+ main.step( "Uninstalling ONOS" )
uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip ) \
and main.ONOSbench.onosUninstall( ONOS2Ip ) \
and main.ONOSbench.onosUninstall( ONOS3Ip )
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py b/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
index d995156..f2395de 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
@@ -122,7 +122,7 @@
branchName = main.ONOSbench.getBranchName()
main.log.report( "ONOS is on branch: " + branchName )
- main.log.step( "Uninstalling ONOS" )
+ main.step( "Uninstalling ONOS" )
uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
utilities.assert_equals( expect=main.TRUE,
actual=uninstallResult,