use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class BasePathSelectorTest method createStateFromPrefMedOrigin.
private static Attributes createStateFromPrefMedOrigin() {
AttributesBuilder dataContBuilder = new AttributesBuilder();
addLowerLocalRef(dataContBuilder);
addLowerMultiExitDisc(dataContBuilder);
addIgpOrigin(dataContBuilder);
return dataContBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class AdjRibInWriter method updateRoutes.
void updateRoutes(final MpReachNlri nlri, final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes attributes) {
final TablesKey key = new TablesKey(nlri.getAfi(), nlri.getSafi());
final TableContext ctx = this.tables.get(key);
if (ctx == null) {
LOG.debug("No table for {}, not accepting NLRI {}", key, nlri);
return;
}
final DOMDataWriteTransaction tx = this.chain.newWriteOnlyTransaction();
ctx.writeRoutes(tx, nlri, attributes);
LOG.trace("Write routes {}", nlri);
Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
LOG.trace("Write routes {}, succeed", nlri);
}
@Override
public void onFailure(final Throwable throwable) {
LOG.error("Write routes failed", throwable);
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class AdjRibOutListener method buildUpdate.
private Update buildUpdate(@Nonnull final Collection<MapEntryNode> advertised, @Nonnull final Collection<MapEntryNode> withdrawn, @Nonnull final Attributes attr) {
final UpdateBuilder ub = new UpdateBuilder().setWithdrawnRoutes(extractWithdrawnRoutes(withdrawn)).setNlri(extractNlris(advertised));
ub.setAttributes(attr);
return ub.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes 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.message.rev200120.path.attributes.Attributes 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