use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey in project bgpcep by opendaylight.
the class BmpRouterPeerImpl method setPeerTables.
private static Set<TablesKey> setPeerTables(final ReceivedOpen open) {
final Set<TablesKey> tables = Sets.newHashSet(DEFAULT_TABLE);
for (final BgpParameters param : open.getBgpParameters()) {
for (final OptionalCapabilities optCapa : param.getOptionalCapabilities()) {
final CParameters cParam = optCapa.getCParameters();
if (cParam.getAugmentation(CParameters1.class) == null || cParam.getAugmentation(CParameters1.class).getMultiprotocolCapability() == null) {
continue;
}
final MultiprotocolCapability multi = cParam.getAugmentation(CParameters1.class).getMultiprotocolCapability();
final TablesKey tt = new TablesKey(multi.getAfi(), multi.getSafi());
tables.add(tt);
}
}
return tables;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.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 DOMDataWriteTransaction 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 InstanceIdentifierBuilder idb = YangInstanceIdentifier.builder(yangTableRootIId);
final NodeIdentifierWithPredicates key = TablesUtil.toYangTablesKey(k);
idb.nodeWithKey(key.getNodeType(), key.getKeyValues());
final TableContext ctx = new TableContext(rs, idb.build(), tree);
ctx.createTable(tx);
tx.put(LogicalDatastoreType.OPERATIONAL, ctx.getTableId().node(BMP_ATTRIBUTES_QNAME).node(ATTRIBUTES_UPTODATE_FALSE.getNodeType()), 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.rib.rev171207.rib.TablesKey in project bgpcep by opendaylight.
the class LinkstateTopologyBuilderTest method setUp.
@Before
@Override
public void setUp() {
super.setUp();
this.linkstateTopoBuilder = new LinkstateTopologyBuilder(getDataBroker(), LOC_RIB_REF, TEST_TOPOLOGY_ID, LISTENER_RESTART_TIME, LISTENER_ENFORCE_COUNTER);
this.linkstateTopoBuilder.start();
final InstanceIdentifier<Tables> path = LOC_RIB_REF.getInstanceIdentifier().builder().child(LocRib.class).child(Tables.class, new TablesKey(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class)).build();
this.linkstateRouteIID = path.builder().child((Class) LinkstateRoutes.class).child(LinkstateRoute.class, new LinkstateRouteKey(LINKSTATE_ROUTE_KEY)).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey in project bgpcep by opendaylight.
the class SimpleRIBExtensionProviderContext method registerRIBSupport.
@Override
public <T extends RIBSupport> RIBSupportRegistration<T> registerRIBSupport(final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi, final T support) {
final TablesKey key = new TablesKey(afi, safi);
final RIBSupport prev = this.supports.putIfAbsent(key, support);
Preconditions.checkArgument(prev == null, "AFI %s SAFI %s is already registered with %s", afi, safi, prev);
this.domSupports.put(RibSupportUtils.toYangTablesKey(afi, safi), support);
addClassLoadingSupport(afi, safi, support);
return new AbstractRIBSupportRegistration<T>(support) {
@Override
protected void removeRegistration() {
SimpleRIBExtensionProviderContext.this.supports.remove(key);
}
};
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey in project bgpcep by opendaylight.
the class SimpleBGPTableTypeRegistryProvider method registerBGPTableType.
@Override
public synchronized AbstractRegistration registerBGPTableType(final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi, final Class<? extends AfiSafiType> afiSafiType) {
final BgpTableType tableType = new BgpTableTypeImpl(afi, safi);
final Class<? extends AfiSafiType> prev = this.tableTypes.putIfAbsent(tableType, afiSafiType);
Preconditions.checkState(prev == null, "AFI %s SAFI %s is already registered with %s", afi, safi, prev);
final TablesKey tableKey = new TablesKey(tableType.getAfi(), tableType.getSafi());
this.tableKeys.put(tableKey, afiSafiType);
return new AbstractRegistration() {
@Override
protected void removeRegistration() {
synchronized (SimpleBGPTableTypeRegistryProvider.this) {
SimpleBGPTableTypeRegistryProvider.this.tableTypes.remove(tableType);
SimpleBGPTableTypeRegistryProvider.this.tableKeys.remove(tableKey);
}
}
};
}
Aggregations