Search in sources :

Example 1 with MetricLinkWeight

use of org.onosproject.net.topology.MetricLinkWeight in project onos by opennetworkinglab.

the class DistributedTopologyStore method modified.

@Modified
protected void modified(ComponentContext context) {
    Dictionary<?, ?> properties = context.getProperties();
    String newLinkWeightFunction = get(properties, LINK_WEIGHT_FUNCTION);
    if (newLinkWeightFunction != null && !Objects.equals(newLinkWeightFunction, linkWeightFunction)) {
        linkWeightFunction = newLinkWeightFunction;
        LinkWeigher weight = linkWeightFunction.equals(LINK_METRIC) ? new MetricLinkWeight() : linkWeightFunction.equals(GEO_DISTANCE) ? new GeoDistanceLinkWeight(deviceService) : null;
        setDefaultLinkWeigher(weight);
    }
    String newMaxPaths = get(properties, MAX_PATHS);
    if (newMaxPaths != null) {
        try {
            setDefaultMaxPaths(Integer.parseInt(newMaxPaths));
        } catch (NumberFormatException e) {
            log.warn("maxPaths must be a number; not {}", newMaxPaths);
        }
    }
    log.info(FORMAT, linkWeightFunction);
}
Also used : GeoDistanceLinkWeight(org.onosproject.net.topology.GeoDistanceLinkWeight) LinkWeigher(org.onosproject.net.topology.LinkWeigher) MetricLinkWeight(org.onosproject.net.topology.MetricLinkWeight) Modified(org.osgi.service.component.annotations.Modified)

Aggregations

GeoDistanceLinkWeight (org.onosproject.net.topology.GeoDistanceLinkWeight)1 LinkWeigher (org.onosproject.net.topology.LinkWeigher)1 MetricLinkWeight (org.onosproject.net.topology.MetricLinkWeight)1 Modified (org.osgi.service.component.annotations.Modified)1