Implementing IPv6 System Testing Using TESTON
Change-Id: Icc1b00739532f6da9b4b6770fe0fd12ac5d3bde9
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 41670f7..221fe82 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -494,7 +494,7 @@
for temp in pingList:
# Current host pings all other hosts specified
- pingCmd = str( host ) + cmd + prefix + str( temp[1:] )
+ pingCmd = str( host ) + cmd + str( self.getIPAddress(temp,proto='IPv6') )
self.handle.sendline( pingCmd )
self.handle.expect( "mininet>", timeout=wait + 1 )
response = self.handle.before
@@ -679,7 +679,7 @@
else:
return main.TRUE
- def moveHost( self, host, oldSw, newSw, ):
+ def moveHostv6( self, host, oldSw, newSw, ):
"""
Moves a host from one switch to another on the fly
Note: The intf between host and oldSw when detached
@@ -690,6 +690,7 @@
"""
if self.handle:
try:
+ IP = str( self.getIPAddress( host, proto='IPV6' ) ) + "/64"
# Bring link between oldSw-host down
cmd = "py net.configLinkStatus('" + oldSw + "'," + "'" + host +\
"'," + "'down')"
@@ -706,7 +707,7 @@
self.handle.expect( "mininet>" )
# Determine ip and mac address of the host-oldSw interface
- cmd = "px ipaddr = hintf.IP()"
+ cmd = "px ipaddr = " + str(IP)
print "cmd3= ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
@@ -737,31 +738,44 @@
# Attach interface between newSw-host
cmd = "px " + newSw + ".attach( sintf )"
- print "cmd3= ", cmd
- self.handle.sendline( cmd )
- self.handle.expect( "mininet>" )
-
- # Set ipaddress of the host-newSw interface
- cmd = "px " + host + ".setIP( ip = ipaddr, intf = hintf)"
- print "cmd7 = ", cmd
+ print "cmd6= ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
# Set macaddress of the host-newSw interface
cmd = "px " + host + ".setMAC( mac = macaddr, intf = hintf)"
+ print "cmd7 = ", cmd
+ self.handle.sendline( cmd )
+ self.handle.expect( "mininet>" )
+
+ # Set ipaddress of the host-newSw interface
+ cmd = "px " + host + ".setIP( ip = ipaddr, intf = hintf)"
print "cmd8 = ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
+ cmd = host + " ifconfig"
+ print "cmd9 =",cmd
+ response = self.execute( cmd = cmd, prompt="mininet>" ,timeout=10 )
+ print response
+ pattern = "h\d-eth([\w])"
+ ipAddressSearch = re.search( pattern, response )
+ print ipAddressSearch.group(1)
+ intf= host + "-eth" + str(ipAddressSearch.group(1))
+ cmd = host + " ip -6 addr add %s dev %s" % ( IP, intf )
+ print "cmd10 = ", cmd
+ self.handle.sendline( cmd )
+ self.handle.expect( "mininet>" )
+
cmd = "net"
- print "cmd9 = ", cmd
+ print "cmd11 = ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
print "output = ", self.handle.before
# Determine ipaddress of the host-newSw interface
cmd = host + " ifconfig"
- print "cmd10= ", cmd
+ print "cmd12= ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
print "ifconfig o/p = ", self.handle.before
@@ -935,7 +949,7 @@
if proto == 'IPV4':
pattern = "inet\saddr:(\d+\.\d+\.\d+\.\d+)"
else:
- pattern = "inet6\saddr:\s([\w,:]*)/"
+ pattern = "inet6\saddr:\s([\w,:]*)/\d+\sScope:Global"
ipAddressSearch = re.search( pattern, response )
main.log.info(
self.name +
@@ -1136,6 +1150,39 @@
main.cleanup()
main.exit()
+ def iperftcpipv6(self, host1="h1", host2="h2", timeout=50):
+ main.log.info( self.name + ": Simple iperf TCP test between two hosts" )
+ try:
+ IP1 = self.getIPAddress( host1, proto='IPV6' )
+ cmd1 = host1 +' iperf -V -sD -B '+ str(IP1)
+ self.handle.sendline( cmd1 )
+ outcome1 = self.handle.expect( "mininet>")
+ cmd2 = host2 +' iperf -V -c '+ str(IP1) +' -t 5'
+ self.handle.sendline( cmd2 )
+ outcome2 = self.handle.expect( "mininet>")
+ response1 = self.handle.before
+ response2 = self.handle.after
+ print response1,response2
+ pattern = "connected with "+ str(IP1)
+ if pattern in response1:
+ main.log.report(self.name + ": iperf test completed")
+ return main.TRUE
+ else:
+ main.log.error( self.name + ": iperf test failed" )
+ return main.FALSE
+ except pexpect.TIMEOUT:
+ main.log.error( self.name + ": TIMEOUT exception found" )
+ main.log.error( self.name + " response: " + repr( self.handle.before ) )
+ self.handle.sendline( "\x03" )
+ self.handle.expect( "Interrupt" )
+ self.handle.expect( "mininet>" )
+ return main.FALSE
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+
def iperfudpAll(self, hosts, bandwidth="10M"):
'''
Runs the iperfudp function with a given set of hosts and specified
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 7dbf023..935f627 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -783,6 +783,7 @@
handleAfter = self.handle.after
# Get the rest of the handle
self.handle.expect( "\$" )
+ time.sleep(10)
handleMore = self.handle.before
cell_result = handleBefore + handleAfter + handleMore
diff --git a/TestON/tests/FUNCipv6Intent/Dependency/FUNCIpv6IntentFunction.py b/TestON/tests/FUNCipv6Intent/Dependency/FUNCIpv6IntentFunction.py
index 6930ef3..b6d706e 100644
--- a/TestON/tests/FUNCipv6Intent/Dependency/FUNCIpv6IntentFunction.py
+++ b/TestON/tests/FUNCipv6Intent/Dependency/FUNCIpv6IntentFunction.py
@@ -116,12 +116,6 @@
main.log.error( itemName + ": Key error Exception" )
return main.FALSE
- # Discover hosts using arping incase pingall discovery failed
- #main.log.info( itemName + ": Discover host using pingall" )
- #main.Mininet1.pingall( protocol='IPv6' )
- #host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
- #host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
-
# Check flows count in each node
checkFlowsCount( main )
@@ -146,19 +140,18 @@
checkFlowsState( main )
# Ping hosts
- #firstPingResult = ping6allHosts( main, hostNames )
firstPingResult = main.Mininet1.ping6pair(SRC=hostNames[0], TARGET=main.hostsData[ host2 ][ 'ipAddresses' ][ 0 ])
if not firstPingResult:
main.log.debug( "First ping failed, there must be" +
" something wrong with ONOS performance" )
# Ping hosts again...
- pingTemp = main.Mininet1.ping6pair(SRC=hostNames[0], TARGET=main.hostsData[ host2 ][ 'ipAddresses' ][ 0 ])
+ pingTemp = ping6allHosts( main, hostNames )
pingResult = pingResult and pingTemp
if pingTemp:
- main.assertReturnString += 'Initial Pingall Passed\n'
+ main.assertReturnString += 'Initial Ping6all Passed\n'
else:
- main.assertReturnString += 'Initial Pingall Failed\n'
+ main.assertReturnString += 'Initial Ping6all Failed\n'
# Test rerouting if these variables exist
if sw1 and sw2 and expectedLink:
@@ -183,13 +176,13 @@
main.assertReturnString += 'Link Down Topology State Failed\n'
# Ping hosts
- pingTemp = pingallHosts( main, hostNames )
+ pingTemp = ping6allHosts( main, hostNames )
pingResult = pingResult and pingTemp
if pingTemp:
- main.assertReturnString += 'Link Down Pingall Passed\n'
+ main.assertReturnString += 'Link Down Ping6all Passed\n'
else:
- main.assertReturnString += 'Link Down Pingall Failed\n'
+ main.assertReturnString += 'Link Down Ping6all Failed\n'
# Check intent states
intentTemp = checkIntentState( main, intentsId )
@@ -228,13 +221,13 @@
main.assertReturnString += 'Link Up Topology State Failed\n'
# Ping hosts
- pingTemp = pingallHosts( main, hostNames )
+ pingTemp = ping6allHosts( main, hostNames )
pingResult = pingResult and pingTemp
if pingTemp:
- main.assertReturnString += 'Link Up Pingall Passed\n'
+ main.assertReturnString += 'Link Up Ping6all Passed\n'
else:
- main.assertReturnString += 'Link Up Pingall Failed\n'
+ main.assertReturnString += 'Link Up Ping6all Failed\n'
intentTemp = checkIntentState( main, intentsId )
intentResult = intentResult and intentTemp
@@ -405,12 +398,12 @@
checkFlowsState( main )
# Ping hosts
- pingTemp = main.Mininet1.ping6pair(SRC=host1, TARGET=main.hostsData[ host2 ][ 'ipAddresses' ][ 0 ])
+ pingTemp = ping6allHosts( main, hostNames )
pingResult = pingResult and pingTemp
if pingTemp:
- main.assertReturnString += 'Initial Ping6 pair Passed\n'
+ main.assertReturnString += 'Initial Ping6all Passed\n'
else:
- main.assertReturnString += 'Initial Ping6 pair Failed\n'
+ main.assertReturnString += 'Initial Ping6all Failed\n'
# Test rerouting if these variables exist
if sw1 and sw2 and expectedLink:
@@ -438,9 +431,9 @@
pingTemp = ping6allHosts( main, hostNames )
pingResult = pingResult and pingTemp
if pingTemp:
- main.assertReturnString += 'Link Down Pingall Passed\n'
+ main.assertReturnString += 'Link Down Ping6all Passed\n'
else:
- main.assertReturnString += 'Link Down Pingall Failed\n'
+ main.assertReturnString += 'Link Down Ping6all Failed\n'
# Check intent state
intentTemp = checkIntentState( main, intentsId )
@@ -478,13 +471,12 @@
main.assertReturnString += 'Link Up Topology State Failed\n'
# Ping hosts
- pingTemp = pingallHosts( main, hostNames )
+ pingTemp = ping6allHosts( main, hostNames )
pingResult = pingResult and pingTemp
-
if pingTemp:
- main.assertReturnString += 'Link Up Pingall Passed\n'
+ main.assertReturnString += 'Link Up Ping6all Passed\n'
else:
- main.assertReturnString += 'Link Up Pingall Failed\n'
+ main.assertReturnString += 'Link Up Ping6all Failed\n'
intentTemp = checkIntentState( main, intentsId )
intentResult = intentResult and intentTemp
@@ -687,12 +679,12 @@
checkFlowsState( main )
# Run iperf to both host
- iperfTemp = main.Mininet1.iperftcp( host1,host2,timeout=10 )
+ iperfTemp = main.Mininet1.iperftcpipv6( host1,host2 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
- main.assertReturnString += 'Initial Iperf Passed\n'
+ main.assertReturnString += 'Initial Iperf6 Passed\n'
else:
- main.assertReturnString += 'Initial Iperf Failed\n'
+ main.assertReturnString += 'Initial Iperf6 Failed\n'
# Test rerouting if these variables exist
if sw1 and sw2 and expectedLink:
@@ -717,12 +709,12 @@
main.assertReturnString += 'Link Down Topology State Failed\n'
# Run iperf to both host
- iperfTemp = main.Mininet1.iperftcp( host1,host2,timeout=10 )
+ iperfTemp = main.Mininet1.iperftcpipv6( host1,host2 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
- main.assertReturnString += 'Link Down Iperf Passed\n'
+ main.assertReturnString += 'Link Down Iperf6 Passed\n'
else:
- main.assertReturnString += 'Link Down Iperf Failed\n'
+ main.assertReturnString += 'Link Down Iperf6 Failed\n'
# Check intent state
intentTemp = checkIntentState( main, intentsId )
@@ -740,7 +732,7 @@
# link up
linkUpResult = link( main, sw1, sw2, "up" )
- if linkUpTemp:
+ if linkUpResult:
main.assertReturnString += 'Link Up Passed\n'
else:
main.assertReturnString += 'Link Up Failed\n'
@@ -761,12 +753,12 @@
main.assertReturnString += 'Link Up Topology State Failed\n'
# Run iperf to both host
- iperfTemp = main.Mininet1.iperftcp( host1,host2,timeout=10 )
+ iperfTemp = main.Mininet1.iperftcpipv6( host1,host2,timeout=10 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
- main.assertReturnString += 'Link Up Iperf Passed\n'
+ main.assertReturnString += 'Link Up Iperf6 Passed\n'
else:
- main.assertReturnString += 'Link Up Iperf Failed\n'
+ main.assertReturnString += 'Link Up Iperf6 Failed\n'
# Check intent state
intentTemp = checkIntentState( main, intentsId )
@@ -796,12 +788,12 @@
def singleToMultiIntent( main,
name,
- hostNames,
+ hostNames="",
onosNode=0,
devices="",
- ports=None,
+ ports="",
ethType="",
- macs=None,
+ macs="",
bandwidth="",
lambdaAlloc=False,
ipProto="",
@@ -880,15 +872,11 @@
if hostNames and devices:
if len( hostNames ) != len( devices ):
main.log.debug( "hosts and devices does not have the same length" )
- #print "len hostNames = ", len( hostNames )
- #print "len devices = ", len( devices )
return main.FALSE
if ports:
if len( ports ) != len( devices ):
main.log.error( "Ports and devices does " +
"not have the same length" )
- #print "len devices = ", len( devices )
- #print "len ports = ", len( ports )
return main.FALSE
else:
main.log.info( "Device Ports are not specified" )
@@ -905,12 +893,7 @@
main.hostsData.get( host ).get( 'mac' )
ipDict[ main.hostsData.get( host ).get( 'location' ) ] = \
main.hostsData.get( host ).get( 'ipAddresses' )
- #print main.hostsData
-
- #print 'host names = ', hostNames
- #print 'devices = ', devices
- #print "macsDict = ", macsDict
-
+
pingResult = main.TRUE
intentResult = main.TRUE
removeIntentResult = main.TRUE
@@ -963,9 +946,7 @@
tcpSrc="",
tcpDst="" ) )
- # Wait some time for the flow to go through when using multi instance
- pingTemp = pingallHosts( main, hostNames )
-
+
# Check intents state
time.sleep( main.checkIntentSleep )
intentResult = checkIntentState( main, intentsId )
@@ -979,12 +960,18 @@
# Verify flows
checkFlowsState( main )
- pingTemp = pingallHosts( main, hostNames )
+ firstPingResult = main.Mininet1.ping6pair(SRC=hostNames[0], TARGET=main.hostsData[ hostNames[1] ][ 'ipAddresses' ][0])
+ if not firstPingResult:
+ main.log.debug( "First ping failed, there must be" +
+ " something wrong with ONOS performance" )
+
+ # Ping hosts again...
+ pingTemp = ping6allHosts( main, hostNames )
pingResult = pingResult and pingTemp
if pingTemp:
- main.assertReturnString += 'Initial Pingall Passed\n'
+ main.assertReturnString += 'Initial Ping6all Passed\n'
else:
- main.assertReturnString += 'Initial Pingall Failed\n'
+ main.assertReturnString += 'Initial Ping6all Failed\n'
# Test rerouting if these variables exist
if sw1 and sw2 and expectedLink:
@@ -1009,12 +996,12 @@
main.assertReturnString += 'Link Down Topology State Failed\n'
# Ping hosts
- pingTemp = pingallHosts( main, hostNames )
+ pingTemp = ping6allHosts( main, hostNames )
pingResult = pingResult and pingTemp
if pingTemp:
- main.assertReturnString += 'Link Down Pingall Passed\n'
+ main.assertReturnString += 'Link Down Ping6all Passed\n'
else:
- main.assertReturnString += 'Link Down Pingall Failed\n'
+ main.assertReturnString += 'Link Down Ping6all Failed\n'
# Check intent state
intentTemp = checkIntentState( main, intentsId )
@@ -1052,12 +1039,12 @@
main.assertReturnString += 'Link Up Topology State Failed\n'
# Ping hosts
- pingTemp = pingallHosts( main, hostNames )
+ pingTemp = ping6allHosts( main, hostNames )
pingResult = pingResult and pingTemp
if pingTemp:
- main.assertReturnString += 'Link Up Pingall Passed\n'
+ main.assertReturnString += 'Link Up Ping6all Passed\n'
else:
- main.assertReturnString += 'Link Up Pingall Failed\n'
+ main.assertReturnString += 'Link Up Ping6all Failed\n'
# Check Intents
intentTemp = checkIntentState( main, intentsId )
@@ -1087,12 +1074,12 @@
def multiToSingleIntent( main,
name,
- hostNames,
+ hostNames="",
onosNode=0,
devices="",
- ports=None,
+ ports="",
ethType="",
- macs=None,
+ macs="",
bandwidth="",
lambdaAlloc=False,
ipProto="",
@@ -1170,15 +1157,11 @@
if hostNames and devices:
if len( hostNames ) != len( devices ):
main.log.debug( "hosts and devices does not have the same length" )
- #print "len hostNames = ", len( hostNames )
- #print "len devices = ", len( devices )
return main.FALSE
if ports:
if len( ports ) != len( devices ):
main.log.error( "Ports and devices does " +
"not have the same length" )
- #print "len devices = ", len( devices )
- #print "len ports = ", len( ports )
return main.FALSE
else:
main.log.info( "Device Ports are not specified" )
@@ -1194,11 +1177,6 @@
main.hostsData.get( host ).get( 'mac' )
ipDict[ main.hostsData.get( host ).get( 'location' ) ] = \
main.hostsData.get( host ).get( 'ipAddresses' )
- #print main.hostsData
-
- #print 'host names = ', hostNames
- #print 'devices = ', devices
- #print "macsDict = ", macsDict
pingResult = main.TRUE
intentResult = main.TRUE
@@ -1251,9 +1229,6 @@
ipDst="",
tcpSrc="",
tcpDst="" ) )
-
- pingTemp = pingallHosts( main, hostNames )
-
# Check intents state
time.sleep( main.checkIntentSleep )
intentResult = checkIntentState( main, intentsId )
@@ -1267,16 +1242,13 @@
# Verify flows
checkFlowsState( main )
- # Ping hosts
- pingTemp = pingallHosts( main, hostNames )
-
- # Ping hosts again...
- pingTemp = pingallHosts( main, hostNames )
+ # Ping hosts...
+ pingTemp = ping6allHosts( main, hostNames )
pingResult = pingResult and pingTemp
if pingTemp:
- main.assertReturnString += 'Initial Pingall Passed\n'
+ main.assertReturnString += 'Initial Ping6all Passed\n'
else:
- main.assertReturnString += 'Initial Pingall Failed\n'
+ main.assertReturnString += 'Initial Ping6all Failed\n'
# Test rerouting if these variables exist
if sw1 and sw2 and expectedLink:
@@ -1301,12 +1273,12 @@
main.assertReturnString += 'Link Down Topology State Failed\n'
# Ping hosts
- pingTemp = pingallHosts( main, hostNames )
+ pingTemp = ping6allHosts( main, hostNames )
pingResult = pingResult and pingTemp
if pingTemp:
- main.assertReturnString += 'Link Down Pingall Passed\n'
+ main.assertReturnString += 'Link Down Ping6all Passed\n'
else:
- main.assertReturnString += 'Link Down Pingall Failed\n'
+ main.assertReturnString += 'Link Down Ping6all Failed\n'
# Check intent state
intentTemp = checkIntentState( main, intentsId )
@@ -1344,12 +1316,12 @@
main.assertReturnString += 'Link Up Topology State Failed\n'
# Ping hosts
- pingTemp = pingallHosts( main, hostNames )
+ pingTemp = ping6allHosts( main, hostNames )
pingResult = pingResult and pingTemp
if pingTemp:
- main.assertReturnString += 'Link Up Pingall Passed\n'
+ main.assertReturnString += 'Link Up Ping6all Passed\n'
else:
- main.assertReturnString += 'Link Up Pingall Failed\n'
+ main.assertReturnString += 'Link Up Ping6all Failed\n'
# Check Intents
intentTemp = checkIntentState( main, intentsId )
@@ -1392,8 +1364,8 @@
getDataResult = main.TRUE
main.log.info( "Activating reactive forwarding app " )
activateResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
- main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true")
- main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true")
+ main.CLIs[ 0 ].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true")
+ main.CLIs[ 0 ].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true")
main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true")
main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true")
time.sleep( main.fwdSleep )
@@ -1407,7 +1379,6 @@
pingResult = main.Mininet1.pingall( protocol="IPv6", timeout = 600 )
hostsJson = json.loads( main.CLIs[ 0 ].hosts() )
hosts = main.Mininet1.getHosts().keys()
- # TODO: Make better use of new getHosts function
for host in hosts:
main.hostsData[ host ] = {}
main.hostsData[ host ][ 'mac' ] = \
@@ -1430,8 +1401,11 @@
main.log.info( "Failed to use fwd app to discover hosts " )
getDataResult = main.FALSE
+ main.log.info( "Removing the automatically configured ipv6 link-local addresses in hostsData to avoid unnecessary ping with these addresses during initial ping test - link-local starts with 'fe' " )
+ for host in main.hostsData.keys():
+ if main.hostsData[ host ].get( 'ipAddresses' ) != None:
+ main.hostsData[ host ][ 'ipAddresses' ] = [ v for v in main.hostsData[ host ][ 'ipAddresses' ] if not v.startswith('fe') ]
print main.hostsData
-
return getDataResult
def checkTopology( main, expectedLink ):
diff --git a/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.params b/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.params
index c7b3c62..851b142 100644
--- a/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.params
+++ b/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.params
@@ -2,11 +2,15 @@
# CASE - Description
# 1 - Variable initialization and optional pull and build ONOS package
# 2 - Install ONOS
- # 11 - Start Mininet with Openflow 1.3
+ # 11 - Start Mininet with Openflow 1.3 (OpenvSwitch --version more than 2.3.1)
# 12 - Assign switch to controller
# 14 - Stop Mininet
+ # 2000 - Test Point Intent
+ # 3000 - Test Single To Multi Point Intent
+ # 4000 - Test multi to single point intents
+ # 5000 - Test host mobility
- <testcases>1,2,11,12,13,2000,14</testcases>
+ <testcases>1,2,11,12,13,2000,3000,4000,5000,14</testcases>
<SCALE>
<size>1</size>
diff --git a/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.py b/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.py
index 1c91540..9c49283 100644
--- a/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.py
+++ b/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.py
@@ -19,14 +19,12 @@
- Install ONOS package
- Build ONOS package
"""
-
main.case( "Constructing test variables and building ONOS package" )
main.step( "Constructing test variables" )
main.caseExplanation = "This test case is mainly for loading " +\
"from params file, and pull and build the " +\
" latest ONOS package"
stepResult = main.FALSE
-
# Test variables
try:
main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
@@ -166,7 +164,7 @@
onpass="Successfully applied cell to " + \
"environment",
onfail="Failed to apply cell to environment " )
-
+
main.step( "Creating ONOS package" )
packageResult = main.ONOSbench.onosPackage()
stepResult = packageResult
@@ -407,10 +405,9 @@
" intents using " + str( main.numCtrls ) +\
" node(s) cluster;\n" +\
"Different type of hosts will be tested in " +\
- "each step such as IPV4, Dual stack, VLAN etc" +\
+ "each step such as IPV6, Dual stack, VLAN etc" +\
";\nThe test will use OF " + main.OFProtocol +\
" OVS running in Mininet"
-
# No option point intents
main.step( "NOOPTION: Add point intents between h1 and h9, ipv6 hosts" )
main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
@@ -427,7 +424,6 @@
actual=stepResult,
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- """
stepResult = main.TRUE
main.step( "IPV6: Add point intents between h1 and h9" )
main.assertReturnString = "Assertion Result for IPV6 point intent\n"
@@ -450,13 +446,13 @@
ip2="",
tcp1="",
tcp2="",
+ sw1="s5",
+ sw2="s2",
expectedLink=18 )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
onfail=main.assertReturnString )
-
main.step( "IPV6_2: Add point intents between h1 and h9" )
main.assertReturnString = "Assertion Result for IPV6 no mac address point intents\n"
stepResult = main.intentFunction.pointIntent(
@@ -471,34 +467,19 @@
ip2="",
tcp1="",
tcp2="",
- expectedLink=18 )
-
+ expectedLink="")
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
onfail=main.assertReturnString )
-
main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV6 using ICMP point intents\n"
mac1 = main.hostsData[ 'h1' ][ 'mac' ]
mac2 = main.hostsData[ 'h9' ][ 'mac' ]
main.log.debug(mac2)
-
- # TODO : Fix is IPv6 arg format
- # when we install the intent "add-point-intent --ethType IPV6 --ethSrc 00:00:00:00:00:01
- # --ethDst 00:00:00:00:00:09 --ipProto 1 --ipSrc 10:1::1/128 --ipDst 10:1::5/128
- # of:0000000000000005/1 of:0000000000000006/1" controller reports following error :
- # Malformed IP prefix string: 10:1::1. Address must take form "x.x.x.x/y" or "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/y"
- #ip1 = main.Mininet1.getIPAddress( 'h1', proto='IPV6' )
- #ip2 = main.Mininet1.getIPAddress( 'h9', proto='IPV6')
-
ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
- # Uneccessary, not including this in the selectors
- #tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
- #tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128"
ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128"
-
stepResult = main.intentFunction.pointIntent(
main,
name="SDNIP-ICMP",
@@ -512,43 +493,41 @@
ipProto=ipProto,
ip1=ip1,
ip2=ip2 )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- """
main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
main.assertReturnString = "Assertion Result for SDNIP-TCP IPV6 using TCP point intents\n"
- mac1 = main.hostsData[ 'h3' ][ 'mac' ]
- mac2 = main.hostsData[ 'h11' ][ 'mac' ]
- ip1 = str( main.hostsData[ 'h3' ][ 'ipAddresses' ][ 0 ] ) + "/128"
- ip2 = str( main.hostsData[ 'h11' ][ 'ipAddresses' ][ 0 ] ) + "/128"
+ mac1 = main.hostsData[ 'h1' ][ 'mac' ]
+ mac2 = main.hostsData[ 'h9' ][ 'mac' ]
+ ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128"
+ ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128"
ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
-
stepResult = main.intentFunction.pointIntentTcp(
main,
name="SDNIP-TCP",
- host1="h3",
- host2="h11",
- deviceId1="of:0000000000000005/3",
- deviceId2="of:0000000000000006/3",
+ host1="h1",
+ host2="h9",
+ deviceId1="of:0000000000000005/1",
+ deviceId2="of:0000000000000006/1",
mac1=mac1,
mac2=mac2,
- ethType="IPV4",
+ ethType="IPV6",
ipProto=ipProto,
ip1=ip1,
ip2=ip2,
tcp1=tcp1,
- tcp2=tcp2 )
-
+ tcp2=tcp2,
+ sw1="",
+ sw2="",
+ expectedLink="" )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- """
main.step( "DUALSTACK1: Add point intents between h3 and h11" )
main.assertReturnString = "Assertion Result for Dualstack1 IPV6 with mac address point intents\n"
stepResult = main.intentFunction.pointIntent(
@@ -570,15 +549,13 @@
ip2="",
tcp1="",
tcp2="",
- sw1="",
- sw2="",
+ sw1="s5",
+ sw2="s2",
expectedLink=18 )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
onfail=main.assertReturnString )
-
main.step( "VLAN: Add point intents between h5 and h24" )
main.assertReturnString = "Assertion Result for VLAN IPV6 with mac address point intents\n"
stepResult = main.intentFunction.pointIntent(
@@ -600,15 +577,13 @@
ip2="",
tcp1="",
tcp2="",
- sw1="",
- sw2="",
+ sw1="s5",
+ sw2="s2",
expectedLink=18 )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
onfail=main.assertReturnString )
-
main.step( "1HOP: Add point intents between h1 and h9" )
main.assertReturnString = "Assertion Result for 1HOP IPV6 with no mac address point intents\n"
stepResult = main.intentFunction.hostIntent( main,
@@ -617,10 +592,274 @@
host2='h9',
host1Id='00:00:00:00:00:01/-1',
host2Id='00:00:00:00:00:09/-1')
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+ main.intentFunction.report( main )
+
+ def CASE3000( self, main ):
+ """
+ Add single point to multi point intents
+ - Get device ids
+ - Add single point to multi point intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ """
+ import time
+ import json
+ import re
+ assert main, "There is no main"
+ assert main.CLIs, "There is no main.CLIs"
+ assert main.Mininet1, "Mininet handle should be named Mininet1"
+ assert main.numSwitch, "Placed the total number of switch topology in \
+ main.numSwitch"
+ main.testName = "Single to Multi Point Intents"
+ main.case( main.testName + " Test - " + str( main.numCtrls ) + " NODE(S) - OF " + main.OFProtocol )
+ main.caseExplanation = "This test case will test single point to" +\
+ " multi point intents using " +\
+ str( main.numCtrls ) + " node(s) cluster;\n" +\
+ "Different type of hosts will be tested in " +\
+ "each step such as IPV6, Dual stack, VLAN etc" +\
+ ";\nThe test will use OF " + main.OFProtocol +\
+ " OVS running in Mininet "
+ main.step( "NOOPTION: Add single point to multi point intents" )
+ hostNames = [ 'h1', 'h9', 'h17' ]
+ devices = [ 'of:0000000000000005/1','of:0000000000000006/1', 'of:0000000000000007/1' ]
+ main.assertReturnString = "Assertion results for IPV6 single to multi point intent with no options set\n"
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.singleToMultiIntent(
+ main,
+ name="NOOPTION",
+ hostNames=hostNames,
+ devices=devices,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18)
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+ main.step( "IPV6: Add single point to multi point intents" )
+ main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses\n"
+ hostNames = [ 'h1', 'h9', 'h17' ]
+ devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
+ macs = [ '00:00:00:00:00:01','00:00:00:00:00:09' ,'00:00:00:00:00:11' ]
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.singleToMultiIntent(
+ main,
+ name="IPV6",
+ hostNames=hostNames,
+ devices=devices,
+ macs=macs,
+ ethType="IPV6",
+ sw1="",
+ sw2="")
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+ main.step( "IPV6_2: Add single point to multi point intents" )
+ main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and no MAC addresses\n"
+ hostNames = [ 'h1', 'h9', 'h17' ]
+ devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.singleToMultiIntent(
+ main,
+ name="IPV6_2",
+ hostNames=hostNames,
+ devices=devices,
+ ethType="IPV6",
+ sw1="",
+ sw2="")
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+ main.step( "VLAN: Add single point to multi point intents" )
+ main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses in the same VLAN\n"
+ hostNames = [ 'h5', 'h24' ]
+ devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
+ macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ]
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.singleToMultiIntent(
+ main,
+ name="IPV6",
+ hostNames=hostNames,
+ devices=devices,
+ macs=macs,
+ ethType="IPV6",
+ sw1="",
+ sw2="")
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+ main.intentFunction.report( main )
+
+ def CASE4000( self, main ):
+ """
+ Add multi point to single point intents
+ - Get device ids
+ - Add multi point to single point intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ """
+ assert main, "There is no main"
+ assert main.CLIs, "There is no main.CLIs"
+ assert main.Mininet1, "Mininet handle should be named Mininet1"
+ assert main.numSwitch, "Placed the total number of switch topology in \
+ main.numSwitch"
+
+ main.testName = "Multi To Single Point Intents"
+ main.case( main.testName + " Test - " + str( main.numCtrls ) +
+ " NODE(S) - OF " + main.OFProtocol )
+ main.caseExplanation = "This test case will test single point to" +\
+ " multi point intents using " +\
+ str( main.numCtrls ) + " node(s) cluster;\n" +\
+ "Different type of hosts will be tested in " +\
+ "each step such as IPV6, Dual stack, VLAN etc" +\
+ ";\nThe test will use OF " + main.OFProtocol +\
+ " OVS running in Mininet"
+
+ main.step( "NOOPTION: Add multi point to single point intents" )
+ main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
+ stepResult = main.TRUE
+ hostNames = [ 'h17', 'h9' ]
+ devices = ['of:0000000000000007/1', 'of:0000000000000006/1' ]
+ stepResult = main.intentFunction.multiToSingleIntent(
+ main,
+ name="NOOPTION",
+ hostNames=hostNames,
+ devices=devices,
+ sw1="s6",
+ sw2="s2",
+ expectedLink=18 )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+ main.step( "IPV6: Add multi point to single point intents" )
+ main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and MAC addresses\n"
+ hostNames = [ 'h1', 'h9', 'h17' ]
+ devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
+ macs = [ '00:00:00:00:00:01','00:00:00:00:00:09' ,'00:00:00:00:00:11' ]
+ stepResult = main.TRUE
+ installResult = main.intentFunction.multiToSingleIntent(
+ main,
+ name="IPV6",
+ hostNames=hostNames,
+ devices=devices,
+ macs=macs,
+ ethType="IPV6",
+ sw1="",
+ sw2="",
+ expectedLink="" )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+ main.step( "IPV6_2: Add multi point to single point intents" )
+ main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses\n"
+ hostNames = [ 'h1', 'h9' ]
+ devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1' ]
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.multiToSingleIntent(
+ main,
+ name="IPV6_2",
+ hostNames=hostNames,
+ devices=devices,
+ ethType="IPV6",
+ sw1="",
+ sw2="",
+ expectedLink="")
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+
+ main.step( "VLAN: Add multi point to single point intents" )
+ main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses in the same VLAN\n"
+ hostNames = [ 'h5', 'h24' ]
+ devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
+ macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ]
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.multiToSingleIntent(
+ main,
+ name="VLAN",
+ hostNames=hostNames,
+ devices=devices,
+ macs=macs,
+ ethType="IPV6",
+ sw1="",
+ sw2="",
+ expectedLink="")
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+ main.intentFunction.report( main )
+
+ def CASE5000( self, main ):
+ """
+ Tests Host Mobility
+ Modifies the topology location of h1
+ """
+ assert main, "There is no main"
+ assert main.CLIs, "There is no main.CLIs"
+ assert main.Mininet1, "Mininet handle should be named Mininet1"
+ assert main.numSwitch, "Placed the total number of switch topology in \
+ main.numSwitch"
+ main.case( "Test host mobility with host intents " )
+ main.step( "Testing host mobility by moving h1 from s5 to s6" )
+ h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
+
+ main.log.info( "Moving h1 from s5 to s6")
+ main.Mininet1.moveHostv6( "h1","s5","s6" )
+ main.intentFunction.getHostsData( main )
+ h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
+
+ utilities.assert_equals( expect="of:0000000000000006",
+ actual=h1PostMove,
+ onpass="Mobility: Successfully moved h1 to s6",
+ onfail="Mobility: Failed to move h1 to s6" +
+ " to single point intents" +
+ " with IPV6 type and MAC addresses" +
+ " in the same VLAN" )
+ main.step( "IPV6: Add host intents between h1 and h9" )
+ main.assertReturnString = "Assert result for IPV6 host intent between h1, moved, and h9\n"
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.hostIntent( main,
+ name='IPV6 Mobility IPV6',
+ host1='h1',
+ host2='h9',
+ host1Id='00:00:00:00:00:01/-1',
+ host2Id='00:00:00:00:00:09/-1')
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- """
main.intentFunction.report( main )
diff --git a/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.py.save b/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.py.save
deleted file mode 100644
index 854d5f3..0000000
--- a/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.py.save
+++ /dev/null
@@ -1,625 +0,0 @@
-# Testing the basic intent for ipv6 functionality of ONOS
-
-class FUNCipv6Intent:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ):
- import time
- import imp
- import re
-
- """
- - Construct tests variables
- - GIT ( optional )
- - Checkout ONOS master branch
- - Pull latest ONOS code
- - Building ONOS ( optional )
- - Install ONOS package
- - Build ONOS package
- """
-
- main.case( "Constructing test variables and building ONOS package" )
- main.step( "Constructing test variables" )
- main.caseExplanation = "This test case is mainly for loading " +\
- "from params file, and pull and build the " +\
- " latest ONOS package"
- stepResult = main.FALSE
-
- # Test variables
- try:
- main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
- main.apps = main.params[ 'ENV' ][ 'cellApps' ]
- gitBranch = main.params[ 'GIT' ][ 'branch' ]
- main.dependencyPath = main.testOnDirectory + \
- main.params[ 'DEPENDENCY' ][ 'path' ]
- main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
- main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
- if main.ONOSbench.maxNodes:
- main.maxNodes = int( main.ONOSbench.maxNodes )
- else:
- main.maxNodes = 0
- wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
- wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
- wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
- main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
- main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
- main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
- main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
- main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
- main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
- gitPull = main.params[ 'GIT' ][ 'pull' ]
- main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
- main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
- main.cellData = {} # for creating cell file
- main.hostsData = {}
- main.CLIs = []
- main.ONOSip = []
- main.assertReturnString = '' # Assembled assert return string
-
- main.ONOSip = main.ONOSbench.getOnosIps()
- print main.ONOSip
-
- # Assigning ONOS cli handles to a list
- for i in range( 1, main.maxNodes + 1 ):
- main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
-
- # -- INIT SECTION, ONLY RUNS ONCE -- #
- main.startUp = imp.load_source( wrapperFile1,
- main.dependencyPath +
- wrapperFile1 +
- ".py" )
-
- main.intentFunction = imp.load_source( wrapperFile2,
- main.dependencyPath +
- wrapperFile2 +
- ".py" )
-
- main.topo = imp.load_source( wrapperFile3,
- main.dependencyPath +
- wrapperFile3 +
- ".py" )
-
- copyResult1 = main.ONOSbench.scp( main.Mininet1,
- main.dependencyPath +
- main.topology,
- main.Mininet1.home,
- direction="to" )
- if main.CLIs:
- stepResult = main.TRUE
- else:
- main.log.error( "Did not properly created list of ONOS CLI handle" )
- stepResult = main.FALSE
- except Exception as e:
- main.log.exception(e)
- main.cleanup()
- main.exit()
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully construct " +
- "test variables ",
- onfail="Failed to construct test variables" )
-
- if gitPull == 'True':
- main.step( "Building ONOS in " + gitBranch + " branch" )
- onosBuildResult = main.startUp.onosBuild( main, gitBranch )
- stepResult = onosBuildResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully compiled " +
- "latest ONOS",
- onfail="Failed to compile " +
- "latest ONOS" )
- else:
- main.log.warn( "Did not pull new code so skipping mvn " +
- "clean install" )
- main.ONOSbench.getVersion( report=True )
-
- def CASE2( self, main ):
- """
- - Set up cell
- - Create cell file
- - Set cell file
- - Verify cell file
- - Kill ONOS process
- - Uninstall ONOS cluster
- - Verify ONOS start up
- - Install ONOS cluster
- - Connect to cli
- """
-
- # main.scale[ 0 ] determines the current number of ONOS controller
- main.numCtrls = int( main.scale[ 0 ] )
-
- main.case( "Starting up " + str( main.numCtrls ) +
- " node(s) ONOS cluster" )
- main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
- " node(s) ONOS cluster"
-
-
-
- #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 ] )
-
- print "NODE COUNT = ", 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" )
-
- time.sleep( main.startUpSleep )
- main.step( "Uninstalling ONOS package" )
- onosUninstallResult = main.TRUE
- for ip in main.ONOSip:
- onosUninstallResult = onosUninstallResult and \
- main.ONOSbench.onosUninstall( nodeIp=ip )
- stepResult = onosUninstallResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully uninstalled ONOS package",
- onfail="Failed to uninstall ONOS package" )
-
- time.sleep( main.startUpSleep )
- main.step( "Installing ONOS package" )
- onosInstallResult = main.TRUE
- for i in range( main.numCtrls ):
- onosInstallResult = onosInstallResult and \
- main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
- stepResult = onosInstallResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully installed ONOS package",
- onfail="Failed to install ONOS package" )
-
- time.sleep( main.startUpSleep )
- main.step( "Starting ONOS service" )
- stopResult = main.TRUE
- startResult = main.TRUE
- onosIsUp = main.TRUE
-
- for i in range( main.numCtrls ):
- onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
- if onosIsUp == main.TRUE:
- main.log.report( "ONOS instance is up and ready" )
- else:
- main.log.report( "ONOS instance may not be up, stop and " +
- "start ONOS again " )
-
- for i in range( main.numCtrls ):
- stopResult = stopResult and \
- main.ONOSbench.onosStop( main.ONOSip[ i ] )
- for i in range( main.numCtrls ):
- startResult = startResult and \
- main.ONOSbench.onosStart( main.ONOSip[ i ] )
- stepResult = onosIsUp and stopResult and startResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="ONOS service is ready",
- onfail="ONOS service did not start properly" )
-
- main.step( "Start ONOS cli" )
- cliResult = main.TRUE
- for i in range( 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" )
-
- main.step( "Checking that ONOS is ready" )
- for i in range( 10 ):
- ready = True
- for i in range( int( main.scale[ 0 ] ) ):
- output = main.CLIs[ i ].summary()
- if not output:
- ready = False
- time.sleep( 30 )
- utilities.assert_equals( expect=True, actual=ready,
- onpass="ONOS summary command succeded",
- onfail="ONOS summary command failed" )
- if not ready:
- main.cleanup()
- main.exit()
-
- main.step( "setup the ipv6NeighbourDiscovery" )
- cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
- cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
- cfgResult = cfgResult1 and cfgResult2
- utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
- onpass="ipv6NeighborDiscovery cfg is set to true",
- onfail="Failed to cfg set ipv6NeighborDiscovery" )
-
- # Remove the first element in main.scale list
- main.scale.remove( main.scale[ 0 ] )
-
- main.intentFunction.report( main )
-
- def CASE11( self, main ):
- """
- Start Mininet topology with OF 1.3 switches
- """
- main.OFProtocol = "1.3"
- main.log.report( "Start Mininet topology with OF 1.3 switches" )
- main.case( "Start Mininet topology with OF 1.3 switches" )
- main.caseExplanation = "Start mininet topology with OF 1.3 " +\
- "switches to test intents, exits out if " +\
- "topology did not start correctly"
-
- main.step( "Starting Mininet topology with OF 1.3 switches" )
- args = "--switch ovs,protocols=OpenFlow13"
- topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
- main.topology,
- args=args )
- stepResult = topoResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully loaded topology",
- onfail="Failed to load topology" )
- # Exit if topology did not load properly
- if not topoResult:
- main.cleanup()
- main.exit()
-
- def CASE12( self, main ):
- """
- Assign mastership to controllers
- """
- import re
-
- main.case( "Assign switches to controllers" )
- main.step( "Assigning switches to controllers" )
- main.caseExplanation = "Assign OF " + main.OFProtocol +\
- " switches to ONOS nodes"
-
- assignResult = main.TRUE
- switchList = []
-
- # Creates a list switch name, use getSwitch() function later...
- for i in range( 1, ( main.numSwitch + 1 ) ):
- switchList.append( 's' + str( i ) )
-
- tempONOSip = []
- for i in range( main.numCtrls ):
- tempONOSip.append( main.ONOSip[ i ] )
-
- assignResult = main.Mininet1.assignSwController( sw=switchList,
- ip=tempONOSip,
- port='6653' )
- if not assignResult:
- main.cleanup()
- main.exit()
-
- for i in range( 1, ( main.numSwitch + 1 ) ):
- response = main.Mininet1.getSwController( "s" + str( i ) )
- print( "Response is " + str( response ) )
- if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
- assignResult = assignResult and main.TRUE
- else:
- assignResult = main.FALSE
- stepResult = assignResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully assigned switches" +
- "to controller",
- onfail="Failed to assign switches to " +
- "controller" )
-
- def CASE13( self, main ):
- """
- Discover all hosts and store its data to a dictionary
- """
- main.case( "Discover all hosts" )
-
- stepResult = main.TRUE
- main.step( "Discover all hosts using pingall " )
- stepResult = main.intentFunction.getHostsData( main )
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully discovered hosts",
- onfail="Failed to discover hosts" )
-
- def CASE14( self, main ):
- """
- Stop mininet
- """
- main.log.report( "Stop Mininet topology" )
- main.case( "Stop Mininet topology" )
- main.caseExplanation = "Stopping the current mininet topology " +\
- "to start up fresh"
-
- main.step( "Stopping Mininet Topology" )
- topoResult = main.Mininet1.stopNet( )
- stepResult = topoResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully stop mininet",
- onfail="Failed to stop mininet" )
- # Exit if topology did not load properly
- if not topoResult:
- main.cleanup()
- main.exit()
-
- def CASE2000( self, main ):
- """
- add point intents between 2 hosts:
- - Get device ids | ports
- - Add point intents
- - Check intents
- - Verify flows
- - Ping hosts
- - Reroute
- - Link down
- - Verify flows
- - Check topology
- - Ping hosts
- - Link up
- - Verify flows
- - Check topology
- - Ping hosts
- - Remove intents
- """
- import time
- import json
- import re
-
- # Assert variables - These variable's name|format must be followed
- # if you want to use the wrapper function
- assert main, "There is no main"
- assert main.CLIs, "There is no main.CLIs"
- assert main.Mininet1, "Mininet handle should be named Mininet1"
- assert main.numSwitch, "Placed the total number of switch topology in \
- main.numSwitch"
-
- main.testName = "Point Intents"
- main.case( main.testName + " Test - " + str( main.numCtrls ) +
- " NODE(S) - OF " + main.OFProtocol )
- main.caseExplanation = "This test case will test point to point" +\
- " intents using " + str( main.numCtrls ) +\
- " node(s) cluster;\n" +\
- "Different type of hosts will be tested in " +\
- "each step such as IPV4, Dual stack, VLAN etc" +\
- ";\nThe test will use OF " + main.OFProtocol +\
- " OVS running in Mininet"
-
- # No option point intents
- main.step( "NOOPTION: Add point intents between h1 and h9, ipv6 hosts" )
- main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
- stepResult = main.TRUE
- stepResult = main.intentFunction.pointIntent(
- main,
- name="NOOPTION",
- host1="h1",
- host2="h9",
- deviceId1="of:0000000000000005/1",
- deviceId2="of:0000000000000006/1")
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
-
- stepResult = main.TRUE
- main.step( "IPV6: Add point intents between h1 and h9" )
- main.assertReturnString = "Assertion Result for IPV6 point intent\n"
- stepResult = main.intentFunction.pointIntent(
- main,
- name="IPV6",
- host1="h1",
- host2="h9",
- deviceId1="of:0000000000000005/1",
- deviceId2="of:0000000000000006/1",
- port1="1",
- port2="1",
- ethType="IPV6",
- mac1="00:00:00:00:00:01",
- mac2="00:00:00:00:00:09",
- bandwidth="30",
- lambdaAlloc=False,
- ipProto="58",
- ip1="10:1:0::1/128",
- ip2="10:1:0::5/128",
- tcp1="",
- tcp2="",
- expectedLink=18 )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
-
- main.step( "IPV6_2: Add point intents between h1 and h9" )
- main.assertReturnString = "Assertion Result for IPV6 no mac address point intents\n"
- stepResult = main.intentFunction.pointIntent(
- main,
- name="IPV6_2",
- host1="h1",
- host2="h9",
- deviceId1="of:0000000000000005/1",
- deviceId2="of:0000000000000006/1",
- ipProto="58",
- ip1="10:1:0::1/128",
- ip2="10:1:0::5/128",
- tcp1="",
- tcp2="",
- expectedLink=18 )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
- """
- main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
- main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
- mac1 = main.hostsData[ 'h1' ][ 'mac' ]
- mac2 = main.hostsData[ 'h9' ][ 'mac' ]
- main.log.debug(mac2)
-
- # TODO : Fix is IPv6 arg format
- # when we install the intent "add-point-intent --ethType IPV6 --ethSrc 00:00:00:00:00:01
- # --ethDst 00:00:00:00:00:09 --ipProto 1 --ipSrc 10:1::1/128 --ipDst 10:1::5/128
- # of:0000000000000005/1 of:0000000000000006/1" controller reports following error :
- # Malformed IP prefix string: 10:1::1. Address must take form "x.x.x.x/y" or "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/y"
- ip1 = main.Mininet1.getIPAddress( 'h1', proto='IPV6' )
- ip2 = main.Mininet1.getIPAddress( 'h9', proto='IPV6')
-
- ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
- # Uneccessary, not including this in the selectors
- tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
- tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
-
- stepResult = main.intentFunction.pointIntent(
- main,
- name="SDNIP-ICMP",
- host1="h1",
- host2="h9",
- deviceId1="of:0000000000000005/1",
- deviceId2="of:0000000000000006/1",
- mac1=mac1,
- mac2=mac2,
- ethType="IPV6",
- ipProto=ipProto,
- ip1=ip1,
- ip2=ip2 )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
-
- main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
- main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
- mac1 = main.hostsData[ 'h1' ][ 'mac' ]
- mac2 = main.hostsData[ 'h9' ][ 'mac' ]
- ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
- ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
- ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
- tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
- tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
-
- stepResult = main.intentFunction.pointIntentTcp(
- main,
- name="SDNIP-TCP",
- host1="h1",
- host2="h9",
- deviceId1="of:0000000000000005/1",
- deviceId2="of:0000000000000006/1",
- mac1=mac1,
- mac2=mac2,
- ethType="IPV4",
- ipProto=ipProto,
- ip1=ip1,
- ip2=ip2,
- tcp1=tcp1,
- tcp2=tcp2 )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
-
- main.step( "DUALSTACK1: Add point intents between h3 and h11" )
- main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
- stepResult = main.intentFunction.pointIntent(
- main,
- name="DUALSTACK1",
- host1="h3",
- host2="h11",
- deviceId1="of:0000000000000005",
- deviceId2="of:0000000000000006",
- port1="3",
- port2="3",
- ethType="IPV4",
- mac1="00:00:00:00:00:03",
- mac2="00:00:00:00:00:0B",
- bandwidth="",
- lambdaAlloc=False,
- ipProto="",
- ip1="",
- ip2="",
- tcp1="",
- tcp2="",
- sw1="s5",
- sw2="s2",
- expectedLink=18 )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
-
- main.step( "VLAN: Add point intents between h5 and h21" )
- main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
- stepResult = main.intentFunction.pointIntent(
- main,
- name="VLAN",
- host1="h5",
- host2="h21",
- deviceId1="of:0000000000000005/5",
- deviceId2="of:0000000000000007/5",
- port1="",
- port2="",
- ethType="IPV4",
- mac1="00:00:00:00:00:05",
- mac2="00:00:00:00:00:15",
- bandwidth="",
- lambdaAlloc=False,
- ipProto="",
- ip1="",
- ip2="",
- tcp1="",
- tcp2="",
- sw1="s5",
- sw2="s2",
- expectedLink=18 )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
- """
- main.step( "1HOP: Add point intents between h1 and h9" )
- main.assertReturnString = "Assertion Result for 1HOP IPV6 with no mac address point intents\n"
- stepResult = main.intentFunction.hostIntent( main,
- name='1HOP',
- host1='h1',
- host2='h9',
- host1Id='00:00:00:00:00:01/-1',
- host2Id='00:00:00:00:00:09/-1')
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
-
- main.intentFunction.report( main )
-"""
diff --git a/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.topo b/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.topo
index 3c8ae7c..fd7c3eb 100755
--- a/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.topo
+++ b/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.topo
@@ -1,6 +1,5 @@
<TOPOLOGY>
<COMPONENT>
-
<ONOSbench>
<host>localhost</host>
<user>cnlabs</user>
@@ -8,7 +7,7 @@
<type>OnosDriver</type>
<connect_order>1</connect_order>
<COMPONENTS>
- <nodes>3</nodes>
+ <nodes>5</nodes>
</COMPONENTS>
</ONOSbench>
@@ -56,7 +55,6 @@
<connect_order>6</connect_order>
<COMPONENTS>
<home>~/mininet/custom/</home>
- <controller> remote </controller>
</COMPONENTS>
</Mininet1>
diff --git a/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.topo.save b/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.topo.save
deleted file mode 100755
index fb4776d..0000000
--- a/TestON/tests/FUNCipv6Intent/FUNCipv6Intent.topo.save
+++ /dev/null
@@ -1,64 +0,0 @@
-<TOPOLOGY>
- <COMPONENT>
-
- <ONOSbench>
- <host>localhost</host>
- <user>cnlabs</user>
- <password>cnlabs123</password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS>
- <nodes>3</nodes>
- </COMPONENTS>
- </ONOSbench>
-
- <ONOScli1>
- <host>localhost</host>
- <user>cnlabs</user>
- <password>cnlabs123</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli1>
-
- <ONOScli2>
- <host>localhost</host>
- <user>cnlabs</user>
- <password>cnlabs123</password>
- <type>OnosCliDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli2>
-
- <ONOScli3>
- <host>localhost</host>
- <user>cnlabs</user>
- <password>cnlabs123</password>
- <type>OnosCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli3>
-
- <ONOS1>
- <host>192.168.2.51</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1>
-
- <Mininet1>
- <host>localhost</host>
- <user>cnlabs</user>
- <password>cnlabs123</password>
- <type>MininetCliDriver</type>
- <connect_order>6</connect_order>
- <COMPONENTS>
- <home>~/mininet/custom/</home>
- <arg1>--topo
- </COMPONENTS>
- </Mininet1>
-
- </COMPONENT>
-</TOPOLOGY>