diff options
71 files changed, 1376 insertions, 668 deletions
diff --git a/sdnr/wt/apigateway/feature/pom.xml b/sdnr/wt/apigateway/feature/pom.xml index 43ce83a99..b4ec29993 100644 --- a/sdnr/wt/apigateway/feature/pom.xml +++ b/sdnr/wt/apigateway/feature/pom.xml @@ -21,7 +21,9 @@ * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> @@ -34,7 +36,7 @@ <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> <dependencyManagement> diff --git a/sdnr/wt/apigateway/installer/pom.xml b/sdnr/wt/apigateway/installer/pom.xml index fb70b2076..b7cc5312b 100755 --- a/sdnr/wt/apigateway/installer/pom.xml +++ b/sdnr/wt/apigateway/installer/pom.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> @@ -12,7 +13,7 @@ <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> <properties> diff --git a/sdnr/wt/apigateway/pom.xml b/sdnr/wt/apigateway/pom.xml index 289fcc673..c4d7a3f06 100755 --- a/sdnr/wt/apigateway/pom.xml +++ b/sdnr/wt/apigateway/pom.xml @@ -21,7 +21,9 @@ * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> diff --git a/sdnr/wt/apigateway/provider/pom.xml b/sdnr/wt/apigateway/provider/pom.xml index 95c6c69d6..75c66cbc6 100644 --- a/sdnr/wt/apigateway/provider/pom.xml +++ b/sdnr/wt/apigateway/provider/pom.xml @@ -11,7 +11,9 @@ 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========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -27,7 +29,7 @@ <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> <dependencies> <dependency> diff --git a/sdnr/wt/devicemanager/feature/pom.xml b/sdnr/wt/devicemanager/feature/pom.xml index a5efb1f78..d99f071fe 100644 --- a/sdnr/wt/devicemanager/feature/pom.xml +++ b/sdnr/wt/devicemanager/feature/pom.xml @@ -21,7 +21,9 @@ * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> @@ -34,7 +36,7 @@ <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> <dependencyManagement> diff --git a/sdnr/wt/devicemanager/installer/pom.xml b/sdnr/wt/devicemanager/installer/pom.xml index c41cfa497..08464f538 100755 --- a/sdnr/wt/devicemanager/installer/pom.xml +++ b/sdnr/wt/devicemanager/installer/pom.xml @@ -21,14 +21,16 @@ * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> diff --git a/sdnr/wt/devicemanager/model/pom.xml b/sdnr/wt/devicemanager/model/pom.xml index 8b2c1488d..c2e59e623 100644 --- a/sdnr/wt/devicemanager/model/pom.xml +++ b/sdnr/wt/devicemanager/model/pom.xml @@ -21,7 +21,9 @@ * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> <artifactId>sdnr-wt-devicemanager-model</artifactId> @@ -33,7 +35,7 @@ <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> <properties> @@ -66,3 +68,4 @@ </plugins> </build> </project> + diff --git a/sdnr/wt/devicemanager/provider/pom.xml b/sdnr/wt/devicemanager/provider/pom.xml index 566001b03..f29859fb2 100644 --- a/sdnr/wt/devicemanager/provider/pom.xml +++ b/sdnr/wt/devicemanager/provider/pom.xml @@ -15,7 +15,9 @@ language governing permissions and limitations under the License. ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> @@ -28,7 +30,7 @@ <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath></relativePath> </parent> <properties> @@ -95,6 +97,11 @@ <artifactId>sal-netconf-connector</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>mdsal-singleton-common-api</artifactId> + <scope>provided</scope> + </dependency> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> @@ -367,6 +374,7 @@ org.opendaylight.controller.md.sal.binding.api;version="[1.6,2)", org.opendaylight.controller.md.sal.common.api.data;version="[1.6,2)", org.opendaylight.controller.sal.binding.api;version="[1.6,2)", + org.opendaylight.mdsal.singleton.common.api;version="[2.0,3)", org.opendaylight.yangtools.concepts;version="[2.0,3)", org.opendaylight.yangtools.yang.binding;version="[0.12,1)", org.opendaylight.yangtools.yang.common;version="[2.0,3)", @@ -486,3 +494,4 @@ </plugins> </build> </project> + diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanProvider.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanProvider.java new file mode 100644 index 000000000..44fae6d61 --- /dev/null +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanProvider.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * 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.devicemanager.archiveservice; + +import java.util.Date; + +public interface ArchiveCleanProvider { + + /** + * Remove all index data older, than specified + * @param olderAreOutdated time to specify older elements + * @return number of removed elements + */ + int doIndexClean(Date olderAreOutdated); + + /** + * Get number of elements older then + * @param olderAreOutdated date to compare with and specify older elements + * @return number of elements + */ + public int getNumberOfOldObjects(Date olderAreOutdated); + + +} diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java new file mode 100644 index 000000000..eb48b87c4 --- /dev/null +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java @@ -0,0 +1,155 @@ +/******************************************************************************* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * 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.devicemanager.archiveservice; + +import java.util.Date; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.IConfigChangedListener; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.EsConfig; +import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService; +import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; + +public class ArchiveCleanService implements AutoCloseable, IConfigChangedListener, Runnable,ClusterSingletonService { + + private static final Logger LOG = LoggerFactory.getLogger(ArchiveCleanService.class); + private static final ServiceGroupIdentifier IDENT = ServiceGroupIdentifier.create("ElasticSearchArchiveCleanService"); + + private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); + private final ArchiveCleanProvider[] indexCleanList; + private final HtDevicemanagerConfiguration htconfig; + private final Runnable doClean; + + private EsConfig config; + private Future<?> taskReference; + private boolean isMaster; + + public ArchiveCleanService(HtDevicemanagerConfiguration config, ArchiveCleanProvider... indexCleanList) { + this.config = config.getEs(); + this.htconfig = config; + this.htconfig.registerConfigChangedListener(this); + this.indexCleanList = indexCleanList; + this.doClean = this; + this.taskReference = null; + + this.reinit(); + } + + private void reinit() { + + if (taskReference != null) { + taskReference.cancel(false); + } + if(this.isMaster) { + if (this.config.getArchiveCheckIntervalSeconds() > 0) { + LOG.info("DBCleanService is turned on for entries older than {} seconds", + this.config.getArchiveLifetimeSeconds()); + taskReference = this.scheduler.scheduleAtFixedRate(doClean, 0, + this.config.getArchiveCheckIntervalSeconds(), TimeUnit.SECONDS); + } else { + LOG.info("DBCleanService is turned off"); + } + } + else { + LOG.info("service is inactive on this node. active on another node."); + } + } + + public Date getDateForOldElements() { + return new Date(System.currentTimeMillis() - config.getArchiveLifetimeSeconds() * 1000); + } + + public int countOldEntries() { + int cnt = 0; + Date olderAreOutdated = getDateForOldElements(); + for (ArchiveCleanProvider indexCleanElement : indexCleanList) { + if (indexCleanElement != null) { + indexCleanElement.getNumberOfOldObjects(olderAreOutdated); + } + } + return cnt; + } + + @Override + public void run() { + + try { + int removed = 0; + Date olderElementToBeRemoved = getDateForOldElements(); + LOG.trace("cleaning logs from entries older than {}", olderElementToBeRemoved); + + for (ArchiveCleanProvider indexCleanElement : indexCleanList) { + if (indexCleanElement != null) { + removed += indexCleanElement.doIndexClean(olderElementToBeRemoved); + } + } + if (removed > 0) { + LOG.trace("Removed elements: {}",removed); + } + } catch (Exception e) { + LOG.warn("problem executing dbclean", e); + } + } + + @Override + public void onConfigChanged() { + LOG.debug("config changed. reninit timer"); + ArchiveCleanService.this.config = EsConfig.reload(); + ArchiveCleanService.this.reinit(); + }; + + @Override + public void close() throws Exception { + this.htconfig.unregisterConfigChangedListener(this); + this.scheduler.shutdown(); + } + + @Override + public String toString() { + return "ArchivCleanService [ArchiveCheckIntervalSeconds=" + config.getArchiveCheckIntervalSeconds() + + "ArchiveLifetimeSeconds=" + config.getArchiveLifetimeSeconds() + "]"; + } + + @Override + public ServiceGroupIdentifier getIdentifier() { + return IDENT; + } + + @Override + public void instantiateServiceInstance() { + LOG.info("We take Leadership"); + this.isMaster=true; + this.reinit(); + } + + @Override + public ListenableFuture<? extends Object> closeServiceInstance() { + LOG.info("We lost Leadership"); + this.isMaster=false; + this.reinit(); + return Futures.immediateFuture(null); + } +} diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDataBaseReaderAndWriter.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDataBaseReaderAndWriter.java index f13b1066f..a742a94b0 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDataBaseReaderAndWriter.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDataBaseReaderAndWriter.java @@ -54,7 +54,12 @@ public class HtDataBaseReaderAndWriter<T extends IsEsObject> { this.mapper = new HtMapper<>( clazz ); } - + /** + * @return dataTypeName + */ + public String getDataTypeName() { + return this.dataTypeName; + } /** * Remove Object from database * @param object Object with content @@ -201,23 +206,33 @@ public class HtDataBaseReaderAndWriter<T extends IsEsObject> { } return res; } - - + /** + * Get all elements of related type + * @return all Elements + */ + public List<T> doReadAll() { + return doReadAll(null); + } /** * Read all existing objects of a type + * @param query for the elements * @return the list of all objects */ - public List<T> doReadAll() { + public List<T> doReadAll(QueryBuilder query) { List<T> res = new ArrayList<>(); int idx = 0; //Idx for getAll int iterateLength = 100; //Step width for iterate SearchHit hits[]; - - do { - hits = db.doReadAllJsonData(idx, iterateLength, dataTypeName); + if(query!=null) { + log.trace("read data in {} {} with query {}",db.getNetworkIndex(),dataTypeName,query); + hits=db.doReadByQueryJsonData(0, 99999, dataTypeName, query); + } + else { + hits = db.doReadAllJsonData(idx, iterateLength, dataTypeName); + } log.debug("Read: {} elements: {} Failures: {}",dataTypeName,hits.length, mapper.getMappingFailures()); T object; diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseWebAPIClient.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseWebAPIClient.java index 25930791a..ed09d34cd 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseWebAPIClient.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseWebAPIClient.java @@ -95,4 +95,8 @@ public class HtDatabaseWebAPIClient { return sresponse; } + + public void insertEntry(String index, String type, JSONObject data) throws IOException { + this.sendRequest(String.format("/%s/%s/", index,type), "POST", data); + } } diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/Resources.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/Resources.java index 330ff8df0..3a899f884 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/Resources.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/Resources.java @@ -255,7 +255,7 @@ public class Resources { } private static Enumeration<URL> getResourceFolderFiles(String folder) { - LOG.info("Get ressource: {}", folder); + LOG.debug("Get resource: {}", folder); URL url = getUrlForRessource(folder); String path = url.getPath(); File[] files = new File(path).listFiles(); diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementFactory.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementFactory.java index bda77f223..2ed02c18c 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementFactory.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementFactory.java @@ -18,7 +18,6 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf; import com.google.common.base.Optional; -import com.google.common.util.concurrent.CheckedFuture; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities; @@ -50,7 +49,6 @@ public class ONFCoreNetworkElementFactory { private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElementFactory.class); - @SuppressWarnings("deprecation") public static @Nonnull ONFCoreNetworkElementRepresentation create(String mountPointNodeName, DataBroker dataBroker, WebSocketServiceClient webSocketService, HtDatabaseEventsService databaseService, InstanceIdentifier<Node> instanceIdentifier, DataBroker mountpointDataBroker, ProviderClient dcaeProvider, @@ -59,7 +57,6 @@ public class ONFCoreNetworkElementFactory { ONFCoreNetworkElementRepresentation res = null; try (ReadOnlyTransaction tx = dataBroker.newReadOnlyTransaction();){ - CheckedFuture<Optional<Node>, ReadFailedException> checkedFuture = tx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier); Optional<Node> nodeOption = tx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier).checkedGet(); if (nodeOption.isPresent()) { Node node = nodeOption.get(); diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/NetconfTimeStamp.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/NetconfTimeStamp.java index a9e451a39..0dc6f0304 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/NetconfTimeStamp.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/NetconfTimeStamp.java @@ -101,10 +101,18 @@ public class NetconfTimeStamp { * @return String with Date in NETCONF/YANG Format Version 1.0. */ public String getTimeStampAsNetconfString() { - return getRightFormattedDate(new Date().getTime()); + return this.getRightFormattedDate(new Date().getTime()); } /** + * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format + + * @return String with Date in NETCONF/YANG Format Version 1.0. + */ + public String getTimeStampAsNetconfString(Date date) { + return getRightFormattedDate(date.getTime()); + } + /** * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format in GMT * * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. @@ -113,6 +121,15 @@ public class NetconfTimeStamp { return DateAndTime.getDefaultInstance(getTimeStampAsNetconfString()); } + /** + * Get time from date as NETCONF specific type NETCONF/YANG 1.0 Format in GMT + * @param date specifying the date and time + * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. + */ + public DateAndTime getTimeStamp(Date date) { + return DateAndTime.getDefaultInstance(getTimeStampAsNetconfString(date)); + } + /** * Return the String with a NETCONF time converted to long @@ -252,4 +269,6 @@ public class NetconfTimeStamp { } } + + } diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AkkaConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AkkaConfig.java index 55d5b9a11..eeccf601f 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AkkaConfig.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AkkaConfig.java @@ -59,6 +59,10 @@ public class AkkaConfig { return this.cluserConfig != null ? this.cluserConfig.isCluster() : false; } + public boolean isClusterAndFirstNode() { + return isSingleNode() || isCluster() && getClusterConfig().getRoleMemberIndex() == 1; + } + public static AkkaConfig load() throws Exception { return load(DEFAULT_FILENAME); } diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/EsConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/EsConfig.java index 958a0dfd3..bdfbf655d 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/EsConfig.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/EsConfig.java @@ -29,13 +29,29 @@ public class EsConfig extends BaseSubConfig { public static final String ESDATATYPENAME = "database"; private static final String EMPTY = "empty"; private static final String PROPERTY_KEY_CLUSTER = "esCluster"; + private static final String PROPERTY_KEY_ARCHIVE_INTERVAL = "esArchiveCheckIntervalSeconds"; + private static final String PROPERTY_KEY_ARCHIVE_LIMIT = "esArchiveLifetimeSeconds"; + private static final String DEFAULT_VALUE_CLUSTER = ""; + /** + * check db data in this interval [in seconds] + * 0 deactivated + */ + private static final long DEFAULT_ARCHIVE_INTERVAL_SEC = 0; + /** + * keep data for this time [in seconds] + * 30 days + */ + private static final long DEFAULT_ARCHIVE_LIMIT_SEC = 60 * 60 * 24 * 30; + private static EsConfig esConfig; private String cluster; private String host; private String node; private String index; + private long archiveCheckIntervalSeconds; + private long archiveLifetimeSeconds; private EsConfig() { super(); @@ -43,6 +59,8 @@ public class EsConfig extends BaseSubConfig { this.node = EMPTY; this.index = EMPTY; this.cluster = DEFAULT_VALUE_CLUSTER; + this.archiveCheckIntervalSeconds = DEFAULT_ARCHIVE_INTERVAL_SEC; + this.archiveLifetimeSeconds = DEFAULT_ARCHIVE_LIMIT_SEC; } public EsConfig cloneWithIndex(String _index) { @@ -51,6 +69,8 @@ public class EsConfig extends BaseSubConfig { c.host = this.host; c.node = this.node; c.cluster = this.cluster; + c.archiveCheckIntervalSeconds = this.archiveCheckIntervalSeconds; + c.archiveLifetimeSeconds = this.archiveLifetimeSeconds; return c; } @@ -90,6 +110,22 @@ public class EsConfig extends BaseSubConfig { this.index = index; } + public long getArchiveCheckIntervalSeconds() { + return this.archiveCheckIntervalSeconds; + } + + public void setArchiveCheckIntervalSeconds(long x) { + this.archiveCheckIntervalSeconds = x; + } + + public long getArchiveLifetimeSeconds() { + return this.archiveLifetimeSeconds; + } + + public void setArchiveLimit(long x) { + this.archiveLifetimeSeconds = x; + } + @Override public String toString() { return "EsConfig [cluster=" + cluster + ", host=" + host + ", node=" + node + ", index=" + index + "]"; @@ -112,9 +148,13 @@ public class EsConfig extends BaseSubConfig { this.cluster = c; this.node = String.format("%s%s", this.cluster, "n1"); this.host = "localhost"; + this.archiveCheckIntervalSeconds = this.getLong(PROPERTY_KEY_ARCHIVE_INTERVAL, DEFAULT_ARCHIVE_INTERVAL_SEC); + this.archiveLifetimeSeconds = this.getLong(PROPERTY_KEY_ARCHIVE_LIMIT, DEFAULT_ARCHIVE_LIMIT_SEC); if (save) { config.setProperty(SECTION_MARKER_ES + "." + PROPERTY_KEY_CLUSTER, this.cluster); + config.setProperty(SECTION_MARKER_ES + "." + PROPERTY_KEY_ARCHIVE_INTERVAL, this.archiveCheckIntervalSeconds); + config.setProperty(SECTION_MARKER_ES + "." + PROPERTY_KEY_ARCHIVE_LIMIT, this.archiveLifetimeSeconds); this.save(); } } @@ -170,15 +210,21 @@ public class EsConfig extends BaseSubConfig { } else if (!node.equals(other.node)) { return false; } + if (archiveCheckIntervalSeconds != other.archiveCheckIntervalSeconds) { + return false; + } + if (archiveLifetimeSeconds != other.archiveLifetimeSeconds) { + return false; + } return true; } @Override - public void save() - { + public void save() { this.getConfig().setProperty(SECTION_MARKER_ES + "." + PROPERTY_KEY_CLUSTER, this.cluster); super.save(); } + public static boolean isInstantiated() { return esConfig != null; } @@ -213,7 +259,7 @@ public class EsConfig extends BaseSubConfig { } public static void clear() { - esConfig=null; + esConfig = null; } } diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java index 0141b2663..89ee376da 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java @@ -6,9 +6,9 @@ * ================================================================================================= * 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 @@ -61,6 +61,7 @@ import org.slf4j.LoggerFactory; * @author herbert */ +@SuppressWarnings("deprecation") public class DeviceMonitorImpl implements AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(DeviceMonitorImpl.class); diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java index f0efe7aa4..97595ddac 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java @@ -24,6 +24,7 @@ import java.util.concurrent.ConcurrentHashMap; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl.AaiProviderClient; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice.ArchiveCleanService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseNode; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementFactory; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementRepresentation; @@ -71,6 +72,8 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; +import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration; @SuppressWarnings("deprecation") public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, ResyncNetworkElementsListener { @@ -92,6 +95,7 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R private RpcProviderRegistry rpcProviderRegistry = null; @SuppressWarnings("unused") private NotificationPublishService notificationPublishService = null; + private ClusterSingletonServiceProvider clusterSingletonServiceProvider; private final ConcurrentHashMap<String, ONFCoreNetworkElementRepresentation> networkElementRepresentations = new ConcurrentHashMap<>(); @@ -116,6 +120,9 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R private Thread threadDoClearCurrentFaultByNodename = null; private int refreshCounter = 0; private AkkaConfig akkaConfig; + private ArchiveCleanService archiveCleanService; + @SuppressWarnings("unused") + private ClusterSingletonServiceRegistration cssRegistration; // Blueprint 1 public DeviceManagerImpl() { @@ -137,7 +144,9 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R public void setMountPointService(MountPointService mountPointService) { this.mountPointService = mountPointService; } - + public void setClusterSingletonService(ClusterSingletonServiceProvider clusterSingletonService) { + this.clusterSingletonServiceProvider = clusterSingletonService; + } public void init() { LOG.info("Session Initiated start {}", APPLICATION_NAME); @@ -146,11 +155,11 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R this.rpcApiService = new DeviceManagerApiServiceImpl(rpcProviderRegistry); // Get configuration HtDevicemanagerConfiguration config = HtDevicemanagerConfiguration.getConfiguration(); - this.akkaConfig = null; try { this.akkaConfig = AkkaConfig.load(); LOG.debug("akka.conf loaded: " + akkaConfig.toString()); } catch (Exception e1) { + this.akkaConfig = null; LOG.warn("problem loading akka.conf: " + e1.getMessage()); } GeoConfig geoConfig = null; @@ -180,8 +189,7 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R LOG.error("Can only run with local database. Stop initialization of devicemanager."); } else { // init Database Values only if singleNode or clusterMember=1 - if (akkaConfig == null || akkaConfig.isSingleNode() || akkaConfig != null && akkaConfig.isCluster() - && akkaConfig.getClusterConfig().getRoleMemberIndex() == 1) { + if (akkaConfig == null || akkaConfig.isClusterAndFirstNode()) { // Create DB index if not existing and if database is running try { this.configService = new IndexConfigService(htDatabase); @@ -192,6 +200,7 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R } // start service for device maintenance service this.maintenanceService = new MaintenanceServiceImpl(htDatabase); + // Websockets try { this.webSocketService = new WebSocketServiceClientImpl2(rpcProviderRegistry); @@ -210,14 +219,17 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R LOG.warn("No configuration available. Don't start event manager"); } else { this.databaseClientEvents = new HtDatabaseEventsService(htDatabase); + //Make sure to start for one cluster node only + if (akkaConfig == null || akkaConfig.isClusterAndFirstNode() || akkaConfig.isSingleNode()) { + } String myDbKeyNameExtended = MYDBKEYNAMEBASE + "-" + dbConfig.getCluster(); - this.odlEventListener = new ODLEventListener(myDbKeyNameExtended, webSocketService, databaseClientEvents, dcaeProviderClient, aotsMProvider, maintenanceService); } - + this.archiveCleanService = new ArchiveCleanService(config, databaseClientEvents, mwtnService); + this.cssRegistration = this.clusterSingletonServiceProvider.registerClusterSingletonService(this.archiveCleanService); // PM PmConfig configurationPM = config.getPm(); LOG.info("Performance manager configuration: {}", configurationPM); @@ -275,7 +287,7 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R close(maintenanceService); close(rpcApiService); close(notificationDelayService); - + close(archiveCleanService); LOG.info("DeviceManagerImpl closing done"); } @@ -300,8 +312,11 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R /** * For each mounted device a mountpoint is created and this listener is called. + * Mountpoint was created or existing. Managed device is now fully connected to node/mountpoint. + * @param action provide action + * @param nNodeId id of the mountpoint + * @param nNode mountpoint contents */ - @Override public void startListenerOnNodeForConnectedState(Action action, NodeId nNodeId, NetconfNode nNode) { String mountPointNodeName = nNodeId.getValue(); @@ -384,7 +399,8 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R ne.initSynchronizationExtension(); // Setup Service that monitors registration/ deregistration of session - odlEventListener.registration(mountPointNodeName); + ConnectionStatus csts = nNode.getConnectionStatus(); + sendCreateOrUpdateNotification(mountPointNodeName, action, csts); if (aaiProviderClient != null) { aaiProviderClient.onDeviceRegistered(mountPointNodeName); @@ -399,52 +415,121 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R LOG.info("Starting Event listener on Netconf device :: Name : {} finished", mountPointNodeName); } - @Override - public void enterNonConnectedState(NodeId nNodeId, NetconfNode nNode) { + /** + * Mountpoint created or existing. Managed device is actually disconnected from node/ mountpoint. + * Origin state: Connecting, Connected + * Target state: are UnableToConnect or Connecting + * @param action create or update + * @param nNodeId id of the mountpoint + * @param nNode mountpoint contents + */ + public void enterNonConnectedState(Action action, NodeId nNodeId, NetconfNode nNode) { + String mountPointNodeName = nNodeId.getValue(); + ConnectionStatus csts = nNode.getConnectionStatus(); + + sendCreateOrUpdateNotification(mountPointNodeName, action, csts); + + // Handling if mountpoint exist. connected -> connecting/UnableToConnect + stopListenerOnNodeForConnectedState(mountPointNodeName); + + if (deviceMonitor != null) { + deviceMonitor.deviceDisconnectIndication(mountPointNodeName); + } + + } + + /** + * Mountpoint removed indication. + * @param nNodeId id of the mountpoint + */ + public void removeMountpointState(NodeId nNodeId) { String mountPointNodeName = nNodeId.getValue(); - LOG.info("enter Non ConnectedState for device :: Name : {}", mountPointNodeName); + LOG.info("mountpointNodeRemoved {}", nNodeId.getValue()); + stopListenerOnNodeForConnectedState(mountPointNodeName); + deviceMonitor.removeMountpointIndication(mountPointNodeName); + if (odlEventListener != null) { + odlEventListener.deRegistration(mountPointNodeName); + } + } + + /** + * Do all tasks necessary to move from mountpoint state connected -> connecting + * @param mountPointNodeName provided + * @param ne representing the device connected to mountpoint + */ + private void stopListenerOnNodeForConnectedState( String mountPointNodeName) { ONFCoreNetworkElementRepresentation ne = networkElementRepresentations.remove(mountPointNodeName); if (ne != null) { - // Handling transition mountpoint connected -> connecting this.maintenanceService.deleteIfNotRequired(mountPointNodeName); int problems = ne.removeAllCurrentProblemsOfNode(); LOG.debug("Removed all {} problems from database at deregistration for {}", problems, mountPointNodeName); - if (odlEventListener != null) { - odlEventListener.deRegistration(mountPointNodeName); - } if (performanceManager != null) { performanceManager.deRegistration(mountPointNodeName); } if (aaiProviderClient != null) { aaiProviderClient.onDeviceUnregistered(mountPointNodeName); } - } else { - // Handling -> create not connected mountpoint, or change other beside connected. - ConnectionStatus csts = nNode.getConnectionStatus(); - if (csts != null) { - odlEventListener.updateRegistration(mountPointNodeName, csts.getClass().getSimpleName(), csts.getName()); - } else { - LOG.info("Unknown connection status"); - } - } - if (deviceMonitor != null) { - deviceMonitor.deviceDisconnectIndication(mountPointNodeName); } + } + private void sendCreateOrUpdateNotification(String mountPointNodeName, Action action, ConnectionStatus csts) { + LOG.info("enter Non ConnectedState for device :: Name : {} Action {} ConnectionStatus {}", mountPointNodeName, action, csts); + if (action == Action.CREATE) { + odlEventListener.registration(mountPointNodeName); + } else { + odlEventListener.updateRegistration(mountPointNodeName, ConnectionStatus.class.getSimpleName(), csts != null ? csts.getName() : "null"); + } } + /** + * Handle netconf/mountpoint changes + */ @Override - public void removeMountpointState(NodeId nNodeId) { - String mountPointNodeName = nNodeId.getValue(); - LOG.info("mountpointNodeRemoved {}", nNodeId.getValue()); - deviceMonitor.removeMountpointIndication(mountPointNodeName); + public void netconfChangeHandler(Action action, @Nullable ConnectionStatus csts, NodeId nodeId, NetconfNode nnode) { + switch (action) { + case REMOVE: + removeMountpointState(nodeId); // Stop Monitor + //deviceManagerService.enterNonConnectedState(nodeId, nnode); // Remove Mountpoint handler + break; + + case UPDATE: + case CREATE: + if (csts != null) { + switch (csts) { + case Connected: { + startListenerOnNodeForConnectedState(action, nodeId, nnode); + break; + } + case UnableToConnect: + case Connecting: { + enterNonConnectedState(action, nodeId, nnode); + break; + } + } + } else { + LOG.debug("NETCONF Node handled with null status for action", action); + } + break; + } } /*------------------------------------------------------------------------------------------- * Functions */ + public ArchiveCleanService getArchiveCleanService() { + return this.archiveCleanService; + } + + public HtDatabaseEventsService getDatabaseClientEvents() { + return databaseClientEvents; + } + + public IndexMwtnService getMwtnService() { + return mwtnService; + } + /** * Async RPC Interface implementation */ diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerService.java index 13fbc644e..ce34401d8 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerService.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerService.java @@ -16,8 +16,9 @@ * ============LICENSE_END========================================================================== ******************************************************************************/ package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl; -import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; +import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; public interface DeviceManagerService { @@ -28,23 +29,11 @@ public interface DeviceManagerService { UPDATE } /** - * Mountpoint was created or existing. Managed device is now fully connected to node/mountpoint. - * @param action provide action - * @param nNodeId id of the mountpoint - * @param nNode mountpoint contents + * MountpointChangeHandler, called to indicate change to DeviceManager + * @param action provided + * @param csts provided + * @param nodeId provided + * @param nnode provided */ - void startListenerOnNodeForConnectedState(@Nonnull Action action, @Nonnull NodeId nNodeId, @Nonnull NetconfNode nNode); - - /** - * Mountpoint created or existing. Managed device is actually disconnected from node/ mountpoint. - * @param nNodeId id of the mountpoint - * @param nNode mountpoint contents - */ - void enterNonConnectedState(@Nonnull NodeId nNodeId, @Nonnull NetconfNode nNode); - - /** - * Mountpoint removed indication. - * @param nNodeId id of the mountpoint - */ - void removeMountpointState(@Nonnull NodeId nNodeId); + void netconfChangeHandler(Action action, @Nullable ConnectionStatus csts, NodeId nodeId, NetconfNode nnode); } diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/service/HtDatabaseEventsService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/service/HtDatabaseEventsService.java index 90b07999c..0a38e0f60 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/service/HtDatabaseEventsService.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/service/HtDatabaseEventsService.java @@ -18,23 +18,24 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service; import java.util.ArrayList; +import java.util.Date; import java.util.List; import javax.annotation.Nonnull; +import org.elasticsearch.index.query.QueryBuilder; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice.ArchiveCleanProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDataBaseReaderAndWriter; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseClientAbstract; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseNode; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.IndexClientBuilder; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElement12Equipment; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.EsEventBase; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.EsFaultCurrent; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.EsFaultLog; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.equipment.EsEquipment; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.equipment.EsToplevelEquipment; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.equipment.ExtendedEquipment; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.MwtNotificationBase; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,9 +45,11 @@ import org.slf4j.LoggerFactory; * * @author herbert */ -public class HtDatabaseEventsService { +public class HtDatabaseEventsService implements ArchiveCleanProvider { private static final Logger LOG = LoggerFactory.getLogger(HtDatabaseEventsService.class); + private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter(); + ///** Filename in the resources with maven initialized version information */ //private static final String RESOURCENAME = "version.properties"; // could also be a constant ///** Index name to be used */ @@ -88,19 +91,7 @@ public class HtDatabaseEventsService { // --- Function - public void writeEventLog(ObjectCreationNotificationXml event) { - writeEventGeneric(event); - } - - public void writeEventLog(ObjectDeletionNotificationXml event) { - writeEventGeneric(event); - } - - public void writeEventLog(AttributeValueChangedNotificationXml event) { - writeEventGeneric(event); - } - - private void writeEventGeneric(MwtNotificationBase event) { + public void writeEventLog(MwtNotificationBase event) { if (client == null) { LOG.debug("No DB, can not write: {}",event.toString()); return; @@ -224,5 +215,33 @@ public class HtDatabaseEventsService { } } + @Override + public int doIndexClean(Date olderAreOutdated) { + + String netconfTimeStamp = NETCONFTIME_CONVERTER.getTimeStampAsNetconfString(olderAreOutdated); + int removed = 0; + + QueryBuilder queryEventBase = EsEventBase.getQueryForTimeStamp(netconfTimeStamp); + removed += eventRWEventLog.doRemoveByQuery(queryEventBase); + + QueryBuilder queryFaultLog = EsFaultLog.getQueryForTimeStamp(netconfTimeStamp); + removed += eventRWFaultLog.doRemoveByQuery(queryFaultLog); + return removed; + } + + @Override + public int getNumberOfOldObjects(Date olderAreOutdated) { + + String netconfTimeStamp = NETCONFTIME_CONVERTER.getTimeStampAsNetconfString(olderAreOutdated); + int numberOfElements = 0; + + QueryBuilder queryEventBase = EsEventBase.getQueryForTimeStamp(netconfTimeStamp); + numberOfElements += eventRWEventLog.doReadAll(queryEventBase).size(); + + QueryBuilder queryFaultLog = EsFaultLog.getQueryForTimeStamp(netconfTimeStamp); + numberOfElements += eventRWFaultLog.doReadAll(queryFaultLog).size(); + + return numberOfElements; + } } diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsEventBase.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsEventBase.java index bcd2849d2..568e01f88 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsEventBase.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsEventBase.java @@ -17,6 +17,8 @@ ******************************************************************************/ package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types; +import org.elasticsearch.index.query.QueryBuilder; +import org.elasticsearch.index.query.RangeQueryBuilder; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.MwtNotificationBase; @@ -30,6 +32,9 @@ public class EsEventBase extends EsObject { public static final String ESDATATYPENAME = "eventlog"; + private static final String EVENTLOG_FIELD_TIMESTAMP = "event.timeStamp"; + + private MwtNotificationBase event; public MwtNotificationBase getProblem() { @@ -40,4 +45,13 @@ public class EsEventBase extends EsObject { this.event = event; } + /** + * Query to get older Elements + * @param netconfTimeStamp to identify older Elements + * @return QueryBuilder for older elements related to timestamp + */ + public static QueryBuilder getQueryForTimeStamp(String netconfTimeStamp) { + return new RangeQueryBuilder(EVENTLOG_FIELD_TIMESTAMP).lt(netconfTimeStamp); + } + } diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsFaultLog.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsFaultLog.java index 06a893ad7..e15aba5b2 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsFaultLog.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsFaultLog.java @@ -17,6 +17,8 @@ ******************************************************************************/ package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types; +import org.elasticsearch.index.query.QueryBuilder; +import org.elasticsearch.index.query.RangeQueryBuilder; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; @@ -30,6 +32,8 @@ public class EsFaultLog extends EsObject { public static final String ESDATATYPENAME = "faultlog"; + private static final String FAULTLOG_FIELD_TIMESTAMP = "fault.timeStamp"; + private ProblemNotificationXml fault; public ProblemNotificationXml getProblem() { @@ -40,4 +44,13 @@ public class EsFaultLog extends EsObject { this.fault = fault; } + /** + * Get older Elements + * @param netconfTimeStamp to identify query elements older than this timestamp. + * @return QueryBuilder for related elements + */ + public static QueryBuilder getQueryForTimeStamp(String netconfTimeStamp) { + return new RangeQueryBuilder(FAULTLOG_FIELD_TIMESTAMP).lt(netconfTimeStamp); + } + } diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java index fc5607557..a521bb94c 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java @@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory; // 07.09.18 Switched to DataTreeChangeListener from ClusteredDataTreeChangeListener -> DM Service is // running at all nodes // This is not correct +@SuppressWarnings("deprecation") public class NetconfChangeListener implements ClusteredDataTreeChangeListener<Node>, AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(NetconfChangeListener.class); @@ -156,33 +157,8 @@ public class NetconfChangeListener implements ClusteredDataTreeChangeListener<No if (nodeIdString.equals(CONTROLLER)) { LOG.debug("Stop processing for [{}]", nodeIdString); } else { - // Action related to mountpoint status - switch (action) { - case REMOVE: - deviceManagerService.removeMountpointState(nodeId); // Stop Monitor - deviceManagerService.enterNonConnectedState(nodeId, nnode); // Remove Mountpoint handler - break; - - case UPDATE: - case CREATE: - if (csts != null) { - switch (csts) { - case Connected: { - deviceManagerService.startListenerOnNodeForConnectedState(action, nodeId, - nnode); - break; - } - case UnableToConnect: - case Connecting: { - deviceManagerService.enterNonConnectedState(nodeId, nnode); - break; - } - } - } else { - LOG.debug("NETCONF Node handled with null status for action", action); - } - break; - } + // Action forwarded to devicehandler + deviceManagerService.netconfChangeHandler(action, csts, nodeId, nnode); } } } catch (NullPointerException e) { diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/ODLEventListener.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/ODLEventListener.java index ecaf06b55..4b87b5828 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/ODLEventListener.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/ODLEventListener.java @@ -47,17 +47,18 @@ import org.slf4j.LoggerFactory; public class ODLEventListener { private static final Logger LOG = LoggerFactory.getLogger(ODLEventListener.class); - private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter(); + private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter(); private final String ownKeyName; - private final WebSocketServiceClient webSocketService; private final HtDatabaseEventsService databaseService; private final ProviderClient dcaeProvider; private final ProviderClient aotsMProvider; - private int eventNumber; private final MaintenanceService maintenanceService; + + private int eventNumber; + /*--------------------------------------------------------------- * Construct */ diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java index 6ca7a5c18..c8f769677 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java @@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory; * Wrapper for forwarding web-socket notifications to the web-socket service, that is running as * bundle. */ +@SuppressWarnings("deprecation") public class WebSocketServiceClientImpl2 implements WebSocketServiceClient { private static final Logger LOG = LoggerFactory.getLogger(ODLEventListener.class); diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/database/types/EsEventOdluxLog.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/database/types/EsEventOdluxLog.java new file mode 100644 index 000000000..14f7d2447 --- /dev/null +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/database/types/EsEventOdluxLog.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * 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.devicemanager.index.database.types; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.elasticsearch.index.query.QueryBuilder; +import org.elasticsearch.index.query.RangeQueryBuilder; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime; + +/** + * Event log, used by Odlux client. + * Not used for writing any data by devicemanager. + * Type introduced to implement IndexCleanService + */ + +public class EsEventOdluxLog extends EsObject { + + public static final String ESDATATYPENAME = "log"; + + private static final String LOG_FIELD_TIMESTAMP = "timestamp"; + + private String type; + private String component; + private String message; + private String timestamp; + + /** + * For jackson + */ + protected EsEventOdluxLog() { + } + /** + * Constructor + * @param type string + * @param component string + * @param message string + * @param timestamp string with netconf format string + */ + public EsEventOdluxLog(String type, String component, String message, InternalDateAndTime timestamp) { + super(); + this.type = type; + this.component = component; + this.message = message; + this.timestamp = timestamp.getValue(); + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("component") + public String getComponent() { + return component; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + @JsonProperty(LOG_FIELD_TIMESTAMP) + public String getTimestamp() { + return timestamp; + } + + /** + * Query to get older Elements + * @param netconfTimeStamp to identify older Elements + * @return QueryBuilder for older elements related to timestamp + */ + public static QueryBuilder getQueryForTimeStamp(String netconfTimeStamp) { + return new RangeQueryBuilder(LOG_FIELD_TIMESTAMP).lt(netconfTimeStamp); + } + + } diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/impl/IndexMwtnService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/impl/IndexMwtnService.java index e175515ae..0e6b03291 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/impl/IndexMwtnService.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/impl/IndexMwtnService.java @@ -17,9 +17,15 @@ ******************************************************************************/ package org.onap.ccsdk.features.sdnr.wt.devicemanager.index.impl; +import java.util.Date; +import org.elasticsearch.index.query.QueryBuilder; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice.ArchiveCleanProvider; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDataBaseReaderAndWriter; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseClientAbstract; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseNode; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.IndexClientBuilder; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.index.database.types.EsEventOdluxLog; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,9 +34,10 @@ import org.slf4j.LoggerFactory; * @author herbert * */ -public class IndexMwtnService implements AutoCloseable { +public class IndexMwtnService implements AutoCloseable, ArchiveCleanProvider { private static final Logger LOG = LoggerFactory.getLogger(IndexMwtnService.class); + private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter(); /** Index name to be used */ public static final String INDEX = "mwtn"; @@ -39,6 +46,9 @@ public class IndexMwtnService implements AutoCloseable { /** Location of configuration data **/ private static final String MODELDATA = "elasticsearch/index/mwtn/modelDescription"; + private final HtDataBaseReaderAndWriter<EsEventOdluxLog> eventRWOdluxLog; + + private final HtDatabaseClientAbstract client; // --- Construct and initialize @@ -46,11 +56,15 @@ public class IndexMwtnService implements AutoCloseable { public IndexMwtnService(HtDatabaseNode database) throws Exception { LOG.info("Create {} start", this.getClass().getSimpleName()); + IndexClientBuilder clientBuilder = IndexClientBuilder.getBuilder(INDEX) .setMappingSettingJsonFileName(MAPPING) .setModelDataDirectory(MODELDATA); client = clientBuilder.create(database); clientBuilder.close(); + + eventRWOdluxLog = new HtDataBaseReaderAndWriter<>(client, EsEventOdluxLog.ESDATATYPENAME, EsEventOdluxLog.class); + LOG.info("Create {} finished. DB Service sucessfully started.", this.getClass().getSimpleName()); } @@ -62,10 +76,42 @@ public class IndexMwtnService implements AutoCloseable { return client; } + /** + * Write into Odlux log, used by client + * @param logEntry as test data + */ + public void writeOdluxEventForTestpurpose(EsEventOdluxLog logEntry) { + eventRWOdluxLog.doWrite(logEntry); + } @Override public void close() throws Exception { - client.close(); + if (client != null) { + client.close(); + } + } + + @Override + public int doIndexClean(Date olderAreOutdated) { + + String netconfTimeStamp = NETCONFTIME_CONVERTER.getTimeStampAsNetconfString(olderAreOutdated); + + QueryBuilder queryOdluxLog = EsEventOdluxLog.getQueryForTimeStamp(netconfTimeStamp); + int removed = eventRWOdluxLog.doRemoveByQuery(queryOdluxLog); + return removed; + + } + + @Override + public int getNumberOfOldObjects(Date olderAreOutdated) { + + String netconfTimeStamp = NETCONFTIME_CONVERTER.getTimeStampAsNetconfString(olderAreOutdated); + int numberOfElements = 0; + + QueryBuilder queryOdluxLog = EsEventOdluxLog.getQueryForTimeStamp(netconfTimeStamp); + numberOfElements += eventRWOdluxLog.doReadAll(queryOdluxLog).size(); + + return numberOfElements; } } diff --git a/sdnr/wt/devicemanager/provider/src/main/resources/elasticsearch/index/mwtn/modelDescription/maintenancemode.json b/sdnr/wt/devicemanager/provider/src/main/resources/elasticsearch/index/mwtn/modelDescription/maintenancemode.json index 3d0a41424..9e26dfeeb 100644 --- a/sdnr/wt/devicemanager/provider/src/main/resources/elasticsearch/index/mwtn/modelDescription/maintenancemode.json +++ b/sdnr/wt/devicemanager/provider/src/main/resources/elasticsearch/index/mwtn/modelDescription/maintenancemode.json @@ -1,22 +1 @@ -{ - "maintenancemode": { - "DragonWave-Z3":{ - "node":"DragonWave-Z3", - "filter": [{ - "definition":{}, - "description":"", - "start":"2018-01-01T10:00+00:00", - "end":"2018-10-10T10:00+00:00" - }] - }, - "MaintenanceMode":{ - "node":"MaintenanceMode", - "filter": [{ - "definition":{}, - "description":"", - "start":"2018-01-01T10:00+00:00", - "end":"2018-10-10T10:00+00:00" - }] - } - } -}
\ No newline at end of file +{}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/devicemanager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml index a9a4e18ec..b946e1035 100644 --- a/sdnr/wt/devicemanager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml +++ b/sdnr/wt/devicemanager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml @@ -36,13 +36,16 @@ limitations under the License. <reference id="rpcProviderRegistry" interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry" odl:type="default" /> - + + <reference id="clusterSingletonService" + interface="org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider"/> <bean id="provider" class="org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl" init-method="init" destroy-method="close"> <property name="dataBroker" ref="dataBroker"/> <property name="rpcProviderRegistry" ref="rpcProviderRegistry" /> <property name="notificationPublishService" ref="notificationPublishService" /> <property name="mountPointService" ref="mountPointService" /> + <property name="clusterSingletonService" ref="clusterSingletonService" /> </bean> diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java index 74d2d2263..1f488b2e9 100644 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java +++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java @@ -163,14 +163,14 @@ public class TestDevMgrPropertiesFile { } - private void sleep(int milliseconds) { + private static void sleep(int milliseconds) { try { Thread.sleep(milliseconds); } catch (InterruptedException e) { } } - private void writeFile(File f, String content) { + public static void writeFile(File f, String content) { try { Files.asCharSink(f, StandardCharsets.UTF_8).write(content); } catch (IOException e) { diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java index 661194c38..435e8e151 100644 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java +++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java @@ -1,22 +1,17 @@ /******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * 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 + * ============LICENSE_START======================================================= ONAP : ccsdk + * feature sdnr wt ================================================================================ + * 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 + * 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========================================================= + * 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.devicemanager.test; @@ -30,27 +25,35 @@ import java.io.StringWriter; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Scanner; +import java.util.concurrent.TimeUnit; import org.json.JSONException; import org.json.JSONObject; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice.ArchiveCleanService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseWebAPIClient; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources; import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerService.Action; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.ClusterSingletonServiceProviderMock; import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.DataBrokerNetconfMock; import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.MountPointMock; import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.MountPointServiceMock; import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.NotificationPublishServiceMock; import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.RpcProviderRegistryMock; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.DBCleanServiceHelper; import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.ReadOnlyTransactionMountpoint1211Mock; import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.ReadOnlyTransactionMountpoint1211pMock; import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.ReadOnlyTransactionMountpoint12Mock; import org.opendaylight.controller.md.sal.binding.api.MountPointService; import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService; +import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; +import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.slf4j.Logger; @@ -63,7 +66,7 @@ public class TestDeviceManagerWithDatabase { private static Path KARAF_ETC = Paths.get("etc"); private static DeviceManagerImpl deviceManager; - private static MountPointMock mountPoint; + private static MountPointMock mountPoint; private static DataBrokerNetconfMock dataBrokerNetconf; private static final Logger LOG = LoggerFactory.getLogger(TestDeviceManagerWithDatabase.class); @@ -73,25 +76,26 @@ public class TestDeviceManagerWithDatabase { @BeforeClass public static void before() throws InterruptedException, IOException { - System.out.println("Logger: "+LOG.getClass().getName() + " " + LOG.getName()); + System.out.println("Logger: " + LOG.getClass().getName() + " " + LOG.getName()); // Call System property to get the classpath value Path etc = KARAF_ETC; delete(etc); - System.out.println("Create empty:"+etc.toString()); + System.out.println("Create empty:" + etc.toString()); Files.createDirectories(etc); - //Create mocks + // Create mocks ReadOnlyTransactionMountpoint12Mock readOnlyTransaction = new ReadOnlyTransactionMountpoint12Mock(); dataBrokerNetconf = new DataBrokerNetconfMock(); dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction); mountPoint = new MountPointMock(); mountPoint.setReadOnlyTransaction(readOnlyTransaction); - MountPointService mountPointService = new MountPointServiceMock(mountPoint); + ClusterSingletonServiceProvider clusterSingletonService = new ClusterSingletonServiceProviderMock(); + MountPointService mountPointService = new MountPointServiceMock(mountPoint); NotificationPublishService notificationPublishService = new NotificationPublishServiceMock(); RpcProviderRegistry rpcProviderRegistry = new RpcProviderRegistryMock(); - //start using blueprint interface + // start using blueprint interface String msg = ""; try { deviceManager = new DeviceManagerImpl(); @@ -100,7 +104,7 @@ public class TestDeviceManagerWithDatabase { deviceManager.setMountPointService(mountPointService); deviceManager.setNotificationPublishService(notificationPublishService); deviceManager.setRpcProviderRegistry(rpcProviderRegistry); - + deviceManager.setClusterSingletonService(clusterSingletonService); deviceManager.init(); } catch (Exception e) { StringWriter sw = new StringWriter(); @@ -110,17 +114,17 @@ public class TestDeviceManagerWithDatabase { e.printStackTrace(); } readOnlyTransaction.close(); - System.out.println("Initialization status: "+deviceManager.isDevicemanagerInitializationOk()); - assertTrue("Devicemanager not initialized: "+msg, deviceManager.isDevicemanagerInitializationOk()); + System.out.println("Initialization status: " + deviceManager.isDevicemanagerInitializationOk()); + assertTrue("Devicemanager not initialized: " + msg, deviceManager.isDevicemanagerInitializationOk()); System.out.println("Initialization done"); - + waitfordatabase(); } @AfterClass public static void after() throws InterruptedException, IOException { System.out.println("Start shutdown"); - //close using blueprint interface + // close using blueprint interface try { deviceManager.close(); } catch (Exception e) { @@ -143,18 +147,6 @@ public class TestDeviceManagerWithDatabase { } @Test - public void test1() throws InterruptedException { - - System.out.println("Test1: Wait for database"); - int timeout = DATABASETIMEOUTSECONDS; - while ( !deviceManager.isDatabaseInitializationFinished() && timeout-- > 0) { - System.out.println("Test1: "+timeout); - Thread.sleep(1000); //On second - } - System.out.println("Test1: database initialized"); - } - - @Test public void test2() { System.out.println("Test2: slave mountpoint"); @@ -190,7 +182,7 @@ public class TestDeviceManagerWithDatabase { NodeId nodeId = new NodeId("mountpointTest3"); Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - System.out.println("Node capabilites: "+capabilities); + System.out.println("Node capabilites: " + capabilities); try { deviceManager.startListenerOnNodeForConnectedState(Action.CREATE, nodeId, nNode); @@ -223,7 +215,7 @@ public class TestDeviceManagerWithDatabase { NodeId nodeId = new NodeId("mountpointTest4"); Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - System.out.println("Node capabilites: "+capabilities); + System.out.println("Node capabilites: " + capabilities); try { deviceManager.startListenerOnNodeForConnectedState(Action.CREATE, nodeId, nNode); @@ -257,7 +249,7 @@ public class TestDeviceManagerWithDatabase { NodeId nodeId = new NodeId("mountpointTest5"); Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - System.out.println("Node capabilites: "+capabilities); + System.out.println("Node capabilites: " + capabilities); try { deviceManager.startListenerOnNodeForConnectedState(Action.CREATE, nodeId, nNode); @@ -283,9 +275,9 @@ public class TestDeviceManagerWithDatabase { System.out.println("Test6: Write zip data file file"); File testFile = new File("etc/elasticsearch_update.zip"); Resources.extractFileTo("elasticsearch_update.zip", testFile); - int wait=130; - while ( testFile.exists() && wait-- > 0) { - System.out.println("Waiting "+wait); + int wait = 130; + while (testFile.exists() && wait-- > 0) { + System.out.println("Waiting " + wait); try { Thread.sleep(1000); } catch (InterruptedException e) { @@ -298,11 +290,92 @@ public class TestDeviceManagerWithDatabase { } - //********************* Private + @Test + public void test7() throws Exception { + final int NUM = 5; + final int ARCHIVE_DAYS = 30; + final long ARCHIVE_LIMIT_SEC = TimeUnit.SECONDS.convert(ARCHIVE_DAYS, TimeUnit.DAYS); + final long ARCHIVE_INTERVAL_SEC = 10; + File propFile = KARAF_ETC.resolve("devicemanager.properties").toFile(); + + ArchiveCleanService service = deviceManager.getArchiveCleanService(); + DBCleanServiceHelper helper = new DBCleanServiceHelper(deviceManager); + + // setEsConfg + TestDevMgrPropertiesFile.writeFile(propFile, getContent(ARCHIVE_LIMIT_SEC, ARCHIVE_INTERVAL_SEC)); + //give time to read file + sleep(5); + System.out.println("Archive clean service configuration "+service); + System.out.println("To delete elements older: "+service.getDateForOldElements()); + System.out.println("Status of elements is: "+service.countOldEntries()); + + // create old data and check if the will be cleaned completely + int elements = helper.writeDataToLogs(NUM, ARCHIVE_DAYS+5, 0 /*Hours*/); + System.out.println("Written elements are: "+elements); + + waitForDeletion(service, 2 * ARCHIVE_INTERVAL_SEC, elements, "Entries are not cleared completely as expected"); + + // create partial old and newer data and check that only half of all data are cleaned + // New data are not counted as "old" .. + int elementsToRemove = elements = helper.writeDataToLogs(NUM, ARCHIVE_DAYS+5, 0); + elements += helper.writeDataToLogs(NUM, ARCHIVE_DAYS-5, 0); + waitForDeletion(service, 2 * ARCHIVE_INTERVAL_SEC, elementsToRemove, "Entries are not cleared exactly half as expected"); + + // create only newer data and check that nothing is cleaned + elements = helper.writeDataToLogs(NUM, ARCHIVE_DAYS+2, 0); + waitForDeletion(service, 2 * ARCHIVE_INTERVAL_SEC, elements, "Some entries were removed, but shouldn't."); + + service.close(); + } + + // ********************* Private + + private void waitForDeletion(ArchiveCleanService service, long timeout, long numberAtBeginning, String faultMessage) { + int numberEntries = 0; + while (timeout-- > 0) { + sleep(1000); + numberEntries = service.countOldEntries(); + if (numberEntries <= 0) { + break; + } + } + if (timeout == 0) { + fail(faultMessage + " Timeout at:" + timeout + " Entries at beginning " + numberAtBeginning + + " remaining" + numberEntries); + } + } + + + private static void waitfordatabase() throws InterruptedException { + + System.out.println("Test1: Wait for database"); + int timeout = DATABASETIMEOUTSECONDS; + while (!deviceManager.isDatabaseInitializationFinished() && timeout-- > 0) { + System.out.println("Test1: " + timeout); + Thread.sleep(1000); // On second + } + System.out.println("Ddatabase initialized"); + } + + private static void sleep(int millis) { + try { + Thread.sleep(millis); + } catch (InterruptedException e) { + LOG.warn(e.getMessage()); + Thread.interrupted(); + } + } + + private static void waitEnter() { + Scanner sc = new Scanner(System.in); + System.out.println("Enter"); + sc.next(); + sc.close(); + } private static void delete(Path etc) throws IOException { if (Files.exists(etc)) { - System.out.println("Found and remove:"+etc.toString()); + System.out.println("Found and remove:" + etc.toString()); delete(etc.toFile()); } } @@ -318,5 +391,21 @@ public class TestDeviceManagerWithDatabase { } } + private String getContent(long archiveLimitSeconds, long esArchiveCheckIntervalSeconds) { + return "[dcae]\n" + "dcaeUserCredentials=admin:admin\n" + "dcaeUrl=http://localhost:45/abc\n" + + "dcaeHeartbeatPeriodSeconds=120\n" + "dcaeTestCollector=no\n" + "\n" + "[aots]\n" + + "userPassword=passwd\n" + "soapurladd=off\n" + "soapaddtimeout=10\n" + "soapinqtimeout=20\n" + + "userName=user\n" + "inqtemplate=inqreq.tmpl.xml\n" + "assignedto=userid\n" + + "addtemplate=addreq.tmpl.xml\n" + "severitypassthrough=critical,major,minor,warning\n" + + "systemuser=user\n" + "prt-offset=1200\n" + "soapurlinq=off\n" + "#smtpHost=\n" + "#smtpPort=\n" + + "#smtpUsername=\n" + "#smtpPassword=\n" + "#smtpSender=\n" + "#smtpReceivers=\n" + "\n" + "[es]\n" + + "esCluster=sendateodl5\n" + "esArchiveLifetimeSeconds=" + archiveLimitSeconds + "\n" + "esArchiveCheckIntervalSeconds=" + + esArchiveCheckIntervalSeconds + "\n" + "\n" + "[aai]\n" + "#keep comment\n" + + "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + "aaiUrl=off\n" + "aaiUserCredentials=AAI:AAI\n" + + "aaiDeleteOnMountpointRemove=true\n" + "aaiTrustAllCerts=false\n" + "aaiApiVersion=aai/v13\n" + + "aaiPropertiesFile=aaiclient.properties\n" + "\n" + "[pm]\n" + "pmCluster=sendateodl5\n" + + "pmEnabled=true\n" + "[toggleAlarmFilter]\n" + "taEnabled=false\n" + "taDelay=5555\n" + ""; + } + } diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ClusterSingletonServiceProviderMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ClusterSingletonServiceProviderMock.java new file mode 100644 index 000000000..30b64817a --- /dev/null +++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ClusterSingletonServiceProviderMock.java @@ -0,0 +1,19 @@ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock; + +import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService; +import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; +import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration; + +public class ClusterSingletonServiceProviderMock implements ClusterSingletonServiceProvider { + + @Override + public void close() throws Exception { + + } + + @Override + public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) { + return null; + } + +} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/DBCleanServiceHelper.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/DBCleanServiceHelper.java new file mode 100644 index 000000000..4e46e1800 --- /dev/null +++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/DBCleanServiceHelper.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * 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.devicemanager.test.util; + +import java.util.Date; +import java.util.concurrent.TimeUnit; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service.HtDatabaseEventsService; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.index.database.types.EsEventOdluxLog; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.index.impl.IndexMwtnService; + +public class DBCleanServiceHelper { + + private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter(); + + private final HtDatabaseEventsService databaseEventService; + private final IndexMwtnService mwtnService; + + /** + * Helper to fill data into the database + * @param deviceManager devicemanger to get services + */ + public DBCleanServiceHelper(DeviceManagerImpl deviceManager) { + this.databaseEventService = deviceManager.getDatabaseClientEvents(); + this.mwtnService = deviceManager.getMwtnService(); + } + + /** + * Write data into database with specific date and content profile. + * @param number of data to be written for each log + * @param days starting day, relative to actual date + * @param hours starting hour ... increased by one hour for each write + * @return integer with the amount of written data + */ + public int writeDataToLogs(int number, int days, int hours) { + int res = 0; + for (Integer t=0; t < number; t++) { //Test "sdnevents", "eventlog" + ObjectCreationNotificationXml notificationXml = new ObjectCreationNotificationXml( + "Testpoint"+t, t.toString(), getInternalDateAndTime(days, hours+t), "ObjectId"+t); + databaseEventService.writeEventLog(notificationXml); + res++; + } + + for (Integer t=0; t < number; t++) { //Test "sdnevents", "faultlog" + ProblemNotificationXml fault = new ProblemNotificationXml( + "ProblemNode"+t, "Problemuuid", "Problemname", InternalSeverity.Major, t.toString(), getInternalDateAndTime(days, hours+t)); + databaseEventService.writeFaultLog(fault); + res++; + } + + for (Integer t=0; t < number; t++) { //Test "mwtn", "log" + EsEventOdluxLog odluxEvent = new EsEventOdluxLog("Odluxevent"+t, "Problemuuid", "Message", getInternalDateAndTime(days, hours+t)); + mwtnService.writeOdluxEventForTestpurpose(odluxEvent); + res++; + } + + return res; + } + + /************************************************************** + * Private section + */ + + private InternalDateAndTime getInternalDateAndTime(int days, int hours) { + Date actual = new Date(new Date().getTime() - TimeUnit.MILLISECONDS.convert(days, TimeUnit.DAYS) - TimeUnit.MILLISECONDS.convert(hours, TimeUnit.HOURS)); + InternalDateAndTime timeStamp = InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp(actual)); + return timeStamp; + } + + +} diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/simplelogger.properties b/sdnr/wt/devicemanager/provider/src/test/resources/simplelogger.properties index 5a8d43145..eec5d3a4c 100644 --- a/sdnr/wt/devicemanager/provider/src/test/resources/simplelogger.properties +++ b/sdnr/wt/devicemanager/provider/src/test/resources/simplelogger.properties @@ -10,9 +10,10 @@ org.slf4j.simpleLogger.defaultLogLevel=info # Must be one of ("trace", "debug", "info", "warn", or "error"). # If not specified, the default logging detail level is used. # org.slf4j.simpleLogger.log.xxx.yyy=debug -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager=debug +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager=info +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice=debug org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources=info -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container=trace +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container=info # Set to true if you want the current date and time to be included in output messages. # Default is false, and will output the number of milliseconds elapsed since startup. diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/test.properties b/sdnr/wt/devicemanager/provider/src/test/resources/test.properties index 943c25bd9..de49c5893 100644 --- a/sdnr/wt/devicemanager/provider/src/test/resources/test.properties +++ b/sdnr/wt/devicemanager/provider/src/test/resources/test.properties @@ -26,6 +26,14 @@ soapurlinq=off [es] esCluster=sendateodl5 +#time limit to keep increasing data in database [in seconds] +#60*60*24*30 (30days) +esArchiveLimit=2592000 +#folder where removed data will be stored +esArchiveFolder=./backup +#interval to archive database [in seconds] +#60*60*24 (1day) +esArchiveInterval=86400 [aai] #keep comment diff --git a/sdnr/wt/devicemodel/feature/pom.xml b/sdnr/wt/devicemodel/feature/pom.xml index 35b1cc3f1..c460e7140 100644 --- a/sdnr/wt/devicemodel/feature/pom.xml +++ b/sdnr/wt/devicemodel/feature/pom.xml @@ -19,7 +19,8 @@ * limitations under the License. * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> @@ -32,7 +33,7 @@ <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> <dependencyManagement> @@ -47,8 +48,7 @@ <dependency> <groupId>org.opendaylight.controller</groupId> <artifactId>mdsal-artifacts</artifactId> - <version>1.8.1</version> - <!-- <version>${odl.mdsal.version}</version> --> + <version>${odl.controller.mdsal.version}</version> <type>pom</type> <scope>import</scope> </dependency> diff --git a/sdnr/wt/devicemodel/installer/pom.xml b/sdnr/wt/devicemodel/installer/pom.xml index 66c47fd7c..19998efc8 100755 --- a/sdnr/wt/devicemodel/installer/pom.xml +++ b/sdnr/wt/devicemodel/installer/pom.xml @@ -21,22 +21,23 @@ * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.ccsdk.parent</groupId> - <artifactId>odlparent-lite</artifactId> - <version>1.2.2-SNAPSHOT</version> - <relativePath/> - </parent> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> <artifactId>sdnr-wt-devicemodel-installer</artifactId> <version>0.4.2-SNAPSHOT</version> <packaging>pom</packaging> <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name> + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>1.2.2-SNAPSHOT</version> + <relativePath /> + </parent> + <properties> <application.name>sdnr-wt-devicemodel</application.name> <include.transitive.dependencies>false</include.transitive.dependencies> diff --git a/sdnr/wt/devicemodel/model/pom.xml b/sdnr/wt/devicemodel/model/pom.xml index 3a8d84e12..5795c3d42 100644 --- a/sdnr/wt/devicemodel/model/pom.xml +++ b/sdnr/wt/devicemodel/model/pom.xml @@ -21,22 +21,23 @@ * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.ccsdk.parent</groupId> - <artifactId>binding-parent</artifactId> - <version>1.2.2-SNAPSHOT</version> - <relativePath/> - </parent> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> <artifactId>sdnr-wt-devicemodel-model</artifactId> <version>0.4.2-SNAPSHOT</version> <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name> <packaging>bundle</packaging> + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>1.2.2-SNAPSHOT</version> + <relativePath /> + </parent> + <properties> <maven.javadoc.skip>true</maven.javadoc.skip> </properties> @@ -71,3 +72,4 @@ </plugins> </build> </project> + diff --git a/sdnr/wt/devicemodel/pom.xml b/sdnr/wt/devicemodel/pom.xml index 60d8cc032..14e4d6a69 100755 --- a/sdnr/wt/devicemodel/pom.xml +++ b/sdnr/wt/devicemodel/pom.xml @@ -24,6 +24,12 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-devicemodel-top</artifactId> + <version>0.4.2-SNAPSHOT</version> + <packaging>pom</packaging> + <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name> + <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> @@ -31,12 +37,6 @@ <relativePath/> </parent> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> - <artifactId>sdnr-wt-devicemodel-top</artifactId> - <version>0.4.2-SNAPSHOT</version> - <packaging>pom</packaging> - <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name> - <properties> <feature-name>sdnr-wt-devicemodel</feature-name> </properties> diff --git a/sdnr/wt/featureaggregator/feature/pom.xml b/sdnr/wt/featureaggregator/feature/pom.xml index 09cc5aa4c..ec69487a1 100644 --- a/sdnr/wt/featureaggregator/feature/pom.xml +++ b/sdnr/wt/featureaggregator/feature/pom.xml @@ -19,7 +19,8 @@ * limitations under the License. * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> @@ -32,7 +33,7 @@ <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> <dependencyManagement> @@ -83,7 +84,6 @@ <type>xml</type> <classifier>features</classifier> </dependency> -<!-- <dependency> <groupId>${project.groupId}</groupId> <artifactId>sdnr-wt-odlux-core-feature</artifactId> @@ -98,6 +98,5 @@ <type>xml</type> <classifier>features</classifier> </dependency> ---> </dependencies> </project> diff --git a/sdnr/wt/featureaggregator/installer/pom.xml b/sdnr/wt/featureaggregator/installer/pom.xml index ca714c42f..623073074 100755 --- a/sdnr/wt/featureaggregator/installer/pom.xml +++ b/sdnr/wt/featureaggregator/installer/pom.xml @@ -19,7 +19,9 @@ * limitations under the License. * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> @@ -32,7 +34,7 @@ <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> <properties> @@ -42,7 +44,7 @@ </properties> <dependencies> - <dependency> + <dependency> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> <artifactId>${application.name}</artifactId> <version>${project.version}</version> @@ -119,6 +121,27 @@ <copyPom>false</copyPom> </configuration> </execution> + <execution> + <id>unpack-cache-schema</id> + <goals> + <goal>unpack</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-devicemanager-provider</artifactId> + <version>0.4.2-SNAPSHOT</version> + <type>jar</type> + </artifactItem> + </artifactItems> + <outputDirectory>${project.build.directory}/assembly</outputDirectory> + <includes>preload.cache.schema/**</includes> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + </configuration> + </execution> </executions> </plugin> </plugins> diff --git a/sdnr/wt/featureaggregator/pom.xml b/sdnr/wt/featureaggregator/pom.xml index cc9aa4ae5..3121490f6 100755 --- a/sdnr/wt/featureaggregator/pom.xml +++ b/sdnr/wt/featureaggregator/pom.xml @@ -19,7 +19,9 @@ * limitations under the License. * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> @@ -32,7 +34,7 @@ <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> <modules> diff --git a/sdnr/wt/helpserver/feature/pom.xml b/sdnr/wt/helpserver/feature/pom.xml index 7545ce3e9..e2d22b9c6 100644 --- a/sdnr/wt/helpserver/feature/pom.xml +++ b/sdnr/wt/helpserver/feature/pom.xml @@ -21,7 +21,9 @@ * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> @@ -34,7 +36,7 @@ <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> diff --git a/sdnr/wt/helpserver/installer/pom.xml b/sdnr/wt/helpserver/installer/pom.xml index cdf810ef1..84ad2c9d1 100755 --- a/sdnr/wt/helpserver/installer/pom.xml +++ b/sdnr/wt/helpserver/installer/pom.xml @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> @@ -12,7 +14,7 @@ <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> <version>1.2.2-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> <properties> diff --git a/sdnr/wt/helpserver/pom.xml b/sdnr/wt/helpserver/pom.xml index 89070da44..dcc7dd641 100755 --- a/sdnr/wt/helpserver/pom.xml +++ b/sdnr/wt/helpserver/pom.xml @@ -21,7 +21,9 @@ * ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> @@ -47,4 +49,4 @@ <properties> <feature-name>sdnr-wt-helpserver</feature-name> </properties> -</project> +</project>
\ No newline at end of file diff --git a/sdnr/wt/helpserver/provider/README.md b/sdnr/wt/helpserver/provider/README.md new file mode 100644 index 000000000..d35aeb580 --- /dev/null +++ b/sdnr/wt/helpserver/provider/README.md @@ -0,0 +1,34 @@ +##Creating help files + +#### Link and references to pictures. + +All links are relative to the current md-file. + +Link to pages located in the same directory: + +``` +[linkname](file.md) +``` + +Link to subpages located in subdirectories: + +``` +[linkname](subfolder/file.md) +``` + +External Links: + +``` +[linkname](linkurl "linktitle") +``` + +Images: + +``` +![SDN-R in ONAP](./ONAP-SDN-R.png "SDN-R in ONAP") +``` + +#### Supported formates + +md-format: +Picture formats: PNG diff --git a/sdnr/wt/helpserver/provider/pom.xml b/sdnr/wt/helpserver/provider/pom.xml index 392ae1a40..7c7d1fd12 100644 --- a/sdnr/wt/helpserver/provider/pom.xml +++ b/sdnr/wt/helpserver/provider/pom.xml @@ -1,83 +1,75 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- * ============LICENSE_START======================================================= - * ONAP : CCSDK.sdnr.wt.apigateway.provider * ================================================================================ - * Copyright (C) 2018 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========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<!-- * ============LICENSE_START======================================================= + * ONAP : CCSDK.sdnr.wt.apigateway.provider * ================================================================================ + * Copyright (C) 2018 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========================================================= --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> - <artifactId>sdnr-wt-helpserver-provider</artifactId> - <version>0.4.2-SNAPSHOT</version> - <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name> - <packaging>bundle</packaging> - <properties> - <checkstyle.skip>true</checkstyle.skip> - <buildtime>${maven.build.timestamp} UTC</buildtime> - <distversion>ONAP Dublin (Flourine-SR1)</distversion> - <buildno>1.15b7491</buildno> - </properties> - <parent> - <groupId>org.onap.ccsdk.parent</groupId> - <artifactId>binding-parent</artifactId> - <version>1.2.2-SNAPSHOT</version> - <relativePath/> - </parent> - <dependencies> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - </dependency> - <dependency> - <groupId>org.json</groupId> - <artifactId>json</artifactId> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.core</artifactId> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.compendium</artifactId> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-helpserver-provider</artifactId> + <version>0.4.2-SNAPSHOT</version> + <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name> + <packaging>bundle</packaging> + <properties> + <checkstyle.skip>true</checkstyle.skip> + </properties> + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>1.2.2-SNAPSHOT</version> + <relativePath /> + </parent> + <dependencies> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.5</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + </dependency> + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> - </dependencies> - <build> - <resources> - <!-- replace properties in about.md --> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - </resource> - </resources> - <plugins> - <!-- fixed bug for sonarcube --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <useSystemClassLoader>false</useSystemClassLoader> - </configuration> - </plugin> - </plugins> - </build> + </dependencies> + <build> + <plugins> + <!-- fixed bug for sonarcube --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <useSystemClassLoader>false</useSystemClassLoader> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java index 35e351563..f91e96b79 100644 --- a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java +++ b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java @@ -26,8 +26,6 @@ import java.io.OutputStream; import java.net.URISyntaxException; import java.net.URLDecoder; import java.nio.file.Path; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -67,11 +65,7 @@ public class HelpServlet extends HttpServlet implements AutoCloseable { resp.addHeader("Access-Control-Allow-Methods", "OPTIONS, HEAD, GET, POST, PUT, DELETE"); resp.addHeader("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, Content-Length"); if (query != null && query.contains("meta")) { - /* - * LOG.debug("received post with uri="+req.getRequestURI()); String - * uri=req.getRequestURI().substring(BASEURI.length()); if(uri.startsWith("/")) - * uri=uri.substring(1); - */ + File f = new File(HelpInfrastructureObject.KARAFHELPDIRECTORY, "meta.json"); if (f.exists()) { LOG.debug("found local meta file"); @@ -120,36 +114,20 @@ public class HelpServlet extends HttpServlet implements AutoCloseable { } LOG.debug("delivering file"); OutputStream out = resp.getOutputStream(); - String version = null; - if (REDIRECT_LINKS) { - version = getVersionFromRequestedUri(uri); - } - if (this.isTextFile(f) && REDIRECT_LINKS && version != null) { - final String regex = - "(!?\\[[^\\]]*?\\])\\(((?:(?!http|www\\.|\\#|\\.com|\\.net|\\.info|\\.org|\\.svg|\\.png|\\.jpg|\\.gif|\\.jpeg|\\.pdf).)*?)\\)"; - final Pattern pattern = Pattern.compile(regex); - Matcher matcher; - String line; - try (BufferedReader br = new BufferedReader(new FileReader(f))) { - line = br.readLine(); - while (line != null) { - // check line for internal link - matcher = pattern.matcher(line); - if (matcher.find()) { - // extend link with specific version - line = line.replace(matcher.group(2), - "../" + matcher.group(2) + version + "/README.md"); - } - out.write((line + "\n").getBytes()); - line = br.readLine(); - - } - out.flush(); - out.close(); - br.close(); - } - - } else { +// if (this.isTextFile(f) && REDIRECT_LINKS) { +// String line; +// try (BufferedReader br = new BufferedReader(new FileReader(f))) { +// line = br.readLine(); +// while (line != null) { +// out.write((line + "\n").getBytes()); +// line = br.readLine(); +// } +// out.flush(); +// out.close(); +// br.close(); +// } +// } else + { try (FileInputStream in = new FileInputStream(f)) { byte[] buffer = new byte[1024]; @@ -169,27 +147,6 @@ public class HelpServlet extends HttpServlet implements AutoCloseable { } } - /** - * Extract version from URI string - * @param uri = "help/folder1/folder2/version/README.md" - * @return version as a string - */ - private static String getVersionFromRequestedUri(String uri) { - if (uri == null) { - return null; - } - int lastidx = uri.lastIndexOf("/"); - if (lastidx < 0) { - return null; - } - int slastidx = uri.lastIndexOf("/", lastidx - 1); - if (slastidx < 0) { - return null; - } - return uri.substring(slastidx + 1, lastidx); - - } - private boolean ispdf(File f) { return f != null ? this.ispdf(f.getName()) : false; } diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/README.md index c03217d14..c99967d2b 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/0.4.0/README.md +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/README.md @@ -1,7 +1,7 @@ # MediatorServer ## Description -The mediator server is the physical device on which multiple instances of the [mediators](mediator/) are running. Additionally a small webserver provides an API to control and create the mediators via HTTP-API. These mediators are translating the requests and responses between the SDN-Controller(netconf) and the device(snmp). Because of the restricted snmp protocol (port 162 only) we have to implement a prerouting automatism that forwards the alarms sent by the devices to another local port so that each mediator only gets the alarms of its device. +The mediator server is the physical device on which multiple instances of the [mediators](mediator/README.md) are running. Additionally a small webserver provides an API to control and create the mediators via HTTP-API. These mediators are translating the requests and responses between the SDN-Controller(netconf) and the device(snmp). Because of the restricted snmp protocol (port 162 only) we have to implement a prerouting automatism that forwards the alarms sent by the devices to another local port so that each mediator only gets the alarms of its device. diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/installation/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/installation/README.md index 6fdcbaec0..6fdcbaec0 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/installation/0.4.0/README.md +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/installation/README.md diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/mediator/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/mediator/README.md index 9fa43a436..9fa43a436 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/mediator/0.4.0/README.md +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/mediator/README.md diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/meta.json b/sdnr/wt/helpserver/provider/src/main/resources/help/meta.json index b23e8d9d0..0bcd0f3e8 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/meta.json +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/meta.json @@ -1,222 +1,177 @@ { - "sdnr": { - "nodes": { - "connect": { - "versions": { - "0.4.0": { - "date": "2018-02-24", - "path": "sdnr/connect/0.4.0/README.md", - "label": "Connect" - }, - "current": { - "date": "2018-02-24", - "path": "sdnr/connect/0.4.0/README.md", - "label": "Connect" - } - }, - "label": "Connect" - }, - "pnfFault": { - "versions": { - "0.4.0": { - "date": "2018-02-24", - "path": "sdnr/pnfFault/0.4.0/README.md", - "label": "pnf Fault" - }, - "current": { - "date": "2018-02-24", - "path": "sdnr/pnfFault/0.4.0/README.md", - "label": "pnf Fault" - } - }, - "label": "pnf Fault" - }, - "pnfMaintenance": { - "versions": { - "0.4.0": { - "date": "2018-09-13", - "path": "sdnr/pnfMaintenance/0.4.0/README.md", - "label": "pnf Maintenance" - }, - "current": { - "date": "2018-09-13", - "path": "sdnr/pnfMaintenance/0.4.0/README.md", - "label": "pnf Maintenance" - } - }, - "label": "pnf Maintenance" - }, - "pnfConfig": { - "versions": { - "0.4.0": { - "date": "2018-02-24", - "path": "sdnr/pnfConfig/0.4.0/README.md", - "label": "pnf Config" - }, - "current": { - "date": "2018-02-24", - "path": "sdnr/pnfConfig/0.4.0/README.md", - "label": "pnf Config" - } - }, - "label": "pnf Config" - }, - "pnfPerformance": { - "versions": { - "0.4.0": { - "date": "2018-02-24", - "path": "sdnr/pnfPerformance/0.4.0/README.md", - "label": "pnf Performance" - }, - "current": { - "date": "2018-02-24", - "path": "sdnr/pnfPerformance/0.4.0/README.md", - "label": "pnf Performance" - } - }, - "label": "pnf Performance" - }, - "pnfInventory": { - "versions": { - "0.4.0": { - "date": "2018-02-24", - "path": "sdnr/pnfInventory/0.4.0/README.md", - "label": "pnf Inventory" - }, - "current": { - "date": "2018-02-24", - "path": "sdnr/pnfInventory/0.4.0/README.md", - "label": "pnf Inventory" - } - }, - "label": "pnf Inventory" - }, - "pnfMediator": { - "versions": { - "0.4.0": { - "date": "2018-02-24", - "path": "sdnr/pnfMediator/0.4.0/README.md", - "label": "pnf Mediator" - }, - "current": { - "date": "2018-02-24", - "path": "sdnr/pnfMediator/0.4.0/README.md", - "label": "pnf Mediator" - } - }, - "label": "pnf Mediator" - }, - "mwtnTest": { - "versions": { - "0.4.0": { - "date": "2018-02-24", - "path": "sdnr/mwtnTest/0.4.0/README.md", - "label": "LTE RAN Test" - }, - "current": { - "date": "2018-02-24", - "path": "sdnr/mwtnTest/0.4.0/README.md", - "label": "LTE RAN Test" - } - }, - "label": "LTE RAN Test" - }, - "mwtnLog": { - "versions": { - "0.4.0": { - "date": "2018-02-24", - "path": "sdnr/mwtnLog/0.4.0/README.md", - "label": "Logs" - }, - "current": { - "date": "2018-02-24", - "path": "sdnr/mwtnLog/0.4.0/README.md", - "label": "Logs" - } - }, - "label": "Logs" - } - }, - "versions": { - "0.4.0": { - "date": "2018-02-24", - "path": "sdnr/0.4.0/README.md", - "label": "SDN-R" - }, - "current": { - "date": "2018-02-24", - "path": "sdnr/0.4.0/README.md", - "label": "SDN-R" - } - }, - "label": "SDN-R" - }, - "mediatorserver":{ - "nodes":{ - "installation":{ - "versions":{ - "0.4.0":{"date":"","path":"mediatorserver/installation/0.4.0/README.md","label":""}, - "current":{"date":"","path":"mediatorserver/installation/0.4.0/README.md","label":""} - }, - "label":"Installation" - }, - "mediator":{ - "versions":{ - "0.4.0":{"date":"","path":"mediatorserver/mediator/0.4.0/README.md","label":""}, - "current":{"date":"","path":"mediatorserver/mediator/0.4.0/README.md","label":""} - }, - "label":"Mediator" - } - }, - "versions":{ - "0.4.0":{"date":"","path":"mediatorserver/0.4.0/README.md","label":""}, - "current":{"date":"","path":"mediatorserver/0.4.0/README.md","label":""} - }, - "label":"MediatorServer" - }, - "faq": { - "versions": { - "0.4.0": { - "date": "2018-02-24", - "path": "sdnr/0.4.0/faq.md", - "label": "FAQ" - }, - "current": { - "date": "2018-02-24", - "path": "sdnr/0.4.0/faq.md", - "label": "FAQ" - } - }, - "label": "FAQ" - }, - "abbreviations": { - "versions": { - "0.4.0": { - "date": "2018-02-24", - "path": "sdnr/0.4.0/abbreviations.md", - "label": "Abbreviations" - }, - "current": { - "date": "2018-02-24", - "path": "sdnr/0.4.0/abbreviations.md", - "label": "Abbreviations" - } - }, - "label": "Abbreviations" - }, - "about": { - "versions": { - "0.4.0": { - "date": "2018-02-24", - "path": "sdnr/0.4.0/about.md", - "label": "About" - }, - "current": { - "date": "2018-02-24", - "path": "sdnr/0.4.0/about.md", - "label": "About" - } - }, - "label": "About" - } + "sdnr": { + "nodes": { + "connect": { + "versions": { + "0.4.0": { + "date": "2018-02-24", + "path": "sdnr/connect/README.md", + "label": "Connect" + }, + "current": { + "date": "2018-02-24", + "path": "sdnr/connect/README.md", + "label": "Connect" + } + }, + "label": "Connect" + }, + "pnfFault": { + "versions": { + "0.4.0": { + "date": "2018-02-24", + "path": "sdnr/pnfFault/README.md", + "label": "Fault" + }, + "current": { + "date": "2018-02-24", + "path": "sdnr/pnfFault/README.md", + "label": "Fault" + } + }, + "label": "Fault" + }, + "pnfMaintenance": { + "versions": { + "0.4.0": { + "date": "2018-09-13", + "path": "sdnr/pnfMaintenance/README.md", + "label": "Maintenance" + }, + "current": { + "date": "2018-09-13", + "path": "sdnr/pnfMaintenance/README.md", + "label": "Maintenance" + } + }, + "label": "Maintenance" + }, + "pnfConfig": { + "versions": { + "0.4.0": { + "date": "2018-02-24", + "path": "sdnr/pnfConfig/README.md", + "label": "Config" + }, + "current": { + "date": "2018-02-24", + "path": "sdnr/pnfConfig/README.md", + "label": "Config" + } + }, + "label": "Config" + }, + "pnfPerformance": { + "versions": { + "0.4.0": { + "date": "2018-02-24", + "path": "sdnr/pnfPerformance/README.md", + "label": "Performance" + }, + "current": { + "date": "2018-02-24", + "path": "sdnr/pnfPerformance/README.md", + "label": "Performance" + } + }, + "label": "Performance" + }, + "pnfInventory": { + "versions": { + "0.4.0": { + "date": "2018-02-24", + "path": "sdnr/pnfInventory/README.md", + "label": "Inventory" + }, + "current": { + "date": "2018-02-24", + "path": "sdnr/pnfInventory/README.md", + "label": "Inventory" + } + }, + "label": "Inventory" + }, + "pnfMediator": { + "versions": { + "0.4.0": { + "date": "2018-02-24", + "path": "sdnr/pnfMediator/README.md", + "label": "Mediator" + }, + "current": { + "date": "2018-02-24", + "path": "sdnr/pnfMediator/README.md", + "label": "Mediator" + } + }, + "label": "Mediator" + } + }, + "versions": { + "0.4.0": { + "date": "2018-02-24", + "path": "sdnr/README.md", + "label": "SDN-R" + }, + "current": { + "date": "2018-02-24", + "path": "sdnr/README.md", + "label": "SDN-R" + } + }, + "label": "SDN-R" + }, + "mediatorserver":{ + "nodes":{ + "installation":{ + "versions":{ + "0.4.0":{"date":"","path":"mediatorserver/installation/README.md","label":""}, + "current":{"date":"","path":"mediatorserver/installation/README.md","label":""} + }, + "label":"Installation" + }, + "mediator":{ + "versions":{ + "0.4.0":{"date":"","path":"mediatorserver/mediator/README.md","label":""}, + "current":{"date":"","path":"mediatorserver/mediator/README.md","label":""} + }, + "label":"Mediator" + } + }, + "versions":{ + "0.4.0":{"date":"","path":"mediatorserver/README.md","label":""}, + "current":{"date":"","path":"mediatorserver/README.md","label":""} + }, + "label":"MediatorServer" + }, + "faq": { + "versions": { + "0.4.0": { + "date": "2018-02-24", + "path": "sdnr/faq.md", + "label": "FAQ" + }, + "current": { + "date": "2018-02-24", + "path": "sdnr/faq.md", + "label": "FAQ" + } + }, + "label": "FAQ" + }, + "abbreviations": { + "versions": { + "0.4.0": { + "date": "2018-02-24", + "path": "sdnr/abbreviations.md", + "label": "Abbreviations" + }, + "current": { + "date": "2018-02-24", + "path": "sdnr/abbreviations.md", + "label": "Abbreviations" + } + }, + "label": "Abbreviations" + } } diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/about.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/about.md deleted file mode 100644 index 31fd5fef8..000000000 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/about.md +++ /dev/null @@ -1 +0,0 @@ -ONAP SDN-R | ONF Wireless for ${distversion} - Build: ${buildtime} (${buildno})
\ No newline at end of file diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/ONAP-SDN-R.png b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/ONAP-SDN-R.png Binary files differindex cc7bd8a2a..cc7bd8a2a 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/ONAP-SDN-R.png +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/ONAP-SDN-R.png diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/README.md index c0871102b..72e4cad05 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/README.md +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/README.md @@ -2,6 +2,7 @@ SDN-R adds features and functionality to the OpenDaylight-based ONAP controller 'SDN-C'. It is built on the Common Controller Framework to control and manage wireless resources. Wireless resources are virtual network functions (e.g. vBBU, vEPC) or physical network functions (e.g. microwave and millimeter wave radios, eNodeB, RRH, DAS equipment). -SDN-R is integrated into ONAP. Therefore it is interfacing with PNFs and VNFs and with other ONAP components, such as A&AI, DCAE and SO. +SDN-R is integrated into ONAP. Therefore it is interfacing with PNFs and VNFs and with other ONAP components, such as A&AI, DCAE and SO. +[See abbreviations](abbreviations.md) -![SDN-R in ONAP](./ONAP-SDN-R.png "SDN-R in ONAP")
\ No newline at end of file +![SDN-R in ONAP](./ONAP-SDN-R.png "SDN-R in ONAP") diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/abbreviations.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/abbreviations.md index 3704796b4..3704796b4 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/abbreviations.md +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/abbreviations.md diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/connect/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/connect/README.md index 12e4dbe63..6eba75461 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/connect/0.4.0/README.md +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/connect/README.md @@ -4,27 +4,20 @@ The 'Connect' application on OpenDaylight provides up-to-date connectivity infor ## Views -The graphical user interfaces is divided in four sections. +The graphical user interfaces is divided in three sections. ### Required Network Elements Required Network Elements are physical network functions, which are planned or expected in the network. This means the identifier, IP addresses and its required configuration is well-known and available in a planning database or in ONAP A&AI. +This view also offer to manually configure/mount the device with the '+' icon. The SDN controller will then start connecting the Netconf server. + ### Unknown Network Elements Most of the physical network function support an automatic registration procedure to the SDN controller. It may happen, that devices are connected to the SDN Controller but not available in planning data. It might be a normal occurrence for very cheap devices, where an entire planning process to too expensive. But is may also happen that the identifier used in planning process differ from the identifier currently configured in the device. -### Mount NetConf Server - -The view offer manually configuration of a device. The SDN controller will then start connecting the NetConf server. - ### Connection Status Log The log lists the connections status changes between SDN Controller and NetConf servers (devices). - - -## Video - -https://youtu.be/QhchzRV2tac
\ No newline at end of file diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/faq.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/faq.md index d81574640..f9d5e50d7 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/faq.md +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/faq.md @@ -1,6 +1,6 @@ # Frequently asked questions -- - - + ## Which browser should I use to operate Opendaylight SDN-R User interface? @@ -49,4 +49,24 @@ grep -anr --include=*.log* "Unable to read NE data for mountpoint" . | grep 2018 grep -anr --include=*.log* "LKCYFL79Q01M01MSS801" . | grep 2018 >> 09-LKCYFL79Q01M01MSS801.txt ``` -- - - + +## How to report an odlux issue + +If you would like to report an odlux issue which you have noticed in the Graphical User Interface, please provide the following information: + +1. **Description**: In which application you have noticed the issue? + +2. **Environment**: + - Which browser is used and the version of the browser. eg: *Google chrome - version 71.0.3578.80 / Mozilla Firefox.* + - Which Operating system and version. eg: *Linux/ Windows 10 - version 1803.* + - In which language you are using the application. + - The application URL which is available on the browser address bar. eg: *http://hostname/odlux/index.html#/connectApp* + +3. **Expected Result**: What is the expected result you are looking for? + +4. **Actual Result**: What is the actual result you got? + +5. **Steps to reproduce**: Describe the steps to reproduce the scenario. If possible, please provide the screenshots + +The above information helps us to analyze the problem quicker. + diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnLog/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnLog/README.md index 0096ce831..0096ce831 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnLog/0.4.0/README.md +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnLog/README.md diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnTest/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnTest/README.md index 6bd3609c2..6bd3609c2 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnTest/0.4.0/README.md +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnTest/README.md diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfConfig/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfConfig/README.md index d398a8e70..d36ec8e09 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfConfig/0.4.0/README.md +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfConfig/README.md @@ -10,6 +10,3 @@ The applications are implemented as OpenDaylight-DLUX web application using the Connections status information are updated automatically due to a web socket for notifications from OpenDaylight to the browser. -## Video - -https://youtu.be/QhchzRV2tac
\ No newline at end of file diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfFault/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfFault/README.md index bfe1774d0..b7db4388e 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfFault/0.4.0/README.md +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfFault/README.md @@ -8,7 +8,7 @@ The graphical user interface is separated in three views. ### Current Alarms -It list all current active faults in the network. In addition is also list alarms send by the SDN controller itself, which detects connections losses to the NetConf server (connectionLossOAM) or which detects connection loss to a devices via a mediator to a device (connectionLossNeOAM). +It list all current active faults in the network. In addition it also list alarms sent by the SDN controller itself, which detects connections losses to the NetConf server (connectionLossOAM) or which detects connection loss to a devices via a mediator to a device (connectionLossNeOAM). ### Alarm Notifications @@ -16,18 +16,15 @@ As long as the view is open, it lists all alarm notification reached by the SDN ### Alarm Log -Next to the current active alarms an alarm log list all alarm notifications of the past. +Next to the current active alarms an alarm log lists all alarm notifications of the past. ## Implementation -The application has two parts. While the server is listening for NetConf notifications to store them in the data base the client retrieves the information from the data base and displays them in a grid view. +The application has two parts. While the server is listening for NetConf notifications to store them in the database the client retrieves the information from the database and displays them in a grid view. -The server synchronizes with the current alarm lists of the devices and calculates based on raise and clear notifications the current alarm status of the network. The current alarms are stored in a data base. In addition all Problem Notifications received by the SDN controller are stored. There is no logic implemented on the client. +The server synchronizes with the current alarm lists of the devices and calculates based on raise and clear notifications the current alarm status of the network. The current alarms are stored in a database. In addition all Problem Notifications received by the SDN controller are stored. There is no logic implemented on the client. An alarm status bar on top of each graphical user interface informs the operator about the health status of the network. The OpenDaylight DLUX web application uses web sockets for updating the graphical user interface in case of Problem Notification (devices) and Connection Status Notifications (ODL). -## Video - -https://youtu.be/vONKAtFZ8wc
\ No newline at end of file diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfInventory/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfInventory/0.4.0/README.md deleted file mode 100644 index 436280855..000000000 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfInventory/0.4.0/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Inventory - -The application offers basic inventory management of devices supporting ONF-TR-512. - -After selection of a currently connected physical network function, the inventory data - basically serial-numbers and part-numbers are displaced accroding to the containment of the equipment. - -## Video - -[ONAP / ONF proof of concept](https://cloud-highstreet-technologies.com/nextcloud/index.php/s/m4wFfqkQ1qK3hHe "ONAP / ONF proof of concept") diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfInventory/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfInventory/README.md new file mode 100644 index 000000000..d8122ad0a --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfInventory/README.md @@ -0,0 +1,21 @@ +# Inventory + +The application offers basic inventory management of devices supporting ONF-TR-512. + +The view displays the inventory data of the network element - basically serial-numbers and part-numbers are displaced according to the containment of the equipment. + +##### Inventory Export: + +As the default pagination size is set to 10, when you export the data only first 10 rows or the first 10 filtered rows shown on the page will be exported to a file. +The inventory export allows the export of up to 1000 entries, when the pagination size is increased to 1000. +So, It is recommended to change the pagination size 'Rows per page' to 1000 if you want to export the complete Inventory data. + +To export the Inventory data: +The behaviour is different depending on the browser: + +a) Some browsers allows you to save the file with the predefined name export.csv. In case your browser does not offer this function please use 'Save as..' + option and define the filename with extension csv. + +b) Some browsers saves the file automatically with the alphanumeric name without an extension. In such case please go to the downloaded file location and rename the file + with the extension after the download. (eg: export_file.csv) + diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMaintenance/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMaintenance/0.4.0/README.md deleted file mode 100644 index 6f5ab5420..000000000 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMaintenance/0.4.0/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Maintenance Mode - -The 'Maintenance' application on the OpenDaylight provides the information of the Network Elements which are set for Maintenance, currently or in the future. - -When a Network Element is mounted with the maintenance mode it automatically shows on this application with the Information like when maintenance will be started or ended. - -Maintenance Mode field in this application shows if the Network Element is in maintenance mode currently or not. -If it is True it means the Network Element is currently undergoing maintenance, If false it means maintenance might have been set for future or maintenance is already completed. - -Users have access to disable the Maintenance mode or change the maintenance start and end dates at any point of time by clicking on the Manage checkbox available.
\ No newline at end of file diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMaintenance/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMaintenance/README.md new file mode 100644 index 000000000..2deadcafc --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMaintenance/README.md @@ -0,0 +1,10 @@ +# Maintenance + +The 'Maintenance' application on the OpenDaylight provides the information of the Network Elements which are set for Maintenance, currently or in the future. +User can manage devices to set the maintenance mode so that no unnecessary alarms are created. +When the device is in Maintenace alarms are not forwarded to DCAE and when the device maintenance is turned off the alarms will start flowing again. + +'Active' field in this application shows if the Network Element is in maintenance mode currently or not. +If it is 'active' it means the Network Element is currently undergoing maintenance, If 'not active' it means maintenance might have been set for future or maintenance is already completed. + +Users have access to disable the Maintenance mode or change the maintenance start and end dates at any point of time by using the available options in actions column. diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMediator/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMediator/README.md index 246e77b70..246e77b70 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMediator/0.4.0/README.md +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMediator/README.md diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfPerformance/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfPerformance/0.4.0/README.md deleted file mode 100644 index a1d39186a..000000000 --- a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfPerformance/0.4.0/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Performance Monitoring - -Performance Monitoring values measured by the devices are necessary to analyze and optimize the network. Therefore the application automatically retrieves all historical performance values from the devices and stores them in a data base. The client part just retrieves the values from the database and displays them in graphical and/or grid views. - -## Current performance values - -After selection of a connected PNF supporting ONF-TR-532 and an physical interface, the application collects the current performance values directly from the device and displays then in table views. - -## Performance history values - -After selection of a connected PNF supporting ONF-TR-532 and an physical interface, the application collects the received and centralized stored performance values for this interface and displays then in table views. - -## Performance link values - -After selection of two air-interface creating an air-interface-link, the application collects the received and centralized stored performance values for this link and displays the data in diagrams and table views. - -## Video - -https://youtu.be/fgwbKFt9cos
\ No newline at end of file diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfPerformance/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfPerformance/README.md new file mode 100644 index 000000000..2db5eda81 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfPerformance/README.md @@ -0,0 +1,8 @@ +# Performance + +Performance Monitoring values measured by the devices are necessary to analyze and optimize the network. Therefore the application automatically retrieves all historical performance values from the devices and stores them in a database. The client part just retrieves the values from the database and displays them in graphical user interface. + +## Performance history values + +After selection of a connected PNF supporting ONF-TR-532 and an physical interface, the application collects the received and centralized stored performance values for this interface and displays them in table views. + diff --git a/sdnr/wt/helpserver/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestMyServlet.java b/sdnr/wt/helpserver/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestMyServlet.java index e51cc6843..2e4f987be 100644 --- a/sdnr/wt/helpserver/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestMyServlet.java +++ b/sdnr/wt/helpserver/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestMyServlet.java @@ -120,7 +120,7 @@ public class TestMyServlet extends Mockito { @Test public void testServlet2() { - this.testGetRequest("test/0.4.0/test.txt"); + this.testGetRequest("test/test.txt"); this.testGetRequest("test.css"); this.testGetRequest("test.eps"); this.testGetRequest("test.pdf"); @@ -156,6 +156,6 @@ public class TestMyServlet extends Mockito { } catch (Exception e) { } - assertEquals(CONTENT,sw.toString().trim()); + assertEquals("compare content for "+fn,CONTENT,sw.toString().trim()); } } |