summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/data-provider/model
diff options
context:
space:
mode:
authorMichael DÜrre <michael.duerre@highstreet-technologies.com>2021-01-07 10:03:05 +0100
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-01-29 11:46:14 +0100
commita3e70a1a48d13193d9f28a2d91089d5b253d3e91 (patch)
tree26f381c2aebc5e1ca5de05e14a0a6df424aec917 /sdnr/wt/data-provider/model
parent9e845affab000be46b38223e45f92b590947e892 (diff)
update common and data-provider
fixes for aluminum Issue-ID: CCSDK-3076 Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com> Change-Id: I5416e3328b067609a8820c8c0d4414d362c65ba2 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/data-provider/model')
-rw-r--r--sdnr/wt/data-provider/model/pom.xml2
-rw-r--r--sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/NetconfTimeStampImpl.java21
-rw-r--r--sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/ScalarTypeObject.java49
-rw-r--r--sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/YangHelper2.java31
-rw-r--r--sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java53
5 files changed, 101 insertions, 55 deletions
diff --git a/sdnr/wt/data-provider/model/pom.xml b/sdnr/wt/data-provider/model/pom.xml
index 0f8ce415a..f968bf409 100644
--- a/sdnr/wt/data-provider/model/pom.xml
+++ b/sdnr/wt/data-provider/model/pom.xml
@@ -29,7 +29,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/NetconfTimeStampImpl.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/NetconfTimeStampImpl.java
index c7f921708..bd71d5ba1 100644
--- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/NetconfTimeStampImpl.java
+++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/NetconfTimeStampImpl.java
@@ -24,6 +24,7 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Date;
+import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.slf4j.Logger;
@@ -66,6 +67,10 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp {
private static final Logger LOG = LoggerFactory.getLogger(NetconfTimeStamp.class);
private static final NetconfTimeStamp CONVERTER = new NetconfTimeStampImpl();
+ private static final String TESTPATTERNSTRING = "2017-01-01T00:00:00.0Z";
+ //private static final String INITIALPATTERN = "0000-00-00T00:00:00.0Z";
+
+ private static final DateAndTime TESTPATTERN = new DateAndTime(TESTPATTERNSTRING);
/**
* Specify the input format expected from netconf, and from specific devices.
@@ -91,7 +96,7 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp {
/**
* Use this function to get the converter
- *
+ *
* @return global converter
*/
public static NetconfTimeStamp getConverter() {
@@ -110,7 +115,7 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp {
/**
* Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format
- *
+ *
* @return String with Date in NETCONF/YANG Format Version 1.0.
*/
@Override
@@ -132,7 +137,7 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp {
/**
* Get time from date as NETCONF specific type NETCONF/YANG 1.0 Format in GMT
- *
+ *
* @param date specifying the date and time
* @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0.
*/
@@ -143,7 +148,7 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp {
/**
* Get time from date as NETCONF specific type NETCONF/YANG 1.0 Format in GMT
- *
+ *
* @param date specifying the date and time
* @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0.
*/
@@ -189,6 +194,14 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp {
return "Malformed date: " + netconfTime; // Error handling
}
+ /**
+ * Return testpattern
+ * @return
+ */
+ public static @Nullable DateAndTime getTestpatternDateAndTime() {
+ return TESTPATTERN;
+ }
+
/*----------------------------------------------------
* Private functions
*/
diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/ScalarTypeObject.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/ScalarTypeObject.java
new file mode 100644
index 000000000..da52f3125
--- /dev/null
+++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/ScalarTypeObject.java
@@ -0,0 +1,49 @@
+/*
+ * ============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.model.types;
+
+public class ScalarTypeObject {
+
+ // constants
+ // end of constants
+
+ // variables
+ // end of variables
+
+ // constructors
+ // end of constructors
+
+ // getters and setters
+ // end of getters and setters
+
+ // private methods
+ // end of private methods
+
+ // public methods
+ // end of public methods
+
+ // static methods
+ // end of static methods
+
+ // private classes
+ // end of private classes
+}
diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/YangHelper2.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/YangHelper2.java
index 339bf7c6e..dd90d29c8 100644
--- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/YangHelper2.java
+++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/YangHelper2.java
@@ -69,10 +69,18 @@ public class YangHelper2 {
public static @NonNull Integer getInteger(@Nullable Uint16 val) {
return val.intValue();
}
+
+ public static @NonNull Long getInteger(@Nullable Long val) {
+ return val;
+ }
+
+ public static @NonNull Long getInteger(@Nullable Uint32 val) {
+ return val.longValue();
+ }
/**
* Aluminium version
*/
- public static <K extends Identifier<T>,T extends Identifiable<K>> Map<K, T> getListOrMapALUMINIUM(Class<K> clazz, List<T> list) {
+ public static <K extends Identifier<T>,T extends Identifiable<K>> Map<K, T> getListOrMap(Class<K> clazz, List<T> list) {
Map<K,T> map = new HashMap<>();
for(T listelement:list) {
Constructor<K> constructor;
@@ -86,17 +94,20 @@ public class YangHelper2 {
}
return map;
}
- public static <K extends Identifier<T>,T extends Identifiable<K>> Map<K, T> getListOrMapALUMINIUM(Class<K> clazz, T listElement) {
- return getListOrMapALUMINIUM(clazz, Arrays.asList(listElement) );
+ public static <K extends Identifier<T>,T extends Identifiable<K>> Map<K, T> getListOrMap(Class<K> clazz, T listElement) {
+ return getListOrMap(clazz, Arrays.asList(listElement) );
}
- /**
- * Sodium version
- */
- public static <K extends Identifier<T>,T extends Identifiable<K>> List<T> getListOrMap(Class<K> clazz, List<T> list) {
- return list;
+ public static Uint32 getLongOrUint32(long longVal) {
+ return Uint32.valueOf(longVal);
+ }
+ public static Uint32 getLongOrUint32(Long longVal) {
+ return Uint32.valueOf(longVal);
+ }
+ public static Uint64 getBigIntegerOrUint64(BigInteger value) {
+ return Uint64.valueOf(value);
}
- public static <K extends Identifier<T>,T extends Identifiable<K>> List<T> getListOrMap(Class<K> clazz, T listElement) {
- return Arrays.asList(listElement);
+ public static Class<?> getScalarTypeObjectClass() {
+ return org.opendaylight.yangtools.yang.binding.ScalarTypeObject.class;
}
}
diff --git a/sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java b/sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java
index b660787c6..f89197b82 100644
--- a/sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java
+++ b/sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java
@@ -1,11 +1,7 @@
package org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Optional;
import org.opendaylight.yangtools.yang.common.Uint64;
/**
@@ -17,20 +13,17 @@ import org.opendaylight.yangtools.yang.common.Uint64;
* finished by the user. This class is generated only once to prevent loss of user code.
*
*/
-@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "with")
+@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "set")
public class PmDataTypeBuilder {
private Uint64 _uint64;
- private BigInteger _unint64;
private Long _int64;
private BigDecimal _decimal64;
- public PmDataTypeBuilder() {
- System.out.println("-- Builder");
- }
+ public PmDataTypeBuilder() {}
- public PmDataTypeBuilder setUnint64(String v) {
- _unint64 = new BigInteger(v);
- return this;
+ //Aluminium uses constructor
+ public PmDataTypeBuilder(String v) {
+ this.setUint64(v);
}
public PmDataTypeBuilder setUint64(String v) {
@@ -39,7 +32,7 @@ public class PmDataTypeBuilder {
}
public PmDataTypeBuilder setInt64(String v) {
- _int64 = new Long(v);
+ _int64 = Long.valueOf(v);
return this;
}
@@ -49,37 +42,17 @@ public class PmDataTypeBuilder {
}
public PmDataType build() {
- Optional<Constructor<PmDataType>> cons1;
- try {
- cons1 = Optional.of(PmDataType.class.getConstructor(BigInteger.class));
- } catch (NoSuchMethodException | SecurityException e) {
- cons1 = Optional.empty();
- }
- Optional<Constructor<PmDataType>> cons2;
- try {
- cons2 = Optional.of(PmDataType.class.getConstructor(Uint64.class));
- } catch (NoSuchMethodException | SecurityException e) {
- cons2 = Optional.empty();
- }
-
- try {
- if (_unint64 != null) {
- return cons1.get().newInstance(_unint64);
- } else if (_uint64 != null) {
- return cons2.get().newInstance(_uint64);
- } else if (_int64 != null) {
- return new PmDataType(_int64);
- } else {
- return new PmDataType(_decimal64);
- }
- } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
- | InvocationTargetException e) {
- throw new IllegalArgumentException("Wrong stuff");
+ if (_uint64 != null) {
+ return new PmDataType(_uint64);
+ } else if (_int64 != null) {
+ return new PmDataType(_int64);
+ } else {
+ return new PmDataType(_decimal64);
}
}
public static PmDataType getDefaultInstance(String defaultValue) {
- return new PmDataTypeBuilder().setInt64("-1").build();
+ return new PmDataTypeBuilder().setUint64(defaultValue).build();
}
}