shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 2 | # Testing the basic functionality of ONOS Next |
| 3 | # For sanity and driver functionality excercises only. |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 4 | |
| 5 | import time |
| 6 | import sys |
| 7 | import os |
| 8 | import re |
| 9 | import time |
| 10 | import json |
| 11 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 12 | time.sleep( 1 ) |
| 13 | |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 14 | class MultiProd: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 15 | |
| 16 | def __init__( self ): |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 17 | self.default = '' |
| 18 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 19 | def CASE1( self, main ): |
| 20 | """ |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 21 | Startup sequence: |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 22 | cell <name> |
| 23 | onos-verify-cell |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 24 | onos-remove-raft-logs |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 25 | git pull |
| 26 | mvn clean install |
| 27 | onos-package |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 28 | onos-install -f |
| 29 | onos-wait-for-start |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 30 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 31 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 32 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 33 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 34 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 35 | ONOS1Port = main.params[ 'CTRL' ][ 'port1' ] |
| 36 | ONOS2Port = main.params[ 'CTRL' ][ 'port2' ] |
| 37 | ONOS3Port = main.params[ 'CTRL' ][ 'port3' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 38 | |
| 39 | main.case( "Setting up test environment" ) |
| 40 | main.log.report( |
| 41 | "This testcase is testing setting up test environment" ) |
| 42 | main.log.report( "__________________________________" ) |
| 43 | |
| 44 | main.step( "Applying cell variable to environment" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 45 | cellResult1 = main.ONOSbench.setCell( cellName ) |
| 46 | # cellResult2 = main.ONOScli1.setCell( cellName ) |
| 47 | # cellResult3 = main.ONOScli2.setCell( cellName ) |
| 48 | # cellResult4 = main.ONOScli3.setCell( cellName ) |
| 49 | verifyResult = main.ONOSbench.verifyCell() |
| 50 | cellResult = cellResult1 |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 51 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 52 | main.step( "Removing raft logs before a clen installation of ONOS" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 53 | removeLogResult = main.ONOSbench.onosRemoveRaftLogs() |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 54 | |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 55 | main.step( "Git checkout, pull and get version" ) |
| 56 | #main.ONOSbench.gitCheckout( "master" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 57 | gitPullResult = main.ONOSbench.gitPull() |
| 58 | print "git_pull_result = ", gitPullResult |
| 59 | versionResult = main.ONOSbench.getVersion( report=True ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 60 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 61 | if gitPullResult == 1: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 62 | main.step( "Using mvn clean & install" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 63 | cleanInstallResult = main.ONOSbench.cleanInstall() |
| 64 | # cleanInstallResult = main.TRUE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 65 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 66 | main.step( "Creating ONOS package" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 67 | packageResult = main.ONOSbench.onosPackage() |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 68 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 69 | # main.step( "Creating a cell" ) |
| 70 | # cellCreateResult = main.ONOSbench.createCellFile( ************** |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 71 | # ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 72 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 73 | main.step( "Installing ONOS package" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 74 | onos1InstallResult = main.ONOSbench.onosInstall( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 75 | options="-f", |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 76 | node=ONOS1Ip ) |
| 77 | onos2InstallResult = main.ONOSbench.onosInstall( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 78 | options="-f", |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 79 | node=ONOS2Ip ) |
| 80 | onos3InstallResult = main.ONOSbench.onosInstall( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 81 | options="-f", |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 82 | node=ONOS3Ip ) |
| 83 | onosInstallResult = onos1InstallResult and onos2InstallResult and\ |
| 84 | onos3InstallResult |
| 85 | if onosInstallResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 86 | main.log.report( "Installing ONOS package successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 87 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 88 | main.log.report( "Installing ONOS package failed" ) |
| 89 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 90 | onos1Isup = main.ONOSbench.isup( ONOS1Ip ) |
| 91 | onos2Isup = main.ONOSbench.isup( ONOS2Ip ) |
| 92 | onos3Isup = main.ONOSbench.isup( ONOS3Ip ) |
| 93 | onosIsup = onos1Isup and onos2Isup and onos3Isup |
| 94 | if onosIsup == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 95 | main.log.report( "ONOS instances are up and ready" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 96 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 97 | main.log.report( "ONOS instances may not be up" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 98 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 99 | main.step( "Starting ONOS service" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 100 | startResult = main.TRUE |
| 101 | # startResult = main.ONOSbench.onosStart( ONOS1Ip ) |
| 102 | startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip ) |
| 103 | startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip ) |
| 104 | startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 105 | print startcli1 |
| 106 | print startcli2 |
| 107 | print startcli3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 108 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 109 | case1Result = ( packageResult and |
| 110 | cellResult and verifyResult and onosInstallResult and |
| 111 | onosIsup and startResult ) |
| 112 | utilities.assertEquals( expect=main.TRUE, actual=case1Result, |
| 113 | onpass="Test startup successful", |
| 114 | onfail="Test startup NOT successful" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 115 | |
| 116 | def CASE11( self, main ): |
| 117 | """ |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 118 | Cleanup sequence: |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 119 | onos-service <nodeIp> stop |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 120 | onos-uninstall |
| 121 | |
| 122 | TODO: Define rest of cleanup |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 123 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 124 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 125 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 126 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 127 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 128 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 129 | main.case( "Cleaning up test environment" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 130 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 131 | main.step( "Testing ONOS kill function" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 132 | killResult1 = main.ONOSbench.onosKill( ONOS1Ip ) |
| 133 | killResult2 = main.ONOSbench.onosKill( ONOS2Ip ) |
| 134 | killResult3 = main.ONOSbench.onosKill( ONOS3Ip ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 135 | |
| 136 | main.step( "Stopping ONOS service" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 137 | stopResult1 = main.ONOSbench.onosStop( ONOS1Ip ) |
| 138 | stopResult2 = main.ONOSbench.onosStop( ONOS2Ip ) |
| 139 | stopResult3 = main.ONOSbench.onosStop( ONOS3Ip ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 140 | |
| 141 | main.step( "Uninstalling ONOS service" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 142 | uninstallResult = main.ONOSbench.onosUninstall() |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 143 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 144 | def CASE3( self, main ): |
| 145 | """ |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 146 | Test 'onos' command and its functionality in driver |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 147 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 148 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 149 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 150 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 151 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 152 | main.case( "Testing 'onos' command" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 153 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 154 | main.step( "Sending command 'onos -w <onos-ip> system:name'" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 155 | cmdstr1 = "system:name" |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 156 | cmdResult1 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr1 ) |
| 157 | main.log.info( "onos command returned: " + cmdResult1 ) |
| 158 | cmdResult2 = main.ONOSbench.onosCli( ONOS2Ip, cmdstr1 ) |
| 159 | main.log.info( "onos command returned: " + cmdResult2 ) |
| 160 | cmdResult3 = main.ONOSbench.onosCli( ONOS3Ip, cmdstr1 ) |
| 161 | main.log.info( "onos command returned: " + cmdResult3 ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 162 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 163 | main.step( "Sending command 'onos -w <onos-ip> onos:topology'" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 164 | cmdstr2 = "onos:topology" |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 165 | cmdResult4 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr2 ) |
| 166 | main.log.info( "onos command returned: " + cmdResult4 ) |
| 167 | cmdResult5 = main.ONOSbench.onosCli( ONOS2Ip, cmdstr2 ) |
| 168 | main.log.info( "onos command returned: " + cmdResult5 ) |
| 169 | cmdResult6 = main.ONOSbench.onosCli( ONOS6Ip, cmdstr2 ) |
| 170 | main.log.info( "onos command returned: " + cmdResult6 ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 171 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 172 | def CASE4( self, main ): |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 173 | import re |
| 174 | import time |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 175 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 176 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 177 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 178 | ONOS1Port = main.params[ 'CTRL' ][ 'port1' ] |
| 179 | ONOS2Port = main.params[ 'CTRL' ][ 'port2' ] |
| 180 | ONOS3Port = main.params[ 'CTRL' ][ 'port3' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 181 | |
| 182 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 183 | "This testcase is testing the assignment of all the switches" + |
| 184 | " to all controllers and discovering the hosts in reactive mode" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 185 | main.log.report( "__________________________________" ) |
| 186 | main.case( "Pingall Test(No intents are added)" ) |
| 187 | main.step( "Assigning switches to controllers" ) |
| 188 | for i in range( 1, 29 ): # 1 to ( num of switches +1 ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 189 | main.Mininet1.assignSwController( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 190 | sw=str( i ), |
| 191 | count=3, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 192 | ip1=ONOS1Ip, |
| 193 | port1=ONOS1Port, |
| 194 | ip2=ONOS2Ip, |
| 195 | port2=ONOS2Port, |
| 196 | ip3=ONOS3Ip, |
| 197 | port3=ONOS3Port ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 198 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 199 | switchMastership = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 200 | for i in range( 1, 29 ): |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 201 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 202 | print( "Response is " + str( response ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 203 | if re.search( "tcp:" + ONOS1Ip, response ): |
| 204 | switchMastership = switchMastership and main.TRUE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 205 | else: |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 206 | switchMastership = main.FALSE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 207 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 208 | if switchMastership == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 209 | main.log.report( "Controller assignment successfull" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 210 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 211 | main.log.report( "Controller assignment failed" ) |
| 212 | # REACTIVE FWD test |
| 213 | main.step( "Pingall" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 214 | pingResult = main.FALSE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 215 | time1 = time.time() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 216 | pingResult = main.Mininet1.pingall() |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 217 | time2 = time.time() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 218 | print "Time for pingall: %2f seconds" % ( time2 - time1 ) |
| 219 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 220 | case4Result = switchMastership and pingResult |
| 221 | if pingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 222 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 223 | "Pingall Test in reactive mode to" + |
| 224 | " discover the hosts successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 225 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 226 | main.log.report( |
| 227 | "Pingall Test in reactive mode to discover the hosts failed" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 228 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 229 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 230 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 231 | actual=case4Result, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 232 | onpass="Controller assignment and Pingall Test successful", |
| 233 | onfail="Controller assignment and Pingall Test NOT successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 234 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 235 | def CASE5( self, main ): |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 236 | import json |
| 237 | from subprocess import Popen, PIPE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 238 | # assumes that sts is already in you PYTHONPATH |
| 239 | from sts.topology.teston_topology import TestONTopology |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 240 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 241 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 242 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 243 | |
| 244 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 245 | "This testcase is testing if all ONOS nodes are in topologyi" + |
| 246 | " sync with mininet and its peer ONOS nodes" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 247 | main.log.report( "__________________________________" ) |
| 248 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 249 | "Testing Mininet topology with the" + |
| 250 | " topology of multi instances ONOS" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 251 | main.step( "Collecting topology information from ONOS" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 252 | devices1 = main.ONOScli1.devices() |
| 253 | devices2 = main.ONOScli2.devices() |
| 254 | devices3 = main.ONOScli3.devices() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 255 | # print "devices1 = ", devices1 |
| 256 | # print "devices2 = ", devices2 |
| 257 | # print "devices3 = ", devices3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 258 | hosts1 = main.ONOScli1.hosts() |
| 259 | hosts2 = main.ONOScli2.hosts() |
| 260 | hosts3 = main.ONOScli3.hosts() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 261 | # print "hosts1 = ", hosts1 |
| 262 | # print "hosts2 = ", hosts2 |
| 263 | # print "hosts3 = ", hosts3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 264 | ports1 = main.ONOScli1.ports() |
| 265 | ports2 = main.ONOScli2.ports() |
| 266 | ports3 = main.ONOScli3.ports() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 267 | # print "ports1 = ", ports1 |
| 268 | # print "ports2 = ", ports2 |
| 269 | # print "ports3 = ", ports3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 270 | links1 = main.ONOScli1.links() |
| 271 | links2 = main.ONOScli2.links() |
| 272 | links3 = main.ONOScli3.links() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 273 | # print "links1 = ", links1 |
| 274 | # print "links2 = ", links2 |
| 275 | # print "links3 = ", links3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 276 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 277 | print "**************" |
| 278 | |
| 279 | main.step( "Start continuous pings" ) |
| 280 | main.Mininet2.pingLong( |
| 281 | src=main.params[ 'PING' ][ 'source1' ], |
| 282 | target=main.params[ 'PING' ][ 'target1' ], |
| 283 | pingTime=500 ) |
| 284 | main.Mininet2.pingLong( |
| 285 | src=main.params[ 'PING' ][ 'source2' ], |
| 286 | target=main.params[ 'PING' ][ 'target2' ], |
| 287 | pingTime=500 ) |
| 288 | main.Mininet2.pingLong( |
| 289 | src=main.params[ 'PING' ][ 'source3' ], |
| 290 | target=main.params[ 'PING' ][ 'target3' ], |
| 291 | pingTime=500 ) |
| 292 | main.Mininet2.pingLong( |
| 293 | src=main.params[ 'PING' ][ 'source4' ], |
| 294 | target=main.params[ 'PING' ][ 'target4' ], |
| 295 | pingTime=500 ) |
| 296 | main.Mininet2.pingLong( |
| 297 | src=main.params[ 'PING' ][ 'source5' ], |
| 298 | target=main.params[ 'PING' ][ 'target5' ], |
| 299 | pingTime=500 ) |
| 300 | main.Mininet2.pingLong( |
| 301 | src=main.params[ 'PING' ][ 'source6' ], |
| 302 | target=main.params[ 'PING' ][ 'target6' ], |
| 303 | pingTime=500 ) |
| 304 | main.Mininet2.pingLong( |
| 305 | src=main.params[ 'PING' ][ 'source7' ], |
| 306 | target=main.params[ 'PING' ][ 'target7' ], |
| 307 | pingTime=500 ) |
| 308 | main.Mininet2.pingLong( |
| 309 | src=main.params[ 'PING' ][ 'source8' ], |
| 310 | target=main.params[ 'PING' ][ 'target8' ], |
| 311 | pingTime=500 ) |
| 312 | main.Mininet2.pingLong( |
| 313 | src=main.params[ 'PING' ][ 'source9' ], |
| 314 | target=main.params[ 'PING' ][ 'target9' ], |
| 315 | pingTime=500 ) |
| 316 | main.Mininet2.pingLong( |
| 317 | src=main.params[ 'PING' ][ 'source10' ], |
| 318 | target=main.params[ 'PING' ][ 'target10' ], |
| 319 | pingTime=500 ) |
| 320 | |
| 321 | main.step( "Create TestONTopology object" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 322 | global ctrls |
| 323 | ctrls = [] |
| 324 | count = 1 |
| 325 | while True: |
| 326 | temp = () |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 327 | if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]: |
| 328 | temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), ) |
| 329 | temp = temp + ( "ONOS" + str( count ), ) |
| 330 | temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], ) |
| 331 | temp = temp + \ |
| 332 | ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), ) |
| 333 | ctrls.append( temp ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 334 | count = count + 1 |
| 335 | else: |
| 336 | break |
| 337 | global MNTopo |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 338 | Topo = TestONTopology( |
| 339 | main.Mininet1, |
| 340 | ctrls ) # can also add Intent API info for intent operations |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 341 | MNTopo = Topo |
| 342 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 343 | TopologyCheck = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 344 | main.step( "Compare ONOS Topology to MN Topology" ) |
| 345 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 346 | switchesResults1 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 347 | MNTopo, |
| 348 | json.loads( devices1 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 349 | print "switches_Result1 = ", switchesResults1 |
| 350 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults1, |
| 351 | onpass="ONOS1 Switches view is correct", |
| 352 | onfail="ONOS1 Switches view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 353 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 354 | switchesResults2 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 355 | MNTopo, |
| 356 | json.loads( devices2 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 357 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults2, |
| 358 | onpass="ONOS2 Switches view is correct", |
| 359 | onfail="ONOS2 Switches view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 360 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 361 | switchesResults3 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 362 | MNTopo, |
| 363 | json.loads( devices3 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 364 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults3, |
| 365 | onpass="ONOS3 Switches view is correct", |
| 366 | onfail="ONOS3 Switches view is incorrect" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 367 | |
| 368 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 369 | portsResults1 = main.Mininet1.comparePorts( MNTopo, |
| 370 | json.loads( ports1 ) ) |
| 371 | utilities.assertEquals( expect=main.TRUE, actual=portsResults1, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 372 | onpass="ONOS1 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 373 | onfail="ONOS1 Ports view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 374 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 375 | portsResults2 = main.Mininet1.comparePorts( MNTopo, |
| 376 | json.loads( ports2 ) ) |
| 377 | utilities.assertEquals( expect=main.TRUE, actual=portsResults2, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 378 | onpass="ONOS2 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 379 | onfail="ONOS2 Ports view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 380 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 381 | portsResults3 = main.Mininet1.comparePorts( MNTopo, |
| 382 | json.loads( ports3 ) ) |
| 383 | utilities.assertEquals( expect=main.TRUE, actual=portsResults3, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 384 | onpass="ONOS3 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 385 | onfail="ONOS3 Ports view is incorrect" ) |
| 386 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 387 | linksResults1 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 388 | MNTopo, |
| 389 | json.loads( links1 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 390 | utilities.assertEquals( expect=main.TRUE, actual=linksResults1, |
| 391 | onpass="ONOS1 Links view is correct", |
| 392 | onfail="ONOS1 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 393 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 394 | linksResults2 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 395 | MNTopo, |
| 396 | json.loads( links2 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 397 | utilities.assertEquals( expect=main.TRUE, actual=linksResults2, |
| 398 | onpass="ONOS2 Links view is correct", |
| 399 | onfail="ONOS2 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 400 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 401 | linksResults3 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 402 | MNTopo, |
| 403 | json.loads( links3 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 404 | utilities.assertEquals( expect=main.TRUE, actual=linksResults3, |
| 405 | onpass="ONOS2 Links view is correct", |
| 406 | onfail="ONOS2 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 407 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 408 | # topoResult = switchesResults1 and switchesResults2 |
| 409 | # and switchesResults3\ |
| 410 | # and portsResults1 and portsResults2 and portsResults3\ |
| 411 | # and linksResults1 and linksResults2 and linksResults3 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 412 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 413 | topoResult = switchesResults1 and switchesResults2 and\ |
| 414 | switchesResults3 and linksResults1 and linksResults2 and\ |
| 415 | linksResults3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 416 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 417 | if topoResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 418 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 419 | "Topology Check Test with mininet" + |
| 420 | "and ONOS instances successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 421 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 422 | main.log.report( |
| 423 | "Topology Check Test with mininet and ONOS instances failed" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 424 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 425 | utilities.assertEquals( expect=main.TRUE, actual=topoResult, |
| 426 | onpass="Topology Check Test successful", |
| 427 | onfail="Topology Check Test NOT successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 428 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 429 | def CASE10( self ): |
| 430 | main.log.report( |
| 431 | "This testcase uninstalls the reactive forwarding app" ) |
| 432 | main.log.report( "__________________________________" ) |
| 433 | main.case( "Uninstalling reactive forwarding app" ) |
| 434 | # Unistall onos-app-fwd app to disable reactive forwarding |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 435 | appUninstallResult1 = main.ONOScli1.featureUninstall( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 436 | "onos-app-fwd" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 437 | appUninstallResult2 = main.ONOScli2.featureUninstall( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 438 | "onos-app-fwd" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 439 | appUninstallResult3 = main.ONOScli3.featureUninstall( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 440 | "onos-app-fwd" ) |
| 441 | main.log.info( "onos-app-fwd uninstalled" ) |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 442 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 443 | # After reactive forwarding is disabled, |
| 444 | # the reactive flows on switches timeout in 10-15s |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 445 | # So sleep for 15s |
| 446 | time.sleep( 15 ) |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 447 | |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 448 | hosts = main.ONOScli1.hosts() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 449 | main.log.info( hosts ) |
| 450 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 451 | case10Result = appUninstallResult1 and\ |
| 452 | appUninstallResult2 and appUninstallResult3 |
| 453 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 454 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 455 | actual=case10Result, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 456 | onpass="Reactive forwarding app uninstallation successful", |
| 457 | onfail="Reactive forwarding app uninstallation failed" ) |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 458 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 459 | def CASE6( self ): |
| 460 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 461 | "This testcase is testing the addition of" + |
| 462 | " host intents and then doing pingall" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 463 | main.log.report( "__________________________________" ) |
| 464 | main.case( "Obtaining hostsfor adding host intents" ) |
| 465 | main.step( "Get hosts" ) |
shahshreya | eac353b | 2014-11-18 17:19:20 -0800 | [diff] [blame] | 466 | hosts = main.ONOScli1.hosts() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 467 | main.log.info( hosts ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 468 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 469 | main.step( "Get all devices id" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 470 | devicesIdList = main.ONOScli1.getAllDevicesId() |
| 471 | main.log.info( devicesIdList ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 472 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 473 | # ONOS displays the hosts in hex format |
| 474 | # unlike mininet which does in decimal format |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 475 | # So take care while adding intents |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 476 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 477 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 478 | main.step( "Add host intents for mn hosts(h8-h18,h9-h19,h10-h20, |
| 479 | h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)" ) |
| 480 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:08/-1", |
| 481 | "00:00:00:00:00:12/-1" ) |
| 482 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:09/-1", |
| 483 | "00:00:00:00:00:13/-1" ) |
| 484 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:0A/-1", |
| 485 | "00:00:00:00:00:14/-1" ) |
| 486 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:0B/-1", |
| 487 | "00:00:00:00:00:15/-1" ) |
| 488 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:0C/-1", |
| 489 | "00:00:00:00:00:16/-1" ) |
| 490 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:0D/-1", |
| 491 | "00:00:00:00:00:17/-1" ) |
| 492 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:0E/-1", |
| 493 | "00:00:00:00:00:18/-1" ) |
| 494 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:0F/-1", |
| 495 | "00:00:00:00:00:19/-1" ) |
| 496 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:10/-1", |
| 497 | "00:00:00:00:00:1A/-1" ) |
| 498 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:11/-1", |
| 499 | "00:00:00:00:00:1B/-1" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 500 | """ |
| 501 | for i in range( 8, 18 ): |
| 502 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 503 | "Adding host intent between h" + str( i ) + |
| 504 | " and h" + str( i + 10 ) ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 505 | host1 = "00:00:00:00:00:" + \ |
| 506 | str( hex( i )[ 2: ] ).zfill( 2 ).upper() |
| 507 | host2 = "00:00:00:00:00:" + \ |
| 508 | str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper() |
| 509 | # NOTE: get host can return None |
| 510 | # TODO: handle this |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 511 | host1Id = main.ONOScli1.getHost( host1 )[ 'id' ] |
| 512 | host2Id = main.ONOScli1.getHost( host2 )[ 'id' ] |
| 513 | tmpResult = main.ONOScli1.addHostIntent( host1Id, host2Id ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 514 | |
| 515 | flowHandle = main.ONOScli1.flows() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 516 | main.log.info( "flows:" + flowHandle ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 517 | |
| 518 | count = 1 |
| 519 | i = 8 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 520 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 521 | while i < 18: |
| 522 | main.log.info( |
| 523 | "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) ) |
| 524 | ping = main.Mininet1.pingHost( |
| 525 | src="h" + str( i ), target="h" + str( i + 10 ) ) |
| 526 | if ping == main.FALSE and count < 5: |
| 527 | count += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 528 | # i = 8 |
| 529 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 530 | main.log.report( "Ping between h" + |
| 531 | str( i ) + |
| 532 | " and h" + |
| 533 | str( i + |
| 534 | 10 ) + |
| 535 | " failed. Making attempt number " + |
| 536 | str( count ) + |
| 537 | " in 2 seconds" ) |
| 538 | time.sleep( 2 ) |
| 539 | elif ping == main.FALSE: |
| 540 | main.log.report( "All ping attempts between h" + |
| 541 | str( i ) + |
| 542 | " and h" + |
| 543 | str( i + |
| 544 | 10 ) + |
| 545 | "have failed" ) |
| 546 | i = 19 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 547 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 548 | elif ping == main.TRUE: |
| 549 | main.log.info( "Ping test between h" + |
| 550 | str( i ) + |
| 551 | " and h" + |
| 552 | str( i + |
| 553 | 10 ) + |
| 554 | "passed!" ) |
| 555 | i += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 556 | PingResult = main.TRUE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 557 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 558 | main.log.info( "Unknown error" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 559 | PingResult = main.ERROR |
| 560 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 561 | main.log.report( |
| 562 | "Host intents have not ben installed correctly. Cleaning up" ) |
| 563 | # main.cleanup() |
| 564 | # main.exit() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 565 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 566 | main.log.report( "Host intents have been installed correctly" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 567 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 568 | case6Result = PingResult |
| 569 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 570 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 571 | actual=case6Result, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 572 | onpass="Host intent addition and Pingall Test successful", |
| 573 | onfail="Host intent addition and Pingall Test NOT successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 574 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 575 | def CASE7( self, main ): |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 576 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 577 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 578 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 579 | linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 580 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 581 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 582 | "This testscase is killing a link to" + |
| 583 | " ensure that link discovery is consistent" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 584 | main.log.report( "__________________________________" ) |
| 585 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 586 | "Killing a link to Ensure that Link" + |
| 587 | " Discovery is Working Properly" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 588 | main.step( "Start continuous pings" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 589 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 590 | main.Mininet2.pingLong( |
| 591 | src=main.params[ 'PING' ][ 'source1' ], |
| 592 | target=main.params[ 'PING' ][ 'target1' ], |
| 593 | pingTime=500 ) |
| 594 | main.Mininet2.pingLong( |
| 595 | src=main.params[ 'PING' ][ 'source2' ], |
| 596 | target=main.params[ 'PING' ][ 'target2' ], |
| 597 | pingTime=500 ) |
| 598 | main.Mininet2.pingLong( |
| 599 | src=main.params[ 'PING' ][ 'source3' ], |
| 600 | target=main.params[ 'PING' ][ 'target3' ], |
| 601 | pingTime=500 ) |
| 602 | main.Mininet2.pingLong( |
| 603 | src=main.params[ 'PING' ][ 'source4' ], |
| 604 | target=main.params[ 'PING' ][ 'target4' ], |
| 605 | pingTime=500 ) |
| 606 | main.Mininet2.pingLong( |
| 607 | src=main.params[ 'PING' ][ 'source5' ], |
| 608 | target=main.params[ 'PING' ][ 'target5' ], |
| 609 | pingTime=500 ) |
| 610 | main.Mininet2.pingLong( |
| 611 | src=main.params[ 'PING' ][ 'source6' ], |
| 612 | target=main.params[ 'PING' ][ 'target6' ], |
| 613 | pingTime=500 ) |
| 614 | main.Mininet2.pingLong( |
| 615 | src=main.params[ 'PING' ][ 'source7' ], |
| 616 | target=main.params[ 'PING' ][ 'target7' ], |
| 617 | pingTime=500 ) |
| 618 | main.Mininet2.pingLong( |
| 619 | src=main.params[ 'PING' ][ 'source8' ], |
| 620 | target=main.params[ 'PING' ][ 'target8' ], |
| 621 | pingTime=500 ) |
| 622 | main.Mininet2.pingLong( |
| 623 | src=main.params[ 'PING' ][ 'source9' ], |
| 624 | target=main.params[ 'PING' ][ 'target9' ], |
| 625 | pingTime=500 ) |
| 626 | main.Mininet2.pingLong( |
| 627 | src=main.params[ 'PING' ][ 'source10' ], |
| 628 | target=main.params[ 'PING' ][ 'target10' ], |
| 629 | pingTime=500 ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 630 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 631 | main.step( "Determine the current number of switches and links" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 632 | topologyOutput = main.ONOScli1.topology() |
| 633 | topologyResult = main.ONOSbench.getTopology( topologyOutput ) |
| 634 | activeSwitches = topologyResult[ 'devices' ] |
| 635 | links = topologyResult[ 'links' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 636 | print "activeSwitches = ", type( activeSwitches ) |
| 637 | print "links = ", type( links ) |
| 638 | main.log.info( |
| 639 | "Currently there are %s switches and %s links" % |
| 640 | ( str( activeSwitches ), str( links ) ) ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 641 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 642 | main.step( "Kill Link between s3 and s28" ) |
| 643 | main.Mininet1.link( END1="s3", END2="s28", OPTION="down" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 644 | time.sleep( linkSleep ) |
| 645 | topologyOutput = main.ONOScli2.topology() |
| 646 | LinkDown = main.ONOSbench.checkStatus( |
| 647 | topologyOutput, activeSwitches, str( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 648 | int( links ) - 2 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 649 | if LinkDown == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 650 | main.log.report( "Link Down discovered properly" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 651 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 652 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 653 | actual=LinkDown, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 654 | onpass="Link Down discovered properly", |
| 655 | onfail="Link down was not discovered in " + |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 656 | str( linkSleep ) + |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 657 | " seconds" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 658 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 659 | main.step( "Bring link between s3 and s28 back up" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 660 | LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" ) |
| 661 | time.sleep( linkSleep ) |
| 662 | topologyOutput = main.ONOScli2.topology() |
| 663 | LinkUp = main.ONOSbench.checkStatus( |
| 664 | topologyOutput, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 665 | activeSwitches, |
| 666 | str( links ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 667 | if LinkUp == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 668 | main.log.report( "Link up discovered properly" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 669 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 670 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 671 | actual=LinkUp, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 672 | onpass="Link up discovered properly", |
| 673 | onfail="Link up was not discovered in " + |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 674 | str( linkSleep ) + |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 675 | " seconds" ) |
| 676 | |
| 677 | main.step( "Compare ONOS Topology to MN Topology" ) |
| 678 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 679 | "Testing Mininet topology with the" + |
| 680 | " topology of multi instances ONOS" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 681 | main.step( "Collecting topology information from ONOS" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 682 | devices1 = main.ONOScli1.devices() |
| 683 | devices2 = main.ONOScli2.devices() |
| 684 | devices3 = main.ONOScli3.devices() |
| 685 | print "devices1 = ", devices1 |
| 686 | print "devices2 = ", devices2 |
| 687 | print "devices3 = ", devices3 |
| 688 | hosts1 = main.ONOScli1.hosts() |
| 689 | hosts2 = main.ONOScli2.hosts() |
| 690 | hosts3 = main.ONOScli3.hosts() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 691 | # print "hosts1 = ", hosts1 |
| 692 | # print "hosts2 = ", hosts2 |
| 693 | # print "hosts3 = ", hosts3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 694 | ports1 = main.ONOScli1.ports() |
| 695 | ports2 = main.ONOScli2.ports() |
| 696 | ports3 = main.ONOScli3.ports() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 697 | # print "ports1 = ", ports1 |
| 698 | # print "ports2 = ", ports2 |
| 699 | # print "ports3 = ", ports3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 700 | links1 = main.ONOScli1.links() |
| 701 | links2 = main.ONOScli2.links() |
| 702 | links3 = main.ONOScli3.links() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 703 | # print "links1 = ", links1 |
| 704 | # print "links2 = ", links2 |
| 705 | # print "links3 = ", links3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 706 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 707 | print "**************" |
| 708 | |
| 709 | main.step( "Start continuous pings" ) |
| 710 | main.Mininet2.pingLong( |
| 711 | src=main.params[ 'PING' ][ 'source1' ], |
| 712 | target=main.params[ 'PING' ][ 'target1' ], |
| 713 | pingTime=500 ) |
| 714 | main.Mininet2.pingLong( |
| 715 | src=main.params[ 'PING' ][ 'source2' ], |
| 716 | target=main.params[ 'PING' ][ 'target2' ], |
| 717 | pingTime=500 ) |
| 718 | main.Mininet2.pingLong( |
| 719 | src=main.params[ 'PING' ][ 'source3' ], |
| 720 | target=main.params[ 'PING' ][ 'target3' ], |
| 721 | pingTime=500 ) |
| 722 | main.Mininet2.pingLong( |
| 723 | src=main.params[ 'PING' ][ 'source4' ], |
| 724 | target=main.params[ 'PING' ][ 'target4' ], |
| 725 | pingTime=500 ) |
| 726 | main.Mininet2.pingLong( |
| 727 | src=main.params[ 'PING' ][ 'source5' ], |
| 728 | target=main.params[ 'PING' ][ 'target5' ], |
| 729 | pingTime=500 ) |
| 730 | main.Mininet2.pingLong( |
| 731 | src=main.params[ 'PING' ][ 'source6' ], |
| 732 | target=main.params[ 'PING' ][ 'target6' ], |
| 733 | pingTime=500 ) |
| 734 | main.Mininet2.pingLong( |
| 735 | src=main.params[ 'PING' ][ 'source7' ], |
| 736 | target=main.params[ 'PING' ][ 'target7' ], |
| 737 | pingTime=500 ) |
| 738 | main.Mininet2.pingLong( |
| 739 | src=main.params[ 'PING' ][ 'source8' ], |
| 740 | target=main.params[ 'PING' ][ 'target8' ], |
| 741 | pingTime=500 ) |
| 742 | main.Mininet2.pingLong( |
| 743 | src=main.params[ 'PING' ][ 'source9' ], |
| 744 | target=main.params[ 'PING' ][ 'target9' ], |
| 745 | pingTime=500 ) |
| 746 | main.Mininet2.pingLong( |
| 747 | src=main.params[ 'PING' ][ 'source10' ], |
| 748 | target=main.params[ 'PING' ][ 'target10' ], |
| 749 | pingTime=500 ) |
| 750 | |
| 751 | main.step( "Create TestONTopology object" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 752 | global ctrls |
| 753 | ctrls = [] |
| 754 | count = 1 |
| 755 | while True: |
| 756 | temp = () |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 757 | if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]: |
| 758 | temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), ) |
| 759 | temp = temp + ( "ONOS" + str( count ), ) |
| 760 | temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], ) |
| 761 | temp = temp + \ |
| 762 | ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), ) |
| 763 | ctrls.append( temp ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 764 | count = count + 1 |
| 765 | else: |
| 766 | break |
| 767 | global MNTopo |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 768 | Topo = TestONTopology( |
| 769 | main.Mininet1, |
| 770 | ctrls ) # can also add Intent API info for intent operations |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 771 | MNTopo = Topo |
| 772 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 773 | TopologyCheck = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 774 | main.step( "Compare ONOS Topology to MN Topology" ) |
| 775 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 776 | switchesResults1 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 777 | MNTopo, |
| 778 | json.loads( devices1 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 779 | print "switches_Result1 = ", switchesResults1 |
| 780 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults1, |
| 781 | onpass="ONOS1 Switches view is correct", |
| 782 | onfail="ONOS1 Switches view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 783 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 784 | switchesResults2 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 785 | MNTopo, |
| 786 | json.loads( devices2 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 787 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults2, |
| 788 | onpass="ONOS2 Switches view is correct", |
| 789 | onfail="ONOS2 Switches view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 790 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 791 | switchesResults3 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 792 | MNTopo, |
| 793 | json.loads( devices3 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 794 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults3, |
| 795 | onpass="ONOS3 Switches view is correct", |
| 796 | onfail="ONOS3 Switches view is incorrect" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 797 | |
| 798 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 799 | portsResults1 = main.Mininet1.comparePorts( MNTopo, |
| 800 | json.loads( ports1 ) ) |
| 801 | utilities.assertEquals( expect=main.TRUE, actual=portsResults1, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 802 | onpass="ONOS1 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 803 | onfail="ONOS1 Ports view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 804 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 805 | portsResults2 = main.Mininet1.comparePorts( MNTopo, |
| 806 | json.loads( ports2 ) ) |
| 807 | utilities.assertEquals( expect=main.TRUE, actual=portsResults2, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 808 | onpass="ONOS2 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 809 | onfail="ONOS2 Ports view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 810 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 811 | portsResults3 = main.Mininet1.comparePorts( MNTopo, |
| 812 | json.loads( ports3 ) ) |
| 813 | utilities.assertEquals( expect=main.TRUE, actual=portsResults3, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 814 | onpass="ONOS3 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 815 | onfail="ONOS3 Ports view is incorrect" ) |
| 816 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 817 | linksResults1 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 818 | MNTopo, |
| 819 | json.loads( links1 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 820 | utilities.assertEquals( expect=main.TRUE, actual=linksResults1, |
| 821 | onpass="ONOS1 Links view is correct", |
| 822 | onfail="ONOS1 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 823 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 824 | linksResults2 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 825 | MNTopo, |
| 826 | json.loads( links2 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 827 | utilities.assertEquals( expect=main.TRUE, actual=linksResults2, |
| 828 | onpass="ONOS2 Links view is correct", |
| 829 | onfail="ONOS2 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 830 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 831 | linksResults3 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 832 | MNTopo, |
| 833 | json.loads( links3 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 834 | utilities.assertEquals( expect=main.TRUE, actual=linksResults3, |
| 835 | onpass="ONOS2 Links view is correct", |
| 836 | onfail="ONOS2 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 837 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 838 | # topoResult = switchesResults1 and switchesResults2 |
| 839 | # and switchesResults3\ |
| 840 | # and portsResults1 and portsResults2 and portsResults3\ |
| 841 | # and linksResults1 and linksResults2 and linksResults3 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 842 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 843 | topoResult = switchesResults1 and switchesResults2\ |
| 844 | and switchesResults3 and linksResults1 and\ |
| 845 | linksResults2 and linksResults3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 846 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 847 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 848 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 849 | actual=topoResult and LinkUp and LinkDown, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 850 | onpass="Topology Check Test successful", |
| 851 | onfail="Topology Check Test NOT successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 852 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 853 | def CASE8( self ): |
| 854 | """ |
shahshreya | eac353b | 2014-11-18 17:19:20 -0800 | [diff] [blame] | 855 | Intent removal |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 856 | """ |
| 857 | main.log.report( |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 858 | "This testcase removes any previously added intents" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 859 | main.log.report( "__________________________________" ) |
| 860 | main.log.info( "Removing any previously installed intents" ) |
| 861 | main.case( "Removing intents" ) |
| 862 | main.step( "Obtain the intent id's" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 863 | intentResult = main.ONOScli1.intents( jsonFormat=False ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 864 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 865 | intentLinewise = intentResult.split( "\n" ) |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 866 | intentList = [] |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 867 | for line in intentLinewise: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 868 | if line.startswith( "id=" ): |
| 869 | intentList.append( line ) |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 870 | |
| 871 | intentids = [] |
| 872 | for line in intentList: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 873 | intentids.append( line.split( "," )[ 0 ].split( "=" )[ 1 ] ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 874 | for id in intentids: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 875 | main.log.info( "id = " + id ) |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 876 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 877 | main.step( |
| 878 | "Iterate through the intentids list and remove each intent" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 879 | for id in intentids: |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 880 | main.ONOScli1.removeIntent( intentId=id ) |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 881 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 882 | intentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 883 | main.log.info( "intent_result = " + intentResult ) |
| 884 | case8Result = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 885 | |
shahshreya | eac353b | 2014-11-18 17:19:20 -0800 | [diff] [blame] | 886 | i = 8 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 887 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 888 | while i < 18: |
| 889 | main.log.info( |
| 890 | "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) ) |
| 891 | ping = main.Mininet1.pingHost( |
| 892 | src="h" + str( i ), target="h" + str( i + 10 ) ) |
| 893 | if ping == main.TRUE: |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 894 | i = 19 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 895 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 896 | elif ping == main.FALSE: |
| 897 | i += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 898 | PingResult = main.FALSE |
shahshreya | eac353b | 2014-11-18 17:19:20 -0800 | [diff] [blame] | 899 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 900 | main.log.info( "Unknown error" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 901 | PingResult = main.ERROR |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 902 | |
| 903 | # Note: If the ping result failed, that means the intents have been |
| 904 | # withdrawn correctly. |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 905 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 906 | main.log.report( "Host intents have not been withdrawn correctly" ) |
| 907 | # main.cleanup() |
| 908 | # main.exit() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 909 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 910 | main.log.report( "Host intents have been withdrawn correctly" ) |
shahshreya | eac353b | 2014-11-18 17:19:20 -0800 | [diff] [blame] | 911 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 912 | case8Result = case8Result and PingResult |
shahshreya | eac353b | 2014-11-18 17:19:20 -0800 | [diff] [blame] | 913 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 914 | if case8Result == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 915 | main.log.report( "Intent removal successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 916 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 917 | main.log.report( "Intent removal failed" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 918 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 919 | utilities.assertEquals( expect=main.FALSE, actual=case8Result, |
| 920 | onpass="Intent removal test failed", |
| 921 | onfail="Intent removal test successful" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 922 | |
| 923 | def CASE9( self ): |
| 924 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 925 | This test case adds point intents. Make sure you run test case 8 |
| 926 | which is host intent removal before executing this test case. |
| 927 | Else the host intent's flows will persist on switches and the pings |
| 928 | would work even if there is some issue with the point intent's flows |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 929 | """ |
| 930 | main.log.report( |
| 931 | "This testcase adds point intents and then does pingall" ) |
| 932 | main.log.report( "__________________________________" ) |
| 933 | main.log.info( "Adding point intents" ) |
| 934 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 935 | "Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20," + |
| 936 | "h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 937 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 938 | "Add point-to-point intents for mininet hosts" + |
| 939 | " h8 and h18 or ONOS hosts h8 and h12" ) |
| 940 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 941 | "of:0000000000003008/1", |
| 942 | "of:0000000000006018/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 943 | if ptpIntentResult == main.TRUE: |
| 944 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 945 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 946 | # main.log.info( getIntentResult ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 947 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 948 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 949 | "of:0000000000006018/1", |
| 950 | "of:0000000000003008/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 951 | if ptpIntentResult == main.TRUE: |
| 952 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 953 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 954 | # main.log.info( getIntentResult ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 955 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 956 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 957 | "Add point-to-point intents for mininet hosts" + |
| 958 | " h9 and h19 or ONOS hosts h9 and h13" ) |
| 959 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 960 | "of:0000000000003009/1", |
| 961 | "of:0000000000006019/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 962 | if ptpIntentResult == main.TRUE: |
| 963 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 964 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 965 | # main.log.info( getIntentResult ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 966 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 967 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 968 | "of:0000000000006019/1", |
| 969 | "of:0000000000003009/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 970 | if ptpIntentResult == main.TRUE: |
| 971 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 972 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 973 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 974 | |
| 975 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 976 | "Add point-to-point intents for mininet" + |
| 977 | " hosts h10 and h20 or ONOS hosts hA and h14" ) |
| 978 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 979 | "of:0000000000003010/1", |
| 980 | "of:0000000000006020/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 981 | if ptpIntentResult == main.TRUE: |
| 982 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 983 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 984 | # main.log.info( getIntentResult ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 985 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 986 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 987 | "of:0000000000006020/1", |
| 988 | "of:0000000000003010/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 989 | if ptpIntentResult == main.TRUE: |
| 990 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 991 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 992 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 993 | |
| 994 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 995 | "Add point-to-point intents for mininet" + |
| 996 | " hosts h11 and h21 or ONOS hosts hB and h15" ) |
| 997 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 998 | "of:0000000000003011/1", |
| 999 | "of:0000000000006021/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1000 | if ptpIntentResult == main.TRUE: |
| 1001 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1002 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1003 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1004 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1005 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1006 | "of:0000000000006021/1", |
| 1007 | "of:0000000000003011/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1008 | if ptpIntentResult == main.TRUE: |
| 1009 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1010 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1011 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1012 | |
| 1013 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1014 | "Add point-to-point intents for mininet" + |
| 1015 | " hosts h12 and h22 or ONOS hosts hC and h16" ) |
| 1016 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1017 | "of:0000000000003012/1", |
| 1018 | "of:0000000000006022/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1019 | if ptpIntentResult == main.TRUE: |
| 1020 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1021 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1022 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1023 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1024 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1025 | "of:0000000000006022/1", |
| 1026 | "of:0000000000003012/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1027 | if ptpIntentResult == main.TRUE: |
| 1028 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1029 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1030 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1031 | |
| 1032 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1033 | "Add point-to-point intents for mininet " + |
| 1034 | "hosts h13 and h23 or ONOS hosts hD and h17" ) |
| 1035 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1036 | "of:0000000000003013/1", |
| 1037 | "of:0000000000006023/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1038 | if ptpIntentResult == main.TRUE: |
| 1039 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1040 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1041 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1042 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1043 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1044 | "of:0000000000006023/1", |
| 1045 | "of:0000000000003013/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1046 | if ptpIntentResult == main.TRUE: |
| 1047 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1048 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1049 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1050 | |
| 1051 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1052 | "Add point-to-point intents for mininet hosts" + |
| 1053 | " h14 and h24 or ONOS hosts hE and h18" ) |
| 1054 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1055 | "of:0000000000003014/1", |
| 1056 | "of:0000000000006024/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1057 | if ptpIntentResult == main.TRUE: |
| 1058 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1059 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1060 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1061 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1062 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1063 | "of:0000000000006024/1", |
| 1064 | "of:0000000000003014/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1065 | if ptpIntentResult == main.TRUE: |
| 1066 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1067 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1068 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1069 | |
| 1070 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1071 | "Add point-to-point intents for mininet hosts" + |
| 1072 | " h15 and h25 or ONOS hosts hF and h19" ) |
| 1073 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1074 | "of:0000000000003015/1", |
| 1075 | "of:0000000000006025/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1076 | if ptpIntentResult == main.TRUE: |
| 1077 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1078 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1079 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1080 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1081 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1082 | "of:0000000000006025/1", |
| 1083 | "of:0000000000003015/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1084 | if ptpIntentResult == main.TRUE: |
| 1085 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1086 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1087 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1088 | |
| 1089 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1090 | "Add point-to-point intents for mininet hosts" + |
| 1091 | " h16 and h26 or ONOS hosts h10 and h1A" ) |
| 1092 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1093 | "of:0000000000003016/1", |
| 1094 | "of:0000000000006026/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1095 | if ptpIntentResult == main.TRUE: |
| 1096 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1097 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1098 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1099 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1100 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1101 | "of:0000000000006026/1", |
| 1102 | "of:0000000000003016/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1103 | if ptpIntentResult == main.TRUE: |
| 1104 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1105 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1106 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1107 | |
| 1108 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1109 | "Add point-to-point intents for mininet hosts h17" + |
| 1110 | " and h27 or ONOS hosts h11 and h1B" ) |
| 1111 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1112 | "of:0000000000003017/1", |
| 1113 | "of:0000000000006027/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1114 | if ptpIntentResult == main.TRUE: |
| 1115 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1116 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1117 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1118 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1119 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1120 | "of:0000000000006027/1", |
| 1121 | "of:0000000000003017/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1122 | if ptpIntentResult == main.TRUE: |
| 1123 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1124 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1125 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1126 | |
| 1127 | print( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1128 | "_______________________________________________________" + |
| 1129 | "________________________________" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1130 | |
| 1131 | flowHandle = main.ONOScli1.flows() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1132 | # print "flowHandle = ", flowHandle |
| 1133 | main.log.info( "flows :" + flowHandle ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1134 | |
| 1135 | count = 1 |
| 1136 | i = 8 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1137 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1138 | while i < 18: |
| 1139 | main.log.info( |
| 1140 | "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) ) |
| 1141 | ping = main.Mininet1.pingHost( |
| 1142 | src="h" + str( i ), target="h" + str( i + 10 ) ) |
| 1143 | if ping == main.FALSE and count < 5: |
| 1144 | count += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1145 | # i = 8 |
| 1146 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1147 | main.log.report( "Ping between h" + |
| 1148 | str( i ) + |
| 1149 | " and h" + |
| 1150 | str( i + |
| 1151 | 10 ) + |
| 1152 | " failed. Making attempt number " + |
| 1153 | str( count ) + |
| 1154 | " in 2 seconds" ) |
| 1155 | time.sleep( 2 ) |
| 1156 | elif ping == main.FALSE: |
| 1157 | main.log.report( "All ping attempts between h" + |
| 1158 | str( i ) + |
| 1159 | " and h" + |
| 1160 | str( i + |
| 1161 | 10 ) + |
| 1162 | "have failed" ) |
| 1163 | i = 19 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1164 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1165 | elif ping == main.TRUE: |
| 1166 | main.log.info( "Ping test between h" + |
| 1167 | str( i ) + |
| 1168 | " and h" + |
| 1169 | str( i + |
| 1170 | 10 ) + |
| 1171 | "passed!" ) |
| 1172 | i += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1173 | PingResult = main.TRUE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1174 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1175 | main.log.info( "Unknown error" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1176 | PingResult = main.ERROR |
| 1177 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1178 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1179 | "Ping all test after Point intents" + |
| 1180 | " addition failed. Cleaning up" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1181 | # main.cleanup() |
| 1182 | # main.exit() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1183 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1184 | main.log.report( |
| 1185 | "Ping all test after Point intents addition successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1186 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1187 | case8Result = PingResult |
| 1188 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1189 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1190 | actual=case8Result, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1191 | onpass="Ping all test after Point intents addition successful", |
| 1192 | onfail="Ping all test after Point intents addition failed" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1193 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1194 | def CASE31( self ): |
| 1195 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1196 | This test case adds point intent related to |
| 1197 | SDN-IP matching on ICMP ( ethertype=IPV4, ipProto=1 ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1198 | """ |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 1199 | import json |
| 1200 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1201 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1202 | "This test case adds point intent " + |
| 1203 | "related to SDN-IP matching on ICMP" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1204 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1205 | "Adding bidirectional point intent related" + |
| 1206 | " to SDN-IP matching on ICMP" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1207 | main.step( "Adding bidirectional point intent" ) |
| 1208 | # add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 |
| 1209 | # --ethType=IPV4 --ipProto=1 of:0000000000003008/1 |
| 1210 | # of:0000000000006018/1 |
| 1211 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1212 | hostsJson = json.loads( main.ONOScli1.hosts() ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1213 | for i in range( 8, 11 ): |
| 1214 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1215 | "Adding point intent between h" + str( i ) + |
| 1216 | " and h" + str( i + 10 ) ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1217 | host1 = "00:00:00:00:00:" + \ |
| 1218 | str( hex( i )[ 2: ] ).zfill( 2 ).upper() |
| 1219 | host2 = "00:00:00:00:00:" + \ |
| 1220 | str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1221 | host1Id = main.ONOScli1.getHost( host1 )[ 'id' ] |
| 1222 | host2Id = main.ONOScli1.getHost( host2 )[ 'id' ] |
| 1223 | for host in hostsJson: |
| 1224 | if host[ 'id' ] == host1Id: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1225 | ip1 = host[ 'ips' ][ 0 ] |
| 1226 | ip1 = str( ip1 + "/32" ) |
| 1227 | device1 = host[ 'location' ][ 'device' ] |
| 1228 | device1 = str( device1 + "/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1229 | elif host[ 'id' ] == host2Id: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1230 | ip2 = str( host[ 'ips' ][ 0 ] ) + "/32" |
| 1231 | device2 = host[ 'location' ][ "device" ] |
| 1232 | device2 = str( device2 + "/1" ) |
| 1233 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1234 | pIntentResult1 = main.ONOScli1.addPointIntent( |
| 1235 | ingressDevice=device1, |
| 1236 | egressDevice=device2, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1237 | ipSrc=ip1, |
| 1238 | ipDst=ip2, |
| 1239 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1240 | ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ] ) |
| 1241 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1242 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1243 | main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1244 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1245 | pIntentResult2 = main.ONOScli1.addPointIntent( |
| 1246 | ingressDevice=device2, |
| 1247 | egressDevice=device1, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1248 | ipSrc=ip2, |
| 1249 | ipDst=ip1, |
| 1250 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1251 | ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ] ) |
| 1252 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1253 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1254 | main.log.info( getIntentResult ) |
| 1255 | if ( pIntentResult1 and pIntentResult2 ) == main.TRUE: |
| 1256 | # getIntentResult = main.ONOScli1.intents() |
| 1257 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1258 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1259 | "Point intent related to SDN-IP matching" + |
| 1260 | " on ICMP install successful" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1261 | |
| 1262 | time.sleep( 15 ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1263 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1264 | main.log.info( "intents = " + getIntentResult ) |
| 1265 | getFlowsResult = main.ONOScli1.flows() |
| 1266 | main.log.info( "flows = " + getFlowsResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1267 | |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1268 | count = 1 |
| 1269 | i = 8 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1270 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1271 | while i < 11: |
| 1272 | main.log.info( |
| 1273 | "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) ) |
| 1274 | ping = main.Mininet1.pingHost( |
| 1275 | src="h" + str( i ), target="h" + str( i + 10 ) ) |
| 1276 | if ping == main.FALSE and count < 3: |
| 1277 | count += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1278 | # i = 8 |
| 1279 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1280 | main.log.report( "Ping between h" + |
| 1281 | str( i ) + |
| 1282 | " and h" + |
| 1283 | str( i + |
| 1284 | 10 ) + |
| 1285 | " failed. Making attempt number " + |
| 1286 | str( count ) + |
| 1287 | " in 2 seconds" ) |
| 1288 | time.sleep( 2 ) |
| 1289 | elif ping == main.FALSE: |
| 1290 | main.log.report( "All ping attempts between h" + |
| 1291 | str( i ) + |
| 1292 | " and h" + |
| 1293 | str( i + |
| 1294 | 10 ) + |
| 1295 | "have failed" ) |
| 1296 | i = 19 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1297 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1298 | elif ping == main.TRUE: |
| 1299 | main.log.info( "Ping test between h" + |
| 1300 | str( i ) + |
| 1301 | " and h" + |
| 1302 | str( i + |
| 1303 | 10 ) + |
| 1304 | "passed!" ) |
| 1305 | i += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1306 | PingResult = main.TRUE |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1307 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1308 | main.log.info( "Unknown error" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1309 | PingResult = main.ERROR |
| 1310 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1311 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1312 | "Ping test after Point intents related to" + |
| 1313 | " SDN-IP matching on ICMP failed." ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1314 | # main.cleanup() |
| 1315 | # main.exit() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1316 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1317 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1318 | "Ping all test after Point intents related to" + |
| 1319 | " SDN-IP matching on ICMP successful" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1320 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1321 | case31Result = PingResult and pIntentResult1 and pIntentResult2 |
| 1322 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1323 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1324 | actual=case31Result, |
| 1325 | onpass="Point intent related to SDN-IP " + |
| 1326 | "matching on ICMP and ping test successful", |
| 1327 | onfail="Point intent related to SDN-IP" + |
| 1328 | " matching on ICMP and ping test failed" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1329 | |
| 1330 | def CASE32( self ): |
| 1331 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1332 | This test case adds point intent related to SDN-IP matching on TCP |
| 1333 | ( ethertype=IPV4, ipProto=6, DefaultPort for iperf=5001 ) |
| 1334 | Note: Although BGP port is 179, we are using 5001 because iperf |
| 1335 | is used for verifying and iperf's default port is 5001 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1336 | """ |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1337 | import json |
| 1338 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1339 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1340 | "This test case adds point intent" + |
| 1341 | " related to SDN-IP matching on TCP" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1342 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1343 | "Adding bidirectional point intent related" + |
| 1344 | " to SDN-IP matching on TCP" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1345 | main.step( "Adding bidirectional point intent" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1346 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1347 | add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 |
| 1348 | --ethType=IPV4 --ipProto=6 --tcpDst=5001 of:0000000000003008/1 |
| 1349 | of:0000000000006018/1 |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1350 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1351 | add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 |
| 1352 | --ethType=IPV4 --ipProto=6 --tcpDst=5001 of:0000000000006018/1 |
| 1353 | of:0000000000003008/1 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1354 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1355 | add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 |
| 1356 | --ethType=IPV4 --ipProto=6 --tcpSrc=5001 of:0000000000003008/1 |
| 1357 | of:0000000000006018/1 |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1358 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1359 | add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 |
| 1360 | --ethType=IPV4 --ipProto=6 --tcpSrc=5001 of:0000000000006018/1 |
| 1361 | of:0000000000003008/1 |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1362 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1363 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1364 | hostsJson = json.loads( main.ONOScli1.hosts() ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1365 | for i in range( 8, 9 ): |
| 1366 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1367 | "Adding point intent between h" + str( i ) + |
| 1368 | " and h" + str( i + 10 ) ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1369 | host1 = "00:00:00:00:00:" + \ |
| 1370 | str( hex( i )[ 2: ] ).zfill( 2 ).upper() |
| 1371 | host2 = "00:00:00:00:00:" + \ |
| 1372 | str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1373 | host1Id = main.ONOScli1.getHost( host1 )[ 'id' ] |
| 1374 | host2Id = main.ONOScli1.getHost( host2 )[ 'id' ] |
| 1375 | for host in hostsJson: |
| 1376 | if host[ 'id' ] == host1Id: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1377 | ip1 = host[ 'ips' ][ 0 ] |
| 1378 | ip1 = str( ip1 + "/32" ) |
| 1379 | device1 = host[ 'location' ][ 'device' ] |
| 1380 | device1 = str( device1 + "/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1381 | elif host[ 'id' ] == host2Id: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1382 | ip2 = str( host[ 'ips' ][ 0 ] ) + "/32" |
| 1383 | device2 = host[ 'location' ][ "device" ] |
| 1384 | device2 = str( device2 + "/1" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1385 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1386 | pIntentResult1 = main.ONOScli1.addPointIntent( |
| 1387 | ingressDevice=device1, |
| 1388 | egressDevice=device2, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1389 | ipSrc=ip1, |
| 1390 | ipDst=ip2, |
| 1391 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1392 | ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ], |
| 1393 | tcpDst=main.params[ 'SDNIP' ][ 'dstPort' ] ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1394 | pIntentResult2 = main.ONOScli1.addPointIntent( |
| 1395 | ingressDevice=device2, |
| 1396 | egressDevice=device1, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1397 | ipSrc=ip2, |
| 1398 | ipDst=ip1, |
| 1399 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1400 | ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ], |
| 1401 | tcpDst=main.params[ 'SDNIP' ][ 'dstPort' ] ) |
| 1402 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1403 | pIntentResult3 = main.ONOScli1.addPointIntent( |
| 1404 | ingressDevice=device1, |
| 1405 | egressDevice=device2, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1406 | ipSrc=ip1, |
| 1407 | ipDst=ip2, |
| 1408 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1409 | ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ], |
| 1410 | tcpSrc=main.params[ 'SDNIP' ][ 'srcPort' ] ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1411 | pIntentResult4 = main.ONOScli1.addPointIntent( |
| 1412 | ingressDevice=device2, |
| 1413 | egressDevice=device1, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1414 | ipSrc=ip2, |
| 1415 | ipDst=ip1, |
| 1416 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1417 | ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ], |
| 1418 | tcpSrc=main.params[ 'SDNIP' ][ 'srcPort' ] ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1419 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1420 | pIntentResult = pIntentResult1 and pIntentResult2 and\ |
| 1421 | pIntentResult3 and pIntentResult4 |
| 1422 | if pIntentResult == main.TRUE: |
| 1423 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1424 | main.log.info( getIntentResult ) |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 1425 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1426 | "Point intent related to SDN-IP matching" + |
| 1427 | " on TCP install successful" ) |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 1428 | else: |
| 1429 | main.log.report( |
| 1430 | "Point intent related to SDN-IP matching" + |
| 1431 | " on TCP install failed" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1432 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1433 | iperfResult = main.Mininet1.iperf( 'h8', 'h18' ) |
| 1434 | if iperfResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1435 | main.log.report( "iperf test successful" ) |
| 1436 | else: |
| 1437 | main.log.report( "iperf test failed" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1438 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1439 | case32Result = pIntentResult and iperfResult |
| 1440 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1441 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1442 | actual=case32Result, |
| 1443 | onpass="Ping all test after Point intents addition related " + |
| 1444 | "to SDN-IP on TCP match successful", |
| 1445 | onfail="Ping all test after Point intents addition related " + |
| 1446 | "to SDN-IP on TCP match failed" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1447 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1448 | def CASE33( self ): |
| 1449 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1450 | This test case adds multipoint to singlepoint intent related to |
| 1451 | SDN-IP matching on destination ip and the action is to rewrite |
| 1452 | the mac address |
| 1453 | Here the mac address to be rewritten is the mac address of the |
| 1454 | egress device |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1455 | """ |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1456 | import json |
| 1457 | import time |
| 1458 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1459 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1460 | "This test case adds multipoint to singlepoint intent related to" + |
| 1461 | " SDN-IP matching on destination ip and " + |
| 1462 | "rewrite mac address action" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1463 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1464 | "Adding multipoint to singlepoint intent related to SDN-IP" + |
| 1465 | " matching on destination ip" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1466 | main.step( "Adding bidirectional multipoint to singlepoint intent" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1467 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1468 | add-multi-to-single-intent --ipDst=10.0.3.0/24 |
| 1469 | --setEthDst=00:00:00:00:00:12 of:0000000000003008/1 0000000000003009/1 |
| 1470 | of:0000000000006018/1 |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1471 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1472 | add-multi-to-single-intent --ipDst=10.0.1.0/24 |
| 1473 | --setEthDst=00:00:00:00:00:08 of:0000000000006018/1 0000000000003009/1 |
| 1474 | of:0000000000003008/1 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1475 | """ |
| 1476 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1477 | "Installing multipoint to single point " + |
| 1478 | "intent with rewrite mac address" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1479 | main.step( "Uninstalling proxy arp app" ) |
| 1480 | # Unistall onos-app-proxyarp app to disable reactive forwarding |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1481 | appUninstallResult1 = main.ONOScli1.featureUninstall( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1482 | "onos-app-proxyarp" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1483 | appUninstallResult2 = main.ONOScli2.featureUninstall( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1484 | "onos-app-proxyarp" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1485 | appUninstallResult3 = main.ONOScli3.featureUninstall( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1486 | "onos-app-proxyarp" ) |
| 1487 | main.log.info( "onos-app-proxyarp uninstalled" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1488 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1489 | main.step( "Changing ipaddress of hosts h8,h9 and h18" ) |
| 1490 | main.Mininet1.changeIP( |
| 1491 | host='h8', |
| 1492 | intf='h8-eth0', |
| 1493 | newIP='10.0.1.1', |
| 1494 | newNetmask='255.255.255.0' ) |
| 1495 | main.Mininet1.changeIP( |
| 1496 | host='h9', |
| 1497 | intf='h9-eth0', |
| 1498 | newIP='10.0.2.1', |
| 1499 | newNetmask='255.255.255.0' ) |
| 1500 | main.Mininet1.changeIP( |
| 1501 | host='h10', |
| 1502 | intf='h10-eth0', |
| 1503 | newIP='10.0.3.1', |
| 1504 | newNetmask='255.255.255.0' ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1505 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1506 | main.step( "Changing default gateway of hosts h8,h9 and h18" ) |
| 1507 | main.Mininet1.changeDefaultGateway( host='h8', newGW='10.0.1.254' ) |
| 1508 | main.Mininet1.changeDefaultGateway( host='h9', newGW='10.0.2.254' ) |
| 1509 | main.Mininet1.changeDefaultGateway( host='h10', newGW='10.0.3.254' ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1510 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1511 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1512 | "Assigning random mac address to the default gateways " + |
| 1513 | "since proxyarp app is uninstalled" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1514 | main.Mininet1.addStaticMACAddress( |
| 1515 | host='h8', |
| 1516 | GW='10.0.1.254', |
| 1517 | macaddr='00:00:00:00:11:11' ) |
| 1518 | main.Mininet1.addStaticMACAddress( |
| 1519 | host='h9', |
| 1520 | GW='10.0.2.254', |
| 1521 | macaddr='00:00:00:00:22:22' ) |
| 1522 | main.Mininet1.addStaticMACAddress( |
| 1523 | host='h10', |
| 1524 | GW='10.0.3.254', |
| 1525 | macaddr='00:00:00:00:33:33' ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1526 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1527 | main.step( "Verify static gateway and MAC address assignment" ) |
| 1528 | main.Mininet1.verifyStaticGWandMAC( host='h8' ) |
| 1529 | main.Mininet1.verifyStaticGWandMAC( host='h9' ) |
| 1530 | main.Mininet1.verifyStaticGWandMAC( host='h10' ) |
| 1531 | |
| 1532 | main.step( "Adding multipoint to singlepoint intent" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1533 | pIntentResult1 = main.ONOScli1.addMultipointToSinglepointIntent( |
| 1534 | ingressDevice1=main.params[ 'MULTIPOINT_INTENT' ][ 'device1' ], |
| 1535 | ingressDevice2=main.params[ 'MULTIPOINT_INTENT' ][ 'device2' ], |
| 1536 | egressDevice=main.params[ 'MULTIPOINT_INTENT' ][ 'device3' ], |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1537 | ipDst=main.params[ 'MULTIPOINT_INTENT' ][ 'ip1' ], |
| 1538 | setEthDst=main.params[ 'MULTIPOINT_INTENT' ][ 'mac1' ] ) |
| 1539 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1540 | pIntentResult2 = main.ONOScli1.addMultipointToSinglepointIntent( |
| 1541 | ingressDevice1=main.params[ 'MULTIPOINT_INTENT' ][ 'device3' ], |
| 1542 | ingressDevice2=main.params[ 'MULTIPOINT_INTENT' ][ 'device2' ], |
| 1543 | egressDevice=main.params[ 'MULTIPOINT_INTENT' ][ 'device1' ], |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1544 | ipDst=main.params[ 'MULTIPOINT_INTENT' ][ 'ip2' ], |
| 1545 | setEthDst=main.params[ 'MULTIPOINT_INTENT' ][ 'mac2' ] ) |
| 1546 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1547 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1548 | main.log.info( "intents = " + getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1549 | |
| 1550 | time.sleep( 10 ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1551 | getFlowsResult = main.ONOScli1.flows( jsonFormat=False ) |
| 1552 | main.log.info( "flows = " + getFlowsResult ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1553 | |
| 1554 | count = 1 |
| 1555 | i = 8 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1556 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1557 | |
| 1558 | main.log.info( "\n\nh" + str( i ) + " is Pinging h" + str( i + 2 ) ) |
| 1559 | ping = main.Mininet1.pingHost( |
| 1560 | src="h" + str( i ), target="h" + str( i + 2 ) ) |
| 1561 | if ping == main.FALSE and count < 3: |
| 1562 | count += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1563 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1564 | main.log.report( "Ping between h" + |
| 1565 | str( i ) + |
| 1566 | " and h" + |
| 1567 | str( i + |
| 1568 | 2 ) + |
| 1569 | " failed. Making attempt number " + |
| 1570 | str( count ) + |
| 1571 | " in 2 seconds" ) |
| 1572 | time.sleep( 2 ) |
| 1573 | elif ping == main.FALSE: |
| 1574 | main.log.report( "All ping attempts between h" + |
| 1575 | str( i ) + |
| 1576 | " and h" + |
| 1577 | str( i + |
| 1578 | 10 ) + |
| 1579 | "have failed" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1580 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1581 | elif ping == main.TRUE: |
| 1582 | main.log.info( "Ping test between h" + |
| 1583 | str( i ) + |
| 1584 | " and h" + |
| 1585 | str( i + |
| 1586 | 2 ) + |
| 1587 | "passed!" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1588 | PingResult = main.TRUE |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1589 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1590 | main.log.info( "Unknown error" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1591 | PingResult = main.ERROR |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1592 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1593 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1594 | main.log.report( "Ping test failed." ) |
| 1595 | # main.cleanup() |
| 1596 | # main.exit() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1597 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1598 | main.log.report( "Ping all successful" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1599 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1600 | pIntentResult = pIntentResult1 and pIntentResult2 |
| 1601 | if pIntentResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1602 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1603 | "Multi point intent with rewrite mac " + |
| 1604 | "address installation successful" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1605 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1606 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1607 | "Multi point intent with rewrite mac" + |
| 1608 | " address installation failed" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1609 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1610 | case33Result = pIntentResult and PingResult |
| 1611 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1612 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1613 | actual=case33Result, |
| 1614 | onpass="Ping all test after multipoint to single point" + |
| 1615 | " intent addition with rewrite mac address successful", |
| 1616 | onfail="Ping all test after multipoint to single point intent" + |
| 1617 | " addition with rewrite mac address failed" ) |