diff options
Diffstat (limited to 'sdnr/wt/data-provider/provider/src')
30 files changed, 646 insertions, 285 deletions
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/http/ReadyHttpServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/ReadyHttpServlet.java index e20f453a1..284365021 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/ReadyHttpServlet.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/ReadyHttpServlet.java @@ -22,28 +22,39 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.http; import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - +import org.apache.karaf.bundle.core.BundleInfo; +import org.apache.karaf.bundle.core.BundleService; +import org.apache.karaf.bundle.core.BundleState; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.about.MarkdownTable; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ReadyHttpServlet extends HttpServlet { /** - * + * */ private static final long serialVersionUID = 1L; private static final Logger LOG = LoggerFactory.getLogger(ReadyHttpServlet.class); private static boolean status; + + private BundleService bundleService = null; + + public void setBundleService(BundleService bundleService) { + this.bundleService = bundleService; + } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - if (isReady()) { + if (isReady() && this.getBundleStatesReady()) { resp.setStatus(HttpServletResponse.SC_OK); } else { @@ -63,4 +74,67 @@ public class ReadyHttpServlet extends HttpServlet { status = s; LOG.info("status is set to ready: {}", status); } + + private boolean getBundleStatesReady() { + Bundle thisbundle = FrameworkUtil.getBundle(this.getClass()); + BundleContext context = thisbundle ==null?null:thisbundle.getBundleContext(); + if (context == null) { + LOG.debug("no bundle context available"); + return true; + } + Bundle[] bundles = context.getBundles(); + if (bundles == null || bundles.length <= 0) { + LOG.debug("no bundles found"); + return true; + } + LOG.debug("found {} bundles", bundles.length); + MarkdownTable table = new MarkdownTable(); + table.setHeader(new String[] {"Bundle-Id","Version","Symbolic-Name","Status"}); + int cntNotActive=0; + + for (Bundle bundle : bundles) { + if(this.bundleService!=null) { + BundleInfo info = this.bundleService.getInfo(bundle); + if(info.getState()==BundleState.Active ) { + continue; + } + if(info.getState()==BundleState.Resolved ) { + if(!this.isBundleImportant(bundle.getSymbolicName())) { + LOG.trace("ignore not important bundle {} with state {}",bundle.getSymbolicName(),info.getState()); + continue; + } + } + + LOG.trace("bundle {} is in state {}",bundle.getSymbolicName(),info.getState()); + } + else { + LOG.warn("bundle service is null"); + } + cntNotActive++; + } + + return cntNotActive==0; + } + + private boolean isBundleImportant(String symbolicName) { + symbolicName = symbolicName.toLowerCase(); + if(symbolicName.contains("mdsal")) { + return true; + } + if(symbolicName.contains("netconf")) { + return true; + } + if(symbolicName.contains("ccsdk")) { + return true; + } + if(symbolicName.contains("devicemanager")) { + return true; + } + if(symbolicName.contains("restconf")) { + return true; + } + + return false; + } + } diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java index 9ac0cc0c3..81b9645fe 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java @@ -38,6 +38,9 @@ import javax.servlet.http.HttpServletResponse; import org.onap.ccsdk.features.sdnr.wt.common.Resources; import org.onap.ccsdk.features.sdnr.wt.common.file.PomFile; import org.onap.ccsdk.features.sdnr.wt.common.file.PomPropertiesFile; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -59,7 +62,6 @@ public class AboutHttpServlet extends HttpServlet { private static final String PLACEHOLDER_ONAP_RELEASEVERSION = "{release-version}"; private static final String PLACEHOLDER_ODL_RELEASENAME = "{odl-version}"; private static final String PLACEHOLDER_BUILD_TIMESTAMP = "{build-time}"; - private static final String PLACEHOLDER_ODLUX_REVISION = "{odlux-revision}"; private static final String PLACEHOLDER_PACKAGE_GITHASH = "{package-githash}"; private static final String PLACEHOLDER_PACAKGE_VERSION = "{package-version}"; private static final String PLACEHOLDER_CCSDK_VERSION = "{ccsdk-version}"; @@ -69,10 +71,12 @@ public class AboutHttpServlet extends HttpServlet { private static final String PLACEHOLDER_KARAF_INFO = "{karaf-info}"; private static final String PLACEHOLDER_DEVICEMANAGER_TABLE = "{devicemanagers}"; private static final String README_FILE = "README.md"; + private static final String NO_DEVICEMANAGERS_RUNNING_MESSAGE = null; private final String groupId = "org.onap.ccsdk.features.sdnr.wt"; private final String artifactId = "sdnr-wt-data-provider-provider"; + private final Map<Integer,String> BUNDLESTATE_LUT; private final Map<String, String> data; private final String readmeContent; // private BundleService bundleService; @@ -83,7 +87,13 @@ public class AboutHttpServlet extends HttpServlet { this.data = new HashMap<>(); this.collectStaticData(); this.readmeContent = this.render(this.getResourceFileContent(README_FILE)); - //BundleContext context = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); + this.BUNDLESTATE_LUT = new HashMap<>(); + this.BUNDLESTATE_LUT.put(Bundle.UNINSTALLED, "uninstalled"); + this.BUNDLESTATE_LUT.put(Bundle.INSTALLED, "installed"); + this.BUNDLESTATE_LUT.put(Bundle.RESOLVED, "resolved"); + this.BUNDLESTATE_LUT.put(Bundle.STARTING, "starting"); + this.BUNDLESTATE_LUT.put(Bundle.STOPPING, "stopping"); + this.BUNDLESTATE_LUT.put(Bundle.ACTIVE, "active"); } @@ -97,13 +107,14 @@ public class AboutHttpServlet extends HttpServlet { private void collectStaticData() { PomPropertiesFile props = this.getPomProperties(); final String ccsdkVersion = this.getPomParentVersion(); + final String mdsalVersion = SystemInfo.getMdSalVersion(UNKNOWN); this.data.put(PLACEHOLDER_ONAP_RELEASENAME, ODLVersionLUT.getONAPReleaseName(ccsdkVersion, UNKNOWN)); - this.data.put(PLACEHOLDER_ODL_RELEASENAME, ODLVersionLUT.getOdlVersion(ccsdkVersion, UNKNOWN)); + this.data.put(PLACEHOLDER_ODL_RELEASENAME, ODLVersionLUT.getOdlVersion(mdsalVersion, UNKNOWN)); this.data.put(PLACEHOLDER_BUILD_TIMESTAMP, props != null ? props.getBuildDate().toString() : ""); this.data.put(PLACEHOLDER_PACAKGE_VERSION, this.getManifestValue("Bundle-Version")); this.data.put(PLACEHOLDER_CCSDK_VERSION, ccsdkVersion); - this.data.put(PLACEHOLDER_ONAP_RELEASEVERSION, "2.0.0-SNAPSHOT"); - this.data.put(PLACEHOLDER_MDSAL_VERSION, SystemInfo.getMdSalVersion(UNKNOWN)); + this.data.put(PLACEHOLDER_ONAP_RELEASEVERSION, SystemInfo.getOnapVersion(UNKNOWN)); + this.data.put(PLACEHOLDER_MDSAL_VERSION, mdsalVersion); this.data.put(PLACEHOLDER_YANGTOOLS_VERSION, SystemInfo.getYangToolsVersion(UNKNOWN)); this.data.put(PLACEHOLDER_PACKAGE_GITHASH, this.getGitHash(UNKNOWN)); } @@ -272,25 +283,34 @@ public class AboutHttpServlet extends HttpServlet { } private String getDevicemanagerBundles() { - // if(this.bundleService==null) { - // LOG.debug("no bundle service available"); - // return ""; - // } - // - // List<String> ids = new ArrayList<String>(); - // List<Bundle> bundles = bundleService.selectBundles("0", ids , true); - // if(bundles==null || bundles.size()<=0) { - // LOG.debug("no bundles found"); - // return ""; - // } - // LOG.debug("found {} bundles",bundles.size()); - // MarkdownTable table = new MarkdownTable(); - // for(Bundle bundle:bundles) { - // BundleInfo info = this.bundleService.getInfo(bundle); - // table.addRow(new String[] {String.valueOf(info.getBundleId()),info.getVersion(),info.getName(),info.getState().toString()}); - // } - // return table.toMarkDown(); - return ""; + Bundle thisbundle = FrameworkUtil.getBundle(this.getClass()); + BundleContext context = thisbundle ==null?null:thisbundle.getBundleContext(); + if (context == null) { + LOG.debug("no bundle context available"); + return ""; + } + Bundle[] bundles = context.getBundles(); + if (bundles == null || bundles.length <= 0) { + LOG.debug("no bundles found"); + return NO_DEVICEMANAGERS_RUNNING_MESSAGE; + } + LOG.debug("found {} bundles", bundles.length); + MarkdownTable table = new MarkdownTable(); + table.setHeader(new String[] {"Bundle-Id","Version","Symbolic-Name","Status"}); + String name; + for (Bundle bundle : bundles) { + name = bundle.getSymbolicName(); + if(!(name.contains("devicemanager") && name.contains("provider"))) { + continue; + } + if(name.equals("org.onap.ccsdk.features.sdnr.wt.sdnr-wt-devicemanager-provider")) { + continue; + } + table.addRow(new String[] {String.valueOf(bundle.getBundleId()), bundle.getVersion().toString(), name, + BUNDLESTATE_LUT.getOrDefault(bundle.getState(),"unknown")}); + + } + return table.toMarkDown(); } /** 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 bd8fae6a0..991231f87 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 @@ -21,8 +21,13 @@ */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.http.about; +import java.util.HashMap; +import java.util.Map; + public class ODLVersionLUT { + private static Map<String,String> odlMdsalVersionLUT=null; + public static String getONAPReleaseName(String onapCCSDKVersion, String def) { if (onapCCSDKVersion == null) { return def; @@ -45,26 +50,26 @@ public class ODLVersionLUT { return def; } - public static String getOdlVersion(String onapCCSDKVersion, String def) { + public static String getOdlVersion(String mdsalVersion, String def) { - if (onapCCSDKVersion == null) { + if (mdsalVersion == null) { return def; } - if (onapCCSDKVersion.startsWith("2.")) { - return "sodium-SR3 (0.11.3)"; - } - if (onapCCSDKVersion.startsWith("1.5.")) { - return "neon-SR1 (0.10.1)"; - } - if (onapCCSDKVersion.startsWith("1.4.")) { - return "neon-SR1 (0.10.1)"; + if(odlMdsalVersionLUT==null) { + odlMdsalVersionLUT = new HashMap<>(); + odlMdsalVersionLUT.put("5.0.14","magnesium-SR2 (0.12.2)"); + odlMdsalVersionLUT.put("5.0.10","magnesium-SR1 (0.12.1)"); + odlMdsalVersionLUT.put("5.0.9","magnesium-SR0 (0.12.0)"); + odlMdsalVersionLUT.put("4.0.14","sodium-SR3 (0.11.3)"); + odlMdsalVersionLUT.put("4.0.11","sodium-SR2 (0.11.2)"); + odlMdsalVersionLUT.put("4.0.6","sodium-SR1 (0.11.1)"); + odlMdsalVersionLUT.put("4.0.4","sodium-SR0 (0.11.0)"); + odlMdsalVersionLUT.put("3.0.13","neon-SR3 (0.10.3)"); + odlMdsalVersionLUT.put("3.0.10","neon-SR2 (0.10.2)"); + odlMdsalVersionLUT.put("3.0.8","neon-SR1 (0.10.1)"); + odlMdsalVersionLUT.put("3.0.6","neon-SR0 (0.10.0)"); } - if (onapCCSDKVersion.startsWith("1.3.")) { - return "fluorine-SR2 (0.9.2)"; - } - if (onapCCSDKVersion.startsWith("1.2.")) { - return "sodium-SR3 (0.11.3)"; - } - return def; + + return odlMdsalVersionLUT.getOrDefault(mdsalVersion, def); } } diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/SystemInfo.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/SystemInfo.java index 1497362a6..134e3d37b 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/SystemInfo.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/SystemInfo.java @@ -42,7 +42,6 @@ import java.util.concurrent.Callable; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Stream; - import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; @@ -54,6 +53,10 @@ public class SystemInfo { private static OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean(); protected static boolean showMemoryPools = false; + public static String getOnapVersion(String def) { + return getOnapVersion("", def); + } + public static String getMdSalVersion(String def) { return getMdSalVersion("", def); } @@ -62,6 +65,10 @@ public class SystemInfo { return getYangToolsVersion("", def); } + public static String getOnapVersion(String baseOdlDirectory, String def) { + return getFeatureVersionByFolder(baseOdlDirectory, "system/org/onap/sdnc/northbound/sdnc-northbound-all/", def); + } + public static String getMdSalVersion(String baseOdlDirectory, String def) { return getFeatureVersionByFolder(baseOdlDirectory, "system/org/opendaylight/mdsal/mdsal-binding-api/", def); } 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/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml index ad9661f66..1be114612 100644 --- a/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml +++ b/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml @@ -29,11 +29,12 @@ <reference id="rpcProviderService" interface="org.opendaylight.mdsal.binding.api.RpcProviderService" odl:type="default"/> - -<!-- <reference id="bundleService" interface="org.apache.karaf.bundle.core.BundleService" odl:type="default"/> --> + <reference id="bundleService" + interface="org.apache.karaf.bundle.core.BundleService" /> <bean id="readyServlet" class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.ReadyHttpServlet"> + <property name="bundleService" ref="bundleService"/> </bean> <service interface="javax.servlet.http.HttpServlet" ref="readyServlet"> 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 |