@GuardedBy("this") private DOMStoreWriteTransaction lookup(final LogicalDatastoreType store, final YangInstanceIdentifier path) { final DOMDataTreeIdentifier id = new DOMDataTreeIdentifier(store, path); for (Entry<DOMDataTreeIdentifier, DOMStoreWriteTransaction> e : idToTransaction.entrySet()) { if (e.getKey().contains(id)) { return e.getValue(); } } throw new IllegalArgumentException(String.format("Path %s is not acessible from transaction %s", id, this)); }
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); }
/** * Return a counterpart to an MD-SAL data tree identifier. * * @return Controller data tree identifier. */ public static DOMDataTreeIdentifier fromMdsal(final org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier mdsal) { return new DOMDataTreeIdentifier(LogicalDatastoreType.fromMdsal(mdsal.getDatastoreType()), mdsal.getRootIdentifier()); }
private DOMDataTreeIdentifier toDomTreeIdentifier(final DataTreeIdentifier<?> treeId) { final YangInstanceIdentifier domPath = codec.toYangInstanceIdentifierBlocking(treeId.getRootIdentifier()); return new DOMDataTreeIdentifier(treeId.getDatastoreType(), domPath); } }
private Messaging4TransportProviderImpl(final YangInstanceIdentifier id, final AmqpUserAgent userAgent, final DOMDataBroker dataBroker, final DOMNotificationService notificationService) { identifier = id; try { Session session = AmqpPublisher.getAmqpSession(userAgent.getHost(), userAgent.getPort(), userAgent.getUsername(), userAgent.getPassword()); MessageProducer producer = session.createProducer(AmqpConfig.getDestination(Messaging4TransportConstants. AMQP_TOPIC_EVENT_DESTINATION)); producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); } catch (final Exception e) { throw new IllegalStateException("Unable to connect to the AMQP server", e); } notificationReg = notificationService.registerNotificationListener(this, TOPIC_NOTIFICATION_PATH); final YangInstanceIdentifier receiverPath = identifier; final DOMDataTreeIdentifier receiverConfigPath = new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, receiverPath); // configurationReg = dataBroker.registerDataChangeListener(); //receiverConfigPath, this); // todo: registerDataTreeChangeListener LOG.info("AMQP user agent initialized. id: {}", id); }
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 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); }