Search in sources :

Example 1 with IngressFlowSegmentInstallCommand

use of org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand in project open-kilda by telstra.

the class RecordHandler method makeFlowSegmentWrappedCommand.

private FlowSegmentWrapperCommand makeFlowSegmentWrappedCommand(InstallIngressFlow request, MessageContext messageContext, FlowSegmentResponseFactory responseFactory) {
    FlowEndpoint endpoint = new FlowEndpoint(request.getSwitchId(), request.getInputPort(), request.getInputVlanId(), request.getInputInnerVlanId(), request.isEnableLldp(), request.isEnableArp());
    MeterConfig meterConfig = makeMeterConfig(request.getMeterId(), request.getBandwidth());
    IngressFlowSegmentInstallCommand command = new IngressFlowSegmentInstallCommand(messageContext, EMPTY_COMMAND_ID, makeSegmentMetadata(request), endpoint, meterConfig, request.getEgressSwitchId(), request.getOutputPort(), makeTransitEncapsulation(request), new RulesContext(), request.getMirrorConfig());
    return new FlowSegmentWrapperCommand(command, responseFactory);
}
Also used : IngressFlowSegmentInstallCommand(org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand) FlowSegmentWrapperCommand(org.openkilda.floodlight.command.flow.FlowSegmentWrapperCommand) FlowEndpoint(org.openkilda.model.FlowEndpoint) RulesContext(org.openkilda.floodlight.model.RulesContext) OFMeterConfig(org.projectfloodlight.openflow.protocol.OFMeterConfig) MeterConfig(org.openkilda.model.MeterConfig)

Example 2 with IngressFlowSegmentInstallCommand

use of org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand in project open-kilda by telstra.

the class IngressFlowSegmentInstallFlowModFactoryTest method makeDefaultPortForwardMessageMeterlessVlanEncoded.

// --- makeDefaultPortForwardMessage
@Test
public void makeDefaultPortForwardMessageMeterlessVlanEncoded() {
    IngressFlowSegmentInstallCommand command = makeCommand(endpointZeroVlan, null, encapsulationVlan);
    testMakeDefaultPortForwardMessageVlan(command);
}
Also used : IngressFlowSegmentInstallCommand(org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand) Test(org.junit.Test)

Example 3 with IngressFlowSegmentInstallCommand

use of org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand 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)));
}
Also used : IngressFlowSegmentInstallCommand(org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand) FlowEndpoint(org.openkilda.model.FlowEndpoint) EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) Test(org.junit.Test)

Example 4 with IngressFlowSegmentInstallCommand

use of org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand 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)));
}
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 5 with IngressFlowSegmentInstallCommand

use of org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand 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)

Aggregations

IngressFlowSegmentInstallCommand (org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand)12 EffectiveIds (org.openkilda.floodlight.model.EffectiveIds)8 FlowEndpoint (org.openkilda.model.FlowEndpoint)8 OFFlowAdd (org.projectfloodlight.openflow.protocol.OFFlowAdd)6 Test (org.junit.Test)5 OFAction (org.projectfloodlight.openflow.protocol.action.OFAction)5 RoutingMetadata (org.openkilda.floodlight.utils.metadata.RoutingMetadata)4 FlowSegmentWrapperCommand (org.openkilda.floodlight.command.flow.FlowSegmentWrapperCommand)1 RulesContext (org.openkilda.floodlight.model.RulesContext)1 MeterConfig (org.openkilda.model.MeterConfig)1 OFMeterConfig (org.projectfloodlight.openflow.protocol.OFMeterConfig)1