Merge branch 'master' of https://github.com/srikanthvavila/ONLabTest
diff --git a/TestON/drivers/common/cli/quaggaclidriver.py b/TestON/drivers/common/cli/quaggaclidriver.py
index 7cc9688..c565ae0 100644
--- a/TestON/drivers/common/cli/quaggaclidriver.py
+++ b/TestON/drivers/common/cli/quaggaclidriver.py
@@ -354,16 +354,35 @@
self.disconnect()
main.log.info( "Start to add routes" )
- for i in range( 0, len( routes ) ):
- routeCmd = "network " + routes[ i ]
+ chunk_size = 20
+
+ if len(routes) > chunk_size:
+ num_iter = (int) (len(routes) / chunk_size)
+ else:
+ num_iter = 1;
+
+ total = 0
+ for n in range( 0, num_iter + 1):
+ routeCmd = ""
+ if (len( routes ) - (n * chunk_size)) >= chunk_size:
+ m = (n + 1) * chunk_size
+ else:
+ m = len( routes )
+ for i in range( n * chunk_size, m ):
+ routeCmd = routeCmd + "network " + routes[ i ] + "\n"
+ total = total + 1
+
+ main.log.info(routeCmd)
try:
self.handle.sendline( routeCmd )
self.handle.expect( "bgpd", timeout=5 )
except:
main.log.warn( "Failed to add route" )
self.disconnect()
+
# waitTimer = 1.00 / routeRate
- # time.sleep( waitTimer )
+ main.log.info("Total routes so far " + ((str) (total)) + " wait for 0 sec")
+ #time.sleep( 1 )
if routesAdded == len( routes ):
main.log.info( "Finished adding routes" )
return main.TRUE
@@ -426,77 +445,6 @@
main.log.info( "NO HANDLE" )
return main.FALSE
- def pingTestAndCheckAllPass( self, ip_address):
- main.log.info( "Start the ping test on host:" + str( ip_address ) )
-
- self.name = self.options[ 'name' ]
- self.handle = super( QuaggaCliDriver, self ).connect(
- user_name=self.user_name, ip_address=ip_address,
- 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 ) )
-
- testPass = main.TRUE
-
- if self.handle:
- # self.handle.expect( "" )
- # self.handle.expect( "\$" )
- main.log.info( "I in host " + str( ip_address ) )
-
- # Ping to 3.0.x.1 is just for sanity check. It always succeeds.
- for m in range( 3, 6 ):
- for n in range( 1, 11 ):
- hostIp = str( m ) + ".0." + str( n ) + ".1"
- main.log.info( "Ping to " + hostIp )
- try:
- self.handle.sendline("ping -c 1 " + hostIp)
- self.handle.expect( "64 bytes from", timeout=1 )
- except:
- main.log.warn("Ping error")
- testPass = main.FALSE
-
- return testPass
- else:
- main.log.info( "NO HANDLE" )
- return main.FALSE
-
- def pingTestAndCheckAllFail( self, ip_address):
- main.log.info( "Start the ping test on host:" + str( ip_address ) )
-
- self.name = self.options[ 'name' ]
- self.handle = super( QuaggaCliDriver, self ).connect(
- user_name=self.user_name, ip_address=ip_address,
- 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 ) )
-
- testPass = main.TRUE
-
- if self.handle:
- # self.handle.expect( "" )
- # self.handle.expect( "\$" )
- main.log.info( "I in host " + str( ip_address ) )
-
- for m in range( 4, 6 ):
- for n in range( 1, 11 ):
- hostIp = str( m ) + ".0." + str( n ) + ".1"
- main.log.info( "Ping to " + hostIp )
- try:
- self.handle.sendline("ping -c 1 " + hostIp)
- self.handle.expect( "64 bytes from", timeout=1 )
- testPass = main.FALSE
- except:
- main.log.warn("Ping error")
-
- return testPass
- else:
- main.log.info( "NO HANDLE" )
- return main.FALSE
-
-
-
# Please use the generateRoutes plus addRoutes instead of this one!
def addRoute( self, net, numRoutes, routeRate ):
diff --git a/TestON/tests/PeeringRouterTest/PeeringRouterTest.py b/TestON/tests/PeeringRouterTest/PeeringRouterTest.py
index e199d74..a58ca24 100755
--- a/TestON/tests/PeeringRouterTest/PeeringRouterTest.py
+++ b/TestON/tests/PeeringRouterTest/PeeringRouterTest.py
@@ -478,12 +478,12 @@
and test new drivers" )
TESTCASE_ROOT_PATH = main.params[ 'ENV' ][ 'home' ]
TESTCASE_MININET_ROOT_PATH = TESTCASE_ROOT_PATH + "/vlan/mininet"
- SDNIPJSONFILEPATH = TESTCASE_ROOT_PATH + "/sdnip.json"
+ SDNIPJSONFILEPATH = TESTCASE_ROOT_PATH + "/vlan/sdnip.json"
main.log.info("sdnip.json file path: "+ SDNIPJSONFILEPATH)
# Copy the json files to config dir
- main.ONOSbench.handle.sendline("cp " + TESTCASE_ROOT_PATH + "/addresses.json ~/onos/tools/package/config/")
- main.ONOSbench.handle.sendline("cp " + TESTCASE_ROOT_PATH + "/sdnip.json ~/onos/tools/package/config/")
+ main.ONOSbench.handle.sendline("cp " + TESTCASE_ROOT_PATH + "/vlan/addresses.json ~/onos/tools/package/config/")
+ main.ONOSbench.handle.sendline("cp " + TESTCASE_ROOT_PATH + "/vlan/sdnip.json ~/onos/tools/package/config/")
# Launch mininet topology for this case
MININET_TOPO_FILE = TESTCASE_MININET_ROOT_PATH + "/PeeringRouterMininetVlan.py"
@@ -499,7 +499,7 @@
main.step( "Start to generate routes for all BGP peers" )
main.log.info( "Generate prefixes for host3" )
- prefixesHost3 = main.QuaggaCliHost3.generatePrefixes( 3, 255 )
+ prefixesHost3 = main.QuaggaCliHost3.generatePrefixes( 3, 3500 )
main.log.info( prefixesHost3 )
# generate route with next hop
for prefix in prefixesHost3:
@@ -509,7 +509,7 @@
prefixesHost3, "192.168.20.1", "00:00:00:00:02:02",
SDNIPJSONFILEPATH )
main.log.info( "Generate prefixes for host4" )
- prefixesHost4 = main.QuaggaCliHost4.generatePrefixes( 4, 255 )
+ prefixesHost4 = main.QuaggaCliHost4.generatePrefixes( 4, 3500 )
main.log.info( prefixesHost4 )
# generate route with next hop
for prefix in prefixesHost4:
@@ -520,7 +520,7 @@
SDNIPJSONFILEPATH )
main.log.info( "Generate prefixes for host5" )
- prefixesHost5 = main.QuaggaCliHost5.generatePrefixes( 5, 255 )
+ prefixesHost5 = main.QuaggaCliHost5.generatePrefixes( 5, 3500 )
main.log.info( prefixesHost5 )
for prefix in prefixesHost5:
allRoutesExpected.append( prefix + "/" + "192.168.60.2" )
@@ -570,6 +570,8 @@
main.log.info( "Add routes to Quagga on host3" )
main.QuaggaCliHost3.addRoutes( prefixesHost3, 1 )
+ time.sleep(20)
+
main.log.info( "Login Quagga CLI on host4" )
main.QuaggaCliHost4.loginQuagga( "1.168.30.3" )
main.log.info( "Enter configuration model of Quagga CLI on host4" )
@@ -577,6 +579,8 @@
main.log.info( "Add routes to Quagga on host4" )
main.QuaggaCliHost4.addRoutes( prefixesHost4, 1 )
+ time.sleep(20)
+
main.log.info( "Login Quagga CLI on host5" )
main.QuaggaCliHost5.loginQuagga( "1.168.30.5" )
main.log.info( "Enter configuration model of Quagga CLI on host5" )
@@ -584,7 +588,17 @@
main.log.info( "Add routes to Quagga on host5" )
main.QuaggaCliHost5.addRoutes( prefixesHost5, 1 )
- time.sleep( 30 )
+ time.sleep(60)
+
+ # get routes inside SDN-IP
+ getRoutesResult = main.ONOScli.routes( jsonFormat=True )
+
+ # parse routes from ONOS CLI
+ allRoutesActual = \
+ main.QuaggaCliHost3.extractActualRoutes( getRoutesResult )
+
+ allRoutesStrExpected = str( sorted( allRoutesExpected ) )
+ allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
# get routes inside SDN-IP
getRoutesResult = main.ONOScli.routes( jsonFormat=True )
@@ -611,60 +625,24 @@
main.log.report(
"***Routes in SDN-IP after adding routes are wrong!***" )
+ time.sleep(20)
+
+
#============================= Ping Test ========================
- pingTestResults = main.QuaggaCliHost.pingTestAndCheckAllPass( "1.168.30.100" )
- main.log.info("Ping test result")
- if pingTestResults:
- main.log.info("Test succeeded")
- else:
- main.log.info("Test failed")
+ pingTestResults = main.TRUE
+ for m in range( 3, 6 ):
+ for n in range( 1, 10 ):
+ hostIp = str( m ) + ".0." + str( n ) + ".1"
+ r = main.Mininet.pingHost(SRC="as2host", TARGET=hostIp)
+ if r == main.FALSE:
+ pingTestResults = main.FALSE
utilities.assert_equals(expect=main.TRUE,actual=pingTestResults,
onpass="Default connectivity check PASS",
onfail="Default connectivity check FAIL")
- #============================= Deleting Routes ==================
- main.step( "Check deleting routes installed" )
- main.QuaggaCliHost3.deleteRoutes( prefixesHost3, 1 )
- main.QuaggaCliHost4.deleteRoutes( prefixesHost4, 1 )
- main.QuaggaCliHost5.deleteRoutes( prefixesHost5, 1 )
-
- getRoutesResult = main.ONOScli.routes( jsonFormat=True )
- allRoutesActual = \
- main.QuaggaCliHost3.extractActualRoutes( getRoutesResult )
-
- main.log.info( "allRoutes_actual = " )
- main.log.info( allRoutesActual )
-
- utilities.assertEquals(
- expect="[]", actual=str( allRoutesActual ),
- onpass="***Route number in SDN-IP is 0, correct!***",
- onfail="***Routes number in SDN-IP is not 0, wrong!***" )
-
- if( eq( allRoutesStrExpected, allRoutesStrActual ) ):
- main.log.report( "***Routes in SDN-IP after deleting correct!***" )
- else:
- main.log.report( "***Routes in SDN-IP after deleting wrong!***" )
-
- #============================= Ping Test ========================
- pingTestResults = main.QuaggaCliHost.pingTestAndCheckAllFail( "1.168.30.100" )
- main.log.info("Ping test result")
- if pingTestResults:
- main.log.info("Test succeeded")
- else:
- main.log.info("Test failed")
-
- utilities.assert_equals(expect=main.TRUE,actual=pingTestResults,
- onpass="disconnect check PASS",
- onfail="disconnect check FAIL")
-
- main.ONOScli.logout()
- main.ONOSbench.onosStop(ONOS1Ip);
- main.Mininet.stopNet()
time.sleep(10)
-
-
# Route convergence and connectivity test
def CASE21( self, main):
import time
diff --git a/TestON/tests/PeeringRouterTest/addresses.json b/TestON/tests/PeeringRouterTest/addresses.json
index 4e829ba..8831f8d 100644
--- a/TestON/tests/PeeringRouterTest/addresses.json
+++ b/TestON/tests/PeeringRouterTest/addresses.json
@@ -4,25 +4,25 @@
"dpid" : "00:00:00:00:00:00:00:01",
"port" : "1",
"ips" : ["192.168.10.101/24"],
- "mac" : "00:00:00:00:00:01",
+ "mac" : "00:00:00:00:00:01"
},
{
"dpid" : "00:00:00:00:00:00:00:01",
"port" : "2",
"ips" : ["192.168.20.101/24"],
- "mac" : "00:00:00:00:00:01",
+ "mac" : "00:00:00:00:00:01"
},
{
"dpid" : "00:00:00:00:00:00:00:01",
"port" : "3",
"ips" : ["192.168.30.101/24"],
- "mac" : "00:00:00:00:00:01",
+ "mac" : "00:00:00:00:00:01"
},
{
"dpid" : "00:00:00:00:00:00:00:01",
"port" : "4",
"ips" : ["192.168.60.101/24"],
- "mac" : "00:00:00:00:00:01",
+ "mac" : "00:00:00:00:00:01"
}
]