Search in sources :

Example 1 with RoutingMetadata

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

the class OneSwitchFlowInstallFlowModFactoryTest method testMakeDoubleVlanForwardMessageVlanEncoded.

private void testMakeDoubleVlanForwardMessageVlanEncoded(MeterConfig meter) {
    OneSwitchFlowInstallCommand command = makeCommand(endpointDoubleVlan, egressEndpointDoubleVlan, meter);
    FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(Collections.emptySet());
    OFFlowAdd expected = makeForwardingMessage(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(), FlowEndpoint.makeVlanStack(endpoint.getInnerVlanId()));
    IngressFlowModFactory factory = makeFactory(command);
    verifyOfMessageEquals(expected, factory.makeDoubleVlanForwardMessage(new EffectiveIds(getEffectiveMeterId(command.getMeterConfig()), null)));
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) OneSwitchFlowInstallCommand(org.openkilda.floodlight.command.flow.ingress.OneSwitchFlowInstallCommand) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd)

Example 2 with RoutingMetadata

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

the class OneSwitchFlowInstallFlowModFactoryTest method testMakeSingleVlanForwardMessage.

private void testMakeSingleVlanForwardMessage(MeterConfig meter) {
    OneSwitchFlowInstallCommand command = makeCommand(endpointSingleVlan, egressEndpointSingleVlan, meter);
    FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(Collections.emptySet());
    OFFlowAdd expected = makeForwardingMessage(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(), FlowEndpoint.makeVlanStack(endpoint.getInnerVlanId()));
    IngressFlowModFactory factory = makeFactory(command);
    verifyOfMessageEquals(expected, factory.makeSingleVlanForwardMessage(new EffectiveIds(getEffectiveMeterId(command.getMeterConfig()), null)));
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) OneSwitchFlowInstallCommand(org.openkilda.floodlight.command.flow.ingress.OneSwitchFlowInstallCommand) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd)

Example 3 with RoutingMetadata

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

the class IngressFlowModFactory method makeDoubleVlanForwardMessage.

/**
 * Make rule to match inner VLAN tag and forward in in ISL (or out port in case one-switch flow).
 */
public OFFlowMod makeDoubleVlanForwardMessage(EffectiveIds effectiveIds) {
    FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(switchFeatures);
    OFFlowMod.Builder builder = flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.INGRESS_TABLE_ID), 10).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())).setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(endpoint.getInnerVlanId())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build());
    return makeForwardMessage(builder, effectiveIds, FlowEndpoint.makeVlanStack(endpoint.getInnerVlanId()));
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) Builder(org.projectfloodlight.openflow.protocol.OFFlowMod.Builder) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod)

Example 4 with RoutingMetadata

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

the class IngressFlowModFactory method makeDoubleVlanFlowLoopMessage.

/**
 * Make ingress flow loop rule to match all flow traffic by port and two vlans and route it back to port from
 * where it came and restore vlan stack.
 */
public OFFlowMod makeDoubleVlanFlowLoopMessage() {
    FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(switchFeatures);
    return flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.INGRESS_TABLE_ID), 10).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())).setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(endpoint.getInnerVlanId())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build()).setCookie(U64.of(command.getCookie().getValue())).setInstructions(makeIngressFlowLoopInstructions(endpoint)).build();
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata)

Example 5 with RoutingMetadata

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

the class IngressFlowModFactory method makeSingleVlanServer42IngressFlowMessage.

/**
 * Make rule to forward server 42 traffic matched by outer VLAN tag and forward in in ISL.
 */
public OFFlowMod makeSingleVlanServer42IngressFlowMessage() {
    RoutingMetadata metadata = buildServer42IngressMetadata();
    OFFlowMod.Builder builder = flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.INGRESS_TABLE_ID)).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(command.getRulesContext().getServer42Port())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build());
    return makeServer42IngressFlowMessage(builder, Collections.emptyList());
}
Also used : RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) Builder(org.projectfloodlight.openflow.protocol.OFFlowMod.Builder) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod)

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