Search in sources :

Example 31 with FlowEndpoint

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

the class SpeakerFlowSegmentRequestBuilderTest method verifyReverseEgressRequest.

private void verifyReverseEgressRequest(Flow flow, FlowSegmentRequest rawRequest) {
    FlowPath path = Objects.requireNonNull(flow.getReversePath());
    EgressFlowSegmentRequest request = verifyCommonEgressRequest(flow, path, rawRequest);
    FlowEndpoint expectedEndpoint = new FlowEndpoint(flow.getSrcSwitchId(), flow.getSrcPort(), flow.getSrcVlan());
    assertEquals(expectedEndpoint, request.getEndpoint());
    FlowEndpoint expectedIngressEndpoint = new FlowEndpoint(flow.getDestSwitchId(), flow.getDestPort(), flow.getDestVlan());
    assertEquals(expectedIngressEndpoint, request.getIngressEndpoint());
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) FlowPath(org.openkilda.model.FlowPath) EgressFlowSegmentRequest(org.openkilda.floodlight.api.request.EgressFlowSegmentRequest)

Example 32 with FlowEndpoint

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

the class SpeakerFlowSegmentRequestBuilderTest method verifyReverseOneSwitchRequest.

private void verifyReverseOneSwitchRequest(Flow flow, FlowSegmentRequest rawRequest) {
    FlowPath path = Objects.requireNonNull(flow.getReversePath());
    OneSwitchFlowRequest request = verifyCommonOneSwitchRequest(flow, path, rawRequest);
    assertEquals(new FlowEndpoint(flow.getDestSwitchId(), flow.getDestPort(), flow.getDestVlan()), request.getEndpoint());
    assertEquals(new FlowEndpoint(flow.getSrcSwitchId(), flow.getSrcPort(), flow.getSrcVlan()), request.getEgressEndpoint());
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) OneSwitchFlowRequest(org.openkilda.floodlight.api.request.OneSwitchFlowRequest) FlowPath(org.openkilda.model.FlowPath)

Example 33 with FlowEndpoint

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

the class SpeakerFlowSegmentRequestBuilderTest method verifyForwardOneSwitchRequest.

private void verifyForwardOneSwitchRequest(Flow flow, FlowSegmentRequest rawRequest) {
    FlowPath path = Objects.requireNonNull(flow.getForwardPath());
    OneSwitchFlowRequest request = verifyCommonOneSwitchRequest(flow, path, rawRequest);
    assertEquals(new FlowEndpoint(flow.getSrcSwitchId(), flow.getSrcPort(), flow.getSrcVlan()), request.getEndpoint());
    assertEquals(new FlowEndpoint(flow.getDestSwitchId(), flow.getDestPort(), flow.getDestVlan()), request.getEgressEndpoint());
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) OneSwitchFlowRequest(org.openkilda.floodlight.api.request.OneSwitchFlowRequest) FlowPath(org.openkilda.model.FlowPath)

Example 34 with FlowEndpoint

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

the class SpeakerFlowSegmentRequestBuilderTest method verifyForwardIngressRequest.

private IngressFlowSegmentRequest verifyForwardIngressRequest(Flow flow, FlowSegmentRequest rawRequest) {
    FlowPath path = Objects.requireNonNull(flow.getForwardPath());
    IngressFlowSegmentRequest request = verifyCommonIngressRequest(flow, path, rawRequest);
    assertEquals(flow.getSrcSwitchId(), request.getSwitchId());
    FlowEndpoint endpoint = new FlowEndpoint(flow.getSrcSwitchId(), flow.getSrcPort(), flow.getSrcVlan());
    assertEquals(endpoint, request.getEndpoint());
    return request;
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) IngressFlowSegmentRequest(org.openkilda.floodlight.api.request.IngressFlowSegmentRequest) FlowPath(org.openkilda.model.FlowPath)

Example 35 with FlowEndpoint

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

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