public org.opendaylight.yangtools.yang.binding.YangModuleInfo getModuleInfo() { return $YangModuleInfoImpl.getInstance(); } }
public static StreamNameType getDefaultInstance(String defaultValue) { return new StreamNameType(defaultValue); }
public CreateSubscriptionInput build() { return new CreateSubscriptionInputImpl(this); }
final Optional<RpcConsumerRegistry> service = mountPoint.get().getService(RpcConsumerRegistry.class); final NotificationsService rpcService = service.get().getRpcService(NotificationsService.class); final CreateSubscriptionInputBuilder createSubscriptionInputBuilder = new CreateSubscriptionInputBuilder(); createSubscriptionInputBuilder.setStream(new StreamNameType(streamName)); LOG.info("Triggering notification stream {} for node {}", streamName, nodeId); final Future<RpcResult<Void>> subscription = rpcService.createSubscription(createSubscriptionInputBuilder.build());
/** * Invokes create-subscription rpc on mounted device stream. If lastEventTime is provided and stream supports replay, * rpc will be invoked with start time parameter. * @param stream stream * @param lastEventTime last event time * @return rpc result */ CheckedFuture<DOMRpcResult, DOMRpcException> invokeCreateSubscription(final Stream stream, final Optional<Date> lastEventTime) { final CreateSubscriptionInputBuilder inputBuilder = new CreateSubscriptionInputBuilder() .setStream(stream.getName()); if(lastEventTime.isPresent() && stream.isReplaySupport()) { final ZonedDateTime dateTime = lastEventTime.get().toInstant().atZone(ZoneId.systemDefault()); final String formattedDate = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(dateTime); inputBuilder.setStartTime(new DateAndTime(formattedDate)); } final CreateSubscriptionInput input = inputBuilder.build(); final ContainerNode nnInput = CODEC_REGISTRY.toNormalizedNodeRpcData(input); return rpcService.invokeRpc(CREATE_SUBSCRIPTION, nnInput); }
if (!Objects.equals(_startTime, other.getStartTime())) { return false; if (!Objects.equals(_stopTime, other.getStopTime())) { return false; if (!Objects.equals(_stream, other.getStream())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
public CreateSubscriptionInputBuilder(CreateSubscriptionInput base) { this._startTime = base.getStartTime(); this._stopTime = base.getStopTime(); this._stream = base.getStream(); if (base instanceof CreateSubscriptionInputImpl) { CreateSubscriptionInputImpl impl = (CreateSubscriptionInputImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
private CreateSubscriptionInputImpl(CreateSubscriptionInputBuilder base) { this._startTime = base.getStartTime(); this._stopTime = base.getStopTime(); this._stream = base.getStream(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput>>, Augmentation<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput>>, Augmentation<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
@Nullable @Override public String apply(@Nullable Stream input) { return input.getName().getValue(); } });
public CreateSubscriptionInputBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
@Override public void onNotification(final StreamNameType stream, final NetconfNotification notification) { Preconditions.checkState(baseListener != null, "Already closed"); Preconditions.checkArgument(stream.equals(registeredStream)); baseListener.onNotification(stream, notification); } }
private static StreamNameType parseStreamIfPresent(final XmlElement operationElement) throws NetconfDocumentedException { final Optional<XmlElement> stream = operationElement.getOnlyChildElementWithSameNamespaceOptionally("stream"); return stream.isPresent() ? new StreamNameType(stream.get().getTextContent()) : NetconfNotificationManager.BASE_STREAM_NAME; }
private $YangModuleInfoImpl() { Set<YangModuleInfo> set = new HashSet<>(); set.add(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.$YangModuleInfoImpl.getInstance()); set.add(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.$YangModuleInfoImpl.getInstance()); importedModules = ImmutableSet.copyOf(set); InputStream stream = $YangModuleInfoImpl.class.getResourceAsStream(resourcePath); if (stream == null) { throw new IllegalStateException("Resource '" + resourcePath + "' is missing"); } try { stream.close(); } catch (IOException e) { // Resource leak, but there is nothing we can do } }
/** * Creates registration to notification stream. * @param stream stream * @param notificationPrefix notifications namespace * @param netconfEventSource event source */ public StreamNotificationTopicRegistration(final Stream stream, final String notificationPrefix, NetconfEventSource netconfEventSource) { super(NotificationSourceType.NetconfDeviceStream, stream.getName().getValue(), notificationPrefix); this.netconfEventSource = netconfEventSource; this.mountPoint = netconfEventSource.getMount(); this.nodeId = mountPoint.getNode().getNodeId().getValue(); this.stream = stream; setReplaySupported(stream.isReplaySupport()); setActive(false); LOG.info("StreamNotificationTopicRegistration initialized for {}", getStreamName()); }
private $YangModuleInfoImpl() { Set<YangModuleInfo> set = new HashSet<>(); set.add(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.datastore.push.rev151015.$YangModuleInfoImpl.getInstance()); set.add(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.$YangModuleInfoImpl.getInstance()); set.add(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.$YangModuleInfoImpl.getInstance()); importedModules = ImmutableSet.copyOf(set); InputStream stream = $YangModuleInfoImpl.class.getResourceAsStream(resourcePath); if (stream == null) { throw new IllegalStateException("Resource '" + resourcePath + "' is missing"); } try { stream.close(); } catch (IOException e) { // Resource leak, but there is nothing we can do } }