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