diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2020-12-08 17:48:09 +0100 |
---|---|---|
committer | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2020-12-08 17:49:01 +0100 |
commit | d022986fd6be49ff29f53ae36bbe1ff967836e11 (patch) | |
tree | 741902ce06ed6bd36c2e4dcdb744289424d7250b /sdnr/wt/netconfnode-state-service/provider/src/main | |
parent | e3ad1d3884cb4c801679e3390088ce17c997f9d1 (diff) |
Support of several NetConf notification streams
Support of several NetConf notification streams
Issue-ID: SDNC-1369
Change-Id: I75b9ba06aed159992444cce3e60384a1cdb91625
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/netconfnode-state-service/provider/src/main')
-rw-r--r-- | sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfAccessorImpl.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfAccessorImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfAccessorImpl.java index 275da397d..65b8e6f56 100644 --- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfAccessorImpl.java +++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfAccessorImpl.java @@ -19,8 +19,10 @@ package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; +import java.util.List; import java.util.Optional; import javax.annotation.Nonnull; +import org.onap.ccsdk.features.sdnr.wt.common.YangHelper; import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; @@ -29,11 +31,15 @@ import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.mdsal.binding.api.MountPoint; import org.opendaylight.mdsal.binding.api.NotificationService; import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInputBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionOutput; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.NotificationsService; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.StreamNameType; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.Netconf; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.Streams; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf; @@ -183,5 +189,36 @@ public class NetconfAccessorImpl implements NetconfAccessor { return res; } + @Override + public void registerNotificationsStream(List<Stream> streamList) { + for (Stream stream : streamList) { + log.info("Stream Name = {}, Stream Description = {}", stream.getName().getValue(), stream.getDescription()); + if (!(stream.getName().getValue().equals(NetconfAccessor.DefaultNotificationsStream))) // Since this stream is already registered + registerNotificationsStream(stream.getName().getValue()); + } + } + + /** + * check if nc-notifications.yang is supported by the device + */ + @Override + public boolean isNCNotificationsSupported() { + Capabilities capabilities = getCapabilites(); + if (capabilities.isSupportingNamespace(Netconf.QNAME)) { + return true; + } + return false; + } + + @Override + public List<Stream> getNotificationStreams() { + final Class<Netconf> netconfClazz = Netconf.class; + InstanceIdentifier<Netconf> streamsIID = InstanceIdentifier.builder(netconfClazz).build(); + + Netconf res = getTransactionUtils().readData(getDataBroker(), LogicalDatastoreType.OPERATIONAL, streamsIID); + Streams streams = res.getStreams(); + return YangHelper.getList(streams.getStream()); + } + } |