use of org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContext in project bgpcep by opendaylight.
the class RIBImpl method startLocRib.
private synchronized void startLocRib(final TablesKey key) {
LOG.debug("Creating LocRib table for {}", key);
// create locRibWriter for each table
final DOMDataWriteTransaction tx = this.domChain.newWriteOnlyTransaction();
final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> table = ImmutableNodes.mapEntryBuilder();
table.withNodeIdentifier(RibSupportUtils.toYangTablesKey(key));
table.withChild(EMPTY_TABLE_ATTRIBUTES);
final NodeIdentifierWithPredicates tableKey = RibSupportUtils.toYangTablesKey(key);
final InstanceIdentifierBuilder tableId = YangInstanceIdentifier.builder(this.yangRibId.node(LocRib.QNAME).node(Tables.QNAME));
tableId.nodeWithKey(tableKey.getNodeType(), tableKey.getKeyValues());
for (final Entry<QName, Object> e : tableKey.getKeyValues().entrySet()) {
table.withChild(ImmutableNodes.leafNode(e.getKey(), e.getValue()));
}
final RIBSupportContext supportContext = this.ribContextRegistry.getRIBSupportContext(key);
if (supportContext != null) {
final ChoiceNode routes = supportContext.getRibSupport().emptyRoutes();
table.withChild(routes);
tx.put(LogicalDatastoreType.OPERATIONAL, tableId.build(), table.build());
try {
tx.submit().checkedGet();
} catch (final TransactionCommitFailedException e1) {
LOG.error("Failed to initiate LocRIB for key {}", key, e1);
}
} else {
LOG.warn("There's no registered RIB Context for {}", key.getAfi());
}
}
use of org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContext in project bgpcep by opendaylight.
the class AdjRibInWriter method createNewTableInstances.
/**
* Create new table instances, potentially creating their empty entries
*/
private ImmutableMap<TablesKey, TableContext> createNewTableInstances(final YangInstanceIdentifier newPeerPath, final RIBSupportContextRegistry registry, final Set<TablesKey> tableTypes, final Map<TablesKey, SendReceive> addPathTablesType, final DOMDataWriteTransaction tx) {
final Builder<TablesKey, TableContext> tb = ImmutableMap.builder();
for (final TablesKey tableKey : tableTypes) {
final RIBSupportContext rs = registry.getRIBSupportContext(tableKey);
// TODO: Use returned value once Instance Identifier builder allows for it.
final NodeIdentifierWithPredicates instanceIdentifierKey = RibSupportUtils.toYangTablesKey(tableKey);
if (rs == null) {
LOG.warn("No support for table type {}, skipping it", tableKey);
continue;
}
installAdjRibsOutTables(newPeerPath, rs, instanceIdentifierKey, tableKey, addPathTablesType.get(tableKey), tx);
installAdjRibInTables(newPeerPath, tableKey, rs, instanceIdentifierKey, tx, tb);
}
return tb.build();
}
Aggregations