summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager/provider/src
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/devicemanager/provider/src')
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java68
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java95
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java18
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java17
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalSeverity.java72
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/AttributeValueChangedNotificationXml.java87
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/GetEventType.java4
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/MwtNotificationBase.java47
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectCreationNotificationXml.java67
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectDeletionNotificationXml.java66
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ProblemNotificationXml.java5
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.java (renamed from sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientDummyImpl.java)39
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java74
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.java8
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java44
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayService.java9
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml2
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java7
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlMapper.java61
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlNotification.java92
20 files changed, 230 insertions, 652 deletions
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java
index 960f64fe0..830969a10 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java
@@ -24,9 +24,6 @@ import org.onap.ccsdk.features.sdnr.wt.common.HtAssert;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeForwarderInternal;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientInternal;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.impl.MaintenanceServiceImpl;
@@ -39,15 +36,20 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.Notificat
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EquipmentData;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EventlogNotificationBuilder;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultNotificationBuilder2;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Faultcurrent;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultcurrentBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.AttributeValueChangedNotification;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.AttributeValueChangedNotificationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectCreationNotification;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectCreationNotificationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectDeletionNotification;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectDeletionNotificationBuilder;
+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.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -93,7 +95,12 @@ public class DeviceManagerDatabaseNotificationService implements NotificationSer
nodeId = "EmptyNodeId";
}
databaseService.writeEventLog(eventNotification);
- webSocketService.sendViaWebsockets(nodeId, new AttributeValueChangedNotificationXml(eventNotification));
+ AttributeValueChangedNotification notification = new AttributeValueChangedNotificationBuilder()
+ .setAttributeName(eventNotification.getAttributeName()).setCounter(eventNotification.getCounter())
+ .setNewValue(eventNotification.getNewValue()).setObjectIdRef(eventNotification.getObjectId())
+ .setTimeStamp(eventNotification.getTimestamp()).build();
+ this.webSocketService.sendViaWebsockets(nodeId, notification, AttributeValueChangedNotification.QNAME,
+ eventNotification.getTimestamp());
}
@Override
@@ -101,8 +108,7 @@ public class DeviceManagerDatabaseNotificationService implements NotificationSer
@Nullable String objectId, @Nullable String attributeName, @Nullable String newValue) {
EventlogEntity eventlogEntity =
new EventlogNotificationBuilder(nodeId, counter, timeStamp, objectId, attributeName, newValue).build();
- databaseService.writeEventLog(eventlogEntity);
- webSocketService.sendViaWebsockets(nodeId.getValue(), new AttributeValueChangedNotificationXml(eventlogEntity));
+ this.eventNotification(eventlogEntity);
}
@Override
@@ -111,7 +117,10 @@ public class DeviceManagerDatabaseNotificationService implements NotificationSer
EventlogEntity eventlogEntity =
new EventlogNotificationBuilder(nodeId, counter, timeStamp, objectId, "creation", null).build();
databaseService.writeEventLog(eventlogEntity);
- webSocketService.sendViaWebsockets(nodeId.getValue(), new ObjectCreationNotificationXml(eventlogEntity));
+ ObjectCreationNotification notification = new ObjectCreationNotificationBuilder().setCounter(counter)
+ .setObjectIdRef(objectId).setTimeStamp(eventlogEntity.getTimestamp()).build();
+ this.webSocketService.sendViaWebsockets(nodeId.getValue(), notification, ObjectCreationNotification.QNAME,
+ eventlogEntity.getTimestamp());
}
@@ -121,18 +130,19 @@ public class DeviceManagerDatabaseNotificationService implements NotificationSer
EventlogEntity eventlogEntity =
new EventlogNotificationBuilder(nodeId, counter, timeStamp, objectId, "deletion", null).build();
databaseService.writeEventLog(eventlogEntity);
- webSocketService.sendViaWebsockets(nodeId.getValue(), new ObjectDeletionNotificationXml(eventlogEntity));
+ ObjectDeletionNotification notification = new ObjectDeletionNotificationBuilder().setCounter(counter)
+ .setObjectIdRef(objectId).setTimeStamp(eventlogEntity.getTimestamp()).build();
+ this.webSocketService.sendViaWebsockets(nodeId.getValue(), notification, ObjectDeletionNotification.QNAME,
+ eventlogEntity.getTimestamp());
}
@Override
- public void writeEquipment(@NonNull EquipmentData equipment) {
- //equipment.getList().forEach(card -> databaseService.writeInventory(card));
+ public void writeEquipment(NodeId nodeId, @NonNull EquipmentData equipment) {
HtAssert.nonnull(equipment);
List<Inventory> list = equipment.getList();
HtAssert.nonnull(list);
- for (Inventory card : list) {
- databaseService.writeInventory(card);
- }
+ databaseService.writeInventory(nodeId.getValue(), list);
+
}
@Override
@@ -151,16 +161,12 @@ public class DeviceManagerDatabaseNotificationService implements NotificationSer
} else {
this.pushAlarmIfNotInMaintenance(nodeName, notificationXml);
}
- // ToggleAlarmFilter functionality
- // if (notificationDelayService.processNotification(notificationXml.getSeverity() == InternalSeverity.NonAlarmed,
- // notificationXml.getProblem(), notificationXml)) {
- // if (notificationDelayService.processNotification(notificationXml)) {
- // aotsDcaeForwarder.sendProblemNotificationUsingMaintenanceFilter(nodeName, notificationXml);
- // }
- // }
- // end of ToggleAlarmFilter
-
- this.webSocketService.sendViaWebsockets(nodeName, notificationXml);
+ ProblemNotification notification = new ProblemNotificationBuilder().setCounter(faultNotification.getCounter())
+ .setObjectIdRef(faultNotification.getObjectId()).setTimeStamp(faultNotification.getTimestamp())
+ .setProblem(faultNotification.getProblem())
+ .setSeverity(InternalSeverity.toYang(faultNotification.getSeverity())).build();
+ this.webSocketService.sendViaWebsockets(faultNotification.getNodeId(), notification,
+ ObjectDeletionNotification.QNAME, faultNotification.getTimestamp());
}
private void pushAlarmIfNotInMaintenance(String nodeName, ProblemNotificationXml notificationXml) {
@@ -174,15 +180,6 @@ public class DeviceManagerDatabaseNotificationService implements NotificationSer
}
@Override
- public void faultNotification(@NonNull NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp,
- @Nullable String objectId, @Nullable String problem, @Nullable SeverityType severity) {
- FaultNotificationBuilder2 bFaultlog = new FaultNotificationBuilder2(nodeId, counter, timeStamp, objectId,
- problem, severity, SourceType.Netconf);
- faultNotification(bFaultlog.build());
-
- }
-
- @Override
public int removeAllCurrentProblemsOfNode(@NonNull NodeId nodeId) {
int deleted = databaseService.clearFaultsCurrentOfNode(nodeId.getValue());
return deleted;
@@ -215,4 +212,5 @@ public class DeviceManagerDatabaseNotificationService implements NotificationSer
LOG.debug("Got delayed event of type :: {}", ProblemNotificationXml.class.getSimpleName());
this.pushAlarmIfNotInMaintenance(nodeName, notification);
}
+
}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java
index fb84bfc1b..d031d25b6 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java
@@ -20,7 +20,6 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
-
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;
@@ -28,19 +27,27 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeForw
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.NetworkElementConnectionEntitiyUtil;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientInternal;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EventHandlingService;
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;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionLogStatus;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Connectionlog;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionlogBuilder;
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.NetworkElementConnectionEntity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.AttributeValueChangedNotification;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.AttributeValueChangedNotificationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectCreationNotification;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectCreationNotificationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectDeletionNotification;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectDeletionNotificationBuilder;
+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.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -105,28 +112,32 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea
/**
* (NonConnected) A registration after creation of a mountpoint occured
- *
+ *
* @param registrationName of device (mountpoint name)
* @param nNode with mountpoint data
*/
@Override
public void registration(String registrationName, NetconfNode nNode) {
- ObjectCreationNotificationXml cNotificationXml = new ObjectCreationNotificationXml(ownKeyName, popEvntNumber(),
- InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName);
+ DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp();
+ ObjectCreationNotification notification = new ObjectCreationNotificationBuilder()
+ .setObjectIdRef(registrationName).setCounter(popEvntNumber()).setTimeStamp(ts).build();
+ Connectionlog log = new ConnectionlogBuilder().setNodeId(registrationName)
+ .setStatus(ConnectionLogStatus.Mounted).setTimestamp(ts).build();
NetworkElementConnectionEntity e =
NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode);
LOG.debug("registration networkelement-connection for {} with status {}", registrationName, e.getStatus());
// Write first to prevent missing entries
databaseService.updateNetworkConnection22(e, registrationName);
- databaseService.writeConnectionLog(cNotificationXml.getConnectionlogEntity());
- webSocketService.sendViaWebsockets(registrationName, cNotificationXml);
+ databaseService.writeConnectionLog(log);
+ webSocketService.sendViaWebsockets(ownKeyName, notification, ObjectCreationNotification.QNAME,
+ NetconfTimeStampImpl.getConverter().getTimeStamp());
}
/**
* (Connected) mountpoint state moves to connected
- *
+ *
* @param mountpointNodeName uuid that is nodeId or mountpointId
* @param deviceType according to assessement
*/
@@ -141,16 +152,16 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea
if (!databaseService.updateNetworkConnectionDeviceType(e, mountpointNodeName)) {
this.updateNeConnectionRetryWithDelay(e, mountpointNodeName);
}
-
- AttributeValueChangedNotificationXml notificationXml = new AttributeValueChangedNotificationXml(ownKeyName,
- popEvntNumber(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), mountpointNodeName,
- "deviceType", deviceType.name());
- webSocketService.sendViaWebsockets(mountpointNodeName, notificationXml);
+ DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp();
+ AttributeValueChangedNotification notification = new AttributeValueChangedNotificationBuilder()
+ .setCounter(popEvntNumber()).setTimeStamp(ts).setObjectIdRef(mountpointNodeName)
+ .setAttributeName("deviceType").setNewValue(deviceType.name()).build();
+ webSocketService.sendViaWebsockets(ownKeyName, notification, AttributeValueChangedNotification.QNAME, ts);
}
/**
* (NonConnected) mountpoint state changed.
- *
+ *
* @param mountpointNodeName nodeid
* @param netconfNode node
*/
@@ -164,34 +175,39 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea
/**
* (NonConnected) A deregistration after removal of a mountpoint occured.
- *
+ *
* @param registrationName Name of the event that is used as key in the database.
*/
@SuppressWarnings("null")
@Override
public void deRegistration(String registrationName) {
- ObjectDeletionNotificationXml dNotificationXml = new ObjectDeletionNotificationXml(ownKeyName, popEvntNumber(),
- InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName);
-
+ DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp();
+ ObjectDeletionNotification notification = new ObjectDeletionNotificationBuilder().setCounter(popEvntNumber())
+ .setTimeStamp(ts).setObjectIdRef(registrationName).build();
+ Connectionlog log = new ConnectionlogBuilder().setNodeId(registrationName)
+ .setStatus(ConnectionLogStatus.Unmounted).setTimestamp(ts).build();
// Write first to prevent missing entries
databaseService.removeNetworkConnection(registrationName);
- databaseService.writeConnectionLog(dNotificationXml.getConnectionlogEntity());
- webSocketService.sendViaWebsockets(registrationName, dNotificationXml);
+ databaseService.writeConnectionLog(log);
+ webSocketService.sendViaWebsockets(registrationName, notification, ObjectDeletionNotification.QNAME, ts);
}
/**
* Mountpoint state changed .. from connected -> connecting or unable-to-connect or vis-e-versa.
- *
+ *
* @param registrationName Name of the event that is used as key in the database.
*/
@Override
public void updateRegistration(String registrationName, String attribute, String attributeNewValue,
NetconfNode nNode) {
- AttributeValueChangedNotificationXml notificationXml = new AttributeValueChangedNotificationXml(ownKeyName,
- popEvntNumber(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName,
- attribute, attributeNewValue);
+ DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp();
+ AttributeValueChangedNotification notification = new AttributeValueChangedNotificationBuilder()
+ .setCounter(popEvntNumber()).setTimeStamp(ts).setObjectIdRef(registrationName)
+ .setAttributeName(attribute).setNewValue(attributeNewValue).build();
+ Connectionlog log = new ConnectionlogBuilder().setNodeId(registrationName).setStatus(getStatus(attributeNewValue))
+ .setTimestamp(ts).build();
NetworkElementConnectionEntity e =
NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode);
LOG.debug("updating networkelement-connection for {} with status {}", registrationName, e.getStatus());
@@ -200,10 +216,11 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea
if (!databaseService.updateNetworkConnection22(e, registrationName)) {
this.updateNeConnectionRetryWithDelay(nNode, registrationName);
}
- databaseService.writeConnectionLog(notificationXml.getConnectionlogEntity());
- webSocketService.sendViaWebsockets(registrationName, notificationXml);
+ databaseService.writeConnectionLog(log);
+ webSocketService.sendViaWebsockets(ownKeyName, notification, AttributeValueChangedNotification.QNAME, ts);
}
+
private void updateNeConnectionRetryWithDelay(NetconfNode nNode, String registrationName) {
LOG.debug("try to rewrite networkelement-connection in {} for node {}", DBWRITE_RETRY_DELAY_MS,
registrationName);
@@ -246,13 +263,16 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea
new ProblemNotificationXml(ownKeyName, registrationName, problemName, problemSeverity,
// popEvntNumberAsString(), InternalDateAndTime.TESTPATTERN );
popEvntNumber(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()));
-
+ DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp();
+ ProblemNotification notification =
+ new ProblemNotificationBuilder().setObjectIdRef(registrationName).setCounter(popEvntNumber())
+ .setProblem(problemName).setSeverity(InternalSeverity.toYang(problemSeverity)).build();
databaseService.writeFaultLog(notificationXml.getFaultlog(SourceType.Controller));
databaseService.updateFaultCurrent(notificationXml.getFaultcurrent());
aotsDcaeForwarder.sendProblemNotificationUsingMaintenanceFilter(ownKeyName, notificationXml);
- webSocketService.sendViaWebsockets(registrationName, notificationXml);
+ webSocketService.sendViaWebsockets(ownKeyName, notification, ProblemNotification.QNAME, ts);
}
@Override
@@ -305,6 +325,21 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea
return eventNumber++;
}
+ private static ConnectionLogStatus getStatus(String newValue) {
+
+ if (newValue.equals(ConnectionStatus.Connected.getName())) {
+ return ConnectionLogStatus.Connected;
+
+ } else if (newValue.equals(ConnectionStatus.Connecting.getName())) {
+ return ConnectionLogStatus.Connecting;
+
+ } else if (newValue.equals(ConnectionStatus.UnableToConnect.getName())) {
+ return ConnectionLogStatus.UnableToConnect;
+
+ }
+ return ConnectionLogStatus.Undefined;
+ }
+
private class DelayedThread extends Thread {
private final long delay;
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java
index 81b782ca3..57f258b3b 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java
@@ -26,7 +26,7 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeForwarderInternal;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.PushNotifications;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
+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.EventlogBuilder;
@@ -36,6 +36,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.AttributeValueChangedNotification;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.AttributeValueChangedNotificationBuilder;
+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.PushFaultNotificationInput;
import org.slf4j.Logger;
@@ -68,7 +72,12 @@ public class RpcPushNotificationsHandler implements PushNotifications {
enventlogBuilder.fieldsFrom(input);
EventlogEntity eventlogEntity = enventlogBuilder.build();
databaseService.writeEventLog(eventlogEntity);
- webSocketService.sendViaWebsockets(OWNKEYNAME, new AttributeValueChangedNotificationXml(eventlogEntity));
+ AttributeValueChangedNotification notification =
+ new AttributeValueChangedNotificationBuilder().setAttributeName(input.getAttributeName())
+ .setCounter(input.getCounter()).setNewValue(input.getNewValue())
+ .setObjectIdRef(input.getObjectId()).setTimeStamp(input.getTimestamp()).build();
+ webSocketService.sendViaWebsockets(OWNKEYNAME, notification, AttributeValueChangedNotification.QNAME,
+ input.getTimestamp());
}
@@ -89,8 +98,11 @@ public class RpcPushNotificationsHandler implements PushNotifications {
databaseService.updateFaultCurrent(faultcurrentEntity);
ProblemNotificationXml notificationXml = new ProblemNotificationXml(faultlogEntity);
+ ProblemNotification notification = new ProblemNotificationBuilder().setProblem(input.getProblem())
+ .setCounter(input.getCounter()).setObjectIdRef(input.getObjectId())
+ .setSeverity(InternalSeverity.toYang(input.getSeverity())).setTimeStamp(input.getTimestamp()).build();
aotsDcaeForwarder.sendProblemNotificationUsingMaintenanceFilter(OWNKEYNAME, notificationXml);
- webSocketService.sendViaWebsockets(OWNKEYNAME, notificationXml);
+ webSocketService.sendViaWebsockets(OWNKEYNAME, notification, ProblemNotification.QNAME, input.getTimestamp());
}
}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java
index 689336f5e..0b69830c7 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java
@@ -57,7 +57,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.ODLEventLi
import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.RpcPushNotificationsHandler;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.housekeeping.ConnectionStatusHousekeepingService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.housekeeping.ResyncNetworkElementHouskeepingService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientImpl2;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientImpl;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientInternal;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.impl.MaintenanceServiceImpl;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.FactoryRegistration;
@@ -77,7 +77,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService
import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.DevicemanagerNotificationDelayService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.vescollectorconnector.impl.VESCollectorServiceImpl;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService;
+import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.MountPointService;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
@@ -106,7 +106,7 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa
private MountPointService mountPointService;
private RpcProviderService rpcProviderRegistry;
private ClusterSingletonServiceProvider clusterSingletonServiceProvider;
- private WebsocketmanagerService websocketmanagerService;
+ private WebsocketManagerService websocketmanagerService;
private IEntityDataProvider iEntityDataProvider;
// Devicemanager common services for network element handler
@@ -176,7 +176,7 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa
this.netconfNodeStateService = netconfNodeStateService;
}
- public void setWebsocketmanagerService(WebsocketmanagerService websocketmanagerService) {
+ public void setWebsocketmanagerService(WebsocketManagerService websocketmanagerService) {
this.websocketmanagerService = websocketmanagerService;
}
@@ -201,7 +201,7 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa
this.maintenanceService = new MaintenanceServiceImpl(iEntityDataProvider.getHtDatabaseMaintenance());
// Websockets
- this.webSocketService = new WebSocketServiceClientImpl2(websocketmanagerService);
+ this.webSocketService = new WebSocketServiceClientImpl(websocketmanagerService);
IEsConfig esConfig = iEntityDataProvider.getEsConfig();
// DCAE
@@ -283,6 +283,7 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa
LOG.info("Factory registration {}", factory.getClass().getName());
factoryList.add(factory);
+ factory.init(getServiceProvider());
return new FactoryRegistration<L>() {
@Override
@@ -419,4 +420,10 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa
return this.vesCollectorServiceImpl;
}
+ @Override
+ public WebsocketManagerService getWebsocketService() {
+ return this.websocketmanagerService;
+ }
+
+
}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalSeverity.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalSeverity.java
index d658720a9..3381d61b4 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalSeverity.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalSeverity.java
@@ -79,21 +79,56 @@ public enum InternalSeverity {
// * @param severity as input
// * @return String with related output
// */
- // public static InternalSeverity valueOf(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.SeverityType severity ) {
- // switch( severity ) {
- // case NonAlarmed:
- // return InternalSeverity.NonAlarmed;
- // case Warning:
- // return InternalSeverity.Warning;
- // case Minor:
- // return InternalSeverity.Minor;
- // case Major:
- // return InternalSeverity.Major;
- // case Critical:
- // return InternalSeverity.Critical;
- // }
- // return null;
- // }
+ public static InternalSeverity valueOf(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType severity) {
+ switch (severity) {
+ case NonAlarmed:
+ return InternalSeverity.NonAlarmed;
+ case Warning:
+ return InternalSeverity.Warning;
+ case Minor:
+ return InternalSeverity.Minor;
+ case Major:
+ return InternalSeverity.Major;
+ case Critical:
+ return InternalSeverity.Critical;
+ }
+ return null;
+ }
+
+
+ public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType toYang(
+ InternalSeverity severity) {
+ switch (severity) {
+ case NonAlarmed:
+ return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.NonAlarmed;
+ case Warning:
+ return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Warning;
+ case Minor:
+ return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Minor;
+ case Major:
+ return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Major;
+ case Critical:
+ return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Critical;
+ }
+ return null;
+ }
+ public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType toYang(
+ @Nullable SeverityType severity) {
+ switch (severity) {
+ case NonAlarmed:
+ return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.NonAlarmed;
+ case Warning:
+ return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Warning;
+ case Minor:
+ return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Minor;
+ case Major:
+ return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Major;
+ case Critical:
+ return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Critical;
+ }
+ return null;
+ }
//
// /**
// * convert ONF 1.2.1.1 Severity
@@ -141,7 +176,7 @@ public enum InternalSeverity {
/**
* convert a text string into Severity
- *
+ *
* @param severityString with textes: warning minor major critical non[-]alarmed. (Capital or lowercase)
* @return related enum. Unknown oe illegal are converted to NonAlarm
*/
@@ -163,7 +198,7 @@ public enum InternalSeverity {
/**
* Convert to InternalSeverity
- *
+ *
* @param severity to be converted
* @return InternalSeverity, null converted to NonAlarmed
*/
@@ -186,4 +221,7 @@ public enum InternalSeverity {
}
+
+
+
}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/AttributeValueChangedNotificationXml.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/AttributeValueChangedNotificationXml.java
deleted file mode 100644
index 2fa192460..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/AttributeValueChangedNotificationXml.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.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.SourceType;
-
-@XmlRootElement(name = "AttributeValueChangedNotification")
-public class AttributeValueChangedNotificationXml extends MwtNotificationBase implements GetEventType {
-
- private static String EVENTTYPE = "AttributeValueChangedNotification";
-
- @XmlElement(name = "attributeName")
- private String attributeName;
-
- @XmlElement(name = "newValue")
- private String newValue;
-
- public AttributeValueChangedNotificationXml() {
-
- }
-
- /**
- * Normalized notification
- *
- * @param nodeName name of mountpoint
- * @param counter of notification
- * @param timeStamp from ne
- * @param objectIdRef from ne
- * @param attributeName from ne
- * @param newValue from ne
- */
- public AttributeValueChangedNotificationXml(String nodeName, Integer counter, InternalDateAndTime timeStamp,
- String objectIdRef, String attributeName, String newValue) {
- super(nodeName, counter, timeStamp, objectIdRef);
- this.attributeName = attributeName;
- this.newValue = newValue;
- }
-
- public AttributeValueChangedNotificationXml(EventlogEntity eventlogEntitiy) {
- this(eventlogEntitiy.getNodeId(), eventlogEntitiy.getCounter(),
- InternalDateAndTime.valueOf(eventlogEntitiy.getTimestamp()), eventlogEntitiy.getObjectId(),
- eventlogEntitiy.getAttributeName(), eventlogEntitiy.getNewValue());
- }
-
-
- public String getAttributeName() {
- return attributeName;
- }
-
- public String getNewValue() {
- return newValue;
- }
-
- @Override
- public String getEventType() {
- return EVENTTYPE;
- }
-
- public EventlogEntity getEventlogEntity() {
- return new EventlogBuilder().setAttributeName(attributeName).setNewValue(newValue)
- .setCounter(Integer.valueOf(this.getCounter())).setNodeId(this.getNodeName())
- .setObjectId(this.getObjectId()).setTimestamp(new DateAndTime(this.getTimeStamp()))
- .setSourceType(SourceType.Netconf).build();
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/GetEventType.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/GetEventType.java
index 3afb27c48..a70777b63 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/GetEventType.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/GetEventType.java
@@ -6,9 +6,9 @@
* =================================================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/MwtNotificationBase.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/MwtNotificationBase.java
index 13576d69d..de7ccc31c 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/MwtNotificationBase.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/MwtNotificationBase.java
@@ -21,12 +21,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Nonnull;
import javax.xml.bind.annotation.XmlElement;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
-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.NetconfNodeConnectionStatus.ConnectionStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionLogStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionlogEntity;
+@Deprecated
public class MwtNotificationBase {
private static String EMPTY = "empty";
@@ -72,47 +68,8 @@ public class MwtNotificationBase {
}
/**
- * Provide ConnectionlogEntity type
- *
- * @return ConnectionlogEntity
- */
- public ConnectionlogEntity getConnectionlogEntity() {
- return new ConnectionlogBuilder().setNodeId(objectId).setStatus(getStatus())
- .setTimestamp(new DateAndTime(timeStamp)).build();
- }
-
- /**
- * Provide connection status for mountpoint log. TODO Add status disconnected if mountpoint is required, but does
- * not exists.
- *
- * @return
- */
- private ConnectionLogStatus getStatus() {
-
- if (this instanceof ObjectCreationNotificationXml) {
- return ConnectionLogStatus.Mounted;
-
- } else if (this instanceof ObjectDeletionNotificationXml) {
- return ConnectionLogStatus.Unmounted;
-
- } else if (this instanceof AttributeValueChangedNotificationXml) {
- String pnx = ((AttributeValueChangedNotificationXml) this).getNewValue();
- if (pnx.equals(ConnectionStatus.Connected.getName())) {
- return ConnectionLogStatus.Connected;
-
- } else if (pnx.equals(ConnectionStatus.Connecting.getName())) {
- return ConnectionLogStatus.Connecting;
-
- } else if (pnx.equals(ConnectionStatus.UnableToConnect.getName())) {
- return ConnectionLogStatus.UnableToConnect;
- }
- }
- return ConnectionLogStatus.Undefined;
- }
-
- /**
* Type for the Database to document the the same name that is used in the websockets.
- *
+ *
* @return String with type name of child class
*/
@JsonProperty("type")
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectCreationNotificationXml.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectCreationNotificationXml.java
deleted file mode 100644
index 9e0e269e4..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectCreationNotificationXml.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.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.SourceType;
-
-@XmlRootElement(name = "ObjectCreationNotification")
-public class ObjectCreationNotificationXml extends MwtNotificationBase implements GetEventType {
-
- private static String EVENTTYPE = "ObjectCreationNotification";
- private static String ACTION = "creation";
-
- public ObjectCreationNotificationXml() {
-
- }
-
- /**
- * Normalized notification
- *
- * @param nodeName name of mountpoint or instance that owns the problem
- * @param counter of notification
- * @param timeStamp from ne
- * @param objectIdRef from ne
- */
- public ObjectCreationNotificationXml(String nodeName, Integer counter, InternalDateAndTime timeStamp,
- String objectIdRef) {
- super(nodeName, counter, timeStamp, objectIdRef);
- }
-
- public ObjectCreationNotificationXml(EventlogEntity el) {
- this(el.getNodeId(), el.getCounter(), InternalDateAndTime.valueOf(el.getTimestamp()), el.getObjectId());
- }
-
- @Override
- public String getEventType() {
- return EVENTTYPE;
- }
-
- public EventlogEntity getEventlogEntity() {
- return new EventlogBuilder().setAttributeName(ACTION).setNewValue(ACTION)
- .setCounter(Integer.valueOf(this.getCounter())).setNodeId(this.getNodeName())
- .setObjectId(this.getObjectId()).setTimestamp(new DateAndTime(this.getTimeStamp()))
- .setSourceType(SourceType.Netconf).build();
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectDeletionNotificationXml.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectDeletionNotificationXml.java
deleted file mode 100644
index 0bb43582b..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectDeletionNotificationXml.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.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.SourceType;
-
-@XmlRootElement(name = "ObjectDeletionNotification")
-public class ObjectDeletionNotificationXml extends MwtNotificationBase implements GetEventType {
-
- private static String EVENTTYPE = "ObjectDeletionNotification";
- private static String ACTION = "deletion";
-
- public ObjectDeletionNotificationXml() {
-
- }
-
- /**
- * Normalized notification
- *
- * @param nodeName name of mountpoint or instance that owns the problem
- * @param counter of notification
- * @param timeStamp from ne
- * @param objectIdRef from ne
- */
- public ObjectDeletionNotificationXml(String nodeName, Integer counter, InternalDateAndTime timeStamp,
- String objectIdRef) {
- super(nodeName, counter, timeStamp, objectIdRef);
- }
-
- public ObjectDeletionNotificationXml(EventlogEntity el) {
- this(el.getNodeId(), el.getCounter(), InternalDateAndTime.valueOf(el.getTimestamp()), el.getObjectId());
- }
-
- @Override
- public String getEventType() {
- return EVENTTYPE;
- }
-
- public EventlogEntity getEventlogEntity() {
- return new EventlogBuilder().setAttributeName(ACTION).setNewValue(ACTION)
- .setCounter(Integer.valueOf(this.getCounter())).setNodeId(this.getNodeName())
- .setObjectId(this.getObjectId()).setTimestamp(new DateAndTime(this.getTimeStamp()))
- .setSourceType(SourceType.Netconf).build();
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ProblemNotificationXml.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ProblemNotificationXml.java
index daba83ac3..33db3baed 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ProblemNotificationXml.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ProblemNotificationXml.java
@@ -33,6 +33,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
import org.slf4j.Logger;
+@Deprecated
@XmlRootElement(name = "ProblemNotification")
public class ProblemNotificationXml extends MwtNotificationBase implements GetEventType, ToggleAlarmFilterable {
@@ -99,7 +100,7 @@ public class ProblemNotificationXml extends MwtNotificationBase implements GetEv
/**
* Create a specific ES id for the current log.
- *
+ *
* @return a string with the generated ES Id
*/
@JsonIgnore
@@ -137,7 +138,7 @@ public class ProblemNotificationXml extends MwtNotificationBase implements GetEv
/**
* LOG the newly added problems of the interface pac
- *
+ *
* @param log of logger
* @param uuid as log info
* @param resultList with all problems
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientDummyImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.java
index d927b8995..6cf984b11 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientDummyImpl.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.java
@@ -18,27 +18,42 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
import org.eclipse.jdt.annotation.NonNull;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.ODLEventListenerHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
+import org.opendaylight.yangtools.yang.binding.Notification;
+import org.opendaylight.yangtools.yang.common.QName;
/**
- * WrapperMock class for web-socket notifications to the web-socket service.
+ * Wrapper for forwarding web-socket notifications to the web-socket service, that is running as bundle.
*/
-public class WebSocketServiceClientDummyImpl implements WebSocketServiceClientInternal {
+public class WebSocketServiceClientImpl implements WebSocketServiceClientInternal {
- private static final Logger LOG = LoggerFactory.getLogger(ODLEventListenerHandler.class);
+// private static final Logger LOG = LoggerFactory.getLogger(ODLEventListenerHandler.class);
- public WebSocketServiceClientDummyImpl() {}
+ private final WebsocketManagerService websocketmanagerService;
- @Override
- public <T extends MwtNotificationBase & GetEventType> void sendViaWebsockets(@NonNull String nodeName,
- @NonNull T notificationXml) {
- LOG.info("Dummy to send websocket event {} for mountpoint {}", notificationXml.getClass().getSimpleName(),
- nodeName);
+ /**
+ * New: Implementation of Websocket notification processor.
+ *
+ * @param websocketmanagerService2 to be used
+ */
+ public WebSocketServiceClientImpl(WebsocketManagerService websocketmanagerService2) {
+ super();
+ this.websocketmanagerService = websocketmanagerService2;
}
+
+
@Override
public void close() throws Exception {}
+
+
+ @Override
+ public void sendViaWebsockets(@NonNull String nodeName, Notification notification, QName qname,
+ DateAndTime timestamp) {
+ this.websocketmanagerService.sendNotification(notification, nodeName, qname, timestamp);
+
+ }
+
}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java
deleted file mode 100644
index bc44543e8..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import javax.xml.bind.JAXBException;
-import org.eclipse.jdt.annotation.NonNull;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.ODLEventListenerHandler;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketEventInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketEventOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Wrapper for forwarding web-socket notifications to the web-socket service, that is running as bundle.
- */
-public class WebSocketServiceClientImpl2 implements WebSocketServiceClientInternal {
-
- private static final Logger LOG = LoggerFactory.getLogger(ODLEventListenerHandler.class);
-
- private final WebsocketmanagerService websocketmanagerService;
- private final XmlMapper xmlMapper;
-
- /**
- * New: Implementation of Websocket notification processor.
- *
- * @param websocketmanagerService2 to be used
- */
- public WebSocketServiceClientImpl2(WebsocketmanagerService websocketmanagerService2) {
- super();
- this.websocketmanagerService = websocketmanagerService2;
- this.xmlMapper = new XmlMapper();
- }
-
- @Override
- public <T extends MwtNotificationBase & GetEventType> void sendViaWebsockets(@NonNull String nodeName,
- @NonNull T notificationXml) {
- LOG.debug("Send websocket event {} for mountpoint {}", notificationXml.getClass().getSimpleName(), nodeName);
-
- WebsocketEventInputBuilder wsBuilder = new WebsocketEventInputBuilder();
- wsBuilder.setNodeName(nodeName);
- wsBuilder.setEventType(notificationXml.getEventType());
- try {
- wsBuilder.setXmlEvent(xmlMapper.getXmlString(notificationXml));
- Future<RpcResult<WebsocketEventOutput>> result = websocketmanagerService.websocketEvent(wsBuilder.build());
- if (result != null)
- LOG.trace("Send websocket result: {}", result == null ? "null" : result.get().getResult().getResponse());
- } catch (JAXBException | InterruptedException | ExecutionException e) {
- LOG.warn("Can not send websocket event {} for mountpoint {} {}", notificationXml, nodeName, e.toString());
- }
- }
-
- @Override
- public void close() throws Exception {}
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.java
index 1af2d893a..83fbd5c7d 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.java
@@ -21,15 +21,17 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
+import org.opendaylight.yangtools.yang.binding.Notification;
+import org.opendaylight.yangtools.yang.common.QName;
/**
* Wrapper for forwarding websocket notifications to the websocket service, that is running as container.
- *
+ *
* @author herbert
*/
public interface WebSocketServiceClientInternal extends AutoCloseable {
- public <T extends MwtNotificationBase & GetEventType> void sendViaWebsockets(@NonNull String nodeName,
- @NonNull T notificationXml);
+ public void sendViaWebsockets(@NonNull String nodeName,Notification notification, QName qname, DateAndTime timestamp);
}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java
deleted file mode 100644
index 62bd50de5..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import java.io.StringWriter;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class XmlMapper {
- @SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(XmlMapper.class);
-
- public String getXmlString(MwtNotificationBase base) throws JAXBException {
- String xml;
- JAXBContext jaxbContext;
- jaxbContext = JAXBContext.newInstance(AttributeValueChangedNotificationXml.class,
- ObjectCreationNotificationXml.class, ObjectDeletionNotificationXml.class, ProblemNotificationXml.class);
- Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
- jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
-
- StringWriter stringWriter = new StringWriter();
- jaxbMarshaller.marshal(base, stringWriter);
- xml = stringWriter.toString();
- return xml;
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayService.java
index ce92da0cf..01cfcc5fc 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayService.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayService.java
@@ -18,7 +18,6 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter;
import java.util.HashMap;
-
import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerService;
@@ -53,8 +52,12 @@ public class NotificationDelayService<T extends ToggleAlarmFilterable>
@Override
public void onConfigChanged() {
- NotificationDelayFilter.setDelay(config.getDelay());
- NotificationDelayFilter.setEnabled(config.isEnabled());
+ if (config != null) {
+ NotificationDelayFilter.setDelay(config.getDelay());
+ NotificationDelayFilter.setEnabled(config.isEnabled());
+ } else {
+ LOG.error("Can not process configuration change");
+ }
}
@Override
diff --git a/sdnr/wt/devicemanager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/devicemanager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
index 17d71e0e5..a015ac172 100644
--- a/sdnr/wt/devicemanager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
+++ b/sdnr/wt/devicemanager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
@@ -48,7 +48,7 @@
<reference id="websocketmanagerService"
availability="mandatory" activation="eager"
- interface="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService"/>
+ interface="org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService"/>
<reference id="iEntityDataProvider"
availability="mandatory" activation="eager"
diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java
index a089aa22c..ed7f56f4b 100644
--- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java
@@ -39,6 +39,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.RpcProviderServic
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeConnectListener;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateListener;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateService;
+import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.MountPointService;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
@@ -46,13 +47,13 @@ import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvid
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.MaintenanceBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ClearCurrentFaultByNodenameInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.DevicemanagerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetRequiredNetworkElementKeysInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushAttributeChangeNotificationInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ShowRequiredNetworkElementInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.slf4j.Logger;
@@ -89,7 +90,7 @@ public class TestDevicemanager extends Mockito {
when(netconfNodeStateService.registerNetconfNodeStateListener(mock(NetconfNodeStateListener.class)))
.thenReturn(lr2);
- WebsocketmanagerService websocketmanagerService = mock(WebsocketmanagerService.class);
+ WebsocketManagerService websocketmanagerService = mock(WebsocketManagerService.class);
IEntityDataProvider iEntityDataProvider = mock(IEntityDataProvider.class);
doNothing().when(iEntityDataProvider).setReadyStatus(isA(Boolean.class));
@@ -152,7 +153,7 @@ public class TestDevicemanager extends Mockito {
FaultService n = deviceManager.getFaultService();
FaultlogBuilder faultLogEntityBuilder = new FaultlogBuilder();
- n.faultNotification(faultLogEntityBuilder.setNodeId("node1")
+ n.faultNotification(faultLogEntityBuilder.setNodeId("node1").setSeverity(SeverityType.Critical)
.setTimestamp(NetconfTimeStampImpl.getTestpatternDateAndTime()).build());
}
diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlMapper.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlMapper.java
deleted file mode 100644
index f79589f62..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlMapper.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
- * All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.test;
-
-import static org.junit.Assert.fail;
-import javax.xml.bind.JAXBException;
-import org.eclipse.jdt.annotation.Nullable;
-import org.junit.Test;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.XmlMapper;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EventlogNotificationBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Eventlog;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-
-@SuppressWarnings("deprecation")
-public class TestXmlMapper {
-
- @Test
- public void test() {
- XmlMapper xmlMapper = new XmlMapper();
- AttributeValueChangedNotificationXml event = getChangeNotification(new NodeId("NodeTest1"), 2, InternalDateAndTime.getTestpatternDateAndTime(), "ObjTest1",
- "AtrributeTest1", "NewTest1");
-
- try {
- String result = xmlMapper.getXmlString(event);
- System.out.println("Mappingresult = "+result);
- } catch (JAXBException e) {
- e.printStackTrace();
- fail("Problem with xml mapping.");
- }
-
- }
-
- public AttributeValueChangedNotificationXml getChangeNotification(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp,
- @Nullable String objectId, @Nullable String attributeName, @Nullable String newValue) {
- Eventlog eventlogEntity = new EventlogNotificationBuilder(nodeId, counter, timeStamp, objectId, attributeName, newValue).build();
- return new AttributeValueChangedNotificationXml(eventlogEntity);
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlNotification.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlNotification.java
deleted file mode 100644
index da3946041..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlNotification.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk feature sdnr wt
- * ================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
- * All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays;
-import org.junit.Test;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestXmlNotification {
-
- private static final Logger log = LoggerFactory.getLogger(TestXmlNotification.class);
-
- @Test
- public void test() {
-
- ProblemNotificationXml notification = new ProblemNotificationXml("TestMointpoint", "network-element",
- "problemName", InternalSeverity.Critical, 123, InternalDateAndTime.getTestpattern());
-
- notification.getFaultlog(SourceType.Unknown);
-
- notification.getFaultcurrent();
-
- notification.isNotManagedAsCurrentProblem();
-
- ProblemNotificationXml.debugResultList(log, "uuid", Arrays.asList(notification), 0);
-
- }
-
- @Test
- public void testNoAlarm() {
-
- ProblemNotificationXml notification;
- notification = new ProblemNotificationXml("TestMointpoint", "network-element", "problemName",
- InternalSeverity.Critical, 123, InternalDateAndTime.getTestpattern());
-
- assertFalse("Critical", notification.isNoAlarmIndication());
-
- notification = new ProblemNotificationXml("TestMointpoint", "network-element", "problemName",
- InternalSeverity.NonAlarmed, 123, InternalDateAndTime.getTestpattern());
-
- assertTrue("NonAlarm", notification.isNoAlarmIndication());
-
- }
-
- @Test
- public void testObjectCreationNotification() {
-
- ObjectCreationNotificationXml notification;
- notification =
- new ObjectCreationNotificationXml("TestMointpoint1", 1, InternalDateAndTime.getTestpattern(), "Id1");
-
- }
-
- @Test
- public void testDeletionCreationNotification() {
-
- ObjectDeletionNotificationXml notification;
- notification =
- new ObjectDeletionNotificationXml("TestMointpoint2", 2, InternalDateAndTime.getTestpattern(), "Id2");
-
- }
-
-
-}