pierventre | 4b72c47 | 2020-05-22 09:42:31 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2020-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.driver.traceable; |
| 18 | |
| 19 | import org.junit.Before; |
| 20 | import org.junit.Test; |
| 21 | |
| 22 | import org.onosproject.driver.pipeline.ofdpa.Ofdpa2Pipeline; |
| 23 | import org.onosproject.driver.pipeline.ofdpa.OvsOfdpaPipeline; |
| 24 | import org.onosproject.net.DataPlaneEntity; |
| 25 | import org.onosproject.net.PipelineTraceableHitChain; |
| 26 | import org.onosproject.net.PipelineTraceableInput; |
| 27 | import org.onosproject.net.PipelineTraceableOutput; |
| 28 | import org.onosproject.net.PipelineTraceableOutput.PipelineTraceableResult; |
| 29 | import org.onosproject.net.PortNumber; |
| 30 | import org.onosproject.net.behaviour.PipelineTraceable; |
| 31 | import org.onosproject.net.behaviour.Pipeliner; |
| 32 | import org.onosproject.net.driver.DefaultDriverData; |
| 33 | import org.onosproject.net.driver.DriverData; |
| 34 | import org.onosproject.net.driver.DriverHandler; |
| 35 | |
| 36 | import java.util.List; |
| 37 | |
| 38 | import static org.easymock.EasyMock.createNiceMock; |
| 39 | import static org.easymock.EasyMock.expect; |
| 40 | import static org.easymock.EasyMock.replay; |
| 41 | import static org.hamcrest.Matchers.is; |
| 42 | import static org.junit.Assert.assertEquals; |
| 43 | import static org.junit.Assert.assertFalse; |
| 44 | import static org.junit.Assert.assertNotNull; |
| 45 | import static org.junit.Assert.assertNull; |
| 46 | import static org.junit.Assert.assertThat; |
| 47 | import static org.junit.Assert.assertTrue; |
| 48 | import static org.onosproject.driver.traceable.TraceableDataPlaneObjects.getDataPlaneEntities; |
| 49 | import static org.onosproject.driver.traceable.TraceableDataPlaneObjects.getHitChains; |
| 50 | import static org.onosproject.driver.traceable.TraceableTestObjects.IN_ARP_PACKET; |
| 51 | import static org.onosproject.driver.traceable.TraceableTestObjects.IN_L2_BRIDG_UNTAG_PACKET; |
| 52 | import static org.onosproject.driver.traceable.TraceableTestObjects.IN_L2_BROAD_UNTAG_PACKET; |
| 53 | import static org.onosproject.driver.traceable.TraceableTestObjects.IN_L3_ECMP_PACKET; |
| 54 | import static org.onosproject.driver.traceable.TraceableTestObjects.IN_L3_UCAST_UNTAG_PACKET; |
| 55 | import static org.onosproject.driver.traceable.TraceableTestObjects.IN_MPLS_ECMP_PACKET; |
| 56 | import static org.onosproject.driver.traceable.TraceableTestObjects.IN_MPLS_ECMP_PACKET_OFDPA; |
| 57 | import static org.onosproject.driver.traceable.TraceableTestObjects.IN_PUNT_IP_PACKET; |
| 58 | import static org.onosproject.driver.traceable.TraceableTestObjects.IN_PUNT_LLDP_PACKET; |
| 59 | import static org.onosproject.driver.traceable.TraceableTestObjects.OFDPA_CP; |
| 60 | import static org.onosproject.driver.traceable.TraceableTestObjects.OFDPA_DEVICE; |
| 61 | import static org.onosproject.driver.traceable.TraceableTestObjects.OFDPA_DRIVER; |
| 62 | import static org.onosproject.driver.traceable.TraceableTestObjects.OUT_L2_BROAD_EMPTY; |
| 63 | import static org.onosproject.driver.traceable.TraceableTestObjects.OUT_L3_ECMP_PACKET; |
| 64 | import static org.onosproject.driver.traceable.TraceableTestObjects.OUT_L3_ECMP_PACKET_1; |
| 65 | import static org.onosproject.driver.traceable.TraceableTestObjects.OUT_L3_ECMP_PACKET_OFDPA; |
| 66 | import static org.onosproject.driver.traceable.TraceableTestObjects.OUT_L3_ECMP_PACKET_OFDPA_1; |
| 67 | import static org.onosproject.driver.traceable.TraceableTestObjects.OUT_L3_UCAST_UNTAG_PACKET; |
| 68 | import static org.onosproject.driver.traceable.TraceableTestObjects.OUT_MPLS_ECMP_PACKET; |
| 69 | import static org.onosproject.driver.traceable.TraceableTestObjects.OUT_PORT; |
| 70 | import static org.onosproject.driver.traceable.TraceableTestObjects.OVS_OFDPA_DRIVER; |
| 71 | import static org.onosproject.driver.traceable.TraceableTestObjects.PORT; |
| 72 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.ARP_OFDPA; |
| 73 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.ARP_OVS_OFDPA; |
| 74 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.L2_BRIDG_NOT_ORDERED_OFDPA; |
| 75 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.L2_BRIDG_NOT_ORDERED_OVS_OFDPA; |
| 76 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.L2_BRIDG_UNTAG_OFDPA; |
| 77 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.L2_BRIDG_UNTAG_OVS_OFDPA; |
| 78 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.L2_BROAD_EMPTY_OFDPA; |
| 79 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.L2_BROAD_EMPTY_OVS_OFDPA; |
| 80 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.L2_BROAD_UNTAG_OFDPA; |
| 81 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.L2_BROAD_UNTAG_OVS_OFDPA; |
| 82 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.L3_ECMP_OFDPA; |
| 83 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.L3_ECMP_OVS_OFDPA; |
| 84 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.L3_UCAST_UNTAG_OFDPA; |
| 85 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.L3_UCAST_UNTAG_OVS_OFDPA; |
| 86 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.MPLS_ECMP_OFDPA; |
| 87 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.MPLS_ECMP_OVS_OFDPA; |
| 88 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.PUNT_IP_OFDPA; |
| 89 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.PUNT_IP_OVS_OFDPA; |
| 90 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.PUNT_LLDP_OFDPA; |
| 91 | import static org.onosproject.driver.traceable.TraceableTestObjects.TraceableTest.PUNT_LLDP_OVS_OFDPA; |
| 92 | import static org.onosproject.driver.traceable.TraceableTestObjects.UP_OFDPA_CP; |
| 93 | import static org.onosproject.driver.traceable.TraceableTestObjects.UP_PORT; |
| 94 | import static org.onosproject.driver.traceable.TraceableTestObjects.UP_PORT_1; |
| 95 | |
| 96 | /** |
| 97 | * Tests for Ofdpa pipeline traceable implementation. |
| 98 | */ |
| 99 | public class OfdpaPipelineTraceableTest { |
| 100 | |
| 101 | private TraceableTestObjects.TestDriver ofdpaDriver = new TraceableTestObjects.TestDriver(OFDPA_DRIVER); |
| 102 | private TraceableTestObjects.TestDriver ovsOfdpaDriver = new TraceableTestObjects.TestDriver(OVS_OFDPA_DRIVER); |
| 103 | |
| 104 | private DriverHandler testDriverHandlerOfdpa; |
| 105 | private DriverHandler testDriverHandlerOvsOfdpa; |
| 106 | |
| 107 | @Before |
| 108 | public void setUp() { |
| 109 | testDriverHandlerOfdpa = createNiceMock(DriverHandler.class); |
| 110 | testDriverHandlerOvsOfdpa = createNiceMock(DriverHandler.class); |
| 111 | expect(testDriverHandlerOfdpa.hasBehaviour(Pipeliner.class)).andReturn(true).anyTimes(); |
| 112 | expect(testDriverHandlerOvsOfdpa.hasBehaviour(Pipeliner.class)).andReturn(true).anyTimes(); |
| 113 | expect(testDriverHandlerOfdpa.behaviour(Pipeliner.class)).andReturn(new Ofdpa2Pipeline()).anyTimes(); |
| 114 | expect(testDriverHandlerOvsOfdpa.behaviour(Pipeliner.class)).andReturn(new OvsOfdpaPipeline()).anyTimes(); |
| 115 | replay(testDriverHandlerOfdpa); |
| 116 | replay(testDriverHandlerOvsOfdpa); |
| 117 | } |
| 118 | |
| 119 | private PipelineTraceable setUpOfdpa() { |
| 120 | PipelineTraceable behaviour = new OfdpaPipelineTraceable(); |
| 121 | DriverData driverData = new DefaultDriverData(ofdpaDriver, OFDPA_DEVICE); |
| 122 | behaviour.setData(driverData); |
| 123 | behaviour.setHandler(testDriverHandlerOfdpa); |
| 124 | behaviour.init(); |
| 125 | return behaviour; |
| 126 | } |
| 127 | |
| 128 | private PipelineTraceable setUpOvsOfdpa() { |
| 129 | PipelineTraceable behaviour = new OfdpaPipelineTraceable(); |
| 130 | DriverData driverData = new DefaultDriverData(ovsOfdpaDriver, OFDPA_DEVICE); |
| 131 | behaviour.setData(driverData); |
| 132 | behaviour.setHandler(testDriverHandlerOvsOfdpa); |
| 133 | behaviour.init(); |
| 134 | return behaviour; |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Test punt ip for ovs-ofdpa. |
| 139 | */ |
| 140 | @Test |
| 141 | public void testOvsOfdpaPuntIP() { |
| 142 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_PUNT_IP_PACKET, OFDPA_CP, |
| 143 | getDataPlaneEntities(OVS_OFDPA_DRIVER, PUNT_IP_OVS_OFDPA)); |
| 144 | PipelineTraceable pipelineTraceable = setUpOvsOfdpa(); |
| 145 | |
| 146 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 147 | assertNotNull(pipelineOutput); |
| 148 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 149 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 150 | |
| 151 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 152 | assertNotNull(hitChain); |
| 153 | List<List<DataPlaneEntity>> chains = getHitChains(PUNT_IP_OVS_OFDPA); |
| 154 | assertThat(chains.size(), is(1)); |
| 155 | |
| 156 | assertNotNull(hitChain.getOutputPort()); |
| 157 | assertThat(hitChain.getOutputPort().port(), is(PortNumber.CONTROLLER)); |
| 158 | assertThat(hitChain.getHitChain().size(), is(7)); |
| 159 | assertEquals(IN_PUNT_IP_PACKET, hitChain.getEgressPacket()); |
| 160 | assertFalse(hitChain.isDropped()); |
| 161 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * Test punt ip for ofdpa. |
| 166 | */ |
| 167 | @Test |
| 168 | public void testOfdpaPuntIP() { |
| 169 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_PUNT_IP_PACKET, OFDPA_CP, |
| 170 | getDataPlaneEntities(OFDPA_DRIVER, PUNT_IP_OFDPA)); |
| 171 | PipelineTraceable pipelineTraceable = setUpOfdpa(); |
| 172 | |
| 173 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 174 | assertNotNull(pipelineOutput); |
| 175 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 176 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 177 | |
| 178 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 179 | assertNotNull(hitChain); |
| 180 | List<List<DataPlaneEntity>> chains = getHitChains(PUNT_IP_OFDPA); |
| 181 | assertThat(chains.size(), is(1)); |
| 182 | |
| 183 | assertNotNull(hitChain.getOutputPort()); |
| 184 | assertThat(hitChain.getOutputPort().port(), is(PortNumber.CONTROLLER)); |
| 185 | assertThat(hitChain.getHitChain().size(), is(4)); |
| 186 | assertEquals(IN_PUNT_IP_PACKET, hitChain.getEgressPacket()); |
| 187 | assertFalse(hitChain.isDropped()); |
| 188 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * Test punt arp for ovs-ofdpa. |
| 193 | */ |
| 194 | @Test |
| 195 | public void testOvsOfdpaArp() { |
| 196 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_ARP_PACKET, OFDPA_CP, |
| 197 | getDataPlaneEntities(OVS_OFDPA_DRIVER, ARP_OVS_OFDPA)); |
| 198 | PipelineTraceable pipelineTraceable = setUpOvsOfdpa(); |
| 199 | |
| 200 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 201 | assertNotNull(pipelineOutput); |
| 202 | assertThat(pipelineOutput.getHitChains().size(), is(3)); |
| 203 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 204 | |
| 205 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 206 | assertNotNull(hitChain); |
| 207 | List<List<DataPlaneEntity>> chains = getHitChains(ARP_OVS_OFDPA); |
| 208 | assertThat(chains.size(), is(3)); |
| 209 | |
| 210 | // This is the copy sent to the controller |
| 211 | assertNotNull(hitChain.getOutputPort()); |
| 212 | assertThat(hitChain.getOutputPort().port(), is(PortNumber.CONTROLLER)); |
| 213 | assertThat(hitChain.getHitChain().size(), is(7)); |
| 214 | assertEquals(IN_ARP_PACKET, hitChain.getEgressPacket()); |
| 215 | assertFalse(hitChain.isDropped()); |
| 216 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 217 | |
| 218 | // This is the copy sent to the member port |
| 219 | hitChain = pipelineOutput.getHitChains().get(1); |
| 220 | assertNotNull(hitChain); |
| 221 | |
| 222 | assertNotNull(hitChain.getOutputPort()); |
| 223 | assertThat(hitChain.getOutputPort().port(), is(OUT_PORT)); |
| 224 | assertThat(hitChain.getHitChain().size(), is(8)); |
| 225 | assertEquals(IN_ARP_PACKET, hitChain.getEgressPacket()); |
| 226 | assertFalse(hitChain.isDropped()); |
| 227 | assertEquals(chains.get(1), hitChain.getHitChain()); |
| 228 | |
| 229 | // This is the copy sent on the input port |
| 230 | hitChain = pipelineOutput.getHitChains().get(2); |
| 231 | assertNotNull(hitChain); |
| 232 | |
| 233 | assertNotNull(hitChain.getOutputPort()); |
| 234 | assertThat(hitChain.getOutputPort().port(), is(PORT)); |
| 235 | assertThat(hitChain.getHitChain().size(), is(8)); |
| 236 | assertEquals(IN_ARP_PACKET, hitChain.getEgressPacket()); |
| 237 | assertTrue(hitChain.isDropped()); |
| 238 | assertEquals(chains.get(2), hitChain.getHitChain()); |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * Test punt arp for ovs-ofdpa. |
| 243 | */ |
| 244 | @Test |
| 245 | public void testOfdpaArp() { |
| 246 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_ARP_PACKET, OFDPA_CP, |
| 247 | getDataPlaneEntities(OFDPA_DRIVER, ARP_OFDPA)); |
| 248 | PipelineTraceable pipelineTraceable = setUpOfdpa(); |
| 249 | |
| 250 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 251 | assertNotNull(pipelineOutput); |
| 252 | assertThat(pipelineOutput.getHitChains().size(), is(3)); |
| 253 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 254 | |
| 255 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 256 | assertNotNull(hitChain); |
| 257 | List<List<DataPlaneEntity>> chains = getHitChains(ARP_OFDPA); |
| 258 | assertThat(chains.size(), is(3)); |
| 259 | |
| 260 | |
| 261 | assertNotNull(hitChain.getOutputPort()); |
| 262 | assertThat(hitChain.getOutputPort().port(), is(PortNumber.CONTROLLER)); |
| 263 | assertThat(hitChain.getHitChain().size(), is(4)); |
| 264 | assertEquals(IN_ARP_PACKET, hitChain.getEgressPacket()); |
| 265 | assertFalse(hitChain.isDropped()); |
| 266 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 267 | |
| 268 | hitChain = pipelineOutput.getHitChains().get(1); |
| 269 | assertNotNull(hitChain); |
| 270 | |
| 271 | assertNotNull(hitChain.getOutputPort()); |
| 272 | assertThat(hitChain.getOutputPort().port(), is(OUT_PORT)); |
| 273 | assertThat(hitChain.getHitChain().size(), is(6)); |
| 274 | assertEquals(IN_ARP_PACKET, hitChain.getEgressPacket()); |
| 275 | assertFalse(hitChain.isDropped()); |
| 276 | assertEquals(chains.get(1), hitChain.getHitChain()); |
| 277 | |
| 278 | hitChain = pipelineOutput.getHitChains().get(2); |
| 279 | assertNotNull(hitChain); |
| 280 | |
| 281 | assertNotNull(hitChain.getOutputPort()); |
| 282 | assertThat(hitChain.getOutputPort().port(), is(PORT)); |
| 283 | assertThat(hitChain.getHitChain().size(), is(6)); |
| 284 | assertEquals(IN_ARP_PACKET, hitChain.getEgressPacket()); |
| 285 | assertTrue(hitChain.isDropped()); |
| 286 | assertEquals(chains.get(2), hitChain.getHitChain()); |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * Test punt lldp for ovs-ofdpa. |
| 291 | */ |
| 292 | @Test |
| 293 | public void testOvsOfdpaPuntLldp() { |
| 294 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_PUNT_LLDP_PACKET, OFDPA_CP, |
| 295 | getDataPlaneEntities(OVS_OFDPA_DRIVER, PUNT_LLDP_OVS_OFDPA)); |
| 296 | PipelineTraceable pipelineTraceable = setUpOvsOfdpa(); |
| 297 | |
| 298 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 299 | assertNotNull(pipelineOutput); |
| 300 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 301 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 302 | |
| 303 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 304 | assertNotNull(hitChain); |
| 305 | List<List<DataPlaneEntity>> chains = getHitChains(PUNT_LLDP_OVS_OFDPA); |
| 306 | assertThat(chains.size(), is(1)); |
| 307 | |
| 308 | assertNotNull(hitChain.getOutputPort()); |
| 309 | assertThat(hitChain.getOutputPort().port(), is(PortNumber.CONTROLLER)); |
| 310 | assertThat(hitChain.getHitChain().size(), is(7)); |
| 311 | assertEquals(IN_PUNT_LLDP_PACKET, hitChain.getEgressPacket()); |
| 312 | assertFalse(hitChain.isDropped()); |
| 313 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 314 | } |
| 315 | |
| 316 | /** |
| 317 | * Test punt lldp for ovs-ofdpa. |
| 318 | */ |
| 319 | @Test |
| 320 | public void testOfdpaPuntLldp() { |
| 321 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_PUNT_LLDP_PACKET, OFDPA_CP, |
| 322 | getDataPlaneEntities(OFDPA_DRIVER, PUNT_LLDP_OFDPA)); |
| 323 | PipelineTraceable pipelineTraceable = setUpOfdpa(); |
| 324 | |
| 325 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 326 | assertNotNull(pipelineOutput); |
| 327 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 328 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 329 | |
| 330 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 331 | assertNotNull(hitChain); |
| 332 | List<List<DataPlaneEntity>> chains = getHitChains(PUNT_LLDP_OFDPA); |
| 333 | assertThat(chains.size(), is(1)); |
| 334 | |
| 335 | assertNotNull(hitChain.getOutputPort()); |
| 336 | assertThat(hitChain.getOutputPort().port(), is(PortNumber.CONTROLLER)); |
| 337 | assertThat(hitChain.getHitChain().size(), is(4)); |
| 338 | assertEquals(IN_PUNT_LLDP_PACKET, hitChain.getEgressPacket()); |
| 339 | assertFalse(hitChain.isDropped()); |
| 340 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 341 | } |
| 342 | |
| 343 | /** |
| 344 | * Test l2 bridging with untagged hosts for ovs-ofdpa. |
| 345 | */ |
| 346 | @Test |
| 347 | public void testOvsOfdpaL2BridingUntagged() { |
| 348 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_L2_BRIDG_UNTAG_PACKET, OFDPA_CP, |
| 349 | getDataPlaneEntities(OVS_OFDPA_DRIVER, L2_BRIDG_UNTAG_OVS_OFDPA)); |
| 350 | PipelineTraceable pipelineTraceable = setUpOvsOfdpa(); |
| 351 | |
| 352 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 353 | assertNotNull(pipelineOutput); |
| 354 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 355 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 356 | |
| 357 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 358 | assertNotNull(hitChain); |
| 359 | List<List<DataPlaneEntity>> chains = getHitChains(L2_BRIDG_UNTAG_OVS_OFDPA); |
| 360 | assertThat(chains.size(), is(1)); |
| 361 | |
| 362 | assertNotNull(hitChain.getOutputPort()); |
| 363 | assertThat(hitChain.getOutputPort().port(), is(OUT_PORT)); |
| 364 | assertThat(hitChain.getHitChain().size(), is(6)); |
| 365 | assertEquals(IN_L2_BRIDG_UNTAG_PACKET, hitChain.getEgressPacket()); |
| 366 | assertFalse(hitChain.isDropped()); |
| 367 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 368 | } |
| 369 | |
| 370 | /** |
| 371 | * Test l2 bridging with untagged hosts for ofdpa. |
| 372 | */ |
| 373 | @Test |
| 374 | public void testOfdpaL2BridingUntagged() { |
| 375 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_L2_BRIDG_UNTAG_PACKET, OFDPA_CP, |
| 376 | getDataPlaneEntities(OFDPA_DRIVER, L2_BRIDG_UNTAG_OFDPA)); |
| 377 | PipelineTraceable pipelineTraceable = setUpOfdpa(); |
| 378 | |
| 379 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 380 | assertNotNull(pipelineOutput); |
| 381 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 382 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 383 | |
| 384 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 385 | assertNotNull(hitChain); |
| 386 | List<List<DataPlaneEntity>> chains = getHitChains(L2_BRIDG_UNTAG_OFDPA); |
| 387 | assertThat(chains.size(), is(1)); |
| 388 | |
| 389 | assertNotNull(hitChain.getOutputPort()); |
| 390 | assertThat(hitChain.getOutputPort().port(), is(OUT_PORT)); |
| 391 | assertThat(hitChain.getHitChain().size(), is(4)); |
| 392 | assertEquals(IN_L2_BRIDG_UNTAG_PACKET, hitChain.getEgressPacket()); |
| 393 | assertFalse(hitChain.isDropped()); |
| 394 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 395 | } |
| 396 | |
| 397 | /** |
| 398 | * Test l2 broadcast with untagged hosts for ovs-ofdpa. |
| 399 | */ |
| 400 | @Test |
| 401 | public void testOvsOfdpaL2BroadcastUntagged() { |
| 402 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_L2_BROAD_UNTAG_PACKET, OFDPA_CP, |
| 403 | getDataPlaneEntities(OVS_OFDPA_DRIVER, L2_BROAD_UNTAG_OVS_OFDPA)); |
| 404 | PipelineTraceable pipelineTraceable = setUpOvsOfdpa(); |
| 405 | |
| 406 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 407 | assertNotNull(pipelineOutput); |
| 408 | assertThat(pipelineOutput.getHitChains().size(), is(2)); |
| 409 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 410 | |
| 411 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 412 | assertNotNull(hitChain); |
| 413 | List<List<DataPlaneEntity>> chains = getHitChains(L2_BROAD_UNTAG_OVS_OFDPA); |
| 414 | assertThat(chains.size(), is(2)); |
| 415 | |
| 416 | assertNotNull(hitChain.getOutputPort()); |
| 417 | assertThat(hitChain.getOutputPort().port(), is(OUT_PORT)); |
| 418 | assertThat(hitChain.getHitChain().size(), is(7)); |
| 419 | assertEquals(IN_L2_BROAD_UNTAG_PACKET, hitChain.getEgressPacket()); |
| 420 | assertFalse(hitChain.isDropped()); |
| 421 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 422 | |
| 423 | // Dropped chain - input port! |
| 424 | hitChain = pipelineOutput.getHitChains().get(1); |
| 425 | assertNotNull(hitChain); |
| 426 | |
| 427 | assertNotNull(hitChain.getOutputPort()); |
| 428 | assertThat(hitChain.getOutputPort().port(), is(PORT)); |
| 429 | assertThat(hitChain.getHitChain().size(), is(7)); |
| 430 | assertEquals(IN_L2_BROAD_UNTAG_PACKET, hitChain.getEgressPacket()); |
| 431 | assertTrue(hitChain.isDropped()); |
| 432 | assertEquals(chains.get(1), hitChain.getHitChain()); |
| 433 | } |
| 434 | |
| 435 | /** |
| 436 | * Test l2 broadcast with untagged hosts for ofdpa. |
| 437 | */ |
| 438 | @Test |
| 439 | public void testOfdpaL2BroadcastUntagged() { |
| 440 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_L2_BROAD_UNTAG_PACKET, OFDPA_CP, |
| 441 | getDataPlaneEntities(OFDPA_DRIVER, L2_BROAD_UNTAG_OFDPA)); |
| 442 | PipelineTraceable pipelineTraceable = setUpOfdpa(); |
| 443 | |
| 444 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 445 | assertNotNull(pipelineOutput); |
| 446 | assertThat(pipelineOutput.getHitChains().size(), is(2)); |
| 447 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 448 | |
| 449 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 450 | assertNotNull(hitChain); |
| 451 | List<List<DataPlaneEntity>> chains = getHitChains(L2_BROAD_UNTAG_OFDPA); |
| 452 | assertThat(chains.size(), is(2)); |
| 453 | |
| 454 | assertNotNull(hitChain.getOutputPort()); |
| 455 | assertThat(hitChain.getOutputPort().port(), is(OUT_PORT)); |
| 456 | assertThat(hitChain.getHitChain().size(), is(5)); |
| 457 | assertEquals(IN_L2_BROAD_UNTAG_PACKET, hitChain.getEgressPacket()); |
| 458 | assertFalse(hitChain.isDropped()); |
| 459 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 460 | |
| 461 | // Dropped chain - input port! |
| 462 | hitChain = pipelineOutput.getHitChains().get(1); |
| 463 | assertNotNull(hitChain); |
| 464 | |
| 465 | assertNotNull(hitChain.getOutputPort()); |
| 466 | assertThat(hitChain.getOutputPort().port(), is(PORT)); |
| 467 | assertThat(hitChain.getHitChain().size(), is(5)); |
| 468 | assertEquals(IN_L2_BROAD_UNTAG_PACKET, hitChain.getEgressPacket()); |
| 469 | assertTrue(hitChain.isDropped()); |
| 470 | assertEquals(chains.get(1), hitChain.getHitChain()); |
| 471 | } |
| 472 | |
| 473 | /** |
| 474 | * Test l3 unicast routing for ovs-ofdpa. |
| 475 | */ |
| 476 | @Test |
| 477 | public void testOvsOfdpaL3Unicast() { |
| 478 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_L3_UCAST_UNTAG_PACKET, UP_OFDPA_CP, |
| 479 | getDataPlaneEntities(OVS_OFDPA_DRIVER, L3_UCAST_UNTAG_OVS_OFDPA)); |
| 480 | PipelineTraceable pipelineTraceable = setUpOvsOfdpa(); |
| 481 | |
| 482 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 483 | assertNotNull(pipelineOutput); |
| 484 | |
| 485 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 486 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 487 | |
| 488 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 489 | assertNotNull(hitChain); |
| 490 | List<List<DataPlaneEntity>> chains = getHitChains(L3_UCAST_UNTAG_OVS_OFDPA); |
| 491 | assertThat(chains.size(), is(1)); |
| 492 | |
| 493 | assertNotNull(hitChain.getOutputPort()); |
| 494 | assertThat(hitChain.getOutputPort().port(), is(OUT_PORT)); |
| 495 | assertThat(hitChain.getHitChain().size(), is(7)); |
| 496 | assertEquals(OUT_L3_UCAST_UNTAG_PACKET, hitChain.getEgressPacket()); |
| 497 | assertFalse(hitChain.isDropped()); |
| 498 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 499 | } |
| 500 | |
| 501 | /** |
| 502 | * Test l3 unicast routing for ofdpa. |
| 503 | */ |
| 504 | @Test |
| 505 | public void testOfdpaL3Unicast() { |
| 506 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_L3_UCAST_UNTAG_PACKET, UP_OFDPA_CP, |
| 507 | getDataPlaneEntities(OFDPA_DRIVER, L3_UCAST_UNTAG_OFDPA)); |
| 508 | PipelineTraceable pipelineTraceable = setUpOfdpa(); |
| 509 | |
| 510 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 511 | assertNotNull(pipelineOutput); |
| 512 | |
| 513 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 514 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 515 | |
| 516 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 517 | assertNotNull(hitChain); |
| 518 | List<List<DataPlaneEntity>> chains = getHitChains(L3_UCAST_UNTAG_OFDPA); |
| 519 | assertThat(chains.size(), is(1)); |
| 520 | |
| 521 | assertNotNull(hitChain.getOutputPort()); |
| 522 | assertThat(hitChain.getOutputPort().port(), is(OUT_PORT)); |
| 523 | assertThat(hitChain.getHitChain().size(), is(6)); |
| 524 | assertEquals(OUT_L3_UCAST_UNTAG_PACKET, hitChain.getEgressPacket()); |
| 525 | assertFalse(hitChain.isDropped()); |
| 526 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 527 | } |
| 528 | |
| 529 | /** |
| 530 | * Test l3 ecmp routing for ovs-ofdpa. |
| 531 | */ |
| 532 | @Test |
| 533 | public void testOvsOfdpaL3Ecmp() { |
| 534 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_L3_ECMP_PACKET, OFDPA_CP, |
| 535 | getDataPlaneEntities(OVS_OFDPA_DRIVER, L3_ECMP_OVS_OFDPA)); |
| 536 | PipelineTraceable pipelineTraceable = setUpOvsOfdpa(); |
| 537 | |
| 538 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 539 | assertNotNull(pipelineOutput); |
| 540 | |
| 541 | assertThat(pipelineOutput.getHitChains().size(), is(2)); |
| 542 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 543 | |
| 544 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 545 | assertNotNull(hitChain); |
| 546 | List<List<DataPlaneEntity>> chains = getHitChains(L3_ECMP_OVS_OFDPA); |
| 547 | assertThat(chains.size(), is(2)); |
| 548 | |
| 549 | assertNotNull(hitChain.getOutputPort()); |
| 550 | assertThat(hitChain.getOutputPort().port(), is(UP_PORT)); |
| 551 | assertThat(hitChain.getHitChain().size(), is(9)); |
| 552 | assertEquals(OUT_L3_ECMP_PACKET, hitChain.getEgressPacket()); |
| 553 | assertFalse(hitChain.isDropped()); |
| 554 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 555 | |
| 556 | // 2nd spine! |
| 557 | hitChain = pipelineOutput.getHitChains().get(1); |
| 558 | assertNotNull(hitChain); |
| 559 | |
| 560 | assertNotNull(hitChain.getOutputPort()); |
| 561 | assertThat(hitChain.getOutputPort().port(), is(UP_PORT_1)); |
| 562 | assertThat(hitChain.getHitChain().size(), is(9)); |
| 563 | assertEquals(OUT_L3_ECMP_PACKET_1, hitChain.getEgressPacket()); |
| 564 | assertFalse(hitChain.isDropped()); |
| 565 | assertEquals(chains.get(1), hitChain.getHitChain()); |
| 566 | } |
| 567 | |
| 568 | /** |
| 569 | * Test l3 ecmp routing for ofdpa. |
| 570 | */ |
| 571 | @Test |
| 572 | public void testOfdpaL3Ecmp() { |
| 573 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_L3_ECMP_PACKET, OFDPA_CP, |
| 574 | getDataPlaneEntities(OFDPA_DRIVER, L3_ECMP_OFDPA)); |
| 575 | PipelineTraceable pipelineTraceable = setUpOfdpa(); |
| 576 | |
| 577 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 578 | assertNotNull(pipelineOutput); |
| 579 | |
| 580 | assertThat(pipelineOutput.getHitChains().size(), is(2)); |
| 581 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 582 | |
| 583 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 584 | assertNotNull(hitChain); |
| 585 | List<List<DataPlaneEntity>> chains = getHitChains(L3_ECMP_OFDPA); |
| 586 | assertThat(chains.size(), is(2)); |
| 587 | |
| 588 | assertNotNull(hitChain.getOutputPort()); |
| 589 | assertThat(hitChain.getOutputPort().port(), is(UP_PORT)); |
| 590 | assertThat(hitChain.getHitChain().size(), is(8)); |
| 591 | assertEquals(OUT_L3_ECMP_PACKET_OFDPA, hitChain.getEgressPacket()); |
| 592 | assertFalse(hitChain.isDropped()); |
| 593 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 594 | |
| 595 | hitChain = pipelineOutput.getHitChains().get(1); |
| 596 | assertNotNull(hitChain); |
| 597 | |
| 598 | assertNotNull(hitChain.getOutputPort()); |
| 599 | assertThat(hitChain.getOutputPort().port(), is(UP_PORT_1)); |
| 600 | assertThat(hitChain.getHitChain().size(), is(8)); |
| 601 | assertEquals(OUT_L3_ECMP_PACKET_OFDPA_1, hitChain.getEgressPacket()); |
| 602 | assertFalse(hitChain.isDropped()); |
| 603 | assertEquals(chains.get(1), hitChain.getHitChain()); |
| 604 | } |
| 605 | |
| 606 | /** |
| 607 | * Test mpls ecmp routing for ovs-ofdpa. |
| 608 | */ |
| 609 | @Test |
| 610 | public void testOvsOfdpaMplsEcmp() { |
| 611 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_MPLS_ECMP_PACKET, UP_OFDPA_CP, |
| 612 | getDataPlaneEntities(OVS_OFDPA_DRIVER, MPLS_ECMP_OVS_OFDPA)); |
| 613 | PipelineTraceable pipelineTraceable = setUpOvsOfdpa(); |
| 614 | |
| 615 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 616 | assertNotNull(pipelineOutput); |
| 617 | |
| 618 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 619 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 620 | |
| 621 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 622 | assertNotNull(hitChain); |
| 623 | List<List<DataPlaneEntity>> chains = getHitChains(MPLS_ECMP_OVS_OFDPA); |
| 624 | assertThat(chains.size(), is(1)); |
| 625 | |
| 626 | assertNotNull(hitChain.getOutputPort()); |
| 627 | assertThat(hitChain.getOutputPort().port(), is(UP_PORT_1)); |
| 628 | assertThat(hitChain.getHitChain().size(), is(9)); |
| 629 | assertEquals(OUT_MPLS_ECMP_PACKET, hitChain.getEgressPacket()); |
| 630 | assertFalse(hitChain.isDropped()); |
| 631 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 632 | } |
| 633 | |
| 634 | /** |
| 635 | * Test mpls ecmp routing for ofdpa. |
| 636 | */ |
| 637 | @Test |
| 638 | public void testOfdpaMplsEcmp() { |
| 639 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_MPLS_ECMP_PACKET_OFDPA, OFDPA_CP, |
| 640 | getDataPlaneEntities(OFDPA_DRIVER, MPLS_ECMP_OFDPA)); |
| 641 | PipelineTraceable pipelineTraceable = setUpOfdpa(); |
| 642 | |
| 643 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 644 | assertNotNull(pipelineOutput); |
| 645 | |
| 646 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 647 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 648 | |
| 649 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 650 | assertNotNull(hitChain); |
| 651 | List<List<DataPlaneEntity>> chains = getHitChains(MPLS_ECMP_OFDPA); |
| 652 | assertThat(chains.size(), is(1)); |
| 653 | |
| 654 | assertNotNull(hitChain.getOutputPort()); |
| 655 | assertThat(hitChain.getOutputPort().port(), is(UP_PORT_1)); |
| 656 | assertThat(hitChain.getHitChain().size(), is(7)); |
| 657 | assertFalse(hitChain.isDropped()); |
| 658 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 659 | assertEquals(OUT_MPLS_ECMP_PACKET, hitChain.getEgressPacket()); |
| 660 | } |
| 661 | |
| 662 | /** |
| 663 | * Test failure due l2 flood group with no buckets for ovs-ofdpa. |
| 664 | */ |
| 665 | @Test |
| 666 | public void testOvsOfdpaL2BroadEmpty() { |
| 667 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_L2_BROAD_UNTAG_PACKET, OFDPA_CP, |
| 668 | getDataPlaneEntities(OVS_OFDPA_DRIVER, L2_BROAD_EMPTY_OVS_OFDPA)); |
| 669 | PipelineTraceable pipelineTraceable = setUpOvsOfdpa(); |
| 670 | |
| 671 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 672 | assertNotNull(pipelineOutput); |
| 673 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 674 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.NO_GROUP_MEMBERS)); |
| 675 | |
| 676 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 677 | assertNotNull(hitChain); |
| 678 | List<List<DataPlaneEntity>> chains = getHitChains(L2_BROAD_EMPTY_OVS_OFDPA); |
| 679 | assertThat(chains.size(), is(1)); |
| 680 | |
| 681 | assertNull(hitChain.getOutputPort()); |
| 682 | assertThat(hitChain.getHitChain().size(), is(6)); |
| 683 | assertEquals(OUT_L2_BROAD_EMPTY, hitChain.getEgressPacket()); |
| 684 | assertTrue(hitChain.isDropped()); |
| 685 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 686 | } |
| 687 | |
| 688 | /** |
| 689 | * Test failure due l2 flood group with no buckets for ofdpa. |
| 690 | */ |
| 691 | @Test |
| 692 | public void testOfdpaL2BroadEmpty() { |
| 693 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_L2_BROAD_UNTAG_PACKET, OFDPA_CP, |
| 694 | getDataPlaneEntities(OFDPA_DRIVER, L2_BROAD_EMPTY_OFDPA)); |
| 695 | PipelineTraceable pipelineTraceable = setUpOfdpa(); |
| 696 | |
| 697 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 698 | assertNotNull(pipelineOutput); |
| 699 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 700 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.NO_GROUP_MEMBERS)); |
| 701 | |
| 702 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 703 | assertNotNull(hitChain); |
| 704 | List<List<DataPlaneEntity>> chains = getHitChains(L2_BROAD_EMPTY_OFDPA); |
| 705 | assertThat(chains.size(), is(1)); |
| 706 | |
| 707 | assertNull(hitChain.getOutputPort()); |
| 708 | assertThat(hitChain.getHitChain().size(), is(4)); |
| 709 | assertEquals(OUT_L2_BROAD_EMPTY, hitChain.getEgressPacket()); |
| 710 | assertTrue(hitChain.isDropped()); |
| 711 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 712 | } |
| 713 | |
| 714 | /** |
| 715 | * Test l2 bridging with l2 interface group that has actions not in order for ovs-ofdpa. |
| 716 | */ |
| 717 | @Test |
| 718 | public void testOvsOfdpaL2BridingNotOrdered() { |
| 719 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_L2_BRIDG_UNTAG_PACKET, OFDPA_CP, |
| 720 | getDataPlaneEntities(OVS_OFDPA_DRIVER, L2_BRIDG_NOT_ORDERED_OVS_OFDPA)); |
| 721 | PipelineTraceable pipelineTraceable = setUpOvsOfdpa(); |
| 722 | |
| 723 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 724 | assertNotNull(pipelineOutput); |
| 725 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 726 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 727 | |
| 728 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 729 | assertNotNull(hitChain); |
| 730 | List<List<DataPlaneEntity>> chains = getHitChains(L2_BRIDG_NOT_ORDERED_OVS_OFDPA); |
| 731 | assertThat(chains.size(), is(1)); |
| 732 | |
| 733 | assertNotNull(hitChain.getOutputPort()); |
| 734 | assertThat(hitChain.getOutputPort().port(), is(OUT_PORT)); |
| 735 | assertThat(hitChain.getHitChain().size(), is(6)); |
| 736 | assertEquals(IN_L2_BRIDG_UNTAG_PACKET, hitChain.getEgressPacket()); |
| 737 | assertFalse(hitChain.isDropped()); |
| 738 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 739 | } |
| 740 | |
| 741 | /** |
| 742 | * Test l2 bridging with l2 interface group that has actions not in order for ofdpa. |
| 743 | */ |
| 744 | @Test |
| 745 | public void testOfdpaL2BridingNotOrdered() { |
| 746 | PipelineTraceableInput pipelineInput = new PipelineTraceableInput(IN_L2_BRIDG_UNTAG_PACKET, OFDPA_CP, |
| 747 | getDataPlaneEntities(OFDPA_DRIVER, L2_BRIDG_NOT_ORDERED_OFDPA)); |
| 748 | PipelineTraceable pipelineTraceable = setUpOfdpa(); |
| 749 | |
| 750 | PipelineTraceableOutput pipelineOutput = pipelineTraceable.apply(pipelineInput); |
| 751 | assertNotNull(pipelineOutput); |
| 752 | assertThat(pipelineOutput.getHitChains().size(), is(1)); |
| 753 | assertThat(pipelineOutput.getResult(), is(PipelineTraceableResult.SUCCESS)); |
| 754 | |
| 755 | PipelineTraceableHitChain hitChain = pipelineOutput.getHitChains().get(0); |
| 756 | assertNotNull(hitChain); |
| 757 | List<List<DataPlaneEntity>> chains = getHitChains(L2_BRIDG_NOT_ORDERED_OFDPA); |
| 758 | assertThat(chains.size(), is(1)); |
| 759 | |
| 760 | assertNotNull(hitChain.getOutputPort()); |
| 761 | assertThat(hitChain.getOutputPort().port(), is(OUT_PORT)); |
| 762 | assertThat(hitChain.getHitChain().size(), is(4)); |
| 763 | assertEquals(IN_L2_BRIDG_UNTAG_PACKET, hitChain.getEgressPacket()); |
| 764 | assertFalse(hitChain.isDropped()); |
| 765 | assertEquals(chains.get(0), hitChain.getHitChain()); |
| 766 | } |
| 767 | |
| 768 | } |