use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.graceful.restart.capability.Tables in project bgpcep by opendaylight.
the class BgpPeer method getBgpParameters.
private static List<BgpParameters> getBgpParameters(final AfiSafis afiSafis, final RIB rib, final BGPTableTypeRegistryConsumer tableTypeRegistry) {
final List<BgpParameters> tlvs = new ArrayList<>();
final List<OptionalCapabilities> caps = new ArrayList<>();
caps.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(rib.getLocalAs()).build()).build()).build());
caps.add(new OptionalCapabilitiesBuilder().setCParameters(BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY).build());
caps.add(new OptionalCapabilitiesBuilder().setCParameters(MultiprotocolCapabilitiesUtil.RR_CAPABILITY).build());
final List<AfiSafi> afiSafi = OpenConfigMappingUtil.getAfiSafiWithDefault(afiSafis, false);
final List<AddressFamilies> addPathCapability = OpenConfigMappingUtil.toAddPathCapability(afiSafi, tableTypeRegistry);
if (!addPathCapability.isEmpty()) {
caps.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setAddPathCapability(new AddPathCapabilityBuilder().setAddressFamilies(addPathCapability).build()).build()).build()).build());
}
final List<BgpTableType> tableTypes = OpenConfigMappingUtil.toTableTypes(afiSafi, tableTypeRegistry);
for (final BgpTableType tableType : tableTypes) {
if (!rib.getLocalTables().contains(tableType)) {
LOG.info("RIB instance does not list {} " + "in its local tables. Incoming data will be dropped.", tableType);
}
caps.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder(tableType).build()).build()).build()).build());
}
tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(caps).build());
return tlvs;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.graceful.restart.capability.Tables in project bgpcep by opendaylight.
the class LocRibWriter method updateNodes.
@SuppressWarnings("unchecked")
private void updateNodes(final DataObjectModification<Tables> table, final UnsignedInteger peerUuid, final WriteTransaction tx, final Map<RouteUpdateKey, RouteEntry> routes) {
final DataObjectModification<Attributes> attUpdate = table.getModifiedChildContainer(Attributes.class);
if (attUpdate != null && attUpdate.getDataAfter() != null) {
final Attributes newAttValue = attUpdate.getDataAfter();
LOG.trace("Uptodate found for {}", newAttValue);
tx.put(LogicalDatastoreType.OPERATIONAL, this.locRibTableIID.child(Attributes.class), newAttValue);
}
final DataObjectModification routesChangesContainer = table.getModifiedChildContainer(this.ribSupport.routesContainerClass());
if (routesChangesContainer == null) {
return;
}
updateRoutesEntries(routesChangesContainer.getModifiedChildren(), peerUuid, routes);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.graceful.restart.capability.Tables in project bgpcep by opendaylight.
the class LocRibWriter method init.
@SuppressWarnings("unchecked")
private synchronized void init() {
final WriteTransaction tx = this.chain.newWriteOnlyTransaction();
tx.merge(LogicalDatastoreType.OPERATIONAL, this.locRibTableIID.builder().child(Attributes.class).build(), new AttributesBuilder().setUptodate(true).build());
tx.submit();
final InstanceIdentifier<Tables> tableId = this.ribIId.builder().child(Peer.class).child(EffectiveRibIn.class).child(Tables.class, this.tk).build();
this.reg = this.dataBroker.registerDataTreeChangeListener(new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, tableId), this);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.graceful.restart.capability.Tables 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.multiprotocol.rev171207.mp.capabilities.graceful.restart.capability.Tables 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