Search in sources :

Example 16 with RoutingMetadata

use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.

the class IngressFlowSegmentInstallFlowModFactoryTest method testMakeDoubleVlanForwardMessageVlanEncoded.

private void testMakeDoubleVlanForwardMessageVlanEncoded(MeterConfig meter) {
    IngressFlowSegmentInstallCommand command = makeCommand(endpointDoubleVlan, meter, encapsulationVlan);
    FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(Collections.emptySet());
    List<OFAction> vlanTransformation = OfAdapter.INSTANCE.makeVlanReplaceActions(of, FlowEndpoint.makeVlanStack(endpoint.getInnerVlanId()), FlowEndpoint.makeVlanStack(command.getEncapsulation().getId()));
    OFFlowAdd expected = makeVlanForwardingMessage(command, 10, OfAdapter.INSTANCE.matchVlanId(of, of.buildMatch(), endpoint.getInnerVlanId()).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.makeDoubleVlanForwardMessage(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) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd)

Example 17 with RoutingMetadata

use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.

the class IngressFlowSegmentInstallFlowModFactoryTest method testMakeSingleVlanForwardMessageVxLanEncoded.

private void testMakeSingleVlanForwardMessageVxLanEncoded(MeterConfig meter) {
    IngressFlowSegmentInstallCommand command = makeCommand(endpointSingleVlan, meter, encapsulationVxLan);
    FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(Collections.emptySet());
    OFFlowAdd expected = makeVxLanForwardingMessage(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(), Collections.emptyList());
    IngressFlowModFactory factory = makeFactory(command);
    verifyOfMessageEquals(expected, factory.makeSingleVlanForwardMessage(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) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd)

Example 18 with RoutingMetadata

use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.

the class IngressFlowSegmentInstallFlowModFactoryTest method testMakeDoubleVlanForwardMessageVxLanEncoded.

private void testMakeDoubleVlanForwardMessageVxLanEncoded(MeterConfig meter) {
    IngressFlowSegmentInstallCommand command = makeCommand(endpointDoubleVlan, meter, encapsulationVxLan);
    FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(Collections.emptySet());
    List<OFAction> vlanTransformation = OfAdapter.INSTANCE.makeVlanReplaceActions(of, FlowEndpoint.makeVlanStack(endpoint.getInnerVlanId()), Collections.emptyList());
    OFFlowAdd expected = makeVxLanForwardingMessage(command, 10, OfAdapter.INSTANCE.matchVlanId(of, of.buildMatch(), endpoint.getInnerVlanId()).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.makeDoubleVlanForwardMessage(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) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd)

Example 19 with RoutingMetadata

use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.

the class IngressServer42FlowInstallCommandTest method assertMetadata.

private void assertMetadata(OFFlowMod mod, int expectedOuterVlan, int expectedPort) {
    RoutingMetadataBuilder metadataBuilder = RoutingMetadata32.builder().inputPort(expectedPort);
    if (expectedOuterVlan != 0) {
        metadataBuilder.outerVlanId(expectedOuterVlan);
    }
    RoutingMetadata metadata = metadataBuilder.build(FEATURES);
    assertEquals(metadata.getValue(), mod.getMatch().getMasked(MatchField.METADATA).getValue().getValue());
    assertEquals(metadata.getMask(), mod.getMatch().getMasked(MatchField.METADATA).getMask().getValue());
}
Also used : RoutingMetadataBuilder(org.openkilda.floodlight.utils.metadata.RoutingMetadata.RoutingMetadataBuilder) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata)

Example 20 with RoutingMetadata

use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.

the class IngressFlowModFactoryTest method makeOuterVlanMatchSharedMessage.

// --- makeOuterVlanMatchSharedMessage
@Test
public void makeOuterVlanMatchSharedMessage() {
    final IngressFlowModFactory factory = makeFactory();
    final IngressFlowSegmentBase command = factory.getCommand();
    final FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(Collections.emptySet());
    OFFlowAdd expected = of.buildFlowAdd().setTableId(getTargetPreIngressTableId()).setPriority(FlowSegmentCommand.FLOW_PRIORITY).setCookie(U64.of(FlowSharedSegmentCookie.builder(SharedSegmentType.QINQ_OUTER_VLAN).portNumber(endpoint.getPortNumber()).vlanId(endpoint.getOuterVlanId()).build().getValue())).setMatch(OfAdapter.INSTANCE.matchVlanId(of, of.buildMatch(), endpoint.getOuterVlanId()).setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())).build()).setInstructions(ImmutableList.of(of.instructions().applyActions(Collections.singletonList(of.actions().popVlan())), of.instructions().writeMetadata(metadata.getValue(), metadata.getMask()), of.instructions().gotoTable(TableId.of(SwitchManager.INGRESS_TABLE_ID)))).build();
    verifyOfMessageEquals(expected, factory.makeOuterVlanMatchSharedMessage());
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) IngressFlowSegmentBase(org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentBase) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd) Test(org.junit.Test)

Aggregations

RoutingMetadata (org.openkilda.floodlight.utils.metadata.RoutingMetadata)29 FlowEndpoint (org.openkilda.model.FlowEndpoint)13 OFFactory (org.projectfloodlight.openflow.protocol.OFFactory)12 Match (org.projectfloodlight.openflow.protocol.match.Match)10 OFInstructionApplyActions (org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions)8 OFFlowAdd (org.projectfloodlight.openflow.protocol.OFFlowAdd)7 EffectiveIds (org.openkilda.floodlight.model.EffectiveIds)6 OFFlowMod (org.projectfloodlight.openflow.protocol.OFFlowMod)6 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)4 IngressFlowSegmentInstallCommand (org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand)4 Builder (org.projectfloodlight.openflow.protocol.OFFlowMod.Builder)4 OFAction (org.projectfloodlight.openflow.protocol.action.OFAction)3 OFInstructionWriteMetadata (org.projectfloodlight.openflow.protocol.instruction.OFInstructionWriteMetadata)3 OneSwitchFlowInstallCommand (org.openkilda.floodlight.command.flow.ingress.OneSwitchFlowInstallCommand)2 RoutingMetadataBuilder (org.openkilda.floodlight.utils.metadata.RoutingMetadata.RoutingMetadataBuilder)2 SwitchFeature (org.openkilda.model.SwitchFeature)2 OFInstruction (org.projectfloodlight.openflow.protocol.instruction.OFInstruction)2 OFInstructionGotoTable (org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable)2 OFVlanVidMatch (org.projectfloodlight.openflow.types.OFVlanVidMatch)2 Test (org.junit.Test)1