@Override public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(final DOMDataTreeIdentifier treeId, final L listener) { final DOMDataTreeChangeService treeService = (DOMDataTreeChangeService) delegate.getSupportedExtensions().get(DOMDataTreeChangeService.class); if (treeService != null) { return treeService.registerDataTreeChangeListener(treeId, listener); } throw new UnsupportedOperationException("Delegate " + delegate + " does not support required functionality"); } }
AdjInTracker(final DOMDataTreeChangeService service, final RIBSupportContextRegistry registry, final DOMTransactionChain chain, final YangInstanceIdentifier peerIId, @Nonnull final PerTableTypeRouteCounter effectiveRibInRouteCounters, @Nonnull final PerTableTypeRouteCounter adjRibInRouteCounters) { this.registry = Preconditions.checkNotNull(registry); this.chain = Preconditions.checkNotNull(chain); this.peerIId = Preconditions.checkNotNull(peerIId); this.effRibTables = this.peerIId.node(EffectiveRibIn.QNAME).node(Tables.QNAME); this.effectiveRibInRouteCounters = Preconditions.checkNotNull(effectiveRibInRouteCounters); this.adjRibInRouteCounters = Preconditions.checkNotNull(adjRibInRouteCounters); final DOMDataTreeIdentifier treeId = new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, this.peerIId.node(AdjRibIn.QNAME).node(Tables.QNAME)); LOG.debug("Registered Effective RIB on {}", this.peerIId); this.reg = service.registerDataTreeChangeListener(treeId, this); }
@Override public <L extends org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(final org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier treeId, final L listener) { final DOMDataTreeChangeListener delegateListener; if (listener instanceof org.opendaylight.mdsal.dom.api.ClusteredDOMDataTreeChangeListener) { delegateListener = (ClusteredDOMDataTreeChangeListener) listener::onDataTreeChanged; } else { delegateListener = listener::onDataTreeChanged; } final ListenerRegistration<?> reg = delegate().registerDataTreeChangeListener( DOMDataTreeIdentifier.fromMdsal(treeId), delegateListener); return new AbstractListenerRegistration<L>(listener) { @Override protected void removeRegistration() { reg.close(); } }; }
private AdjRibOutListener(final PeerId peerId, final TablesKey tablesKey, final YangInstanceIdentifier ribId, final CodecsRegistry registry, final RIBSupport support, final DOMDataTreeChangeService service, final ChannelOutputLimiter session, final boolean mpSupport, final UnsignedInt32Counter routeCounter) { this.session = Preconditions.checkNotNull(session); this.support = Preconditions.checkNotNull(support); this.codecs = registry.getCodecs(this.support); this.mpSupport = mpSupport; final YangInstanceIdentifier adjRibOutId = ribId.node(Peer.QNAME).node(IdentifierUtils.domPeerId(peerId)).node(AdjRibOut.QNAME).node(Tables.QNAME).node(RibSupportUtils.toYangTablesKey(tablesKey)); this.registerDataTreeChangeListener = service.registerDataTreeChangeListener(new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, adjRibOutId), this); this.routeCounter = routeCounter; }
@Override public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L> registerDataTreeChangeListener( final DataTreeIdentifier<T> treeId, final L listener) { final DOMDataTreeIdentifier domIdentifier = toDomTreeIdentifier(treeId); @SuppressWarnings({ "rawtypes", "unchecked" }) final BindingDOMDataTreeChangeListenerAdapter<T> domListener = listener instanceof ClusteredDataTreeChangeListener ? new BindingClusteredDOMDataTreeChangeListenerAdapter<T>( codec, (ClusteredDataTreeChangeListener)listener, treeId.getDatastoreType()) : new BindingDOMDataTreeChangeListenerAdapter<T>(codec, listener, treeId.getDatastoreType()); final ListenerRegistration<BindingDOMDataTreeChangeListenerAdapter<T>> domReg = dataTreeChangeService.registerDataTreeChangeListener(domIdentifier, domListener); return new BindingDataTreeChangeListenerRegistration<>(listener,domReg); }
@Override public void instantiateServiceInstance() { if(this.configurationWriter != null) { this.configurationWriter.apply(); } LOG.info("Application Peer Singleton Service {} instantiated", getIdentifier()); final YangInstanceIdentifier yangIId = YangInstanceIdentifier.builder().node(ApplicationRib.QNAME) .nodeWithKey(ApplicationRib.QNAME, APP_ID_QNAME, this.appRibId.getValue()).node(Tables.QNAME).node(Tables.QNAME).build(); this.applicationPeer.instantiateServiceInstance(); this.registration = this.dataTreeChangeService .registerDataTreeChangeListener(new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, yangIId), this.applicationPeer); }
private LocRibWriter(final RIBSupportContextRegistry registry, final DOMTransactionChain chain, final YangInstanceIdentifier target, final Long ourAs, final DOMDataTreeChangeService service, final PolicyDatabase pd, final TablesKey tablesKey, final CacheDisconnectedPeers cacheDisconnectedPeers, @Nonnull final PathSelectionMode pathSelectionMode, final UnsignedInt32Counter routeCounter) { this.chain = Preconditions.checkNotNull(chain); this.tableKey = RibSupportUtils.toYangTablesKey(tablesKey); this.localTablesKey = tablesKey; this.locRibTarget = YangInstanceIdentifier.create(target.node(LocRib.QNAME).node(Tables.QNAME).node(this.tableKey).getPathArguments()); this.ourAs = Preconditions.checkNotNull(ourAs); this.ribSupport = registry.getRIBSupportContext(tablesKey).getRibSupport(); this.attributesIdentifier = this.ribSupport.routeAttributesIdentifier(); this.peerPolicyTracker = new ExportPolicyPeerTrackerImpl(pd, this.localTablesKey); this.cacheDisconnectedPeers = cacheDisconnectedPeers; this.pathSelectionMode = pathSelectionMode; this.routeCounter = routeCounter; final DOMDataWriteTransaction tx = this.chain.newWriteOnlyTransaction(); tx.merge(LogicalDatastoreType.OPERATIONAL, this.locRibTarget.node(Routes.QNAME), this.ribSupport.emptyRoutes()); tx.merge(LogicalDatastoreType.OPERATIONAL, this.locRibTarget.node(Attributes.QNAME).node(ATTRIBUTES_UPTODATE_TRUE.getNodeType()), ATTRIBUTES_UPTODATE_TRUE); tx.submit(); final YangInstanceIdentifier tableId = target.node(Peer.QNAME).node(Peer.QNAME); this.reg = service.registerDataTreeChangeListener(new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, tableId), this); }