summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-core
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/devicemanager-core')
-rw-r--r--sdnr/wt/devicemanager-core/model/src/main/yang/devicemanager.yang11
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/config/AaiClientPropertiesFile.java31
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java16
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java15
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java20
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java21
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/PushNotifications.java5
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/FaultEntityManager.java17
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java9
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java5
-rw-r--r--sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java1
11 files changed, 111 insertions, 40 deletions
diff --git a/sdnr/wt/devicemanager-core/model/src/main/yang/devicemanager.yang b/sdnr/wt/devicemanager-core/model/src/main/yang/devicemanager.yang
index a34ea49a4..e12991b29 100644
--- a/sdnr/wt/devicemanager-core/model/src/main/yang/devicemanager.yang
+++ b/sdnr/wt/devicemanager-core/model/src/main/yang/devicemanager.yang
@@ -22,6 +22,8 @@ module devicemanager {
Copyright 2019 highstreet technologies GmbH Intellectual Property.
All rights reserved.
+ Update Copyright 2021 Samsung Electronics Intellectual Property.
+ All rights reserved.
Licensed under the Apache License, Version 2.0 (the 'License');
you may not use this file except in compliance with the License.
@@ -313,6 +315,15 @@ module devicemanager {
}
}
+ rpc push-cm-notification {
+ description
+ "Forward CM notification";
+ input {
+ uses data-provider:object-change-reference;
+ uses data-provider:cm;
+ }
+ }
+
rpc push-attribute-change-notification {
description
"Forward attribute change notification of a network-element";
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/config/AaiClientPropertiesFile.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/config/AaiClientPropertiesFile.java
index 8329ec0e9..1e9629b03 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/config/AaiClientPropertiesFile.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/config/AaiClientPropertiesFile.java
@@ -19,11 +19,16 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl.config;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class AaiClientPropertiesFile {
+ private static final Logger log = LoggerFactory.getLogger(AaiClientPropertiesFile.class);
+
private final File mFile;
private String mPCKS12CertFilename;
private String mPCKS12Passphrase;
@@ -73,19 +78,21 @@ public class AaiClientPropertiesFile {
this.mFile = new File(filename);
}
- public void load() throws IOException, NumberFormatException {
+ public void load() throws IOException {
Properties defaultProps = new Properties();
- FileInputStream in = new FileInputStream(this.mFile);
- defaultProps.load(in);
- this.mPCKS12CertFilename = defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.ssl.key", null);
- this.mPCKS12Passphrase = defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd", null);
- this.mTrustInsecureSSL = defaultProps
+
+ try (FileInputStream in = new FileInputStream(this.mFile)) {
+ defaultProps.load(in);
+ this.mPCKS12CertFilename = defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.ssl.key", null);
+ this.mPCKS12Passphrase = defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd", null);
+ this.mTrustInsecureSSL = defaultProps
.getProperty("org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore", "false").equals("true");
- this.mApplicationIdentifier = defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.application", null);
- this.mRemoteUrl = defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.uri", null);
- this.mConnectionTimeout = Integer.parseInt(defaultProps.getProperty("connection.timeout", "60000"));
- this.mReadTimeout = Integer.parseInt(defaultProps.getProperty("read.timeout", "60000"));
- in.close();
+ this.mApplicationIdentifier = defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.application", null);
+ this.mRemoteUrl = defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.uri", null);
+ this.mConnectionTimeout = Integer.parseInt(defaultProps.getProperty("connection.timeout", "60000"));
+ this.mReadTimeout = Integer.parseInt(defaultProps.getProperty("read.timeout", "60000"));
+ } catch (FileNotFoundException fnfe) {
+ log.error("File - {} not found",getFilename());
+ }
}
-
}
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java
index 037f09778..4543ab0b4 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java
@@ -22,6 +22,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
+import org.eclipse.jdt.annotation.NonNull;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
@@ -33,6 +34,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificatio
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientInternal;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EventHandlingService;
import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.ReadTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
@@ -158,12 +160,16 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea
.child(Topology.class, new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName())))
.child(Node.class, new NodeKey(nodeId)).augmentation(NetconfNode.class);
+ //Implicit close of try with resource is not handled correctly by underlying opendaylight NETCONF service
+ @NonNull
+ ReadTransaction readTransaction = this.dataBroker.newReadOnlyTransaction();
try {
- Optional<NetconfNode> onode =
- this.dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, iif).get();
- return onode;
- } catch (InterruptedException | ExecutionException e) {
- LOG.warn("problem requesting netconfnode again:", e);
+ return readTransaction.read(LogicalDatastoreType.CONFIGURATION, iif).get();
+ } catch (InterruptedException e) {
+ LOG.warn("InterruptedException occurred - problem requesting netconfnode again:", e);
+ Thread.currentThread().interrupt();
+ } catch (ExecutionException e) {
+ LOG.warn("ExecutionException occurred - problem requesting netconfnode again:", e);
}
}
return Optional.empty();
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java
index 90e07e666..a9c043e03 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java
@@ -7,6 +7,8 @@
* ================================================================================
* Update Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Update Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved.
+ * =================================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -29,6 +31,8 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.PushNotifications;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientInternal;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CmlogBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CmlogEntity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultcurrentBuilder;
@@ -41,6 +45,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicema
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ProblemNotification;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ProblemNotificationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushAttributeChangeNotificationInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushCmNotificationInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInput;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.slf4j.Logger;
@@ -106,4 +111,14 @@ public class RpcPushNotificationsHandler implements PushNotifications {
webSocketService.sendViaWebsockets(new NodeId(input.getNodeId()!=null?input.getNodeId():OWNKEYNAME), notification, ProblemNotification.QNAME, input.getTimestamp());
}
+ @Override
+ public void pushCMNotification(PushCmNotificationInput input) {
+ LOG.debug("Got CM event {}", input);
+
+ CmlogBuilder cmlogBuilder = new CmlogBuilder();
+ cmlogBuilder.setSourceType(SourceType.Ves);
+ cmlogBuilder.fieldsFrom(input);
+ CmlogEntity cmlogEntity = cmlogBuilder.build();
+ databaseService.writeCMLog(cmlogEntity);
+ }
}
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java
index 49c678ebc..02c32d91b 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java
@@ -192,15 +192,20 @@ public class ConnectionStatusHousekeepingService
private ConnectionLogStatus getMDSalConnectionStatus(String nodeId) {
- @SuppressWarnings("null")
@NonNull
InstanceIdentifier<Node> instanceIdentifier =
NETCONF_TOPO_IID.child(Node.class, new NodeKey(new NodeId(nodeId)));
+ //Implicit close of try with resource is not handled correctly by underlying opendaylight NETCONF service
ReadTransaction trans = this.dataBroker.newReadOnlyTransaction();
- FluentFuture<Optional<Node>> optionalNode = trans.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier);
try {
- //Node node = optionalNode.get(5, TimeUnit.SECONDS).get();
- Node node = optionalNode.get().get();
+ FluentFuture<Optional<Node>> optionalNode =
+ trans.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier);
+ Optional<Node> nodeOpt = optionalNode.get();
+ if (nodeOpt.isEmpty()) {
+ LOG.warn("unable to get node info");
+ return null;
+ }
+ Node node = nodeOpt.get();
LOG.debug("node is {}", node);
NetconfNode nNode = node.augmentation(NetconfNode.class);
LOG.debug("nnode is {}", nNode);
@@ -209,8 +214,11 @@ public class ConnectionStatusHousekeepingService
}
} catch (NoSuchElementException e) {
return ConnectionLogStatus.Disconnected;
- } catch (ExecutionException | InterruptedException e) {// | TimeoutException e) {
- LOG.warn("unable to get node info: {}", e);
+ } catch (InterruptedException e) {
+ LOG.warn("InterruptedException unable to get node info: ", e);
+ Thread.currentThread().interrupt();
+ } catch (ExecutionException e) {// | TimeoutException e) {
+ LOG.warn("ExecutionException unable to get node info: ", e);
} finally {
trans.close();
}
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java
index 266bb04ba..e31b79aea 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java
@@ -4,6 +4,8 @@
* =================================================================================================
* Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
+ * Update Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved.
+ * =================================================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
@@ -17,6 +19,7 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.List;
import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.housekeeping.ResyncNetworkElementsListener;
@@ -35,6 +38,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicema
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetRequiredNetworkElementKeysOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushAttributeChangeNotificationInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushAttributeChangeNotificationOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushCmNotificationInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushCmNotificationOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SetMaintenanceModeInput;
@@ -53,8 +58,6 @@ import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.util.concurrent.ListenableFuture;
-
public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(DevicemanagerService.class);
@@ -220,6 +223,20 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl
}
@Override
+ public ListenableFuture<RpcResult<PushCmNotificationOutput>> pushCmNotification(PushCmNotificationInput input) {
+ LOG.info("RPC Received CM notification {}", input);
+ RpcResultBuilder<PushCmNotificationOutput> result;
+ try {
+ pushNotificationsListener.pushCMNotification(input);
+ result = RpcResultBuilder.success();
+ } catch (Exception e) {
+ result = RpcResultBuilder.failed();
+ result.withError(ErrorType.APPLICATION, "Exception", e);
+ }
+ return result.buildFuture();
+ }
+
+ @Override
public ListenableFuture<RpcResult<PushAttributeChangeNotificationOutput>> pushAttributeChangeNotification(
PushAttributeChangeNotificationInput input) {
LOG.info("RPC Received change notification {}", input);
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/PushNotifications.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/PushNotifications.java
index f424878f8..8d32c8cc0 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/PushNotifications.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/PushNotifications.java
@@ -4,6 +4,8 @@
* =================================================================================================
* Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
+ * Update Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved.
+ * =================================================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
@@ -19,6 +21,7 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushAttributeChangeNotificationInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushCmNotificationInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInput;
public interface PushNotifications {
@@ -27,4 +30,6 @@ public interface PushNotifications {
void pushFaultNotification(PushFaultNotificationInput input);
+ void pushCMNotification(PushCmNotificationInput input);
+
}
diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/FaultEntityManager.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/FaultEntityManager.java
index 785f5dbab..7c83a08dc 100644
--- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/FaultEntityManager.java
+++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/FaultEntityManager.java
@@ -17,15 +17,13 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Fault;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultcurrentEntity;
public class FaultEntityManager {
- private static final Pattern pattern = Pattern.compile(".*\\[layerProtocol=(.*)\\]");
+ private static final String FAULT_TAG = "[layerProtocol=";
/**
* The leading indication for notification or events that are not in the currentProblem data of the ONF Coremodel
@@ -34,7 +32,7 @@ public class FaultEntityManager {
/**
* Specific problems are not moving into current problem list
- *
+ *
* @param problemName to be verified
* @return true if problem is current
*/
@@ -48,7 +46,7 @@ public class FaultEntityManager {
/**
* Specific problems are not moving into current problem list
- *
+ *
* @param fault to be verified
* @return true if cleared indication
*/
@@ -59,16 +57,15 @@ public class FaultEntityManager {
/**
* Create a specific ES id for the current log.
- *
+ *
* @return a string with the generated ES Id
*/
public static String genSpecificEsId(String nodeName, String objectId, String problemName) {
String uuId;
- Matcher matcher = pattern.matcher(objectId);
- if (matcher.matches() && matcher.groupCount() == 1) {
- uuId = matcher.group(1);
+ if (objectId.endsWith("]") && objectId.contains(FAULT_TAG)) {
+ uuId = objectId.substring(objectId.indexOf(FAULT_TAG) + FAULT_TAG.length(), objectId.length()-1);
} else {
uuId = objectId;
}
@@ -84,7 +81,7 @@ public class FaultEntityManager {
/**
* Create Es id
- *
+ *
* @param fault used to create uuid for faultcurrent
* @return String with Id
*/
diff --git a/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java b/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java
index 02d381ff2..627192365 100644
--- a/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java
+++ b/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java
@@ -115,7 +115,8 @@ public class TestAai {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
- e.printStackTrace();
+ System.out.println("Break sleep : " + e.getMessage());
+ Thread.currentThread().interrupt();
}
System.out.println("unregistering device");
provider.onDeviceUnregistered(new NodeId(mountPointName));
@@ -132,7 +133,8 @@ public class TestAai {
try {
Thread.sleep(3000);
} catch (InterruptedException e1) {
- e1.printStackTrace();
+ System.out.println("Break sleep : " + e1.getMessage());
+ Thread.currentThread().interrupt();
}
AaiProviderClient provider = new AaiProviderClient(globalCfg, null);
@@ -151,7 +153,8 @@ public class TestAai {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
- e.printStackTrace();
+ System.out.println("Break sleep : " + e.getMessage());
+ Thread.currentThread().interrupt();
}
System.out.println("unregistering device");
provider.onDeviceUnregistered(new NodeId(mountPointName));
diff --git a/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java b/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java
index a403fe4a6..4bad25ce7 100644
--- a/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java
+++ b/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java
@@ -97,12 +97,13 @@ public class TestDcae {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
- e.printStackTrace();
+ System.out.println("Break sleep : " + e.getMessage());
+ Thread.currentThread().interrupt();
}
try {
provider.close();
} catch (Exception e) {
- e.printStackTrace();
+ System.out.println("Close provider error : " + e.getMessage());
}
}
diff --git a/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java b/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java
index 9b533b554..987424d04 100644
--- a/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java
+++ b/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java
@@ -124,6 +124,7 @@ public class TestDevMgrPropertiesFile {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
}
}