Changed Lincoe and SdnIpTest naming style
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.py b/TestON/tests/SdnIpTest/SdnIpTest.py
index 081b1ca..53560f3 100644
--- a/TestON/tests/SdnIpTest/SdnIpTest.py
+++ b/TestON/tests/SdnIpTest/SdnIpTest.py
@@ -11,12 +11,14 @@
def CASE1( self, main ):
"""
Test the SDN-IP functionality
- allRoutes_expected: all expected routes for all BGP peers
- routeIntents_expected: all expected MultiPointToSinglePointIntent intents
- bgpIntents_expected: expected PointToPointIntent intents
- allRoutes_actual: all routes from ONOS LCI
- routeIntents_actual: actual MultiPointToSinglePointIntent intents from ONOS CLI
- bgpIntents_actual: actual PointToPointIntent intents from ONOS CLI
+ allRoutesExpected: all expected routes for all BGP peers
+ routeIntentsExpected: all expected
+ MultiPointToSinglePointIntent intents
+ bgpIntentsExpected: expected PointToPointIntent intents
+ allRoutesActual: all routes from ONOS LCI
+ routeIntentsActual: actual MultiPointToSinglePointIntent
+ intents from ONOS CLI
+ bgpIntentsActual: actual PointToPointIntent intents from ONOS CLI
"""
import time
import json
@@ -25,10 +27,11 @@
from time import localtime, strftime
main.case(
- "The test case is to help to setup the TestON environment and test new drivers" )
- SDNIP_JSON_FILE_PATH = "../tests/SdnIpTest/sdnip.json"
+ "The test case is to help to setup the TestON " +
+ "environment and test new drivers" )
+ SDNIPJSONFILEPATH = "../tests/SdnIpTest/sdnip.json"
# all expected routes for all BGP peers
- allRoutes_expected = []
+ allRoutesExpected = []
main.step( "Start to generate routes for all BGP peers" )
# bgpPeerHosts = []
# for i in range( 3, 5 ):
@@ -37,111 +40,111 @@
# for i in range( 3, 5 ):
# QuaggaCliHost = "QuaggaCliHost" + str( i )
- # prefixes = main.QuaggaCliHost.generate_prefixes( 3, 10 )
+ # prefixes = main.QuaggaCliHost.generatePrefixes( 3, 10 )
# main.log.info( prefixes )
- # allRoutes_expected.append( prefixes )
+ # allRoutesExpected.append( prefixes )
main.log.info( "Generate prefixes for host3" )
- prefixes_host3 = main.QuaggaCliHost3.generate_prefixes( 3, 10 )
- main.log.info( prefixes_host3 )
+ prefixesHost3 = main.QuaggaCliHost3.generatePrefixes( 3, 10 )
+ main.log.info( prefixesHost3 )
# generate route with next hop
- for prefix in prefixes_host3:
- allRoutes_expected.append( prefix + "/" + "192.168.20.1" )
- routeIntents_expected_host3 = main.QuaggaCliHost3.generate_expected_onePeerRouteIntents(
- prefixes_host3,
- "192.168.20.1",
- "00:00:00:00:02:02",
- SDNIP_JSON_FILE_PATH )
+ for prefix in prefixesHost3:
+ allRoutesExpected.append( prefix + "/" + "192.168.20.1" )
+ routeIntentsExpectedHost3 = main.QuaggaCliHost3.\
+ generateExpectedOnePeerRouteIntents( prefixesHost3,
+ "192.168.20.1",
+ "00:00:00:00:02:02",
+ SDNIPJSONFILEPATH )
main.log.info( "Generate prefixes for host4" )
- prefixes_host4 = main.QuaggaCliHost4.generate_prefixes( 4, 10 )
- main.log.info( prefixes_host4 )
+ prefixesHost4 = main.QuaggaCliHost4.generatePrefixes( 4, 10 )
+ main.log.info( prefixesHost4 )
# generate route with next hop
- for prefix in prefixes_host4:
- allRoutes_expected.append( prefix + "/" + "192.168.30.1" )
- routeIntents_expected_host4 = main.QuaggaCliHost4.generate_expected_onePeerRouteIntents(
- prefixes_host4,
- "192.168.30.1",
- "00:00:00:00:03:01",
- SDNIP_JSON_FILE_PATH )
+ for prefix in prefixesHost4:
+ allRoutesExpected.append( prefix + "/" + "192.168.30.1" )
+ routeIntentsExpectedHost4 = main.QuaggaCliHost4.\
+ generateExpectedOnePeerRouteIntents( prefixesHost4,
+ "192.168.30.1",
+ "00:00:00:00:03:01",
+ SDNIPJSONFILEPATH )
- routeIntents_expected = routeIntents_expected_host3 + \
- routeIntents_expected_host4
+ routeIntentsExpected = routeIntentsExpectedHost3 + \
+ routeIntentsExpectedHost4
- cell_name = main.params[ 'ENV' ][ 'cellName' ]
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
main.step( "Set cell for ONOS-cli environment" )
- main.ONOScli.set_cell( cell_name )
- verify_result = main.ONOSbench.verify_cell()
+ main.ONOScli.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
main.log.report( "Removing raft logs" )
- main.ONOSbench.onos_remove_raft_logs()
+ main.ONOSbench.onosRemoveRaftLogs()
main.log.report( "Uninstalling ONOS" )
- main.ONOSbench.onos_uninstall( ONOS1_ip )
+ main.ONOSbench.onosUninstall( ONOS1Ip )
main.step( "Creating ONOS package" )
- package_result = main.ONOSbench.onos_package()
+ packageResult = main.ONOSbench.onosPackage()
main.step( "Starting ONOS service" )
# TODO: start ONOS from Mininet Script
- # start_result = main.ONOSbench.onos_start( "127.0.0.1" )
+ # startResult = main.ONOSbench.onosStart( "127.0.0.1" )
main.step( "Installing ONOS package" )
- onos1_install_result = main.ONOSbench.onos_install(
+ onos1InstallResult = main.ONOSbench.onosInstall(
options="-f",
- node=ONOS1_ip )
+ node=ONOS1Ip )
main.step( "Checking if ONOS is up yet" )
time.sleep( 60 )
- onos1_isup = main.ONOSbench.isup( ONOS1_ip )
- if not onos1_isup:
+ onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+ if not onos1Isup:
main.log.report( "ONOS1 didn't start!" )
main.step( "Start ONOS-cli" )
- # TODO: change the hardcode in start_onos_cli method in ONOS CLI driver
+ # TODO: change the hardcode in startOnosCli method in ONOS CLI driver
- main.ONOScli.start_onos_cli( ONOS1_ip )
+ main.ONOScli.startOnosCli( ONOS1Ip )
main.step( "Get devices in the network" )
- list_result = main.ONOScli.devices( json_format=False )
- main.log.info( list_result )
+ listResult = main.ONOScli.devices( jsonFormat=False )
+ main.log.info( listResult )
time.sleep( 10 )
main.log.info( "Installing sdn-ip feature" )
- main.ONOScli.feature_install( "onos-app-sdnip" )
+ main.ONOScli.featureInstall( "onos-app-sdnip" )
time.sleep( 10 )
main.step( "Login all BGP peers and add routes into peers" )
main.log.info( "Login Quagga CLI on host3" )
main.QuaggaCliHost3.loginQuagga( "1.168.30.2" )
main.log.info( "Enter configuration model of Quagga CLI on host3" )
- main.QuaggaCliHost3.enter_config( 64514 )
+ main.QuaggaCliHost3.enterConfig( 64514 )
main.log.info( "Add routes to Quagga on host3" )
- main.QuaggaCliHost3.add_routes( prefixes_host3, 1 )
+ main.QuaggaCliHost3.addRoutes( prefixesHost3, 1 )
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" )
- main.QuaggaCliHost4.enter_config( 64516 )
+ main.QuaggaCliHost4.enterConfig( 64516 )
main.log.info( "Add routes to Quagga on host4" )
- main.QuaggaCliHost4.add_routes( prefixes_host4, 1 )
+ main.QuaggaCliHost4.addRoutes( prefixesHost4, 1 )
time.sleep( 60 )
# get all routes inside SDN-IP
- get_routes_result = main.ONOScli.routes( json_format=True )
+ getRoutesResult = main.ONOScli.routes( jsonFormat=True )
# parse routes from ONOS CLI
- allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(
- get_routes_result )
+ allRoutesActual = main.QuaggaCliHost3.extractActualRoutes(
+ getRoutesResult )
- allRoutes_str_expected = str( sorted( allRoutes_expected ) )
- allRoutes_str_actual = str( allRoutes_actual ).replace( 'u', "" )
+ allRoutesStrExpected = str( sorted( allRoutesExpected ) )
+ allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
main.step( "Check routes installed" )
main.log.info( "Routes expected:" )
- main.log.info( allRoutes_str_expected )
+ main.log.info( allRoutesStrExpected )
main.log.info( "Routes get from ONOS CLI:" )
- main.log.info( allRoutes_str_actual )
- utilities.assert_equals(
- expect=allRoutes_str_expected,
- actual=allRoutes_str_actual,
+ main.log.info( allRoutesStrActual )
+ utilities.assertEquals(
+ expect=allRoutesStrExpected,
+ actual=allRoutesStrActual,
onpass="***Routes in SDN-IP are correct!***",
onfail="***Routes in SDN-IP are wrong!***" )
- if( eq( allRoutes_str_expected, allRoutes_str_actual ) ):
+ if( eq( allRoutesStrExpected, allRoutesStrActual ) ):
main.log.report(
"***Routes in SDN-IP after adding routes are correct!***" )
else:
@@ -149,132 +152,143 @@
"***Routes in SDN-IP after adding routes are wrong!***" )
time.sleep( 20 )
- get_intents_result = main.ONOScli.intents( json_format=True )
+ getIntentsResult = main.ONOScli.intents( jsonFormat=True )
main.step( "Check MultiPointToSinglePointIntent intents installed" )
- # route_intents_expected are generated when generating routes
+ # routeIntentsExpected are generated when generating routes
# get rpoute intents from ONOS CLI
- routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(
- get_intents_result )
- routeIntents_str_expected = str( sorted( routeIntents_expected ) )
- routeIntents_str_actual = str( routeIntents_actual ).replace( 'u', "" )
+ routeIntentsActual = main.QuaggaCliHost3.extractActualRouteIntents(
+ getIntentsResult )
+ routeIntentsStrExpected = str( sorted( routeIntentsExpected ) )
+ routeIntentsStrActual = str( routeIntentsActual ).replace( 'u', "" )
main.log.info( "MultiPointToSinglePoint intents expected:" )
- main.log.info( routeIntents_str_expected )
+ main.log.info( routeIntentsStrExpected )
main.log.info( "MultiPointToSinglePoint intents get from ONOS CLI:" )
- main.log.info( routeIntents_str_actual )
- utilities.assert_equals(
+ main.log.info( routeIntentsStrActual )
+ utilities.assertEquals(
expect=True,
actual=eq(
- routeIntents_str_expected,
- routeIntents_str_actual ),
- onpass="***MultiPointToSinglePoint Intents in SDN-IP are correct!***",
- onfail="***MultiPointToSinglePoint Intents in SDN-IP are wrong!***" )
+ routeIntentsStrExpected,
+ routeIntentsStrActual ),
+ onpass= "***MultiPointToSinglePoint " +
+ "Intents in SDN-IP are correct!***",
+ onfail= "***MultiPointToSinglePoint Intents" +
+ " in SDN-IP are wrong!***" )
- if( eq( routeIntents_str_expected, routeIntents_str_actual ) ):
+ if( eq( routeIntentsStrExpected, routeIntentsStrActual ) ):
main.log.report(
- "***MultiPointToSinglePoint Intents before deleting routes correct!***" )
+ "***MultiPointToSinglePoint Intents " +
+ "before deleting routes correct!***" )
else:
main.log.report(
- "***MultiPointToSinglePoint Intents before deleting routes wrong!***" )
+ "***MultiPointToSinglePoint Intents" +
+ "before deleting routes wrong!***" )
main.step( "Check BGP PointToPointIntent intents installed" )
# bgp intents expected
- bgpIntents_expected = main.QuaggaCliHost3.generate_expected_bgpIntents(
- SDNIP_JSON_FILE_PATH )
+ bgpIntentsExpected = main.QuaggaCliHost3.generateExpectedBgpIntents(
+ SDNIPJSONFILEPATH )
# get BGP intents from ONOS CLI
- bgpIntents_actual = main.QuaggaCliHost3.extract_actual_bgpIntents(
- get_intents_result )
+ bgpIntentsActual = main.QuaggaCliHost3.extractActualBgpIntents(
+ getIntentsResult )
- bgpIntents_str_expected = str( bgpIntents_expected ).replace( 'u', "" )
- bgpIntents_str_actual = str( bgpIntents_actual )
+ bgpIntentsStrExpected = str( bgpIntentsExpected ).replace( 'u', "" )
+ bgpIntentsStrActual = str( bgpIntentsActual )
main.log.info( "PointToPointIntent intents expected:" )
- main.log.info( bgpIntents_str_expected )
+ main.log.info( bgpIntentsStrExpected )
main.log.info( "PointToPointIntent intents get from ONOS CLI:" )
- main.log.info( bgpIntents_str_actual )
+ main.log.info( bgpIntentsStrActual )
- utilities.assert_equals(
+ utilities.assertEquals(
expect=True,
actual=eq(
- bgpIntents_str_expected,
- bgpIntents_str_actual ),
+ bgpIntentsStrExpected,
+ bgpIntentsStrActual ),
onpass="***PointToPointIntent Intents in SDN-IP are correct!***",
onfail="***PointToPointIntent Intents in SDN-IP are wrong!***" )
- if ( eq( bgpIntents_str_expected, bgpIntents_str_actual ) ):
+ if ( eq( bgpIntentsStrExpected, bgpIntentsStrActual ) ):
main.log.report(
"***PointToPointIntent Intents in SDN-IP are correct!***" )
else:
main.log.report(
"***PointToPointIntent Intents in SDN-IP are wrong!***" )
- #============================= Ping Test ========================
+ # ============================= Ping Test ========================
# wait until all MultiPointToSinglePoint
time.sleep( 20 )
- ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
- ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE1-ping-results-before-delete-routes-" + \
- strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt"
- ping_test_results = main.QuaggaCliHost.ping_test(
+ pingTestScript = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+ pingTestResultsFile = "~/SDNIP/SdnIpIntentDemo/log/" +\
+ "CASE1-ping-results-before-delete-routes-" + \
+ strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt"
+ pingTestResults = main.QuaggaCliHost.pingTest(
"1.168.30.100",
- ping_test_script,
- ping_test_results_file )
- main.log.info( ping_test_results )
+ pingTestScript,
+ pingTestResultsFile )
+ main.log.info( pingTestResults )
# ping test
- #============================= Deleting Routes ==================
+ # ============================= Deleting Routes ==================
main.step( "Check deleting routes installed" )
- main.QuaggaCliHost3.delete_routes( prefixes_host3, 1 )
- main.QuaggaCliHost4.delete_routes( prefixes_host4, 1 )
+ main.QuaggaCliHost3.deleteRoutes( prefixesHost3, 1 )
+ main.QuaggaCliHost4.deleteRoutes( prefixesHost4, 1 )
# main.log.info( "main.ONOScli.get_routes_num() = " )
- # main.log.info( main.ONOScli.get_routes_num() )
- # utilities.assert_equals( expect="Total SDN-IP routes = 1", actual=
- # main.ONOScli.get_routes_num(),
- get_routes_result = main.ONOScli.routes( json_format=True )
- allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(
- get_routes_result )
+ # main.log.info( main.ONOScli.getRoutesNum() )
+ # utilities.assertEquals( expect="Total SDN-IP routes = 1", actual=
+ # main.ONOScli.getRoutesNum(),
+ getRoutesResult = main.ONOScli.routes( jsonFormat=True )
+ allRoutesActual = main.QuaggaCliHost3.extractActualRoutes(
+ getRoutesResult )
main.log.info( "allRoutes_actual = " )
- main.log.info( allRoutes_actual )
+ main.log.info( allRoutesActual )
- utilities.assert_equals(
+ utilities.assertEquals(
expect="[]",
- actual=str( allRoutes_actual ),
+ actual=str( allRoutesActual ),
onpass="***Route number in SDN-IP is 0, correct!***",
onfail="***Routes number in SDN-IP is not 0, wrong!***" )
- if( eq( allRoutes_str_expected, allRoutes_str_actual ) ):
+ 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!***" )
main.step( "Check intents after deleting routes" )
- get_intents_result = main.ONOScli.intents( json_format=True )
- routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(
- get_intents_result )
+ getIntentsResult = main.ONOScli.intents( jsonFormat=True )
+ routeIntentsActual = main.QuaggaCliHost3.extractActualRouteIntents(
+ getIntentsResult )
main.log.info( "main.ONOScli.intents()= " )
- main.log.info( routeIntents_actual )
- utilities.assert_equals(
+ main.log.info( routeIntentsActual )
+ utilities.assertEquals(
expect="[]",
- actual=str( routeIntents_actual ),
- onpass="***MultiPointToSinglePoint Intents number in SDN-IP is 0, correct!***",
- onfail="***MultiPointToSinglePoint Intents number in SDN-IP is 0, wrong!***" )
+ actual=str( routeIntentsActual ),
+ onpass="***MultiPointToSinglePoint Intents" +
+ " number in SDN-IP is 0, correct!***",
+ onfail="***MultiPointToSinglePoint Intents " +
+ "number in SDN-IP is 0, wrong!***" )
- if( eq( routeIntents_str_expected, routeIntents_str_actual ) ):
+ if( eq( routeIntentsStrExpected, routeIntentsStrActual ) ):
main.log.report(
- "***MultiPointToSinglePoint Intents after deleting routes correct!***" )
+ "***MultiPointToSinglePoint Intents" +
+ " after deleting routes correct!***" )
else:
main.log.report(
- "***MultiPointToSinglePoint Intents after deleting routes wrong!***" )
+ "***MultiPointToSinglePoint Intents " +
+ "after deleting routes wrong!***" )
time.sleep( 20 )
- ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
- ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE1-ping-results-after-delete-routes-" + \
- strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt"
- ping_test_results = main.QuaggaCliHost.ping_test(
+ pingTestScript = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+ pingTestResultsFile = "~/SDNIP/SdnIpIntentDemo/log/" +\
+ "CASE1-ping-results-after-delete-routes-" +\
+ strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) +\
+ ".txt"
+ pingTestResults = main.QuaggaCliHost.pingTest(
"1.168.30.100",
- ping_test_script,
- ping_test_results_file )
- main.log.info( ping_test_results )
+ pingTestScript,
+ pingTestResultsFile )
+ main.log.info( pingTestResults )
time.sleep( 30 )
# main.step( "Test whether Mininet is started" )
@@ -284,12 +298,14 @@
def CASE2( self, main ):
"""
Test the SDN-IP functionality
- allRoutes_expected: all expected routes for all BGP peers
- routeIntents_expected: all expected MultiPointToSinglePointIntent intents
- bgpIntents_expected: expected PointToPointIntent intents
- allRoutes_actual: all routes from ONOS LCI
- routeIntents_actual: actual MultiPointToSinglePointIntent intents from ONOS CLI
- bgpIntents_actual: actual PointToPointIntent intents from ONOS CLI
+ allRoutesExpected: all expected routes for all BGP peers
+ routeIntentsExpected: all expected MultiPointToSinglePointIntent
+ intents
+ bgpIntentsExpected: expected PointToPointIntent intents
+ allRoutesActual: all routes from ONOS LCI
+ routeIntentsActual: actual MultiPointToSinglePointIntent intents from
+ ONOS CLI
+ bgpIntentsActual: actual PointToPointIntent intents from ONOS CLI
"""
import time
import json
@@ -297,227 +313,233 @@
from time import localtime, strftime
main.case(
- "The test case is to help to setup the TestON environment and test new drivers" )
- SDNIP_JSON_FILE_PATH = "../tests/SdnIpTest/sdnip.json"
+ "The test case is to help to setup the " +
+ "TestON environment and test new drivers" )
+ SDNIPJSONFILEPATH = "../tests/SdnIpTest/sdnip.json"
# all expected routes for all BGP peers
- allRoutes_expected = []
+ allRoutesExpected = []
main.step( "Start to generate routes for all BGP peers" )
main.log.info( "Generate prefixes for host3" )
- prefixes_host3 = main.QuaggaCliHost3.generate_prefixes( 3, 10 )
- main.log.info( prefixes_host3 )
+ prefixesHost3 = main.QuaggaCliHost3.generatePrefixes( 3, 10 )
+ main.log.info( prefixesHost3 )
# generate route with next hop
- for prefix in prefixes_host3:
- allRoutes_expected.append( prefix + "/" + "192.168.20.1" )
- routeIntents_expected_host3 = main.QuaggaCliHost3.generate_expected_onePeerRouteIntents(
- prefixes_host3,
- "192.168.20.1",
- "00:00:00:00:02:02",
- SDNIP_JSON_FILE_PATH )
+ for prefix in prefixesHost3:
+ allRoutesExpected.append( prefix + "/" + "192.168.20.1" )
+ routeIntentsExpectedHost3 = main.QuaggaCliHost3.\
+ generateExpectedOnePeerRouteIntents( prefixesHost3,
+ "192.168.20.1",
+ "00:00:00:00:02:02",
+ SDNIPJSONFILEPATH )
main.log.info( "Generate prefixes for host4" )
- prefixes_host4 = main.QuaggaCliHost4.generate_prefixes( 4, 10 )
- main.log.info( prefixes_host4 )
+ prefixesHost4 = main.QuaggaCliHost4.generatePrefixes( 4, 10 )
+ main.log.info( prefixesHost4 )
# generate route with next hop
- for prefix in prefixes_host4:
- allRoutes_expected.append( prefix + "/" + "192.168.30.1" )
- routeIntents_expected_host4 = main.QuaggaCliHost4.generate_expected_onePeerRouteIntents(
- prefixes_host4,
- "192.168.30.1",
- "00:00:00:00:03:01",
- SDNIP_JSON_FILE_PATH )
+ for prefix in prefixesHost4:
+ allRoutesExpected.append( prefix + "/" + "192.168.30.1" )
+ routeIntentsExpectedHost4 = main.QuaggaCliHost4.\
+ generateExpectedOnePeerRouteIntents( prefixesHost4,
+ "192.168.30.1",
+ "00:00:00:00:03:01",
+ SDNIPJSONFILEPATH )
- routeIntents_expected = routeIntents_expected_host3 + \
- routeIntents_expected_host4
+ routeIntentsExpected = routeIntentsExpectedHost3 + \
+ routeIntentsExpectedHost4
main.log.report( "Removing raft logs" )
- main.ONOSbench.onos_remove_raft_logs()
+ main.ONOSbench.onosRemoveRaftLogs()
main.log.report( "Uninstalling ONOS" )
- main.ONOSbench.onos_uninstall( ONOS1_ip )
+ main.ONOSbench.onosUninstall( ONOS1Ip )
- cell_name = main.params[ 'ENV' ][ 'cellName' ]
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
main.step( "Set cell for ONOS-cli environment" )
- main.ONOScli.set_cell( cell_name )
- verify_result = main.ONOSbench.verify_cell()
- #main.log.report( "Removing raft logs" )
- # main.ONOSbench.onos_remove_raft_logs()
- #main.log.report( "Uninstalling ONOS" )
- # main.ONOSbench.onos_uninstall( ONOS1_ip )
+ 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( "Creating ONOS package" )
- package_result = main.ONOSbench.onos_package()
+ packageResult = main.ONOSbench.onosPackage()
main.step( "Installing ONOS package" )
- onos1_install_result = main.ONOSbench.onos_install(
+ onos1InstallResult = main.ONOSbench.onosInstall(
options="-f",
- node=ONOS1_ip )
+ node=ONOS1Ip )
main.step( "Checking if ONOS is up yet" )
time.sleep( 60 )
- onos1_isup = main.ONOSbench.isup( ONOS1_ip )
- if not onos1_isup:
+ onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+ if not onos1Isup:
main.log.report( "ONOS1 didn't start!" )
main.step( "Start ONOS-cli" )
- main.ONOScli.start_onos_cli( ONOS1_ip )
+ main.ONOScli.startOnosCli( ONOS1Ip )
main.step( "Get devices in the network" )
- list_result = main.ONOScli.devices( json_format=False )
- main.log.info( list_result )
+ listResult = main.ONOScli.devices( jsonFormat=False )
+ main.log.info( listResult )
time.sleep( 10 )
main.log.info( "Installing sdn-ip feature" )
- main.ONOScli.feature_install( "onos-app-sdnip" )
+ main.ONOScli.featureInstall( "onos-app-sdnip" )
time.sleep( 10 )
main.step( "Check BGP PointToPointIntent intents installed" )
# bgp intents expected
- bgpIntents_expected = main.QuaggaCliHost3.generate_expected_bgpIntents(
- SDNIP_JSON_FILE_PATH )
+ bgpIntentsExpected = main.QuaggaCliHost3.generateExpectedBgpIntents(
+ SDNIPJSONFILEPATH )
# get BGP intents from ONOS CLI
- get_intents_result = main.ONOScli.intents( json_format=True )
- bgpIntents_actual = main.QuaggaCliHost3.extract_actual_bgpIntents(
- get_intents_result )
+ getIntentsResult = main.ONOScli.intents( jsonFormat=True )
+ bgpIntentsActual = main.QuaggaCliHost3.extractActualBgpIntents(
+ getIntentsResult )
- bgpIntents_str_expected = str( bgpIntents_expected ).replace( 'u', "" )
- bgpIntents_str_actual = str( bgpIntents_actual )
+ bgpIntentsStrExpected = str( bgpIntentsExpected ).replace( 'u', "" )
+ bgpIntentsStrActual = str( bgpIntentsActual )
main.log.info( "PointToPointIntent intents expected:" )
- main.log.info( bgpIntents_str_expected )
+ main.log.info( bgpIntentsStrExpected )
main.log.info( "PointToPointIntent intents get from ONOS CLI:" )
- main.log.info( bgpIntents_str_actual )
+ main.log.info( bgpIntentsStrActual )
- utilities.assert_equals(
+ utilities.assertEquals(
expect=True,
actual=eq(
- bgpIntents_str_expected,
- bgpIntents_str_actual ),
+ bgpIntentsStrExpected,
+ bgpIntentsStrActual ),
onpass="***PointToPointIntent Intents in SDN-IP are correct!***",
onfail="***PointToPointIntent Intents in SDN-IP are wrong!***" )
- if ( eq( bgpIntents_str_expected, bgpIntents_str_actual ) ):
+ if ( eq( bgpIntentsStrExpected, bgpIntentsStrActual ) ):
main.log.report(
"***PointToPointIntent Intents in SDN-IP are correct!***" )
else:
main.log.report(
"***PointToPointIntent Intents in SDN-IP are wrong!***" )
- allRoutes_str_expected = str( sorted( allRoutes_expected ) )
- routeIntents_str_expected = str( sorted( routeIntents_expected ) )
- ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
- # round_num = 0;
+ allRoutesStrExpected = str( sorted( allRoutesExpected ) )
+ routeIntentsStrExpected = str( sorted( routeIntentsExpected ) )
+ pingTestScript = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+ # roundNum = 0;
# while( True ):
- for round_num in range( 1, 6 ):
+ for roundNum in range( 1, 6 ):
# round = round + 1;
main.log.report(
"The Round " +
- str( round_num ) +
+ str( roundNum ) +
" test starts........................................" )
main.step( "Login all BGP peers and add routes into peers" )
main.log.info( "Login Quagga CLI on host3" )
main.QuaggaCliHost3.loginQuagga( "1.168.30.2" )
main.log.info( "Enter configuration model of Quagga CLI on host3" )
- main.QuaggaCliHost3.enter_config( 64514 )
+ main.QuaggaCliHost3.enterConfig( 64514 )
main.log.info( "Add routes to Quagga on host3" )
- main.QuaggaCliHost3.add_routes( prefixes_host3, 1 )
+ main.QuaggaCliHost3.addRoutes( prefixesHost3, 1 )
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" )
- main.QuaggaCliHost4.enter_config( 64516 )
+ main.QuaggaCliHost4.enterConfig( 64516 )
main.log.info( "Add routes to Quagga on host4" )
- main.QuaggaCliHost4.add_routes( prefixes_host4, 1 )
+ main.QuaggaCliHost4.addRoutes( prefixesHost4, 1 )
time.sleep( 60 )
# get all routes inside SDN-IP
- get_routes_result = main.ONOScli.routes( json_format=True )
+ getRoutesResult = main.ONOScli.routes( jsonFormat=True )
# parse routes from ONOS CLI
- allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(
- get_routes_result )
+ allRoutesActual = main.QuaggaCliHost3.extractActualRoutes(
+ getRoutesResult )
- # allRoutes_str_expected = str( sorted( allRoutes_expected ) )
- allRoutes_str_actual = str( allRoutes_actual ).replace( 'u', "" )
+ # allRoutesStrExpected = str( sorted( allRoutesExpected ) )
+ allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
main.step( "Check routes installed" )
main.log.info( "Routes expected:" )
- main.log.info( allRoutes_str_expected )
+ main.log.info( allRoutesStrExpected )
main.log.info( "Routes get from ONOS CLI:" )
- main.log.info( allRoutes_str_actual )
- utilities.assert_equals(
- expect=allRoutes_str_expected,
- actual=allRoutes_str_actual,
+ main.log.info( allRoutesStrActual )
+ utilities.assertEquals(
+ expect=allRoutesStrExpected,
+ actual=allRoutesStrActual,
onpass="***Routes in SDN-IP are correct!***",
onfail="***Routes in SDN-IP are wrong!***" )
- if( eq( allRoutes_str_expected, allRoutes_str_actual ) ):
+ if( eq( allRoutesStrExpected, allRoutesStrActual ) ):
main.log.report(
"***Routes in SDN-IP after adding correct!***" )
else:
main.log.report( "***Routes in SDN-IP after adding wrong!***" )
time.sleep( 20 )
- get_intents_result = main.ONOScli.intents( json_format=True )
+ getIntentsResult = main.ONOScli.intents( jsonFormat=True )
main.step(
"Check MultiPointToSinglePointIntent intents installed" )
- # route_intents_expected are generated when generating routes
+ # routeIntentsExpected are generated when generating routes
# get route intents from ONOS CLI
- routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(
- get_intents_result )
- # routeIntents_str_expected = str( sorted( routeIntents_expected ) )
- routeIntents_str_actual = str(
- routeIntents_actual ).replace( 'u', "" )
+ routeIntentsActual = main.QuaggaCliHost3.extractActualRouteIntents(
+ getIntentsResult )
+ # routeIntentsStrExpected = str( sorted( routeIntentsExpected ) )
+ routeIntentsStrActual = str(
+ routeIntentsActual ).replace( 'u', "" )
main.log.info( "MultiPointToSinglePoint intents expected:" )
- main.log.info( routeIntents_str_expected )
+ main.log.info( routeIntentsStrExpected )
main.log.info(
"MultiPointToSinglePoint intents get from ONOS CLI:" )
- main.log.info( routeIntents_str_actual )
- utilities.assert_equals(
+ main.log.info( routeIntentsStrActual )
+ utilities.assertEquals(
expect=True,
actual=eq(
- routeIntents_str_expected,
- routeIntents_str_actual ),
- onpass="***MultiPointToSinglePoint Intents in SDN-IP are correct!***",
- onfail="***MultiPointToSinglePoint Intents in SDN-IP are wrong!***" )
+ routeIntentsStrExpected,
+ routeIntentsStrActual ),
+ onpass= "***MultiPointToSinglePoint " +
+ "Intents in SDN-IP are correct!***",
+ onfail= "***MultiPointToSinglePoint Intents " +
+ "in SDN-IP are wrong!***" )
- if( eq( routeIntents_str_expected, routeIntents_str_actual ) ):
+ if( eq( routeIntentsStrExpected, routeIntentsStrActual ) ):
main.log.report(
- "***MultiPointToSinglePoint Intents after adding routes correct!***" )
+ "***MultiPointToSinglePoint Intents" +
+ " after adding routes correct!***" )
else:
main.log.report(
- "***MultiPointToSinglePoint Intents after adding routes wrong!***" )
+ "***MultiPointToSinglePoint Intents" +
+ " after adding routes wrong!***" )
- #============================= Ping Test ========================
+ # ============================= Ping Test ========================
# wait until all MultiPointToSinglePoint
time.sleep( 20 )
- # ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
- ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE2-Round" + \
- str( round_num ) + "-ping-results-before-delete-routes-" + strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt"
- ping_test_results = main.QuaggaCliHost.ping_test(
+ # pingTestScript = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+ pingTestResultsFile = "~/SDNIP/SdnIpIntentDemo/log/CASE2-Round" + \
+ str( roundNum ) + "-ping-results-before-delete-routes-" +\
+ strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt"
+ pingTestResults = main.QuaggaCliHost.pingTest(
"1.168.30.100",
- ping_test_script,
- ping_test_results_file )
- main.log.info( ping_test_results )
+ pingTestScript,
+ pingTestResultsFile )
+ main.log.info( pingTestResults )
# ping test
- #============================= Deleting Routes ==================
+ # ============================= Deleting Routes ==================
main.step( "Check deleting routes installed" )
main.log.info( "Delete routes to Quagga on host3" )
- main.QuaggaCliHost3.delete_routes( prefixes_host3, 1 )
+ main.QuaggaCliHost3.deleteRoutes( prefixesHost3, 1 )
main.log.info( "Delete routes to Quagga on host4" )
- main.QuaggaCliHost4.delete_routes( prefixes_host4, 1 )
+ main.QuaggaCliHost4.deleteRoutes( prefixesHost4, 1 )
- get_routes_result = main.ONOScli.routes( json_format=True )
- allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(
- get_routes_result )
+ getRoutesResult = main.ONOScli.routes( jsonFormat=True )
+ allRoutesActual = main.QuaggaCliHost3.extractActualRoutes(
+ getRoutesResult )
main.log.info( "allRoutes_actual = " )
- main.log.info( allRoutes_actual )
+ main.log.info( allRoutesActual )
- utilities.assert_equals(
+ utilities.assertEquals(
expect="[]",
- actual=str( allRoutes_actual ),
+ actual=str( allRoutesActual ),
onpass="***Route number in SDN-IP is 0, correct!***",
onfail="***Routes number in SDN-IP is not 0, wrong!***" )
- if( eq( allRoutes_str_expected, allRoutes_str_actual ) ):
+ if( eq( allRoutesStrExpected, allRoutesStrActual ) ):
main.log.report(
"***Routes in SDN-IP after deleting correct!***" )
else:
@@ -525,31 +547,36 @@
"***Routes in SDN-IP after deleting wrong!***" )
main.step( "Check intents after deleting routes" )
- get_intents_result = main.ONOScli.intents( json_format=True )
- routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(
- get_intents_result )
+ getIntentsResult = main.ONOScli.intents( jsonFormat=True )
+ routeIntentsActual = main.QuaggaCliHost3.extractActualRouteIntents(
+ getIntentsResult )
main.log.info( "main.ONOScli.intents()= " )
- main.log.info( routeIntents_actual )
- utilities.assert_equals(
+ main.log.info( routeIntentsActual )
+ utilities.assertEquals(
expect="[]",
- actual=str( routeIntents_actual ),
- onpass="***MultiPointToSinglePoint Intents number in SDN-IP is 0, correct!***",
- onfail="***MultiPointToSinglePoint Intents number in SDN-IP is 0, wrong!***" )
+ actual=str( routeIntentsActual ),
+ onpass="***MultiPointToSinglePoint Intents " +
+ "number in SDN-IP is 0, correct!***",
+ onfail="***MultiPointToSinglePoint Intents " +
+ "number in SDN-IP is 0, wrong!***" )
- if( eq( routeIntents_str_expected, routeIntents_str_actual ) ):
+ if( eq( routeIntentsStrExpected, routeIntentsStrActual ) ):
main.log.report(
- "***MultiPointToSinglePoint Intents after deleting routes correct!***" )
+ "***MultiPointToSinglePoint Intents " +
+ "after deleting routes correct!***" )
else:
main.log.report(
- "***MultiPointToSinglePoint Intents after deleting routes wrong!***" )
+ "***MultiPointToSinglePoint Intents " +
+ "after deleting routes wrong!***" )
time.sleep( 20 )
- # ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
- ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE2-Round" + \
- str( round_num ) + "-ping-results-after-delete-routes-" + strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt"
- ping_test_results = main.QuaggaCliHost.ping_test(
+ # pingTestScript = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+ pingTestResultsFile = "~/SDNIP/SdnIpIntentDemo/log/CASE2-Round" + \
+ str( roundNum ) + "-ping-results-after-delete-routes-" +\
+ strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt"
+ pingTestResults = main.QuaggaCliHost.pingTest(
"1.168.30.100",
- ping_test_script,
- ping_test_results_file )
- main.log.info( ping_test_results )
+ pingTestScript,
+ pingTestResultsFile )
+ main.log.info( pingTestResults )
time.sleep( 30 )