summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/data-provider/model/src
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/data-provider/model/src')
-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
4 files changed, 54 insertions, 100 deletions
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 bd71d5ba1..c7f921708 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,7 +24,6 @@ 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;
@@ -67,10 +66,6 @@ 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.
@@ -96,7 +91,7 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp {
/**
* Use this function to get the converter
- *
+ *
* @return global converter
*/
public static NetconfTimeStamp getConverter() {
@@ -115,7 +110,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
@@ -137,7 +132,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.
*/
@@ -148,7 +143,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.
*/
@@ -194,14 +189,6 @@ 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
deleted file mode 100644
index da52f3125..000000000
--- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/ScalarTypeObject.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * ============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 dd90d29c8..339bf7c6e 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,18 +69,10 @@ 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> getListOrMap(Class<K> clazz, List<T> list) {
+ public static <K extends Identifier<T>,T extends Identifiable<K>> Map<K, T> getListOrMapALUMINIUM(Class<K> clazz, List<T> list) {
Map<K,T> map = new HashMap<>();
for(T listelement:list) {
Constructor<K> constructor;
@@ -94,20 +86,17 @@ public class YangHelper2 {
}
return map;
}
- 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) );
+ 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 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);
+ /**
+ * 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 Class<?> getScalarTypeObjectClass() {
- return org.opendaylight.yangtools.yang.binding.ScalarTypeObject.class;
+ public static <K extends Identifier<T>,T extends Identifiable<K>> List<T> getListOrMap(Class<K> clazz, T listElement) {
+ return Arrays.asList(listElement);
}
}
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 f89197b82..b660787c6 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,7 +1,11 @@
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;
/**
@@ -13,17 +17,20 @@ 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 = "set")
+@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "with")
public class PmDataTypeBuilder {
private Uint64 _uint64;
+ private BigInteger _unint64;
private Long _int64;
private BigDecimal _decimal64;
- public PmDataTypeBuilder() {}
+ public PmDataTypeBuilder() {
+ System.out.println("-- Builder");
+ }
- //Aluminium uses constructor
- public PmDataTypeBuilder(String v) {
- this.setUint64(v);
+ public PmDataTypeBuilder setUnint64(String v) {
+ _unint64 = new BigInteger(v);
+ return this;
}
public PmDataTypeBuilder setUint64(String v) {
@@ -32,7 +39,7 @@ public class PmDataTypeBuilder {
}
public PmDataTypeBuilder setInt64(String v) {
- _int64 = Long.valueOf(v);
+ _int64 = new Long(v);
return this;
}
@@ -42,17 +49,37 @@ public class PmDataTypeBuilder {
}
public PmDataType build() {
- if (_uint64 != null) {
- return new PmDataType(_uint64);
- } else if (_int64 != null) {
- return new PmDataType(_int64);
- } else {
- return new PmDataType(_decimal64);
+ 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");
}
}
public static PmDataType getDefaultInstance(String defaultValue) {
- return new PmDataTypeBuilder().setUint64(defaultValue).build();
+ return new PmDataTypeBuilder().setInt64("-1").build();
}
}