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