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