pingping-lin | 4ed949d | 2015-08-13 17:15:48 -0700 | [diff] [blame] | 1 | class SDNIPperf: |
| 2 | |
| 3 | def __init__( self ): |
| 4 | self.default = '' |
| 5 | global branchName |
| 6 | |
| 7 | # This case is to setup ONOS |
| 8 | def CASE100( self, main ): |
| 9 | """ |
| 10 | CASE100 is to compile ONOS and push it to the test machines |
| 11 | Startup sequence: |
| 12 | cell <name> |
| 13 | onos-verify-cell |
| 14 | git pull |
| 15 | mvn clean install |
| 16 | onos-package |
| 17 | onos-install -f |
| 18 | onos-wait-for-start |
| 19 | """ |
| 20 | main.case( "Setting up test environment" ) |
| 21 | |
| 22 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 23 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 24 | |
| 25 | main.step( "Applying cell variable to environment" ) |
| 26 | cellResult = main.ONOSbench.setCell( cellName ) |
| 27 | verifyResult = main.ONOSbench.verifyCell() |
| 28 | |
| 29 | branchName = main.ONOSbench.getBranchName() |
| 30 | main.log.info( "ONOS is on branch: " + branchName ) |
| 31 | |
| 32 | main.log.report( "Uninstalling ONOS" ) |
| 33 | main.ONOSbench.onosUninstall( ONOS1Ip ) |
| 34 | |
| 35 | cleanInstallResult = main.TRUE |
| 36 | gitPullResult = main.TRUE |
| 37 | |
| 38 | main.step( "Git pull" ) |
| 39 | gitPullResult = main.FALSE |
| 40 | #Need to push some new code to ONOS before using the git pull |
| 41 | #gitPullResult = main.ONOSbench.gitPull() |
| 42 | |
| 43 | main.step( "Using mvn clean & install" ) |
| 44 | if gitPullResult == main.TRUE: |
| 45 | cleanInstallResult = main.ONOSbench.cleanInstall() |
| 46 | else: |
| 47 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 48 | "clean install" ) |
| 49 | cleanInstallResult = main.ONOSbench.cleanInstall( mciTimeout= 300 ) |
| 50 | main.ONOSbench.getVersion( report=True ) |
| 51 | |
| 52 | main.step( "Creating ONOS package" ) |
| 53 | packageResult = main.ONOSbench.onosPackage( opTimeout=500 ) |
| 54 | |
| 55 | main.step( "Installing ONOS package" ) |
| 56 | onos1InstallResult = main.ONOSbench.onosInstall( options="-f", |
| 57 | node=ONOS1Ip ) |
| 58 | |
| 59 | main.step( "Checking if ONOS is up yet" ) |
| 60 | for i in range( 2 ): |
| 61 | onos1Isup = main.ONOSbench.isup( ONOS1Ip, timeout=420 ) |
| 62 | if onos1Isup: |
| 63 | break |
| 64 | if not onos1Isup: |
| 65 | main.log.report( "ONOS1 didn't start!" ) |
| 66 | |
| 67 | cliResult = main.ONOScli.startOnosCli( ONOS1Ip, |
| 68 | commandlineTimeout=100, onosStartTimeout=600) |
| 69 | |
| 70 | case1Result = ( cleanInstallResult and packageResult and |
| 71 | cellResult and verifyResult and |
| 72 | onos1InstallResult and |
| 73 | onos1Isup and cliResult ) |
| 74 | |
| 75 | utilities.assert_equals( expect=main.TRUE, actual=case1Result, |
| 76 | onpass="ONOS startup successful", |
| 77 | onfail="ONOS startup NOT successful" ) |
| 78 | |
| 79 | if case1Result == main.FALSE: |
| 80 | main.cleanup() |
| 81 | main.exit() |
| 82 | |
| 83 | def CASE9( self, main ): |
| 84 | """ |
| 85 | Test the SDN-IP Performance |
| 86 | Test whether SDN-IP can boot with 600,000 routes from an external peer. |
| 87 | Since our goal for SDN-IP is to handle 600,000 routes, in this test case |
| 88 | we statically configure an external peer Quagga with 655360 routes. |
| 89 | Thus, we pre-know the routes and intents it should be, and then boot the |
| 90 | whole system and check whether the numbers of routes and intents from |
| 91 | ONOS CLI are correct. |
| 92 | """ |
| 93 | import time |
| 94 | import json |
| 95 | from operator import eq |
| 96 | from time import localtime, strftime |
| 97 | |
| 98 | # We configured one external BGP peer with 655360 routes |
| 99 | routeNumberExpected = 655360 |
| 100 | m2SIntentsNumberExpected = 655360 |
| 101 | |
| 102 | main.case("This case is to testing the performance of SDN-IP with \ |
| 103 | single ONOS instance" ) |
| 104 | time.sleep( 10 ) |
| 105 | |
| 106 | main.step( "Get devices in the network" ) |
| 107 | listResult = main.ONOScli.devices( jsonFormat=False ) |
| 108 | main.log.info( listResult ) |
| 109 | |
| 110 | main.step( "Get links in the network" ) |
| 111 | listResult = main.ONOScli.links ( jsonFormat=False ) |
| 112 | main.log.info( listResult ) |
| 113 | |
| 114 | main.log.info( "Activate sdn-ip application" ) |
| 115 | main.ONOScli.activateApp( "org.onosproject.sdnip" ) |
| 116 | |
| 117 | main.step("Sleep 1200 seconds") |
| 118 | # wait until SDN-IP receives all routes and ONOS installs all intents |
pingping-lin | 687c12a | 2015-08-19 10:59:30 -0700 | [diff] [blame] | 119 | time.sleep( float(main.params[ 'timers' ][ 'SystemBoot' ]) ) |
pingping-lin | 4ed949d | 2015-08-13 17:15:48 -0700 | [diff] [blame] | 120 | |
| 121 | main.step( "Checking routes installed" ) |
| 122 | |
| 123 | main.log.info( "Total route number expected is:" ) |
| 124 | main.log.info( routeNumberExpected ) |
| 125 | |
| 126 | routeNumberActual = main.ONOScli.ipv4RouteNumber() |
| 127 | main.log.info("Total route number actual is: ") |
| 128 | main.log.info(routeNumberActual) |
| 129 | |
| 130 | utilities.assertEquals( |
| 131 | expect=routeNumberExpected, actual=routeNumberActual, |
| 132 | onpass="***Routes in SDN-IP are correct!***", |
| 133 | onfail="***Routes in SDN-IP are wrong!***" ) |
| 134 | |
| 135 | |
| 136 | main.step( "Checking MultiPointToSinglePointIntent intents installed" ) |
| 137 | |
| 138 | main.log.info( "MultiPointToSinglePoint intent number expected is:" ) |
| 139 | main.log.info( m2SIntentsNumberExpected ) |
| 140 | |
| 141 | m2SIntentsNumberActual = main.ONOScli.m2SIntentInstalledNumber() |
| 142 | main.log.info( "MultiPointToSinglePoint intent number actual is:" ) |
| 143 | main.log.info(m2SIntentsNumberActual) |
| 144 | |
| 145 | utilities.assertEquals( |
| 146 | expect=True, |
| 147 | actual=eq( m2SIntentsNumberExpected, m2SIntentsNumberActual ), |
| 148 | onpass="***MultiPointToSinglePoint intent number is correct!***", |
| 149 | onfail="***MultiPointToSinglePoint intent number is wrong!***" ) |