summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/mountpoint-registrar
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2020-08-20 12:48:17 +0200
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2020-08-20 12:48:30 +0200
commit4277231cf397c2fbc12d4f5ca16d51c0f657bb4f (patch)
treed1682f24cdad7beefdb315a808034a4f58c60105 /sdnr/wt/mountpoint-registrar
parent57976923bf81939fe7cea8c316fa94071612c3ea (diff)
Fix code smells based on SonarCloud report
Bundles mountpoint-registrar and mountpoint-state-provider and also a Junit test case of aapter-manager devicemanager Issue-ID: CCSDK-2671 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: I84324e6433415bdc001d735e17930c2eb63bb439 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/mountpoint-registrar')
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPFaultVESMsgConsumer.java8
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPPNFRegVESMsgConsumer.java10
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumer.java1
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerImpl.java35
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerMain.java31
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultConfig.java10
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultNotificationClient.java6
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/GeneralConfig.java5
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/MountpointRegistrarImpl.java2
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFMountPointClient.java23
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFRegistrationConfig.java10
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java3
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java3
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java6
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java6
15 files changed, 68 insertions, 91 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 b0227da6f..649f9a86f 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
@@ -29,7 +29,6 @@ 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";
@@ -46,6 +45,7 @@ public class DMaaPFaultVESMsgConsumer extends DMaaPVESMsgConsumerImpl {
String faultObjectId;
String faultReason;
String faultSeverity;
+ String vesDomain;
int faultSequence;
ObjectMapper oMapper = new ObjectMapper();
JsonNode dmaapMessageRootNode;
@@ -53,6 +53,11 @@ public class DMaaPFaultVESMsgConsumer extends DMaaPVESMsgConsumerImpl {
LOG.info("Fault VES Message is - {}", msg);
try {
dmaapMessageRootNode = oMapper.readTree(msg);
+ vesDomain = dmaapMessageRootNode.at("/event/commonEventHeader/domain").textValue();
+ if (!vesDomain.equalsIgnoreCase("fault")) {
+ LOG.warn("Received {} domain VES Message in DMaaP Fault topic, ignoring it", vesDomain);
+ return;
+ }
faultNodeId = dmaapMessageRootNode.at("/event/commonEventHeader/sourceName").textValue();
faultOccurrenceTime =
dmaapMessageRootNode.at("/event/faultFields/alarmAdditionalInformation/eventTime").textValue();
@@ -60,7 +65,6 @@ public class DMaaPFaultVESMsgConsumer extends DMaaPVESMsgConsumerImpl {
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();
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 c412a7a91..b64f6c689 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
@@ -100,8 +100,14 @@ public class DMaaPPNFRegVESMsgConsumer extends DMaaPVESMsgConsumerImpl {
LOG.debug("Setting RESTConf Authorization values - {} : {}", sdnrUser, sdnrPasswd);
mountpointClient.setAuthorization(sdnrUser, sdnrPasswd);
- mountpointClient.pnfMountPointCreate(pnfId, pnfIPv4Address, pnfCommProtocol, pnfKeyId, pnfUsername,
- pnfPasswd, pnfCommPort);
+ if ((null != pnfId) && (null != pnfIPv4Address) && (null != pnfCommProtocol) && (null != pnfUsername)
+ && (null != pnfCommPort)) {
+ mountpointClient.pnfMountPointCreate(pnfId, pnfIPv4Address, pnfCommProtocol, pnfKeyId, pnfUsername,
+ pnfPasswd, pnfCommPort);
+ } else {
+ LOG.warn("One of the mandatory fields has a null value - pnfId = {} : pnfIPv4Address = {} : pnfCommProtocol = {} : pnfUsername {} : "
+ + "pnfCommPort {}", pnfId, pnfIPv4Address, pnfCommProtocol, pnfUsername, pnfCommPort, "- not invoking mountpoint creation");
+ }
} catch (IOException e) {
LOG.info("Cannot parse json object, ignoring the received PNF Registration VES Message. Reason: {}",
e.getMessage());
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 25f737583..2874c906f 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
@@ -22,7 +22,6 @@ import java.util.Properties;
public abstract interface DMaaPVESMsgConsumer extends Runnable {
- //public abstract void init(Properties baseProperties, String consumerPropertiesPath);
public abstract void init(Properties baseProperties);
public abstract void processMsg(String msg) throws Exception;//Implement something like InvalidMessageException;
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 66cce840f..ac6c7f92d 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
@@ -19,13 +19,11 @@
package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl;
import java.util.Properties;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.onap.dmaap.mr.client.MRClientFactory;
import org.onap.dmaap.mr.client.MRConsumer;
import org.onap.dmaap.mr.client.response.MRConsumerResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
@@ -34,7 +32,6 @@ public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
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
@@ -45,7 +42,7 @@ public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
}
/*
- * Thread to fetch messages from the DMaaP topic. Waits for the messages to arrive on the topic until a certain timeout and returns.
+ * 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
@@ -56,16 +53,17 @@ public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
while (running) {
try {
boolean noData = true;
+ MRConsumerResponse consumerResponse = null;
consumerResponse = consumer.fetchWithReturnConsumerResponse(timeout, -1);
for (String msg : consumerResponse.getActualMessages()) {
noData = false;
- LOG.debug(name + " received ActualMessage from DMaaP VES Message topic:\n" + msg);
+ LOG.debug("{} received ActualMessage from DMaaP VES Message topic {}", name,msg);
processMsg(msg);
}
if (noData) {
- LOG.debug(name + " received ResponseCode: " + consumerResponse.getResponseCode());
- LOG.debug(name + " received ResponseMessage: " + consumerResponse.getResponseMessage());
+ LOG.debug("{} received ResponseCode: {}", name, consumerResponse.getResponseCode());
+ LOG.debug("{} received ResponseMessage: {}", name, consumerResponse.getResponseMessage());
if ((consumerResponse.getResponseCode() == null)
&& (consumerResponse.getResponseMessage().contains("SocketTimeoutException"))) {
LOG.warn("Client timeout while waiting for response from Server {}",
@@ -82,7 +80,7 @@ public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
}
/*
- * Create a consumer by specifying properties containing information such as topic name, timeout, URL etc
+ * Create a consumer by specifying properties containing information such as topic name, timeout, URL etc
*/
@Override
public void init(Properties properties) {
@@ -90,23 +88,23 @@ public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
try {
String timeoutStr = properties.getProperty("timeout");
- LOG.debug("timeoutStr: " + timeoutStr);
+ LOG.debug("timeoutStr: {}", timeoutStr);
if ((timeoutStr != null) && (timeoutStr.length() > 0)) {
timeout = parseTimeOutValue(timeoutStr);
}
String fetchPauseStr = properties.getProperty("fetchPause");
- LOG.debug("fetchPause(Str): " + fetchPauseStr);
+ LOG.debug("fetchPause(Str): {}",fetchPauseStr);
if ((fetchPauseStr != null) && (fetchPauseStr.length() > 0)) {
fetchPause = parseFetchPause(fetchPauseStr);
}
- LOG.debug("fetchPause: " + fetchPause);
+ 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);
+ LOG.error("Error initializing DMaaP VES Message consumer from file {} {}",properties, e);
}
}
@@ -114,7 +112,7 @@ public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
try {
return Integer.parseInt(timeoutStr);
} catch (NumberFormatException e) {
- LOG.error("Non-numeric value specified for timeout (" + timeoutStr + ")");
+ LOG.error("Non-numeric value specified for timeout ({})",timeoutStr);
}
return timeout;
}
@@ -123,14 +121,14 @@ public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
try {
return Integer.parseInt(fetchPauseStr);
} catch (NumberFormatException e) {
- LOG.error("Non-numeric value specified for fetchPause (" + fetchPauseStr + ")");
+ 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));
+ LOG.debug("No data received from fetch. Pausing {} ms before retry", fetchPause);
Thread.sleep(fetchPause);
} else {
LOG.debug("No data received from fetch. No fetch pause specified - retrying immediately");
@@ -156,6 +154,7 @@ public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
running = false;
}
- public abstract void processMsg(String msg) throws Exception;
+ /*@Override
+ 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 97dd79577..3503aed8c 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
@@ -29,15 +29,18 @@ import org.slf4j.LoggerFactory;
public class DMaaPVESMsgConsumerMain implements Runnable {
private static final Logger LOG = LoggerFactory.getLogger(DMaaPVESMsgConsumerMain.class);
- private static final String pnfRegClass =
+ private static final String _PNFREG_CLASS =
"org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer";
- private static final String faultClass =
+ private static final String _FAULT_CLASS =
"org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer";
+ private static final String _PNFREG_DOMAIN = "pnfRegistration";
+ private static final String _FAULT_DOMAIN = "fault";
+
boolean threadsRunning = false;
List<DMaaPVESMsgConsumer> consumers = new LinkedList<>();
- public PNFRegistrationConfig pnfRegistrationConfig;
- public FaultConfig faultConfig;
- public GeneralConfig generalConfig;
+ private PNFRegistrationConfig pnfRegistrationConfig;
+ private FaultConfig faultConfig;
+ private GeneralConfig generalConfig;
public DMaaPVESMsgConsumerMain(Map<String, Configuration> configMap, GeneralConfig generalConfig) {
this.generalConfig = generalConfig;
@@ -48,11 +51,11 @@ public class DMaaPVESMsgConsumerMain implements Runnable {
LOG.debug("In initialize method : Domain = {} and domainConfig = {}", domain, domainConfig);
String consumerClass = null;
Properties consumerProperties = new Properties();
- if (domain.equalsIgnoreCase("pnfregistration")) {
+ if (domain.equalsIgnoreCase(_PNFREG_DOMAIN)) {
this.pnfRegistrationConfig = (PNFRegistrationConfig) domainConfig;
- consumerClass = pnfRegistrationConfig.getConsumerClass();
- LOG.debug("Consumer class = " + consumerClass);
+ consumerClass = _PNFREG_CLASS;
+ LOG.debug("Consumer class = {}",consumerClass);
consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_TRANSPORTTYPE,
pnfRegistrationConfig.getTransportType());
@@ -80,10 +83,10 @@ public class DMaaPVESMsgConsumerMain implements Runnable {
pnfRegistrationConfig.getClientReadTimeout());
consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT,
pnfRegistrationConfig.getClientConnectTimeout());
- threadsRunning = createConsumer("pnfRegistration", consumerProperties);
- } else if (domain.equalsIgnoreCase("fault")) {
+ threadsRunning = createConsumer(_PNFREG_DOMAIN, consumerProperties);
+ } else if (domain.equalsIgnoreCase(_FAULT_DOMAIN)) {
this.faultConfig = (FaultConfig) domainConfig;
- consumerClass = faultConfig.getConsumerClass();
+ consumerClass = _FAULT_CLASS;
LOG.debug("Consumer class = {}", consumerClass);
consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_TRANSPORTTYPE, faultConfig.getTransportType());
consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_HOST_PORT, faultConfig.getHostPort());
@@ -101,7 +104,7 @@ public class DMaaPVESMsgConsumerMain implements Runnable {
faultConfig.getClientReadTimeout());
consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT,
faultConfig.getClientConnectTimeout());
- threadsRunning = createConsumer("fault", consumerProperties);
+ threadsRunning = createConsumer(_FAULT_DOMAIN, consumerProperties);
}
}
@@ -118,9 +121,9 @@ public class DMaaPVESMsgConsumerMain implements Runnable {
public boolean createConsumer(String consumerType, Properties properties) {
DMaaPVESMsgConsumerImpl consumer = null;
- if (consumerType.equalsIgnoreCase("pnfRegistration"))
+ if (consumerType.equalsIgnoreCase(_PNFREG_DOMAIN))
consumer = new DMaaPPNFRegVESMsgConsumer(generalConfig);
- else if (consumerType.equalsIgnoreCase("fault"))
+ else if (consumerType.equalsIgnoreCase(_FAULT_DOMAIN))
consumer = new DMaaPFaultVESMsgConsumer(generalConfig);
handleConsumer(consumer, properties, 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 6477ebbec..dfdb1c00b 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
@@ -23,10 +23,6 @@ import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRep
public class FaultConfig implements Configuration {
private static final String SECTION_MARKER = "fault";
- private static final String PROPERTY_KEY_CONSUMER_CLASS = "faultConsumerClass";
- private static final String DEFAULT_VALUE_CONSUMER_CLASS =
- "org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer";
-
public static final String PROPERTY_KEY_CONSUMER_TRANSPORTTYPE = "TransportType";
private static final String DEFAULT_VALUE_CONSUMER_TRANSPORTTYPE = "HTTPNOAUTH";
@@ -85,8 +81,6 @@ public class FaultConfig implements Configuration {
@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,
@@ -117,10 +111,6 @@ public class FaultConfig implements Configuration {
}
- 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);
}
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 3fdbb6f20..11f46fff7 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
@@ -68,7 +68,7 @@ public class FaultNotificationClient extends BaseHTTPClient {
message = updateFaultPayload(faultNodeId, faultCounter, faultOccurrenceTime, faultObjectId, faultReason,
faultSeverity);
- LOG.debug("Payload after updating values is: " + message);
+ LOG.debug("Payload after updating values is: {}",message);
return sendFaultRequest("POST", message) == 200;
@@ -88,7 +88,7 @@ public class FaultNotificationClient extends BaseHTTPClient {
private int sendFaultRequest(String method, String message) {
- LOG.debug("In sendFaultRequest - " + method + " " + message);
+ LOG.debug("In sendFaultRequest - {}-{}",method,message);
BaseHTTPResponse response;
try {
String uri = FAULT_NOTIFICATION_URI;
@@ -96,7 +96,7 @@ public class FaultNotificationClient extends BaseHTTPClient {
LOG.debug("finished with responsecode {}", response.code);
return response.code;
} catch (IOException e) {
- LOG.warn("problem sending fault message {} : {}", e.getMessage());
+ 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 2ad5431be..eec4e7a9e 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
@@ -32,7 +32,7 @@ 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";
private static final String PROPERTY_KEY_USER = "sdnrUser";
private static final String DEFAULT_VALUE_USER = "${SDNRUSERNAME}";
@@ -53,8 +53,7 @@ public class GeneralConfig implements Configuration {
}
public Boolean getEnabled() {
- Boolean enabled = configuration.getPropertyBoolean(SECTION_MARKER, PROPERTY_KEY_ENABLED);
- return enabled;
+ return configuration.getPropertyBoolean(SECTION_MARKER, PROPERTY_KEY_ENABLED);
}
public String getBaseUrl() {
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 94b15a54c..53454ac03 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
@@ -102,8 +102,6 @@ public class MountpointRegistrarImpl implements AutoCloseable, IConfigChangedLis
@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);
}
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 f8653ca75..22b4e5f22 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
@@ -57,21 +57,21 @@ public class PNFMountPointClient extends BaseHTTPClient {
+ " <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"
+ + " <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"
+ + " <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"
+ + "<!-- 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
@@ -128,7 +128,6 @@ public class PNFMountPointClient extends BaseHTTPClient {
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);
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 dd4d2864a..636df4104 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
@@ -24,10 +24,6 @@ import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRep
public class PNFRegistrationConfig implements Configuration {
private static final String SECTION_MARKER = "pnfRegistration";
- private static final String PROPERTY_KEY_CONSUMER_CLASS = "pnfRegConsumerClass";
- private static final String DEFAULT_VALUE_CONSUMER_CLASS =
- "org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer";
-
public static final String PROPERTY_KEY_CONSUMER_TRANSPORTTYPE = "TransportType";
private static final String DEFAULT_VALUE_CONSUMER_TRANSPORTTYPE = "HTTPNOAUTH";
@@ -86,8 +82,6 @@ public class PNFRegistrationConfig implements Configuration {
@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,
@@ -117,10 +111,6 @@ public class PNFRegistrationConfig implements Configuration {
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);
}
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 80e037da6..87a70d795 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
@@ -32,7 +32,6 @@ public class PNFRegistrationConfigTest {
// @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"
@@ -59,8 +58,6 @@ public class PNFRegistrationConfigTest {
cfg = new ConfigurationFileRepresentation(configFile);
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());
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 3caa864d5..f44bebcee 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
@@ -32,7 +32,6 @@ public class TestFaultConfig {
// @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"
@@ -60,8 +59,6 @@ public class TestFaultConfig {
cfg = new ConfigurationFileRepresentation(CONFIGURATIONFILE);
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());
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 7e7bece17..9fb35e6ba 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
@@ -19,12 +19,9 @@
package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test;
import static org.junit.Assert.assertEquals;
-
import java.io.IOException;
import java.util.Map;
-
import javax.annotation.Nonnull;
-
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPResponse;
import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultNotificationClient;
@@ -51,7 +48,8 @@ public class TestFaultNotificationClient extends FaultNotificationClient {
}
@Override
- public @Nonnull BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers)
+ @Nonnull
+ public BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers)
throws IOException {
System.out.println("In overridden sendRequest in TestFaultNotificationClient");
return new BaseHTTPResponse(200, body);
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java
index 8694963a9..591ed5b24 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
@@ -19,12 +19,9 @@
package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test;
import static org.junit.Assert.assertEquals;
-
import java.io.IOException;
import java.util.Map;
-
import javax.annotation.Nonnull;
-
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPResponse;
import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFMountPointClient;
@@ -52,7 +49,8 @@ public class TestPNFMountPointClient extends PNFMountPointClient {
}
@Override
- public @Nonnull BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers)
+ @Nonnull
+ public BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers)
throws IOException {
System.out.println("In overridden sendRequest in TestPNFMountPointClient");
return new BaseHTTPResponse(200, body);