From df5869629e4ffd6cb0b1ccb81c1fe17cdd73f851 Mon Sep 17 00:00:00 2001 From: Ravi Pendurty Date: Fri, 30 Jul 2021 15:14:17 +0530 Subject: devicemanager-core refactoring and support for TLS mountpoints using data-provider interface Use NodeId instead of String for mountpointname and enhance data-provider for creation of TLS mountpoints using REST or from the UI Issue-ID: CCSDK-3403 Signed-off-by: Ravi Pendurty Change-Id: Iafb9fe81c2e1d1152beef2b86299edb78a870d85 Signed-off-by: Ravi Pendurty --- .../sdnr/wt/devicemanager/service/AaiService.java | 6 +- .../service/EventHandlingService.java | 9 +- .../wt/devicemanager/service/FaultService.java | 11 ++- .../devicemanager/service/MaintenanceService.java | 10 +- .../devicemanager/service/NotificationService.java | 54 +++++++---- .../devicemanager/service/PerformanceManager.java | 5 +- .../types/InternalConnectionStatus.java | 3 + .../aaiconnector/impl/AaiProviderClient.java | 19 ++-- .../dcaeconnector/impl/DcaeForwarderImpl.java | 13 +-- .../dcaeconnector/impl/DcaeForwarderInternal.java | 5 +- .../dcaeconnector/impl/DcaeMessages.java | 13 +-- .../dcaeconnector/impl/DcaeProviderClient.java | 9 +- .../dcaeconnector/impl/DcaeProviderWorker.java | 6 +- .../DeviceManagerDatabaseNotificationService.java | 4 +- .../eventdatahandler/ODLEventListenerHandler.java | 105 ++++++++++++++------- .../RpcPushNotificationsHandler.java | 2 +- .../ResyncNetworkElementHouskeepingService.java | 2 +- .../wt/devicemanager/impl/DeviceManagerImpl.java | 4 +- .../impl/DeviceManagerNetconfConnectHandler.java | 26 ++--- .../DeviceManagerNetconfNotConnectHandler.java | 9 +- .../sdnr/wt/devicemanager/impl/ProviderClient.java | 13 +-- .../util/NetworkElementConnectionEntitiyUtil.java | 37 +++++++- .../maintenance/impl/MaintenanceServiceImpl.java | 15 +-- .../impl/PerformanceManagerImpl.java | 13 +-- .../sdnr/wt/devicemanager/test/TestAai.java | 14 ++- .../sdnr/wt/devicemanager/test/TestDcae.java | 13 ++- 26 files changed, 262 insertions(+), 158 deletions(-) (limited to 'sdnr/wt/devicemanager-core') diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/AaiService.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/AaiService.java index eca19a8c0..53c5c1444 100644 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/AaiService.java +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/AaiService.java @@ -17,6 +17,8 @@ */ package org.onap.ccsdk.features.sdnr.wt.devicemanager.service; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; + /** * Forward to Active and Available Inventory */ @@ -25,11 +27,11 @@ public interface AaiService extends DeviceManagerService { /** * @param mountPointNodeName */ - void onDeviceRegistered(String mountPointNodeName); + void onDeviceRegistered(NodeId nodeId); /** * @param mountPointNodeName */ - void onDeviceUnregistered(String mountPointNodeName); + void onDeviceUnregistered(NodeId nodeId); } diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/EventHandlingService.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/EventHandlingService.java index 5cb9b9f21..e59401cc7 100644 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/EventHandlingService.java +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/EventHandlingService.java @@ -19,6 +19,7 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.service; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; /** * Event Forwarding for central event management by devicemanager @@ -29,12 +30,12 @@ public interface EventHandlingService { * @param mountPointNodeName * @param deviceType */ - void connectIndication(String mountPointNodeName, NetworkElementDeviceType deviceType); + void connectIndication(NodeId nodeId, NetworkElementDeviceType deviceType); /** * @param mountPointNodeName */ - void deRegistration(String mountPointNodeName); + void deRegistration(NodeId nodeId); /** * @@ -43,13 +44,13 @@ public interface EventHandlingService { * @param attributeNewValue * @param nNode */ - void updateRegistration(String registrationName, String attribute, String attributeNewValue, NetconfNode nNode); + void updateRegistration(NodeId nodeId, String attribute, String attributeNewValue, NetconfNode nNode); /** * @param nodeIdString * @param nNode */ - void registration(String nodeIdString, NetconfNode nNode); + void registration(NodeId nodeId, NetconfNode nNode); /** * @param objectId diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/FaultService.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/FaultService.java index f414b4b15..5598bd1e8 100644 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/FaultService.java +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/FaultService.java @@ -28,9 +28,18 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. public interface FaultService extends DeviceManagerService { /** - * Notify fault information to devicemanager + * Forward received fault information to devicemanager. Devicemanager writes abstracted fault information to + * database and send abstracted fault information to websocket. + * For sending specific notifications to a client, additionally use + * {@link org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService} + *
    + *
  • write to database faultcurrent FaultlogEntity namespace: urn:opendaylight:params:xml:ns:yang:data-provider + *
  • write to database faultlog + *
  • send via websocket as ProblemNotification namespace: urn:opendaylight:params:xml:ns:yang:devicemanager + *
* * @param faultNotification to send + * */ void faultNotification(@NonNull FaultlogEntity faultNotification); diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/MaintenanceService.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/MaintenanceService.java index 8a2ffd880..544ba5fbf 100644 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/MaintenanceService.java +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/MaintenanceService.java @@ -17,28 +17,30 @@ */ package org.onap.ccsdk.features.sdnr.wt.devicemanager.service; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; + public interface MaintenanceService extends DeviceManagerService { /** * Verify maintenance state of given object according to the filter settings. The object is specified by the * criteria provided in the parameters. The data _id (uuid) is equal to the mountpointReference. - * + * * @param mountpointReference used as reference, to query the data from database. * @param objectIdRef first level id in onf core model, delivered by notification objectid * @param problem problem name of device, delivered in problem notification * @return boolean indication */ - boolean isONFObjectInMaintenance(String mountpointReference, String objectIdRef, String problem); + boolean isONFObjectInMaintenance(NodeId nodeId, String objectIdRef, String problem); /** * @param mountPointNodeName */ - void createIfNotExists(String mountPointNodeName); + void createIfNotExists(NodeId nodeId); /** * @param mountPointNodeName */ - void deleteIfNotRequired(String mountPointNodeName); + void deleteIfNotRequired(NodeId nodeId); } diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NotificationService.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NotificationService.java index b249c5008..c766faaac 100644 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NotificationService.java +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/NotificationService.java @@ -24,31 +24,52 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; /** - * Central notification management of devicemanager + * Central notification management of devicemanagers. + * Notifications are forwarded to ODLUX-Clients and written into database. + * Type {@link #EventlogEntity} contains all information. + * Basically, all fields have to be provided with meaningful or + * unique value. + *
    + *
  • SourceType: Mandatory to choose one of the ENUMS, specified by SDNC software + *
  • Host Name: Mountpoint name + *
  • Timestamp: From message or created by controller + *
  • ObjectId: Unique ID of Object (e.g. device, interface) within namespace device + *
  • attributeName: Unique ID within namespace object or message about changed value, + * presented in ODLUX "Message" column. + *
*/ public interface NotificationService extends DeviceManagerService { - - /** Event notification to devicemanager. Can be change, create or remove indication **/ + /** + * Handling of event notification, received by devicemanager. + * Can be a change, create or remove indication. + * + * @param eventNotification is containing all event related information. + */ void eventNotification(@NonNull EventlogEntity eventNotification); -// void eventNotification(NodeId nodeId, Notification notification, @NonNull QName qname, -// @Nullable DateAndTime timeStamp); - - /** create notification for an object **/ + /** + * create notification for an object. Message set to "Create" + * + * @param nodeId of device + * @param counter provided + * @param timeStamp provided + * @param objectId provided + */ void creationNotification(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp, @Nullable String objectId); -// void creationNotification(NodeId nodeId, Notification notification, @NonNull QName qname, -// @Nullable DateAndTime timeStamp); - - /** delete notification of object **/ + /** + * delete notification of object. Message set to "Deletion" + * + * @param nodeId of device + * @param counter provided + * @param timeStamp provided + * @param objectId provided + */ 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 * @@ -62,9 +83,4 @@ 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-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/PerformanceManager.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/PerformanceManager.java index 3f93108a3..d3cd88226 100644 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/PerformanceManager.java +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/PerformanceManager.java @@ -18,6 +18,7 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.service; import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; /** * @author herbert @@ -29,11 +30,11 @@ public interface PerformanceManager extends DeviceManagerService { * @param mountPointNodeName * @param ne */ - void registration(String mountPointNodeName, NetworkElement ne); + void registration(NodeId nodeId, NetworkElement ne); /** * @param mountPointNodeName */ - void deRegistration(String mountPointNodeName); + void deRegistration(NodeId nodeId); } diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/InternalConnectionStatus.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/InternalConnectionStatus.java index 303cd8214..29450ed31 100644 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/InternalConnectionStatus.java +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/InternalConnectionStatus.java @@ -23,6 +23,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro public class InternalConnectionStatus { public static ConnectionLogStatus statusFromNodeStatus(ConnectionStatus nodeStatus) { + if(nodeStatus==null) { + return ConnectionLogStatus.Undefined; + } switch (nodeStatus) { case Connected: return ConnectionLogStatus.Connected; diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiProviderClient.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiProviderClient.java index 193b96a44..acd18336e 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiProviderClient.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiProviderClient.java @@ -30,6 +30,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.InventoryProvide import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.AaiService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InventoryInformationDcae; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -59,33 +60,35 @@ public class AaiProviderClient implements AaiService, AutoCloseable { return this.config; } - public void onDeviceRegistered(String mountPointName) { + @Override + public void onDeviceRegistered(NodeId nodeId) { if (this.config.isOff()) { return; } NetworkElement ne = - this.deviceManager != null ? this.deviceManager.getConnectedNeByMountpoint(mountPointName) : null; + this.deviceManager != null ? this.deviceManager.getConnectedNeByMountpoint(nodeId.getValue()) : null; Optional oip = ne != null ? ne.getService(InventoryProvider.class) : Optional.empty(); - this.onDeviceRegistered(mountPointName, + this.onDeviceRegistered(nodeId, oip.isPresent() ? oip.get().getInventoryInformation("MWPS") : InventoryInformationDcae.getDefault()); } - public void onDeviceRegistered(String mountPointName, InventoryInformationDcae i) { + public void onDeviceRegistered(NodeId nodeId, InventoryInformationDcae i) { if (this.config.isOff()) { return; } - new Thread(new AaiCreateRequestRunnable(mountPointName, i.getType(), i.getModel(), i.getVendor(), + new Thread(new AaiCreateRequestRunnable(nodeId.getValue(), i.getType(), i.getModel(), i.getVendor(), i.getDeviceIpv4(), i.getInterfaceUuidList())).start(); } - public void onDeviceUnregistered(String mountPointName) { + @Override + public void onDeviceUnregistered(NodeId nodeId) { if (this.config.isOff()) { return; } if (this.config.doDeleteOnMountPointRemoved()) { - new Thread(new AaiDeleteRequestRunnable(mountPointName)).start(); + new Thread(new AaiDeleteRequestRunnable(nodeId.getValue())).start(); } else { - LOG.debug("prevent deleting device {} by config", mountPointName); + LOG.debug("prevent deleting device {} by config", nodeId.getValue()); } } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderImpl.java index 8e091bef5..e5dc1d0eb 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderImpl.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderImpl.java @@ -24,6 +24,7 @@ import org.onap.ccsdk.features.sdnr.wt.common.HtAssert; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.ProviderClient; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.MaintenanceService; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,23 +48,23 @@ public class DcaeForwarderImpl implements DcaeForwarderInternal, AutoCloseable { @Override @SuppressWarnings("null") - public void sendProblemNotificationUsingMaintenanceFilter(String nodeId, ProblemNotificationXml notificationXml) { - if (!this.maintenanceService.isONFObjectInMaintenance(nodeId, notificationXml.getObjectId(), + public void sendProblemNotificationUsingMaintenanceFilter(NodeId oWNKEYID, ProblemNotificationXml notificationXml) { + if (!this.maintenanceService.isONFObjectInMaintenance(oWNKEYID, notificationXml.getObjectId(), notificationXml.getProblem())) { if (dcaeProvider != null) { - this.dcaeProvider.sendProblemNotification(nodeId, notificationXml); + this.dcaeProvider.sendProblemNotification(oWNKEYID, notificationXml); } if (this.aotsmClient != null) { - this.aotsmClient.sendProblemNotification(nodeId, notificationXml); + this.aotsmClient.sendProblemNotification(oWNKEYID, notificationXml); } } else { LOG.debug( - "Notification will not be sent to external services. Device " + nodeId + " is in maintenance mode"); + "Notification will not be sent to external services. Device " + oWNKEYID.getValue() + " is in maintenance mode"); } } @Override - public void sendProblemNotification(String nodeId, ProblemNotificationXml notificationXml) { + public void sendProblemNotification(NodeId nodeId, ProblemNotificationXml notificationXml) { //to prevent push alarms on reconnect //=> only pushed alarms are forwared to dcae if (dcaeProvider != null) { diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderInternal.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderInternal.java index d86e0b451..d4e601679 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderInternal.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderInternal.java @@ -18,6 +18,7 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; /** * @author herbert @@ -29,12 +30,12 @@ public interface DcaeForwarderInternal { * @param oWNKEYNAME * @param notificationXml */ - void sendProblemNotificationUsingMaintenanceFilter(String oWNKEYNAME, ProblemNotificationXml notificationXml); + void sendProblemNotificationUsingMaintenanceFilter(NodeId oWNKEYID, ProblemNotificationXml notificationXml); /** * @param nodeName * @param notificationXml */ - void sendProblemNotification(String nodeName, ProblemNotificationXml notificationXml); + void sendProblemNotification(NodeId nodeId, ProblemNotificationXml notificationXml); } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeMessages.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeMessages.java index de62af08e..065faf3ff 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeMessages.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeMessages.java @@ -41,6 +41,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificatio import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.InventoryProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InventoryInformationDcae; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -103,7 +104,7 @@ public class DcaeMessages { * @return String with answer */ - public String postNotification(String mountPointName, ProblemNotificationXml notification) { + public String postNotification(NodeId nodeId, ProblemNotificationXml notification) { String problemName = notification.getProblem(); String sequence = notification.getCounter(); @@ -111,7 +112,7 @@ public class DcaeMessages { String severity = convert(notification.getSeverity()); String timeStamp = convert(notification.getTimeStamp()); - String body = assembleEventNotificationFromTemplate(null, timeStamp, sequence, mountPointName, objId, + String body = assembleEventNotificationFromTemplate(null, timeStamp, sequence, nodeId, objId, problemName, severity, notification.getTimeStamp()).toString(); return dcaeSender.sendDcaePost(body); @@ -243,7 +244,7 @@ public class DcaeMessages { */ private StringBuffer assembleEventNotificationFromTemplate(StringBuffer sb, String epochTimeMicrosecondsString, - String sequence, String mountpointName, String objId, String problemName, String severity, + String sequence, NodeId nodeId, String objId, String problemName, String severity, String eventTimeValueNetconfFormatString) { if (sb == null) { @@ -251,7 +252,7 @@ public class DcaeMessages { } NetworkElement optionalNe = - deviceManager != null ? deviceManager.getConnectedNeByMountpoint(mountpointName) : null; + deviceManager != null ? deviceManager.getConnectedNeByMountpoint(nodeId.getValue()) : null; InventoryInformationDcae neInventory = InventoryInformationDcae.getDefault(); if (optionalNe != null) { Optional inventoryProvider = optionalNe.getService(InventoryProvider.class); @@ -265,7 +266,7 @@ public class DcaeMessages { + " \"event\": {\n" + " \"commonEventHeader\": {\n" + " \"domain\": \"fault\",\n" - + " \"eventId\": \"" + mountpointName + "_" + objId + "_" + problemName + "\",\n" + + " \"eventId\": \"" + nodeId.getValue() + "_" + objId + "_" + problemName + "\",\n" + " \"eventName\": \"" + eventNamePrefix + "_" + problemName + "\",\n" + " \"eventType\": \"" + eventType + "\",\n" + " \"sequence\": " + sequence + ",\n" @@ -273,7 +274,7 @@ public class DcaeMessages { + " \"reportingEntityId\": \"\",\n" + " \"reportingEntityName\": \"" + entityName + "\",\n" + " \"sourceId\": \"\",\n" - + " \"sourceName\": \"" + mountpointName + "\",\n" + + " \"sourceName\": \"" + nodeId.getValue() + "\",\n" + " \"startEpochMicrosec\": " + epochTimeMicrosecondsString + ",\n" + " \"lastEpochMicrosec\": " + epochTimeMicrosecondsString + ",\n" + " \"version\": 3.0\n" diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderClient.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderClient.java index 7ceafcb46..8416d366e 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderClient.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderClient.java @@ -23,6 +23,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.config.D import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.ProviderClient; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,16 +56,16 @@ public class DcaeProviderClient implements AutoCloseable, ProviderClient { } @Override - public void sendProblemNotification(String mountPointName, ProblemNotificationXml notification) { + public void sendProblemNotification(NodeId nodeId, ProblemNotificationXml notification) { synchronized (lock) { - worker.sendProblemNotification(mountPointName, notification); + worker.sendProblemNotification(nodeId, notification); } } @Override - public void sendProblemNotification(String mountPointName, ProblemNotificationXml notification, + public void sendProblemNotification(NodeId nodeId, ProblemNotificationXml notification, boolean neDeviceAlarm) { - sendProblemNotification(mountPointName, notification); + sendProblemNotification(nodeId, notification); } @Override diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderWorker.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderWorker.java index 1ef50c3e9..f407b7811 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderWorker.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderWorker.java @@ -21,10 +21,10 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; - import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.config.DcaeConfig; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,8 +62,8 @@ class DcaeProviderWorker implements AutoCloseable { LOG.info("Fault task scheduled"); } - public void sendProblemNotification(String mountPointName, ProblemNotificationXml notification) { - LOG.debug("Notification answer: {}", dcaeMessages.postNotification(mountPointName, notification)); + public void sendProblemNotification(NodeId nodeId, ProblemNotificationXml notification) { + LOG.debug("Notification answer: {}", dcaeMessages.postNotification(nodeId, notification)); } @Override diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java index dc57626ff..94694cd90 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java @@ -171,9 +171,9 @@ public class DeviceManagerDatabaseNotificationService implements NotificationSer } private void pushAlarmIfNotInMaintenance(String nodeName, ProblemNotificationXml notificationXml) { - if (!this.maintenanceService.isONFObjectInMaintenance(nodeName, notificationXml.getObjectId(), + if (!this.maintenanceService.isONFObjectInMaintenance(new NodeId(nodeName), notificationXml.getObjectId(), notificationXml.getProblem())) { - this.aotsDcaeForwarder.sendProblemNotification(nodeName, notificationXml); + this.aotsDcaeForwarder.sendProblemNotification(new NodeId(nodeName), notificationXml); } else { LOG.debug("Notification will not be sent to external services. Device " + nodeName + " is in maintenance mode"); diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java index 66fcc05c3..037f09778 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java @@ -17,6 +17,8 @@ */ package org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler; +import java.util.Optional; +import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -30,9 +32,12 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.NetworkElementCon 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.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus; +import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf; 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; @@ -48,7 +53,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicema import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.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.NetworkTopology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -78,6 +90,7 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea private final WebSocketServiceClientInternal webSocketService; private final DataProvider databaseService; private final DcaeForwarderInternal aotsDcaeForwarder; + private final DataBroker dataBroker; private final ExecutorService executor = Executors.newFixedThreadPool(5); private int eventNumber; @@ -95,7 +108,7 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea * @param dcaeForwarder to deliver problems to external service */ public ODLEventListenerHandler(String ownKeyName, WebSocketServiceClientInternal webSocketService, - DataProvider databaseService, DcaeForwarderInternal dcaeForwarder) { + DataProvider databaseService, DcaeForwarderInternal dcaeForwarder, DataBroker dataBroker) { super(); this.ownKeyName = ownKeyName; @@ -103,6 +116,7 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea this.databaseService = databaseService; this.aotsDcaeForwarder = dcaeForwarder; + this.dataBroker = dataBroker; this.eventNumber = 0; } @@ -118,24 +132,43 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea * @param nNode with mountpoint data */ @Override - public void registration(String registrationName, NetconfNode nNode) { + public void registration(NodeId nodeId, NetconfNode nNode) { DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp(); ObjectCreationNotification notification = new ObjectCreationNotificationBuilder() - .setObjectIdRef(registrationName).setCounter(popEvntNumber()).setTimeStamp(ts).build(); - Connectionlog log = new ConnectionlogBuilder().setNodeId(registrationName) + .setObjectIdRef(nodeId.getValue()).setCounter(popEvntNumber()).setTimeStamp(ts).build(); + Connectionlog log = new ConnectionlogBuilder().setNodeId(nodeId.getValue()) .setStatus(ConnectionLogStatus.Mounted).setTimestamp(ts).build(); - NetworkElementConnectionEntity e = - NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode); - LOG.debug("registration networkelement-connection for {} with status {}", registrationName, e.getStatus()); + + NetworkElementConnectionEntity e = NetworkElementConnectionEntitiyUtil.getNetworkConnection(nodeId.getValue(), + nNode, getNnodeConfig(nodeId)); + LOG.debug("registration networkelement-connection for {} with status {}", nodeId.getValue(), e.getStatus()); // Write first to prevent missing entries - databaseService.updateNetworkConnection22(e, registrationName); + databaseService.updateNetworkConnection22(e, nodeId.getValue()); databaseService.writeConnectionLog(log); webSocketService.sendViaWebsockets(new NodeId(ownKeyName), notification, ObjectCreationNotification.QNAME, NetconfTimeStampImpl.getConverter().getTimeStamp()); } + private Optional getNnodeConfig(NodeId nodeId) { + if (this.dataBroker != null) { + + InstanceIdentifier iif = InstanceIdentifier.create(NetworkTopology.class) + .child(Topology.class, new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName()))) + .child(Node.class, new NodeKey(nodeId)).augmentation(NetconfNode.class); + + try { + Optional onode = + this.dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, iif).get(); + return onode; + } catch (InterruptedException | ExecutionException e) { + LOG.warn("problem requesting netconfnode again:", e); + } + } + return Optional.empty(); + } + /** * (Connected) mountpoint state moves to connected * @@ -143,21 +176,22 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea * @param deviceType according to assessement */ @Override - public void connectIndication(String mountpointNodeName, NetworkElementDeviceType deviceType) { + public void connectIndication(NodeId nNodeId, NetworkElementDeviceType deviceType) { // Write first to prevent missing entries - LOG.debug("updating networkelement-connection devicetype for {} with {}", mountpointNodeName, deviceType); + LOG.debug("updating networkelement-connection devicetype for {} with {}", nNodeId.getValue(), deviceType); NetworkElementConnectionEntity e = NetworkElementConnectionEntitiyUtil.getNetworkConnectionDeviceTpe(deviceType); //if updating db entry for ne connection fails retry later on (due elasticsearch max script executions error) - if (!databaseService.updateNetworkConnectionDeviceType(e, mountpointNodeName)) { - this.updateNeConnectionRetryWithDelay(e, mountpointNodeName); + if (!databaseService.updateNetworkConnectionDeviceType(e, nNodeId.getValue())) { + this.updateNeConnectionRetryWithDelay(e, nNodeId.getValue()); } DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp(); AttributeValueChangedNotification notification = new AttributeValueChangedNotificationBuilder() - .setCounter(popEvntNumber()).setTimeStamp(ts).setObjectIdRef(mountpointNodeName) + .setCounter(popEvntNumber()).setTimeStamp(ts).setObjectIdRef(nNodeId.getValue()) .setAttributeName("deviceType").setNewValue(deviceType.name()).build(); - webSocketService.sendViaWebsockets(new NodeId(ownKeyName), notification, AttributeValueChangedNotification.QNAME, ts); + webSocketService.sendViaWebsockets(new NodeId(ownKeyName), notification, + AttributeValueChangedNotification.QNAME, ts); } /** @@ -166,11 +200,11 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea * @param mountpointNodeName nodeid * @param netconfNode node */ - public void onStateChangeIndication(String mountpointNodeName, NetconfNode netconfNode) { - LOG.debug("mountpoint state changed indication for {}", mountpointNodeName); + public void onStateChangeIndication(NodeId nodeId, NetconfNode netconfNode) { + LOG.debug("mountpoint state changed indication for {}", nodeId.getValue()); ConnectionStatus csts = netconfNode.getConnectionStatus(); - this.updateRegistration(mountpointNodeName, ConnectionStatus.class.getSimpleName(), - csts != null ? csts.getName() : "null", netconfNode); + this.updateRegistration(nodeId, ConnectionStatus.class.getSimpleName(), csts != null ? csts.getName() : "null", + netconfNode); } @@ -181,17 +215,18 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea */ @SuppressWarnings("null") @Override - public void deRegistration(String registrationName) { + public void deRegistration(NodeId nodeId) { DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp(); ObjectDeletionNotification notification = new ObjectDeletionNotificationBuilder().setCounter(popEvntNumber()) - .setTimeStamp(ts).setObjectIdRef(registrationName).build(); - Connectionlog log = new ConnectionlogBuilder().setNodeId(registrationName) + .setTimeStamp(ts).setObjectIdRef(nodeId.getValue()).build(); + Connectionlog log = new ConnectionlogBuilder().setNodeId(nodeId.getValue()) .setStatus(ConnectionLogStatus.Unmounted).setTimestamp(ts).build(); // Write first to prevent missing entries - databaseService.removeNetworkConnection(registrationName); + databaseService.removeNetworkConnection(nodeId.getValue()); databaseService.writeConnectionLog(log); - webSocketService.sendViaWebsockets(new NodeId(registrationName), notification, ObjectDeletionNotification.QNAME, ts); + webSocketService.sendViaWebsockets(new NodeId(nodeId.getValue()), notification, + ObjectDeletionNotification.QNAME, ts); } @@ -201,24 +236,24 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea * @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) { + public void updateRegistration(NodeId nodeId, String attribute, String attributeNewValue, NetconfNode nNode) { DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp(); AttributeValueChangedNotification notification = new AttributeValueChangedNotificationBuilder() - .setCounter(popEvntNumber()).setTimeStamp(ts).setObjectIdRef(registrationName) + .setCounter(popEvntNumber()).setTimeStamp(ts).setObjectIdRef(nodeId.getValue()) .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()); + Connectionlog log = new ConnectionlogBuilder().setNodeId(nodeId.getValue()) + .setStatus(getStatus(attributeNewValue)).setTimestamp(ts).build(); + NetworkElementConnectionEntity e = NetworkElementConnectionEntitiyUtil.getNetworkConnection(nodeId.getValue(), + nNode, getNnodeConfig(nodeId)); + LOG.debug("updating networkelement-connection for {} with status {}", nodeId.getValue(), e.getStatus()); //if updating db entry for ne connection fails retry later on (due elasticsearch max script executions error) - if (!databaseService.updateNetworkConnection22(e, registrationName)) { - this.updateNeConnectionRetryWithDelay(nNode, registrationName); + if (!databaseService.updateNetworkConnection22(e, nodeId.getValue())) { + this.updateNeConnectionRetryWithDelay(nNode, nodeId.getValue()); } databaseService.writeConnectionLog(log); - webSocketService.sendViaWebsockets(new NodeId(ownKeyName), notification, AttributeValueChangedNotification.QNAME, ts); + webSocketService.sendViaWebsockets(new NodeId(ownKeyName), notification, + AttributeValueChangedNotification.QNAME, ts); } @@ -271,7 +306,7 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea databaseService.writeFaultLog(notificationXml.getFaultlog(SourceType.Controller)); databaseService.updateFaultCurrent(notificationXml.getFaultcurrent()); - aotsDcaeForwarder.sendProblemNotificationUsingMaintenanceFilter(ownKeyName, notificationXml); + aotsDcaeForwarder.sendProblemNotificationUsingMaintenanceFilter(new NodeId(ownKeyName), notificationXml); webSocketService.sendViaWebsockets(new NodeId(ownKeyName), notification, ProblemNotification.QNAME, ts); } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java index 273231a9b..90e07e666 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java @@ -102,7 +102,7 @@ public class RpcPushNotificationsHandler implements PushNotifications { 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); + aotsDcaeForwarder.sendProblemNotificationUsingMaintenanceFilter(new NodeId(OWNKEYNAME), notificationXml); webSocketService.sendViaWebsockets(new NodeId(input.getNodeId()!=null?input.getNodeId():OWNKEYNAME), notification, ProblemNotification.QNAME, input.getTimestamp()); } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ResyncNetworkElementHouskeepingService.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ResyncNetworkElementHouskeepingService.java index fe166c92d..50b0215d6 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ResyncNetworkElementHouskeepingService.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ResyncNetworkElementHouskeepingService.java @@ -99,7 +99,7 @@ public class ResyncNetworkElementHouskeepingService implements ResyncNetworkElem List nodeNamesInput; // Create list of mountpoints if input is empty, using the content in ES - if (nodeNames == null || nodeNames.isEmpty()) { + if (nodeNames == null || nodeNames.size() <= 0) { nodeNamesInput = this.databaseClientEvents.getAllNodesWithCurrentAlarms(); } else { nodeNamesInput = nodeNames; diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java index ed452cb7e..361356217 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java @@ -218,8 +218,8 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa RpcPushNotificationsHandler rpcPushNotificationsHandler = new RpcPushNotificationsHandler(webSocketService, dataProvider, aotsDcaeForwarder); - this.odlEventListenerHandler = - new ODLEventListenerHandler(myDbKeyNameExtended, webSocketService, dataProvider, aotsDcaeForwarder); + this.odlEventListenerHandler = new ODLEventListenerHandler(myDbKeyNameExtended, webSocketService, dataProvider, + aotsDcaeForwarder, dataBroker); this.archiveCleanService = new ArchiveCleanService(iEntityDataProvider.getEsConfig(), clusterSingletonServiceProvider, dataProvider); this.housekeepingService = new ConnectionStatusHousekeepingService(config, clusterSingletonServiceProvider, diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfConnectHandler.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfConnectHandler.java index bb61a82b4..4b4d1eded 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfConnectHandler.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfConnectHandler.java @@ -88,13 +88,13 @@ public class DeviceManagerNetconfConnectHandler extends DeviceManagerNetconfNotC } // update db with connect status NetconfNode netconfNode = acessor.getNetconfNode(); - sendUpdateNotification(mountPointNodeName, netconfNode.getConnectionStatus(), netconfNode); + sendUpdateNotification(acessor.getNodeId(), netconfNode.getConnectionStatus(), netconfNode); for (NetworkElementFactory f : getFactoryList()) { Optional optionalNe = f.create(acessor, getServiceProvider()); if (optionalNe.isPresent()) { // sendUpdateNotification(mountPointNodeName, nNode.getConnectionStatus(), nNode); - handleNeStartup(mountPointNodeName, optionalNe.get()); + handleNeStartup(acessor.getNodeId(), optionalNe.get()); break; // Use the first provided } } @@ -109,7 +109,7 @@ public class DeviceManagerNetconfConnectHandler extends DeviceManagerNetconfNotC if (optionalNetconfNode.isPresent()) { NetconfNode nNode = optionalNetconfNode.get(); ConnectionStatus csts = nNode.getConnectionStatus(); - sendUpdateNotification(mountPointNodeName, csts, nNode); + sendUpdateNotification(nNodeId, csts, nNode); } // Handling if mountpoint exist. connected -> connecting/UnableToConnect @@ -137,7 +137,7 @@ public class DeviceManagerNetconfConnectHandler extends DeviceManagerNetconfNotC /** * Do all tasks necessary to move from mountpoint state connected -> connecting - * + * * @param mountPointNodeName provided */ private void stopListenerOnNodeForConnectedState(String mountPointNodeName) { @@ -154,32 +154,32 @@ public class DeviceManagerNetconfConnectHandler extends DeviceManagerNetconfNotC } - private void handleNeStartup(String mountPointNodeName, NetworkElement inNe) { + private void handleNeStartup(NodeId nodeId, NetworkElement inNe) { - LOG.info("NE Management for {} with {}", mountPointNodeName, inNe.getClass().getName()); + LOG.info("NE Management for {} with {}", nodeId.getValue(), inNe.getClass().getName()); NetworkElement result; synchronized (networkelementLock) { - result = connectedNetworkElementRepresentations.put(mountPointNodeName, inNe); + result = connectedNetworkElementRepresentations.put(nodeId.getValue(), inNe); } if (result != null) { LOG.warn("NE list was not empty as expected, but contained {} ", result.getNodeId()); } else { - LOG.debug("refresh necon entry for {} with type {}", mountPointNodeName, inNe.getDeviceType()); + LOG.debug("refresh necon entry for {} with type {}", nodeId.getValue(), inNe.getDeviceType()); if (isOdlEventListenerHandlerEnabled()) { - getOdlEventListenerHandler().connectIndication(mountPointNodeName, inNe.getDeviceType()); + getOdlEventListenerHandler().connectIndication(nodeId, inNe.getDeviceType()); } } if (isDeviceMonitorEnabled()) { - getDeviceMonitor().deviceConnectMasterIndication(mountPointNodeName, inNe); + getDeviceMonitor().deviceConnectMasterIndication(nodeId.getValue(), inNe); } inNe.register(); } - private void sendUpdateNotification(String mountPointNodeName, ConnectionStatus csts, NetconfNode nNode) { - LOG.info("update ConnectedState for device :: Name : {} ConnectionStatus {}", mountPointNodeName, csts); + private void sendUpdateNotification(NodeId nodeId, ConnectionStatus csts, NetconfNode nNode) { + LOG.info("update ConnectedState for device :: Name : {} ConnectionStatus {}", nodeId.getValue(), csts); if (isOdlEventListenerHandlerEnabled()) { - getOdlEventListenerHandler().updateRegistration(mountPointNodeName, ConnectionStatus.class.getSimpleName(), + getOdlEventListenerHandler().updateRegistration(nodeId, ConnectionStatus.class.getSimpleName(), csts != null ? csts.getName() : "null", nNode); } } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfNotConnectHandler.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfNotConnectHandler.java index df833018d..f9bbe1abf 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfNotConnectHandler.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfNotConnectHandler.java @@ -75,7 +75,7 @@ public class DeviceManagerNetconfNotConnectHandler implements NetconfNodeStateLi public void onCreated(NodeId nNodeId, NetconfNode netconfNode) { LOG.info("onCreated {}", nNodeId); if (isOdlEventListenerHandlerMaster()) { - odlEventListenerHandler.registration(nNodeId.getValue(), netconfNode); + odlEventListenerHandler.registration(nNodeId, netconfNode); } if (deviceMonitorEnabled) { deviceMonitor.deviceDisconnectIndication(nNodeId.getValue()); @@ -86,20 +86,19 @@ public class DeviceManagerNetconfNotConnectHandler implements NetconfNodeStateLi public void onStateChange(NodeId nNodeId, NetconfNode netconfNode) { LOG.info("onStateChange {}", nNodeId); if (isOdlEventListenerHandlerMaster()) { - odlEventListenerHandler.onStateChangeIndication(nNodeId.getValue(), netconfNode); + odlEventListenerHandler.onStateChangeIndication(nNodeId, netconfNode); } } @Override public void onRemoved(NodeId nNodeId) { - String mountPointNodeName = nNodeId.getValue(); LOG.info("mountpointNodeRemoved {}", nNodeId.getValue()); if (deviceMonitorEnabled) { - deviceMonitor.removeMountpointIndication(mountPointNodeName); + deviceMonitor.removeMountpointIndication(nNodeId.getValue()); } if (isOdlEventListenerHandlerMaster()) { - odlEventListenerHandler.deRegistration(mountPointNodeName); //Additional indication for log + odlEventListenerHandler.deRegistration(nNodeId); //Additional indication for log } } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ProviderClient.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ProviderClient.java index 82519e48b..7258e8d84 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ProviderClient.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ProviderClient.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 @@ -18,25 +18,26 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl; import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; public interface ProviderClient extends AutoCloseable { /** * Send out problem notification, that was created by a device/ or NE - * + * * @param mountPointName related * @param notification xml description */ - public void sendProblemNotification(String mountPointName, ProblemNotificationXml notification); + public void sendProblemNotification(NodeId nodeId, ProblemNotificationXml notification); /** * Send out problem notification - * + * * @param mountPointName related * @param notification xml description * @param neDeviceAlarm true indicates an NE originated alarm, false an sdncontroller generated alarm */ - public void sendProblemNotification(String mountPointName, ProblemNotificationXml notification, + public void sendProblemNotification(NodeId nodeId, ProblemNotificationXml notification, boolean neDeviceAlarm); } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java index 5b8105a07..4369af019 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java @@ -17,6 +17,7 @@ */ package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util; +import java.util.Optional; import javax.annotation.Nonnull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InternalConnectionStatus; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; @@ -24,12 +25,16 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; 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.netconf.node.credentials.Credentials; +import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.KeyAuth; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword; +import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPw; +import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPwUnencrypted; 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.NetworkElementConnectionBuilder; 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.network.element.connection.entity.NodeDetailsBuilder; +import org.opendaylight.yangtools.yang.common.Uint32; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,6 +63,11 @@ public class NetworkElementConnectionEntitiyUtil { * @return NetworkElementConnectionEntity specific information */ public static NetworkElementConnectionEntity getNetworkConnection(String nodeId, @Nonnull NetconfNode nNode) { + return getNetworkConnection(nodeId, nNode, Optional.empty()); + } + + public static NetworkElementConnectionEntity getNetworkConnection(String nodeId, @Nonnull NetconfNode nNode, + Optional configNetconfNode) { NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder(); // -- basics @@ -79,15 +89,34 @@ public class NetworkElementConnectionEntitiyUtil { Host host = nNode.getHost(); PortNumber portNumber = nNode.getPort(); if (host != null && portNumber != null) { - eb.setHost(host.stringValue()).setPort(portNumber.getValue().longValue()); + eb.setHost(host.stringValue()).setPort(Uint32.valueOf(portNumber.getValue())); } - Credentials credentials = nNode.getCredentials(); + Credentials credentials = + configNetconfNode.isPresent() ? configNetconfNode.get().getCredentials() : nNode.getCredentials(); if (credentials instanceof LoginPassword) { LoginPassword loginPassword = (LoginPassword) credentials; - eb.setUsername(loginPassword.getUsername()).setPassword(loginPassword.getPassword()); + eb.setUsername(loginPassword.getUsername()).setPassword(loginPassword.getPassword()) + .setMountMethod(LoginPassword.class.getSimpleName()); + } else if (credentials instanceof LoginPwUnencrypted) { + LoginPwUnencrypted loginPassword = (LoginPwUnencrypted) credentials; + eb.setUsername(loginPassword.getLoginPasswordUnencrypted().getUsername()) + .setPassword(loginPassword.getLoginPasswordUnencrypted().getPassword()) + .setMountMethod(LoginPwUnencrypted.class.getSimpleName()); + } else if (credentials instanceof LoginPw) { + LoginPw loginPassword = (LoginPw) credentials; + eb.setUsername(loginPassword.getLoginPassword().getUsername()) + .setPassword(loginPassword.getLoginPassword().getPassword()) + .setMountMethod(LoginPw.class.getSimpleName()); + } else if (credentials instanceof KeyAuth) { + KeyAuth keyAuth = (KeyAuth) credentials; + eb.setUsername(keyAuth.getKeyBased().getUsername()).setTlsKey(keyAuth.getKeyBased().getKeyId()) + .setMountMethod(KeyAuth.class.getSimpleName()); } - eb.setCoreModelCapability("Unsupported"); // Default value. Specific value (if any) is set in the specific devicemanagers + LOG.debug("mount-method: {} ({})", eb.getMountMethod(), + credentials == null ? null : credentials.getClass().getName()); + // Default value. Specific value (if any) is set in the specific devicemanagers + eb.setCoreModelCapability("Unsupported"); return eb.build(); } } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java index 7dad49e01..6351f3958 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java @@ -35,6 +35,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicema import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.TestMaintenanceModeInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.TestMaintenanceModeOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.show.required.network.element.output.RequiredNetworkElementBuilder; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,13 +55,13 @@ public class MaintenanceServiceImpl implements MaintenanceService, MaintenanceRP } @Override - public void createIfNotExists(String mountPointNodeName) { - database.createIfNotExists(mountPointNodeName); + public void createIfNotExists(NodeId nodeId) { + database.createIfNotExists(nodeId.getValue()); } @Override - public void deleteIfNotRequired(String mountPointNodeName) { - database.deleteIfNotRequired(mountPointNodeName); + public void deleteIfNotRequired(NodeId nodeId) { + database.deleteIfNotRequired(nodeId.getValue()); } /*------------------------------------------------- @@ -159,10 +160,10 @@ public class MaintenanceServiceImpl implements MaintenanceService, MaintenanceRP */ @Override - public boolean isONFObjectInMaintenance(String mountpointReference, String objectIdRef, String problem) { - MaintenanceEntity maintenanceMode = database.getMaintenance(mountpointReference); + public boolean isONFObjectInMaintenance(NodeId nodeId, String objectIdRef, String problem) { + MaintenanceEntity maintenanceMode = database.getMaintenance(nodeId.getValue()); boolean res = MaintenanceCalculator.isONFObjectInMaintenance(maintenanceMode, objectIdRef, problem); - LOG.debug("inMaintenance={} for mountpoint/id/problem:{} {} {} Definition: {}", res, mountpointReference, + LOG.debug("inMaintenance={} for mountpoint/id/problem:{} {} {} Definition: {}", res, nodeId.getValue(), objectIdRef, problem, this); return res; } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerImpl.java index 22098675b..3ccaa7550 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerImpl.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerImpl.java @@ -23,6 +23,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.config.PmConfig; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.PerformanceManager; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -65,18 +66,18 @@ public class PerformanceManagerImpl implements PerformanceManager, AutoCloseable } @Override - public void registration(String mountPointNodeName, NetworkElement ne) { - LOG.debug("Register {}", mountPointNodeName); + public void registration(NodeId nodeId, NetworkElement ne) { + LOG.debug("Register {}", nodeId.getValue()); if (task != null) { - task.registration(mountPointNodeName, ne); + task.registration(nodeId.getValue(), ne); } } @Override - public void deRegistration(String mountPointNodeName) { - LOG.debug("Deregister {}", mountPointNodeName); + public void deRegistration(NodeId nodeId) { + LOG.debug("Deregister {}", nodeId.getValue()); if (task != null) { - task.deRegistration(mountPointNodeName); + task.deRegistration(nodeId.getValue()); } } diff --git a/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java b/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java index cc49ea9bf..02d381ff2 100644 --- a/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java +++ b/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java @@ -23,7 +23,6 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; - import com.google.common.io.Files; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; @@ -37,9 +36,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import org.junit.After; import org.junit.AfterClass; -import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; @@ -47,6 +44,7 @@ import org.onap.ccsdk.features.sdnr.wt.common.util.ResourceFileLoader; import org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl.AaiProviderClient; import org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl.config.AaiConfig; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InventoryInformationDcae; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; public class TestAai { @@ -113,14 +111,14 @@ public class TestAai { ifInfos.add("LP-MWPS-RADIO"); InventoryInformationDcae ii = new InventoryInformationDcae(type, model, vendor, ipv4, ipv6, ifInfos); System.out.println("registering device"); - provider.onDeviceRegistered(mountPointName, ii); + provider.onDeviceRegistered(new NodeId(mountPointName), ii); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("unregistering device"); - provider.onDeviceUnregistered(mountPointName); + provider.onDeviceUnregistered(new NodeId(mountPointName)); System.out.println("finished"); try { provider.close(); @@ -148,15 +146,15 @@ public class TestAai { ifInfos.add("LP-MWPS-RADIO"); InventoryInformationDcae ii = new InventoryInformationDcae(type, model, vendor, ipv4, ipv6, ifInfos); System.out.println("registering device"); - provider.onDeviceRegistered(mountPointName); - provider.onDeviceRegistered(mountPointName, ii); + provider.onDeviceRegistered(new NodeId(mountPointName)); + provider.onDeviceRegistered(new NodeId(mountPointName), ii); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("unregistering device"); - provider.onDeviceUnregistered(mountPointName); + provider.onDeviceUnregistered(new NodeId(mountPointName)); System.out.println("finished"); try { provider.close(); diff --git a/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java b/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java index ff01f9a2b..a403fe4a6 100644 --- a/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java +++ b/sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java @@ -21,7 +21,10 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.test; import static org.junit.Assert.fail; - +import com.google.common.io.Files; +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; import java.io.File; import java.io.IOException; import java.io.OutputStream; @@ -31,7 +34,6 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; - import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -41,10 +43,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTi 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.types.InventoryInformationDcae; -import com.google.common.io.Files; -import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpHandler; -import com.sun.net.httpserver.HttpServer; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; @SuppressWarnings("restriction") public class TestDcae { @@ -93,7 +92,7 @@ public class TestDcae { boolean neDeviceAlarm = false; ProblemNotificationXml notification = new ProblemNotificationXml(mountPointName, "network-element", "problemName", InternalSeverity.Critical, 123, InternalDateAndTime.getTestpattern()); - provider.sendProblemNotification(mountPointName, notification, neDeviceAlarm); + provider.sendProblemNotification(new NodeId(mountPointName), notification, neDeviceAlarm); try { Thread.sleep(5000); -- cgit 1.2.3-korg