use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.ll.graceful.restart.capability.TablesKey in project bgpcep by opendaylight.
the class BmpRibInWriter method createTableInstance.
/**
* Create new table instance.
*/
private static ImmutableMap.Builder<TablesKey, TableContext> createTableInstance(final Set<TablesKey> tableTypes, final YangInstanceIdentifier yangTableRootIId, final DOMDataTreeWriteTransaction tx, final RIBExtensionConsumerContext ribExtensions, final BindingCodecTree tree) {
final ImmutableMap.Builder<TablesKey, TableContext> tb = ImmutableMap.builder();
for (final TablesKey k : tableTypes) {
final RIBSupport rs = ribExtensions.getRIBSupport(k);
if (rs == null) {
LOG.warn("No support for table type {}, skipping it", k);
continue;
}
final TableContext ctx = new TableContext(rs, yangTableRootIId.node(TablesUtil.toYangTablesKey(k)).toOptimized(), tree);
ctx.createTable(tx);
tx.put(LogicalDatastoreType.OPERATIONAL, ctx.getTableId().node(BMP_ATTRIBUTES_QNAME).node(ATTRIBUTES_UPTODATE_FALSE.getIdentifier()), ATTRIBUTES_UPTODATE_FALSE);
LOG.debug("Created table instance {}", ctx.getTableId());
tb.put(k, ctx);
}
return tb;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.ll.graceful.restart.capability.TablesKey in project bgpcep by opendaylight.
the class GlobalUtil method buildAfiSafi.
/**
* Build Afi Safi containing State.
*
* @param ribState containing RIb Operational State
* @param tablesKey table Key
* @param bgpTableTypeRegistry BGP TableType Registry
* @return Afi Safi Operational State
*/
public static AfiSafi buildAfiSafi(final BGPRibState ribState, final TablesKey tablesKey, final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
final Optional<Class<? extends AfiSafiType>> optAfiSafi = bgpTableTypeRegistry.getAfiSafiType(tablesKey);
if (!optAfiSafi.isPresent()) {
return null;
}
final State state = new StateBuilder().addAugmentation(GlobalAfiSafiStateAugmentation.class, new GlobalAfiSafiStateAugmentationBuilder().setTotalPaths(ribState.getPathCount(tablesKey)).setTotalPrefixes(ribState.getPrefixesCount(tablesKey)).build()).build();
return new AfiSafiBuilder().setAfiSafiName(optAfiSafi.get()).setState(state).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.ll.graceful.restart.capability.TablesKey in project bgpcep by opendaylight.
the class BmpRibInWriter method addRoutes.
private synchronized void addRoutes(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);
tx.submit();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.ll.graceful.restart.capability.TablesKey in project bgpcep by opendaylight.
the class BGPPeer method addBgp4Support.
// try to add a support for old-school BGP-4, if peer did not advertise IPv4-Unicast MP capability
private synchronized void addBgp4Support() {
final TablesKey key = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
if (!this.tables.contains(key)) {
final HashSet<TablesKey> newSet = new HashSet<>(this.tables);
newSet.add(key);
this.tables = ImmutableSet.copyOf(newSet);
createAdjRibOutListener(key, false);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.ll.graceful.restart.capability.TablesKey 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