aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt
diff options
context:
space:
mode:
authorMichael Dürre <michael.duerre@highstreet-technologies.com>2020-08-31 10:36:42 +0200
committerMichael Dürre <michael.duerre@highstreet-technologies.com>2020-08-31 13:27:38 +0200
commit4cd4c471e9b56494b7ae1e4917e88fa9513082b9 (patch)
tree779311a2a203d89c54468fefeb7d56b786d55471 /sdnr/wt
parent4bd84bebdaa0c2d82050fbedd1fa8260eb62146d (diff)
add data-provider v2 for openroadm
extend db service for writing data for v2 Issue-ID: CCSDK-2582 Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com> Change-Id: Ib47919a7f45a4954cd76514097a0b073c605fec3 Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt')
-rw-r--r--sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/JSONAssert.java57
-rw-r--r--sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java7
-rw-r--r--sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java (renamed from sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev200327/PmDataTypeBuilder.java)2
-rw-r--r--sdnr/wt/data-provider/model/src/main/yang/data-provider-v2@2020-07-02.yang1
-rw-r--r--sdnr/wt/data-provider/model/src/main/yang/org-openroadm-pm-types@2019-11-29.yang (renamed from sdnr/wt/devicemanager-openroadm/provider/src/main/yang/org-openroadm-pm-types.yang)0
-rw-r--r--sdnr/wt/data-provider/provider/pom.xml3
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/entity/HtDatabaseEventsService.java63
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/yangtools/YangToolsCloner.java223
-rw-r--r--sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTree.java78
-rw-r--r--sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/HostInfoForTest.java2
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/1.json17
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/10.json15
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/11.json18
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/12.json15
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/13.json20
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/14.json15
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/15.json15
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/16.json15
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/17.json17
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/18.json18
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/19.json20
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/2.json15
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/20.json20
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/21.json17
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/3.json15
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/4.json15
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/5.json25
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/6.json17
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/7.json17
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/8.json17
-rw-r--r--sdnr/wt/data-provider/provider/src/test/resources/testequipment/9.json19
-rw-r--r--sdnr/wt/devicemanager-openroadm/provider/src/main/yang/org-openroadm-pm-types@2019-11-29.yang (renamed from sdnr/wt/data-provider/model/src/main/yang/org-openroadm-pm-types@2020-03-27.yang)31
32 files changed, 555 insertions, 274 deletions
diff --git a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/JSONAssert.java b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/JSONAssert.java
index f95dfe0b2..8b651cbe9 100644
--- a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/JSONAssert.java
+++ b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/JSONAssert.java
@@ -60,7 +60,7 @@ public class JSONAssert {
} else if ((o1 instanceof String) && (o2 instanceof String)) {
- return ((String) o1).equals(((String) o2)) ? 0 : -1;
+ return ((String) o1).equals((o2)) ? 0 : -1;
} else if ((o1 instanceof JSONObject) && (o2 instanceof JSONObject)) {
if (((JSONObject) o1).length() != ((JSONObject) o2).length()) {
return ((JSONObject) o1).length() - ((JSONObject) o2).length() < 0 ? -1 : 1;
@@ -137,7 +137,7 @@ public class JSONAssert {
} else if ((o1 instanceof String) && (o2 instanceof String)) {
- return ((String) o1).equals(((String) o2)) ? 0 : -1;
+ return ((String) o1).equals((o2)) ? 0 : -1;
} else if ((o1 instanceof JSONObject) && (o2 instanceof JSONObject)) {
if (((JSONObject) o1).length() == 0 && ((JSONObject) o2).length() == 0) {
return 0;
@@ -181,6 +181,56 @@ public class JSONAssert {
}
}
+
+ public static void assertContainsOnlyKey(JSONObject o, String key) {
+ if(o==null) {
+ throw new AssertionError("object is null");
+ }
+ if(key==null) {
+ throw new AssertionError("key is null");
+ }
+
+ Object[] keys= o.keySet().toArray();
+ if(keys.length>1) {
+ throw new AssertionError("more than one key found");
+ }
+ if(keys.length==0) {
+ throw new AssertionError("no key found");
+ }
+ if(!key.equals(keys[0])) {
+ throw new AssertionError("different key found "+key+" <=> "+ keys[0]);
+ }
+ }
+
+
+ public static void assertContainsExactKeys(JSONObject o, String[] keys) {
+ if(o==null) {
+ throw new AssertionError("object is null");
+ }
+ if(keys==null) {
+ throw new AssertionError("keys is null");
+ }
+ Object[] okeys= o.keySet().toArray();
+ if(okeys.length!=keys.length) {
+ throw new AssertionError("found different amount of keys");
+ }
+ for(String k:keys) {
+ if(!o.keySet().contains(k)) {
+ throw new AssertionError("key "+ k+ " not found");
+ }
+ }
+ }
+ public static void assertContainsNoKeys(JSONObject o) {
+ if(o==null) {
+ throw new AssertionError("object is null");
+ }
+
+ Object[] okeys= o.keySet().toArray();
+ if(okeys.length!=0) {
+ throw new AssertionError("found keys");
+ }
+ }
+
private static void assertEqualsNonStrict(String message, String def, String toTest) throws JSONException {
JSONObject d1 = new JSONObject(def);
@@ -188,6 +238,7 @@ public class JSONAssert {
if (nonStrictComarator.compare(d1, d2) != 0) {
throw new AssertionError(message);
}
+
}
private static void assertEqualsStrict(String message, String def, String toTest) throws JSONException {
@@ -198,4 +249,6 @@ public class JSONAssert {
}
}
+
+
}
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 f4578d5dc..639fe301b 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
@@ -102,10 +102,13 @@ public interface DataProvider extends ArchiveCleanProvider {
/**
* @param list
*/
- void doWritePerformanceData(List<PmdataEntity> 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);
+
/**
- * @return
+ * @return raw database client
*/
HtDatabaseClient getRawClient();
diff --git a/sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev200327/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 f470fb6ba..98e93c363 100644
--- a/sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev200327/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,4 +1,4 @@
-package org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev200327;
+package org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129;
import java.lang.String;
import java.lang.UnsupportedOperationException;
diff --git a/sdnr/wt/data-provider/model/src/main/yang/data-provider-v2@2020-07-02.yang b/sdnr/wt/data-provider/model/src/main/yang/data-provider-v2@2020-07-02.yang
index 358e30c8b..47cc009f1 100644
--- a/sdnr/wt/data-provider/model/src/main/yang/data-provider-v2@2020-07-02.yang
+++ b/sdnr/wt/data-provider/model/src/main/yang/data-provider-v2@2020-07-02.yang
@@ -6,6 +6,7 @@ module data-provider-v2 {
import org-openroadm-pm-types {
prefix org-openroadm-pm-types;
+ revision-date 2019-11-29;
reference
"OpenROADM: YANG definitions of performance management types";
}
diff --git a/sdnr/wt/devicemanager-openroadm/provider/src/main/yang/org-openroadm-pm-types.yang b/sdnr/wt/data-provider/model/src/main/yang/org-openroadm-pm-types@2019-11-29.yang
index 78dd8934e..78dd8934e 100644
--- a/sdnr/wt/devicemanager-openroadm/provider/src/main/yang/org-openroadm-pm-types.yang
+++ b/sdnr/wt/data-provider/model/src/main/yang/org-openroadm-pm-types@2019-11-29.yang
diff --git a/sdnr/wt/data-provider/provider/pom.xml b/sdnr/wt/data-provider/provider/pom.xml
index a536d64b1..2a7b68632 100644
--- a/sdnr/wt/data-provider/provider/pom.xml
+++ b/sdnr/wt/data-provider/provider/pom.xml
@@ -162,13 +162,12 @@
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
- <version>6.16</version>
<configuration>
<skip>${skipTests}</skip>
<clusterName>testCluster</clusterName>
<transportPort>9500</transportPort>
<httpPort>${databaseport}</httpPort>
- <version>7.1.1</version>
+ <version>7.6.1</version>
<timeout>120</timeout>
<pathInitScript>${project.build.directory}/EsInit.script</pathInitScript>
</configuration>
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/entity/HtDatabaseEventsService.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/entity/HtDatabaseEventsService.java
index 46475f02d..de6870571 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/entity/HtDatabaseEventsService.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/entity/HtDatabaseEventsService.java
@@ -25,9 +25,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
-
import javax.annotation.Nonnull;
-
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
@@ -83,6 +81,8 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
private final EsDataObjectReaderWriter2<NetworkElementConnectionEntity> networkelementConnectionDB;
private final EsDataObjectReaderWriter2<PmdataEntity> pmData15mDB;
private final EsDataObjectReaderWriter2<PmdataEntity> pmData24hDB;
+ private final EsDataObjectReaderWriter2<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.v2.rev200702.PmdataEntity> pmData15mDBv2;
+ private final EsDataObjectReaderWriter2<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.v2.rev200702.PmdataEntity> pmData24hDBv2;
@SuppressWarnings("unused")
private final ElasticSearchDataProvider dataProvider;
@@ -124,6 +124,15 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
pmData24hDB = new EsDataObjectReaderWriter2<>(client, Entity.Historicalperformance24h, PmdataEntity.class,
PmdataEntityBuilder.class);
+ pmData15mDBv2 = new EsDataObjectReaderWriter2<>(client, Entity.Historicalperformance15min,
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.v2.rev200702.PmdataEntity.class,
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.v2.rev200702.PmdataEntityBuilder.class);
+
+ pmData24hDBv2 = new EsDataObjectReaderWriter2<>(client, Entity.Historicalperformance24h,
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.v2.rev200702.PmdataEntity.class,
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.v2.rev200702.PmdataEntityBuilder.class);
+
+
} catch (Exception e) {
LOG.error("Can not start database client. Exception: {}", e);
throw new Exception("Can not start database client. Exception: {}", e);
@@ -251,7 +260,7 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
/**
* write internal equipment to database
- *
+ *
* @param internalEquipment with mandatory fields.
*/
@Override
@@ -276,7 +285,7 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
/**
* join base with parameters of toJoin (only non null values)
- *
+ *
* @param base base object
* @param toJoin object with new property values
* @return new joined object
@@ -335,7 +344,7 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
/**
* Update after new mountpoint registration
- *
+ *
* @param networkElementConnectionEntitiy data
* @param nodeId of device (mountpoint name)
*/
@@ -411,7 +420,7 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
/**
* Verify status of client
- *
+ *
* @param event that is printed with message
* @return true if client is null
*/
@@ -425,7 +434,7 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
/**
* Verify status of client
- *
+ *
* @param message to print including {} for object printout.
* @return true if client is null
*/
@@ -443,7 +452,7 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
private static class EsEventBase {
/**
* Query to get older Elements
- *
+ *
* @param netconfTimeStamp to identify older Elements
* @return QueryBuilder for older elements related to timestamp
*/
@@ -454,7 +463,7 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
private static class EsFaultLogDevicemanager {
/**
* Get older Elements
- *
+ *
* @param netconfTimeStamp to identify query elements older than this timestamp.
* @return QueryBuilder for related elements
*/
@@ -513,15 +522,51 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
});
}
+ @Override
+ public void doWritePerformanceData2(
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.v2.rev200702.PmdataEntity> list) {
+
+ list.forEach(elem -> {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.v2.rev200702.GranularityPeriodType
+ granularityPeriod = nnGetGranularityPeriodType2(elem.getGranularityPeriod());
+ //_id": "Sim12600/LP-MWPS-TTP-01/2017-07-04T15:15:00.0+00:00"
+ StringBuffer id = new StringBuffer();
+ DateAndTime date = elem.getTimeStamp();
+ id.append(elem.getNodeName());
+ id.append("/");
+ id.append(elem.getUuidInterface());
+ id.append("/");
+ id.append(date != null ? date.getValue() : "null");
+ switch (granularityPeriod) {
+ case Period15Min:
+ pmData15mDB.write(elem, id.toString());
+ break;
+ case Period24Hours:
+ pmData24hDB.write(elem, id.toString());
+ break;
+ case Unknown:
+ default:
+ LOG.debug("Unknown granularity {} id {}", granularityPeriod, id);
+ break;
+ }
+ });
+ }
@NonNull
GranularityPeriodType nnGetGranularityPeriodType(@Nullable GranularityPeriodType granularityPeriod) {
return granularityPeriod != null ? granularityPeriod : GranularityPeriodType.Unknown;
}
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.v2.rev200702.GranularityPeriodType nnGetGranularityPeriodType2(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.v2.rev200702.@Nullable GranularityPeriodType granularityPeriod) {
+ return granularityPeriod != null ? granularityPeriod :
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.v2.rev200702.GranularityPeriodType.Unknown;
+ }
@Override
public HtDatabaseClient getRawClient() {
return this.client;
}
+
+
}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/yangtools/YangToolsCloner.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/yangtools/YangToolsCloner.java
deleted file mode 100644
index a9a658387..000000000
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/yangtools/YangToolsCloner.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2019 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.yangtools;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.Nullable;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class YangToolsCloner {
-
- private static YangToolsMapper yangtoolsMapper = new YangToolsMapper();
- private static final Logger LOG = LoggerFactory.getLogger(YangToolsCloner.class);
- public static final int ACCESSOR_FIELD = 0;
- public static final int ACCESSOR_METHOD = 1;
-
-
- private final int accessor;
-
- private YangToolsCloner(int ac) {
- this.accessor = ac;
- }
-
- public static YangToolsCloner instance() {
- return instance(ACCESSOR_METHOD);
- }
-
- public static YangToolsCloner instance(int ac) {
- return new YangToolsCloner(ac);
- }
-
- /**
- *
- * @param source source object
- * @param clazz Class of return object
- * @return list of cloned object
- * @return
- */
- public <S extends DataObject, T extends DataObject> List<T> cloneList(List<S> source, Class<T> clazz) {
- return cloneList(source, clazz, null);
- }
-
- /**
- *
- * @param source source object
- * @param clazz Class of return object
- * @attrList filter for attribute Names to clone
- * @return list of cloned object
- */
- public <S extends DataObject, T extends DataObject> List<T> cloneList(List<S> source, Class<T> clazz,
- @Nullable List<String> attrList) {
- if (source == null) {
- return null;
- }
- List<T> list = new ArrayList<>();
- for (S s : source) {
- list.add(clone(s, clazz, attrList));
- }
- return list;
- }
-
- /**
- *
- * @param source source object
- * @param clazz Class of return object
- * @return cloned object
- */
- public <S, T extends DataObject> T clone(S source, Class<T> clazz) {
- return clone(source, clazz, null);
- }
-
- /**
- *
- * @param source source object
- * @param clazz Class of return object
- * @attrList if empty copy all else list of attribute Names to clone
- * @return cloned object
- */
- public <S, T extends DataObject> T clone(S source, Class<T> clazz, @Nullable List<String> attrList) {
- if (source == null) {
- return (T) null;
- }
- Field[] attributeFields;
- Field sourceField;
- Method m;
- Builder<T> builder = yangtoolsMapper.getBuilder(clazz);
- T object = builder.build();
- attributeFields = object.getClass().getDeclaredFields();
- for (Field attributeField : attributeFields) {
- // check if attr is in inclusion list
- if (attrList != null && !attrList.contains(attributeField.getName())) {
- continue;
- }
- // ignore QNAME
- if (attributeField.getName().equals("QNAME")) {
- continue;
- }
-
- attributeField.setAccessible(true);
- try {
- if (accessor == ACCESSOR_FIELD) {
- sourceField = source.getClass().getDeclaredField(attributeField.getName());
- sourceField.setAccessible(true);
- if (attributeField.getType().equals(String.class) && !sourceField.getType().equals(String.class)) {
- attributeField.set(object, String.valueOf(sourceField.get(source)));
- } else {
- attributeField.set(object, sourceField.get(source));
- }
- } else if (accessor == ACCESSOR_METHOD) {
- String getter = getter(attributeField.getName());
- System.out.println("getter=" + getter);
- m = source.getClass().getDeclaredMethod(getter);
- m.setAccessible(true);
- if (attributeField.getType().equals(String.class) && !m.getReturnType().equals(String.class)) {
- attributeField.set(object, String.valueOf(m.invoke(source)));
- } else {
- attributeField.set(object, m.invoke(source));
- }
- }
-
- } catch (NoSuchMethodException | NoSuchFieldException e) {
- // Convert to run-time exception
- String msg = "no such field " + attributeField.getName() + " in class " + source.getClass().getName();
- LOG.debug(msg);
- // throw new IllegalArgumentException(msg);
- } catch (IllegalAccessException | SecurityException e) {
- LOG.debug("Access problem " + attributeField.getName(), e);
- } catch (IllegalArgumentException e) {
- LOG.debug("argument problem " + attributeField.getName(), e);
- } catch (InvocationTargetException e) {
- LOG.debug("invocation problem " + attributeField.getName(), e);
- }
- }
-
- return object;
- }
-
- private static String getter(String name) {
- return String.format("%s%s%s", "get", name.substring(1, 2).toUpperCase(), name.substring(2));
- }
-
- public <S extends DataObject, T extends DataObject, B extends Builder<T>> B cloneToBuilder(S source, B builder) {
- return cloneToBuilder(source, builder, null);
- }
-
- public <S extends DataObject, T extends DataObject, B extends Builder<T>> B cloneToBuilder(S source, B builder,
- @Nullable List<String> attrList) {
- Field[] attributeFields;
- Field sourceField;
- Method m;
- attributeFields = builder.getClass().getDeclaredFields();
- for (Field attributeField : attributeFields) {
- // check if attr is in inclusion list
- if (attrList != null && !attrList.contains(attributeField.getName())) {
- continue;
- }
- // ignore QNAME
- if (attributeField.getName().equals("QNAME")) {
- continue;
- }
-
- attributeField.setAccessible(true);
- try {
- if (accessor == ACCESSOR_FIELD) {
- sourceField = source.getClass().getDeclaredField(attributeField.getName());
- sourceField.setAccessible(true);
- if (attributeField.getType().equals(String.class) && !sourceField.getType().equals(String.class)) {
- attributeField.set(builder, String.valueOf(sourceField.get(source)));
- } else {
- attributeField.set(builder, sourceField.get(source));
- }
- } else if (accessor == ACCESSOR_METHOD) {
- m = source.getClass().getDeclaredMethod(getter(attributeField.getName()));
- m.setAccessible(true);
- if (attributeField.getType().equals(String.class) && !m.getReturnType().equals(String.class)) {
- attributeField.set(builder, String.valueOf(m.invoke(source)));
- } else {
- attributeField.set(builder, m.invoke(source));
- }
- }
-
- } catch (NoSuchMethodException | NoSuchFieldException e) {
- // Convert to run-time exception
- String msg = "no such field " + attributeField.getName() + " in class " + source.getClass().getName();
- LOG.debug(msg);
- // throw new IllegalArgumentException(msg);
- } catch (IllegalAccessException | SecurityException e) {
- LOG.debug("Access problem " + attributeField.getName(), e);
- } catch (IllegalArgumentException e) {
- LOG.debug("argument problem " + attributeField.getName(), e);
- } catch (InvocationTargetException e) {
- LOG.debug("invocation problem " + attributeField.getName(), e);
- }
- }
- return builder;
- }
-}
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTree.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTree.java
index f2a7ff951..970816514 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTree.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTree.java
@@ -22,14 +22,18 @@
package org.onap.ccsdk.features.sdnr.wt.dataprovider.test;
import java.io.IOException;
+import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
+import org.apache.sshd.common.util.io.IoUtils;
+import org.json.JSONObject;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteByQueryRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.test.JSONAssert;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.ElasticSearchDataProvider;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeHttpServlet;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeHttpServlet.EntityWithTree;
@@ -54,23 +58,89 @@ public class TestTree {
dbProvider = new ElasticSearchDataProvider(hosts);
dbProvider.waitForYellowDatabaseStatus(30, TimeUnit.SECONDS);
dbRawProvider = HtDatabaseClient.getClient(hosts);
+ DeleteByQueryRequest query = new DeleteByQueryRequest(Entity.Inventoryequipment.getName(), true);
+ query.setQuery(QueryBuilders.matchAllQuery().toJSON());
+ dbRawProvider.deleteByQuery(query);
+ fillTestData();
+ }
+
+ private static void fillTestData() throws IOException {
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/a2.module-1.1.5.5", getFileContent("/testequipment/1.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/CARD-1.1.7.0", getFileContent("/testequipment/2.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/a2.module-1.55.1.2", getFileContent("/testequipment/3.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/a2.module-1.65.1.2", getFileContent("/testequipment/4.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/SHELF-1.1.0.0", getFileContent("/testequipment/5.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/a2.module-1.1.1.5", getFileContent("/testequipment/6.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/a2.module-1.1.1.8", getFileContent("/testequipment/7.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/a2.module-1.1.6.5", getFileContent("/testequipment/8.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/ODU-1.56.0.0", getFileContent("/testequipment/9.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/a2.module-1.56.1.2", getFileContent("/testequipment/10.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/IDU-1.65.0.0", getFileContent("/testequipment/11.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/CARD-1.65.1.4", getFileContent("/testequipment/12.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/CARD-1.1.6.0", getFileContent("/testequipment/13.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/CARD-1.1.8.0", getFileContent("/testequipment/14.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/CARD-1.1.9.0", getFileContent("/testequipment/15.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/CARD-1.55.1.4", getFileContent("/testequipment/16.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/a2.module-1.1.1.7", getFileContent("/testequipment/17.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/IDU-1.55.0.0", getFileContent("/testequipment/18.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/CARD-1.1.1.0", getFileContent("/testequipment/19.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/CARD-1.1.5.0", getFileContent("/testequipment/20.json"));
+ dbRawProvider.doWriteRaw(Entity.Inventoryequipment.getName(), "sim1/a2.module-1.1.5.6", getFileContent("/testequipment/21.json"));
+
+ }
+ /**
+ * @param string
+ * @return
+ * @throws URISyntaxException
+ * @throws IOException
+ */
+ private static String getFileContent(String filename) throws IOException {
+ return String.join("\n",IoUtils.readAllLines(TestTree.class.getResourceAsStream(filename)));
}
@Test
public void testInventoryTree() throws IOException {
DataTreeProviderImpl provider = new DataTreeProviderImpl();
provider.setDatabaseClient(dbRawProvider);
- DeleteByQueryRequest query = new DeleteByQueryRequest(Entity.Inventoryequipment.getName(), true);
- query.setQuery(QueryBuilders.matchAllQuery().toJSON());
- dbRawProvider.deleteByQuery(query);
+
DataTreeObject tree = provider.readInventoryTree(null, null, FilterMode.Lazy);
+ System.out.println(tree.toJSON());
+ JSONObject o = new JSONObject(tree.toJSON());
+ JSONAssert.assertContainsOnlyKey(o, "sim1");
+ JSONObject children = o.getJSONObject("sim1").getJSONObject("children");
+ this.assertSim1(children);
- tree = provider.readInventoryTree(Arrays.asList("sim1"), "CARD", FilterMode.Lazy);
+ tree = provider.readInventoryTree(Arrays.asList("sim1"), "*", FilterMode.Lazy);
+ this.assertSim1(new JSONObject(tree.toJSON()));
System.out.println(tree.toJSON());
}
+ private void assertSim1(JSONObject sim1Children) {
+ JSONAssert.assertContainsExactKeys(sim1Children,new String[] {"sim1/ODU-1.56.0.0", "sim1/IDU-1.55.0.0", "sim1/IDU-1.65.0.0", "sim1/SHELF-1.1.0.0"});
+ JSONObject c1 = sim1Children.getJSONObject("sim1/ODU-1.56.0.0");
+ JSONObject c2 = sim1Children.getJSONObject("sim1/IDU-1.55.0.0");
+ JSONObject c3 = sim1Children.getJSONObject("sim1/IDU-1.65.0.0");
+ JSONObject c4 = sim1Children.getJSONObject("sim1/SHELF-1.1.0.0");
+ JSONAssert.assertContainsExactKeys(c1.getJSONObject("children"),new String[] {"sim1/a2.module-1.56.1.2"});
+ JSONAssert.assertContainsExactKeys(c2.getJSONObject("children"),new String[] {"sim1/a2.module-1.55.1.2","sim1/CARD-1.55.1.4"});
+ JSONAssert.assertContainsExactKeys(c3.getJSONObject("children"),new String[] {"sim1/a2.module-1.65.1.2","sim1/CARD-1.65.1.4"});
+ JSONAssert.assertContainsExactKeys(c4.getJSONObject("children"),new String[] {"sim1/CARD-1.1.1.0",
+ "sim1/CARD-1.1.5.0", "sim1/CARD-1.1.7.0","sim1/CARD-1.1.6.0", "sim1/CARD-1.1.9.0","sim1/CARD-1.1.8.0"});
+ JSONObject c41 = c4.getJSONObject("children").getJSONObject("sim1/CARD-1.1.1.0");
+ JSONObject c42 = c4.getJSONObject("children").getJSONObject("sim1/CARD-1.1.5.0");
+ JSONObject c43 = c4.getJSONObject("children").getJSONObject("sim1/CARD-1.1.7.0");
+ JSONObject c44 = c4.getJSONObject("children").getJSONObject("sim1/CARD-1.1.6.0");
+ JSONObject c45 = c4.getJSONObject("children").getJSONObject("sim1/CARD-1.1.9.0");
+ JSONObject c46 = c4.getJSONObject("children").getJSONObject("sim1/CARD-1.1.8.0");
+ JSONAssert.assertContainsExactKeys(c41.getJSONObject("children"),new String[] {"sim1/a2.module-1.1.1.7","sim1/a2.module-1.1.1.5","sim1/a2.module-1.1.1.8"});
+ JSONAssert.assertContainsExactKeys(c42.getJSONObject("children"),new String[] {"sim1/a2.module-1.1.5.6","sim1/a2.module-1.1.5.5"});
+ JSONAssert.assertContainsNoKeys(c43.getJSONObject("children"));
+ JSONAssert.assertContainsExactKeys(c44.getJSONObject("children"),new String[] {"sim1/a2.module-1.1.6.5"});
+ JSONAssert.assertContainsNoKeys(c45.getJSONObject("children"));
+ JSONAssert.assertContainsNoKeys(c46.getJSONObject("children"));
+ }
@Test
public void testUriConversion() {
EntityWithTree e = DataTreeHttpServlet.getEntity("/tree/read-inventoryequipment-tree/sim1/sim1%2FODU");
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/HostInfoForTest.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/HostInfoForTest.java
index 8ea4b13aa..bd7e8ce5d 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/HostInfoForTest.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/HostInfoForTest.java
@@ -41,7 +41,7 @@ public class HostInfoForTest {
int port;
String portAsString = System.getProperty("databaseport");
- if (portAsString == null | portAsString.isEmpty())
+ if (portAsString == null || portAsString.isEmpty())
port = 49200;
else
port = Integer.valueOf(portAsString);
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/1.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/1.json
new file mode 100644
index 000000000..bcf5e1d0a
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/1.json
@@ -0,0 +1,17 @@
+ {
+ "description": "WS/p8.module/a2.module#5",
+ "date": "2013-04-13T00:00:00.0Z",
+ "version": "a2.module-newest",
+ "node-id": "sim1",
+ "uuid": "a2.module-1.1.5.5",
+ "parent-uuid": "CARD-1.1.5.0",
+ "contained-holder": [
+ "SUBRACK-1.55.0.0"
+ ],
+ "tree-level": 2,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "310330015",
+ "part-type-id": "3EM23141AD01",
+ "model-identifier": "CRPQABVFAA",
+ "type-name": "a2.module"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/10.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/10.json
new file mode 100644
index 000000000..6eed5d6a8
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/10.json
@@ -0,0 +1,15 @@
+ {
+ "description": "MWR#56Ch#1/a2.moduletraff",
+ "date": "2017-09-09T00:00:00.0Z",
+ "version": "a2.module-newest",
+ "node-id": "sim1",
+ "uuid": "a2.module-1.56.1.2",
+ "parent-uuid": "ODU-1.56.0.0",
+ "contained-holder": [],
+ "tree-level": 1,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "Serial1",
+ "part-type-id": "Partnumber",
+ "model-identifier": "model-id",
+ "type-name": "a2.module"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/11.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/11.json
new file mode 100644
index 000000000..46a4d0650
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/11.json
@@ -0,0 +1,18 @@
+ {
+ "description": "MWR-ng Dir#6.5-Ch#1",
+ "date": "2014-01-16T00:00:00.0Z",
+ "version": "MWR-ng",
+ "node-id": "sim1",
+ "uuid": "IDU-1.65.0.0",
+ "parent-uuid": "network-element",
+ "contained-holder": [
+ "PORT-1.65.1.4",
+ "PORT-1.65.1.2"
+ ],
+ "tree-level": 0,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "WAUZZI",
+ "part-type-id": "3DB76047BAAA02",
+ "model-identifier": "model-id-s3s",
+ "type-name": "MWR-ng"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/12.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/12.json
new file mode 100644
index 000000000..02d592e56
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/12.json
@@ -0,0 +1,15 @@
+ {
+ "description": "MWR#55Ch#0/RxDiv",
+ "date": "2014-01-08T00:00:00.0Z",
+ "version": "2017",
+ "node-id": "sim1",
+ "uuid": "CARD-1.65.1.4",
+ "parent-uuid": "IDU-1.65.0.0",
+ "contained-holder": [],
+ "tree-level": 1,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "Serie2017-13",
+ "part-type-id": "partNo2017-12",
+ "model-identifier": "model-id-s3s",
+ "type-name": "RxDiv"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/13.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/13.json
new file mode 100644
index 000000000..85c3723b7
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/13.json
@@ -0,0 +1,20 @@
+ {
+ "description": "WS/p8.module",
+ "date": "2013-11-23T00:00:00.0Z",
+ "version": "234",
+ "node-id": "sim1",
+ "uuid": "CARD-1.1.6.0",
+ "parent-uuid": "SHELF-1.1.0.0",
+ "contained-holder": [
+ "PORT-1.1.6.5",
+ "PORT-1.1.6.7",
+ "PORT-1.1.6.6",
+ "PORT-1.1.6.8"
+ ],
+ "tree-level": 1,
+ "manufacturer-identifier": "SAN",
+ "serial": "serial-number-124",
+ "part-type-id": "part-number-12",
+ "model-identifier": "model-id-12",
+ "type-name": "p8.module"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/14.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/14.json
new file mode 100644
index 000000000..1fa236e10
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/14.json
@@ -0,0 +1,15 @@
+{
+ "description": "WS/DS3",
+ "date": "2008-10-21T00:00:00.0Z",
+ "version": "unknown",
+ "node-id": "sim1",
+ "uuid": "CARD-1.1.8.0",
+ "parent-uuid": "SHELF-1.1.0.0",
+ "contained-holder": [],
+ "tree-level": 1,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "sd-dsa-eqw",
+ "part-type-id": "unknown",
+ "model-identifier": "model-id-s3s",
+ "type-name": "p4.module"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/15.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/15.json
new file mode 100644
index 000000000..ff40c4e8b
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/15.json
@@ -0,0 +1,15 @@
+{
+ "description": "WS/wind",
+ "date": "2007-02-19T00:00:00.0Z",
+ "version": "wind",
+ "node-id": "sim1",
+ "uuid": "CARD-1.1.9.0",
+ "parent-uuid": "SHELF-1.1.0.0",
+ "contained-holder": [],
+ "tree-level": 1,
+ "manufacturer-identifier": "CIT",
+ "serial": "proto-type",
+ "part-type-id": "party-yea",
+ "model-identifier": "model-id-s3s",
+ "type-name": "wind"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/16.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/16.json
new file mode 100644
index 000000000..fbd62e04d
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/16.json
@@ -0,0 +1,15 @@
+ {
+ "description": "MWR#55Ch#1/RxDiv",
+ "date": "2014-01-07T00:00:00.0Z",
+ "version": "2017",
+ "node-id": "sim1",
+ "uuid": "CARD-1.55.1.4",
+ "parent-uuid": "IDU-1.55.0.0",
+ "contained-holder": [],
+ "tree-level": 1,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "Serie2017-12",
+ "part-type-id": "partNo2017-12",
+ "model-identifier": "model-id-s3s",
+ "type-name": "RxDiv"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/17.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/17.json
new file mode 100644
index 000000000..1704468f3
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/17.json
@@ -0,0 +1,17 @@
+{
+ "description": "WS/CORE-MAIN/a2.module#7",
+ "date": "2009-01-19T00:00:00.0Z",
+ "version": "a2.module-newest",
+ "node-id": "sim1",
+ "uuid": "a2.module-1.1.1.7",
+ "parent-uuid": "CARD-1.1.1.0",
+ "contained-holder": [
+ "SUBRACK-1.17.0.0"
+ ],
+ "tree-level": 2,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "91T403003322",
+ "part-type-id": "1AB187280031",
+ "model-identifier": "mod2",
+ "type-name": "a2.module"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/18.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/18.json
new file mode 100644
index 000000000..eaec335b4
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/18.json
@@ -0,0 +1,18 @@
+ {
+ "description": "MWR-ng Dir#5.5-Ch#1",
+ "date": "2014-01-15T00:00:00.0Z",
+ "version": "MWR-ng",
+ "node-id": "sim1",
+ "uuid": "IDU-1.55.0.0",
+ "parent-uuid": "network-element",
+ "contained-holder": [
+ "PORT-1.55.1.2",
+ "PORT-1.55.1.4"
+ ],
+ "tree-level": 0,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "Serie2017-14",
+ "part-type-id": "3DB76047BAAA02",
+ "model-identifier": "model-id-s3s",
+ "type-name": "MWR-ng"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/19.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/19.json
new file mode 100644
index 000000000..9a7eb62a7
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/19.json
@@ -0,0 +1,20 @@
+ {
+ "description": "WS/CORE-MAIN",
+ "date": "2015-08-17T00:00:00.0Z",
+ "version": "123",
+ "node-id": "sim1",
+ "uuid": "CARD-1.1.1.0",
+ "parent-uuid": "SHELF-1.1.0.0",
+ "contained-holder": [
+ "PORT-1.1.1.6",
+ "PORT-1.1.1.5",
+ "PORT-1.1.1.8",
+ "PORT-1.1.1.7"
+ ],
+ "tree-level": 1,
+ "manufacturer-identifier": "SAN",
+ "serial": "asdf-asdasd-asd",
+ "part-type-id": "part-number-2",
+ "model-identifier": "model-id-2",
+ "type-name": "latest"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/2.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/2.json
new file mode 100644
index 000000000..ff352653a
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/2.json
@@ -0,0 +1,15 @@
+ {
+ "description": "WS/DS1",
+ "date": "2007-08-27T00:00:00.0Z",
+ "version": "p1.module",
+ "node-id": "sim1",
+ "uuid": "CARD-1.1.7.0",
+ "parent-uuid": "SHELF-1.1.0.0",
+ "contained-holder": [],
+ "tree-level": 1,
+ "manufacturer-identifier": "CIT",
+ "serial": "serial-number-s3s",
+ "part-type-id": "part-number-s3s",
+ "model-identifier": "model-id-s3s",
+ "type-name": "p1.module_A"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/20.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/20.json
new file mode 100644
index 000000000..179794027
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/20.json
@@ -0,0 +1,20 @@
+ {
+ "description": "WS/p8.module",
+ "date": "2013-10-21T00:00:00.0Z",
+ "version": "234",
+ "node-id": "sim1",
+ "uuid": "CARD-1.1.5.0",
+ "parent-uuid": "SHELF-1.1.0.0",
+ "contained-holder": [
+ "PORT-1.1.5.6",
+ "PORT-1.1.5.5",
+ "PORT-1.1.5.8",
+ "PORT-1.1.5.7"
+ ],
+ "tree-level": 1,
+ "manufacturer-identifier": "SAN",
+ "serial": "africa",
+ "part-type-id": "part-number-12",
+ "model-identifier": "model-id-12",
+ "type-name": "p8.module"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/21.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/21.json
new file mode 100644
index 000000000..c76d6715e
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/21.json
@@ -0,0 +1,17 @@
+{
+ "description": "WS/p8.module/a2.module#6",
+ "date": "",
+ "version": "",
+ "node-id": "sim1",
+ "uuid": "a2.module-1.1.5.6",
+ "parent-uuid": "CARD-1.1.5.0",
+ "contained-holder": [
+ "SUBRACK-1.56.0.0"
+ ],
+ "tree-level": 2,
+ "manufacturer-identifier": "",
+ "serial": "",
+ "part-type-id": "",
+ "model-identifier": "",
+ "type-name": "a2.module"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/3.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/3.json
new file mode 100644
index 000000000..1dc6dfce2
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/3.json
@@ -0,0 +1,15 @@
+{
+ "description": "MWR#55Ch#1/a2.moduletraff",
+ "date": "2013-04-13T00:00:00.0Z",
+ "version": "a2.module-newest",
+ "node-id": "sim1",
+ "uuid": "a2.module-1.55.1.2",
+ "parent-uuid": "IDU-1.55.0.0",
+ "contained-holder": [],
+ "tree-level": 1,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "310330015",
+ "part-type-id": "3EM23141AD01",
+ "model-identifier": "CRPQABVFAA",
+ "type-name": "a2.module"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/4.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/4.json
new file mode 100644
index 000000000..ab1132692
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/4.json
@@ -0,0 +1,15 @@
+ {
+ "description": "MWR#65Ch#1/a2.moduletraff",
+ "date": "2013-04-13T00:00:00.0Z",
+ "version": "a2.module-newest",
+ "node-id": "sim1",
+ "uuid": "a2.module-1.65.1.2",
+ "parent-uuid": "IDU-1.65.0.0",
+ "contained-holder": [],
+ "tree-level": 1,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "310330008",
+ "part-type-id": "3EM23141AD01",
+ "model-identifier": "CRPQABVFAA",
+ "type-name": "a2.module"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/5.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/5.json
new file mode 100644
index 000000000..e54173fe6
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/5.json
@@ -0,0 +1,25 @@
+{
+ "description": "WS-8",
+ "date": "2017-09-09T00:00:00.0Z",
+ "version": "a2.module-newest",
+ "node-id": "sim1",
+ "uuid": "SHELF-1.1.0.0",
+ "parent-uuid": "network-element",
+ "contained-holder": [
+ "SLOT-1.1.1.0",
+ "SLOT-1.1.2.0",
+ "SLOT-1.1.3.0",
+ "SLOT-1.1.4.0",
+ "SLOT-1.1.5.0",
+ "SLOT-1.1.6.0",
+ "SLOT-1.1.7.0",
+ "SLOT-1.1.8.0",
+ "SLOT-1.1.9.0"
+ ],
+ "tree-level": 0,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "Serial1",
+ "part-type-id": "Partnumber",
+ "model-identifier": "model-id",
+ "type-name": "WS-8"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/6.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/6.json
new file mode 100644
index 000000000..8486033b0
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/6.json
@@ -0,0 +1,17 @@
+ {
+ "description": "WS/CORE-MAIN/a2.module#5",
+ "date": "2005-11-09T00:00:00.0Z",
+ "version": "a2.module-newest",
+ "node-id": "sim1",
+ "uuid": "a2.module-1.1.1.5",
+ "parent-uuid": "CARD-1.1.1.0",
+ "contained-holder": [
+ "SUBRACK-1.15.0.0"
+ ],
+ "tree-level": 2,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "0003548168",
+ "part-type-id": "3FE25774AA01",
+ "model-identifier": "VAUIAEYAAA",
+ "type-name": "a2.module"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/7.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/7.json
new file mode 100644
index 000000000..5c583bec7
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/7.json
@@ -0,0 +1,17 @@
+{
+ "description": "WS/CORE-MAIN/a2.module#8",
+ "date": "2010-02-05T00:00:00.0Z",
+ "version": "a2.module-newest",
+ "node-id": "sim1",
+ "uuid": "a2.module-1.1.1.8",
+ "parent-uuid": "CARD-1.1.1.0",
+ "contained-holder": [
+ "SUBRACK-1.18.0.0"
+ ],
+ "tree-level": 2,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "01T441601301",
+ "part-type-id": "1AB376720002",
+ "model-identifier": "NGI7AMLMAA",
+ "type-name": "a2.module"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/8.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/8.json
new file mode 100644
index 000000000..a86819a7d
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/8.json
@@ -0,0 +1,17 @@
+{
+ "description": "WS/p8.module/a2.module#5",
+ "date": "2013-04-13T00:00:00.0Z",
+ "version": "a2.module-newest",
+ "node-id": "sim1",
+ "uuid": "a2.module-1.1.6.5",
+ "parent-uuid": "CARD-1.1.6.0",
+ "contained-holder": [
+ "SUBRACK-1.65.0.0"
+ ],
+ "tree-level": 2,
+ "manufacturer-identifier": "ONF-Wireless-Transport",
+ "serial": "310330008",
+ "part-type-id": "3EM23141AD01",
+ "model-identifier": "CRPQABVFAA",
+ "type-name": "a2.module"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/testequipment/9.json b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/9.json
new file mode 100644
index 000000000..914033bb4
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/resources/testequipment/9.json
@@ -0,0 +1,19 @@
+ {
+ "description": "MWR-hyper Dir#5.6-Ch#1",
+ "date": "",
+ "version": "extrem-hyper",
+ "node-id": "sim1",
+ "uuid": "ODU-1.56.0.0",
+ "parent-uuid": "network-element",
+ "contained-holder": [
+ "PORT-1.56.1.2",
+ "PORT-1.56.1.3",
+ "PORT-1.56.1.4"
+ ],
+ "tree-level": 0,
+ "manufacturer-identifier": "",
+ "serial": "",
+ "part-type-id": "",
+ "model-identifier": "",
+ "type-name": "MWR-hyper"
+} \ No newline at end of file
diff --git a/sdnr/wt/data-provider/model/src/main/yang/org-openroadm-pm-types@2020-03-27.yang b/sdnr/wt/devicemanager-openroadm/provider/src/main/yang/org-openroadm-pm-types@2019-11-29.yang
index 1fbd72e0f..78dd8934e 100644
--- a/sdnr/wt/data-provider/model/src/main/yang/org-openroadm-pm-types@2020-03-27.yang
+++ b/sdnr/wt/devicemanager-openroadm/provider/src/main/yang/org-openroadm-pm-types@2019-11-29.yang
@@ -35,10 +35,6 @@ module org-openroadm-pm-types {
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE";
- revision 2020-03-27 {
- description
- "Version 7.0.0";
- }
revision 2019-11-29 {
description
"Version 6.1.0";
@@ -643,31 +639,6 @@ module org-openroadm-pm-types {
description
"unavailable Seconds Count on TCM6 down direction.";
}
- enum fecCorrectedCodewords {
- value 120;
- description
- "FEC Corrected Codewords Counter";
- }
- enum fecUncorrectedCodewords {
- value 121;
- description
- "FEC Uncorrected Codewords Counter";
- }
- enum fecSymbolErrors {
- value 122;
- description
- "FEC Symbol Error Counter";
- }
- enum localFaultSeconds {
- value 123;
- description
- "Local Fault Seconds";
- }
- enum remoteFaultSeconds {
- value 124;
- description
- "Remote Fault Seconds";
- }
}
}
@@ -706,4 +677,4 @@ module org-openroadm-pm-types {
name not found in pm-names-enum";
}
}
-} \ No newline at end of file
+}