Search in sources :

Example 21 with EffectiveIds

use of org.openkilda.floodlight.model.EffectiveIds in project open-kilda by telstra.

the class IngressFlowSegmentInstallFlowModFactoryTest method testMakeDefaultPortForwardMessageVxLan.

private void testMakeDefaultPortForwardMessageVxLan(IngressFlowSegmentInstallCommand command) {
    OFFlowAdd expected = makeVxLanForwardingMessage(command, -1, of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(command.getEndpoint().getPortNumber())).build(), getTargetIngressTableId(), Collections.emptyList());
    IngressFlowModFactory factory = makeFactory(command);
    verifyOfMessageEquals(expected, factory.makeDefaultPortForwardMessage(new EffectiveIds(getEffectiveMeterId(command.getMeterConfig()), null)));
}
Also used : EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd)

Example 22 with EffectiveIds

use of org.openkilda.floodlight.model.EffectiveIds in project open-kilda by telstra.

the class IngressFlowSegmentInstallFlowModFactoryTest method testMakeOuterOnlyVlanForwardMessageVlanEncoded.

private void testMakeOuterOnlyVlanForwardMessageVlanEncoded(MeterConfig meter) {
    IngressFlowSegmentInstallCommand command = makeCommand(endpointSingleVlan, meter, encapsulationVlan);
    FlowEndpoint endpoint = command.getEndpoint();
    List<OFAction> vlanTransformation = OfAdapter.INSTANCE.makeVlanReplaceActions(of, endpoint.getVlanStack(), makeTransitVlanStack(endpoint, command.getEncapsulation().getId()));
    OFFlowAdd expected = makeVlanForwardingMessage(command, 0, OfAdapter.INSTANCE.matchVlanId(of, of.buildMatch(), command.getEndpoint().getOuterVlanId()).setExact(MatchField.IN_PORT, OFPort.of(command.getEndpoint().getPortNumber())).build(), getTargetIngressTableId(), vlanTransformation);
    IngressFlowModFactory factory = makeFactory(command);
    verifyOfMessageEquals(expected, factory.makeOuterOnlyVlanForwardMessage(new EffectiveIds(getEffectiveMeterId(command.getMeterConfig()), null)));
}
Also used : IngressFlowSegmentInstallCommand(org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand) FlowEndpoint(org.openkilda.model.FlowEndpoint) EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd)

Example 23 with EffectiveIds

use of org.openkilda.floodlight.model.EffectiveIds in project open-kilda by telstra.

the class IngressServer42FlowInstallCommandTest method server42IngressFlowDefaultMultiTableVxlan.

@Test
public void server42IngressFlowDefaultMultiTableVxlan() throws Exception {
    IngressServer42FlowInstallCommand command = createCommand(0, 0, VXLAN_ENCAPSULATION, true);
    OFFlowMod mod = assertModCountAndReturnMod(command.makeFlowModMessages(new EffectiveIds()));
    assertCommonMultiTable(mod);
    assertEquals(2, stream(mod.getMatch().getMatchFields().spliterator(), false).count());
    assertNull(mod.getMatch().get(MatchField.VLAN_VID));
    assertMetadata(mod, 0, CUSTOMER_PORT);
    List<OFAction> applyActions = ((OFInstructionApplyActions) mod.getInstructions().get(0)).getActions();
    assertEquals(2, applyActions.size());
    assertPushVxlanAction(applyActions.get(0));
    assertOutputAction(applyActions.get(1));
}
Also used : OFInstructionApplyActions(org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions) EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod) Test(org.junit.Test)

Example 24 with EffectiveIds

use of org.openkilda.floodlight.model.EffectiveIds in project open-kilda by telstra.

the class IngressServer42FlowInstallCommandTest method server42IngressFlowSingleTagMultiTableVlan.

@Test
public void server42IngressFlowSingleTagMultiTableVlan() throws Exception {
    IngressServer42FlowInstallCommand command = createCommand(VLAN_1, 0, VLAN_ENCAPSULATION, true);
    OFFlowMod mod = assertModCountAndReturnMod(command.makeFlowModMessages(new EffectiveIds()));
    assertCommonMultiTable(mod);
    assertEquals(2, stream(mod.getMatch().getMatchFields().spliterator(), false).count());
    assertNull(mod.getMatch().get(MatchField.VLAN_VID));
    assertMetadata(mod, VLAN_1, CUSTOMER_PORT);
    List<OFAction> applyActions = ((OFInstructionApplyActions) mod.getInstructions().get(0)).getActions();
    assertEquals(5, applyActions.size());
    assertSetField(applyActions.get(0), OFOxmEthSrc.class, MacAddress.of(INGRESS_SWITCH_ID.toMacAddress()));
    assertSetField(applyActions.get(1), OFOxmEthDst.class, MacAddress.of(EGRESS_SWITCH_ID.toMacAddress()));
    assertPushVlanAction(applyActions.get(2));
    assertSetField(applyActions.get(3), OFOxmVlanVid.class, OFVlanVidMatch.ofVlan(VLAN_ENCAPSULATION.getId()));
    assertOutputAction(applyActions.get(4));
}
Also used : OFInstructionApplyActions(org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions) EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod) Test(org.junit.Test)

Example 25 with EffectiveIds

use of org.openkilda.floodlight.model.EffectiveIds in project open-kilda by telstra.

the class IngressServer42FlowInstallCommandTest method server42IngressFlowSigleTagMultiTableVxlan.

@Test
public void server42IngressFlowSigleTagMultiTableVxlan() throws Exception {
    IngressServer42FlowInstallCommand command = createCommand(VLAN_1, 0, VXLAN_ENCAPSULATION, true);
    OFFlowMod mod = assertModCountAndReturnMod(command.makeFlowModMessages(new EffectiveIds()));
    assertCommonMultiTable(mod);
    assertEquals(2, stream(mod.getMatch().getMatchFields().spliterator(), false).count());
    assertNull(mod.getMatch().get(MatchField.VLAN_VID));
    assertMetadata(mod, VLAN_1, CUSTOMER_PORT);
    List<OFAction> applyActions = ((OFInstructionApplyActions) mod.getInstructions().get(0)).getActions();
    assertEquals(2, applyActions.size());
    assertPushVxlanAction(applyActions.get(0));
    assertOutputAction(applyActions.get(1));
}
Also used : OFInstructionApplyActions(org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions) EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod) Test(org.junit.Test)

Aggregations

EffectiveIds (org.openkilda.floodlight.model.EffectiveIds)45 Test (org.junit.Test)24 OFAction (org.projectfloodlight.openflow.protocol.action.OFAction)21 OFFlowMod (org.projectfloodlight.openflow.protocol.OFFlowMod)15 OFInstructionApplyActions (org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions)15 OFFlowAdd (org.projectfloodlight.openflow.protocol.OFFlowAdd)12 FlowEndpoint (org.openkilda.model.FlowEndpoint)9 IngressFlowSegmentInstallCommand (org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand)8 RoutingMetadata (org.openkilda.floodlight.utils.metadata.RoutingMetadata)6 FlowSegmentReport (org.openkilda.floodlight.command.flow.FlowSegmentReport)5 SwitchErrorResponseException (org.openkilda.floodlight.error.SwitchErrorResponseException)3 OneSwitchFlowInstallCommand (org.openkilda.floodlight.command.flow.ingress.OneSwitchFlowInstallCommand)2 UnsupportedSwitchOperationException (org.openkilda.floodlight.error.UnsupportedSwitchOperationException)2