shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 2 | # Testing the basic functionality of ONOS Next |
| 3 | # For sanity and driver functionality excercises only. |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 4 | |
| 5 | import time |
| 6 | import sys |
| 7 | import os |
| 8 | import re |
| 9 | import time |
| 10 | import json |
| 11 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 12 | time.sleep( 1 ) |
| 13 | |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 14 | class MultiProd: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 15 | |
| 16 | def __init__( self ): |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 17 | self.default = '' |
| 18 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 19 | def CASE1( self, main ): |
| 20 | """ |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 21 | Startup sequence: |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 22 | cell <name> |
| 23 | onos-verify-cell |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 24 | onos-remove-raft-logs |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 25 | git pull |
| 26 | mvn clean install |
| 27 | onos-package |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 28 | onos-install -f |
| 29 | onos-wait-for-start |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 30 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 31 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 32 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 33 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 34 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 35 | ONOS1Port = main.params[ 'CTRL' ][ 'port1' ] |
| 36 | ONOS2Port = main.params[ 'CTRL' ][ 'port2' ] |
| 37 | ONOS3Port = main.params[ 'CTRL' ][ 'port3' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 38 | |
| 39 | main.case( "Setting up test environment" ) |
| 40 | main.log.report( |
| 41 | "This testcase is testing setting up test environment" ) |
| 42 | main.log.report( "__________________________________" ) |
| 43 | |
| 44 | main.step( "Applying cell variable to environment" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 45 | cellResult1 = main.ONOSbench.setCell( cellName ) |
| 46 | # cellResult2 = main.ONOScli1.setCell( cellName ) |
| 47 | # cellResult3 = main.ONOScli2.setCell( cellName ) |
| 48 | # cellResult4 = main.ONOScli3.setCell( cellName ) |
| 49 | verifyResult = main.ONOSbench.verifyCell() |
| 50 | cellResult = cellResult1 |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 51 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 52 | main.step( "Removing raft logs before a clen installation of ONOS" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 53 | removeLogResult = main.ONOSbench.onosRemoveRaftLogs() |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 54 | |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 55 | main.step( "Git checkout, pull and get version" ) |
| 56 | #main.ONOSbench.gitCheckout( "master" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 57 | gitPullResult = main.ONOSbench.gitPull() |
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 ) |
| 640 | activeSwitches = topologyResult[ 'devices' ] |
| 641 | links = topologyResult[ 'links' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 642 | print "activeSwitches = ", type( activeSwitches ) |
| 643 | print "links = ", type( links ) |
| 644 | main.log.info( |
| 645 | "Currently there are %s switches and %s links" % |
| 646 | ( str( activeSwitches ), str( links ) ) ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 647 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 648 | main.step( "Kill Link between s3 and s28" ) |
| 649 | main.Mininet1.link( END1="s3", END2="s28", OPTION="down" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 650 | time.sleep( linkSleep ) |
| 651 | topologyOutput = main.ONOScli2.topology() |
| 652 | LinkDown = main.ONOSbench.checkStatus( |
| 653 | topologyOutput, activeSwitches, str( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 654 | int( links ) - 2 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 655 | if LinkDown == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 656 | main.log.report( "Link Down discovered properly" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 657 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 658 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 659 | actual=LinkDown, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 660 | onpass="Link Down discovered properly", |
| 661 | onfail="Link down was not discovered in " + |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 662 | str( linkSleep ) + |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 663 | " seconds" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 664 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 665 | main.step( "Bring link between s3 and s28 back up" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 666 | LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" ) |
| 667 | time.sleep( linkSleep ) |
| 668 | topologyOutput = main.ONOScli2.topology() |
| 669 | LinkUp = main.ONOSbench.checkStatus( |
| 670 | topologyOutput, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 671 | activeSwitches, |
| 672 | str( links ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 673 | if LinkUp == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 674 | main.log.report( "Link up discovered properly" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 675 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 676 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 677 | actual=LinkUp, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 678 | onpass="Link up discovered properly", |
| 679 | onfail="Link up was not discovered in " + |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 680 | str( linkSleep ) + |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 681 | " seconds" ) |
| 682 | |
| 683 | main.step( "Compare ONOS Topology to MN Topology" ) |
| 684 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 685 | "Testing Mininet topology with the" + |
| 686 | " topology of multi instances ONOS" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 687 | main.step( "Collecting topology information from ONOS" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 688 | devices1 = main.ONOScli1.devices() |
| 689 | devices2 = main.ONOScli2.devices() |
| 690 | devices3 = main.ONOScli3.devices() |
| 691 | print "devices1 = ", devices1 |
| 692 | print "devices2 = ", devices2 |
| 693 | print "devices3 = ", devices3 |
| 694 | hosts1 = main.ONOScli1.hosts() |
| 695 | hosts2 = main.ONOScli2.hosts() |
| 696 | hosts3 = main.ONOScli3.hosts() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 697 | # print "hosts1 = ", hosts1 |
| 698 | # print "hosts2 = ", hosts2 |
| 699 | # print "hosts3 = ", hosts3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 700 | ports1 = main.ONOScli1.ports() |
| 701 | ports2 = main.ONOScli2.ports() |
| 702 | ports3 = main.ONOScli3.ports() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 703 | # print "ports1 = ", ports1 |
| 704 | # print "ports2 = ", ports2 |
| 705 | # print "ports3 = ", ports3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 706 | links1 = main.ONOScli1.links() |
| 707 | links2 = main.ONOScli2.links() |
| 708 | links3 = main.ONOScli3.links() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 709 | # print "links1 = ", links1 |
| 710 | # print "links2 = ", links2 |
| 711 | # print "links3 = ", links3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 712 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 713 | print "**************" |
| 714 | |
| 715 | main.step( "Start continuous pings" ) |
| 716 | main.Mininet2.pingLong( |
| 717 | src=main.params[ 'PING' ][ 'source1' ], |
| 718 | target=main.params[ 'PING' ][ 'target1' ], |
| 719 | pingTime=500 ) |
| 720 | main.Mininet2.pingLong( |
| 721 | src=main.params[ 'PING' ][ 'source2' ], |
| 722 | target=main.params[ 'PING' ][ 'target2' ], |
| 723 | pingTime=500 ) |
| 724 | main.Mininet2.pingLong( |
| 725 | src=main.params[ 'PING' ][ 'source3' ], |
| 726 | target=main.params[ 'PING' ][ 'target3' ], |
| 727 | pingTime=500 ) |
| 728 | main.Mininet2.pingLong( |
| 729 | src=main.params[ 'PING' ][ 'source4' ], |
| 730 | target=main.params[ 'PING' ][ 'target4' ], |
| 731 | pingTime=500 ) |
| 732 | main.Mininet2.pingLong( |
| 733 | src=main.params[ 'PING' ][ 'source5' ], |
| 734 | target=main.params[ 'PING' ][ 'target5' ], |
| 735 | pingTime=500 ) |
| 736 | main.Mininet2.pingLong( |
| 737 | src=main.params[ 'PING' ][ 'source6' ], |
| 738 | target=main.params[ 'PING' ][ 'target6' ], |
| 739 | pingTime=500 ) |
| 740 | main.Mininet2.pingLong( |
| 741 | src=main.params[ 'PING' ][ 'source7' ], |
| 742 | target=main.params[ 'PING' ][ 'target7' ], |
| 743 | pingTime=500 ) |
| 744 | main.Mininet2.pingLong( |
| 745 | src=main.params[ 'PING' ][ 'source8' ], |
| 746 | target=main.params[ 'PING' ][ 'target8' ], |
| 747 | pingTime=500 ) |
| 748 | main.Mininet2.pingLong( |
| 749 | src=main.params[ 'PING' ][ 'source9' ], |
| 750 | target=main.params[ 'PING' ][ 'target9' ], |
| 751 | pingTime=500 ) |
| 752 | main.Mininet2.pingLong( |
| 753 | src=main.params[ 'PING' ][ 'source10' ], |
| 754 | target=main.params[ 'PING' ][ 'target10' ], |
| 755 | pingTime=500 ) |
| 756 | |
| 757 | main.step( "Create TestONTopology object" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 758 | global ctrls |
| 759 | ctrls = [] |
| 760 | count = 1 |
| 761 | while True: |
| 762 | temp = () |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 763 | if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]: |
| 764 | temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), ) |
| 765 | temp = temp + ( "ONOS" + str( count ), ) |
| 766 | temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], ) |
| 767 | temp = temp + \ |
| 768 | ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), ) |
| 769 | ctrls.append( temp ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 770 | count = count + 1 |
| 771 | else: |
| 772 | break |
| 773 | global MNTopo |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 774 | Topo = TestONTopology( |
| 775 | main.Mininet1, |
| 776 | ctrls ) # can also add Intent API info for intent operations |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 777 | MNTopo = Topo |
| 778 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 779 | TopologyCheck = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 780 | main.step( "Compare ONOS Topology to MN Topology" ) |
| 781 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 782 | switchesResults1 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 783 | MNTopo, |
| 784 | json.loads( devices1 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 785 | print "switches_Result1 = ", switchesResults1 |
| 786 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults1, |
| 787 | onpass="ONOS1 Switches view is correct", |
| 788 | onfail="ONOS1 Switches view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 789 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 790 | switchesResults2 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 791 | MNTopo, |
| 792 | json.loads( devices2 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 793 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults2, |
| 794 | onpass="ONOS2 Switches view is correct", |
| 795 | onfail="ONOS2 Switches view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 796 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 797 | switchesResults3 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 798 | MNTopo, |
| 799 | json.loads( devices3 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 800 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults3, |
| 801 | onpass="ONOS3 Switches view is correct", |
| 802 | onfail="ONOS3 Switches view is incorrect" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 803 | |
| 804 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 805 | portsResults1 = main.Mininet1.comparePorts( MNTopo, |
| 806 | json.loads( ports1 ) ) |
| 807 | utilities.assertEquals( expect=main.TRUE, actual=portsResults1, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 808 | onpass="ONOS1 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 809 | onfail="ONOS1 Ports view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 810 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 811 | portsResults2 = main.Mininet1.comparePorts( MNTopo, |
| 812 | json.loads( ports2 ) ) |
| 813 | utilities.assertEquals( expect=main.TRUE, actual=portsResults2, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 814 | onpass="ONOS2 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 815 | onfail="ONOS2 Ports view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 816 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 817 | portsResults3 = main.Mininet1.comparePorts( MNTopo, |
| 818 | json.loads( ports3 ) ) |
| 819 | utilities.assertEquals( expect=main.TRUE, actual=portsResults3, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 820 | onpass="ONOS3 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 821 | onfail="ONOS3 Ports view is incorrect" ) |
| 822 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 823 | linksResults1 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 824 | MNTopo, |
| 825 | json.loads( links1 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 826 | utilities.assertEquals( expect=main.TRUE, actual=linksResults1, |
| 827 | onpass="ONOS1 Links view is correct", |
| 828 | onfail="ONOS1 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 829 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 830 | linksResults2 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 831 | MNTopo, |
| 832 | json.loads( links2 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 833 | utilities.assertEquals( expect=main.TRUE, actual=linksResults2, |
| 834 | onpass="ONOS2 Links view is correct", |
| 835 | onfail="ONOS2 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 836 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 837 | linksResults3 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 838 | MNTopo, |
| 839 | json.loads( links3 ) ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 840 | utilities.assertEquals( expect=main.TRUE, actual=linksResults3, |
| 841 | onpass="ONOS2 Links view is correct", |
| 842 | onfail="ONOS2 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 843 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 844 | # topoResult = switchesResults1 and switchesResults2 |
| 845 | # and switchesResults3\ |
| 846 | # and portsResults1 and portsResults2 and portsResults3\ |
| 847 | # and linksResults1 and linksResults2 and linksResults3 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 848 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 849 | topoResult = switchesResults1 and switchesResults2\ |
| 850 | and switchesResults3 and linksResults1 and\ |
| 851 | linksResults2 and linksResults3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 852 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 853 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 854 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 855 | actual=topoResult and LinkUp and LinkDown, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 856 | onpass="Topology Check Test successful", |
| 857 | onfail="Topology Check Test NOT successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 858 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 859 | def CASE8( self ): |
| 860 | """ |
shahshreya | eac353b | 2014-11-18 17:19:20 -0800 | [diff] [blame] | 861 | Intent removal |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 862 | """ |
| 863 | main.log.report( |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 864 | "This testcase removes any previously added intents" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 865 | main.log.report( "__________________________________" ) |
| 866 | main.log.info( "Removing any previously installed intents" ) |
| 867 | main.case( "Removing intents" ) |
| 868 | main.step( "Obtain the intent id's" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 869 | intentResult = main.ONOScli1.intents( jsonFormat=False ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 870 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 871 | intentLinewise = intentResult.split( "\n" ) |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 872 | intentList = [] |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 873 | for line in intentLinewise: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 874 | if line.startswith( "id=" ): |
| 875 | intentList.append( line ) |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 876 | |
| 877 | intentids = [] |
| 878 | for line in intentList: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 879 | intentids.append( line.split( "," )[ 0 ].split( "=" )[ 1 ] ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 880 | for id in intentids: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 881 | main.log.info( "id = " + id ) |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 882 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 883 | main.step( |
| 884 | "Iterate through the intentids list and remove each intent" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 885 | for id in intentids: |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 886 | main.ONOScli1.removeIntent( intentId=id ) |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 887 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 888 | intentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 889 | main.log.info( "intent_result = " + intentResult ) |
| 890 | case8Result = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 891 | |
shahshreya | eac353b | 2014-11-18 17:19:20 -0800 | [diff] [blame] | 892 | i = 8 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 893 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 894 | while i < 18: |
| 895 | main.log.info( |
| 896 | "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) ) |
| 897 | ping = main.Mininet1.pingHost( |
| 898 | src="h" + str( i ), target="h" + str( i + 10 ) ) |
| 899 | if ping == main.TRUE: |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 900 | i = 19 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 901 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 902 | elif ping == main.FALSE: |
| 903 | i += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 904 | PingResult = main.FALSE |
shahshreya | eac353b | 2014-11-18 17:19:20 -0800 | [diff] [blame] | 905 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 906 | main.log.info( "Unknown error" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 907 | PingResult = main.ERROR |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 908 | |
| 909 | # Note: If the ping result failed, that means the intents have been |
| 910 | # withdrawn correctly. |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 911 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 912 | main.log.report( "Host intents have not been withdrawn correctly" ) |
| 913 | # main.cleanup() |
| 914 | # main.exit() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 915 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 916 | main.log.report( "Host intents have been withdrawn correctly" ) |
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 | case8Result = case8Result and PingResult |
shahshreya | eac353b | 2014-11-18 17:19:20 -0800 | [diff] [blame] | 919 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 920 | if case8Result == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 921 | main.log.report( "Intent removal successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 922 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 923 | main.log.report( "Intent removal failed" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 924 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 925 | utilities.assertEquals( expect=main.FALSE, actual=case8Result, |
| 926 | onpass="Intent removal test failed", |
| 927 | onfail="Intent removal test successful" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 928 | |
| 929 | def CASE9( self ): |
| 930 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 931 | This test case adds point intents. Make sure you run test case 8 |
| 932 | which is host intent removal before executing this test case. |
| 933 | Else the host intent's flows will persist on switches and the pings |
| 934 | 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] | 935 | """ |
| 936 | main.log.report( |
| 937 | "This testcase adds point intents and then does pingall" ) |
| 938 | main.log.report( "__________________________________" ) |
| 939 | main.log.info( "Adding point intents" ) |
| 940 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 941 | "Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20," + |
| 942 | "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] | 943 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 944 | "Add point-to-point intents for mininet hosts" + |
| 945 | " h8 and h18 or ONOS hosts h8 and h12" ) |
| 946 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 947 | "of:0000000000003008/1", |
| 948 | "of:0000000000006018/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 949 | if ptpIntentResult == main.TRUE: |
| 950 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 951 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 952 | # main.log.info( getIntentResult ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 953 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 954 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 955 | "of:0000000000006018/1", |
| 956 | "of:0000000000003008/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 957 | if ptpIntentResult == main.TRUE: |
| 958 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 959 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 960 | # main.log.info( getIntentResult ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 961 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 962 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 963 | "Add point-to-point intents for mininet hosts" + |
| 964 | " h9 and h19 or ONOS hosts h9 and h13" ) |
| 965 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 966 | "of:0000000000003009/1", |
| 967 | "of:0000000000006019/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 968 | if ptpIntentResult == main.TRUE: |
| 969 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 970 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 971 | # main.log.info( getIntentResult ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 972 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 973 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 974 | "of:0000000000006019/1", |
| 975 | "of:0000000000003009/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 976 | if ptpIntentResult == main.TRUE: |
| 977 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 978 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 979 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 980 | |
| 981 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 982 | "Add point-to-point intents for mininet" + |
| 983 | " hosts h10 and h20 or ONOS hosts hA and h14" ) |
| 984 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 985 | "of:0000000000003010/1", |
| 986 | "of:0000000000006020/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 987 | if ptpIntentResult == main.TRUE: |
| 988 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 989 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 990 | # main.log.info( getIntentResult ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 991 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 992 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 993 | "of:0000000000006020/1", |
| 994 | "of:0000000000003010/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 995 | if ptpIntentResult == main.TRUE: |
| 996 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 997 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 998 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 999 | |
| 1000 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1001 | "Add point-to-point intents for mininet" + |
| 1002 | " hosts h11 and h21 or ONOS hosts hB and h15" ) |
| 1003 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1004 | "of:0000000000003011/1", |
| 1005 | "of:0000000000006021/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1006 | if ptpIntentResult == main.TRUE: |
| 1007 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1008 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1009 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1010 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1011 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1012 | "of:0000000000006021/1", |
| 1013 | "of:0000000000003011/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1014 | if ptpIntentResult == main.TRUE: |
| 1015 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1016 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1017 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1018 | |
| 1019 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1020 | "Add point-to-point intents for mininet" + |
| 1021 | " hosts h12 and h22 or ONOS hosts hC and h16" ) |
| 1022 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1023 | "of:0000000000003012/1", |
| 1024 | "of:0000000000006022/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1025 | if ptpIntentResult == main.TRUE: |
| 1026 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1027 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1028 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1029 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1030 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1031 | "of:0000000000006022/1", |
| 1032 | "of:0000000000003012/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1033 | if ptpIntentResult == main.TRUE: |
| 1034 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1035 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1036 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1037 | |
| 1038 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1039 | "Add point-to-point intents for mininet " + |
| 1040 | "hosts h13 and h23 or ONOS hosts hD and h17" ) |
| 1041 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1042 | "of:0000000000003013/1", |
| 1043 | "of:0000000000006023/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1044 | if ptpIntentResult == main.TRUE: |
| 1045 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1046 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1047 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1048 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1049 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1050 | "of:0000000000006023/1", |
| 1051 | "of:0000000000003013/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1052 | if ptpIntentResult == main.TRUE: |
| 1053 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1054 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1055 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1056 | |
| 1057 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1058 | "Add point-to-point intents for mininet hosts" + |
| 1059 | " h14 and h24 or ONOS hosts hE and h18" ) |
| 1060 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1061 | "of:0000000000003014/1", |
| 1062 | "of:0000000000006024/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1063 | if ptpIntentResult == main.TRUE: |
| 1064 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1065 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1066 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1067 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1068 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1069 | "of:0000000000006024/1", |
| 1070 | "of:0000000000003014/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1071 | if ptpIntentResult == main.TRUE: |
| 1072 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1073 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1074 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1075 | |
| 1076 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1077 | "Add point-to-point intents for mininet hosts" + |
| 1078 | " h15 and h25 or ONOS hosts hF and h19" ) |
| 1079 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1080 | "of:0000000000003015/1", |
| 1081 | "of:0000000000006025/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1082 | if ptpIntentResult == main.TRUE: |
| 1083 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1084 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1085 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1086 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1087 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1088 | "of:0000000000006025/1", |
| 1089 | "of:0000000000003015/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1090 | if ptpIntentResult == main.TRUE: |
| 1091 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1092 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1093 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1094 | |
| 1095 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1096 | "Add point-to-point intents for mininet hosts" + |
| 1097 | " h16 and h26 or ONOS hosts h10 and h1A" ) |
| 1098 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1099 | "of:0000000000003016/1", |
| 1100 | "of:0000000000006026/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1101 | if ptpIntentResult == main.TRUE: |
| 1102 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1103 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1104 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1105 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1106 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1107 | "of:0000000000006026/1", |
| 1108 | "of:0000000000003016/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1109 | if ptpIntentResult == main.TRUE: |
| 1110 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1111 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1112 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1113 | |
| 1114 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1115 | "Add point-to-point intents for mininet hosts h17" + |
| 1116 | " and h27 or ONOS hosts h11 and h1B" ) |
| 1117 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1118 | "of:0000000000003017/1", |
| 1119 | "of:0000000000006027/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1120 | if ptpIntentResult == main.TRUE: |
| 1121 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1122 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1123 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1124 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1125 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1126 | "of:0000000000006027/1", |
| 1127 | "of:0000000000003017/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1128 | if ptpIntentResult == main.TRUE: |
| 1129 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1130 | main.log.info( "Point to point intent install successful" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1131 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1132 | |
| 1133 | print( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1134 | "_______________________________________________________" + |
| 1135 | "________________________________" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1136 | |
| 1137 | flowHandle = main.ONOScli1.flows() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1138 | # print "flowHandle = ", flowHandle |
| 1139 | main.log.info( "flows :" + flowHandle ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1140 | |
| 1141 | count = 1 |
| 1142 | i = 8 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1143 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1144 | while i < 18: |
| 1145 | main.log.info( |
| 1146 | "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) ) |
| 1147 | ping = main.Mininet1.pingHost( |
| 1148 | src="h" + str( i ), target="h" + str( i + 10 ) ) |
| 1149 | if ping == main.FALSE and count < 5: |
| 1150 | count += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1151 | # i = 8 |
| 1152 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1153 | main.log.report( "Ping between h" + |
| 1154 | str( i ) + |
| 1155 | " and h" + |
| 1156 | str( i + |
| 1157 | 10 ) + |
| 1158 | " failed. Making attempt number " + |
| 1159 | str( count ) + |
| 1160 | " in 2 seconds" ) |
| 1161 | time.sleep( 2 ) |
| 1162 | elif ping == main.FALSE: |
| 1163 | main.log.report( "All ping attempts between h" + |
| 1164 | str( i ) + |
| 1165 | " and h" + |
| 1166 | str( i + |
| 1167 | 10 ) + |
| 1168 | "have failed" ) |
| 1169 | i = 19 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1170 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1171 | elif ping == main.TRUE: |
| 1172 | main.log.info( "Ping test between h" + |
| 1173 | str( i ) + |
| 1174 | " and h" + |
| 1175 | str( i + |
| 1176 | 10 ) + |
| 1177 | "passed!" ) |
| 1178 | i += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1179 | PingResult = main.TRUE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1180 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1181 | main.log.info( "Unknown error" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1182 | PingResult = main.ERROR |
| 1183 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1184 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1185 | "Ping all test after Point intents" + |
| 1186 | " addition failed. Cleaning up" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1187 | # main.cleanup() |
| 1188 | # main.exit() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1189 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1190 | main.log.report( |
| 1191 | "Ping all test after Point intents addition successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1192 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1193 | case8Result = PingResult |
| 1194 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1195 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1196 | actual=case8Result, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1197 | onpass="Ping all test after Point intents addition successful", |
| 1198 | onfail="Ping all test after Point intents addition failed" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1199 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1200 | def CASE31( self ): |
| 1201 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1202 | This test case adds point intent related to |
| 1203 | SDN-IP matching on ICMP ( ethertype=IPV4, ipProto=1 ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1204 | """ |
shahshreya | a9d79f2 | 2014-11-18 15:41:29 -0800 | [diff] [blame] | 1205 | import json |
| 1206 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1207 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1208 | "This test case adds point intent " + |
| 1209 | "related to SDN-IP matching on ICMP" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1210 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1211 | "Adding bidirectional point intent related" + |
| 1212 | " to SDN-IP matching on ICMP" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1213 | main.step( "Adding bidirectional point intent" ) |
| 1214 | # add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 |
| 1215 | # --ethType=IPV4 --ipProto=1 of:0000000000003008/1 |
| 1216 | # of:0000000000006018/1 |
| 1217 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1218 | hostsJson = json.loads( main.ONOScli1.hosts() ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1219 | for i in range( 8, 11 ): |
| 1220 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1221 | "Adding point intent between h" + str( i ) + |
| 1222 | " and h" + str( i + 10 ) ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1223 | host1 = "00:00:00:00:00:" + \ |
| 1224 | str( hex( i )[ 2: ] ).zfill( 2 ).upper() |
| 1225 | host2 = "00:00:00:00:00:" + \ |
| 1226 | str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1227 | host1Id = main.ONOScli1.getHost( host1 )[ 'id' ] |
| 1228 | host2Id = main.ONOScli1.getHost( host2 )[ 'id' ] |
| 1229 | for host in hostsJson: |
| 1230 | if host[ 'id' ] == host1Id: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1231 | ip1 = host[ 'ips' ][ 0 ] |
| 1232 | ip1 = str( ip1 + "/32" ) |
| 1233 | device1 = host[ 'location' ][ 'device' ] |
| 1234 | device1 = str( device1 + "/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1235 | elif host[ 'id' ] == host2Id: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1236 | ip2 = str( host[ 'ips' ][ 0 ] ) + "/32" |
| 1237 | device2 = host[ 'location' ][ "device" ] |
| 1238 | device2 = str( device2 + "/1" ) |
| 1239 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1240 | pIntentResult1 = main.ONOScli1.addPointIntent( |
| 1241 | ingressDevice=device1, |
| 1242 | egressDevice=device2, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1243 | ipSrc=ip1, |
| 1244 | ipDst=ip2, |
| 1245 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1246 | ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ] ) |
| 1247 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1248 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1249 | main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1250 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1251 | pIntentResult2 = main.ONOScli1.addPointIntent( |
| 1252 | ingressDevice=device2, |
| 1253 | egressDevice=device1, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1254 | ipSrc=ip2, |
| 1255 | ipDst=ip1, |
| 1256 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1257 | ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ] ) |
| 1258 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1259 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1260 | main.log.info( getIntentResult ) |
| 1261 | if ( pIntentResult1 and pIntentResult2 ) == main.TRUE: |
| 1262 | # getIntentResult = main.ONOScli1.intents() |
| 1263 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1264 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1265 | "Point intent related to SDN-IP matching" + |
| 1266 | " on ICMP install successful" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1267 | |
| 1268 | time.sleep( 15 ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1269 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1270 | main.log.info( "intents = " + getIntentResult ) |
| 1271 | getFlowsResult = main.ONOScli1.flows() |
| 1272 | main.log.info( "flows = " + getFlowsResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1273 | |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1274 | count = 1 |
| 1275 | i = 8 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1276 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1277 | while i < 11: |
| 1278 | main.log.info( |
| 1279 | "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) ) |
| 1280 | ping = main.Mininet1.pingHost( |
| 1281 | src="h" + str( i ), target="h" + str( i + 10 ) ) |
| 1282 | if ping == main.FALSE and count < 3: |
| 1283 | count += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1284 | # i = 8 |
| 1285 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1286 | main.log.report( "Ping between h" + |
| 1287 | str( i ) + |
| 1288 | " and h" + |
| 1289 | str( i + |
| 1290 | 10 ) + |
| 1291 | " failed. Making attempt number " + |
| 1292 | str( count ) + |
| 1293 | " in 2 seconds" ) |
| 1294 | time.sleep( 2 ) |
| 1295 | elif ping == main.FALSE: |
| 1296 | main.log.report( "All ping attempts between h" + |
| 1297 | str( i ) + |
| 1298 | " and h" + |
| 1299 | str( i + |
| 1300 | 10 ) + |
| 1301 | "have failed" ) |
| 1302 | i = 19 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1303 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1304 | elif ping == main.TRUE: |
| 1305 | main.log.info( "Ping test between h" + |
| 1306 | str( i ) + |
| 1307 | " and h" + |
| 1308 | str( i + |
| 1309 | 10 ) + |
| 1310 | "passed!" ) |
| 1311 | i += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1312 | PingResult = main.TRUE |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1313 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1314 | main.log.info( "Unknown error" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1315 | PingResult = main.ERROR |
| 1316 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1317 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1318 | "Ping test after Point intents related to" + |
| 1319 | " SDN-IP matching on ICMP failed." ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1320 | # main.cleanup() |
| 1321 | # main.exit() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1322 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1323 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1324 | "Ping all test after Point intents related to" + |
| 1325 | " SDN-IP matching on ICMP successful" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1326 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1327 | case31Result = PingResult and pIntentResult1 and pIntentResult2 |
| 1328 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1329 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1330 | actual=case31Result, |
| 1331 | onpass="Point intent related to SDN-IP " + |
| 1332 | "matching on ICMP and ping test successful", |
| 1333 | onfail="Point intent related to SDN-IP" + |
| 1334 | " matching on ICMP and ping test failed" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1335 | |
| 1336 | def CASE32( self ): |
| 1337 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1338 | This test case adds point intent related to SDN-IP matching on TCP |
| 1339 | ( ethertype=IPV4, ipProto=6, DefaultPort for iperf=5001 ) |
| 1340 | Note: Although BGP port is 179, we are using 5001 because iperf |
| 1341 | is used for verifying and iperf's default port is 5001 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1342 | """ |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1343 | import json |
| 1344 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1345 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1346 | "This test case adds point intent" + |
| 1347 | " related to SDN-IP matching on TCP" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1348 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1349 | "Adding bidirectional point intent related" + |
| 1350 | " to SDN-IP matching on TCP" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1351 | main.step( "Adding bidirectional point intent" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1352 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1353 | add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 |
| 1354 | --ethType=IPV4 --ipProto=6 --tcpDst=5001 of:0000000000003008/1 |
| 1355 | of:0000000000006018/1 |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1356 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1357 | add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 |
| 1358 | --ethType=IPV4 --ipProto=6 --tcpDst=5001 of:0000000000006018/1 |
| 1359 | of:0000000000003008/1 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1360 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1361 | add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 |
| 1362 | --ethType=IPV4 --ipProto=6 --tcpSrc=5001 of:0000000000003008/1 |
| 1363 | of:0000000000006018/1 |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1364 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1365 | add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 |
| 1366 | --ethType=IPV4 --ipProto=6 --tcpSrc=5001 of:0000000000006018/1 |
| 1367 | of:0000000000003008/1 |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1368 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1369 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1370 | hostsJson = json.loads( main.ONOScli1.hosts() ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1371 | for i in range( 8, 9 ): |
| 1372 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1373 | "Adding point intent between h" + str( i ) + |
| 1374 | " and h" + str( i + 10 ) ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1375 | host1 = "00:00:00:00:00:" + \ |
| 1376 | str( hex( i )[ 2: ] ).zfill( 2 ).upper() |
| 1377 | host2 = "00:00:00:00:00:" + \ |
| 1378 | str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1379 | host1Id = main.ONOScli1.getHost( host1 )[ 'id' ] |
| 1380 | host2Id = main.ONOScli1.getHost( host2 )[ 'id' ] |
| 1381 | for host in hostsJson: |
| 1382 | if host[ 'id' ] == host1Id: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1383 | ip1 = host[ 'ips' ][ 0 ] |
| 1384 | ip1 = str( ip1 + "/32" ) |
| 1385 | device1 = host[ 'location' ][ 'device' ] |
| 1386 | device1 = str( device1 + "/1" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1387 | elif host[ 'id' ] == host2Id: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1388 | ip2 = str( host[ 'ips' ][ 0 ] ) + "/32" |
| 1389 | device2 = host[ 'location' ][ "device" ] |
| 1390 | device2 = str( device2 + "/1" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1391 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1392 | pIntentResult1 = main.ONOScli1.addPointIntent( |
| 1393 | ingressDevice=device1, |
| 1394 | egressDevice=device2, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1395 | ipSrc=ip1, |
| 1396 | ipDst=ip2, |
| 1397 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1398 | ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ], |
| 1399 | tcpDst=main.params[ 'SDNIP' ][ 'dstPort' ] ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1400 | pIntentResult2 = main.ONOScli1.addPointIntent( |
| 1401 | ingressDevice=device2, |
| 1402 | egressDevice=device1, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1403 | ipSrc=ip2, |
| 1404 | ipDst=ip1, |
| 1405 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1406 | ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ], |
| 1407 | tcpDst=main.params[ 'SDNIP' ][ 'dstPort' ] ) |
| 1408 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1409 | pIntentResult3 = main.ONOScli1.addPointIntent( |
| 1410 | ingressDevice=device1, |
| 1411 | egressDevice=device2, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1412 | ipSrc=ip1, |
| 1413 | ipDst=ip2, |
| 1414 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1415 | ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ], |
| 1416 | tcpSrc=main.params[ 'SDNIP' ][ 'srcPort' ] ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1417 | pIntentResult4 = main.ONOScli1.addPointIntent( |
| 1418 | ingressDevice=device2, |
| 1419 | egressDevice=device1, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1420 | ipSrc=ip2, |
| 1421 | ipDst=ip1, |
| 1422 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1423 | ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ], |
| 1424 | tcpSrc=main.params[ 'SDNIP' ][ 'srcPort' ] ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1425 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1426 | pIntentResult = pIntentResult1 and pIntentResult2 and\ |
| 1427 | pIntentResult3 and pIntentResult4 |
| 1428 | if pIntentResult == main.TRUE: |
| 1429 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1430 | main.log.info( getIntentResult ) |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 1431 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1432 | "Point intent related to SDN-IP matching" + |
| 1433 | " on TCP install successful" ) |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 1434 | else: |
| 1435 | main.log.report( |
| 1436 | "Point intent related to SDN-IP matching" + |
| 1437 | " on TCP install failed" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1438 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1439 | iperfResult = main.Mininet1.iperf( 'h8', 'h18' ) |
| 1440 | if iperfResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1441 | main.log.report( "iperf test successful" ) |
| 1442 | else: |
| 1443 | main.log.report( "iperf test failed" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1444 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1445 | case32Result = pIntentResult and iperfResult |
| 1446 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1447 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1448 | actual=case32Result, |
| 1449 | onpass="Ping all test after Point intents addition related " + |
| 1450 | "to SDN-IP on TCP match successful", |
| 1451 | onfail="Ping all test after Point intents addition related " + |
| 1452 | "to SDN-IP on TCP match failed" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1453 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1454 | def CASE33( self ): |
| 1455 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1456 | This test case adds multipoint to singlepoint intent related to |
| 1457 | SDN-IP matching on destination ip and the action is to rewrite |
| 1458 | the mac address |
| 1459 | Here the mac address to be rewritten is the mac address of the |
| 1460 | egress device |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1461 | """ |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1462 | import json |
| 1463 | import time |
| 1464 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1465 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1466 | "This test case adds multipoint to singlepoint intent related to" + |
| 1467 | " SDN-IP matching on destination ip and " + |
| 1468 | "rewrite mac address action" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1469 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1470 | "Adding multipoint to singlepoint intent related to SDN-IP" + |
| 1471 | " matching on destination ip" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1472 | main.step( "Adding bidirectional multipoint to singlepoint intent" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1473 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1474 | add-multi-to-single-intent --ipDst=10.0.3.0/24 |
| 1475 | --setEthDst=00:00:00:00:00:12 of:0000000000003008/1 0000000000003009/1 |
| 1476 | of:0000000000006018/1 |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1477 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1478 | add-multi-to-single-intent --ipDst=10.0.1.0/24 |
| 1479 | --setEthDst=00:00:00:00:00:08 of:0000000000006018/1 0000000000003009/1 |
| 1480 | of:0000000000003008/1 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1481 | """ |
| 1482 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1483 | "Installing multipoint to single point " + |
| 1484 | "intent with rewrite mac address" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1485 | main.step( "Uninstalling proxy arp app" ) |
| 1486 | # Unistall onos-app-proxyarp app to disable reactive forwarding |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1487 | appUninstallResult1 = main.ONOScli1.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 | appUninstallResult2 = main.ONOScli2.featureUninstall( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1490 | "onos-app-proxyarp" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1491 | appUninstallResult3 = main.ONOScli3.featureUninstall( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1492 | "onos-app-proxyarp" ) |
| 1493 | main.log.info( "onos-app-proxyarp uninstalled" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1494 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1495 | main.step( "Changing ipaddress of hosts h8,h9 and h18" ) |
| 1496 | main.Mininet1.changeIP( |
| 1497 | host='h8', |
| 1498 | intf='h8-eth0', |
| 1499 | newIP='10.0.1.1', |
| 1500 | newNetmask='255.255.255.0' ) |
| 1501 | main.Mininet1.changeIP( |
| 1502 | host='h9', |
| 1503 | intf='h9-eth0', |
| 1504 | newIP='10.0.2.1', |
| 1505 | newNetmask='255.255.255.0' ) |
| 1506 | main.Mininet1.changeIP( |
| 1507 | host='h10', |
| 1508 | intf='h10-eth0', |
| 1509 | newIP='10.0.3.1', |
| 1510 | newNetmask='255.255.255.0' ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1511 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1512 | main.step( "Changing default gateway of hosts h8,h9 and h18" ) |
| 1513 | main.Mininet1.changeDefaultGateway( host='h8', newGW='10.0.1.254' ) |
| 1514 | main.Mininet1.changeDefaultGateway( host='h9', newGW='10.0.2.254' ) |
| 1515 | main.Mininet1.changeDefaultGateway( host='h10', newGW='10.0.3.254' ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1516 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1517 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1518 | "Assigning random mac address to the default gateways " + |
| 1519 | "since proxyarp app is uninstalled" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1520 | main.Mininet1.addStaticMACAddress( |
| 1521 | host='h8', |
| 1522 | GW='10.0.1.254', |
| 1523 | macaddr='00:00:00:00:11:11' ) |
| 1524 | main.Mininet1.addStaticMACAddress( |
| 1525 | host='h9', |
| 1526 | GW='10.0.2.254', |
| 1527 | macaddr='00:00:00:00:22:22' ) |
| 1528 | main.Mininet1.addStaticMACAddress( |
| 1529 | host='h10', |
| 1530 | GW='10.0.3.254', |
| 1531 | macaddr='00:00:00:00:33:33' ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1532 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1533 | main.step( "Verify static gateway and MAC address assignment" ) |
| 1534 | main.Mininet1.verifyStaticGWandMAC( host='h8' ) |
| 1535 | main.Mininet1.verifyStaticGWandMAC( host='h9' ) |
| 1536 | main.Mininet1.verifyStaticGWandMAC( host='h10' ) |
| 1537 | |
| 1538 | main.step( "Adding multipoint to singlepoint intent" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1539 | pIntentResult1 = main.ONOScli1.addMultipointToSinglepointIntent( |
| 1540 | ingressDevice1=main.params[ 'MULTIPOINT_INTENT' ][ 'device1' ], |
| 1541 | ingressDevice2=main.params[ 'MULTIPOINT_INTENT' ][ 'device2' ], |
| 1542 | egressDevice=main.params[ 'MULTIPOINT_INTENT' ][ 'device3' ], |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1543 | ipDst=main.params[ 'MULTIPOINT_INTENT' ][ 'ip1' ], |
| 1544 | setEthDst=main.params[ 'MULTIPOINT_INTENT' ][ 'mac1' ] ) |
| 1545 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1546 | pIntentResult2 = main.ONOScli1.addMultipointToSinglepointIntent( |
| 1547 | ingressDevice1=main.params[ 'MULTIPOINT_INTENT' ][ 'device3' ], |
| 1548 | ingressDevice2=main.params[ 'MULTIPOINT_INTENT' ][ 'device2' ], |
| 1549 | egressDevice=main.params[ 'MULTIPOINT_INTENT' ][ 'device1' ], |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1550 | ipDst=main.params[ 'MULTIPOINT_INTENT' ][ 'ip2' ], |
| 1551 | setEthDst=main.params[ 'MULTIPOINT_INTENT' ][ 'mac2' ] ) |
| 1552 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1553 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1554 | main.log.info( "intents = " + getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1555 | |
| 1556 | time.sleep( 10 ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1557 | getFlowsResult = main.ONOScli1.flows( jsonFormat=False ) |
| 1558 | main.log.info( "flows = " + getFlowsResult ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1559 | |
| 1560 | count = 1 |
| 1561 | i = 8 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1562 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1563 | |
| 1564 | main.log.info( "\n\nh" + str( i ) + " is Pinging h" + str( i + 2 ) ) |
| 1565 | ping = main.Mininet1.pingHost( |
| 1566 | src="h" + str( i ), target="h" + str( i + 2 ) ) |
| 1567 | if ping == main.FALSE and count < 3: |
| 1568 | count += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1569 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1570 | main.log.report( "Ping between h" + |
| 1571 | str( i ) + |
| 1572 | " and h" + |
| 1573 | str( i + |
| 1574 | 2 ) + |
| 1575 | " failed. Making attempt number " + |
| 1576 | str( count ) + |
| 1577 | " in 2 seconds" ) |
| 1578 | time.sleep( 2 ) |
| 1579 | elif ping == main.FALSE: |
| 1580 | main.log.report( "All ping attempts between h" + |
| 1581 | str( i ) + |
| 1582 | " and h" + |
| 1583 | str( i + |
| 1584 | 10 ) + |
| 1585 | "have failed" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1586 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1587 | elif ping == main.TRUE: |
| 1588 | main.log.info( "Ping test between h" + |
| 1589 | str( i ) + |
| 1590 | " and h" + |
| 1591 | str( i + |
| 1592 | 2 ) + |
| 1593 | "passed!" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1594 | PingResult = main.TRUE |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1595 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1596 | main.log.info( "Unknown error" ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1597 | PingResult = main.ERROR |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1598 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1599 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1600 | main.log.report( "Ping test failed." ) |
| 1601 | # main.cleanup() |
| 1602 | # main.exit() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1603 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1604 | main.log.report( "Ping all successful" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1605 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1606 | pIntentResult = pIntentResult1 and pIntentResult2 |
| 1607 | if pIntentResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1608 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1609 | "Multi point intent with rewrite mac " + |
| 1610 | "address installation successful" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1611 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1612 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1613 | "Multi point intent with rewrite mac" + |
| 1614 | " address installation failed" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1615 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1616 | case33Result = pIntentResult and PingResult |
| 1617 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1618 | expect=main.TRUE, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1619 | actual=case33Result, |
| 1620 | onpass="Ping all test after multipoint to single point" + |
| 1621 | " intent addition with rewrite mac address successful", |
| 1622 | onfail="Ping all test after multipoint to single point intent" + |
| 1623 | " addition with rewrite mac address failed" ) |