summaryrefslogtreecommitdiffstats
path: root/sdnr
diff options
context:
space:
mode:
authorKAPIL SINGAL <ks220y@att.com>2020-07-12 09:34:56 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-12 09:34:56 +0000
commit2f08de22d7dbdb76513f3aac2444958d8d29ccd8 (patch)
tree80b14671cd2e720ee82e7b78473ae3693b64bd99 /sdnr
parent164113b59d3f7723189fac75e9c79d87ef931c52 (diff)
parent5f5644378ff7510a6c7c1190e93e997abc8cbc25 (diff)
Merge "Reformat sdnr mountpoint-registrar to ONAP code style"
Diffstat (limited to 'sdnr')
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPFaultVESMsgConsumer.java148
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPPNFRegVESMsgConsumer.java177
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumer.java18
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerImpl.java258
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerMain.java294
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultConfig.java281
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultNotificationClient.java142
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/GeneralConfig.java105
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/MountpointRegistrarImpl.java180
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFMountPointClient.java209
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFRegistrationConfig.java228
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java119
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java271
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java484
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java265
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java122
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java36
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestGeneralConfig.java77
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java14
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java14
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java36
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyFaultVESMsgConsumer.java12
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyPNFRegVESMsgConsumer.java12
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/ClusterSingletonServiceProviderMock.java18
24 files changed, 1799 insertions, 1721 deletions
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
index 14d31d578..4e6cc996d 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -30,75 +30,77 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
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);
- }
+ 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
index 00d7e9514..ed9f583a5 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt mountpoint-registrar
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -28,90 +28,95 @@ 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);
+ 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";
- String baseUrl = getBaseUrl();
- String sdnrUser = getSDNRUser();
- String sdnrPasswd = getSDNRPasswd();
+ @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;
+ }
- 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);
- }
+ 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
index 8474bbb0b..25f737583 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt mountpoint-registrar
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -22,15 +22,15 @@ 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 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 void processMsg(String msg) throws Exception;//Implement something like InvalidMessageException;
- public abstract boolean isReady();
+ public abstract boolean isReady();
- public abstract boolean isRunning();
-
- public abstract void stopConsumer();
+ 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
index 1164a9a88..66cce840f 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt mountpoint-registrar
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -29,131 +29,133 @@ 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());
- if ((consumerResponse.getResponseCode() == null) && (consumerResponse.getResponseMessage().contains("SocketTimeoutException"))) {
- LOG.warn("Client timeout while waiting for response from Server {}", 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;
+ 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());
+ if ((consumerResponse.getResponseCode() == null)
+ && (consumerResponse.getResponseMessage().contains("SocketTimeoutException"))) {
+ LOG.warn("Client timeout while waiting for response from Server {}",
+ 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
index 26afd19aa..7b851aa5c 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt mountpoint-registrar
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -29,143 +29,157 @@ 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());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_PROTOCOL, pnfRegistrationConfig.getProtocol());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_USERNAME, pnfRegistrationConfig.getUsername());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_PASSWORD, pnfRegistrationConfig.getPassword());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT, pnfRegistrationConfig.getClientReadTimeout());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT, pnfRegistrationConfig.getClientConnectTimeout());
- } 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());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_PROTOCOL, faultConfig.getProtocol());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_USERNAME, faultConfig.getUsername());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_PASSWORD, faultConfig.getPassword());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT, faultConfig.getClientReadTimeout());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT, faultConfig.getClientConnectTimeout());
- }
-
- 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;
- }
+ 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());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_PROTOCOL,
+ pnfRegistrationConfig.getProtocol());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_USERNAME,
+ pnfRegistrationConfig.getUsername());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_PASSWORD,
+ pnfRegistrationConfig.getPassword());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT,
+ pnfRegistrationConfig.getClientReadTimeout());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT,
+ pnfRegistrationConfig.getClientConnectTimeout());
+ } 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());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_PROTOCOL, faultConfig.getProtocol());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_USERNAME, faultConfig.getUsername());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_PASSWORD, faultConfig.getPassword());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT,
+ faultConfig.getClientReadTimeout());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT,
+ faultConfig.getClientConnectTimeout());
+ }
+
+ 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
index dc0ed9cdd..a6323f270 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,153 +14,168 @@
* 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 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";
+ 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_TRANSPORTTYPE = "TransportType";
- private static final String DEFAULT_VALUE_CONSUMER_TRANSPORTTYPE = "HTTPNOAUTH";
-
public static final String PROPERTY_KEY_CONSUMER_PROTOCOL = "Protocol";
private static final String DEFAULT_VALUE_CONSUMER_PROTOCOL = "http";
-
+
public static final String PROPERTY_KEY_CONSUMER_USERNAME = "username";
private static final String DEFAULT_VALUE_CONSUMER_USERNAME = "username";
-
+
public static final String PROPERTY_KEY_CONSUMER_PASSWORD = "password";
private static final String DEFAULT_VALUE_CONSUMER_PASSWORD = "password";
- public static final String PROPERTY_KEY_CONSUMER_HOST_PORT = "host";
- private static final String DEFAULT_VALUE_CONSUMER_HOST_PORT = "onap-dmaap: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";
-
- public static final String PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT="jersey.config.client.readTimeout";
- private static final String DEFAULT_VALUE_CONSUMER_CLIENT_READTIMEOUT="25000";
-
- public static final String PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT="jersey.config.client.connectTimeout";
- private static final String DEFAULT_VALUE_CONSUMER_CLIENT_CONNECTTIMEOUT="25000";
-
- 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_PROTOCOL, DEFAULT_VALUE_CONSUMER_PROTOCOL);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_USERNAME, DEFAULT_VALUE_CONSUMER_USERNAME);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_PASSWORD, DEFAULT_VALUE_CONSUMER_PASSWORD);
- 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);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT, DEFAULT_VALUE_CONSUMER_CLIENT_READTIMEOUT);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT, DEFAULT_VALUE_CONSUMER_CLIENT_CONNECTTIMEOUT);
-
- }
-
- 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 getProtocol() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_PROTOCOL);
- }
-
- public String getUsername() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_USERNAME);
- }
-
- public String getPassword() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_PASSWORD);
- }
-
- 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);
- }
-
- public String getClientReadTimeout() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT);
- }
-
- public String getClientConnectTimeout() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT);
- }
+ public static final String PROPERTY_KEY_CONSUMER_HOST_PORT = "host";
+ private static final String DEFAULT_VALUE_CONSUMER_HOST_PORT = "onap-dmaap: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";
+
+ public static final String PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT = "jersey.config.client.readTimeout";
+ private static final String DEFAULT_VALUE_CONSUMER_CLIENT_READTIMEOUT = "25000";
+
+ public static final String PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT = "jersey.config.client.connectTimeout";
+ private static final String DEFAULT_VALUE_CONSUMER_CLIENT_CONNECTTIMEOUT = "25000";
+
+ 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_PROTOCOL,
+ DEFAULT_VALUE_CONSUMER_PROTOCOL);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_USERNAME,
+ DEFAULT_VALUE_CONSUMER_USERNAME);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_PASSWORD,
+ DEFAULT_VALUE_CONSUMER_PASSWORD);
+ 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);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT,
+ DEFAULT_VALUE_CONSUMER_CLIENT_READTIMEOUT);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT,
+ DEFAULT_VALUE_CONSUMER_CLIENT_CONNECTTIMEOUT);
+
+ }
+
+ 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 getProtocol() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_PROTOCOL);
+ }
+
+ public String getUsername() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_USERNAME);
+ }
+
+ public String getPassword() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_PASSWORD);
+ }
+
+ 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);
+ }
+
+ public String getClientReadTimeout() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT);
+ }
+
+ public String getClientConnectTimeout() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT);
+ }
}
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
index 76137674a..3fdbb6f20 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -22,7 +22,6 @@ 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;
@@ -30,70 +29,75 @@ 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;
- }
- }
+ 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;
+
+ // @formatter:off
+ 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"
+ + "}";
+ // @formatter:on
+
+
+ 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) {
+ // @formatter:off
+ return FAULT_PAYLOAD.replace("@node-id@", faultNodeId)
+ .replace("@counter@", faultCounter)
+ .replace("@timestamp@", faultOccurrenceTime)
+ .replace("@object-id@", faultObjectId)
+ .replace("@problem@", faultReason)
+ .replace("@severity@", faultSeverity);
+ // @formatter:on
+ }
+
+
+ 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
index 39d688ba2..e8269ccda 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -22,66 +22,67 @@ import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRep
/**
* 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
+ * - 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_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);
- }
-
-
+
+
+ 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
index a993f23c9..12a992216 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -31,93 +31,95 @@ import org.slf4j.LoggerFactory;
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;
-
- private GeneralConfig generalConfig;
- private boolean dmaapEnabled = false;
- private Map<String, Configuration> configMap = new HashMap<>();
-
- // Blueprint 1
- public MountpointRegistrarImpl() {
- LOG.info("Creating provider class for {}", APPLICATION_NAME);
- }
-
- 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();
- }
- }
- }
+ 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;
+
+ private GeneralConfig generalConfig;
+ private boolean dmaapEnabled = false;
+ private Map<String, Configuration> configMap = new HashMap<>();
+
+ // Blueprint 1
+ public MountpointRegistrarImpl() {
+ LOG.info("Creating provider class for {}", APPLICATION_NAME);
+ }
+
+ 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
index ace1c0a39..f8653ca75 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -22,112 +22,121 @@ 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<>();
+ 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;
+ // @formatter:off
+ 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>";
+ // @formatter:on
+ // @formatter:off
+ 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>";
+ // @formatter:on
+
+ 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;
- }
- }
+ }
+
+ 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) {
+ // @formatter:off
+ return SSH_PAYLOAD.replace("@device-name@", pnfName)
+ .replace("@device-ip@", ipv4Address)
+ .replace("@device-port@", portNo)
+ .replace("@username@", username)
+ .replace("@password@", password);
+ // @formatter:on
+ }
+
+ private static String updateTLSPayload(String pnfName, String ipv4Address, String username, String keyId,
+ String portNo) {
+ // @formatter:off
+ return TLS_PAYLOAD.replace("@device-name@", pnfName)
+ .replace("@device-ip@", ipv4Address)
+ .replace("@username@", username)
+ .replace("@key-id@", keyId)
+ .replace("@device-port@", portNo);
+ // @formatter:on
+ }
+
+ 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
index 79f96db32..a8e12767f 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -22,20 +22,21 @@ 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 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";
+ 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_PROTOCOL = "Protocol";
private static final String DEFAULT_VALUE_CONSUMER_PROTOCOL = "http";
-
+
public static final String PROPERTY_KEY_CONSUMER_USERNAME = "username";
private static final String DEFAULT_VALUE_CONSUMER_USERNAME = "username";
-
+
public static final String PROPERTY_KEY_CONSUMER_PASSWORD = "password";
private static final String DEFAULT_VALUE_CONSUMER_PASSWORD = "password";
@@ -62,102 +63,117 @@ public class PNFRegistrationConfig implements Configuration {
public static final String PROPERTY_KEY_CONSUMER_FETCHPAUSE = "fetchPause";
private static final String DEFAULT_VALUE_CONSUMER_FETCHPAUSE = "5000";
-
- public static final String PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT="jersey.config.client.readTimeout";
- private static final String DEFAULT_VALUE_CONSUMER_CLIENT_READTIMEOUT="25000";
-
- public static final String PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT="jersey.config.client.connectTimeout";
- private static final String DEFAULT_VALUE_CONSUMER_CLIENT_CONNECTTIMEOUT="25000";
-
- 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_PROTOCOL, DEFAULT_VALUE_CONSUMER_PROTOCOL);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_USERNAME, DEFAULT_VALUE_CONSUMER_USERNAME);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_PASSWORD, DEFAULT_VALUE_CONSUMER_PASSWORD);
- 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);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT, DEFAULT_VALUE_CONSUMER_CLIENT_READTIMEOUT);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT, DEFAULT_VALUE_CONSUMER_CLIENT_CONNECTTIMEOUT);
- }
-
- 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 getProtocol() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_PROTOCOL);
- }
-
- public String getUsername() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_USERNAME);
- }
-
- public String getPassword() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_PASSWORD);
- }
-
- 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);
- }
-
- public String getClientReadTimeout() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT);
- }
-
- public String getClientConnectTimeout() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT);
- }
+
+ public static final String PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT = "jersey.config.client.readTimeout";
+ private static final String DEFAULT_VALUE_CONSUMER_CLIENT_READTIMEOUT = "25000";
+
+ public static final String PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT = "jersey.config.client.connectTimeout";
+ private static final String DEFAULT_VALUE_CONSUMER_CLIENT_CONNECTTIMEOUT = "25000";
+
+ 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_PROTOCOL,
+ DEFAULT_VALUE_CONSUMER_PROTOCOL);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_USERNAME,
+ DEFAULT_VALUE_CONSUMER_USERNAME);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_PASSWORD,
+ DEFAULT_VALUE_CONSUMER_PASSWORD);
+ 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);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT,
+ DEFAULT_VALUE_CONSUMER_CLIENT_READTIMEOUT);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT,
+ DEFAULT_VALUE_CONSUMER_CLIENT_CONNECTTIMEOUT);
+ }
+
+ 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 getProtocol() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_PROTOCOL);
+ }
+
+ public String getUsername() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_USERNAME);
+ }
+
+ public String getPassword() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_PASSWORD);
+ }
+
+ 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);
+ }
+
+ public String getClientReadTimeout() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT);
+ }
+
+ public String getClientConnectTimeout() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT);
+ }
}
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
index 39488f887..9c41da9ea 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,82 +14,81 @@
* 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 com.google.common.io.Files;
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.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" +
- "Protocol=http\n" +
- "username=username\n" +
- "password=password\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" +
- "jersey.config.client.readTimeout=25000\n" +
- "jersey.config.client.connectTimeout=25000\n" +
- "";
+ // @formatter:off
+ private static final String TESTCONFIG_CONTENT = "[pnfRegistration]\n"
+ + "pnfRegConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer\n"
+ + "TransportType=HTTPNOAUTH\n"
+ + "Protocol=http\n"
+ + "username=username\n"
+ + "password=password\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"
+ + "jersey.config.client.readTimeout=25000\n"
+ + "jersey.config.client.connectTimeout=25000\n"
+ + "";
+ // @formatter:on
+ 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());
+ assertEquals("http", pnfCfg.getProtocol());
+ assertEquals("username", pnfCfg.getUsername());
+ assertEquals("password", pnfCfg.getPassword());
+ assertEquals("25000", pnfCfg.getClientReadTimeout());
+ assertEquals("25000", pnfCfg.getClientConnectTimeout());
- private ConfigurationFileRepresentation cfg;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ }
- @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());
- assertEquals("http", pnfCfg.getProtocol());
- assertEquals("username", pnfCfg.getUsername());
- assertEquals("password", pnfCfg.getPassword());
- assertEquals("25000", pnfCfg.getClientReadTimeout());
- assertEquals("25000", pnfCfg.getClientConnectTimeout());
+ }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- }
+ @After
+ public void cleanUp() {
+ File file = new File("test.properties");
+ if (file.exists()) {
+ System.out.println("File exists, Deleting it");
+ file.delete();
+ }
- }
-
- @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/TestDMaaPFaultVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java
index b5544dfa4..8929612ad 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -24,145 +24,148 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultNotificatio
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 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\""
- + " }"
- + " }"
- + " }"
- + "}";
+ // @formatter:off
+ 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\""
+ + " }"
+ + " }"
+ + " }"
+ + "}";
+ // @formatter:on
+ // @formatter:off
+ 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\""
+ + " }"
+ + " }"
+ + " }"
+ + "}";
+ // @formatter:on
- 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 {
+ @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());
- }
- }
+ 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 FaultNotificationClient getFaultNotificationClient(String baseUrl) {
+ return new TestFaultNotificationClient();
+ }
- @Override
- public String getSDNRUser() {
- return DEFAULT_SDNRUSER;
- }
+ @Override
+ public String getSDNRUser() {
+ return DEFAULT_SDNRUSER;
+ }
- @Override
- public String getSDNRPasswd() {
- return DEFAULT_SDNRPASSWD;
- }
+ @Override
+ public String getSDNRPasswd() {
+ return DEFAULT_SDNRPASSWD;
+ }
- @Override
- public String getBaseUrl() {
- return DEFAULT_SDNRBASEURL;
- }
+ @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 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()); }
- */
+ /*
+ * @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
index eda372d77..169f734e8 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -24,253 +24,255 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFMountPointCli
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 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" +
- "";
+ // @formatter:off
+ 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_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" +
- "";
+ 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"
+ + "";
+ // @formatter:on
- @Test
- public void processMsgTest() {
+ @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());
- }
- }
+ 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 PNFMountPointClient getPNFMountPointClient(String baseUrl) {
+ return new TestPNFMountPointClient();
+ }
- @Override
- public String getSDNRUser() {
- return DEFAULT_SDNRUSER;
- }
+ @Override
+ public String getSDNRUser() {
+ return DEFAULT_SDNRUSER;
+ }
- @Override
- public String getSDNRPasswd() {
- return DEFAULT_SDNRPASSWD;
- }
+ @Override
+ public String getSDNRPasswd() {
+ return DEFAULT_SDNRPASSWD;
+ }
- @Override
- public String getBaseUrl() {
- return DEFAULT_SDNRBASEURL;
- }
+ @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());
- }
+ @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
index 774ca2085..1f1cfa33f 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,18 +14,17 @@
* 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 com.google.common.io.Files;
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.Test;
import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
@@ -36,136 +35,138 @@ 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() {
- File file = new File("test.properties");
- if (file.exists()) {
- System.out.println("File exists, Deleting it");
- file.delete();
- }
- List<DMaaPVESMsgConsumer> consumers = DMaaPVESMsgConsumerMain.getConsumers();
- for (DMaaPVESMsgConsumer consumer : consumers) {
- // stop all consumers
- consumer.stopConsumer();
- }
- }
+ private static final String CONFIGURATIONFILE = "test.properties";
+ // @formatter:off
+ 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;
+ // @formatter:on
+ 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() {
+ File file = new File("test.properties");
+ if (file.exists()) {
+ System.out.println("File exists, Deleting it");
+ file.delete();
+ }
+ 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
index e07b9757c..c847fbb9f 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,82 +14,82 @@
* 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 com.google.common.io.Files;
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.FaultConfig;
-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" +
- "Protocol=http\n" +
- "username=username\n" +
- "password=password\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" +
- "jersey.config.client.readTimeout=25000\n" +
- "jersey.config.client.connectTimeout=25000\n" +
- "\n" +
- "";
+ // @formatter:off
+ private static final String TESTCONFIG_CONTENT = "[fault]\n"
+ + "faultConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer\n"
+ + "TransportType=HTTPNOAUTH\n"
+ + "Protocol=http\n"
+ + "username=username\n"
+ + "password=password\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"
+ + "jersey.config.client.readTimeout=25000\n"
+ + "jersey.config.client.connectTimeout=25000\n"
+ + "\n"
+ + "";
+ // @formatter:on
+
+ 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());
+ assertEquals("http", faultCfg.getProtocol());
+ assertEquals("username", faultCfg.getUsername());
+ assertEquals("password", faultCfg.getPassword());
+ assertEquals("25000", faultCfg.getClientReadTimeout());
+ assertEquals("25000", faultCfg.getClientConnectTimeout());
- private ConfigurationFileRepresentation cfg;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ }
+ }
- @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());
- assertEquals("http", faultCfg.getProtocol());
- assertEquals("username", faultCfg.getUsername());
- assertEquals("password", faultCfg.getPassword());
- assertEquals("25000", faultCfg.getClientReadTimeout());
- assertEquals("25000", faultCfg.getClientConnectTimeout());
+ @After
+ public void cleanUp() {
+ File file = new File("test.properties");
+ if (file.exists()) {
+ System.out.println("File exists, Deleting it");
+ file.delete();
+ }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- }
- }
-
- @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/TestFaultNotificationClient.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java
index b09b54f7e..0b9e2df24 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -31,27 +31,29 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultNotificatio
public class TestFaultNotificationClient extends FaultNotificationClient {
- public static String baseUrl = "http://localhost:8181";
- FaultNotificationClient testClient ;
+ public static String baseUrl = "http://localhost:8181";
+ FaultNotificationClient testClient;
- public TestFaultNotificationClient() {
- super(baseUrl);
+ 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"));
- }
+ @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)
+ @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");
+ 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
index 4eb5ba17b..c07ee480b 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,58 +14,57 @@
* 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 com.google.common.io.Files;
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" +
- "";
+ // @formatter:off
+ private static final String TESTCONFIG_CONTENT = "[general]\n"
+ + "dmaapEnabled=false\n"
+ + "baseUrl=http://localhost:8181\n"
+ + "sdnrUser=admin\n"
+ + "sdnrPasswd=admin\n"
+ + "";
+ // @formatter:on
+
+ 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();
+ }
+ }
- private ConfigurationFileRepresentation globalCfg;
+ @After
+ public void cleanUp() {
+ File file = new File("test.properties");
+ if (file.exists()) {
+ System.out.println("File exists, Deleting it");
+ file.delete();
+ }
- @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
index 3259f2e4c..7753c0975 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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 java.util.Optional;
@@ -36,8 +36,8 @@ public class TestMapping {
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 {
+ private String updateFaultPayload(String faultNodeId, String faultCounter, String faultOccurrenceTime,
+ String faultObjectId, String faultReason, String faultSeverity) throws JsonProcessingException {
PushFaultNotificationInputBuilder faultNotificationBuilder = new PushFaultNotificationInputBuilder();
faultNotificationBuilder.setNodeId(faultNodeId);
@@ -59,9 +59,9 @@ public class TestMapping {
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");
+ String result = updateFaultPayload("f1", "34", dt.getValue(), "fefef", "reason", "Critical");
- System.out.println("Res: "+result);
- }
+ 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
index af47f3d33..433972435 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START======================================================= ONAP : ccsdk
* feature sdnr wt ================================================================================
* Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
@@ -12,7 +12,7 @@
* 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;
@@ -58,12 +58,12 @@ public class TestMountpointRegistrarImpl {
// start using blueprint interface
try {
- mountpointRegistrar = new MountpointRegistrarImpl();
- mountpointRegistrar.init();
+ mountpointRegistrar = new MountpointRegistrarImpl();
+ mountpointRegistrar.init();
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
- fail("Not initialized" +sw.toString());
+ fail("Not initialized" + sw.toString());
}
System.out.println("Initialization status: " + mountpointRegistrar.isInitializationOk());
System.out.println("Initialization done");
@@ -75,7 +75,7 @@ public class TestMountpointRegistrarImpl {
System.out.println("Start shutdown");
// close using blueprint interface
try {
- mountpointRegistrar.close();
+ mountpointRegistrar.close();
} catch (Exception e) {
System.out.println(e);
}
@@ -94,7 +94,7 @@ public class TestMountpointRegistrarImpl {
// ********************* Private
@SuppressWarnings("unused")
- private static void sleep(int millis) {
+ private static void sleep(int millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
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
index 5a68e15bc..596522fc0 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -31,28 +31,30 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFMountPointCli
public class TestPNFMountPointClient extends PNFMountPointClient {
- public static String baseUrl = "http://localhost:8181";
- PNFMountPointClient testClient ;
+ public static String baseUrl = "http://localhost:8181";
+ PNFMountPointClient testClient;
- public TestPNFMountPointClient() {
- super(baseUrl);
+ 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"));
+ @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"));
- }
+ 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)
+ @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");
+ 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
index a5662c986..d1e9015e7 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -22,10 +22,10 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPVESMsgConsu
public class DummyFaultVESMsgConsumer extends DMaaPVESMsgConsumerImpl {
- @Override
- public void processMsg(String msg) throws Exception {
- System.out.println("Message received is - "+msg);
+ @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
index 368bbde11..a165182c0 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -23,10 +23,10 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPVESMsgConsu
public class DummyPNFRegVESMsgConsumer extends DMaaPVESMsgConsumerImpl {
- @Override
- public void processMsg(String msg) throws Exception {
- System.out.println("Message received is - "+msg);
+ @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
index d76b9db93..0b51b995d 100644
--- 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
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* 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;
@@ -24,14 +24,14 @@ import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegist
public class ClusterSingletonServiceProviderMock implements ClusterSingletonServiceProvider {
- @Override
- public void close() throws Exception {
+ @Override
+ public void close() throws Exception {
- }
+ }
- @Override
- public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) {
- return null;
- }
+ @Override
+ public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) {
+ return null;
+ }
}