summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/mountpoint-registrar/provider
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/mountpoint-registrar/provider')
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/copyright17
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/pom.xml126
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPFaultVESMsgConsumer.java104
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPPNFRegVESMsgConsumer.java117
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumer.java36
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerImpl.java156
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerMain.java163
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultConfig.java125
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultNotificationClient.java99
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/GeneralConfig.java87
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/MountpointRegistrarImpl.java158
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFMountPointClient.java133
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFRegistrationConfig.java124
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml52
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/resources/version.properties3
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java74
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java172
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java279
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java166
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java75
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java57
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestGeneralConfig.java71
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java65
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java147
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java59
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyFaultVESMsgConsumer.java31
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyPNFRegVESMsgConsumer.java32
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/ClusterSingletonServiceProviderMock.java37
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerMountpointMock.java76
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerNetconfMock.java75
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointMock.java90
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointServiceMock.java55
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/NotificationPublishServiceMock.java50
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcConsumerRegistryMock.java39
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcProviderRegistryMock.java60
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/resources/simplelogger.properties38
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/test.properties11
37 files changed, 3259 insertions, 0 deletions
diff --git a/sdnr/wt/mountpoint-registrar/provider/copyright b/sdnr/wt/mountpoint-registrar/provider/copyright
new file mode 100644
index 000000000..754b6218f
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/copyright
@@ -0,0 +1,17 @@
+/**
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * 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==========================================================================
+ */
diff --git a/sdnr/wt/mountpoint-registrar/provider/pom.xml b/sdnr/wt/mountpoint-registrar/provider/pom.xml
new file mode 100644
index 000000000..c4b7c82cc
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/pom.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- ============LICENSE_START=======================================================
+ ONAP : CCSDK / SDNR / WT / mountpoint-registrar ================================================================================
+ 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========================================================= -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <relativePath />
+ </parent>
+
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-mountpoint-registrar-provider</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <name>ccsdk-features-sdnr-wt :: ${project.artifactId}</name>
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+ </license>
+ </licenses>
+
+ <properties>
+ <checkstyle.skip>true</checkstyle.skip> <!-- POM configuration -->
+ <maven.javadoc.skip>true</maven.javadoc.skip>
+ <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
+ <buildtime>${maven.build.timestamp} UTC</buildtime>
+ <elasticsearch.version>6.4.3</elasticsearch.version>
+ </properties>
+
+ <dependencies>
+ <!-- begin for testing -->
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- end for testing -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sdnr-wt-mountpoint-registrar-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-common</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>sal-netconf-connector</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
+ <artifactId>rfc6991-ietf-yang-types</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>yang-binding</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-singleton-common-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
+ <artifactId>dmaapClient</artifactId>
+ <version>1.1.10</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-data-provider-model</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-devicemanager-model</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-data-provider-database</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </build>
+</project>
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPFaultVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPFaultVESMsgConsumer.java
new file mode 100644
index 000000000..14d31d578
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPFaultVESMsgConsumer.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.impl;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.io.IOException;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType;
+
+public class DMaaPFaultVESMsgConsumer extends DMaaPVESMsgConsumerImpl {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DMaaPFaultVESMsgConsumer.class);
+
+ //private static int faultCounter = 0;
+ private static final String DEFAULT_SDNRUSER = "admin";
+ private static final String DEFAULT_SDNRPASSWD = "admin";
+
+ @Override
+ public void processMsg(String msg) throws Exception {
+ String faultNodeId;
+ String faultOccurrenceTime;
+ String faultObjectId;
+ String faultReason;
+ String faultSeverity;
+ int faultSequence;
+ ObjectMapper oMapper = new ObjectMapper();
+ JsonNode dmaapMessageRootNode;
+
+ LOG.info("Fault VES Message is - {}", msg);
+ try {
+ dmaapMessageRootNode = oMapper.readTree(msg);
+ faultNodeId = dmaapMessageRootNode.at("/event/commonEventHeader/sourceName").textValue();
+ faultOccurrenceTime = dmaapMessageRootNode.at("/event/faultFields/alarmAdditionalInformation/eventTime").textValue();
+ faultObjectId = dmaapMessageRootNode.at("/event/faultFields/alarmInterfaceA").textValue();
+ faultReason = dmaapMessageRootNode.at("/event/faultFields/specificProblem").textValue();
+ faultSeverity = dmaapMessageRootNode.at("/event/faultFields/eventSeverity").textValue();
+ faultSequence = dmaapMessageRootNode.at("/event/commonEventHeader/sequence").intValue();
+ //faultCounter++;
+
+ if (faultSeverity.equalsIgnoreCase("critical")) {
+ faultSeverity = SeverityType.Critical.toString();
+ } else if (faultSeverity.equalsIgnoreCase("major")) {
+ faultSeverity = SeverityType.Major.toString();
+ } else if (faultSeverity.equalsIgnoreCase("minor")) {
+ faultSeverity = SeverityType.Minor.toString();
+ } else if (faultSeverity.equalsIgnoreCase("warning")) {
+ faultSeverity = SeverityType.Warning.toString();
+ } else if (faultSeverity.equalsIgnoreCase("nonalarmed")) {
+ faultSeverity = SeverityType.NonAlarmed.toString();
+ } else {
+ faultSeverity = SeverityType.NonAlarmed.toString();
+ }
+
+ String baseUrl = getBaseUrl();
+ String sdnrUser = getSDNRUser();
+ String sdnrPasswd = getSDNRPasswd();
+
+ FaultNotificationClient faultClient = getFaultNotificationClient(baseUrl);
+ faultClient.setAuthorization(sdnrUser, sdnrPasswd);
+ faultClient.sendFaultNotification(faultNodeId, Integer.toString(faultSequence), faultOccurrenceTime, faultObjectId, faultReason, faultSeverity);
+
+ } catch (IOException e) {
+ LOG.info("Cannot parse json object ");
+ throw new Exception("Cannot parse json object", e);
+ }
+ }
+
+ public String getBaseUrl() {
+ return GeneralConfig.getBaseUrl();
+ }
+
+ public String getSDNRUser() {
+ return GeneralConfig.getSDNRUser()!= null?GeneralConfig.getSDNRUser():DEFAULT_SDNRUSER;
+ }
+
+ public String getSDNRPasswd() {
+ return GeneralConfig.getSDNRPasswd()!= null?GeneralConfig.getSDNRPasswd():DEFAULT_SDNRPASSWD;
+ }
+
+ public FaultNotificationClient getFaultNotificationClient(String baseUrl) {
+ return new FaultNotificationClient(baseUrl);
+ }
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPPNFRegVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPPNFRegVESMsgConsumer.java
new file mode 100644
index 000000000..00d7e9514
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPPNFRegVESMsgConsumer.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt mountpoint-registrar
+ * =================================================================================================
+ * 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.mountpointregistrar.impl;
+
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class DMaaPPNFRegVESMsgConsumer extends DMaaPVESMsgConsumerImpl {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DMaaPPNFRegVESMsgConsumer.class);
+ private static final String DEFAULT_PROTOCOL = "SSH";
+ private static final String DEFAULT_PORT = "17830";
+ private static final String DEFAULT_USERNAME = "netconf";
+ private static final String DEFAULT_PASSWORD = "netconf";
+ private static final String DEFAULT_SDNRUSER = "admin";
+ private static final String DEFAULT_SDNRPASSWD = "admin";
+
+ @Override
+ public void processMsg(String msg) {
+ LOG.debug("Message from DMaaP topic is - {} ",msg);
+ String pnfId;
+ String pnfIPv4Address;
+ String pnfCommProtocol;
+ String pnfCommPort;
+ String pnfKeyId = null;
+ String pnfUsername;
+ String pnfPasswd = null;
+ ObjectMapper oMapper = new ObjectMapper();
+ JsonNode dmaapMessageRootNode;
+ try {
+ dmaapMessageRootNode = oMapper.readTree(msg);
+ pnfId = dmaapMessageRootNode.at("/event/commonEventHeader/sourceName").textValue();
+ pnfIPv4Address = dmaapMessageRootNode.at("/event/pnfRegistrationFields/oamV4IpAddress").textValue();
+ pnfCommProtocol = dmaapMessageRootNode.at("/event/pnfRegistrationFields/additionalFields/protocol").textValue();
+ pnfCommPort = dmaapMessageRootNode.at("/event/pnfRegistrationFields/additionalFields/oamPort").textValue();
+ if (pnfCommProtocol != null) {
+ if (pnfCommProtocol.equalsIgnoreCase("TLS")) {
+ // Read username and keyId
+ pnfKeyId = dmaapMessageRootNode.at("/event/pnfRegistrationFields/additionalFields/keyId").textValue();
+ pnfUsername = dmaapMessageRootNode.at("/event/pnfRegistrationFields/additionalFields/username").textValue();
+ } else if (pnfCommProtocol.equalsIgnoreCase("SSH")) {
+ // Read username and password
+ pnfUsername = dmaapMessageRootNode.at("/event/pnfRegistrationFields/additionalFields/username").textValue();
+ pnfPasswd = dmaapMessageRootNode.at("/event/pnfRegistrationFields/additionalFields/password").textValue();
+ } else {
+ // log warning - Unknown protocol
+ LOG.warn("Only SSH and TLS protocols supported. Protocol specified in VES message is - {}",pnfCommProtocol,". Defaulting to SSH");
+ pnfCommProtocol = DEFAULT_PROTOCOL;
+ pnfCommPort = DEFAULT_PORT;
+ pnfUsername = DEFAULT_USERNAME;
+ pnfPasswd = DEFAULT_PASSWORD;
+ }
+ } else {
+ LOG.warn("Protocol not specified in VES message, Defaulting to SSH");
+ pnfCommProtocol = DEFAULT_PROTOCOL;
+ pnfCommPort = DEFAULT_PORT;
+ pnfUsername = DEFAULT_USERNAME;
+ pnfPasswd = DEFAULT_PASSWORD;
+ }
+
+ LOG.debug("PNF Fields - {} : {} : {} : {} : {} : {} : {}",pnfId,pnfIPv4Address,pnfCommProtocol,pnfKeyId,pnfUsername,pnfPasswd,pnfCommPort);
+
+ String baseUrl = getBaseUrl();
+ String sdnrUser = getSDNRUser();
+ String sdnrPasswd = getSDNRPasswd();
+
+ PNFMountPointClient mountpointClient = getPNFMountPointClient(baseUrl);
+ LOG.debug("Setting RESTConf Authorization values - {} : {}",sdnrUser,sdnrPasswd);
+ mountpointClient.setAuthorization(sdnrUser, sdnrPasswd);
+
+ mountpointClient.pnfMountPointCreate(pnfId,
+ pnfIPv4Address,
+ pnfCommProtocol, pnfKeyId,
+ pnfUsername, pnfPasswd,
+ pnfCommPort);
+ } catch (IOException e) {
+ LOG.info("Cannot parse json object, ignoring the received PNF Registration VES Message. Reason: {}",e.getMessage());
+ }
+ }
+
+ public String getBaseUrl() {
+ return GeneralConfig.getBaseUrl();
+ }
+
+ public String getSDNRUser() {
+ return GeneralConfig.getSDNRUser()!= null?GeneralConfig.getSDNRUser():DEFAULT_SDNRUSER;
+ }
+
+ public String getSDNRPasswd() {
+ return GeneralConfig.getSDNRPasswd()!= null?GeneralConfig.getSDNRPasswd():DEFAULT_SDNRPASSWD;
+ }
+
+ public PNFMountPointClient getPNFMountPointClient(String baseUrl) {
+ return new PNFMountPointClient(baseUrl);
+ }
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumer.java
new file mode 100644
index 000000000..8474bbb0b
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumer.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt mountpoint-registrar
+ * =================================================================================================
+ * 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.mountpointregistrar.impl;
+
+import java.util.Properties;
+
+public abstract interface DMaaPVESMsgConsumer extends Runnable {
+
+ //public abstract void init(Properties baseProperties, String consumerPropertiesPath);
+ public abstract void init(Properties baseProperties);
+
+ public abstract void processMsg(String msg) throws Exception;//Implement something like InvalidMessageException;
+
+ public abstract boolean isReady();
+
+ public abstract boolean isRunning();
+
+ public abstract void stopConsumer();
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerImpl.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerImpl.java
new file mode 100644
index 000000000..bf8596cbc
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerImpl.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt mountpoint-registrar
+ * =================================================================================================
+ * 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.mountpointregistrar.impl;
+
+import java.util.Properties;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRConsumer;
+import org.onap.dmaap.mr.client.response.MRConsumerResponse;
+
+public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DMaaPVESMsgConsumerImpl.class);
+
+ private final String name = this.getClass().getSimpleName();
+ private Properties properties = null;
+ private MRConsumer consumer = null;
+ private MRConsumerResponse consumerResponse = null;
+ private boolean running = false;
+ private boolean ready = false;
+ private int fetchPause = 5000; // Default pause between fetch - 5 seconds
+ private int timeout = 15000; // Default timeout - 15 seconds
+
+ protected DMaaPVESMsgConsumerImpl() {
+
+ }
+
+ /*
+ * Thread to fetch messages from the DMaaP topic. Waits for the messages to arrive on the topic until a certain timeout and returns.
+ * If no data arrives on the topic, sleeps for a certain time period before checking again
+ */
+ @Override
+ public void run() {
+
+ if (ready) {
+ running = true;
+ while (running) {
+ try {
+ boolean noData = true;
+ consumerResponse = consumer.fetchWithReturnConsumerResponse(timeout, -1);
+ for (String msg : consumerResponse.getActualMessages()) {
+ noData = false;
+ LOG.debug(name + " received ActualMessage from DMaaP VES Message topic:\n"+msg);
+ processMsg(msg);
+ }
+
+ if (noData) {
+ LOG.debug(name + " received ResponseCode: " + consumerResponse.getResponseCode());
+ LOG.debug(name + " received ResponseMessage: " + consumerResponse.getResponseMessage());
+ pauseThread();
+ }
+ } catch (Exception e) {
+ LOG.error("Caught exception reading from DMaaP VES Message Topic", e);
+ running = false;
+ }
+ }
+ }
+ }
+
+ /*
+ * Create a consumer by specifying properties containing information such as topic name, timeout, URL etc
+ */
+ @Override
+ public void init(Properties properties) {
+
+ try {
+
+ String timeoutStr = properties.getProperty("timeout");
+ LOG.debug("timeoutStr: " + timeoutStr);
+
+ if ((timeoutStr != null) && (timeoutStr.length() > 0)) {
+ timeout = parseTimeOutValue(timeoutStr);
+ }
+
+ String fetchPauseStr = properties.getProperty("fetchPause");
+ LOG.debug("fetchPause(Str): " + fetchPauseStr);
+ if ((fetchPauseStr != null) && (fetchPauseStr.length() > 0)) {
+ fetchPause = parseFetchPause(fetchPauseStr);
+ }
+ LOG.debug("fetchPause: " + fetchPause);
+
+ this.consumer = MRClientFactory.createConsumer(properties);
+ ready = true;
+ } catch (Exception e) {
+ LOG.error("Error initializing DMaaP VES Message consumer from file " + properties, e);
+ }
+ }
+
+ private int parseTimeOutValue(String timeoutStr) {
+ try {
+ return Integer.parseInt(timeoutStr);
+ } catch (NumberFormatException e) {
+ LOG.error("Non-numeric value specified for timeout (" + timeoutStr + ")");
+ }
+ return timeout;
+ }
+
+ private int parseFetchPause(String fetchPauseStr) {
+ try {
+ return Integer.parseInt(fetchPauseStr);
+ } catch (NumberFormatException e) {
+ LOG.error("Non-numeric value specified for fetchPause (" + fetchPauseStr + ")");
+ }
+ return fetchPause;
+ }
+
+ private void pauseThread() throws InterruptedException {
+ if (fetchPause > 0) {
+ LOG.debug(String.format("No data received from fetch. Pausing %d ms before retry", fetchPause));
+ Thread.sleep(fetchPause);
+ } else {
+ LOG.debug("No data received from fetch. No fetch pause specified - retrying immediately");
+ }
+ }
+
+ @Override
+ public boolean isReady() {
+ return ready;
+ }
+
+ @Override
+ public boolean isRunning() {
+ return running;
+ }
+
+ public String getProperty(String name) {
+ return properties.getProperty(name, "");
+ }
+
+ @Override
+ public void stopConsumer() {
+ running = false;
+ }
+
+ public abstract void processMsg(String msg) throws Exception;
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerMain.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerMain.java
new file mode 100644
index 000000000..10bffe44c
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerMain.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt mountpoint-registrar
+ * =================================================================================================
+ * 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.mountpointregistrar.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DMaaPVESMsgConsumerMain implements Runnable {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DMaaPVESMsgConsumerMain.class);
+
+ boolean threadsRunning = false;
+ static List<DMaaPVESMsgConsumer> consumers = new LinkedList<>();
+ public GeneralConfig config;
+ public PNFRegistrationConfig pnfRegistrationConfig;
+ public FaultConfig faultConfig;
+
+ public DMaaPVESMsgConsumerMain(Map<String, Configuration> configMap) {
+ configMap.forEach((k, v) -> initialize(k, v));
+ }
+
+ public void initialize(String domain, Configuration domainConfig) {
+ LOG.debug("In initialize method : Domain = {} and domainConfig = {}",domain,domainConfig);
+ String consumerClass = null;
+ Properties consumerProperties = new Properties();
+ if (domain.equalsIgnoreCase("pnfregistration")) {
+ this.pnfRegistrationConfig = (PNFRegistrationConfig) domainConfig;
+
+ consumerClass = pnfRegistrationConfig.getConsumerClass();
+ LOG.debug("Consumer class = "+consumerClass);
+
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_TRANSPORTTYPE, pnfRegistrationConfig.getTransportType());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_HOST_PORT, pnfRegistrationConfig.getHostPort());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CONTENTTYPE, pnfRegistrationConfig.getContenttype());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_GROUP, pnfRegistrationConfig.getConsumerGroup());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_ID, pnfRegistrationConfig.getConsumerId());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_TOPIC, pnfRegistrationConfig.getTopic());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_TIMEOUT, pnfRegistrationConfig.getTimeout());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_LIMIT, pnfRegistrationConfig.getLimit());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_FETCHPAUSE, pnfRegistrationConfig.getFetchPause());
+ } else if (domain.equalsIgnoreCase("fault")) {
+ this.faultConfig = (FaultConfig) domainConfig;
+ consumerClass = faultConfig.getConsumerClass();
+ LOG.debug("Consumer class = {}",consumerClass);
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_TRANSPORTTYPE, faultConfig.getTransportType());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_HOST_PORT, faultConfig.getHostPort());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CONTENTTYPE, faultConfig.getContenttype());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_GROUP, faultConfig.getConsumerGroup());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_ID, faultConfig.getConsumerId());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_TOPIC, faultConfig.getTopic());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_TIMEOUT, faultConfig.getTimeout());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_LIMIT, faultConfig.getLimit());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_FETCHPAUSE, faultConfig.getFetchPause());
+ }
+
+ if (consumerClass != null) {
+ LOG.info("Calling createConsumer : {}",consumerClass);
+ threadsRunning = createConsumer(consumerClass, consumerProperties);
+ }
+
+ }
+
+ private static boolean updateThreadState(List<DMaaPVESMsgConsumer> consumers) {
+ boolean threadsRunning = false;
+ for (DMaaPVESMsgConsumer consumer : consumers) {
+ if (consumer.isRunning()) {
+ threadsRunning = true;
+ }
+ }
+ return threadsRunning;
+ }
+
+ static boolean createConsumer(String consumerClassName, Properties properties) {
+ Class<?> consumerClass = null;
+
+ try {
+ consumerClass = Class.forName(consumerClassName);
+ } catch (Exception e) {
+ LOG.error("Could not find DMaap VES Message consumer class {}", consumerClassName, e);
+ }
+
+ if (consumerClass != null) {
+ LOG.debug("Calling handleConsumerClass");
+ handleConsumerClass(consumerClass, consumerClassName, properties, consumers);
+ }
+ return !consumers.isEmpty();
+ }
+
+ private static boolean handleConsumerClass(Class<?> consumerClass, String consumerClassName, Properties properties, List<DMaaPVESMsgConsumer> consumers) {
+ DMaaPVESMsgConsumer consumer = null;
+
+ try {
+ consumer = (DMaaPVESMsgConsumer) consumerClass.newInstance();
+ LOG.debug("Successfully created an instance of consumerClass : {}",consumerClassName);
+ } catch (Exception e) {
+ LOG.error("Could not create consumer from class {}",consumerClassName, e);
+ }
+
+ if (consumer != null) {
+ LOG.info("Initializing consumer {}({})", consumerClassName, properties);
+ consumer.init(properties);
+
+ if (consumer.isReady()) {
+ Thread consumerThread = new Thread(consumer);
+ consumerThread.start();
+ consumers.add(consumer);
+
+ LOG.info("Started consumer thread ({} : {})", consumerClassName,
+ properties);
+ return true;
+ } else {
+ LOG.debug("Consumer {} is not ready", consumerClassName);
+ }
+ }
+ return false;
+ }
+
+ public void run() {
+ while (threadsRunning) {
+ threadsRunning = updateThreadState(consumers);
+ if (!threadsRunning) {
+ break;
+ }
+
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ LOG.error(e.getLocalizedMessage(), e);
+ }
+ }
+
+ LOG.info("No listener threads running - exiting");
+ }
+
+ public static List<DMaaPVESMsgConsumer> getConsumers() {
+ return consumers;
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultConfig.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultConfig.java
new file mode 100644
index 000000000..b04ba315b
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultConfig.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.impl;
+
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+
+public class FaultConfig implements Configuration {
+ private static final String SECTION_MARKER = "fault";
+
+ private static final String PROPERTY_KEY_CONSUMER_CLASS = "faultConsumerClass";
+ private static final String DEFAULT_VALUE_CONSUMER_CLASS = "org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer";
+
+ public static final String PROPERTY_KEY_CONSUMER_TRANSPORTTYPE = "TransportType";
+ private static final String DEFAULT_VALUE_CONSUMER_TRANSPORTTYPE = "HTTPNOAUTH";
+
+ public static final String PROPERTY_KEY_CONSUMER_HOST_PORT = "host";
+ private static final String DEFAULT_VALUE_CONSUMER_HOST_PORT = "onap-dmap:3904";
+
+ public static final String PROPERTY_KEY_CONSUMER_TOPIC = "topic";
+ private static final String DEFAULT_VALUE_CONSUMER_TOPIC = "unauthenticated.SEC_FAULT_OUTPUT";
+
+ public static final String PROPERTY_KEY_CONSUMER_CONTENTTYPE = "contenttype";
+ private static final String DEFAULT_VALUE_CONSUMER_CONTENTTYPE = "application/json";
+
+ public static final String PROPERTY_KEY_CONSUMER_GROUP = "group";
+ private static final String DEFAULT_VALUE_CONSUMER_GROUP = "myG";
+
+ public static final String PROPERTY_KEY_CONSUMER_ID = "id";
+ private static final String DEFAULT_VALUE_CONSUMER_ID = "C1";
+
+ public static final String PROPERTY_KEY_CONSUMER_TIMEOUT = "timeout";
+ private static final String DEFAULT_VALUE_CONSUMER_TIMEOUT = "20000";
+
+ public static final String PROPERTY_KEY_CONSUMER_LIMIT = "limit";
+ private static final String DEFAULT_VALUE_CONSUMER_LIMIT = "10000";
+
+ public static final String PROPERTY_KEY_CONSUMER_FETCHPAUSE = "fetchPause";
+ private static final String DEFAULT_VALUE_CONSUMER_FETCHPAUSE = "5000";
+
+ private final ConfigurationFileRepresentation configuration;
+
+ public FaultConfig(ConfigurationFileRepresentation configuration) {
+ this.configuration = configuration;
+ this.configuration.addSection(SECTION_MARKER);
+ defaults();
+ }
+
+ @Override
+ public String getSectionName() {
+ return SECTION_MARKER;
+ }
+
+ @Override
+ public void defaults() {
+
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLASS, DEFAULT_VALUE_CONSUMER_CLASS);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TRANSPORTTYPE, DEFAULT_VALUE_CONSUMER_TRANSPORTTYPE);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_HOST_PORT, DEFAULT_VALUE_CONSUMER_HOST_PORT);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TOPIC, DEFAULT_VALUE_CONSUMER_TOPIC);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CONTENTTYPE, DEFAULT_VALUE_CONSUMER_CONTENTTYPE);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_GROUP, DEFAULT_VALUE_CONSUMER_GROUP);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_ID, DEFAULT_VALUE_CONSUMER_ID);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TIMEOUT, DEFAULT_VALUE_CONSUMER_TIMEOUT);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_LIMIT, DEFAULT_VALUE_CONSUMER_LIMIT);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_FETCHPAUSE, DEFAULT_VALUE_CONSUMER_FETCHPAUSE);
+
+ }
+
+ public String getConsumerClass() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLASS);
+ }
+
+ public String getHostPort() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_HOST_PORT);
+ }
+
+ public String getTransportType() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TRANSPORTTYPE);
+ }
+
+ public String getTopic() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TOPIC);
+ }
+
+ public String getConsumerGroup() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_GROUP);
+ }
+
+ public String getConsumerId() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_ID);
+ }
+
+ public String getTimeout() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TIMEOUT);
+ }
+
+ public String getLimit() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_LIMIT);
+ }
+
+ public String getFetchPause() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_FETCHPAUSE);
+ }
+
+ public String getContenttype() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CONTENTTYPE);
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultNotificationClient.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultNotificationClient.java
new file mode 100644
index 000000000..76137674a
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultNotificationClient.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.impl;
+
+import java.io.IOException;
+import java.util.Base64;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPClient;
+import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FaultNotificationClient extends BaseHTTPClient {
+
+ private static final Logger LOG = LoggerFactory.getLogger(FaultNotificationClient.class);
+ private static final String FAULT_NOTIFICATION_URI = "restconf/operations/devicemanager:push-fault-notification";
+ private final Map<String, String> headerMap;
+
+ private static final String FAULT_PAYLOAD = "{\n" +
+ " \"devicemanager:input\": {\n" +
+ " \"devicemanager:node-id\": \"@node-id@\",\n" +
+ " \"devicemanager:counter\": \"@counter@\",\n" +
+ " \"devicemanager:timestamp\": \"@timestamp@\",\n" +
+ " \"devicemanager:object-id\": \"@object-id@\",\n" +
+ " \"devicemanager:problem\": \"@problem@\",\n" +
+ " \"devicemanager:severity\": \"@severity@\"\n" +
+ " }\n" +
+ "}";
+
+ public FaultNotificationClient(String baseUrl) {
+ super(baseUrl);
+
+ this.headerMap = new HashMap<>();
+ this.headerMap.put("Content-Type", "application/json");
+ this.headerMap.put("Accept", "application/json");
+ }
+
+ public void setAuthorization(String username, String password) {
+ String credentials = username + ":" + password;
+ this.headerMap.put("Authorization",
+ "Basic " + new String(Base64.getEncoder().encode(credentials.getBytes())));
+
+ }
+
+ public boolean sendFaultNotification(String faultNodeId, String faultCounter, String faultOccurrenceTime, String faultObjectId,
+ String faultReason, String faultSeverity) {
+ String message = "";
+
+ message = updateFaultPayload(faultNodeId, faultCounter, faultOccurrenceTime, faultObjectId, faultReason, faultSeverity);
+
+ LOG.debug("Payload after updating values is: "+message);
+
+ return sendFaultRequest("POST", message) == 200;
+
+ }
+
+ private static String updateFaultPayload(String faultNodeId, String faultCounter, String faultOccurrenceTime, String faultObjectId,
+ String faultReason, String faultSeverity) {
+ return FAULT_PAYLOAD.replace("@node-id@", faultNodeId)
+ .replace("@counter@", faultCounter)
+ .replace("@timestamp@", faultOccurrenceTime)
+ .replace("@object-id@", faultObjectId)
+ .replace("@problem@", faultReason)
+ .replace("@severity@", faultSeverity);
+ }
+
+
+ private int sendFaultRequest(String method, String message) {
+ LOG.debug("In sendFaultRequest - "+method+ " "+message);
+ BaseHTTPResponse response;
+ try {
+ String uri = FAULT_NOTIFICATION_URI;
+ response = this.sendRequest(uri, method, message, headerMap);
+ LOG.debug("finished with responsecode {}", response.code);
+ return response.code;
+ } catch (IOException e) {
+ LOG.warn("problem sending fault message {} : {}", e.getMessage());
+ return -1;
+ }
+ }
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/GeneralConfig.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/GeneralConfig.java
new file mode 100644
index 000000000..39d688ba2
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/GeneralConfig.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.impl;
+
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+
+/**
+ * Configuration of mountpoint-registrar, general section<br>
+ * - dmaapEnabled : Boolean disable/enable service depending on whether DMaaP is running or not
+ * Generates default Configuration properties if none exist or exist partially
+ * Generates Consumer properties only for TransportType=HTTPNOAUTH. Other TransportTypes like HTTP, AUTH_KEY and DME2 have additional properties and are not
+ * generated by default. For a list of applicable properties for the different TranportType values, please see - https://wiki.onap.org/display/DW/Feature+configuration+requirements
+ */
+public class GeneralConfig implements Configuration {
+
+ private static final String SECTION_MARKER = "general";
+
+ private static final String PROPERTY_KEY_ENABLED = "dmaapEnabled" ; //"enabled";
+
+ private static final String PROPERTY_KEY_USER = "sdnrUser";
+ private static final String DEFAULT_VALUE_USER = "admin";
+
+ private static final String PROPERTY_KEY_USERPASSWD = "sdnrPasswd";
+ private static final String DEFAULT_VALUE_USERPASSWD = "admin";
+
+ private static final String PROPERTY_KEY_BASEURL = "baseUrl";
+ private static final String DEFAULT_VALUE_BASEURL = "http://localhost:8181";
+
+
+ private static ConfigurationFileRepresentation configuration;
+
+ public GeneralConfig(ConfigurationFileRepresentation configuration) {
+ GeneralConfig.configuration = configuration;
+ GeneralConfig.configuration.addSection(SECTION_MARKER);
+ defaults();
+ }
+
+ public Boolean getEnabled() {
+ Boolean enabled = configuration.getPropertyBoolean(SECTION_MARKER, PROPERTY_KEY_ENABLED);
+ return enabled;
+ }
+
+ public static String getBaseUrl() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_BASEURL);
+ }
+
+ public static String getSDNRUser() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_USER);
+ }
+
+ public static String getSDNRPasswd() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_USERPASSWD);
+ }
+
+ @Override
+ public String getSectionName() {
+ return SECTION_MARKER;
+ }
+
+ @Override
+ public void defaults() {
+ // The default value should be "false" given that SDNR can be run in environments where DMaaP is not used
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_ENABLED, Boolean.FALSE);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_BASEURL, DEFAULT_VALUE_BASEURL);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_USER, DEFAULT_VALUE_USER);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_USERPASSWD, DEFAULT_VALUE_USERPASSWD);
+ }
+
+
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/MountpointRegistrarImpl.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/MountpointRegistrarImpl.java
new file mode 100644
index 000000000..f10cb1af7
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/MountpointRegistrarImpl.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.MountPointService;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("deprecation")
+public class MountpointRegistrarImpl implements AutoCloseable, IConfigChangedListener {
+
+ private static final Logger LOG = LoggerFactory.getLogger(MountpointRegistrarImpl.class);
+ private static final String APPLICATION_NAME = "mountpoint-registrar";
+ private static final String CONFIGURATIONFILE = "etc/mountpoint-registrar.properties";
+
+ private Thread dmaapVESMsgConsumerMain = null;
+ @SuppressWarnings("unused")
+ private DataBroker dataBroker = null;
+ @SuppressWarnings("unused")
+ private MountPointService mountPointService = null;
+ @SuppressWarnings("unused")
+ private RpcProviderRegistry rpcProviderRegistry = null;
+ @SuppressWarnings("unused")
+ private NotificationPublishService notificationPublishService = null;
+ @SuppressWarnings("unused")
+ private ClusterSingletonServiceProvider clusterSingletonServiceProvider;
+
+ private GeneralConfig generalConfig;
+ private boolean dmaapEnabled = false;
+ Map<String, Configuration> configMap = new HashMap<>();
+
+ // Blueprint 1
+ public MountpointRegistrarImpl() {
+ LOG.info("Creating provider class for {}", APPLICATION_NAME);
+ }
+
+ public void setDataBroker(DataBroker dataBroker) {
+ this.dataBroker = dataBroker;
+ }
+
+ public void setRpcProviderRegistry(RpcProviderRegistry rpcProviderRegistry) {
+ this.rpcProviderRegistry = rpcProviderRegistry;
+ }
+
+ public void setNotificationPublishService(NotificationPublishService notificationPublishService) {
+ this.notificationPublishService = notificationPublishService;
+ }
+
+ public void setMountPointService(MountPointService mountPointService) {
+ this.mountPointService = mountPointService;
+ }
+
+ public void setClusterSingletonService(ClusterSingletonServiceProvider clusterSingletonService) {
+ this.clusterSingletonServiceProvider = clusterSingletonService;
+ }
+
+ public void init() {
+ LOG.info("Init call for {}", APPLICATION_NAME);
+
+ ConfigurationFileRepresentation configFileRepresentation = new ConfigurationFileRepresentation(CONFIGURATIONFILE);
+ configFileRepresentation.registerConfigChangedListener(this);
+
+ generalConfig = new GeneralConfig(configFileRepresentation);
+ PNFRegistrationConfig pnfRegConfig = new PNFRegistrationConfig(configFileRepresentation);
+ FaultConfig faultConfig = new FaultConfig(configFileRepresentation);
+
+ configMap.put("pnfRegistration", pnfRegConfig);
+ configMap.put("fault", faultConfig);
+
+ dmaapEnabled = generalConfig.getEnabled();
+ if (dmaapEnabled) { // start dmaap consumer thread only if dmaapEnabled=true
+ LOG.info("DMaaP seems to be enabled, starting consumer(s)");
+ dmaapVESMsgConsumerMain = new Thread(new DMaaPVESMsgConsumerMain(configMap));
+ dmaapVESMsgConsumerMain.start();
+ } else {
+ LOG.info("DMaaP seems to be disabled, not starting any consumer(s)");
+ }
+ }
+
+ /**
+ * Reflect status for Unit Tests
+ * @return Text with status
+ */
+ public String isInitializationOk() {
+ return "No implemented";
+ }
+
+ @Override
+ public void onConfigChanged() {
+ LOG.info("Service configuration state changed. Enabled: {}", generalConfig.getEnabled());
+ boolean dmaapEnabledNewVal = generalConfig.getEnabled();
+ if (!dmaapEnabled && dmaapEnabledNewVal) { // Dmaap disabled earlier (or during bundle startup) but enabled later, start Consumer(s)
+ LOG.info("DMaaP is enabled, starting consumer(s)");
+ dmaapVESMsgConsumerMain = new Thread(new DMaaPVESMsgConsumerMain(configMap));
+ dmaapVESMsgConsumerMain.start();
+ } else if (dmaapEnabled && !dmaapEnabledNewVal) { // Dmaap enabled earlier (or during bundle startup) but disabled later, stop consumer(s)
+ LOG.info("DMaaP is disabled, stopping consumer(s)");
+ List<DMaaPVESMsgConsumer> consumers = DMaaPVESMsgConsumerMain.getConsumers();
+ for (DMaaPVESMsgConsumer consumer : consumers) {
+ // stop all consumers
+ consumer.stopConsumer();
+ }
+ }
+ dmaapEnabled = dmaapEnabledNewVal;
+ }
+
+ @Override
+ public void close() throws Exception {
+ LOG.info("{} closing ...", this.getClass().getName());
+ //close(updateService, configService, mwtnService); issue#1
+ //close(updateService, mwtnService);
+ LOG.info("{} closing done",APPLICATION_NAME);
+ }
+
+ /**
+ * Used to close all Services, that should support AutoCloseable Pattern
+ *
+ * @param toClose
+ * @throws Exception
+ */
+ @SuppressWarnings("unused")
+ private void close(AutoCloseable... toCloseList) throws Exception {
+ for (AutoCloseable element : toCloseList) {
+ if (element != null) {
+ element.close();
+ }
+ }
+ }
+
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFMountPointClient.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFMountPointClient.java
new file mode 100644
index 000000000..ace1c0a39
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFMountPointClient.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.impl;
+
+import java.io.IOException;
+import java.util.Base64;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPClient;
+import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PNFMountPointClient extends BaseHTTPClient {
+
+ private static final Logger LOG = LoggerFactory.getLogger(PNFMountPointClient.class);
+ private static final String MOUNTPOINT_URI = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/";
+ private final Map<String, String> headerMap;
+ private static final String SSH_PAYLOAD = "<node xmlns=\"urn:TBD:params:xml:ns:yang:network-topology\">\n" +
+ " <node-id>@device-name@</node-id>\n" +
+ " <host xmlns=\"urn:opendaylight:netconf-node-topology\">@device-ip@</host>\n" +
+ " <port xmlns=\"urn:opendaylight:netconf-node-topology\">@device-port@</port>\n" +
+ " <username xmlns=\"urn:opendaylight:netconf-node-topology\">@username@</username>\n" +
+ " <password xmlns=\"urn:opendaylight:netconf-node-topology\">@password@</password>\n" +
+ " <tcp-only xmlns=\"urn:opendaylight:netconf-node-topology\">false</tcp-only>\n" +
+ " <!-- non-mandatory fields with default values, you can safely remove these if you do not wish to override any of these values-->\n" +
+ " <reconnect-on-changed-schema xmlns=\"urn:opendaylight:netconf-node-topology\">false</reconnect-on-changed-schema>\n" +
+ " <connection-timeout-millis xmlns=\"urn:opendaylight:netconf-node-topology\">20000</connection-timeout-millis>\n" +
+ " <max-connection-attempts xmlns=\"urn:opendaylight:netconf-node-topology\">0</max-connection-attempts>\n" +
+ " <between-attempts-timeout-millis xmlns=\"urn:opendaylight:netconf-node-topology\">2000</between-attempts-timeout-millis>\n" +
+ " <sleep-factor xmlns=\"urn:opendaylight:netconf-node-topology\">1.5</sleep-factor>\n" +
+ " <!-- keepalive-delay set to 0 turns off keepalives-->\n" +
+ " <keepalive-delay xmlns=\"urn:opendaylight:netconf-node-topology\">120</keepalive-delay>\n" +
+ "</node>";
+ private static final String TLS_PAYLOAD = "<node xmlns=\"urn:TBD:params:xml:ns:yang:network-topology\">\n" +
+ " <node-id>@device-name@</node-id>\n" +
+ " <host xmlns=\"urn:opendaylight:netconf-node-topology\">@device-ip@</host>\n" +
+ " <port xmlns=\"urn:opendaylight:netconf-node-topology\">@device-port@</port>\n" +
+ " <key-based xmlns=\"urn:opendaylight:netconf-node-topology\">\n" +
+ " <username xmlns=\"urn:opendaylight:netconf-node-topology\">@username@</username>\n" +
+ " <key-id>@key-id@</key-id>\n" +
+ " </key-based>\n" +
+ " <tcp-only xmlns=\"urn:opendaylight:netconf-node-topology\">false</tcp-only>\n" +
+ " <protocol xmlns=\"urn:opendaylight:netconf-node-topology\">\n" +
+ " <name>TLS</name>\n" +
+ " </protocol>\n" +
+ " <!-- non-mandatory fields with default values, you can safely remove these if you do not wish to override any of these values-->\n" +
+ " <reconnect-on-changed-schema xmlns=\"urn:opendaylight:netconf-node-topology\">false</reconnect-on-changed-schema>\n" +
+ " <connection-timeout-millis xmlns=\"urn:opendaylight:netconf-node-topology\">20000</connection-timeout-millis>\n" +
+ " <max-connection-attempts xmlns=\"urn:opendaylight:netconf-node-topology\">0</max-connection-attempts>\n" +
+ " <between-attempts-timeout-millis xmlns=\"urn:opendaylight:netconf-node-topology\">2000</between-attempts-timeout-millis>\n" +
+ " <sleep-factor xmlns=\"urn:opendaylight:netconf-node-topology\">1.5</sleep-factor>\n" +
+ " <!-- keepalive-delay set to 0 turns off keepalives-->\n" +
+ " <keepalive-delay xmlns=\"urn:opendaylight:netconf-node-topology\">120</keepalive-delay>\n" +
+ "</node>";
+
+ public PNFMountPointClient(String baseUrl) {
+ super(baseUrl);
+
+ this.headerMap = new HashMap<>();
+ this.headerMap.put("Content-Type", "application/xml");
+ this.headerMap.put("Accept", "application/xml");
+ }
+
+ public void setAuthorization(String username, String password) {
+ String credentials = username + ":" + password;
+ this.headerMap.put("Authorization",
+ "Basic " + new String(Base64.getEncoder().encode(credentials.getBytes())));
+
+ }
+
+ public boolean pnfMountPointCreate(String pnfName, String ipv4Address, String protocol, String keyId, String username, String password, String commPort) {
+ String message = "";
+ if (protocol.equals("TLS")) {
+ message = updateTLSPayload(pnfName, ipv4Address, username, keyId, commPort);
+ } else { //SSH
+ message = updatePayload(pnfName, ipv4Address, username, password, commPort);
+ LOG.debug("Payload after updating values is: {}",message);
+ }
+ return pnfRequest(pnfName, "PUT", message) == 200;
+
+ }
+
+ private static String updatePayload(String pnfName, String ipv4Address, String username, String password, String portNo) {
+ return SSH_PAYLOAD.replace("@device-name@", pnfName)
+ .replace("@device-ip@", ipv4Address)
+ .replace("@device-port@", portNo)
+ .replace("@username@", username)
+ .replace("@password@", password);
+ }
+
+ private static String updateTLSPayload(String pnfName, String ipv4Address, String username, String keyId, String portNo) {
+ return TLS_PAYLOAD.replace("@device-name@", pnfName)
+ .replace("@device-ip@", ipv4Address)
+ .replace("@username@", username)
+ .replace("@key-id@", keyId)
+ .replace("@device-port@", portNo);
+ }
+
+ private int pnfRequest(String pnfName, String method, String message) {
+ LOG.info("In pnfRequest - {} : {} : {}",pnfName,method,message);
+ BaseHTTPResponse response;
+ try {
+ //String uri = "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/" + pnfName;
+ String uri = MOUNTPOINT_URI + pnfName;
+ response = this.sendRequest(uri, method, message, headerMap);
+ LOG.debug("finished with responsecode {}", response.code);
+ return response.code;
+ } catch (IOException e) {
+ LOG.warn("problem registering {} : {}", pnfName, e.getMessage());
+ return -1;
+ }
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFRegistrationConfig.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFRegistrationConfig.java
new file mode 100644
index 000000000..8a3ded50d
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFRegistrationConfig.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.impl;
+
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+
+public class PNFRegistrationConfig implements Configuration {
+ private static final String SECTION_MARKER = "pnfRegistration";
+
+ private static final String PROPERTY_KEY_CONSUMER_CLASS = "pnfRegConsumerClass";
+ private static final String DEFAULT_VALUE_CONSUMER_CLASS = "org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer";
+
+ public static final String PROPERTY_KEY_CONSUMER_TRANSPORTTYPE = "TransportType";
+ private static final String DEFAULT_VALUE_CONSUMER_TRANSPORTTYPE = "HTTPNOAUTH";
+
+ public static final String PROPERTY_KEY_CONSUMER_HOST_PORT = "host";
+ private static final String DEFAULT_VALUE_CONSUMER_HOST_PORT = "onap-dmap:3904";
+
+ public static final String PROPERTY_KEY_CONSUMER_TOPIC = "topic";
+ private static final String DEFAULT_VALUE_CONSUMER_TOPIC = "unauthenticated.VES_PNFREG_OUTPUT";
+
+ public static final String PROPERTY_KEY_CONSUMER_CONTENTTYPE = "contenttype";
+ private static final String DEFAULT_VALUE_CONSUMER_CONTENTTYPE = "application/json";
+
+ public static final String PROPERTY_KEY_CONSUMER_GROUP = "group";
+ private static final String DEFAULT_VALUE_CONSUMER_GROUP = "myG";
+
+ public static final String PROPERTY_KEY_CONSUMER_ID = "id";
+ private static final String DEFAULT_VALUE_CONSUMER_ID = "C1";
+
+ public static final String PROPERTY_KEY_CONSUMER_TIMEOUT = "timeout";
+ private static final String DEFAULT_VALUE_CONSUMER_TIMEOUT = "20000";
+
+ public static final String PROPERTY_KEY_CONSUMER_LIMIT = "limit";
+ private static final String DEFAULT_VALUE_CONSUMER_LIMIT = "10000";
+
+ public static final String PROPERTY_KEY_CONSUMER_FETCHPAUSE = "fetchPause";
+ private static final String DEFAULT_VALUE_CONSUMER_FETCHPAUSE = "5000";
+
+ private final ConfigurationFileRepresentation configuration;
+
+ public PNFRegistrationConfig(ConfigurationFileRepresentation configuration) {
+ this.configuration = configuration;
+ this.configuration.addSection(SECTION_MARKER);
+ defaults();
+ }
+ @Override
+ public String getSectionName() {
+ return SECTION_MARKER;
+ }
+
+ @Override
+ public void defaults() {
+
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLASS, DEFAULT_VALUE_CONSUMER_CLASS);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TRANSPORTTYPE, DEFAULT_VALUE_CONSUMER_TRANSPORTTYPE);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_HOST_PORT, DEFAULT_VALUE_CONSUMER_HOST_PORT);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TOPIC, DEFAULT_VALUE_CONSUMER_TOPIC);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CONTENTTYPE, DEFAULT_VALUE_CONSUMER_CONTENTTYPE);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_GROUP, DEFAULT_VALUE_CONSUMER_GROUP);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_ID, DEFAULT_VALUE_CONSUMER_ID);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TIMEOUT, DEFAULT_VALUE_CONSUMER_TIMEOUT);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_LIMIT, DEFAULT_VALUE_CONSUMER_LIMIT);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_FETCHPAUSE, DEFAULT_VALUE_CONSUMER_FETCHPAUSE);
+
+ }
+
+ public String getConsumerClass() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLASS);
+ }
+
+ public String getHostPort() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_HOST_PORT);
+ }
+
+ public String getTransportType() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TRANSPORTTYPE);
+ }
+
+ public String getTopic() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TOPIC);
+ }
+
+ public String getConsumerGroup() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_GROUP);
+ }
+
+ public String getConsumerId() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_ID);
+ }
+
+ public String getTimeout() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TIMEOUT);
+ }
+
+ public String getLimit() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_LIMIT);
+ }
+
+ public String getFetchPause() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_FETCHPAUSE);
+ }
+
+ public String getContenttype() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CONTENTTYPE);
+ }
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/mountpoint-registrar/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
new file mode 100644
index 000000000..d89f922f3
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+============LICENSE_START=======================================================
+ONAP : ccsdk feature sdnr wt devicemanager
+ ================================================================================
+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:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" odl:use-default-for-reference-types="true">
+
+ <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
+
+ <reference id="notificationPublishService"
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
+
+ <reference id="mountPointService"
+ interface="org.opendaylight.controller.md.sal.binding.api.MountPointService"
+ odl:type="default" />
+
+ <reference id="rpcProviderRegistry" interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
+
+ <reference id="clusterSingletonService"
+ interface="org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider"/>
+
+ <bean id="provider" class="org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.MountpointRegistrarImpl" init-method="init" destroy-method="close">
+ <property name="dataBroker" ref="dataBroker"/>
+ <property name="rpcProviderRegistry" ref="rpcProviderRegistry" />
+ <property name="notificationPublishService" ref="notificationPublishService" />
+ <property name="mountPointService" ref="mountPointService" />
+ <property name="clusterSingletonService" ref="clusterSingletonService" />
+ </bean>
+
+
+</blueprint>
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/resources/version.properties b/sdnr/wt/mountpoint-registrar/provider/src/main/resources/version.properties
new file mode 100644
index 000000000..80373399e
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/resources/version.properties
@@ -0,0 +1,3 @@
+# Proberties filled in by maven during build process
+version = ${project.version}
+build = ${buildtime}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java
new file mode 100644
index 000000000..2bc41490d
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFRegistrationConfig;
+
+import com.google.common.io.Files;
+
+public class PNFRegistrationConfigTest {
+
+ private static final String TESTCONFIG_CONTENT="[pnfRegistration]\n" +
+ "pnfRegConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer\n" +
+ "TransportType=HTTPNOAUTH\n" +
+ "host=onap-dmap:3904\n" +
+ "topic=unauthenticated.VES_PNFREG_OUTPUT\n" +
+ "contenttype=application/json\n" +
+ "group=myG\n" +
+ "id=C1\n" +
+ "timeout=20000\n" +
+ "limit=10000\n" +
+ "fetchPause=5000\n" +
+ "";
+
+ private ConfigurationFileRepresentation cfg;
+
+ @Test
+ public void test() {
+ try {
+ Files.asCharSink(new File("test.properties"), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT);
+ cfg = new ConfigurationFileRepresentation("test.properties");
+ PNFRegistrationConfig pnfCfg = new PNFRegistrationConfig(cfg);
+ assertEquals("pnfRegistration", pnfCfg.getSectionName());
+ assertEquals("org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer", pnfCfg.getConsumerClass());
+ assertEquals("HTTPNOAUTH", pnfCfg.getTransportType());
+ assertEquals("onap-dmap:3904", pnfCfg.getHostPort());
+ assertEquals("unauthenticated.VES_PNFREG_OUTPUT", pnfCfg.getTopic());
+ assertEquals("application/json", pnfCfg.getContenttype());
+ assertEquals("myG", pnfCfg.getConsumerGroup());
+ assertEquals("C1", pnfCfg.getConsumerId());
+ assertEquals("20000", pnfCfg.getTimeout());
+ assertEquals("10000", pnfCfg.getLimit());
+ assertEquals("5000", pnfCfg.getFetchPause());
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ }
+
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java
new file mode 100644
index 000000000..cdc641f10
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultNotificationClient;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFMountPointClient;
+
+public class TestDMaaPFaultVESMsgConsumer extends DMaaPFaultVESMsgConsumer {
+
+ private static final String DEFAULT_SDNRUSER = "admin";
+ private static final String DEFAULT_SDNRPASSWD = "admin";
+ private static final String DEFAULT_SDNRBASEURL = "http://localhost:8181";
+
+ private static final String faultVESMsg = ""
+ + "{\"event\":"
+ + " {\"commonEventHeader\":"
+ + " { \"domain\":\"fault\","
+ + " \"eventId\":\"1e9a28bcd119_50007_2019-11-20T14:59:47.3Z\","
+ + " \"eventName\":\"fault_O_RAN_COMPONENT_Alarms\","
+ + " \"eventType\":\"O_RAN_COMPONENT_Alarms\","
+ + " \"sequence\":1,"
+ + " \"priority\":\"Low\","
+ + " \"reportingEntityId\":\"\","
+ + " \"reportingEntityName\":\"1e9a28bcd119_50007\","
+ + " \"sourceId\":\"\","
+ + " \"sourceName\":\"1e9a28bcd119_50007\","
+ + " \"startEpochMicrosec\":94801033822670,"
+ + " \"lastEpochMicrosec\":94801033822670,"
+ + " \"nfNamingCode\":\"sdn controller\","
+ + " \"nfVendorName\":\"sdn\","
+ + " \"timeZoneOffset\":\"+00:00\","
+ + " \"version\":\"4.0.1\","
+ + " \"vesEventListenerVersion\":\"7.0.1\""
+ + " },"
+ + " \"faultFields\":"
+ + " {"
+ + " \"faultFieldsVersion\":\"4.0\","
+ + " \"alarmCondition\":\"8\","
+ + " \"alarmInterfaceA\":\"dkom32\","
+ + " \"eventSourceType\":\"O_RAN_COMPONENT\","
+ + " \"specificProblem\":\"dsonj32 don32 mdson32pk654\","
+ + " \"eventSeverity\":\"@eventSeverity@\","
+ + " \"vfStatus\":\"Active\","
+ + " \"alarmAdditionalInformation\":"
+ + " {"
+ + " \"eventTime\":\"2019-11-20T14:59:47.3Z\","
+ + " \"equipType\":\"O-RAN-sim\","
+ + " \"vendor\":\"Melacon\","
+ + " \"model\":\"Simulated Device\""
+ + " }"
+ + " }"
+ + " }"
+ + "}";
+
+ private static final String faultVESMsg_Incomplete = ""
+ + "{\"event\":"
+ + " {\"commonEventHeader\":"
+ + " { \"domain\":\"fault\","
+ + " \"eventId\":\"1e9a28bcd119_50007_2019-11-20T14:59:47.3Z\","
+ + " \"eventName\":\"fault_O_RAN_COMPONENT_Alarms\","
+ + " \"eventType\":\"O_RAN_COMPONENT_Alarms\","
+ + " \"sequence\":1,"
+ + " \"priority\":\"Low\","
+ + " \"reportingEntityId\":\"\","
+ + " \"reportingEntityName\":\"1e9a28bcd119_50007\","
+ + " \"sourceId\":\"\","
+ + " \"sourceName\":\"1e9a28bcd119_50007\","
+ + " \"startEpochMicrosec\":94801033822670,"
+ + " \"lastEpochMicrosec\":94801033822670,"
+ + " \"nfNamingCode\":\"sdn controller\","
+ + " \"nfVendorName\":\"sdn\","
+ + " \"timeZoneOffset\":\"+00:00\","
+ + " \"version\":\"4.0.1\","
+ + " \"vesEventListenerVersion\":\"7.0.1\","
+ + " },"
+ + " \"faultFields\":"
+ + " {"
+ + " \"faultFieldsVersion\":\"4.0\","
+ + " \"alarmCondition\":\"8\","
+ + " \"alarmInterfaceA\":\"dkom32\","
+ + " \"eventSourceType\":\"O_RAN_COMPONENT\","
+ + " \"specificProblem\":\"dsonj32 don32 mdson32pk654\","
+ + " \"eventSeverity\":\"CRITICAL\","
+ + " \"vfStatus\":\"Active\","
+ + " \"alarmAdditionalInformation\":"
+ + " {"
+ + " \"eventTime\":\"2019-11-20T14:59:47.3Z\","
+ + " \"equipType\":\"O-RAN-sim\","
+ + " \"vendor\":\"Melacon\","
+ + " \"model\":\"Simulated Device\""
+ + " }"
+ + " }"
+ + " }"
+ + "}";
+ @Test
+ public void test() {
+ DMaaPFaultVESMsgConsumer faultMsgConsumer = new TestDMaaPFaultVESMsgConsumer();
+ try {
+
+ faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "CRITICAL"));
+ faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "Major"));
+ faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "minor"));
+ faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "NonAlarmed"));
+ faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "warning"));
+ faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "Unknown"));
+ faultMsgConsumer.processMsg(faultVESMsg_Incomplete);
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println("Exception while processing Fault Message - "+e.getMessage());
+ }
+ }
+
+ @Override
+ public FaultNotificationClient getFaultNotificationClient(String baseUrl) {
+ return new TestFaultNotificationClient();
+ }
+
+ @Override
+ public String getSDNRUser() {
+ return DEFAULT_SDNRUSER;
+ }
+
+ @Override
+ public String getSDNRPasswd() {
+ return DEFAULT_SDNRPASSWD;
+ }
+
+ @Override
+ public String getBaseUrl() {
+ return DEFAULT_SDNRBASEURL;
+ }
+
+ @Test
+ public void Test1() {
+ TestGeneralConfig cfgTest = new TestGeneralConfig();
+ cfgTest.test();
+ DMaaPFaultVESMsgConsumer faultConsumer = new DMaaPFaultVESMsgConsumer();
+ System.out.println(faultConsumer.getBaseUrl());
+ System.out.println(faultConsumer.getSDNRUser());
+ System.out.println(faultConsumer.getSDNRPasswd());
+ }
+
+ /*
+ * @Test public void Test2() { TestGeneralConfig cfgTest = new
+ * TestGeneralConfig(); cfgTest.test1(); //cfgTest.test();
+ * DMaaPFaultVESMsgConsumer faultConsumer = new DMaaPFaultVESMsgConsumer();
+ * System.out.println(faultConsumer.getBaseUrl());
+ * System.out.println(faultConsumer.getSDNRUser());
+ * System.out.println(faultConsumer.getSDNRPasswd()); }
+ */
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java
new file mode 100644
index 000000000..54439150c
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java
@@ -0,0 +1,279 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFMountPointClient;
+
+public class TestDMaaPPNFRegVESMsgConsumer extends DMaaPPNFRegVESMsgConsumer {
+
+ private static final String DEFAULT_SDNRUSER = "admin";
+ private static final String DEFAULT_SDNRPASSWD = "admin";
+ private static final String DEFAULT_SDNRBASEURL = "http://localhost:8181";
+
+ private static final String pnfRegMsg_TLS = "{\n" +
+ " \"event\": {\n" +
+ " \"commonEventHeader\": {\n" +
+ " \"domain\": \"pnfRegistration\",\n" +
+ " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" +
+ " \"eventName\": \"pnfRegistration_EventType5G\",\n" +
+ " \"eventType\": \"EventType5G\",\n" +
+ " \"sequence\": 0,\n" +
+ " \"priority\": \"Low\",\n" +
+ " \"reportingEntityId\": \"\",\n" +
+ " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" +
+ " \"sourceId\": \"\",\n" +
+ " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" +
+ " \"startEpochMicrosec\": 1571300004203,\n" +
+ " \"lastEpochMicrosec\": 1571300004203,\n" +
+ " \"nfNamingCode\": \"1234\",\n" +
+ " \"nfVendorName\": \"VENDORA\",\n" +
+ " \"timeZoneOffset\": \"+00:00\",\n" +
+ " \"version\": \"4.0.1\",\n" +
+ " \"vesEventListenerVersion\":\"7.0.1\"\n" +
+ " },\n" +
+ " \"pnfRegistrationFields\": {\n" +
+ " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" +
+ " \"additionalFields\": \n" +
+ " { \n" +
+ " \"protocol\":\"TLS\",\n"+
+ " \"keyId\":\"netconf\",\n"+
+ " \"oamPort\":\"50000\",\n"+
+ " \"betweenAttemptsTimeout\":\"2000\",\n" +
+ " \"keepaliveDelay\":\"120\",\n" +
+ " \"sleep-factor\":\"1.5\",\n" +
+ " \"reconnectOnChangedSchema\":\"false\",\n" +
+ " \"connectionTimeout\":\"20000\",\n" +
+ " \"maxConnectionAttempts\":\"100\",\n" +
+ " \"username\":\"netconf\",\n" +
+ " \"tcpOnly\":\"false\"\n" +
+ " },\n" +
+ " \"lastServiceDate\":\"2019-08-16\",\n" +
+ " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" +
+ " \"manufactureDate\":\"2019-08-16\",\n" +
+ " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" +
+ " \"oamV4IpAddress\": \"10.10.10.11\",\n" +
+ " \"oamPort\":\"17380\",\n" +
+ " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" +
+ " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" +
+ " \"softwareVersion\": \"2.3.5\",\n" +
+ " \"unitFamily\": \"VENDORA-1234\",\n" +
+ " \"unitType\": \"1234\",\n" +
+ " \"vendorName\": \"VENDORA\"\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "";
+
+ private static final String pnfRegMsg_SSH = "{\n" +
+ " \"event\": {\n" +
+ " \"commonEventHeader\": {\n" +
+ " \"domain\": \"pnfRegistration\",\n" +
+ " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" +
+ " \"eventName\": \"pnfRegistration_EventType5G\",\n" +
+ " \"eventType\": \"EventType5G\",\n" +
+ " \"sequence\": 0,\n" +
+ " \"priority\": \"Low\",\n" +
+ " \"reportingEntityId\": \"\",\n" +
+ " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" +
+ " \"sourceId\": \"\",\n" +
+ " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" +
+ " \"startEpochMicrosec\": 1571300004203,\n" +
+ " \"lastEpochMicrosec\": 1571300004203,\n" +
+ " \"nfNamingCode\": \"1234\",\n" +
+ " \"nfVendorName\": \"VENDORA\",\n" +
+ " \"timeZoneOffset\": \"+00:00\",\n" +
+ " \"version\": \"4.0.1\",\n" +
+ " \"vesEventListenerVersion\":\"7.0.1\"\n" +
+ " },\n" +
+ " \"pnfRegistrationFields\": {\n" +
+ " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" +
+ " \"additionalFields\": \n" +
+ " { \n" +
+ " \"protocol\":\"SSH\",\n"+
+ " \"password\":\"netconf\",\n"+
+ " \"oamPort\":\"50000\",\n"+
+ " \"betweenAttemptsTimeout\":\"2000\",\n" +
+ " \"keepaliveDelay\":\"120\",\n" +
+ " \"sleep-factor\":\"1.5\",\n" +
+ " \"reconnectOnChangedSchema\":\"false\",\n" +
+ " \"connectionTimeout\":\"20000\",\n" +
+ " \"maxConnectionAttempts\":\"100\",\n" +
+ " \"username\":\"netconf\",\n" +
+ " \"tcpOnly\":\"false\"\n" +
+ " },\n" +
+ " \"lastServiceDate\":\"2019-08-16\",\n" +
+ " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" +
+ " \"manufactureDate\":\"2019-08-16\",\n" +
+ " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" +
+ " \"oamV4IpAddress\": \"10.10.10.11\",\n" +
+ " \"oamPort\":\"17380\",\n" +
+ " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" +
+ " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" +
+ " \"softwareVersion\": \"2.3.5\",\n" +
+ " \"unitFamily\": \"VENDORA-1234\",\n" +
+ " \"unitType\": \"1234\",\n" +
+ " \"vendorName\": \"VENDORA\"\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "";
+
+ private static final String pnfRegMsg_OTHER = "{\n" +
+ " \"event\": {\n" +
+ " \"commonEventHeader\": {\n" +
+ " \"domain\": \"pnfRegistration\",\n" +
+ " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" +
+ " \"eventName\": \"pnfRegistration_EventType5G\",\n" +
+ " \"eventType\": \"EventType5G\",\n" +
+ " \"sequence\": 0,\n" +
+ " \"priority\": \"Low\",\n" +
+ " \"reportingEntityId\": \"\",\n" +
+ " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" +
+ " \"sourceId\": \"\",\n" +
+ " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" +
+ " \"startEpochMicrosec\": 1571300004203,\n" +
+ " \"lastEpochMicrosec\": 1571300004203,\n" +
+ " \"nfNamingCode\": \"1234\",\n" +
+ " \"nfVendorName\": \"VENDORA\",\n" +
+ " \"timeZoneOffset\": \"+00:00\",\n" +
+ " \"version\": \"4.0.1\",\n" +
+ " \"vesEventListenerVersion\":\"7.0.1\"\n" +
+ " },\n" +
+ " \"pnfRegistrationFields\": {\n" +
+ " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" +
+ " \"additionalFields\": \n" +
+ " { \n" +
+ " \"protocol\":\"OTHER\",\n"+
+ " \"password\":\"netconf\",\n"+
+ " \"oamPort\":\"50000\",\n"+
+ " \"betweenAttemptsTimeout\":\"2000\",\n" +
+ " \"keepaliveDelay\":\"120\",\n" +
+ " \"sleep-factor\":\"1.5\",\n" +
+ " \"reconnectOnChangedSchema\":\"false\",\n" +
+ " \"connectionTimeout\":\"20000\",\n" +
+ " \"maxConnectionAttempts\":\"100\",\n" +
+ " \"username\":\"netconf\",\n" +
+ " \"tcpOnly\":\"false\"\n" +
+ " },\n" +
+ " \"lastServiceDate\":\"2019-08-16\",\n" +
+ " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" +
+ " \"manufactureDate\":\"2019-08-16\",\n" +
+ " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" +
+ " \"oamV4IpAddress\": \"10.10.10.11\",\n" +
+ " \"oamPort\":\"17380\",\n" +
+ " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" +
+ " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" +
+ " \"softwareVersion\": \"2.3.5\",\n" +
+ " \"unitFamily\": \"VENDORA-1234\",\n" +
+ " \"unitType\": \"1234\",\n" +
+ " \"vendorName\": \"VENDORA\"\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "";
+ private static final String pnfRegMsg = "{\n" +
+ " \"event\": {\n" +
+ " \"commonEventHeader\": {\n" +
+ " \"domain\": \"pnfRegistration\",\n" +
+ " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" +
+ " \"eventName\": \"pnfRegistration_EventType5G\",\n" +
+ " \"eventType\": \"EventType5G\",\n" +
+ " \"sequence\": 0,\n" +
+ " \"priority\": \"Low\",\n" +
+ " \"reportingEntityId\": \"\",\n" +
+ " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" +
+ " \"sourceId\": \"\",\n" +
+ " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" +
+ " \"startEpochMicrosec\": 1571300004203,\n" +
+ " \"lastEpochMicrosec\": 1571300004203,\n" +
+ " \"nfNamingCode\": \"1234\",\n" +
+ " \"nfVendorName\": \"VENDORA\",\n" +
+ " \"timeZoneOffset\": \"+00:00\",\n" +
+ " \"version\": \"4.0.1\",\n" +
+ " \"vesEventListenerVersion\":\"7.0.1\"\n" +
+ " },\n" +
+ " \"pnfRegistrationFields\": {\n" +
+ " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" +
+ " \"lastServiceDate\":\"2019-08-16\",\n" +
+ " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" +
+ " \"manufactureDate\":\"2019-08-16\",\n" +
+ " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" +
+ " \"oamV4IpAddress\": \"10.10.10.11\",\n" +
+ " \"oamPort\":\"17380\",\n" +
+ " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" +
+ " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" +
+ " \"softwareVersion\": \"2.3.5\",\n" +
+ " \"unitFamily\": \"VENDORA-1234\",\n" +
+ " \"unitType\": \"1234\",\n" +
+ " \"vendorName\": \"VENDORA\"\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "";
+
+ @Test
+ public void processMsgTest() {
+
+ DMaaPPNFRegVESMsgConsumer pnfRegMsgConsumer = new TestDMaaPPNFRegVESMsgConsumer();
+ try {
+ pnfRegMsgConsumer.processMsg(pnfRegMsg);
+ pnfRegMsgConsumer.processMsg(pnfRegMsg_SSH);
+ pnfRegMsgConsumer.processMsg(pnfRegMsg_TLS);
+ pnfRegMsgConsumer.processMsg(pnfRegMsg_OTHER);
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println("Exception while processing PNF Registration Message - "+e.getMessage());
+ }
+ }
+
+ @Override
+ public PNFMountPointClient getPNFMountPointClient(String baseUrl) {
+ return new TestPNFMountPointClient();
+ }
+
+ @Override
+ public String getSDNRUser() {
+ return DEFAULT_SDNRUSER;
+ }
+
+ @Override
+ public String getSDNRPasswd() {
+ return DEFAULT_SDNRPASSWD;
+ }
+
+ @Override
+ public String getBaseUrl() {
+ return DEFAULT_SDNRBASEURL;
+ }
+
+ @Test
+ public void Test1() {
+ TestGeneralConfig cfgTest = new TestGeneralConfig();
+ cfgTest.test();
+ DMaaPPNFRegVESMsgConsumer pnfConsumer = new DMaaPPNFRegVESMsgConsumer();
+ System.out.println(pnfConsumer.getBaseUrl());
+ System.out.println(pnfConsumer.getSDNRUser());
+ System.out.println(pnfConsumer.getSDNRPasswd());
+ }
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java
new file mode 100644
index 000000000..956477379
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPVESMsgConsumer;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPVESMsgConsumerMain;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultConfig;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.GeneralConfig;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFRegistrationConfig;
+
+import com.google.common.io.Files;
+
+public class TestDMaaPVESMsgConsumerMain {
+
+ private static final String CONFIGURATIONFILE = "test.properties";
+ private static final String TESTCONFIG_GENERAL="[general]\n" +
+ "dmaapEnabled=false\n" +
+ "baseUrl=http://localhost:8181\n" +
+ "sdnrUser=admin\n" +
+ "sdnrPasswd=admin\n" +
+ "\n" +
+ "[pnfRegistration]\n" +
+ "pnfRegConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl.DummyPNFRegVESMsgConsumer\n" +
+ "TransportType=HTTPNOAUTH\n" +
+ "host=onap-dmap:3904\n" +
+ "topic=unauthenticated.VES_PNFREG_OUTPUT\n" +
+ "contenttype=application/json\n" +
+ "group=myG\n" +
+ "id=C1\n" +
+ "timeout=20000\n" +
+ "limit=10000\n" +
+ "\n" +
+ "[fault]\n" +
+ "faultConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl.DummyFaultVESMsgConsumer\n" +
+ "TransportType=HTTPNOAUTH\n" +
+ "host=onap-dmap:3904\n" +
+ "topic=unauthenticated.SEC_FAULT_OUTPUT\n" +
+ "contenttype=application/json\n" +
+ "group=myG\n" +
+ "id=C1\n" +
+ "timeout=20000\n" +
+ "limit=10000\n" +
+ "fetchPause=10000\n" +
+ "\n" +
+ "";
+
+ private static final String TESTCONFIG_GENERAL_INVALID="[general]\n" +
+ "dmaapEnabled=false\n" +
+ "baseUrl=http://localhost:8181\n" +
+ "sdnrUser=admin\n" +
+ "sdnrPasswd=admin\n" +
+ "\n" +
+ "[pnfRegistration]\n" +
+ "pnfRegConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl.DummyPNFRegVESMsgConsumer\n" +
+ "TransportType=HTTPNOAUTH\n" +
+ "host=onap-dmap:3904\n" +
+ "topic=unauthenticated.VES_PNFREG_OUTPUT\n" +
+ "contenttype=application/json\n" +
+ "group=myG\n" +
+ "id=C1\n" +
+ "timeout=20000\n" +
+ "limit=10000\n" +
+ "\n" +
+ "[fault]\n" +
+ "faultConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl.DummyFaultVESMsgConsumer\n" +
+ "TransportType=HTTPNOAUTH\n" +
+ "host=onap-dmap:3904\n" +
+ "topic=unauthenticated.SEC_FAULT_OUTPUT\n" +
+ "contenttype=application/json\n" +
+ "group=myG\n" +
+ "id=C1\n" +
+ "timeout=HELLO\n" +
+ "limit=10000\n" +
+ "fetchPause=WORLD\n" +
+ "\n" +
+ "";
+ public GeneralConfig generalConfig;
+ Map<String, Configuration> configMap = new HashMap<String, Configuration>();
+ DMaaPVESMsgConsumerMain dmaapMain;
+
+// @Before
+ public void preTest1() {
+ try {
+ Files.asCharSink(new File(CONFIGURATIONFILE), StandardCharsets.UTF_8).write(TESTCONFIG_GENERAL);
+ ConfigurationFileRepresentation configFileRepresentation = new ConfigurationFileRepresentation(CONFIGURATIONFILE);
+
+ generalConfig = new GeneralConfig(configFileRepresentation);
+ PNFRegistrationConfig pnfRegConfig = new PNFRegistrationConfig(configFileRepresentation);
+ FaultConfig faultConfig = new FaultConfig(configFileRepresentation);
+
+ configMap.put("pnfRegistration", pnfRegConfig);
+ configMap.put("fault", faultConfig);
+ } catch (Exception e) {
+ System.out.println("Failed in preTest execution "+e.getMessage());
+ }
+ }
+
+ public void preTest2() {
+ try {
+ Files.asCharSink(new File(CONFIGURATIONFILE), StandardCharsets.UTF_8).write(TESTCONFIG_GENERAL_INVALID);
+ ConfigurationFileRepresentation configFileRepresentation = new ConfigurationFileRepresentation(CONFIGURATIONFILE);
+
+ generalConfig = new GeneralConfig(configFileRepresentation);
+ PNFRegistrationConfig pnfRegConfig = new PNFRegistrationConfig(configFileRepresentation);
+ FaultConfig faultConfig = new FaultConfig(configFileRepresentation);
+
+ configMap.put("pnfRegistration", pnfRegConfig);
+ configMap.put("fault", faultConfig);
+ } catch (Exception e) {
+ System.out.println("Failed in preTest execution "+e.getMessage());
+ }
+ }
+
+ @Test
+ public void testDMaaPVESMsgConsumerMainMapOfStringConfiguration() {
+ preTest1();
+ assertNotNull(configMap);
+ dmaapMain = new DMaaPVESMsgConsumerMain(configMap);
+ }
+
+ @Test
+ public void testDMaaPVESMsgConsumerMainMapOfStringConfiguration1() {
+ preTest2();
+ assertNotNull(configMap);
+ dmaapMain = new DMaaPVESMsgConsumerMain(configMap);
+ }
+
+ @After
+ public void postTest() {
+ List<DMaaPVESMsgConsumer> consumers = DMaaPVESMsgConsumerMain.getConsumers();
+ for (DMaaPVESMsgConsumer consumer : consumers) {
+ // stop all consumers
+ consumer.stopConsumer();
+ }
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java
new file mode 100644
index 000000000..cbdb24a03
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultConfig;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFRegistrationConfig;
+
+import com.google.common.io.Files;
+
+public class TestFaultConfig {
+
+ private static final String TESTCONFIG_CONTENT="[fault]\n" +
+ "faultConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer\n" +
+ "TransportType=HTTPNOAUTH\n" +
+ "host=onap-dmap:3904\n" +
+ "topic=unauthenticated.SEC_FAULT_OUTPUT\n" +
+ "contenttype=application/json\n" +
+ "group=myG\n" +
+ "id=C1\n" +
+ "timeout=20000\n" +
+ "limit=10000\n" +
+ "fetchPause=5000\n" +
+ "\n" +
+ "";
+
+ private ConfigurationFileRepresentation cfg;
+
+ @Test
+ public void test() {
+ try {
+ Files.asCharSink(new File("test.properties"), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT);
+ cfg = new ConfigurationFileRepresentation("test.properties");
+ FaultConfig faultCfg = new FaultConfig(cfg);
+ assertEquals("fault", faultCfg.getSectionName());
+ assertEquals("org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer", faultCfg.getConsumerClass());
+ assertEquals("HTTPNOAUTH", faultCfg.getTransportType());
+ assertEquals("onap-dmap:3904", faultCfg.getHostPort());
+ assertEquals("unauthenticated.SEC_FAULT_OUTPUT", faultCfg.getTopic());
+ assertEquals("application/json", faultCfg.getContenttype());
+ assertEquals("myG", faultCfg.getConsumerGroup());
+ assertEquals("C1", faultCfg.getConsumerId());
+ assertEquals("20000", faultCfg.getTimeout());
+ assertEquals("10000", faultCfg.getLimit());
+ assertEquals("5000", faultCfg.getFetchPause());
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ }
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java
new file mode 100644
index 000000000..68bcb5ee4
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.annotation.Nonnull;
+
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPResponse;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultNotificationClient;
+
+public class TestFaultNotificationClient extends FaultNotificationClient {
+
+ public static String baseUrl = "http://localhost:8181";
+ FaultNotificationClient testClient ;
+
+
+ public TestFaultNotificationClient() {
+ super(baseUrl);
+
+ }
+
+ @Test
+ public void testFaultNotificationClient() {
+ testClient = new TestFaultNotificationClient();
+ testClient.setAuthorization("admin", "admin");
+ assertEquals(true, testClient.sendFaultNotification("TEST_50001", "1", "2019-11-20T09:25:19.948Z", "SEDNKSAHQ01M01nSky01", "lossOfSignal", "Critical"));
+ assertEquals(true, testClient.sendFaultNotification("TEST_50001", "1", "2019-11-20T09:25:19.948Z", "SEDNKSAHQ01M01nSky01", "lossOfSignal", "Critical"));
+ }
+
+ @Override
+ protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers)
+ throws IOException {
+ System.out.println("In overridden sendRequest in TestFaultNotificationClient");
+ return new BaseHTTPResponse(200, body);
+ }
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestGeneralConfig.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestGeneralConfig.java
new file mode 100644
index 000000000..4eb5ba17b
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestGeneralConfig.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import org.junit.After;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.GeneralConfig;
+
+import com.google.common.io.Files;
+
+public class TestGeneralConfig {
+
+ private static final String TESTCONFIG_CONTENT="[general]\n" +
+ "dmaapEnabled=false\n" +
+ "baseUrl=http://localhost:8181\n" +
+ "sdnrUser=admin\n" +
+ "sdnrPasswd=admin\n" +
+ "";
+
+ private ConfigurationFileRepresentation globalCfg;
+
+ @Test
+ public void test() {
+ try {
+ Files.asCharSink(new File("test.properties"), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT);
+ globalCfg = new ConfigurationFileRepresentation("test.properties");
+ GeneralConfig cfg = new GeneralConfig(globalCfg);
+ assertEquals(false, cfg.getEnabled());
+ assertEquals("http://localhost:8181", GeneralConfig.getBaseUrl());
+ assertEquals("admin", GeneralConfig.getSDNRUser());
+ assertEquals("admin", GeneralConfig.getSDNRPasswd());
+ assertEquals("general", cfg.getSectionName());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @After
+ public void cleanUp() {
+ File file = new File("test.properties");
+ if (file.exists()) {
+ System.out.println("File exists, Deleting it");
+ file.delete();
+ }
+
+ }
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java
new file mode 100644
index 000000000..5c9fbe35d
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.util.Optional;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.yangtools.YangToolsMapper;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInputBuilder;
+
+public class TestMapping {
+
+ private final YangToolsMapper mapper = new YangToolsMapper();
+
+
+ private static Optional<SeverityType> getSeverity(String faultSeverity) {
+ return SeverityType.forName(faultSeverity); // <-- mapping provided by generated classes. Manual mapping beneficial.
+ }
+
+ private String updateFaultPayload(String faultNodeId, String faultCounter, String faultOccurrenceTime, String faultObjectId,
+ String faultReason, String faultSeverity) throws JsonProcessingException {
+
+ PushFaultNotificationInputBuilder faultNotificationBuilder = new PushFaultNotificationInputBuilder();
+ faultNotificationBuilder.setNodeId(faultNodeId);
+ faultNotificationBuilder.setCounter(Integer.valueOf(faultCounter));
+ faultNotificationBuilder.setTimestamp(new DateAndTime(faultOccurrenceTime));
+ faultNotificationBuilder.setObjectId(faultObjectId);
+ faultNotificationBuilder.setProblem(faultReason);
+ Optional<SeverityType> oSeverity = getSeverity(faultSeverity); //TODO getSeverity
+ if (oSeverity.isPresent()) {
+ faultNotificationBuilder.setSeverity(oSeverity.get());
+ } else {
+ // Do something to handle the problem
+ }
+ return mapper.writeValueAsString(faultNotificationBuilder);
+ }
+
+
+ @Test
+ public void test() throws JsonProcessingException {
+ DateAndTime dt = new DateAndTime("2017-03-01T09:15:00.0Z");
+
+ String result = updateFaultPayload("f1","34",dt.getValue(),"fefef","reason","Critical");
+
+ System.out.println("Res: "+result);
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java
new file mode 100644
index 000000000..014a96f03
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.MountpointRegistrarImpl;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi.ClusterSingletonServiceProviderMock;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi.DataBrokerNetconfMock;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi.MountPointServiceMock;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi.NotificationPublishServiceMock;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi.RpcProviderRegistryMock;
+import org.opendaylight.controller.md.sal.binding.api.MountPointService;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("deprecation")
+public class TestMountpointRegistrarImpl {
+
+ private static Path KARAF_ETC = Paths.get("etc");
+ private static MountpointRegistrarImpl mountpointRegistrar;
+ private static DataBrokerNetconfMock dataBrokerNetconf;
+
+ private static final Logger LOG = LoggerFactory.getLogger(TestMountpointRegistrarImpl.class);
+
+
+
+ @Before
+ public void before() throws InterruptedException, IOException {
+
+ System.out.println("Logger: " + LOG.getClass().getName() + " " + LOG.getName());
+ // Call System property to get the classpath value
+ Path etc = KARAF_ETC;
+ delete(etc);
+
+ System.out.println("Create empty:" + etc.toString());
+ Files.createDirectories(etc);
+
+ // Create mocks
+ dataBrokerNetconf = new DataBrokerNetconfMock();
+ ClusterSingletonServiceProvider clusterSingletonService = new ClusterSingletonServiceProviderMock();
+ MountPointService mountPointService = new MountPointServiceMock(null);
+ NotificationPublishService notificationPublishService = new NotificationPublishServiceMock();
+ RpcProviderRegistry rpcProviderRegistry = new RpcProviderRegistryMock();
+
+ // start using blueprint interface
+ try {
+ mountpointRegistrar = new MountpointRegistrarImpl();
+
+ mountpointRegistrar.setDataBroker(dataBrokerNetconf);
+ mountpointRegistrar.setMountPointService(mountPointService);
+ mountpointRegistrar.setNotificationPublishService(notificationPublishService);
+ mountpointRegistrar.setRpcProviderRegistry(rpcProviderRegistry);
+ mountpointRegistrar.setClusterSingletonService(clusterSingletonService);
+ mountpointRegistrar.init();
+ } catch (Exception e) {
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ fail("Not initialized" +sw.toString());
+ }
+ System.out.println("Initialization status: " + mountpointRegistrar.isInitializationOk());
+ System.out.println("Initialization done");
+ }
+
+ @After
+ public void after() throws InterruptedException, IOException {
+
+ System.out.println("Start shutdown");
+ // close using blueprint interface
+ try {
+ mountpointRegistrar.close();
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ delete(KARAF_ETC);
+
+ }
+
+ @Test
+ public void test1() {
+ System.out.println("Test1: slave mountpoint");
+ assertNotNull(mountpointRegistrar);
+ System.out.println("Initialization status: " + mountpointRegistrar.isInitializationOk());
+ System.out.println("Test2: Done");
+ }
+
+ // ********************* Private
+
+ @SuppressWarnings("unused")
+ private static void sleep(int millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException e) {
+ LOG.warn(e.getMessage());
+ Thread.interrupted();
+ }
+ }
+
+ private static void delete(Path etc) throws IOException {
+ if (Files.exists(etc)) {
+ System.out.println("Found and remove:" + etc.toString());
+ delete(etc.toFile());
+ }
+ }
+
+ private static void delete(File f) throws IOException {
+ if (f.isDirectory()) {
+ for (File c : f.listFiles()) {
+ delete(c);
+ }
+ }
+ if (!f.delete()) {
+ throw new FileNotFoundException("Failed to delete file: " + f);
+ }
+ }
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java
new file mode 100644
index 000000000..ca61d9c1c
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.annotation.Nonnull;
+
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPResponse;
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFMountPointClient;
+
+public class TestPNFMountPointClient extends PNFMountPointClient {
+
+ public static String baseUrl = "http://localhost:8181";
+ PNFMountPointClient testClient ;
+
+
+ public TestPNFMountPointClient() {
+ super(baseUrl);
+
+ }
+
+ @Test
+ public void testPNFMountPointClient() {
+ testClient = new TestPNFMountPointClient();
+ testClient.setAuthorization("admin", "admin");
+ assertEquals(true, testClient.pnfMountPointCreate("TEST_50001", "127.0.0.1", "TLS", "key_id", "admin", "admin", "17380"));
+
+ assertEquals(true, testClient.pnfMountPointCreate("TEST_50001", "127.0.0.1", "SSH", "key_id", "admin", "admin", "17380"));
+ }
+
+ @Override
+ protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers)
+ throws IOException {
+ System.out.println("In overridden sendRequest in TestPNFMountPointClient");
+ return new BaseHTTPResponse(200, body);
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyFaultVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyFaultVESMsgConsumer.java
new file mode 100644
index 000000000..a5662c986
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyFaultVESMsgConsumer.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test.impl;
+
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPVESMsgConsumerImpl;
+
+public class DummyFaultVESMsgConsumer extends DMaaPVESMsgConsumerImpl {
+
+ @Override
+ public void processMsg(String msg) throws Exception {
+ System.out.println("Message received is - "+msg);
+
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyPNFRegVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyPNFRegVESMsgConsumer.java
new file mode 100644
index 000000000..368bbde11
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyPNFRegVESMsgConsumer.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test.impl;
+
+import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPVESMsgConsumerImpl;
+
+public class DummyPNFRegVESMsgConsumer extends DMaaPVESMsgConsumerImpl {
+
+
+ @Override
+ public void processMsg(String msg) throws Exception {
+ System.out.println("Message received is - "+msg);
+
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/ClusterSingletonServiceProviderMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/ClusterSingletonServiceProviderMock.java
new file mode 100644
index 000000000..d76b9db93
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/ClusterSingletonServiceProviderMock.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test.mock.odlapi;
+
+import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
+import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
+import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
+
+public class ClusterSingletonServiceProviderMock implements ClusterSingletonServiceProvider {
+
+ @Override
+ public void close() throws Exception {
+
+ }
+
+ @Override
+ public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) {
+ return null;
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerMountpointMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerMountpointMock.java
new file mode 100644
index 000000000..a2e115d59
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerMountpointMock.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test.mock.odlapi;
+
+import org.opendaylight.controller.md.sal.binding.api.BindingService;
+import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * @author herbert
+ *
+ */
+@SuppressWarnings("deprecation")
+public class DataBrokerMountpointMock implements DataBroker, BindingService {
+
+ ReadOnlyTransaction readOnlyTransaction;
+
+ public void setReadOnlyTransaction(ReadOnlyTransaction readOnlyTransaction) {
+ this.readOnlyTransaction = readOnlyTransaction;
+ }
+
+ @Override
+ public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L> registerDataTreeChangeListener(
+ DataTreeIdentifier<T> arg0, L arg1) {
+ return null;
+ }
+
+ @Override
+ public BindingTransactionChain createTransactionChain(TransactionChainListener listener) {
+ return null;
+ }
+
+ @Override
+ public ReadOnlyTransaction newReadOnlyTransaction() {
+ return readOnlyTransaction;
+ }
+
+ @Override
+ public ReadWriteTransaction newReadWriteTransaction() {
+ return null;
+ }
+
+ @Override
+ public WriteTransaction newWriteOnlyTransaction() {
+ return null;
+ }
+
+
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerNetconfMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerNetconfMock.java
new file mode 100644
index 000000000..e504ef166
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/DataBrokerNetconfMock.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test.mock.odlapi;
+
+import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * @author herbert
+ *
+ */
+@SuppressWarnings("deprecation")
+public class DataBrokerNetconfMock implements DataBroker {
+
+
+ ReadOnlyTransaction readOnlyTransaction;
+
+ public void setReadOnlyTransaction(ReadOnlyTransaction readOnlyTransaction) {
+ this.readOnlyTransaction = readOnlyTransaction;
+ }
+
+ @Override
+ public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L> registerDataTreeChangeListener(
+ DataTreeIdentifier<T> arg0, L arg1) {
+ return null;
+ }
+
+ @Override
+ public BindingTransactionChain createTransactionChain(TransactionChainListener listener) {
+ return null;
+ }
+
+ @Override
+ public ReadOnlyTransaction newReadOnlyTransaction() {
+ return readOnlyTransaction;
+ }
+
+ @Override
+ public ReadWriteTransaction newReadWriteTransaction() {
+ return null;
+ }
+
+ @Override
+ public WriteTransaction newWriteOnlyTransaction() {
+ return null;
+ }
+
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointMock.java
new file mode 100644
index 000000000..1a7cc50a5
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointMock.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider
+ * ================================================================================
+ * 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.mountpointregistrar.test.mock.odlapi;
+
+import com.google.common.base.Optional;
+import org.opendaylight.controller.md.sal.binding.api.BindingService;
+import org.opendaylight.controller.md.sal.binding.api.MountPoint;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * @author herbert
+ *
+ */
+@SuppressWarnings("deprecation")
+public class MountPointMock implements MountPoint {
+
+ private boolean databrokerAbsent = true;
+ private final DataBrokerMountpointMock dataBroker = new DataBrokerMountpointMock();
+ private final RpcConsumerRegistryMock rpcConsumerRegistry = new RpcConsumerRegistryMock();
+ private NotificationService setReadOnlyTransaction;
+
+ private static final InstanceIdentifier<Topology> NETCONF_TOPO_IID =
+ InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,
+ new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName())));
+
+ @Override
+ public InstanceIdentifier<?> getIdentifier() {
+ return NETCONF_TOPO_IID;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T extends BindingService> Optional<T> getService(Class<T> service) {
+
+ System.out.println("Requested mountpoint service: "+service.getSimpleName()+" databrokerAbsent state: "+databrokerAbsent);
+
+ Optional<?> res;
+ if (service.isInstance(dataBroker)) {
+ System.out.println("Delivering databroker");
+ res = databrokerAbsent ? Optional.absent() : Optional.of(dataBroker);
+ } else if (service.isInstance(rpcConsumerRegistry)) {
+ System.out.println("Delivering RpcConsumerRegistryMock");
+ res = Optional.of(rpcConsumerRegistry);
+ } else if (service.isInstance(setReadOnlyTransaction)) {
+ System.out.println("Delivering notificationService");
+ res = Optional.of(setReadOnlyTransaction);
+ } else {
+ System.out.println("Delivering no service");
+ res = Optional.absent();
+ }
+ return (Optional<T>)res;
+ }
+
+ public void setDatabrokerAbsent( boolean state) {
+ this.databrokerAbsent = state;
+ }
+
+ public <T extends NotificationService&ReadOnlyTransaction>void setReadOnlyTransaction(T readOnlyTransaction) {
+ this.setReadOnlyTransaction = readOnlyTransaction;
+ dataBroker.setReadOnlyTransaction(readOnlyTransaction);
+ }
+
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointServiceMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointServiceMock.java
new file mode 100644
index 000000000..433324737
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/MountPointServiceMock.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test.mock.odlapi;
+
+import com.google.common.base.Optional;
+import org.opendaylight.controller.md.sal.binding.api.MountPoint;
+import org.opendaylight.controller.md.sal.binding.api.MountPointService;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * @author herbert
+ *
+ */
+@SuppressWarnings("deprecation")
+public class MountPointServiceMock implements MountPointService {
+
+ private final MountPointMock mountpoint;
+
+ public MountPointServiceMock(MountPointMock mountpoint) {
+ this.mountpoint = mountpoint;
+ }
+
+ @Override
+ public Optional<MountPoint> getMountPoint(InstanceIdentifier<?> mountPoint) {
+
+ Optional<MountPoint> optional = Optional.of(mountpoint);
+ return optional;
+ }
+
+ @Override
+ public <T extends MountPointListener> ListenerRegistration<T> registerListener(InstanceIdentifier<?> path,
+ T listener) {
+ return null;
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/NotificationPublishServiceMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/NotificationPublishServiceMock.java
new file mode 100644
index 000000000..cf4ab0e9b
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/NotificationPublishServiceMock.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test.mock.odlapi;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.TimeUnit;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.yangtools.yang.binding.Notification;
+
+/**
+ * @author herbert
+ *
+ */
+@SuppressWarnings("deprecation")
+public class NotificationPublishServiceMock implements NotificationPublishService {
+
+ @Override
+ public ListenableFuture<?> offerNotification(Notification notification) {
+ return null;
+ }
+
+ @Override
+ public ListenableFuture<?> offerNotification(Notification notification, int timeout, TimeUnit unit)
+ throws InterruptedException {
+ return null;
+ }
+
+ @Override
+ public void putNotification(Notification notification) throws InterruptedException {
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcConsumerRegistryMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcConsumerRegistryMock.java
new file mode 100644
index 000000000..a33012b8b
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcConsumerRegistryMock.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider
+ * ================================================================================
+ * 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.mountpointregistrar.test.mock.odlapi;
+
+import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.yangtools.yang.binding.RpcService;
+
+/**
+ * @author herbert
+ *
+ */
+@SuppressWarnings("deprecation")
+public class RpcConsumerRegistryMock implements RpcConsumerRegistry {
+
+ @Override
+ public <T extends RpcService> T getRpcService(Class<T> serviceInterface) {
+ return null;
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcProviderRegistryMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcProviderRegistryMock.java
new file mode 100644
index 000000000..7d556df98
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/RpcProviderRegistryMock.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * ============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.mountpointregistrar.test.mock.odlapi;
+
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.RpcService;
+
+@SuppressWarnings("deprecation")
+public class RpcProviderRegistryMock implements RpcProviderRegistry {
+
+ @Override
+ public <T extends RpcService> T getRpcService(Class<T> serviceInterface) {
+ return null;
+ }
+
+ @Override
+ public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
+ L listener) {
+ return null;
+ }
+
+
+ @Override
+ public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> serviceInterface,
+ T implementation) throws IllegalStateException {
+ return null;
+ }
+
+ @Override
+ public <T extends RpcService> RpcRegistration<T> addRpcImplementation(Class<T> serviceInterface, T implementation)
+ throws IllegalStateException {
+ System.out.println("Register class "+serviceInterface);
+ return null;
+ }
+
+}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/resources/simplelogger.properties b/sdnr/wt/mountpoint-registrar/provider/src/test/resources/simplelogger.properties
new file mode 100644
index 000000000..2eb3eb7b3
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/resources/simplelogger.properties
@@ -0,0 +1,38 @@
+# SLF4J's SimpleLogger configuration file
+# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err.
+
+# Default logging detail level for all instances of SimpleLogger.
+# Must be one of ("trace", "debug", "info", "warn", or "error").
+# If not specified, defaults to "info".
+org.slf4j.simpleLogger.defaultLogLevel=info
+
+# Logging detail level for a SimpleLogger instance named "xxx.yyy.zzz".
+# Must be one of ("trace", "debug", "info", "warn", or "error").
+# If not specified, the default logging detail level is used.
+# org.slf4j.simpleLogger.log.xxx.yyy=debug
+org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager=info
+org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice=info
+org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources=info
+org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container=info
+
+# Set to true if you want the current date and time to be included in output messages.
+# Default is false, and will output the number of milliseconds elapsed since startup.
+#org.slf4j.simpleLogger.showDateTime=false
+
+# The date and time format to be used in the output messages.
+# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat.
+# If the format is not specified or is invalid, the default format is used.
+# The default format is yyyy-MM-dd HH:mm:ss:SSS Z.
+#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z
+
+# Set to true if you want to output the current thread name.
+# Defaults to true.
+#org.slf4j.simpleLogger.showThreadName=true
+
+# Set to true if you want the Logger instance name to be included in output messages.
+# Defaults to true.
+#org.slf4j.simpleLogger.showLogName=true
+
+# Set to true if you want the last component of the name to be included in output messages.
+# Defaults to false.
+#org.slf4j.simpleLogger.showShortLogName=false
diff --git a/sdnr/wt/mountpoint-registrar/provider/test.properties b/sdnr/wt/mountpoint-registrar/provider/test.properties
new file mode 100644
index 000000000..bb0eaadd4
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/test.properties
@@ -0,0 +1,11 @@
+[pnfRegistration]
+pnfRegConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer
+TransportType=HTTPNOAUTH
+host=onap-dmap:3904
+topic=unauthenticated.VES_PNFREG_OUTPUT
+contenttype=application/json
+group=myG
+id=C1
+timeout=20000
+limit=10000
+fetchPause=5000