Added IpOptical and IpOpticalMulti for exclusive OpticalTests
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index 6ee414e..8419489 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -95,6 +95,31 @@
main.log.warn( outputs )
return main.TRUE
+ def arping( self, host="", ip="10.128.20.211" ):
+ """
+ Description:
+ Sends arp message from mininet host for hosts discovery
+ Required:
+ host - hosts name
+ Optional:
+ ip - ip address that does not exist in the network so there would
+ be no reply.
+ """
+ cmd = " py " + host + ".cmd(\"arping -c 1 " + ip + "\")"
+ try:
+ main.log.warn( "Sending: " + cmd )
+ self.handle.sendline( cmd )
+ response = self.handle.before
+ self.handle.sendline( "" )
+ self.handle.expect( "mininet>" )
+ return main.TRUE
+
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+
def pingLong( self, **pingParams ):
"""
Starts a continuous ping on the mininet host outputting
@@ -387,6 +412,7 @@
self.handle.expect( "Press ENTER to push Topology.json" )
time.sleep(30)
self.handle.sendline( "" )
+ self.handle.sendline( "" )
self.handle.expect("mininet>")
return main.TRUE
except pexpect.EOF:
diff --git a/TestON/tests/IpOptical/IpOptical.params b/TestON/tests/IpOptical/IpOptical.params
new file mode 100755
index 0000000..ccb4bdb
--- /dev/null
+++ b/TestON/tests/IpOptical/IpOptical.params
@@ -0,0 +1,41 @@
+<PARAMS>
+
+ <testcases>20,21,22,25,10,23,24</testcases>
+ #Environment variables
+ <ENV>
+ <cellName>driver_test</cellName>
+ </ENV>
+
+ <CTRL>
+ <ip1>10.128.20.11</ip1>
+ <port1>6633</port1>
+ </CTRL>
+
+ <PING>
+ <source1>h8</source1>
+ <source2>h9</source2>
+ <source3>h10</source3>
+ <source4>h11</source4>
+ <source5>h12</source5>
+ <source6>h13</source6>
+ <source7>h14</source7>
+ <source8>h15</source8>
+ <source9>h16</source9>
+ <source10>h17</source10>
+ <target1>10.0.0.18</target1>
+ <target2>10.0.0.19</target2>
+ <target3>10.0.0.20</target3>
+ <target4>10.0.0.21</target4>
+ <target5>10.0.0.22</target5>
+ <target6>10.0.0.23</target6>
+ <target7>10.0.0.24</target7>
+ <target8>10.0.0.25</target8>
+ <target9>10.0.0.26</target9>
+ <target10>10.0.0.27</target10>
+ </PING>
+
+ <timers>
+ <LinkDiscovery>5</LinkDiscovery>
+ <SwitchDiscovery>15</SwitchDiscovery>
+ </timers>
+</PARAMS>
diff --git a/TestON/tests/IpOptical/IpOptical.py b/TestON/tests/IpOptical/IpOptical.py
new file mode 100644
index 0000000..c290ac9
--- /dev/null
+++ b/TestON/tests/IpOptical/IpOptical.py
@@ -0,0 +1,640 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+# import sys
+# import os
+# import re
+import json
+
+time.sleep( 1 )
+
+class IpOptical:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ import time
+ """
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-log
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ """
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.case( "Setting up test environment" )
+ main.log.report(
+ "This testcase is testing setting up test environment" )
+ main.log.report( "__________________________________" )
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+ main.step( "Removing raft logs before a clen installation of ONOS" )
+ main.ONOSbench.onosRemoveRaftLogs()
+
+ main.step( "Git checkout and get version" )
+ #main.ONOSbench.gitCheckout( "master" )
+ gitPullResult = main.ONOSbench.gitPull()
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
+ main.ONOSbench.getVersion( report=True )
+
+ if gitPullResult == 1:
+ main.step( "Using mvn clean & install" )
+ main.ONOSbench.cleanInstall()
+ elif gitPullResult == 0:
+ main.log.report(
+ "Git Pull Failed, look into logs for detailed reason" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ main.step( "Uninstalling ONOS package" )
+ ONOSip1 = main.params[ 'CTRL' ][ 'ip1' ]
+ onosUninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOSip1)
+ if onosUninstallResult:
+ main.log.report( "Uninstalling ONOS package successful" )
+ else:
+ main.log.report( "Uninstalled ONOS package unsucessful" )
+ time.sleep( 5 )
+ main.step( "Installing ONOS package" )
+ onosInstallResult = main.ONOSbench.onosInstall( node = ONOSip1 )
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ onos1Isup = main.ONOSbench.isup()
+ if onos1Isup == main.TRUE:
+ main.log.report( "ONOS instance is up and ready" )
+ else:
+ main.log.report( "ONOS instance may not be up" )
+
+ main.step( "Starting ONOS service" )
+ startResult = main.ONOSbench.onosStart( ONOS1Ip )
+
+ main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ main.step( "Starting Mininet CLI..." )
+
+ case1Result = ( packageResult and
+ cellResult and verifyResult
+ and onosInstallResult and
+ onos1Isup and startResult )
+ utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+ onpass="Test startup successful",
+ onfail="Test startup NOT successful" )
+
+ def CASE20( self ):
+ """
+ Exit from mininet cli
+ reinstall ONOS
+ """
+ import time
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.log.report( "This testcase exits the mininet cli and reinstalls" +
+ "ONOS to switch over to Packet Optical topology" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Disconnecting mininet and restarting ONOS" )
+
+ main.step( "Disconnecting mininet and restarting ONOS" )
+ step1Result = main.TRUE
+ mininetDisconnect = main.Mininet1.disconnect()
+ print "mininetDisconnect = ", mininetDisconnect
+ step1Result = mininetDisconnect
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Mininet disconnect successfully",
+ onfail="Mininet failed to disconnect")
+ """
+ main.step( "Removing raft logs before a clean installation of ONOS" )
+ step2Result = main.TRUE
+ removeRaftLogsResult = main.ONOSbench.onosRemoveRaftLogs()
+ step2Result = removeRaftLogsResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Raft logs removed successfully",
+ onfail="Failed to remove raft logs")
+ """
+ main.step( "Applying cell variable to environment" )
+ step3Result = main.TRUE
+ setCellResult = main.ONOSbench.setCell( cellName )
+ verifyCellResult = main.ONOSbench.verifyCell()
+ step3Result = setCellResult and verifyCellResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step3Result,
+ onpass="Cell applied successfully",
+ onfail="Failed to apply cell")
+
+ main.step( "Uninstalling ONOS package" )
+ step4Result = main.TRUE
+ ONOSip1 = main.params[ 'CTRL' ][ 'ip1' ]
+ onosUninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOSip1)
+ step4Result = onosUninstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully uninstalled ONOS",
+ onfail="Failed to uninstall ONOS")
+
+ time.sleep( 5 )
+ main.step( "Installing ONOS package" )
+ step5Result = main.TRUE
+ onosInstallResult = main.ONOSbench.onosInstall( node = ONOSip1 )
+ step5Result = onosInstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step5Result,
+ onpass="Successfully installed ONOS",
+ onfail="Failed to install ONOS")
+
+ onos1Isup = main.ONOSbench.isup()
+ if onos1Isup == main.TRUE:
+ main.log.report( "ONOS instance is up and ready" )
+ else:
+ main.log.report( "ONOS instance may not be up" )
+
+ main.step( "Starting ONOS service" )
+ step6Result = main.TRUE
+ startResult = main.ONOSbench.onosStart( ONOS1Ip )
+ step6Result = startResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step6Result,
+ onpass="Successfully started ONOS",
+ onfail="Failed to start ONOS")
+
+ main.step( "Starting ONOS cli" )
+ step7Result = main.TRUE
+ cliResult = main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ step7Result = cliResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step7Result,
+ onpass="Successfully started ONOS cli",
+ onfail="Failed to start ONOS cli")
+
+ case20Result = step1Result and step3Result and\
+ step4Result and step5Result and step6Result and\
+ step7Result
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case20Result,
+ onpass= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS successful",
+ onfail= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS failed" )
+
+ def CASE21( self, main ):
+ """
+ On ONOS bench, run this command:
+ sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1
+ which spawns packet optical topology and copies the links
+ json file to the onos instance.
+ Note that in case of Packet Optical, the links are not learnt
+ from the topology, instead the links are learnt
+ from the json config file
+ """
+ import time
+ main.log.report(
+ "This testcase starts the packet layer topology and REST" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Starting LINC-OE and other components" )
+
+ main.step( "Activate optical app" )
+ step1Result = main.TRUE
+ activateOpticalResult = main.ONOS2.activateApp( "org.onosproject.optical" )
+ step1Result = activateOpticalResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully activated optical app",
+ onfail="Failed to activate optical app")
+
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
+
+ main.step( "Starting mininet and LINC-OE" )
+ step2Result = main.TRUE
+ time.sleep( 10 )
+ opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
+ step2Result = opticalMnScript
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Started the topology successfully ",
+ onfail="Failed to start the topology")
+
+ case21Result = step1Result and step2Result
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case21Result,
+ onpass="Packet optical topology spawned successsfully",
+ onfail="Packet optical topology spawning failed" )
+
+ def CASE22( self, main ):
+ """
+ Curretly we use, 10 optical switches(ROADM's) and
+ 6 packet layer mininet switches each with one host.
+ Therefore, the roadmCount variable = 10,
+ packetLayerSWCount variable = 6, hostCount=6 and
+ links=42.
+ All this is hardcoded in the testcase. If the topology changes,
+ these hardcoded values need to be changed
+ """
+ import time
+ main.log.report(
+ "This testcase compares the optical+packet topology against what" +
+ " is expected" )
+ main.case( "Topology comparision" )
+
+ main.step( "Starts new ONOS cli" )
+ step1Result = main.TRUE
+ cliResult = main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ]\
+ [ 'ip1' ] )
+ step1Result = cliResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully starts a new cli",
+ onfail="Failed to start new cli" )
+
+ main.step( "Compare topology" )
+ step2Result = main.TRUE
+ devicesResult = main.ONOS3.devices( jsonFormat=False )
+ print "devices_result :\n", devicesResult
+ devicesLinewise = devicesResult.split( "\n" )
+ roadmCount = 0
+ packetLayerSWCount = 0
+ for line in devicesLinewise:
+ components = line.split( "," )
+ availability = components[ 1 ].split( "=" )[ 1 ]
+ type = components[ 3 ].split( "=" )[ 1 ]
+ if availability == 'true' and type == 'ROADM':
+ roadmCount += 1
+ elif availability == 'true' and type == 'SWITCH':
+ packetLayerSWCount += 1
+ if roadmCount == 10:
+ print "Number of Optical Switches = %d and is" % roadmCount +\
+ " correctly detected"
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is correctly detected" )
+ opticalSWResult = main.TRUE
+ else:
+ print "Number of Optical Switches = %d and is wrong" % roadmCount
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is wrong" )
+ opticalSWResult = main.FALSE
+ if packetLayerSWCount == 6:
+ print "Number of Packet layer or mininet Switches = %d "\
+ % packetLayerSWCount + "and is correctly detected"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is correctly detected" )
+ packetSWResult = main.TRUE
+ else:
+ print "Number of Packet layer or mininet Switches = %d and"\
+ % packetLayerSWCount + " is wrong"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is wrong" )
+ packetSWResult = main.FALSE
+ # sleeps for sometime so the state of the switches will be active
+ time.sleep( 30 )
+ print "_________________________________"
+ linksResult = main.ONOS3.links( jsonFormat=False )
+ print "links_result = ", linksResult
+ print "_________________________________"
+ linkActiveCount = linksResult.count("state=ACTIVE")
+ main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+ if linkActiveCount == 42:
+ linkActiveResult = main.TRUE
+ main.log.info(
+ "Number of links in ACTIVE state are correct")
+ else:
+ linkActiveResult = main.FALSE
+ main.log.info(
+ "Number of links in ACTIVE state are wrong")
+ step2Result = opticalSWResult and packetSWResult and \
+ linkActiveResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfully loaded packet optical topology",
+ onfail="Failed to load packet optical topology" )
+
+ case22Result = step1Result and step2Result
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case22Result,
+ onpass="Packet optical topology discovery successful",
+ onfail="Packet optical topology discovery failed" )
+
+ def CASE23( self, main ):
+ import time
+ """
+ Add bidirectional point intents between 2 packet layer( mininet )
+ devices and
+ ping mininet hosts
+ """
+ main.log.report(
+ "This testcase adds bidirectional point intents between 2 " +
+ "packet layer( mininet ) devices and ping mininet hosts" )
+ main.case( "Install point intents between 2 packet layer device and " +
+ "ping the hosts" )
+
+ main.step( "Adding point intents" )
+ step1Result = main.TRUE
+ intentsId = []
+ pIntent1 = main.ONOS3.addPointIntent(
+ "of:0000ffffffff0001/1",
+ "of:0000ffffffff0005/1" )
+ pIntent2 = main.ONOS3.addPointIntent(
+ "of:0000ffffffff0005/1",
+ "of:0000ffffffff0001/1" )
+ intentsId.append( pIntent1 )
+ intentsId.append( pIntent2 )
+ main.log.info( "Checking intents state")
+ checkStateResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+ time.sleep( 30 )
+ main.log.info( "Checking flows state")
+ checkFlowResult = main.ONOS3.checkFlowsState()
+ # Sleep for 30 seconds to provide time for the intent state to change
+ time.sleep( 30 )
+ main.log.info( "Checking intents state one more time")
+ checkStateResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+ step1Result = checkStateResult and checkFlowResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully added point intents",
+ onfail="Failed to add point intents")
+
+ main.step( "Ping h1 and h5" )
+ step2Result = main.TRUE
+ main.log.info( "\n\nh1 is Pinging h5" )
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ step2Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfully pinged h1 and h5",
+ onfail="Failed to ping between h1 and h5")
+
+ case23Result = step1Result and step2Result
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case23Result,
+ onpass="Point intents are installed properly",
+ onfail="Failed to install point intents" )
+
+ def CASE24( self, main ):
+ import time
+ import json
+ """
+ LINC uses its own switch IDs. You can use the following
+ command on the LINC console to find the mapping between
+ DPIDs and LINC IDs.
+ rp(application:get_all_key(linc)).
+
+ Test Rerouting of Packet Optical by bringing a port down
+ ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+ so that link
+ ( between switch1 port20 - switch5 port50 ) is inactive
+ and do a ping test. If rerouting is successful,
+ ping should pass. also check the flows
+ """
+ main.log.report(
+ "This testcase tests rerouting and pings mininet hosts" )
+ main.case( "Test rerouting and pings mininet hosts" )
+
+ main.step( "Attach to the Linc-OE session" )
+ step1Result = main.TRUE
+ attachConsole = main.LincOE1.attachLincOESession()
+ step1Result = attachConsole
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully attached Linc-OE session",
+ onfail="Failed to attached Linc-OE session")
+
+ main.step( "Bring a port down and verify the link state" )
+ step2Result = main.TRUE
+ main.LincOE1.portDown( swId="9", ptId="20" )
+ linksNonjson = main.ONOS3.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+ linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 2:
+ main.log.info(
+ "Number of links in INACTIVE state are correct")
+ else:
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+ links = main.ONOS3.links()
+ main.log.info( "links = " + links )
+ linksResult = json.loads( links )
+ linksStateResult = main.FALSE
+ for item in linksResult:
+ if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+ 'src' ][ 'port' ] == "20":
+ if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+ 'dst' ][ 'port' ] == "50":
+ linksState = item[ 'state' ]
+ if linksState == "INACTIVE":
+ main.log.info(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ main.log.report(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ linksStateResult = main.TRUE
+ break
+ else:
+ main.log.info(
+ "Links state is not inactive as expected" )
+ main.log.report(
+ "Links state is not inactive as expected" )
+ linksStateResult = main.FALSE
+ time.sleep( 10 )
+ checkFlowsState = main.ONOS3.checkFlowsState()
+ step2Result = linksStateResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfuly brought down a link",
+ onfail="Failed to bring down a link")
+
+ main.step( "Verify Rerouting by a ping test" )
+ step3Result = main.TRUE
+ main.log.info( "\n\nh1 is Pinging h5" )
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ step3Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step3Result,
+ onpass="Successfully pinged h1 and h5",
+ onfail="Failed to ping between h1 and h5")
+
+ main.step( "Bring the downed port up and verify the link state" )
+ step4Result = main.TRUE
+ main.LincOE1.portUp( swId="9", ptId="20" )
+ linksNonjson = main.ONOS3.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+ linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 0:
+ main.log.info(
+ "Number of links in INACTIVE state are correct")
+ else:
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+ step4Result = main.FALSE
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully brought the port up",
+ onfail="Failed to bring the port up")
+
+ case24Result = step1Result and step2Result and step3Result \
+ and step4Result
+ utilities.assert_equals( expect=main.TRUE,
+ actual=case24Result,
+ onpass="Packet optical rerouting successful",
+ onfail="Packet optical rerouting failed" )
+
+ def CASE10( self ):
+ main.log.report(
+ "This testcase uninstalls the reactive forwarding app" )
+ main.log.report( "__________________________________" )
+ main.case( "Uninstalling reactive forwarding app" )
+ main.step( "Uninstalling reactive forwarding app" )
+ step1Result = main.TRUE
+ # Unistall onos-app-fwd app to disable reactive forwarding
+ main.log.info( "deactivate reactive forwarding app" )
+ appUninstallResult = main.ONOS2.deactivateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
+ step1Result = appUninstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully deactivate reactive forwarding app",
+ onfail="Failed to deactivate reactive forwarding app")
+ # After reactive forwarding is disabled, the reactive flows on
+ # switches timeout in 10-15s
+ # So sleep for 15s
+ time.sleep( 15 )
+ flows = main.ONOS2.flows()
+ main.log.info( flows )
+
+ case10Result = step1Result
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case10Result,
+ onpass="Reactive forwarding app uninstallation successful",
+ onfail="Reactive forwarding app uninstallation failed" )
+
+ def CASE25( self ):
+ """
+ Add host intents between 2 packet layer host
+ """
+ import time
+ import json
+ main.log.report( "Adding host intents between 2 optical layer host" )
+ main.case( "Test add host intents between optical layer host" )
+
+ main.log.step( "Discover host using arping" )
+ step1Result = main.TRUE
+ main.hostMACs = []
+ main.hostId = []
+ #Listing host MAC addresses
+ for i in range( 1 , 7 ):
+ main.hostMACs.append( "00:00:00:00:00:" +
+ str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+ for macs in main.hostMACs:
+ main.hostId.append( macs + "/-1" )
+ host1 = main.hostId[ 0 ]
+ host2 = main.hostId[ 1 ]
+ # Use arping to discover the hosts
+ main.LincOE2.arping( host = "h1" )
+ main.LincOE2.arping( host = "h2" )
+ time.sleep( 5 )
+ hostsDict = main.ONOS3.hosts()
+ if not len( hostsDict ):
+ step1Result = main.FALSE
+ # Adding host intent
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Hosts discovered",
+ onfail="Failed to discover hosts")
+
+ main.log.step( "Adding host intents to h1 and h2" )
+ step2Result = main.TRUE
+ intentsId = []
+ intent1 = main.ONOS3.addHostIntent( hostIdOne = host1,
+ hostIdTwo = host2 )
+ intentsId.append( intent1 )
+ time.sleep( 5 )
+ intent2 = main.ONOS3.addHostIntent( hostIdOne = host2,
+ hostIdTwo = host1 )
+ intentsId.append( intent2 )
+ # Checking intents state before pinging
+ main.log.info( "Checking intents state" )
+ time.sleep( 15 )
+ intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+ #check intent state again if intents are not in installed state
+ if not intentResult:
+ intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+ step2Result = intentResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step2Result,
+ onpass="All intents are in INSTALLED state ",
+ onfail="Some of the intents are not in " +
+ "INSTALLED state " )
+
+ # pinging h1 to h2 and then ping h2 to h1
+ main.log.step( "Pinging h1 and h2" )
+ step3Result = main.TRUE
+ pingResult = main.TRUE
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+ pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+ target="h1" )
+ step2Result = pingResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step2Result,
+ onpass="Pinged successfully between h1 and h2",
+ onfail="Pinged failed between h1 and h2" )
+
+ case25Result = step1Result and step2Result and step3Result
+ utilities.assert_equals( expect=main.TRUE, actual=case25Result,
+ onpass="Add host intent successful",
+ onfail="Add host intent failed" )
diff --git a/TestON/tests/IpOptical/IpOptical.topo b/TestON/tests/IpOptical/IpOptical.topo
new file mode 100755
index 0000000..9cef3f7
--- /dev/null
+++ b/TestON/tests/IpOptical/IpOptical.topo
@@ -0,0 +1,92 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOSbench>
+
+ <ONOS1>
+ <host>10.128.10.11</host>
+ <user>sdn</user>
+ <password>sdn</password>
+ <type>OnosDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS1>
+
+ <ONOS2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS2>
+
+ <ONOS3>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS3>
+
+
+ <Mininet1>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>MininetCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ #Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+ <arg2> --topo mytopo </arg2>
+ <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet1>
+
+ <Mininet2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ #Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+ <arg2> --topo mytopo </arg2>
+ <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet2>
+
+ <LincOE1>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>LincOEDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </LincOE1>
+
+ <LincOE2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </LincOE2>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/IpOptical/__init__.py b/TestON/tests/IpOptical/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/IpOptical/__init__.py
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMulti.params b/TestON/tests/IpOpticalMulti/IpOpticalMulti.params
new file mode 100755
index 0000000..f3fa343
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMulti.params
@@ -0,0 +1,64 @@
+<PARAMS>
+
+ <testcases>1,21,22,25,10,23,24</testcases>
+ #Environment variables
+ <ENV>
+ <cellName>multi_test</cellName>
+ </ENV>
+
+ <CTRL>
+ <ip1>10.128.20.11</ip1>
+ <ip2>10.128.20.12</ip2>
+ <ip3>10.128.20.13</ip3>
+ <port1>6633</port1>
+ <port2>6633</port2>
+ <port3>6633</port3>
+ </CTRL>
+
+ <SDNIP>
+ <ethType>IPV4</ethType>
+ <tcpProto>6</tcpProto>
+ <icmpProto>1</icmpProto>
+ <srcPort>5001</srcPort>
+ <dstPort>5001</dstPort>
+ </SDNIP>
+
+ <MULTIPOINT_INTENT>
+ <device1>of:0000000000003008/1 </device1>
+ <device2>of:0000000000003009/1 </device2>
+ <device3>of:0000000000003010/1 </device3>
+ <mac1>00:00:00:00:00:0A </mac1>
+ <mac2>00:00:00:00:00:08 </mac2>
+ <ip1>10.0.3.0/24 </ip1>
+ <ip2>10.0.1.0/24 </ip2>
+ </MULTIPOINT_INTENT>
+
+ <PING>
+ <source1>h8</source1>
+ <source2>h9</source2>
+ <source3>h10</source3>
+ <source4>h11</source4>
+ <source5>h12</source5>
+ <source6>h13</source6>
+ <source7>h14</source7>
+ <source8>h15</source8>
+ <source9>h16</source9>
+ <source10>h17</source10>
+ <target1>10.0.0.18</target1>
+ <target2>10.0.0.19</target2>
+ <target3>10.0.0.20</target3>
+ <target4>10.0.0.21</target4>
+ <target5>10.0.0.22</target5>
+ <target6>10.0.0.23</target6>
+ <target7>10.0.0.24</target7>
+ <target8>10.0.0.25</target8>
+ <target9>10.0.0.26</target9>
+ <target10>10.0.0.27</target10>
+ </PING>
+
+ <timers>
+ <LinkDiscovery>5</LinkDiscovery>
+ <SwitchDiscovery>31</SwitchDiscovery>
+ </timers>
+
+</PARAMS>
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMulti.py b/TestON/tests/IpOpticalMulti/IpOpticalMulti.py
new file mode 100644
index 0000000..d00410f
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMulti.py
@@ -0,0 +1,572 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+import time
+import json
+
+time.sleep( 1 )
+
+class IpOpticalMulti:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-logs
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ """
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+ ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+ ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+ ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+ ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+ main.case( "Setting up test environment" )
+ main.log.report(
+ "This testcase is testing setting up test environment" )
+ main.log.report( "__________________________________" )
+
+ main.step( "Applying cell variable to environment" )
+ cellResult1 = main.ONOSbench.setCell( cellName )
+ # cellResult2 = main.ONOScli1.setCell( cellName )
+ # cellResult3 = main.ONOScli2.setCell( cellName )
+ # cellResult4 = main.ONOScli3.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+ cellResult = cellResult1
+
+ main.step( "Removing raft logs before a clen installation of ONOS" )
+ removeLogResult = main.ONOSbench.onosRemoveRaftLogs()
+
+ main.step( "Git checkout, pull and get version" )
+ #main.ONOSbench.gitCheckout( "master" )
+ gitPullResult = main.ONOSbench.gitPull()
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
+ versionResult = main.ONOSbench.getVersion( report=True )
+
+ if gitPullResult == 1:
+ main.step( "Using mvn clean & install" )
+ cleanInstallResult = main.ONOSbench.cleanInstall()
+ # cleanInstallResult = main.TRUE
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ # main.step( "Creating a cell" )
+ # cellCreateResult = main.ONOSbench.createCellFile( **************
+ # )
+
+ main.step( "Installing ONOS package" )
+ onos1InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS1Ip )
+ onos2InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS2Ip )
+ onos3InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS3Ip )
+ onosInstallResult = onos1InstallResult and onos2InstallResult and\
+ onos3InstallResult
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+ onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+ onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+ onosIsup = onos1Isup and onos2Isup and onos3Isup
+ if onosIsup == main.TRUE:
+ main.log.report( "ONOS instances are up and ready" )
+ else:
+ main.log.report( "ONOS instances may not be up" )
+
+ main.step( "Starting ONOS service" )
+ startResult = main.TRUE
+ # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+ startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+ startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+ startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+ print startcli1
+ print startcli2
+ print startcli3
+
+ case1Result = ( packageResult and
+ cellResult and verifyResult and onosInstallResult and
+ onosIsup and startResult )
+ utilities.assertEquals( expect=main.TRUE, actual=case1Result,
+ onpass="Test startup successful",
+ onfail="Test startup NOT successful" )
+
+ def CASE10( self ):
+ import time
+ main.log.report(
+ "This testcase uninstalls the reactive forwarding app" )
+ main.log.report( "__________________________________" )
+ main.case( "Uninstalling reactive forwarding app" )
+ # Unistall onos-app-fwd app to disable reactive forwarding
+ appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOScli1.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOScli1.apps() )
+ main.log.warn( main.ONOScli1.appIDs() )
+ main.log.info( "onos-app-fwd uninstalled" )
+
+ # After reactive forwarding is disabled,
+ # the reactive flows on switches timeout in 10-15s
+ # So sleep for 15s
+ time.sleep( 15 )
+
+ hosts = main.ONOScli1.hosts()
+ main.log.info( hosts )
+ case10Result = appInstallResult
+ utilities.assertEquals(
+ expect=main.TRUE,
+ actual=case10Result,
+ onpass="Reactive forwarding app uninstallation successful",
+ onfail="Reactive forwarding app uninstallation failed" )
+
+ def CASE20( self ):
+ """
+ Exit from mininet cli
+ reinstall ONOS
+ """
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+ ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+ ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+ ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+ ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+ main.log.report( "This testcase exits the mininet cli and reinstalls" +
+ "ONOS to switch over to Packet Optical topology" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Disconnecting mininet and restarting ONOS" )
+ main.step( "Disconnecting mininet and restarting ONOS" )
+ mininetDisconnect = main.Mininet1.disconnect()
+ print "mininetDisconnect = ", mininetDisconnect
+
+ main.step( "Removing raft logs before a clen installation of ONOS" )
+ main.ONOSbench.onosRemoveRaftLogs()
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+
+ main.step( "Installing ONOS package" )
+ onos1InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS1Ip )
+ onos2InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS2Ip )
+ onos3InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS3Ip )
+ onosInstallResult = onos1InstallResult and onos2InstallResult and\
+ onos3InstallResult
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+ onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+ onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+ onosIsup = onos1Isup and onos2Isup and onos3Isup
+ if onosIsup == main.TRUE:
+ main.log.report( "ONOS instances are up and ready" )
+ else:
+ main.log.report( "ONOS instances may not be up" )
+
+ main.step( "Starting ONOS service" )
+ startResult = main.TRUE
+ # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+ startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+ startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+ startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+ startResult = startcli1 and startcli2 and startcli3
+ if startResult == main.TRUE:
+ main.log.report( "ONOS cli starts properly" )
+ case20Result = mininetDisconnect and cellResult and verifyResult \
+ and onosInstallResult and onosIsup and startResult
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case20Result,
+ onpass= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS successful",
+ onfail= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS failed" )
+
+ def CASE21( self, main ):
+ """
+ On ONOS bench, run this command:
+ sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1 <Ctrls>
+ which spawns packet optical topology and copies the links
+ json file to the onos instance.
+ Note that in case of Packet Optical, the links are not learnt
+ from the topology, instead the links are learnt
+ from the json config file
+ """
+ main.log.report(
+ "This testcase starts the packet layer topology and REST" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Starting LINC-OE and other components" )
+ main.step( "Starting LINC-OE and other components" )
+ main.log.info( "Activate optical app" )
+ appInstallResult = main.ONOScli1.activateApp( "org.onosproject.optical" )
+ appCheck = main.ONOScli1.appToIDCheck()
+ appCheck = appCheck and main.ONOScli2.appToIDCheck()
+ appCheck = appCheck and main.ONOScli3.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( "Checking ONOS application unsuccesful" )
+
+ ctrllerIP = []
+ ctrllerIP.append( main.params[ 'CTRL' ][ 'ip1' ] )
+ #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip2' ] )
+ #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip3' ] )
+ opticalMnScript = main.LincOE2.runOpticalMnScript( ctrllerIP = ctrllerIP )
+ case21Result = opticalMnScript and appInstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case21Result,
+ onpass="Packet optical topology spawned successsfully",
+ onfail="Packet optical topology spawning failed" )
+
+ def CASE22( self, main ):
+ """
+ Curretly we use, 10 optical switches(ROADM's) and
+ 6 packet layer mininet switches each with one host.
+ Therefore, the roadmCount variable = 10,
+ packetLayerSWCount variable = 6, hostCount=6 and
+ links=42.
+ All this is hardcoded in the testcase. If the topology changes,
+ these hardcoded values need to be changed
+ """
+ main.log.report(
+ "This testcase compares the optical+packet topology against what" +
+ " is expected" )
+ main.case( "Topology comparision" )
+ main.step( "Topology comparision" )
+ devicesResult = main.ONOScli3.devices( jsonFormat=False )
+
+ print "devices_result = ", devicesResult
+ devicesLinewise = devicesResult.split( "\n" )
+ roadmCount = 0
+ packetLayerSWCount = 0
+ for line in devicesLinewise:
+ components = line.split( "," )
+ availability = components[ 1 ].split( "=" )[ 1 ]
+ type = components[ 3 ].split( "=" )[ 1 ]
+ if availability == 'true' and type == 'ROADM':
+ roadmCount += 1
+ elif availability == 'true' and type == 'SWITCH':
+ packetLayerSWCount += 1
+ if roadmCount == 10:
+ print "Number of Optical Switches = %d and is" % roadmCount +\
+ " correctly detected"
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is correctly detected" )
+ opticalSWResult = main.TRUE
+ else:
+ print "Number of Optical Switches = %d and is wrong" % roadmCount
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is wrong" )
+ opticalSWResult = main.FALSE
+
+ if packetLayerSWCount == 6:
+ print "Number of Packet layer or mininet Switches = %d "\
+ % packetLayerSWCount + "and is correctly detected"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is correctly detected" )
+ packetSWResult = main.TRUE
+ else:
+ print "Number of Packet layer or mininet Switches = %d and"\
+ % packetLayerSWCount + " is wrong"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is wrong" )
+ packetSWResult = main.FALSE
+ print "_________________________________"
+
+ linksResult = main.ONOScli3.links( jsonFormat=False )
+ print "links_result = ", linksResult
+ print "_________________________________"
+ linkActiveCount = linksResult.count("state=ACTIVE")
+ main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+ if linkActiveCount == 42:
+ linkActiveResult = main.TRUE
+ main.log.info(
+ "Number of links in ACTIVE state are correct")
+ else:
+ linkActiveResult = main.FALSE
+ main.log.info(
+ "Number of links in ACTIVE state are wrong")
+
+ case22Result = opticalSWResult and packetSWResult and \
+ linkActiveResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case22Result,
+ onpass="Packet optical topology discovery successful",
+ onfail="Packet optical topology discovery failed" )
+
+ def CASE23( self, main ):
+ import time
+ """
+ Add bidirectional point intents between 2 packet layer( mininet )
+ devices and
+ ping mininet hosts
+ """
+ main.log.report(
+ "This testcase adds bidirectional point intents between 2 " +
+ "packet layer( mininet ) devices and ping mininet hosts" )
+ main.case( "Topology comparision" )
+ main.step( "Adding point intents" )
+ ptpIntentResult = main.ONOScli1.addPointIntent(
+ "of:0000ffffffff0001/1",
+ "of:0000ffffffff0005/1" )
+ if ptpIntentResult == main.TRUE:
+ main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "Point to point intent install successful" )
+
+ ptpIntentResult = main.ONOScli1.addPointIntent(
+ "of:0000ffffffff0005/1",
+ "of:0000ffffffff0001/1" )
+ if ptpIntentResult == main.TRUE:
+ main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "Point to point intent install successful" )
+
+ time.sleep( 30 )
+ flowHandle = main.ONOScli1.flows()
+ main.log.info( "flows :" + flowHandle )
+
+ # Sleep for 30 seconds to provide time for the intent state to change
+ time.sleep( 60 )
+ intentHandle = main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "intents :" + intentHandle )
+
+ PingResult = main.TRUE
+ count = 1
+ main.log.info( "\n\nh1 is Pinging h5" )
+ ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ # ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count < 5:
+ count += 1
+ PingResult = main.FALSE
+ main.log.info(
+ "Ping between h1 and h5 failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.info( "All ping attempts between h1 and h5 have failed" )
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h1 and h5 passed!" )
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.FALSE:
+ main.log.report(
+ "Point intents for packet optical have not ben installed" +
+ " correctly. Cleaning up" )
+ if PingResult == main.TRUE:
+ main.log.report(
+ "Point Intents for packet optical have been " +
+ "installed correctly" )
+
+ case23Result = PingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case23Result,
+ onpass= "Point intents addition for packet optical and" +
+ "Pingall Test successful",
+ onfail= "Point intents addition for packet optical and" +
+ "Pingall Test NOT successful" )
+
+ def CASE24( self, main ):
+ import time
+ import json
+ """
+ LINC uses its own switch IDs. You can use the following
+ command on the LINC console to find the mapping between
+ DPIDs and LINC IDs.
+ rp(application:get_all_key(linc)).
+
+ Test Rerouting of Packet Optical by bringing a port down
+ ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+ so that link
+ ( between switch1 port20 - switch5 port50 ) is inactive
+ and do a ping test. If rerouting is successful,
+ ping should pass. also check the flows
+ """
+ main.log.report(
+ "This testcase tests rerouting and pings mininet hosts" )
+ main.case( "Test rerouting and pings mininet hosts" )
+ main.step( "Attach to the Linc-OE session" )
+ attachConsole = main.LincOE1.attachLincOESession()
+ print "attachConsole = ", attachConsole
+
+ main.step( "Bring a port down and verify the link state" )
+ main.LincOE1.portDown( swId="9", ptId="20" )
+ linksNonjson = main.ONOScli3.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+
+ linkInactiveCount = linksNonjson.count("state=INACTIVE")
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 2:
+ main.log.info(
+ "Number of links in INACTIVE state are correct")
+ else:
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+
+ links = main.ONOScli3.links()
+ main.log.info( "links = " + links )
+
+ linksResult = json.loads( links )
+ linksStateResult = main.FALSE
+ for item in linksResult:
+ if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+ 'src' ][ 'port' ] == "20":
+ if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+ 'dst' ][ 'port' ] == "50":
+ linksState = item[ 'state' ]
+ if linksState == "INACTIVE":
+ main.log.info(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ main.log.report(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ linksStateResult = main.TRUE
+ break
+ else:
+ main.log.info(
+ "Links state is not inactive as expected" )
+ main.log.report(
+ "Links state is not inactive as expected" )
+ linksStateResult = main.FALSE
+
+ print "links_state_result = ", linksStateResult
+ time.sleep( 10 )
+ flowHandle = main.ONOScli3.flows()
+ main.log.info( "flows :" + flowHandle )
+
+ main.step( "Verify Rerouting by a ping test" )
+ PingResult = main.TRUE
+ count = 1
+ main.log.info( "\n\nh1 is Pinging h5" )
+ ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ # ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count < 5:
+ count += 1
+ PingResult = main.FALSE
+ main.log.info(
+ "Ping between h1 and h5 failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.info( "All ping attempts between h1 and h5 have failed" )
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h1 and h5 passed!" )
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.TRUE:
+ main.log.report( "Ping test successful " )
+ if PingResult == main.FALSE:
+ main.log.report( "Ping test failed" )
+
+ case24Result = PingResult and linksStateResult
+ utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+ onpass="Packet optical rerouting successful",
+ onfail="Packet optical rerouting failed" )
+
+ def CASE25( self ):
+ """
+ Add host intents between 2 packet layer host
+ """
+ import time
+ import json
+ main.log.report( "Adding host intents between 2 packet layer host" )
+ main.hostMACs = []
+ main.hostId = []
+ #Listing host MAC addresses
+ for i in range( 1 , 7 ):
+ main.hostMACs.append( "00:00:00:00:00:" +
+ str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+ for macs in main.hostMACs:
+ main.hostId.append( macs + "/-1" )
+
+ host1 = main.hostId[ 0 ]
+ host2 = main.hostId[ 1 ]
+ intentsId = []
+ # Use arping to discover the hosts
+ main.LincOE2.arping( host = "h1" )
+ main.LincOE2.arping( host = "h2" )
+ # Adding host intent
+ main.log.step( "Adding host intents to h1 and h2" )
+ intent1 = main.ONOScli1.addHostIntent( hostIdOne = host1,
+ hostIdTwo = host2 )
+ intentsId.append( intent1 )
+ time.sleep( 5 )
+ intent2 = main.ONOScli1.addHostIntent( hostIdOne = host2,
+ hostIdTwo = host1 )
+ intentsId.append( intent2 )
+ # Checking intents state before pinging
+ main.log.step( "Checking intents state" )
+ time.sleep( 10 )
+ intentResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+ utilities.assert_equals( expect=main.TRUE, actual=intentResult,
+ onpass="All intents are in INSTALLED state ",
+ onfail="Some of the intents are not in " +
+ "INSTALLED state " )
+
+ # pinging h1 to h2 and then ping h2 to h1
+ main.log.step( "Pinging h1 and h2" )
+ pingResult = main.TRUE
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+ pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+ target="h1" )
+
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+ onpass="Pinged successfully between h1 and h2",
+ onfail="Pinged failed between h1 and h2" )
+
+ case25Result = pingResult
+ utilities.assert_equals( expect=main.TRUE, actual=case25Result,
+ onpass="Add host intent successful",
+ onfail="Add host intent failed" )
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMulti.topo b/TestON/tests/IpOpticalMulti/IpOpticalMulti.topo
new file mode 100755
index 0000000..4b1ab12
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMulti.topo
@@ -0,0 +1,118 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOSbench>
+
+ <ONOScli1>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli1>
+
+ <ONOScli2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli2>
+
+ <ONOScli3>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli3>
+
+ <ONOS1>
+ <host>10.128.10.11</host>
+ <user>sdn</user>
+ <password>sdn</password>
+ <type>OnosCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS1>
+
+ <ONOS2>
+ <host>10.128.10.11</host>
+ <user>sdn</user>
+ <password>sdn</password>
+ <type>OnosCliDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS2>
+
+ <ONOS3>
+ <host>10.128.10.11</host>
+ <user>sdn</user>
+ <password>sdn</password>
+ <type>OnosCliDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS3>
+
+
+ <Mininet1>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>MininetCliDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS>
+ #Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+ <arg2> --topo mytopo </arg2>
+ <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet1>
+
+ <Mininet2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>9</connect_order>
+ <COMPONENTS>
+ #Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+ <arg2> --topo mytopo </arg2>
+ <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet2>
+
+ <LincOE1>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>LincOEDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </LincOE1>
+
+ <LincOE2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </LincOE2>
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/IpOpticalMulti/__init__.py b/TestON/tests/IpOpticalMulti/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/__init__.py
diff --git a/TestON/tests/MultiProd/MultiProd.py b/TestON/tests/MultiProd/MultiProd.py
index ace9d79..3de6eee 100644
--- a/TestON/tests/MultiProd/MultiProd.py
+++ b/TestON/tests/MultiProd/MultiProd.py
@@ -1765,7 +1765,6 @@
print "devices_result = ", devicesResult
devicesLinewise = devicesResult.split( "\n" )
- devicesLinewise = devicesLinewise[ 1: ]
roadmCount = 0
packetLayerSWCount = 0
for line in devicesLinewise:
diff --git a/TestON/tests/MultiProd13/MultiProd13.py b/TestON/tests/MultiProd13/MultiProd13.py
index 94d7a45..0ab9d4f 100644
--- a/TestON/tests/MultiProd13/MultiProd13.py
+++ b/TestON/tests/MultiProd13/MultiProd13.py
@@ -1765,7 +1765,6 @@
print "devices_result = ", devicesResult
devicesLinewise = devicesResult.split( "\n" )
- devicesLinewise = devicesLinewise[ 1: ]
roadmCount = 0
packetLayerSWCount = 0
for line in devicesLinewise:
diff --git a/TestON/tests/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
index f062893..f3fe33f 100644
--- a/TestON/tests/ProdFunc/ProdFunc.py
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -192,7 +192,7 @@
main.case( "Disconnecting mininet and restarting ONOS" )
main.step( "Disconnecting mininet and restarting ONOS" )
mininetDisconnect = main.Mininet1.disconnect()
- print "mininetDisconnect = ", mininetDisconnect
+ print "mininetDisconnect = ", mininetDisconnect
main.step( "Removing raft logs before a clen installation of ONOS" )
main.ONOSbench.onosRemoveRaftLogs()
@@ -279,7 +279,6 @@
print "devices_result = ", devicesResult
devicesLinewise = devicesResult.split( "\n" )
- devicesLinewise = devicesLinewise[ 1: ]
roadmCount = 0
packetLayerSWCount = 0
for line in devicesLinewise:
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.py b/TestON/tests/ProdFunc13/ProdFunc13.py
index 5989b78..5551759 100644
--- a/TestON/tests/ProdFunc13/ProdFunc13.py
+++ b/TestON/tests/ProdFunc13/ProdFunc13.py
@@ -279,7 +279,6 @@
print "devices_result = ", devicesResult
devicesLinewise = devicesResult.split( "\n" )
- devicesLinewise = devicesLinewise[ 1: ]
roadmCount = 0
packetLayerSWCount = 0
for line in devicesLinewise: