summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-core
diff options
context:
space:
mode:
authorMichael Dürre <michael.duerre@highstreet-technologies.com>2022-07-20 09:32:50 +0200
committerMichael Dürre <michael.duerre@highstreet-technologies.com>2022-07-21 12:38:52 +0200
commit25423c50e504676f15c7a57c03aad40bfc35c7e6 (patch)
tree811649e2ec44e0332e601c6563e00e914d355b9a /sdnr/wt/devicemanager-core
parentcea47224b7b6afdd7b3d3ead8d08baf46eadc575 (diff)
migrate sdnr features to sulfur
fix sdnr code for sulfur Issue-ID: CCSDK-3692 Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com> Change-Id: I0a62ade424bb978222e7ce6450215fb327f957b7 Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-core')
-rw-r--r--sdnr/wt/devicemanager-core/feature/pom.xml4
-rwxr-xr-xsdnr/wt/devicemanager-core/installer/pom.xml3
-rw-r--r--sdnr/wt/devicemanager-core/model/pom.xml12
-rw-r--r--sdnr/wt/devicemanager-core/model/src/main/yang/devicemanager.yang2
-rwxr-xr-xsdnr/wt/devicemanager-core/pom.xml3
-rw-r--r--sdnr/wt/devicemanager-core/provider/pom.xml36
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java29
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java5
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java5
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java4
10 files changed, 71 insertions, 32 deletions
diff --git a/sdnr/wt/devicemanager-core/feature/pom.xml b/sdnr/wt/devicemanager-core/feature/pom.xml
index 5882823b2..e65580d83 100644
--- a/sdnr/wt/devicemanager-core/feature/pom.xml
+++ b/sdnr/wt/devicemanager-core/feature/pom.xml
@@ -22,13 +22,15 @@
~ ============LICENSE_END=======================================================
~
-->
+
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>2.4.0</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/devicemanager-core/installer/pom.xml b/sdnr/wt/devicemanager-core/installer/pom.xml
index 1124c5b09..1d84071b4 100755
--- a/sdnr/wt/devicemanager-core/installer/pom.xml
+++ b/sdnr/wt/devicemanager-core/installer/pom.xml
@@ -22,13 +22,14 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.4.0</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/devicemanager-core/model/pom.xml b/sdnr/wt/devicemanager-core/model/pom.xml
index 070d3840e..56bec8c84 100644
--- a/sdnr/wt/devicemanager-core/model/pom.xml
+++ b/sdnr/wt/devicemanager-core/model/pom.xml
@@ -22,16 +22,18 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <parent>
+ <parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.4.0</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath/>
</parent>
+
<groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
<artifactId>sdnr-wt-devicemanager-core-model</artifactId>
<version>1.4.0-SNAPSHOT</version>
@@ -60,11 +62,17 @@
<artifactId>sdnr-wt-data-provider-model</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
+ </dependency> <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sdnr-wt-common</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sdnr-wt-websocketmanager-model</artifactId>
<version>${project.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
diff --git a/sdnr/wt/devicemanager-core/model/src/main/yang/devicemanager.yang b/sdnr/wt/devicemanager-core/model/src/main/yang/devicemanager.yang
index e12991b29..5edf3949d 100644
--- a/sdnr/wt/devicemanager-core/model/src/main/yang/devicemanager.yang
+++ b/sdnr/wt/devicemanager-core/model/src/main/yang/devicemanager.yang
@@ -1,6 +1,6 @@
module devicemanager {
- yang-version 1;
+ yang-version 1.1;
namespace "urn:opendaylight:params:xml:ns:yang:devicemanager";
prefix devicemanager;
diff --git a/sdnr/wt/devicemanager-core/pom.xml b/sdnr/wt/devicemanager-core/pom.xml
index 18be33b40..24a99fe39 100755
--- a/sdnr/wt/devicemanager-core/pom.xml
+++ b/sdnr/wt/devicemanager-core/pom.xml
@@ -22,13 +22,14 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.4.0</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/devicemanager-core/provider/pom.xml b/sdnr/wt/devicemanager-core/provider/pom.xml
index 05a6127d2..4c373d58d 100644
--- a/sdnr/wt/devicemanager-core/provider/pom.xml
+++ b/sdnr/wt/devicemanager-core/provider/pom.xml
@@ -22,13 +22,14 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.4.0</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath/>
</parent>
@@ -52,13 +53,6 @@
</properties>
<dependencies>
- <!-- begin for testing -->
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- end for testing -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sdnr-wt-devicemanager-core-model</artifactId>
@@ -71,6 +65,12 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sdnr-wt-data-provider-model</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
<artifactId>sdnr-wt-websocketmanager-model</artifactId>
<version>${project.version}</version>
@@ -85,11 +85,12 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <scope>provided</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>ietf-topology</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
@@ -156,6 +157,23 @@
<artifactId>jaxb-runtime</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <!-- begin for testing -->
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- end for testing -->
</dependencies>
<build>
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java
index e31b79aea..4d5823a00 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java
@@ -19,8 +19,14 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl;
+import com.google.common.util.concurrent.ForwardingListenableFuture;
import com.google.common.util.concurrent.ListenableFuture;
+
+import java.util.HashSet;
import java.util.List;
+import java.util.stream.Collectors;
+
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.housekeeping.ResyncNetworkElementsListener;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceRPCServiceAPI;
@@ -52,7 +58,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicema
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.TestMaintenanceModeOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.TestMaintenanceModeOutputBuilder;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
@@ -105,7 +111,7 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl
try {
GetRequiredNetworkElementKeysOutputBuilder outputBuilder =
maintenanceService.getRequiredNetworkElementKeys();
- result = RpcResultBuilder.success(outputBuilder);
+ result = RpcResultBuilder.success(outputBuilder.build());
} catch (Exception e) {
result = RpcResultBuilder.failed();
result.withError(ErrorType.APPLICATION, "Exception", e);
@@ -123,7 +129,7 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl
try {
ShowRequiredNetworkElementOutputBuilder outputBuilder =
maintenanceService.showRequiredNetworkElement(input);
- result = RpcResultBuilder.success(outputBuilder);
+ result = RpcResultBuilder.success(outputBuilder.build());
} catch (Exception e) {
result = RpcResultBuilder.failed();
result.withError(ErrorType.APPLICATION, "Exception", e);
@@ -139,13 +145,12 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl
try {
SetMaintenanceModeOutputBuilder outputBuilder = maintenanceService.setMaintenanceMode(input);
- result = RpcResultBuilder.success(outputBuilder);
+ result = RpcResultBuilder.success(outputBuilder.build());
} catch (Exception e) {
result = RpcResultBuilder.failed();
result.withError(ErrorType.APPLICATION, "Exception", e);
}
return result.buildFuture();
-
}
@@ -154,11 +159,11 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl
public ListenableFuture<RpcResult<GetMaintenanceModeOutput>> getMaintenanceMode(GetMaintenanceModeInput input) {
LOG.info("RPC Request: getMaintenanceMode input: {}", input.getMountpointName());
- RpcResultBuilder<GetMaintenanceModeOutput> result;
+ @NonNull RpcResultBuilder<GetMaintenanceModeOutput> result;
try {
GetMaintenanceModeOutputBuilder outputBuilder = maintenanceService.getMaintenanceMode(input);
- result = RpcResultBuilder.success(outputBuilder);
+ result = RpcResultBuilder.success(outputBuilder.build());
} catch (Exception e) {
result = RpcResultBuilder.failed();
result.withError(ErrorType.APPLICATION, "Exception", e);
@@ -174,7 +179,7 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl
try {
TestMaintenanceModeOutputBuilder outputBuilder = maintenanceService.testMaintenanceMode(input);
- result = RpcResultBuilder.success(outputBuilder);
+ result = RpcResultBuilder.success(outputBuilder.build());
} catch (Exception e) {
result = RpcResultBuilder.failed();
result.withError(ErrorType.APPLICATION, "Exception", e);
@@ -192,10 +197,10 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl
try {
if (this.resyncCallbackListener != null) {
List<String> nodeNames =
- this.resyncCallbackListener.doClearCurrentFaultByNodename(input.getNodenames());
+ this.resyncCallbackListener.doClearCurrentFaultByNodename(input.getNodenames().stream().collect(Collectors.toList()));
ClearCurrentFaultByNodenameOutputBuilder outputBuilder = new ClearCurrentFaultByNodenameOutputBuilder();
- outputBuilder.setNodenames(nodeNames);
- result = RpcResultBuilder.success(outputBuilder);
+ outputBuilder.setNodenames(new HashSet<>(nodeNames));
+ result = RpcResultBuilder.success(outputBuilder.build());
} else {
result = RpcResultBuilder.failed();
result.withError(ErrorType.APPLICATION, "Startup running");
@@ -251,6 +256,4 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl
return result.buildFuture();
}
-
-
}
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java
index 4369af019..13eca8f25 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java
@@ -17,6 +17,7 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util;
+import java.util.HashSet;
import java.util.Optional;
import javax.annotation.Nonnull;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InternalConnectionStatus;
@@ -82,8 +83,8 @@ public class NetworkElementConnectionEntitiyUtil {
Capabilities unAvailableCapabilities = Capabilities.getUnavailableCapabilities(nNode);
NodeDetailsBuilder nodeDetails =
- new NodeDetailsBuilder().setAvailableCapabilities(availableCapabilities.getCapabilities())
- .setUnavailableCapabilities(unAvailableCapabilities.getCapabilities());
+ new NodeDetailsBuilder().setAvailableCapabilities(new HashSet<>(availableCapabilities.getCapabilities()))
+ .setUnavailableCapabilities(new HashSet<>(unAvailableCapabilities.getCapabilities()));
eb.setNodeDetails(nodeDetails.build());
// -- host information
Host host = nNode.getHost();
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java
index 6351f3958..b8b67fde4 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java
@@ -19,7 +19,10 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.impl;
import java.time.ZonedDateTime;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMaintenance;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceRPCServiceAPI;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.MaintenanceService;
@@ -79,7 +82,7 @@ public class MaintenanceServiceImpl implements MaintenanceService, MaintenanceRP
public GetRequiredNetworkElementKeysOutputBuilder getRequiredNetworkElementKeys() {
List<MaintenanceEntity> all = database.getAll();
- List<String> mountpointList = new ArrayList<>();
+ Set<String> mountpointList = new HashSet<>();
for (MaintenanceEntity oneOfAll : all) {
mountpointList.add(oneOfAll.getNodeId());
diff --git a/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java b/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java
index 06b825934..07c4f6ae4 100644
--- a/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java
+++ b/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java
@@ -22,6 +22,8 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.test;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
+import java.util.HashSet;
+
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -179,7 +181,7 @@ public class TestDevicemanager extends Mockito {
log.info("testResync");
ClearCurrentFaultByNodenameInputBuilder inputBuilder = new ClearCurrentFaultByNodenameInputBuilder();
- inputBuilder.setNodenames(Arrays.asList("test1", "test2"));
+ inputBuilder.setNodenames(new HashSet<>(Arrays.asList("test1", "test2")));
apiService.clearCurrentFaultByNodename(inputBuilder.build());
}