shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 2 | # Testing the basic functionality of ONOS Next |
| 3 | # For sanity and driver functionality excercises only. |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 4 | |
| 5 | import time |
| 6 | import sys |
| 7 | import os |
| 8 | import re |
| 9 | import time |
| 10 | import json |
| 11 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 12 | time.sleep( 1 ) |
| 13 | |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 14 | class MultiProd: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 15 | |
| 16 | def __init__( self ): |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 17 | self.default = '' |
| 18 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 19 | def CASE1( self, main ): |
| 20 | """ |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 21 | Startup sequence: |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 22 | cell <name> |
| 23 | onos-verify-cell |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 24 | onos-remove-raft-logs |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 25 | git pull |
| 26 | mvn clean install |
| 27 | onos-package |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 28 | onos-install -f |
| 29 | onos-wait-for-start |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 30 | """ |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 31 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 32 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 33 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 34 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 35 | ONOS1Port = main.params[ 'CTRL' ][ 'port1' ] |
| 36 | ONOS2Port = main.params[ 'CTRL' ][ 'port2' ] |
| 37 | ONOS3Port = main.params[ 'CTRL' ][ 'port3' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 38 | |
| 39 | main.case( "Setting up test environment" ) |
| 40 | main.log.report( |
| 41 | "This testcase is testing setting up test environment" ) |
| 42 | main.log.report( "__________________________________" ) |
| 43 | |
| 44 | main.step( "Applying cell variable to environment" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 45 | cellResult1 = main.ONOSbench.setCell( cellName ) |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 46 | # cellResult2 = main.ONOScli1.setCell( cellName ) |
| 47 | # cellResult3 = main.ONOScli2.setCell( cellName ) |
| 48 | # cellResult4 = main.ONOScli3.setCell( cellName ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 49 | verifyResult = main.ONOSbench.verifyCell() |
| 50 | cellResult = cellResult1 |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 51 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 52 | main.step( "Removing raft logs before a clen installation of ONOS" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 53 | removeLogResult = main.ONOSbench.onosRemoveRaftLogs() |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 54 | |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 55 | main.step( "Git checkout, pull and get version" ) |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 56 | main.ONOSbench.gitCheckout( "master" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 57 | gitPullResult = main.ONOSbench.gitPull() |
shahshreya | 42efbd8 | 2015-02-05 17:06:08 -0800 | [diff] [blame] | 58 | main.log.info( "git_pull_result = " + str( gitPullResult )) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 59 | versionResult = main.ONOSbench.getVersion( report=True ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 60 | |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 61 | packageResult = main.TRUE |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 62 | if gitPullResult == 100: |
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() |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 65 | main.step( "Creating ONOS package" ) |
| 66 | packageResult = main.ONOSbench.onosPackage() |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 67 | # cleanInstallResult = main.TRUE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 68 | |
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 | 42efbd8 | 2015-02-05 17:06:08 -0800 | [diff] [blame] | 110 | # Starting the mininet using the old way |
| 111 | main.step( "Starting Mininet ..." ) |
| 112 | netIsUp = main.Mininet1.startNet() |
| 113 | if netIsUp: |
| 114 | main.log.info("Mininet CLI is up") |
| 115 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 116 | case1Result = ( packageResult and |
| 117 | cellResult and verifyResult and onosInstallResult and |
| 118 | onosIsup and startResult ) |
| 119 | utilities.assertEquals( expect=main.TRUE, actual=case1Result, |
| 120 | onpass="Test startup successful", |
| 121 | onfail="Test startup NOT successful" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 122 | |
| 123 | def CASE11( self, main ): |
| 124 | """ |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 125 | Cleanup sequence: |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 126 | onos-service <nodeIp> stop |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 127 | onos-uninstall |
| 128 | |
| 129 | TODO: Define rest of cleanup |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 130 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 131 | """ |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 132 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 133 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 134 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 135 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 136 | main.case( "Cleaning up test environment" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 137 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 138 | main.step( "Testing ONOS kill function" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 139 | killResult1 = main.ONOSbench.onosKill( ONOS1Ip ) |
| 140 | killResult2 = main.ONOSbench.onosKill( ONOS2Ip ) |
| 141 | killResult3 = main.ONOSbench.onosKill( ONOS3Ip ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 142 | |
| 143 | main.step( "Stopping ONOS service" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 144 | stopResult1 = main.ONOSbench.onosStop( ONOS1Ip ) |
| 145 | stopResult2 = main.ONOSbench.onosStop( ONOS2Ip ) |
| 146 | stopResult3 = main.ONOSbench.onosStop( ONOS3Ip ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 147 | |
| 148 | main.step( "Uninstalling ONOS service" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 149 | uninstallResult = main.ONOSbench.onosUninstall() |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 150 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 151 | def CASE3( self, main ): |
| 152 | """ |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 153 | Test 'onos' command and its functionality in driver |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 154 | """ |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 155 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 156 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 157 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 158 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 159 | main.case( "Testing 'onos' command" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 160 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 161 | main.step( "Sending command 'onos -w <onos-ip> system:name'" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 162 | cmdstr1 = "system:name" |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 163 | cmdResult1 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr1 ) |
| 164 | main.log.info( "onos command returned: " + cmdResult1 ) |
| 165 | cmdResult2 = main.ONOSbench.onosCli( ONOS2Ip, cmdstr1 ) |
| 166 | main.log.info( "onos command returned: " + cmdResult2 ) |
| 167 | cmdResult3 = main.ONOSbench.onosCli( ONOS3Ip, cmdstr1 ) |
| 168 | main.log.info( "onos command returned: " + cmdResult3 ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 169 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 170 | main.step( "Sending command 'onos -w <onos-ip> onos:topology'" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 171 | cmdstr2 = "onos:topology" |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 172 | cmdResult4 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr2 ) |
| 173 | main.log.info( "onos command returned: " + cmdResult4 ) |
| 174 | cmdResult5 = main.ONOSbench.onosCli( ONOS2Ip, cmdstr2 ) |
| 175 | main.log.info( "onos command returned: " + cmdResult5 ) |
| 176 | cmdResult6 = main.ONOSbench.onosCli( ONOS6Ip, cmdstr2 ) |
| 177 | main.log.info( "onos command returned: " + cmdResult6 ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 178 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 179 | def CASE4( self, main ): |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 180 | import re |
| 181 | import time |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 182 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 183 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 184 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 185 | ONOS1Port = main.params[ 'CTRL' ][ 'port1' ] |
| 186 | ONOS2Port = main.params[ 'CTRL' ][ 'port2' ] |
| 187 | ONOS3Port = main.params[ 'CTRL' ][ 'port3' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 188 | |
| 189 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 190 | "This testcase is testing the assignment of all the switches" + |
| 191 | " to all controllers and discovering the hosts in reactive mode" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 192 | main.log.report( "__________________________________" ) |
| 193 | main.case( "Pingall Test(No intents are added)" ) |
| 194 | main.step( "Assigning switches to controllers" ) |
| 195 | for i in range( 1, 29 ): # 1 to ( num of switches +1 ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 196 | main.Mininet1.assignSwController( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 197 | sw=str( i ), |
| 198 | count=3, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 199 | ip1=ONOS1Ip, |
| 200 | port1=ONOS1Port, |
| 201 | ip2=ONOS2Ip, |
| 202 | port2=ONOS2Port, |
| 203 | ip3=ONOS3Ip, |
| 204 | port3=ONOS3Port ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 205 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 206 | switchMastership = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 207 | for i in range( 1, 29 ): |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 208 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 209 | print( "Response is " + str( response ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 210 | if re.search( "tcp:" + ONOS1Ip, response ): |
| 211 | switchMastership = switchMastership and main.TRUE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 212 | else: |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 213 | switchMastership = main.FALSE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 214 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 215 | if switchMastership == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 216 | main.log.report( "Controller assignment successfull" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 217 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 218 | main.log.report( "Controller assignment failed" ) |
shahshreya | d524a94 | 2015-04-21 09:55:16 -0700 | [diff] [blame] | 219 | appInstallResult = main.TRUE |
| 220 | main.log.info( "Activating reactive forwarding app" ) |
| 221 | appInstallResult = main.ONOScli1.activateApp( "org.onosproject.fwd" ) |
| 222 | appCheck = main.ONOScli1.appToIDCheck() |
| 223 | if appCheck != main.TRUE: |
| 224 | main.log.warn( main.ONOScli1.apps() ) |
| 225 | main.log.warn( main.ONOScli1.appIDs() ) |
| 226 | time.sleep( 30 ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 227 | # REACTIVE FWD test |
| 228 | main.step( "Pingall" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 229 | pingResult = main.FALSE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 230 | time1 = time.time() |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 231 | pingResult = main.Mininet1.pingall() |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 232 | time2 = time.time() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 233 | print "Time for pingall: %2f seconds" % ( time2 - time1 ) |
| 234 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 235 | case4Result = switchMastership and pingResult |
| 236 | if pingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 237 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 238 | "Pingall Test in reactive mode to" + |
| 239 | " discover the hosts successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 240 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 241 | main.log.report( |
| 242 | "Pingall Test in reactive mode to discover the hosts failed" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 243 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 244 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 245 | expect=main.TRUE, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 246 | actual=case4Result, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 247 | onpass="Controller assignment and Pingall Test successful", |
| 248 | onfail="Controller assignment and Pingall Test NOT successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 249 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 250 | def CASE5( self, main ): |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 251 | import json |
| 252 | from subprocess import Popen, PIPE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 253 | # assumes that sts is already in you PYTHONPATH |
| 254 | from sts.topology.teston_topology import TestONTopology |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 255 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 256 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 257 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 258 | |
| 259 | main.log.report( |
shahshreya | d2ef8bf | 2015-04-03 15:34:55 -0700 | [diff] [blame] | 260 | "This testcase is testing if all ONOS nodes are in topology" + |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 261 | " sync with mininet and its peer ONOS nodes" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 262 | main.log.report( "__________________________________" ) |
| 263 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 264 | "Testing Mininet topology with the" + |
| 265 | " topology of multi instances ONOS" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 266 | main.step( "Collecting topology information from ONOS" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 267 | devices1 = main.ONOScli1.devices() |
| 268 | devices2 = main.ONOScli2.devices() |
| 269 | devices3 = main.ONOScli3.devices() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 270 | # print "devices1 = ", devices1 |
| 271 | # print "devices2 = ", devices2 |
| 272 | # print "devices3 = ", devices3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 273 | hosts1 = main.ONOScli1.hosts() |
| 274 | hosts2 = main.ONOScli2.hosts() |
| 275 | hosts3 = main.ONOScli3.hosts() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 276 | # print "hosts1 = ", hosts1 |
| 277 | # print "hosts2 = ", hosts2 |
| 278 | # print "hosts3 = ", hosts3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 279 | ports1 = main.ONOScli1.ports() |
| 280 | ports2 = main.ONOScli2.ports() |
| 281 | ports3 = main.ONOScli3.ports() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 282 | # print "ports1 = ", ports1 |
| 283 | # print "ports2 = ", ports2 |
| 284 | # print "ports3 = ", ports3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 285 | links1 = main.ONOScli1.links() |
| 286 | links2 = main.ONOScli2.links() |
| 287 | links3 = main.ONOScli3.links() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 288 | # print "links1 = ", links1 |
| 289 | # print "links2 = ", links2 |
| 290 | # print "links3 = ", links3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 291 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 292 | print "**************" |
| 293 | |
| 294 | main.step( "Start continuous pings" ) |
| 295 | main.Mininet2.pingLong( |
| 296 | src=main.params[ 'PING' ][ 'source1' ], |
| 297 | target=main.params[ 'PING' ][ 'target1' ], |
| 298 | pingTime=500 ) |
| 299 | main.Mininet2.pingLong( |
| 300 | src=main.params[ 'PING' ][ 'source2' ], |
| 301 | target=main.params[ 'PING' ][ 'target2' ], |
| 302 | pingTime=500 ) |
| 303 | main.Mininet2.pingLong( |
| 304 | src=main.params[ 'PING' ][ 'source3' ], |
| 305 | target=main.params[ 'PING' ][ 'target3' ], |
| 306 | pingTime=500 ) |
| 307 | main.Mininet2.pingLong( |
| 308 | src=main.params[ 'PING' ][ 'source4' ], |
| 309 | target=main.params[ 'PING' ][ 'target4' ], |
| 310 | pingTime=500 ) |
| 311 | main.Mininet2.pingLong( |
| 312 | src=main.params[ 'PING' ][ 'source5' ], |
| 313 | target=main.params[ 'PING' ][ 'target5' ], |
| 314 | pingTime=500 ) |
| 315 | main.Mininet2.pingLong( |
| 316 | src=main.params[ 'PING' ][ 'source6' ], |
| 317 | target=main.params[ 'PING' ][ 'target6' ], |
| 318 | pingTime=500 ) |
| 319 | main.Mininet2.pingLong( |
| 320 | src=main.params[ 'PING' ][ 'source7' ], |
| 321 | target=main.params[ 'PING' ][ 'target7' ], |
| 322 | pingTime=500 ) |
| 323 | main.Mininet2.pingLong( |
| 324 | src=main.params[ 'PING' ][ 'source8' ], |
| 325 | target=main.params[ 'PING' ][ 'target8' ], |
| 326 | pingTime=500 ) |
| 327 | main.Mininet2.pingLong( |
| 328 | src=main.params[ 'PING' ][ 'source9' ], |
| 329 | target=main.params[ 'PING' ][ 'target9' ], |
| 330 | pingTime=500 ) |
| 331 | main.Mininet2.pingLong( |
| 332 | src=main.params[ 'PING' ][ 'source10' ], |
| 333 | target=main.params[ 'PING' ][ 'target10' ], |
| 334 | pingTime=500 ) |
| 335 | |
| 336 | main.step( "Create TestONTopology object" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 337 | global ctrls |
| 338 | ctrls = [] |
| 339 | count = 1 |
| 340 | while True: |
| 341 | temp = () |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 342 | if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]: |
| 343 | temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), ) |
| 344 | temp = temp + ( "ONOS" + str( count ), ) |
| 345 | temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], ) |
| 346 | temp = temp + \ |
| 347 | ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), ) |
| 348 | ctrls.append( temp ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 349 | count = count + 1 |
| 350 | else: |
| 351 | break |
| 352 | global MNTopo |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 353 | Topo = TestONTopology( |
| 354 | main.Mininet1, |
| 355 | ctrls ) # can also add Intent API info for intent operations |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 356 | MNTopo = Topo |
| 357 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 358 | TopologyCheck = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 359 | main.step( "Compare ONOS Topology to MN Topology" ) |
| 360 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 361 | switchesResults1 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 362 | MNTopo, |
| 363 | json.loads( devices1 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 364 | print "switches_Result1 = ", switchesResults1 |
| 365 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults1, |
| 366 | onpass="ONOS1 Switches view is correct", |
| 367 | onfail="ONOS1 Switches view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 368 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 369 | switchesResults2 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 370 | MNTopo, |
| 371 | json.loads( devices2 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 372 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults2, |
| 373 | onpass="ONOS2 Switches view is correct", |
| 374 | onfail="ONOS2 Switches view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 375 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 376 | switchesResults3 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 377 | MNTopo, |
| 378 | json.loads( devices3 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 379 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults3, |
| 380 | onpass="ONOS3 Switches view is correct", |
| 381 | onfail="ONOS3 Switches view is incorrect" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 382 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 383 | portsResults1 = main.Mininet1.comparePorts( MNTopo, |
| 384 | json.loads( ports1 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 385 | utilities.assertEquals( expect=main.TRUE, actual=portsResults1, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 386 | onpass="ONOS1 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 387 | onfail="ONOS1 Ports view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 388 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 389 | portsResults2 = main.Mininet1.comparePorts( MNTopo, |
| 390 | json.loads( ports2 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 391 | utilities.assertEquals( expect=main.TRUE, actual=portsResults2, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 392 | onpass="ONOS2 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 393 | onfail="ONOS2 Ports view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 394 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 395 | portsResults3 = main.Mininet1.comparePorts( MNTopo, |
| 396 | json.loads( ports3 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 397 | utilities.assertEquals( expect=main.TRUE, actual=portsResults3, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 398 | onpass="ONOS3 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 399 | onfail="ONOS3 Ports view is incorrect" ) |
shahshreya | bf739d8 | 2015-06-10 11:22:31 -0700 | [diff] [blame] | 400 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 401 | linksResults1 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 402 | MNTopo, |
| 403 | json.loads( links1 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 404 | utilities.assertEquals( expect=main.TRUE, actual=linksResults1, |
| 405 | onpass="ONOS1 Links view is correct", |
| 406 | onfail="ONOS1 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 407 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 408 | linksResults2 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 409 | MNTopo, |
| 410 | json.loads( links2 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 411 | utilities.assertEquals( expect=main.TRUE, actual=linksResults2, |
| 412 | onpass="ONOS2 Links view is correct", |
| 413 | onfail="ONOS2 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 414 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 415 | linksResults3 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 416 | MNTopo, |
| 417 | json.loads( links3 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 418 | utilities.assertEquals( expect=main.TRUE, actual=linksResults3, |
| 419 | onpass="ONOS2 Links view is correct", |
| 420 | onfail="ONOS2 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 421 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 422 | # topoResult = switchesResults1 and switchesResults2 |
| 423 | # and switchesResults3\ |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 424 | # and portsResults1 and portsResults2 and portsResults3\ |
| 425 | # and linksResults1 and linksResults2 and linksResults3 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 426 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 427 | topoResult = switchesResults1 and switchesResults2 and\ |
| 428 | switchesResults3 and linksResults1 and linksResults2 and\ |
| 429 | linksResults3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 430 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 431 | if topoResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 432 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 433 | "Topology Check Test with mininet" + |
| 434 | "and ONOS instances successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 435 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 436 | main.log.report( |
| 437 | "Topology Check Test with mininet and ONOS instances failed" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 438 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 439 | utilities.assertEquals( expect=main.TRUE, actual=topoResult, |
| 440 | onpass="Topology Check Test successful", |
| 441 | onfail="Topology Check Test NOT successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 442 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 443 | def CASE10( self ): |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 444 | import time |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 445 | main.log.report( |
| 446 | "This testcase uninstalls the reactive forwarding app" ) |
| 447 | main.log.report( "__________________________________" ) |
| 448 | main.case( "Uninstalling reactive forwarding app" ) |
| 449 | # Unistall onos-app-fwd app to disable reactive forwarding |
shahshreya | d524a94 | 2015-04-21 09:55:16 -0700 | [diff] [blame] | 450 | appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.fwd" ) |
| 451 | appCheck = main.ONOScli1.appToIDCheck() |
| 452 | if appCheck != main.TRUE: |
| 453 | main.log.warn( main.ONOScli1.apps() ) |
| 454 | main.log.warn( main.ONOScli1.appIDs() ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 455 | main.log.info( "onos-app-fwd uninstalled" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 456 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 457 | # After reactive forwarding is disabled, |
| 458 | # the reactive flows on switches timeout in 10-15s |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 459 | # So sleep for 15s |
| 460 | time.sleep( 15 ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 461 | |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 462 | hosts = main.ONOScli1.hosts() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 463 | main.log.info( hosts ) |
shahshreya | d524a94 | 2015-04-21 09:55:16 -0700 | [diff] [blame] | 464 | case10Result = appInstallResult |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 465 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 466 | expect=main.TRUE, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 467 | actual=case10Result, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 468 | onpass="Reactive forwarding app uninstallation successful", |
| 469 | onfail="Reactive forwarding app uninstallation failed" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 470 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 471 | def CASE6( self ): |
| 472 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 473 | "This testcase is testing the addition of" + |
| 474 | " host intents and then doing pingall" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 475 | main.log.report( "__________________________________" ) |
| 476 | main.case( "Obtaining hostsfor adding host intents" ) |
| 477 | main.step( "Get hosts" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 478 | hosts = main.ONOScli1.hosts() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 479 | main.log.info( hosts ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 480 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 481 | main.step( "Get all devices id" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 482 | devicesIdList = main.ONOScli1.getAllDevicesId() |
| 483 | main.log.info( devicesIdList ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 484 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 485 | # ONOS displays the hosts in hex format |
| 486 | # unlike mininet which does in decimal format |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 487 | # So take care while adding intents |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 488 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 489 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 490 | main.step( "Add host intents for mn hosts(h8-h18,h9-h19,h10-h20, |
| 491 | h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)" ) |
| 492 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:08/-1", |
| 493 | "00:00:00:00:00:12/-1" ) |
| 494 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:09/-1", |
| 495 | "00:00:00:00:00:13/-1" ) |
| 496 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:0A/-1", |
| 497 | "00:00:00:00:00:14/-1" ) |
| 498 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:0B/-1", |
| 499 | "00:00:00:00:00:15/-1" ) |
| 500 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:0C/-1", |
| 501 | "00:00:00:00:00:16/-1" ) |
| 502 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:0D/-1", |
| 503 | "00:00:00:00:00:17/-1" ) |
| 504 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:0E/-1", |
| 505 | "00:00:00:00:00:18/-1" ) |
| 506 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:0F/-1", |
| 507 | "00:00:00:00:00:19/-1" ) |
| 508 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:10/-1", |
| 509 | "00:00:00:00:00:1A/-1" ) |
| 510 | hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:11/-1", |
| 511 | "00:00:00:00:00:1B/-1" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 512 | """ |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 513 | intentsId = [] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 514 | for i in range( 8, 18 ): |
| 515 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 516 | "Adding host intent between h" + str( i ) + |
| 517 | " and h" + str( i + 10 ) ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 518 | host1 = "00:00:00:00:00:" + \ |
| 519 | str( hex( i )[ 2: ] ).zfill( 2 ).upper() |
| 520 | host2 = "00:00:00:00:00:" + \ |
| 521 | str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper() |
| 522 | # NOTE: get host can return None |
| 523 | # TODO: handle this |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 524 | host1Id = main.ONOScli1.getHost( host1 )[ 'id' ] |
| 525 | host2Id = main.ONOScli1.getHost( host2 )[ 'id' ] |
| 526 | tmpResult = main.ONOScli1.addHostIntent( host1Id, host2Id ) |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 527 | intentsId.append( tmpResult ) |
| 528 | |
| 529 | checkIntent1 = main.ONOScli1.checkIntentState( intentsId ) |
| 530 | checkIntent2 = main.ONOScli2.checkIntentState( intentsId ) |
| 531 | checkIntent3 = main.ONOScli3.checkIntentState( intentsId ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 532 | |
| 533 | flowHandle = main.ONOScli1.flows() |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 534 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 535 | main.log.info( "flows:" + flowHandle ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 536 | |
| 537 | count = 1 |
| 538 | i = 8 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 539 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 540 | while i < 18: |
| 541 | main.log.info( |
| 542 | "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) ) |
| 543 | ping = main.Mininet1.pingHost( |
| 544 | src="h" + str( i ), target="h" + str( i + 10 ) ) |
| 545 | if ping == main.FALSE and count < 5: |
| 546 | count += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 547 | # i = 8 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 548 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 549 | main.log.report( "Ping between h" + |
| 550 | str( i ) + |
| 551 | " and h" + |
| 552 | str( i + |
| 553 | 10 ) + |
| 554 | " failed. Making attempt number " + |
| 555 | str( count ) + |
| 556 | " in 2 seconds" ) |
| 557 | time.sleep( 2 ) |
| 558 | elif ping == main.FALSE: |
| 559 | main.log.report( "All ping attempts between h" + |
| 560 | str( i ) + |
| 561 | " and h" + |
| 562 | str( i + |
| 563 | 10 ) + |
| 564 | "have failed" ) |
| 565 | i = 19 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 566 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 567 | elif ping == main.TRUE: |
| 568 | main.log.info( "Ping test between h" + |
| 569 | str( i ) + |
| 570 | " and h" + |
| 571 | str( i + |
| 572 | 10 ) + |
| 573 | "passed!" ) |
| 574 | i += 1 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 575 | PingResult = main.TRUE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 576 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 577 | main.log.info( "Unknown error" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 578 | PingResult = main.ERROR |
| 579 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 580 | main.log.report( |
| 581 | "Host intents have not ben installed correctly. Cleaning up" ) |
| 582 | # main.cleanup() |
| 583 | # main.exit() |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 584 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 585 | main.log.report( "Host intents have been installed correctly" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 586 | |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 587 | checkIntent1 = main.ONOScli1.checkIntentState( intentsId ) |
| 588 | checkIntent2 = main.ONOScli2.checkIntentState( intentsId ) |
| 589 | checkIntent3 = main.ONOScli3.checkIntentState( intentsId ) |
| 590 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 591 | case6Result = PingResult |
| 592 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 593 | expect=main.TRUE, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 594 | actual=case6Result, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 595 | onpass="Host intent addition and Pingall Test successful", |
| 596 | onfail="Host intent addition and Pingall Test NOT successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 597 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 598 | def CASE7( self, main ): |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 599 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 600 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 601 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 602 | linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 603 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 604 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 605 | "This testscase is killing a link to" + |
| 606 | " ensure that link discovery is consistent" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 607 | main.log.report( "__________________________________" ) |
| 608 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 609 | "Killing a link to Ensure that Link" + |
| 610 | " Discovery is Working Properly" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 611 | main.step( "Start continuous pings" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 612 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 613 | main.Mininet2.pingLong( |
| 614 | src=main.params[ 'PING' ][ 'source1' ], |
| 615 | target=main.params[ 'PING' ][ 'target1' ], |
| 616 | pingTime=500 ) |
| 617 | main.Mininet2.pingLong( |
| 618 | src=main.params[ 'PING' ][ 'source2' ], |
| 619 | target=main.params[ 'PING' ][ 'target2' ], |
| 620 | pingTime=500 ) |
| 621 | main.Mininet2.pingLong( |
| 622 | src=main.params[ 'PING' ][ 'source3' ], |
| 623 | target=main.params[ 'PING' ][ 'target3' ], |
| 624 | pingTime=500 ) |
| 625 | main.Mininet2.pingLong( |
| 626 | src=main.params[ 'PING' ][ 'source4' ], |
| 627 | target=main.params[ 'PING' ][ 'target4' ], |
| 628 | pingTime=500 ) |
| 629 | main.Mininet2.pingLong( |
| 630 | src=main.params[ 'PING' ][ 'source5' ], |
| 631 | target=main.params[ 'PING' ][ 'target5' ], |
| 632 | pingTime=500 ) |
| 633 | main.Mininet2.pingLong( |
| 634 | src=main.params[ 'PING' ][ 'source6' ], |
| 635 | target=main.params[ 'PING' ][ 'target6' ], |
| 636 | pingTime=500 ) |
| 637 | main.Mininet2.pingLong( |
| 638 | src=main.params[ 'PING' ][ 'source7' ], |
| 639 | target=main.params[ 'PING' ][ 'target7' ], |
| 640 | pingTime=500 ) |
| 641 | main.Mininet2.pingLong( |
| 642 | src=main.params[ 'PING' ][ 'source8' ], |
| 643 | target=main.params[ 'PING' ][ 'target8' ], |
| 644 | pingTime=500 ) |
| 645 | main.Mininet2.pingLong( |
| 646 | src=main.params[ 'PING' ][ 'source9' ], |
| 647 | target=main.params[ 'PING' ][ 'target9' ], |
| 648 | pingTime=500 ) |
| 649 | main.Mininet2.pingLong( |
| 650 | src=main.params[ 'PING' ][ 'source10' ], |
| 651 | target=main.params[ 'PING' ][ 'target10' ], |
| 652 | pingTime=500 ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 653 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 654 | main.step( "Determine the current number of switches and links" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 655 | topologyOutput = main.ONOScli1.topology() |
| 656 | topologyResult = main.ONOSbench.getTopology( topologyOutput ) |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 657 | activeSwitches = topologyResult[ 'devices' ] |
| 658 | links = topologyResult[ 'links' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 659 | main.log.info( |
| 660 | "Currently there are %s switches and %s links" % |
| 661 | ( str( activeSwitches ), str( links ) ) ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 662 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 663 | main.step( "Kill Link between s3 and s28" ) |
| 664 | main.Mininet1.link( END1="s3", END2="s28", OPTION="down" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 665 | time.sleep( linkSleep ) |
| 666 | topologyOutput = main.ONOScli2.topology() |
| 667 | LinkDown = main.ONOSbench.checkStatus( |
| 668 | topologyOutput, activeSwitches, str( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 669 | int( links ) - 2 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 670 | if LinkDown == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 671 | main.log.report( "Link Down discovered properly" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 672 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 673 | expect=main.TRUE, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 674 | actual=LinkDown, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 675 | onpass="Link Down discovered properly", |
| 676 | onfail="Link down was not discovered in " + |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 677 | str( linkSleep ) + |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 678 | " seconds" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 679 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 680 | main.step( "Bring link between s3 and s28 back up" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 681 | LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" ) |
| 682 | time.sleep( linkSleep ) |
| 683 | topologyOutput = main.ONOScli2.topology() |
| 684 | LinkUp = main.ONOSbench.checkStatus( |
| 685 | topologyOutput, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 686 | activeSwitches, |
| 687 | str( links ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 688 | if LinkUp == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 689 | main.log.report( "Link up discovered properly" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 690 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 691 | expect=main.TRUE, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 692 | actual=LinkUp, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 693 | onpass="Link up discovered properly", |
| 694 | onfail="Link up was not discovered in " + |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 695 | str( linkSleep ) + |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 696 | " seconds" ) |
| 697 | |
| 698 | main.step( "Compare ONOS Topology to MN Topology" ) |
| 699 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 700 | "Testing Mininet topology with the" + |
| 701 | " topology of multi instances ONOS" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 702 | main.step( "Collecting topology information from ONOS" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 703 | devices1 = main.ONOScli1.devices() |
| 704 | devices2 = main.ONOScli2.devices() |
| 705 | devices3 = main.ONOScli3.devices() |
| 706 | print "devices1 = ", devices1 |
| 707 | print "devices2 = ", devices2 |
| 708 | print "devices3 = ", devices3 |
| 709 | hosts1 = main.ONOScli1.hosts() |
| 710 | hosts2 = main.ONOScli2.hosts() |
| 711 | hosts3 = main.ONOScli3.hosts() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 712 | # print "hosts1 = ", hosts1 |
| 713 | # print "hosts2 = ", hosts2 |
| 714 | # print "hosts3 = ", hosts3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 715 | ports1 = main.ONOScli1.ports() |
| 716 | ports2 = main.ONOScli2.ports() |
| 717 | ports3 = main.ONOScli3.ports() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 718 | # print "ports1 = ", ports1 |
| 719 | # print "ports2 = ", ports2 |
| 720 | # print "ports3 = ", ports3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 721 | links1 = main.ONOScli1.links() |
| 722 | links2 = main.ONOScli2.links() |
| 723 | links3 = main.ONOScli3.links() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 724 | # print "links1 = ", links1 |
| 725 | # print "links2 = ", links2 |
| 726 | # print "links3 = ", links3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 727 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 728 | print "**************" |
| 729 | |
| 730 | main.step( "Start continuous pings" ) |
| 731 | main.Mininet2.pingLong( |
| 732 | src=main.params[ 'PING' ][ 'source1' ], |
| 733 | target=main.params[ 'PING' ][ 'target1' ], |
| 734 | pingTime=500 ) |
| 735 | main.Mininet2.pingLong( |
| 736 | src=main.params[ 'PING' ][ 'source2' ], |
| 737 | target=main.params[ 'PING' ][ 'target2' ], |
| 738 | pingTime=500 ) |
| 739 | main.Mininet2.pingLong( |
| 740 | src=main.params[ 'PING' ][ 'source3' ], |
| 741 | target=main.params[ 'PING' ][ 'target3' ], |
| 742 | pingTime=500 ) |
| 743 | main.Mininet2.pingLong( |
| 744 | src=main.params[ 'PING' ][ 'source4' ], |
| 745 | target=main.params[ 'PING' ][ 'target4' ], |
| 746 | pingTime=500 ) |
| 747 | main.Mininet2.pingLong( |
| 748 | src=main.params[ 'PING' ][ 'source5' ], |
| 749 | target=main.params[ 'PING' ][ 'target5' ], |
| 750 | pingTime=500 ) |
| 751 | main.Mininet2.pingLong( |
| 752 | src=main.params[ 'PING' ][ 'source6' ], |
| 753 | target=main.params[ 'PING' ][ 'target6' ], |
| 754 | pingTime=500 ) |
| 755 | main.Mininet2.pingLong( |
| 756 | src=main.params[ 'PING' ][ 'source7' ], |
| 757 | target=main.params[ 'PING' ][ 'target7' ], |
| 758 | pingTime=500 ) |
| 759 | main.Mininet2.pingLong( |
| 760 | src=main.params[ 'PING' ][ 'source8' ], |
| 761 | target=main.params[ 'PING' ][ 'target8' ], |
| 762 | pingTime=500 ) |
| 763 | main.Mininet2.pingLong( |
| 764 | src=main.params[ 'PING' ][ 'source9' ], |
| 765 | target=main.params[ 'PING' ][ 'target9' ], |
| 766 | pingTime=500 ) |
| 767 | main.Mininet2.pingLong( |
| 768 | src=main.params[ 'PING' ][ 'source10' ], |
| 769 | target=main.params[ 'PING' ][ 'target10' ], |
| 770 | pingTime=500 ) |
| 771 | |
| 772 | main.step( "Create TestONTopology object" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 773 | global ctrls |
| 774 | ctrls = [] |
| 775 | count = 1 |
| 776 | while True: |
| 777 | temp = () |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 778 | if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]: |
| 779 | temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), ) |
| 780 | temp = temp + ( "ONOS" + str( count ), ) |
| 781 | temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], ) |
| 782 | temp = temp + \ |
| 783 | ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), ) |
| 784 | ctrls.append( temp ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 785 | count = count + 1 |
| 786 | else: |
| 787 | break |
| 788 | global MNTopo |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 789 | Topo = TestONTopology( |
| 790 | main.Mininet1, |
| 791 | ctrls ) # can also add Intent API info for intent operations |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 792 | MNTopo = Topo |
| 793 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 794 | TopologyCheck = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 795 | main.step( "Compare ONOS Topology to MN Topology" ) |
| 796 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 797 | switchesResults1 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 798 | MNTopo, |
| 799 | json.loads( devices1 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 800 | print "switches_Result1 = ", switchesResults1 |
| 801 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults1, |
| 802 | onpass="ONOS1 Switches view is correct", |
| 803 | onfail="ONOS1 Switches view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 804 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 805 | switchesResults2 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 806 | MNTopo, |
| 807 | json.loads( devices2 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 808 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults2, |
| 809 | onpass="ONOS2 Switches view is correct", |
| 810 | onfail="ONOS2 Switches view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 811 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 812 | switchesResults3 = main.Mininet1.compareSwitches( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 813 | MNTopo, |
| 814 | json.loads( devices3 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 815 | utilities.assertEquals( expect=main.TRUE, actual=switchesResults3, |
| 816 | onpass="ONOS3 Switches view is correct", |
| 817 | onfail="ONOS3 Switches view is incorrect" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 818 | |
| 819 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 820 | portsResults1 = main.Mininet1.comparePorts( MNTopo, |
| 821 | json.loads( ports1 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 822 | utilities.assertEquals( expect=main.TRUE, actual=portsResults1, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 823 | onpass="ONOS1 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 824 | onfail="ONOS1 Ports view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 825 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 826 | portsResults2 = main.Mininet1.comparePorts( MNTopo, |
| 827 | json.loads( ports2 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 828 | utilities.assertEquals( expect=main.TRUE, actual=portsResults2, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 829 | onpass="ONOS2 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 830 | onfail="ONOS2 Ports view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 831 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 832 | portsResults3 = main.Mininet1.comparePorts( MNTopo, |
| 833 | json.loads( ports3 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 834 | utilities.assertEquals( expect=main.TRUE, actual=portsResults3, |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 835 | onpass="ONOS3 Ports view is correct", |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 836 | onfail="ONOS3 Ports view is incorrect" ) |
| 837 | """ |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 838 | linksResults1 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 839 | MNTopo, |
| 840 | json.loads( links1 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 841 | utilities.assertEquals( expect=main.TRUE, actual=linksResults1, |
| 842 | onpass="ONOS1 Links view is correct", |
| 843 | onfail="ONOS1 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 844 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 845 | linksResults2 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 846 | MNTopo, |
| 847 | json.loads( links2 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 848 | utilities.assertEquals( expect=main.TRUE, actual=linksResults2, |
| 849 | onpass="ONOS2 Links view is correct", |
| 850 | onfail="ONOS2 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 851 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 852 | linksResults3 = main.Mininet1.compareLinks( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 853 | MNTopo, |
| 854 | json.loads( links3 ) ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 855 | utilities.assertEquals( expect=main.TRUE, actual=linksResults3, |
| 856 | onpass="ONOS2 Links view is correct", |
| 857 | onfail="ONOS2 Links view is incorrect" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 858 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 859 | # topoResult = switchesResults1 and switchesResults2 |
| 860 | # and switchesResults3\ |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 861 | # and portsResults1 and portsResults2 and portsResults3\ |
| 862 | # and linksResults1 and linksResults2 and linksResults3 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 863 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 864 | topoResult = switchesResults1 and switchesResults2\ |
| 865 | and switchesResults3 and linksResults1 and\ |
| 866 | linksResults2 and linksResults3 |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 867 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 868 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 869 | expect=main.TRUE, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 870 | actual=topoResult and LinkUp and LinkDown, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 871 | onpass="Topology Check Test successful", |
| 872 | onfail="Topology Check Test NOT successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 873 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 874 | def CASE8( self ): |
| 875 | """ |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 876 | Intent removal |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 877 | """ |
| 878 | main.log.report( |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 879 | "This testcase removes any previously added intents" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 880 | main.log.report( "__________________________________" ) |
| 881 | main.log.info( "Removing any previously installed intents" ) |
| 882 | main.case( "Removing intents" ) |
| 883 | main.step( "Obtain the intent id's" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 884 | intentResult = main.ONOScli1.intents( jsonFormat=False ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 885 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 886 | intentLinewise = intentResult.split( "\n" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 887 | intentList = [] |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 888 | for line in intentLinewise: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 889 | if line.startswith( "id=" ): |
| 890 | intentList.append( line ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 891 | |
| 892 | intentids = [] |
| 893 | for line in intentList: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 894 | intentids.append( line.split( "," )[ 0 ].split( "=" )[ 1 ] ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 895 | for id in intentids: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 896 | main.log.info( "id = " + id ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 897 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 898 | main.step( |
| 899 | "Iterate through the intentids list and remove each intent" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 900 | for id in intentids: |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 901 | main.ONOScli1.removeIntent( intentId=id ,purge=True ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 902 | |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 903 | remainingIntent = main.ONOScli1.intents( jsonFormat=False ) |
| 904 | main.log.info( "Remaining intents " + remainingIntent ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 905 | |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 906 | case8Result = main.TRUE |
| 907 | intentResult = main.TRUE |
| 908 | if remainingIntent: |
| 909 | main.log.error( "There are still remaining intent" ) |
| 910 | intentResult = main.FALSE |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 911 | i = 8 |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 912 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 913 | PingResult = main.TRUE |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 914 | """ |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 915 | while i < 18: |
| 916 | main.log.info( |
| 917 | "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) ) |
| 918 | ping = main.Mininet1.pingHost( |
| 919 | src="h" + str( i ), target="h" + str( i + 10 ) ) |
| 920 | if ping == main.TRUE: |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 921 | i = 19 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 922 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 923 | elif ping == main.FALSE: |
| 924 | i += 1 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 925 | PingResult = main.FALSE |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 926 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 927 | main.log.info( "Unknown error" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 928 | PingResult = main.ERROR |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 929 | # Note: If the ping result failed, that means the intents have been |
| 930 | # withdrawn correctly. |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 931 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 932 | main.log.report( "Host intents have not been withdrawn correctly" ) |
| 933 | # main.cleanup() |
| 934 | # main.exit() |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 935 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 936 | main.log.report( "Host intents have been withdrawn correctly" ) |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 937 | """ |
| 938 | case8Result = intentResult |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 939 | |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 940 | if case8Result == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 941 | main.log.report( "Intent removal successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 942 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 943 | main.log.report( "Intent removal failed" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 944 | |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 945 | utilities.assertEquals( expect=main.TRUE, actual=case8Result, |
| 946 | onpass="Intent removal test successful", |
| 947 | onfail="Intent removal test failed" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 948 | |
| 949 | def CASE9( self ): |
| 950 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 951 | This test case adds point intents. Make sure you run test case 8 |
| 952 | which is host intent removal before executing this test case. |
| 953 | Else the host intent's flows will persist on switches and the pings |
| 954 | 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] | 955 | """ |
| 956 | main.log.report( |
| 957 | "This testcase adds point intents and then does pingall" ) |
| 958 | main.log.report( "__________________________________" ) |
| 959 | main.log.info( "Adding point intents" ) |
| 960 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 961 | "Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20," + |
| 962 | "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] | 963 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 964 | "Add point-to-point intents for mininet hosts" + |
| 965 | " h8 and h18 or ONOS hosts h8 and h12" ) |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 966 | macsDict = {} |
| 967 | for i in range( 1,29 ): |
| 968 | macsDict[ 'h' + str( i ) ]= main.Mininet1.getMacAddress( host='h'+ str( i ) ) |
| 969 | print macsDict |
| 970 | # main.step(var1) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 971 | ptpIntentResult = main.ONOScli1.addPointIntent( |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 972 | ingressDevice="of:0000000000003008/1", |
| 973 | egressDevice="of:0000000000006018/1", |
| 974 | ethType='IPV4', |
| 975 | ethSrc=macsDict.get( 'h8' )) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 976 | if ptpIntentResult == main.TRUE: |
| 977 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 978 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 979 | # main.log.info( getIntentResult ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 980 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 981 | ptpIntentResult = main.ONOScli1.addPointIntent( |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 982 | ingressDevice="of:0000000000006018/1", |
| 983 | egressDevice="of:0000000000003008/1", |
| 984 | ethType='IPV4', |
| 985 | ethSrc=macsDict.get( 'h18' )) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 986 | if ptpIntentResult == main.TRUE: |
| 987 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 988 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 989 | # main.log.info( getIntentResult ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 990 | |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 991 | var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13" |
| 992 | main.step(var2) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 993 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 994 | "of:0000000000003009/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 995 | "of:0000000000006019/1", |
| 996 | ethType='IPV4', |
| 997 | ethSrc=macsDict.get( 'h9' )) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 998 | if ptpIntentResult == main.TRUE: |
| 999 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1000 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1001 | # main.log.info( getIntentResult ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1002 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1003 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1004 | "of:0000000000006019/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1005 | "of:0000000000003009/1", |
| 1006 | ethType='IPV4', |
| 1007 | ethSrc=macsDict.get( 'h19' )) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1008 | if ptpIntentResult == main.TRUE: |
| 1009 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1010 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1011 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1012 | |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1013 | var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14" |
| 1014 | main.step(var3) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1015 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1016 | "of:0000000000003010/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1017 | "of:0000000000006020/1", |
| 1018 | ethType='IPV4', |
| 1019 | ethSrc=macsDict.get( 'h10' )) |
| 1020 | |
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 ) |
shahshreya | 4e13a06 | 2014-11-11 16:46: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:0000000000006020/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1028 | "of:0000000000003010/1", |
| 1029 | ethType='IPV4', |
| 1030 | ethSrc=macsDict.get( 'h20' )) |
| 1031 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1032 | if ptpIntentResult == main.TRUE: |
| 1033 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1034 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1035 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1036 | |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1037 | var4 = "Add point intents for mininet hosts h11 and h21 or" +\ |
| 1038 | " ONOS hosts hB and h15" |
| 1039 | main.case(var4) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1040 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1041 | "of:0000000000003011/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1042 | "of:0000000000006021/1", |
| 1043 | ethType='IPV4', |
| 1044 | ethSrc=macsDict.get( 'h11' )) |
| 1045 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1046 | if ptpIntentResult == main.TRUE: |
| 1047 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1048 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1049 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1050 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1051 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1052 | "of:0000000000006021/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1053 | "of:0000000000003011/1", |
| 1054 | ethType='IPV4', |
| 1055 | ethSrc=macsDict.get( 'h21' )) |
| 1056 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1057 | if ptpIntentResult == main.TRUE: |
| 1058 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1059 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1060 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1061 | |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1062 | var5 = "Add point intents for mininet hosts h12 and h22 " +\ |
| 1063 | "ONOS hosts hC and h16" |
| 1064 | main.case(var5) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1065 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1066 | "of:0000000000003012/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1067 | "of:0000000000006022/1", |
| 1068 | ethType='IPV4', |
| 1069 | ethSrc=macsDict.get( 'h12' )) |
| 1070 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1071 | if ptpIntentResult == main.TRUE: |
| 1072 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1073 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1074 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1075 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1076 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1077 | "of:0000000000006022/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1078 | "of:0000000000003012/1", |
| 1079 | ethType='IPV4', |
| 1080 | ethSrc=macsDict.get( 'h22' )) |
| 1081 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1082 | if ptpIntentResult == main.TRUE: |
| 1083 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1084 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1085 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1086 | |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1087 | var6 = "Add point intents for mininet hosts h13 and h23 or" +\ |
| 1088 | " ONOS hosts hD and h17" |
| 1089 | main.case(var6) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1090 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1091 | "of:0000000000003013/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1092 | "of:0000000000006023/1", |
| 1093 | ethType='IPV4', |
| 1094 | ethSrc=macsDict.get( 'h13' )) |
| 1095 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1096 | if ptpIntentResult == main.TRUE: |
| 1097 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1098 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1099 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1100 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1101 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1102 | "of:0000000000006023/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1103 | "of:0000000000003013/1", |
| 1104 | ethType='IPV4', |
| 1105 | ethSrc=macsDict.get( 'h23' )) |
| 1106 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1107 | if ptpIntentResult == main.TRUE: |
| 1108 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1109 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1110 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1111 | |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1112 | var7 = "Add point intents for mininet hosts h14 and h24 or" +\ |
| 1113 | " ONOS hosts hE and h18" |
| 1114 | main.case(var7) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1115 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1116 | "of:0000000000003014/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1117 | "of:0000000000006024/1", |
| 1118 | ethType='IPV4', |
| 1119 | ethSrc=macsDict.get( 'h14' )) |
| 1120 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1121 | if ptpIntentResult == main.TRUE: |
| 1122 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1123 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1124 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1125 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1126 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1127 | "of:0000000000006024/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1128 | "of:0000000000003014/1", |
| 1129 | ethType='IPV4', |
| 1130 | ethSrc=macsDict.get( 'h24' )) |
| 1131 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1132 | if ptpIntentResult == main.TRUE: |
| 1133 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1134 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1135 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1136 | |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1137 | var8 = "Add point intents for mininet hosts h15 and h25 or" +\ |
| 1138 | " ONOS hosts hF and h19" |
| 1139 | main.case(var8) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1140 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1141 | "of:0000000000003015/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1142 | "of:0000000000006025/1", |
| 1143 | ethType='IPV4', |
| 1144 | ethSrc=macsDict.get( 'h15' )) |
| 1145 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1146 | if ptpIntentResult == main.TRUE: |
| 1147 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1148 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1149 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1150 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1151 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1152 | "of:0000000000006025/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1153 | "of:0000000000003015/1", |
| 1154 | ethType='IPV4', |
| 1155 | ethSrc=macsDict.get( 'h25' )) |
| 1156 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1157 | if ptpIntentResult == main.TRUE: |
| 1158 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1159 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1160 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1161 | |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1162 | var9 = "Add intents for mininet hosts h16 and h26 or" +\ |
| 1163 | " ONOS hosts h10 and h1A" |
| 1164 | main.case(var9) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1165 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1166 | "of:0000000000003016/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1167 | "of:0000000000006026/1", |
| 1168 | ethType='IPV4', |
| 1169 | ethSrc=macsDict.get( 'h16' )) |
| 1170 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1171 | if ptpIntentResult == main.TRUE: |
| 1172 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1173 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1174 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1175 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1176 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1177 | "of:0000000000006026/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1178 | "of:0000000000003016/1", |
| 1179 | ethType='IPV4', |
| 1180 | ethSrc=macsDict.get( 'h26' )) |
| 1181 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1182 | if ptpIntentResult == main.TRUE: |
| 1183 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1184 | main.log.info( "Point to point intent install successful" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1185 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1186 | |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1187 | var10 = "Add point intents for mininet hosts h17 and h27 or" +\ |
| 1188 | " ONOS hosts h11 and h1B" |
| 1189 | main.case(var10) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1190 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1191 | "of:0000000000003017/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1192 | "of:0000000000006027/1", |
| 1193 | ethType='IPV4', |
| 1194 | ethSrc=macsDict.get( 'h17' )) |
| 1195 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1196 | if ptpIntentResult == main.TRUE: |
| 1197 | getIntentResult = main.ONOScli1.intents() |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1198 | main.log.info( "Point to point intent install successful" ) |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1199 | #main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1200 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1201 | ptpIntentResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1202 | "of:0000000000006027/1", |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1203 | "of:0000000000003017/1", |
| 1204 | ethType='IPV4', |
| 1205 | ethSrc=macsDict.get( 'h27' )) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1206 | |
| 1207 | print( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1208 | "_______________________________________________________" + |
| 1209 | "________________________________" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1210 | |
| 1211 | flowHandle = main.ONOScli1.flows() |
shahshreya | bf739d8 | 2015-06-10 11:22:31 -0700 | [diff] [blame] | 1212 | print "flowHandle = ", flowHandle |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1213 | main.log.info( "flows :" + flowHandle ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1214 | |
| 1215 | count = 1 |
| 1216 | i = 8 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1217 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1218 | while i < 18: |
| 1219 | main.log.info( |
| 1220 | "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) ) |
| 1221 | ping = main.Mininet1.pingHost( |
| 1222 | src="h" + str( i ), target="h" + str( i + 10 ) ) |
| 1223 | if ping == main.FALSE and count < 5: |
| 1224 | count += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1225 | # i = 8 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1226 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1227 | main.log.report( "Ping between h" + |
| 1228 | str( i ) + |
| 1229 | " and h" + |
| 1230 | str( i + |
| 1231 | 10 ) + |
| 1232 | " failed. Making attempt number " + |
| 1233 | str( count ) + |
| 1234 | " in 2 seconds" ) |
| 1235 | time.sleep( 2 ) |
| 1236 | elif ping == main.FALSE: |
| 1237 | main.log.report( "All ping attempts between h" + |
| 1238 | str( i ) + |
| 1239 | " and h" + |
| 1240 | str( i + |
| 1241 | 10 ) + |
| 1242 | "have failed" ) |
| 1243 | i = 19 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1244 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1245 | elif ping == main.TRUE: |
| 1246 | main.log.info( "Ping test between h" + |
| 1247 | str( i ) + |
| 1248 | " and h" + |
| 1249 | str( i + |
| 1250 | 10 ) + |
| 1251 | "passed!" ) |
| 1252 | i += 1 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1253 | PingResult = main.TRUE |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1254 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1255 | main.log.info( "Unknown error" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1256 | PingResult = main.ERROR |
| 1257 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1258 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1259 | "Ping all test after Point intents" + |
| 1260 | " addition failed. Cleaning up" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1261 | # main.cleanup() |
| 1262 | # main.exit() |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1263 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1264 | main.log.report( |
| 1265 | "Ping all test after Point intents addition successful" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1266 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1267 | case8Result = PingResult |
| 1268 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1269 | expect=main.TRUE, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1270 | actual=case8Result, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1271 | onpass="Ping all test after Point intents addition successful", |
| 1272 | onfail="Ping all test after Point intents addition failed" ) |
shahshreya | 4e13a06 | 2014-11-11 16:46:18 -0800 | [diff] [blame] | 1273 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1274 | def CASE31( self ): |
| 1275 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1276 | This test case adds point intent related to |
| 1277 | SDN-IP matching on ICMP ( ethertype=IPV4, ipProto=1 ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1278 | """ |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1279 | import json |
| 1280 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1281 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1282 | "This test case adds point intent " + |
| 1283 | "related to SDN-IP matching on ICMP" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1284 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1285 | "Adding bidirectional point intent related" + |
| 1286 | " to SDN-IP matching on ICMP" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1287 | main.step( "Adding bidirectional point intent" ) |
| 1288 | # add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 |
| 1289 | # --ethType=IPV4 --ipProto=1 of:0000000000003008/1 |
| 1290 | # of:0000000000006018/1 |
| 1291 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1292 | hostsJson = json.loads( main.ONOScli1.hosts() ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1293 | for i in range( 8, 11 ): |
| 1294 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1295 | "Adding point intent between h" + str( i ) + |
| 1296 | " and h" + str( i + 10 ) ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1297 | host1 = "00:00:00:00:00:" + \ |
| 1298 | str( hex( i )[ 2: ] ).zfill( 2 ).upper() |
| 1299 | host2 = "00:00:00:00:00:" + \ |
| 1300 | str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper() |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1301 | host1Id = main.ONOScli1.getHost( host1 )[ 'id' ] |
| 1302 | host2Id = main.ONOScli1.getHost( host2 )[ 'id' ] |
| 1303 | for host in hostsJson: |
| 1304 | if host[ 'id' ] == host1Id: |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1305 | ip1 = host[ 'ipAddresses' ][ 0 ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1306 | ip1 = str( ip1 + "/32" ) |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1307 | device1 = host[ 'location' ][ 'elementId' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1308 | device1 = str( device1 + "/1" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1309 | elif host[ 'id' ] == host2Id: |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1310 | ip2 = str( host[ 'ipAddresses' ][ 0 ] ) + "/32" |
| 1311 | device2 = host[ 'location' ][ 'elementId' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1312 | device2 = str( device2 + "/1" ) |
| 1313 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1314 | pIntentResult1 = main.ONOScli1.addPointIntent( |
| 1315 | ingressDevice=device1, |
| 1316 | egressDevice=device2, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1317 | ipSrc=ip1, |
| 1318 | ipDst=ip2, |
| 1319 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1320 | ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ], ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1321 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1322 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1323 | main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1324 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1325 | pIntentResult2 = main.ONOScli1.addPointIntent( |
| 1326 | ingressDevice=device2, |
| 1327 | egressDevice=device1, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1328 | ipSrc=ip2, |
| 1329 | ipDst=ip1, |
| 1330 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1331 | ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ] ) |
| 1332 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1333 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1334 | main.log.info( getIntentResult ) |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1335 | if ( pIntentResult1 and pIntentResult2 ) : |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1336 | # getIntentResult = main.ONOScli1.intents() |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1337 | # main.log.info( getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1338 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1339 | "Point intent related to SDN-IP matching" + |
| 1340 | " on ICMP install successful" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1341 | |
| 1342 | time.sleep( 15 ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1343 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1344 | main.log.info( "intents = " + getIntentResult ) |
| 1345 | getFlowsResult = main.ONOScli1.flows() |
| 1346 | main.log.info( "flows = " + getFlowsResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1347 | |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1348 | count = 1 |
| 1349 | i = 8 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1350 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1351 | while i < 11: |
| 1352 | main.log.info( |
| 1353 | "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) ) |
| 1354 | ping = main.Mininet1.pingHost( |
| 1355 | src="h" + str( i ), target="h" + str( i + 10 ) ) |
| 1356 | if ping == main.FALSE and count < 3: |
| 1357 | count += 1 |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1358 | # i = 8 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1359 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1360 | main.log.report( "Ping between h" + |
| 1361 | str( i ) + |
| 1362 | " and h" + |
| 1363 | str( i + |
| 1364 | 10 ) + |
| 1365 | " failed. Making attempt number " + |
| 1366 | str( count ) + |
| 1367 | " in 2 seconds" ) |
| 1368 | time.sleep( 2 ) |
| 1369 | elif ping == main.FALSE: |
| 1370 | main.log.report( "All ping attempts between h" + |
| 1371 | str( i ) + |
| 1372 | " and h" + |
| 1373 | str( i + |
| 1374 | 10 ) + |
| 1375 | "have failed" ) |
| 1376 | i = 19 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1377 | PingResult = main.FALSE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1378 | elif ping == main.TRUE: |
| 1379 | main.log.info( "Ping test between h" + |
| 1380 | str( i ) + |
| 1381 | " and h" + |
| 1382 | str( i + |
| 1383 | 10 ) + |
| 1384 | "passed!" ) |
| 1385 | i += 1 |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1386 | PingResult = main.TRUE |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1387 | else: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1388 | main.log.info( "Unknown error" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1389 | PingResult = main.ERROR |
| 1390 | if PingResult == main.FALSE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1391 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1392 | "Ping test after Point intents related to" + |
| 1393 | " SDN-IP matching on ICMP failed." ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1394 | # main.cleanup() |
| 1395 | # main.exit() |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1396 | if PingResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1397 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1398 | "Ping all test after Point intents related to" + |
| 1399 | " SDN-IP matching on ICMP successful" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1400 | |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1401 | case31Result = PingResult |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1402 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1403 | expect=main.TRUE, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1404 | actual=case31Result, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1405 | onpass="Point intent related to SDN-IP " + |
| 1406 | "matching on ICMP and ping test successful", |
| 1407 | onfail="Point intent related to SDN-IP" + |
| 1408 | " matching on ICMP and ping test failed" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1409 | |
| 1410 | def CASE32( self ): |
| 1411 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1412 | This test case adds point intent related to SDN-IP matching on TCP |
| 1413 | ( ethertype=IPV4, ipProto=6, DefaultPort for iperf=5001 ) |
| 1414 | Note: Although BGP port is 179, we are using 5001 because iperf |
| 1415 | is used for verifying and iperf's default port is 5001 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1416 | """ |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1417 | import json |
| 1418 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1419 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1420 | "This test case adds point intent" + |
| 1421 | " related to SDN-IP matching on TCP" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1422 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1423 | "Adding bidirectional point intent related" + |
| 1424 | " to SDN-IP matching on TCP" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1425 | main.step( "Adding bidirectional point intent" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1426 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1427 | add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 |
| 1428 | --ethType=IPV4 --ipProto=6 --tcpDst=5001 of:0000000000003008/1 |
| 1429 | of:0000000000006018/1 |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1430 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1431 | add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 |
| 1432 | --ethType=IPV4 --ipProto=6 --tcpDst=5001 of:0000000000006018/1 |
| 1433 | of:0000000000003008/1 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1434 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1435 | add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 |
| 1436 | --ethType=IPV4 --ipProto=6 --tcpSrc=5001 of:0000000000003008/1 |
| 1437 | of:0000000000006018/1 |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1438 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1439 | add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 |
| 1440 | --ethType=IPV4 --ipProto=6 --tcpSrc=5001 of:0000000000006018/1 |
| 1441 | of:0000000000003008/1 |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1442 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1443 | """ |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1444 | hostsJson = json.loads( main.ONOScli1.hosts() ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1445 | for i in range( 8, 9 ): |
| 1446 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1447 | "Adding point intent between h" + str( i ) + |
| 1448 | " and h" + str( i + 10 ) ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1449 | host1 = "00:00:00:00:00:" + \ |
| 1450 | str( hex( i )[ 2: ] ).zfill( 2 ).upper() |
| 1451 | host2 = "00:00:00:00:00:" + \ |
| 1452 | str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper() |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1453 | host1Id = main.ONOScli1.getHost( host1 )[ 'id' ] |
| 1454 | host2Id = main.ONOScli1.getHost( host2 )[ 'id' ] |
| 1455 | for host in hostsJson: |
| 1456 | if host[ 'id' ] == host1Id: |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1457 | ip1 = host[ 'ipAddresses' ][ 0 ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1458 | ip1 = str( ip1 + "/32" ) |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1459 | device1 = host[ 'location' ][ 'elementId' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1460 | device1 = str( device1 + "/1" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1461 | elif host[ 'id' ] == host2Id: |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1462 | ip2 = str( host[ 'ipAddresses' ][ 0 ] ) + "/32" |
| 1463 | device2 = host[ 'location' ][ 'elementId' ] |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1464 | device2 = str( device2 + "/1" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1465 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1466 | pIntentResult1 = main.ONOScli1.addPointIntent( |
| 1467 | ingressDevice=device1, |
| 1468 | egressDevice=device2, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1469 | ipSrc=ip1, |
| 1470 | ipDst=ip2, |
| 1471 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1472 | ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ], |
| 1473 | tcpDst=main.params[ 'SDNIP' ][ 'dstPort' ] ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1474 | pIntentResult2 = main.ONOScli1.addPointIntent( |
| 1475 | ingressDevice=device2, |
| 1476 | egressDevice=device1, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1477 | ipSrc=ip2, |
| 1478 | ipDst=ip1, |
| 1479 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1480 | ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ], |
| 1481 | tcpDst=main.params[ 'SDNIP' ][ 'dstPort' ] ) |
| 1482 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1483 | pIntentResult3 = main.ONOScli1.addPointIntent( |
| 1484 | ingressDevice=device1, |
| 1485 | egressDevice=device2, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1486 | ipSrc=ip1, |
| 1487 | ipDst=ip2, |
| 1488 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1489 | ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ], |
| 1490 | tcpSrc=main.params[ 'SDNIP' ][ 'srcPort' ] ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1491 | pIntentResult4 = main.ONOScli1.addPointIntent( |
| 1492 | ingressDevice=device2, |
| 1493 | egressDevice=device1, |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1494 | ipSrc=ip2, |
| 1495 | ipDst=ip1, |
| 1496 | ethType=main.params[ 'SDNIP' ][ 'ethType' ], |
| 1497 | ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ], |
| 1498 | tcpSrc=main.params[ 'SDNIP' ][ 'srcPort' ] ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1499 | |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 1500 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1501 | main.log.info( getIntentResult ) |
| 1502 | pIntentResult = main.TRUE |
| 1503 | if getIntentResult: |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 1504 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1505 | "Point intent related to SDN-IP matching" + |
| 1506 | " on TCP install successful" ) |
shahshreya | b512cd0 | 2015-01-27 17:01:47 -0800 | [diff] [blame] | 1507 | else: |
| 1508 | main.log.report( |
| 1509 | "Point intent related to SDN-IP matching" + |
| 1510 | " on TCP install failed" ) |
shahshreya | 234a168 | 2015-05-27 15:41:56 -0700 | [diff] [blame] | 1511 | pIntentResult = main.FALSE |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1512 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1513 | iperfResult = main.Mininet1.iperf( 'h8', 'h18' ) |
| 1514 | if iperfResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1515 | main.log.report( "iperf test successful" ) |
| 1516 | else: |
| 1517 | main.log.report( "iperf test failed" ) |
shahshreya | e6c7cf4 | 2014-11-26 16:39:01 -0800 | [diff] [blame] | 1518 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1519 | case32Result = pIntentResult and iperfResult |
| 1520 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1521 | expect=main.TRUE, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1522 | actual=case32Result, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1523 | onpass="Ping all test after Point intents addition related " + |
| 1524 | "to SDN-IP on TCP match successful", |
| 1525 | onfail="Ping all test after Point intents addition related " + |
| 1526 | "to SDN-IP on TCP match failed" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1527 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1528 | def CASE33( self ): |
| 1529 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1530 | This test case adds multipoint to singlepoint intent related to |
| 1531 | SDN-IP matching on destination ip and the action is to rewrite |
| 1532 | the mac address |
| 1533 | Here the mac address to be rewritten is the mac address of the |
| 1534 | egress device |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1535 | """ |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1536 | import json |
| 1537 | import time |
| 1538 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1539 | main.log.report( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1540 | "This test case adds multipoint to singlepoint intent related to" + |
| 1541 | " SDN-IP matching on destination ip and " + |
| 1542 | "rewrite mac address action" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1543 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1544 | "Adding multipoint to singlepoint intent related to SDN-IP" + |
| 1545 | " matching on destination ip" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1546 | main.step( "Adding bidirectional multipoint to singlepoint intent" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1547 | """ |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1548 | add-multi-to-single-intent --ipDst=10.0.3.0/24 |
| 1549 | --setEthDst=00:00:00:00:00:12 of:0000000000003008/1 0000000000003009/1 |
| 1550 | of:0000000000006018/1 |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1551 | |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1552 | add-multi-to-single-intent --ipDst=10.0.1.0/24 |
| 1553 | --setEthDst=00:00:00:00:00:08 of:0000000000006018/1 0000000000003009/1 |
| 1554 | of:0000000000003008/1 |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1555 | """ |
| 1556 | main.case( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1557 | "Installing multipoint to single point " + |
| 1558 | "intent with rewrite mac address" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1559 | main.step( "Uninstalling proxy arp app" ) |
shahshreya | d524a94 | 2015-04-21 09:55:16 -0700 | [diff] [blame] | 1560 | # deactivating proxyarp app |
| 1561 | appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.proxyarp" ) |
| 1562 | appCheck = main.ONOScli1.appToIDCheck() |
| 1563 | if appCheck != main.TRUE: |
| 1564 | main.log.warn( main.ONOScli1.apps() ) |
| 1565 | main.log.warn( main.ONOScli1.appIDs() ) |
| 1566 | time.sleep( 30 ) |
| 1567 | main.log.info( "onos-app-proxyarp deactivated" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1568 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1569 | main.step( "Changing ipaddress of hosts h8,h9 and h18" ) |
| 1570 | main.Mininet1.changeIP( |
| 1571 | host='h8', |
| 1572 | intf='h8-eth0', |
| 1573 | newIP='10.0.1.1', |
| 1574 | newNetmask='255.255.255.0' ) |
| 1575 | main.Mininet1.changeIP( |
| 1576 | host='h9', |
| 1577 | intf='h9-eth0', |
| 1578 | newIP='10.0.2.1', |
| 1579 | newNetmask='255.255.255.0' ) |
| 1580 | main.Mininet1.changeIP( |
| 1581 | host='h10', |
| 1582 | intf='h10-eth0', |
| 1583 | newIP='10.0.3.1', |
| 1584 | newNetmask='255.255.255.0' ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1585 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1586 | main.step( "Changing default gateway of hosts h8,h9 and h18" ) |
| 1587 | main.Mininet1.changeDefaultGateway( host='h8', newGW='10.0.1.254' ) |
| 1588 | main.Mininet1.changeDefaultGateway( host='h9', newGW='10.0.2.254' ) |
| 1589 | main.Mininet1.changeDefaultGateway( host='h10', newGW='10.0.3.254' ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1590 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1591 | main.step( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1592 | "Assigning random mac address to the default gateways " + |
| 1593 | "since proxyarp app is uninstalled" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1594 | main.Mininet1.addStaticMACAddress( |
| 1595 | host='h8', |
| 1596 | GW='10.0.1.254', |
| 1597 | macaddr='00:00:00:00:11:11' ) |
| 1598 | main.Mininet1.addStaticMACAddress( |
| 1599 | host='h9', |
| 1600 | GW='10.0.2.254', |
| 1601 | macaddr='00:00:00:00:22:22' ) |
| 1602 | main.Mininet1.addStaticMACAddress( |
| 1603 | host='h10', |
| 1604 | GW='10.0.3.254', |
| 1605 | macaddr='00:00:00:00:33:33' ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1606 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1607 | main.step( "Verify static gateway and MAC address assignment" ) |
| 1608 | main.Mininet1.verifyStaticGWandMAC( host='h8' ) |
| 1609 | main.Mininet1.verifyStaticGWandMAC( host='h9' ) |
| 1610 | main.Mininet1.verifyStaticGWandMAC( host='h10' ) |
| 1611 | |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1612 | ingressDevice1=main.params[ 'MULTIPOINT_INTENT' ][ 'device1' ] |
| 1613 | ingressDevice2=main.params[ 'MULTIPOINT_INTENT' ][ 'device2' ] |
| 1614 | ingressDeviceList = [] |
| 1615 | ingressDeviceList.append( ingressDevice1 ) |
| 1616 | ingressDeviceList.append( ingressDevice2 ) |
| 1617 | |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1618 | main.step( "Adding multipoint to singlepoint intent" ) |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1619 | pIntentResult1 = main.ONOScli1.addMultipointToSinglepointIntent( |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1620 | ingressDeviceList, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1621 | egressDevice=main.params[ 'MULTIPOINT_INTENT' ][ 'device3' ], |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1622 | ipDst=main.params[ 'MULTIPOINT_INTENT' ][ 'ip1' ], |
| 1623 | setEthDst=main.params[ 'MULTIPOINT_INTENT' ][ 'mac1' ] ) |
| 1624 | |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1625 | ingressDevice1=main.params[ 'MULTIPOINT_INTENT' ][ 'device3' ] |
| 1626 | ingressDevice2=main.params[ 'MULTIPOINT_INTENT' ][ 'device2' ] |
| 1627 | ingressDeviceList = [ingressDevice1, ingressDevice2] |
| 1628 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1629 | pIntentResult2 = main.ONOScli1.addMultipointToSinglepointIntent( |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1630 | ingressDeviceList, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1631 | egressDevice=main.params[ 'MULTIPOINT_INTENT' ][ 'device1' ], |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1632 | ipDst=main.params[ 'MULTIPOINT_INTENT' ][ 'ip2' ], |
| 1633 | setEthDst=main.params[ 'MULTIPOINT_INTENT' ][ 'mac2' ] ) |
| 1634 | |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1635 | pIntentResult = pIntentResult1 and pIntentResult2 |
| 1636 | if pIntentResult == main.FALSE: |
| 1637 | main.log.info( |
| 1638 | "Multi point to single point intent " + |
| 1639 | "installation failed" ) |
| 1640 | else: |
| 1641 | pIntentResult = main.TRUE |
| 1642 | getIntentResult = main.ONOScli1.intents( jsonFormat=False ) |
| 1643 | main.log.info( "intents = " + getIntentResult ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1644 | |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1645 | time.sleep( 10 ) |
| 1646 | getFlowsResult = main.ONOScli1.flows( jsonFormat=False ) |
| 1647 | main.log.info( "flows = " + getFlowsResult ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1648 | |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1649 | count = 1 |
| 1650 | i = 8 |
| 1651 | PingResult = main.TRUE |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1652 | |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1653 | main.log.info( "\n\nh" + str( i ) + " is Pinging h" + str( i + 2 ) ) |
| 1654 | ping = main.Mininet1.pingHost( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1655 | src="h" + str( i ), target="h" + str( i + 2 ) ) |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1656 | if ping == main.FALSE and count < 3: |
| 1657 | count += 1 |
| 1658 | PingResult = main.FALSE |
| 1659 | main.log.report( "Ping between h" + |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1660 | str( i ) + |
| 1661 | " and h" + |
| 1662 | str( i + |
| 1663 | 2 ) + |
| 1664 | " failed. Making attempt number " + |
| 1665 | str( count ) + |
| 1666 | " in 2 seconds" ) |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1667 | time.sleep( 2 ) |
| 1668 | elif ping == main.FALSE: |
| 1669 | main.log.report( "All ping attempts between h" + |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1670 | str( i ) + |
| 1671 | " and h" + |
| 1672 | str( i + |
| 1673 | 10 ) + |
| 1674 | "have failed" ) |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1675 | PingResult = main.FALSE |
| 1676 | elif ping == main.TRUE: |
| 1677 | main.log.info( "Ping test between h" + |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1678 | str( i ) + |
| 1679 | " and h" + |
| 1680 | str( i + |
| 1681 | 2 ) + |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1682 | " passed!" ) |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1683 | PingResult = main.TRUE |
| 1684 | else: |
| 1685 | main.log.info( "Unknown error" ) |
| 1686 | PingResult = main.ERROR |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1687 | |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1688 | if PingResult == main.FALSE: |
| 1689 | main.log.report( "Ping test failed." ) |
| 1690 | # main.cleanup() |
| 1691 | # main.exit() |
| 1692 | if PingResult == main.TRUE: |
| 1693 | main.log.report( "Ping all successful" ) |
shahshreya | f1b1b9f | 2014-12-04 16:59:20 -0800 | [diff] [blame] | 1694 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1695 | if pIntentResult == main.TRUE: |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1696 | main.log.info( |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1697 | "Multi point intent with rewrite mac " + |
shahshreya | b471a3e | 2015-03-19 17:07:13 -0700 | [diff] [blame] | 1698 | "address installation and ping successful" ) |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1699 | |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1700 | case33Result = pIntentResult and PingResult |
| 1701 | utilities.assertEquals( |
kelvin-onlab | eaa2eb3 | 2015-01-16 15:58:18 -0800 | [diff] [blame] | 1702 | expect=main.TRUE, |
shahshreya | f307635 | 2015-01-23 13:52:01 -0800 | [diff] [blame] | 1703 | actual=case33Result, |
kelvin-onlab | cf33bda | 2015-01-23 16:54:17 -0800 | [diff] [blame] | 1704 | onpass="Ping all test after multipoint to single point" + |
| 1705 | " intent addition with rewrite mac address successful", |
| 1706 | onfail="Ping all test after multipoint to single point intent" + |
| 1707 | " addition with rewrite mac address failed" ) |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 1708 | |
| 1709 | def CASE20( self ): |
| 1710 | """ |
| 1711 | Exit from mininet cli |
| 1712 | reinstall ONOS |
| 1713 | """ |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1714 | import time |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 1715 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 1716 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 1717 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 1718 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 1719 | ONOS1Port = main.params[ 'CTRL' ][ 'port1' ] |
| 1720 | ONOS2Port = main.params[ 'CTRL' ][ 'port2' ] |
| 1721 | ONOS3Port = main.params[ 'CTRL' ][ 'port3' ] |
| 1722 | |
| 1723 | main.log.report( "This testcase exits the mininet cli and reinstalls" + |
| 1724 | "ONOS to switch over to Packet Optical topology" ) |
| 1725 | main.log.report( "_____________________________________________" ) |
| 1726 | main.case( "Disconnecting mininet and restarting ONOS" ) |
| 1727 | main.step( "Disconnecting mininet and restarting ONOS" ) |
| 1728 | mininetDisconnect = main.Mininet1.disconnect() |
| 1729 | print "mininetDisconnect = ", mininetDisconnect |
| 1730 | |
| 1731 | main.step( "Removing raft logs before a clen installation of ONOS" ) |
| 1732 | main.ONOSbench.onosRemoveRaftLogs() |
| 1733 | |
| 1734 | main.step( "Applying cell variable to environment" ) |
| 1735 | cellResult = main.ONOSbench.setCell( cellName ) |
| 1736 | verifyResult = main.ONOSbench.verifyCell() |
| 1737 | |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1738 | time.sleep( 5 ) |
| 1739 | main.step( "Uninstalling ONOS package" ) |
| 1740 | onos1UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS1Ip) |
| 1741 | onos2UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS2Ip) |
| 1742 | onos3UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS3Ip) |
| 1743 | onosUninstallResult = onos1UninstallResult and onos2UninstallResult \ |
| 1744 | and onos3UninstallResult |
| 1745 | time.sleep( 15 ) |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 1746 | main.step( "Installing ONOS package" ) |
| 1747 | onos1InstallResult = main.ONOSbench.onosInstall( |
| 1748 | options="-f", |
| 1749 | node=ONOS1Ip ) |
| 1750 | onos2InstallResult = main.ONOSbench.onosInstall( |
| 1751 | options="-f", |
| 1752 | node=ONOS2Ip ) |
| 1753 | onos3InstallResult = main.ONOSbench.onosInstall( |
| 1754 | options="-f", |
| 1755 | node=ONOS3Ip ) |
| 1756 | onosInstallResult = onos1InstallResult and onos2InstallResult and\ |
| 1757 | onos3InstallResult |
| 1758 | if onosInstallResult == main.TRUE: |
| 1759 | main.log.report( "Installing ONOS package successful" ) |
| 1760 | else: |
| 1761 | main.log.report( "Installing ONOS package failed" ) |
| 1762 | |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1763 | time.sleep( 10 ) |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 1764 | onos1Isup = main.ONOSbench.isup( ONOS1Ip ) |
| 1765 | onos2Isup = main.ONOSbench.isup( ONOS2Ip ) |
| 1766 | onos3Isup = main.ONOSbench.isup( ONOS3Ip ) |
| 1767 | onosIsup = onos1Isup and onos2Isup and onos3Isup |
| 1768 | if onosIsup == main.TRUE: |
| 1769 | main.log.report( "ONOS instances are up and ready" ) |
| 1770 | else: |
| 1771 | main.log.report( "ONOS instances may not be up" ) |
| 1772 | |
| 1773 | main.step( "Starting ONOS service" ) |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1774 | time.sleep( 10 ) |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 1775 | startResult = main.TRUE |
| 1776 | # startResult = main.ONOSbench.onosStart( ONOS1Ip ) |
| 1777 | startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip ) |
| 1778 | startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip ) |
| 1779 | startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip ) |
| 1780 | startResult = startcli1 and startcli2 and startcli3 |
| 1781 | if startResult == main.TRUE: |
| 1782 | main.log.report( "ONOS cli starts properly" ) |
| 1783 | case20Result = mininetDisconnect and cellResult and verifyResult \ |
| 1784 | and onosInstallResult and onosIsup and startResult |
| 1785 | |
| 1786 | utilities.assert_equals( |
| 1787 | expect=main.TRUE, |
| 1788 | actual=case20Result, |
| 1789 | onpass= "Exiting functionality mininet topology and reinstalling" + |
| 1790 | " ONOS successful", |
| 1791 | onfail= "Exiting functionality mininet topology and reinstalling" + |
| 1792 | " ONOS failed" ) |
| 1793 | |
| 1794 | def CASE21( self, main ): |
| 1795 | """ |
| 1796 | On ONOS bench, run this command: |
| 1797 | sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1 <Ctrls> |
| 1798 | which spawns packet optical topology and copies the links |
| 1799 | json file to the onos instance. |
| 1800 | Note that in case of Packet Optical, the links are not learnt |
| 1801 | from the topology, instead the links are learnt |
| 1802 | from the json config file |
| 1803 | """ |
| 1804 | main.log.report( |
| 1805 | "This testcase starts the packet layer topology and REST" ) |
| 1806 | main.log.report( "_____________________________________________" ) |
| 1807 | main.case( "Starting LINC-OE and other components" ) |
| 1808 | main.step( "Starting LINC-OE and other components" ) |
| 1809 | main.log.info( "Activate optical app" ) |
| 1810 | appInstallResult = main.ONOScli1.activateApp( "org.onosproject.optical" ) |
| 1811 | appCheck = main.ONOScli1.appToIDCheck() |
| 1812 | appCheck = appCheck and main.ONOScli2.appToIDCheck() |
| 1813 | appCheck = appCheck and main.ONOScli3.appToIDCheck() |
| 1814 | if appCheck != main.TRUE: |
| 1815 | main.log.warn( "Checking ONOS application unsuccesful" ) |
| 1816 | |
| 1817 | ctrllerIP = [] |
| 1818 | ctrllerIP.append( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 1819 | #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip2' ] ) |
| 1820 | #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip3' ] ) |
| 1821 | opticalMnScript = main.LincOE2.runOpticalMnScript( ctrllerIP = ctrllerIP ) |
| 1822 | case21Result = opticalMnScript and appInstallResult |
| 1823 | utilities.assert_equals( |
| 1824 | expect=main.TRUE, |
| 1825 | actual=case21Result, |
| 1826 | onpass="Packet optical topology spawned successsfully", |
| 1827 | onfail="Packet optical topology spawning failed" ) |
| 1828 | |
| 1829 | def CASE22( self, main ): |
| 1830 | """ |
| 1831 | Curretly we use, 10 optical switches(ROADM's) and |
| 1832 | 6 packet layer mininet switches each with one host. |
| 1833 | Therefore, the roadmCount variable = 10, |
| 1834 | packetLayerSWCount variable = 6, hostCount=6 and |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1835 | links=46. |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 1836 | All this is hardcoded in the testcase. If the topology changes, |
| 1837 | these hardcoded values need to be changed |
| 1838 | """ |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1839 | import time |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 1840 | main.log.report( |
| 1841 | "This testcase compares the optical+packet topology against what" + |
| 1842 | " is expected" ) |
| 1843 | main.case( "Topology comparision" ) |
| 1844 | main.step( "Topology comparision" ) |
| 1845 | devicesResult = main.ONOScli3.devices( jsonFormat=False ) |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1846 | time.sleep( 15 ) |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 1847 | print "devices_result = ", devicesResult |
| 1848 | devicesLinewise = devicesResult.split( "\n" ) |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 1849 | roadmCount = 0 |
| 1850 | packetLayerSWCount = 0 |
| 1851 | for line in devicesLinewise: |
| 1852 | components = line.split( "," ) |
| 1853 | availability = components[ 1 ].split( "=" )[ 1 ] |
| 1854 | type = components[ 3 ].split( "=" )[ 1 ] |
| 1855 | if availability == 'true' and type == 'ROADM': |
| 1856 | roadmCount += 1 |
| 1857 | elif availability == 'true' and type == 'SWITCH': |
| 1858 | packetLayerSWCount += 1 |
| 1859 | if roadmCount == 10: |
| 1860 | print "Number of Optical Switches = %d and is" % roadmCount +\ |
| 1861 | " correctly detected" |
| 1862 | main.log.info( |
| 1863 | "Number of Optical Switches = " + |
| 1864 | str( roadmCount ) + |
| 1865 | " and is correctly detected" ) |
| 1866 | opticalSWResult = main.TRUE |
| 1867 | else: |
| 1868 | print "Number of Optical Switches = %d and is wrong" % roadmCount |
| 1869 | main.log.info( |
| 1870 | "Number of Optical Switches = " + |
| 1871 | str( roadmCount ) + |
| 1872 | " and is wrong" ) |
| 1873 | opticalSWResult = main.FALSE |
| 1874 | |
| 1875 | if packetLayerSWCount == 6: |
| 1876 | print "Number of Packet layer or mininet Switches = %d "\ |
| 1877 | % packetLayerSWCount + "and is correctly detected" |
| 1878 | main.log.info( |
| 1879 | "Number of Packet layer or mininet Switches = " + |
| 1880 | str( packetLayerSWCount ) + |
| 1881 | " and is correctly detected" ) |
| 1882 | packetSWResult = main.TRUE |
| 1883 | else: |
| 1884 | print "Number of Packet layer or mininet Switches = %d and"\ |
| 1885 | % packetLayerSWCount + " is wrong" |
| 1886 | main.log.info( |
| 1887 | "Number of Packet layer or mininet Switches = " + |
| 1888 | str( packetLayerSWCount ) + |
| 1889 | " and is wrong" ) |
| 1890 | packetSWResult = main.FALSE |
| 1891 | print "_________________________________" |
| 1892 | |
| 1893 | linksResult = main.ONOScli3.links( jsonFormat=False ) |
| 1894 | print "links_result = ", linksResult |
| 1895 | print "_________________________________" |
| 1896 | linkActiveCount = linksResult.count("state=ACTIVE") |
| 1897 | main.log.info( "linkActiveCount = " + str( linkActiveCount )) |
shahshreya | a47ebf4 | 2015-05-20 13:29:18 -0700 | [diff] [blame] | 1898 | if linkActiveCount == 46: |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 1899 | linkActiveResult = main.TRUE |
| 1900 | main.log.info( |
| 1901 | "Number of links in ACTIVE state are correct") |
| 1902 | else: |
| 1903 | linkActiveResult = main.FALSE |
| 1904 | main.log.info( |
| 1905 | "Number of links in ACTIVE state are wrong") |
| 1906 | |
| 1907 | case22Result = opticalSWResult and packetSWResult and \ |
| 1908 | linkActiveResult |
| 1909 | utilities.assert_equals( |
| 1910 | expect=main.TRUE, |
| 1911 | actual=case22Result, |
| 1912 | onpass="Packet optical topology discovery successful", |
| 1913 | onfail="Packet optical topology discovery failed" ) |
| 1914 | |
| 1915 | def CASE23( self, main ): |
| 1916 | import time |
| 1917 | """ |
| 1918 | Add bidirectional point intents between 2 packet layer( mininet ) |
| 1919 | devices and |
| 1920 | ping mininet hosts |
| 1921 | """ |
| 1922 | main.log.report( |
| 1923 | "This testcase adds bidirectional point intents between 2 " + |
| 1924 | "packet layer( mininet ) devices and ping mininet hosts" ) |
| 1925 | main.case( "Topology comparision" ) |
| 1926 | main.step( "Adding point intents" ) |
| 1927 | ptpIntentResult = main.ONOScli1.addPointIntent( |
| 1928 | "of:0000ffffffff0001/1", |
| 1929 | "of:0000ffffffff0005/1" ) |
| 1930 | if ptpIntentResult == main.TRUE: |
| 1931 | main.ONOScli1.intents( jsonFormat=False ) |
| 1932 | main.log.info( "Point to point intent install successful" ) |
| 1933 | |
| 1934 | ptpIntentResult = main.ONOScli1.addPointIntent( |
| 1935 | "of:0000ffffffff0005/1", |
| 1936 | "of:0000ffffffff0001/1" ) |
| 1937 | if ptpIntentResult == main.TRUE: |
| 1938 | main.ONOScli1.intents( jsonFormat=False ) |
| 1939 | main.log.info( "Point to point intent install successful" ) |
| 1940 | |
| 1941 | time.sleep( 30 ) |
shahshreya | bf739d8 | 2015-06-10 11:22:31 -0700 | [diff] [blame] | 1942 | #flowHandle = main.ONOScli1.flows() |
| 1943 | #main.log.info( "flows :" + flowHandle ) |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 1944 | |
| 1945 | # Sleep for 30 seconds to provide time for the intent state to change |
| 1946 | time.sleep( 60 ) |
| 1947 | intentHandle = main.ONOScli1.intents( jsonFormat=False ) |
| 1948 | main.log.info( "intents :" + intentHandle ) |
| 1949 | |
| 1950 | PingResult = main.TRUE |
| 1951 | count = 1 |
| 1952 | main.log.info( "\n\nh1 is Pinging h5" ) |
| 1953 | ping = main.LincOE2.pingHostOptical( src="h1", target="h5" ) |
| 1954 | # ping = main.LincOE2.pinghost() |
| 1955 | if ping == main.FALSE and count < 5: |
| 1956 | count += 1 |
| 1957 | PingResult = main.FALSE |
| 1958 | main.log.info( |
| 1959 | "Ping between h1 and h5 failed. Making attempt number " + |
| 1960 | str( count ) + |
| 1961 | " in 2 seconds" ) |
| 1962 | time.sleep( 2 ) |
| 1963 | elif ping == main.FALSE: |
| 1964 | main.log.info( "All ping attempts between h1 and h5 have failed" ) |
| 1965 | PingResult = main.FALSE |
| 1966 | elif ping == main.TRUE: |
| 1967 | main.log.info( "Ping test between h1 and h5 passed!" ) |
| 1968 | PingResult = main.TRUE |
| 1969 | else: |
| 1970 | main.log.info( "Unknown error" ) |
| 1971 | PingResult = main.ERROR |
| 1972 | |
| 1973 | if PingResult == main.FALSE: |
| 1974 | main.log.report( |
| 1975 | "Point intents for packet optical have not ben installed" + |
| 1976 | " correctly. Cleaning up" ) |
| 1977 | if PingResult == main.TRUE: |
| 1978 | main.log.report( |
| 1979 | "Point Intents for packet optical have been " + |
| 1980 | "installed correctly" ) |
| 1981 | |
| 1982 | case23Result = PingResult |
| 1983 | utilities.assert_equals( |
| 1984 | expect=main.TRUE, |
| 1985 | actual=case23Result, |
| 1986 | onpass= "Point intents addition for packet optical and" + |
| 1987 | "Pingall Test successful", |
| 1988 | onfail= "Point intents addition for packet optical and" + |
| 1989 | "Pingall Test NOT successful" ) |
| 1990 | |
| 1991 | def CASE24( self, main ): |
| 1992 | import time |
| 1993 | import json |
| 1994 | """ |
| 1995 | LINC uses its own switch IDs. You can use the following |
| 1996 | command on the LINC console to find the mapping between |
| 1997 | DPIDs and LINC IDs. |
| 1998 | rp(application:get_all_key(linc)). |
| 1999 | |
| 2000 | Test Rerouting of Packet Optical by bringing a port down |
| 2001 | ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ), |
| 2002 | so that link |
| 2003 | ( between switch1 port20 - switch5 port50 ) is inactive |
| 2004 | and do a ping test. If rerouting is successful, |
| 2005 | ping should pass. also check the flows |
| 2006 | """ |
| 2007 | main.log.report( |
| 2008 | "This testcase tests rerouting and pings mininet hosts" ) |
| 2009 | main.case( "Test rerouting and pings mininet hosts" ) |
| 2010 | main.step( "Attach to the Linc-OE session" ) |
| 2011 | attachConsole = main.LincOE1.attachLincOESession() |
| 2012 | print "attachConsole = ", attachConsole |
| 2013 | |
| 2014 | main.step( "Bring a port down and verify the link state" ) |
| 2015 | main.LincOE1.portDown( swId="9", ptId="20" ) |
| 2016 | linksNonjson = main.ONOScli3.links( jsonFormat=False ) |
| 2017 | main.log.info( "links = " + linksNonjson ) |
| 2018 | |
| 2019 | linkInactiveCount = linksNonjson.count("state=INACTIVE") |
| 2020 | main.log.info( "linkInactiveCount = " + str( linkInactiveCount )) |
| 2021 | if linkInactiveCount == 2: |
| 2022 | main.log.info( |
| 2023 | "Number of links in INACTIVE state are correct") |
| 2024 | else: |
| 2025 | main.log.info( |
| 2026 | "Number of links in INACTIVE state are wrong") |
| 2027 | |
| 2028 | links = main.ONOScli3.links() |
| 2029 | main.log.info( "links = " + links ) |
| 2030 | |
| 2031 | linksResult = json.loads( links ) |
| 2032 | linksStateResult = main.FALSE |
| 2033 | for item in linksResult: |
| 2034 | if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[ |
| 2035 | 'src' ][ 'port' ] == "20": |
| 2036 | if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[ |
| 2037 | 'dst' ][ 'port' ] == "50": |
| 2038 | linksState = item[ 'state' ] |
| 2039 | if linksState == "INACTIVE": |
| 2040 | main.log.info( |
| 2041 | "Links state is inactive as expected due to one" + |
| 2042 | " of the ports being down" ) |
| 2043 | main.log.report( |
| 2044 | "Links state is inactive as expected due to one" + |
| 2045 | " of the ports being down" ) |
| 2046 | linksStateResult = main.TRUE |
| 2047 | break |
| 2048 | else: |
| 2049 | main.log.info( |
| 2050 | "Links state is not inactive as expected" ) |
| 2051 | main.log.report( |
| 2052 | "Links state is not inactive as expected" ) |
| 2053 | linksStateResult = main.FALSE |
| 2054 | |
| 2055 | print "links_state_result = ", linksStateResult |
| 2056 | time.sleep( 10 ) |
shahshreya | bf739d8 | 2015-06-10 11:22:31 -0700 | [diff] [blame] | 2057 | #flowHandle = main.ONOScli3.flows() |
| 2058 | #main.log.info( "flows :" + flowHandle ) |
shahshreya | 1f119da | 2015-04-21 17:16:46 -0700 | [diff] [blame] | 2059 | |
| 2060 | main.step( "Verify Rerouting by a ping test" ) |
| 2061 | PingResult = main.TRUE |
| 2062 | count = 1 |
| 2063 | main.log.info( "\n\nh1 is Pinging h5" ) |
| 2064 | ping = main.LincOE2.pingHostOptical( src="h1", target="h5" ) |
| 2065 | # ping = main.LincOE2.pinghost() |
| 2066 | if ping == main.FALSE and count < 5: |
| 2067 | count += 1 |
| 2068 | PingResult = main.FALSE |
| 2069 | main.log.info( |
| 2070 | "Ping between h1 and h5 failed. Making attempt number " + |
| 2071 | str( count ) + |
| 2072 | " in 2 seconds" ) |
| 2073 | time.sleep( 2 ) |
| 2074 | elif ping == main.FALSE: |
| 2075 | main.log.info( "All ping attempts between h1 and h5 have failed" ) |
| 2076 | PingResult = main.FALSE |
| 2077 | elif ping == main.TRUE: |
| 2078 | main.log.info( "Ping test between h1 and h5 passed!" ) |
| 2079 | PingResult = main.TRUE |
| 2080 | else: |
| 2081 | main.log.info( "Unknown error" ) |
| 2082 | PingResult = main.ERROR |
| 2083 | |
| 2084 | if PingResult == main.TRUE: |
| 2085 | main.log.report( "Ping test successful " ) |
| 2086 | if PingResult == main.FALSE: |
| 2087 | main.log.report( "Ping test failed" ) |
| 2088 | |
| 2089 | case24Result = PingResult and linksStateResult |
| 2090 | utilities.assert_equals( expect=main.TRUE, actual=case24Result, |
| 2091 | onpass="Packet optical rerouting successful", |
| 2092 | onfail="Packet optical rerouting failed" ) |