diff options
author | Michael DÜrre <michael.duerre@highstreet-technologies.com> | 2021-04-08 06:34:22 +0200 |
---|---|---|
committer | Michael DÜrre <michael.duerre@highstreet-technologies.com> | 2021-04-08 06:34:46 +0200 |
commit | f3969004c6ccac18e742c5fc48c844e315991023 (patch) | |
tree | f5486a62e842bb16ca7d3af47a8663df08feef55 /sdnr/wt/devicemanager-onf/provider/src | |
parent | a252be83694ae33260d99d5371ed48c1558aa2e8 (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-onf/provider/src')
11 files changed, 139 insertions, 49 deletions
diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ExtendedEquipment.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ExtendedEquipment.java index ed9726a11..e6c3865f7 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ExtendedEquipment.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ExtendedEquipment.java @@ -29,6 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.ManufacturerProperties; 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.InventoryBuilder; +import org.opendaylight.yangtools.yang.common.Uint32; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -85,7 +86,7 @@ public class ExtendedEquipment { // General inventoryBuilder.setNodeId(getNodeId()); inventoryBuilder.setParentUuid(getParentUuid()); - inventoryBuilder.setTreeLevel(Long.valueOf(getTreeLevel())); + inventoryBuilder.setTreeLevel(Uint32.valueOf(getTreeLevel())); if (getEquipment() != null) { inventoryBuilder.setUuid(getEquipment().getUuid().getValue()); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java index 0c51c5ebc..3c0878495 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java @@ -29,7 +29,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.OnfInterfacePac; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EquipmentData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InventoryInformationDcae; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java index 12c8b540a..6b32180d1 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java @@ -33,9 +33,9 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; +import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; @@ -74,6 +74,9 @@ import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.r import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.tdm.container.pac.TdmContainerCurrentProblems; 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.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.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.NotificationListener; import org.opendaylight.yangtools.yang.common.QName; @@ -95,6 +98,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw private Optional<NotificationWorker<EventlogEntity>> notificationQueue; + private final WebsocketManagerService notificationService; + /** * @param acessor to access device */ @@ -104,6 +109,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw this.genericTransactionUtils = acessor.getTransactionUtils(); this.microwaveModelListener = serviceProvider.getNotificationService(); this.faultService = serviceProvider.getFaultService(); + this.notificationService = serviceProvider.getWebsocketService(); this.notificationQueue = Optional.empty(); } @@ -202,6 +208,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw if (notification != null) { microwaveModelListener.creationNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue()); + notificationService.sendNotification(notification, acessor.getNodeId().getValue(), + ObjectCreationNotification.QNAME, notification.getTimeStamp()); } } @@ -211,6 +219,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw if (notification != null) { microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue()); + notificationService.sendNotification(notification, acessor.getNodeId().getValue(), + ObjectDeletionNotification.QNAME, notification.getTimeStamp()); } } @@ -222,6 +232,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw .setObjectId(Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue()) .setAttributeName(notification.getAttributeName()).setNewValue(notification.getNewValue()).build(); microwaveModelListener.eventNotification(beventlogEntity); + notificationService.sendNotification(notification, acessor.getNodeId().getValue(), + AttributeValueChangedNotification.QNAME, notification.getTimeStamp()); if (notificationQueue.isPresent()) { notificationQueue.get().put(beventlogEntity); } @@ -231,10 +243,15 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw public void onProblemNotification(ProblemNotification notification) { LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName()); - - faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(), - Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), notification.getProblem(), - mapSeverity(notification.getSeverity())); + FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue()) + .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf) + .setTimestamp(notification.getTimeStamp()) + .setNodeId(this.acessor.getNodeId().getValue()) + .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter()) + .build(); + faultService.faultNotification(faultAlarm); + notificationService.sendNotification(notification, acessor.getNodeId().getValue(), ProblemNotification.QNAME, + notification.getTimeStamp()); } /*----------------------------------------------------------------------------- @@ -267,7 +284,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw if (problems == null) { LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid); } else { - for (AirInterfaceCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) { + for (AirInterfaceCurrentProblemTypeG problem : YangHelper + .getCollection(problems.nonnullCurrentProblemList())) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); @@ -300,7 +318,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw if (problems == null) { LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid); } else { - for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) { + for (ContainerCurrentProblemTypeG problem : YangHelper + .getCollection(problems.nonnullCurrentProblemList())) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); @@ -332,7 +351,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw if (problems == null) { LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid); } else { - for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) { + for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper + .getCollection(problems.nonnullCurrentProblemList())) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); @@ -364,7 +384,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw if (problems == null) { LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid); } else { - for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) { + for (StructureCurrentProblemTypeG problem : YangHelper + .getCollection(problems.nonnullCurrentProblemList())) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); @@ -396,7 +417,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw if (problems == null) { LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid); } else { - for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) { + for (StructureCurrentProblemTypeG problem : YangHelper + .getCollection(problems.nonnullCurrentProblemList())) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); @@ -441,7 +463,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid); } else { // -- Specific part 3 - for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) { + for (ContainerCurrentProblemTypeG problem : YangHelper + .getCollection(problems.nonnullCurrentProblemList())) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); @@ -527,7 +550,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId); } else { Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = - YangHelper.getCollection(ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList()); + YangHelper.getCollection( + ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList()); LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size()); for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) { result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord)); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java index 653a786f0..04d72e1fa 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java @@ -33,9 +33,9 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; +import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; @@ -74,6 +74,9 @@ import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.r import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.tdm.container.pac.TdmContainerCurrentProblems; 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.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.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.NotificationListener; import org.opendaylight.yangtools.yang.common.QName; @@ -93,10 +96,12 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw private final TransactionUtils genericTransactionUtil; private final String mountpointId; private final @NonNull FaultService faultService; + private final WebsocketManagerService notificationService; private Optional<NotificationWorker<EventlogEntity>> notificationQueue; + /** * Handle specific version of microwave model * @@ -110,6 +115,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw this.genericTransactionUtil = acessor.getTransactionUtils(); this.microwaveModelListener = serviceProvider.getNotificationService(); this.faultService = serviceProvider.getFaultService(); + this.notificationService = serviceProvider.getWebsocketService(); this.notificationQueue = Optional.empty(); } @@ -253,10 +259,15 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw public void onProblemNotification(ProblemNotification notification) { LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName()); - - faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(), - Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), notification.getProblem(), - mapSeverity(notification.getSeverity())); + FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue()) + .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf) + .setTimestamp(notification.getTimeStamp()) + .setNodeId(this.acessor.getNodeId().getValue()) + .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter()) + .build(); + faultService.faultNotification(faultAlarm); + notificationService.sendNotification(notification, acessor.getNodeId().getValue(), ProblemNotification.QNAME, + notification.getTimeStamp()); } /*----------------------------------------------------------------------------- diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java index a1f71c586..623fa6220 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java @@ -33,9 +33,9 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; +import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; @@ -74,6 +74,9 @@ import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.r import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.tdm.container.pac.TdmContainerCurrentProblems; 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.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.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.NotificationListener; import org.opendaylight.yangtools.yang.common.QName; @@ -93,6 +96,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw private final TransactionUtils genericTransactionUtils; private final String mountpointId; private final @NonNull FaultService faultService; + private final WebsocketManagerService notificationService; private Optional<NotificationWorker<EventlogEntity>> notificationQueue; @@ -109,6 +113,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw this.mountpointId = acessor.getNodeId().getValue(); this.microwaveModelListener = serviceProvider.getNotificationService(); this.faultService = serviceProvider.getFaultService(); + this.notificationService = serviceProvider.getWebsocketService(); this.notificationQueue = Optional.empty(); } @@ -249,10 +254,15 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw public void onProblemNotification(ProblemNotification notification) { LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName()); - - faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(), - Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), notification.getProblem(), - mapSeverity(notification.getSeverity())); + FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue()) + .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf) + .setTimestamp(notification.getTimeStamp()) + .setNodeId(this.acessor.getNodeId().getValue()) + .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter()) + .build(); + faultService.faultNotification(faultAlarm); + notificationService.sendNotification(notification, acessor.getNodeId().getValue(), ProblemNotification.QNAME, + notification.getTimeStamp()); } /*----------------------------------------------------------------------------- @@ -286,7 +296,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } else if (problems.getCurrentProblemList() == null) { LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid); } else { - for (AirInterfaceCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) { + for (AirInterfaceCurrentProblemTypeG problem : YangHelper + .getCollection(problems.nonnullCurrentProblemList())) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); @@ -319,7 +330,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } else if (problems.getCurrentProblemList() == null) { LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid); } else { - for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) { + for (ContainerCurrentProblemTypeG problem : YangHelper + .getCollection(problems.nonnullCurrentProblemList())) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); @@ -352,7 +364,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } else if (problems.getCurrentProblemList() == null) { LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid); } else { - for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) { + for (AirInterfaceDiversityCurrentProblemTypeG problem : YangHelper + .getCollection(problems.nonnullCurrentProblemList())) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); @@ -385,7 +398,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } else if (problems.getCurrentProblemList() == null) { LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid); } else { - for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) { + for (StructureCurrentProblemTypeG problem : YangHelper + .getCollection(problems.nonnullCurrentProblemList())) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); @@ -418,7 +432,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } else if (problems.getCurrentProblemList() == null) { LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid); } else { - for (StructureCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) { + for (StructureCurrentProblemTypeG problem : YangHelper + .getCollection(problems.nonnullCurrentProblemList())) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); @@ -462,7 +477,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid); } else { // -- Specific part 3 - for (ContainerCurrentProblemTypeG problem : YangHelper.getCollection(problems.nonnullCurrentProblemList())) { + for (ContainerCurrentProblemTypeG problem : YangHelper + .getCollection(problems.nonnullCurrentProblemList())) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); @@ -549,7 +565,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId); } else { Collection<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = - YangHelper.getCollection(ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList()); + YangHelper.getCollection( + ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList()); LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size()); for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) { result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord)); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java index 3c6140d82..a7a09fccb 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java @@ -31,7 +31,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNotifications; 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.NetworkElementConnectionBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType; @@ -70,8 +69,6 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { private final @NonNull String mountPointNodeName; private final @NonNull NetconfBindingAccessor acessor; private final @NonNull DeviceManagerOnfConfiguration pollAlarmConfig; - - private final NetconfNotifications notificationAccessor; /*----------------------------------------------------------------------------- * Construction @@ -98,9 +95,6 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { this.performanceManager = serviceProvider.getPerformanceManagerService(); this.eventListenerHandler = serviceProvider.getEventHandlingService(); this.dataProvider = serviceProvider.getDataProvider(); - - this.notificationAccessor = acessor.getNotificationAccessor().get(); - } /*----------------------------------------------------------------------------- @@ -167,7 +161,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { faultService.initCurrentProblemStatus(nodeId, resultList); LOG.debug("DB write current problems completed"); - equipmentService.writeEquipment(equipment.getEquipmentData()); + equipmentService.writeEquipment(nodeId, equipment.getEquipmentData()); LOG.info("Found info at {} for device {} number of problems: {}", getMountpoint(), getUuId(), resultList.size()); @@ -207,7 +201,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { doRegisterEventListener(acessor.getMountpoint()); // Register netconf stream - notificationAccessor.registerNotificationsStream(NetconfAccessor.DefaultNotificationsStream); + acessor.registerNotificationsStream(NetconfAccessor.DefaultNotificationsStream); // Set core-model revision value in "core-model-capability" field setCoreModel(acessor.getNetconfNode()); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java index 6cd6c949a..836f36214 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java @@ -33,7 +33,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EquipmentService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.opendaylight.mdsal.binding.api.MountPoint; import org.opendaylight.mdsal.binding.api.NotificationService; @@ -216,7 +215,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas microwaveEventListener.initCurrentProblemStatus(nodeId, resultList); LOG.debug("DB write current problems completed"); - equipmentService.writeEquipment(equipment.getEquipmentData()); + equipmentService.writeEquipment(nodeId, equipment.getEquipmentData()); LOG.info("Found info at {} for device {} number of problems: {}", getMountpoint(), getUuId(), resultList.size()); diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/TestSerializer.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/TestSerializer.java new file mode 100644 index 000000000..d4c587b6d --- /dev/null +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/TestSerializer.java @@ -0,0 +1,53 @@ +/* + * ============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.onf; + +import static org.junit.Assert.fail; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapper; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotification; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotificationBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.SeverityType; + +public class TestSerializer { + + @Test + public void testProblemNotification() { + ProblemNotification notification = new ProblemNotificationBuilder().setCounter(32) + .setObjectIdRef(new UniversalId("abc")).setProblem("problem").setSeverity(SeverityType.Critical) + .setTimeStamp(DateAndTime.getDefaultInstance("2020-01-01T01:01:02.0Z")).build(); + + + YangToolsMapper mapper = new YangToolsMapper(); + String result=null; + try { + result = mapper.writeValueAsString(notification); + } catch (JsonProcessingException e) { + e.printStackTrace(); + fail(e.getMessage()); + } + System.out.println(result); + } +} diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java index 14bd1bd91..be0191f87 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java @@ -36,7 +36,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.impl.ONFCoreNetworkElem import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNotifications; import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; @@ -71,7 +70,6 @@ public class TestONFCoreNetworkElementFactory { nNodeId = new NodeId("nSky"); NetconfBindingAccessor bindingAccessor = mock(NetconfBindingAccessor.class); when(bindingAccessor.getNodeId()).thenReturn(nNodeId); - when(bindingAccessor.getNotificationAccessor()).thenReturn(Optional.of(mock(NetconfNotifications.class))); when(bindingAccessor.getCapabilites()).thenReturn(capabilities); when(accessor.getNodeId()).thenReturn(nNodeId); diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java index 0749823a2..25fba9281 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java @@ -30,7 +30,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EquipmentService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNotifications; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; @@ -73,7 +72,6 @@ public class TestONFCoreNetworkElement12Basic { when(accessor.getNodeId()).thenReturn(nNodeId); when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME)).thenReturn(true); when(accessor.getTransactionUtils()).thenReturn(transactionUtils); - when(accessor.getNotificationAccessor()).thenReturn(Optional.of(mock(NetconfNotifications.class))); NetconfBindingAccessor bindingAccessor = mock(NetconfBindingAccessor.class); when(bindingAccessor.getNodeId()).thenReturn(nNodeId); when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(bindingAccessor)); diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java index 3e743ca3b..ab907ead7 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java @@ -19,7 +19,6 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne.test; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.util.Optional; import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.OnfMicrowaveModel; @@ -30,7 +29,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EquipmentService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNotifications; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; @@ -73,8 +71,6 @@ public class TestONFCoreNetworkElement12Microwave { when(accessor.getNodeId()).thenReturn(nNodeId); when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME)).thenReturn(true); when(accessor.getTransactionUtils()).thenReturn(transactionUtils); - when(accessor.getNotificationAccessor()).thenReturn(Optional.of(mock(NetconfNotifications.class))); - } @Test |