add test case 3 for I2 deployment
Change-Id: I6c25196deccaade07f7b4f31df0ac6fda2ef614f
diff --git a/TestON/tests/USECASE_SdnipInternet2/Dependency/USECASE_SdnipI2MN.py b/TestON/tests/USECASE_SdnipI2/Dependency/USECASE_SdnipI2MN.py
similarity index 99%
rename from TestON/tests/USECASE_SdnipInternet2/Dependency/USECASE_SdnipI2MN.py
rename to TestON/tests/USECASE_SdnipI2/Dependency/USECASE_SdnipI2MN.py
index 66c0c18..28d4725 100755
--- a/TestON/tests/USECASE_SdnipInternet2/Dependency/USECASE_SdnipI2MN.py
+++ b/TestON/tests/USECASE_SdnipI2/Dependency/USECASE_SdnipI2MN.py
@@ -40,7 +40,6 @@
peer64514 = self.addHost( 'peer64514' )
peer64515 = self.addHost( 'peer64515' )
peer64516 = self.addHost( 'peer64516' )
- sw100 = self.addSwitch( 'sw100', dpid = '00000000000000a1' )
'''
sw1 = self.addSwitch( 'SEAT', dpid = '00000000000000a1' )
diff --git a/TestON/tests/USECASE_SdnipInternet2/Dependency/quagga-sdn.conf b/TestON/tests/USECASE_SdnipI2/Dependency/quagga-sdn.conf
similarity index 100%
rename from TestON/tests/USECASE_SdnipInternet2/Dependency/quagga-sdn.conf
rename to TestON/tests/USECASE_SdnipI2/Dependency/quagga-sdn.conf
diff --git a/TestON/tests/USECASE_SdnipInternet2/Dependency/quagga64514.conf b/TestON/tests/USECASE_SdnipI2/Dependency/quagga64514.conf
similarity index 100%
rename from TestON/tests/USECASE_SdnipInternet2/Dependency/quagga64514.conf
rename to TestON/tests/USECASE_SdnipI2/Dependency/quagga64514.conf
diff --git a/TestON/tests/USECASE_SdnipInternet2/Dependency/quagga64515.conf b/TestON/tests/USECASE_SdnipI2/Dependency/quagga64515.conf
similarity index 100%
rename from TestON/tests/USECASE_SdnipInternet2/Dependency/quagga64515.conf
rename to TestON/tests/USECASE_SdnipI2/Dependency/quagga64515.conf
diff --git a/TestON/tests/USECASE_SdnipInternet2/Dependency/quagga64516.conf b/TestON/tests/USECASE_SdnipI2/Dependency/quagga64516.conf
similarity index 100%
rename from TestON/tests/USECASE_SdnipInternet2/Dependency/quagga64516.conf
rename to TestON/tests/USECASE_SdnipI2/Dependency/quagga64516.conf
diff --git a/TestON/tests/USECASE_SdnipInternet2/Dependency/zebra.conf b/TestON/tests/USECASE_SdnipI2/Dependency/zebra.conf
similarity index 100%
rename from TestON/tests/USECASE_SdnipInternet2/Dependency/zebra.conf
rename to TestON/tests/USECASE_SdnipI2/Dependency/zebra.conf
diff --git a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params
new file mode 100644
index 0000000..b35ef65
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params
@@ -0,0 +1,35 @@
+<PARAMS>
+
+ <testcases>100, 3</testcases>
+
+ #Environment variables
+ <ENV>
+ <cellName>sdnip_single_instance</cellName>
+ </ENV>
+
+ <CTRL>
+ <numCtrl>1</numCtrl>
+ <ip1>10.128.4.52</ip1>
+ <port1>6633</port1>
+ </CTRL>
+
+ <GIT>
+ <autoPull>on</autoPull>
+ <branch1>master</branch1>
+ <branch2>onos-1.3</branch2>
+ </GIT>
+
+ <JSON>
+ <prefix>prefix</prefix>
+ <nextHop>nextHop</nextHop>
+ </JSON>
+
+ <timers>
+ <SdnIpSetup>10</SdnIpSetup>
+ <PingTestWithRoutes>20</PingTestWithRoutes>
+ <PingTestWithoutRoutes>100</PingTestWithoutRoutes>
+ <RouteDelivery>60</RouteDelivery>
+ <PathAvailable>20</PathAvailable>
+ </timers>
+
+</PARAMS>
diff --git a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py
new file mode 100644
index 0000000..ab7e002
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py
@@ -0,0 +1,159 @@
+# Testing the functionality of SDN-IP with single ONOS instance
+class USECASE_SdnipI2:
+
+ def __init__( self ):
+ self.default = ''
+ global branchName
+
+
+ # This case is to setup ONOS
+ def CASE100( self, main ):
+ """
+ CASE100 is to compile ONOS and install it
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ """
+ import json
+ import time
+ from operator import eq
+
+ main.case( "Setting up test environment" )
+
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+ branchName = main.ONOSbench.getBranchName()
+ main.log.info( "ONOS is on branch: " + branchName )
+
+ main.log.report( "Uninstalling ONOS" )
+ main.ONOSbench.onosUninstall( ONOS1Ip )
+
+ # cleanInstallResult = main.TRUE
+ # gitPullResult = main.TRUE
+
+ main.step( "Git pull" )
+ gitPullResult = main.ONOSbench.gitPull()
+
+ main.step( "Using mvn clean install" )
+ if gitPullResult == main.TRUE:
+ cleanInstallResult = main.ONOSbench.cleanInstall( mciTimeout = 1000 )
+ else:
+ main.log.warn( "Did not pull new code so skipping mvn " +
+ "clean install" )
+ cleanInstallResult = main.TRUE
+
+ main.ONOSbench.getVersion( report = True )
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage( opTimeout = 500 )
+
+ main.step( "Installing ONOS package" )
+ onos1InstallResult = main.ONOSbench.onosInstall( options = "-f",
+ node = ONOS1Ip )
+
+ main.step( "Checking if ONOS is up yet" )
+ for i in range( 2 ):
+ onos1Isup = main.ONOSbench.isup( ONOS1Ip, timeout = 420 )
+ if onos1Isup:
+ break
+ if not onos1Isup:
+ main.log.report( "ONOS1 didn't start!" )
+
+ cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
+ commandlineTimeout = 100, onosStartTimeout = 600 )
+
+ case1Result = ( cleanInstallResult and packageResult and
+ cellResult and verifyResult and
+ onos1InstallResult and
+ onos1Isup and cliResult )
+
+ utilities.assert_equals( expect = main.TRUE, actual = case1Result,
+ onpass = "ONOS startup successful",
+ onfail = "ONOS startup NOT successful" )
+
+ if case1Result == main.FALSE:
+ main.cleanup()
+ main.exit()
+
+ def CASE1( self, main ):
+ '''
+ ping test from 3 bgp peers to BGP speaker
+ '''
+ main.case( "This case is to check ping between BGP peers and speakers" )
+
+ def CASE2( self, main ):
+ '''
+ point-to-point intents test for each BGP peer and BGP speaker pair
+ '''
+ main.case( "This case is to check point-to-point intents" )
+
+
+ def CASE3( self, main ):
+ '''
+ routes and intents check to all BGP peers
+ '''
+ main.case( "This case is to check routes and intents to all BGP peers" )
+
+ main.step( "Get links in the network" )
+ listResult = main.ONOScli.links( jsonFormat = False )
+ main.log.info( listResult )
+ main.log.info( "Activate sdn-ip application" )
+ main.ONOScli.activateApp( "org.onosproject.sdnip" )
+ # wait sdn-ip to finish installing connectivity intents, and the BGP
+ # paths in data plane are ready.
+ time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) )
+ # wait Quagga to finish delivery all routes to each other and to sdn-ip,
+ # plus finish installing all intents.
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) )
+
+
+ allRoutesExpected = []
+ allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" )
+ allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
+ allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
+
+ getRoutesResult = main.ONOScli.routes( jsonFormat = True )
+ allRoutesActual = \
+ main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
+ allRoutesStrExpected = str( sorted( allRoutesExpected ) )
+ allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
+
+ main.step( "Check routes installed" )
+ main.log.info( "Routes expected:" )
+ main.log.info( allRoutesStrExpected )
+ main.log.info( "Routes get from ONOS CLI:" )
+ main.log.info( allRoutesStrActual )
+ utilities.assertEquals( \
+ expect = allRoutesStrExpected, actual = allRoutesStrActual,
+ onpass = "***Routes in SDN-IP are correct!***",
+ onfail = "***Routes in SDN-IP are wrong!***" )
+
+ main.step( "Check MultiPointToSinglePointIntent intents installed" )
+ getIntentsResult = main.ONOScli.intents( jsonFormat = True )
+ routeIntentsActualNum = \
+ main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
+ routeIntentsExpectedNum = 3
+
+ main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
+ main.log.info( routeIntentsExpectedNum )
+ main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
+ main.log.info( routeIntentsActualNum )
+ utilities.assertEquals( \
+ expect = True,
+ actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ),
+ onpass = "***MultiPointToSinglePoint Intent Num in SDN-IP is \
+ correct!***",
+ onfail = "***MultiPointToSinglePoint Intent Num in SDN-IP is \
+ wrong!***" )
+
diff --git a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.topo b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.topo
new file mode 100644
index 0000000..4b39d3c
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.topo
@@ -0,0 +1,42 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>127.0.0.1</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOSbench>
+
+ <ONOScli>
+ <host>127.0.0.1</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli>
+
+ <ONOS1>
+ <host>10.128.4.52</host>
+ <user>sdn</user>
+ <password></password>
+ <type>OnosDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS1>
+
+ <QuaggaCliSpeaker1>
+ <host>127.0.0.1</host>
+ <user>admin</user>
+ <password></password>
+ <type>QuaggaCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </QuaggaCliSpeaker1>
+
+ </COMPONENT>
+</TOPOLOGY>
+
diff --git a/TestON/tests/USECASE_SdnipI2/__init__.py b/TestON/tests/USECASE_SdnipI2/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipI2/__init__.py
diff --git a/TestON/tests/USECASE_SdnipInternet2/network-cfg.json b/TestON/tests/USECASE_SdnipI2/network-cfg.json
similarity index 100%
rename from TestON/tests/USECASE_SdnipInternet2/network-cfg.json
rename to TestON/tests/USECASE_SdnipI2/network-cfg.json