summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/data-provider/provider
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/data-provider/provider')
-rw-r--r--sdnr/wt/data-provider/provider/pom.xml15
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java6
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseMaintenanceService.java4
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java2
-rw-r--r--sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java8
-rw-r--r--sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMapper.java93
-rw-r--r--sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMappingOpenRoadm.java6
-rw-r--r--sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/MariaDBTestBase.java15
8 files changed, 116 insertions, 33 deletions
diff --git a/sdnr/wt/data-provider/provider/pom.xml b/sdnr/wt/data-provider/provider/pom.xml
index 8c546aebd..1d3753b48 100644
--- a/sdnr/wt/data-provider/provider/pom.xml
+++ b/sdnr/wt/data-provider/provider/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
@@ -210,18 +210,7 @@
</execution>
</executions>
</plugin>
-<!-- <plugin> -->
-<!-- <groupId>org.apache.felix</groupId> -->
-<!-- <artifactId>maven-bundle-plugin</artifactId> -->
-<!-- <extensions>true</extensions> -->
-<!-- <configuration> -->
-<!-- <instructions> -->
-<!-- <Export-Package>org.onap.ccsdk.features.sdnr.wt.dataprovider.*</Export-Package> -->
-<!-- <Import-Package>*</Import-Package> -->
-<!-- <Embed-Dependency>dblib-provider;scope=provided|;inline=false,utils-provider;scope=provided|;inline=false</Embed-Dependency> -->
-<!-- </instructions> -->
-<!-- </configuration> -->
-<!-- </plugin> -->
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java
index 13438ef15..9cfe4e50d 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java
@@ -405,8 +405,8 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
}
NetworkElementConnectionBuilder builder = new NetworkElementConnectionBuilder(base);
if (toJoin != null) {
- if (toJoin.isIsRequired() != null) {
- builder.setIsRequired(toJoin.isIsRequired());
+ if (toJoin.requireIsRequired() != null) {
+ builder.setIsRequired(toJoin.requireIsRequired());
}
if (toJoin.getCoreModelCapability() != null) {
builder.setCoreModelCapability(toJoin.getCoreModelCapability());
@@ -483,7 +483,7 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
public void removeNetworkConnection(String nodeId) {
Boolean isRequired;
NetworkElementConnectionEntity e = this.networkelementConnectionDB.read(nodeId);
- if (e != null && (isRequired = e.isIsRequired()) != null) {
+ if (e != null && (isRequired = e.requireIsRequired()) != null) {
if (isRequired) {
LOG.debug("updating connection status for {} of required ne to disconnected", nodeId);
this.networkelementConnectionDB.update(new UpdateNetworkElementConnectionInputBuilder()
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseMaintenanceService.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseMaintenanceService.java
index c6161b54c..9f4c0f399 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseMaintenanceService.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseMaintenanceService.java
@@ -166,8 +166,8 @@ public class HtDatabaseMaintenanceService implements HtDatabaseMaintenance {
} else {
LOG.warn("cannot read db. no db reader writer initialized");
}
- if (ne != null && ne.isIsRequired() != null) {
- return ne.isIsRequired();
+ if (ne != null && ne.requireIsRequired() != null) {
+ return ne.requireIsRequired();
} else {
return false;
}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java
index 5211030eb..29d9ee9db 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java
@@ -66,6 +66,8 @@ public class ODLVersionLUT {
}
if(odlMdsalVersionLUT==null) {
odlMdsalVersionLUT = new HashMap<>();
+ odlMdsalVersionLUT.put("8.0.7","phosphorus-SR1 (0.15.1)");
+ odlMdsalVersionLUT.put("8.0.5","phosphorus-SR0 (0.15.0)");
odlMdsalVersionLUT.put("7.0.9","silicon-SR2 (0.14.2)");
odlMdsalVersionLUT.put("7.0.7","silicon-SR1 (0.14.1)");
odlMdsalVersionLUT.put("7.0.6","silicon-SR0 (0.14.0)");
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java
index d59a0784f..00e8075f9 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java
@@ -379,7 +379,7 @@ public class TestCRUDforDatabase {
// ==PARTIAL UPDATE============================
System.out.println("Try partial update...");
- assertEquals(false, data.get(0).isIsRequired());
+ assertEquals(false, data.get(0).requireIsRequired());
updateInput = new UpdateNetworkElementConnectionInputBuilder().setId(dbId).setIsRequired(true).build();
try {
updateOutput = dbProvider.updateNetworkElementConnection(updateInput);
@@ -392,7 +392,7 @@ public class TestCRUDforDatabase {
readOperation = dbProvider.readNetworkElementConnectionList(readInput);
data = readOperation.getData();
- assertEquals(true, data.get(0).isIsRequired());
+ assertEquals(true, data.get(0).requireIsRequired());
assertEquals(url2, data.get(0).getHost());
assertEquals(port2, data.get(0).getPort().longValue());
@@ -463,7 +463,7 @@ public class TestCRUDforDatabase {
assertNotEquals(0, data.size());
assertNotNull(data);
assertEquals(nodeId, data.get(0).getNodeId());
- assertEquals(isActive, data.get(0).isActive());
+ assertEquals(isActive, data.get(0).requireActive());
// ==UPDATE============================
@@ -489,7 +489,7 @@ public class TestCRUDforDatabase {
assertNotNull(data);
assertEquals(nodeId2, data.get(0).getNodeId());
- assertEquals(isActive2, data.get(0).isActive());
+ assertEquals(isActive2, data.get(0).getActive());
// ==DELETE================================
System.out.println("Trying to delete...");
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMapper.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMapper.java
new file mode 100644
index 000000000..50c231015
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMapper.java
@@ -0,0 +1,93 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
+ * All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ */
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.json.JSONObject;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnection;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType;
+
+public class TestMapper {
+
+ private static final YangToolsMapper MAPPER = new YangToolsMapper();
+
+ @Test
+ public void testYangGenEnumMapperDeser() {
+ NetworkElementConnection con = null;
+ try {
+ con = MAPPER.readValue("{\"device-type\":\"O-RAN\"}", NetworkElementConnection.class);
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ assertEquals(NetworkElementDeviceType.ORAN, con.getDeviceType());
+ try {
+ con = MAPPER.readValue("{\"device-type\":\"ORAN\"}", NetworkElementConnection.class);
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ assertEquals(NetworkElementDeviceType.ORAN, con.getDeviceType());
+ try {
+ con = MAPPER.readValue("{\"device-type\":\"O-ROADM\"}", NetworkElementConnection.class);
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ assertEquals(NetworkElementDeviceType.OROADM, con.getDeviceType());
+ try {
+ con = MAPPER.readValue("{\"device-type\":\"O-ROADM\"}", NetworkElementConnection.class);
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ assertEquals(NetworkElementDeviceType.OROADM, con.getDeviceType());
+ }
+
+ @Test
+ public void testYangGenEnumMapperSer() {
+ NetworkElementConnection con =
+ new NetworkElementConnectionBuilder().setDeviceType(NetworkElementDeviceType.ORAN).build();
+ String str = null;
+ try {
+ str = MAPPER.writeValueAsString(con);
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ assertEquals("O-RAN", new JSONObject(str).getString("device-type"));
+ con = new NetworkElementConnectionBuilder().setDeviceType(NetworkElementDeviceType.OROADM).build();
+ str = null;
+ try {
+ str = MAPPER.writeValueAsString(con);
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ assertEquals("O-ROADM", new JSONObject(str).getString("device-type"));
+ }
+}
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMappingOpenRoadm.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMappingOpenRoadm.java
index 1345d4edf..35ddaf2f3 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMappingOpenRoadm.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMappingOpenRoadm.java
@@ -35,6 +35,7 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.YangHelper2;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.yangtools.DataProviderYangToolsMapper;
import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapper2;
import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmDataType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmDataTypeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.openroadm.pm.types.rev200413.BIPErrorCounter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.openroadm.pm.types.rev200413.OpticalPowerInputOSCMin;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GranularityPeriodType;
@@ -78,7 +79,7 @@ public class TestYangGenSalMappingOpenRoadm extends Mockito {
String jsonString = mapper2.writeValueAsString(pmDataType);
out("Result json after mapping: " + jsonString);
- PmdataEntity generatepmdNode = mapper2.readValue(jsonString.getBytes(), PmdataEntity.class);
+ PmdataEntity generatepmdNode = mapper2.readValue(jsonString, PmdataEntity.class);
out("Original: " + pmDataType.toString());
out("Mapped : " + generatepmdNode.toString());
assertTrue("Can mapping not working", generatepmdNode.equals(pmDataType));
@@ -104,9 +105,10 @@ public class TestYangGenSalMappingOpenRoadm extends Mockito {
@Test
public void testOpenroadmPMString2() throws IOException, ClassNotFoundException {
out("Test: " + method());
+ PmDataTypeBuilder.getDefaultInstance("11298624220985537708");
String jsonString2 = getFileContent("pmdata2.json");
DataProviderYangToolsMapper mapper2 = new DataProviderYangToolsMapper();
- PmdataEntity generatepmdNode = mapper2.readValue(jsonString2.getBytes(), PmdataEntity.class);
+ PmdataEntity generatepmdNode = mapper2.readValue(jsonString2, PmdataEntity.class);
out(generatepmdNode.toString()); // Print it with specified indentation
}
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/MariaDBTestBase.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/MariaDBTestBase.java
index 18efde235..7d71571d4 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/MariaDBTestBase.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/MariaDBTestBase.java
@@ -154,20 +154,17 @@ public class MariaDBTestBase {
}
public static boolean createTable(SqlDBClient dbService, Class<?> cls, Entity entity, boolean autoIndex) {
+ return createTable(dbService, cls, entity, autoIndex, true);
+ }
+ public static boolean createTable(SqlDBClient dbService, Class<?> cls, Entity entity, boolean autoIndex,
+ boolean withControllerId) {
String createStatement = null;
try {
- createStatement = SqlDBMapper.createTable(cls, entity, "", autoIndex);
+ createStatement = SqlDBMapper.createTable(cls, entity, "", autoIndex,withControllerId);
} catch (UnableToMapClassException e) {
fail(e.getMessage());
}
System.out.println(createStatement);
- try {
- return dbService.write(createStatement);
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
-
- }
- return false;
+ return dbService.createTable(createStatement);
}
}