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