aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-onap/onf12
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-08-31 11:45:05 +0530
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-08-31 11:45:19 +0530
commitd2ef8edac288371db8bf049a7a82b3e084862743 (patch)
treeb4f5ef4f6cf91aae05656e9766c3ef88e9075c0a /sdnr/wt/devicemanager-onap/onf12
parent8e683ffdb67a8c9e254c7f6dafa857b903d7dffb (diff)
Fix Sonar reported bugs
Improve code coverage Issue-ID: SDNC-1603 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: Icb38a02ce62f327c114054c2a1db40d4cb242b6c Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-onap/onf12')
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java27
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java14
2 files changed, 25 insertions, 16 deletions
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java
index 06558ad5a..b0125f4f0 100644
--- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java
@@ -61,19 +61,24 @@ public class ONFCoreNetworkElementFactory implements NetworkElementFactory {
if (capabilities.isSupportingNamespaceAndRevision(NetworkElement.QNAME)) {
OnfMicrowaveModel onfMicrowaveModel = null;
Optional<NetconfBindingAccessor> bindingAccessor = accessor.getNetconfBindingAccessor();
- if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) {
- onfMicrowaveModel = new WrapperMicrowaveModelRev170324(bindingAccessor.get(), serviceProvider);
- } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) {
- onfMicrowaveModel = new WrapperMicrowaveModelRev180907(bindingAccessor.get(), serviceProvider);
- } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) {
- onfMicrowaveModel = new WrapperMicrowaveModelRev181010(bindingAccessor.get(), serviceProvider);
- }
+ if (bindingAccessor.isPresent()) {
+ if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) {
+ onfMicrowaveModel = new WrapperMicrowaveModelRev170324(bindingAccessor.get(), serviceProvider);
+ } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) {
+ onfMicrowaveModel = new WrapperMicrowaveModelRev180907(bindingAccessor.get(), serviceProvider);
+ } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) {
+ onfMicrowaveModel = new WrapperMicrowaveModelRev181010(bindingAccessor.get(), serviceProvider);
+ }
- if (onfMicrowaveModel != null) {
- return Optional.of(new ONFCoreNetworkElement12Microwave(bindingAccessor.get(), serviceProvider, configuration,
- onfMicrowaveModel));
+ if (onfMicrowaveModel != null) {
+ return Optional.of(new ONFCoreNetworkElement12Microwave(bindingAccessor.get(), serviceProvider,
+ configuration, onfMicrowaveModel));
+ } else {
+ return Optional.of(
+ new ONFCoreNetworkElement12Basic(bindingAccessor.get(), serviceProvider, configuration));
+ }
} else {
- return Optional.of(new ONFCoreNetworkElement12Basic(bindingAccessor.get(), serviceProvider, configuration));
+ log.error("Netconf Bindingaccessor is not present. This is a fatal issue and needs to be corrected for devicemanagers to work correctly.");
}
}
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java
index 836f36214..736fd4742 100644
--- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java
@@ -380,11 +380,15 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas
LOG.info("Begin registration listener for Mountpoint");
final Optional<NotificationService> optionalNotificationService =
mountPoint.getService(NotificationService.class);
- final NotificationService notificationService = optionalNotificationService.get();
- // notificationService.registerNotificationListener(microwaveEventListener);
- listenerRegistrationresult =
- notificationService.registerNotificationListener(microwaveModel.getNotificationListener());
- LOG.info("End registration listener for Mountpoint Result: {}", listenerRegistrationresult);
+ if (optionalNotificationService.isPresent()) {
+ final NotificationService notificationService = optionalNotificationService.get();
+ // notificationService.registerNotificationListener(microwaveEventListener);
+ listenerRegistrationresult =
+ notificationService.registerNotificationListener(microwaveModel.getNotificationListener());
+ LOG.info("End registration listener for Mountpoint Result: {}", listenerRegistrationresult);
+ } else {
+ LOG.error("Could not get NotificationService, hence microwave notification listener not registered");
+ }
}
/*------------------------------------------------------------