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);
}
Aggregations