Search in sources :

Example 1 with FlowDirection

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

the class PingProducer method buildPing.

private Ping buildPing(PingContext pingContext, FlowDirection direction) {
    Flow flow = pingContext.getFlow();
    FlowEndpoint ingress;
    FlowEndpoint egress;
    int islPort;
    if (FlowDirection.FORWARD == direction) {
        ingress = new FlowSourceAdapter(flow).getEndpoint();
        egress = new FlowDestAdapter(flow).getEndpoint();
        islPort = getIslPort(flow, flow.getForwardPath());
    } else if (FlowDirection.REVERSE == direction) {
        ingress = new FlowDestAdapter(flow).getEndpoint();
        egress = new FlowSourceAdapter(flow).getEndpoint();
        islPort = getIslPort(flow, flow.getReversePath());
    } else {
        throw new IllegalArgumentException(String.format("Unexpected %s value: %s", FlowDirection.class.getCanonicalName(), direction));
    }
    return new Ping(new NetworkEndpoint(ingress.getSwitchId(), ingress.getPortNumber()), new NetworkEndpoint(egress.getSwitchId(), egress.getPortNumber()), pingContext.getTransitEncapsulation(), islPort);
}
Also used : FlowSourceAdapter(org.openkilda.adapter.FlowSourceAdapter) FlowEndpoint(org.openkilda.model.FlowEndpoint) NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) FlowDirection(org.openkilda.messaging.model.FlowDirection) FlowDestAdapter(org.openkilda.adapter.FlowDestAdapter) Ping(org.openkilda.messaging.model.Ping) FlowEndpoint(org.openkilda.model.FlowEndpoint) NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) Flow(org.openkilda.model.Flow)

Aggregations

FlowDestAdapter (org.openkilda.adapter.FlowDestAdapter)1 FlowSourceAdapter (org.openkilda.adapter.FlowSourceAdapter)1 FlowDirection (org.openkilda.messaging.model.FlowDirection)1 NetworkEndpoint (org.openkilda.messaging.model.NetworkEndpoint)1 Ping (org.openkilda.messaging.model.Ping)1 Flow (org.openkilda.model.Flow)1 FlowEndpoint (org.openkilda.model.FlowEndpoint)1