aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/netconfnode-state-service/provider/src
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-06-16 10:22:36 +0530
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-06-16 10:23:34 +0530
commit17fd7d683b0b38a401481ae85cc5927679e20ce3 (patch)
tree03431a5ebf320e1c6efd3e6f5aef0b3029227a3d /sdnr/wt/netconfnode-state-service/provider/src
parent17614362f2550c29dcd746ee2c1bc01d0df5de65 (diff)
Include missing mapping of O-RAN fault fields
Refactor O-RAN devicemanager and correct VES fault fields characteristics Issue-ID: CCSDK-3309 Change-Id: I01441cb9c84660c0ee6931d6bbe3f28993cfd054 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/netconfnode-state-service/provider/src')
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingAccessorImpl.java61
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java1
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java2
3 files changed, 24 insertions, 40 deletions
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingAccessorImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingAccessorImpl.java
index 9c10f0bae..6f3a592c8 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingAccessorImpl.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingAccessorImpl.java
@@ -18,7 +18,6 @@
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.binding;
import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@@ -34,7 +33,6 @@ 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;
@@ -45,9 +43,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.r
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.NotificationListener;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,19 +55,29 @@ public class NetconfBindingAccessorImpl extends NetconfAccessorImpl implements N
private final DataBroker dataBroker;
private final MountPoint mountpoint;
+ final NotificationsService mountpointNotificationService;
/**
- * Contains all data to access and manage netconf device
+ * Contains all data to access and manage NETCONF device
*
- * @param nodeId of managed netconf node
- * @param netconfNode information
+ * @param accessor with basic mountpoint information
* @param dataBroker to access node
* @param mountpoint of netconfNode
+ * @throws IllegalArgumentException
*/
- public NetconfBindingAccessorImpl(NetconfAccessorImpl accessor, DataBroker dataBroker, MountPoint mountpoint) {
+ public NetconfBindingAccessorImpl(NetconfAccessorImpl accessor, DataBroker dataBroker, MountPoint mountpoint)
+ throws IllegalArgumentException {
super(accessor);
this.dataBroker = Objects.requireNonNull(dataBroker);
this.mountpoint = Objects.requireNonNull(mountpoint);
+
+ final Optional<RpcConsumerRegistry> optionalRpcConsumerService =
+ mountpoint.getService(RpcConsumerRegistry.class);
+ if (optionalRpcConsumerService.isPresent()) {
+ mountpointNotificationService = optionalRpcConsumerService.get().getRpcService(NotificationsService.class);
+ } else {
+ throw new IllegalArgumentException("Can not process without rpcConsumerService service");
+ }
}
@Override
@@ -103,41 +109,20 @@ public class NetconfBindingAccessorImpl extends NetconfAccessorImpl implements N
return ranListenerRegistration;
}
-
@Override
public ListenableFuture<RpcResult<CreateSubscriptionOutput>> registerNotificationsStream(
@NonNull String streamName) {
- String failMessage = "";
- final Optional<RpcConsumerRegistry> optionalRpcConsumerService =
- getMountpoint().getService(RpcConsumerRegistry.class);
- if (optionalRpcConsumerService.isPresent()) {
- final NotificationsService rpcService =
- optionalRpcConsumerService.get().getRpcService(NotificationsService.class);
-
- final CreateSubscriptionInputBuilder createSubscriptionInputBuilder = new CreateSubscriptionInputBuilder();
+ final CreateSubscriptionInputBuilder createSubscriptionInputBuilder = new CreateSubscriptionInputBuilder();
+ if (streamName != null) {
createSubscriptionInputBuilder.setStream(new StreamNameType(streamName));
- log.info("Event listener triggering notification stream {} for node {}", streamName, getNodeId());
- try {
- CreateSubscriptionInput createSubscriptionInput = createSubscriptionInputBuilder.build();
- if (createSubscriptionInput == null) {
- failMessage = "createSubscriptionInput is null for mountpoint " + getNodeId();
- } else {
- // Regular case, return value
- return rpcService.createSubscription(createSubscriptionInput);
- }
- } catch (NullPointerException e) {
- failMessage = "createSubscription failed";
- }
- } else {
- failMessage = "No RpcConsumerRegistry avaialble.";
}
- //Be here only in case of problem and return failed indication
- log.warn(failMessage);
- RpcResultBuilder<CreateSubscriptionOutput> result = RpcResultBuilder.failed();
- result.withError(ErrorType.APPLICATION, failMessage);
- SettableFuture<RpcResult<CreateSubscriptionOutput>> future = SettableFuture.create();
- future.set(result.build());
- return future;
+ log.info("Event listener triggering notification stream '{}' for node {}", streamName, getNodeId());
+ return mountpointNotificationService.createSubscription(createSubscriptionInputBuilder.build());
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<CreateSubscriptionOutput>> registerNotificationsStream() {
+ return registerNotificationsStream((String)null);
}
@Override
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java
index 3212eac82..b6843fb59 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java
@@ -52,7 +52,6 @@ import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
import org.opendaylight.mdsal.dom.api.DOMNotificationService;
import org.opendaylight.mdsal.dom.api.DOMRpcResult;
import org.opendaylight.mdsal.dom.api.DOMRpcService;
-import org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil;
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.create.subscription.input.Filter;
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java
index 46b2e769e..b6d731418 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java
@@ -48,7 +48,6 @@ import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.NetconfNodeS
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.rpc.NetconfnodeStateServiceRpcApiImpl;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.example.ExampleConfig;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.example.TestNetconfHelper;
-import org.opendaylight.mdsal.binding.runtime.spi.BindingRuntimeHelpers;
import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
@@ -60,6 +59,7 @@ import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext;
+import org.opendaylight.mdsal.binding.runtime.spi.BindingRuntimeHelpers;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
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.NetconfNodeBuilder;