Search in sources :

Example 1 with DetectConnectedDevicesPayload

use of org.openkilda.messaging.payload.flow.DetectConnectedDevicesPayload in project open-kilda by telstra.

the class FlowMapper method toFlowCreateRequest.

/**
 * Map FlowCreatePayload.
 *
 * @param source {@link FlowCreatePayload} instance.
 * @return {@link FlowRequest} instance.
 */
public FlowRequest toFlowCreateRequest(FlowCreatePayload source) {
    FlowRequest target = toFlowRequest(source).toBuilder().diverseFlowId(source.getDiverseFlowId()).type(Type.CREATE).build();
    if (source.getSource().getDetectConnectedDevices() != null) {
        DetectConnectedDevicesPayload srcDevs = source.getSource().getDetectConnectedDevices();
        target.getDetectConnectedDevices().setSrcArp(srcDevs.isArp());
        target.getDetectConnectedDevices().setSrcLldp(srcDevs.isLldp());
    }
    if (source.getDestination().getDetectConnectedDevices() != null) {
        DetectConnectedDevicesPayload dstDevs = source.getDestination().getDetectConnectedDevices();
        target.getDetectConnectedDevices().setDstArp(dstDevs.isArp());
        target.getDetectConnectedDevices().setDstLldp(dstDevs.isLldp());
    }
    return target;
}
Also used : FlowRequest(org.openkilda.messaging.command.flow.FlowRequest) DetectConnectedDevicesPayload(org.openkilda.messaging.payload.flow.DetectConnectedDevicesPayload)

Example 2 with DetectConnectedDevicesPayload

use of org.openkilda.messaging.payload.flow.DetectConnectedDevicesPayload in project open-kilda by telstra.

the class FlowMapper method toFlowUpdateRequest.

/**
 * Map FlowUpdatePayload.
 *
 * @param source {@link FlowUpdatePayload} instance.
 * @return {@link FlowRequest} instance.
 */
public FlowRequest toFlowUpdateRequest(FlowUpdatePayload source) {
    FlowRequest target = toFlowRequest(source).toBuilder().diverseFlowId(source.getDiverseFlowId()).type(Type.UPDATE).build();
    if (source.getSource().getDetectConnectedDevices() != null) {
        DetectConnectedDevicesPayload srcDevs = source.getSource().getDetectConnectedDevices();
        target.getDetectConnectedDevices().setSrcArp(srcDevs.isArp());
        target.getDetectConnectedDevices().setSrcLldp(srcDevs.isLldp());
    }
    if (source.getDestination().getDetectConnectedDevices() != null) {
        DetectConnectedDevicesPayload dstDevs = source.getDestination().getDetectConnectedDevices();
        target.getDetectConnectedDevices().setDstArp(dstDevs.isArp());
        target.getDetectConnectedDevices().setDstLldp(dstDevs.isLldp());
    }
    return target;
}
Also used : FlowRequest(org.openkilda.messaging.command.flow.FlowRequest) DetectConnectedDevicesPayload(org.openkilda.messaging.payload.flow.DetectConnectedDevicesPayload)

Aggregations

FlowRequest (org.openkilda.messaging.command.flow.FlowRequest)2 DetectConnectedDevicesPayload (org.openkilda.messaging.payload.flow.DetectConnectedDevicesPayload)2