summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager
diff options
context:
space:
mode:
authorMichael DÜrre <michael.duerre@highstreet-technologies.com>2021-04-08 06:34:22 +0200
committerMichael DÜrre <michael.duerre@highstreet-technologies.com>2021-04-08 06:34:46 +0200
commitf3969004c6ccac18e742c5fc48c844e315991023 (patch)
treef5486a62e842bb16ca7d3af47a8663df08feef55 /sdnr/wt/devicemanager
parenta252be83694ae33260d99d5371ed48c1558aa2e8 (diff)
update websocketmanager
update complete notification flow Issue-ID: CCSDK-3252 Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com> Change-Id: I87ba00f615707b942471fcace57bcda50ce37e61
Diffstat (limited to 'sdnr/wt/devicemanager')
-rw-r--r--sdnr/wt/devicemanager/feature/pom.xml1
-rw-r--r--sdnr/wt/devicemanager/model/pom.xml10
-rw-r--r--sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/ne/factory/NetworkElementFactory.java16
-rw-r--r--sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/DeviceManagerServiceProvider.java5
-rw-r--r--sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/EquipmentService.java7
-rw-r--r--sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/FaultService.java23
-rw-r--r--sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NotificationService.java18
-rw-r--r--sdnr/wt/devicemanager/model/src/main/yang/devicemanager.yang134
-rw-r--r--sdnr/wt/devicemanager/provider/pom.xml2
-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
29 files changed, 419 insertions, 679 deletions
diff --git a/sdnr/wt/devicemanager/feature/pom.xml b/sdnr/wt/devicemanager/feature/pom.xml
index babd9d7c3..662af8ea6 100644
--- a/sdnr/wt/devicemanager/feature/pom.xml
+++ b/sdnr/wt/devicemanager/feature/pom.xml
@@ -23,6 +23,7 @@
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
diff --git a/sdnr/wt/devicemanager/model/pom.xml b/sdnr/wt/devicemanager/model/pom.xml
index 129bdf31d..b5e24b21c 100644
--- a/sdnr/wt/devicemanager/model/pom.xml
+++ b/sdnr/wt/devicemanager/model/pom.xml
@@ -64,10 +64,20 @@
</dependency>
<dependency>
<groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-websocketmanager-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
<artifactId>sdnr-wt-netconfnode-state-service-model</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
+ <artifactId>rfc6991-ietf-yang-types</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/ne/factory/NetworkElementFactory.java b/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/ne/factory/NetworkElementFactory.java
index 4b3881e0b..c28b9245b 100644
--- a/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/ne/factory/NetworkElementFactory.java
+++ b/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/ne/factory/NetworkElementFactory.java
@@ -26,7 +26,21 @@ import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
public interface NetworkElementFactory {
- Optional<NetworkElement> create(@NonNull NetconfAccessor acessor,
+ /**
+ * Called after connect of device. Decide if devicemanger should be started to manage device.
+ * @param accessor function to access device and get information from mountpoint
+ * @param serviceProvider provides base device manager services.
+ * @return Empty or NetworkElement object
+ */
+ Optional<NetworkElement> create(@NonNull NetconfAccessor accessor,
@NonNull DeviceManagerServiceProvider serviceProvider);
+ /**
+ * Called directly after factory registration to allow initialization
+ * @param serviceProvider provides base device manager services.
+ */
+ default void init(DeviceManagerServiceProvider serviceProvider) {
+ }
+
+
}
diff --git a/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/DeviceManagerServiceProvider.java b/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/DeviceManagerServiceProvider.java
index 22a0a1370..163f80839 100644
--- a/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/DeviceManagerServiceProvider.java
+++ b/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/DeviceManagerServiceProvider.java
@@ -20,6 +20,7 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.service;
import org.eclipse.jdt.annotation.NonNull;
import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
+import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
public interface DeviceManagerServiceProvider {
@@ -31,6 +32,10 @@ public interface DeviceManagerServiceProvider {
@NonNull
NotificationService getNotificationService();
+ /** @return Get ws notification service **/
+ @NonNull
+ WebsocketManagerService getWebsocketService();
+
/** @return Get service for handling fault **/
@NonNull
FaultService getFaultService();
diff --git a/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/EquipmentService.java b/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/EquipmentService.java
index 10a3aa670..323140191 100644
--- a/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/EquipmentService.java
+++ b/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/EquipmentService.java
@@ -19,8 +19,8 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.service;
import org.eclipse.jdt.annotation.NonNull;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EquipmentData;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
/**
* @author herbert
@@ -30,9 +30,10 @@ public interface EquipmentService extends DeviceManagerService {
/**
* Write equipment to database
- *
+ *
+ * @param nodeId
* @param equipment with all equipment entities (card, subrack) of device
*/
- void writeEquipment(@NonNull EquipmentData equipment);
+ void writeEquipment(NodeId nodeId, @NonNull EquipmentData equipment);
}
diff --git a/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/FaultService.java b/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/FaultService.java
index 9a4c89d4a..f414b4b15 100644
--- a/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/FaultService.java
+++ b/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/FaultService.java
@@ -18,11 +18,8 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.service;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
-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.FaultlogEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
/**
@@ -32,27 +29,15 @@ public interface FaultService extends DeviceManagerService {
/**
* Notify fault information to devicemanager
- *
+ *
* @param faultNotification to send
*/
void faultNotification(@NonNull FaultlogEntity faultNotification);
- /**
- * Fault notification
- *
- * @param nodeId of node
- * @param counter provided
- * @param timeStamp provided
- * @param objectId provided
- * @param problem provided
- * @param severity provided
- */
- void faultNotification(@NonNull NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp,
- @Nullable String objectId, @Nullable String problem, @Nullable SeverityType severity);
-
+ //void faultNotification(@NonNull NodeId nodeId,Notification notification, QName type, DateAndTime timeStamp);
/**
* Remove current problems of node
- *
+ *
* @param nodeId of node
* @return number of removed entries
*/
@@ -60,7 +45,7 @@ public interface FaultService extends DeviceManagerService {
/**
* Write initial list of problems of node
- *
+ *
* @param nodeId of node
* @param resultList
*/
diff --git a/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NotificationService.java b/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NotificationService.java
index 5a153a1cc..b249c5008 100644
--- a/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NotificationService.java
+++ b/sdnr/wt/devicemanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NotificationService.java
@@ -32,17 +32,26 @@ public interface NotificationService extends DeviceManagerService {
/** Event notification to devicemanager. Can be change, create or remove indication **/
void eventNotification(@NonNull EventlogEntity eventNotification);
+// void eventNotification(NodeId nodeId, Notification notification, @NonNull QName qname,
+// @Nullable DateAndTime timeStamp);
+
/** create notification for an object **/
void creationNotification(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp,
@Nullable String objectId);
- /** create notification of object **/
+// void creationNotification(NodeId nodeId, Notification notification, @NonNull QName qname,
+// @Nullable DateAndTime timeStamp);
+
+ /** delete notification of object **/
void deletionNotification(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp,
@Nullable String objectId);
+// void deletionNotification(NodeId nodeId, Notification notification, @NonNull QName qname,
+// @Nullable DateAndTime timeStamp);
+
/**
* change notification of attribute of object
- *
+ *
* @param nodeId of device
* @param counter provided
* @param timeStamp provided
@@ -53,4 +62,9 @@ public interface NotificationService extends DeviceManagerService {
void changeNotification(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp,
@Nullable String objectId, @Nullable String attributeName, @Nullable String newValue);
+// void changeNotification(NodeId nodeId, Notification notification, @NonNull QName qname,
+// @Nullable DateAndTime timeStamp);
+
+
+
}
diff --git a/sdnr/wt/devicemanager/model/src/main/yang/devicemanager.yang b/sdnr/wt/devicemanager/model/src/main/yang/devicemanager.yang
index 608e2dabd..a34ea49a4 100644
--- a/sdnr/wt/devicemanager/model/src/main/yang/devicemanager.yang
+++ b/sdnr/wt/devicemanager/model/src/main/yang/devicemanager.yang
@@ -8,7 +8,9 @@ module devicemanager {
prefix data-provider;
revision-date 2020-11-10;
}
-
+ import ietf-yang-types {
+ prefix yang;
+ }
organization
"highstreet technologies GmbH";
contact
@@ -40,6 +42,136 @@ module devicemanager {
"https://jira.onap.org/browse/SDNC-877";
}
+ notification object-creation-notification {
+ uses object-creation-notification-g;
+ description "none";
+ }
+ grouping object-creation-notification-g {
+ leaf counter {
+ type int32;
+ default -1;
+ description "Counts object creation notifications.";
+ }
+ leaf time-stamp {
+ type yang:date-and-time;
+ default "2017-01-01T00:00:00.0Z";
+ description "none";
+ }
+ leaf object-id-ref {
+ type string;
+ description "ID of the affected MW_AirInterface_Pac, MW_AirInterfaceDiversity_Pac, MW_Structure_Pac, MW_PureEthernetStructure_Pac, MW_HybridMwStructure_Pac, MW_Container_Pac, MW_EthernetContainer_Pac or MW_TdmContainer_Pac.";
+ }
+ leaf object-type {
+ type string;
+ default "Type of created object not specified.";
+ description "Type of Object to be chosen from the following list of values: 'MW_AirInterface_Pac', 'MW_AirInterfaceDiversity_Pac', 'MW_Structure_Pac', 'MW_PureEthernetStructure_Pac', 'MW_HybridMwStructure_Pac', 'MW_Container_Pac', 'MW_EthernetContainer_Pac' or 'MW_TdmContainer_Pac'.";
+ }
+ description "To be sent when a new MW_AirInterface_Pac, MW_AirInterfaceDiversity_Pac, MW_Structure_Pac, MW_PureEthernetStructure_Pac, MW_HybridMwStructure_Pac, MW_Container_Pac, MW_EthernetContainer_Pac or MW_TdmContainer_Pac has to be instancieted in the controller.";
+ }
+ notification object-deletion-notification {
+ uses object-deletion-notification-g;
+ description "none";
+ }
+ grouping object-deletion-notification-g {
+ leaf counter {
+ type int32;
+ default -1;
+ description "Counts object deletion notifications.";
+ }
+ leaf time-stamp {
+ type yang:date-and-time;
+ default "2017-01-01T00:00:00.0Z";
+ description "none";
+ }
+ leaf object-id-ref {
+ type string;
+ description "ID of the affected MW_AirInterface_Pac, MW_AirInterfaceDiversity_Pac, MW_Structure_Pac, MW_PureEthernetStructure_Pac, MW_HybridMwStructure_Pac, MW_Container_Pac, MW_EthernetContainer_Pac or MW_TdmContainer_Pac.";
+ }
+ description "To be sent when a new MW_AirInterface_Pac, MW_AirInterfaceDiversity_Pac, MW_Structure_Pac, MW_PureEthernetStructure_Pac, MW_HybridMwStructure_Pac, MW_Container_Pac, MW_EthernetContainer_Pac or MW_TdmContainer_Pac instance has to be deleted in the controller.";
+ }
+ notification attribute-value-changed-notification {
+ uses attribute-value-changed-notification-g;
+ description "none";
+ }
+ grouping attribute-value-changed-notification-g {
+ leaf counter {
+ type int32;
+ default -1;
+ description "Counts attribute value changed notifications.";
+ }
+ leaf time-stamp {
+ type yang:date-and-time;
+ default "2017-01-01T00:00:00.0Z";
+ description "none";
+ }
+ leaf object-id-ref {
+ type string;
+ description "ID of the affected MW_AirInterface_Pac, MW_AirInterfaceDiversity_Pac, MW_Structure_Pac, MW_PureEthernetStructure_Pac, MW_HybridMwStructure_Pac, MW_Container_Pac, MW_EthernetContainer_Pac or MW_TdmContainer_Pac.";
+ }
+ leaf attribute-name {
+ type string;
+ default "Attribute name not specified.";
+ description "Name of the attribute that has been changed.";
+ }
+ leaf new-value {
+ type string;
+ default "New value not specified.";
+ description "Attribute value converted to a string (xml, json, ...)";
+ }
+ description "To be sent when an attribute has changed and one or more controllers have to update their data.";
+ }
+ notification problem-notification {
+ uses problem-notification-g;
+ description "none";
+ }
+ grouping problem-notification-g {
+ leaf counter {
+ type int32;
+ default -1;
+ description "Counts problem notifications";
+ }
+ leaf time-stamp {
+ type yang:date-and-time;
+ default "2017-01-01T00:00:00.0Z";
+ description "none";
+ }
+ leaf object-id-ref {
+ type string;
+ description "ID of the affected MW_AirInterface_Pac, MW_AirInterfaceDiversity_Pac, MW_Structure_Pac, MW_PureEthernetStructure_Pac, MW_HybridMwStructure_Pac, MW_Container_Pac, MW_EthernetContainer_Pac or MW_TdmContainer_Pac.";
+ }
+ leaf problem {
+ type string;
+ default "Problem name not specified.";
+ description "Name of the problem according to AirInterface::AirInterfaceCapability::supportedAlarms or AirInterfaceDiversity::AirInterfaceDiversityCapability::supportedAlarms or Structure::StructureCapability::supportedAlarms or PureEthernetStructure::PureEthernetStructureCapability::supportedAlarms or HybridMwStructure::HybridMwStructureCapability::supportedAlarms or Container::ContainerCapability::supportedAlarms or EthernetContainer::EthernetContainerCapability::supportedAlarms or TdmContainer::TdmContainerCapability::supportedAlarms.";
+ }
+ leaf severity {
+ type severity-type;
+ default warning;
+ description "Severity of the problem according to AirInterface::AirInterfaceConfiguration::problemSeverityList, AirInterfaceDiversity::AirInterfaceDiversityConfiguration::problemSeverityList, Structure::StructureConfiguration::problemSeverityList, PureEthernetStructure::PureEthernetStructureConfiguration::problemSeverityList, HybridMwStructure::HybridMwStructureConfiguration::problemSeverityList, Container::ContainerConfiguration::problemSeverityList, EthernetContainer::EthernetContainerConfiguration::problemSeverityList or TdmContainer::TdmContainerConfiguration::problemSeverityList";
+ }
+ description "To be sent when a problem occurs at a MW_AirInterface_Pac, MW_AirInterfaceDiversity_Pac, MW_Structure_Pac, MW_PureEthernetStructure_Pac, MW_HybridMwStructure_Pac, MW_Container_Pac, MW_EthernetContainer_Pac or MW_TdmContainer_Pac.";
+ }
+ typedef severity-type {
+ type enumeration {
+ enum non-alarmed {
+ description "none";
+ }
+ enum warning {
+ description "none";
+ }
+ enum minor {
+ description "none";
+ }
+ enum major {
+ description "none";
+ }
+ enum critical {
+ description "none";
+ }
+ }
+ description "According to ITU-T M.3160";
+ }
+
rpc set-maintenance-mode {
description
"Set maintenance mode for network element";
diff --git a/sdnr/wt/devicemanager/provider/pom.xml b/sdnr/wt/devicemanager/provider/pom.xml
index bf02984a5..a6ed412fc 100644
--- a/sdnr/wt/devicemanager/provider/pom.xml
+++ b/sdnr/wt/devicemanager/provider/pom.xml
@@ -73,7 +73,7 @@
</dependency>
<dependency>
<groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-websocketmanager2-model</artifactId>
+ <artifactId>sdnr-wt-websocketmanager-model</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
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");
-
- }
-
-
-}