Search in sources :

Example 1 with YFlowStatsInfoFactory

use of org.openkilda.messaging.info.stats.YFlowStatsInfoFactory in project open-kilda by telstra.

the class YFlowProcessingFsm method newYFlowStatsInfoFactory.

private YFlowStatsInfoFactory newYFlowStatsInfoFactory(YFlowResources resources) throws InsufficientDataException {
    YFlowResources.EndpointResources sharedEndpoint = resources.getSharedEndpointResources();
    YFlowResources.EndpointResources yPoint = resources.getMainPathYPointResources();
    String missing;
    if (sharedEndpoint == null && yPoint == null) {
        missing = "shared and y-point endpoints";
    } else if (sharedEndpoint == null) {
        missing = "shared endpoint";
    } else if (yPoint == null) {
        missing = "y-point endpoint";
    } else {
        missing = null;
    }
    if (missing != null) {
        throw new InsufficientDataException(String.format("%s data are empty (is null)", missing));
    }
    return new YFlowStatsInfoFactory(getYFlowId(), new YFlowEndpointResources(sharedEndpoint.getEndpoint(), sharedEndpoint.getMeterId()), new YFlowEndpointResources(yPoint.getEndpoint(), yPoint.getMeterId()));
}
Also used : YFlowResources(org.openkilda.wfm.topology.flowhs.model.yflow.YFlowResources) InsufficientDataException(org.openkilda.wfm.topology.flowhs.exception.InsufficientDataException) YFlowStatsInfoFactory(org.openkilda.messaging.info.stats.YFlowStatsInfoFactory) YFlowEndpointResources(org.openkilda.messaging.payload.yflow.YFlowEndpointResources)

Aggregations

YFlowStatsInfoFactory (org.openkilda.messaging.info.stats.YFlowStatsInfoFactory)1 YFlowEndpointResources (org.openkilda.messaging.payload.yflow.YFlowEndpointResources)1 InsufficientDataException (org.openkilda.wfm.topology.flowhs.exception.InsufficientDataException)1 YFlowResources (org.openkilda.wfm.topology.flowhs.model.yflow.YFlowResources)1