Search in sources :

Example 1 with GeoDistanceLinkWeight

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();
}
Also used : GeoDistanceLinkWeight(org.onosproject.net.topology.GeoDistanceLinkWeight) PathService(org.onosproject.net.topology.PathService) TopologyService(org.onosproject.net.topology.TopologyService)

Example 2 with GeoDistanceLinkWeight

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);
}
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)2 LinkWeigher (org.onosproject.net.topology.LinkWeigher)1 MetricLinkWeight (org.onosproject.net.topology.MetricLinkWeight)1 PathService (org.onosproject.net.topology.PathService)1 TopologyService (org.onosproject.net.topology.TopologyService)1 Modified (org.osgi.service.component.annotations.Modified)1