- final InstanceIdentifierBuilder yangRibIdBuilder = YangInstanceIdentifier.builder().node(BgpRib.QNAME).node(Rib.QNAME);
- this.yangRibId = yangRibIdBuilder.nodeWithKey(Rib.QNAME, RIB_ID_QNAME, ribId.getValue()).build();
- this.configModuleTracker = moduleTracker;
- this.openConfigProvider = openConfigProvider;
- this.cacheDisconnectedPeers = new CacheDisconnectedPeersImpl();
- this.bestPathSelectionStrategies = Preconditions.checkNotNull(bestPathSelectionStrategies);
-
- LOG.debug("Instantiating RIB table {} at {}", ribId, this.yangRibId);
-
- final ContainerNode bgpRib = Builders.containerBuilder()
- .withNodeIdentifier(new NodeIdentifier(BgpRib.QNAME))
- .addChild(ImmutableNodes.mapNodeBuilder(Rib.QNAME).build()).build();
-
- final MapEntryNode ribInstance = Builders.mapEntryBuilder().withNodeIdentifier(
- new NodeIdentifierWithPredicates(Rib.QNAME, RIB_ID_QNAME, ribId.getValue()))
- .addChild(ImmutableNodes.leafNode(RIB_ID_QNAME, ribId.getValue()))
- .addChild(ImmutableNodes.mapNodeBuilder(Peer.QNAME).build())
- .addChild(Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(LocRib.QNAME))
- .addChild(ImmutableNodes.mapNodeBuilder(Tables.QNAME).build())
- .build()).build();
-
-
- final DOMDataWriteTransaction trans = this.domChain.newWriteOnlyTransaction();
-
- // merge empty BgpRib + Rib, to make sure the top-level parent structure is present
- trans.merge(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().node(BgpRib.QNAME).build(), bgpRib);
- trans.put(LogicalDatastoreType.OPERATIONAL, yangRibIdBuilder.build(), ribInstance);
-
- try {
- trans.submit().checkedGet();
- } catch (final TransactionCommitFailedException e) {
- LOG.error("Failed to initiate RIB {}", this.yangRibId, e);
- }
- final ClusterIdentifier cId = (clusterId == null) ? new ClusterIdentifier(localBgpId) : new ClusterIdentifier(clusterId);
- final PolicyDatabase pd = new PolicyDatabase(localAs.getValue(), localBgpId, cId);
-
- final DOMDataBrokerExtension domDatatreeChangeService = this.domDataBroker.getSupportedExtensions().get(DOMDataTreeChangeService.class);
- this.service = domDatatreeChangeService;
- this.efWriter = EffectiveRibInWriter.create(getService(), createPeerChain(this), getYangRibId(), pd, this.ribContextRegistry);
- LOG.debug("Effective RIB created.");