Search in sources :

Example 1 with OffsetMap

use of org.opendaylight.protocol.bgp.mode.impl.add.OffsetMap in project bgpcep by opendaylight.

the class ComplexRouteEntry method createRoute.

@Override
public Route createRoute(final RIBSupport ribSup, final Identifier routeKey, final long pathId, final AddPathBestPath path) {
    final OffsetMap map = getOffsets();
    final Route route = map.getValue(this.values, map.offsetOf(path.getRouteKey()));
    return ribSup.createRoute(route, routeKey, pathId, path.getAttributes());
}
Also used : OffsetMap(org.opendaylight.protocol.bgp.mode.impl.add.OffsetMap) Route(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route)

Example 2 with OffsetMap

use of org.opendaylight.protocol.bgp.mode.impl.add.OffsetMap in project bgpcep by opendaylight.

the class ComplexRouteEntry method addRoute.

@Override
public int addRoute(final UnsignedInteger routerId, final long remotePathId, final Route route) {
    final OffsetMap oldMap = getOffsets();
    final int offset = addRoute(new RouteKey(routerId, remotePathId), route.getAttributes());
    final OffsetMap newMap = getOffsets();
    if (!newMap.equals(oldMap)) {
        this.values = newMap.expand(oldMap, this.values, offset);
    }
    newMap.setValue(this.values, offset, route);
    return offset;
}
Also used : RouteKey(org.opendaylight.protocol.bgp.mode.impl.add.RouteKey) OffsetMap(org.opendaylight.protocol.bgp.mode.impl.add.OffsetMap)

Example 3 with OffsetMap

use of org.opendaylight.protocol.bgp.mode.impl.add.OffsetMap in project bgpcep by opendaylight.

the class ComplexRouteEntry method createRoute.

@Override
public Route createRoute(final RIBSupport ribSup, final Identifier routeKey, final long pathId, final AddPathBestPath path) {
    final OffsetMap map = getOffsets();
    final Route route = map.getValue(this.values, map.offsetOf(path.getRouteKey()));
    return ribSup.createRoute(route, routeKey, pathId, path.getAttributes());
}
Also used : OffsetMap(org.opendaylight.protocol.bgp.mode.impl.add.OffsetMap) Route(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route)

Example 4 with OffsetMap

use of org.opendaylight.protocol.bgp.mode.impl.add.OffsetMap in project bgpcep by opendaylight.

the class ComplexRouteEntry method removeRoute.

@Override
public boolean removeRoute(final UnsignedInteger routerId, final long remotePathId) {
    final RouteKey key = new RouteKey(routerId, remotePathId);
    final OffsetMap map = getOffsets();
    final int offset = map.offsetOf(key);
    this.values = map.removeValue(this.values, offset);
    return removeRoute(key, offset);
}
Also used : RouteKey(org.opendaylight.protocol.bgp.mode.impl.add.RouteKey) OffsetMap(org.opendaylight.protocol.bgp.mode.impl.add.OffsetMap)

Example 5 with OffsetMap

use of org.opendaylight.protocol.bgp.mode.impl.add.OffsetMap in project bgpcep by opendaylight.

the class ComplexRouteEntry method addRoute.

@Override
public int addRoute(final UnsignedInteger routerId, final long remotePathId, final Route route) {
    final OffsetMap oldMap = getOffsets();
    final int offset = addRoute(new RouteKey(routerId, remotePathId), route.getAttributes());
    final OffsetMap newMap = getOffsets();
    if (!newMap.equals(oldMap)) {
        this.values = newMap.expand(oldMap, this.values, offset);
    }
    newMap.setValue(this.values, offset, route);
    return offset;
}
Also used : RouteKey(org.opendaylight.protocol.bgp.mode.impl.add.RouteKey) OffsetMap(org.opendaylight.protocol.bgp.mode.impl.add.OffsetMap)

Aggregations

OffsetMap (org.opendaylight.protocol.bgp.mode.impl.add.OffsetMap)6 RouteKey (org.opendaylight.protocol.bgp.mode.impl.add.RouteKey)4 Route (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route)2