From 8d39a39c646154b3e746564536b890a0200bc37b Mon Sep 17 00:00:00 2001 From: Herbert Eiselt Date: Wed, 30 Jan 2019 09:45:54 +0100 Subject: Add sdnr wt helpserver Add complete sdnr wireless transport app helpserver Change-Id: I01ba5a2a4b6dbd8fbfd91bbb5a1ae5db7b181f2d Issue-ID: SDNC-577 Signed-off-by: Herbert Eiselt --- sdnr/wt/helpserver/feature/pom.xml | 52 ++++ sdnr/wt/helpserver/installer/pom.xml | 115 ++++++++ .../src/assembly/assemble_mvnrepo_zip.xml | 49 ++++ sdnr/wt/helpserver/pom.xml | 52 ++++ sdnr/wt/helpserver/provider/pom.xml | 75 ++++++ .../features/sdnr/wt/helpserver/HelpServlet.java | 291 +++++++++++++++++++++ .../sdnr/wt/helpserver/data/Environment.java | 41 +++ .../wt/helpserver/data/ExtactBundleResource.java | 115 ++++++++ .../helpserver/data/HelpInfrastructureObject.java | 201 ++++++++++++++ .../resources/OSGI-INF/blueprint/blueprint.xml | 32 +++ .../resources/help/mediatorserver/0.4.0/README.md | 144 ++++++++++ .../mediatorserver/installation/0.4.0/README.md | 246 +++++++++++++++++ .../help/mediatorserver/mediator/0.4.0/README.md | 66 +++++ .../provider/src/main/resources/help/meta.json | 222 ++++++++++++++++ .../main/resources/help/sdnr/0.4.0/ONAP-SDN-R.png | Bin 0 -> 210224 bytes .../src/main/resources/help/sdnr/0.4.0/README.md | 7 + .../resources/help/sdnr/0.4.0/abbreviations.md | 15 ++ .../src/main/resources/help/sdnr/0.4.0/about.md | 1 + .../src/main/resources/help/sdnr/0.4.0/faq.md | 52 ++++ .../resources/help/sdnr/connect/0.4.0/README.md | 30 +++ .../resources/help/sdnr/mwtnLog/0.4.0/README.md | 3 + .../resources/help/sdnr/mwtnTest/0.4.0/README.md | 3 + .../resources/help/sdnr/pnfConfig/0.4.0/README.md | 15 ++ .../resources/help/sdnr/pnfFault/0.4.0/README.md | 33 +++ .../help/sdnr/pnfInventory/0.4.0/README.md | 9 + .../help/sdnr/pnfMaintenance/0.4.0/README.md | 10 + .../help/sdnr/pnfMediator/0.4.0/README.md | 3 + .../help/sdnr/pnfPerformance/0.4.0/README.md | 19 ++ .../sdnr/wt/helpserver/test/TestHelpServer.java | 35 +++ .../provider/src/test/resources/log4j.properties | 12 + sdnr/wt/pom.xml | 1 + 31 files changed, 1949 insertions(+) create mode 100644 sdnr/wt/helpserver/feature/pom.xml create mode 100755 sdnr/wt/helpserver/installer/pom.xml create mode 100644 sdnr/wt/helpserver/installer/src/assembly/assemble_mvnrepo_zip.xml create mode 100755 sdnr/wt/helpserver/pom.xml create mode 100644 sdnr/wt/helpserver/provider/pom.xml create mode 100644 sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java create mode 100644 sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/Environment.java create mode 100644 sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/ExtactBundleResource.java create mode 100644 sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/OSGI-INF/blueprint/blueprint.xml create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/installation/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/mediator/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/meta.json create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/ONAP-SDN-R.png create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/abbreviations.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/about.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/faq.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/connect/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnLog/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnTest/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfConfig/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfFault/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfInventory/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMaintenance/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMediator/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfPerformance/0.4.0/README.md create mode 100644 sdnr/wt/helpserver/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestHelpServer.java create mode 100644 sdnr/wt/helpserver/provider/src/test/resources/log4j.properties diff --git a/sdnr/wt/helpserver/feature/pom.xml b/sdnr/wt/helpserver/feature/pom.xml new file mode 100644 index 000000000..95e830c0e --- /dev/null +++ b/sdnr/wt/helpserver/feature/pom.xml @@ -0,0 +1,52 @@ + + + + + 4.0.0 + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-helpserver-feature + 0.4.1-SNAPSHOT + feature + ccsdk-features-sdnr-wt :: ${project.artifactId} :: feature + + + org.onap.ccsdk.parent + single-feature-parent + 1.2.1-SNAPSHOT + + + + + + + + ${project.groupId} + sdnr-wt-helpserver-provider + ${project.version} + + + + diff --git a/sdnr/wt/helpserver/installer/pom.xml b/sdnr/wt/helpserver/installer/pom.xml new file mode 100755 index 000000000..7051ce984 --- /dev/null +++ b/sdnr/wt/helpserver/installer/pom.xml @@ -0,0 +1,115 @@ + + + 4.0.0 + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-helpserver-installer + 0.4.1-SNAPSHOT + pom + ccsdk-features-sdnr-wt :: ${project.artifactId} + + + org.onap.ccsdk.parent + odlparent-lite + 1.2.1-SNAPSHOT + + + + + sdnr-wt-helpserver + false + + + + + + org.onap.ccsdk.features.sdnr.wt + ${application.name}-feature + ${project.version} + xml + features + + + * + * + + + + + org.onap.ccsdk.features.sdnr.wt + ${application.name}-provider + ${project.version} + + + + + + + maven-assembly-plugin + + + maven-repo-zip + + single + + package + + true + stage/${application.name}-${project.version} + + src/assembly/assemble_mvnrepo_zip.xml + + true + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + + + + + + + + + + + + + + + + + + + + copy-nested-dependencies + + copy-dependencies + + prepare-package + + true + ${project.build.directory}/assembly/system + false + true + true + true + false + false + + + + + + + + + diff --git a/sdnr/wt/helpserver/installer/src/assembly/assemble_mvnrepo_zip.xml b/sdnr/wt/helpserver/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..c4eb9aa25 --- /dev/null +++ b/sdnr/wt/helpserver/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,49 @@ + + + + + + repo + + zip + + + + false + + + + target/assembly/ + . + + + + + + + + diff --git a/sdnr/wt/helpserver/pom.xml b/sdnr/wt/helpserver/pom.xml new file mode 100755 index 000000000..90d27bfd1 --- /dev/null +++ b/sdnr/wt/helpserver/pom.xml @@ -0,0 +1,52 @@ + + + + + 4.0.0 + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-helpserver-top + 0.4.1-SNAPSHOT + pom + ccsdk-features-sdnr-wt :: ${project.artifactId} + + + org.onap.ccsdk.parent + odlparent-lite + 1.2.1-SNAPSHOT + + + + + + feature + provider + installer + + + + sdnr-wt-helpserver + + \ No newline at end of file diff --git a/sdnr/wt/helpserver/provider/pom.xml b/sdnr/wt/helpserver/provider/pom.xml new file mode 100644 index 000000000..fff54d281 --- /dev/null +++ b/sdnr/wt/helpserver/provider/pom.xml @@ -0,0 +1,75 @@ + + + + + 4.0.0 + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-helpserver-provider + 0.4.1-SNAPSHOT + ccsdk-features-sdnr-wt :: ${project.artifactId} + bundle + + true + + + org.onap.ccsdk.parent + binding-parent + 1.2.1-SNAPSHOT + + + + + javax.servlet + servlet-api + 2.5 + + + org.slf4j + slf4j-simple + + + org.json + json + + + org.osgi + org.osgi.core + + + org.osgi + org.osgi.compendium + + + org.mockito + mockito-core + test + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + false + + + + + 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 new file mode 100644 index 000000000..76ac17bb6 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java @@ -0,0 +1,291 @@ +/******************************************************************************* + * ============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.helpserver; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URISyntaxException; +import java.net.URL; +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; +import javax.servlet.http.HttpServletResponse; +import org.onap.ccsdk.features.sdnr.wt.helpserver.data.HelpInfrastructureObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class HelpServlet extends HttpServlet implements AutoCloseable { + + private static Logger LOG = LoggerFactory.getLogger(HelpServlet.class); + private static final long serialVersionUID = -4285072760648493461L; + + private static final boolean USE_FILESYSTEM = true; + private static final boolean USE_RESSOURCES = !USE_FILESYSTEM; + private static final String BASEURI = "/help"; + + private static final boolean REDIRECT_LINKS = true; + + private final Path basePath; + + public HelpServlet() { + LOG.info("Starting HelpServlet instance {}", this.hashCode()); + HelpInfrastructureObject.createFilesFromResources(); + this.basePath = HelpInfrastructureObject.getHelpDirectoryBase(); + } + + @Override + protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + resp.addHeader("Access-Control-Allow-Origin", "*"); + 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"); + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, + * javax.servlet.http.HttpServletResponse) Handle Get Request: if query=?meta=send json + * infrastructure for README.md else if file exist send file + */ + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + String query = req.getQueryString(); + resp.addHeader("Access-Control-Allow-Origin", "*"); + 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"); + try (BufferedReader rd = new BufferedReader(new FileReader(f));) { + String line = rd.readLine(); + while (line != null) { + resp.getOutputStream().println(line); + line = rd.readLine(); + } + rd.close(); + } catch (IOException e) { + LOG.debug("Can not read meta file", e); + } + } else { + LOG.debug("start walking from path=" + basePath.toAbsolutePath().toString()); + HelpInfrastructureObject o = null; + if (USE_FILESYSTEM) { + try { + o = new HelpInfrastructureObject(this.basePath); + } catch (URISyntaxException e) { + LOG.debug("Can not relsolve URI. ", e); + } + } else if (USE_RESSOURCES) { + // o=new HelpInfrastructureObject() + } + resp.getOutputStream().println(o != null ? o.toString() : ""); + } + resp.setHeader("Content-Type", "application/json"); + } else { + LOG.debug("received get with uri=" + req.getRequestURI()); + String uri = URLDecoder.decode(req.getRequestURI().substring(BASEURI.length()), "UTF-8"); + if (uri.startsWith("/")) { + uri = uri.substring(1); + } + Path p = basePath.resolve(uri); + if (USE_FILESYSTEM) { + File f = p.toFile(); + if (f.isFile() && f.exists()) { + LOG.debug("found file for request"); + if (this.isTextFile(f)) { + resp.setHeader("Content-Type", "application/text"); + resp.setHeader("charset", "utf-8"); + } else if (this.isImageFile(f)) { + resp.setHeader("Content-Type", "image/*"); + } else if (this.ispdf(f)) { + resp.setHeader("Content-Type", "application/pdf"); + } else { + LOG.debug("file is not allowed to deliver"); + resp.setStatus(404); + return; + } + 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 { + try (FileInputStream in = new FileInputStream(f)) { + + byte[] buffer = new byte[1024]; + int len; + while ((len = in.read(buffer)) != -1) { + out.write(buffer, 0, len); + } + in.close(); + out.flush(); + out.close(); + } + } + } else { + LOG.debug("found not file for request"); + resp.setStatus(404); + } + } else if (USE_RESSOURCES) { + URL resurl = this.getClass().getResource(p.toString()); + if (resurl != null)// resource file found + { + if (this.isTextFile(resurl)) { + resp.setHeader("Content-Type", "application/text"); + resp.setHeader("charset", "utf-8"); + } else if (this.isImageFile(resurl)) { + resp.setHeader("Content-Type", "image/*"); + } else if (this.ispdf(resurl)) { + resp.setHeader("Content-Type", "application/pdf"); + } else { + resp.setStatus(404); + return; + } + try (InputStream in = this.getClass().getResourceAsStream(p.toString())) { + OutputStream out = resp.getOutputStream(); + byte[] buffer = new byte[1024]; + int len; + while ((len = in.read(buffer)) != -1) { + out.write(buffer, 0, len); + } + in.close(); + out.flush(); + out.close(); + } + + } else // resource file not found + { + resp.setStatus(404); + } + } + } + } + + /* + * + * uri = "help/folder1/folder2/version/README.md" + */ + 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 isTextFile(URL url) { + return url != null ? this.isTextFile(url.toString()) : false; + } + + private boolean ispdf(URL url) { + return url != null ? this.ispdf(url.toString()) : false; + } + + private boolean isImageFile(URL url) { + return url != null ? this.isImageFile(url.toString()) : false; + } + + private boolean ispdf(File f) { + return f != null ? this.ispdf(f.getName()) : false; + } + + private boolean ispdf(String name) { + return name != null ? name.toLowerCase().endsWith("pdf") : false; + } + + private boolean isImageFile(File f) { + return f != null ? this.isImageFile(f.getName()) : false; + } + + private boolean isImageFile(String name) { + + return name != null + ? name.toLowerCase().endsWith("png") || name.toLowerCase().endsWith("jpg") + || name.toLowerCase().endsWith("jpeg") || name.toLowerCase().endsWith("svg") + || name.toLowerCase().endsWith("eps") + : false; + } + + private boolean isTextFile(File f) { + return f != null ? this.isTextFile(f.getName()) : false; + + } + + private boolean isTextFile(String name) { + return name != null + ? name.toLowerCase().endsWith("md") || name.toLowerCase().endsWith("txt") + || name.toLowerCase().endsWith("html") || name.toLowerCase().endsWith("htm") + || name.toLowerCase().endsWith("js") || name.toLowerCase().endsWith("css") + : false; + } + + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {} + + @Override + public void close() throws Exception {} +} diff --git a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/Environment.java b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/Environment.java new file mode 100644 index 000000000..bbbccdb10 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/Environment.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * ============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.helpserver.data; + +import java.net.Inet4Address; +import java.net.UnknownHostException; +import java.util.Map; + +public class Environment { + + public static String getVar(String v) + { + if(v.equals("$HOSTNAME")) + try { + return Inet4Address.getLocalHost().getHostName(); + } catch (UnknownHostException e) { + + } + Map env = System.getenv(); + for (String envName : env.keySet()) { + if(envName!=null && envName.equals(v)) + return env.get(envName); + } + return null; + } +} diff --git a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/ExtactBundleResource.java b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/ExtactBundleResource.java new file mode 100644 index 000000000..ac99849dc --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/ExtactBundleResource.java @@ -0,0 +1,115 @@ +/******************************************************************************* + * ============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.helpserver.data; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Enumeration; + +import org.osgi.framework.Bundle; + +/** + * Extract subtree with resources from Opendaylight/Karaf/OSGi bundle into Karaf directory
+ * + * Reference: Eclipsezone @see https://www.eclipszone.com + *

+ * Example for resource and directory path from karaf log. + * write resource: help/FAQ/0.4.0/README.md + * Create directories for: data/cache/com.highstreet.technologies.help/help/FAQ/0.4.0/README.md + * Open the file: data/cache/com.highstreet.technologies.help/help/FAQ/0.4.0/README.md + * Problem: Binary, JPG files => do not use buffer related functions + * + * Hint: Werify with file manager the content of the bundle.jar file to see the location of the resources. + * There is no need to mark them via the classpath. + */ + +public class ExtactBundleResource { + + /** + * Extract resources from Karaf/OSGi bundle into karaf directory structure. + * @param bundle Karaf/OSGi bundle with resources + * @param filePrefix prefix in karaf file system for destination e.g. "data/cache/com.highstreet.technologies." + * @param ressoureRoot root name of ressources, with leading "/". e.g. "/help" + * @throws IOException In case of problems. + */ + public static void copyBundleResoucesRecursively(Bundle bundle, String filePrefix, String ressoureRoot) throws IOException { + copyResourceTreeRecurse(bundle, filePrefix, bundle.getEntryPaths(ressoureRoot)); + } + + /** + * Delete a file or a directory and its children. + * @param file The directory to delete. + * @throws IOException Exception when problem occurs during deleting the directory. + */ + public static void deleteRecursively(File file) throws IOException { + + if (file.isDirectory()) { + for (File childFile : file.listFiles()) { + if (childFile.isDirectory()) { + deleteRecursively(childFile); + } else { + if (!childFile.delete()) { + throw new IOException(); + } + } + } + } + + if (!file.delete()) { + throw new IOException(); + } + } + + // ------------- Private functions + + /** + * Recurse function to steps through the resource element tree + * @param b Bundle index for bundle with resourcs + * @param filePrefix + * @param resource + * @throws IOException + */ + private static void copyResourceTreeRecurse(Bundle b, String filePrefix, Enumeration resource) throws IOException { + while (resource.hasMoreElements()) { + String name = resource.nextElement(); + Enumeration list = b.getEntryPaths(name); + if (list != null) { + copyResourceTreeRecurse(b, filePrefix, list); + } else { + //Read + File targetFile = new File(filePrefix+name); + targetFile.getParentFile().mkdirs(); + + try(InputStream in = b.getEntry(name).openStream(); + OutputStream outStream = new FileOutputStream(targetFile);) { + + int theInt; + while ((theInt = in.read()) >= 0) { + outStream.write(theInt); + } + in.close(); + outStream.flush(); + outStream.close(); + } + } + } + } +} diff --git a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java new file mode 100644 index 000000000..11042d13a --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java @@ -0,0 +1,201 @@ +/******************************************************************************* + * ============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.helpserver.data; + +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import org.json.JSONObject; +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class HelpInfrastructureObject extends JSONObject { + + private static final Logger LOG = LoggerFactory.getLogger(HelpInfrastructureObject.class); + private static String HELPBASE = "help"; + private static String KARAFBUNDLERESOURCEHELPROOT = "/" + HELPBASE; + private static String KARAFHELPDIRPREFIX = "data/cache/com.highstreet.technologies."; + public static File KARAFHELPDIRECTORY = new File(KARAFHELPDIRPREFIX + HELPBASE); + + public static class VersionObject extends JSONObject { + private static Comparator comp; + private final String mVersion; + + public String getVersion() { + return this.mVersion; + } + + public VersionObject(String path, String date, String label, String version) { + this.mVersion = version; + this.put("path", path); + this.put("date", date); + this.put("label", label); + } + + public static Comparator getComparer() { + if (comp == null) { + comp = (o1, o2) -> o1.getVersion().compareTo(o2.getVersion()); + } + return comp; + } + + public VersionObject cloneAsLatest() { + return new VersionObject(this.getString("path"), this.getString("date"), this.getString("label"), "latest"); + } + + public VersionObject cloneAsCurrent() { + return new VersionObject(this.getString("path"), this.getString("date"), this.getString("label"), + "current"); + } + } + public static class NodeObject extends JSONObject { + public NodeObject(Path base, File dir, String label, ArrayList versions) { + this.put("label", label); + if (versions != null && versions.size() > 0) { + JSONObject o = new JSONObject(); + this.put("versions", o); + for (VersionObject version : versions) { + o.put(version.getVersion(), version); + } + + } + File[] list = dir.listFiles(); + if (list == null) { + return; + } + for (File f : list) { + if (f.isDirectory()) { + ArrayList versions2 = findReadmeVersionFolders(base, f.toPath(), true); + if (versions2 != null && versions2.size() > 0) { + JSONObject nodes; + if (!this.has("nodes")) { + this.put("nodes", new JSONObject()); + } + nodes = this.getJSONObject("nodes"); + + NodeObject o = new NodeObject(base, f, f.getName(), versions2); + nodes.put(o.getString("label").toLowerCase(), o); + } + } + } + } + + } + + public HelpInfrastructureObject(Path proot) throws URISyntaxException { + File root = proot.toFile(); + File[] list = root.listFiles(); + if (list == null) { + return; + } + for (File f : list) { + if (f.isDirectory()) { + ArrayList versions = findReadmeVersionFolders(root.toPath(), f.toPath(), true); + if (versions != null && versions.size() > 0) { + NodeObject o = new NodeObject(proot, f, f.getName(), versions); + this.put(o.getString("label").toLowerCase(), o); + } + } + } + + + } + + public static void walk(ArrayList results, String path) { + + File root = new File(path); + File[] list = root.listFiles(); + + if (list == null) { + return; + } + + for (File f : list) { + if (f.isDirectory()) { + walk(results, f.getAbsolutePath()); + // System.out.println( "Dir:" + f.getAbsoluteFile() ); + } else { + // System.out.println( "File:" + f.getAbsoluteFile() ); + if (f.isFile() && f.getName().endsWith(".md")) { + results.add(f); + } + } + } + } + + private static ArrayList findReadmeVersionFolders(Path base, Path root, boolean appendCurrent) { + ArrayList list = new ArrayList<>(); + File[] files = root.toFile().listFiles(); + int baselen = base.toFile().getAbsolutePath().length(); + if (files != null) { + for (File f : files) { + if (f.isDirectory() && new File(f.getAbsolutePath() + "/README.md").exists()) { + list.add(new VersionObject(f.getAbsolutePath().substring(baselen + 1) + "/README.md", "", "", + f.getName())); + } + } + } + Collections.sort(list, VersionObject.getComparer()); + Collections.reverse(list); + if (list.size() > 0 && appendCurrent) { + list.add(list.get(0).cloneAsCurrent()); + } + return list; + } + + + public static void createFilesFromResources() { + + if (KARAFHELPDIRECTORY.exists()) { + LOG.info("Delete existing directory"); + try { + ExtactBundleResource.deleteRecursively(KARAFHELPDIRECTORY); + } catch (IOException e1) { + LOG.warn(e1.toString()); + } + } + + LOG.info("Extract"); + try { + Bundle b = FrameworkUtil.getBundle(HelpInfrastructureObject.class); + if (b == null) { + LOG.info("No bundlereference: Use target in filesystem."); + // URL helpRessource = + // JarFileUtils.stringToJarURL("target/helpserver-impl-0.4.0-SNAPSHOT.jar",KARAFBUNDLERESOURCEHELPROOT); + + } else { + LOG.info("Bundle location:{} State:{}", b.getLocation(), b.getState()); + LOG.info("Write files from Resource"); + ExtactBundleResource.copyBundleResoucesRecursively(b, "data/cache/com.highstreet.technologies.", + KARAFBUNDLERESOURCEHELPROOT); + } + } catch (IOException e) { + LOG.warn("No help files available. Exception: " + e.toString()); + } + } + + public static Path getHelpDirectoryBase() { + return KARAFHELPDIRECTORY.toPath(); + } +} diff --git a/sdnr/wt/helpserver/provider/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/sdnr/wt/helpserver/provider/src/main/resources/OSGI-INF/blueprint/blueprint.xml new file mode 100644 index 000000000..8c614c4af --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + 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/0.4.0/README.md new file mode 100644 index 000000000..c03217d14 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/0.4.0/README.md @@ -0,0 +1,144 @@ +# 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. + + + +## Config-File + +``` +/etc/mediatorserver.conf +``` + +``` +#global config file for mediatorserver + +#Home Directory +home=/opt/snmp + +#HOST IP +host=192.168.178.89 +port=7071 + +#Port range for Netconf +ncrangemin=4000 +ncrangemax=6000 + +#Port Range for SNMP +snmprangemin=10000 +snmprangemax=12000 + +#PortRange for JMX +jmxrangemin=6001 +jmxrangemax=7000 + +#Log (ERROR | WARN | DEBUG | INFO | TRACE ) +loglevel=DEBUG +logfile=/var/log/mediatorserver.log + +#===================================== +#global MediatorConfig + +#set LogLevel (ERROR | WARN | DEBUG | INFO | TRACE ) +MediatorLogLevel=DEBUG + +#set ping timeout in milliseconds +MediatorDevicePingTimeout=2000 + +#set latency for snmp requests +MediatorSnmpLatency=2000 + +#set java memory for mediator instance +MediatorMemory="-Xmx256m -Xms128m" +``` + +## HTTP-API + +``` +http://:/api/?task= +``` + +| Task | additional Parameters | Description | Response (Success) | +| ---- | --------------------- | ----------- | ------------------ | +| create | config=<config-object> | create new mediator instance | {"code":1,"data":"<string>"}| +| delete | name=<name> | delete mediator instance | \{"code":1,"data":<string>"} | +| start | name=<name> | start mediator instance | \{"code":1,"data":"<string>"} | +| stop | name=<name> | stop mediator instance | \{"code":1,"data":"<string>"} | +| getconfig | name=<name>(optional) | Get current Config for all instances / named mediator instance | \{"code":1,"data":[<config-objects>]}| +| getlog | name=<name>(optional) | Get LogEntries for all instances / named mediator instance | \{"code":1,"data":[]} | +| clearlock | name=<name> | Clear Mediator Lock File | \{"code":1,"data":"<string>"} | +| getnemodels | - | get all Network Element Template Filenames | \{"code":1,"data":[<string-array>]} | +| getncports | limit=<limit>(optional) | get next free ports for Netconf Connections | \{"code":1,"data":[<int-array>]} | +| getsnmpports | limit=<limit>(optional) | get next free ports for SNMP Traps | \{"code":1,"data":[<int-array>]} | +| version | - | get version info of server and mediator | \{"code":1,"data":\{"server":"0.1.0","mediator":"0.1.1"\}\}| +| repair | - | try to fix corrupted configs | \{"code":1,"data":[<config-status-objects>]}| + +HTTP-Response is always a json-formatted String with 2 Elements: + +* code ... 1:success 0:failure +* data ... if code==0: <string> else <string | object> + + +### JSON-Objects + +Config-Object +``` +{ + Name:, + DeviceType:, + DeviceIp:, + DevicePort: , + TrapsPort:, + NeModel:, + NcPort:, + ODLConfig:[ + { + Server:, + Port:, + User:, + Password: + } + ], + PID:, + IsLocked:, + AutoRun:, + FwActive:, + IsNetconfConnected:, + IsNeConnected: +} +``` + +Log-Object +``` +{ + ts:"", + lvl:"", + src:"", + msg:"> /var/log/firewall.log +*/2 * * * * /bin/bash /opt/snmp/bin/clean_all.sh > /dev/null 2>&1 +``` + +### Test Accessibility of the HTTP-API with console +``` +curl http://localhost:7070/api/?task=version +``` +or directly in your browser +``` +http://:7070/api/?task=version +``` +should respond with something like this: +``` +{"code":1,"data":{"server":"0.1.0","mediator":"0.1.1"}} +``` + 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/0.4.0/README.md new file mode 100644 index 000000000..9fa43a436 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/mediator/0.4.0/README.md @@ -0,0 +1,66 @@ +# Mediator + +## Description + + +The mediator is a piece of software to translate get and set requests between the SDN-Controller and the device. In our case we translate from netconf to snmp and back. Additionally the mediator is listening for snmp traps to push them forward to the SDN-Controller. + +## Usage + +Standalone: +``` +./Netconf2SNMPMediator.sh [--cli] ../test.config ../yang/yangNeModel +``` +[MediatorServer](../../mediatorserver/): +``` +./mediators//start.sh +``` + +## Config-File +``` +{ + "Name":"", + "DeviceType":, + "DeviceIP":"", + "TrapPort":, + "NeXMLFile":"", + "NcPort":, + "ODLConfig":[{"Server":"","Port":,"User":"","Password":""}], + "IsNCConnected":false +} +``` + +## XML Ne File + +The xml network element file is the central element of the mediator. It contains all information about the interfaces, their capabilities and everything else of information which get requested through netconf. To connect specific netconf values to device specific snmp values we use the xml attributes of the node element. + +Attributes: + +|Name | Value | Description | +| ----| ---- | ---------- | +|oid | <oid dotted string> | Attribute with SNMP mapping for given oid. For NETCONF-get, request content from Device| +|access | read-only / read-write | decides if only snmp-get or get and set-requests are allowed| +|conversion | <conv-method> | Convert the snmp-value to netconf-value and back| +|default | <any value> | the default netconf value if there is no response from the device | +|validator | regex | to validate the netconf value to avoid protocol errors | + + +Conversion methods: + +Hint: All conversations shown here are the snmp-to-netconf value conversations. Some of these are working in both directions, some not. + + +| Conversion | bi-directional | Description | Example | +| ---------- |: -------------- :| ----------- | ------- | +|int-to-boolean | yes | Convert 1-true and not 1-false between boolean and int| 1=\>true, 0=\>false | +|int-to-boolean-dd,dd,dd-true | no | Convert listed numbers to true | | +|int-to-boolean-dd,dd,dd-false | no | Convert listed numbers to false| | +|if-dd,dd,dd-term1-term2 | no | if value listed, result is *term1*, if not *term2*| | +|map-dd1,dd2,dd3-term1-term2 | yes | Bidirectional map dd1 to term1, dd2 to term2 and soon | | +|divide-dd1 | yes | Divide value by dd1| divide-10: 99 =\> 9.9 =\> 10| +|dividen-dd1 | yes | Divide value by (-1*dd1)| dividen-10: 99 =\> -9.9 =\> -10| +|internal | yes | use inernally hardcoded conversion method | qpsk =\> 4, 16qam =\> 16 | + + +## Alarms + diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/meta.json b/sdnr/wt/helpserver/provider/src/main/resources/help/meta.json new file mode 100644 index 000000000..b23e8d9d0 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/meta.json @@ -0,0 +1,222 @@ +{ + "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" + } +} 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/0.4.0/ONAP-SDN-R.png new file mode 100644 index 000000000..cc7bd8a2a Binary files /dev/null and b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/ONAP-SDN-R.png differ 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/0.4.0/README.md new file mode 100644 index 000000000..c0871102b --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/README.md @@ -0,0 +1,7 @@ +# SDN controller for 'Radio' (SDN-R) + +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 in ONAP](./ONAP-SDN-R.png "SDN-R in ONAP") \ No newline at end of file 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/0.4.0/abbreviations.md new file mode 100644 index 000000000..3704796b4 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/abbreviations.md @@ -0,0 +1,15 @@ +# Abbreviations + +| **Abbreviation** | **Description** | +| ---------------: | ---------------- | +| A&AI | [Active and Available Inventory](https://wiki.onap.org/display/DW/Active+and+Available+Inventory+Project) | +| AAA | [Authentication, Authorization and Accounting](https://en.wikipedia.org/wiki/AAA_(computer_security)) | +| DCAE | [Data Collection Analytics & Events](https://wiki.onap.org/pages/viewpage.action?pageId=6592895) | +| GUI | [Graphical User Interface](https://en.wikipedia.org/wiki/Graphical_user_interface) | +| MSO | [Master Service Orchestrator](https://wiki.onap.org/pages/viewpage.action?pageId=1015834) | +| ONAP | [Open Network Automation Platform](https://wiki.onap.org/pages/viewpage.action?pageId=1015843) | +| SDN | [Software-defined networking](https://en.wikipedia.org/wiki/Software-defined_networking) | +| SDN-C | [SDN-Controller](https://wiki.onap.org/display/DW/SDN+Controller+Development+Guide) | +| SDN-R | [SDN-Radio](https://wiki.onap.org/display/DW/SDN-R) | +| UI | [User Interface](https://en.wikipedia.org/wiki/User_interface) | +| UX | [User Experience](https://en.wikipedia.org/wiki/User_experience) | 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 new file mode 100644 index 000000000..856d69aa5 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/about.md @@ -0,0 +1 @@ +Version: @buildtime@ \ 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/0.4.0/faq.md new file mode 100644 index 000000000..d81574640 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/faq.md @@ -0,0 +1,52 @@ +# Frequently asked questions + +- - - + +## Which browser should I use to operate Opendaylight SDN-R User interface? + +An actual version of [Google Chromium](https://www.chromium.org/getting-involved/download-chromium "Download Chromium") or +[Google Chrome](https://www.google.de/search?q=chrome+download&oq=chrome+download&aqs=chrome..69i57j0l5.2718j0j4&sourceid=chrome&ie=UTF-8 "Download Chrome") is recommended. + +- - - + + +## How to enable detailed logs in karaf for SDN-R applications + +If you like to see more details in karaf logs for the NetConf communication between ODL and NetConf servers (mediators/devices) please invoke the following commands in the karaf console. + +``` +# Logging settings (on) +log:set DEBUG org.opendaylight.mwtn +log:set TRACE org.opendaylight.netconf +log:set TRACE com.highstreet.technologies.odl.app +``` + +Please note, setting the debug level to 'TRACE' may impact the performance on the controller. In production environment make sure to set back the debug level to 'INFO' as soon possible. + + +``` +# Logging settings (off) +log:set INFO org.opendaylight.mwtn +log:set INFO org.opendaylight.netconf +log:set INFO com.highstreet.technologies.odl.app +``` + +- - - + +## Which commands should be used to analyse karaf logs? + +``` +cd $ODL_KARAF_HOME/data/log +rm *.txt +grep -anr --include=*.log* "| ERROR |" . | grep 2018 >> 01-error.txt +grep -anr --include=*.log* "RemoteDevice{" . | grep 2018 >> 02-devices.txt +grep -anr --include=*.log* "RemoteDevice{" . | grep "Unable to build schema context, unsatisfied imports" | grep 2018 >> 03-schema-issue.txt +grep -anr --include=*.log* "Matched request:" . | grep 2018 >> 04-matched-request.txt +grep -anr --include=*.log* "network-element" . | grep 2018 >> 05-network-element.txt +grep -anr --include=*.log* "urn:onf:params:xml:ns:yang:core-model" . | grep 2018 >> 06-core-module.txt +grep -anr --include=*.log* "PerformanceManagerTask" . | grep 2018 >> 07-pm-tick.txt +grep -anr --include=*.log* "Unable to read NE data for mountpoint" . | grep 2018 >> 08-unable-to-read.txt +grep -anr --include=*.log* "LKCYFL79Q01M01MSS801" . | grep 2018 >> 09-LKCYFL79Q01M01MSS801.txt +``` + +- - - 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/0.4.0/README.md new file mode 100644 index 000000000..12e4dbe63 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/connect/0.4.0/README.md @@ -0,0 +1,30 @@ +# Connect + +The 'Connect' application on OpenDaylight provides up-to-date connectivity information about the wireless devices in the network. It automatically displays new network elements and their connection status. Despite the network elements usually automatically mount themselves, an additional small window allows manually mounting devices/mediators. For better understanding alarms and status, a connection status log lists all the connection status changes of OpenDaylight mount points. + +## Views + +The graphical user interfaces is divided in four 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. + +### 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/mwtnLog/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnLog/0.4.0/README.md new file mode 100644 index 000000000..0096ce831 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnLog/0.4.0/README.md @@ -0,0 +1,3 @@ +# Log + +The application displays (UX) application logs. SDN-R offer a common log server, so that PNFs or other ONAP/ECOMP components could log there data in a common way. \ No newline at end of file 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/0.4.0/README.md new file mode 100644 index 000000000..6bd3609c2 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnTest/0.4.0/README.md @@ -0,0 +1,3 @@ +# Test + +The view offers in a generic way data fetched from ONF-TR-532 devices for test and debug purposes. \ No newline at end of file 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/0.4.0/README.md new file mode 100644 index 000000000..d398a8e70 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfConfig/0.4.0/README.md @@ -0,0 +1,15 @@ +# Configuration + +The application shows the actual values of all attributes of the ONF-TR-532 for a selected physical network function (PNF). Each view of a functional element is divide into capabilities, configuration, status, current problem, current performance and history performance information according to TR-532. + +A separate window is available for modifying the configuration. All changes made are sent to the device in a single NetConf bulk request. The operator is notified about successfully configuring the device. + +## Implementation + +The applications are implemented as OpenDaylight-DLUX web application using the RestConf northbound interface of the SDN controller. The key frameworks are: Maven, Angular.js, Bootstrap and UI-Grid. + +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/0.4.0/README.md new file mode 100644 index 000000000..bfe1774d0 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfFault/0.4.0/README.md @@ -0,0 +1,33 @@ +# Fault Management + +To operate a network, it is important to get an overview about the currently raised alarms. The application offers basic fault management of devices supporting ONF-TR-532. The alarms are classified according to the severity level (warning, minor, major, critical). + +## Views + +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). + +### Alarm Notifications + +As long as the view is open, it lists all alarm notification reached by the SDN Controller. Please note that refreshing the view will start the collection again. Previous alarm notification can be viewed in the alarm log. + +### Alarm Log + +Next to the current active alarms an alarm log list 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 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. + +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 new file mode 100644 index 000000000..436280855 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfInventory/0.4.0/README.md @@ -0,0 +1,9 @@ +# 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/pnfMaintenance/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMaintenance/0.4.0/README.md new file mode 100644 index 000000000..6f5ab5420 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMaintenance/0.4.0/README.md @@ -0,0 +1,10 @@ +# 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/pnfMediator/0.4.0/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMediator/0.4.0/README.md new file mode 100644 index 000000000..246e77b70 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfMediator/0.4.0/README.md @@ -0,0 +1,3 @@ +# Mediator + +Some device vendors (Altiostar, CommScope, Dragonwave-X) uses the [generic mediator framework](https://github.com/Melacon/NetConf2SNMP). Such mediator offers an API to create, delete, start and stop mediator instances. \ No newline at end of file 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 new file mode 100644 index 000000000..a1d39186a --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/pnfPerformance/0.4.0/README.md @@ -0,0 +1,19 @@ +# 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/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestHelpServer.java b/sdnr/wt/helpserver/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestHelpServer.java new file mode 100644 index 000000000..db6d783b9 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestHelpServer.java @@ -0,0 +1,35 @@ +package org.onap.ccsdk.features.sdnr.wt.helpserver.test; +/******************************************************************************* + * ============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========================================================================== + ******************************************************************************/ +import static org.junit.Assert.assertNotNull; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.helpserver.HelpServlet; + +public class TestHelpServer { + + @Test + public void test() throws Exception { + + HelpServlet helpServelet = new HelpServlet(); + + assertNotNull("Helpservelet created", helpServelet); + + helpServelet.close(); + } + +} diff --git a/sdnr/wt/helpserver/provider/src/test/resources/log4j.properties b/sdnr/wt/helpserver/provider/src/test/resources/log4j.properties new file mode 100644 index 000000000..142663bd2 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/test/resources/log4j.properties @@ -0,0 +1,12 @@ +log4j.rootLogger=INFO, out + +log4j.logger.org.apache.camel.impl.converter=WARN +log4j.logger.org.apache.camel.management=WARN +log4j.logger.org.apache.camel.impl.DefaultPackageScanClassResolver=WARN +log4j.logger.org.springframework=ERROR + +# CONSOLE appender not used by default +log4j.appender.out=org.apache.log4j.ConsoleAppender +log4j.appender.out.layout=org.apache.log4j.PatternLayout +log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n + diff --git a/sdnr/wt/pom.xml b/sdnr/wt/pom.xml index 59e23b3ae..922ac4f9d 100644 --- a/sdnr/wt/pom.xml +++ b/sdnr/wt/pom.xml @@ -39,6 +39,7 @@ apigateway devicemodel websocketmanager2 + helpserver -- cgit 1.2.3-korg