Search in sources :

Example 1 with TransitFlowSegmentRequest

use of org.openkilda.floodlight.api.request.TransitFlowSegmentRequest in project open-kilda by telstra.

the class SpeakerFlowSegmentRequestBuilderTest method verifyCommonTransitRequest.

private TransitFlowSegmentRequest verifyCommonTransitRequest(Flow flow, FlowPath path, SwitchId datapath, FlowSegmentRequest rawRequest) {
    assertThat("Should be egress segment request", rawRequest, instanceOf(TransitFlowSegmentRequest.class));
    TransitFlowSegmentRequest request = (TransitFlowSegmentRequest) rawRequest;
    assertEquals(flow.getFlowId(), request.getFlowId());
    assertEquals(path.getCookie(), request.getCookie());
    assertEquals(SWITCH_2, request.getSwitchId());
    PathSegment ingress = null;
    PathSegment egress = null;
    for (PathSegment segment : path.getSegments()) {
        if (datapath.equals(segment.getDestSwitchId())) {
            ingress = segment;
        } else if (datapath.equals(segment.getSrcSwitchId())) {
            egress = segment;
        }
    }
    assertNotNull(ingress);
    assertNotNull(egress);
    assertEquals(ingress.getDestPort(), (int) request.getIngressIslPort());
    assertEquals(egress.getSrcPort(), (int) request.getEgressIslPort());
    verifyVlanEncapsulation(flow, path, request.getEncapsulation());
    return request;
}
Also used : TransitFlowSegmentRequest(org.openkilda.floodlight.api.request.TransitFlowSegmentRequest) PathSegment(org.openkilda.model.PathSegment)

Aggregations

TransitFlowSegmentRequest (org.openkilda.floodlight.api.request.TransitFlowSegmentRequest)1 PathSegment (org.openkilda.model.PathSegment)1