Search in sources :

Example 6 with BfdProperties

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

the class IslMapper method map.

/**
 * Convert {@link Isl} to {@link IslInfoData}.
 */
public IslInfoData map(Isl isl) {
    if (isl == null) {
        return null;
    }
    PathNode src = new PathNode();
    src.setSwitchId(isl.getSrcSwitchId());
    src.setPortNo(isl.getSrcPort());
    src.setSegLatency(isl.getLatency());
    src.setSeqId(0);
    PathNode dst = new PathNode();
    dst.setSwitchId(isl.getDestSwitchId());
    dst.setPortNo(isl.getDestPort());
    dst.setSegLatency(isl.getLatency());
    dst.setSeqId(1);
    Long timeCreateMillis = Optional.ofNullable(isl.getTimeCreate()).map(Instant::toEpochMilli).orElse(null);
    Long timeModifyMillis = Optional.ofNullable(isl.getTimeModify()).map(Instant::toEpochMilli).orElse(null);
    BfdProperties bfdProperties = readBfdProperties(isl);
    return new IslInfoData(isl.getLatency(), src, dst, isl.getSpeed(), isl.getAvailableBandwidth(), isl.getMaxBandwidth(), isl.getDefaultMaxBandwidth(), map(isl.getStatus()), map(isl.getActualStatus()), map(isl.getRoundTripStatus()), isl.getCost(), timeCreateMillis, timeModifyMillis, isl.isUnderMaintenance(), bfdProperties.isEnabled(), map(isl.getBfdSessionStatus()), null);
}
Also used : BfdProperties(org.openkilda.model.BfdProperties) IslInfoData(org.openkilda.messaging.info.event.IslInfoData) PathNode(org.openkilda.messaging.info.event.PathNode)

Aggregations

BfdProperties (org.openkilda.model.BfdProperties)6 Test (org.junit.Test)3 BfdSessionData (org.openkilda.wfm.topology.network.model.BfdSessionData)3 BfdSessionResponse (org.openkilda.messaging.floodlight.response.BfdSessionResponse)1 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)1 PathNode (org.openkilda.messaging.info.event.PathNode)1 NoviBfdSession (org.openkilda.messaging.model.NoviBfdSession)1 BfdSession (org.openkilda.model.BfdSession)1 Isl (org.openkilda.model.Isl)1