use of org.openkilda.floodlight.model.EffectiveIds in project open-kilda by telstra.
the class IngressFlowLoopSegmentInstallCommandTest method ingressFlowLoopSigleTagSingleTableTest.
@Test
public void ingressFlowLoopSigleTagSingleTableTest() throws Exception {
IngressFlowLoopSegmentInstallCommand command = createCommand(VLAN_1, 0, false);
OFFlowMod mod = assertModCountAndReturnMod(command.makeFlowModMessages(new EffectiveIds()));
assertCommon(mod, INPUT_TABLE_ID);
assertEquals(2, stream(mod.getMatch().getMatchFields().spliterator(), false).count());
assertEquals(VLAN_1, mod.getMatch().get(MatchField.VLAN_VID).getVlan());
List<OFAction> applyActions = ((OFInstructionApplyActions) mod.getInstructions().get(0)).getActions();
assertEquals(1, applyActions.size());
assertOutputAction(applyActions.get(0));
}
use of org.openkilda.floodlight.model.EffectiveIds in project open-kilda by telstra.
the class IngressFlowLoopSegmentInstallCommandTest method ingressFlowLoopDoubleTagMultiTableTest.
@Test
public void ingressFlowLoopDoubleTagMultiTableTest() throws Exception {
IngressFlowLoopSegmentInstallCommand command = createCommand(VLAN_1, VLAN_2, true);
OFFlowMod mod = assertModCountAndReturnMod(command.makeFlowModMessages(new EffectiveIds()));
assertCommon(mod, INGRESS_TABLE_ID);
assertEquals(3, stream(mod.getMatch().getMatchFields().spliterator(), false).count());
assertEquals(VLAN_2, mod.getMatch().get(MatchField.VLAN_VID).getVlan());
assertMetadata(mod.getMatch(), VLAN_1);
List<OFAction> applyActions = ((OFInstructionApplyActions) mod.getInstructions().get(0)).getActions();
assertEquals(3, applyActions.size());
assertPushVlanAction(applyActions.get(0));
assertSetField(applyActions.get(1), OFOxmVlanVid.class, OFVlanVidMatch.ofVlan(VLAN_1));
assertOutputAction(applyActions.get(2));
}
use of org.openkilda.floodlight.model.EffectiveIds in project open-kilda by telstra.
the class IngressFlowSegmentInstallFlowModFactoryTest method makeOuterVlanOnlyForwardMessageConnectedDevices.
@Test
public void makeOuterVlanOnlyForwardMessageConnectedDevices() {
FlowEndpoint endpoint = new FlowEndpoint(endpointSingleVlan.getSwitchId(), endpointSingleVlan.getPortNumber(), endpointSingleVlan.getOuterVlanId(), 0, true, true);
IngressFlowSegmentInstallCommand command = makeCommand(endpoint, meterConfig, encapsulationVlan);
IngressFlowModFactory factory = makeFactory(command);
verifyGoToTableInstruction(factory.makeOuterOnlyVlanForwardMessage(new EffectiveIds(meterConfig.getId(), null)));
}
use of org.openkilda.floodlight.model.EffectiveIds in project open-kilda by telstra.
the class IngressFlowSegmentInstallFlowModFactoryTest method testMakeSingleVlanForwardMessageVlanEncoded.
private void testMakeSingleVlanForwardMessageVlanEncoded(MeterConfig meter) {
IngressFlowSegmentInstallCommand command = makeCommand(endpointSingleVlan, meter, encapsulationVlan);
FlowEndpoint endpoint = command.getEndpoint();
RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(Collections.emptySet());
List<OFAction> vlanTransformation = OfAdapter.INSTANCE.makeVlanReplaceActions(of, Collections.emptyList(), Collections.singletonList(command.getEncapsulation().getId()));
OFFlowAdd expected = makeVlanForwardingMessage(command, 0, of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build(), getTargetIngressTableId(), vlanTransformation);
IngressFlowModFactory factory = makeFactory(command);
verifyOfMessageEquals(expected, factory.makeSingleVlanForwardMessage(new EffectiveIds(getEffectiveMeterId(command.getMeterConfig()), null)));
}
use of org.openkilda.floodlight.model.EffectiveIds in project open-kilda by telstra.
the class IngressFlowSegmentInstallFlowModFactoryTest method testMakeDefaultPortForwardMessageVlan.
private void testMakeDefaultPortForwardMessageVlan(IngressFlowSegmentInstallCommand command) {
List<OFAction> vlanTransformation = OfAdapter.INSTANCE.makeVlanReplaceActions(of, Collections.emptyList(), Collections.singletonList(command.getEncapsulation().getId()));
OFFlowAdd expected = makeVlanForwardingMessage(command, -1, of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(command.getEndpoint().getPortNumber())).build(), getTargetIngressTableId(), vlanTransformation);
IngressFlowModFactory factory = makeFactory(command);
verifyOfMessageEquals(expected, factory.makeDefaultPortForwardMessage(new EffectiveIds(getEffectiveMeterId(command.getMeterConfig()), null)));
}
Aggregations