use of org.onosproject.net.topology.GeoDistanceLinkWeight in project onos by opennetworkinglab.
the class PathPainterTopovMessageHandler method init.
// ===============-=-=-=-=-=-======================-=-=-=-=-=-=-===========
@Override
public void init(UiConnection connection, ServiceDirectory directory) {
super.init(connection, directory);
pathService = directory.get(PathService.class);
topologyService = directory.get(TopologyService.class);
linkData = new GeoDistanceLinkWeight(directory.get(DeviceService.class));
addListeners();
}
use of org.onosproject.net.topology.GeoDistanceLinkWeight 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