pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 1 | # Testing the functionality of SDN-IP with single ONOS instance |
| 2 | class SDNIPfunction: |
| 3 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 4 | def __init__( self ): |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 5 | self.default = '' |
| 6 | global branchName |
| 7 | |
| 8 | |
| 9 | # This case is to setup ONOS |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 10 | def CASE100( self, main ): |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 11 | """ |
| 12 | CASE100 is to compile ONOS and install it |
| 13 | Startup sequence: |
| 14 | cell <name> |
| 15 | onos-verify-cell |
| 16 | git pull |
| 17 | mvn clean install |
| 18 | onos-package |
| 19 | onos-install -f |
| 20 | onos-wait-for-start |
| 21 | """ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 22 | main.case( "Setting up test environment" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 23 | |
| 24 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 25 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 26 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 27 | main.step( "Applying cell variable to environment" ) |
| 28 | cellResult = main.ONOSbench.setCell( cellName ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 29 | verifyResult = main.ONOSbench.verifyCell() |
| 30 | |
| 31 | branchName = main.ONOSbench.getBranchName() |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 32 | main.log.info( "ONOS is on branch: " + branchName ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 33 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 34 | main.log.report( "Uninstalling ONOS" ) |
| 35 | main.ONOSbench.onosUninstall( ONOS1Ip ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 36 | |
| 37 | # cleanInstallResult = main.TRUE |
| 38 | # gitPullResult = main.TRUE |
| 39 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 40 | main.step( "Git pull" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 41 | gitPullResult = main.ONOSbench.gitPull() |
| 42 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 43 | main.step( "Using mvn clean install" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 44 | if gitPullResult == main.TRUE: |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 45 | cleanInstallResult = main.ONOSbench.cleanInstall( mciTimeout = 1000 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 46 | else: |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 47 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 48 | "clean install" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 49 | cleanInstallResult = main.TRUE |
| 50 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 51 | main.ONOSbench.getVersion( report = True ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 52 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 53 | main.step( "Creating ONOS package" ) |
| 54 | packageResult = main.ONOSbench.onosPackage( opTimeout = 500 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 55 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 56 | main.step( "Installing ONOS package" ) |
| 57 | onos1InstallResult = main.ONOSbench.onosInstall( options = "-f", |
| 58 | node = ONOS1Ip ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 59 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 60 | main.step( "Checking if ONOS is up yet" ) |
| 61 | for i in range( 2 ): |
| 62 | onos1Isup = main.ONOSbench.isup( ONOS1Ip, timeout = 420 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 63 | if onos1Isup: |
| 64 | break |
| 65 | if not onos1Isup: |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 66 | main.log.report( "ONOS1 didn't start!" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 67 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 68 | cliResult = main.ONOScli.startOnosCli( ONOS1Ip, |
| 69 | commandlineTimeout = 100, onosStartTimeout = 600 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 70 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 71 | case1Result = ( cleanInstallResult and packageResult and |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 72 | cellResult and verifyResult and |
| 73 | onos1InstallResult and |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 74 | onos1Isup and cliResult ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 75 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 76 | utilities.assert_equals( expect = main.TRUE, actual = case1Result, |
| 77 | onpass = "ONOS startup successful", |
| 78 | onfail = "ONOS startup NOT successful" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 79 | |
| 80 | if case1Result == main.FALSE: |
| 81 | main.cleanup() |
| 82 | main.exit() |
| 83 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 84 | def CASE4( self, main ): |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 85 | """ |
| 86 | Test the SDN-IP functionality |
| 87 | allRoutesExpected: all expected routes for all BGP peers |
| 88 | routeIntentsExpected: all expected MultiPointToSinglePointIntent \ |
| 89 | intents |
| 90 | bgpIntentsExpected: expected PointToPointIntent intents |
| 91 | allRoutesActual: all routes from ONOS LCI |
| 92 | routeIntentsActual: actual MultiPointToSinglePointIntent intents from \ |
| 93 | ONOS CLI |
| 94 | bgpIntentsActual: actual PointToPointIntent intents from ONOS CLI |
| 95 | """ |
| 96 | import json |
| 97 | import time |
| 98 | from operator import eq |
| 99 | from time import localtime, strftime |
| 100 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 101 | main.case( "This case is to testing the functionality of SDN-IP with \ |
| 102 | single ONOS instance" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 103 | SDNIPJSONFILEPATH = \ |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 104 | "~/ONOS/tools/package/config/sdnip.json" |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 105 | # all expected routes for all BGP peers |
| 106 | allRoutesExpected = [] |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 107 | main.step( "Start to generate routes for all BGP peers" ) |
| 108 | main.log.info( "Generate prefixes for host3" ) |
| 109 | prefixesHost3 = main.QuaggaCliHost3.generatePrefixes( 3, 10 ) |
| 110 | main.log.info( prefixesHost3 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 111 | # generate route with next hop |
| 112 | for prefix in prefixesHost3: |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 113 | allRoutesExpected.append( prefix + "/" + "192.168.20.1" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 114 | routeIntentsExpectedHost3 = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 115 | main.QuaggaCliHost3.generateExpectedOnePeerRouteIntents( |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 116 | prefixesHost3, "192.168.20.1", "00:00:00:00:02:02", |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 117 | SDNIPJSONFILEPATH ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 118 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 119 | main.log.info( "Generate prefixes for host4" ) |
| 120 | prefixesHost4 = main.QuaggaCliHost4.generatePrefixes( 4, 10 ) |
| 121 | main.log.info( prefixesHost4 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 122 | # generate route with next hop |
| 123 | for prefix in prefixesHost4: |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 124 | allRoutesExpected.append( prefix + "/" + "192.168.30.1" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 125 | routeIntentsExpectedHost4 = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 126 | main.QuaggaCliHost4.generateExpectedOnePeerRouteIntents( |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 127 | prefixesHost4, "192.168.30.1", "00:00:00:00:03:01", |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 128 | SDNIPJSONFILEPATH ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 129 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 130 | main.log.info( "Generate prefixes for host5" ) |
| 131 | prefixesHost5 = main.QuaggaCliHost5.generatePrefixes( 5, 10 ) |
| 132 | main.log.info( prefixesHost5 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 133 | for prefix in prefixesHost5: |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 134 | allRoutesExpected.append( prefix + "/" + "192.168.60.2" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 135 | routeIntentsExpectedHost5 = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 136 | main.QuaggaCliHost5.generateExpectedOnePeerRouteIntents( |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 137 | prefixesHost5, "192.168.60.1", "00:00:00:00:06:02", |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 138 | SDNIPJSONFILEPATH ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 139 | |
| 140 | routeIntentsExpected = routeIntentsExpectedHost3 + \ |
| 141 | routeIntentsExpectedHost4 + routeIntentsExpectedHost5 |
| 142 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 143 | main.step( "Get links in the network" ) |
| 144 | listResult = main.ONOScli.links( jsonFormat = False ) |
| 145 | main.log.info( listResult ) |
| 146 | main.log.info( "Activate sdn-ip application" ) |
| 147 | main.ONOScli.activateApp( "org.onosproject.sdnip" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 148 | # wait sdn-ip to finish installing connectivity intents, and the BGP |
| 149 | # paths in data plane are ready. |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 150 | time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 151 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 152 | main.step( "Login all BGP peers and add routes into peers" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 153 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 154 | main.log.info( "Login Quagga CLI on host3" ) |
| 155 | main.QuaggaCliHost3.loginQuagga( "1.168.30.2" ) |
| 156 | main.log.info( "Enter configuration model of Quagga CLI on host3" ) |
| 157 | main.QuaggaCliHost3.enterConfig( 64514 ) |
| 158 | main.log.info( "Add routes to Quagga on host3" ) |
| 159 | main.QuaggaCliHost3.addRoutes( prefixesHost3, 1 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 160 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 161 | main.log.info( "Login Quagga CLI on host4" ) |
| 162 | main.QuaggaCliHost4.loginQuagga( "1.168.30.3" ) |
| 163 | main.log.info( "Enter configuration model of Quagga CLI on host4" ) |
| 164 | main.QuaggaCliHost4.enterConfig( 64516 ) |
| 165 | main.log.info( "Add routes to Quagga on host4" ) |
| 166 | main.QuaggaCliHost4.addRoutes( prefixesHost4, 1 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 167 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 168 | main.log.info( "Login Quagga CLI on host5" ) |
| 169 | main.QuaggaCliHost5.loginQuagga( "1.168.30.5" ) |
| 170 | main.log.info( "Enter configuration model of Quagga CLI on host5" ) |
| 171 | main.QuaggaCliHost5.enterConfig( 64521 ) |
| 172 | main.log.info( "Add routes to Quagga on host5" ) |
| 173 | main.QuaggaCliHost5.addRoutes( prefixesHost5, 1 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 174 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 175 | for i in range( 101, 201 ): |
| 176 | prefixesHostX = main.QuaggaCliHost.generatePrefixes( str( i ), 10 ) |
| 177 | main.log.info( prefixesHostX ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 178 | for prefix in prefixesHostX: |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 179 | allRoutesExpected.append( prefix + "/" + "192.168.40." |
| 180 | + str( i - 100 ) ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 181 | |
| 182 | routeIntentsExpectedHostX = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 183 | main.QuaggaCliHost.generateExpectedOnePeerRouteIntents( |
| 184 | prefixesHostX, "192.168.40." + str( i - 100 ), |
| 185 | "00:00:%02d:00:00:90" % ( i - 101 ), SDNIPJSONFILEPATH ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 186 | routeIntentsExpected = routeIntentsExpected + \ |
| 187 | routeIntentsExpectedHostX |
| 188 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 189 | main.log.info( "Login Quagga CLI on host" + str( i ) ) |
| 190 | QuaggaCliHostX = getattr( main, ( 'QuaggaCliHost' + str( i ) ) ) |
| 191 | QuaggaCliHostX.loginQuagga( "1.168.30." + str( i ) ) |
| 192 | main.log.info( \ |
| 193 | "Enter configuration model of Quagga CLI on host" + str( i ) ) |
| 194 | QuaggaCliHostX.enterConfig( 65000 + i - 100 ) |
| 195 | main.log.info( "Add routes to Quagga on host" + str( i ) ) |
| 196 | QuaggaCliHostX.addRoutes( prefixesHostX, 1 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 197 | # wait Quagga to finish delivery all routes to each other and to sdn-ip, |
| 198 | # plus finish installing all intents. |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 199 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 200 | time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 201 | # get routes inside SDN-IP |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 202 | getRoutesResult = main.ONOScli.routes( jsonFormat = True ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 203 | |
| 204 | allRoutesActual = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 205 | main.QuaggaCliHost3.extractActualRoutesMaster( getRoutesResult ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 206 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 207 | allRoutesStrExpected = str( sorted( allRoutesExpected ) ) |
| 208 | allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" ) |
| 209 | main.step( "Check routes installed" ) |
| 210 | main.log.info( "Routes expected:" ) |
| 211 | main.log.info( allRoutesStrExpected ) |
| 212 | main.log.info( "Routes get from ONOS CLI:" ) |
| 213 | main.log.info( allRoutesStrActual ) |
| 214 | utilities.assertEquals( \ |
| 215 | expect = allRoutesStrExpected, actual = allRoutesStrActual, |
| 216 | onpass = "***Routes in SDN-IP are correct!***", |
| 217 | onfail = "***Routes in SDN-IP are wrong!***" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 218 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 219 | getIntentsResult = main.ONOScli.intents( jsonFormat = True ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 220 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 221 | main.step( "Check MultiPointToSinglePointIntent intents installed" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 222 | # routeIntentsExpected are generated when generating routes |
| 223 | # get route intents from ONOS CLI |
| 224 | routeIntentsActualNum = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 225 | main.QuaggaCliHost3.extractActualRouteIntentNum( getIntentsResult ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 226 | routeIntentsExpectedNum = 1030 |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 227 | main.log.info( "MultiPointToSinglePoint Intent Num expected is:" ) |
| 228 | main.log.info( routeIntentsExpectedNum ) |
| 229 | main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" ) |
| 230 | main.log.info( routeIntentsActualNum ) |
| 231 | utilities.assertEquals( \ |
| 232 | expect = True, |
| 233 | actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ), |
| 234 | onpass = "***MultiPointToSinglePoint Intent Num in SDN-IP is \ |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 235 | correct!***", |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 236 | onfail = "***MultiPointToSinglePoint Intent Num in SDN-IP is \ |
| 237 | wrong!***" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 238 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 239 | main.step( "Check BGP PointToPointIntent intents installed" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 240 | |
| 241 | bgpIntentsActualNum = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 242 | main.QuaggaCliHost3.extractActualBgpIntentNum( getIntentsResult ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 243 | bgpIntentsExpectedNum = 624 |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 244 | main.log.info( "bgpIntentsExpected num is:" ) |
| 245 | main.log.info( bgpIntentsExpectedNum ) |
| 246 | main.log.info( "bgpIntentsActual num is:" ) |
| 247 | main.log.info( bgpIntentsActualNum ) |
| 248 | utilities.assertEquals( \ |
| 249 | expect = True, |
| 250 | actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ), |
| 251 | onpass = "***PointToPointIntent Intent Num in SDN-IP are correct!***", |
| 252 | onfail = "***PointToPointIntent Intent Num in SDN-IP are wrong!***" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 253 | |
| 254 | #============================= Ping Test ======================== |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 255 | pingTestScript = "~/OnosSystemTest/TestON/tests/SDNIPfunction/dependencies/CASE4-ping-as2host.sh" |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 256 | pingTestResultsFile = \ |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 257 | "~/OnosSystemTest/TestON/tests/SDNIPfunction/dependencies/log/CASE4-ping-results-before-delete-routes-"\ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 258 | + strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt" |
| 259 | pingTestResults = main.QuaggaCliHost.pingTest( \ |
| 260 | "1.168.30.100", pingTestScript, pingTestResultsFile ) |
| 261 | main.log.info( pingTestResults ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 262 | # wait to finish the ping test |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 263 | time.sleep( int( main.params[ 'timers' ][ 'PingTestWithRoutes' ] ) ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 264 | |
| 265 | #============================= Deleting Routes ================== |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 266 | main.step( "Check deleting routes installed" ) |
| 267 | main.QuaggaCliHost3.deleteRoutes( prefixesHost3, 1 ) |
| 268 | main.QuaggaCliHost4.deleteRoutes( prefixesHost4, 1 ) |
| 269 | main.QuaggaCliHost5.deleteRoutes( prefixesHost5, 1 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 270 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 271 | for i in range( 101, 201 ): |
| 272 | prefixesHostX = main.QuaggaCliHost.generatePrefixes( str( i ), 10 ) |
| 273 | main.log.info( prefixesHostX ) |
| 274 | QuaggaCliHostX = getattr( main, ( 'QuaggaCliHost' + str( i ) ) ) |
| 275 | QuaggaCliHostX.deleteRoutes( prefixesHostX, 1 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 276 | # wait Quagga to finish delivery all routes to each other and to sdn-ip, |
| 277 | # plus finish un-installing all intents. |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 278 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 279 | time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 280 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 281 | getRoutesResult = main.ONOScli.routes( jsonFormat = True ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 282 | allRoutesActual = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 283 | main.QuaggaCliHost3.extractActualRoutesMaster( getRoutesResult ) |
| 284 | main.log.info( "allRoutes_actual = " ) |
| 285 | main.log.info( allRoutesActual ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 286 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 287 | utilities.assertEquals( \ |
| 288 | expect = "[]", actual = str( allRoutesActual ), |
| 289 | onpass = "***Route number in SDN-IP is 0, correct!***", |
| 290 | onfail = "***Routes number in SDN-IP is not 0, wrong!***" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 291 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 292 | main.step( "Check intents after deleting routes" ) |
| 293 | getIntentsResult = main.ONOScli.intents( jsonFormat = True ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 294 | routeIntentsActualNum = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 295 | main.QuaggaCliHost3.extractActualRouteIntentNum( |
| 296 | getIntentsResult ) |
| 297 | main.log.info( "route Intents Actual Num is: " ) |
| 298 | main.log.info( routeIntentsActualNum ) |
| 299 | utilities.assertEquals( \ |
| 300 | expect = 0, actual = routeIntentsActualNum, |
| 301 | onpass = "***MultiPointToSinglePoint Intent Num in SDN-IP is 0, \ |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 302 | correct!***", |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 303 | onfail = "***MultiPointToSinglePoint Intent Num in SDN-IP is not 0, \ |
| 304 | wrong!***" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 305 | |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 306 | pingTestScript = "~/OnosSystemTest/TestON/tests/SDNIPfunction/dependencies/CASE4-ping-as2host.sh" |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 307 | pingTestResultsFile = \ |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 308 | "~/OnosSystemTest/TestON/tests/SDNIPfunction/dependencies/log/CASE4-ping-results-after-delete-routes-"\ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 309 | + strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt" |
| 310 | pingTestResults = main.QuaggaCliHost.pingTest( \ |
| 311 | "1.168.30.100", pingTestScript, pingTestResultsFile ) |
| 312 | main.log.info( pingTestResults ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 313 | # wait to finish the ping test |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 314 | time.sleep( int( main.params[ 'timers' ][ 'PingTestWithoutRoutes' ] ) ) |