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 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 22 | try: |
| 23 | from tests.dependencies.ONOSSetup import ONOSSetup |
| 24 | main.testSetUp = ONOSSetup() |
| 25 | except ImportError: |
| 26 | main.log.error( "ONOSSetup not found. exiting the test" ) |
| 27 | main.exit() |
| 28 | main.testSetUp.envSetupDescription() |
| 29 | stepResult = main.FALSE |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 30 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 31 | try: |
| 32 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 33 | ONOS1Ip = main.params['CTRL']['ip1'] |
| 34 | stepResult = main.testSetUp.envSetup( specificIp=ONOS1Ip ) |
| 35 | except Exception as e: |
| 36 | main.testSetUp.envSetupException( e ) |
| 37 | main.testSetUp.evnSetupConclusion( stepResult ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 38 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 39 | case1Result = main.testSetUp.ONOSSetUp( "", newCell=False, cellname=cellName ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 40 | |
| 41 | if case1Result == main.FALSE: |
| 42 | main.cleanup() |
| 43 | main.exit() |
| 44 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 45 | def CASE4( self, main ): |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 46 | """ |
| 47 | Test the SDN-IP functionality |
| 48 | allRoutesExpected: all expected routes for all BGP peers |
| 49 | routeIntentsExpected: all expected MultiPointToSinglePointIntent \ |
| 50 | intents |
| 51 | bgpIntentsExpected: expected PointToPointIntent intents |
| 52 | allRoutesActual: all routes from ONOS LCI |
| 53 | routeIntentsActual: actual MultiPointToSinglePointIntent intents from \ |
| 54 | ONOS CLI |
| 55 | bgpIntentsActual: actual PointToPointIntent intents from ONOS CLI |
| 56 | """ |
| 57 | import json |
| 58 | import time |
| 59 | from operator import eq |
| 60 | from time import localtime, strftime |
| 61 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 62 | main.case( "This case is to testing the functionality of SDN-IP with \ |
| 63 | single ONOS instance" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 64 | SDNIPJSONFILEPATH = \ |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 65 | "~/ONOS/tools/package/config/sdnip.json" |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 66 | # all expected routes for all BGP peers |
| 67 | allRoutesExpected = [] |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 68 | main.step( "Start to generate routes for all BGP peers" ) |
| 69 | main.log.info( "Generate prefixes for host3" ) |
| 70 | prefixesHost3 = main.QuaggaCliHost3.generatePrefixes( 3, 10 ) |
| 71 | main.log.info( prefixesHost3 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 72 | # generate route with next hop |
| 73 | for prefix in prefixesHost3: |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 74 | allRoutesExpected.append( prefix + "/" + "192.168.20.1" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 75 | routeIntentsExpectedHost3 = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 76 | main.QuaggaCliHost3.generateExpectedOnePeerRouteIntents( |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 77 | prefixesHost3, "192.168.20.1", "00:00:00:00:02:02", |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 78 | SDNIPJSONFILEPATH ) |
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 | main.log.info( "Generate prefixes for host4" ) |
| 81 | prefixesHost4 = main.QuaggaCliHost4.generatePrefixes( 4, 10 ) |
| 82 | main.log.info( prefixesHost4 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 83 | # generate route with next hop |
| 84 | for prefix in prefixesHost4: |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 85 | allRoutesExpected.append( prefix + "/" + "192.168.30.1" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 86 | routeIntentsExpectedHost4 = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 87 | main.QuaggaCliHost4.generateExpectedOnePeerRouteIntents( |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 88 | prefixesHost4, "192.168.30.1", "00:00:00:00:03:01", |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 89 | SDNIPJSONFILEPATH ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 90 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 91 | main.log.info( "Generate prefixes for host5" ) |
| 92 | prefixesHost5 = main.QuaggaCliHost5.generatePrefixes( 5, 10 ) |
| 93 | main.log.info( prefixesHost5 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 94 | for prefix in prefixesHost5: |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 95 | allRoutesExpected.append( prefix + "/" + "192.168.60.2" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 96 | routeIntentsExpectedHost5 = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 97 | main.QuaggaCliHost5.generateExpectedOnePeerRouteIntents( |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 98 | prefixesHost5, "192.168.60.1", "00:00:00:00:06:02", |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 99 | SDNIPJSONFILEPATH ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 100 | |
| 101 | routeIntentsExpected = routeIntentsExpectedHost3 + \ |
| 102 | routeIntentsExpectedHost4 + routeIntentsExpectedHost5 |
| 103 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 104 | main.step( "Get links in the network" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 105 | listResult = main.ONOScli1.links( jsonFormat = False ) |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 106 | main.log.info( listResult ) |
| 107 | main.log.info( "Activate sdn-ip application" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 108 | main.ONOScli1.activateApp( "org.onosproject.sdnip" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 109 | # wait sdn-ip to finish installing connectivity intents, and the BGP |
| 110 | # paths in data plane are ready. |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 111 | time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 112 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 113 | main.step( "Login all BGP peers and add routes into peers" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 114 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 115 | main.log.info( "Login Quagga CLI on host3" ) |
| 116 | main.QuaggaCliHost3.loginQuagga( "1.168.30.2" ) |
| 117 | main.log.info( "Enter configuration model of Quagga CLI on host3" ) |
| 118 | main.QuaggaCliHost3.enterConfig( 64514 ) |
| 119 | main.log.info( "Add routes to Quagga on host3" ) |
| 120 | main.QuaggaCliHost3.addRoutes( prefixesHost3, 1 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 121 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 122 | main.log.info( "Login Quagga CLI on host4" ) |
| 123 | main.QuaggaCliHost4.loginQuagga( "1.168.30.3" ) |
| 124 | main.log.info( "Enter configuration model of Quagga CLI on host4" ) |
| 125 | main.QuaggaCliHost4.enterConfig( 64516 ) |
| 126 | main.log.info( "Add routes to Quagga on host4" ) |
| 127 | main.QuaggaCliHost4.addRoutes( prefixesHost4, 1 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 128 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 129 | main.log.info( "Login Quagga CLI on host5" ) |
| 130 | main.QuaggaCliHost5.loginQuagga( "1.168.30.5" ) |
| 131 | main.log.info( "Enter configuration model of Quagga CLI on host5" ) |
| 132 | main.QuaggaCliHost5.enterConfig( 64521 ) |
| 133 | main.log.info( "Add routes to Quagga on host5" ) |
| 134 | main.QuaggaCliHost5.addRoutes( prefixesHost5, 1 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 135 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 136 | for i in range( 101, 201 ): |
| 137 | prefixesHostX = main.QuaggaCliHost.generatePrefixes( str( i ), 10 ) |
| 138 | main.log.info( prefixesHostX ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 139 | for prefix in prefixesHostX: |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 140 | allRoutesExpected.append( prefix + "/" + "192.168.40." |
| 141 | + str( i - 100 ) ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 142 | |
| 143 | routeIntentsExpectedHostX = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 144 | main.QuaggaCliHost.generateExpectedOnePeerRouteIntents( |
| 145 | prefixesHostX, "192.168.40." + str( i - 100 ), |
| 146 | "00:00:%02d:00:00:90" % ( i - 101 ), SDNIPJSONFILEPATH ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 147 | routeIntentsExpected = routeIntentsExpected + \ |
| 148 | routeIntentsExpectedHostX |
| 149 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 150 | main.log.info( "Login Quagga CLI on host" + str( i ) ) |
| 151 | QuaggaCliHostX = getattr( main, ( 'QuaggaCliHost' + str( i ) ) ) |
| 152 | QuaggaCliHostX.loginQuagga( "1.168.30." + str( i ) ) |
| 153 | main.log.info( \ |
| 154 | "Enter configuration model of Quagga CLI on host" + str( i ) ) |
| 155 | QuaggaCliHostX.enterConfig( 65000 + i - 100 ) |
| 156 | main.log.info( "Add routes to Quagga on host" + str( i ) ) |
| 157 | QuaggaCliHostX.addRoutes( prefixesHostX, 1 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 158 | # wait Quagga to finish delivery all routes to each other and to sdn-ip, |
| 159 | # plus finish installing all intents. |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 160 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 161 | time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 162 | # get routes inside SDN-IP |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 163 | getRoutesResult = main.ONOScli1.routes( jsonFormat = True ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 164 | |
| 165 | allRoutesActual = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 166 | main.QuaggaCliHost3.extractActualRoutesMaster( getRoutesResult ) |
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 | allRoutesStrExpected = str( sorted( allRoutesExpected ) ) |
| 169 | allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" ) |
| 170 | main.step( "Check routes installed" ) |
| 171 | main.log.info( "Routes expected:" ) |
| 172 | main.log.info( allRoutesStrExpected ) |
| 173 | main.log.info( "Routes get from ONOS CLI:" ) |
| 174 | main.log.info( allRoutesStrActual ) |
| 175 | utilities.assertEquals( \ |
| 176 | expect = allRoutesStrExpected, actual = allRoutesStrActual, |
| 177 | onpass = "***Routes in SDN-IP are correct!***", |
| 178 | onfail = "***Routes in SDN-IP are wrong!***" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 179 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 180 | getIntentsResult = main.ONOScli1.intents( jsonFormat = True ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 181 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 182 | main.step( "Check MultiPointToSinglePointIntent intents installed" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 183 | # routeIntentsExpected are generated when generating routes |
| 184 | # get route intents from ONOS CLI |
| 185 | routeIntentsActualNum = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 186 | main.QuaggaCliHost3.extractActualRouteIntentNum( getIntentsResult ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 187 | routeIntentsExpectedNum = 1030 |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 188 | main.log.info( "MultiPointToSinglePoint Intent Num expected is:" ) |
| 189 | main.log.info( routeIntentsExpectedNum ) |
| 190 | main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" ) |
| 191 | main.log.info( routeIntentsActualNum ) |
| 192 | utilities.assertEquals( \ |
| 193 | expect = True, |
| 194 | actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ), |
| 195 | onpass = "***MultiPointToSinglePoint Intent Num in SDN-IP is \ |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 196 | correct!***", |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 197 | onfail = "***MultiPointToSinglePoint Intent Num in SDN-IP is \ |
| 198 | wrong!***" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 199 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 200 | main.step( "Check BGP PointToPointIntent intents installed" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 201 | |
| 202 | bgpIntentsActualNum = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 203 | main.QuaggaCliHost3.extractActualBgpIntentNum( getIntentsResult ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 204 | bgpIntentsExpectedNum = 624 |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 205 | main.log.info( "bgpIntentsExpected num is:" ) |
| 206 | main.log.info( bgpIntentsExpectedNum ) |
| 207 | main.log.info( "bgpIntentsActual num is:" ) |
| 208 | main.log.info( bgpIntentsActualNum ) |
| 209 | utilities.assertEquals( \ |
| 210 | expect = True, |
| 211 | actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ), |
| 212 | onpass = "***PointToPointIntent Intent Num in SDN-IP are correct!***", |
| 213 | onfail = "***PointToPointIntent Intent Num in SDN-IP are wrong!***" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 214 | |
| 215 | #============================= Ping Test ======================== |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 216 | pingTestScript = "~/OnosSystemTest/TestON/tests/SDNIPfunction/dependencies/CASE4-ping-as2host.sh" |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 217 | pingTestResultsFile = \ |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 218 | "~/OnosSystemTest/TestON/tests/SDNIPfunction/dependencies/log/CASE4-ping-results-before-delete-routes-"\ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 219 | + strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt" |
| 220 | pingTestResults = main.QuaggaCliHost.pingTest( \ |
| 221 | "1.168.30.100", pingTestScript, pingTestResultsFile ) |
| 222 | main.log.info( pingTestResults ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 223 | # wait to finish the ping test |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 224 | time.sleep( int( main.params[ 'timers' ][ 'PingTestWithRoutes' ] ) ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 225 | |
| 226 | #============================= Deleting Routes ================== |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 227 | main.step( "Check deleting routes installed" ) |
| 228 | main.QuaggaCliHost3.deleteRoutes( prefixesHost3, 1 ) |
| 229 | main.QuaggaCliHost4.deleteRoutes( prefixesHost4, 1 ) |
| 230 | main.QuaggaCliHost5.deleteRoutes( prefixesHost5, 1 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 231 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 232 | for i in range( 101, 201 ): |
| 233 | prefixesHostX = main.QuaggaCliHost.generatePrefixes( str( i ), 10 ) |
| 234 | main.log.info( prefixesHostX ) |
| 235 | QuaggaCliHostX = getattr( main, ( 'QuaggaCliHost' + str( i ) ) ) |
| 236 | QuaggaCliHostX.deleteRoutes( prefixesHostX, 1 ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 237 | # wait Quagga to finish delivery all routes to each other and to sdn-ip, |
| 238 | # plus finish un-installing all intents. |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 239 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 240 | time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 241 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 242 | getRoutesResult = main.ONOScli1.routes( jsonFormat = True ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 243 | allRoutesActual = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 244 | main.QuaggaCliHost3.extractActualRoutesMaster( getRoutesResult ) |
| 245 | main.log.info( "allRoutes_actual = " ) |
| 246 | main.log.info( allRoutesActual ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 247 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 248 | utilities.assertEquals( \ |
| 249 | expect = "[]", actual = str( allRoutesActual ), |
| 250 | onpass = "***Route number in SDN-IP is 0, correct!***", |
| 251 | onfail = "***Routes number in SDN-IP is not 0, wrong!***" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 252 | |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 253 | main.step( "Check intents after deleting routes" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 254 | getIntentsResult = main.ONOScli1.intents( jsonFormat = True ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 255 | routeIntentsActualNum = \ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 256 | main.QuaggaCliHost3.extractActualRouteIntentNum( |
| 257 | getIntentsResult ) |
| 258 | main.log.info( "route Intents Actual Num is: " ) |
| 259 | main.log.info( routeIntentsActualNum ) |
| 260 | utilities.assertEquals( \ |
| 261 | expect = 0, actual = routeIntentsActualNum, |
| 262 | onpass = "***MultiPointToSinglePoint Intent Num in SDN-IP is 0, \ |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 263 | correct!***", |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 264 | onfail = "***MultiPointToSinglePoint Intent Num in SDN-IP is not 0, \ |
| 265 | wrong!***" ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 266 | |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 267 | pingTestScript = "~/OnosSystemTest/TestON/tests/SDNIPfunction/dependencies/CASE4-ping-as2host.sh" |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 268 | pingTestResultsFile = \ |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 269 | "~/OnosSystemTest/TestON/tests/SDNIPfunction/dependencies/log/CASE4-ping-results-after-delete-routes-"\ |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 270 | + strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt" |
| 271 | pingTestResults = main.QuaggaCliHost.pingTest( \ |
| 272 | "1.168.30.100", pingTestScript, pingTestResultsFile ) |
| 273 | main.log.info( pingTestResults ) |
pingping-lin | 86d9f51 | 2015-08-17 18:29:41 -0700 | [diff] [blame] | 274 | # wait to finish the ping test |
pingping-lin | 500727a | 2015-09-02 19:53:11 -0700 | [diff] [blame] | 275 | time.sleep( int( main.params[ 'timers' ][ 'PingTestWithoutRoutes' ] ) ) |