summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/data-provider/model/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/data-provider/model/src/main/java')
-rw-r--r--sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java27
-rw-r--r--sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/HtDatabaseMaintenance.java2
-rw-r--r--sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/YangHelper2.java102
-rw-r--r--sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java82
4 files changed, 191 insertions, 22 deletions
diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java
index 639fe301b..d277b763e 100644
--- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java
+++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java
@@ -20,13 +20,14 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.model;
import java.util.Date;
import java.util.List;
import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ConnectionlogEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EventlogEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.FaultcurrentEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.FaultlogEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Inventory;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementConnectionEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.PmdataEntity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionlogEntity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultcurrentEntity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Guicutthrough;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionEntity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.PmdataEntity;
public interface DataProvider extends ArchiveCleanProvider {
@@ -72,6 +73,13 @@ public interface DataProvider extends ArchiveCleanProvider {
void writeInventory(Inventory internalEquipment);
/**
+ * write GUI Cut through data to database
+ *
+ * @param gcData
+ */
+ void writeGuiCutThroughData(Guicutthrough gcData);
+
+ /**
*
* @param networkElementConnectionEntitiy to wirte to DB
* @param nodeId Id for this DB element
@@ -102,10 +110,7 @@ public interface DataProvider extends ArchiveCleanProvider {
/**
* @param list
*/
- void doWritePerformanceData(List<PmdataEntity> list);
-
- void doWritePerformanceData2(List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.v2.rev200702.PmdataEntity> list);
-
+ void doWritePerformanceData(List<PmdataEntity> list);
/**
* @return raw database client
diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/HtDatabaseMaintenance.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/HtDatabaseMaintenance.java
index 51fe25d89..99e251c44 100644
--- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/HtDatabaseMaintenance.java
+++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/HtDatabaseMaintenance.java
@@ -19,7 +19,7 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.model;
import java.util.List;
import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.MaintenanceEntity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.MaintenanceEntity;
/**
* @author herbert
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
new file mode 100644
index 000000000..339bf7c6e
--- /dev/null
+++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/YangHelper2.java
@@ -0,0 +1,102 @@
+/*
+ * ============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;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.math.BigInteger;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.Identifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+
+public class YangHelper2 {
+
+ static public @NonNull Uint64 getUint64(@NonNull BigInteger val) {
+ return Uint64.valueOf(val);
+ }
+
+ static public @NonNull Uint64 getUint64(@NonNull Uint64 val) {
+ return val;
+ }
+
+ static public @NonNull Uint32 getUint32(@NonNull Long val) {
+ return Uint32.valueOf(val);
+ }
+
+ static public @NonNull Uint32 getUint32(@NonNull Uint32 val) {
+ return val;
+ }
+
+ public static @NonNull Uint16 getUint16(@Nullable Integer val) {
+ return Uint16.valueOf(val);
+ }
+
+ public static @NonNull Uint16 getUint16(@Nullable Uint16 val) {
+ return val;
+ }
+
+ public static @NonNull Integer getInteger(@Nullable Integer val) {
+ return val;
+ }
+
+ public static @NonNull Integer getInteger(@Nullable Uint16 val) {
+ return val.intValue();
+ }
+ /**
+ * Aluminium version
+ */
+ 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;
+ try {
+ constructor = clazz.getConstructor(clazz);
+ clazz.getConstructors();
+ map.put(constructor.newInstance(listelement.key()), listelement);
+ } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new IllegalArgumentException("Can not create map element.", e);
+ }
+ }
+ 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) );
+ }
+ /**
+ * 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 <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 98e93c363..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,23 +1,85 @@
package org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129;
-import java.lang.String;
-import java.lang.UnsupportedOperationException;
+
+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;
/**
- * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
- * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32).
+ * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string
+ * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 -
+ * uint16), or (string - uint32).
*
- * The reason behind putting it under src/main/java is:
- * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent
- * loss of user code.
+ * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be
+ * finished by the user. This class is generated only once to prevent loss of user code.
*
*/
+@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "with")
public class PmDataTypeBuilder {
- private PmDataTypeBuilder() {
- //Exists only to defeat instantiation.
+ private Uint64 _uint64;
+ private BigInteger _unint64;
+ private Long _int64;
+ private BigDecimal _decimal64;
+
+ public PmDataTypeBuilder() {
+ System.out.println("-- Builder");
+ }
+
+ public PmDataTypeBuilder setUnint64(String v) {
+ _unint64 = new BigInteger(v);
+ return this;
+ }
+
+ public PmDataTypeBuilder setUint64(String v) {
+ _uint64 = Uint64.valueOf(v);
+ return this;
+ }
+
+ public PmDataTypeBuilder setInt64(String v) {
+ _int64 = new Long(v);
+ return this;
+ }
+
+ public PmDataTypeBuilder setDecimal64(String v) {
+ _decimal64 = new BigDecimal(v);
+ return this;
+ }
+
+ 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");
+ }
}
public static PmDataType getDefaultInstance(String defaultValue) {
- throw new UnsupportedOperationException("Not yet implemented");
+ return new PmDataTypeBuilder().setInt64("-1").build();
}
}