Search in sources :

Example 81 with FlowEndpoint

use of org.openkilda.model.FlowEndpoint 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 82 with FlowEndpoint

use of org.openkilda.model.FlowEndpoint 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 83 with FlowEndpoint

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

the class OneSwitchFlowInstallFlowModFactoryTest method makeOuterOnlyVlanForwardMessageSamePort.

// --- makeOuterOnlyVlanForwardMessage
@Test
public void makeOuterOnlyVlanForwardMessageSamePort() {
    FlowEndpoint egress = new FlowEndpoint(endpointSingleVlan.getSwitchId(), endpointSingleVlan.getPortNumber(), endpointSingleVlan.getOuterVlanId() + 1);
    OneSwitchFlowInstallCommand command = makeCommand(endpointSingleVlan, egress, meterConfig);
    testMakeOuterOnlyVlanForwardMessage(command);
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) OneSwitchFlowInstallCommand(org.openkilda.floodlight.command.flow.ingress.OneSwitchFlowInstallCommand) Test(org.junit.Test)

Example 84 with FlowEndpoint

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

the class IngressFlowModFactoryTest method makeCustomerPortSharedCatchInstallMessage.

// --- makeCustomerPortSharedCatchInstallMessage
@Test
public void makeCustomerPortSharedCatchInstallMessage() {
    IngressFlowModFactory factory = makeFactory();
    FlowEndpoint endpoint = factory.getCommand().getEndpoint();
    OFFlowMod expected = of.buildFlowAdd().setTableId(TableId.of(SwitchManager.INPUT_TABLE_ID)).setPriority(SwitchManager.INGRESS_CUSTOMER_PORT_RULE_PRIORITY_MULTITABLE).setCookie(U64.of(Cookie.encodeIngressRulePassThrough(endpoint.getPortNumber()))).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())).build()).setInstructions(Collections.singletonList(of.instructions().gotoTable(TableId.of(SwitchManager.PRE_INGRESS_TABLE_ID)))).build();
    verifyOfMessageEquals(expected, factory.makeCustomerPortSharedCatchMessage());
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod) Test(org.junit.Test)

Example 85 with FlowEndpoint

use of org.openkilda.model.FlowEndpoint 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

FlowEndpoint (org.openkilda.model.FlowEndpoint)105 Test (org.junit.Test)26 Flow (org.openkilda.model.Flow)22 ArrayList (java.util.ArrayList)15 RoutingMetadata (org.openkilda.floodlight.utils.metadata.RoutingMetadata)12 YFlow (org.openkilda.model.YFlow)11 FlowPath (org.openkilda.model.FlowPath)10 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)9 SpeakerData (org.openkilda.rulemanager.SpeakerData)9 SwitchId (org.openkilda.model.SwitchId)8 YSubFlow (org.openkilda.model.YSubFlow)8 HashSet (java.util.HashSet)7 FlowSideAdapter (org.openkilda.adapter.FlowSideAdapter)7 FlowSourceAdapter (org.openkilda.adapter.FlowSourceAdapter)7 IngressFlowSegmentInstallCommand (org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand)7 EffectiveIds (org.openkilda.floodlight.model.EffectiveIds)7 FlowSegmentWrapperCommand (org.openkilda.floodlight.command.flow.FlowSegmentWrapperCommand)6 FlowProcessingException (org.openkilda.wfm.topology.flowhs.exception.FlowProcessingException)6 OFFlowAdd (org.projectfloodlight.openflow.protocol.OFFlowAdd)6 MessageContext (org.openkilda.messaging.MessageContext)5