use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.rib.LocRib in project bgpcep by opendaylight.
the class BaseAbstractRouteEntry method removePathFromDataStore.
@SuppressWarnings("unchecked")
private void removePathFromDataStore(final RouteEntryDependenciesContainer entryDep, final Identifier routeKey, final WriteTransaction tx) {
LOG.trace("Best Path removed {}", this.removedBestPath);
final KeyedInstanceIdentifier<Tables, TablesKey> locRibTarget = entryDep.getLocRibTableTarget();
final RIBSupport ribSup = entryDep.getRibSupport();
Identifier newRouteKey = ribSup.createNewRouteKey(this.removedBestPath.getPathId(), routeKey);
if (newRouteKey == null) {
newRouteKey = routeKey;
}
final InstanceIdentifier routeTarget = ribSup.createRouteIdentifier(locRibTarget, newRouteKey);
LOG.debug("Delete route from LocRib {}", routeTarget);
tx.delete(LogicalDatastoreType.OPERATIONAL, routeTarget);
fillAdjRibsOut(null, null, newRouteKey, this.removedBestPath.getPeerId(), entryDep, tx);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.rib.LocRib in project bgpcep by opendaylight.
the class BaseAbstractRouteEntry method addPathToDataStore.
@SuppressWarnings("unchecked")
private void addPathToDataStore(final RouteEntryDependenciesContainer entryDep, final Identifier routeKey, final WriteTransaction tx) {
final RIBSupport ribSup = entryDep.getRibSupport();
Identifier newRouteKey = ribSup.createNewRouteKey(this.bestPath.getPathId(), routeKey);
if (newRouteKey == null) {
newRouteKey = routeKey;
}
final Route route = createRoute(ribSup, newRouteKey, this.bestPath.getPathId(), this.bestPath);
LOG.trace("Selected best route {}", route);
final KeyedInstanceIdentifier<Tables, TablesKey> locRibTarget = entryDep.getLocRibTableTarget();
final InstanceIdentifier routeTarget = ribSup.createRouteIdentifier(locRibTarget, newRouteKey);
LOG.debug("Write route to LocRib {}", route);
tx.put(LogicalDatastoreType.OPERATIONAL, routeTarget, route);
fillAdjRibsOut(this.bestPath.getAttributes(), route, newRouteKey, this.bestPath.getPeerId(), entryDep, tx);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.rib.LocRib in project bgpcep by opendaylight.
the class AddPathAbstractRouteEntry method updateBestPaths.
@Override
public void updateBestPaths(final RouteEntryDependenciesContainer entryDependencies, final Identifier routeKey, final WriteTransaction tx) {
final RIBSupport ribSupport = entryDependencies.getRibSupport();
final KeyedInstanceIdentifier<Tables, TablesKey> locRibTarget = entryDependencies.getLocRibTableTarget();
if (this.bestPathRemoved != null) {
this.bestPathRemoved.forEach(path -> {
final Identifier newRouteKey = ribSupport.createNewRouteKey(path.getPathId(), routeKey);
final InstanceIdentifier routeTarget = ribSupport.createRouteIdentifier(locRibTarget, newRouteKey);
LOG.debug("Delete route from LocRib {}", routeTarget);
tx.delete(LogicalDatastoreType.OPERATIONAL, routeTarget);
});
this.bestPathRemoved = null;
}
if (this.removedPaths != null) {
this.removedPaths.forEach(removedPath -> {
final Identifier routeKeyAddPath = ribSupport.createNewRouteKey(removedPath.getPathId(), routeKey);
final Identifier routeKeyNonAddPath = ribSupport.createNewRouteKey(NON_PATH_ID_VALUE, routeKey);
fillAdjRibsOut(true, null, null, null, routeKeyNonAddPath, routeKeyAddPath, RouterIds.createPeerId(removedPath.getRouteId()), entryDependencies.getLocalTablesKey(), entryDependencies, tx);
});
this.removedPaths = null;
}
if (this.newBestPathToBeAdvertised != null) {
this.newBestPathToBeAdvertised.forEach(path -> addPathToDataStore(entryDependencies, path, isFirstBestPath(this.bestPath.indexOf(path)), routeKey, tx));
this.newBestPathToBeAdvertised = null;
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.rib.LocRib in project bgpcep by opendaylight.
the class AddPathAbstractRouteEntry method addPathToDataStore.
private void addPathToDataStore(final RouteEntryDependenciesContainer entryDep, final AddPathBestPath path, final boolean isFirstBestPath, final Identifier routeKey, final WriteTransaction tx) {
final RIBSupport ribSup = entryDep.getRibSupport();
final Identifier routeKeyAddPath = ribSup.createNewRouteKey(path.getPathId(), routeKey);
final Identifier routeKeyAddNonPath = ribSup.createNewRouteKey(NON_PATH_ID_VALUE, routeKey);
final Route routeAddPath = createRoute(ribSup, routeKeyAddPath, path.getPathId(), path);
final Route routeNonAddPath = createRoute(ribSup, routeKeyAddNonPath, NON_PATH_ID_VALUE, path);
final KeyedInstanceIdentifier<Tables, TablesKey> locRibTarget = entryDep.getLocRibTableTarget();
final InstanceIdentifier routeTarget = ribSup.createRouteIdentifier(locRibTarget, routeKeyAddPath);
LOG.debug("Write route to LocRib {}", routeAddPath);
tx.put(LogicalDatastoreType.OPERATIONAL, routeTarget, routeAddPath);
fillAdjRibsOut(isFirstBestPath, path.getAttributes(), routeNonAddPath, routeAddPath, routeKeyAddNonPath, routeKeyAddPath, path.getPeerId(), entryDep.getLocalTablesKey(), entryDep, tx);
}
Aggregations