auto pull onos & add routes driver for master branch
diff --git a/TestON/drivers/common/cli/quaggaclidriver.py b/TestON/drivers/common/cli/quaggaclidriver.py
index 98f83d2..929858e 100644
--- a/TestON/drivers/common/cli/quaggaclidriver.py
+++ b/TestON/drivers/common/cli/quaggaclidriver.py
@@ -33,9 +33,9 @@
ip_address="1.1.1.1",
port=self.port,
pwd=self.pwd )
- main.log.info( "connect parameters:" + str( self.user_name ) + ";"
- + str( self.ip_address ) + ";" + str( self.port )
- + ";" + str(self.pwd ) )
+ #main.log.info( "connect parameters:" + str( self.user_name ) + ";"
+ # + str( self.ip_address ) + ";" + str( self.port )
+ # + ";" + str(self.pwd ) )
if self.handle:
# self.handle.expect( "",timeout=10 )
@@ -190,6 +190,17 @@
route[ 'prefix' ] + "/" + route[ 'nextHop' ] )
return sorted( allRoutesActual )
+ def extractActualRoutesNew( self, getRoutesResult ):
+ routesJsonObj = json.loads( getRoutesResult )
+
+ allRoutesActual = []
+ for route in routesJsonObj['routes4']:
+ if route[ 'prefix' ] == '172.16.10.0/24':
+ continue
+ allRoutesActual.append(
+ route[ 'prefix' ] + "/" + route[ 'nextHop' ] )
+
+ return sorted( allRoutesActual )
# This method extracts all actual route intents from ONOS CLI
def extractActualRouteIntents( self, getIntentsResult ):
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.params b/TestON/tests/SdnIpTest/SdnIpTest.params
index 7f7ef2d..e47adf6 100755
--- a/TestON/tests/SdnIpTest/SdnIpTest.params
+++ b/TestON/tests/SdnIpTest/SdnIpTest.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>4</testcases>
+ <testcases>100, [4]*5</testcases>
#Environment variables
<ENV>
@@ -8,13 +8,15 @@
</ENV>
<CTRL>
+ <numCtrl>1</numCtrl>
<ip1>10.128.4.52</ip1>
<port1>6633</port1>
</CTRL>
<GIT>
- <autoPull>off</autoPull>
- <checkout>master</checkout>
+ <autoPull>on</autoPull>
+ <branch1>master</branch1>
+ <branch2>onos-1.0</branch2>
</GIT>
<JSON>
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.py b/TestON/tests/SdnIpTest/SdnIpTest.py
index 85ac21e..7b18558 100644
--- a/TestON/tests/SdnIpTest/SdnIpTest.py
+++ b/TestON/tests/SdnIpTest/SdnIpTest.py
@@ -1,22 +1,91 @@
-# from cupshelpers.config import prefix
# Testing the basic functionality of SDN-IP
-
-
class SdnIpTest:
def __init__( self ):
self.default = ''
+ global git_branch
+
+ def CASE101( self, main ):
+ git_branch = main.params[ 'GIT' ][ 'branch1' ]
+ def CASE102( self, main ):
+ git_branch = main.params[ 'GIT' ][ 'branch2' ]
+ # Setup ONOS
+ def CASE100( self, main ):
+ import time
+ """
+ CASE100 is to compile ONOS and push it to the test machines
+ Startup sequence:
+ git pull
+ mvn clean install
+ onos-package
+ cell <name>
+ onos-verify-cell
+ onos-install -f
+ onos-wait-for-start
+ """
+ main.case( "Setting up test environment" )
-# from cupshelpers.config import prefix
+ PULLCODE = False
+ #if main.params[ 'Git' ] == 'True':
+ # PULLCODE = True
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-# Testing the basic functionality of SDN-IP
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+ main.log.report( "Uninstalling ONOS" )
+ main.ONOSbench.onosUninstall( ONOS1Ip )
-
-class SdnIpTest:
-
- def __init__( self ):
- self.default = ''
+ cleanInstallResult = main.TRUE
+ gitPullResult = main.TRUE
+
+ main.step( "Git pull" )
+ #main.ONOSbench.gitCheckout( git_branch )
+ gitPullResult = main.ONOSbench.gitPull()
+
+ main.step( "Using mvn clean & install" )
+ cleanInstallResult = main.TRUE
+ if gitPullResult == main.TRUE:
+ cleanInstallResult = main.ONOSbench.cleanInstall()
+ else:
+ main.log.warn( "Did not pull new code so skipping mvn " +
+ "clean install" )
+ main.ONOSbench.getVersion( report=True )
+
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ 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 )
+ if onos1Isup:
+ break
+ if not onos1Isup:
+ main.log.report( "ONOS1 didn't start!" )
+
+ cliResult = main.ONOScli.startOnosCli( ONOS1Ip )
+
+ case1Result = ( cleanInstallResult and packageResult and
+ cellResult and verifyResult and
+ onos1InstallResult and
+ onos1Isup and cliResult )
+
+ utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+ onpass="Test startup successful",
+ onfail="Test startup NOT successful" )
+
+ if case1Result == main.FALSE:
+ main.cleanup()
+ main.exit()
def CASE4( self, main ):
"""
@@ -40,7 +109,7 @@
and test new drivers" )
# SDNIPJSONFILEPATH = "../tests/SdnIpTest/sdnip.json"
SDNIPJSONFILEPATH = \
- "/home/admin/workspace/onos/tools/package/config/sdnip.json"
+ "/home/admin/ONOS/tools/package/config/sdnip.json"
# all expected routes for all BGP peers
allRoutesExpected = []
main.step( "Start to generate routes for all BGP peers" )
@@ -79,31 +148,33 @@
routeIntentsExpected = routeIntentsExpectedHost3 + \
routeIntentsExpectedHost4 + routeIntentsExpectedHost5
- cellName = main.params[ 'ENV' ][ 'cellName' ]
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
- main.step( "Set cell for ONOS-cli environment" )
- main.ONOScli.setCell( cellName )
- verifyResult = main.ONOSbench.verifyCell()
-
- main.log.report( "Removing raft logs" )
- main.ONOSbench.onosRemoveRaftLogs()
- main.log.report( "Uninstalling ONOS" )
- main.ONOSbench.onosUninstall( ONOS1Ip )
-
- main.step( "Installing ONOS package" )
- onos1InstallResult = main.ONOSbench.onosInstall(
- options="-f", node=ONOS1Ip )
-
- main.step( "Checking if ONOS is up yet" )
- time.sleep( 150 )
- onos1Isup = main.ONOSbench.isup( ONOS1Ip )
- if not onos1Isup:
- main.log.report( "ONOS1 didn't start!" )
-
- main.step( "Start ONOS-cli" )
-
- main.ONOScli.startOnosCli( ONOS1Ip )
-
+ #####
+# cellName = main.params[ 'ENV' ][ 'cellName' ]
+# ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+# main.step( "Set cell for ONOS-cli environment" )
+# main.ONOScli.setCell( cellName )
+# verifyResult = main.ONOSbench.verifyCell()
+#
+# main.log.report( "Removing raft logs" )
+# main.ONOSbench.onosRemoveRaftLogs()
+# main.log.report( "Uninstalling ONOS" )
+# main.ONOSbench.onosUninstall( ONOS1Ip )
+#
+# main.step( "Installing ONOS package" )
+# onos1InstallResult = main.ONOSbench.onosInstall(
+# options="-f", node=ONOS1Ip )
+#
+# main.step( "Checking if ONOS is up yet" )
+# time.sleep( 150 )
+# onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+# if not onos1Isup:
+# main.log.report( "ONOS1 didn't start!" )
+#
+# main.step( "Start ONOS-cli" )
+#
+# main.ONOScli.startOnosCli( ONOS1Ip )
+ #####
+
main.step( "Get devices in the network" )
listResult = main.ONOScli.devices( jsonFormat=False )
main.log.info( listResult )
@@ -138,8 +209,7 @@
prefixesHostX = main.QuaggaCliHost.generatePrefixes( str( i ), 10 )
main.log.info( prefixesHostX )
for prefix in prefixesHostX:
- allRoutesExpected.append(
- prefix + "/" + "192.168.40." + str( i - 100 ) )
+ allRoutesExpected.append( prefix + "/" + "192.168.40." + str( i - 100 ) )
routeIntentsExpectedHostX = \
main.QuaggaCliHost.generateExpectedOnePeerRouteIntents(
@@ -165,7 +235,7 @@
# parse routes from ONOS CLI
allRoutesActual = \
main.QuaggaCliHost3.extractActualRoutes( getRoutesResult )
-
+
allRoutesStrExpected = str( sorted( allRoutesExpected ) )
allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
main.step( "Check routes installed" )
@@ -338,7 +408,7 @@
environment and test new drivers" )
# SDNIPJSONFILEPATH = "../tests/SdnIpTest/sdnip.json"
SDNIPJSONFILEPATH = \
- "/home/admin/workspace/onos/tools/package/config/sdnip.json"
+ "/home/admin/ONOS/tools/package/config/sdnip.json"
# all expected routes for all BGP peers
allRoutesExpected = []
main.step( "Start to generate routes for all BGP peers" )