diff options
Diffstat (limited to 'sdnr/wt')
31 files changed, 1949 insertions, 0 deletions
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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + * ============LICENSE_START======================================================= + * ONAP : CCSDK.feature.sdnr.wt + * ================================================================================ + * 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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-helpserver-feature</artifactId> + <version>0.4.1-SNAPSHOT</version> + <packaging>feature</packaging> + <name>ccsdk-features-sdnr-wt :: ${project.artifactId} :: feature</name> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>single-feature-parent</artifactId> + <version>1.2.1-SNAPSHOT</version> + <relativePath /> + </parent> + + + <dependencies> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>sdnr-wt-helpserver-provider</artifactId> + <version>${project.version}</version> + </dependency> + + </dependencies> +</project> 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 @@ +<?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"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-helpserver-installer</artifactId> + <version>0.4.1-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.1-SNAPSHOT</version> + <relativePath /> + </parent> + + <properties> + <application.name>sdnr-wt-helpserver</application.name> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> + + <dependencies> + + <dependency> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>${application.name}-feature</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>${application.name}-provider</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>true</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <!-- <execution> --> + <!-- <id>copy-dependencies</id> --> + <!-- <goals> --> + <!-- <goal>copy-dependencies</goal> --> + <!-- </goals> --> + <!-- <phase>prepare-package</phase> --> + <!-- <configuration> --> + <!-- <transitive>true</transitive> --> + <!-- <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> --> + <!-- <overWriteReleases>false</overWriteReleases> --> + <!-- <overWriteSnapshots>true</overWriteSnapshots> --> + <!-- <overWriteIfNewer>true</overWriteIfNewer> --> + <!-- <useRepositoryLayout>true</useRepositoryLayout> --> + <!-- <addParentPoms>false</addParentPoms> --> + <!-- <copyPom>false</copyPom> --> + <!-- <includeArtifactIds>sdnr-wt-apigateway-provider,${application.name}</includeArtifactIds> --> + <!-- <scope>provided</scope> --> + <!-- </configuration> --> + <!-- </execution> --> + <execution> + <id>copy-nested-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <transitive>true</transitive> + <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <useRepositoryLayout>true</useRepositoryLayout> + <addParentPoms>false</addParentPoms> + <copyPom>false</copyPom> + <!--<includeArtifactIds>sdnr-wt-apigateway-provider,${application.name}</includeArtifactIds> --> + <!--<scope>provided</scope> --> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> 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 @@ +<!-- + ============LICENSE_START======================================================= + ONAP : CCSDK + ================================================================================ + Copyright (C) 2017 AT&T 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========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>repo</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> + + + +</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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + * ============LICENSE_START======================================================= + * ONAP : CCSDK.feature.sdnr.wt + * ================================================================================ + * 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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-helpserver-top</artifactId> + <version>0.4.1-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.1-SNAPSHOT</version> + <relativePath/> + </parent> + + + <modules> + <module>feature</module> + <module>provider</module> + <module>installer</module> + </modules> + + <properties> + <feature-name>sdnr-wt-helpserver</feature-name> + </properties> +</project>
\ 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 @@ +<?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"> + + <modelVersion>4.0.0</modelVersion> + + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-helpserver-provider</artifactId> + <version>0.4.1-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.1-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> + <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 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<String, String> 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<br> + * + * Reference: Eclipsezone @see <a href="https://www.eclipsezone.com/eclipse/forums/t101557.html">https://www.eclipszone.com</a> + * <br><br> + * 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<String> resource) throws IOException { + while (resource.hasMoreElements()) { + String name = resource.nextElement(); + Enumeration<String> 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<VersionObject> 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<VersionObject> 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<VersionObject> 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<VersionObject> 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<VersionObject> 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<File> 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<VersionObject> findReadmeVersionFolders(Path base, Path root, boolean appendCurrent) { + ArrayList<VersionObject> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============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========================================================================== +--> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"> + + <bean id="helpServlet" + class="org.onap.ccsdk.features.sdnr.wt.helpserver.HelpServlet"> + </bean> + + <service interface="javax.servlet.http.HttpServlet" ref="helpServlet"> + <service-properties> + <entry key="alias" value="/help" /> + </service-properties> + </service> +</blueprint> 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://<host>:<port>/api/?task=<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:<String>, + DeviceType:<enum>, + DeviceIp:<String>, + DevicePort: <int>, + TrapsPort:<Int>, + NeModel:<XML Filename>, + NcPort:<int>, + ODLConfig:[ + { + Server:<String>, + Port:<int>, + User:<String>, + Password:<String> + } + ], + PID:<int>, + IsLocked:<boolean>, + AutoRun:<boolean>, + FwActive:<boolean>, + IsNetconfConnected:<boolean>, + IsNeConnected:<boolean> +} +``` + +Log-Object +``` +{ + ts:"<Timestamp>", + lvl:"<LogLevel>", + src:"<Source>", + msg:"<Message" +} +``` + + +## Usage + +All functionality which is not automated can be executed by the control script +``` +bin/control.sh +``` + +| parameter | description | +| ------------- | ------------------------------------------------ | +|checkout | get latest code from git repo | +|cpsrc | copy binary files from source | +|cpxml | copy xml files from source | +|build | build sources | +|make | build sources and install bins and ressources | +|start | start server | +|stop | stop server | +|stopall | stop all mediators, then the server | +|startmed [med] | start mediator with name [med] | +|stopmed [med] | stop mediator with name [med] | +|status | print status | +|repair | repair config files if corrupted | + 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/0.4.0/README.md new file mode 100644 index 000000000..6fdcbaec0 --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/installation/0.4.0/README.md @@ -0,0 +1,246 @@ +# MediatorServer + +## Manual Installation + +### Install prerequisites + +``` +sudo apt-get install jq curl +``` +Installing Java + +for production +``` +sudo apt-get install openjdk-8-jre + +``` + +for development +``` +sudo apt-get install openjdk-8-jdk +sudo apt-get install git maven + +``` + +### Create user +``` +useradd mediators +``` + +### Choose a home directory for all mediatorserver files +``` +mkdir /opt/snmp + +``` + +### Create folder infrastructure +``` +cd /opt/snmp +mkdir bin +mkdir mediators +mkdir nemodel +mkdir yang +mkdir source (only for dev-env) + +``` + +### Copy files to folders +``` +bin/control.sh +bin/clean_all.sh +bin/debug.sh +bin/mediatorserver.sh +bin/Netconf2SNMPMediator.sh +bin/Netconf2SNMPMediator.jar +bin/init_script.sh +bin/firewall_status.sh +bin/unlock_all.sh +bin/firewall.sh +bin/MediatorServer.jar +bin/stop_all.sh +bin/start_all.sh +``` + +``` +nemodel/DragonWave-HCP.xml +nemodel/ActionTEC_ECB6200.xml +nemodel/ActionTEC_ECB6000.xml +nemodel/DVM_MWCore12_BasicAir.xml +nemodel/DragonWave-HQ.xml +nemodel/DragonWave-HQdev.xml +nemodel/CommScope.xml +``` + +``` +yang/yangNeModel +yang/yangNeModel/G_874_1_model-Imported_Information_Object_Classes-Q_822@2016-08-11.yang +yang/yangNeModel/MicrowaveModel-ObjectClasses-PureEthernetStructure@2016-09-02.yang +yang/yangNeModel/yuma-proc@2012-10-10.yang +yang/yangNeModel/nc-notifications@2008-07-14.yang +yang/yangNeModel/CoreModel-CoreFoundationModule-TypeDefinitions@2016-07-01.yang +yang/yangNeModel/ietf-inet-types@2010-09-24.yang +yang/yangNeModel/onf-ptp-dataset@2017-05-08.yang +yang/yangNeModel/yuma-system@2014-11-27.yang +yang/yangNeModel/onf-ethernet-conditional-packages@2017-04-02.yang +yang/yangNeModel/MicrowaveModel-ObjectClasses-SuperClasses@2016-08-09.yang +yang/yangNeModel/ietf-ptp-dataset@2017-02-08.yang +yang/yangNeModel/MicrowaveModel-ObjectClasses-TdmContainer@2016-09-02.yang +yang/yangNeModel/ietf-netconf-acm@2012-02-22.yang +yang/yangNeModel/MicrowaveModel-Notifications@2016-08-09.yang +yang/yangNeModel/MicrowaveModel-ObjectClasses-HybridMwStructure@2016-09-02.yang +yang/yangNeModel/microwave-model@2017-03-24.yang +yang/yangNeModel/MicrowaveModel-ObjectClasses-AirInterfaceDiversity@2016-09-02.yang +yang/yangNeModel/G_874_1_model-Type_Definitions@2016-07-10.yang +yang/yangNeModel/CoreModel-CoreFoundationModule-StateModel@2016-08-09.yang +yang/yangNeModel/G_874_1_model-Imported_Information_Object_Classes-X_739@2016-07-10.yang +yang/yangNeModel/ietf-system@2014-08-06.yang +yang/yangNeModel/G_874_1_model-Imported_Information_Object_Classes-X_721@2016-07-10.yang +yang/yangNeModel/MicrowaveModel-ObjectClasses-AirInterface@2016-09-01.yang +yang/yangNeModel/onf-core-model-conditional-packages@2017-04-02.yang +yang/yangNeModel/MicrowaveModel-NetworkElement-CurrentProblemList@2016-11-20.yang +yang/yangNeModel/core-model@2017-03-20.yang +yang/yangNeModel/g.874.1-model@2017-03-20.yang +yang/yangNeModel/ietf-yang-library@2016-04-09.yang +yang/yangNeModel/yuma-time-filter@2011-08-13.yang +yang/yangNeModel/yuma-mysession@2010-05-10.yang +yang/yangNeModel/G_874_1_model-Imported_Data_Types@2016-07-10.yang +yang/yangNeModel/yuma-ncx@2012-01-13.yang +yang/yangNeModel/ietf-yang-types@2013-07-15.yang +yang/yangNeModel/MicrowaveModel-ObjectClasses-EthernetContainer@2016-09-02.yang +yang/yangNeModel/notifications@2008-07-14.yang +yang/yangNeModel/ietf-netconf-monitoring@2010-10-04.yang +yang/yangNeModel/CoreModel-CoreFoundationModule-SuperClassesAndCommonPackages@2016-07-10.yang +yang/yangNeModel/ietf-restconf@2013-10-19.yang +yang/yangNeModel/yuma-app-common@2012-08-16.yang +yang/yangNeModel/yuma-types@2012-06-01.yang +yang/yangNeModel/CoreModel-CoreNetworkModule-ObjectClasses@2016-08-11.yang +yang/yangNeModel/MicrowaveModel-TypeDefinitions@2016-09-02.yang +yang/yangNeModel/ietf-netconf-with-defaults@2011-06-01.yang +yang/yangNeModel/ietf-netconf@2011-06-01.yang +yang/yangNeModel/ietf-netconf-partial-lock@2009-10-19.yang +yang/yangNeModel/G_874_1_model-Object_Classes@2016-07-10.yang +yang/yangNeModel/ietf-inet-types@2013-07-15.yang +yang/yangNeModel/CoreModel-CoreNetworkModule-TypeDefinitions@2016-07-10.yang +yang/yangNeModel/yuma-arp@2012-01-13.yang +yang/yangNeModel/iana-crypt-hash@2014-04-04.yang +yang/notification +yang/notification/readme.md +yang/notification/notifications@2008-07-14.yang +``` + +and change all rights to the extra created user +``` +sudo chown -R mediators:mediators /opt/snmp +``` + +### Create mediatorserver config file + +``` +sudo nano /etc/mediatorserver.conf +``` +example: +``` +#Home Directory +home=/opt/snmp + +#HOST IP +host=192.168.178.89 +port=7070 + +#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=WARN +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" + +#==================================== +``` + + +### Create mediatorserver systemd daemon + +``` +sudo nano /etc/systemd/system/mediatorserver.service +``` + +``` +[Unit] +Description=mediatorserver +After=network.target + +[Service] +WorkingDirectory=/opt/snmp/ +SyslogIdentifier=MediatorServer +ExecStart=/opt/snmp/bin/mediatorserver.sh +User=mediators +Type=oneshot + +[Install] +WantedBy=multi-user.target + +``` + +### Initial create mediator server logfile with correct file permissions +``` +sudo touch /var/log/mediatorserver.log +sudo chown mediators:mediators /var/log/mediatorserver.log +``` + +### Activate mediatorserver systemd daemon +``` +systemctl enable mediatorserver.service +systemctl daemon-reload +``` + +Now you can start and stop the service as you like +``` +sudo service mediatorserver [start | stop] +``` + +### Install cron jobs +``` +sudo crontab -e +``` +``` +*/2 * * * * /bin/bash /opt/snmp/bin/firewall.sh >> /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://<mediator-server-ip>: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/<name>/start.sh +``` + +## Config-File +``` +{ + "Name":"<mediatorname-in-odl>", + "DeviceType":<int-of-enum of device type>, + "DeviceIP":"<remote Ip Address>", + "TrapPort":<trap port>, + "NeXMLFile":"<rel-path-to-xml-ne-filename>", + "NcPort":<netconf-port>, + "ODLConfig":[{"Server":"<odl-server-ip>","Port":<odl-http-port>,"User":"<odl-username>","Password":"<odl-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 Binary files differnew file mode 100644 index 000000000..cc7bd8a2a --- /dev/null +++ b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/0.4.0/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/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 @@ <module>apigateway</module> <module>devicemodel</module> <module>websocketmanager2</module> + <module>helpserver</module> </modules> </project> |