use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route in project bgpcep by opendaylight.
the class FlowspecIpv4RIBSupportTest method testPutRoutes.
@Test
public void testPutRoutes() {
RIB_SUPPORT.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
final FlowspecRoute route = (FlowspecRoute) this.insertedRoutes.get(0).getValue();
assertEquals(ROUTE, route);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route in project bgpcep by opendaylight.
the class FlowspecIpv6RIBSupportTest method testPutRoutes.
@Test
public void testPutRoutes() {
RIB_SUPPORT.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
final FlowspecRoute route = (FlowspecRoute) this.insertedRoutes.get(0).getValue();
assertEquals(ROUTE, route);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route in project bgpcep by opendaylight.
the class BaseAbstractRouteEntry method addRoute.
@Override
public int addRoute(final UnsignedInteger routerId, final long remotePathId, final Route route) {
final Attributes advertisedAttrs = route.getAttributes();
int offset = this.offsets.offsetOf(routerId);
if (offset < 0) {
final OffsetMap newOffsets = this.offsets.with(routerId);
offset = newOffsets.offsetOf(routerId);
this.values = newOffsets.expand(this.offsets, this.values, offset);
this.offsets = newOffsets;
}
this.offsets.setValue(this.values, offset, advertisedAttrs);
LOG.trace("Added route from {} attributes {}", routerId, advertisedAttrs);
return offset;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route in project bgpcep by opendaylight.
the class BaseAbstractRouteEntry method initializeBestPaths.
@Override
@SuppressWarnings("unchecked")
public void initializeBestPaths(final RouteEntryDependenciesContainer entryDep, final RouteEntryInfo entryInfo, final WriteTransaction tx) {
if (this.bestPath == null) {
return;
}
final TablesKey localTK = entryDep.getLocalTablesKey();
final Peer toPeer = entryInfo.getToPeer();
if (!filterRoutes(this.bestPath.getPeerId(), toPeer, localTK)) {
return;
}
final Identifier oldRouteKey = entryInfo.getRouteKey();
final RIBSupport ribSupport = entryDep.getRibSupport();
Identifier newRouteKey = ribSupport.createNewRouteKey(this.bestPath.getPathId(), oldRouteKey);
if (newRouteKey == null) {
newRouteKey = oldRouteKey;
}
final BGPRouteEntryExportParameters routeEntry = new BGPRouteEntryExportParametersImpl(this.peerTracker.getPeer(this.bestPath.getPeerId()), toPeer);
final Optional<Attributes> effAttrib = entryDep.getRoutingPolicies().applyExportPolicies(routeEntry, this.bestPath.getAttributes());
final Route route = createRoute(ribSupport, newRouteKey, this.bestPath.getPathId(), this.bestPath);
InstanceIdentifier ribOutIId = ribSupport.createRouteIdentifier(toPeer.getRibOutIId(localTK), newRouteKey);
if (effAttrib.isPresent() && route != null) {
LOG.debug("Write route {} to peer AdjRibsOut {}", route, toPeer.getPeerId());
tx.put(LogicalDatastoreType.OPERATIONAL, ribOutIId, route);
tx.put(LogicalDatastoreType.OPERATIONAL, ribOutIId.child(Attributes.class), effAttrib.get());
}
}
Aggregations