Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 1 | """ |
| 2 | Description: This test is an example of a simple single node ONOS test |
| 3 | |
| 4 | List of test cases: |
| 5 | CASE1: Compile ONOS and push it to the test machine |
| 6 | CASE2: Assign mastership to controller |
| 7 | CASE3: Pingall |
| 8 | """ |
| 9 | class PingallExample: |
| 10 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 11 | def __init__( self ): |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 12 | self.default = '' |
| 13 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 14 | def CASE1( self, main ): |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 15 | """ |
| 16 | CASE1 is to compile ONOS and push it to the test machines |
| 17 | |
| 18 | Startup sequence: |
| 19 | git pull |
| 20 | mvn clean install |
| 21 | onos-package |
| 22 | cell <name> |
| 23 | onos-verify-cell |
| 24 | onos-install -f |
| 25 | onos-wait-for-start |
| 26 | """ |
| 27 | desc = "ONOS Single node cluster restart HA test - initialization" |
| 28 | main.log.report( desc ) |
| 29 | main.case( "Setting up test environment" ) |
| 30 | |
| 31 | # load some vairables from the params file |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 32 | PULLCODE = False |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 33 | if main.params[ 'Git' ] == 'True': |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 34 | PULLCODE = True |
| 35 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 36 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 37 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 38 | |
| 39 | main.step( "Applying cell variable to environment" ) |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 40 | cellResult = main.ONOSbench.setCell( cellName ) |
| 41 | verifyResult = main.ONOSbench.verifyCell() |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 42 | |
| 43 | main.log.report( "Uninstalling ONOS" ) |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 44 | main.ONOSbench.onosUninstall( ONOS1Ip ) |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 45 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 46 | cleanInstallResult = main.TRUE |
| 47 | gitPullResult = main.TRUE |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 48 | |
| 49 | main.step( "Compiling the latest version of ONOS" ) |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 50 | if PULLCODE: |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 51 | main.step( "Git checkout and pull master" ) |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 52 | main.ONOSbench.gitCheckout( "master" ) |
| 53 | gitPullResult = main.ONOSbench.gitPull() |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 54 | |
| 55 | main.step( "Using mvn clean & install" ) |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 56 | cleanInstallResult = main.TRUE |
| 57 | if gitPullResult == main.TRUE: |
| 58 | cleanInstallResult = main.ONOSbench.cleanInstall() |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 59 | else: |
| 60 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 61 | "clean install" ) |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 62 | main.ONOSbench.getVersion( report=True ) |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 63 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 64 | cellResult = main.ONOSbench.setCell( cellName ) |
| 65 | verifyResult = main.ONOSbench.verifyCell() |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 66 | main.step( "Creating ONOS package" ) |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 67 | packageResult = main.ONOSbench.onosPackage() |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 68 | |
| 69 | main.step( "Installing ONOS package" ) |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 70 | onos1InstallResult = main.ONOSbench.onosInstall( options="-f", |
| 71 | node=ONOS1Ip ) |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 72 | |
| 73 | main.step( "Checking if ONOS is up yet" ) |
| 74 | for i in range( 2 ): |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 75 | onos1Isup = main.ONOSbench.isup( ONOS1Ip ) |
| 76 | if onos1Isup: |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 77 | break |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 78 | if not onos1Isup: |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 79 | main.log.report( "ONOS1 didn't start!" ) |
| 80 | |
| 81 | # TODO: if it becomes an issue, we can retry this step a few times |
| 82 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 83 | cliResult = main.ONOScli1.startOnosCli( ONOS1Ip ) |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 84 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 85 | case1Result = ( cleanInstallResult and packageResult and |
| 86 | cellResult and verifyResult and |
| 87 | onos1InstallResult and |
| 88 | onos1Isup and cliResult ) |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 89 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 90 | utilities.assert_equals( expect=main.TRUE, actual=case1Result, |
kelvin-onlab | a72405f | 2015-01-20 15:59:41 -0800 | [diff] [blame] | 91 | onpass="Test startup successful", |
| 92 | onfail="Test startup NOT successful" ) |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 93 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 94 | if case1Result == main.FALSE: |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 95 | main.cleanup() |
| 96 | main.exit() |
Jon Hall | 882f895 | 2015-03-26 19:43:26 -0700 | [diff] [blame] | 97 | |
kelvin-onlab | 52730b5 | 2015-02-04 16:59:18 -0800 | [diff] [blame] | 98 | # Starting the mininet using the old way |
| 99 | main.step( "Starting Mininet ..." ) |
| 100 | netIsUp = main.Mininet1.startNet() |
| 101 | if netIsUp: |
| 102 | main.log.info("Mininet CLI is up") |
| 103 | else: |
| 104 | main.log.info("Mininet CLI is down") |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 105 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 106 | def CASE2( self, main ): |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 107 | """ |
| 108 | Assign mastership to controller |
| 109 | """ |
| 110 | import re |
| 111 | |
| 112 | main.log.report( "Assigning switches to controller" ) |
| 113 | main.case( "Assigning Controller" ) |
| 114 | main.step( "Assign switches to controller" ) |
| 115 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 116 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 117 | ONOS1Port = main.params[ 'CTRL' ][ 'port1' ] |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 118 | |
| 119 | for i in range( 1, 14 ): |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 120 | main.Mininet1.assignSwController( |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 121 | sw=str( i ), |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 122 | ip1=ONOS1Ip, |
| 123 | port1=ONOS1Port ) |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 124 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 125 | mastershipCheck = main.TRUE |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 126 | for i in range( 1, 14 ): |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 127 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 128 | try: |
| 129 | main.log.info( str( response ) ) |
Jon Hall | febb1c7 | 2015-03-05 13:30:09 -0800 | [diff] [blame] | 130 | except Exception: |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 131 | main.log.info( repr( response ) ) |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 132 | if re.search( "tcp:" + ONOS1Ip, response ): |
| 133 | mastershipCheck = mastershipCheck and main.TRUE |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 134 | else: |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 135 | mastershipCheck = main.FALSE |
| 136 | if mastershipCheck == main.TRUE: |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 137 | main.log.report( "Switch mastership assigned correctly" ) |
| 138 | utilities.assert_equals( |
| 139 | expect=main.TRUE, |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 140 | actual=mastershipCheck, |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 141 | onpass="Switch mastership assigned correctly", |
| 142 | onfail="Switches not assigned correctly to controllers" ) |
| 143 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 144 | def CASE3( self, main ): |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 145 | """ |
Jon Hall | 146f152 | 2015-03-24 15:33:24 -0700 | [diff] [blame] | 146 | Install forwarding app, Pingall and unistall the app |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 147 | """ |
| 148 | import time |
| 149 | |
| 150 | main.log.report( "Run Pingall" ) |
| 151 | main.case( "Run Pingall" ) |
| 152 | |
| 153 | # install onos-app-fwd |
Jon Hall | 882f895 | 2015-03-26 19:43:26 -0700 | [diff] [blame] | 154 | main.step( "Activate reactive forwarding app" ) |
| 155 | main.ONOScli1.activateApp( "org.onosproject.fwd" ) |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 156 | |
| 157 | # REACTIVE FWD test |
Jon Hall | 882f895 | 2015-03-26 19:43:26 -0700 | [diff] [blame] | 158 | main.step( "Run the pingall command in Mininet" ) |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 159 | pingResult = main.FALSE |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 160 | time1 = time.time() |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 161 | pingResult = main.Mininet1.pingall() |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 162 | time2 = time.time() |
| 163 | main.log.info( "Time for pingall: %2f seconds" % ( time2 - time1 ) ) |
| 164 | |
| 165 | # uninstall onos-app-fwd |
kaouthera | 3f13ca2 | 2015-05-05 15:01:41 -0700 | [diff] [blame] | 166 | # main.step( "Deactivate reactive forwarding app" ) |
| 167 | #main.ONOScli1.deactivateApp( "org.onosproject.fwd" ) |
Jon Hall | f1f285d | 2015-01-12 10:58:08 -0800 | [diff] [blame] | 168 | |
kelvin-onlab | d3b6489 | 2015-01-20 13:26:24 -0800 | [diff] [blame] | 169 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
kelvin-onlab | a72405f | 2015-01-20 15:59:41 -0800 | [diff] [blame] | 170 | onpass="All hosts are reachable", |
| 171 | onfail="Some pings failed" ) |
kaouthera | 3f13ca2 | 2015-05-05 15:01:41 -0700 | [diff] [blame] | 172 | |
| 173 | def CASE25( self, main ): |
| 174 | """ |
| 175 | Activate fwd app |
| 176 | Ping selected hosts |
| 177 | Assign selected hosts vlans |
| 178 | Ping to test vlans |
| 179 | Deactivate fwd app |
| 180 | """ |
| 181 | import time |
| 182 | |
| 183 | main.log.report( "This testcase creates different vlan hosts " + |
| 184 | " and verifies that only hosts that belong " + |
| 185 | " to the same vlan can ping each others") |
| 186 | main.log.report( "___________________________________________________" ) |
| 187 | main.case( "Creating vlans and performing ping between hosts" ) |
| 188 | |
| 189 | main.step( "Activate reactive forwarding app" ) |
| 190 | main.ONOScli1.activateApp( "org.onosproject.fwd" ) |
| 191 | |
| 192 | main.step( "Activate reactive forwarding app" ) |
| 193 | main.ONOScli1.activateApp( "org.onosproject.fwd" ) |
| 194 | |
| 195 | main.step( "Verify host pinging in Mininet before creating vlans" ) |
| 196 | source1V1 = main.params[ 'VPING' ][ 'source1V1' ]['vhost'] |
| 197 | source1V2 = main.params[ 'VPING' ][ 'source1V2' ]['vhost'] |
| 198 | source1Vnone = main.params[ 'VPING' ][ 'source1Vnone' ]['vhost'] |
| 199 | target1V1 = main.params[ 'VPING' ][ 'target1V1' ]['vhost'] |
| 200 | target2V1 = main.params[ 'VPING' ][ 'target2V1' ]['vhost'] |
| 201 | target1V2 = main.params[ 'VPING' ][ 'target1V2' ]['vhost'] |
| 202 | target1Vnone = main.params[ 'VPING' ][ 'target1Vnone' ]['vhost'] |
| 203 | |
| 204 | targetIP1V1 = main.Mininet1.getIPAddress(target1V1) |
| 205 | targetIP2V1 = main.Mininet1.getIPAddress(target2V1) |
| 206 | targetIP1V2 = main.Mininet1.getIPAddress(target1V2) |
| 207 | targetIP1Vnone = main.Mininet1.getIPAddress(target1Vnone) |
| 208 | |
| 209 | for i in range(0,2): |
| 210 | ping1V1 = main.Mininet1.pingHost( src = source1V1, target = targetIP1V1) |
| 211 | ping2V1 = main.Mininet1.pingHost( src = source1V1, target = targetIP2V1) |
| 212 | ping1V2 = main.Mininet1.pingHost( src = source1V2, target = targetIP1V2) |
| 213 | pingV1V2 = main.Mininet1.pingHost( src = source1V1, target = targetIP1V2) |
| 214 | pingV2V1 = main.Mininet1.pingHost( src = source1V2, target = targetIP1V1) |
| 215 | pingV1Vnone = main.Mininet1.pingHost ( src = source1V1, target = targetIP1Vnone) |
| 216 | pingVnoneV2 = main.Mininet1.pingHost ( src = source1Vnone, target = targetIP1V2) |
| 217 | |
| 218 | pingResultBeforeVlan = ping1V1 and ping2V1 and ping1V2 and pingV1V2 \ |
| 219 | and pingV2V1 and pingV1Vnone and pingVnoneV2 |
| 220 | |
| 221 | |
| 222 | if pingResultBeforeVlan == main.TRUE: |
| 223 | main.log.report("Ping succeeded before vlans are created") |
| 224 | |
| 225 | main.step( "Create vlan hosts in mininet" ) |
| 226 | v1Tag = main.params[ 'VTAGS' ][ 'tag1' ] |
| 227 | v2Tag = main.params[ 'VTAGS' ][ 'tag2' ] |
| 228 | intfSource1V1 = source1V1 + "-" + main.params[ 'VPING' ][ 'source1V1' ][ 'vintf' ] |
| 229 | intfSource1V2 = source1V2 + "-" + main.params[ 'VPING' ][ 'source1V2' ][ 'vintf' ] |
| 230 | intfTarget1V1 = target1V1 + "-" + main.params[ 'VPING' ][ 'target1V1' ][ 'vintf' ] |
| 231 | intfTarget2V1 = target2V1 + "-" + main.params[ 'VPING' ][ 'target2V1' ][ 'vintf' ] |
| 232 | intfTarget1V2 = target1V2 + "-" + main.params[ 'VPING' ][ 'target1V2' ][ 'vintf' ] |
| 233 | |
| 234 | main.Mininet1.assignVLAN(source1V1, intfSource1V1, v1Tag) |
| 235 | main.Mininet1.assignVLAN(target1V1, intfTarget1V1, v1Tag) |
| 236 | main.Mininet1.assignVLAN(target2V1, intfTarget2V1, v1Tag) |
| 237 | main.Mininet1.assignVLAN(source1V2, intfSource1V2, v2Tag) |
| 238 | main.Mininet1.assignVLAN(target1V2, intfTarget1V2, v2Tag) |
| 239 | |
| 240 | main.step( "Verify host pinging in Mininet after creating vlans" ) |
| 241 | |
| 242 | ping1V1 = main.Mininet1.pingHost( src = source1V1, target = targetIP1V1) |
| 243 | ping2V1 = main.Mininet1.pingHost( src = source1V1, target = targetIP2V1) |
| 244 | ping1V2 = main.Mininet1.pingHost( src = source1V2, target = targetIP1V2) |
| 245 | pingV1V2 = main.Mininet1.pingHost( src = source1V1, target = targetIP1V2) |
| 246 | pingV2V1 = main.Mininet1.pingHost( src = source1V2, target = targetIP1V1) |
| 247 | pingV1Vnone = main.Mininet1.pingHost ( src = source1V1, target = targetIP1Vnone) |
| 248 | pingVnoneV2 = main.Mininet1.pingHost ( src = source1Vnone, target = targetIP1V2) |
| 249 | |
| 250 | |
| 251 | pingExpectedTrue = ping1V1 and ping2V1 and ping1V2 |
| 252 | pingResultAfterVlan = pingExpectedTrue and not pingV1V2 \ |
| 253 | and not pingV2V1 and not pingV1Vnone and not pingVnoneV2 |
| 254 | |
| 255 | if pingResultAfterVlan == main.TRUE: |
| 256 | main.log.report("Ping results are as expected after vlans are created") |
| 257 | testCaseResult = main.TRUE |
| 258 | if pingResultAfterVlan == main.FALSE: |
| 259 | main.log.report("Ping results are not expected after vlans are created") |
| 260 | testCaseResult = main.FALSE |
| 261 | |
| 262 | case25Result = testCaseResult |
| 263 | utilities.assert_equals( expect=main.TRUE, actual=case25Result, |
| 264 | onpass="Vlan verification is successfull", |
| 265 | onfail="Vlan verification failed" ) |
| 266 | if pingResultBeforeVlan == main.FALSE: |
| 267 | main.log.report("Ping failed before vlans are created") |
| 268 | case25Result = main.FALSE |
| 269 | utilities.assert_equals( expect=main.TRUE, actual=case25Result, |
| 270 | onpass="Test case 25 can be verified", |
| 271 | onfail="Test case 25 cannot be verified because " + |
| 272 | "there are ping failures before assigning host vlans" ) |
| 273 | |
| 274 | main.step( "Deactivate reactive forwarding app" ) |
| 275 | main.ONOScli1.deactivateApp( "org.onosproject.fwd" ) |
| 276 | |
| 277 | def CASE26( self, main ): |
| 278 | """ |
| 279 | This test case verifies that hosts belonging to the same vlan, |
| 280 | can ping each other with proactive forwarding (after adding host intent): |
| 281 | - Deactivate app fwd |
| 282 | - Assign vlan tag to selected hosts |
| 283 | - Add host intent between the selected hosts |
| 284 | - Ping the selected hosts to verify proactive forwarding with vlan hosts |
| 285 | """ |
| 286 | import time |
| 287 | |
| 288 | main.log.report( "This testcase creates vlan hosts, " + |
| 289 | " add host intent, " + |
| 290 | " then ping the hosts") |
| 291 | main.log.report( "___________________________________________________" ) |
| 292 | main.case( "Creating vlans and performing ping between hosts" ) |
| 293 | |
| 294 | main.step( "Deactivate reactive forwarding app" ) |
| 295 | main.ONOScli1.deactivateApp( "org.onosproject.fwd" ) |
| 296 | |
| 297 | main.step( "Assign vlan hosts in mininet" ) |
| 298 | |
| 299 | source1V1 = main.params[ 'VPING' ][ 'source1V1Int' ]['vhost'] |
| 300 | target1V1 = main.params[ 'VPING' ][ 'target1V1Int' ]['vhost'] |
| 301 | |
| 302 | intfSource1V1 = source1V1 + "-" + main.params[ 'VPING' ][ 'source1V1Int' ][ 'vintf' ] |
| 303 | intfTarget1V1 = target1V1 + "-" + main.params[ 'VPING' ][ 'target1V1Int' ][ 'vintf' ] |
| 304 | |
| 305 | vTag = main.params[ 'VTAGS' ][ 'tag3' ] |
| 306 | |
| 307 | main.Mininet1.assignVLAN(source1V1, intfSource1V1, vTag) |
| 308 | main.Mininet1.assignVLAN(target1V1, intfTarget1V1, vTag) |
| 309 | |
| 310 | main.step( "Add host intent" ) |
| 311 | mac1 = main.Mininet1.getMacAddress(source1V1) |
| 312 | mac2 = main.Mininet1.getMacAddress(target1V1) |
| 313 | id1 = mac1 + "/" + vTag |
| 314 | id2 = mac2 + "/" + vTag |
| 315 | hthIntentResult = main.ONOScli1.addHostIntent( id1 , id2 ) |
| 316 | if hthIntentResult: |
| 317 | main.step( "Ping hosts after installing host intent" ) |
| 318 | #time.sleep(10) |
| 319 | targetIPV1 = main.Mininet1.getIPAddress(target1V1) |
| 320 | for i in range(0,3): |
| 321 | ping1V1 = main.Mininet1.pingHost( src = source1V1, target = targetIPV1) |
| 322 | |
| 323 | if ping1V1 == main.TRUE: |
| 324 | main.log.report(" Vlan hosts can ping each other successfully "+ |
| 325 | " after add host intent.") |
| 326 | |
| 327 | if ping1V1 == main.FALSE: |
| 328 | main.log.report("Vlan hosts failed to ping each other "+ |
| 329 | " after add host intent. ") |
| 330 | |
| 331 | else: |
| 332 | main.log.report(" add host intent failed between vlan hosts ") |
| 333 | |
| 334 | case26Result = hthIntentResult and ping1V1 |
| 335 | utilities.assert_equals( expect=main.TRUE, actual=case26Result, |
| 336 | onpass="Test case 26 is successfull", |
| 337 | onfail="Test case 26 has failed" ) |
| 338 | |