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