aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager/provider/src/main/java
diff options
context:
space:
mode:
authorherbert <herbert.eiselt@highstreet-technologies.com>2019-12-14 00:06:42 +0100
committerherbert <herbert.eiselt@highstreet-technologies.com>2019-12-14 00:07:02 +0100
commitda4fd6169717cfa04d644d0af0d23dd089a6e373 (patch)
tree3c7a2c804b001349dc24852f7e488061a2f733f4 /sdnr/wt/devicemanager/provider/src/main/java
parent58f412ad18c1daf622e54ed36db6014f4e04f3f7 (diff)
remove old version
of devicemodel devicemanager oldux featureaggregator Issue-ID: SDNC-1004 Signed-off-by: herbert <herbert.eiselt@highstreet-technologies.com> Change-Id: I5337643181e2398e5a8097e4ee14fa4ac96d0d4c
Diffstat (limited to 'sdnr/wt/devicemanager/provider/src/main/java')
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/elasticsearch/bootstrap/JarHell.java10
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiProviderClient.java168
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiWebApiClient.java157
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/URLParamEncoder.java53
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanProvider.java39
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java155
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/EsBaseRequireNetworkElement.java31
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/EsObject.java41
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDataBase.java49
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDataBaseReaderAndWriter.java257
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseClientAbstract.java502
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseNode.java266
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseUpdateFile.java109
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseWebAPIClient.java102
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtMapper.java111
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/IndexClientBuilder.java141
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/IsEsObject.java37
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/JsonMapperBase.java137
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/http/BaseHTTPClient.java325
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/http/BaseHTTPResponse.java38
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/Environment.java46
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/FileWatchdog.java128
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/IniConfigurationFile.java360
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalDateAndTime.java108
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalSeverity.java151
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InventoryInformation.java130
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/Resources.java336
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/NotificationActor.java24
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/NotificationWorker.java89
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12.java266
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12Base.java457
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12Equipment.java291
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12Microwave.java520
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementBase.java83
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementCallback.java26
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementCoreData.java32
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementEmpty.java130
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementFactory.java139
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementRepresentation.java45
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/AllPm.java59
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/Capabilities.java145
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ExtendedAirInterfaceHistoricalPerformanceType12.java105
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ExtendedAirInterfaceHistoricalPerformanceType1211.java106
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ExtendedAirInterfaceHistoricalPerformanceType1211p.java106
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ONFLayerProtocolName.java61
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ValueNameList.java84
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/GenericTransactionUtils.java137
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/LinkIdentifyingObject.java24
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/NetconfTimeStamp.java192
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/OnfInterfacePac.java39
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/OnfMicrowaveModel.java45
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/OnfMicrowaveModelNotification.java38
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperEquipmentPacRev170402.java104
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperMicrowaveModelRev170324.java597
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperMicrowaveModelRev180907.java600
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperMicrowaveModelRev181010.java599
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperPTPModelRev170208.java85
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayFilter.java162
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayService.java65
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayedListener.java25
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationWithServerTimeStamp.java78
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/BaseSubConfig.java127
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/HtDevicemanagerConfiguration.java158
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/IConfigChangedListener.java22
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/ISubConfigHandler.java22
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AaiClientPropertiesFile.java74
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AaiConfig.java476
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AkkaConfig.java85
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/DcaeConfig.java200
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/DmConfig.java132
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/EsConfig.java265
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/GeoConfig.java163
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/PmConfig.java209
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/ToggleAlarmConfig.java139
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterConfig.java133
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterNodeInfo.java81
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterRoleInfo.java91
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterRoleInfoCollection.java45
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ConfigFileObserver.java67
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeMessages.java342
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderClient.java82
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderTask.java50
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderWorker.java83
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeSender.java31
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeSenderImpl.java236
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/Checker.java48
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitor.java53
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorEmptyImpl.java47
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java229
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorProblems.java69
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorTask.java320
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitoredNe.java47
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java201
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java756
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerService.java39
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ProviderClient.java39
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ResyncNetworkElementsListener.java35
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/service/HtDatabaseEventsService.java247
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsEventBase.java57
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsFaultCurrent.java68
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsFaultLog.java56
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/equipment/EsEquipment.java92
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/equipment/EsToplevelEquipment.java46
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/equipment/ExtendedEquipment.java60
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java170
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfEventListener12.java206
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/ODLEventListener.java223
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/AttributeValueChangedNotificationXml.java68
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/GetEventType.java29
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/MwtNotificationBase.java83
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectCreationNotificationXml.java58
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectDeletionNotificationXml.java61
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ProblemNotificationXml.java139
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClient.java31
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientDummyImpl.java38
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.java38
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java69
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java49
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/database/types/EsEventOdluxLog.java92
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/impl/IndexMwtnService.java115
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/impl/IndexUpdateService.java111
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/MaintenanceRPCServiceAPI.java42
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/MaintenanceService.java33
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/database/types/EsMaintenanceFilter.java227
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/database/types/EsMaintenanceFilterDefinition.java97
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/database/types/EsMaintenanceMode.java181
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java269
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/MicrowaveModelPerformanceDataProvider.java24
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerImpl.java72
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerTask.java238
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/service/MicrowaveHistoricalPerformanceWriterService.java104
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformance15Minutes.java43
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformance24Hours.java36
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformanceBase.java165
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformanceLogEntry.java92
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsPerformanceData.java444
136 files changed, 0 insertions, 19014 deletions
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/elasticsearch/bootstrap/JarHell.java b/sdnr/wt/devicemanager/provider/src/main/java/org/elasticsearch/bootstrap/JarHell.java
deleted file mode 100644
index 4a6913efe..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/elasticsearch/bootstrap/JarHell.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.elasticsearch.bootstrap;
-import java.net.URL;
-public class JarHell {
- private JarHell() {}
- public static void checkJarHell() throws Exception {}
- public static void checkJarHell(URL urls[]) throws Exception {}
- public static void checkVersionFormat(String targetVersion) {}
- public static void checkJavaVersion(String resource, String targetVersion) {}
- public static URL[] parseClassPath() {return new URL[]{};}
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiProviderClient.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiProviderClient.java
deleted file mode 100644
index d5030c1c7..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiProviderClient.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl;
-
-import java.util.List;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.http.BaseHTTPResponse;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InventoryInformation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.AaiConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AaiProviderClient implements AutoCloseable {
-
- private static Logger LOG = LoggerFactory.getLogger(AaiProviderClient.class);
- private static boolean reloadConfigFlag;
- private static final IConfigChangedListener configChangedListener = () -> reloadConfigFlag = true;
-
- private AaiConfig config;
- private final DeviceManagerImpl deviceManager;
- private final HtDevicemanagerConfiguration htconfig;
-
-
- public AaiConfig getConfig() {
- return this.config;
- }
-
-
- public AaiProviderClient(HtDevicemanagerConfiguration cfg, DeviceManagerImpl devMgr) {
- this.config = cfg.getAai();
- this.htconfig = cfg;
- this.htconfig.registerConfigChangedListener(configChangedListener);
- this.deviceManager = devMgr;
-
- }
-
- private void _reload() {
- if (reloadConfigFlag) {
- this.config = AaiConfig.reload();
- LOG.info("config reloaded: {}", config == null ? "null" : config);
- }
- reloadConfigFlag = false;
- }
-
- public void onDeviceRegistered(String mountPointName) {
- this._reload();
- if (this.config.isOff()) {
- return;
- }
- ONFCoreNetworkElementRepresentation ne =
- this.deviceManager != null ? this.deviceManager.getNeByMountpoint(mountPointName) : null;
- this.onDeviceRegistered(mountPointName,
- ne != null ? ne.getInventoryInformation("MWPS") : InventoryInformation.getDefault());
-
- }
-
- public void onDeviceRegistered(String mountPointName, InventoryInformation i) {
- this._reload();
- if (this.config.isOff()) {
- return;
- }
- new Thread(new AaiCreateRequestRunnable(mountPointName, i.getType(), i.getModel(), i.getVendor(),
- i.getDeviceIpv4(), i.getInterfaceUuidList())).start();
- }
-
- public void onDeviceUnregistered(String mountPointName) {
- this._reload();
- if (this.config.isOff()) {
- return;
- }
- if (this.config.doDeleteOnMountPointRemoved()) {
- new Thread(new AaiDeleteRequestRunnable(mountPointName)).start();
- } else {
- LOG.debug("prevent deleting device {} by config", mountPointName);
- }
- }
-
- @Override
- public void close() throws Exception {
- this.htconfig.unregisterConfigChangedListener(configChangedListener);
- }
-
- private class AaiCreateRequestRunnable implements Runnable {
-
- private static final int RESPCODE_NOTFOUND = BaseHTTPResponse.CODE404;
- private static final int RESPCODE_FOUND = BaseHTTPResponse.CODE200;
- private final AaiWebApiClient mClient;
- private final String pnfId;
- private final String type;
- private final String model;
- private final String vendor;
- private final String oamIp;
- private final List<String> ifaces;
- private final int timeout;
-
- public AaiCreateRequestRunnable(String pnfId, String type, String model, String vendor, String oamIp,
- List<String> ifaces) {
- this.pnfId = pnfId;
- this.type = type;
- this.model = model;
- this.vendor = vendor;
- this.oamIp = oamIp;
- this.ifaces = ifaces;
- this.timeout = AaiProviderClient.this.config.getConnectionTimeout();
- this.mClient = new AaiWebApiClient(AaiProviderClient.this.config.getBaseUrl(),
- AaiProviderClient.this.config.getHeaders(), AaiProviderClient.this.config.getTrustAll(),
- AaiProviderClient.this.config.getPcks12CertificateFilename(),
- AaiProviderClient.this.config.getPcks12CertificatePassphrase());
- }
-
- @Override
- public void run() {
- LOG.debug("check if pnfid {} exists", pnfId);
- this.mClient.setTimeout(timeout);
- int responseCode = this.mClient.pnfCheckIfExists(pnfId);
- if (responseCode == RESPCODE_NOTFOUND) {
- LOG.debug("do pnfCreate for {}", pnfId);
- this.mClient.pnfCreate(pnfId, type, model, vendor, oamIp, ifaces);
- } else if (responseCode == RESPCODE_FOUND) {
- LOG.debug("pnfid {} found, nothing to do", pnfId);
- } else {
- LOG.warn("unhandled response code: {}", responseCode);
- }
- }
- };
-
- private class AaiDeleteRequestRunnable implements Runnable {
-
- private final AaiWebApiClient mClient;
- private final String pnfId;
- private final int timeout;
-
-
- public AaiDeleteRequestRunnable(String pnfId) {
- this.pnfId = pnfId;
- this.timeout = AaiProviderClient.this.config.getConnectionTimeout();
- this.mClient = new AaiWebApiClient(AaiProviderClient.this.config.getBaseUrl(),
- AaiProviderClient.this.config.getHeaders(), AaiProviderClient.this.config.getTrustAll(),
- AaiProviderClient.this.config.getPcks12CertificateFilename(),
- AaiProviderClient.this.config.getPcks12CertificatePassphrase());
- }
-
- @Override
- public void run() {
- this.mClient.setTimeout(this.timeout);
- this.mClient.pnfDelete(pnfId);
- }
- };
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiWebApiClient.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiWebApiClient.java
deleted file mode 100644
index 6ce4cff67..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiWebApiClient.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.http.BaseHTTPClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.http.BaseHTTPResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AaiWebApiClient extends BaseHTTPClient {
-
- private static Logger LOG = LoggerFactory.getLogger(AaiWebApiClient.class);
- private static final String PNF_JSON_INTERFACE_TEMPLATE = " {\n"
- + " \"interface-name\": \"@interface@\",\n" + " \"speed-value\": \"300\",\n"
- + " \"speed-units\": \"MBit/s\",\n"
- + " \"port-description\": \"Air Interface (MWPS)\",\n"
- + " \"equipment-identifier\": \"@pnfId@-@interface@\",\n"
- + " \"interface-role\": \"Wireless\",\n"
- + " \"interface-type\": \"Air Interface (MWPS)\",\n"
- + " \"resource-version\": \"@model@\",\n" + " \"relationship-list\": [\n"
- + " {\n"
- + " \"related-to\": \"A keyword provided by A&AI to indicate type of node.\",\n"
- + " \"related-link\": \"URL to the object in A&AI.\",\n"
- + " \"relationship-data\": [\n" + " {\n"
- + " \"relationship-key\": \"A keyword provided by A&AI to indicate an attribute.\",\n"
- + " \"relationship-value\": \"Value of the attribute\"\n"
- + " }\n" + " ],\n"
- + " \"related-to-property\": [\n" + " {\n"
- + " \"property-key\": \"Key part of a key/value pair\",\n"
- + " \"property-value\": \"Value part of a key/value pair\"\n"
- + " }\n" + " ]\n" + " }\n" + " ]\n"
- + " }\n";
- private static final String PNF_JSON_TEMPLATE = "{\n" + " \"pnf-name\": \"@pnfId@\",\n"
- + " \"pnf-id\": \"@pnfId@\",\n" + " \"equip-type\": \"@type@\",\n"
- + " \"equip-model\": \"@model@\",\n" + " \"equip-vendor\": \"@vendor@\",\n"
- + " \"ipaddress-v4-oam\": \"@oamIp@\",\n" + " \"in-maint\": false,\n"
- + " \"prov-status\":\"PROV\",\n" + " \"p-interfaces\": @interface-list@\n" + "}\n" + "";
- private static final String PNF_URI = "network/pnfs/pnf/";
- private static final String EMPTY_MESSAGE = "";
-
- private final Map<String, String> headerMap;
-
-
- public AaiWebApiClient(String baseUrl, Map<String, String> headers, boolean trustAllCerts) {
- this(baseUrl, headers, trustAllCerts, null, null);
- }
-
- public AaiWebApiClient(String baseUrl, Map<String, String> headers, boolean trustAllCerts, String certFilename,
- String passphrase) {
- super(baseUrl, trustAllCerts, certFilename, passphrase, BaseHTTPClient.getSslCertPcks());
-
- this.headerMap = new HashMap<>();
- this.headerMap.putAll(headers);
- this.headerMap.put("Content-Type", "application/json");
- this.headerMap.put("Accept", "application/json");
- }
-
- /**
- * Create and specify defition parametrs of pnf
- * @param pnfId name
- * @param type type
- * @param model model
- * @param vendor vendor
- * @param oamIp ip
- * @param ifaces interfaces
- * @return true if http response code was 200 or false if not.
- */
- public boolean pnfCreate(String pnfId, String type, String model, String vendor, String oamIp,
- List<String> ifaces) {
- LOG.debug("registering {} (type={}, model={}, vendor={},ip={})", pnfId, type, model, vendor, oamIp);
- String message = getPnfTemplateFilled(pnfId, type, model, vendor, oamIp, ifaces);
- return pnfRequest(pnfId, "PUT", message) == 200;
- }
-
- /**
- * Unregister
- * @param pnfId name
- * @return true if http response code was 200 or false if not.
- */
- public boolean pnfDelete(String pnfId) {
- LOG.debug("unregistering {}", pnfId);
- return pnfRequest(pnfId, "DELETE", EMPTY_MESSAGE) == 200;
- }
-
- /**
- * Send registration request
- * @param pnfId name
- * @return error accoring to http response code or -1
- */
- public int pnfCheckIfExists(String pnfId) {
- LOG.debug("check for {}", pnfId);
- return pnfRequest(pnfId, "GET", EMPTY_MESSAGE);
- }
-
- /*
- * Private classes
- */
-
- private int pnfRequest(String pnfId, String method, String message) {
- BaseHTTPResponse response;
- try {
- String uri = PNF_URI + URLParamEncoder.encode(pnfId);
- response = this.sendRequest(uri, method, message, headerMap);
- LOG.debug("finished with responsecode {}", response.code);
- return response.code;
- } catch (IOException e) {
- LOG.warn("problem registering {} : {}", pnfId, e.getMessage());
- return -1;
- }
- }
-
-
- private static String getPnfTemplateFilled(String pnfId, String type, String model, String vendor, String oamIp,
- List<String> ifaces) {
- return PNF_JSON_TEMPLATE.replace("@pnfId@", pnfId).replace("@type@", type).replace("@model@", model)
- .replace("@vendor@", vendor).replace("@oamIp@", oamIp)
- .replace("@interface-list@", getPnfTemplateInterfaceList(pnfId, ifaces, model));
- }
-
- private static String getPnfTemplateInterfaceList(String pnfId, List<String> ifaces, String model) {
- StringBuffer s = new StringBuffer();
- s.append("[");
- if (ifaces != null) {
- for (int i = 0; i < ifaces.size(); i++) {
- if (i > 0) {
- s.append(",");
- }
- s.append(PNF_JSON_INTERFACE_TEMPLATE.replace("@interface@", ifaces.get(i)));
- }
- }
- s.append("]");
-
- return s.toString().replace("@pnfId@", pnfId).replace("@model@", model);
- }
-
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/URLParamEncoder.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/URLParamEncoder.java
deleted file mode 100644
index 4decc24d7..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/URLParamEncoder.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl;
-
-class URLParamEncoder {
-
- private URLParamEncoder() {
- }
-
- private static final String UNSAFE_CHARSET = " %$&+,/:;=?@<>#%";
-
- public static String encode(String input) {
- StringBuilder resultStr = new StringBuilder();
- for (char ch : input.toCharArray()) {
- if (isUnsafe(ch)) {
- resultStr.append(escape(ch));
- } else {
- resultStr.append(ch);
- }
- }
- return resultStr.toString();
- }
-
- private static boolean isUnsafe(char ch) {
- if (ch > 128) {
- return true;
- }
- return UNSAFE_CHARSET.indexOf(ch) >= 0;
- }
-
- private static String escape(char ch){
- return String.format("%c%c%c", '%', toHex(ch / 16), toHex(ch % 16));
- }
-
- private static char toHex(int ch) {
- return (char) (ch < 10 ? '0' + ch : 'A' + ch - 10);
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanProvider.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanProvider.java
deleted file mode 100644
index 44fae6d61..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice;
-
-import java.util.Date;
-
-public interface ArchiveCleanProvider {
-
- /**
- * Remove all index data older, than specified
- * @param olderAreOutdated time to specify older elements
- * @return number of removed elements
- */
- int doIndexClean(Date olderAreOutdated);
-
- /**
- * Get number of elements older then
- * @param olderAreOutdated date to compare with and specify older elements
- * @return number of elements
- */
- public int getNumberOfOldObjects(Date olderAreOutdated);
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java
deleted file mode 100644
index eb48b87c4..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice;
-
-import java.util.Date;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.EsConfig;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-
-public class ArchiveCleanService implements AutoCloseable, IConfigChangedListener, Runnable,ClusterSingletonService {
-
- private static final Logger LOG = LoggerFactory.getLogger(ArchiveCleanService.class);
- private static final ServiceGroupIdentifier IDENT = ServiceGroupIdentifier.create("ElasticSearchArchiveCleanService");
-
- private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
- private final ArchiveCleanProvider[] indexCleanList;
- private final HtDevicemanagerConfiguration htconfig;
- private final Runnable doClean;
-
- private EsConfig config;
- private Future<?> taskReference;
- private boolean isMaster;
-
- public ArchiveCleanService(HtDevicemanagerConfiguration config, ArchiveCleanProvider... indexCleanList) {
- this.config = config.getEs();
- this.htconfig = config;
- this.htconfig.registerConfigChangedListener(this);
- this.indexCleanList = indexCleanList;
- this.doClean = this;
- this.taskReference = null;
-
- this.reinit();
- }
-
- private void reinit() {
-
- if (taskReference != null) {
- taskReference.cancel(false);
- }
- if(this.isMaster) {
- if (this.config.getArchiveCheckIntervalSeconds() > 0) {
- LOG.info("DBCleanService is turned on for entries older than {} seconds",
- this.config.getArchiveLifetimeSeconds());
- taskReference = this.scheduler.scheduleAtFixedRate(doClean, 0,
- this.config.getArchiveCheckIntervalSeconds(), TimeUnit.SECONDS);
- } else {
- LOG.info("DBCleanService is turned off");
- }
- }
- else {
- LOG.info("service is inactive on this node. active on another node.");
- }
- }
-
- public Date getDateForOldElements() {
- return new Date(System.currentTimeMillis() - config.getArchiveLifetimeSeconds() * 1000);
- }
-
- public int countOldEntries() {
- int cnt = 0;
- Date olderAreOutdated = getDateForOldElements();
- for (ArchiveCleanProvider indexCleanElement : indexCleanList) {
- if (indexCleanElement != null) {
- indexCleanElement.getNumberOfOldObjects(olderAreOutdated);
- }
- }
- return cnt;
- }
-
- @Override
- public void run() {
-
- try {
- int removed = 0;
- Date olderElementToBeRemoved = getDateForOldElements();
- LOG.trace("cleaning logs from entries older than {}", olderElementToBeRemoved);
-
- for (ArchiveCleanProvider indexCleanElement : indexCleanList) {
- if (indexCleanElement != null) {
- removed += indexCleanElement.doIndexClean(olderElementToBeRemoved);
- }
- }
- if (removed > 0) {
- LOG.trace("Removed elements: {}",removed);
- }
- } catch (Exception e) {
- LOG.warn("problem executing dbclean", e);
- }
- }
-
- @Override
- public void onConfigChanged() {
- LOG.debug("config changed. reninit timer");
- ArchiveCleanService.this.config = EsConfig.reload();
- ArchiveCleanService.this.reinit();
- };
-
- @Override
- public void close() throws Exception {
- this.htconfig.unregisterConfigChangedListener(this);
- this.scheduler.shutdown();
- }
-
- @Override
- public String toString() {
- return "ArchivCleanService [ArchiveCheckIntervalSeconds=" + config.getArchiveCheckIntervalSeconds()
- + "ArchiveLifetimeSeconds=" + config.getArchiveLifetimeSeconds() + "]";
- }
-
- @Override
- public ServiceGroupIdentifier getIdentifier() {
- return IDENT;
- }
-
- @Override
- public void instantiateServiceInstance() {
- LOG.info("We take Leadership");
- this.isMaster=true;
- this.reinit();
- }
-
- @Override
- public ListenableFuture<? extends Object> closeServiceInstance() {
- LOG.info("We lost Leadership");
- this.isMaster=false;
- this.reinit();
- return Futures.immediateFuture(null);
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/EsBaseRequireNetworkElement.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/EsBaseRequireNetworkElement.java
deleted file mode 100644
index 7c78a4aed..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/EsBaseRequireNetworkElement.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database;
-
-public class EsBaseRequireNetworkElement extends EsObject {
- public static final String ESDATATYPENAME = "required-networkelement";
-
- public EsBaseRequireNetworkElement() {
-
- }
-
- public EsBaseRequireNetworkElement(String mountpountName) {
- super();
- this.setEsId(mountpountName);
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/EsObject.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/EsObject.java
deleted file mode 100644
index 4b188d1de..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/EsObject.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * @author Herbert
- *
- */
-public class EsObject implements IsEsObject {
-
- @JsonIgnore
- private String esId;
-
- @Override
- public String getEsId() {
- return esId;
- }
-
- @Override
- public void setEsId(String esId) {
- this.esId = esId;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDataBase.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDataBase.java
deleted file mode 100644
index 856163104..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDataBase.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database;
-
-import org.elasticsearch.client.Client;
-import org.elasticsearch.common.bytes.BytesReference;
-import org.elasticsearch.index.query.QueryBuilder;
-import org.elasticsearch.search.SearchHit;
-
-
-/**
- * Interface, used by access one object
- * @author Herbert
- *
- */
-public interface HtDataBase {
-
- String getNetworkIndex();
- void setNetworkIndex(String networkIndex);
-
- Client getClient();
- void closeDb();
-
- public BytesReference doReadJsonData( String dataTypeName, IsEsObject esId );
- public BytesReference doReadJsonData(String dataTypeName, String esId);
- public SearchHit[] doReadAllJsonData( int start, int length, String dataTypeName );
- public SearchHit[] doReadByQueryJsonData( int start, int length, String dataTypeName, QueryBuilder query);
-
- public String doWriteByteArray( String dataTypeName, IsEsObject esId, byte[] json);
- public String doWriteJsonString( String dataTypeName, IsEsObject esId, String json);
-
- public boolean doRemove( String dataTypeName, IsEsObject esId );
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDataBaseReaderAndWriter.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDataBaseReaderAndWriter.java
deleted file mode 100644
index a742a94b0..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDataBaseReaderAndWriter.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import org.elasticsearch.index.query.QueryBuilder;
-import org.elasticsearch.search.SearchHit;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Generic class to write lists of model classes to the database.
- *
- */
-public class HtDataBaseReaderAndWriter<T extends IsEsObject> {
-
- private static final Logger log = LoggerFactory.getLogger(HtDataBaseReaderAndWriter.class);
-
-
- private final HtDataBase db;
- private final String dataTypeName;
- private final HtMapper<T> mapper;
-
- /**
- * Class specific access to database
- * @param db ES database descriptor
- * @param dataTypeName datatype name
- * @param clazz class of datatype
- */
- public HtDataBaseReaderAndWriter(HtDataBase db, String dataTypeName, Class<? extends T> clazz) {
-
- this.db = db;
- this.dataTypeName = dataTypeName;
- this.mapper = new HtMapper<>( clazz );
-
- }
- /**
- * @return dataTypeName
- */
- public String getDataTypeName() {
- return this.dataTypeName;
- }
- /**
- * Remove Object from database
- * @param object Object with content
- * @return true if remove is done
- */
- public boolean doRemove( T object) {
-
- return db.doRemove(dataTypeName, object );
-
- }
-
- /**
- * Remove all data that match the filter
- * @param query to specify data to be deleted
- * @return number of removed objects
- */
- public int doRemoveByQuery(QueryBuilder query) {
-
- int idx = 0; //Idx for getAll
- int iterateLength = 100; //Step width for iterate
-
- SearchHit hits[];
- do {
- hits = db.doReadByQueryJsonData(idx, iterateLength, dataTypeName, query);
- log.debug("Found: {} elements: {} Failures: {}",dataTypeName,hits.length, mapper.getMappingFailures());
-
- T object;
- idx += hits.length;
- for (SearchHit hit : hits) {
-
- object = mapper.getObjectFromJson( hit.getSourceRef() );
-
- log.debug("Mapp Object: {}\nSource: '{}'\nResult: '{}'\n Failures: {}", hit.getId(), hit.getSourceAsString(), object, mapper.getMappingFailures());
- if (object != null) {
- object.setEsId( hit.getId() );
- doRemove(object);
- } else {
- log.warn("Mapp result null Object: {}\n Source: '{}'\n : '", hit.getId(), hit.getSourceAsString());
- }
- }
- } while (hits.length == iterateLength); //Do it until end indicated, because less hits than iterateLength allows.
-
- return idx;
- }
-
- /**
- * Do the mapping for test purpose
- * @param object object for test purpose
- * @return json String
- */
- public String getJson( T object ) {
- String json = mapper.objectToJson(object);
- return json;
- }
-
- /**
- * Write one object into Database
- * @param object Object with content
- * @return This object for chained call pattern.
- */
- public T doWrite( T object) {
-
- String json = mapper.objectToJson(object);
- return doWrite(object, json);
-
- }
-
- /**
- * Write one object into Database
- * @param object Object with content
- * @param json string
- * @return This object for chained call pattern.
- */
- public T doWrite( T object, String json) {
-
- log.debug("doWrite {} {}",object.getClass().getSimpleName(), object.getEsId());
-
- if (json != null) {
- String esId = db.doWriteJsonString(dataTypeName, object, json);
- object.setEsId(esId);
- log.debug("doWrite done for {} {}",object.getClass().getSimpleName(), object.getEsId());
- return esId == null ? null : object;
- } else {
- log.warn("Can not map object and write to database. {} {}",object.getClass().getSimpleName(), object);
- return null;
- }
-
- }
-
-
- /**
- * Write a list of Objects to the database.
- * @param list Object list with content
- * @return This object for chained call pattern.
- */
- public HtDataBaseReaderAndWriter<T> doWrite( Collection<T> list) {
-
- int writeError = 0;
- String indexName = db.getNetworkIndex();
-
- log.debug("Write to ES database {}, {} Class: {} {} elements",indexName,dataTypeName, mapper.getClazz().getSimpleName(), list.size());
-
- if (indexName == null) {
- throw new IllegalArgumentException("Missing Index");
- }
-
- if (list != null && !list.isEmpty()) {
- for( T s : list ) {
- if ( doWrite(s) == null ) {
- if ( ++writeError > 5 ) {
- log.warn("Leave because of to >5 write errors");
- break;
- }
- }
- }
-
- }
-
- return this;
- }
-
- /**
- * Read one object via the object class specific ID
- * @param object Object refrenced by idString
- * @return The Object if found or null
- */
- public @Nullable T doRead( IsEsObject object ) {
- T res = mapper.getObjectFromJson( db.doReadJsonData( dataTypeName, object) );
- if (res != null) {
- res.setEsId(object.getEsId());
- }
- return res;
- }
-
- /**
- * Read one object via the object class specific ID
- * @param objectEsId Object refrence
- * @return The Object if found or null
- */
- public @Nullable T doRead( String objectEsId ) {
- T res = mapper.getObjectFromJson( db.doReadJsonData( dataTypeName, objectEsId ) );
- if (res != null) {
- res.setEsId(objectEsId);
- }
- return res;
- }
- /**
- * Get all elements of related type
- * @return all Elements
- */
- public List<T> doReadAll() {
- return doReadAll(null);
- }
- /**
- * Read all existing objects of a type
- * @param query for the elements
- * @return the list of all objects
- */
- public List<T> doReadAll(QueryBuilder query) {
-
- List<T> res = new ArrayList<>();
- int idx = 0; //Idx for getAll
- int iterateLength = 100; //Step width for iterate
-
- SearchHit hits[];
- do {
- if(query!=null) {
- log.trace("read data in {} {} with query {}",db.getNetworkIndex(),dataTypeName,query);
- hits=db.doReadByQueryJsonData(0, 99999, dataTypeName, query);
- }
- else {
- hits = db.doReadAllJsonData(idx, iterateLength, dataTypeName);
- }
- log.debug("Read: {} elements: {} Failures: {}",dataTypeName,hits.length, mapper.getMappingFailures());
-
- T object;
- idx += hits.length;
- for (SearchHit hit : hits) {
-
- object = mapper.getObjectFromJson( hit.getSourceRef() );
-
- log.debug("Mapp Object: {}\nSource: '{}'\nResult: '{}'\n Failures: {}", hit.getId(), hit.getSourceAsString(), object, mapper.getMappingFailures());
- if (object != null) {
- object.setEsId( hit.getId() );
- res.add( object );
- } else {
- log.warn("Mapp result null Object: {}\n Source: '{}'\n : '", hit.getId(), hit.getSourceAsString());
- }
- }
- } while (hits.length == iterateLength); //Do it until end indicated, because less hits than iterateLength allows.
-
- return res;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseClientAbstract.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseClientAbstract.java
deleted file mode 100644
index 5a6554398..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseClientAbstract.java
+++ /dev/null
@@ -1,502 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.elasticsearch.ElasticsearchException;
-import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
-import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
-import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
-import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
-import org.elasticsearch.action.delete.DeleteResponse;
-import org.elasticsearch.action.get.GetResponse;
-import org.elasticsearch.action.index.IndexRequestBuilder;
-import org.elasticsearch.action.index.IndexResponse;
-import org.elasticsearch.action.search.SearchResponse;
-import org.elasticsearch.client.Client;
-import org.elasticsearch.common.bytes.BytesReference;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.index.query.QueryBuilder;
-import org.elasticsearch.index.query.QueryBuilders;
-import org.elasticsearch.search.SearchHit;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author Herbert
- *
- */
-public class HtDatabaseClientAbstract implements HtDataBase, AutoCloseable {
-
- private final Logger log = LoggerFactory.getLogger(HtDatabaseClientAbstract.class);
-
- private final Client client;
- private String esIndexAlias;
-
- /**
- * Simple database initialization. Query all ES configuration information from cluster node.
- *
- * @param esIndex Database index
- * @param database database node descriptor
- */
- public HtDatabaseClientAbstract(String esIndex, @Nonnull HtDatabaseNode database) {
-
- this.esIndexAlias = esIndex;
- this.client = database.getClient();
- }
-
-
- /*----------------------------------
- * some constructing functions, used by public constructors
- */
-
-
- /*----------------------------------
- * Getter / Setter
- */
-
- @Override
- public String getNetworkIndex() {
- return esIndexAlias;
- }
-
- @Override
- public void setNetworkIndex(String es_index) {
- this.esIndexAlias = es_index;
- }
-
- @Override
- public Client getClient() {
- return client;
- }
-
- /*----------------------------------
- * Functions
- */
-
- /**
- * Close function
- */
- @Override
- public void close() {
- client.close();
- }
-
- /**
- * Verify if index already created
- *
- * @return boolean accordingly
- */
- public boolean isExistsIndex() {
-
- if (esIndexAlias == null) {
- throw new IllegalArgumentException("Missing Index");
- }
-
- log.debug("Check status of ES index: {}", esIndexAlias);
-
- final IndicesExistsResponse indexStatus =
- client.admin().indices().prepareExists(esIndexAlias).execute().actionGet();
-
- return indexStatus.isExists();
-
- }
-
-
- /**
- * Create and write the mapping and setting of the index
- *
- * @param jsonIndexMappingSetting with mapping and setting definition Object or null for no
- * configuration
- */
- public void doCreateIndexWithMapping(JSONObject jsonIndexMappingSetting) {
-
- if (esIndexAlias == null) {
- throw new IllegalArgumentException("Missing Index");
- }
-
- try {
- // Create index with mapping and setting
- String esIndexName = esIndexAlias + "_v1";
- log.debug("Create not existing ES index: {} with alias:{}", esIndexName, esIndexAlias);
-
- doCreateIndexWithMappingsAndSettings(esIndexName, jsonIndexMappingSetting);
-
- // Set Alias
- log.debug("Set alias {} to index {}", esIndexAlias, esIndexName);
- IndicesAliasesResponse setAliasResponse =
- client.admin().indices().prepareAliases().addAlias(esIndexName, esIndexAlias).execute().actionGet();
- log.debug("CreateIndex response {}", setAliasResponse);
-
- } catch (ElasticsearchException e) {
- log.warn("ElasticsearchException: {}", e.getDetailedMessage());
- }
- }
-
-
- /**
- * Assign each mapping in the mappings section as separate mapping entry
- *
- * @param createIndexRequestBuilder builder for command to ES
- * @param jsonIndexMappingSetting json with mapping information
- */
- private void doCreateIndexWithMappingsAndSettings(String esIndexName, JSONObject jsonIndexMappingSetting) {
-
- CreateIndexRequestBuilder createIndexRequestBuilder = client.admin().indices().prepareCreate(esIndexName);
- if (createIndexRequestBuilder == null) {
- throw new HtDatabaseClientException("No client. Can not create index.", esIndexAlias);
- }
-
- if (jsonIndexMappingSetting != null) {
- try {
- doAddMappings(createIndexRequestBuilder, jsonIndexMappingSetting);
- doAddSetting(createIndexRequestBuilder, jsonIndexMappingSetting);
- log.debug(" doCreateIndexWithMapping");
- } catch (RuntimeException e) {
- log.info("Exception during adding mappings or settings to CreateIndexRequestBuilder. ", e);
- }
- }
-
- CreateIndexResponse createResponse = createIndexRequestBuilder.execute().actionGet();
- log.debug("CreateIndex response {}", createResponse);
- }
-
- /**
- * Add one or more mappings to command
- *
- * @param createIndexRequestBuilder to add parameters
- * @param jsonIndexMappingSetting contains mapping and setting information
- */
- private void doAddMappings(CreateIndexRequestBuilder createIndexRequestBuilder,
- JSONObject jsonIndexMappingSetting) {
-
- // If there are json information .. verify if they contain mappings
- JSONObject jsonMapping = jsonIndexMappingSetting.optJSONObject("mappings");
-
- // Handle optional mappings if requested
- if (jsonMapping != null) {
- log.debug("Set mapping for index {} {}", esIndexAlias, jsonMapping);
-
- // For any reason the function below was not working without iterator
- Set<String> keys = getStringKeySet(jsonMapping);
- if (log.isDebugEnabled()) {
- log.debug("Found length: {} keys: {}", jsonMapping.length(), keys.size());
- }
-
- for (String docType : keys) {
- JSONObject jsonObject = jsonMapping.getJSONObject(docType);
- if (jsonObject != null) {
- String jsonObjectString = jsonObject.toString();
- log.debug("Doctype:{} mapping:{}", docType, jsonObjectString);
- createIndexRequestBuilder.addMapping(docType, jsonObjectString);
- log.debug("Mapping created Doctype:{}", docType);
- } else {
- log.debug("No jsonObject for docType {}", docType);
- }
- }
- } else {
- log.debug("No mapping requested for index {}", esIndexAlias);
- }
- }
-
- /**
- * Add one setting to command
- *
- * @param createIndexRequestBuilder to add parameters
- * @param jsonIndexMappingSetting contains mapping and setting information
- */
- private void doAddSetting(CreateIndexRequestBuilder createIndexRequestBuilder, JSONObject jsonIndexMappingSetting) {
- // Handle optional settings if requested
- log.debug("Handle settings");
- JSONObject jsonSettings = jsonIndexMappingSetting.optJSONObject("settings");
- if (jsonSettings != null) {
- log.debug("Set setting for index {} {}", esIndexAlias, jsonSettings);
- createIndexRequestBuilder.setSettings(Settings.settingsBuilder().loadFromSource(jsonSettings.toString()));
- } else {
- log.debug("No settings requested for index {}", esIndexAlias);
- }
- }
-
- /**
- * Create Index with alias according to definition, but no mapping
- */
- public void doCreateIndex() {
- doCreateIndexWithMapping(null);
- }
-
- /**
- * Write one object into Database
- *
- * @param esId Database index
- * @param dataTypeName Name of datatype
- * @param json String in JSON format.
- * @return esId of the object
- */
- @Override
- public String doWriteJsonString(String dataTypeName, IsEsObject esId, String json) {
- return doWriteByteArray(dataTypeName, esId, json.getBytes());
- }
-
- /**
- * Write one object into Database
- *
- * @param esId Database index
- * @param dataTypeName Name of datatype
- * @param json String in JSON format.
- * @return esId of the object
- */
-
- @Override
- public String doWriteByteArray(String dataTypeName, IsEsObject esId, byte[] json) {
- return doWriteRaw(dataTypeName, esId.getEsId(), json);
- }
-
- /**
- * Write one object into Database
- *
- * @param dataTypeName Name of datatype
- * @param id id of the object or null
- * @param json Object as json
- * @return esId of the Object
- */
- public String doWriteJsonObject(String dataTypeName, String id, JSONObject json) {
- return doWriteRaw(dataTypeName, id, json.toString().getBytes());
- }
-
- /**
- * Write one object into Database
- *
- * @param esId Database index or null
- * @param dataTypeName Name of datatype
- * @param json String in JSON format.
- * @return esId of the object
- */
-
- public String doWriteRaw(String dataTypeName, String esId, byte[] json) {
-
- if (esIndexAlias == null) {
- throw new IllegalArgumentException("Missing Index");
- }
-
- IndexRequestBuilder request = esId == null || esId.isEmpty() ? client.prepareIndex(esIndexAlias, dataTypeName)
- : client.prepareIndex(esIndexAlias, dataTypeName, esId);
-
- IndexResponse response = null;
- try {
- response = request.setSource(json).execute().actionGet();
- } catch (ElasticsearchException e) {
- log.warn("ES Exception {} Json: {}", e.getMessage(), new String(json));
- }
-
- if (response == null) {
- String jsonString = new String(json);
- log.warn("Response null during write: {} {}", esId, jsonString);
- return null;
- } else {
- return response.getId();
- }
- }
-
- /**
- * Write JSON Data. First level contains datatype, next level id Example "datatype" : { "id" : { } }
- * @param json Object
- */
- public void doWriteJSONObject(JSONObject json) {
-
- Set<String> docTypes = getStringKeySet(json);
- log.debug("Found number of keys: {} keys: {}", json.length(), docTypes.size());
- for (String docType : docTypes) {
- JSONObject objects = json.optJSONObject(docType);
- if (objects == null) {
- log.debug("Skip json {} with class {}", docType, json.get(docType).getClass());
- } else {
- doWriteJsonObjectsWithIds(docType, objects);
- }
- }
- }
-
- /**
- * Write object and Id of object for a doctype
- * @param docType of the objects
- * @param objects a bunch of objects with ids as object name
- */
- private void doWriteJsonObjectsWithIds(String docType, JSONObject objects) {
- Set<String> ids = getStringKeySet(objects);
- log.debug("write doctype {} with elements {}", docType, ids.size());
- for (String id : ids) {
- JSONObject jsonIdObject = objects.optJSONObject(id);
- if (jsonIdObject == null) {
- log.debug("Skip jsonsub {} with class {}", id, objects.get(id).getClass());
- } else {
- if (log.isTraceEnabled()) {
- log.trace("Jsonsub object of id {} '{}'", id, jsonIdObject);
- }
- this.doWriteRaw(docType, id, jsonIdObject.toString().getBytes());
- }
- }
- }
-
- /**
- * Remove Object from database
- */
- @Override
- public boolean doRemove(String dataTypeName, IsEsObject esId) {
-
- if (esIndexAlias == null) {
- throw new IllegalArgumentException("Missing Index");
- }
-
- DeleteResponse response =
- client.prepareDelete(esIndexAlias, dataTypeName, esId.getEsId()).execute().actionGet();
-
- return response.isFound();
- }
-
- /**
- * Read Json Object from database
- */
- @Override
- public @Nullable BytesReference doReadJsonData(String dataTypeName, IsEsObject esId) {
-
- if (esId.getEsId() == null) {
- throw new IllegalArgumentException("Read access to object without database Id");
- }
-
- return doReadJsonData(dataTypeName, esId.getEsId());
- }
-
- /**
- * Read Json Object from database
- */
- @Override
- public @Nullable BytesReference doReadJsonData(String dataTypeName, String esId) {
-
- log.debug("NetworkIndex read: {}", esIndexAlias);
-
- GetResponse response = client.prepareGet(esIndexAlias, dataTypeName, esId)
- // .setOperationThreaded(false)
- .execute().actionGet();
-
- return response.isExists() ? response.getSourceAsBytesRef() : null;
- }
-
-
- @Override
- public SearchHit[] doReadByQueryJsonData(int start, int length, String dataTypeName, QueryBuilder qb) {
-
- log.debug("NetworkIndex query and read: {}", esIndexAlias);
-
- SearchResponse response1 = client.prepareSearch(esIndexAlias).setTypes(dataTypeName).setQuery(qb).setFrom(start)
- .setSize(length).execute().actionGet();
-
- return response1.getHits().hits();
- }
-
-
- @Override
- public SearchHit[] doReadAllJsonData(int start, int length, String dataTypeName) {
- // Use query
- QueryBuilder qb = QueryBuilders.matchAllQuery();
- return doReadByQueryJsonData(start, length, dataTypeName, qb);
- }
-
- /**
- * Write Json datetype that is specified by file to ES
- *
- * @param dataType ES Datatype name
- * @param fileName file name
- */
- public void writeJsonObjectsFromFile(String dataType, String fileName) {
-
- log.debug("Start: Index: '{}' ' datatype: '{}' File: '{}'", esIndexAlias, dataType, fileName);
-
- String content = null;
-
- try {
- content = new String(Files.readAllBytes(Paths.get(fileName)), StandardCharsets.UTF_8);
- } catch (IOException e1) {
- log.warn("Can not read file: {}", e1.getMessage());
- }
-
- if (content != null && content.charAt(0) == 0xfeff) {
- content = content.substring(1);
- log.debug("Delete first char {} {}", dataType, fileName);
- }
-
- if (content != null) {
- IndexResponse response = null;
- try {
- response = client.prepareIndex(esIndexAlias, dataType).setSource(content).execute().actionGet();
- } catch (ElasticsearchException e) {
- log.error("ElasticsearchException during write: for {} from {} from {}", e.getMessage(), dataType, fileName);
- } catch (Exception e) {
- log.error("Exception during write: for {} from {} from {}", e.getMessage(), dataType, fileName);
- }
-
- if (response != null) {
- if (!response.isCreated()) {
- String responseAsString = response.toString();
- log.warn("Jackson Response not created: {} {} {}", dataType, fileName, responseAsString);
- } else {
- log.debug("Created: {}", response.getId());
- }
- } else {
- log.warn("Jackson Response null after write {} {}", dataType, fileName);
- }
- }
-
- }
-
- @Override
- public void closeDb() {
- if (client != null) {
- client.close();
- }
- }
-
-
- // For any reason the function json.keySet() was not working in Oxygen => replaced by iterator
- public static @Nonnull Set<String> getStringKeySet(JSONObject json) {
- Set<String> keys = new HashSet<>();
- Iterator<?> iterator = json.keys();
- while (iterator.hasNext()) {
- keys.add((String) iterator.next());
- }
- return keys;
- }
-
-
- private static class HtDatabaseClientException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public HtDatabaseClientException(String string, String esIndexAlias) {
- super(string + " Effected index: " + "esIndexAlias");
- }
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseNode.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseNode.java
deleted file mode 100644
index 93a5bbd40..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseNode.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database;
-
-import static org.elasticsearch.node.NodeBuilder.nodeBuilder;
-import java.io.File;
-import java.io.IOException;
-import java.net.DatagramSocket;
-import java.net.ServerSocket;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.List;
-import org.apache.lucene.util.Version;
-import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
-import org.elasticsearch.client.Client;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.unit.TimeValue;
-import org.elasticsearch.node.Node;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.AkkaConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.EsConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.GeoConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.util.ClusterNodeInfo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class HtDatabaseNode implements AutoCloseable {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(HtDatabaseNode.class);
- private static final String DBCONFIGFILENAME = "etc/elasticsearch.yml";
- private static final String RESFOLDER_PLUGIN = "elasticsearch/plugins";
- private static final String RESFOLDER_PLUGINHEAD = RESFOLDER_PLUGIN + "/head";
- private static final String RESFOLDER_PLUGINDELETE = RESFOLDER_PLUGIN + "/delete-by-query";
- private static int MIN_PORT_NUMBER = 1024;
- private static int MAX_PORT_NUMBER = 65535;
- private static int ES_PORT = 9200;
- private static int DELAYSECONDS = 120;
- private static String PLUGINFOLDER = "etc/elasticsearch-plugins";
-
- private static HtDatabaseNode oneNode = null;
- private static Object initializationLock = new Object();
- private static Integer initializedTarget = 0;
- private static Integer initializedReached = 0;
-
- private final Node node;
-
- private HtDatabaseNode() {
- LOGGER.debug("Start elasticsearch service");
-
- LOGGER.debug("Lucine version: " + Version.LATEST);
-
- node = nodeBuilder().settings(Settings.builder().put("path.home", "etc").put("path.conf", "etc")).node();
- LOGGER.info("Starting Database service. Wait {} s", DELAYSECONDS);
- // Wait for orange status for single node without redundancy
- ClusterHealthResponse nodeStatus = node.client().admin().cluster().prepareHealth().setWaitForYellowStatus()
- .setTimeout(TimeValue.timeValueSeconds(DELAYSECONDS)).get();
-
- LOGGER.debug("Elasticsearch service started with status {}", nodeStatus.toString());
- }
-
- /**
- * Close node
- */
- @Override
- public void close() {
- node.close();
- oneNode = null; // Release the one instance that was started !
- }
-
- /**
- * Provide indication if all Index initializations are done.
- *
- * @return true if all index initializations are ready, false if not
- */
- public Boolean getInitialized() {
- synchronized (initializationLock) {
- return initializedTarget != 0 && initializedReached == initializedTarget;
- }
- }
-
- public void setInitializedReached() {
- synchronized (initializationLock) {
- HtDatabaseNode.initializedReached++;
- }
- }
-
- public void setInitializedTarget() {
- synchronized (initializationLock) {
- HtDatabaseNode.initializedTarget++;
- }
- }
-
- public Client getClient() {
- return node.client();
- }
-
-
- /*
- * --------------------------------------- Static functions below
- */
-
-
- // Visibility package for test purpose
- static void checkorcreateplugins(String pluginFolder) {
- File f = new File(pluginFolder);
- if (!f.exists()) {
- f.mkdir();
- }
- if (!Resources.copyFolderInto(RESFOLDER_PLUGINHEAD, PLUGINFOLDER, RESFOLDER_PLUGIN)) {
- throw new IllegalArgumentException("Copy not successfull Name: " + RESFOLDER_PLUGINHEAD + " folder src "
- + PLUGINFOLDER + " folder dst " + RESFOLDER_PLUGIN);
- }
- //Normal JAR loaded by classloader as part of the bundle
- if (!Resources.copyFolderInto(RESFOLDER_PLUGINDELETE, PLUGINFOLDER, RESFOLDER_PLUGIN)) {
- throw new IllegalArgumentException("Copy not successfull Name: " + RESFOLDER_PLUGINDELETE + " folder src "
- + PLUGINFOLDER + " folder dst " + RESFOLDER_PLUGIN);
- }
- }
-
- /**
- * Checks to see if a specific port is available.
- *
- * @param port the port to check for availability
- */
- private static boolean isPortAvailable(int port) {
- if (port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER) {
- throw new IllegalArgumentException("Invalid start port: " + port);
- }
-
- ServerSocket ss = null;
- DatagramSocket ds = null;
- try {
- ss = new ServerSocket(port);
- ss.setReuseAddress(true);
- ds = new DatagramSocket(port);
- ds.setReuseAddress(true);
- return true;
- } catch (IOException e) {
- } finally {
- if (ds != null) {
- ds.close();
- }
-
- if (ss != null) {
- try {
- ss.close();
- } catch (IOException e) {
- /* should not be thrown */
- }
- }
- }
-
- return false;
- }
-
- private static void checkorcreateConfigFile(EsConfig config, AkkaConfig akkaConfig, GeoConfig geoConfig) {
- File f = new File(DBCONFIGFILENAME);
- if (!f.exists()) {
- LOGGER.debug("no " + DBCONFIGFILENAME + " found - extracting from resources");
- if (Resources.extractFileTo("elasticsearch/elasticsearch.yml", f)) {
- // replace template values
- LOGGER.debug("replace template values with config:" + config);
- Charset charset = StandardCharsets.UTF_8;
- try {
- Path p = f.toPath();
- String hostName = "0.0.0.0"; // Default as initialisation value
- if (akkaConfig != null && akkaConfig.isCluster()) {
- LOGGER.debug("cluster configuration found");
- hostName = akkaConfig.getClusterConfig().getHostName(hostName);
- String clusterDBName = akkaConfig.getClusterConfig().getDBClusterName(null);
- String nodeName = String.format("node%d.%s", akkaConfig.getClusterConfig().getRoleMemberIndex(),
- clusterDBName);
- if (clusterDBName != null) {
- config.setCluster(clusterDBName);
- config.setNode(nodeName);
- config.save();
- LOGGER.info("set db name to " + clusterDBName + " nodename=" + nodeName);
- } else {
- LOGGER.warn("unable to set correct db clustername");
- }
- }
- String content = new String(Files.readAllBytes(p), charset);
- content = content.replaceAll("\\$clustername", config.getCluster())
- .replaceAll("\\$nodename", config.getNode()).replaceAll("\\$hostname", hostName);
-
- // add cluster configuration
- if (akkaConfig != null && akkaConfig.isCluster()) {
- List<ClusterNodeInfo> seedNodes = akkaConfig.getClusterConfig().getSeedNodes();
- String nodesJSONString = "[\"" + seedNodes.get(0).getRemoteAddress() + "\"";
- for (int i = 1; i < seedNodes.size(); i++) {
- nodesJSONString += ",\"" + seedNodes.get(i).getRemoteAddress() + "\"";
- }
- nodesJSONString += "]";
- content += System.lineSeparator()
- + String.format("discovery.zen.ping.unicast.hosts: %s", nodesJSONString);
-
- if (geoConfig != null) {
- LOGGER.debug("adding zone configuration");
- content += System.lineSeparator() + String
- .format("cluster.routing.allocation.awareness.force.zone.values: zone1,zone2");
- content += System.lineSeparator()
- + String.format("cluster.routing.allocation.awareness.attributes: zone");
- if (geoConfig.isPrimary(akkaConfig.getClusterConfig().getRoleMember())) {
- content += System.lineSeparator() + String.format("node.zone: zone1");
- LOGGER.debug("setting zone to zone1");
- } else {
- content += System.lineSeparator() + String.format("node.zone: zone2");
- LOGGER.debug("setting zone to zone2");
- }
- }
- }
- Files.write(p, content.getBytes(charset));
- } catch (IOException e) {
- LOGGER.warn("problem replacing values in file: " + e.getMessage());
-
- }
- } else {
- LOGGER.warn("problem writing database.yml to etc folder from res");
- }
- }
- }
-
- /**
- * Start as singleton
- *
- * @param config data
- * @param akkaConfig data
- * @param geoConfig data
- * @return the node or null if external node used
- */
- public static HtDatabaseNode start(EsConfig config, AkkaConfig akkaConfig, GeoConfig geoConfig) {
- if (isPortAvailable(ES_PORT)) {
- LOGGER.info("ES Port not in use. Start internal ES.");
- if (oneNode == null) {
- checkorcreateplugins(PLUGINFOLDER);
- checkorcreateConfigFile(config, akkaConfig, geoConfig);
- oneNode = new HtDatabaseNode();
- } else {
- throw new IllegalStateException(
- "Database is already started, but can only be started once. Stop here.");
- }
- } else {
- LOGGER.info("ES Port in use. External ES used.");
- }
-
- return oneNode;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseUpdateFile.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseUpdateFile.java
deleted file mode 100644
index 186b89c6c..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseUpdateFile.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-
-public class HtDatabaseUpdateFile extends ZipFile {
-
- public static final String FILENAME_DEFAULT = "elasticsearch_update.zip";
-
- public class EsUpdateObject {
- public final String Uri;
- public final String Method;
- public final JSONObject Body;
-
- public EsUpdateObject(JSONObject o) {
- this.Uri = o.getString("uri");
- this.Method = o.getString("method");
- this.Body = o.getJSONObject("body");
- }
- }
-
- public interface FileReadCallback {
- void read(EsUpdateObject obj,String filename);
-
- void onerror(String filename,IOException e);
- }
-
- private static final Comparator<ZipEntry> byfilenameComparator = (o1, o2) -> o1.getName().compareTo(o2.getName());
-
- public HtDatabaseUpdateFile(String filename) throws IOException {
- super(filename);
- }
-
- private static String readFile(final InputStream s) throws IOException {
- // read file
- BufferedReader in = new BufferedReader(new InputStreamReader(s));
- StringBuilder sb = new StringBuilder();
- String inputLine;
- while ((inputLine = in.readLine()) != null) {
- sb.append(inputLine);
- }
- in.close();
- s.close();
- return sb.toString();
- }
-
- public boolean readFiles(FileReadCallback cb) {
- boolean r=true;
- Enumeration<? extends ZipEntry> entries = this.entries();
- ArrayList<? extends ZipEntry> list = Collections.list(entries);
- Collections.sort(list, byfilenameComparator);
- for (ZipEntry entry : list) {
- if (entry.isDirectory()) {
- continue;
- }
- try {
- InputStream stream = this.getInputStream(entry);
- Object data = new JSONTokener(readFile(stream)).nextValue();
- stream.close();
- if(data instanceof JSONArray)
- {
- JSONArray a=(JSONArray)data;
- for(int i=0;i<a.length();i++)
- {
- cb.read(new EsUpdateObject(a.getJSONObject(i)),entry.getName());
- }
- }
- else if(data instanceof JSONObject)
- {
- cb.read(new EsUpdateObject( (JSONObject)data),entry.getName());
- }
- } catch (IOException e) {
- r=false;
- cb.onerror(entry.getName(),e);
- }
- }
- return r;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseWebAPIClient.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseWebAPIClient.java
deleted file mode 100644
index ed09d34cd..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtDatabaseWebAPIClient.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class HtDatabaseWebAPIClient {
-
- private static Logger LOG = LoggerFactory.getLogger(HtDatabaseWebAPIClient.class);
- private static final int BUFSIZE = 1024;
- private static final String CHARSET = "UTF-8";
- private final String host;
- private final int port;
-
- public HtDatabaseWebAPIClient() {
- this.host = "http://localhost";
- this.port = 9200;
- }
-
- public String sendRequest(String uri, String method, JSONObject body) throws IOException {
- LOG.debug("try to send request with uri=" + uri + " as method=" + method);
- String sresponse = "";
- int responseCode = -1;
-
- if (body != null) {
- LOG.trace("body: {}", body);
- InputStream response = null;
- String surl = String.format("%s:%d%s", this.host, this.port, uri);
- URL url = new URL(surl);
- URLConnection urlConnection = url.openConnection();
- if (urlConnection instanceof HttpURLConnection) {
- HttpURLConnection http = (HttpURLConnection) urlConnection;
- http.setRequestMethod(method);
- http.setDoOutput(true);
- http.setRequestProperty("Content-Type", "application/json");
- // send request
- // Send the message to destination
- if (!method.equals("GET")) {
- try (OutputStream output = http.getOutputStream()) {
- output.write(body.toString().getBytes(CHARSET));
- }
- }
- responseCode = http.getResponseCode();
- // Receive answer
- if (responseCode >= 200 && responseCode < 300) {
- response = http.getInputStream();
- } else {
- response = http.getErrorStream();
- if (response == null) {
- http.getInputStream();
- }
- }
- }
- byte[] buffer = new byte[BUFSIZE];
- int len = 0;
- if (response != null) {
- while (true) {
- len = response.read(buffer, 0, BUFSIZE);
- if (len <= 0) {
- break;
- }
- sresponse += new String(buffer, 0, len, CHARSET);
- }
- response.close();
- } else {
- LOG.debug("response is null");
- }
- }
- LOG.debug("ResponseCode: " + responseCode);
- LOG.trace("Response: " + sresponse);
-
- return sresponse;
- }
-
- public void insertEntry(String index, String type, JSONObject data) throws IOException {
- this.sendRequest(String.format("/%s/%s/", index,type), "POST", data);
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtMapper.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtMapper.java
deleted file mode 100644
index 9d8ddc3ae..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/HtMapper.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database;
-
-import java.io.IOException;
-import javax.annotation.Nullable;
-
-import org.elasticsearch.common.bytes.BytesReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-
-/**
- * @author Herbert
- *
- */
-public class HtMapper<T> {
-
- private static final Logger log = LoggerFactory.getLogger(HtDatabaseClientAbstract.class);
-
- private final Class<? extends T> clazz;
-
- private final JsonMapperBase objectMapperRead;
- private final JsonMapperBase objectMapperWrite;
-
- private int mappingFailures;
-
-
- public HtMapper(Class<? extends T> clazz) {
-
- this.mappingFailures = 0;
- this.clazz = clazz;
-
- this.objectMapperRead = new JsonMapperBase();
- this.objectMapperWrite = this.objectMapperRead;
- }
-
- public Class<? extends T> getClazz() {
- return clazz;
- }
-
- public int getMappingFailures() {
- return mappingFailures;
- }
-
- public String objectToJson( T object ) {
- return objectMapperWrite.objectToJson(object);
- }
-
- /**
- * Do the mapping from Json to class
- * Block further mapping if there is are to many failures
- * @param json String with Objects JSON representation
- * @return The Object
- */
- public @Nullable T getObjectFromJson(byte[] json) {
-
- if (json == null) {
- return null;
- } else if (mappingFailures < 10) {
- try {
- T object = objectMapperRead.readValue(json, clazz);
- return object;
- } catch (JsonParseException e) {
- mappingFailures++;
- log.warn(e.toString());
- } catch (JsonMappingException e) {
- mappingFailures++;
- log.warn(e.toString());
- } catch (IOException e) {
- mappingFailures++;
- log.warn(e.toString());
- } catch (Exception e) {
- mappingFailures++;
- log.warn(e.toString());
- }
- }
- log.warn("Problems parsing : {} {}", clazz, json);
- return null;
- }
-
- /**
- * Do the mapping from Json to class
- * Block further mapping if there is are to many failures
- * @param json Byte array with JSON Object representation
- * @return The Object
- */
- public @Nullable T getObjectFromJson(BytesReference json) {
-
- return json == null ? null : getObjectFromJson(json.toBytes());
-
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/IndexClientBuilder.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/IndexClientBuilder.java
deleted file mode 100644
index facc1c6f7..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/IndexClientBuilder.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database;
-
-import java.util.List;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import org.json.JSONObject;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Setup index in the database
- * @author herbert
- *
- */
-public class IndexClientBuilder implements AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(IndexClientBuilder.class);
-
- /** Index name to be used */
- private final String index;
- /** Location of mapping data **/
- private String mappingSettingFileName = null;
- /** Location of configuration data **/
- private String modelDataDirectory = null;
-
- private final ScheduledExecutorService scheduler;
- private HtDatabaseClientAbstract client;
- private HtDatabaseNode databaseNode;
-
-
- // --- Construct and initialize
-
- public IndexClientBuilder(String index) {
- this.index = index;
- this.databaseNode = null;
- this.scheduler = Executors.newSingleThreadScheduledExecutor();
- }
-
- // Additional setter functions
-
- public IndexClientBuilder setMappingSettingJsonFileName(String jsonFileName) {
- this.mappingSettingFileName = jsonFileName;
- return(this);
- }
-
- public IndexClientBuilder setModelDataDirectory(String jsonDirectory) {
- this.modelDataDirectory = jsonDirectory;
- return(this);
- }
-
- public HtDatabaseClientAbstract create(HtDatabaseNode database) {
- LOG.info("Create {} start with node", this.getClass().getSimpleName() );
- this.databaseNode = database;
- client = new HtDatabaseClientAbstract(index, database);
- setupIndex();
- return client;
- }
-
-
- public void stop() {
- this.scheduler.shutdown();
- }
-
- @Override
- public void close() throws Exception {
- stop();
- }
-
- private void setupIndex() {
- if (! client.isExistsIndex()) {
- LOG.info("Index not existing ... create index");
-
- // Initialisation 1
- if (mappingSettingFileName != null) {
- JSONObject indexconfigdata=Resources.getJSONFile(mappingSettingFileName);
- client.doCreateIndexWithMapping(indexconfigdata);
- } else
- client.doCreateIndex();
-
- // Initialisation 2 - start asynchron initialization and let it run
- scheduler.schedule(fillDatabase, 0, TimeUnit.SECONDS);
- }
- }
-
- private final Runnable fillDatabase = new Runnable() {
- @Override
- public void run() {
- if (databaseNode != null) {
- databaseNode.setInitializedTarget();
- }
- try { //Prevent ending task by exception
- if (modelDataDirectory != null) {
- LOG.info("... write initial data for index {}",index);
- List<JSONObject> dataList=Resources.getJSONFiles(modelDataDirectory, false);
- LOG.debug("received number of objects: {} of index {}", dataList.size(), index);
- for (JSONObject da: dataList) {
- client.doWriteJSONObject(da);
- }
- LOG.debug("wrote all objects for index {}", index);
- } else {
- LOG.info("No initial data for index {}",index);
- }
- } catch (Exception e) {
- LOG.warn("Problem during initialization of index "+index+" {}", e);
- }
- if (databaseNode != null) {
- databaseNode.setInitializedReached();
- }
- }
- };
-
- /*---------------------------------------------------------
- * static files
- */
-
- public static IndexClientBuilder getBuilder(String index) {
- return new IndexClientBuilder(index);
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/IsEsObject.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/IsEsObject.java
deleted file mode 100644
index 7e9db591d..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/IsEsObject.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database;
-
-/**
- * Element is a document in the ES database.
- */
-public interface IsEsObject {
-
- /**
- * Set the ES Id
- * @param id Set the ID, created by ES for this Object
- */
- void setEsId( String id );
-
- /**
- * Get Id content as string that is used in ES
- * @return Related ID, that was specified by set command.
- */
- String getEsId();
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/JsonMapperBase.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/JsonMapperBase.java
deleted file mode 100644
index 4a89c9be1..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/database/JsonMapperBase.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database;
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.core.JsonGenerator.Feature;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-
-/**
- * This class is used to define default for JSON Serialization and Deserialization for the project at a single place
- */
-public class JsonMapperBase extends ObjectMapper {
-
- private static final long serialVersionUID = 1L;
- private static final Logger LOG = LoggerFactory.getLogger(JsonMapperBase.class);
-
- public JsonMapperBase() {
-
- setVisibility(PropertyAccessor.ALL, Visibility.NONE);
- setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
-
- // Deserialization
- configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
-
- // Serialization
- configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
- getFactory().configure(Feature.ESCAPE_NON_ASCII, true);
- }
-
- public JsonMapperBase(int t) {
-
- switch(t) {
- case 0:
- break;
- case 1:
- setVisibility(PropertyAccessor.ALL, Visibility.NONE);
- setVisibility(PropertyAccessor.FIELD, Visibility.DEFAULT);
- break;
- case 2:
- setVisibility(PropertyAccessor.ALL, Visibility.NONE);
- setVisibility(PropertyAccessor.FIELD, Visibility.PROTECTED_AND_PUBLIC);
- break;
- case 3:
- setVisibility(PropertyAccessor.ALL, Visibility.NONE);
- setVisibility(PropertyAccessor.GETTER, Visibility.ANY);
- setVisibility(PropertyAccessor.IS_GETTER, Visibility.ANY);
- break;
- default:
- setVisibility(PropertyAccessor.ALL, Visibility.NONE);
- setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
- break;
-
- }
-
- // Deserialization
- configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
-
- // Serialization
- configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
- getFactory().configure(Feature.ESCAPE_NON_ASCII, true);
- }
-
-
-
- public String objectToJson( Object object ) {
- String res = null;
-
- try {
-
- res = writeValueAsString(object);
-
- } catch (JsonGenerationException e) {
- LOG.debug(e.toString());
- } catch (JsonMappingException e) {
- LOG.debug(e.toString());
- } catch (IOException e) {
- LOG.debug(e.toString());
- } catch (Exception e) {
- LOG.debug(e.toString());
- }
-
- return res;
- }
-
- public String objectListToJson( List<? extends Object> objectList ) {
- String res = null;
-
- try {
-
- StringWriter stringEmp = new StringWriter();
- writeValue(stringEmp, objectList);
- res = stringEmp.toString();
- stringEmp.close();
-
- } catch (JsonGenerationException e) {
- LOG.debug(e.toString());
- } catch (JsonMappingException e) {
- LOG.debug(e.toString());
- } catch (IOException e) {
- LOG.debug(e.toString());
- } catch (Exception e) {
- LOG.debug(e.toString());
- }
-
- return res;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/http/BaseHTTPClient.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/http/BaseHTTPClient.java
deleted file mode 100644
index b0404eed6..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/http/BaseHTTPClient.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.http;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.security.KeyFactory;
-import java.security.KeyManagementException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.util.Base64;
-import java.util.Map;
-import javax.annotation.Nonnull;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.KeyManager;
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.xml.bind.DatatypeConverter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BaseHTTPClient {
-
- private static Logger LOG = LoggerFactory.getLogger(BaseHTTPClient.class);
- private static final int SSLCERT_NONE = -1;
- private static final int SSLCERT_PCKS = 0;
- private static final int SSLCERT_PEM = 1;
- private static final int BUFSIZE = 1024;
- private static final Charset CHARSET = StandardCharsets.UTF_8;
- private static final String SSLCONTEXT = "TLSv1.2";
- private static final int DEFAULT_HTTP_TIMEOUT_MS = 30000; // in ms
-
- private final boolean trustAll;
- private final String baseUrl;
-
- private int timeout = DEFAULT_HTTP_TIMEOUT_MS;
- private SSLContext sc = null;
-
- public BaseHTTPClient(String base) {
- this(base, false);
- }
-
- public BaseHTTPClient(String base, boolean trustAllCerts) {
- this(base, trustAllCerts, null, null, SSLCERT_NONE);
- }
-
- public BaseHTTPClient(String base, boolean trustAllCerts, String certFilename, String passphrase, int sslCertType) {
- this.baseUrl = base;
- this.trustAll = trustAllCerts;
- try {
- sc = setupSsl(trustAll, certFilename, passphrase, sslCertType);
- } catch (KeyManagementException | NoSuchAlgorithmException | UnrecoverableKeyException | CertificateException
- | KeyStoreException | IOException | InvalidKeySpecException e) {
- LOG.warn("problem ssl setup: " + e.getMessage());
- }
- }
-
- protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers)
- throws IOException {
- return this.sendRequest(uri, method, body != null ? body.getBytes(CHARSET) : null, headers);
- }
-
- protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, byte[] body, Map<String, String> headers)
- throws IOException {
- if (uri == null) {
- uri = "";
- }
- String surl = this.baseUrl;
- if (!surl.endsWith("/") && uri.length() > 0) {
- surl += "/";
- }
- if (uri.startsWith("/")) {
- uri = uri.substring(1);
- }
- surl += uri;
- LOG.debug("try to send request with url=" + this.baseUrl + uri + " as method=" + method);
- LOG.trace("body:" + (body == null ? "null" : new String(body, CHARSET)));
- URL url = new URL(surl);
- URLConnection http = url.openConnection();
- http.setConnectTimeout(this.timeout);
- if (surl.toString().startsWith("https")) {
- if (sc != null) {
- ((HttpsURLConnection) http).setSSLSocketFactory(sc.getSocketFactory());
- if (trustAll) {
- LOG.debug("trusting all certs");
- HostnameVerifier allHostsValid = (hostname, session) -> true;
- ((HttpsURLConnection) http).setHostnameVerifier(allHostsValid);
- }
- } else // Should never happen
- {
- LOG.warn("No SSL context available");
- return new BaseHTTPResponse(-1, "");
- }
- }
- ((HttpURLConnection) http).setRequestMethod(method);
- http.setDoOutput(true);
- if (headers != null && headers.size() > 0) {
- for (String key : headers.keySet()) {
- http.setRequestProperty(key, headers.get(key));
- LOG.trace("set http header " + key + ": " + headers.get(key));
- }
- }
- byte[] buffer = new byte[BUFSIZE];
- int len = 0, lensum = 0;
- // send request
- // Send the message to destination
- if (!method.equals("GET") && body != null && body.length > 0) {
- try (OutputStream output = http.getOutputStream()) {
- output.write(body);
- }
- }
- // Receive answer
- int responseCode = ((HttpURLConnection) http).getResponseCode();
- String sresponse = "";
- InputStream response = null;
- try {
- if (responseCode >= 200 && responseCode < 300) {
- response = http.getInputStream();
- } else {
- response = ((HttpURLConnection) http).getErrorStream();
- if (response == null) {
- response = http.getInputStream();
- }
- }
- if (response != null) {
- while (true) {
- len = response.read(buffer, 0, BUFSIZE);
- if (len <= 0) {
- break;
- }
- lensum += len;
- sresponse += new String(buffer, 0, len, CHARSET);
- }
- } else {
- LOG.debug("response is null");
- }
- } catch (Exception e) {
- LOG.debug("No response. ", e);
- } finally {
- if (response != null) {
- response.close();
- }
- }
- LOG.debug("ResponseCode: " + responseCode);
- LOG.trace("Response (len:{}): {}", String.valueOf(lensum), sresponse);
- return new BaseHTTPResponse(responseCode, sresponse);
- }
-
- public static SSLContext setupSsl(boolean trustall)
- throws NoSuchAlgorithmException, KeyManagementException, CertificateException, FileNotFoundException,
- IOException, UnrecoverableKeyException, KeyStoreException, InvalidKeySpecException {
-
- return setupSsl(trustall, null, null, SSLCERT_NONE);
- }
-
- /**
- * @param keyFilename filename for key file
- * @param certFilename filename for cert file
- * @throws NoSuchAlgorithmException
- * @throws KeyManagementException
- * @throws IOException
- * @throws FileNotFoundException
- * @throws CertificateException
- * @throws KeyStoreException
- * @throws UnrecoverableKeyException
- * @throws InvalidKeySpecException
- */
- /**
- * Setup of SSLContext
- *
- * @param trustall true to switch of certificate verification
- * @param certFilename filename for certificate file
- * @param passPhrase for certificate
- * @param certType of certificate
- * @return SSL Context according to parameters
- * @throws NoSuchAlgorithmException according name
- * @throws KeyManagementException according name
- * @throws CertificateException according name
- * @throws FileNotFoundException according name
- * @throws IOException according name
- * @throws UnrecoverableKeyException according name
- * @throws KeyStoreException according name
- * @throws InvalidKeySpecException according name
- */
- public static SSLContext setupSsl(boolean trustall, String certFilename, String passPhrase, int certType)
- throws NoSuchAlgorithmException, KeyManagementException, CertificateException, FileNotFoundException,
- IOException, UnrecoverableKeyException, KeyStoreException, InvalidKeySpecException {
-
- SSLContext sc = SSLContext.getInstance(SSLCONTEXT);
- TrustManager[] trustCerts = null;
- if (trustall) {
- trustCerts = new TrustManager[] {new javax.net.ssl.X509TrustManager() {
- @Override
- public java.security.cert.X509Certificate[] getAcceptedIssuers() {
- return null;
- }
-
- @Override
- public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
-
- @Override
- public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
- }};
-
- }
- KeyManager[] kms = null;
- if (certFilename != null && passPhrase != null && !certFilename.isEmpty() && !passPhrase.isEmpty()) {
- if (certType == SSLCERT_PCKS) {
- LOG.debug("try to load pcks file " + certFilename + " with passphrase=" + passPhrase);
- KeyStore keyStore = KeyStore.getInstance("PKCS12");
- FileInputStream fileInputStream = new FileInputStream(certFilename);
- keyStore.load(fileInputStream, passPhrase.toCharArray());
- KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
- kmf.init(keyStore, passPhrase.toCharArray());
- kms = kmf.getKeyManagers();
- fileInputStream.close();
- LOG.debug("successful");
-
- } else if (certType == SSLCERT_PEM) {
- LOG.debug("try to load pem files cert=" + certFilename + " key=" + passPhrase);
- File fCert = new File(certFilename);
- File fKey = new File(passPhrase);
- KeyStore keyStore = KeyStore.getInstance("JKS");
- keyStore.load(null);
- byte[] certBytes = parseDERFromPEM(Files.readAllBytes(fCert.toPath()), "-----BEGIN CERTIFICATE-----",
- "-----END CERTIFICATE-----");
- byte[] keyBytes = parseDERFromPEM(Files.readAllBytes(fKey.toPath()), "-----BEGIN PRIVATE KEY-----",
- "-----END PRIVATE KEY-----");
-
- X509Certificate cert = generateCertificateFromDER(certBytes);
- RSAPrivateKey key = generatePrivateKeyFromDER(keyBytes);
- keyStore.setCertificateEntry("cert-alias", cert);
- keyStore.setKeyEntry("key-alias", key, "changeit".toCharArray(), new Certificate[] {cert});
-
- KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
- kmf.init(keyStore, "changeit".toCharArray());
- kms = kmf.getKeyManagers();
- LOG.debug("successful");
- }
- }
- // Init the SSLContext with a TrustManager[] and SecureRandom()
- sc.init(kms, trustCerts, new java.security.SecureRandom());
- return sc;
- }
-
- protected static byte[] parseDERFromPEM(byte[] pem, String beginDelimiter, String endDelimiter) {
- String data = new String(pem);
- String[] tokens = data.split(beginDelimiter);
- tokens = tokens[1].split(endDelimiter);
- return DatatypeConverter.parseBase64Binary(tokens[0]);
- }
-
- protected static RSAPrivateKey generatePrivateKeyFromDER(byte[] keyBytes)
- throws InvalidKeySpecException, NoSuchAlgorithmException {
- PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyBytes);
-
- KeyFactory factory = KeyFactory.getInstance("RSA");
-
- return (RSAPrivateKey) factory.generatePrivate(spec);
- }
-
- protected static X509Certificate generateCertificateFromDER(byte[] certBytes) throws CertificateException {
- CertificateFactory factory = CertificateFactory.getInstance("X.509");
-
- return (X509Certificate) factory.generateCertificate(new ByteArrayInputStream(certBytes));
- }
-
- public static String getAuthorizationHeaderValue(String username, String password) {
- return "Basic " + new String(Base64.getEncoder().encode((username + ":" + password).getBytes()));
- }
-
- public void setTimeout(int timeout) {
- this.timeout = timeout;
- }
-
- public static int getSslCertPcks() {
- return SSLCERT_PCKS;
- }
-
- public static int getSslCertNone() {
- return SSLCERT_NONE;
- }
-
- public static int getSslCertPEM() {
- return SSLCERT_PEM;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/http/BaseHTTPResponse.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/http/BaseHTTPResponse.java
deleted file mode 100644
index ddadd1149..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/http/BaseHTTPResponse.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.http;
-
-public class BaseHTTPResponse {
-
- public static final int CODE404 = 404;
- public static final int CODE200 = 200;
- public static final BaseHTTPResponse UNKNOWN = new BaseHTTPResponse(-1, "");
- public final int code;
- public final String body;
-
- public BaseHTTPResponse(int code,String body)
- {
- this.code=code;
- this.body=body;
- }
-
- @Override
- public String toString() {
- return "BaseHTTPResponse [code=" + code + ", body=" + body + "]";
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/Environment.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/Environment.java
deleted file mode 100644
index b56fe12b3..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/Environment.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes;
-
-import java.net.Inet4Address;
-import java.net.UnknownHostException;
-import java.util.Map;
-
-public class Environment {
-
- public static String getVar(String v)
- {
- if(v.equals("$HOSTNAME"))
- {
- String s=null;
- try {
- s = Inet4Address.getLocalHost().getHostName();
- } catch (UnknownHostException e) {
-
- }
- if(s!=null && s.length()>0)
- return s;
- }
- Map<String, String> env = System.getenv();
- for (String envName : env.keySet()) {
- if(envName!=null && envName.equals(v))
- return env.get(envName);
- }
- return null;
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/FileWatchdog.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/FileWatchdog.java
deleted file mode 100644
index 90bb8432a..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/FileWatchdog.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You 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.
- */
-
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes;
-
-import java.io.File;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Check every now and then that a certain file has not changed. If it has, then call the
- * {@link #doOnChange} method.
- *
- * @author JunHo Yoon
- * @since 3.1.1
- */
-public abstract class FileWatchdog extends Thread {
- private static final Logger LOGGER = LoggerFactory.getLogger(FileWatchdog.class);
- /**
- * The default delay between every file modification check, set to 60 seconds.
- */
- public static final long DEFAULT_DELAY = 60000;
- /**
- * The name of the file to observe for changes.
- */
- private final String filename;
-
- /**
- * The delay to observe between every check. By default set {@link #DEFAULT_DELAY}.
- */
- private long delay = DEFAULT_DELAY;
-
- private final File file;
- private long lastModified = 0;
- private boolean warnedAlready = false;
-
- protected FileWatchdog(String filename) {
- this.filename = filename;
- file = new File(filename);
- setDaemon(true);
- checkAndConfigure();
- }
-
- /**
- * Set the delay to observe between each check of the file changes.
- *
- * @param delay the frequency of file watch.
- */
- public void setDelay(long delay) {
- this.delay = delay;
- }
-
- /**
- * abstract method to be run when the file is changed.
- */
- protected abstract void doOnChange();
-
- protected void checkAndConfigure() {
- boolean fileExists;
- try {
- fileExists = file.exists();
- } catch (SecurityException e) {
- LOGGER.warn("Was not allowed to read check file existence, file:[{}].",filename);
- this.interrupt(); // there is no point in continuing
- return;
- }
-
- if (fileExists) {
- long l = file.lastModified(); // this can also throw a
- if (lastModified == 0) {
- lastModified = l; // is very unlikely.
- }
- if (l > lastModified) { // however, if we reached this point this
- lastModified = l; // is very unlikely.
- doOnChange();
- warnedAlready = false;
- }
- } else {
- if (!warnedAlready) {
- LOGGER.debug("[{}] does not exist.", filename);
- warnedAlready = true;
- }
- }
- }
-
- @Override
- public void run() {
- while (!isInterrupted()) {
- checkAndConfigure();
- try {
- Thread.sleep(delay);
- } catch (InterruptedException e) {
- LOGGER.debug("Interrupted sleep. {}", e.getMessage());
- Thread.currentThread().interrupt();
- }
- }
- LOGGER.debug("Stoppen file watchdog for file {}", filename);
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/IniConfigurationFile.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/IniConfigurationFile.java
deleted file mode 100644
index ebb46547e..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/IniConfigurationFile.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map.Entry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class IniConfigurationFile {
-
- private static final Logger LOG = LoggerFactory.getLogger(IniConfigurationFile.class);
-
- private static final String SECTIONNAME_ROOT = "";
- private static final String DELIMITER = "=";
- private static final String COMMENTCHARS[] = {"#", ";"};
- private static final String LR = "\n";
-
- private final File mFile;
- private final List<Section> sections;
-
- public IniConfigurationFile(File f) {
- this.mFile = f;
- this.sections = new ArrayList<>();
- this.sections.add(new Section(SECTIONNAME_ROOT));
- }
-
- public void load() throws ConfigurationException {
- String curSectionName = SECTIONNAME_ROOT;
- LOG.debug("loading file");
- BufferedReader br = null;
- try {
- br = new BufferedReader(new FileReader(this.mFile));
- for (String line; (line = br.readLine()) != null;) {
- line = line.trim();
- if (line.isEmpty()) {
- continue;
- }
- if (line.startsWith("[") && line.endsWith("]")) {
- curSectionName = line.substring(1, line.length() - 1);
- this.addSection(curSectionName);
- } else {
- this.getSection(curSectionName).addLine(line);
- }
- }
-
- } catch (Exception e) {
- throw new ConfigurationException(e.getMessage());
- } finally {
- try {
- if (br != null) {
- br.close();
- }
- } catch (IOException e) {
- }
- }
- LOG.debug("finished loading file");
- LOG.debug("start parsing sections");
- for (Section section : this.sections) {
- section.parseLines();
- }
- LOG.debug("finished parsing " + this.sections.size() + " sections");
- }
-
- private Section getSection(String name) {
- for (Section s : this.sections) {
- if (s.Name.equals(name)) {
- return s;
- }
- }
- return this.addSection(name);
-
- }
-
- private Section addSection(String name) {
-
- Section s = new Section(name);
- this.sections.add(s);
- return s;
- }
-
- public void reLoad() throws ConfigurationException {
- this.sections.clear();
- this.sections.add(new Section(SECTIONNAME_ROOT));
- this.load();
- }
-
-
- public void setProperty(String key, String value) {
- Section s;
- if (key.contains(".")) {
- s = this.getSection(key.substring(0, key.indexOf(".")));
- key = key.substring(key.indexOf(".") + 1);
- } else {
- s = this.getSection(SECTIONNAME_ROOT);
- }
- s.setProperty(key, value);
- }
-
-
- public void setProperty(String key, int value) {
- Section s;
- if (key.contains(".")) {
- s = this.getSection(key.substring(0, key.indexOf(".")));
- key = key.substring(key.indexOf(".") + 1);
- } else {
- s = this.getSection(SECTIONNAME_ROOT);
- }
- s.setProperty(key, String.format("%d", value));
- }
-
-
- public void setProperty(String key, boolean value) {
- Section s;
- if (key.contains(".")) {
- s = this.getSection(key.substring(0, key.indexOf(".")));
- key = key.substring(key.indexOf(".") + 1);
- } else {
- s = this.getSection(SECTIONNAME_ROOT);
- }
- s.setProperty(key, value ? "true" : "false");
- }
-
- public void setProperty(String key, Object value) {
- this.setProperty(key, value == null ? "null" : value.toString());
- }
-
- public void save() {
- try (BufferedWriter bw = new BufferedWriter(new FileWriter(this.mFile, false))) {
- for (Section section : this.sections) {
- if (section.hasValues()) {
- bw.write(String.join(LR, section.toLines()) + LR + LR);
- }
- }
- bw.close();
- } catch (Exception e) {
- LOG.warn("problem saving value: " + e.getMessage());
- }
- }
-
- public Section subset(String section) {
- return this.getSection(section);
- }
-
- public static class ConfigurationException extends Exception {
-
- private static final long serialVersionUID = 733061908616404383L;
-
- public ConfigurationException(String m) {
- super(m);
- }
- }
-
- public static class ConversionException extends Exception {
- private static final long serialVersionUID = 5179891576029923079L;
-
- public ConversionException(String m) {
- super(m);
- }
- }
-
- private static class SectionValue {
- private String Value;
- private final List<String> Comments;
- private boolean IsUncommented;
-
- public SectionValue(String value) {
- this(value, new ArrayList<String>(), false);
- }
-
- public SectionValue(String value, List<String> commentsForValue, boolean isuncommented) {
- this.Comments = commentsForValue;
- this.Value = value;
- this.IsUncommented = isuncommented;
- }
- }
-
- public static class Section {
- private final String Name;
- private final List<String> rawLines;
- private final LinkedHashMap<String, SectionValue> values;
-
- public Section(String name) {
- LOG.debug("new section created:" + name);
- this.Name = name;
- this.rawLines = new ArrayList<>();
- this.values = new LinkedHashMap<>();
- }
-
- public void addLine(String line) {
- LOG.trace("adding raw line:" + line);
- this.rawLines.add(line);
- }
-
- public String getProperty(String key) {
- return this.getProperty(key, null);
- }
-
- public String getProperty(String key, String defValue) {
- if (values.containsKey(key)) {
- return values.get(key).Value;
- }
- return defValue;
- }
-
- public void setProperty(String key, String value) {
- boolean isuncommented = this.isCommentLine(key);
- if (isuncommented) {
- key = key.substring(1);
- }
- if (this.values.containsKey(key)) {
- this.values.get(key).Value = value;
- this.values.get(key).IsUncommented = isuncommented;
- } else {
- SectionValue sv = new SectionValue(value);
- sv.IsUncommented = isuncommented;
- this.values.put(key, sv);
- }
- }
-
- public void parseLines() {
- this.values.clear();
- List<String> commentsForValue = new ArrayList<>();
- boolean uncommented = false;
- for (String line : rawLines) {
-
- if (this.isCommentLine(line)) {
- if (!line.contains(DELIMITER)) {
- commentsForValue.add(line);
- continue;
- } else {
- uncommented = true;
- line = line.substring(1);
- }
- }
- if (!line.contains(DELIMITER)) {
- continue;
- }
- String hlp[] = line.split(DELIMITER);
- if (hlp.length > 1) {
- String key = hlp[0];
- String value =
- line.length() > (key + DELIMITER).length() ? line.substring((key + DELIMITER).length())
- : "";
- if (this.values.containsKey(key)) {
- this.values.get(key).Value = value;
- } else {
- this.values.put(key, new SectionValue(value, commentsForValue, uncommented));
- commentsForValue = new ArrayList<>();
- }
- } else {
- LOG.warn("ignoring unknown formatted line:" + line);
- }
- uncommented = false;
- }
- }
-
- private boolean isCommentLine(String line) {
- for (String c : COMMENTCHARS) {
- if (line.startsWith(c)) {
- return true;
- }
- }
- return false;
- }
-
- public String[] toLines() {
- List<String> lines = new ArrayList<>();
- if (!this.Name.isEmpty()) {
- lines.add("[" + this.Name + "]");
- }
- for (Entry<String, SectionValue> entry : this.values.entrySet()) {
- if (entry.getValue().Comments.size() > 0) {
- for (String comment : entry.getValue().Comments) {
- lines.add(comment);
- }
- }
- lines.add((entry.getValue().IsUncommented ? COMMENTCHARS[0] : "") + entry.getKey() + DELIMITER
- + entry.getValue().Value);
- }
- String[] alines = new String[lines.size()];
- return lines.toArray(alines);
- }
-
- public String getString(String key, String def) {
- return this.getProperty(key, def);
- }
-
- public boolean getBoolean(String key, boolean def) throws ConversionException {
- String v = this.getProperty(key);
- if (v == null || v.isEmpty()) {
- return def;
- }
- if (v.equals("true")) {
- return true;
- }
- if (v.equals("false")) {
- return false;
- }
- throw new ConversionException("invalid value for key " + key);
- }
-
- public int getInt(String key, int def) throws ConversionException {
- String v = this.getProperty(key);
- if (v == null || v.isEmpty()) {
- return def;
- }
- try {
- return Integer.parseInt(v);
- } catch (NumberFormatException e) {
- throw new ConversionException(e.getMessage());
- }
- }
-
- public long getLong(String key, long def) throws ConversionException {
- String v = this.getProperty(key);
- if (v == null || v.isEmpty()) {
- return def;
- }
- try {
- return Long.parseLong(v);
- } catch (NumberFormatException e) {
- throw new ConversionException(e.getMessage());
- }
- }
-
- public boolean hasValues() {
- return this.values.size() > 0;
- }
-
- public boolean hasKey(String key) {
- return this.values.containsKey(key);
- }
-
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalDateAndTime.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalDateAndTime.java
deleted file mode 100644
index cc47362c0..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalDateAndTime.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.DateAndTime;
-
-/**
- * Converts time stamps into internal format according to ONF1.2 and ISO 8601.
- * @author herbert
- *
- */
-public class InternalDateAndTime {
-
- private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter();
-
- private static final InternalDateAndTime TESTPATTERN = new InternalDateAndTime("2017-01-01T00:00:00.0Z");
- private static final String INITIALPATTERN = "0000-00-00T00:00:00.0Z";
-
- String internalDateAndTime = INITIALPATTERN;
-
- /**
- * Static builder ONF1.2
- * @param time in ONF1.2 yang format
- * @return InternalDateAndTime
- */
- public static InternalDateAndTime valueOf(DateAndTime time) {
- return new InternalDateAndTime(time);
- }
-
- /**
- * Static builder ONF1.0
- * @param time in ONF1.0 yang format
- * @return InternalDateAndTime
- */
-
- public static InternalDateAndTime valueOf(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime time) {
- return new InternalDateAndTime(time);
- }
-
- /**
- * @return Getter with String representation
- */
- public String getValue() {
- return internalDateAndTime;
- }
-
- /*----------------------------------------------------------------
- * Private constructors and functions
- */
-
- /**
- * Convert ONF 1.2 DateAndTime to String
- * @param time as input
- */
- private InternalDateAndTime(DateAndTime time) {
- internalDateAndTime = NETCONFTIME_CONVERTER.getTimeStampFromNetconf(time.getValue());
- }
-
- /**
- * Convert ONF 1.2 DateAndTime to String
- * @param time as input
- */
- private InternalDateAndTime(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime time) {
- if (time != null) {
- internalDateAndTime = NETCONFTIME_CONVERTER.getTimeStampFromNetconf(time.getValue());
- } else {
- internalDateAndTime = INITIALPATTERN;
- }
- }
-
- /**
- * Setup static TEST
- * @param internalDateAndTime
- */
- private InternalDateAndTime(String internalDateAndTime) {
- this.internalDateAndTime = internalDateAndTime;
- }
-
- /**
- * Get a testpattern
- * @return testpattern
- */
- public static InternalDateAndTime getTestpattern() {
- return TESTPATTERN;
- }
-
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalSeverity.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalSeverity.java
deleted file mode 100644
index fcdb5e8ef..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalSeverity.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- * @author herbert
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes;
-
-import javax.annotation.Nullable;
-
-public enum InternalSeverity {
-
- NonAlarmed,
- Warning,
- Minor,
- Major,
- Critical;
-
- public boolean isNoAlarmIndication() {
- return this == NonAlarmed;
- }
-
- public String getValueAsString() {
- return this.name();
- }
-
- @Override
- public String toString() {
- return this.name();
- }
-
- public String toNetconfString()
- {
- switch(this)
- {
- case NonAlarmed:
- return "non-alarmed";
- case Warning:
- return "warning";
- case Minor:
- return "minor";
- case Major:
- return "major";
- case Critical:
- return "critical";
- }
- return "not-specified";
- }
-
- /**
- * convert ONF 1.2 Severity
- * @param severity as input
- * @return String with related output
- */
- public static InternalSeverity valueOf(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.SeverityType severity ) {
- switch( severity ) {
- case NonAlarmed:
- return InternalSeverity.NonAlarmed;
- case Warning:
- return InternalSeverity.Warning;
- case Minor:
- return InternalSeverity.Minor;
- case Major:
- return InternalSeverity.Major;
- case Critical:
- return InternalSeverity.Critical;
- }
- return null;
- }
-
- /**
- * convert ONF 1.2.1.1 Severity
- * @param severity as input
- * @return String with related output
- */
- public static InternalSeverity valueOf(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.SeverityType severity ) {
- switch( severity ) {
- case NonAlarmed:
- return InternalSeverity.NonAlarmed;
- case Warning:
- return InternalSeverity.Warning;
- case Minor:
- return InternalSeverity.Minor;
- case Major:
- return InternalSeverity.Major;
- case Critical:
- return InternalSeverity.Critical;
- }
- return null;
- }
-
- /**
- * convert ONF 1.2.1.1p Severity
- * @param severity as input
- * @return String with related output
- */
- public static InternalSeverity valueOf(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.SeverityType severity ) {
- switch( severity ) {
- case NonAlarmed:
- return InternalSeverity.NonAlarmed;
- case Warning:
- return InternalSeverity.Warning;
- case Minor:
- return InternalSeverity.Minor;
- case Major:
- return InternalSeverity.Major;
- case Critical:
- return InternalSeverity.Critical;
- }
- return null;
- }
-
- /**
- * convert a text string into Severity
- * @param severityString with textes non[-]alarmed, warning minor major critical
- * @return related enum or null
- */
- public static @Nullable InternalSeverity valueOfString(String severityString) {
-
- switch( severityString.toLowerCase().trim() ) {
- case "non-alarmed":
- case "nonalarmed":
- return InternalSeverity.NonAlarmed;
- case "warning":
- return InternalSeverity.Warning;
- case "minor":
- return InternalSeverity.Minor;
- case "major":
- return InternalSeverity.Major;
- case "critical":
- return InternalSeverity.Critical;
- }
- return null;
-
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InventoryInformation.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InventoryInformation.java
deleted file mode 100644
index e4ce4afa7..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InventoryInformation.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class InventoryInformation {
-
- private static final String UNKNOWN = "unknown";
- private static final List<String> EMPTY = new ArrayList<>();
- private static final InventoryInformation DEFAULT = new InventoryInformation();
-
- private String type;
- private String model;
- private String vendor;
- private String deviceIpv4;
- private String deviceIpv6;
- private List<String> interfaceUuidList;
-
- public InventoryInformation()
- {
- this.type=UNKNOWN;
- this.model=UNKNOWN;
- this.vendor=UNKNOWN;
- this.deviceIpv4=UNKNOWN;
- this.deviceIpv6=UNKNOWN;
- this.interfaceUuidList=EMPTY;
- }
-
- public InventoryInformation(InventoryInformation inventoryInformation) {
- this.type=inventoryInformation.type;
- this.model=inventoryInformation.model;
- this.vendor=inventoryInformation.vendor;
- this.deviceIpv4=inventoryInformation.deviceIpv4;
- this.deviceIpv6=inventoryInformation.deviceIpv6;
- this.interfaceUuidList=new ArrayList<>(inventoryInformation.interfaceUuidList);
- }
-
- public InventoryInformation(
- String type, String model, String vendor, String deviceIpv4,
- String deviceIpv6, List<String> interfaceUuidList) {
- setType(type);
- setModel(model);
- setVendor(vendor);
- setDeviceIpv4(deviceIpv4);
- setDeviceIpv6(deviceIpv6);
- setInterfaceUuidList(interfaceUuidList);
- }
-
- public String getType() {
- return type;
- }
-
- public String getModel() {
- return model;
- }
-
- public String getVendor() {
- return vendor;
- }
-
- public String getDeviceIpv4() {
- return deviceIpv4;
- }
-
- public String getDeviceIpv6() {
- return deviceIpv6;
- }
-
- public List<String> getInterfaceUuidList() {
- return interfaceUuidList;
- }
-
- public InventoryInformation setType(String type) {
- this.type = type != null ? type : UNKNOWN;
- return this;
- }
-
- public InventoryInformation setModel(String model) {
- this.model = model != null ? model : UNKNOWN;
- return this;
- }
-
- public InventoryInformation setVendor(String vendor) {
- this.vendor = vendor != null ? vendor : UNKNOWN;
- return this;
- }
-
- public InventoryInformation setDeviceIpv4(String deviceIpv4) {
- this.deviceIpv4 = deviceIpv4 != null ? deviceIpv4 : UNKNOWN;
- return this;
- }
-
- public InventoryInformation setDeviceIpv6(String deviceIpv6) {
- this.deviceIpv6 = deviceIpv6 != null ? deviceIpv6 : UNKNOWN ;
- return this;
- }
-
- public InventoryInformation setInterfaceUuidList(List<String> interfaceUuidList) {
- this.interfaceUuidList = interfaceUuidList != null ? interfaceUuidList : EMPTY;
- return this;
- }
-
- public static InventoryInformation getDefault() {
- return DEFAULT;
- }
-
- @Override
- public String toString() {
- return "InventoryInformation [type=" + type + ", model=" + model + ", vendor=" + vendor + ", deviceIpv4="
- + deviceIpv4 + ", deviceIpv6=" + deviceIpv6 + ", interfaceUuidList=" + interfaceUuidList + "]";
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/Resources.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/Resources.java
deleted file mode 100644
index 3a899f884..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/Resources.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.FrameworkUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Resources {
-
- private static final Logger LOG = LoggerFactory.getLogger(Resources.class);
-
- private static final String RESSOURCEROOT = "src/main/resources";
-
- private static URL getFileURL(String resFile) {
- Bundle b = FrameworkUtil.getBundle(Resources.class);
- URL u = null;
- LOG.debug("try to get file {}", resFile);
- if (b == null) {
- LOG.info("Load resource as file: {}", resFile);
- u = getUrlForRessource(resFile);
- } else {
- LOG.info("Load resource from bundle: {}", resFile);
- u = b.getEntry(resFile);
- }
- return u;
- }
-
- private static File getFile(String resFile) {
- Bundle b = FrameworkUtil.getBundle(Resources.class);
- File f = null;
- LOG.debug("try to get file {}", resFile);
- if (b == null) {
- LOG.warn("cannot load bundle resources");
- f = new File(RESSOURCEROOT + resFile);
- } else {
- try {
- f = new File(b.getEntry(resFile).toURI());
- } catch (URISyntaxException e) {
- LOG.warn("Con not load file: {}",e.getMessage());
- }
- }
- return f;
- }
-
- private static String readFile(final URL u) throws IOException {
- return readFile(u.openStream());
- }
-
- private static String readFile(final InputStream s) throws IOException {
- // read file
- BufferedReader in = new BufferedReader(new InputStreamReader(s));
- StringBuilder sb = new StringBuilder();
- String inputLine;
- while ((inputLine = in.readLine()) != null) {
- sb.append(inputLine);
- }
- in.close();
- s.close();
- return sb.toString();
- }
-
- public static List<URL> getFileURLs(String folder, final String filter, final boolean recursive)
- throws IOException {
- Bundle b = FrameworkUtil.getBundle(Resources.class);
- List<URL> list = new ArrayList<>();
- if (b == null) {
- FileFilter ff = pathname -> {
- if (pathname.isFile()) {
- return pathname.getName().contains(filter);
- } else {
- return true;
- }
- };
- File ffolder = getFile(folder);
- if (ffolder != null && ffolder.isDirectory()) {
- File[] files = ffolder.listFiles(ff);
- if (files != null && files.length > 0) {
- for (File f : files) {
- if (f.isFile()) {
- list.add(f.toURI().toURL());
- } else if (f.isDirectory() && recursive) {
- getFileURLsRecursive(f, ff, list);
- }
- }
- }
- }
- } else {
- getResourceURLsTreeRecurse(b, filter, b.getEntryPaths(folder), recursive, list);
- }
- return list;
- }
-
- private static void getFileURLsRecursive(File root, FileFilter ff, List<URL> list) throws MalformedURLException {
- if (root != null && root.isDirectory()) {
- File[] files = root.listFiles(ff);
- if (files != null && files.length > 0) {
- for (File f : files) {
- if (f.isFile()) {
- list.add(f.toURI().toURL());
- } else if (f.isDirectory()) {
- getFileURLsRecursive(f, ff, list);
- }
- }
- }
- }
-
- }
-
- private static void getResourceURLsTreeRecurse(Bundle b, String filter, Enumeration<String> resource,
- boolean recursive, List<URL> outp) throws IOException {
- while (resource.hasMoreElements()) {
- String name = resource.nextElement();
- Enumeration<String> list = b.getEntryPaths(name);
- if (list != null) {
- if (recursive) {
- getResourceURLsTreeRecurse(b, filter, list, recursive, outp);
- }
- } else {
- // Read
- if (name.contains(filter)) {
- LOG.debug("add {} to list", name);
- outp.add(b.getEntry(name));
- } else {
- LOG.debug("filtered out {}", name);
- }
- }
- }
- }
-
- public static List<JSONObject> getJSONFiles(String folder, boolean recursive) {
- List<JSONObject> list = new ArrayList<>();
- List<URL> urls;
- try {
- urls = getFileURLs(folder, ".json", recursive);
- LOG.debug("found {} files", urls.size());
- } catch (IOException e1) {
- urls = new ArrayList<>();
- LOG.warn("failed to get urls from resfolder {} : {}", folder, e1.getMessage());
- }
- for (URL u : urls) {
- LOG.debug("try to parse " + u.toString());
- try {
- JSONObject o = new JSONObject(readFile(u));
- list.add(o);
- } catch (JSONException | IOException e) {
- LOG.warn("problem reading/parsing file {} : {}", u, e.getMessage());
- }
- }
- return list;
- }
-
- public static JSONObject getJSONFile(String resFile) {
- LOG.debug("loading json file {} from res", resFile);
- URL u = getFileURL(resFile);
- if (u == null) {
- LOG.warn("cannot find resfile: {}", resFile);
- return null;
- }
- JSONObject o = null;
- try {
- // parse to jsonobject
- o = new JSONObject(readFile(u));
- } catch (Exception e) {
- LOG.warn("problem reading/parsing file: {}", e.getMessage());
- }
- return o;
- }
-
- /**
- * Used for reading plugins from resource files /elasticsearch/plugins/head
- * /etc/elasticsearch-plugins /elasticsearch/plugins
- *
- * @param resFolder resource folder pointing to the related files
- * @param dstFolder destination
- * @param rootDirToRemove part from full path to remove
- * @return true if files could be extracted
- */
- public static boolean copyFolderInto(String resFolder, String dstFolder, String rootDirToRemove) {
-
- Enumeration<URL> urls = null;
- Bundle b = FrameworkUtil.getBundle(Resources.class);
- if (b == null) {
- LOG.info("Running in file text.");
- urls = getResourceFolderFiles(resFolder);
- } else {
- urls = b.findEntries(resFolder, "*", true);
- }
-
- boolean success = true;
- URL srcUrl;
- String srcFilename;
- String dstFilename;
- while (urls.hasMoreElements()) {
- srcUrl = urls.nextElement();
- srcFilename = srcUrl.getFile();
-
- if (srcFilename.endsWith("/")) {
- LOG.debug("Skip directory: {}", srcFilename);
- continue;
- }
-
- LOG.debug("try to copy res {} to {}", srcFilename, dstFolder);
- if (rootDirToRemove != null) {
- srcFilename =
- srcFilename.substring(srcFilename.indexOf(rootDirToRemove) + rootDirToRemove.length() + 1);
- LOG.debug("dstfilename trimmed to {}", srcFilename);
- }
- dstFilename = dstFolder + "/" + srcFilename;
- try {
- if (!extractFileTo(srcUrl, new File(dstFilename))) {
- success = false;
- }
- } catch (Exception e) {
- LOG.warn("problem copying res {} to {}: {}", srcFilename, dstFilename, e.getMessage());
- }
- }
-
- return success;
-
- }
-
- private static Enumeration<URL> getResourceFolderFiles(String folder) {
- LOG.debug("Get resource: {}", folder);
- URL url = getUrlForRessource(folder);
- String path = url.getPath();
- File[] files = new File(path).listFiles();
- Collection<URL> urlCollection = new ArrayList<>();
-
- if (files != null) {
- for (File f : files) {
- try {
- if (f.isDirectory()) {
- urlCollection.addAll(Collections.list(getResourceFolderFiles(folder + "/" + f.getName())));
- } else {
- urlCollection.add(f.toURI().toURL());
- }
- } catch (MalformedURLException e) {
- LOG.error("Can not read ressources", e);
- break;
- }
- }
- }
-
- Enumeration<URL> urls = Collections.enumeration(urlCollection);
- return urls;
- }
-
- private static URL getUrlForRessource(String fileOrDirectory) {
- //ClassLoader loader = Thread.currentThread().getContextClassLoader();
- ClassLoader loader = Resources.class.getClassLoader();
- URL url = loader.getResource(fileOrDirectory);
- return url;
- }
-
- public static boolean extractFileTo(String resFile, File oFile) {
- if (oFile == null) {
- return false;
- }
- LOG.debug("try to copy {} from res to {}", resFile, oFile.getAbsolutePath());
- URL u = getFileURL(resFile);
- if (u == null) {
- LOG.warn("cannot find resfile: {}", resFile);
- return false;
- }
- return extractFileTo(u, oFile);
- }
-
- public static boolean extractFileTo(URL u, File oFile) {
-
- if (oFile.isDirectory()) {
- oFile.mkdirs();
- return true;
- } else {
- oFile.getParentFile().mkdirs();
- }
-
- if (!oFile.exists()) {
- try {
- oFile.createNewFile();
- } catch (IOException e) {
- LOG.warn("problem creating file {}: {}", oFile.getAbsoluteFile(), e.getMessage());
- }
- }
- try (InputStream in = u.openStream(); OutputStream outStream = new FileOutputStream(oFile);) {
-
- int theInt;
- while ((theInt = in.read()) >= 0) {
- outStream.write(theInt);
- }
- in.close();
- outStream.flush();
- outStream.close();
- LOG.debug("file written successfully");
- } catch (IOException e) {
- LOG.error("problem writing file: {}", e.getMessage());
- return false;
- }
- return true;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/NotificationActor.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/NotificationActor.java
deleted file mode 100644
index 7daf7c9c5..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/NotificationActor.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-
-public interface NotificationActor<T> {
-
- public void notificationActor(T item);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/NotificationWorker.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/NotificationWorker.java
deleted file mode 100644
index 9a073e20e..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/NotificationWorker.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.LinkedBlockingQueue;
-
-/**
- * Provide a thread that is receiving and process notifications.
- * @param <T> represents the object that is provided with a notification and
- * forwarded to the NotificationActor<T>.
- *
- * @author herbert
- */
-
-public class NotificationWorker<T> implements AutoCloseable {
-
- private final BlockingQueue<T> workQueue;
- private final ExecutorService service;
- private final NotificationActor<T> actor;
-
- public NotificationWorker(int numWorkers, int workQueueSize, NotificationActor<T> actorObject) {
- workQueue = new LinkedBlockingQueue<T>(workQueueSize);
- service = Executors.newFixedThreadPool(numWorkers);
- actor = actorObject;
-
- for (int i=0; i < numWorkers; i++) {
- service.submit(new Worker<T>(workQueue, actor));
- }
- }
-
- public void put(T item) {
- try {
- workQueue.put(item);
- } catch (InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- }
-
- @Override
- public void close() throws Exception {
- // TODO Auto-generated method stub
- }
-
- private static class Worker<T> implements Runnable {
- private final BlockingQueue<T> workQueue;
- private final NotificationActor<T> actor;
-
-
- public Worker(BlockingQueue<T> workQueue, NotificationActor<T> actor) {
- this.workQueue = workQueue;
- this.actor = actor;
- }
-
- @Override
- public void run() {
- while (!Thread.currentThread().isInterrupted()) {
- try {
- T item = workQueue.take();
- actor.notificationActor(item);
- // Process item
- } catch (InterruptedException ex) {
- Thread.currentThread().interrupt();
- break;
- }
- }
- }
- }
-
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12.java
deleted file mode 100644
index a06e4a601..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-
-import java.util.List;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.GenericTransactionUtils;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter.NotificationDelayService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.ProviderClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service.HtDatabaseEventsService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.NetconfEventListener12;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceService;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.extension.g.Extension;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Get information over NETCONF device according to ONF Coremodel. Read networkelement and
- * conditional packages.
- *
- * Get conditional packages from Networkelement Possible interfaces are: MWPS, LTP(MWPS-TTP),
- * MWAirInterfacePac, MicrowaveModel-ObjectClasses-AirInterface ETH-CTP,LTP(Client),
- * MW_EthernetContainer_Pac MWS, LTP(MWS-CTP-xD), MWAirInterfaceDiversityPac,
- * MicrowaveModel-ObjectClasses-AirInterfaceDiversity MWS, LTP(MWS-TTP),
- * ,MicrowaveModel-ObjectClasses-HybridMwStructure MWS, LTP(MWS-TTP),
- * ,MicrowaveModel-ObjectClasses-PureEthernetStructure
- *
- * @author herbert
- *
- */
-@SuppressWarnings("deprecation")
-public class ONFCoreNetworkElement12 extends ONFCoreNetworkElement12Base
- implements ONFCoreNetworkElementCallback, NotificationActor<AttributeValueChangedNotificationXml> {
-
- private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElement12.class);
-
- /*-----------------------------------------------------------------------------
- * Class members
- */
- private final @Nonnull NetconfEventListener12 netconfEventListener;
- private final NotificationWorker<AttributeValueChangedNotificationXml> notificationQueue;
-
- /*-----------------------------------------------------------------------------
- * Construction
- */
-
- /**
- * Constructor
- *
- * @param mountPointNodeName as String
- * @param capabilities of the specific network element
- * @param netconfNodeDataBroker for the network element specific data
- * @param webSocketService to forward event notifications
- * @param databaseService to access the database
- * @param dcaeProvider to forward problem / change notifications
- */
- ONFCoreNetworkElement12(String mountPointNodeName, Capabilities capabilities,
- DataBroker netconfNodeDataBroker, WebSocketServiceClient webSocketService,
- HtDatabaseEventsService databaseService, ProviderClient dcaeProvider, @Nullable ProviderClient aotsmClient,
- MaintenanceService maintenanceService,
- NotificationDelayService<ProblemNotificationXml> notificationDelayService ) {
-
- super(mountPointNodeName, netconfNodeDataBroker, capabilities);
-
- this.netconfEventListener = new NetconfEventListener12(mountPointNodeName, webSocketService,
- databaseService, dcaeProvider, aotsmClient, maintenanceService, notificationDelayService, this);
- this.notificationQueue = new NotificationWorker<>(1, 100, this);
-
- }
-
-
- /*-----------------------------------------------------------------------------
- * Functions
- */
-
- /**
- * DeviceMonitor Prepare check by updating NE state and reading all interfaces.
- */
- @Override
- public void prepareCheck() {
- synchronized (dmLock) {
- boolean change = readNetworkElementAndInterfaces();
- if (change) {
- int problems = netconfEventListener.removeAllCurrentProblemsOfNode();
- List<ProblemNotificationXml> resultList = readAllCurrentProblemsOfNode();
- netconfEventListener.initCurrentProblemStatus(resultList);
- LOG.info("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountPointNodeName(),
- getUuId(), problems, resultList.size());
- }
- }
- }
-
- // public boolean checkIfConnectionToMediatorIsOk() -> Shifted to super class
- // public boolean checkIfConnectionToNeIsOk() -> Shifted to super class
-
- /*-----------------------------------------------------------------------------
- * Synchronization
- */
-
- // public void initSynchronizationExtension() -> Shifted to super class
- // private InstanceList readPTPClockInstances() -> Shifted to super class
-
- /*-----------------------------------------------------------------------------
- * Services for NE/Device synchronization
- */
-
- /**
- * Handling of specific Notifications from NE, indicating changes and need for synchronization.
- *
- * <attribute-value-changed-notification xmlns="urn:onf:params:xml:ns:yang:microwave-model">
- * <attribute-name>/equipment-pac/equipment-current-problems</attribute-name>
- * <object-id-ref>CARD-1.1.1.0</object-id-ref> <new-value></new-value>
- * </attribute-value-changed-notification>
- * <attribute-value-changed-notification xmlns="urn:onf:params:xml:ns:yang:microwave-model">
- * <attribute-name>/network-element/extension[value-name="top-level-equipment"]/value</attribute-name>
- * <object-id-ref>Hybrid-Z</object-id-ref>
- * <new-value>SHELF-1.1.0.0,IDU-1.55.0.0,ODU-1.56.0.0,IDU-1.65.0.0</new-value>
- * </attribute-value-changed-notification>
- */
-
-
- @Override
- public void notificationFromNeListener(AttributeValueChangedNotificationXml notificationXml) {
- notificationQueue.put(notificationXml);
- }
-
- @Override
- public void notificationActor(AttributeValueChangedNotificationXml notificationXml) {
-
- LOG.debug("Enter change notification listener");
- if (LOG.isTraceEnabled()) {
- LOG.trace("Notification: {}", notificationXml);
- }
- if (notificationXml.getAttributeName().equals("/equipment-pac/equipment-current-problems")) {
- syncEquipmentPac(notificationXml.getObjectId());
- } else if (notificationXml.getAttributeName()
- .equals("/network-element/extension[value-name=\"top-level-equipment\"]/value")) {
- initialReadFromNetworkElement();
- }
- LOG.debug("Leave change notification listener");
- }
-
- /**
- * Synchronize problems for a specific equipment-pac
- *
- * @param uuidString of the equipment-pac
- */
- private synchronized void syncEquipmentPac(String uuidString) {
-
- int problems = netconfEventListener.removeObjectsCurrentProblemsOfNode(uuidString);
- LOG.debug("Removed {} problems for uuid {}", problems, uuidString);
-
- List<ProblemNotificationXml> resultList = getEquipment().addProblemsofNodeObject(uuidString);
- netconfEventListener.initCurrentProblemStatus(resultList);
- LOG.debug("Added {} problems for uuid {}", resultList.size(), uuidString);
-
- }
-
-
- /*-----------------------------------------------------------------------------
- * Problem/Fault related functions
- */
-
- /**
- * Read during startup all relevant structure and status parameters from device
- */
- @Override
- public synchronized void initialReadFromNetworkElement() {
- // optionalNe.getLtp().get(0).getLp();
- LOG.debug("Get info about {}", getMountPointNodeName());
-
- int problems = netconfEventListener.removeAllCurrentProblemsOfNode();
- LOG.debug("Removed all {} problems from database at registration", problems);
-
- // Step 2.1: access data broker within this mount point
- LOG.debug("DBRead start");
-
- // Step 2.2: read ne from data store
- readNetworkElementAndInterfaces();
- getEquipment().readNetworkElementEquipment();
-
- // Step 2.3: read the existing faults and add to DB
- List<ProblemNotificationXml> resultList = readAllCurrentProblemsOfNode();
- getEquipment().addProblemsofNode(resultList);
-
- netconfEventListener.initCurrentProblemStatus(resultList);
-
- netconfEventListener.writeEquipment(getEquipment());
-
- LOG.info("Found info at {} for device {} number of problems: {}", getMountPointNodeName(), getUuId(),
- resultList.size());
- }
-
-
-
-
- /**
- * Read the NetworkElement part from database.
- *
- * @return Optional with NetworkElement or empty
- */
- @Nullable
- private NetworkElement readNetworkElement() {
- // Step 2.2: construct data and the relative iid
- // The schema path to identify an instance is
- // <i>CoreModel-CoreNetworkModule-ObjectClasses/NetworkElement</i>
- // Read to the config data store
- return GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
- NETWORKELEMENT_IID);
- }
-
- /**
- * Read element from class that could be not available
- *
- * @param ltp layer termination point
- * @return List with extension parameters or empty list
- */
- @Nonnull
- private static List<Extension> getExtensionList(@Nullable Lp ltp) {
- if (ltp != null && ltp.getExtension() != null) {
- return ltp.getExtension();
- } else {
- return EMPTYLTPEXTENSIONLIST;
- }
- }
-
- /**
- * Remove all entries from list
- */
- @Override
- public int removeAllCurrentProblemsOfNode() {
- return netconfEventListener.removeAllCurrentProblemsOfNode();
- }
-
-
- @Override
- public void close() throws Exception {
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12Base.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12Base.java
deleted file mode 100644
index 2aa8dd99b..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12Base.java
+++ /dev/null
@@ -1,457 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InventoryInformation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.AllPm;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.GenericTransactionUtils;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperPTPModelRev170208;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.MountPoint;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.InstanceList;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
-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.extension.g.Extension;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.Ltp;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.network.element.pac.NetworkElementCurrentProblems;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * This class contains the ONF Core model Version 1.2 related functions.<br>
- * Provides the basic ONF Core Model function.<br>
- * - initialReadFromNetworkElement is not implemented in child classes.
- */
-@SuppressWarnings("deprecation")
-public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementBase implements ONFCoreNetworkElementCoreData {
-
- private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElement12Base.class);
-
- protected static final List<Extension> EMPTYLTPEXTENSIONLIST = new ArrayList<>();
- // private static final List<Ltp> EMPTYLTPLIST = new ArrayList<>();
-
- protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier
- .builder(NetworkElement.class).build();
-
-
- /*-----------------------------------------------------------------------------
- * Class members
- */
-
- // Non specific part. Used by all functions.
- /** interfaceList is used by PM task and should be synchronized */
- private final @Nonnull List<Lp> interfaceList = Collections.synchronizedList(new CopyOnWriteArrayList<>());
- private @Nullable NetworkElement optionalNe = null;
-
- // Performance monitoring specific part
- /** Lock for the PM access specific elements that could be null */
- private final @Nonnull Object pmLock = new Object();
- protected @Nullable Iterator<Lp> interfaceListIterator = null;
- /** Actual pmLp used during iteration over interfaces */
- protected @Nullable Lp pmLp = null;
-
- // Device monitoring specific part
- /** Lock for the DM access specific elements that could be null */
- protected final @Nonnull Object dmLock = new Object();
-
- protected final boolean isNetworkElementCurrentProblemsSupporting12;
-
- private final ONFCoreNetworkElement12Equipment equipment;
-
- private @Nonnull InventoryInformation inventoryInformation = new InventoryInformation();
-
- /*
- * Constructor
- */
-
- protected ONFCoreNetworkElement12Base(String mountPointNodeName, DataBroker netconfNodeDataBroker,
- Capabilities capabilities) {
- super(mountPointNodeName, netconfNodeDataBroker, capabilities);
- // TODO Auto-generated constructor stub
- this.isNetworkElementCurrentProblemsSupporting12 = capabilities.isSupportingNamespaceAndRevision(NetworkElementPac.QNAME);
- this.equipment = new ONFCoreNetworkElement12Equipment(this, capabilities);
- WrapperPTPModelRev170208.initSynchronizationExtension(mountPointNodeName, netconfNodeDataBroker, capabilities);
- LOG.debug("support necurrent-problem-list=" + this.isNetworkElementCurrentProblemsSupporting12);
- LOG.info("Create NE instance {}", InstanceList.QNAME.getLocalName());
- }
-
- /*---------------------------------------------------------------
- * Getter/ Setter
- */
-
- @Override
- public NetworkElement getOptionalNetworkElement() {
- return optionalNe;
- }
-
- List<Lp> getInterfaceList() {
- return interfaceList;
- }
-
- public Object getPmLock() {
- return pmLock;
- }
-
- public ONFCoreNetworkElement12Equipment getEquipment() {
- return equipment;
- }
-
- /*---------------------------------------------------------------
- * Core model related function
- */
-
- /**
- * Read the NetworkElement part from database.
- *
- * @return Optional with NetworkElement or empty
- */
- @Nullable
- private NetworkElement readNetworkElement() {
- // Step 2.2: construct data and the relative iid
- // The schema path to identify an instance is
- // <i>CoreModel-CoreNetworkModule-ObjectClasses/NetworkElement</i>
- // Read to the config data store
- return GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
- NETWORKELEMENT_IID);
- }
-
- /**
- * Get uuid of Optional NE.
- *
- * @return Uuid or EMPTY String if optionNE is not available
- */
- protected String getUuId() {
- String uuid = EMPTY;
-
- try {
- uuid = optionalNe != null ? optionalNe.getUuid() != null ? optionalNe.getUuid().getValue() : EMPTY : EMPTY;
- } catch (NullPointerException e) {
- // Unfortunately throws null pointer if not definied
- }
- return uuid;
- }
-
- /**
- * Read from NetworkElement and verify LTPs have changed. If the NE has changed, update to the new
- * structure. From initial state it changes also.
- */
- protected synchronized boolean readNetworkElementAndInterfaces() {
-
- LOG.debug("Update mountpoint if changed {}", getMountPointNodeName());
-
- optionalNe = GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
- NETWORKELEMENT_IID);;
- synchronized (pmLock) {
- boolean change = false;
-
- if (optionalNe == null) {
- LOG.debug("Unable to read NE data for mountpoint {}", getMountPointNodeName());
- if (!interfaceList.isEmpty()) {
- interfaceList.clear();
- interfaceListIterator = null;
- change = true;
- }
-
- } else {
- LOG.debug("Mountpoint '{}' NE-Name '{}'", getMountPointNodeName(), optionalNe.getName());
- List<Lp> actualInterfaceList = getLtpList(optionalNe);
- if (!interfaceList.equals(actualInterfaceList)) {
- LOG.debug("Mountpoint '{}' Update LTP List. Elements {}", getMountPointNodeName(),
- actualInterfaceList.size());
- interfaceList.clear();
- interfaceList.addAll(actualInterfaceList);
- interfaceListIterator = null;
- change = true;
- }
- }
- return change;
- }
- }
-
- /**
- * Get List of UUIDs for conditional packages from Networkelement<br>
- * Possible interfaces are:<br>
- * MWPS, LTP(MWPS-TTP), MWAirInterfacePac, MicrowaveModel-ObjectClasses-AirInterface<br>
- * ETH-CTP,LTP(Client), MW_EthernetContainer_Pac<br>
- * MWS, LTP(MWS-CTP-xD), MWAirInterfaceDiversityPac,
- * MicrowaveModel-ObjectClasses-AirInterfaceDiversity<br>
- * MWS, LTP(MWS-TTP), ,MicrowaveModel-ObjectClasses-HybridMwStructure<br>
- * MWS, LTP(MWS-TTP), ,MicrowaveModel-ObjectClasses-PureEthernetStructure<br>
- *
- * @param ne NetworkElement
- * @return Id List, never null.
- */
-
- private static List<Lp> getLtpList(@Nullable NetworkElement ne) {
-
- List<Lp> res = Collections.synchronizedList(new ArrayList<Lp>());
-
- if (ne != null) {
- List<Ltp> ltpRefList = ne.getLtp();
- if (ltpRefList == null) {
- LOG.debug("DBRead NE-Interfaces: null");
- } else {
- for (Ltp ltRefListE : ltpRefList) {
- List<Lp> lpList = ltRefListE.getLp();
- if (lpList == null) {
- LOG.debug("DBRead NE-Interfaces Reference List: null");
- } else {
- for (Lp ltp : lpList) {
- res.add(ltp);
- }
- }
- }
- }
- } else {
- LOG.debug("DBRead NE: null");
- }
-
- // ---- Debug
- if (LOG.isDebugEnabled()) {
- StringBuffer strBuf = new StringBuffer();
- for (Lp ltp : res) {
- if (strBuf.length() > 0) {
- strBuf.append(", ");
- }
- strBuf.append(ltp.getLayerProtocolName().getValue());
- strBuf.append(':');
- strBuf.append(ltp.getUuid().getValue());
- }
- LOG.debug("DBRead NE-Interfaces: {}", strBuf.toString());
- }
- // ---- Debug end
-
- return res;
- }
-
- /**
- * Read current problems of AirInterfaces and EthernetContainer according to NE status into DB
- *
- * @return List with all problems
- */
- protected List<ProblemNotificationXml> readAllCurrentProblemsOfNode() {
-
- // Step 2.3: read the existing faults and add to DB
- List<ProblemNotificationXml> resultList = new ArrayList<>();
- int idxStart; // Start index for debug messages
- UniversalId uuid;
-
- synchronized (pmLock) {
- for (Lp lp : interfaceList) {
-
- idxStart = resultList.size();
- uuid = lp.getUuid();
- ProblemNotificationXml.debugResultList(LOG, uuid.getValue(), resultList, idxStart);
-
- }
- }
-
- // Step 2.4: Read other problems from mountpoint
- if (isNetworkElementCurrentProblemsSupporting12) {
- idxStart = resultList.size();
- readNetworkElementCurrentProblems12(resultList);
- ProblemNotificationXml.debugResultList(LOG, "CurrentProblems12", resultList, idxStart);
- }
-
- return resultList;
-
- }
-
- /**
- * Reading problems for the networkElement V1.2
- * @param resultList
- * @return
- */
- private List<ProblemNotificationXml> readNetworkElementCurrentProblems12(List<ProblemNotificationXml> resultList) {
-
- LOG.info("DBRead Get {} NetworkElementCurrentProblems12", getMountPointNodeName());
-
- InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac> networkElementCurrentProblemsIID =
- InstanceIdentifier.builder(
- org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac.class)
- .build();
-
- // Step 2.3: read to the config data store
- NetworkElementPac problemPac;
- NetworkElementCurrentProblems problems;
- try {
- problemPac = GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
- networkElementCurrentProblemsIID);
- problems = problemPac.getNetworkElementCurrentProblems();
- if (problems == null) {
- LOG.debug("DBRead no NetworkElementCurrentProblems12");
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead empty CurrentProblemList12");
- } else {
- for (org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.network.element.current.problems.g.CurrentProblemList problem : problems
- .getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(getMountPointNodeName(), problem.getObjectReference(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(),
- InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- } catch (Exception e) {
- LOG.warn("DBRead {} NetworkElementCurrentProblems12 not supported. Message '{}' ", getMountPointNodeName(),
- e.getMessage());
- }
- return resultList;
- }
-
- /*---------------------------------------------------------------
- * Device Monitor
- */
-
- @Override
- public boolean checkIfConnectionToMediatorIsOk() {
- synchronized (dmLock) {
- return optionalNe != null;
- }
- }
-
- /*
- * New implementation to interpret status with empty LTP List as notConnected => return false
- * 30.10.2018 Since this behavior is very specific and implicit for specific NE Types
- * it needs to be activated by extension or configuration. Change to be disabled at the moment
- */
- @Override
- public boolean checkIfConnectionToNeIsOk() {
- return true;
- }
-
- /*---------------------------------------------------------------
- * Synchronization
- */
-
-
-
- /*---------------------------------------------------------------
- * Equipment related functions
- */
-
- @Override
- public @Nonnull InventoryInformation getInventoryInformation(String layerProtocolFilter) {
- LOG.debug("request inventory information. filter:" + layerProtocolFilter);
- return this.equipment.getInventoryInformation(getFilteredInterfaceUuidsAsStringList(layerProtocolFilter));
- }
-
- @Override
- public InventoryInformation getInventoryInformation() {
- return getInventoryInformation(null);
- }
-
- protected List<String> getFilteredInterfaceUuidsAsStringList(String layerProtocolFilter) {
- List<String> uuids = new ArrayList<>();
-
- LOG.debug("request inventory information. filter:" + layerProtocolFilter);
- if (optionalNe != null) {
- // uuids
- for (Lp lp : this.interfaceList) {
- if (layerProtocolFilter == null || layerProtocolFilter.isEmpty()) {
- uuids.add(lp.getUuid().getValue());
- } else if (lp.getLayerProtocolName() != null && lp.getLayerProtocolName().getValue() != null
- && lp.getLayerProtocolName().getValue().equals(layerProtocolFilter)) {
- uuids.add(lp.getUuid().getValue());
- }
- }
- }
- LOG.debug("uuids found: {}", uuids);
- return uuids;
- }
-
-
- /*---------------------------------------------------------------
- * Performancemanagement specific interface
- */
-
- @Override
- public void resetPMIterator() {
- synchronized (pmLock) {
- interfaceListIterator = interfaceList.iterator();
- }
- LOG.debug("PM reset iterator");
- }
-
- @Override
- public boolean hasNext() {
- boolean res;
- synchronized (pmLock) {
- res = interfaceListIterator != null ? interfaceListIterator.hasNext() : false;
- }
- LOG.debug("PM hasNext LTP {}", res);
- return res;
- }
-
- @Override
- public void next() {
- synchronized (pmLock) {
- if (interfaceListIterator == null) {
- pmLp = null;
- LOG.debug("PM next LTP null");
- } else {
- pmLp = interfaceListIterator.next();
- LOG.debug("PM next LTP {}", pmLp.getLayerProtocolName().getValue());
- }
- }
- }
-
- @Override
- public String pmStatusToString() {
- StringBuffer res = new StringBuffer();
- synchronized (pmLock) {
- res.append(pmLp == null ? "no interface" : pmLp.getLayerProtocolName().getValue());
- for (Lp lp : getInterfaceList()) {
- res.append("IF:");
- res.append(lp.getLayerProtocolName().getValue());
- res.append(" ");
- }
- }
- return res.toString();
- }
-
- @Override
- public AllPm getHistoricalPM() {
- return AllPm.getEmpty();
- }
-
-
- @Override
- public void doRegisterMicrowaveEventListener(MountPoint mountPoint) {
- //Do nothing
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12Equipment.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12Equipment.java
deleted file mode 100644
index dcce28c35..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12Equipment.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InventoryInformation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ValueNameList;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.GenericTransactionUtils;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.OnfInterfacePac;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperEquipmentPacRev170402;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.equipment.ExtendedEquipment;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.Equipment;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.EquipmentKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
-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.equipment.g.ContainedHolder;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentType;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.ManufacturerProperties;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Contains equipment related information of ONFCore Network Element
- */
-public class ONFCoreNetworkElement12Equipment {
-
- private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElement12Equipment.class);
-
- private static final UniversalId EQUIPMENTROOT = new UniversalId("network-element");
- private static final int EQUIPMENTROOTLEVEL = 0;
- private static final OnfInterfacePac EMPTYEQUIPMENTPAC = (interfacePacUuid, resultList) -> { return(resultList); };
-
- private final ONFCoreNetworkElementCoreData coreData;
- private final OnfInterfacePac equipmentPac;
-
- private final ValueNameList extensionList;
- private final List<UniversalId> topLevelEqUuidList;
- private final List<ProblemNotificationXml> globalProblemList;
- private final List<ExtendedEquipment> globalEquipmentList;
-
- public ONFCoreNetworkElement12Equipment(ONFCoreNetworkElementCoreData coreData, Capabilities capabilities) {
- LOG.debug("Initialize " + ONFCoreNetworkElement12Equipment.class.getName());
- this.coreData = coreData;
- if (capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)) {
- this.equipmentPac = new WrapperEquipmentPacRev170402(coreData);
- LOG.debug("Equipment pac supported {}", WrapperEquipmentPacRev170402.QNAME);
- } else {
- this.equipmentPac = EMPTYEQUIPMENTPAC;
- LOG.debug("Equipment pac not supported {}", WrapperEquipmentPacRev170402.QNAME);
- }
-
- extensionList = new ValueNameList();
- topLevelEqUuidList = new ArrayList<>();
- globalProblemList = new ArrayList<>();
- globalEquipmentList = new ArrayList<>();
-
- initClassVars();
- }
-
- public void addProblemsofNode(List<ProblemNotificationXml> resultList) {
- resultList.addAll(globalProblemList);
- }
-
- public List<ProblemNotificationXml> addProblemsofNodeObject(String uuidString) {
- List<ProblemNotificationXml> res = new ArrayList<>();
-
- if (this.equipmentPac != null) {
- this.equipmentPac.readTheFaults(new UniversalId(uuidString), res);
- }
- return res;
- }
-
- public @Nonnull InventoryInformation getInventoryInformation(List<String> uuids) {
- return getInventoryInformation(this.extensionList, uuids);
- }
-
- protected void readNetworkElementEquipment() {
- doSyncNetworkElementEquipmentToClassVars();
- }
-
- public String getMountpoint() {
- return coreData.getMountpoint();
- }
-
- public OnfInterfacePac getEquipmentPac() {
- return equipmentPac;
- }
-
- public List<UniversalId> getTopLevelEqUuidList() {
- return topLevelEqUuidList;
- }
-
- public List<ExtendedEquipment> getEquipmentList() {
- return globalEquipmentList;
- }
-
- public List<Equipment> getEquipmentAll() {
- List<Equipment> equipmentListAll = new ArrayList<>();
-
- Equipment equipment = readEquipmentAll();
- equipmentListAll.add(equipment);
-
- return equipmentListAll;
- }
-
-
- /*
- * --------------------------------------------------------------------------------- private
- * functions
- */
-
- private void initClassVars() {
- this.globalProblemList.clear();
- this.globalEquipmentList.clear();
- this.extensionList.clear();
- this.topLevelEqUuidList.clear();
- }
-
- private void doSyncNetworkElementEquipmentToClassVars() {
-
- NetworkElement optionalNe = coreData.getOptionalNetworkElement();
- initClassVars();
-
- if (optionalNe != null) {
- // extract Inventory
- extensionList.put(optionalNe.getExtension());
-
- if (!extensionList.isEmpty()) {
-
- /*
- * Loop through network element extension to get "top-level-equipment" <extension>
- * <value-name>top-level-equipment</value-name> <value>1.0.BKP,1.0.WCS</value> </extension> "ipv4"
- * address
- */
- extensionList.getAsUniversalIdList("top-level-equipment", topLevelEqUuidList);
-
- // If top-level-equipment exists get further information
- if (topLevelEqUuidList.isEmpty()) {
- LOG.debug("no top level equipment found");
- } else {
- // Read equipment and problems
- for (UniversalId uuid : topLevelEqUuidList) {
- recurseReadEquipmentProblems(uuid, EQUIPMENTROOT, EQUIPMENTROOTLEVEL, globalProblemList,
- globalEquipmentList);
- }
- }
- } else {
- LOG.debug("extension list is null");
- }
- }
- }
-
- private void recurseReadEquipmentProblems(UniversalId uuid, UniversalId parentUuid, int treeLevel,
- List<ProblemNotificationXml> problemList, List<ExtendedEquipment> equipmentList) {
-
- if (uuid != null) {
-
- Equipment equipment = this.readEquipment(uuid);
-
- if (equipment != null) {
- equipmentList.add(new ExtendedEquipment(parentUuid.getValue(), equipment, treeLevel));
-
- this.equipmentPac.readTheFaults(uuid, problemList);
- List<ContainedHolder> containedHolderListe = equipment.getContainedHolder();
- if (containedHolderListe != null) {
- for (ContainedHolder containedHolder : containedHolderListe) {
- recurseReadEquipmentProblems(containedHolder.getOccupyingFru(), uuid, treeLevel + 1,
- problemList, equipmentList);
- }
- }
- }
- }
- }
-
- private @Nonnull InventoryInformation getInventoryInformation(ValueNameList extensions, List<String> uuids) {
-
- InventoryInformation inventoryInformation = new InventoryInformation();
-
- // uuids
- inventoryInformation.setInterfaceUuidList(uuids);
-
- if (!extensions.isEmpty()) {
-
- inventoryInformation.setDeviceIpv4(extensions.getOrNull("neIpAddress"));
-
- // If top-level-equipment exists get further information
- if (topLevelEqUuidList.isEmpty()) {
- LOG.debug("no top level equipment found");
- } else {
- //
- if (!globalEquipmentList.isEmpty()) {
- Equipment e = globalEquipmentList.get(0).getEquipment();
- if (e.getManufacturedThing() != null) {
- EquipmentType et;
- if ((et = e.getManufacturedThing().getEquipmentType()) != null) {
- inventoryInformation.setType(et.getTypeName());
- inventoryInformation.setModel(et.getModelIdentifier());
- }
- ManufacturerProperties em;
- if ((em = e.getManufacturedThing().getManufacturerProperties()) != null) {
- inventoryInformation.setVendor(em.getManufacturerIdentifier());
- }
- }
- }
- }
- } else {
- LOG.debug("extension list is null");
- }
-
- LOG.debug("Inventory: {}", inventoryInformation);
- return inventoryInformation;
-
- }
-
-
- /**
- * Read equipment information
- *
- * @param interfacePacUuid uuid as key for Equipment.
- * @return Equipment or null
- */
- private @Nullable Equipment readEquipment(UniversalId interfacePacUuid) {
-
- final Class<?> clazzPac = Equipment.class;
-
- LOG.info("DBRead Get equipment for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<Equipment> equipmentIID =
- InstanceIdentifier.builder(Equipment.class, new EquipmentKey(interfacePacUuid)).build();
-
- Equipment res = GenericTransactionUtils.readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
- equipmentIID);
-
- return res;
- }
-
- /**
- * Read equipment information
- *
- * @param interfacePacUuid uuid as key for Equipment.
- * @return Equipment or null
- */
- private @Nullable Equipment readEquipmentAll() {
-
- final Class<?> clazzPac = Equipment.class;
-
- LOG.info("DBRead Get all equipment for class {} from mountpoint {}", clazzPac.getSimpleName(),
- coreData.getMountpoint());
-
- InstanceIdentifier<Equipment> equipmentIID = InstanceIdentifier.builder(Equipment.class).build();
-
- Equipment res = GenericTransactionUtils.readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
- equipmentIID);
-
- return res;
- }
-
- /**
- * specific toString()
- */
- @Override
- public String toString() {
- return "ONFCoreNetworkElement12Equipment [coreData=" + coreData + ", equipmentPac=" + equipmentPac
- + ", extensions=" + extensionList + ", topLevelEqUuidList=" + topLevelEqUuidList + ", problemList="
- + globalProblemList + ", equipmentList=" + globalEquipmentList + "]";
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12Microwave.java
deleted file mode 100644
index d8a052f7f..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElement12Microwave.java
+++ /dev/null
@@ -1,520 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.AllPm;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.GenericTransactionUtils;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.OnfMicrowaveModel;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter.NotificationDelayService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.ProviderClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service.HtDatabaseEventsService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.NetconfEventListener12;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance15Minutes;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance24Hours;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.MountPoint;
-import org.opendaylight.controller.md.sal.binding.api.NotificationService;
-import org.opendaylight.controller.md.sal.common.api.data.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.extension.g.Extension;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.network.element.pac.NetworkElementCurrentProblems;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.NotificationListener;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Optional;
-
-/**
- * Get information over NETCONF device according to ONF Coremodel. Read networkelement and
- * conditional packages.
- *
- * Get conditional packages from Networkelement Possible interfaces are: MWPS, LTP(MWPS-TTP),
- * MWAirInterfacePac, MicrowaveModel-ObjectClasses-AirInterface ETH-CTP,LTP(Client),
- * MW_EthernetContainer_Pac MWS, LTP(MWS-CTP-xD), MWAirInterfaceDiversityPac,
- * MicrowaveModel-ObjectClasses-AirInterfaceDiversity MWS, LTP(MWS-TTP),
- * ,MicrowaveModel-ObjectClasses-HybridMwStructure MWS, LTP(MWS-TTP),
- * ,MicrowaveModel-ObjectClasses-PureEthernetStructure
- *
- * @author herbert
- *
- */
-@SuppressWarnings("deprecation")
-public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Base
- implements ONFCoreNetworkElementCallback, NotificationActor<AttributeValueChangedNotificationXml> {
-
- private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElement12Microwave.class);
-
- /*-----------------------------------------------------------------------------
- * Class members
- */
- private final @Nonnull NetconfEventListener12 microwaveEventListener;
- private final @Nonnull OnfMicrowaveModel microwaveModel;
- private final NotificationWorker<AttributeValueChangedNotificationXml> notificationQueue;
-
- private ListenerRegistration<NotificationListener> listenerRegistrationresult = null;
-
- /*-----------------------------------------------------------------------------
- * Construction
- */
-
- /**
- * Constructor
- *
- * @param mountPointNodeName as String
- * @param capabilities of the specific network element
- * @param netconfNodeDataBroker for the network element specific data
- * @param webSocketService to forward event notifications
- * @param databaseService to access the database
- * @param dcaeProvider to forward problem / change notifications
- */
- ONFCoreNetworkElement12Microwave(String mountPointNodeName, Capabilities capabilities,
- DataBroker netconfNodeDataBroker, WebSocketServiceClient webSocketService,
- HtDatabaseEventsService databaseService, ProviderClient dcaeProvider, @Nullable ProviderClient aotsmClient,
- MaintenanceService maintenanceService,
- NotificationDelayService<ProblemNotificationXml> notificationDelayService,
- OnfMicrowaveModel onfMicrowaveModel) {
-
- super(mountPointNodeName, netconfNodeDataBroker, capabilities);
-
- this.microwaveModel = onfMicrowaveModel;
- this.microwaveModel.setCoreData(this);
-
- // Create MicrowaveService here
- this.microwaveEventListener = new NetconfEventListener12(mountPointNodeName, webSocketService,
- databaseService, dcaeProvider, aotsmClient, maintenanceService, notificationDelayService, this);
- this.microwaveModel.setOnfMicrowaveModelListener(microwaveEventListener);
-
- this.notificationQueue = new NotificationWorker<>(1, 100, this);
-
- // ->Below shifted to super class
- // this.isNetworkElementCurrentProblemsSupporting12 =
- // capabilities.isSupportingNamespaceAndRevision(NetworkElementPac.QNAME);
- // LOG.debug("support necurrent-problem-list=" + this.isNetworkElementCurrentProblemsSupporting12);
- // LOG.info("Create NE instance {}", InstanceList.QNAME.getLocalName());
-
- }
-
- /*-----------------------------------------------------------------------------
- * Functions
- */
-
- /**
- * DeviceMonitor Prepare check by updating NE state and reading all interfaces.
- */
- @Override
- public void prepareCheck() {
- synchronized (dmLock) {
- boolean change = readNetworkElementAndInterfaces();
- if (change) {
- int problems = microwaveEventListener.removeAllCurrentProblemsOfNode();
- List<ProblemNotificationXml> resultList = readAllCurrentProblemsOfNode();
- microwaveEventListener.initCurrentProblemStatus(resultList);
- LOG.info("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountPointNodeName(),
- getUuId(), problems, resultList.size());
- }
- }
- }
-
- // public boolean checkIfConnectionToMediatorIsOk() -> Shifted to super class
- // public boolean checkIfConnectionToNeIsOk() -> Shifted to super class
-
- /*-----------------------------------------------------------------------------
- * Synchronization
- */
-
- // public void initSynchronizationExtension() -> Shifted to super class
- // private InstanceList readPTPClockInstances() -> Shifted to super class
-
- /*-----------------------------------------------------------------------------
- * Services for NE/Device synchronization
- */
-
- /**
- * Handling of specific Notifications from NE, indicating changes and need for synchronization.
- *
- * <attribute-value-changed-notification xmlns="urn:onf:params:xml:ns:yang:microwave-model">
- * <attribute-name>/equipment-pac/equipment-current-problems</attribute-name>
- * <object-id-ref>CARD-1.1.1.0</object-id-ref> <new-value></new-value>
- * </attribute-value-changed-notification>
- * <attribute-value-changed-notification xmlns="urn:onf:params:xml:ns:yang:microwave-model">
- * <attribute-name>/network-element/extension[value-name="top-level-equipment"]/value</attribute-name>
- * <object-id-ref>Hybrid-Z</object-id-ref>
- * <new-value>SHELF-1.1.0.0,IDU-1.55.0.0,ODU-1.56.0.0,IDU-1.65.0.0</new-value>
- * </attribute-value-changed-notification>
- */
-
-
- @Override
- public void notificationFromNeListener(AttributeValueChangedNotificationXml notificationXml) {
- notificationQueue.put(notificationXml);
- }
-
- @Override
- public void notificationActor(AttributeValueChangedNotificationXml notificationXml) {
-
- LOG.debug("Enter change notification listener");
- if (LOG.isTraceEnabled()) {
- LOG.trace("Notification: {}", notificationXml);
- }
- if (notificationXml.getAttributeName().equals("/equipment-pac/equipment-current-problems")) {
- syncEquipmentPac(notificationXml.getObjectId());
- } else if (notificationXml.getAttributeName()
- .equals("/network-element/extension[value-name=\"top-level-equipment\"]/value")) {
- initialReadFromNetworkElement();
- }
- LOG.debug("Leave change notification listener");
- }
-
- /**
- * Synchronize problems for a specific equipment-pac
- *
- * @param uuidString of the equipment-pac
- */
- private synchronized void syncEquipmentPac(String uuidString) {
-
- int problems = microwaveEventListener.removeObjectsCurrentProblemsOfNode(uuidString);
- LOG.debug("Removed {} problems for uuid {}", problems, uuidString);
-
- List<ProblemNotificationXml> resultList = getEquipment().addProblemsofNodeObject(uuidString);
- microwaveEventListener.initCurrentProblemStatus(resultList);
- LOG.debug("Added {} problems for uuid {}", resultList.size(), uuidString);
-
- }
-
-
- /*-----------------------------------------------------------------------------
- * Problem/Fault related functions
- */
-
- /**
- * Read during startup all relevant structure and status parameters from device
- */
- @Override
- public synchronized void initialReadFromNetworkElement() {
- // optionalNe.getLtp().get(0).getLp();
- LOG.debug("Get info about {}", getMountPointNodeName());
-
- int problems = microwaveEventListener.removeAllCurrentProblemsOfNode();
- LOG.debug("Removed all {} problems from database at registration", problems);
-
- // Step 2.1: access data broker within this mount point
- LOG.debug("DBRead start");
-
- // Step 2.2: read ne from data store
- readNetworkElementAndInterfaces();
- getEquipment().readNetworkElementEquipment();
-
- // Step 2.3: read the existing faults and add to DB
- List<ProblemNotificationXml> resultList = readAllCurrentProblemsOfNode();
- getEquipment().addProblemsofNode(resultList);
-
- microwaveEventListener.initCurrentProblemStatus(resultList);
-
- microwaveEventListener.writeEquipment(getEquipment());
-
- LOG.info("Found info at {} for device {} number of problems: {}", getMountPointNodeName(), getUuId(),
- resultList.size());
- }
-
- /**
- * LOG the newly added problems of the interface pac
- *
- * @param idxStart
- * @param uuid
- * @param resultList
- */
- private void debugResultList(String uuid, List<ProblemNotificationXml> resultList, int idxStart) {
- if (LOG.isDebugEnabled()) {
- StringBuffer sb = new StringBuffer();
- int idx = 0;
- for (int t = idxStart; t < resultList.size(); t++) {
- sb.append(idx++);
- sb.append(":{");
- sb.append(resultList.get(t));
- sb.append('}');
- }
- LOG.debug("Found problems {} {}", uuid, sb.toString());
- }
- }
-
- /**
- * Read current problems of AirInterfaces and EthernetContainer according to NE status into DB
- *
- * @return List with all problems
- */
- @Override
- protected List<ProblemNotificationXml> readAllCurrentProblemsOfNode() {
-
- // Step 2.3: read the existing faults and add to DB
- List<ProblemNotificationXml> resultList = new ArrayList<>();
- int idxStart; // Start index for debug messages
- UniversalId uuid;
-
- synchronized (getPmLock()) {
- for (Lp lp : getInterfaceList()) {
-
- idxStart = resultList.size();
- uuid = lp.getUuid();
- Class<?> lpClass = getLpExtension(lp);
-
- ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName());
-
- microwaveModel.readTheFaultsOfMicrowaveModel(lpName, lpClass, uuid, resultList);
-
- debugResultList(uuid.getValue(), resultList, idxStart);
-
- }
- }
-
- // Step 2.4: Read other problems from mountpoint
- if (isNetworkElementCurrentProblemsSupporting12) {
- idxStart = resultList.size();
- readNetworkElementCurrentProblems12(resultList);
- debugResultList("CurrentProblems12", resultList, idxStart);
- }
-
- return resultList;
-
- }
-
- /**
- * Get from LayerProtocolExtensions the related generated ONF Interface PAC class which represents it.
- *
- * @param lp logical termination point
- * @return Class of InterfacePac
- */
- @Nullable
- private Class<?> getLpExtension(@Nullable Lp lp) {
-
- String capability = EMPTY;
- String revision = EMPTY;
- String conditionalPackage = EMPTY;
- Class<?> res = null;
-
- if (lp != null) {
- for (Extension e : getExtensionList(lp)) {
- if (e.getValueName().contentEquals("capability")) {
- capability = e.getValue();
- int idx = capability.indexOf("?");
- if (idx != -1) {
- capability = capability.substring(0, idx);
- }
- }
- if (e.getValueName().contentEquals("revision")) {
- revision = e.getValue();
- }
- if (e.getValueName().contentEquals("conditional-package")) {
- conditionalPackage = e.getValue();
- }
- }
- }
- // QName qName =
- // org.opendaylight.yangtools.yang.common.QName.create("urn:onf:params:xml:ns:yang:microwave-model",
- // "2017-03-24", "mw-air-interface-pac").intern();
- LOG.info("LpExtension capability={} revision={} conditionalPackage={}", capability, revision,
- conditionalPackage);
- if (!capability.isEmpty() && !revision.isEmpty() && !conditionalPackage.isEmpty()) {
- try {
- QName qName = QName.create(capability, revision, conditionalPackage);
- res = this.microwaveModel.getClassForLtpExtension(qName);
- } catch (IllegalArgumentException e) {
- LOG.debug("Can not create QName from ({}{}{}): {}", capability, revision, conditionalPackage,
- e.getMessage());
- }
- }
- return res;
- }
-
- /**
- * Read element from class that could be not available
- *
- * @param ltp layer termination point
- * @return List with extension parameters or empty list
- */
- @Nonnull
- private static List<Extension> getExtensionList(@Nullable Lp ltp) {
- if (ltp != null && ltp.getExtension() != null) {
- return ltp.getExtension();
- } else {
- return EMPTYLTPEXTENSIONLIST;
- }
- }
-
- @Nonnull
- private List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(Lp lp) {
- ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName());
-
- return this.microwaveModel.readTheHistoricalPerformanceData(lpName, lp);
- }
-
- @Override
- public AllPm getHistoricalPM() {
-
- synchronized (getPmLock()) {
- if (pmLp != null) {
- LOG.debug("Enter query PM");
- AllPm allPm = new AllPm();
- Lp lp = pmLp;
-
- List<? extends OtnHistoryDataG> resultList = readTheHistoricalPerformanceData(lp);
- LOG.debug("Got records: {}", resultList.size());
- // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType
- GranularityPeriodType granularityPeriod;
- for (OtnHistoryDataG perf : resultList) {
-
- granularityPeriod = perf.getGranularityPeriod();
- if (granularityPeriod == null) {
- granularityPeriod = GranularityPeriodType.Unknown;
- }
-
- switch (granularityPeriod) {
- case Period15Min: {
- EsHistoricalPerformance15Minutes pm =
- new EsHistoricalPerformance15Minutes(getMountPointNodeName(), lp)
- .setHistoricalRecord15Minutes(perf);
- allPm.add(pm);
- }
- break;
-
- case Period24Hours: {
- EsHistoricalPerformance24Hours pm =
- new EsHistoricalPerformance24Hours(getMountPointNodeName(), lp)
- .setHistoricalRecord24Hours(perf);
- LOG.debug("Write 24h write to DB");
- allPm.add(pm);
- }
- break;
-
- default:
- LOG.warn("Unknown granularity {}", perf.getGranularityPeriod());
- break;
-
- }
- }
- LOG.debug("Deliver normalized records: {}", allPm.size());
- return allPm;
- } else {
- LOG.debug("Deliver empty, no LTP");
- return AllPm.getEmpty();
- }
- }
- }
-
-
- /**
- * Remove all entries from list
- */
- @Override
- public int removeAllCurrentProblemsOfNode() {
- return microwaveEventListener.removeAllCurrentProblemsOfNode();
- }
-
- /**
- * Register the listener
- */
- @Override
- public void doRegisterMicrowaveEventListener(MountPoint mountPoint) {
- LOG.info("End registration listener for Mountpoint {}", mountPoint.getIdentifier().toString());
- final Optional<NotificationService> optionalNotificationService =
- mountPoint.getService(NotificationService.class);
- final NotificationService notificationService = optionalNotificationService.get();
- // notificationService.registerNotificationListener(microwaveEventListener);
- listenerRegistrationresult =
- notificationService.registerNotificationListener(microwaveModel.getNotificationListener());
- LOG.info("End registration listener for Mountpoint {} Listener: {} Result: {}",
- mountPoint.getIdentifier().toString(), optionalNotificationService, listenerRegistrationresult);
- }
-
-
- /*------------------------------------------------------------
- * private function to access database
- */
-
- /*-----------------------------------------------------------------------------
- * Reading problems for the networkElement V1.2
- */
-
- private List<ProblemNotificationXml> readNetworkElementCurrentProblems12(List<ProblemNotificationXml> resultList) {
-
- LOG.info("DBRead Get {} NetworkElementCurrentProblems12", getMountPointNodeName());
-
- InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac> networkElementCurrentProblemsIID =
- InstanceIdentifier.builder(
- org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac.class)
- .build();
-
- // Step 2.3: read to the config data store
- NetworkElementPac problemPac;
- NetworkElementCurrentProblems problems;
- try {
- problemPac = GenericTransactionUtils.readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL,
- networkElementCurrentProblemsIID);
- problems = problemPac.getNetworkElementCurrentProblems();
- if (problems == null) {
- LOG.debug("DBRead no NetworkElementCurrentProblems12");
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead empty CurrentProblemList12");
- } else {
- for (org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.network.element.current.problems.g.CurrentProblemList problem : problems
- .getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(getMountPointNodeName(), problem.getObjectReference(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(),
- InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- } catch (Exception e) {
- LOG.warn("DBRead {} NetworkElementCurrentProblems12 not supported. Message '{}' ", getMountPointNodeName(),
- e.getMessage());
- }
- return resultList;
-
- }
-
- @Override
- public void close() throws Exception {
- if (listenerRegistrationresult != null) {
- listenerRegistrationresult.close();
- }
- }
-
-
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementBase.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementBase.java
deleted file mode 100644
index f6fdb13b6..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementBase.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author herbert
- *
- */
-@SuppressWarnings("deprecation")
-public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCoreNetworkElementRepresentation {
-
- private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElementBase.class);
-
- protected static final String EMPTY = "";
-
- private final String mountPointNodeName;
- private final DataBroker netconfNodeDataBroker;
- private final Capabilities capabilities;
-
- protected ONFCoreNetworkElementBase(String mountPointNodeName, DataBroker netconfNodeDataBroker,
- Capabilities capabilities) {
- LOG.info("Create ONFCoreNetworkElementBase");
- this.mountPointNodeName = mountPointNodeName;
- this.netconfNodeDataBroker = netconfNodeDataBroker;
- this.capabilities = capabilities;
-
- }
-
- @Override
- public String getMountPointNodeName() {
- return mountPointNodeName;
- }
-
- /**
- * @return the netconfNodeDataBroker
- */
- public DataBroker getNetconfNodeDataBroker() {
- return netconfNodeDataBroker;
- }
-
- /**
- * @return the capabilities
- */
- public Capabilities getCapabilities() {
- return capabilities;
- }
-
- /*---------------------------------------------------------------
- * Getter/ Setter
- */
-
- public String getMountpoint() {
- return mountPointNodeName;
- }
-
- public DataBroker getDataBroker() {
- return netconfNodeDataBroker;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementCallback.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementCallback.java
deleted file mode 100644
index e681ee0a0..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementCallback.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
-
-public interface ONFCoreNetworkElementCallback {
-
- public void notificationFromNeListener(AttributeValueChangedNotificationXml notificationXml);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementCoreData.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementCoreData.java
deleted file mode 100644
index d394af7b4..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementCoreData.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-
-import javax.annotation.Nullable;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
-
-@SuppressWarnings("deprecation")
-public interface ONFCoreNetworkElementCoreData {
-
- public String getMountpoint();
- public DataBroker getDataBroker();
- public @Nullable NetworkElement getOptionalNetworkElement();
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementEmpty.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementEmpty.java
deleted file mode 100644
index fe0c144a1..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementEmpty.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InventoryInformation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.AllPm;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.MountPoint;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author herbert
- *
- */
-@SuppressWarnings("deprecation")
-public class ONFCoreNetworkElementEmpty implements ONFCoreNetworkElementRepresentation {
-
- private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElementEmpty.class);
-
- private String mountPointNodeName = "";
-
-
- ONFCoreNetworkElementEmpty(String mountPointNodeName) {
- LOG.info("Create {}",ONFCoreNetworkElementEmpty.class.getSimpleName());
- this.mountPointNodeName = mountPointNodeName;
- }
-
- @Override
- public void initialReadFromNetworkElement() {
- }
-
- @Override
- public String getMountPointNodeName() {
- return mountPointNodeName;
- }
-
- @Override
- public String getMountpoint() {
- return mountPointNodeName;
- }
-
- @Override
- public void resetPMIterator() {
- }
-
- @Override
- public boolean hasNext() {
- return false;
- }
-
- @Override
- public void next() {
- }
-
- @Override
- public AllPm getHistoricalPM() {
- return AllPm.getEmpty();
- }
-
- @Override
- public String pmStatusToString() {
- return this.getClass().getSimpleName();
- }
-
- @Override
- public int removeAllCurrentProblemsOfNode() {
- return 0;
- }
-
- @Override
- public void doRegisterMicrowaveEventListener(MountPoint mointPoint) {
- //Do nothing
- }
-
- @Override
- public void prepareCheck() {
- //Do nothing here
- }
-
- @Override
- public boolean checkIfConnectionToMediatorIsOk() {
- return false;
- }
-
- @Override
- public boolean checkIfConnectionToNeIsOk() {
- return false;
- }
-
- @Override
- public InventoryInformation getInventoryInformation() {
- return InventoryInformation.getDefault();
- }
-
- @Override
- public InventoryInformation getInventoryInformation(String layerProtocolFilter) {
- return InventoryInformation.getDefault();
- }
-
- @Override
- public DataBroker getDataBroker() {
- return null;
- }
-
- @Override
- public NetworkElement getOptionalNetworkElement() {
- return null;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementFactory.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementFactory.java
deleted file mode 100644
index 3455f1681..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementFactory.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-
-import com.google.common.base.Optional;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.OnfMicrowaveModel;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev170324;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev180907;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev181010;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter.NotificationDelayService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.ProviderClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service.HtDatabaseEventsService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceService;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
-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.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Create a Network Element representation according to the capability
- * information. The capabilities are more than an ODL-QName. After the ? other
- * terms than "revision" are provided.
- *
- */
-@SuppressWarnings("deprecation")
-public class ONFCoreNetworkElementFactory {
-
- private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElementFactory.class);
-
- public static @Nonnull ONFCoreNetworkElementRepresentation create(String mountPointNodeName, DataBroker dataBroker,
- WebSocketServiceClient webSocketService, HtDatabaseEventsService databaseService,
- InstanceIdentifier<Node> instanceIdentifier, DataBroker mountpointDataBroker, ProviderClient dcaeProvider,
- @Nullable ProviderClient aotsmClient, MaintenanceService maintenanceService,
- NotificationDelayService<ProblemNotificationXml> notificationDelayService) {
-
- ONFCoreNetworkElementRepresentation res = null;
- try (ReadOnlyTransaction tx = dataBroker.newReadOnlyTransaction();){
- Optional<Node> nodeOption = tx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier).checkedGet();
- if (nodeOption.isPresent()) {
- Node node = nodeOption.get();
- NetconfNode nnode = node.augmentation(NetconfNode.class);
- if (nnode != null) {
- ConnectionStatus csts = nnode.getConnectionStatus();
- if (csts == ConnectionStatus.Connected) {
- Capabilities capabilities = Capabilities.getAvailableCapabilities(nnode);
- LOG.info("Mountpoint {} capabilities {}", mountPointNodeName, capabilities);
- res = build(mountPointNodeName, capabilities, mountpointDataBroker,
- webSocketService, databaseService, dcaeProvider, aotsmClient, maintenanceService,
- notificationDelayService);
- LOG.info("ONFCoreNetworkElementRepresentation12 value is not null? " + (res != null));
- }
- }
- }
- tx.close();
- } catch (ReadFailedException | IllegalArgumentException e) {
- LOG.warn("Can not generate specific NE Version representation. ", e);
- }
- if (res == null) {
- res = new ONFCoreNetworkElementEmpty(mountPointNodeName);
- }
- LOG.info("Mointpoint {} started as {}", mountPointNodeName, res.getClass().getSimpleName());
- return res;
- }
-
- public static @Nonnull ONFCoreNetworkElementRepresentation getEmpty(String mountPointNodeName) {
- return new ONFCoreNetworkElementEmpty(mountPointNodeName);
- }
-
- /**
- * Check capabilities are matching the this specific implementation and create network element
- * representation if so.
- *
- * @param mountPointNodeName as String
- * @param capabilities of the specific network element
- * @param netconfNodeDataBroker for the network element specific data
- * @param webSocketService to forward event notifications
- * @param databaseService to access the database
- * @param dcaeProvider to forward problem / change notifications
- * @return created Object if conditions are OK or null if not.
- */
- private static @Nullable ONFCoreNetworkElementRepresentation build(String mountPointNodeName, Capabilities capabilities,
- DataBroker netconfNodeDataBroker, WebSocketServiceClient webSocketService,
- HtDatabaseEventsService databaseService, ProviderClient dcaeProvider, @Nullable ProviderClient aotsmClient,
- MaintenanceService maintenanceService,
- NotificationDelayService<ProblemNotificationXml> notificationDelayService) {
-
- if (capabilities.isSupportingNamespaceAndRevision(NetworkElement.QNAME)) {
- OnfMicrowaveModel onfMicrowaveModel = null;
-
- if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) {
- onfMicrowaveModel = new WrapperMicrowaveModelRev170324();
- } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) {
- onfMicrowaveModel = new WrapperMicrowaveModelRev180907();
- } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) {
- onfMicrowaveModel = new WrapperMicrowaveModelRev181010();
- }
-
- if (onfMicrowaveModel != null) {
- return new ONFCoreNetworkElement12Microwave(mountPointNodeName, capabilities, netconfNodeDataBroker,
- webSocketService, databaseService, dcaeProvider, aotsmClient, maintenanceService,
- notificationDelayService, onfMicrowaveModel);
- } else {
- return new ONFCoreNetworkElement12(mountPointNodeName, capabilities, netconfNodeDataBroker,
- webSocketService, databaseService, dcaeProvider, aotsmClient, maintenanceService,
- notificationDelayService);
- }
- }
- return null;
-
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementRepresentation.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementRepresentation.java
deleted file mode 100644
index 3e7a9caa7..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/ONFCoreNetworkElementRepresentation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InventoryInformation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitoredNe;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.MicrowaveModelPerformanceDataProvider;
-import org.opendaylight.controller.md.sal.binding.api.MountPoint;
-
-public interface ONFCoreNetworkElementRepresentation
- extends DeviceMonitoredNe, MicrowaveModelPerformanceDataProvider, ONFCoreNetworkElementCoreData {
-
- /**
- * Read during startup all relevant structure and status parameters from device.
- * Remove all currentAlarms, read structure from networkElement with all
- * interfacePacs, read current alarm status
- */
- public void initialReadFromNetworkElement();
-
- public String getMountPointNodeName();
-
- public int removeAllCurrentProblemsOfNode();
-
- public void doRegisterMicrowaveEventListener(MountPoint mountPoint);
-
- public InventoryInformation getInventoryInformation();
-
- public InventoryInformation getInventoryInformation(String layerProtocolFilter);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/AllPm.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/AllPm.java
deleted file mode 100644
index 5c7cd03bd..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/AllPm.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.base.netconf.container;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance15Minutes;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance24Hours;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class AllPm {
-
- private final List<EsHistoricalPerformance15Minutes> pm15 = new ArrayList<>();
- private final List<EsHistoricalPerformance24Hours> pm24 = new ArrayList<>();
-
- public void add(EsHistoricalPerformance15Minutes pm) {
- pm15.add(pm);
- }
-
- public void add(EsHistoricalPerformance24Hours pm) {
- pm24.add(pm);
- }
-
- public List<EsHistoricalPerformance15Minutes> getPm15() {
- return Collections.unmodifiableList(pm15);
- }
-
- public List<EsHistoricalPerformance24Hours> getPm24() {
- return Collections.unmodifiableList(pm24);
- }
-
- public int size() {
- return pm15.size() + pm24.size();
- }
-
- public static AllPm getEmpty() {
- return new AllPm();
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/Capabilities.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/Capabilities.java
deleted file mode 100644
index d64996c65..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/Capabilities.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- * Convert capabilities of netconfnode into internal format. Boron and Carbon are providing
- * different versions
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Optional;
-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.connection.status.AvailableCapabilities;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Wrapper class for capabilites for Boron and later releases. Uses generics because yang model was
- * changed from Boron to later version. Interface class:
- * org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapability
- */
-public class Capabilities {
-
- private static final Logger LOG = LoggerFactory.getLogger(Capabilities.class);
-
- private static final String METHODNAME = "getCapability";
- private final List<String> capabilities = new ArrayList<>();
- private final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
-
- private Capabilities() {}
-
- public static Capabilities getAvailableCapabilities(NetconfNode nnode) {
- LOG.info("GetAvailableCapabilities for node");
- Capabilities capabilities = new Capabilities();
- if (nnode != null) {
- AvailableCapabilities availableCapabilites = nnode.getAvailableCapabilities();
- if (availableCapabilites != null) {
- capabilities.constructor(availableCapabilites.getAvailableCapability());
- } else {
- LOG.debug("empty capabilites");
- }
- } else {
- LOG.debug("No node provided");
- }
- return capabilities;
- }
-
- /**
- * Does all construction steps
- *
- * @param pcapabilities with a list of capabilities. <br>
- * Type could be <br>
- * - Boron: List<code><String></code> <br>
- * - Carbon: List<AvailableCapability>
- */
- private void constructor(List<?> pcapabilities) {
- if (pcapabilities != null) {
- Method methodGetCapability;
-
- for (Object capability : pcapabilities) {
-
- if (capability instanceof String) { // ODL Boron specific
- this.capabilities.add((String) capability);
- } else { // Carbon specific part .. handled via generics
- try {
- methodGetCapability = capability.getClass().getDeclaredMethod(METHODNAME);
- methodGetCapability.setAccessible(true);
- this.capabilities.add(methodGetCapability.invoke(capability).toString());
- } catch (NoSuchMethodException | SecurityException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
- LOG.warn("Capability class with missing interface method {}: {} {} {}", METHODNAME,
- e.getMessage(), capability.getClass(),
- Arrays.toString(capability.getClass().getInterfaces()));
- }
- }
- }
- }
- }
-
- /**
- * check if the namespace and its revision are supported by the given capabilities
- *
- * @param qCapability capability from the model
- * @return true if supporting the model
- */
- public boolean isSupportingNamespaceAndRevision(QName qCapability) {
- String namespace = qCapability.getNamespace().toString();
- String revision;
- Object revisionObject = qCapability.getRevision();
- if (revisionObject instanceof Optional) {
- if (((Optional<?>) revisionObject).isPresent()) {
- revisionObject = ((Optional<?>) revisionObject).get();
- LOG.info("Unwrapp Optional: {}", revisionObject.getClass());
- }
- }
- if (revisionObject instanceof String) {
- revision = (String) revisionObject;
- } else if (revisionObject instanceof Date) {
- revision = formatter.format((Date) revisionObject);
- } else {
- revision = revisionObject.toString();
- LOG.debug("Revision number type not supported. Use toString().String:{} Class:{} ", revisionObject,
- revisionObject.getClass().getName());
- }
- LOG.trace("isSupportingNamespaceAndRevision: Model namespace {}?[revision {}]", namespace, revision);
- for (String capability : capabilities) {
- if (capability.contains(namespace) && capability.contains(revision)) {
- LOG.trace("Verify true with: {}", capability);
- return true;
- } else {
- LOG.trace("Verify false with: {}", capability);
- }
- }
- return false;
- }
-
-
- @Override
- public String toString() {
- return "Capabilities [capabilities=" + capabilities + "]";
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ExtendedAirInterfaceHistoricalPerformanceType12.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ExtendedAirInterfaceHistoricalPerformanceType12.java
deleted file mode 100644
index 470ddab80..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ExtendedAirInterfaceHistoricalPerformanceType12.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.LinkIdentifyingObject;
-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.g._874._1.model.rev170320.GranularityPeriodType;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.ObjectIdentifier;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceConfigurationG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-
-public class ExtendedAirInterfaceHistoricalPerformanceType12 implements OtnHistoryDataG, LinkIdentifyingObject {
-
- private final AirInterfaceHistoricalPerformanceTypeG airInterfaceHistoricalPerformanceType;
- private final AirInterfaceConfigurationG airInterfaceConfiguration;
-
- public ExtendedAirInterfaceHistoricalPerformanceType12(AirInterfaceHistoricalPerformanceTypeG data, AirInterfaceConfigurationG conf) {
- this.airInterfaceHistoricalPerformanceType = data;
- this.airInterfaceConfiguration = conf;
- }
-
-
- public AirInterfaceHistoricalPerformanceTypeG getAirInterfaceHistoricalPerformanceType() {
- return airInterfaceHistoricalPerformanceType;
- }
-
-
- public AirInterfaceConfigurationG getAirInterfaceConfiguration() {
- return airInterfaceConfiguration;
- }
-
-
- @Override
- public Class<? extends DataContainer> getImplementedInterface() {
- return airInterfaceHistoricalPerformanceType.getImplementedInterface();
- }
-
- @Override
- public String getHistoryDataId() {
- return airInterfaceHistoricalPerformanceType.getHistoryDataId();
- }
-
- @Override
- public DateAndTime getPeriodEndTime() {
- return airInterfaceHistoricalPerformanceType.getPeriodEndTime();
- }
-
-
- @Override
- public GranularityPeriodType getGranularityPeriod() {
- return airInterfaceHistoricalPerformanceType.getGranularityPeriod();
- }
-
-
- @Override
- public ObjectIdentifier getObjectClass() {
- return airInterfaceHistoricalPerformanceType.getObjectClass();
- }
-
-
- @Override
- public ObjectIdentifier getNameBinding() {
- return airInterfaceHistoricalPerformanceType.getNameBinding();
- }
-
- @Override
- public Boolean isSuspectIntervalFlag() {
- return airInterfaceHistoricalPerformanceType.isSuspectIntervalFlag();
- }
-
- @Override
- public String getSignalId() {
- return airInterfaceConfiguration.getRadioSignalId();
- }
-
-
- @Override
- public String toString() {
- return "ExtendedAirInterfaceHistoricalPerformanceType [airInterfaceHistoricalPerformanceType="
- + airInterfaceHistoricalPerformanceType + ", airInterfaceConfiguration=" + airInterfaceConfiguration
- + "]";
- }
-
-
-
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ExtendedAirInterfaceHistoricalPerformanceType1211.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ExtendedAirInterfaceHistoricalPerformanceType1211.java
deleted file mode 100644
index 115e20e17..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ExtendedAirInterfaceHistoricalPerformanceType1211.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.LinkIdentifyingObject;
-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.g._874._1.model.rev170320.GranularityPeriodType;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.ObjectIdentifier;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceConfigurationG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceHistoricalPerformanceTypeG;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-
-public class ExtendedAirInterfaceHistoricalPerformanceType1211 implements OtnHistoryDataG, LinkIdentifyingObject {
-
- private final AirInterfaceHistoricalPerformanceTypeG airInterfaceHistoricalPerformanceType;
- private final AirInterfaceConfigurationG airInterfaceConfiguration;
-
- public ExtendedAirInterfaceHistoricalPerformanceType1211(AirInterfaceHistoricalPerformanceTypeG data, AirInterfaceConfigurationG conf) {
- this.airInterfaceHistoricalPerformanceType = data;
- this.airInterfaceConfiguration = conf;
- }
-
-
- public AirInterfaceHistoricalPerformanceTypeG getAirInterfaceHistoricalPerformanceType() {
- return airInterfaceHistoricalPerformanceType;
- }
-
-
- public AirInterfaceConfigurationG getAirInterfaceConfiguration() {
- return airInterfaceConfiguration;
- }
-
-
- @Override
- public Class<? extends DataContainer> getImplementedInterface() {
- return airInterfaceHistoricalPerformanceType.getImplementedInterface();
- }
-
- @Override
- public String getHistoryDataId() {
- return airInterfaceHistoricalPerformanceType.getHistoryDataId();
- }
-
- @Override
- public DateAndTime getPeriodEndTime() {
- return airInterfaceHistoricalPerformanceType.getPeriodEndTime();
- }
-
-
- @Override
- public GranularityPeriodType getGranularityPeriod() {
- return airInterfaceHistoricalPerformanceType.getGranularityPeriod();
- }
-
-
- @Override
- public ObjectIdentifier getObjectClass() {
- return airInterfaceHistoricalPerformanceType.getObjectClass();
- }
-
-
- @Override
- public ObjectIdentifier getNameBinding() {
- return airInterfaceHistoricalPerformanceType.getNameBinding();
- }
-
- @Override
- public Boolean isSuspectIntervalFlag() {
- return airInterfaceHistoricalPerformanceType.isSuspectIntervalFlag();
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public String getSignalId() {
- return airInterfaceConfiguration.getRadioSignalId();
- }
-
-
- @Override
- public String toString() {
- return "ExtendedAirInterfaceHistoricalPerformanceType [airInterfaceHistoricalPerformanceType="
- + airInterfaceHistoricalPerformanceType + ", airInterfaceConfiguration=" + airInterfaceConfiguration
- + "]";
- }
-
-
-
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ExtendedAirInterfaceHistoricalPerformanceType1211p.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ExtendedAirInterfaceHistoricalPerformanceType1211p.java
deleted file mode 100644
index abac75fed..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ExtendedAirInterfaceHistoricalPerformanceType1211p.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.LinkIdentifyingObject;
-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.g._874._1.model.rev170320.GranularityPeriodType;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.ObjectIdentifier;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceConfigurationG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceHistoricalPerformanceTypeG;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-
-public class ExtendedAirInterfaceHistoricalPerformanceType1211p implements OtnHistoryDataG, LinkIdentifyingObject {
-
- private final AirInterfaceHistoricalPerformanceTypeG airInterfaceHistoricalPerformanceType;
- private final AirInterfaceConfigurationG airInterfaceConfiguration;
-
- public ExtendedAirInterfaceHistoricalPerformanceType1211p(AirInterfaceHistoricalPerformanceTypeG data, AirInterfaceConfigurationG conf) {
- this.airInterfaceHistoricalPerformanceType = data;
- this.airInterfaceConfiguration = conf;
- }
-
-
- public AirInterfaceHistoricalPerformanceTypeG getAirInterfaceHistoricalPerformanceType() {
- return airInterfaceHistoricalPerformanceType;
- }
-
-
- public AirInterfaceConfigurationG getAirInterfaceConfiguration() {
- return airInterfaceConfiguration;
- }
-
-
- @Override
- public Class<? extends DataContainer> getImplementedInterface() {
- return airInterfaceHistoricalPerformanceType.getImplementedInterface();
- }
-
- @Override
- public String getHistoryDataId() {
- return airInterfaceHistoricalPerformanceType.getHistoryDataId();
- }
-
- @Override
- public DateAndTime getPeriodEndTime() {
- return airInterfaceHistoricalPerformanceType.getPeriodEndTime();
- }
-
-
- @Override
- public GranularityPeriodType getGranularityPeriod() {
- return airInterfaceHistoricalPerformanceType.getGranularityPeriod();
- }
-
-
- @Override
- public ObjectIdentifier getObjectClass() {
- return airInterfaceHistoricalPerformanceType.getObjectClass();
- }
-
-
- @Override
- public ObjectIdentifier getNameBinding() {
- return airInterfaceHistoricalPerformanceType.getNameBinding();
- }
-
- @Override
- public Boolean isSuspectIntervalFlag() {
- return airInterfaceHistoricalPerformanceType.isSuspectIntervalFlag();
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public String getSignalId() {
- return airInterfaceConfiguration.getRadioSignalId();
- }
-
-
- @Override
- public String toString() {
- return "ExtendedAirInterfaceHistoricalPerformanceType [airInterfaceHistoricalPerformanceType="
- + airInterfaceHistoricalPerformanceType + ", airInterfaceConfiguration=" + airInterfaceConfiguration
- + "]";
- }
-
-
-
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ONFLayerProtocolName.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ONFLayerProtocolName.java
deleted file mode 100644
index 68627a862..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ONFLayerProtocolName.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public enum ONFLayerProtocolName {
-
- MWAirInterface("MWPS"), //V1.0 + V1.2
- EthernetContainer10("ETH-CTP"), //V1.0
- EthernetContainer12("ETC"), //V1.2 + V1.2.1.1
- EthernetPhysical("ETY"), //V1.2
- TDMContainer("TDM"), //V1.2
- Structure("MWS"), //V1.0 + V1.2
- Ethernet("ETH"), //V1.2
- Unknown("");
-
- private static final Logger LOG = LoggerFactory.getLogger(ONFLayerProtocolName.class);
-
- private final String myLayerProtocolName;
-
- ONFLayerProtocolName( String myLayerProtocolName ) {
- this.myLayerProtocolName = myLayerProtocolName;
- }
-
- public boolean is( org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName onfName ) {
- return myLayerProtocolName.equals(onfName.getValue());
- }
-
- public static ONFLayerProtocolName valueOf( org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName onfName ) {
- for (ONFLayerProtocolName protocol : ONFLayerProtocolName.values()) {
- if (protocol.is(onfName)) {
- return protocol;
- }
- }
- LOG.info("Can not map {}. Use Unknown",onfName.getValue() );
- return Unknown;
- }
-
- public String getValue() {
- return myLayerProtocolName;
- }
-
-}
-
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ValueNameList.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ValueNameList.java
deleted file mode 100644
index 1e0156c20..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/ValueNameList.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container;
-
-import java.util.HashMap;
-import java.util.List;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-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.extension.g.Extension;
-
-/**
- * ValueNameList is an access Wrapper to NETCONF Extension lists
- * Class is a specialized HashMap.
- */
-public class ValueNameList extends HashMap<String, String> {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Create ValueNameList for NETCONF extensions
- * @param extensionList Parameters as received from device. Could be null.
- */
- public void put(@Nullable List<Extension> extensionList) {
-
- if (extensionList != null) {
- String name;
- String value;
-
- for (Extension e : extensionList) {
- name = e.getValueName();
- value = e.getValue();
- if (name != null && value != null) {
- put(name, value);
- }
- }
- }
- }
-
- /**
- * Return value or null
- * @param name key for element
- * @return value if key exists; if not nul
- */
- public String getOrNull(String name) {
- return containsKey(name) ? get(name) : null;
- }
-
- /**
- * Get element as id list
- * @param name key of element
- * @param topLevelEqUuidList as input to add elements
- * @return List<UniversalId>
- */
- public @Nonnull List<UniversalId> getAsUniversalIdList(String name, List<UniversalId> topLevelEqUuidList) {
- if (containsKey(name)) {
- String[] result = get(name).split(",\\s*");
- if (result.length > 0) {
- for (String e : result) {
- topLevelEqUuidList.add(new UniversalId(e));
- }
- }
- }
- return topLevelEqUuidList;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/GenericTransactionUtils.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/GenericTransactionUtils.java
deleted file mode 100644
index 1cfe10f08..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/GenericTransactionUtils.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util;
-
-import java.util.NoSuchElementException;
-import java.util.concurrent.CancellationException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-import javax.annotation.Nullable;
-import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
-
-@SuppressWarnings("deprecation")
-public final class GenericTransactionUtils {
- static final Logger LOG = LoggerFactory.getLogger(GenericTransactionUtils.class);
-
- /**
- * Deliver the data back or null. Warning
- *
- * @param <T> SubType of the DataObject to be handled
- * @param dataBroker for accessing data
- * @param dataStoreType to address datastore
- * @param iid id to access data
- * @return null or object
- */
- @Nullable
- public static <T extends DataObject> T readData(DataBroker dataBroker, LogicalDatastoreType dataStoreType,
- InstanceIdentifier<T> iid) {
-
- AtomicBoolean noErrorIndication = new AtomicBoolean();
- AtomicReference<String> statusText = new AtomicReference<>();
-
- T obj = readDataOptionalWithStatus(dataBroker, dataStoreType, iid, noErrorIndication, statusText);
-
- if (!noErrorIndication.get()) {
- LOG.warn("Read transaction for identifier " + iid + " failed with status " + statusText.get());
- }
-
- return obj;
- }
-
- /**
- * Deliver the data back or null
- *
- * @param <T> SubType of the DataObject to be handled
- * @param dataBroker for accessing data
- * @param dataStoreType to address datastore
- * @param iid id to access data
- * @param noErrorIndication (Output) true if data could be read and are available and is not null
- * @param statusIndicator (Output) String with status indications during the read.
- * @return null or object
- */
- @Nullable
- public static <T extends DataObject> T readDataOptionalWithStatus(DataBroker dataBroker,
- LogicalDatastoreType dataStoreType, InstanceIdentifier<T> iid, AtomicBoolean noErrorIndication,
- AtomicReference<String> statusIndicator) {
-
- T data = null;
- noErrorIndication.set(false);
-
- statusIndicator.set("Preconditions");
- Preconditions.checkNotNull(dataBroker);
-
- int retry = 0;
- int retryDelayMilliseconds = 2000;
- int maxRetries = 5; // 0 no Retry
-
- do {
- if (retry > 0) {
- try {
- LOG.debug("Sleep {}ms", retryDelayMilliseconds);
- Thread.sleep(retryDelayMilliseconds);
- } catch (InterruptedException e) {
- LOG.debug("Sleep interrupted", e);
- Thread.currentThread().interrupt();
- }
- }
-
- LOG.debug("Sending message with retry {} ", retry);
- statusIndicator.set("Create Read Transaction");
-
- try (ReadOnlyTransaction readTransaction = dataBroker.newReadOnlyTransaction();) {
- CheckedFuture<Optional<T>, ReadFailedException> od = readTransaction.read(dataStoreType, iid);
- statusIndicator.set("Read done");
- if (od != null) {
- statusIndicator.set("Unwrap checkFuture done");
- Optional<T> optionalData = od.get();
- if (optionalData != null) {
- statusIndicator.set("Unwrap optional done");
- data = optionalData.orNull();
- statusIndicator.set("Read transaction done");
- noErrorIndication.set(true);
- LOG.debug("Read done with no error. Data:[{}]", data);
- }
- }
-
- readTransaction.close();
- } catch (CancellationException | ExecutionException | InterruptedException | NoSuchElementException e) {
- statusIndicator.set(ExceptionUtils.getStackTrace(e));
- if (e instanceof InterruptedException) {
- Thread.currentThread().interrupt();
- }
- }
-
- } while (noErrorIndication.get() == false && retry++ < maxRetries);
-
- return data;
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/LinkIdentifyingObject.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/LinkIdentifyingObject.java
deleted file mode 100644
index 7c4f7e102..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/LinkIdentifyingObject.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util;
-
-public interface LinkIdentifyingObject {
-
- public String getSignalId();
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/NetconfTimeStamp.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/NetconfTimeStamp.java
deleted file mode 100644
index 94913c40e..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/util/NetconfTimeStamp.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util;
-
-import java.text.ParseException;
-import java.time.OffsetDateTime;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.time.format.DateTimeParseException;
-import java.util.Date;
-
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * 2019/06/17 Redesign to ZonedDateTime because of sync problems.
- *
- * Function is handling the NETCONF and the format used by database and restconf communication.
- *
- * Input supported for the formats used in NETCONF messages:
- *
- * Format1 ISO 8601 2017-01-18T11:44:49.482-05:00
- *
- * Format2 NETCONF - pattern from ietf-yang-types "2013-07-15" Pattern:
- * "\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-](\d{2}):(\d{2}))"
- *
- * Format3 NETCONF DateAndTime CoreModel-CoreFoundationModule-TypeDefinitions vom
- * 2016-07-01 Example1: 20170118114449.1Z Example2: 20170118114449.1-0500 Pattern:
- * "\d{4}\d{2}\d{2}\d{2}\d{2}\d{2}.\d+?(Z|[\+\-](\d{2})(\d{2}))" typedef DateAndTime { description
- * "This primitive type defines the date and time according to the following structure:
- * 'yyyyMMddhhmmss.s[Z|{+|-}HHMm]' where: yyyy '0000'..'9999' year MM '01'..'12' month dd '01'..'31'
- * day hh '00'..'23' hour mm '00'..'59' minute ss '00'..'59' second s '.0'..'.9' tenth of second
- * (set to '.0' if EMS or NE cannot support this granularity) Z 'Z' indicates UTC (rather than local
- * time) {+|-} '+' or '-' delta from UTC HH '00'..'23' time zone difference in hours Mm '00'..'59'
- * time zone difference in minutes."; type string; } Format4 E/// specific Example1:
- * 2017-01-23T13:32:38-05:00 Example2: 2017-01-23T13:32-05:00
- *
- * Input formats netconfTime as String according the formats given above
- *
- * Return format is String in ISO8601 Format for database and presentation.
- *
- * Example formats:
- * 1) ISO8601. Example 2017-01-18T11:44:49.482-05:00
- * 2) Microwave ONF. Examples 20170118114449.1Z, 20170118114449.1-0500
- * 3.1) Ericson. Example: 2017-01-23T13:32:38-05:00
- * 3.2) Ericson. Example: 2017-01-23T13:32-05:00
- * Always 10 Groups,
- * 1:Year 2:Month 3:day 4:Hour 5:minute 6:optional sec 7:optional ms 8:optional Z or 9:offset
- * signedhour 10:min
- *
- * Template:
- * private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter();
- */
-
-public class NetconfTimeStamp {
- private static final Logger LOG = LoggerFactory.getLogger(NetconfTimeStamp.class);
-
- private static final NetconfTimeStamp CONVERTER = new NetconfTimeStamp();
-
- /**
- * Specify the input format expected from netconf, and from specific devices.
- */
- private static DateTimeFormatter formatterInput = DateTimeFormatter.ofPattern(""
- + "[yyyy-MM-dd'T'HH:mm[:ss][.SSS][.SS][.S][xxx][xx][X][Z]]"
- + "[yyyyMMddHHmmss[.SSS][.SS][.S][xxx][xx][X][Z]]"
- ).withZone(ZoneOffset.UTC);
-
- /**
- * Specify output format that is used internally
- */
- private static DateTimeFormatter formatterOutput = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.S'Z'")
- .withZone(ZoneOffset.UTC);
-
- /**
- * Use static access
- */
- private NetconfTimeStamp() {
- }
-
- /*
- * ------------------------------------ Public function
- */
-
- /**
- * Use this function to get the converter
- * @return global converter
- */
- public static NetconfTimeStamp getConverter() {
- return CONVERTER;
- }
-
- /**
- * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format
- *
- * @return String with Date in NETCONF/YANG Format Version 1.0.
- */
- public String getTimeStampAsNetconfString() {
- return ZonedDateTime.now(ZoneOffset.UTC).format(formatterOutput);
- }
-
- /**
- * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format
-
- * @return String with Date in NETCONF/YANG Format Version 1.0.
- */
- public String getTimeStampAsNetconfString(Date date) {
- return ZonedDateTime.ofInstant(date.toInstant(),ZoneOffset.UTC).format(formatterOutput);
- }
-
-
-
- /**
- * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format in GMT
- *
- * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0.
- */
- public DateAndTime getTimeStamp() {
- return DateAndTime.getDefaultInstance(getTimeStampAsNetconfString());
- }
-
- /**
- * Get time from date as NETCONF specific type NETCONF/YANG 1.0 Format in GMT
- * @param date specifying the date and time
- * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0.
- */
- public DateAndTime getTimeStamp(Date date) {
- return DateAndTime.getDefaultInstance(getTimeStampAsNetconfString(date));
- }
-
-
- /**
- * Return the String with a NETCONF time converted to long
- *
- * @param netconfTime as String according the formats given above
- * @return Epoch milliseconds
- * @throws IllegalArgumentException In case of no compliant time format definition for the string
- * @throws ParseException Time parsing failed
- */
- public long getTimeStampFromNetconfAsMilliseconds(String netconfTime) throws IllegalArgumentException {
- try {
- long utcMillis = doParse(netconfTime).toInstant().toEpochMilli();
- return utcMillis;
- } catch (DateTimeParseException e) {
- throw new IllegalArgumentException(
- "No pattern for NETCONF data string: " + netconfTime + " Msg:" + e.getMessage());
- }
- }
-
- /**
- * Deliver String result.
- *
- * @param netconfTime as String according the formats given above
- * @return If successful: String in ISO8601 Format for database and presentation. If "wrong formed
- * input" the Input string with the prefix "Maleformed date" is delivered back.
- */
- public String getTimeStampFromNetconf(String netconfTime) {
- try {
- String inputUTC = doParse(netconfTime).format(formatterOutput);
- return inputUTC;
- } catch (Exception e) {
- LOG.info(e.getMessage());
- }
- LOG.debug("No pattern for NETCONF data string: {}", netconfTime);
- return "Malformed date: " + netconfTime; // Error handling
- }
-
- /*----------------------------------------------------
- * Private functions
- */
-
- private OffsetDateTime doParse(String netconfTime) {
- return OffsetDateTime.parse(netconfTime, formatterInput);
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/OnfInterfacePac.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/OnfInterfacePac.java
deleted file mode 100644
index e26d997a0..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/OnfInterfacePac.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc;
-
-import java.util.List;
-
-import javax.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
-
-public interface OnfInterfacePac {
-
- /**
- * Read problems of specific interfaces. TODO Goal for future implementation
- * without usage of explicit new. Key is generated by newInstance() function
- * here to verify this approach.
- *
- * @param interfacePacUuid Universal index of Interfacepac
- * @param resultList List to add fault. If null new list is created.
- * @return list of alarms
- */
- public List<ProblemNotificationXml> readTheFaults(UniversalId interfacePacUuid, @Nullable List<ProblemNotificationXml> resultList);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/OnfMicrowaveModel.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/OnfMicrowaveModel.java
deleted file mode 100644
index d716a01bc..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/OnfMicrowaveModel.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc;
-
-import java.util.List;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementCoreData;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-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;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-import org.opendaylight.yangtools.yang.binding.NotificationListener;
-import org.opendaylight.yangtools.yang.common.QName;
-
-public interface OnfMicrowaveModel {
-
- public void setCoreData(ONFCoreNetworkElementCoreData coreData);
-
- public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
- List<ProblemNotificationXml> resultList);
-
- public List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(ONFLayerProtocolName lpName, Lp lp);
-
- public Class<?> getClassForLtpExtension(QName qName);
-
- public <T extends NotificationListener> T getNotificationListener();
-
- public void setOnfMicrowaveModelListener(OnfMicrowaveModelNotification microwaveModelListener);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/OnfMicrowaveModelNotification.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/OnfMicrowaveModelNotification.java
deleted file mode 100644
index 2c7aead70..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/OnfMicrowaveModelNotification.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-
-/**
- * Abstraction of YANG specified notifications
- * Each method converts from internal specific class to model unspecific class
- * @author herbert
- *
- */
-public interface OnfMicrowaveModelNotification {
-
- void onObjectCreationNotification(ObjectCreationNotificationXml notificationXml);
- void onObjectDeletionNotification(ObjectDeletionNotificationXml notificationXml);
- void onProblemNotification(ProblemNotificationXml notificationXml);
- void onAttributeValueChangedNotification(AttributeValueChangedNotificationXml notificationXml);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperEquipmentPacRev170402.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperEquipmentPacRev170402.java
deleted file mode 100644
index 3ee0c91ad..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperEquipmentPacRev170402.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementCoreData;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.GenericTransactionUtils;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.opendaylight.controller.md.sal.common.api.data.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.onf.core.model.conditional.packages.rev170402.CurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.EquipmentPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.EquipmentPacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.equipment.pac.EquipmentCurrentProblems;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.QName;
-
-public class WrapperEquipmentPacRev170402 implements OnfInterfacePac {
-
- private static final Logger LOG = LoggerFactory.getLogger(WrapperEquipmentPacRev170402.class);
- public static final QName QNAME = EquipmentPac.QNAME;
-
- ONFCoreNetworkElementCoreData coreData;
-
- public WrapperEquipmentPacRev170402(ONFCoreNetworkElementCoreData coreData) {
- this.coreData = coreData;
- }
-
- /**
- * Read problems of specific interfaces. TODO Goal for future implementation without usage of
- * explicit new. Key is generated by newInstance() function here to verify this approach.
- *
- * @param interfacePacUuid Universal index of onf interface-pac
- * @param resultList list to add, or null for new list.
- * @return list of alarms
- */
- @Override
- public List<ProblemNotificationXml> readTheFaults(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<EquipmentPac> clazzPac = EquipmentPac.class;
- final Class<EquipmentPacKey> clazzPacKey = EquipmentPacKey.class;
- final Class<EquipmentCurrentProblems> clazzProblems = EquipmentCurrentProblems.class;
- // final Class<ContainerCurrentProblemTypeG> clazzProblem =
- // ContainerCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- try {
- if (resultList == null) {
- resultList = new ArrayList<>();
- }
- // -- Specific part 1
- Constructor<EquipmentPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
- InstanceIdentifier<EquipmentCurrentProblems> interfaceIID = InstanceIdentifier
- .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
-
- // -- Specific part 2
- EquipmentCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, interfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no {}", interfacePacUuid, clazzProblems, clazzProblems.getName());
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} no list {}", interfacePacUuid, clazzProblems.getName());
- } else {
- // -- Specific part 3
- for (CurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(),
- InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
- LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
- }
- return resultList;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperMicrowaveModelRev170324.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperMicrowaveModelRev170324.java
deleted file mode 100644
index 32fb095b4..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperMicrowaveModelRev170324.java
+++ /dev/null
@@ -1,597 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc;
-
-
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementCoreData;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ExtendedAirInterfaceHistoricalPerformanceType12;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.GenericTransactionUtils;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.opendaylight.controller.md.sal.common.api.data.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;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceCurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceDiversityCurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AttributeValueChangedNotification;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerCurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerHistoricalPerformanceTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MicrowaveModelListener;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectCreationNotification;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectDeletionNotification;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ProblemNotification;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.StructureCurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfiguration;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.tdm.container.pac.TdmContainerCurrentProblems;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.NotificationListener;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, MicrowaveModelListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev170324.class);
-
- public static final QName QNAME = MwAirInterfacePac.QNAME;
-
-
- private ONFCoreNetworkElementCoreData coreData;
- private OnfMicrowaveModelNotification microwaveModelListener;
-
- /*-----------------------------------------------------------------------------
- * Setter/Getter
- */
-
- @Override
- public void setCoreData(ONFCoreNetworkElementCoreData coreData) {
- this.coreData = coreData;
- }
-
- public ONFCoreNetworkElementCoreData getCoreData() {
- return coreData;
- }
-
- @Override
- public void setOnfMicrowaveModelListener(OnfMicrowaveModelNotification microwaveModelListener) {
- this.microwaveModelListener = microwaveModelListener;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T extends NotificationListener> T getNotificationListener() {
- return (T)this;
- }
-
- /*-----------------------------------------------------------------------------
- * Interfacefunctions
- */
-
- @Override
- public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
- List<ProblemNotificationXml> resultList) {
-
- switch (lpName) {
- case MWAirInterface:
- readTheFaultsOfMwAirInterfacePac(uuid, resultList);
- break;
-
- case EthernetContainer12:
- readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
- break;
-
- case TDMContainer:
- readTheFaultsOfMwTdmContainerPac(uuid, resultList);
- break;
-
- case Structure:
- if (lpClass == MwHybridMwStructurePac.class) {
- readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
-
- } else if (lpClass == MwAirInterfaceDiversityPac.class) {
- readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
-
- } else if (lpClass == MwPureEthernetStructurePac.class) {
- readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
-
- } else {
- LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
- }
- break;
- case Ethernet:
- // No alarms supported
- break;
- case EthernetContainer10:
- default:
- LOG.warn("Unassigned or not expected lp in model {}", lpName);
- }
- }
-
- @Override
- public List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(ONFLayerProtocolName lpName, Lp lp) {
- switch (lpName) {
- case MWAirInterface:
- return readTheHistoricalPerformanceDataOfMwAirInterfacePac(lp);
-
- case EthernetContainer12:
- return readTheHistoricalPerformanceDataOfEthernetContainer(lp);
-
- case EthernetContainer10:
- case EthernetPhysical:
- case Ethernet:
- case TDMContainer:
- case Structure:
- case Unknown:
- LOG.debug("Do not read HistoricalPM data for {} {}", lpName, lp.getUuid().getValue());
- break;
- }
- return new ArrayList<>();
- }
-
- @Override
- public Class<?> getClassForLtpExtension(QName qName) {
- Class<?> res = null;
- if (qName.equals(MwAirInterfacePac.QNAME)) {
- res = MwAirInterfacePac.class;
- } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
- res = MwAirInterfaceDiversityPac.class;
- } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
- res = MwPureEthernetStructurePac.class;
- } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
- res = MwHybridMwStructurePac.class;
- } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
- res = MwEthernetContainerPac.class;
- } else if (qName.equals(MwTdmContainerPac.QNAME)) {
- res = MwTdmContainerPac.class;
- }
- LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
- return res;
- }
-
- /*-----------------------------------------------------------------------------
- * Reading problems for specific interface pacs
- */
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal Id String of the interface
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
- // final Class<MwAirInterfacePacKey> clazzPacKey = MwAirInterfacePacKey.class;
- // final Class<AirInterfaceCurrentProblems> clazzProblems =
- // AirInterfaceCurrentProblems.class;
- // final Class<AirInterfaceCurrentProblemTypeG> clazzProblem =
- // AirInterfaceCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- // Step 2.2: construct data and the relative iid
- InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = InstanceIdentifier
- .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
- .child(AirInterfaceCurrentProblems.class).build();
-
- // Step 2.3: read to the config data store
- AirInterfaceCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
-
- if (problems == null) {
- LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
- } else {
- for (AirInterfaceCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
- // final Class<MwEthernetContainerPacKey> clazzPacKey =
- // MwEthernetContainerPacKey.class;
- // final Class<EthernetContainerCurrentProblems> clazzProblems =
- // EthernetContainerCurrentProblems.class;
- // final Class<ContainerCurrentProblemTypeG> clazzProblem =
- // ContainerCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
- .child(EthernetContainerCurrentProblems.class).build();
-
- EthernetContainerCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
- } else {
- for (ContainerCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
- // final Class<MwAirInterfaceDiversityPacKey> clazzPacKey =
- // MwAirInterfaceDiversityPacKey.class;
- final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
- // final Class<AirInterfaceDiversityCurrentProblemTypeG> clazzProblem =
- // AirInterfaceDiversityCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
-
- AirInterfaceDiversityCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
- } else {
- for (AirInterfaceDiversityCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
- // final Class<MwPureEthernetStructurePacKey> clazzPacKey =
- // MwPureEthernetStructurePacKey.class;
- final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
- // final Class<StructureCurrentProblemTypeG> clazzProblem =
- // StructureCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
-
- PureEthernetStructureCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
- } else {
- for (StructureCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
- // final Class<MwHybridMwStructurePacKey> clazzPacKey =
- // MwHybridMwStructurePacKey.class;
- final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
- // final Class<HybridMwStructureCurrentProblemsG> clazzProblem =
- // HybridMwStructureCurrentProblemsG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
-
- HybridMwStructureCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
- } else {
- for (StructureCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces. TODO Goal for future implementation
- * without usage of explicit new. Key is generated by newInstance() function
- * here to verify this approach.
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- * @throws SecurityException
- * @throws NoSuchMethodException
- * @throws InvocationTargetException
- * @throws IllegalArgumentException
- * @throws IllegalAccessException
- * @throws InstantiationException
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
- final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
- final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
- // final Class<ContainerCurrentProblemTypeG> clazzProblem =
- // ContainerCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- try {
- // -- Specific part 1
- Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
- InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
-
- // -- Specific part 2
- TdmContainerCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
- } else {
- // -- Specific part 3
- for (ContainerCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(),
- InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
- LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
- }
- return resultList;
- }
-
- /*-----------------------------------------------------------------------------
- * Performance related data
- */
-
- /**
- * PM MwAirInterfacePac
- *
- * @param lp
- * @return
- */
- private List<ExtendedAirInterfaceHistoricalPerformanceType12> readTheHistoricalPerformanceDataOfMwAirInterfacePac(
- Lp lp) {
-
- String uuId = lp.getUuid().getValue();
-
- List<ExtendedAirInterfaceHistoricalPerformanceType12> resultList = new ArrayList<>();
- LOG.debug("DBRead Get {} MWAirInterfacePac: {}", coreData.getMountpoint(), uuId);
- // ----
- UniversalId mwAirInterfacePacuuId = new UniversalId(uuId);
- // Step 2.1: construct data and the relative iid
- InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier
- .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
- .child(AirInterfaceConfiguration.class).build();
- AirInterfaceConfiguration airConfiguration = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
-
- if (airConfiguration == null) {
- LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
-
- } else {
- // Step 2.2: construct data and the relative iid
- InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier
- .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
- .child(AirInterfaceHistoricalPerformances.class).build();
-
- // Step 2.3: read to the config data store
- AirInterfaceHistoricalPerformances airHistoricalPerformanceData = GenericTransactionUtils.readData(
- coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
-
- if (airHistoricalPerformanceData == null) {
- LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
- mwAirInterfacePacuuId);
- } else {
- // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
- List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData
- .getHistoricalPerformanceDataList();
- LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
- airHistPMList.size());
- if (airHistPMList != null) {
- for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistoricalPerformanceData
- .getHistoricalPerformanceDataList()) {
- resultList.add(new ExtendedAirInterfaceHistoricalPerformanceType12(pmRecord, airConfiguration));
- }
- }
- }
- }
- LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, resultList.size());
- return resultList;
- }
-
- private List<ContainerHistoricalPerformanceTypeG> readTheHistoricalPerformanceDataOfEthernetContainer(Lp lp) {
-
- final String myName = "MWEthernetContainerPac";
- String uuId = lp.getUuid().getValue();
-
- List<ContainerHistoricalPerformanceTypeG> resultList = new ArrayList<>();
- LOG.debug("DBRead Get {} : {}", coreData.getMountpoint(), myName, uuId);
- // ----
- UniversalId ethContainerPacuuId = new UniversalId(uuId);
- // Step 2.2: construct data and the relative iid
- InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
- .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
- .child(EthernetContainerHistoricalPerformances.class).build();
-
- // Step 2.3: read to the config data store
- EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = GenericTransactionUtils
- .readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
-
- if (ethContainerHistoricalPerformanceData == null) {
- LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
- } else {
- // import
- // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.ethernet.container.historical.performances.g.HistoricalPerformanceDataList
- // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList
- List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData
- .getHistoricalPerformanceDataList();
- LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
- if (airHistPMList != null) {
- for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
- resultList.add(pmRecord);
- }
- }
- }
- LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, resultList.size());
- return resultList;
- }
-
- @Override
- public void onObjectCreationNotification(ObjectCreationNotification notification) {
- LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
-
- ObjectCreationNotificationXml notificationXml = new ObjectCreationNotificationXml(coreData.getMountpoint(),
- notification.getCounter().toString(),
- InternalDateAndTime.valueOf(notification.getTimeStamp()),
- notification.getObjectIdRef().getValue());
- microwaveModelListener.onObjectCreationNotification(notificationXml);
- }
-
- @Override
- public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
- LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
-
- ObjectDeletionNotificationXml notificationXml = new ObjectDeletionNotificationXml(coreData.getMountpoint(),
- notification.getCounter().toString(),
- InternalDateAndTime.valueOf(notification.getTimeStamp()),
- notification.getObjectIdRef().getValue()
- );
- microwaveModelListener.onObjectDeletionNotification(notificationXml);
- }
-
- @Override
- public void onProblemNotification(ProblemNotification notification) {
-
- LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
-
- ProblemNotificationXml notificationXml = new ProblemNotificationXml(coreData.getMountpoint(), notification.getObjectIdRef().getValue(),
- notification.getProblem(), InternalSeverity.valueOf(notification.getSeverity()),
- notification.getCounter().toString(), InternalDateAndTime.valueOf(notification.getTimeStamp()));
-
- microwaveModelListener.onProblemNotification(notificationXml);
- }
-
- @Override
- public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
- LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
-
- AttributeValueChangedNotificationXml notificationXml = new AttributeValueChangedNotificationXml(coreData.getMountpoint(),
- String.valueOf(notification.getCounter()), InternalDateAndTime.valueOf(notification.getTimeStamp()),
- notification.getObjectIdRef().getValue(), notification.getAttributeName(), notification.getNewValue());
-
- microwaveModelListener.onAttributeValueChangedNotification(notificationXml);
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperMicrowaveModelRev180907.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperMicrowaveModelRev180907.java
deleted file mode 100644
index 27583f8ac..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperMicrowaveModelRev180907.java
+++ /dev/null
@@ -1,600 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc;
-
-
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.NotificationListener;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementCoreData;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ExtendedAirInterfaceHistoricalPerformanceType1211;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.GenericTransactionUtils;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-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.rev180907.AirInterfaceCurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceDiversityCurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceHistoricalPerformanceTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerCurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerHistoricalPerformanceTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MicrowaveModelListener;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.StructureCurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceConfiguration;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
-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.onf.params.xml.ns.yang.microwave.model.rev180907.AttributeValueChangedNotification;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ObjectCreationNotification;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ObjectDeletionNotification;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ProblemNotification;
-
-
-public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, MicrowaveModelListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev180907.class);
-
- public static final QName QNAME = MwAirInterfacePac.QNAME;
-
-
- private ONFCoreNetworkElementCoreData coreData;
-
- private OnfMicrowaveModelNotification microwaveModelListener;
-
-
- /*-----------------------------------------------------------------------------
- * Setter/Getter
- */
-
- @Override
- public void setCoreData(ONFCoreNetworkElementCoreData coreData) {
- this.coreData = coreData;
- }
-
- public ONFCoreNetworkElementCoreData getCoreData() {
- return coreData;
- }
-
- @Override
- public void setOnfMicrowaveModelListener(OnfMicrowaveModelNotification microwaveModelListener) {
- this.microwaveModelListener = microwaveModelListener;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T extends NotificationListener> T getNotificationListener() {
- return (T) this;
- }
-
- /*-----------------------------------------------------------------------------
- * Interfacefunctions
- */
-
- @Override
- public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
- List<ProblemNotificationXml> resultList) {
-
- switch (lpName) {
- case MWAirInterface:
- readTheFaultsOfMwAirInterfacePac(uuid, resultList);
- break;
-
- case EthernetContainer12:
- readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
- break;
-
- case TDMContainer:
- readTheFaultsOfMwTdmContainerPac(uuid, resultList);
- break;
-
- case Structure:
- if (lpClass == MwHybridMwStructurePac.class) {
- readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
-
- } else if (lpClass == MwAirInterfaceDiversityPac.class) {
- readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
-
- } else if (lpClass == MwPureEthernetStructurePac.class) {
- readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
-
- } else {
- LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
- }
- break;
- case Ethernet:
- // No alarms supported
- break;
- case EthernetContainer10:
- default:
- LOG.warn("Unassigned or not expected lp in model {}", lpName);
- }
- }
-
- @Override
- public List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(ONFLayerProtocolName lpName, Lp lp) {
- switch (lpName) {
- case MWAirInterface:
- return readTheHistoricalPerformanceDataOfMwAirInterfacePac(lp);
-
- case EthernetContainer12:
- return readTheHistoricalPerformanceDataOfEthernetContainer(lp);
-
- case EthernetContainer10:
- case EthernetPhysical:
- case Ethernet:
- case TDMContainer:
- case Structure:
- case Unknown:
- LOG.debug("Do not read HistoricalPM data for {} {}", lpName, lp.getUuid().getValue());
- break;
- }
- return new ArrayList<>();
- }
-
- @Override
- public Class<?> getClassForLtpExtension(QName qName) {
- Class<?> res = null;
- if (qName.equals(MwAirInterfacePac.QNAME)) {
- res = MwAirInterfacePac.class;
- } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
- res = MwAirInterfaceDiversityPac.class;
- } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
- res = MwPureEthernetStructurePac.class;
- } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
- res = MwHybridMwStructurePac.class;
- } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
- res = MwEthernetContainerPac.class;
- } else if (qName.equals(MwTdmContainerPac.QNAME)) {
- res = MwTdmContainerPac.class;
- }
- LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
- return res;
- }
-
- /*-----------------------------------------------------------------------------
- * Reading problems for specific interface pacs
- */
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal Id String of the interface
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
- // final Class<MwAirInterfacePacKey> clazzPacKey = MwAirInterfacePacKey.class;
- // final Class<AirInterfaceCurrentProblems> clazzProblems =
- // AirInterfaceCurrentProblems.class;
- // final Class<AirInterfaceCurrentProblemTypeG> clazzProblem =
- // AirInterfaceCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- // Step 2.2: construct data and the relative iid
- InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = InstanceIdentifier
- .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
- .child(AirInterfaceCurrentProblems.class).build();
-
- // Step 2.3: read to the config data store
- AirInterfaceCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
-
- if (problems == null) {
- LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
- } else {
- for (AirInterfaceCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
- // final Class<MwEthernetContainerPacKey> clazzPacKey =
- // MwEthernetContainerPacKey.class;
- // final Class<EthernetContainerCurrentProblems> clazzProblems =
- // EthernetContainerCurrentProblems.class;
- // final Class<ContainerCurrentProblemTypeG> clazzProblem =
- // ContainerCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
- .child(EthernetContainerCurrentProblems.class).build();
-
- EthernetContainerCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
- } else {
- for (ContainerCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
- // final Class<MwAirInterfaceDiversityPacKey> clazzPacKey =
- // MwAirInterfaceDiversityPacKey.class;
- final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
- // final Class<AirInterfaceDiversityCurrentProblemTypeG> clazzProblem =
- // AirInterfaceDiversityCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
-
- AirInterfaceDiversityCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
- } else {
- for (AirInterfaceDiversityCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
- // final Class<MwPureEthernetStructurePacKey> clazzPacKey =
- // MwPureEthernetStructurePacKey.class;
- final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
- // final Class<StructureCurrentProblemTypeG> clazzProblem =
- // StructureCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
-
- PureEthernetStructureCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
- } else {
- for (StructureCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
- // final Class<MwHybridMwStructurePacKey> clazzPacKey =
- // MwHybridMwStructurePacKey.class;
- final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
- // final Class<HybridMwStructureCurrentProblemsG> clazzProblem =
- // HybridMwStructureCurrentProblemsG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
-
- HybridMwStructureCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
- } else {
- for (StructureCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces. TODO Goal for future implementation
- * without usage of explicit new. Key is generated by newInstance() function
- * here to verify this approach.
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- * @throws SecurityException
- * @throws NoSuchMethodException
- * @throws InvocationTargetException
- * @throws IllegalArgumentException
- * @throws IllegalAccessException
- * @throws InstantiationException
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
- final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
- final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
- // final Class<ContainerCurrentProblemTypeG> clazzProblem =
- // ContainerCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- try {
- // -- Specific part 1
- Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
- InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
-
- // -- Specific part 2
- TdmContainerCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
- } else {
- // -- Specific part 3
- for (ContainerCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(),
- InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
- LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
- }
- return resultList;
- }
-
- /*-----------------------------------------------------------------------------
- * Performance related data
- */
-
- /**
- * PM MwAirInterfacePac
- *
- * @param lp
- * @return
- */
- private List<ExtendedAirInterfaceHistoricalPerformanceType1211> readTheHistoricalPerformanceDataOfMwAirInterfacePac(
- Lp lp) {
-
- String uuId = lp.getUuid().getValue();
-
- List<ExtendedAirInterfaceHistoricalPerformanceType1211> resultList = new ArrayList<>();
- LOG.debug("DBRead Get {} MWAirInterfacePac: {}", coreData.getMountpoint(), uuId);
- // ----
- UniversalId mwAirInterfacePacuuId = new UniversalId(uuId);
- // Step 2.1: construct data and the relative iid
- InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier
- .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
- .child(AirInterfaceConfiguration.class).build();
- AirInterfaceConfiguration airConfiguration = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
-
- if (airConfiguration == null) {
- LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
-
- } else {
- // Step 2.2: construct data and the relative iid
- InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier
- .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
- .child(AirInterfaceHistoricalPerformances.class).build();
-
- // Step 2.3: read to the config data store
- AirInterfaceHistoricalPerformances airHistoricalPerformanceData = GenericTransactionUtils.readData(
- coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
-
- if (airHistoricalPerformanceData == null) {
- LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
- mwAirInterfacePacuuId);
- } else {
- // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
- List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData
- .getHistoricalPerformanceDataList();
- LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
- airHistPMList.size());
- if (airHistPMList != null) {
- for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistoricalPerformanceData
- .getHistoricalPerformanceDataList()) {
- resultList.add(new ExtendedAirInterfaceHistoricalPerformanceType1211(pmRecord, airConfiguration));
- }
- }
- }
- }
- LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, resultList.size());
- return resultList;
- }
-
- private List<ContainerHistoricalPerformanceTypeG> readTheHistoricalPerformanceDataOfEthernetContainer(Lp lp) {
-
- final String myName = "MWEthernetContainerPac";
- String uuId = lp.getUuid().getValue();
-
- List<ContainerHistoricalPerformanceTypeG> resultList = new ArrayList<>();
- LOG.debug("DBRead Get {} : {}", coreData.getMountpoint(), myName, uuId);
- // ----
- UniversalId ethContainerPacuuId = new UniversalId(uuId);
- // Step 2.2: construct data and the relative iid
- InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
- .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
- .child(EthernetContainerHistoricalPerformances.class).build();
-
- // Step 2.3: read to the config data store
- EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = GenericTransactionUtils
- .readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
-
- if (ethContainerHistoricalPerformanceData == null) {
- LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
- } else {
- // import
- // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.ethernet.container.historical.performances.g.HistoricalPerformanceDataList
- List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData
- .getHistoricalPerformanceDataList();
- LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
- if (airHistPMList != null) {
- for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
- resultList.add(pmRecord);
- }
- }
- }
- LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, resultList.size());
- return resultList;
- }
-
- @Override
- public void onObjectCreationNotification(ObjectCreationNotification notification) {
- LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
-
- ObjectCreationNotificationXml notificationXml = new ObjectCreationNotificationXml(coreData.getMountpoint(),
- notification.getCounter().toString(),
- InternalDateAndTime.valueOf(notification.getTimeStamp()),
- notification.getObjectIdRef().getValue());
- microwaveModelListener.onObjectCreationNotification(notificationXml);
- }
-
- @Override
- public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
- LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
-
- ObjectDeletionNotificationXml notificationXml = new ObjectDeletionNotificationXml(coreData.getMountpoint(),
- notification.getCounter().toString(),
- InternalDateAndTime.valueOf(notification.getTimeStamp()),
- notification.getObjectIdRef().getValue()
- );
- microwaveModelListener.onObjectDeletionNotification(notificationXml);
- }
-
- @Override
- public void onProblemNotification(ProblemNotification notification) {
-
- LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
-
- ProblemNotificationXml notificationXml = new ProblemNotificationXml(coreData.getMountpoint(), notification.getObjectIdRef().getValue(),
- notification.getProblem(), InternalSeverity.valueOf(notification.getSeverity()),
- notification.getCounter().toString(), InternalDateAndTime.valueOf(notification.getTimeStamp()));
-
- microwaveModelListener.onProblemNotification(notificationXml);
- }
-
- @Override
- public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
- LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
-
- AttributeValueChangedNotificationXml notificationXml = new AttributeValueChangedNotificationXml(coreData.getMountpoint(),
- String.valueOf(notification.getCounter()), InternalDateAndTime.valueOf(notification.getTimeStamp()),
- notification.getObjectIdRef().getValue(), notification.getAttributeName(), notification.getNewValue());
-
- microwaveModelListener.onAttributeValueChangedNotification(notificationXml);
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperMicrowaveModelRev181010.java
deleted file mode 100644
index 86358072e..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperMicrowaveModelRev181010.java
+++ /dev/null
@@ -1,599 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc;
-
-
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.NotificationListener;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementCoreData;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ExtendedAirInterfaceHistoricalPerformanceType1211p;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.GenericTransactionUtils;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-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.AirInterfaceCurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceDiversityCurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceHistoricalPerformanceTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerCurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerHistoricalPerformanceTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MicrowaveModelListener;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPac;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPacKey;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.StructureCurrentProblemTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceConfiguration;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceHistoricalPerformances;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerHistoricalPerformances;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems;
-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.onf.params.xml.ns.yang.microwave.model.rev181010.AttributeValueChangedNotification;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ObjectCreationNotification;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ObjectDeletionNotification;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotification;
-
-
-public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, MicrowaveModelListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(WrapperMicrowaveModelRev181010.class);
-
- public static final QName QNAME = MwAirInterfacePac.QNAME;
-
-
- private ONFCoreNetworkElementCoreData coreData;
-
- private OnfMicrowaveModelNotification microwaveModelListener;
-
- /*-----------------------------------------------------------------------------
- * Setter/Getter
- */
-
- @Override
- public void setCoreData(ONFCoreNetworkElementCoreData coreData) {
- this.coreData = coreData;
- }
-
- public ONFCoreNetworkElementCoreData getCoreData() {
- return coreData;
- }
-
- @Override
- public void setOnfMicrowaveModelListener(OnfMicrowaveModelNotification microwaveModelListener) {
- this.microwaveModelListener = microwaveModelListener;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T extends NotificationListener> T getNotificationListener() {
- return (T) this;
- }
-
- /*-----------------------------------------------------------------------------
- * Interfacefunctions
- */
-
- @Override
- public void readTheFaultsOfMicrowaveModel(ONFLayerProtocolName lpName, Class<?> lpClass, UniversalId uuid,
- List<ProblemNotificationXml> resultList) {
-
- switch (lpName) {
- case MWAirInterface:
- readTheFaultsOfMwAirInterfacePac(uuid, resultList);
- break;
-
- case EthernetContainer12:
- readTheFaultsOfMwEthernetContainerPac(uuid, resultList);
- break;
-
- case TDMContainer:
- readTheFaultsOfMwTdmContainerPac(uuid, resultList);
- break;
-
- case Structure:
- if (lpClass == MwHybridMwStructurePac.class) {
- readTheFaultsOfMwHybridMwStructurePac(uuid, resultList);
-
- } else if (lpClass == MwAirInterfaceDiversityPac.class) {
- readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList);
-
- } else if (lpClass == MwPureEthernetStructurePac.class) {
- readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList);
-
- } else {
- LOG.warn("Unassigned lp model {} class {}", lpName, lpClass);
- }
- break;
- case Ethernet:
- // No alarms supported
- break;
- case EthernetContainer10:
- default:
- LOG.warn("Unassigned or not expected lp in model {}", lpName);
- }
- }
-
- @Override
- public List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(ONFLayerProtocolName lpName, Lp lp) {
- switch (lpName) {
- case MWAirInterface:
- return readTheHistoricalPerformanceDataOfMwAirInterfacePac(lp);
-
- case EthernetContainer12:
- return readTheHistoricalPerformanceDataOfEthernetContainer(lp);
-
- case EthernetContainer10:
- case EthernetPhysical:
- case Ethernet:
- case TDMContainer:
- case Structure:
- case Unknown:
- LOG.debug("Do not read HistoricalPM data for {} {}", lpName, lp.getUuid().getValue());
- break;
- }
- return new ArrayList<>();
- }
-
- @Override
- public Class<?> getClassForLtpExtension(QName qName) {
- Class<?> res = null;
- if (qName.equals(MwAirInterfacePac.QNAME)) {
- res = MwAirInterfacePac.class;
- } else if (qName.equals(MwAirInterfaceDiversityPac.QNAME)) {
- res = MwAirInterfaceDiversityPac.class;
- } else if (qName.equals(MwPureEthernetStructurePac.QNAME)) {
- res = MwPureEthernetStructurePac.class;
- } else if (qName.equals(MwHybridMwStructurePac.QNAME)) {
- res = MwHybridMwStructurePac.class;
- } else if (qName.equals(MwEthernetContainerPac.QNAME)) {
- res = MwEthernetContainerPac.class;
- } else if (qName.equals(MwTdmContainerPac.QNAME)) {
- res = MwTdmContainerPac.class;
- }
- LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res));
- return res;
- }
-
- /*-----------------------------------------------------------------------------
- * Reading problems for specific interface pacs
- */
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal Id String of the interface
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class;
- // final Class<MwAirInterfacePacKey> clazzPacKey = MwAirInterfacePacKey.class;
- // final Class<AirInterfaceCurrentProblems> clazzProblems =
- // AirInterfaceCurrentProblems.class;
- // final Class<AirInterfaceCurrentProblemTypeG> clazzProblem =
- // AirInterfaceCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- // Step 2.2: construct data and the relative iid
- InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = InstanceIdentifier
- .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid))
- .child(AirInterfaceCurrentProblems.class).build();
-
- // Step 2.3: read to the config data store
- AirInterfaceCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID);
-
- if (problems == null) {
- LOG.debug("DBRead Id {} no AirInterfaceCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
- } else {
- for (AirInterfaceCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class;
- // final Class<MwEthernetContainerPacKey> clazzPacKey =
- // MwEthernetContainerPacKey.class;
- // final Class<EthernetContainerCurrentProblems> clazzProblems =
- // EthernetContainerCurrentProblems.class;
- // final Class<ContainerCurrentProblemTypeG> clazzProblem =
- // ContainerCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(interfacePacUuid))
- .child(EthernetContainerCurrentProblems.class).build();
-
- EthernetContainerCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no EthernetContainerCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
- } else {
- for (ContainerCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class;
- // final Class<MwAirInterfaceDiversityPacKey> clazzPacKey =
- // MwAirInterfaceDiversityPacKey.class;
- final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class;
- // final Class<AirInterfaceDiversityCurrentProblemTypeG> clazzProblem =
- // AirInterfaceDiversityCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(clazzPac, new MwAirInterfaceDiversityPacKey(interfacePacUuid)).child(clazzProblems).build();
-
- AirInterfaceDiversityCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no AirInterfaceDiversityCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemList", interfacePacUuid);
- } else {
- for (AirInterfaceDiversityCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class;
- // final Class<MwPureEthernetStructurePacKey> clazzPacKey =
- // MwPureEthernetStructurePacKey.class;
- final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class;
- // final Class<StructureCurrentProblemTypeG> clazzProblem =
- // StructureCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(clazzPac, new MwPureEthernetStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
-
- PureEthernetStructureCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no PureEthernetStructureCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
- } else {
- for (StructureCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class;
- // final Class<MwHybridMwStructurePacKey> clazzPacKey =
- // MwHybridMwStructurePacKey.class;
- final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class;
- // final Class<HybridMwStructureCurrentProblemsG> clazzProblem =
- // HybridMwStructureCurrentProblemsG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(clazzPac, new MwHybridMwStructurePacKey(interfacePacUuid)).child(clazzProblems).build();
-
- HybridMwStructureCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no HybridMwStructureCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
- } else {
- for (StructureCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(), InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- return resultList;
- }
-
- /**
- * Read problems of specific interfaces. TODO Goal for future implementation
- * without usage of explicit new. Key is generated by newInstance() function
- * here to verify this approach.
- *
- * @param uuId Universal index of Interfacepac
- * @return number of alarms
- * @throws SecurityException
- * @throws NoSuchMethodException
- * @throws InvocationTargetException
- * @throws IllegalArgumentException
- * @throws IllegalAccessException
- * @throws InstantiationException
- */
- private List<ProblemNotificationXml> readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid,
- List<ProblemNotificationXml> resultList) {
-
- final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class;
- final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class;
- final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class;
- // final Class<ContainerCurrentProblemTypeG> clazzProblem =
- // ContainerCurrentProblemTypeG.class;
-
- LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
- coreData.getMountpoint(), interfacePacUuid.getValue());
-
- try {
- // -- Specific part 1
- Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new()
- InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier
- .builder(clazzPac, cons.newInstance(interfacePacUuid)).child(clazzProblems).build();
-
- // -- Specific part 2
- TdmContainerCurrentProblems problems = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID);
- if (problems == null) {
- LOG.debug("DBRead Id {} no TdmContainerCurrentProblems", interfacePacUuid);
- } else if (problems.getCurrentProblemList() == null) {
- LOG.debug("DBRead Id {} empty CurrentProblemsList", interfacePacUuid);
- } else {
- // -- Specific part 3
- for (ContainerCurrentProblemTypeG problem : problems.getCurrentProblemList()) {
- resultList.add(new ProblemNotificationXml(coreData.getMountpoint(), interfacePacUuid.getValue(),
- problem.getProblemName(), InternalSeverity.valueOf(problem.getProblemSeverity()),
- problem.getSequenceNumber().toString(),
- InternalDateAndTime.valueOf(problem.getTimeStamp())));
- }
- }
- } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
- LOG.warn("Could not reade instance of MwTdmContainerPacKey: ", e);
- }
- return resultList;
- }
-
- /*-----------------------------------------------------------------------------
- * Performance related data
- */
-
- /**
- * PM MwAirInterfacePac
- *
- * @param lp
- * @return
- */
- private List<ExtendedAirInterfaceHistoricalPerformanceType1211p> readTheHistoricalPerformanceDataOfMwAirInterfacePac(
- Lp lp) {
-
- String uuId = lp.getUuid().getValue();
-
- List<ExtendedAirInterfaceHistoricalPerformanceType1211p> resultList = new ArrayList<>();
- LOG.debug("DBRead Get {} MWAirInterfacePac: {}", coreData.getMountpoint(), uuId);
- // ----
- UniversalId mwAirInterfacePacuuId = new UniversalId(uuId);
- // Step 2.1: construct data and the relative iid
- InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier
- .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
- .child(AirInterfaceConfiguration.class).build();
- AirInterfaceConfiguration airConfiguration = GenericTransactionUtils.readData(coreData.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID);
-
- if (airConfiguration == null) {
- LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId);
-
- } else {
- // Step 2.2: construct data and the relative iid
- InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier
- .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId))
- .child(AirInterfaceHistoricalPerformances.class).build();
-
- // Step 2.3: read to the config data store
- AirInterfaceHistoricalPerformances airHistoricalPerformanceData = GenericTransactionUtils.readData(
- coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID);
-
- if (airHistoricalPerformanceData == null) {
- LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances",
- mwAirInterfacePacuuId);
- } else {
- // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList
- List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData
- .getHistoricalPerformanceDataList();
- LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId,
- airHistPMList.size());
- if (airHistPMList != null) {
- for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistoricalPerformanceData
- .getHistoricalPerformanceDataList()) {
- resultList.add(new ExtendedAirInterfaceHistoricalPerformanceType1211p(pmRecord, airConfiguration));
- }
- }
- }
- }
- LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, resultList.size());
- return resultList;
- }
-
- private List<ContainerHistoricalPerformanceTypeG> readTheHistoricalPerformanceDataOfEthernetContainer(Lp lp) {
-
- final String myName = "MWEthernetContainerPac";
- String uuId = lp.getUuid().getValue();
-
- List<ContainerHistoricalPerformanceTypeG> resultList = new ArrayList<>();
- LOG.debug("DBRead Get {} : {}", coreData.getMountpoint(), myName, uuId);
- // ----
- UniversalId ethContainerPacuuId = new UniversalId(uuId);
- // Step 2.2: construct data and the relative iid
- InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier
- .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId))
- .child(EthernetContainerHistoricalPerformances.class).build();
-
- // Step 2.3: read to the config data store
- EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = GenericTransactionUtils
- .readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID);
-
- if (ethContainerHistoricalPerformanceData == null) {
- LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId);
- } else {
- // import
- // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.ethernet.container.historical.performances.g.HistoricalPerformanceDataList
- List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData
- .getHistoricalPerformanceDataList();
- LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size());
- if (airHistPMList != null) {
- for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) {
- resultList.add(pmRecord);
- }
- }
- }
- LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, resultList.size());
- return resultList;
- }
-
- @Override
- public void onObjectCreationNotification(ObjectCreationNotification notification) {
- LOG.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
-
- ObjectCreationNotificationXml notificationXml = new ObjectCreationNotificationXml(coreData.getMountpoint(),
- notification.getCounter().toString(),
- InternalDateAndTime.valueOf(notification.getTimeStamp()),
- notification.getObjectIdRef().getValue());
- microwaveModelListener.onObjectCreationNotification(notificationXml);
- }
-
- @Override
- public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
- LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
-
- ObjectDeletionNotificationXml notificationXml = new ObjectDeletionNotificationXml(coreData.getMountpoint(),
- notification.getCounter().toString(),
- InternalDateAndTime.valueOf(notification.getTimeStamp()),
- notification.getObjectIdRef().getValue()
- );
- microwaveModelListener.onObjectDeletionNotification(notificationXml);
- }
-
- @Override
- public void onProblemNotification(ProblemNotification notification) {
-
- LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
-
- ProblemNotificationXml notificationXml = new ProblemNotificationXml(coreData.getMountpoint(), notification.getObjectIdRef().getValue(),
- notification.getProblem(), InternalSeverity.valueOf(notification.getSeverity()),
- notification.getCounter().toString(), InternalDateAndTime.valueOf(notification.getTimeStamp()));
-
- microwaveModelListener.onProblemNotification(notificationXml);
- }
-
- @Override
- public void onAttributeValueChangedNotification(AttributeValueChangedNotification notification) {
- LOG.debug("Got event of type :: {}", AttributeValueChangedNotification.class.getSimpleName());
-
- AttributeValueChangedNotificationXml notificationXml = new AttributeValueChangedNotificationXml(coreData.getMountpoint(),
- String.valueOf(notification.getCounter()), InternalDateAndTime.valueOf(notification.getTimeStamp()),
- notification.getObjectIdRef().getValue(), notification.getAttributeName(), notification.getNewValue());
-
- microwaveModelListener.onAttributeValueChangedNotification(notificationXml);
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperPTPModelRev170208.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperPTPModelRev170208.java
deleted file mode 100644
index d02ca12fb..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/wrapperc/WrapperPTPModelRev170208.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc;
-
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.GenericTransactionUtils;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.InstanceList;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.InstanceListKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.instance.list.PortDsList;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ptp.dataset.rev170208.port.ds.entry.PortIdentity;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Reading PTP specific information from networkelement and creating log-trace output.
- *
- * @author herbert
- */
-@SuppressWarnings("deprecation")
-public class WrapperPTPModelRev170208 {
-
- private static final Logger LOG = LoggerFactory.getLogger(WrapperPTPModelRev170208.class);
-
- protected static final InstanceIdentifier<InstanceList> PTPINSTANCES_IID = InstanceIdentifier
- .builder(InstanceList.class, new InstanceListKey(1)).build();
-
- /**
- * Query synchronization information out of NE
- */
-
- public static void initSynchronizationExtension(String mountPointNodeName, DataBroker netconfNodeDataBroker,
- Capabilities capabilities) {
- try {
- if (!capabilities.isSupportingNamespaceAndRevision(InstanceList.QNAME)) {
- LOG.debug("Mountpoint {} does not support PTP", mountPointNodeName);
- } else {
- StringBuffer sb = new StringBuffer();
- sb.append("NE ");
- sb.append(mountPointNodeName);
- sb.append(" does support synchronisation.\n");
- InstanceList ptpInstance = readPTPClockInstances(netconfNodeDataBroker);
- if (ptpInstance != null) {
- List<PortDsList> dsList = ptpInstance.getPortDsList();
- if (dsList != null) {
- int t = 0;
- for (PortDsList portDs : ptpInstance.getPortDsList()) {
- PortIdentity portId = portDs.getPortIdentity();
- if (portId != null) {
- sb.append("Port[");
- sb.append(portId.getPortNumber());
- sb.append("]{ ClockId: ");
- sb.append(portId.getClockIdentity());
- sb.append(", Portstate: ");
- sb.append(portDs.getPortState());
- sb.append("}, ");
- } else {
- sb.append("Incomplete port #" + t + ", ");
- }
- t++;
- }
- } else {
- sb.append("dsList contains null");
- }
- } else {
- sb.append("ptpInstance equals null");
- }
- LOG.trace(sb.toString());
- }
- } catch (Exception e) {
- LOG.info("Inconsistent synchronisation structure: " + e.getMessage());
- }
- }
-
- @Nullable
- private static InstanceList readPTPClockInstances(DataBroker netconfNodeDataBroker) {
- return GenericTransactionUtils.readData(netconfNodeDataBroker, LogicalDatastoreType.OPERATIONAL,
- PTPINSTANCES_IID);
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayFilter.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayFilter.java
deleted file mode 100644
index fecdd3b53..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayFilter.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter;
-
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NotificationDelayFilter<T> implements AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(NotificationDelayFilter.class);
-
- private final ConcurrentHashMap <String, NotificationWithServerTimeStamp<T>> problemItems;
-// private final HashMap<String, NotificationWithServerTimeStamp<T>> nonProblemItems;
- private final NotificationDelayedListener<T> timeoutListener;
-
- private static long delay;
- private static boolean enabled;
-
- public static void setDelay(long l) {
- NotificationDelayFilter.delay = l;
- }
-
- public static long getDelay() {
- return NotificationDelayFilter.delay;
- }
-
- public static boolean isEnabled() {
- return NotificationDelayFilter.enabled;
- }
-
- public static void setEnabled(boolean enabled) {
- NotificationDelayFilter.enabled = enabled;
- }
-
- private final ScheduledExecutorService scheduler;
- private final Runnable timerRunner = () -> onTick();
-
- private final String nodeName;
-
- public NotificationDelayFilter(String nodeName, NotificationDelayedListener<T> timeoutListener) {
- this.nodeName = nodeName;
- this.timeoutListener = timeoutListener;
- this.problemItems = new ConcurrentHashMap <>();
- this.scheduler = Executors.newScheduledThreadPool(1);
- this.startTimer();
- }
-
- /**
- * Push notification with a specific severity (everything except non-alarmed)
- * @param problemName key
- * @param notification related notification
- */
- public void pushAlarmNotification(String problemName, T notification) {
- synchronized (problemItems) {
-
- boolean cp = this.problemItems.containsKey(problemName);
- if (!cp) {
- // no alarm in entries => create entry and push the alarm currently
- NotificationWithServerTimeStamp<T> item = new NotificationWithServerTimeStamp<>(
- notification);
- LOG.debug("add event into list for node " + this.nodeName + " for alarm " + problemName + ": "
- + item.toString());
- this.problemItems.put(problemName, item);
- if (this.timeoutListener != null) {
- this.timeoutListener.onNotificationDelay(notification);
- }
- } else {
- LOG.debug("clear contra event for node " + this.nodeName + " for alarm " + problemName);
- this.problemItems.get(problemName).clrContraEvent();
- }
-
- }
- }
-
- /**
- * Push notification with severity non-alarmed
- * @param problemName key
- * @param notification related notification
- */
- public void clearAlarmNotification(String problemName, T notification) {
- synchronized (problemItems) {
-
- boolean cp = this.problemItems.containsKey(problemName);
- if (cp) {
- LOG.debug("set contra event for alarm " + problemName);
- this.problemItems.get(problemName).setContraEvent(notification);
- } else {
- // not in list => push directly through
- if (this.timeoutListener != null) {
- this.timeoutListener.onNotificationDelay(notification);
- }
- }
- }
- }
-
- private void startTimer() {
- scheduler.scheduleAtFixedRate(timerRunner, 0, 1, TimeUnit.SECONDS);
- }
-
- private void stopTimer() {
- scheduler.shutdown();
- }
-
- /**
- * check for clearing item out of the list
- */
- private void onTick() {
- long now = System.currentTimeMillis();
- try {
-
- synchronized (problemItems) {
-
- for (Entry<String, NotificationWithServerTimeStamp<T>> entry : problemItems
- .entrySet()) {
- NotificationWithServerTimeStamp<T> value = entry.getValue();
- if (value.isStable(now)) {
- // send contra Alarm if exists
- if (value.getContraAlarmNotification() != null) {
- if (this.timeoutListener != null) {
- this.timeoutListener.onNotificationDelay(value.getContraAlarmNotification());
- }
- }
- problemItems.remove(entry.getKey());
- LOG.debug("removing entry for "+this.nodeName+" for alarm " + entry.getKey());
- } else {
- LOG.trace("currently state is still unstable for alarm " + entry.getKey());
- }
- }
-
- }
- } catch (Exception e) {
- //Prevent stopping the task
- LOG.warn("Exception during NotificationDelayFilter Task", e);
- }
- }
-
- @Override
- public void close() throws Exception {
- this.stopTimer();
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayService.java
deleted file mode 100644
index 8ef302afa..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayService.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter;
-
-import java.util.HashMap;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.ToggleAlarmConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NotificationDelayService<T> implements AutoCloseable, IConfigChangedListener {
- private static final Logger LOG = LoggerFactory.getLogger(NotificationDelayService.class);
-
- private final HashMap<String, NotificationDelayFilter<T>> filters;
-
- public NotificationDelayFilter<T> getInstance(String nodeName, NotificationDelayedListener<T> eventListener) {
- NotificationDelayFilter<T> filter = filters.getOrDefault(nodeName, null);
-
- LOG.trace("nodeName={}, filter!=null? {}", nodeName, filter != null);
- if (filter == null) {
- filter = new NotificationDelayFilter<>(nodeName, eventListener);
- this.filters.put(nodeName, filter);
- }
- return filter;
- }
-
- public NotificationDelayService(HtDevicemanagerConfiguration htconfig) {
- this.filters = new HashMap<>();
- htconfig.registerConfigChangedListener(this);
- NotificationDelayFilter.setDelay(htconfig.getToggleAlarm().getDelay());
- NotificationDelayFilter.setEnabled(htconfig.getToggleAlarm().isEnabled());
- }
-
- @Override
- public void onConfigChanged() {
- ToggleAlarmConfig cfg = ToggleAlarmConfig.reload();
- NotificationDelayFilter.setDelay(cfg.getDelay());
- NotificationDelayFilter.setEnabled(cfg.isEnabled());
- }
-
- @Override
- public void close() throws Exception {
- // close all filters
- for (NotificationDelayFilter<T> filter : this.filters.values()) {
- filter.close();
- }
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayedListener.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayedListener.java
deleted file mode 100644
index 04276c999..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayedListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter;
-
-public interface NotificationDelayedListener<T> {
-
- public void onNotificationDelay(T notification);
-
-}
-
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationWithServerTimeStamp.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationWithServerTimeStamp.java
deleted file mode 100644
index 6631cbedf..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationWithServerTimeStamp.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter;
-
-public class NotificationWithServerTimeStamp<T2> {
- private final T2 alarmNotification;
- private T2 contraAlarmNotification;
- private final long timestampStart;
- private long timestamp;
-
- public NotificationWithServerTimeStamp(T2 n) {
- this(n, System.currentTimeMillis());
- }
-
- public NotificationWithServerTimeStamp(T2 n, long ts) {
- this.alarmNotification = n;
- this.contraAlarmNotification = null;
- this.timestamp = ts;
- this.timestampStart=ts;
- }
-
- @SuppressWarnings("unused")
- public long getStartTime() {
- return this.timestampStart;
- }
- public void refresh() {
- this.refresh(System.currentTimeMillis());
- }
-
- public void refresh(long ts) {
- this.timestamp = ts;
- }
-
- public void setContraEvent(T2 notification) {
- this.contraAlarmNotification = notification;
- this.refresh();
- }
-
- public void clrContraEvent() {
- this.contraAlarmNotification = null;
- this.refresh();
- }
-
- public boolean isStable(long now) {
- return this.timestamp + NotificationDelayFilter.getDelay() < now;
- }
-
- @SuppressWarnings("unused")
- public T2 getAlarmNotification() {
- return this.alarmNotification;
- }
-
- public T2 getContraAlarmNotification() {
- return this.contraAlarmNotification;
- }
-
- @Override
- public String toString() {
- return "NotificationWithServerTimeStamp [alarmNotification=" + alarmNotification
- + ", contraAlarmNotification=" + contraAlarmNotification + ", timestampStart=" + timestampStart
- + ", timestamp=" + timestamp + "]";
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/BaseSubConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/BaseSubConfig.java
deleted file mode 100644
index 88dde506c..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/BaseSubConfig.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile.ConversionException;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile.Section;
-
-public class BaseSubConfig {
-
- private final Section subconfig;
- private final ISubConfigHandler configHandler;
- private final IniConfigurationFile config;
-
- protected Section getSubConfig() {
- return this.subconfig;
- }
- protected ISubConfigHandler getConfigHandler() {
- return this.configHandler;
- }
- protected IniConfigurationFile getConfig() {
- return this.config;
- }
- public BaseSubConfig()
- {
- this.config=null;
- this.subconfig=null;
- this.configHandler=null;
- }
- public BaseSubConfig(IniConfigurationFile config, ISubConfigHandler configHandler,String section) {
- this.config = config;
- this.subconfig = config.subset(section);
- this.configHandler = configHandler;
- }
- protected boolean hasKey(String key)
- {
- if(this.subconfig==null) {
- return false;
- }
- return this.subconfig.hasKey(key);
- }
- protected String getString(String key,String def)
- {
- if(this.subconfig==null) {
- return def;
- }
- String s;
- //try
- {
- s=this.subconfig.getString(key, def);
- if(s.isEmpty()) {
- s=def;
- }
- }
- /*catch(ConversionException e)
- {
- s=def;
- }
- */
- return s;
- }
- protected boolean getBoolean(String key, boolean def) {
- if(this.subconfig==null) {
- return def;
- }
- boolean s;
- try {
- s=this.subconfig.getBoolean(key, def);
- }
- catch(ConversionException e)
- {
- s=def;
- }
- return s;
- }
- protected int getInt(String key, int def) {
- if(this.subconfig==null) {
- return def;
- }
- int s;
- try {
- s=this.subconfig.getInt(key, def);
- }
- catch(ConversionException e)
- {
- s=def;
- }
- return s;
- }
- protected long getLong(String key, long def) {
- if(this.subconfig==null) {
- return def;
- }
- long s;
- try {
- s=this.subconfig.getLong(key, def);
- }
- catch(ConversionException e)
- {
- s=def;
- }
- return s;
- }
- protected void save()
- {
- if(this.configHandler!=null) {
- this.configHandler.save();
- }
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/HtDevicemanagerConfiguration.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/HtDevicemanagerConfiguration.java
deleted file mode 100644
index 1f2dde235..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/HtDevicemanagerConfiguration.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config;
-
-import java.io.File;
-import java.io.IOException;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile.ConfigurationException;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.AaiConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.DcaeConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.DmConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.EsConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.PmConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.ToggleAlarmConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.util.ConfigFileObserver;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class HtDevicemanagerConfiguration {
-
- private static final long FILE_POLL_INTERVAL_MS = 1000;
-
- private static final Logger LOG = LoggerFactory.getLogger(HtDevicemanagerConfiguration.class);
-
- private static final String CONFIGURATIONFILE = "etc/devicemanager.properties";
- private static final String CONFIGURATIONTESTFILE = "test.properties"; // for
- // testing
-
- private static HtDevicemanagerConfiguration mObj;
- private static HtDevicemanagerConfiguration mObjTest;
- private static IniConfigurationFile mConfig;
- private final ISubConfigHandler subconfigHandler = () -> mConfig.save();
-
- private final ConfigFileObserver fileObserver;
- private File mFile;
-
- private HtDevicemanagerConfiguration(String filename) {
-
- try {
- this.mFile = new File(filename);
- if (!this.mFile.exists()) {
- if (!this.mFile.createNewFile()) {
- LOG.error("Can not create file {}", filename);
- }
- }
- if (mConfig == null) {
- mConfig = new IniConfigurationFile(this.mFile);
- }
- mConfig.load();
-
- } catch (ConfigurationException e) {
- LOG.error("Problem loading config values: {}", e.getMessage());
- } catch (IOException e) {
- LOG.error("Problem loading config file {} : {}", filename, e.getMessage());
- }
-
- this.fileObserver = new ConfigFileObserver(filename, FILE_POLL_INTERVAL_MS, mConfig);
- this.fileObserver.start();
- }
-
-
- public static HtDevicemanagerConfiguration getConfiguration() {
- if (mObj == null) {
- mObj = new HtDevicemanagerConfiguration(CONFIGURATIONFILE);
- }
- return mObj;
- }
- public static HtDevicemanagerConfiguration getTestConfiguration() {
- return getTestConfiguration(CONFIGURATIONTESTFILE,false);
- }
-
- public static HtDevicemanagerConfiguration getTestConfiguration(boolean newInstance) {
- return getTestConfiguration(CONFIGURATIONTESTFILE,newInstance);
- }
- public static HtDevicemanagerConfiguration getTestConfiguration(String filename) {
- return getTestConfiguration(filename,false);
- }
- public static HtDevicemanagerConfiguration getTestConfiguration(final String filename,boolean newInstance) {
- if (mObjTest == null || newInstance) {
- mObjTest = new HtDevicemanagerConfiguration(filename);
- }
- return mObjTest;
- }
-
- public IniConfigurationFile getMConfig() {
- return mConfig;
- }
-
- public void registerConfigChangedListener(IConfigChangedListener l) {
- this.fileObserver.registerConfigChangedListener(l);
- }
-
- public void unregisterConfigChangedListener(IConfigChangedListener l) {
- this.fileObserver.unregisterConfigChangedListener(l);
- }
-
- @Override
- protected void finalize() throws Throwable {
- if (this.fileObserver != null) {
- this.fileObserver.interrupt();
- }
- super.finalize();
- }
-
- public DcaeConfig getDcae() {
- return DcaeConfig.getDcae(mConfig, this.subconfigHandler);
- }
-
- public AaiConfig getAai() {
- return AaiConfig.getAai(mConfig, this.subconfigHandler);
- }
-
- public EsConfig getEs() {
- return EsConfig.getEs(mConfig, this.subconfigHandler);
- }
-
- public PmConfig getPm() {
- return PmConfig.getPm(mConfig, this.subconfigHandler);
- }
-
- public ToggleAlarmConfig getToggleAlarm() {
- return ToggleAlarmConfig.getTa(mConfig, this.subconfigHandler);
- }
-
- public DmConfig getDmConfig() {
- return DmConfig.getDmConfig(mConfig, this.subconfigHandler);
- }
-
- public ISubConfigHandler getSubconfigHandler() {
- return subconfigHandler;
- }
-
- public static void clear() {
- mObj = null;
- mObjTest = null;
- DcaeConfig.clear();
- AaiConfig.clear();
- EsConfig.clear();
- PmConfig.clear();
- ToggleAlarmConfig.clear();
- DmConfig.clear();
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/IConfigChangedListener.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/IConfigChangedListener.java
deleted file mode 100644
index 704841ce7..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/IConfigChangedListener.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config;
-
-public interface IConfigChangedListener {
- void onConfigChanged();
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/ISubConfigHandler.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/ISubConfigHandler.java
deleted file mode 100644
index c1f67f0a3..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/ISubConfigHandler.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config;
-
-public interface ISubConfigHandler {
- void save();
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AaiClientPropertiesFile.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AaiClientPropertiesFile.java
deleted file mode 100644
index 7912f047b..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AaiClientPropertiesFile.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Properties;
-
-public class AaiClientPropertiesFile{
-
- private final File mFile;
- private String mPCKS12CertFilename;
- private String mPCKS12Passphrase;
- private boolean mTrustInsecureSSL;
- private String mApplicationIdentifier;
- private String mRemoteUrl;
- private int mConnectionTimeout;
- private int mReadTimeout;
-
- public String getFilename()
- { return this.mFile.getAbsolutePath(); }
- public String getPCKS12CertFilename()
- {return this.mPCKS12CertFilename;}
- public String getPCKS12Passphrase()
- {return this.mPCKS12Passphrase; }
- public boolean trustInsecureSSL()
- {return this.mTrustInsecureSSL;}
- public String getApplicationIdentifier()
- {return this.mApplicationIdentifier;}
- public String getRemoteUrl()
- {return this.mRemoteUrl;}
- public int getConnectionTimeout()
- {return this.mConnectionTimeout;}
- public int getReadTimeout()
- {return this.mReadTimeout;}
-
- public boolean exists()
- {return this.mFile.exists();}
- public AaiClientPropertiesFile(String filename)
- {
- this.mFile=new File(filename);
- }
- public void load() throws IOException,NumberFormatException
- {
- Properties defaultProps = new Properties();
- FileInputStream in = new FileInputStream(this.mFile);
- defaultProps.load(in);
- this.mPCKS12CertFilename=defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.ssl.key",null);
- this.mPCKS12Passphrase=defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd",null);
- this.mTrustInsecureSSL=defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore","false").equals("true");
- this.mApplicationIdentifier=defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.application",null);
- this.mRemoteUrl=defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.uri",null);
- this.mConnectionTimeout=Integer.parseInt(defaultProps.getProperty("connection.timeout","60000"));
- this.mReadTimeout=Integer.parseInt(defaultProps.getProperty("read.timeout","60000"));
- in.close();
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AaiConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AaiConfig.java
deleted file mode 100644
index fd5d04e6a..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AaiConfig.java
+++ /dev/null
@@ -1,476 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl;
-
-import java.io.IOException;
-import java.util.Base64;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import javax.annotation.Nullable;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile.ConfigurationException;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.BaseSubConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.ISubConfigHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AaiConfig extends BaseSubConfig {
-
- private static final Logger LOG = LoggerFactory.getLogger(AaiConfig.class);
-
- private static final String SECTION_MARKER_AAI = "aai";
-
- private static final String PROPERTY_KEY_AAIPROP_FILE ="aaiPropertiesFile";
- private static final String PROPERTY_KEY_BASEURL = "aaiUrl";
- private static final String PROPERTY_KEY_USERCREDENTIALS = "aaiUserCredentials";
- private static final String PROPERTY_KEY_HEADERS = "aaiHeaders";
- private static final String PROPERTY_KEY_DELETEONMOUNTPOINTREMOVED = "aaiDeleteOnMountpointRemove";
- private static final String PROPERTY_KEY_TRUSTALLCERTS = "aaiTrustAllCerts";
- private static final String PROPERTY_KEY_APIVERSION = "aaiApiVersion";
- private static final String PROPERTY_KEY_PCKS12CERTFILENAME = "aaiPcks12ClientCertFile";
- private static final String PROPERTY_KEY_PCKS12PASSPHRASE = "aaiPcks12ClientCertPassphrase";
- private static final String PROPERTY_KEY_CONNECTIONTIMEOUT = "aaiClientConnectionTimeout";
- private static final String PROPERTY_KEY_APPLICATIONID = "aaiApplicationId";
-
- private static final String DEFAULT_VALUE_AAIPROP_FILE ="null";
- private static final String DEFAULT_VALUE_BASEURL = "off";
- private static final String DEFAULT_VALUE_APPLICATION = "SDNR";
- private static final String DEFAULT_VALUE_USERNAME = "";
- private static final String DEFAULT_VALUE_USERPASSWORD = "";
- private static final String DEFAULT_VALUE_USERCREDENTIALS = "";
- private static final String DEFAULT_VALUE_HEADERS = "[\"X-TransactionId: 9999\"]";
- private static final boolean DEFAULT_VALUE_DELETEONMOUNTPOINTREMOVED = false;
- private static final boolean DEFAULT_VALUE_TRUSTALLCERTS = false;
- private static final int DEFAULT_VALUE_CONNECTION_TIMEOUT = 30000; //in ms
- private static final String DEFAULT_VALUE_APIVERSION = "aai/v13";
- private static final String DEFAULT_VALUE_PCKS12CERTFILENAME ="";
- private static final String DEFAULT_VALUE_PCKS12PASSPHRASE = "";
- private static final String DEFAULT_VALUE_APPLICATIONID = "SDNR";
-
- private static final String HEADER_KEY_APPLICATION = "X-FromAppId";
-
-
- private static AaiConfig aaiConfig;
-
- private final String aaiPropFile;
- private final String baseUrl;
- private String apiVersion;
- private String applicationIdentifier;
- private String username;
- private String password;
- private String pcks12CertificateFilename;
- private String pcks12CertificatePassphrase;
- private int connectionTimeout;
- private final boolean deleteOnMountPointRemoved;
- private final boolean trustAllCerts;
-
- public boolean doDeleteOnMountPointRemoved() {
- return this.deleteOnMountPointRemoved;
- }
-
- private Map<String, String> headers;
-
-
- private AaiConfig() {
- super();
- this.aaiPropFile = DEFAULT_VALUE_AAIPROP_FILE;
- this.apiVersion=DEFAULT_VALUE_APIVERSION;
- this.applicationIdentifier = DEFAULT_VALUE_APPLICATION;
- this.baseUrl = DEFAULT_VALUE_BASEURL;
- this.username = DEFAULT_VALUE_USERNAME;
- this.password = DEFAULT_VALUE_USERPASSWORD;
- this.deleteOnMountPointRemoved = DEFAULT_VALUE_DELETEONMOUNTPOINTREMOVED;
- this.trustAllCerts=DEFAULT_VALUE_TRUSTALLCERTS;
- this.applicationIdentifier=DEFAULT_VALUE_APPLICATIONID;
- }
-
- public AaiConfig(IniConfigurationFile config, ISubConfigHandler configHandler) throws ConfigurationException {
- this(config, configHandler, true);
- }
-
- public AaiConfig(IniConfigurationFile config, ISubConfigHandler configHandler, boolean save)
- throws ConfigurationException {
- super(config, configHandler, SECTION_MARKER_AAI);
- // load
- this.aaiPropFile=this.getString(PROPERTY_KEY_AAIPROP_FILE, "");
- AaiClientPropertiesFile aaiProperties = new AaiClientPropertiesFile(this.aaiPropFile);
- String defBaseUrl=DEFAULT_VALUE_BASEURL;
- String defPCKSCertFilename=DEFAULT_VALUE_PCKS12CERTFILENAME;
- String defPCKSPassphrase=DEFAULT_VALUE_PCKS12PASSPHRASE;
- String defApplicationId=DEFAULT_VALUE_APPLICATION;
- int defconnectionTimeout=DEFAULT_VALUE_CONNECTION_TIMEOUT;
- boolean loaded=false;
- if(aaiProperties.exists())
- {
- LOG.debug("found another aaiclient.properties file");
- try
- {
- aaiProperties.load();
- loaded=true;
- LOG.debug("loaded successfully");
- }
- catch(IOException|NumberFormatException e)
- {
- LOG.warn("problem loading external properties file "+aaiProperties.getFilename()+": "+e.getMessage());
- }
- if(loaded) //preload new default values
- {
- String value;
- value = aaiProperties.getRemoteUrl();
- if (value != null) {
- defBaseUrl = value;
- }
- value = aaiProperties.getPCKS12CertFilename();
- if (value != null) {
- defPCKSCertFilename = value;
- }
- value = aaiProperties.getPCKS12Passphrase();
- if (value != null) {
- defPCKSPassphrase = value;
- }
- value = aaiProperties.getApplicationIdentifier();
- if (value != null) {
- defApplicationId = value;
- }
- }
- } else {
- LOG.debug("no aaiclient.properties file found");
- }
-
-
- this.baseUrl = this.getString(PROPERTY_KEY_BASEURL, defBaseUrl);
- this.apiVersion=this.getString(PROPERTY_KEY_APIVERSION,DEFAULT_VALUE_APIVERSION);
- String credentials = this.getString(PROPERTY_KEY_USERCREDENTIALS, DEFAULT_VALUE_USERCREDENTIALS);
- if (credentials.contains(":")) {
- try {
- this.username = credentials.split(":")[0];
- this.password = credentials.split(":")[1];
- } catch (Exception e) {
- this.username = DEFAULT_VALUE_USERNAME;
- this.password = DEFAULT_VALUE_USERPASSWORD;
- }
- } else {
- this.username = DEFAULT_VALUE_USERNAME;
- this.password = DEFAULT_VALUE_USERPASSWORD;
- }
- this.headers = _parseHeadersMap(this.getString(PROPERTY_KEY_HEADERS, DEFAULT_VALUE_HEADERS));
- this.applicationIdentifier = this.getString(PROPERTY_KEY_APPLICATIONID, defApplicationId);
- this.pcks12CertificateFilename=this.getString(PROPERTY_KEY_PCKS12CERTFILENAME, defPCKSCertFilename);
- this.pcks12CertificatePassphrase=this.getString(PROPERTY_KEY_PCKS12PASSPHRASE, defPCKSPassphrase);
- this.connectionTimeout = this.getInt(PROPERTY_KEY_CONNECTIONTIMEOUT, defconnectionTimeout);
- this.deleteOnMountPointRemoved = this.getBoolean(PROPERTY_KEY_DELETEONMOUNTPOINTREMOVED,
- DEFAULT_VALUE_DELETEONMOUNTPOINTREMOVED);
- this.trustAllCerts = this.getBoolean(PROPERTY_KEY_TRUSTALLCERTS, DEFAULT_VALUE_TRUSTALLCERTS);
-
- boolean missing=!this.hasKey(PROPERTY_KEY_APPLICATIONID)|| !this.hasKey(PROPERTY_KEY_CONNECTIONTIMEOUT)||
- !this.hasKey(PROPERTY_KEY_TRUSTALLCERTS) || !this.hasKey(PROPERTY_KEY_PCKS12CERTFILENAME) ||
- !this.hasKey(PROPERTY_KEY_PCKS12PASSPHRASE);
- if(missing) {
- LOG.debug("some params missing in config file");
- }
- //re-save if external aaiproperties file changed to show that params are submitted internally
- if(missing || aaiConfig!=null && aaiConfig!=this && (
- !propertyEquals(aaiConfig.aaiPropFile, this.aaiPropFile) ||
- !propertyEquals(aaiConfig.pcks12CertificateFilename, this.pcks12CertificateFilename) ||
- !propertyEquals(aaiConfig.pcks12CertificatePassphrase, this.pcks12CertificatePassphrase) ||
- !propertyEquals(aaiConfig.connectionTimeout, this.connectionTimeout)
-
- ))
- {
- LOG.debug("force saving because of reload changes from remote file");
- save=true;
- }
- if (save) {
- config.setProperty(SECTION_MARKER_AAI + "." + PROPERTY_KEY_BASEURL, this.baseUrl);
- config.setProperty(SECTION_MARKER_AAI + "." + PROPERTY_KEY_USERCREDENTIALS,
- nullorempty(this.username) && nullorempty(this.password)?"":this.username + ":" + this.password);
- config.setProperty(SECTION_MARKER_AAI + "." + PROPERTY_KEY_HEADERS, _printHeadersMap(this.headers));
- config.setProperty(SECTION_MARKER_AAI + "." + PROPERTY_KEY_DELETEONMOUNTPOINTREMOVED,
- this.deleteOnMountPointRemoved);
- config.setProperty(SECTION_MARKER_AAI + "." + PROPERTY_KEY_TRUSTALLCERTS, this.trustAllCerts);
- config.setProperty(SECTION_MARKER_AAI+"."+PROPERTY_KEY_AAIPROP_FILE, this.aaiPropFile);
- config.setProperty(SECTION_MARKER_AAI+"."+PROPERTY_KEY_APIVERSION,this.apiVersion);
- config.setProperty(SECTION_MARKER_AAI+"."+PROPERTY_KEY_APPLICATIONID, this.applicationIdentifier);
- config.setProperty(SECTION_MARKER_AAI+"."+PROPERTY_KEY_CONNECTIONTIMEOUT, this.connectionTimeout);
- /*if(this.pcks12CertificateFilename !=null && !this.pcks12CertificateFilename.isEmpty() &&
- this.pcks12CertificatePassphrase!=null && !this.pcks12CertificatePassphrase.isEmpty())*/
- {
- LOG.debug("no client credentials to save");
- config.setProperty(SECTION_MARKER_AAI+"."+PROPERTY_KEY_PCKS12CERTFILENAME, this.pcks12CertificateFilename);
- config.setProperty(SECTION_MARKER_AAI+"."+PROPERTY_KEY_PCKS12PASSPHRASE, this.pcks12CertificatePassphrase);
- }
- LOG.debug("save");
- this.save();
- }
- }
-
- private boolean nullorempty(String s) {
- return s==null || s.isEmpty();
- }
-
- public boolean isOff() {
- return this.baseUrl == null || this.baseUrl.toLowerCase().equals("off");
- }
-
- private static boolean propertyEquals(final Object p1,final Object p2)
- {
- return p1==null && p2==null || p1 != null && p1.equals(p2);
- }
- private static boolean propertyEquals(final int p1,final int p2)
- {
- return p1==p2;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (aaiPropFile == null ? 0 : aaiPropFile.hashCode());
- result = prime * result + (apiVersion == null ? 0 : apiVersion.hashCode());
- result = prime * result + (applicationIdentifier == null ? 0 : applicationIdentifier.hashCode());
- result = prime * result + (baseUrl == null ? 0 : baseUrl.hashCode());
- result = prime * result + connectionTimeout;
- result = prime * result + (deleteOnMountPointRemoved ? 1231 : 1237);
- result = prime * result + (headers == null ? 0 : headers.hashCode());
- result = prime * result + (password == null ? 0 : password.hashCode());
- result = prime * result + (pcks12CertificateFilename == null ? 0 : pcks12CertificateFilename.hashCode());
- result = prime * result + (pcks12CertificatePassphrase == null ? 0 : pcks12CertificatePassphrase.hashCode());
- result = prime * result + (trustAllCerts ? 1231 : 1237);
- result = prime * result + (username == null ? 0 : username.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- AaiConfig other = (AaiConfig) obj;
- if (aaiPropFile == null) {
- if (other.aaiPropFile != null) {
- return false;
- }
- } else if (!aaiPropFile.equals(other.aaiPropFile)) {
- return false;
- }
- if (apiVersion == null) {
- if (other.apiVersion != null) {
- return false;
- }
- } else if (!apiVersion.equals(other.apiVersion)) {
- return false;
- }
- if (applicationIdentifier == null) {
- if (other.applicationIdentifier != null) {
- return false;
- }
- } else if (!applicationIdentifier.equals(other.applicationIdentifier)) {
- return false;
- }
- if (baseUrl == null) {
- if (other.baseUrl != null) {
- return false;
- }
- } else if (!baseUrl.equals(other.baseUrl)) {
- return false;
- }
- if (connectionTimeout != other.connectionTimeout) {
- return false;
- }
- if (deleteOnMountPointRemoved != other.deleteOnMountPointRemoved) {
- return false;
- }
- if (headers == null) {
- if (other.headers != null) {
- return false;
- }
- } else if (!headers.equals(other.headers)) {
- return false;
- }
- if (password == null) {
- if (other.password != null) {
- return false;
- }
- } else if (!password.equals(other.password)) {
- return false;
- }
- if (pcks12CertificateFilename == null) {
- if (other.pcks12CertificateFilename != null) {
- return false;
- }
- } else if (!pcks12CertificateFilename.equals(other.pcks12CertificateFilename)) {
- return false;
- }
- if (pcks12CertificatePassphrase == null) {
- if (other.pcks12CertificatePassphrase != null) {
- return false;
- }
- } else if (!pcks12CertificatePassphrase.equals(other.pcks12CertificatePassphrase)) {
- return false;
- }
- if (trustAllCerts != other.trustAllCerts) {
- return false;
- }
- if (username == null) {
- if (other.username != null) {
- return false;
- }
- } else if (!username.equals(other.username)) {
- return false;
- }
- return true;
- }
-
- public String getBaseUri() {
- String s;
- if(!this.apiVersion.startsWith("/")) {
- s="/"+this.apiVersion;
- }
- else
- s=this.apiVersion;
- return s;
- }
- public String getBaseUrl() {
- String url=this.baseUrl;
- if(!url.endsWith("/")) {
- url+="/";
- }
- if(this.apiVersion.startsWith("/")) {
- this.apiVersion=this.apiVersion.substring(1);
- }
- return url+this.apiVersion;
- }
-
- public Map<String, String> getHeaders() {
- if (this.headers == null) {
- this.headers = new HashMap<>();
- }
- this.headers.put(HEADER_KEY_APPLICATION, this.applicationIdentifier);
- String s = this.headers.getOrDefault("Authorization", null);
- if (nullorempty(s) && !nullorempty(this.username) && !nullorempty(this.password)) {
- this.headers.put("Authorization", "Basic "
- + new String(Base64.getEncoder().encode((this.username + ":" + this.password).getBytes())));
- }
- return this.headers;
- }
-
- @Override
- public String toString() {
- return "AaiConfig [aaiPropFile=" + aaiPropFile + ", baseUrl=" + baseUrl + ", apiVersion=" + apiVersion
- + ", applicationIdentifier=" + applicationIdentifier + ", username=" + username + ", password="
- + password + ", pcks12CertificateFilename=" + pcks12CertificateFilename
- + ", pcks12CertificatePassphrase=" + pcks12CertificatePassphrase + ", connectionTimeout="
- + connectionTimeout + ", deleteOnMountPointRemoved=" + deleteOnMountPointRemoved + ", trustAllCerts="
- + trustAllCerts + ", headers=" + this.getHeaders() + "]";
- }
-
- private static String _printHeadersMap(Map<String, String> headers) {
- String r = "[";
- if (headers != null) {
- int i = 0;
- for (Entry<String, String> entry : headers.entrySet()) {
- if (i > 0) {
- r += ",";
- }
- r += "\"" + entry.getKey() + ":" + entry.getValue() + "\"";
- i++;
- }
- }
- r += "]";
- return r;
- }
-
- private static Map<String, String> _parseHeadersMap(String s) throws JSONException {
- Map<String, String> r = new HashMap<>();
- JSONArray a = new JSONArray(s);
- if (a != null && a.length() > 0) {
- for (int i = 0; i < a.length(); i++) {
- String item = a.getString(i);
- String[] hlp = item.split(":");
- if (hlp.length > 1) {
- r.put(hlp[0], hlp[1]);
- }
- }
- }
- return r;
- }
-
- public static boolean isInstantiated() {
- return aaiConfig != null;
- }
-
- public static AaiConfig getDefaultConfiguration() {
- return new AaiConfig();
- }
-
- public static AaiConfig getAai(IniConfigurationFile config, ISubConfigHandler configHandler) {
- if (aaiConfig == null) {
- try {
- aaiConfig = new AaiConfig(config, configHandler);
- } catch (ConfigurationException e) {
- aaiConfig = AaiConfig.getDefaultConfiguration();
- }
- }
- return aaiConfig;
- }
-
- public static @Nullable AaiConfig reload() {
- if (aaiConfig == null) {
- return null;
- }
- AaiConfig tmpConfig;
- try {
- tmpConfig = new AaiConfig(aaiConfig.getConfig(), aaiConfig.getConfigHandler(), false);
- } catch (ConfigurationException e) {
- tmpConfig = AaiConfig.getDefaultConfiguration();
- LOG.warn("problem loading config: "+e.getMessage());
- }
- aaiConfig = tmpConfig;
- return aaiConfig;
- }
-
- public boolean getTrustAll() {
- return this.trustAllCerts;
- }
-
- public String getPcks12CertificateFilename() {
- return this.pcks12CertificateFilename;
- }
-
- public String getPcks12CertificatePassphrase() {
- return this.pcks12CertificatePassphrase;
- }
-
- public int getConnectionTimeout() {
- return this.connectionTimeout;
- }
-
- public static void clear() {
- aaiConfig=null;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AkkaConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AkkaConfig.java
deleted file mode 100644
index eeccf601f..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/AkkaConfig.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl;
-
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
-import java.io.File;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.util.ClusterConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AkkaConfig {
-
- @SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(AkkaConfig.class);
-
- private static final String DEFAULT_FILENAME = "configuration/initial/akka.conf";
- private final String filename;
- private ClusterConfig cluserConfig;
-
- public ClusterConfig getClusterConfig() {
- return this.cluserConfig;
- }
-
- private AkkaConfig(String filename) {
- this.filename = filename;
- }
-
- public AkkaConfig() {
- this(null);
- }
-
- @Override
- public String toString() {
- return "AkkaConfig [filename=" + filename + ", cluserConfig=" + cluserConfig + "]";
- }
-
- private void loadFromFile() throws Exception {
- Config cfg = ConfigFactory.parseFile(new File(this.filename));
- this.cluserConfig = new ClusterConfig(cfg.getConfig("odl-cluster-data").getConfig("akka").getConfig("cluster"));
- }
-
- public boolean isCluster() {
- return this.cluserConfig != null ? this.cluserConfig.isCluster() : false;
- }
-
- public boolean isClusterAndFirstNode() {
- return isSingleNode() || isCluster() && getClusterConfig().getRoleMemberIndex() == 1;
- }
-
- public static AkkaConfig load() throws Exception {
- return load(DEFAULT_FILENAME);
- }
-
- public static AkkaConfig load(String filename) throws Exception {
- AkkaConfig cfg = new AkkaConfig(filename);
- cfg.loadFromFile();
- return cfg;
- }
-
- public boolean isSingleNode() {
- return !this.isCluster();
- }
- public static AkkaConfig parse(String content) throws Exception {
- Config cfg = ConfigFactory.parseString(content);
- AkkaConfig c = new AkkaConfig();
- c.cluserConfig=new ClusterConfig(cfg.getConfig("odl-cluster-data").getConfig("akka").getConfig("cluster"));
- return c;
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/DcaeConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/DcaeConfig.java
deleted file mode 100644
index 669b211e1..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/DcaeConfig.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile.ConfigurationException;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.BaseSubConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.ISubConfigHandler;
-
-public class DcaeConfig extends BaseSubConfig {
- private static final String SECTION_MARKER_DCAE = "dcae";
-
- private static final String PROPERTY_KEY_EVENTRECEIVERURL = "dcaeUrl";
- //private static final String PROPERTY_KEY_TESTCOLLECTOR = "dcaeTestCollector";
- private static final String PROPERTY_KEY_USERCREDENTIALS = "dcaeUserCredentials";
- private static final String PROPERTY_KEY_TIMERPERIOD = "dcaeHeartbeatPeriodSeconds";
-
- private static final String DEFAULT_VALUE_EVENTRECEIVERURL = "off";
- @SuppressWarnings("unused")
- private static final String DEFAULT_VALUE_TESTCOLLECTOR = "no";
- private static final String DEFAULT_VALUE_USERCREDENTIALS = "admin:admin";
- private static final int DEFAULT_VALUE_TIMERPERIOD = 120;
-
- private static DcaeConfig dcaeConfig = null; // Singleton of configuration data
-
- private String eventReceiverUrl;
- private String userCredentials;
- private Integer timerPeriodSeconds;
-
- private DcaeConfig() {
- super();
- this.eventReceiverUrl = DEFAULT_VALUE_EVENTRECEIVERURL;
- this.userCredentials = DEFAULT_VALUE_USERCREDENTIALS;
- this.timerPeriodSeconds = DEFAULT_VALUE_TIMERPERIOD;
- }
-
- private DcaeConfig(IniConfigurationFile config, ISubConfigHandler configHandler) throws ConfigurationException {
- this(config, configHandler, true);
- }
-
- private DcaeConfig(IniConfigurationFile config, ISubConfigHandler configHandler, boolean save)
- throws ConfigurationException {
-
- super(config, configHandler, SECTION_MARKER_DCAE);
-
- this.eventReceiverUrl = this.getString(PROPERTY_KEY_EVENTRECEIVERURL, DEFAULT_VALUE_EVENTRECEIVERURL);
- this.userCredentials = this.getString(PROPERTY_KEY_USERCREDENTIALS, DEFAULT_VALUE_USERCREDENTIALS);
- this.timerPeriodSeconds = this.getInt(PROPERTY_KEY_TIMERPERIOD, DEFAULT_VALUE_TIMERPERIOD);
- if (save) {
- config.setProperty(SECTION_MARKER_DCAE + "." + PROPERTY_KEY_EVENTRECEIVERURL, this.eventReceiverUrl);
- config.setProperty(SECTION_MARKER_DCAE + "." + PROPERTY_KEY_USERCREDENTIALS, this.userCredentials);
- config.setProperty(SECTION_MARKER_DCAE + "." + PROPERTY_KEY_TIMERPERIOD, this.timerPeriodSeconds);
-
- this.save();
- }
- }
-
- /*
- * Setter
- */
-
- public void setEventReceiverUrl(String eventReveicerUrl) {
- this.eventReceiverUrl = eventReveicerUrl;
- }
-
- public void setUserCredentials(String userCredentials) {
- this.userCredentials = userCredentials;
- }
-
-
-
- public void setTimerPeriodSeconds(Integer timerPeriodSeconds) {
- this.timerPeriodSeconds = timerPeriodSeconds;
- }
-
- /*
- * Getter
- */
-
- public String getEventReveicerUrl() {
- return eventReceiverUrl;
- }
-
- public String getUserCredentials() {
- return userCredentials;
- }
-
-
- public Integer getTimerPeriodSeconds() {
- return timerPeriodSeconds;
- }
-
- @Override
- public String toString() {
- return "DcaeConfig [eventReceiverUrl=" + eventReceiverUrl + ", userCredentials=" + userCredentials
- + ", timerPeriodSeconds=" + timerPeriodSeconds + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (eventReceiverUrl == null ? 0 : eventReceiverUrl.hashCode());
- result = prime * result + (timerPeriodSeconds == null ? 0 : timerPeriodSeconds.hashCode());
- result = prime * result + (userCredentials == null ? 0 : userCredentials.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- DcaeConfig other = (DcaeConfig) obj;
- if (eventReceiverUrl == null) {
- if (other.eventReceiverUrl != null) {
- return false;
- }
- } else if (!eventReceiverUrl.equals(other.eventReceiverUrl)) {
- return false;
- }
- if (timerPeriodSeconds == null) {
- if (other.timerPeriodSeconds != null) {
- return false;
- }
- } else if (!timerPeriodSeconds.equals(other.timerPeriodSeconds)) {
- return false;
- }
- if (userCredentials == null) {
- if (other.userCredentials != null) {
- return false;
- }
- } else if (!userCredentials.equals(other.userCredentials)) {
- return false;
- }
- return true;
- }
-
- /*-------------------------------------
- * static Functions
- */
-
- public static DcaeConfig getDefaultConfiguration() {
- return new DcaeConfig();
- }
-
- public static DcaeConfig getDcae(IniConfigurationFile config, ISubConfigHandler configHandler) {
- if (dcaeConfig == null) {
- try {
- dcaeConfig = new DcaeConfig(config, configHandler);
- } catch (ConfigurationException e) {
- dcaeConfig = DcaeConfig.getDefaultConfiguration();
- }
- }
- return dcaeConfig;
- }
-
- public static boolean isInstantiated() {
- return dcaeConfig != null;
- }
-
- public static DcaeConfig reload() {
- if (dcaeConfig == null) {
- return null;
- }
- DcaeConfig tmpConfig;
- try {
- tmpConfig = new DcaeConfig(dcaeConfig.getConfig(), dcaeConfig.getConfigHandler(), false);
- } catch (ConfigurationException e) {
- tmpConfig = DcaeConfig.getDefaultConfiguration();
- }
- dcaeConfig = tmpConfig;
- return dcaeConfig;
- }
-
- public static void clear() {
- dcaeConfig=null;
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/DmConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/DmConfig.java
deleted file mode 100644
index c62a8eca6..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/DmConfig.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl;
-
-import java.util.EnumMap;
-import java.util.Map;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile.ConfigurationException;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.BaseSubConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.ISubConfigHandler;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitorProblems;
-
-/**
- * Configuration of devicemonitor, section [devicemonitor]
- * SeverityConnectionlossNeOAM=minor
- * SeverityConnectionlossOAM=major
- * SeverityConnectionlossMediator=critical
- */
-public class DmConfig extends BaseSubConfig{
-
- private static final String SECTION_MARKER_TA = "devicemonitor";
- private static final String PROPERTY_KEY_PREFIX_Severity = "Severity";
-
- private static DmConfig dmConfig = null;
-
- private Map<DeviceMonitorProblems, InternalSeverity> severty = new EnumMap<>(DeviceMonitorProblems.class);
-
- /*
- * Constructor
- */
- private DmConfig() {
- super();
- }
-
- public DmConfig(IniConfigurationFile config, ISubConfigHandler configHandler) throws ConfigurationException {
- this(config, configHandler, true);
- }
-
- public DmConfig(IniConfigurationFile config, ISubConfigHandler configHandler, boolean save)
- throws ConfigurationException {
-
- super(config, configHandler, SECTION_MARKER_TA);
-
- for (DeviceMonitorProblems problem : DeviceMonitorProblems.values()) {
- severty.put(problem, readProperty(problem));
- }
-
- if (save) {
- for (DeviceMonitorProblems problem : DeviceMonitorProblems.values()) {
- configSetPropertyp(config, problem, severty.get(problem));
- }
- this.save();
- }
- }
-
- public InternalSeverity getSeverity(DeviceMonitorProblems problem) {
- return severty.get(problem);
- }
-
- public static DmConfig getDefaultConfiguration() {
- DmConfig c = new DmConfig();
- for (DeviceMonitorProblems problem : DeviceMonitorProblems.values()) {
- c.severty.put(problem, InternalSeverity.Major);
- }
- return c;
- }
- public static boolean isInstantiated() {
- return dmConfig != null;
- }
-
- public static DmConfig getDmConfig(IniConfigurationFile config, ISubConfigHandler configHandler) {
- if (dmConfig == null) {
- try {
- dmConfig = new DmConfig(config, configHandler);
- } catch (ConfigurationException e) {
- dmConfig = DmConfig.getDefaultConfiguration();
- }
- }
- return dmConfig;
- }
-
- public static DmConfig reload() {
- if (dmConfig == null) {
- return null;
- }
- DmConfig tmpConfig;
- try {
- tmpConfig = new DmConfig(dmConfig.getConfig(), dmConfig.getConfigHandler(), false);
- } catch (ConfigurationException e) {
- tmpConfig = DmConfig.getDefaultConfiguration();
- }
- dmConfig = tmpConfig;
- return dmConfig;
- }
-
- public static void clear() {
- dmConfig=null;
- }
-
- /*
- * Private Helper functions
- */
- private static String getPropertyName(DeviceMonitorProblems problem) {
- return PROPERTY_KEY_PREFIX_Severity+problem.name();
- }
-
- private static void configSetPropertyp(IniConfigurationFile config, DeviceMonitorProblems problem, InternalSeverity value) {
- config.setProperty(SECTION_MARKER_TA + "."+getPropertyName(problem), value.getValueAsString());
- }
-
- private InternalSeverity readProperty(DeviceMonitorProblems problem) {
- return InternalSeverity.valueOfString(getString(getPropertyName(problem), InternalSeverity.Major.getValueAsString()));
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/EsConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/EsConfig.java
deleted file mode 100644
index bdfbf655d..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/EsConfig.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Environment;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile.ConfigurationException;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.BaseSubConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.ISubConfigHandler;
-
-public class EsConfig extends BaseSubConfig {
-
- public static final String SECTION_MARKER_ES = "es";
- public static final String ESDATATYPENAME = "database";
- private static final String EMPTY = "empty";
- private static final String PROPERTY_KEY_CLUSTER = "esCluster";
- private static final String PROPERTY_KEY_ARCHIVE_INTERVAL = "esArchiveCheckIntervalSeconds";
- private static final String PROPERTY_KEY_ARCHIVE_LIMIT = "esArchiveLifetimeSeconds";
-
- private static final String DEFAULT_VALUE_CLUSTER = "";
- /**
- * check db data in this interval [in seconds]
- * 0 deactivated
- */
- private static final long DEFAULT_ARCHIVE_INTERVAL_SEC = 0;
- /**
- * keep data for this time [in seconds]
- * 30 days
- */
- private static final long DEFAULT_ARCHIVE_LIMIT_SEC = 60 * 60 * 24 * 30;
-
- private static EsConfig esConfig;
-
- private String cluster;
- private String host;
- private String node;
- private String index;
- private long archiveCheckIntervalSeconds;
- private long archiveLifetimeSeconds;
-
- private EsConfig() {
- super();
- this.host = EMPTY;
- this.node = EMPTY;
- this.index = EMPTY;
- this.cluster = DEFAULT_VALUE_CLUSTER;
- this.archiveCheckIntervalSeconds = DEFAULT_ARCHIVE_INTERVAL_SEC;
- this.archiveLifetimeSeconds = DEFAULT_ARCHIVE_LIMIT_SEC;
- }
-
- public EsConfig cloneWithIndex(String _index) {
- EsConfig c = new EsConfig();
- c.index = _index;
- c.host = this.host;
- c.node = this.node;
- c.cluster = this.cluster;
- c.archiveCheckIntervalSeconds = this.archiveCheckIntervalSeconds;
- c.archiveLifetimeSeconds = this.archiveLifetimeSeconds;
- return c;
- }
-
- public static String getESDATATYPENAME() {
- return ESDATATYPENAME;
- }
-
- public String getCluster() {
- return cluster;
- }
-
- public void setCluster(String cluster) {
- this.cluster = cluster;
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public String getNode() {
- return node;
- }
-
- public void setNode(String node) {
- this.node = node;
- }
-
- public String getIndex() {
- return index;
- }
-
- public void setIndex(String index) {
- this.index = index;
- }
-
- public long getArchiveCheckIntervalSeconds() {
- return this.archiveCheckIntervalSeconds;
- }
-
- public void setArchiveCheckIntervalSeconds(long x) {
- this.archiveCheckIntervalSeconds = x;
- }
-
- public long getArchiveLifetimeSeconds() {
- return this.archiveLifetimeSeconds;
- }
-
- public void setArchiveLimit(long x) {
- this.archiveLifetimeSeconds = x;
- }
-
- @Override
- public String toString() {
- return "EsConfig [cluster=" + cluster + ", host=" + host + ", node=" + node + ", index=" + index + "]";
- }
-
- public EsConfig(IniConfigurationFile config, ISubConfigHandler configHandler) throws ConfigurationException {
- this(config, configHandler, true);
- }
-
- public EsConfig(IniConfigurationFile config, ISubConfigHandler configHandler, boolean save)
- throws ConfigurationException {
-
- super(config, configHandler, SECTION_MARKER_ES);
- String clustername = Environment.getVar("$HOSTNAME");
-
- String c = this.getString(PROPERTY_KEY_CLUSTER, clustername);
- if (c != null && c.startsWith("$")) {
- c = Environment.getVar(c);
- }
- this.cluster = c;
- this.node = String.format("%s%s", this.cluster, "n1");
- this.host = "localhost";
- this.archiveCheckIntervalSeconds = this.getLong(PROPERTY_KEY_ARCHIVE_INTERVAL, DEFAULT_ARCHIVE_INTERVAL_SEC);
- this.archiveLifetimeSeconds = this.getLong(PROPERTY_KEY_ARCHIVE_LIMIT, DEFAULT_ARCHIVE_LIMIT_SEC);
-
- if (save) {
- config.setProperty(SECTION_MARKER_ES + "." + PROPERTY_KEY_CLUSTER, this.cluster);
- config.setProperty(SECTION_MARKER_ES + "." + PROPERTY_KEY_ARCHIVE_INTERVAL, this.archiveCheckIntervalSeconds);
- config.setProperty(SECTION_MARKER_ES + "." + PROPERTY_KEY_ARCHIVE_LIMIT, this.archiveLifetimeSeconds);
- this.save();
- }
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (cluster == null ? 0 : cluster.hashCode());
- result = prime * result + (host == null ? 0 : host.hashCode());
- result = prime * result + (index == null ? 0 : index.hashCode());
- result = prime * result + (node == null ? 0 : node.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- EsConfig other = (EsConfig) obj;
- if (cluster == null) {
- if (other.cluster != null) {
- return false;
- }
- } else if (!cluster.equals(other.cluster)) {
- return false;
- }
- if (host == null) {
- if (other.host != null) {
- return false;
- }
- } else if (!host.equals(other.host)) {
- return false;
- }
- if (index == null) {
- if (other.index != null) {
- return false;
- }
- } else if (!index.equals(other.index)) {
- return false;
- }
- if (node == null) {
- if (other.node != null) {
- return false;
- }
- } else if (!node.equals(other.node)) {
- return false;
- }
- if (archiveCheckIntervalSeconds != other.archiveCheckIntervalSeconds) {
- return false;
- }
- if (archiveLifetimeSeconds != other.archiveLifetimeSeconds) {
- return false;
- }
- return true;
- }
-
- @Override
- public void save() {
- this.getConfig().setProperty(SECTION_MARKER_ES + "." + PROPERTY_KEY_CLUSTER, this.cluster);
- super.save();
- }
-
- public static boolean isInstantiated() {
- return esConfig != null;
- }
-
- public static EsConfig getDefaultConfiguration() {
- return new EsConfig();
- }
-
- public static EsConfig getEs(IniConfigurationFile config, ISubConfigHandler configHandler) {
- if (esConfig == null) {
- try {
- esConfig = new EsConfig(config, configHandler);
- } catch (ConfigurationException e) {
- esConfig = EsConfig.getDefaultConfiguration();
- }
- }
- return esConfig;
- }
-
- public static EsConfig reload() {
- if (esConfig == null) {
- return null;
- }
- EsConfig tmpConfig;
- try {
- tmpConfig = new EsConfig(esConfig.getConfig(), esConfig.getConfigHandler(), false);
- } catch (ConfigurationException e) {
- tmpConfig = EsConfig.getDefaultConfiguration();
- }
- esConfig = tmpConfig;
- return esConfig;
- }
-
- public static void clear() {
- esConfig = null;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/GeoConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/GeoConfig.java
deleted file mode 100644
index ac9c3cb50..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/GeoConfig.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl;
-
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.util.ClusterRoleInfo;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.util.ClusterRoleInfoCollection;
-
-public class GeoConfig {
-
- private static final String DEFAULT_FILENAME = "configuration/initial/geo.conf";
- private static final String LUMINA_ROOTNODENAME = "lumina-geo-cluster";
- private final String filename;
- private final String rootNodename;
- private ClusterRoleInfoCollection primaryRoles;
- private ClusterRoleInfoCollection secondayRoles;
- private RolesTable rolesTable;
-
- private GeoConfig() {
- this(null);
- }
-
- private GeoConfig(String filename) {
- this(filename, LUMINA_ROOTNODENAME);
- }
-
- private GeoConfig(String filename, String rootNodeName) {
- this.filename = filename;
- this.rootNodename = rootNodeName;
- }
-
- public static boolean fileExists() {
- File f = new File(DEFAULT_FILENAME);
- return f.exists();
- }
-
- public static GeoConfig load() throws Exception {
- return load(DEFAULT_FILENAME);
- }
-
- public static GeoConfig load(String filename) throws Exception {
- GeoConfig cfg = new GeoConfig(filename);
- cfg._load();
- return cfg;
- }
-
- private void _load() throws Exception {
- this._load(ConfigFactory.parseFile(new File(this.filename)));
- }
-
- private void _load(Config cfg) throws Exception {
- this.primaryRoles = new ClusterRoleInfoCollection();
- List<String> a = cfg.getConfig(this.rootNodename).getStringList("primary_roles");
-
- for (int i = 0; i < a.size(); i++) {
- ClusterRoleInfo s = new ClusterRoleInfo(a.get(i));
- this.primaryRoles.add(s);
- }
- this.secondayRoles = new ClusterRoleInfoCollection();
- a = cfg.getConfig(this.rootNodename).getStringList("secondary_roles");
- for (int i = 0; i < a.size(); i++) {
- ClusterRoleInfo s = new ClusterRoleInfo(a.get(i));
- this.secondayRoles.add(s);
- }
- this.checkDuplicateRoleEntries();
- this.rolesTable = new RolesTable(cfg.getConfig(this.rootNodename).getConfigList("ip_roles_table"));
- }
-
- private void checkDuplicateRoleEntries() throws Exception {
- ClusterRoleInfoCollection duplicateEntries = new ClusterRoleInfoCollection();
- for (ClusterRoleInfo primaryRole : this.primaryRoles) {
- if (this.secondayRoles.contains(primaryRole)) {
- duplicateEntries.add(primaryRole);
- }
- }
- if (duplicateEntries.size() > 0) {
- throw new Exception("duplicate entries found: " + duplicateEntries.toString());
- }
-
- }
-
- public static GeoConfig parse(String content) throws Exception {
- GeoConfig cfg = new GeoConfig();
- cfg._load(ConfigFactory.parseString(content));
- return cfg;
- }
-
- public ClusterRoleInfoCollection getPrimaryRoles() {
- return this.primaryRoles;
- }
-
- public ClusterRoleInfoCollection getSecondaryRoles() {
- return this.secondayRoles;
- }
-
- public boolean isPrimary(ClusterRoleInfo roleMember) {
- return !this.isSecondary(roleMember);
- }
-
- private boolean isSecondary(ClusterRoleInfo roleMember) {
- if (roleMember == null) {
- return false;
- }
- for (ClusterRoleInfo info : this.secondayRoles) {
- if (info.equals(roleMember)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public String toString() {
- return "GeoConfig [filename=" + filename + ", rootNodename=" + rootNodename + ", primaryRoles=" + primaryRoles
- + ", secondayRoles=" + secondayRoles + ", rolesTable=" + rolesTable + "]";
- }
-
- public static class RolesTableEntry {
- private final ClusterRoleInfo role;
- private final String ip;
-
- public RolesTableEntry(Config c) throws Exception {
- this.role = new ClusterRoleInfo(c.getString("role"));
- this.ip = c.getString("ip");
- }
-
- @Override
- public String toString() {
- return "RolesTableEntry [role=" + role + ", ip=" + ip + "]";
- }
- }
- public static class RolesTable extends ArrayList<RolesTableEntry> {
- private static final long serialVersionUID = -9146218864237487506L;
-
- public RolesTable(List<? extends Config> configList) throws Exception {
- for (Config c : configList) {
- this.add(new RolesTableEntry(c));
- }
- }
-
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/PmConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/PmConfig.java
deleted file mode 100644
index d710efed2..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/PmConfig.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Environment;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile.ConfigurationException;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.BaseSubConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.ISubConfigHandler;
-
-public class PmConfig extends BaseSubConfig {
-
- private static final String SECTION_MARKER_PM = "pm";
- private static final String PROPERTY_KEY_ENABLED = "pmEnabled";
- private static final String PROPERTY_KEY_CLUSTER = "pmCluster";
-
- private static final boolean DEFAULT_VALUE_ENABLED = true;
- private static final String DEFAULT_VALUE_CLUSTER = "";
- private static PmConfig pmConfig;
-
- private boolean enabled;
-
- public static final String ESDATATYPENAME = "database";
-
- private static final String EMPTY = "empty";
-
- private String cluster;
- private String host;
- private String node;
-
- public static String getESDATATYPENAME() {
- return ESDATATYPENAME;
- }
-
- public String getCluster() {
- return cluster;
- }
-
- public void setCluster(String cluster) {
- this.cluster = cluster;
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public String getNode() {
- return node;
- }
-
- public void setNode(String node) {
- this.node = node;
- }
-
- public boolean isPerformanceManagerEnabled() {
- return this.enabled;
- }
-
- public PmConfig(IniConfigurationFile config, ISubConfigHandler configHandler) throws ConfigurationException {
- this(config, configHandler, true);
- }
-
- public PmConfig(IniConfigurationFile config, ISubConfigHandler configHandler, boolean save)
- throws ConfigurationException {
-
- super(config, configHandler, SECTION_MARKER_PM);
- String clustername = Environment.getVar("$HOSTNAME");
-
- this.enabled = this.getBoolean(PROPERTY_KEY_ENABLED, DEFAULT_VALUE_ENABLED);
- String c = this.getString(PROPERTY_KEY_CLUSTER, clustername);
- if (c != null && c.startsWith("$")) {
- c = Environment.getVar(c);
- }
- this.cluster = c;
- this.node = String.format("%s%s", this.cluster, "n1");
- this.host = "localhost";
-
- if (save) {
- config.setProperty(SECTION_MARKER_PM + "." + PROPERTY_KEY_ENABLED, this.enabled);
- config.setProperty(SECTION_MARKER_PM + "." + PROPERTY_KEY_CLUSTER, this.cluster);
-
- this.save();
- }
- }
-
- private PmConfig() {
- super();
- this.cluster = EMPTY;
- this.host = EMPTY;
- this.node = EMPTY;
- this.enabled = DEFAULT_VALUE_ENABLED;
- }
-
-
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (cluster == null ? 0 : cluster.hashCode());
- result = prime * result + (enabled ? 1231 : 1237);
- result = prime * result + (host == null ? 0 : host.hashCode());
- result = prime * result + (node == null ? 0 : node.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- PmConfig other = (PmConfig) obj;
- if (cluster == null) {
- if (other.cluster != null) {
- return false;
- }
- } else if (!cluster.equals(other.cluster)) {
- return false;
- }
- if (enabled != other.enabled) {
- return false;
- }
- if (host == null) {
- if (other.host != null) {
- return false;
- }
- } else if (!host.equals(other.host)) {
- return false;
- }
- if (node == null) {
- if (other.node != null) {
- return false;
- }
- } else if (!node.equals(other.node)) {
- return false;
- }
- return true;
- }
-
- public static PmConfig getDefaultConfiguration() {
- PmConfig c = new PmConfig();
- c.enabled = DEFAULT_VALUE_ENABLED;
- c.cluster = DEFAULT_VALUE_CLUSTER;
- return c;
- }
-
- @Override
- public String toString() {
- return "PmConfig [enabled=" + enabled + ", cluster=" + cluster + ", host=" + host + ", node=" + node + "]";
- }
-
- public static boolean isInstantiated() {
- return pmConfig != null;
- }
-
- public static PmConfig getPm(IniConfigurationFile config, ISubConfigHandler configHandler) {
- if (pmConfig == null) {
- try {
- pmConfig = new PmConfig(config, configHandler);
- } catch (ConfigurationException e) {
- pmConfig = PmConfig.getDefaultConfiguration();
- }
- }
- return pmConfig;
- }
-
- public static PmConfig reload() {
- if (pmConfig == null) {
- return null;
- }
- PmConfig tmpConfig;
- try {
- tmpConfig = new PmConfig(pmConfig.getConfig(), pmConfig.getConfigHandler(), false);
- } catch (ConfigurationException e) {
- tmpConfig = PmConfig.getDefaultConfiguration();
- }
- pmConfig = tmpConfig;
- return pmConfig;
- }
-
- public static void clear() {
- pmConfig=null;
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/ToggleAlarmConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/ToggleAlarmConfig.java
deleted file mode 100644
index da2f10a75..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/ToggleAlarmConfig.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile.ConfigurationException;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.BaseSubConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.ISubConfigHandler;
-
-public class ToggleAlarmConfig extends BaseSubConfig{
-
- private static final String SECTION_MARKER_TA = "toggleAlarmFilter";
- private static final String PROPERTY_KEY_ENABLED = "taEnabled";
- private static final String PROPERTY_KEY_DELAY = "taDelay";
-
- private static final boolean DEFAULT_VALUE_ENABLED = true;
- private static final long DEFAULT_VALUE_DELAY = 3000; //in ms
- private static ToggleAlarmConfig taConfig;
- private boolean enabled;
- private long delay;
-
- public boolean isEnabled() {
- return this.enabled;
- }
- public long getDelay() {
- return this.delay;
- }
- private ToggleAlarmConfig() {
- super();
- this.enabled = DEFAULT_VALUE_ENABLED;
- this.delay=DEFAULT_VALUE_DELAY;
- }
- public ToggleAlarmConfig(IniConfigurationFile config, ISubConfigHandler configHandler) throws ConfigurationException {
- this(config, configHandler, true);
- }
-
- public ToggleAlarmConfig(IniConfigurationFile config, ISubConfigHandler configHandler, boolean save)
- throws ConfigurationException {
-
- super(config, configHandler, SECTION_MARKER_TA);
-
- this.enabled = this.getBoolean(PROPERTY_KEY_ENABLED, DEFAULT_VALUE_ENABLED);
- this.delay = this.getLong(PROPERTY_KEY_DELAY,DEFAULT_VALUE_DELAY);
- if (save) {
- config.setProperty(SECTION_MARKER_TA + "." + PROPERTY_KEY_ENABLED, this.enabled);
- config.setProperty(SECTION_MARKER_TA + "." + PROPERTY_KEY_DELAY, this.delay);
-
- this.save();
- }
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (int) (delay ^ delay >>> 32);
- result = prime * result + (enabled ? 1231 : 1237);
- return result;
- }
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ToggleAlarmConfig other = (ToggleAlarmConfig) obj;
- if (delay != other.delay) {
- return false;
- }
- if (enabled != other.enabled) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "ToggleAlarmConfig [enabled=" + enabled + ", delay=" + delay + "]";
- }
-
- public static ToggleAlarmConfig getDefaultConfiguration() {
- ToggleAlarmConfig c = new ToggleAlarmConfig();
- c.enabled = DEFAULT_VALUE_ENABLED;
- c.delay = DEFAULT_VALUE_DELAY;
- return c;
- }
- public static boolean isInstantiated() {
- return taConfig != null;
- }
-
- public static ToggleAlarmConfig getTa(IniConfigurationFile config, ISubConfigHandler configHandler) {
- if (taConfig == null) {
- try {
- taConfig = new ToggleAlarmConfig(config, configHandler);
- } catch (ConfigurationException e) {
- taConfig = ToggleAlarmConfig.getDefaultConfiguration();
- }
- }
- return taConfig;
- }
-
- public static ToggleAlarmConfig reload() {
- if (taConfig == null) {
- return null;
- }
- ToggleAlarmConfig tmpConfig;
- try {
- tmpConfig = new ToggleAlarmConfig(taConfig.getConfig(), taConfig.getConfigHandler(), false);
- } catch (ConfigurationException e) {
- tmpConfig = ToggleAlarmConfig.getDefaultConfiguration();
- }
- taConfig = tmpConfig;
- return taConfig;
- }
-
- public static void clear() {
- taConfig=null;
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterConfig.java
deleted file mode 100644
index 7d3174bce..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterConfig.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.util;
-
-import com.typesafe.config.Config;
-import java.util.ArrayList;
-import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ClusterConfig {
-
- private static final Logger LOG = LoggerFactory.getLogger(ClusterConfig.class);
-
- private final List<ClusterNodeInfo> seedNodes;
- private final ClusterRoleInfoCollection roles;
- private ClusterNodeInfo ismeInfo;
-
- public static ClusterConfig defaultSingleNodeConfig()
- {
- ClusterConfig cfg=new ClusterConfig();
- cfg.ismeInfo=ClusterNodeInfo.defaultSingleNodeInfo();
- cfg.seedNodes.add(cfg.ismeInfo);
- cfg.roles.add(ClusterRoleInfo.defaultSingleNodeRole());
- return cfg;
- }
- public ClusterConfig()
- {
- this.seedNodes = new ArrayList<>();
- this.roles = new ClusterRoleInfoCollection();
-
- }
- public ClusterConfig(Config o) throws Exception {
- {
- this.seedNodes = new ArrayList<>();
- this.roles = new ClusterRoleInfoCollection();
- List<String> a = o.getStringList("seed-nodes");
- for (int i = 0; i < a.size(); i++) {
- ClusterNodeInfo info = new ClusterNodeInfo(a.get(i));
- this.seedNodes.add(info);
- }
- a = o.getStringList("roles");
- for (int i = 0; i < a.size(); i++) {
- ClusterRoleInfo s = new ClusterRoleInfo(a.get(i));
- this.roles.add(s);
- }
- int idx = this.roles.get(0).getIndex() - 1;
- if (idx >= 0 && idx < this.seedNodes.size()) {
- this.ismeInfo = this.seedNodes.get(idx);
- } else {
- this.ismeInfo = null;
- }
- }
-
- }
-
- public boolean isCluster() {
- return this.seedNodes != null ? this.seedNodes.size() > 1 : false;
- }
-
- public boolean isMe(ClusterNodeInfo i) {
- return this.ismeInfo != null ? this.ismeInfo.equals(i) : false;
- }
-
- public List<ClusterNodeInfo> getSeedNodes() {
- return this.seedNodes;
- }
-
- public String getHostName(String defaultValue) {
- if (getRoleMemberIndex() > 0 && getRoleMemberIndex() <= seedNodes.size()) {
- return this.seedNodes.get(getRoleMemberIndex()-1).getRemoteAddress();
- } else {
- LOG.warn("Seednode not available for roleMemberIndex {}. Using default {}",getRoleMember(), defaultValue);
- return defaultValue;
- }
- }
-
- public String getDBClusterName(String defaultValue) {
- String r = null;
- if (this.seedNodes != null && this.seedNodes.size() > 0) {
- r = String.format("cluster-%s.%d", this.seedNodes.get(0).getRemoteAddress(), this.seedNodes.get(0).getPort());
- }
- if (r == null || r.isEmpty()) {
- r = defaultValue;
- }
- return r;
- }
- public String getClusterSeedNodeName() {
- return this.getClusterSeedNodeName("");
- }
- public String getClusterSeedNodeName(String defaultValue) {
- int idx=this.getRoleMemberIndex()-1;
- String r=null;
- if(this.seedNodes!=null && idx>=0 && this.seedNodes.size()>0 && this.seedNodes.size()>idx)
- {
- r=this.seedNodes.get(idx).getSeedNodeName();
- }
- if (r == null || r.isEmpty()) {
- r = defaultValue;
- }
- return r;
- }
- public int getRoleMemberIndex() {
-
- ClusterRoleInfo role=this.roles.get("member");
- return role!=null?role.getIndex():0;
- }
- public ClusterRoleInfo getRoleMember() {
- return this.roles.get("member");
- }
-
- @Override
- public String toString() {
- return "ClusterConfig [seedNodes=" + seedNodes + ", roles=" + roles + ", ismeInfo=" + ismeInfo + "]";
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterNodeInfo.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterNodeInfo.java
deleted file mode 100644
index 53dcfd102..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterNodeInfo.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.util;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class ClusterNodeInfo {
- private final String protocol;
- private final String clusterName;
- private final String remoteAdr;
- private final int port;
- private final String seedNodeName;
-
- public static ClusterNodeInfo defaultSingleNodeInfo() {
- return new ClusterNodeInfo("akka.tcp","opendaylight-cluster-data","127.0.0.1",2550);
- }
-
- public ClusterNodeInfo(String s) throws Exception {
- final String regex = "([a-z.]*):\\/\\/([a-zA-Z0-9-]*)@([a-zA-Z0-9.-]*):([0-9]*)";
- final Pattern pattern = Pattern.compile(regex);
- final Matcher matcher = pattern.matcher(s);
- if (!matcher.find()) {
- throw new Exception("invalid seedNode format");
- }
- this.seedNodeName = matcher.group();
- this.protocol = matcher.group(1);
- this.clusterName = matcher.group(2);
- this.remoteAdr = matcher.group(3);
- this.port = Integer.parseInt(matcher.group(4));
- }
-
- public ClusterNodeInfo(String protocol, String clustername, String remoteadr, int port) {
- this.protocol=protocol;
- this.clusterName=clustername;
- this.remoteAdr=remoteadr;
- this.port=port;
- this.seedNodeName=this.protocol+"://"+this.clusterName+"@"+this.remoteAdr+":"+this.port;
- }
-
- public String getProtocol() {
- return protocol;
- }
-
- public String getClusterName() {
- return clusterName;
- }
-
- public String getRemoteAddress() {
- return remoteAdr;
- }
- public String getSeedNodeName() {
- return seedNodeName;
- }
-
- public int getPort() {
- return port;
- }
-
- @Override
- public String toString() {
- return "ClusterNodeInfo [protocol=" + protocol + ", clusterName=" + clusterName + ", remoteAdr=" + remoteAdr
- + ", port=" + port + ", seedNodeName=" + seedNodeName + "]";
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterRoleInfo.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterRoleInfo.java
deleted file mode 100644
index fa2a21b6a..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterRoleInfo.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.util;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class ClusterRoleInfo {
- private final String Role;
- private final int Index;
-
- public ClusterRoleInfo(String s) throws Exception {
- final String regex = "([a-zA-Z]*)-([0-9]*)";
- final Pattern pattern = Pattern.compile(regex);
- final Matcher matcher = pattern.matcher(s);
- if (!matcher.find()) {
- throw new Exception("unexpected role format:"+s);
- }
- this.Role = matcher.group(1);
- this.Index = Integer.parseInt(matcher.group(2));
- }
-
- private ClusterRoleInfo(String role, int idx) {
- this.Role=role;
- this.Index=idx;
- }
-
- public static ClusterRoleInfo defaultSingleNodeRole() {
- return new ClusterRoleInfo("member",1);
- }
-
- public String getRole() {
- return Role;
- }
- public int getIndex() {
- return Index;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + Index;
- result = prime * result + (Role == null ? 0 : Role.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ClusterRoleInfo other = (ClusterRoleInfo) obj;
- if (Index != other.Index) {
- return false;
- }
- if (Role == null) {
- if (other.Role != null) {
- return false;
- }
- } else if (!Role.equals(other.Role)) {
- return false;
- }
- return true;
- }
- @Override
- public String toString() {
- return "ClusterRoleInfo [Role=" + Role + ", Index=" + Index + "]";
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterRoleInfoCollection.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterRoleInfoCollection.java
deleted file mode 100644
index 6cb81c2af..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ClusterRoleInfoCollection.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.util;
-
-import java.util.ArrayList;
-
-public class ClusterRoleInfoCollection extends ArrayList<ClusterRoleInfo> {
- private static final long serialVersionUID = 1L;
-
- public ClusterRoleInfo get(String role) {
- for (ClusterRoleInfo info : this) {
- if (info.getRole().equals(role)) {
- return info;
- }
- }
- return null;
- }
-
- public boolean contains(ClusterRoleInfo info) {
- if (info == null) {
- return false;
- }
- for (ClusterRoleInfo i : this) {
- if (i.equals(info)) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ConfigFileObserver.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ConfigFileObserver.java
deleted file mode 100644
index daa572a63..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/util/ConfigFileObserver.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.config.util;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.FileWatchdog;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile.ConfigurationException;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.IConfigChangedListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConfigFileObserver extends FileWatchdog {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConfigFileObserver.class);
-
- private final List<IConfigChangedListener> mConfigChangedHandlers = new ArrayList<>();
- private final IniConfigurationFile mConfig;
-
- public ConfigFileObserver(String filename, long pollIntervallMs, IniConfigurationFile mConfig) {
- super(filename);
- this.setDelay(pollIntervallMs);
- this.mConfig = mConfig;
- }
-
- @Override
- protected void doOnChange() {
-
- LOG.debug("property file has changed");
- try {
- mConfig.reLoad();
- // push event to all listeners
- for (IConfigChangedListener listener : this.mConfigChangedHandlers) {
- listener.onConfigChanged();
- }
- } catch (ConfigurationException e) {
- LOG.warn("error reloading config: " + e.getMessage());
- }
- }
-
- public void registerConfigChangedListener(@Nonnull IConfigChangedListener l) {
- if (!this.mConfigChangedHandlers.contains(l)) {
- this.mConfigChangedHandlers.add(l);
- }
- }
-
- public void unregisterConfigChangedListener(IConfigChangedListener l) {
- this.mConfigChangedHandlers.remove(l);
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeMessages.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeMessages.java
deleted file mode 100644
index e9da90945..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeMessages.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- ecompProvider.sendProblemNotification(ownKeyName, notificationXml);
- * ECOMP Messages are generated an send to destination
- *
- * @author herbert
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl;
-
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.annotation.Nullable;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InventoryInformation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DcaeMessages {
-
- private static final Logger LOG = LoggerFactory.getLogger(DcaeSenderImpl.class);
-
- private static final String DCAE_NORMAL = "NORMAL";
- private static final String DCAE_MINOR = "MINOR";
- private static final String DCAE_WARNING = "WARNING";
- private static final String DCAE_CRITICAL = "CRITICAL";
- private static final String DCAE_MAJOR = "MAJOR";
-
- private static final String eventNamePrefix = "fault_Microwave_Radio_Alarms";
- private static final String eventType = "Microwave_Radio_Alarms";
- private static final String eventSourceType = "Microwave_Radio";
-
- private static final String charset = "UTF-8";
-
- private static final HostnameVerifier allHostsValid = (hostname, session) -> true;
-
- private static final String CONTENT_TYPE_APPJSON = "application/json";
-
- private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter();
-
- //Configurable parameters
- private final DcaeSender dcaeSender;
- private final int heartbeatIntervallSeconds;
- private final String entityName;
- private final DeviceManagerImpl deviceManager;
-
- //Variables
- private int heartbeatsequence = 0;
-
- public DcaeMessages(DcaeSender ecompSender, String entityName, Integer heartbeatIntervallSeconds, DeviceManagerImpl deviceManager) {
- this.dcaeSender = ecompSender;
- this.entityName = entityName;
- this.deviceManager = deviceManager;
- this.heartbeatIntervallSeconds = heartbeatIntervallSeconds;
- }
-
- /**
- * Create a heartbeat message.
- * @return Result string with answer from server
- */
- public String postHeartBeat() {
- String epochTimeMicrosecondsString = getEpochTimeMicroseconds();
- String body = assembleHeartbeatFromTemplate(null,
- epochTimeMicrosecondsString,
- heartbeatsequence++,
- NETCONFTIME_CONVERTER.getTimeStampAsNetconfString()).toString();
- return dcaeSender.sendDcaePost( body);
- }
-
- /**
- * ONF 1.2 Problem Notification
- * @param mountPointName self-explaining
- * @param notification Notification input
- * @return String with answer
- */
-
- public String postNotification(String mountPointName, ProblemNotificationXml notification) {
-
- String problemName = notification.getProblem();
- String sequence = notification.getCounter();
- String objId = notification.getObjectId();
- String severity = convert( notification.getSeverity());
- String timeStamp = convert( notification.getTimeStamp() );
-
- String body = assembleEventNotificationFromTemplate(null,
- timeStamp, sequence,
- mountPointName, objId, problemName, severity, notification.getTimeStamp() ).toString();
-
- return dcaeSender.sendDcaePost( body);
- }
-
- /**
- * Setup a connection to URL with authorisation header
- * @param url e.g. "https://plan.fritz.box:9092/ux/#" or "
- * @param basicAuth authorisation header like "Basic SGVyYmVydDpIZXJiZXJ0"
- * @param insertContentHeader
- * @return Null in case of error or the URLConnection
- * @throws IOException
- * @throws MalformedURLException
- */
- static @Nullable HttpURLConnection openConnection( URL url, String basicAuth, boolean insertContentHeader, @Nullable SSLContext sc) throws MalformedURLException, IOException {
-
- //Prepare the connection
- HttpURLConnection newHttpConnection = null;
- {
- URLConnection newConnection = url.openConnection();
- if (newConnection instanceof HttpURLConnection) {
- LOG.debug("Setup connection to {} ", url.toString());
-
- newHttpConnection = (HttpURLConnection)newConnection;
-
- newHttpConnection.setDoOutput(true); // Triggers POST.
- newHttpConnection.setRequestProperty("Accept-Charset", charset);
- if (basicAuth != null) {
- newHttpConnection.setRequestProperty("Authorization", basicAuth);
- }
- if (insertContentHeader) {
- newHttpConnection.setRequestProperty("Content-Type", CONTENT_TYPE_APPJSON);
- }
-
- if (newHttpConnection instanceof HttpsURLConnection) {
- LOG.debug("SSL connection setup with trust all.");
- HttpsURLConnection newHttpsConnection = (HttpsURLConnection)newHttpConnection;
- if (sc != null) {
- newHttpsConnection.setSSLSocketFactory(sc.getSocketFactory());
- } else {
- LOG.warn("No SSL Contect available");
- }
- newHttpsConnection.setHostnameVerifier(allHostsValid);
- }
- } else {
- LOG.warn("URL not a HTTP protocol: {}", url);
- }
- }
- return newHttpConnection;
- }
-
- /* -----------------
- * Private function for message creation and with templates
- */
-
- /**
- * Get actual microseconds
- * @return String
- */
- private String getEpochTimeMicroseconds() {
- long microseconds = System.nanoTime() / 1000;
- return String.valueOf(microseconds);
- }
-
- /**
- * Assemble heartbeat message
- * @param sb StringBuffer to be used or null to allocate
- * @param epochTimeMicrosecondsString Text with time stamp
- * @param sequence integer sequence number
- * @param eventTimeValueNetconfFormatString like this: 2018-05-14T05:32:17.292Z
- * @return StringBuffer with result
- */
- private StringBuffer assembleHeartbeatFromTemplate(
- StringBuffer sb,
- String epochTimeMicrosecondsString,
- int sequence,
- String eventTimeValueNetconfFormatString) {
-
- if (sb == null) {
- sb = new StringBuffer();
- }
- sb.append("{\n" +
- " \"event\": {\n" +
- " \"commonEventHeader\": {\n" +
- " \"domain\": \"heartbeat\",\n" +
- " \"eventId\": \"testpattern-ab305d54-85b4-a31b-7db2-fb6b9e546015\",\n" +
- " \"eventName\": \"heartbeat_Controller\",\n" +
- " \"eventType\": \"Controller\",\n" +
- " \"priority\": \"Low\",\n" +
- " \"reportingEntityId\": \"\",\n" +
- " \"reportingEntityName\": \""+entityName+"\",\n" +
- " \"sequence\": "+String.valueOf(sequence)+",\n" +
- " \"sourceId\": \"\",\n" +
- " \"sourceName\": \""+entityName+"\",\n" +
- " \"startEpochMicrosec\": "+epochTimeMicrosecondsString+",\n" +
- " \"lastEpochMicrosec\": "+epochTimeMicrosecondsString+",\n" +
- " \"version\": 3.0\n" +
- " },\n" +
- " \"heartbeatFields\": {\n" +
- " \"additionalFields\": [\n" +
- " {\n" +
- " \"name\": \"eventTime\",\n" +
- " \"value\": \""+eventTimeValueNetconfFormatString+"\"\n" +
- " }\n" +
- " ],\n" +
- " \"heartbeatFieldsVersion\": 1.0,\n" +
- " \"heartbeatInterval\": "+heartbeatIntervallSeconds+"\n" +
- " }\n" +
- " }\n" +
- "}\n"
- );
-
- return sb;
- }
-
- /**
- * Assemble notification message
- * @param sb StringBuffer to be used or null to allocate
- * @param epochTimeMicrosecondsString Text with time stamp
- * @param sequence integer sequence number
- * @param mountpointName
- * @param objId
- * @param problemName
- * @param severity
- * @return StringBuffer with result
- */
-
- private StringBuffer assembleEventNotificationFromTemplate(StringBuffer sb,
- String epochTimeMicrosecondsString, String sequence,
- String mountpointName, String objId, String problemName, String severity, String eventTimeValueNetconfFormatString
- ) {
-
- if (sb == null) {
- sb = new StringBuffer();
- }
-
- ONFCoreNetworkElementRepresentation optionalNe = deviceManager != null ? deviceManager.getNeByMountpoint(mountpointName) : null;
- InventoryInformation neInventory = optionalNe != null ? optionalNe.getInventoryInformation() : InventoryInformation.getDefault();
-
- sb.append("{\n" +
- " \"event\": {\n" +
- " \"commonEventHeader\": {\n" +
- " \"domain\": \"fault\",\n" +
- " \"eventId\": \""+mountpointName+"_"+objId+"_"+problemName+"\",\n" +
- " \"eventName\": \""+eventNamePrefix+"_"+problemName+"\",\n" +
- " \"eventType\": \""+eventType+"\",\n" +
- " \"sequence\": "+sequence+",\n" +
- " \"priority\": \"High\",\n" +
- " \"reportingEntityId\": \"\",\n" +
- " \"reportingEntityName\": \""+entityName+"\",\n" +
- " \"sourceId\": \"\",\n" +
- " \"sourceName\": \""+mountpointName+"\",\n" +
- " \"startEpochMicrosec\": "+epochTimeMicrosecondsString+",\n" +
- " \"lastEpochMicrosec\": "+epochTimeMicrosecondsString+",\n" +
- " \"version\": 3.0\n" +
- " },\n" +
- " \"faultFields\": {\n" +
- " \"alarmAdditionalInformation\": [\n" +
- " {\n" +
- " \"name\": \"eventTime\",\n" +
- " \"value\": \""+eventTimeValueNetconfFormatString+"\"\n" +
- " },\n" +
- " {\n" +
- " \"name\": \"equipType\",\n" +
- " \"value\": \""+neInventory.getType()+"\"\n" +
- " },\n" +
- " {\n" +
- " \"name\": \"vendor\",\n" +
- " \"value\": \""+neInventory.getVendor()+"\"\n" +
- " },\n" +
- " {\n" +
- " \"name\": \"model\",\n" +
- " \"value\": \""+neInventory.getModel()+"\"\n" +
- " }\n" +
- " ],\n" +
- " \"faultFieldsVersion\":2.0,\n" +
- " \"eventSourceType\": \""+eventSourceType+"\",\n" +
- " \"alarmCondition\": \""+problemName+"\",\n" +
- " \"alarmInterfaceA\": \""+objId+"\",\n" +
- " \"specificProblem\": \""+problemName+"\",\n" +
- " \"eventSeverity\": \""+severity+"\",\n" +
- " \"vfStatus\": \"Active\"\n" +
- " }\n" +
- " }\n" +
- "}\n"
- );
-
- return sb;
- }
-
- /* -----------------
- * Convert internal type formats into the Ecomp format
- */
-
- private String convert(InternalSeverity severity ) {
- switch( severity ) {
- case NonAlarmed:
- break;
- case Warning:
- return DCAE_WARNING;
- case Minor:
- return DCAE_MINOR;
- case Major:
- return DCAE_MAJOR;
- case Critical:
- return DCAE_CRITICAL;
- }
- return DCAE_NORMAL;
- }
-
-
- /**
- * Time has to be converted into milliseconds
- * @param timeAsString time as string
- * @return as string
- */
- private String convert(String timeAsString) {
-
- long microseconds = -1;
- try {
- microseconds = NETCONFTIME_CONVERTER.getTimeStampFromNetconfAsMilliseconds(timeAsString) * 1000;
- } catch (IllegalArgumentException e) {
- LOG.info("Can not convert timeAsString", e);
- }
- return String.valueOf(microseconds);
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderClient.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderClient.java
deleted file mode 100644
index 0f817323f..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderClient.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.DcaeConfig;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class DcaeProviderClient implements AutoCloseable, ProviderClient {
-
- private static final Logger LOG = LoggerFactory.getLogger(DcaeProviderClient.class);
-
- private final HtDevicemanagerConfiguration htConfig;
- private final IConfigChangedListener configChangedListener;
-
- private final Object lock = new Object();;
- private DcaeProviderWorker worker;
-
- public DcaeProviderClient(HtDevicemanagerConfiguration cfg, String entityName, DeviceManagerImpl deviceManager) {
- LOG.info("Create");
- this.htConfig=cfg;
- worker = new DcaeProviderWorker(this.htConfig.getDcae(), entityName, deviceManager);
- this.configChangedListener = () -> {
- LOG.info("Configuration change. Worker exchanged");
- synchronized(lock) {
- worker.close();
- worker = new DcaeProviderWorker(DcaeConfig.reload(), entityName, deviceManager);
- }
- };
- this.htConfig.registerConfigChangedListener(configChangedListener );
-
- }
-
- @Override
- public void sendProblemNotification(String mountPointName, ProblemNotificationXml notification) {
- synchronized(lock) {
- worker.sendProblemNotification(mountPointName, notification);
- }
- }
-
- @Override
- public void sendProblemNotification(String mountPointName, ProblemNotificationXml notification, boolean neDeviceAlarm) {
- sendProblemNotification(mountPointName, notification);
- }
-
- @Override
- public void close() {
- this.htConfig.unregisterConfigChangedListener(configChangedListener);
- synchronized(lock) {
- worker.close();
- }
- }
-
- /* ---------------------------------------------------------
- * Private
- */
-
-}
-
-
-
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderTask.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderTask.java
deleted file mode 100644
index 2a169db01..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderTask.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- * Event provider to ECOMP for heartbeat message
- *
- * @author herbert
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-class DcaeProviderTask implements Runnable {
-
- private static final Logger LOG = LoggerFactory.getLogger(DcaeProviderTask.class);
-
- private int t = 0;
- private final DcaeMessages dcaeMessages;
-
- DcaeProviderTask(DcaeMessages dcaeMessages) {
- LOG.info("Create eventprovider task");
- this.dcaeMessages = dcaeMessages;
- }
-
- private void sendHeartbeat() {
- dcaeMessages.postHeartBeat();
- }
-
- @Override
- public void run() {
- LOG.debug("DCAE provider heartbeat tick start {}", t++);
- sendHeartbeat();
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderWorker.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderWorker.java
deleted file mode 100644
index 17d09ecb2..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderWorker.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl;
-
-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.config.impl.DcaeConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-class DcaeProviderWorker implements AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(DcaeProviderWorker.class);
-
- private static final int MIN_HEARTBEAT_TIME_SECONDS = 30;
-
- private final ScheduledExecutorService scheduler;
- private final DcaeSenderImpl dcaepClient;
- private final DcaeMessages dcaeMessages;
- private final ScheduledFuture<?> taskReference;
-
- public DcaeProviderWorker(DcaeConfig configuration, String entityName, DeviceManagerImpl deviceManager) {
-
- //Start services
- LOG.info("Configuration: "+configuration);
- int heartbeatSeconds = configuration.getTimerPeriodSeconds();
- if ( heartbeatSeconds < MIN_HEARTBEAT_TIME_SECONDS ) {
- heartbeatSeconds = MIN_HEARTBEAT_TIME_SECONDS;
- LOG.info("Adjust heartbeat intervall to minimum of { } seconds.",heartbeatSeconds);
- }
-
- dcaepClient = new DcaeSenderImpl(configuration.getEventReveicerUrl(), configuration.getUserCredentials());
- dcaeMessages = new DcaeMessages(dcaepClient, entityName, heartbeatSeconds, deviceManager);
-
- //Activate task
- LOG.info("Create Fault manager client Task");
- this.scheduler = Executors.newSingleThreadScheduledExecutor();
- Runnable task = new DcaeProviderTask(dcaeMessages);
-
- LOG.info("Fault task created with "+heartbeatSeconds+" Seconds");
- this.taskReference = this.scheduler.scheduleAtFixedRate(task, 0, heartbeatSeconds, TimeUnit.SECONDS);
- LOG.info("Fault task scheduled");
- }
-
- public void sendProblemNotification(String mountPointName, ProblemNotificationXml notification) {
- LOG.debug("Notification answer: {}", dcaeMessages.postNotification(mountPointName, notification));
- }
-
- @Override
- public void close() {
- this.taskReference.cancel(false);
- try {
- this.scheduler.shutdown();
- this.scheduler.awaitTermination(5, TimeUnit.SECONDS);
- } catch (InterruptedException | SecurityException e) {
- LOG.debug("Schedler shutdown interrupted with exception: ",e);
- if (e instanceof InterruptedException) {
- Thread.currentThread().interrupt();
- }
- }
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeSender.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeSender.java
deleted file mode 100644
index 5ebc37d51..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeSender.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl;
-
-/**
- * @author herbert
- *
- */
-public interface DcaeSender {
-
- public String sendDcaePost(String body);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeSenderImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeSenderImpl.java
deleted file mode 100644
index 9b386add5..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeSenderImpl.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- * Client for ECOMP notification server
- *
- * Reference: @link
- * http://stackoverflow.com/questions/13022717/java-and-https-url-connection-without-downloading-certificate
- *
- * @author herbert
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.KeyManagementException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.CertificateException;
-import java.security.spec.InvalidKeySpecException;
-import java.util.Base64;
-import javax.net.ssl.SSLContext;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.http.BaseHTTPClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DcaeSenderImpl implements DcaeSender {
-
- private static final Logger LOG = LoggerFactory.getLogger(DcaeSenderImpl.class);
- private static final String EMPTY = "";
- private static final String charset = "UTF-8";
-
- private final String urlString;
- private final String basicAuth;
-
- private SSLContext sc = null;
- private URL url = null;
- private HttpURLConnection connection = null;
-
- public DcaeSenderImpl(String url, String userCredentials) {
-
- LOG.info("DcaeSenderImpl setup start with {} {}", url, userCredentials);
-
- this.urlString = url;
- this.basicAuth = "Basic " + new String(Base64.getEncoder().encode(userCredentials.getBytes()));
-
- if (urlString != null && !urlString.equals("off")) {
- try {
- this.url = new URL(url);
- sc = BaseHTTPClient.setupSsl(true);
- } catch (KeyManagementException | NoSuchAlgorithmException | UnrecoverableKeyException
- | CertificateException | KeyStoreException | InvalidKeySpecException | IOException e) {
- LOG.warn("SSL setup failed: {}", e.getMessage());
- }
- }
- LOG.info("DcaeSenderImpl setup ends");
- }
-
- /**
- * Send message to ECOMP Server
- *
- * @param body for POST message
- */
- @Override
- public String sendDcaePost(String body) {
-
- if (url != null) {
- try {
- connection = DcaeMessages.openConnection(url, basicAuth, true, sc);
- if (connection != null) {
- return processPost(connection, body);
- } else {
- LOG.warn("No SSL context available");
- }
- } catch (IOException e) {
- LOG.warn("Dcae post failed {}", e.getMessage());
- }
- }
- return EMPTY;
- }
-
- /**
- * Connect to Server and expect answer.
- *
- * @return with answer body
- */
- public String testConnectServer() {
-
- if (url != null) {
- try {
- connection = DcaeMessages.openConnection(url, null, false, sc);
- if (connection != null) {
- return receiveInitialAnswer(connection);
- }
- } catch (IOException e) {
- LOG.warn("Dcae post failed {}", e.getMessage());
- }
- }
- return EMPTY;
- }
-
- /**
- * Show status in readable form for testing
- *
- * @return String with result
- */
- public String getStatusAsString() {
- StringBuffer sb = new StringBuffer();
-
- sb.append("URL: " + url.getPath() + " " + url.getPort() + " Host: " + url.getHost());
- sb.append("\n");
- if (connection != null) {
- sb.append("Connection setup: ");
- sb.append(connection.getClass().getName());
- sb.append(" ");
- } else {
- sb.append("Connection setup: No connection (server problem or switched off)");
- }
- return sb.toString();
-
- }
-
-
- /*------------------------------------------------------------------------------
- * Private functions
- */
-
-
- /**
- * Send Post and wait for answer
- *
- * @param connection
- * @param body
- * @return
- * @throws IOException
- */
- private static String processPost(HttpURLConnection connection, String body) throws IOException {
-
- LOG.debug("Post message: {}", connection.getURL().toString());
- if (LOG.isTraceEnabled()) {
- LOG.trace("Body: {} ", body);
- }
-
- // Send the message to destination
- try (OutputStream output = connection.getOutputStream()) {
- output.write(body.getBytes(charset));
- }
-
- // Receive answer
- InputStream response = null;
- BufferedReader rd = null;
- StringBuilder result = new StringBuilder();
-
- try {
- int responseCode = connection.getResponseCode();
- LOG.debug("Response code: {}", String.valueOf(responseCode));
-
- if (responseCode >= 200 && responseCode < 300) {
- response = connection.getInputStream();
- } else {
- response = connection.getErrorStream();
- if (response == null) {
- response = connection.getInputStream();
- }
- }
- if (response != null) {
- rd = new BufferedReader(new InputStreamReader(response));
- String line;
- while ((line = rd.readLine()) != null) {
- result.append(line);
- }
- }
- } catch (IOException e) {
- LOG.debug("No response received: {}", e.getMessage());
- } finally {
- if (response != null) {
- response.close();
- }
- if (rd != null) {
- rd.close();
- }
- }
-
- LOG.trace("Result: {} ", result);
- return result.toString();
- }
-
- /**
- * Read initial answer from Server after connect
- *
- * @param connection that was opened
- * @return String with answer message
- * @throws IOException
- */
- private static String receiveInitialAnswer(URLConnection iConnection) throws IOException {
-
-
- final StringBuffer response = new StringBuffer();
-
- if (iConnection != null) {
-
- final Reader reader = new InputStreamReader(iConnection.getInputStream());
- final BufferedReader br = new BufferedReader(reader);
- String line = "";
- while ((line = br.readLine()) != null) {
- response.append(line);
- response.append("\n");
- }
- br.close();
- }
-
- return response.toString();
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/Checker.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/Checker.java
deleted file mode 100644
index 1091c41eb..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/Checker.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- * (c) highstreet technologies GmbH
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Steps to Monitor the connection to a network element during state connected
- */
-abstract class Checker {
-
- @SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(Checker.class);
-
- /**
- * Check action.
- * @return true if reachable, false if not
- */
- abstract boolean isReachableOnce();
-
- /**
- * Procedure to check the connection of one mountpoint
- * @return true if reachable, false if not
- */
- boolean isConnected() {
- return isReachableOnce();
- }
-}
-
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitor.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitor.java
deleted file mode 100644
index dd5ffd40b..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitor.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl;
-
-public interface DeviceMonitor extends AutoCloseable {
-
- /**
- * Referesh database by raising all alarms again.
- */
- void refreshAlarmsInDb();
-
- /**
- * removeMountpointIndication deregisters a mountpoint for registration services
- * @param mountPointNodeName to deregister
- */
- void removeMountpointIndication(String mountPointNodeName);
-
- /**
- * Notify of device state change to "disconnected"
- * Mount point supervision
- * @param mountPointNodeName to deregister
- */
- void deviceDisconnectIndication(String mountPointNodeName);
-
- /**
- * Notify of device state changes to "connected"
- * @param mountPointNodeName name of mount point
- * @param ne to monitor
- */
- void deviceConnectMasterIndication(String mountPointNodeName, DeviceMonitoredNe ne);
-
- /**
- * Notify of device state changes to "connected" for slave nodes
- * @param mountPointNodeName name of mount point
- */
- void deviceConnectSlaveIndication(String mountPointNodeName);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorEmptyImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorEmptyImpl.java
deleted file mode 100644
index ef2af1ae3..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorEmptyImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl;
-
-public class DeviceMonitorEmptyImpl implements DeviceMonitor {
-
- @Override
- public void refreshAlarmsInDb() {
- }
-
- @Override
- public void removeMountpointIndication(String mountPointNodeName) {
- }
-
- @Override
- public void deviceConnectMasterIndication(String mountPointNodeName, DeviceMonitoredNe ne) {
- }
-
- @Override
- public void deviceDisconnectIndication(String mountPointNodeName) {
- }
-
- @Override
- public void deviceConnectSlaveIndication(String mountPointNodeName) {
- }
-
- @Override
- public void close() throws Exception {
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java
deleted file mode 100644
index 0149d6fca..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- * (c) 2017 highstreet technologies GmbH
- */
-
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl;
-
-import java.util.Enumeration;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.DmConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.ODLEventListener;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Implementation of concept "Active monitoring" of a device.<br>
- * <br>
- * For each existing mountpoint a task runs with 120s cycle time. Every 120 seconds the check actions are performed.
- * The request is handled by the NETCONF layer with a (default)configured time-out of 60 seconds.<br>
- * Generated alarms, by the object/node "SDN-Controller" are (enum DeviceMonitorProblems):<br>
- * - notConnected(InternalSeverity.Warning)<br>
- * - noConnectionMediator(InternalSeverity.Minor)<br>
- * - noConnectionNe(InternalSeverity.Critical)<br>
- * <br>
- * 1. Mountpoint does not exist<br>
- * If the mountpoint does not exists there are no related current alarms in the database.<br>
- * <br>
- * 2. Created mountpoint with state "Connecting" or "UnableToConnect"<br>
- * If the Mountpoint is created and connection status is "Connecting" or "UnableToConnect".<br>
- * - After about 2..4 Minutes ... raise alarm "notConnected" with severity warning<br>
- * <br>
- * 3. Created mountpoint with state "Connection"<br>
- * There are two monitor activities.<br>
- * 3a. Check of Mediator connection by requesting (typical) cached data.<br>
- * - After about 60 seconds raise alarm: connection-loss-mediator with severity minor<br>
- * - Request from Mediator: network-element<br>
- * <br>
- * 3b. Check connection to NEby requesting (typical) non-cached data.<br>
- * - Only if AirInterface available. The first one is used.<br>
- * - Requested are the currentAlarms<br>
- * - After about 60 seconds raise alarm: connection-loss-network-element with severity critical<br>
- * <br>
- * @author herbert
- */
-
-@SuppressWarnings("deprecation")
-public class DeviceMonitorImpl implements DeviceMonitor, IConfigChangedListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(DeviceMonitorImpl.class);
-
- private final ConcurrentHashMap<String, DeviceMonitorTask> queue;
- private final ScheduledExecutorService scheduler;
- private final ODLEventListener odlEventListener;
- @SuppressWarnings("unused")
- private final DataBroker dataBroker; //Future usage
-
- /*-------------------------------------------------------------
- * Construction/ destruction of service
- */
-
- /**
- * Basic implementation of devicemonitoring
- * @param odlEventListener as destination for problems
- */
- public DeviceMonitorImpl(DataBroker dataBroker, ODLEventListener odlEventListener, HtDevicemanagerConfiguration htconfig) {
- LOG.info("Construct {}", this.getClass().getSimpleName());
-
- this.odlEventListener = odlEventListener;
- this.dataBroker = dataBroker;
-
- htconfig.registerConfigChangedListener(this);
- DmConfig dmConfig = htconfig.getDmConfig();
- setDmConfig(dmConfig);
-
- this.queue = new ConcurrentHashMap<>();
- this.scheduler = Executors.newScheduledThreadPool(10);
- }
-
- /**
- * Stop the service. Stop all running monitoring tasks.
- */
- @Override
- synchronized public void close() {
- LOG.info("Close {}", this.getClass().getSimpleName());
-
- Enumeration<String> e = queue.keys();
- while (e.hasMoreElements()) {
- deviceDisconnectIndication(e.nextElement());
- }
-
- scheduler.shutdown();
- }
-
- @Override
- public void onConfigChanged() {
- DmConfig cfg = DmConfig.reload();
- setDmConfig(cfg);
- }
-
- private void setDmConfig(DmConfig dmConfig) {
- for (DeviceMonitorProblems problem : DeviceMonitorProblems.values()) {
- problem.setSeverity(dmConfig.getSeverity(problem));
- }
- }
-
- /*-------------------------------------------------------------
- * Start/ stop/ update service for Mountpoint
- */
-
- /**
- * Notify of device state changes to "connected" for slave nodes
- * @param mountPointNodeName name of mount point
- */
- synchronized public void deviceConnectSlaveIndication(String mountPointNodeName) {
- deviceConnectMasterIndication(mountPointNodeName, null);
- }
-
- /**
- * Notify of device state changes to "connected"
- * @param mountPointNodeName name of mount point
- * @param ne to monitor
- */
- synchronized public void deviceConnectMasterIndication(String mountPointNodeName, DeviceMonitoredNe ne) {
-
- LOG.debug("ne changes to connected state {}",mountPointNodeName);
- createMonitoringTask(mountPointNodeName);
- if (queue.containsKey(mountPointNodeName)) {
- DeviceMonitorTask task = queue.get(mountPointNodeName);
- task.deviceConnectIndication(ne);
- } else {
- LOG.warn("Monitoring task not in queue: {} {} {}", mountPointNodeName, mountPointNodeName.hashCode(), queue.size());
- }
- }
-
- /**
- * Notify of device state change to "disconnected"
- * Mount point supervision
- * @param mountPointNodeName to deregister
- */
- synchronized public void deviceDisconnectIndication(String mountPointNodeName) {
-
- LOG.debug("State changes to not connected state {}",mountPointNodeName);
- createMonitoringTask(mountPointNodeName);
- if (queue.containsKey(mountPointNodeName)) {
- DeviceMonitorTask task = queue.get(mountPointNodeName);
- task.deviceDisconnectIndication();
- } else {
- LOG.warn("Monitoring task not in queue: {} {} {}", mountPointNodeName, mountPointNodeName.hashCode(), queue.size());
- }
- }
-
- /**
- * removeMountpointIndication deregisters a mountpoint for registration services
- * @param mountPointNodeName to deregister
- */
- synchronized public void removeMountpointIndication(String mountPointNodeName) {
-
- if (queue.containsKey(mountPointNodeName)) {
- DeviceMonitorTask task = queue.get(mountPointNodeName);
- //Remove from here
- queue.remove(mountPointNodeName);
- //Clear all problems
- task.removeMountpointIndication();
- LOG.debug("Task stopped: {}", mountPointNodeName);
- } else {
- LOG.warn("Task not in queue: {}", mountPointNodeName);
- }
- }
-
- /**
- * Referesh database by raising all alarms again.
- */
- public void refreshAlarmsInDb() {
- synchronized(queue) {
- for (DeviceMonitorTask task : queue.values()) {
- task.refreshAlarms();
- }
- }
- }
-
- /*-------------------------------------------------------------
- * Private functions
- */
-
- /**
- * createMountpoint registers a new mountpoint monitoring service
- * @param mountPointNodeName name of mountpoint
- */
- synchronized private DeviceMonitorTask createMonitoringTask(String mountPointNodeName) {
-
- DeviceMonitorTask task;
- LOG.debug("Register for monitoring {} {}",mountPointNodeName, mountPointNodeName.hashCode());
-
- if (queue.containsKey(mountPointNodeName)) {
- LOG.info("Monitoring task exists");
- task = queue.get(mountPointNodeName);
- } else {
- LOG.info("Do start of DeviceMonitor task");
- //Runnable task = new PerformanceManagerTask(queue, databaseService);
- task = new DeviceMonitorTask(mountPointNodeName, this.odlEventListener);
- queue.put(mountPointNodeName, task);
- task.start(scheduler);
- }
- return task;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorProblems.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorProblems.java
deleted file mode 100644
index 812d4dcf3..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorProblems.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- * Problems generated by DeviceMonitor
- *
- * @author herbert
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl;
-
-import javax.annotation.Nullable;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public enum DeviceMonitorProblems {
-
- /**
- * Mountpoint is not connected via NETCONF with NE/Mediator = ssh connection
- */
- connectionLossOAM(InternalSeverity.Major),
-
- /**
- * Mountpoint is connected via Netconf to Mediator, but mediator is not responding.
- * Connection state to NE is unknown.
- */
- connectionLossMediator(InternalSeverity.Major),
-
- /** Mountpoint is connected via Netconf to Mediator.
- * This connection is OK, but mediator <-> NE Connection is not OK
- */
- connectionLossNeOAM(InternalSeverity.Major);
-
- private static final Logger LOG = LoggerFactory.getLogger(DeviceMonitorProblems.class);
- InternalSeverity severity;
-
- DeviceMonitorProblems(@Nullable InternalSeverity severity) {
- if (severity != null) {
- this.severity = severity;
- }
- }
-
- InternalSeverity getSeverity() {
- return severity;
- }
-
- public void setSeverity(InternalSeverity severity) {
- LOG.info("Change severity for {} from {} to {}", name(), this.severity, severity);
- this.severity=severity;
- }
-
-}
-
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorTask.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorTask.java
deleted file mode 100644
index 04d15cc19..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorTask.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- * @author herbert
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl;
-
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.Set;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.ODLEventListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DeviceMonitorTask implements Runnable {
-
- private static final Logger LOG = LoggerFactory.getLogger(DeviceMonitorTask.class);
- private static final String LOGMARKER = "DMTick";
- private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter();
-
- private final String mountPointName;
- private final ODLEventListener odlEventListener;
- private final Checker checkConnectionToMediator;
- private final Checker checkConnectionToNe;
-
- private int tickCounter; //Added for each tick. Not relevant for internal status
-
- private ScheduledFuture<?> taskHandle;
- private final Object lockNe = new Object(); //USe top lock access to member ne
- private @Nullable DeviceMonitoredNe ne; //Indication if in status connect or disconnect
- private @Nonnull Boolean mountpointConnectingStateSupervision; //Indication of mountpoint supervision
-
- private final Object lockDisconnectSupervisionTickout = new Object();
- private Integer disconnectSupervisionTickout; //Tickcounter of task ticks for "not connected indication"
- private Set<DeviceMonitorProblems> currentProblems; //List with actual problems. Synchronized by itself
-
- /*------------------------------------------------------------
- * Construction
- */
-
- /**
- * Setup monitoring task
- * @param mountPointName to monitor
- * @param odlEventListener to forward problems to
- */
- public DeviceMonitorTask(String mountPointName, ODLEventListener odlEventListener) {
- LOG.debug("Init task {}", DeviceMonitorTask.class.getSimpleName());
-
- //Setup finals
- this.mountPointName = mountPointName;
- this.odlEventListener = odlEventListener;
- this.checkConnectionToMediator = new Checker() {
- @Override
- boolean isReachableOnce() {
- synchronized(lockNe) {
- //mountpoint state "Connected"
- //If for any reason the mountpoint is Connected, but Notconf messages are not received
- return ne == null ? true : ne.checkIfConnectionToMediatorIsOk();
- }
- }
- };
- this.checkConnectionToNe = new Checker() {
- @Override
- boolean isReachableOnce() {
- synchronized(lockNe) {
- //mountpoint state "Connected"
- //If netconf mediator (netconf application software for NE) has connection loss to managed device.
- //The networkelement object is available, but there is no interfacepack available.
- return ne == null ? true : ne.checkIfConnectionToNeIsOk();
- }
- }
- };
-
- //Setup parameters
- this.taskHandle = null;
- this.tickCounter = 0;
- this.ne = null;
- this.mountpointConnectingStateSupervision = false;
- this.currentProblems = Collections.synchronizedSet(EnumSet.noneOf(DeviceMonitorProblems.class));
- this.disconnectSupervisionTickout = 0;
-
- int removed = odlEventListener.removeAllCurrentProblemsOfNode(mountPointName);
- LOG.debug("{} Init task removed fault entries {}", LOGMARKER, removed);
-
- }
-
- /**
- * Start for each object an own instance of the thread.
- * @param scheduler for all the threads.
- */
- public void start(ScheduledExecutorService scheduler) {
- LOG.info("{} {} DeviceMonitor task to create", LOGMARKER, tickCounter);
- if (taskHandle == null) {
- startDisconnectSupervision();
- taskHandle = scheduler.scheduleAtFixedRate(this, 0, 120, TimeUnit.SECONDS);
- LOG.info("DeviceMonitor task scheduled");
- } else {
- LOG.error("{} {} Task already running.", LOGMARKER, tickCounter);
- }
- }
-
- /**
- * Call after NE change state to connected.
- * Mountpoint exists. Status is Connecting.
- * @param neParam that connected
- */
-
- public void deviceConnectIndication(DeviceMonitoredNe neParam) {
- LOG.info("{} {} Connect {} and stop.", LOGMARKER, tickCounter, mountPointName);
- clear(DeviceMonitorProblems.connectionLossOAM);
- synchronized(lockNe) {
- this.ne = neParam;
- this.mountpointConnectingStateSupervision = false;
- }
- stopDisconnectSupervision();
- }
-
- /**
- * If ne is disconnected do the related actions.
- * - Mountpoint exists. Status is Connecting or UnableToConnect
- */
-
- public void deviceDisconnectIndication() {
- LOG.info("{} {} Disconnect {} and start.", LOGMARKER, tickCounter, mountPointName);
- clear(DeviceMonitorProblems.connectionLossOAM);
- synchronized(lockNe) {
- this.ne = null;
- this.mountpointConnectingStateSupervision = true;
- }
- startDisconnectSupervision();
- }
-
- /**
- * Do all actions to clean up the log if mountpoint has been deleted.
- * - Mountpoint removed
- * Prepare cancellation of the task and cancel task
- */
-
- public void removeMountpointIndication() {
- for (DeviceMonitorProblems problem : DeviceMonitorProblems.values()) {
- clear(problem);
- }
- //Cancel the task
- if (this.taskHandle != null) {
- this.taskHandle.cancel(false);
- LOG.info("{} {} DeviceMonitor task canceled for {}", LOGMARKER, tickCounter, mountPointName);
- } else {
- LOG.error("{} {} Task already stopped", LOGMARKER, tickCounter);
- }
- }
-
- /**
- * Referesh Alarms
- */
- public void refreshAlarms() {
- LOG.debug("{} Start refresh of all problems",LOGMARKER);
- synchronized(currentProblems) {
- for (DeviceMonitorProblems problem : currentProblems) {
- LOG.debug("{} Refresh problem {} Raised-status {}",LOGMARKER, problem.name(), currentProblems.contains(problem));
- odlEventListener.onProblemNotification(mountPointName, problem.name(), problem.getSeverity());
- }
- }
- LOG.debug("{} Finish refresh of all problems",LOGMARKER);
- }
-
- /*------------------------------------------------------------
- * Functions to clear/raise alarm
- */
-
- /**
- * Raise a problem, but only once
- * @param problem
- */
- private void raise(DeviceMonitorProblems problem) {
- LOG.debug("{} Raise problem {} Raised-status {}",LOGMARKER, problem.name(), currentProblems.contains(problem));
- synchronized(currentProblems) {
- if (! currentProblems.contains(problem)) {
- currentProblems.add(problem);
- odlEventListener.onProblemNotification(mountPointName, problem.name(), problem.getSeverity());
- }
- }
- }
-
- /**
- * Raise a problem, but only once
- * @param problem
- */
- private void clear(DeviceMonitorProblems problem) {
- LOG.debug("{} Clear problem {} Raised-status {}",LOGMARKER, problem.name(), currentProblems.contains(problem));
- synchronized(currentProblems) {
- if (currentProblems.contains(problem)) {
- currentProblems.remove(problem);
- odlEventListener.onProblemNotification(mountPointName, problem.name(), InternalSeverity.NonAlarmed);
- }
- }
- }
-
- /**
- * Process problem notification cascade
- * @param isReachable
- * @param problem
- */
- private void clearRaiseIfConnected(Checker checker, DeviceMonitorProblems problem) {
- LOG.debug("{} check start {} problem {} Raised-status {}",LOGMARKER, tickCounter, problem.name(), currentProblems.contains(problem));
- if (checker.isConnected()) {
- clear(problem);
- } else {
- raise(problem);
- }
- LOG.debug("{} check end {} problem {} Raised-status {}",LOGMARKER, tickCounter, problem.name(), currentProblems.contains(problem));
- }
-
- /*------------------------------------------------------------
- * Functions to start/stop
- */
-
- private void startDisconnectSupervision() {
- synchronized(lockDisconnectSupervisionTickout) {
- this.disconnectSupervisionTickout = 2;
- }
- }
-
- private void stopDisconnectSupervision() {
- synchronized(lockDisconnectSupervisionTickout) {
- this.disconnectSupervisionTickout = 0;
- }
- }
-
- private boolean processDisconnectSupervisionAndCheckExceeded() {
- synchronized(lockDisconnectSupervisionTickout) {
- if (disconnectSupervisionTickout == 0) {
- return true;
- } else if (disconnectSupervisionTickout > 0) {
- disconnectSupervisionTickout--;
- }
- return false;
- }
- }
-
- /*------------------------------------------------------------
- * TASK
- */
-
- /**
- * Task to monitor connectivity to Network Elements.
- * Connectivity problems lead to alarm indication.
- */
- @Override
- public void run() {
-
- try {
- LOG.debug("{} UTCTime {} START mountpoint {} tick {} connecting supervision {} tickout {}",
- LOGMARKER,
- NETCONFTIME_CONVERTER.getTimeStamp(),
- mountPointName,
- tickCounter,
- mountpointConnectingStateSupervision,
- disconnectSupervisionTickout);
-
- if (mountpointConnectingStateSupervision) {
- LOG.debug("{} {} Mountpoint supervision {}", LOGMARKER, tickCounter, mountPointName);
- if (processDisconnectSupervisionAndCheckExceeded()) {
- raise(DeviceMonitorProblems.connectionLossOAM);
- }
-
- } else {
- synchronized (lockNe) {
- if (ne != null) {
- //checks during "Connected"
- clear(DeviceMonitorProblems.connectionLossOAM); //Always cleared never raised
- LOG.debug("{} {} Prepare check", LOGMARKER, tickCounter);
- ne.prepareCheck(); // Prepare ne check
- // Mediator check
- LOG.debug("{} {} Mediator check", LOGMARKER, tickCounter);
- clearRaiseIfConnected(checkConnectionToMediator, DeviceMonitorProblems.connectionLossMediator);
-
- // NE check
- LOG.debug("{} {} Ne check", LOGMARKER, tickCounter);
- clearRaiseIfConnected(checkConnectionToNe, DeviceMonitorProblems.connectionLossNeOAM);
- } else {
- //Monitor switch off.
- LOG.debug("{} {} Monitor switch off state", LOGMARKER, tickCounter);
- clear(DeviceMonitorProblems.connectionLossOAM); //Always cleared never raised
- clear(DeviceMonitorProblems.connectionLossMediator); //Always cleared never raised
- clear(DeviceMonitorProblems.connectionLossNeOAM); //Always cleared never raised
- }
- }
- }
- } catch (Exception e) {
- //Prevent stopping the task
- LOG.warn("{} {} During DeviceMontoring task",LOGMARKER, tickCounter, e);
- }
- LOG.debug("{} {} END", LOGMARKER, tickCounter++);
-
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitoredNe.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitoredNe.java
deleted file mode 100644
index ec19f17b9..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitoredNe.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl;
-
-/**
- * @author herbert
- *
- */
-public interface DeviceMonitoredNe {
-
- /**
- * Prepare subsequent check calls
- */
- public void prepareCheck();
-
- /**
- * Test connection to mediator, by getting data that have to be called from NE
- * @return true if connection working, false if not
- */
- public boolean checkIfConnectionToMediatorIsOk();
-
- /**
- * Test connection to NE via mediator, by getting data that have to be called from NE
- * @return true if connection working, false if not
- */
- public boolean checkIfConnectionToNeIsOk();
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java
deleted file mode 100644
index 79b4b056f..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import java.util.List;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceRPCServiceAPI;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.impl.MaintenanceServiceImpl;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ClearCurrentFaultByNodenameInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ClearCurrentFaultByNodenameOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ClearCurrentFaultByNodenameOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.DevicemanagerService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetMaintenanceModeInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetMaintenanceModeOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetMaintenanceModeOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetRequiredNetworkElementKeysInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetRequiredNetworkElementKeysOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetRequiredNetworkElementKeysOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SetMaintenanceModeInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SetMaintenanceModeOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SetMaintenanceModeOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ShowRequiredNetworkElementInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ShowRequiredNetworkElementOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ShowRequiredNetworkElementOutputBuilder;
-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.TestMaintenanceModeOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.TestMaintenanceModeOutputBuilder;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("deprecation")
-public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(DevicemanagerService.class);
-
- private final RpcRegistration<DevicemanagerService> rpcReg;
-
- private MaintenanceRPCServiceAPI maintenanceService;
- private ResyncNetworkElementsListener resyncCallbackListener;
-
- DeviceManagerApiServiceImpl(final RpcProviderRegistry rpcProviderRegistry) {
- // Register ourselves as the REST API RPC implementation
- LOG.info("Register RPC Service "+DevicemanagerService.class.getSimpleName());
- this.maintenanceService = null;
- this.rpcReg = rpcProviderRegistry.addRpcImplementation(DevicemanagerService.class, this);
- }
-
- public void setMaintenanceService(MaintenanceServiceImpl maintenanceService2) {
- this.maintenanceService = maintenanceService2;
- }
-
- @Override
- public void close() throws Exception {
- LOG.info("Close RPC Service");
- if (rpcReg != null) {
- rpcReg.close();
- }
- }
-
- /*-------------------------------
- * Interfaces for MaintenanceService
- */
-
- @Override
- public ListenableFuture<RpcResult<GetRequiredNetworkElementKeysOutput>> getRequiredNetworkElementKeys(
- GetRequiredNetworkElementKeysInput input) {
- return getRequiredNetworkElementKeys();
- }
-
- // For casablanca version no input was generated.
- public ListenableFuture<RpcResult<GetRequiredNetworkElementKeysOutput>> getRequiredNetworkElementKeys() {
-
- LOG.info("RPC Request: getRequiredNetworkElementKeys");
- RpcResultBuilder<GetRequiredNetworkElementKeysOutput> result;
- try {
- GetRequiredNetworkElementKeysOutputBuilder outputBuilder = maintenanceService.getRequiredNetworkElementKeys();
- result = RpcResultBuilder.success(outputBuilder);
- } catch (Exception e) {
- result = RpcResultBuilder.failed();
- result.withError(ErrorType.APPLICATION, "Exception", e);
- }
- return result.buildFuture();
- }
-
- @Override
- public ListenableFuture<RpcResult<ShowRequiredNetworkElementOutput>> showRequiredNetworkElement(
- ShowRequiredNetworkElementInput input) {
-
- LOG.info("RPC Request: showRequiredNetworkElement input: {}", input.getMountpointName());
- RpcResultBuilder<ShowRequiredNetworkElementOutput> result;
-
- try {
- ShowRequiredNetworkElementOutputBuilder outputBuilder = maintenanceService.showRequiredNetworkElement(input);
- result = RpcResultBuilder.success(outputBuilder);
- } catch (Exception e) {
- result = RpcResultBuilder.failed();
- result.withError(ErrorType.APPLICATION, "Exception", e);
- }
- return result.buildFuture();
- }
-
- @Override
- public ListenableFuture<RpcResult<SetMaintenanceModeOutput>> setMaintenanceMode(SetMaintenanceModeInput input) {
-
- LOG.info("RPC Request: setMaintenanceMode input: {}", input.getMountpointName());
- RpcResultBuilder<SetMaintenanceModeOutput> result;
-
- try {
- SetMaintenanceModeOutputBuilder outputBuilder = maintenanceService.setMaintenanceMode(input);
- result = RpcResultBuilder.success(outputBuilder);
- } catch (Exception e) {
- result = RpcResultBuilder.failed();
- result.withError(ErrorType.APPLICATION, "Exception", e);
- }
- return result.buildFuture();
-
- }
-
-
-
- @Override
- public ListenableFuture<RpcResult<GetMaintenanceModeOutput>> getMaintenanceMode(GetMaintenanceModeInput input) {
-
- LOG.info("RPC Request: getMaintenanceMode input: {}", input.getMountpointName());
- RpcResultBuilder<GetMaintenanceModeOutput> result;
-
- try {
- GetMaintenanceModeOutputBuilder outputBuilder = maintenanceService.getMaintenanceMode(input);
- result = RpcResultBuilder.success(outputBuilder);
- } catch (Exception e) {
- result = RpcResultBuilder.failed();
- result.withError(ErrorType.APPLICATION, "Exception", e);
- }
- return result.buildFuture();
-
- }
-
- @Override
- public ListenableFuture<RpcResult<TestMaintenanceModeOutput>> testMaintenanceMode(TestMaintenanceModeInput input) {
- LOG.info("RPC Request: getMaintenanceMode input: {}", input.getMountpointName());
- RpcResultBuilder<TestMaintenanceModeOutput> result;
-
- try {
- TestMaintenanceModeOutputBuilder outputBuilder = maintenanceService.testMaintenanceMode(input);
- result = RpcResultBuilder.success(outputBuilder);
- } catch (Exception e) {
- result = RpcResultBuilder.failed();
- result.withError(ErrorType.APPLICATION, "Exception", e);
- }
- return result.buildFuture();
-
- }
-
-
- @Override
- public ListenableFuture<RpcResult<ClearCurrentFaultByNodenameOutput>> clearCurrentFaultByNodename(
- ClearCurrentFaultByNodenameInput input) {
- LOG.info("RPC Request: clearNetworkElementAlarms input: {}", input.getNodenames());
- RpcResultBuilder<ClearCurrentFaultByNodenameOutput> result;
- try {
- if(this.resyncCallbackListener!=null) {
- List<String> nodeNames= this.resyncCallbackListener.doClearCurrentFaultByNodename(input.getNodenames());
- ClearCurrentFaultByNodenameOutputBuilder outputBuilder = new ClearCurrentFaultByNodenameOutputBuilder();
- outputBuilder.setNodenames(nodeNames);
- result = RpcResultBuilder.success(outputBuilder);
- } else {
- result = RpcResultBuilder.failed();
- result.withError(ErrorType.APPLICATION, "Startup running" );
- }
- } catch(Exception e) {
- result = RpcResultBuilder.failed();
- result.withError(ErrorType.APPLICATION, "Exception", e);
- }
- return result.buildFuture();
- }
-
- public void setResyncListener(ResyncNetworkElementsListener listener) {
- this.resyncCallbackListener = listener;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java
deleted file mode 100644
index e5e3d6e48..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java
+++ /dev/null
@@ -1,756 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl;
-
-import com.google.common.base.Optional;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl.AaiProviderClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice.ArchiveCleanService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseNode;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementFactory;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter.NotificationDelayService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.AkkaConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.EsConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.GeoConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.PmConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeProviderClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitor;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitorEmptyImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitorImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service.HtDatabaseEventsService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.NetconfChangeListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.ODLEventListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientDummyImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientImpl2;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.index.impl.IndexMwtnService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.index.impl.IndexUpdateService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.impl.MaintenanceServiceImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.PerformanceManagerImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.service.MicrowaveHistoricalPerformanceWriterService;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.MountPoint;
-import org.opendaylight.controller.md.sal.binding.api.MountPointService;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.NotificationsService;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.StreamNameType;
-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.netconf.node.connection.status.ClusteredConnectionStatus;
-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.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;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
-
-@SuppressWarnings("deprecation")
-public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, ResyncNetworkElementsListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerImpl.class);
- private static final String APPLICATION_NAME = "DeviceManager";
- private static final String MYDBKEYNAMEBASE = "SDN-Controller";
-
- // http://sendateodl:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf
- private static final InstanceIdentifier<Topology> NETCONF_TOPO_IID =
- InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,
- new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName())));
- @SuppressWarnings("unused")
- private static final String STARTUPLOG_FILENAME = "etc/devicemanager.startup.log";
- // private static final String STARTUPLOG_FILENAME2 = "data/cache/devicemanager.startup.log";
-
- private DataBroker dataBroker = null;
- private MountPointService mountPointService = null;
- private RpcProviderRegistry rpcProviderRegistry = null;
- @SuppressWarnings("unused")
- private NotificationPublishService notificationPublishService = null;
- private ClusterSingletonServiceProvider clusterSingletonServiceProvider;
-
- private final ConcurrentHashMap<String, ONFCoreNetworkElementRepresentation> networkElementRepresentations =
- new ConcurrentHashMap<>();
- private final ONFCoreNetworkElementRepresentation networkelementLock = ONFCoreNetworkElementFactory.getEmpty("NE-LOCK");
- private WebSocketServiceClient webSocketService;
- private HtDatabaseEventsService databaseClientEvents;
- private ODLEventListener odlEventListener;
- private NetconfChangeListener netconfChangeListener;
- private DeviceManagerApiServiceImpl rpcApiService;
- private @Nullable PerformanceManagerImpl performanceManager = null;
- private ProviderClient dcaeProviderClient;
- private ProviderClient aotsMProvider;
- private @Nullable AaiProviderClient aaiProviderClient = null;
- private @Nullable DeviceMonitor deviceMonitor = new DeviceMonitorEmptyImpl();
- private IndexUpdateService updateService;
- //private IndexConfigService configService; issue#1
- private IndexMwtnService mwtnService;
- private HtDatabaseNode htDatabase;
- private Boolean devicemanagerInitializationOk = false;
- private MaintenanceServiceImpl maintenanceService;
- private NotificationDelayService<ProblemNotificationXml> notificationDelayService;
- private Thread threadDoClearCurrentFaultByNodename = null;
- private int refreshCounter = 0;
- private AkkaConfig akkaConfig;
- private ArchiveCleanService archiveCleanService;
- @SuppressWarnings("unused")
- private ClusterSingletonServiceRegistration cssRegistration;
-
- // Blueprint 1
- public DeviceManagerImpl() {
- LOG.info("Creating provider for {}", APPLICATION_NAME);
- }
-
- public void setDataBroker(DataBroker dataBroker) {
- this.dataBroker = dataBroker;
- }
-
- public void setRpcProviderRegistry(RpcProviderRegistry rpcProviderRegistry) {
- this.rpcProviderRegistry = rpcProviderRegistry;
- }
-
- public void setNotificationPublishService(NotificationPublishService notificationPublishService) {
- this.notificationPublishService = notificationPublishService;
- }
-
- public void setMountPointService(MountPointService mountPointService) {
- this.mountPointService = mountPointService;
- }
- public void setClusterSingletonService(ClusterSingletonServiceProvider clusterSingletonService) {
- this.clusterSingletonServiceProvider = clusterSingletonService;
- }
- public void init() {
-
- LOG.info("Session Initiated start {}", APPLICATION_NAME);
-
- // Start RPC Service
- this.rpcApiService = new DeviceManagerApiServiceImpl(rpcProviderRegistry);
- // Get configuration
- HtDevicemanagerConfiguration config = HtDevicemanagerConfiguration.getConfiguration();
- try {
- this.akkaConfig = AkkaConfig.load();
- LOG.debug("akka.conf loaded: " + akkaConfig.toString());
- } catch (Exception e1) {
- this.akkaConfig = null;
- LOG.warn("problem loading akka.conf: " + e1.getMessage());
- }
- GeoConfig geoConfig = null;
- if (akkaConfig != null && akkaConfig.isCluster()) {
- LOG.info("cluster mode detected");
- if (GeoConfig.fileExists()) {
- try {
- LOG.debug("try to load geoconfig");
- geoConfig = GeoConfig.load();
- } catch (Exception err) {
- LOG.warn("problem loading geoconfig: " + err.getMessage());
- }
- } else {
- LOG.debug("no geoconfig file found");
- }
- } else {
- LOG.info("single node mode detected");
- }
-
- this.notificationDelayService = new NotificationDelayService<>(config);
-
- EsConfig dbConfig = config.getEs();
- LOG.debug("esConfig=" + dbConfig.toString());
- // Start database
- htDatabase = HtDatabaseNode.start(dbConfig, akkaConfig, geoConfig);
- if (htDatabase == null) {
- LOG.error("Can only run with local database. Stop initialization of devicemanager.");
- } else {
- // init Database Values only if singleNode or clusterMember=1
- if (akkaConfig == null || akkaConfig.isClusterAndFirstNode()) {
- // Create DB index if not existing and if database is running
- try {
- //this.configService = new IndexConfigService(htDatabase);issue#1
- this.mwtnService = new IndexMwtnService(htDatabase);
- } catch (Exception e) {
- LOG.warn("Can not start ES access clients to provide database index config, mwtn. ", e);
- }
- }
- // start service for device maintenance service
- this.maintenanceService = new MaintenanceServiceImpl(htDatabase);
-
- // Websockets
- try {
- this.webSocketService = new WebSocketServiceClientImpl2(rpcProviderRegistry);
- } catch (Exception e) {
- LOG.error("Can not start websocket service. Loading mock class.", e);
- this.webSocketService = new WebSocketServiceClientDummyImpl();
- }
- // DCAE
- this.dcaeProviderClient = new DcaeProviderClient(config, dbConfig.getCluster(), this);
-
- this.aaiProviderClient = new AaiProviderClient(config, this);
- // EM
- EsConfig emConfig = dbConfig.cloneWithIndex("sdnevents");
-
- if (emConfig == null) {
- LOG.warn("No configuration available. Don't start event manager");
- } else {
- this.databaseClientEvents = new HtDatabaseEventsService(htDatabase);
-
- String myDbKeyNameExtended = MYDBKEYNAMEBASE + "-" + dbConfig.getCluster();
-
- this.odlEventListener = new ODLEventListener(myDbKeyNameExtended, webSocketService,
- databaseClientEvents, dcaeProviderClient, aotsMProvider, maintenanceService);
- }
- this.archiveCleanService = new ArchiveCleanService(config, databaseClientEvents, mwtnService);
- this.cssRegistration = this.clusterSingletonServiceProvider.registerClusterSingletonService(this.archiveCleanService);
- // PM
- PmConfig configurationPM = config.getPm();
- LOG.info("Performance manager configuration: {}", configurationPM);
- if (!configurationPM.isPerformanceManagerEnabled()) {
-
- LOG.info("No configuration available. Don't start performance manager");
- } else {
- @Nullable
- MicrowaveHistoricalPerformanceWriterService databaseClientHistoricalPerformance;
- databaseClientHistoricalPerformance = new MicrowaveHistoricalPerformanceWriterService(htDatabase);
- this.performanceManager = new PerformanceManagerImpl(60, databaseClientHistoricalPerformance);
- }
-
- // DUS (Database update service)
- LOG.debug("start db update service");
- this.updateService =
- new IndexUpdateService(htDatabase, dbConfig.getHost(), dbConfig.getCluster(), dbConfig.getNode());
- this.updateService.start();
-
- // RPC Service for specific services
- this.rpcApiService.setMaintenanceService(this.maintenanceService);
- this.rpcApiService.setResyncListener(this);
- // DM
- // DeviceMonitor has to be available before netconfSubscriptionManager is
- // configured
- LOG.debug("start DeviceMonitor Service");
- this.deviceMonitor = new DeviceMonitorImpl(dataBroker, odlEventListener, config);
-
- // netconfSubscriptionManager should be the last one because this is a callback
- // service
- LOG.debug("start NetconfSubscriptionManager Service");
- // this.netconfSubscriptionManager = new
- // NetconfSubscriptionManagerOfDeviceManager(this, dataBroker);
- // this.netconfSubscriptionManager.register();
- this.netconfChangeListener = new NetconfChangeListener(this, dataBroker);
- this.netconfChangeListener.register();
-
- this.devicemanagerInitializationOk = true;
- }
- LOG.info("Session Initiated end. Initialization done {}", devicemanagerInitializationOk);
- }
-
- @Override
- public void close() throws Exception {
- LOG.info("DeviceManagerImpl closing ...");
-
- close(performanceManager);
- close(dcaeProviderClient);
- close(aaiProviderClient);
- close(aotsMProvider);
- close(deviceMonitor);
- //close(updateService, configService, mwtnService); issue#1
- close(updateService, mwtnService);
- close(htDatabase);
- close(netconfChangeListener);
- close(maintenanceService);
- close(rpcApiService);
- close(notificationDelayService);
- close(archiveCleanService);
- LOG.info("DeviceManagerImpl closing done");
- }
-
-
- /**
- * Used to close all Services, that should support AutoCloseable Pattern
- *
- * @param toClose
- * @throws Exception
- */
- private void close(AutoCloseable... toCloseList) throws Exception {
- for (AutoCloseable element : toCloseList) {
- if (element != null) {
- element.close();
- }
- }
- }
-
- /*-------------------------------------------------------------------------------------------
- * Functions for interface DeviceManagerService
- */
-
- /**
- * For each mounted device a mountpoint is created and this listener is called.
- * Mountpoint was created or existing. Managed device is now fully connected to node/mountpoint.
- * @param action provide action
- * @param nNodeId id of the mountpoint
- * @param nNode mountpoint contents
- */
- public void startListenerOnNodeForConnectedState(Action action, NodeId nNodeId, NetconfNode nNode) {
-
- String mountPointNodeName = nNodeId.getValue();
- LOG.info("Starting Event listener on Netconf for mountpoint {} Action {}", mountPointNodeName, action);
-
- boolean preConditionMissing = false;
- if (mountPointService == null) {
- preConditionMissing = true;
- LOG.warn("No mountservice available.");
- }
- if (!devicemanagerInitializationOk) {
- preConditionMissing = true;
- LOG.warn("Devicemanager initialization still pending.");
- }
- if (preConditionMissing) {
- return;
- }
-
- if (!isNetconfNodeMaster(nNode)) {
- // Change Devicemonitor-status to connected ... for non master mountpoints.
- deviceMonitor.deviceConnectSlaveIndication(mountPointNodeName);
- } else {
-
- InstanceIdentifier<Node> instanceIdentifier = NETCONF_TOPO_IID.child(Node.class,
- new NodeKey(new NodeId(mountPointNodeName)));
-
- Optional<MountPoint> optionalMountPoint = null;
- int timeout = 10000;
- while (!(optionalMountPoint = mountPointService.getMountPoint(instanceIdentifier)).isPresent()
- && timeout > 0) {
- LOG.info("Event listener waiting for mount point for Netconf device :: Name : {}", mountPointNodeName);
- sleepMs(1000);
- timeout -= 1000;
- }
-
- if (!optionalMountPoint.isPresent()) {
- LOG.warn("Event listener timeout while waiting for mount point for Netconf device :: Name : {} ",
- mountPointNodeName);
- } else {
- // Mountpoint is present for sure
- MountPoint mountPoint = optionalMountPoint.get();
- // BindingDOMDataBrokerAdapter.BUILDER_FACTORY;
- LOG.info("Mountpoint with id: {} class {} toString {}", mountPoint.getIdentifier(),
- mountPoint.getClass().getName(), mountPoint);
- Optional<DataBroker> optionalNetconfNodeDatabroker = mountPoint.getService(DataBroker.class);
-
- if (!optionalNetconfNodeDatabroker.isPresent()) {
- LOG.info("Slave mountpoint {} without databroker", mountPointNodeName);
- } else {
-
- // It is master for mountpoint and all data are available.
- // Make sure that specific mountPointNodeName is handled only once.
- // be aware that startListenerOnNodeForConnectedState could be called multiple
- // times for same mountPointNodeName.
- // networkElementRepresentations contains handled NEs at master node.
-
- synchronized (networkelementLock) {
- if (networkElementRepresentations.containsKey(mountPointNodeName)) {
- LOG.warn("Mountpoint {} already registered. Leave startup procedure.", mountPointNodeName);
- return;
- } else {
- ONFCoreNetworkElementRepresentation result = networkElementRepresentations.put(mountPointNodeName,
- networkelementLock);
- if (result != null) {
- LOG.info("Expected null value was not provided, but {}", result.getMountPointNodeName());
- }
- }
- }
-
- DataBroker netconfNodeDataBroker = optionalNetconfNodeDatabroker.get();
- LOG.info("Master mountpoint {}", mountPointNodeName);
- // getNodeInfoTest(dataBroker);
-
- // create automatic empty maintenance entry into db before reading and listening
- // for problems
- this.maintenanceService.createIfNotExists(mountPointNodeName);
-
- // Setup microwaveEventListener for Notificationservice
-
- // MicrowaveEventListener microwaveEventListener = new
- // MicrowaveEventListener(mountPointNodeName, websocketmanagerService,
- // xmlMapper, databaseClientEvents);
- ONFCoreNetworkElementRepresentation ne = ONFCoreNetworkElementFactory.create(mountPointNodeName,
- dataBroker, webSocketService, databaseClientEvents, instanceIdentifier,
- netconfNodeDataBroker, dcaeProviderClient, aotsMProvider, maintenanceService,
- notificationDelayService);
-
- synchronized (networkelementLock) {
- ONFCoreNetworkElementRepresentation result = networkElementRepresentations
- .put(mountPointNodeName, ne);
- if (result != networkelementLock) {
- LOG.info("NE list does not provide lock as epxected, but {}.",
- result.getMountPointNodeName());
- }
- }
- ne.doRegisterMicrowaveEventListener(mountPoint);
-
- // Register netconf stream
- registerNotificationStream(mountPointNodeName, mountPoint, "NETCONF");
-
- // -- Read data from NE
- ne.initialReadFromNetworkElement();
-
- sendUpdateNotification(mountPointNodeName, nNode.getConnectionStatus());
-
- if (aaiProviderClient != null) {
- aaiProviderClient.onDeviceRegistered(mountPointNodeName);
- }
- // -- Register NE to performance manager
- if (performanceManager != null) {
- performanceManager.registration(mountPointNodeName, ne);
- }
-
- deviceMonitor.deviceConnectMasterIndication(mountPointNodeName, ne);
-
- LOG.info("Starting Event listener on Netconf device :: Name : {} finished", mountPointNodeName);
- }
- }
- }
- }
-
- /**
- * Mountpoint created or existing. Managed device is actually disconnected from node/ mountpoint.
- * Origin state: Connecting, Connected
- * Target state: are UnableToConnect or Connecting
- * @param action create or update
- * @param nNodeId id of the mountpoint
- * @param nNode mountpoint contents
- */
- public void enterNonConnectedState(Action action, NodeId nNodeId, NetconfNode nNode) {
- String mountPointNodeName = nNodeId.getValue();
- ConnectionStatus csts = nNode.getConnectionStatus();
- if (isNetconfNodeMaster(nNode)) {
- sendUpdateNotification(mountPointNodeName, csts);
- }
-
- // Handling if mountpoint exist. connected -> connecting/UnableToConnect
- stopListenerOnNodeForConnectedState(mountPointNodeName);
-
- deviceMonitor.deviceDisconnectIndication(mountPointNodeName);
-
- }
-
- /**
- * Mountpoint removed indication.
- * @param nNodeId id of the mountpoint
- */
- public void removeMountpointState(NodeId nNodeId) {
- String mountPointNodeName = nNodeId.getValue();
- LOG.info("mountpointNodeRemoved {}", nNodeId.getValue());
-
- stopListenerOnNodeForConnectedState(mountPointNodeName);
- deviceMonitor.removeMountpointIndication(mountPointNodeName);
- if (odlEventListener != null) {
- odlEventListener.deRegistration(mountPointNodeName);
- }
- }
-
- /**
- * Do all tasks necessary to move from mountpoint state connected -> connecting
- * @param mountPointNodeName provided
- * @param ne representing the device connected to mountpoint
- */
- private void stopListenerOnNodeForConnectedState( String mountPointNodeName) {
- ONFCoreNetworkElementRepresentation ne = networkElementRepresentations.remove(mountPointNodeName);
- if (ne != null) {
- this.maintenanceService.deleteIfNotRequired(mountPointNodeName);
- int problems = ne.removeAllCurrentProblemsOfNode();
- LOG.debug("Removed all {} problems from database at deregistration for {}", problems, mountPointNodeName);
- if (performanceManager != null) {
- performanceManager.deRegistration(mountPointNodeName);
- }
- if (aaiProviderClient != null) {
- aaiProviderClient.onDeviceUnregistered(mountPointNodeName);
- }
- }
- }
-
- private void sendUpdateNotification(String mountPointNodeName, ConnectionStatus csts) {
- LOG.info("enter Non ConnectedState for device :: Name : {} ConnectionStatus {}", mountPointNodeName, csts);
- if (odlEventListener != null) {
- odlEventListener.updateRegistration(mountPointNodeName, ConnectionStatus.class.getSimpleName(), csts != null ? csts.getName() : "null");
- }
- }
-
- /**
- * Handle netconf/mountpoint changes
- */
- @Override
- public void netconfChangeHandler(Action action, @Nullable ConnectionStatus csts, NodeId nodeId, NetconfNode nNode) {
-
- ClusteredConnectionStatus ccsts = nNode.getClusteredConnectionStatus();
- String nodeIdString = nodeId.getValue();
- if (action == Action.CREATE) {
- if (odlEventListener != null) {
- odlEventListener.registration(nodeIdString);
- }
- }
- boolean isCluster = akkaConfig == null && akkaConfig.isCluster();
- if (isCluster && ccsts == null) {
- LOG.debug("NETCONF Node {} {} does not provide cluster status. Stop execution.", nodeIdString, action);
- } else {
- switch (action) {
- case REMOVE:
- removeMountpointState(nodeId); // Stop Monitor
- break;
-
- case UPDATE:
- case CREATE:
- if (csts != null) {
- switch (csts) {
- case Connected: {
- startListenerOnNodeForConnectedState(action, nodeId, nNode);
- break;
- }
- case UnableToConnect:
- case Connecting: {
- enterNonConnectedState(action, nodeId, nNode);
- break;
- }
- }
- } else {
- LOG.debug("NETCONF Node handled with null status for action", action);
- }
- break;
- }
- }
- }
-
- /*-------------------------------------------------------------------------------------------
- * Functions
- */
-
- public ArchiveCleanService getArchiveCleanService() {
- return this.archiveCleanService;
- }
-
- public HtDatabaseEventsService getDatabaseClientEvents() {
- return databaseClientEvents;
- }
-
- public IndexMwtnService getMwtnService() {
- return mwtnService;
- }
-
- /**
- * Async RPC Interface implementation
- */
- @Override
- public @Nonnull List<String> doClearCurrentFaultByNodename(@Nullable List<String> nodeNamesInput)
- throws IllegalStateException {
-
- if (this.databaseClientEvents == null) {
- throw new IllegalStateException("dbEvents service not instantiated");
- }
-
- if (threadDoClearCurrentFaultByNodename != null && threadDoClearCurrentFaultByNodename.isAlive()) {
- throw new IllegalStateException("A clear task is already active");
- } else {
-
- // Create list of mountpoints if input is empty, using the content in ES
- if (nodeNamesInput == null || nodeNamesInput.size() <= 0) {
- nodeNamesInput = this.databaseClientEvents.getAllNodesWithCurrentAlarms();
- }
-
- // Filter all mountpoints from input that were found and are known to this Cluster-node instance of
- // DeviceManager
- final List<String> nodeNamesHandled = new ArrayList<>();
- for (String mountpointName : nodeNamesInput) {
- LOG.info("Work with mountpoint {}", mountpointName);
-
- if (odlEventListener != null && mountpointName.equals(odlEventListener.getOwnKeyName())) {
-
- // SDN Controller related alarms
- // -- can not be recreated on all nodes in connected state
- // -- would result in a DCAE/AAI Notification
- // Conclusion for 1810 Delivery ... not covered by RPC function (See issue #43)
- LOG.info("Ignore SDN Controller related alarms for {}", mountpointName);
- // this.databaseClientEvents.clearFaultsCurrentOfNode(mountpointName);
- // nodeNamesHandled.add(mountpointName);
-
- } else {
-
- if (mountPointService != null) {
- InstanceIdentifier<Node> instanceIdentifier =
- NETCONF_TOPO_IID.child(Node.class, new NodeKey(new NodeId(mountpointName)));
- Optional<MountPoint> optionalMountPoint = mountPointService.getMountPoint(instanceIdentifier);
-
- if (!optionalMountPoint.isPresent()) {
- LOG.info("Remove Alarms for unknown mountpoint {}", mountpointName);
- this.databaseClientEvents.clearFaultsCurrentOfNode(mountpointName);
- nodeNamesHandled.add(mountpointName);
- } else {
- if (networkElementRepresentations.containsKey(mountpointName)) {
- LOG.info("At node known mountpoint {}", mountpointName);
- nodeNamesHandled.add(mountpointName);
- } else {
- LOG.info("At node unknown mountpoint {}", mountpointName);
- }
- }
- }
- }
- }
-
- // Force a sync
- this.deviceMonitor.refreshAlarmsInDb();
-
- threadDoClearCurrentFaultByNodename = new Thread(() -> {
- refreshCounter++;
- LOG.info("Start refresh mountpoint task {}", refreshCounter);
- // for(String nodeName:nodeNamesOutput) {
- for (String nodeName : nodeNamesHandled) {
- ONFCoreNetworkElementRepresentation ne = networkElementRepresentations.get(nodeName);
- if (ne != null) {
- LOG.info("Refresh mountpoint {}", nodeName);
- ne.initialReadFromNetworkElement();
- } else {
- LOG.info("Unhandled mountpoint {}", nodeName);
- }
- }
- LOG.info("End refresh mountpoint task {}", refreshCounter);
- });
- threadDoClearCurrentFaultByNodename.start();
- return nodeNamesHandled;
- }
- };
-
- /**
- * Indication if init() of devicemanager successfully done.
- *
- * @return true if init() was sucessfull. False if not done or not successfull.
- */
- public boolean isDevicemanagerInitializationOk() {
- return this.devicemanagerInitializationOk;
- }
-
- /**
- * Get initialization status of database.
- *
- * @return true if fully initialized false if not
- */
- public boolean isDatabaseInitializationFinished() {
- return htDatabase == null ? false : htDatabase.getInitialized();
- }
-
- /*---------------------------------------------------------------------
- * Private funtions
- */
-
- /**
- * Do the stream creation for the device.
- *
- * @param mountPointNodeName
- * @param mountPoint
- */
- private void registerNotificationStream(String mountPointNodeName, MountPoint mountPoint, String streamName) {
-
- final Optional<RpcConsumerRegistry> optionalRpcConsumerService =
- mountPoint.getService(RpcConsumerRegistry.class);
- if (optionalRpcConsumerService.isPresent()) {
- final RpcConsumerRegistry rpcConsumerRegitry = optionalRpcConsumerService.get();
- final NotificationsService rpcService = rpcConsumerRegitry.getRpcService(NotificationsService.class);
- if (rpcService == null) {
- LOG.warn("rpcService is null for mountpoint {}", mountPointNodeName);
- } else {
- final CreateSubscriptionInputBuilder createSubscriptionInputBuilder =
- new CreateSubscriptionInputBuilder();
- createSubscriptionInputBuilder.setStream(new StreamNameType(streamName));
- LOG.info("Event listener triggering notification stream {} for node {}", streamName,
- mountPointNodeName);
- try {
- CreateSubscriptionInput createSubscriptionInput = createSubscriptionInputBuilder.build();
- if (createSubscriptionInput == null) {
- LOG.warn("createSubscriptionInput is null for mountpoint {}", mountPointNodeName);
- } else {
- rpcService.createSubscription(createSubscriptionInput);
- }
- } catch (NullPointerException e) {
- LOG.warn("createSubscription failed");
- }
- }
- } else {
- LOG.warn("No RpcConsumerRegistry avaialble.");
- }
-
- }
-
- /**
- * Get NE object
- *
- * @param mountpoint mount point name
- * @return null or NE specific data
- */
- public @Nullable ONFCoreNetworkElementRepresentation getNeByMountpoint(String mountpoint) {
-
- return networkElementRepresentations.get(mountpoint);
-
- }
-
- /* -- LOG related functions -- */
-
-
- private boolean isInClusterMode() {
- return this.akkaConfig == null ? false : this.akkaConfig.isCluster();
- }
-
- private String getClusterNetconfNodeName() {
- return this.akkaConfig == null ? "" : this.akkaConfig.getClusterConfig().getClusterSeedNodeName("abc");
- }
-
- private boolean isNetconfNodeMaster(NetconfNode nnode) {
- if (isInClusterMode()) {
- LOG.debug("check if me is responsible for node");
- String masterNodeName = nnode.getClusteredConnectionStatus() == null ? "null"
- : nnode.getClusteredConnectionStatus().getNetconfMasterNode();
- String myNodeName = getClusterNetconfNodeName();
- LOG.debug("sdnMasterNode=" + masterNodeName + " and sdnMyNode=" + myNodeName);
- if (!masterNodeName.equals(myNodeName)) {
- LOG.debug("netconf change but me is not master for this node");
- return false;
- }
- }
- return true;
- }
-
-
- private void sleepMs(int milliseconds) {
- try {
- Thread.sleep(milliseconds);
- } catch (InterruptedException e) {
- LOG.debug("Interrupted sleep");
- // Restore interrupted state...
- Thread.currentThread().interrupt();
- }
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerService.java
deleted file mode 100644
index ce34401d8..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerService.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl;
-import javax.annotation.Nullable;
-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.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-
-public interface DeviceManagerService {
-
- public enum Action {
- CREATE,
- REMOVE,
- UPDATE
- }
- /**
- * MountpointChangeHandler, called to indicate change to DeviceManager
- * @param action provided
- * @param csts provided
- * @param nodeId provided
- * @param nnode provided
- */
- void netconfChangeHandler(Action action, @Nullable ConnectionStatus csts, NodeId nodeId, NetconfNode nnode);
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ProviderClient.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ProviderClient.java
deleted file mode 100644
index 922b8a0e0..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ProviderClient.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-
-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);
-
- /**
- * 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, boolean neDeviceAlarm);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ResyncNetworkElementsListener.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ResyncNetworkElementsListener.java
deleted file mode 100644
index d202cde40..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ResyncNetworkElementsListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl;
-
-import java.util.List;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-public interface ResyncNetworkElementsListener
-{
- /**
- * Handle API Request and clean up current alarms according to the list of mountpoint id's/devices
- * Implement RPC function "clear-current-fault-by-nodename"
- * @return List with
- * @throws IllegalStateException Illegal state exception
- */
- public @Nonnull List<String> doClearCurrentFaultByNodename(@Nullable List<String> nodeNamesInput) throws IllegalStateException;
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/service/HtDatabaseEventsService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/service/HtDatabaseEventsService.java
deleted file mode 100644
index 0a38e0f60..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/service/HtDatabaseEventsService.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.elasticsearch.index.query.QueryBuilder;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice.ArchiveCleanProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDataBaseReaderAndWriter;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseClientAbstract;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseNode;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.IndexClientBuilder;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElement12Equipment;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.EsEventBase;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.EsFaultCurrent;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.EsFaultLog;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.equipment.EsEquipment;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.equipment.EsToplevelEquipment;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.equipment.ExtendedEquipment;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.MwtNotificationBase;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Event service, writing all events into the database into the appropriate index.
- *
- * @author herbert
- */
-public class HtDatabaseEventsService implements ArchiveCleanProvider {
- private static final Logger LOG = LoggerFactory.getLogger(HtDatabaseEventsService.class);
-
- private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter();
-
- ///** Filename in the resources with maven initialized version information */
- //private static final String RESOURCENAME = "version.properties"; // could also be a constant
- ///** Index name to be used */
- private static final String INDEX = "sdnevents";
- private static final String MAPPING = "/elasticsearch/index/sdnevents/sdneventsMapping.json";
-
- private HtDatabaseClientAbstract client;
- private HtDataBaseReaderAndWriter<EsEventBase> eventRWEventLog;
- private HtDataBaseReaderAndWriter<EsFaultCurrent> eventRWFaultCurrent;
- private HtDataBaseReaderAndWriter<EsFaultLog> eventRWFaultLog;
- private HtDataBaseReaderAndWriter<EsEquipment> eventRWEquipment;
- private HtDataBaseReaderAndWriter<EsToplevelEquipment> eventRWToplevelEquipment;
-
-
- // --- Construct and initialize
-
- public HtDatabaseEventsService(HtDatabaseNode database) {
-
- LOG.info("Create {} start", HtDatabaseEventsService.class);
-
- try {
- // Create control structure
- IndexClientBuilder clientBuilder = IndexClientBuilder.getBuilder(INDEX).setMappingSettingJsonFileName(MAPPING);
- client = clientBuilder.create(database);
- clientBuilder.close();
-
- eventRWEventLog = new HtDataBaseReaderAndWriter<>(client, EsEventBase.ESDATATYPENAME, EsEventBase.class);
- eventRWFaultLog = new HtDataBaseReaderAndWriter<>(client, EsFaultLog.ESDATATYPENAME, EsFaultLog.class);
- eventRWFaultCurrent = new HtDataBaseReaderAndWriter<>(client, EsFaultCurrent.ESDATATYPENAME, EsFaultCurrent.class);
- eventRWToplevelEquipment = new HtDataBaseReaderAndWriter<>(client, EsToplevelEquipment.ESDATATYPENAME, EsToplevelEquipment.class);
- eventRWEquipment = new HtDataBaseReaderAndWriter<>(client, EsEquipment.ESDATATYPENAME, EsEquipment.class);
-
-
- } catch (Exception e) {
- LOG.error("Can not start database client. Exception: {}", e.getMessage());
- }
- LOG.info("Create {} finished. DB Service {} started.", HtDatabaseEventsService.class, client != null ? "sucessfully" : "not" );
- }
-
- // --- Function
-
- public void writeEventLog(MwtNotificationBase event) {
- if (client == null) {
- LOG.debug("No DB, can not write: {}",event.toString());
- return;
- }
-
- LOG.debug("Write event: {}",event.toString());
- EsEventBase eventBase = new EsEventBase();
- eventBase.setProblem(event);
- eventRWEventLog.doWrite(eventBase);
- }
-
- public void writeFaultLog(ProblemNotificationXml fault) {
- if (client == null) {
- LOG.debug("No DB, can not write: {}",fault.toString());
- return;
- }
-
- LOG.debug("Write fault to faultlog: {}",fault.toString());
- EsFaultLog eventProblem = new EsFaultLog();
- eventProblem.setProblem(fault);
- eventRWFaultLog.doWrite(eventProblem);
- }
-
- public void updateFaultCurrent(ProblemNotificationXml fault) {
- if (client == null) {
- LOG.debug("No DB, can not write: {}",fault.toString());
- return;
- }
-
- if (!fault.isNotManagedAsCurrentProblem()) {
- EsFaultCurrent eventProblem = new EsFaultCurrent();
- eventProblem.setProblem(fault);
-
- if (eventProblem.isNoAlarmIndication()) {
- LOG.debug("Remove from currentFaults: {}",fault.toString());
- eventRWFaultCurrent.doRemove(eventProblem);
- } else {
- LOG.debug("Write to currentFaults: {}",fault.toString());
- eventRWFaultCurrent.doWrite(eventProblem);
- }
- } else {
- LOG.debug("Ingnore for currentFaults: {}",fault.toString());
- }
- }
-
- /**
- * Remove all entries for one node
- * @param nodeName contains the mountpointname
- * @return number of deleted entries
- */
- public int clearFaultsCurrentOfNode(String nodeName) {
- if (client == null) {
- LOG.debug("No DB, can not delete for node: {}", nodeName);
- return -1;
- }
- LOG.debug("Remove from currentFaults all faults for node: {}", nodeName);
- return eventRWFaultCurrent.doRemoveByQuery(EsFaultCurrent.getQueryForOneNode(nodeName));
- }
-
- /**
- * Remove all entries for one node
- * @param nodeName contains the mountpointname
- * @param objectId of element to be deleted
- * @return number of deleted entries
- */
- public int clearFaultsCurrentOfNodeWithObjectId(String nodeName, String objectId) {
- if (client == null) {
- LOG.debug("No DB, can not delete for node: {}", nodeName);
- return -1;
- }
- LOG.debug("Remove from currentFaults all faults for node/objectId: {}/{}", nodeName, objectId);
- return eventRWFaultCurrent.doRemoveByQuery(EsFaultCurrent.getQueryForOneNodeAndObjectId(nodeName, objectId));
-
- }
-
- /**
- * Deliver list with all mountpoint/node-names in the database.
- * @return List of all mountpoint/node-names the had active alarms.
- */
- public @Nonnull List<String> getAllNodesWithCurrentAlarms() {
- if (client == null) {
- LOG.debug("No DB, can not delete for all nodes");
- return new ArrayList<>();
- }
- LOG.debug("Remove from currentFaults faults for all node");
- List<String> nodeNames = new ArrayList<>();
-
- for (EsFaultCurrent fault : eventRWFaultCurrent.doReadAll()) {
- String nodeName = fault.getProblem().getNodeName();
- if (!nodeNames.contains(nodeName)) {
- //this.clearFaultsCurrentOfNode(nodeName); -> Function shifted
- nodeNames.add(nodeName);
- }
- }
- return nodeNames;
- }
-
-
- /**
- * Write inventory to DB
- * @param equipment all equipment of network element
- */
- public void writeInventory(ONFCoreNetworkElement12Equipment equipment) {
- if (client == null) {
- LOG.debug("No DB, can not write for mountpoint: {}",equipment.getMountpoint());
- return;
- }
-
- LOG.debug("Write inventory to database for mountpoint: {}",equipment.getMountpoint());
-
- EsToplevelEquipment esToplevelEquipment = new EsToplevelEquipment();
- esToplevelEquipment.set(equipment);
- eventRWToplevelEquipment.doWrite(esToplevelEquipment);
-
- List<ExtendedEquipment> equipmentList = equipment.getEquipmentList();
- EsEquipment esEquipment;
- for (ExtendedEquipment equipment1 : equipmentList) {
- esEquipment = new EsEquipment();
- esEquipment.set(equipment.getMountpoint(), equipment1);
- eventRWEquipment.doWrite(esEquipment);
- }
- }
-
- @Override
- public int doIndexClean(Date olderAreOutdated) {
-
- String netconfTimeStamp = NETCONFTIME_CONVERTER.getTimeStampAsNetconfString(olderAreOutdated);
- int removed = 0;
-
- QueryBuilder queryEventBase = EsEventBase.getQueryForTimeStamp(netconfTimeStamp);
- removed += eventRWEventLog.doRemoveByQuery(queryEventBase);
-
- QueryBuilder queryFaultLog = EsFaultLog.getQueryForTimeStamp(netconfTimeStamp);
- removed += eventRWFaultLog.doRemoveByQuery(queryFaultLog);
- return removed;
- }
-
- @Override
- public int getNumberOfOldObjects(Date olderAreOutdated) {
-
- String netconfTimeStamp = NETCONFTIME_CONVERTER.getTimeStampAsNetconfString(olderAreOutdated);
- int numberOfElements = 0;
-
- QueryBuilder queryEventBase = EsEventBase.getQueryForTimeStamp(netconfTimeStamp);
- numberOfElements += eventRWEventLog.doReadAll(queryEventBase).size();
-
- QueryBuilder queryFaultLog = EsFaultLog.getQueryForTimeStamp(netconfTimeStamp);
- numberOfElements += eventRWFaultLog.doReadAll(queryFaultLog).size();
-
- return numberOfElements;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsEventBase.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsEventBase.java
deleted file mode 100644
index 568e01f88..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsEventBase.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types;
-
-import org.elasticsearch.index.query.QueryBuilder;
-import org.elasticsearch.index.query.RangeQueryBuilder;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.MwtNotificationBase;
-
-/**
- *
- * Event from Network to be recorded in the database
- *
- */
-
-public class EsEventBase extends EsObject {
-
- public static final String ESDATATYPENAME = "eventlog";
-
- private static final String EVENTLOG_FIELD_TIMESTAMP = "event.timeStamp";
-
-
- private MwtNotificationBase event;
-
- public MwtNotificationBase getProblem() {
- return event;
- }
-
- public void setProblem(MwtNotificationBase event) {
- this.event = event;
- }
-
- /**
- * Query to get older Elements
- * @param netconfTimeStamp to identify older Elements
- * @return QueryBuilder for older elements related to timestamp
- */
- public static QueryBuilder getQueryForTimeStamp(String netconfTimeStamp) {
- return new RangeQueryBuilder(EVENTLOG_FIELD_TIMESTAMP).lt(netconfTimeStamp);
- }
-
- }
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsFaultCurrent.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsFaultCurrent.java
deleted file mode 100644
index 97c48f1ff..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsFaultCurrent.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types;
-
-import org.elasticsearch.index.query.BoolQueryBuilder;
-import org.elasticsearch.index.query.QueryBuilder;
-import org.elasticsearch.index.query.QueryBuilders;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-
-/**
- * Event from Network to be recorded in the database
- *
- */
-
-public class EsFaultCurrent extends EsObject {
-
- public static final String ESDATATYPENAME = "faultcurrent";
- //private static final String NOALARM = "NonAlarmed";
-
- private ProblemNotificationXml faultCurrent;
-
- public ProblemNotificationXml getProblem() {
- return faultCurrent;
- }
-
- public void setProblem(ProblemNotificationXml fault) {
- this.faultCurrent = fault;
- setEsId(fault.genSpecificEsId());
- }
-
- public boolean isNoAlarmIndication() {
- return faultCurrent.getSeverity().isNoAlarmIndication();
- }
-
- /**
- * TODO: termquery to matchquery, termquery with scoring, not exact matching
- * @param nodeName name of the node
- * @return query builder
- */
- public static QueryBuilder getQueryForOneNode( String nodeName) {
- return QueryBuilders.termQuery("faultCurrent.nodeName", nodeName);
- }
-
- public static QueryBuilder getQueryForOneNodeAndObjectId( String nodeName, String objectId) {
- BoolQueryBuilder bq = QueryBuilders.boolQuery();
- bq.must(QueryBuilders.termQuery("faultCurrent.nodeName", nodeName));
- bq.must(QueryBuilders.termQuery("faultCurrent.objectId", objectId));
- return bq;
- //return QueryBuilders.termQuery("faultCurrent.objectId", objectId);
-
- }
- }
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsFaultLog.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsFaultLog.java
deleted file mode 100644
index e15aba5b2..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/EsFaultLog.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types;
-
-import org.elasticsearch.index.query.QueryBuilder;
-import org.elasticsearch.index.query.RangeQueryBuilder;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-
-/**
- *
- * Event from Network to be recorded in the database
- *
- */
-
-public class EsFaultLog extends EsObject {
-
- public static final String ESDATATYPENAME = "faultlog";
-
- private static final String FAULTLOG_FIELD_TIMESTAMP = "fault.timeStamp";
-
- private ProblemNotificationXml fault;
-
- public ProblemNotificationXml getProblem() {
- return fault;
- }
-
- public void setProblem(ProblemNotificationXml fault) {
- this.fault = fault;
- }
-
- /**
- * Get older Elements
- * @param netconfTimeStamp to identify query elements older than this timestamp.
- * @return QueryBuilder for related elements
- */
- public static QueryBuilder getQueryForTimeStamp(String netconfTimeStamp) {
- return new RangeQueryBuilder(FAULTLOG_FIELD_TIMESTAMP).lt(netconfTimeStamp);
- }
-
- }
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/equipment/EsEquipment.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/equipment/EsEquipment.java
deleted file mode 100644
index 5c70ad972..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/equipment/EsEquipment.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.equipment;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.Equipment;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolder;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ManufacturedThing;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentInstance;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentType;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.ManufacturerProperties;
-
-public class EsEquipment extends EsObject {
-
- public static final String ESDATATYPENAME = "inventoryequipment";
-
- int treeLevel;
- String parentUuid;
- String mountpoint;
- String uuid;
- List<String> containedHolder;
- String manufacturerName;
- String manufacturerIdentifier;
- String serial;
- String date;
- String version;
- String description;
- String partTypeId;
- String modelIdentifier;
- String typeName;
-
-
- public EsEquipment set( String mountpoint, ExtendedEquipment extendedEquipment ) {
-
- Equipment equipment = extendedEquipment.getEquipment();
-
- this.parentUuid = extendedEquipment.getParentUuid();
- this.treeLevel = extendedEquipment.getTreeLevel();
- this.mountpoint = mountpoint;
- this.uuid = equipment.getUuid().getValue();
- this.setEsId(this.mountpoint+"/"+this.uuid);
-
- this.containedHolder = new ArrayList<>();
- List<ContainedHolder> containedHolderList = equipment.getContainedHolder();
- if (containedHolderList != null && !containedHolderList.isEmpty()) {
- for (ContainedHolder containedHolderElement: containedHolderList) {
- this.containedHolder.add(containedHolderElement.key().getUuid().getValue());
- }
- }
- ManufacturedThing manufacturedThing = equipment.getManufacturedThing();
- if (manufacturedThing != null) {
- ManufacturerProperties manufacturedProperties = manufacturedThing.getManufacturerProperties();
- if (manufacturedProperties != null) {
- this.manufacturerName = manufacturedProperties.getManufacturerName();
- this.manufacturerIdentifier = manufacturedProperties.getManufacturerIdentifier();
- }
- EquipmentInstance equipmentInstance = manufacturedThing.getEquipmentInstance();
- if (equipmentInstance != null) {
- this.serial = equipmentInstance.getSerialNumber();
- this.date = equipmentInstance.getManufactureDate();
- }
- EquipmentType equipmentType = manufacturedThing.getEquipmentType();
- if (equipmentType != null) {
- this.version = equipmentType.getVersion();
- this.description = equipmentType.getDescription();
- this.partTypeId = equipmentType.getPartTypeIdentifier();
- this.modelIdentifier = equipmentType.getModelIdentifier();
- this.typeName = equipmentType.getTypeName();
- }
- }
-
- return this;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/equipment/EsToplevelEquipment.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/equipment/EsToplevelEquipment.java
deleted file mode 100644
index a2e7af787..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/equipment/EsToplevelEquipment.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.equipment;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElement12Equipment;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
-
-public class EsToplevelEquipment extends EsObject {
-
- public static final String ESDATATYPENAME = "inventorytoplevel";
-
- String mountpoint;
- List<String> uuidList;
-
- public EsToplevelEquipment set(ONFCoreNetworkElement12Equipment coreEquipment) {
-
- mountpoint = coreEquipment.getMountpoint();
- this.setEsId(mountpoint);
-
- uuidList = new ArrayList<>();
- for (UniversalId uuid : coreEquipment.getTopLevelEqUuidList()) {
- uuidList.add(uuid.getValue());
- }
-
- return(this);
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/equipment/ExtendedEquipment.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/equipment/ExtendedEquipment.java
deleted file mode 100644
index 680a663ad..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/database/types/equipment/ExtendedEquipment.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.equipment;
-
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.Equipment;
-
-public class ExtendedEquipment {
-
- private final String parentUuid;
- private final int treeLevel;
- private final Equipment equipment;
-
- /**
- * Equipment with additional information beside NETCONF equipment
- *
- * @param parentUuid of parent equipment
- * @param equipment NETCONF Equipment
- * @param treeLevel level of tree starting with root at 0
- */
- public ExtendedEquipment(String parentUuid, Equipment equipment, int treeLevel) {
- super();
- this.parentUuid = parentUuid;
- this.equipment = equipment;
- this.treeLevel = treeLevel;
- }
-
- public String getParentUuid() {
- return parentUuid;
- }
-
- public Equipment getEquipment() {
- return equipment;
- }
-
- public int getTreeLevel() {
- return treeLevel;
- }
-
- @Override
- public String toString() {
- return "ExtendedEquipment [parentUuid=" + parentUuid + ", treeLevel=" + treeLevel + ", equipment=" + equipment
- + "]";
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java
deleted file mode 100644
index 80aac1ac4..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener;
-
-import java.util.Collection;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerService.Action;
-import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
-import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType;
-import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
-import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-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.netconf.node.connection.status.ClusteredConnectionStatus;
-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.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.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-// 07.09.18 Switched to DataTreeChangeListener from ClusteredDataTreeChangeListener -> DM Service is
-// running at all nodes
-// This is not correct
-@SuppressWarnings("deprecation")
-public class NetconfChangeListener implements ClusteredDataTreeChangeListener<Node>, AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(NetconfChangeListener.class);
-
- private static final InstanceIdentifier<Node> NETCONF_NODE_TOPO_IID =
- InstanceIdentifier.create(NetworkTopology.class)
- .child(Topology.class, new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName())))
- .child(Node.class);
- // Name of ODL controller NETCONF instance
- private static final String CONTROLLER = "controller-config";
-
- private final DeviceManagerService deviceManagerService;
- private final DataBroker dataBroker;
- private ListenerRegistration<NetconfChangeListener> dlcReg;
-
- public NetconfChangeListener(DeviceManagerService deviceManagerService, DataBroker dataBroker) {
- this.deviceManagerService = deviceManagerService;
- this.dataBroker = dataBroker;
- }
-
- public void register() {
- DataTreeIdentifier<Node> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, NETCONF_NODE_TOPO_IID);
-
- dlcReg = dataBroker.registerDataTreeChangeListener(treeId, this);
- }
-
- @Override
- public void close() {
- if (dlcReg != null) {
- dlcReg.close();
- }
- }
- /*---------------------------------------------------------------------------
- * Listener
- */
- @Override
- public void onDataTreeChanged(Collection<DataTreeModification<Node>> changes) {
- LOG.debug("OnDataChange, TreeChange, changes:{}", changes.size());
-
- for (final DataTreeModification<Node> change : changes) {
- final DataObjectModification<Node> root = change.getRootNode();
- final ModificationType modificationType = root.getModificationType();
- if (LOG.isTraceEnabled()) {
- LOG.trace("Handle this modificationType:{} path:{} root:{}", modificationType, change.getRootPath(),
- root);
- }
- switch (modificationType) {
- case SUBTREE_MODIFIED:
- // Change of subtree information
- // update(change); OLD
- doProcessing(Action.UPDATE, root.getDataAfter());
- break;
- case WRITE:
- // Create or modify top level node
- // Treat an overwrite as an update
- boolean update = root.getDataBefore() != null;
- if (update) {
- // update(change);
- doProcessing(Action.UPDATE, root.getDataAfter());
- } else {
- // add(change);
- doProcessing(Action.CREATE, root.getDataAfter());
- }
- break;
- case DELETE:
- // Node removed
- // remove(change);
- doProcessing(Action.REMOVE, root.getDataBefore());
- break;
- }
- }
- }
-
- /*
- * ---------------------------------------------------------------- Functions to select the right
- * node from DataObjectModification
- */
-
- /**
- * Process event and forward to clients
- *
- * @param action
- * @param node Basis node
- */
- private void doProcessing(Action action, Node node) {
-
- NodeId nodeId = null;
- NetconfNode nnode = null;
- NodeKey nodeKey = null;
-
- try {
- if (node != null) {
- if ((nodeKey = node.key()) != null) {
- nodeId = nodeKey.getNodeId();
- }
- nnode = node.augmentation(NetconfNode.class);
- }
-
- if (node == null || nnode == null || nodeId == null || nodeKey == null) {
- LOG.warn("Unexpected node {}, netconf node {} or key {} or id {}", node, nnode, nodeKey, nodeId);
- } else {
- String nodeIdString = nodeId.getValue();
- // Do not forward any controller related events to devicemanager
- if (nodeIdString.equals(CONTROLLER)) {
- LOG.debug("Stop processing for [{}]", nodeIdString);
- } else {
-
- ClusteredConnectionStatus ccsts = nnode.getClusteredConnectionStatus();
- ConnectionStatus csts = nnode.getConnectionStatus();
- LOG.debug("NETCONF Node processing with id {} action {} status {} cluster status {}", nodeIdString,
- action, csts, ccsts);
- // Action forwarded to devicehandler
- deviceManagerService.netconfChangeHandler(action, csts, nodeId, nnode);
- }
- }
- } catch (NullPointerException e) {
- LOG.warn("Unexpected null .. stop processing.", e);
- }
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfEventListener12.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfEventListener12.java
deleted file mode 100644
index ae05da943..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfEventListener12.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener;
-
-import java.util.List;
-
-import javax.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElement12Equipment;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementCallback;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.OnfMicrowaveModelNotification;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter.NotificationDelayFilter;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter.NotificationDelayService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter.NotificationDelayedListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.ProviderClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service.HtDatabaseEventsService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Important: Websocket notification must be the last action.
- * At the beginning intended to handle notifications of type <code>OnfMicrowaveModelNotification</code>.
- * Today an abstract class for processing notifications independent of model.
- *
- * @author herbert
- */
-public class NetconfEventListener12 implements OnfMicrowaveModelNotification, NotificationDelayedListener<ProblemNotificationXml> {
-
- private static final Logger LOG = LoggerFactory.getLogger(NetconfEventListener12.class);
-
- private final String nodeName;
- private final WebSocketServiceClient webSocketService;
- //private final WebsocketmanagerService websocketmanagerService;
- //private final XmlMapper xmlMapper;
- private final HtDatabaseEventsService databaseService;
- private final ProviderClient dcaeProvider;
- private final @Nullable ProviderClient aotsmClient;
-
- private final MaintenanceService maintenanceService;
-
- private final NotificationDelayFilter<ProblemNotificationXml> delayFilter;
- private final ONFCoreNetworkElementCallback ne;
-
- public NetconfEventListener12(String nodeName, WebSocketServiceClient webSocketService,
- HtDatabaseEventsService databaseService, ProviderClient dcaeProvider,@Nullable ProviderClient aotsmClient,
- MaintenanceService maintenanceService2,NotificationDelayService<ProblemNotificationXml> notificationDelayService,
- ONFCoreNetworkElementCallback ne) {
- super();
- this.nodeName = nodeName;
- //this.websocketmanagerService = websocketmanagerService;
- //this.xmlMapper = xmlMapper;
- this.webSocketService = webSocketService;
- this.databaseService = databaseService;
- this.dcaeProvider = dcaeProvider;
- this.aotsmClient = aotsmClient;
- this.maintenanceService=maintenanceService2;
- this.delayFilter=notificationDelayService.getInstance(nodeName, this);//12(nodeName,this);
- this.ne = ne;
- }
-
-
- @Override
- public void onAttributeValueChangedNotification(AttributeValueChangedNotificationXml notificationXml) {
-
- ne.notificationFromNeListener(notificationXml);
-
- databaseService.writeEventLog(notificationXml);
-
- webSocketService.sendViaWebsockets(nodeName, notificationXml);
- }
-
-
- @Override
- public void onObjectCreationNotification(ObjectCreationNotificationXml notificationXml) {
-
- databaseService.writeEventLog(notificationXml);
-
- webSocketService.sendViaWebsockets(nodeName, notificationXml);
-
- }
-
- @Override
- public void onObjectDeletionNotification(ObjectDeletionNotificationXml notificationXml) {
-
- databaseService.writeEventLog(notificationXml);
-
- webSocketService.sendViaWebsockets(nodeName, notificationXml);
- }
-
- @Override
- public void onProblemNotification(ProblemNotificationXml notificationXml) {
-
- databaseService.writeFaultLog(notificationXml);
- databaseService.updateFaultCurrent(notificationXml);
-
- //ToggleAlarmFilter functionality
- if(NotificationDelayFilter.isEnabled())
- {
- if(notificationXml.getSeverity() == InternalSeverity.NonAlarmed) {
- delayFilter.clearAlarmNotification(notificationXml.getProblem(), notificationXml);
- } else {
- delayFilter.pushAlarmNotification(notificationXml.getProblem(), notificationXml);
- }
- }
- else
- {
- this.pushAlarmIfNotInMaintenance(notificationXml);
- }
- //end of ToggleAlarmFilter
-
- this.webSocketService.sendViaWebsockets(nodeName, notificationXml);
-
- }
-
- @Override
- public void onNotificationDelay(ProblemNotificationXml notificationXml) {
-
- LOG.debug("Got delayed event of type :: {}", ProblemNotificationXml.class.getSimpleName());
- this.pushAlarmIfNotInMaintenance(notificationXml);
-
- }
- private void pushAlarmIfNotInMaintenance(ProblemNotificationXml notificationXml)
- {
- if(!this.maintenanceService.isONFObjectInMaintenance(nodeName, notificationXml.getObjectId(), notificationXml.getProblem()))
- {
- this.dcaeProvider.sendProblemNotification(nodeName, notificationXml);
- if(this.aotsmClient!=null) {
- this.aotsmClient.sendProblemNotification(nodeName, notificationXml);
- }
- }
- else
- {
- LOG.debug("Notification will not be sent to external services. Device "+this.nodeName+" is in maintenance mode");
- }
- }
- private void initCurrentProblem(ProblemNotificationXml notificationXml) {
- databaseService.updateFaultCurrent(notificationXml);
- //to prevent push alarms on reconnect
- //=> only pushed alarms are forwared to dcae
- //dcaeProvider.sendProblemNotification(nodeName, notificationXml);
- if(aotsmClient!=null) {
- aotsmClient.sendProblemNotification(this.nodeName, notificationXml);
- }
- }
-
- /**
- * Called to initialize with the current status and notify the clients
- * @param notificationXmlList List with problems
- */
- public void initCurrentProblemStatus(List<ProblemNotificationXml> notificationXmlList) {
-
- for (ProblemNotificationXml notificationXml : notificationXmlList) {
- initCurrentProblem(notificationXml);
- }
-
- }
-
- /**
- * Called on exit to remove everything from the current list.
- * @return Number of deleted objects
- */
- public int removeAllCurrentProblemsOfNode() {
- int deleted = databaseService.clearFaultsCurrentOfNode(nodeName);
- return deleted;
- }
-
- /**
- * Called on exit to remove for one Object-Pac from the current list.
- * @param objectId uuid of the interface-pac or equipment-pac
- * @return Number of deleted objects
- */
- public int removeObjectsCurrentProblemsOfNode(String objectId) {
- int deleted = databaseService.clearFaultsCurrentOfNodeWithObjectId(nodeName, objectId);
- return deleted;
- }
-
- /**
- * Write equipment data to database
- * @param equipment to write
- */
- public void writeEquipment(ONFCoreNetworkElement12Equipment equipment) {
- databaseService.writeInventory(equipment);
- }
-
- }
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/ODLEventListener.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/ODLEventListener.java
deleted file mode 100644
index 4b87b5828..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/ODLEventListener.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener;
-
-import javax.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.ProviderClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service.HtDatabaseEventsService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceService;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ProblemNotification;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Responsible class for documenting changes in the ODL itself. The occurence of such an event is
- * documented in the database and to clients. Specific example here is the registration or
- * deregistration of a netconf device. This service has an own eventcounter to apply to the ONF
- * Coremodel netconf behaviour.
- *
- * Important: Websocket notification must be the last action.
- *
- * @author herbert
- */
-
-public class ODLEventListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(ODLEventListener.class);
-
- private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter();
-
- private final String ownKeyName;
- private final WebSocketServiceClient webSocketService;
- private final HtDatabaseEventsService databaseService;
- private final ProviderClient dcaeProvider;
- private final ProviderClient aotsMProvider;
- private final MaintenanceService maintenanceService;
-
- private int eventNumber;
-
- /*---------------------------------------------------------------
- * Construct
- */
-
- /**
- * Create a Service to document events to clients and within a database
- *
- * @param ownKeyName The name of this service, that is used in the database as identification key.
- * @param webSocketService service to direct messages to clients
- * @param databaseService service to write to the database
- * @param dcaeProvider to deliver problems to
- * @param maintenanceService2
- */
- @SuppressWarnings("javadoc")
- public ODLEventListener(String ownKeyName, WebSocketServiceClient webSocketService,
- HtDatabaseEventsService databaseService, ProviderClient dcaeProvider,
- @Nullable ProviderClient aotsMProvider, MaintenanceService maintenanceService) {
- super();
-
- this.ownKeyName = ownKeyName;
- this.webSocketService = webSocketService;
-
- this.databaseService = databaseService;
- this.dcaeProvider = dcaeProvider;
- this.aotsMProvider = aotsMProvider;
-
- this.eventNumber = 0;
- this.maintenanceService = maintenanceService;
-
- }
-
- /*---------------------------------------------------------------
- * Handling of ODL Controller events
- */
-
- /**
- * A registration of a mountpoint occured, that is in connect state
- *
- * @param registrationName Name of the event that is used as key in the database.
- */
-
- public void registration(String registrationName) {
-
- ObjectCreationNotificationXml cNotificationXml =
- new ObjectCreationNotificationXml(ownKeyName, getEventNumberAsString(),
- InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName);
-
- // Write first to prevent missing entries
- databaseService.writeEventLog(cNotificationXml);
- webSocketService.sendViaWebsockets(registrationName, cNotificationXml);
- }
-
-
- /**
- * A deregistration of a mountpoint occured.
- *
- * @param registrationName Name of the event that is used as key in the database.
- */
-
- public void deRegistration(String registrationName) {
-
- ObjectDeletionNotificationXml dNotificationXml =
- new ObjectDeletionNotificationXml(ownKeyName, getEventNumberAsString(),
- InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName);
-
- // Write first to prevent missing entries
- databaseService.writeEventLog(dNotificationXml);
- webSocketService.sendViaWebsockets(registrationName, dNotificationXml);
-
- }
-
- /**
- * Mountpoint state changed .. from connected -> connecting or unable-to-connect or vis-e-versa.
- *
- * @param registrationName Name of the event that is used as key in the database.
- */
- public void updateRegistration(String registrationName, String attribute, String attributeNewValue) {
- AttributeValueChangedNotificationXml notificationXml = new AttributeValueChangedNotificationXml(ownKeyName,
- getEventNumberAsString(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()),
- registrationName, attribute, attributeNewValue);
- databaseService.writeEventLog(notificationXml);
- webSocketService.sendViaWebsockets(registrationName, notificationXml);
-
- }
-
- /**
- * At a mountpoint a problem situation is indicated
- *
- * @param registrationName indicating object within SDN controller, normally the mountpointName
- * @param problemName that changed
- * @param problemSeverity of the problem according to NETCONF/YANG
- */
-
- public void onProblemNotification(String registrationName, String problemName, InternalSeverity problemSeverity) {
- LOG.debug("Got event of type :: {} or {} or {}", ProblemNotification.class.getSimpleName(),
- org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ProblemNotification.class
- .getSimpleName(),
- org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotification.class
- .getSimpleName());
- // notification
-
- ProblemNotificationXml notificationXml =
- new ProblemNotificationXml(ownKeyName, registrationName, problemName, problemSeverity,
- // popEvntNumberAsString(), InternalDateAndTime.TESTPATTERN );
- getEventNumberAsString(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()));
-
- databaseService.writeFaultLog(notificationXml);
- databaseService.updateFaultCurrent(notificationXml);
-
- if (!maintenanceService.isONFObjectInMaintenance(registrationName, notificationXml.getObjectId(),
- notificationXml.getProblem())) {
- dcaeProvider.sendProblemNotification(ownKeyName, notificationXml);
- if (aotsMProvider != null) {
- aotsMProvider.sendProblemNotification(ownKeyName, notificationXml, false);// not a nealarm, its a
- }
- } // sdncontroller alarm
- else {
- LOG.debug("Notification will not be sent to external services. Device " + registrationName
- + " is in maintenance mode");
- }
-
- webSocketService.sendViaWebsockets(registrationName, notificationXml);
- }
-
-
- /*---------------------------------------------
- * Handling of ODL Controller events
- */
-
- /**
- * Called on exit to remove everything for a node from the current list.
- *
- * @param nodeName to remove all problems for
- * @return Number of deleted objects
- */
- public int removeAllCurrentProblemsOfNode(String nodeName) {
- return databaseService.clearFaultsCurrentOfNodeWithObjectId(ownKeyName, nodeName);
- }
-
- /*---------------------------------------------------------------
- * Get/Set
- */
-
- /**
- * @return the ownKeyName
- */
- public String getOwnKeyName() {
- return ownKeyName;
- }
-
- /*---------------------------------------------------------------
- * Private
- */
-
- private String getEventNumberAsString() {
- return String.valueOf(popEvntNumber());
- }
-
- private int popEvntNumber() {
- return eventNumber++;
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/AttributeValueChangedNotificationXml.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/AttributeValueChangedNotificationXml.java
deleted file mode 100644
index 8ec5903d1..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/AttributeValueChangedNotificationXml.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-
-@XmlRootElement(name = "AttributeValueChangedNotification")
-public class AttributeValueChangedNotificationXml extends MwtNotificationBase implements GetEventType {
-
- private static String EVENTTYPE = "AttributeValueChangedNotification";
-
- @XmlElement(name = "attributeName")
- private String attributeName;
-
- @XmlElement(name = "newValue")
- private String newValue;
-
- public AttributeValueChangedNotificationXml() {
-
- }
-
- /**
- * Normalized notification
- * @param nodeName name of mountpoint
- * @param counter of notification
- * @param timeStamp from ne
- * @param objectIdRef from ne
- * @param attributeName from ne
- * @param newValue from ne
- */
- public AttributeValueChangedNotificationXml(String nodeName, String counter, InternalDateAndTime timeStamp, String objectIdRef,
- String attributeName, String newValue) {
- super(nodeName, counter, timeStamp, objectIdRef);
- this.attributeName = attributeName;
- this.newValue = newValue;
- }
-
- public String getAttributeName() {
- return attributeName;
- }
-
- public String getNewValue() {
- return newValue;
- }
-
- @Override
- public String getEventType() {
- return EVENTTYPE;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/GetEventType.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/GetEventType.java
deleted file mode 100644
index ba3e23c77..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/GetEventType.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-/**
- * @author herbert
- *
- */
-public interface GetEventType {
- public String getEventType();
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/MwtNotificationBase.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/MwtNotificationBase.java
deleted file mode 100644
index 149640641..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/MwtNotificationBase.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import javax.xml.bind.annotation.XmlElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-
-public class MwtNotificationBase {
-
- private static String EMPTY = "empty";
-
- private String nodeName;
- private String counter;
- private String timeStamp;
- private String objectId;
-
- public MwtNotificationBase() {
- // For Jaxb
- }
-
- public MwtNotificationBase(String nodeName, String counter, InternalDateAndTime timeStamp, String objectId) {
- this.nodeName = nodeName;
- this.counter = counter;
- this.timeStamp = timeStamp.getValue();
- this.objectId = objectId;
- if (this.objectId == null) {
- this.objectId = EMPTY;
- }
- }
-
- @XmlElement(name = "nodeName")
- public String getNodeName() {
- return nodeName;
- }
-
- @XmlElement(name = "counter")
- public String getCounter() {
- return counter;
- }
-
- @XmlElement(name = "timeStamp")
- public String getTimeStamp() {
- return timeStamp;
- }
-
- @XmlElement(name = "objectId")
- public String getObjectId() {
- return objectId;
- }
-
- /**
- * Type for the Database to document the the same name that is used in the websockets.
- * @return String with type name of child class
- */
- @JsonProperty("type")
- public String getType() {
- return this.getClass().getSimpleName();
- }
-
- @Override
- public String toString() {
- return "MwtNotificationBase [getType()="+ getType() + ", nodeName=" + nodeName + ", counter=" + counter + ", timeStamp=" + timeStamp
- + ", objectId=" + objectId + "]";
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectCreationNotificationXml.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectCreationNotificationXml.java
deleted file mode 100644
index b404073b7..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectCreationNotificationXml.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-
-@XmlRootElement(name = "ObjectCreationNotification")
-public class ObjectCreationNotificationXml extends MwtNotificationBase implements GetEventType {
-
- private static String EVENTTYPE = "ObjectCreationNotification";
-
- public ObjectCreationNotificationXml() {
-
- }
-
- /**
- * Normalized notification
- * @param nodeName name of mountpoint or instance that owns the problem
- * @param counter of notification
- * @param timeStamp from ne
- * @param objectIdRef from ne
- */
- public ObjectCreationNotificationXml(String nodeName, String counter, InternalDateAndTime timeStamp, String objectIdRef) {
- super(nodeName, counter, timeStamp, objectIdRef);
- }
-
- /*public ObjectCreationNotificationXml(String nodeName, org.opendaylight.yang.gen.v1.uri.onf.microwavemodel.notifications.rev160809.ObjectCreationNotification notification) {
- super(nodeName, notification.getCounter().toString(), InternalDateAndTime.valueOf(notification.getTimeStamp()),
- notification.getObjectIdRef().getValue());
- }
-
- public ObjectCreationNotificationXml(String nodeName, org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectCreationNotification notification) {
- super(nodeName, notification.getCounter().toString(), InternalDateAndTime.valueOf(notification.getTimeStamp()),
- notification.getObjectIdRef().getValue());
- }*/
-
- @Override
- public String getEventType() {
- return EVENTTYPE;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectDeletionNotificationXml.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectDeletionNotificationXml.java
deleted file mode 100644
index c61a94ac4..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ObjectDeletionNotificationXml.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-
-@XmlRootElement(name = "ObjectDeletionNotification")
-public class ObjectDeletionNotificationXml extends MwtNotificationBase implements GetEventType {
-
- private static String EVENTTYPE = "ObjectDeletionNotification";
-
- public ObjectDeletionNotificationXml() {
-
- }
-
- /**
- * Normalized notification
- * @param nodeName name of mountpoint or instance that owns the problem
- * @param counter of notification
- * @param timeStamp from ne
- * @param objectIdRef from ne
- */
- public ObjectDeletionNotificationXml(String nodeName, String counter, InternalDateAndTime timeStamp, String objectIdRef) {
- super(nodeName, counter, timeStamp, objectIdRef);
- }
-
- /*
- public ObjectDeletionNotificationXml(String nodeName, ObjectDeletionNotification notification) {
- super(nodeName, notification.getCounter().toString(), InternalDateAndTime.valueOf(notification.getTimeStamp()),
-// notification.getObjectId().getValue());
- notification.getObjectIdRef().getValue());
- }*/
-/*
- public ObjectDeletionNotificationXml(String nodeName, org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ObjectDeletionNotification notification) {
- super(nodeName, notification.getCounter().toString(), InternalDateAndTime.valueOf(notification.getTimeStamp()),
-// notification.getObjectId().getValue());
- notification.getObjectIdRef().getValue());
- }
-*/
- @Override
- public String getEventType() {
- return EVENTTYPE;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ProblemNotificationXml.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ProblemNotificationXml.java
deleted file mode 100644
index 26757170b..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ProblemNotificationXml.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
-import org.slf4j.Logger;
-
-@XmlRootElement(name = "ProblemNotification")
-public class ProblemNotificationXml extends MwtNotificationBase implements GetEventType {
-
- private static String EVENTTYPE = "ProblemNotification";
- private static final Pattern pattern = Pattern.compile(".*\\[layerProtocol=(.*)\\]");
- /**
- * The leading indication for notification or events that are not in the
- * currentProblem data of the ONF Coremodel
- */
- private static final String NOCURRENTPROBLEMINDICATION = "#";
-
- @XmlElement(name = "problem")
- private String problem;
-
- @XmlElement(name = "severity")
- private InternalSeverity severity;
-
- public ProblemNotificationXml() {
-
- }
-
- /**
- * Generic Problem. All the parameters are of type Strings according to YANG
- * specification.
- *
- * @param nodeName Name of mountpoint
- * @param uuId Name of Interface Pac
- * @param problemNameString Name of the problem
- * @param problemSeverityString Severitycode of the problem
- * @param counterString Counter from device
- * @param internaltimeStampString Timestamp according to internal format.
- */
- public ProblemNotificationXml(String nodeName, String uuId, String problemNameString,
- InternalSeverity problemSeverityString, String counterString, InternalDateAndTime internaltimeStampString) {
- super(nodeName, counterString, internaltimeStampString, uuId);
- this.problem = problemNameString;
- this.severity = problemSeverityString;
- }
-
- public String getProblem() {
- return problem;
- }
-
- public InternalSeverity getSeverity() {
- return severity;
- }
-
- public boolean isNotManagedAsCurrentProblem() {
- return problem.startsWith(NOCURRENTPROBLEMINDICATION);
- }
-
- /**
- * Create a specific ES id for the current log.
- *
- * @return a string with the generated ES Id
- */
- @JsonIgnore
- public String genSpecificEsId() {
-
- String uuId;
-
- Matcher matcher = pattern.matcher(getObjectId());
- if (matcher.matches() && matcher.groupCount() == 1) {
- uuId = matcher.group(1);
- } else {
- uuId = getObjectId();
- }
-
- StringBuffer strBuf = new StringBuffer();
- strBuf.append(getNodeName());
- strBuf.append("/");
- strBuf.append(uuId);
- strBuf.append("/");
- strBuf.append(getProblem());
- return strBuf.toString();
- }
-
-
- @Override
- public String toString() {
- return "ProblemNotificationXml [problem=" + problem + ", severity=" + severity + ", toString()="
- + super.toString() + "]";
- }
-
- @Override
- public String getEventType() {
- return EVENTTYPE;
- }
-
- /**
- * LOG the newly added problems of the interface pac
- * @param idxStart
- * @param uuid
- * @param resultList
- */
- public static void debugResultList(Logger log, String uuid, List<ProblemNotificationXml> resultList, int idxStart) {
- if (log.isDebugEnabled()) {
- StringBuffer sb = new StringBuffer();
- int idx = 0;
- for (int t = idxStart; t < resultList.size(); t++) {
- sb.append(idx++);
- sb.append(":{");
- sb.append(resultList.get(t));
- sb.append('}');
- }
- log.debug("Found problems {} {}", uuid, sb.toString());
- }
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClient.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClient.java
deleted file mode 100644
index 8cfd63d39..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClient.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-/**
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-/**
- * Wrapper for forwarding websocket notifications to the websocket service, that is running as container.
- * @author herbert
- */
-public interface WebSocketServiceClient {
-
- public <T extends MwtNotificationBase & GetEventType> void sendViaWebsockets(String nodeName, T notificationXml);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientDummyImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientDummyImpl.java
deleted file mode 100644
index 90f46ae96..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientDummyImpl.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.ODLEventListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * WrapperMock class for web-socket notifications to the web-socket service.
- */
-public class WebSocketServiceClientDummyImpl implements WebSocketServiceClient {
-
- private static final Logger LOG = LoggerFactory.getLogger(ODLEventListener.class);
-
- public WebSocketServiceClientDummyImpl() {
- }
-
- @Override
- public <T extends MwtNotificationBase & GetEventType> void sendViaWebsockets(String nodeName, T notificationXml) {
- LOG.info("Dummy to send websocket event {} for mountpoint {}", notificationXml.getClass().getSimpleName(), nodeName);
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.java
deleted file mode 100644
index af1a32de3..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.ODLEventListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * WrapperMock class for web-socket notifications to the web-socket service.
- */
-public class WebSocketServiceClientImpl implements WebSocketServiceClient {
-
- private static final Logger LOG = LoggerFactory.getLogger(ODLEventListener.class);
-
- public WebSocketServiceClientImpl() {
- }
-
- @Override
- public <T extends MwtNotificationBase & GetEventType> void sendViaWebsockets(String nodeName, T notificationXml) {
- LOG.info("Dummy to send websocket event {} for mountpoint {}", notificationXml.getClass().getSimpleName(), nodeName);
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java
deleted file mode 100644
index c8f769677..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl2.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import java.util.concurrent.Future;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.ODLEventListener;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketEventInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketEventOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Wrapper for forwarding web-socket notifications to the web-socket service, that is running as
- * bundle.
- */
-@SuppressWarnings("deprecation")
-public class WebSocketServiceClientImpl2 implements WebSocketServiceClient {
-
- private static final Logger LOG = LoggerFactory.getLogger(ODLEventListener.class);
-
- private final WebsocketmanagerService websocketmanagerService;
- private final XmlMapper xmlMapper;
-
- /**
- * Implementation of Websocket notification processor.
- *
- * @param rpcProviderRegistry to get MDSAL services.
- */
- public WebSocketServiceClientImpl2(RpcProviderRegistry rpcProviderRegistry) {
- super();
- this.websocketmanagerService = rpcProviderRegistry.getRpcService(WebsocketmanagerService.class);
- this.xmlMapper = new XmlMapper();
- }
-
- @Override
- public <T extends MwtNotificationBase & GetEventType> void sendViaWebsockets(String nodeName, T notificationXml) {
- LOG.info("Send websocket event {} for mountpoint {}", notificationXml.getClass().getSimpleName(), nodeName);
-
- try {
- WebsocketEventInputBuilder wsBuilder = new WebsocketEventInputBuilder();
- wsBuilder.setNodeName(nodeName);
- wsBuilder.setEventType(notificationXml.getEventType());
- wsBuilder.setXmlEvent(xmlMapper.getXmlString(notificationXml));
- Future<RpcResult<WebsocketEventOutput>> result = websocketmanagerService.websocketEvent(wsBuilder.build());
- LOG.info("Send websocket result: {}", result.get().getResult().getResponse());
- } catch (Exception e) {
- LOG.warn("Can not send websocket event {} for mountpoint {} {}", notificationXml.getClass().getSimpleName(),
- nodeName, e.toString());
- }
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java
deleted file mode 100644
index 897795a0e..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/XmlMapper.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml;
-
-import java.io.StringWriter;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class XmlMapper {
- private static final Logger LOG = LoggerFactory.getLogger(XmlMapper.class);
-
- public String getXmlString(MwtNotificationBase base) {
- String xml;
- JAXBContext jaxbContext;
- try {
- jaxbContext = JAXBContext.newInstance(AttributeValueChangedNotificationXml.class,
- ObjectCreationNotificationXml.class, ObjectDeletionNotificationXml.class,
- ProblemNotificationXml.class);
- Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
- jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
-
- StringWriter stringWriter = new StringWriter();
- jaxbMarshaller.marshal(base, stringWriter);
- xml = stringWriter.toString();
- } catch (JAXBException e) {
- LOG.warn("Problem in marshalling xml file {}", e);
- xml = null;
- }
- return xml;
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/database/types/EsEventOdluxLog.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/database/types/EsEventOdluxLog.java
deleted file mode 100644
index 14f7d2447..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/database/types/EsEventOdluxLog.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.index.database.types;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.elasticsearch.index.query.QueryBuilder;
-import org.elasticsearch.index.query.RangeQueryBuilder;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime;
-
-/**
- * Event log, used by Odlux client.
- * Not used for writing any data by devicemanager.
- * Type introduced to implement IndexCleanService
- */
-
-public class EsEventOdluxLog extends EsObject {
-
- public static final String ESDATATYPENAME = "log";
-
- private static final String LOG_FIELD_TIMESTAMP = "timestamp";
-
- private String type;
- private String component;
- private String message;
- private String timestamp;
-
- /**
- * For jackson
- */
- protected EsEventOdluxLog() {
- }
- /**
- * Constructor
- * @param type string
- * @param component string
- * @param message string
- * @param timestamp string with netconf format string
- */
- public EsEventOdluxLog(String type, String component, String message, InternalDateAndTime timestamp) {
- super();
- this.type = type;
- this.component = component;
- this.message = message;
- this.timestamp = timestamp.getValue();
- }
-
- @JsonProperty("type")
- public String getType() {
- return type;
- }
-
- @JsonProperty("component")
- public String getComponent() {
- return component;
- }
-
- @JsonProperty("message")
- public String getMessage() {
- return message;
- }
-
- @JsonProperty(LOG_FIELD_TIMESTAMP)
- public String getTimestamp() {
- return timestamp;
- }
-
- /**
- * Query to get older Elements
- * @param netconfTimeStamp to identify older Elements
- * @return QueryBuilder for older elements related to timestamp
- */
- public static QueryBuilder getQueryForTimeStamp(String netconfTimeStamp) {
- return new RangeQueryBuilder(LOG_FIELD_TIMESTAMP).lt(netconfTimeStamp);
- }
-
- }
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/impl/IndexMwtnService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/impl/IndexMwtnService.java
deleted file mode 100644
index 4f3469759..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/impl/IndexMwtnService.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.index.impl;
-
-import java.util.Date;
-import org.elasticsearch.index.query.QueryBuilder;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice.ArchiveCleanProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDataBaseReaderAndWriter;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseClientAbstract;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseNode;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.IndexClientBuilder;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.index.database.types.EsEventOdluxLog;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Setup index mwtn in the database
- * @author herbert
- *
- */
-public class IndexMwtnService implements AutoCloseable, ArchiveCleanProvider {
-
- private static final Logger LOG = LoggerFactory.getLogger(IndexMwtnService.class);
- private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter();
-
- /** Index name to be used */
- public static final String INDEX = "mwtn";
- /** Location of mapping data **/
- private static final String MAPPING = "elasticsearch/index/mwtn/mwtnMapping.json";
- /** Location of configuration data **/
-
- private final HtDataBaseReaderAndWriter<EsEventOdluxLog> eventRWOdluxLog;
-
-
- private final HtDatabaseClientAbstract client;
-
- // --- Construct and initialize
-
- public IndexMwtnService(HtDatabaseNode database) throws Exception {
- LOG.info("Create {} start", this.getClass().getSimpleName());
-
-
- IndexClientBuilder clientBuilder = IndexClientBuilder.getBuilder(INDEX)
- .setMappingSettingJsonFileName(MAPPING);
- client = clientBuilder.create(database);
- clientBuilder.close();
-
- eventRWOdluxLog = new HtDataBaseReaderAndWriter<>(client, EsEventOdluxLog.ESDATATYPENAME, EsEventOdluxLog.class);
-
- LOG.info("Create {} finished. DB Service sucessfully started.", this.getClass().getSimpleName());
- }
-
- /**
- * Get client to be used in other services
- * @return client
- */
- public HtDatabaseClientAbstract getClient() {
- return client;
- }
-
- /**
- * Write into Odlux log, used by client
- * @param logEntry as test data
- */
- public void writeOdluxEventForTestpurpose(EsEventOdluxLog logEntry) {
- eventRWOdluxLog.doWrite(logEntry);
- }
-
-
- @Override
- public void close() throws Exception {
- if (client != null) {
- client.close();
- }
- }
-
- @Override
- public int doIndexClean(Date olderAreOutdated) {
-
- String netconfTimeStamp = NETCONFTIME_CONVERTER.getTimeStampAsNetconfString(olderAreOutdated);
-
- QueryBuilder queryOdluxLog = EsEventOdluxLog.getQueryForTimeStamp(netconfTimeStamp);
- int removed = eventRWOdluxLog.doRemoveByQuery(queryOdluxLog);
- return removed;
-
- }
-
- @Override
- public int getNumberOfOldObjects(Date olderAreOutdated) {
-
- String netconfTimeStamp = NETCONFTIME_CONVERTER.getTimeStampAsNetconfString(olderAreOutdated);
- int numberOfElements = 0;
-
- QueryBuilder queryOdluxLog = EsEventOdluxLog.getQueryForTimeStamp(netconfTimeStamp);
- numberOfElements += eventRWOdluxLog.doReadAll(queryOdluxLog).size();
-
- return numberOfElements;
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/impl/IndexUpdateService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/impl/IndexUpdateService.java
deleted file mode 100644
index 4af48922e..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/index/impl/IndexUpdateService.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.index.impl;
-
-import java.io.File;
-import java.io.IOException;
-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.base.database.HtDatabaseNode;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseUpdateFile;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseWebAPIClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseUpdateFile.EsUpdateObject;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseUpdateFile.FileReadCallback;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class IndexUpdateService implements AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(IndexUpdateService.class);
-
- private static final String FILENAME = "etc/elasticsearch_update.zip";
-
- private final HtDatabaseWebAPIClient webClient;
-
- private final boolean autoremove=true;
-
- @SuppressWarnings("unused")
- private ScheduledFuture<?> taskHandle;
- private final ScheduledExecutorService scheduler;
- @SuppressWarnings("unused")
- private final HtDatabaseNode database;
-
- private final FileReadCallback onReadUpdateFile = new FileReadCallback()
- {
- @Override
- public void read(EsUpdateObject obj,String filename) {
- try {
- IndexUpdateService.this.webClient.sendRequest(obj.Uri, obj.Method, obj.Body);
- LOG.info("run database update file {}", filename);
- } catch (IOException e) {
- LOG.warn("problem for request {}", obj.Uri);
- }
- }
-
- @Override
- public void onerror(String filename,IOException e) {
- LOG.warn("problem reading content file {} : {}", filename, e.getMessage());
- }
-
- };
- private final Runnable checkForUpdateTask = () -> {
- File f=new File(FILENAME);
- if(f.exists())
- {
- LOG.debug("found update file {}", f.getAbsolutePath());
- try {
- HtDatabaseUpdateFile updateFile=new HtDatabaseUpdateFile(FILENAME);
- if(updateFile.readFiles(onReadUpdateFile))
- {
- LOG.info("update successful");
- }
- updateFile.close();
- if(IndexUpdateService.this.autoremove)
- {
- boolean res = f.delete();
- LOG.debug("autodelete updatefile done {}", res);
- }
-
- } catch (IOException e) {
- LOG.warn("problem with update file: {}", e.getMessage());
- }
- }
- };
-
-
-
- public IndexUpdateService(HtDatabaseNode database, String esNodeserverName, String esClusterName, String esNodeName) {
- this.database = database;
- this.webClient = new HtDatabaseWebAPIClient();
- this.scheduler = Executors.newSingleThreadScheduledExecutor();
- }
- public void start()
- {
- this.taskHandle = this.scheduler.scheduleAtFixedRate(checkForUpdateTask, 0, 30, TimeUnit.SECONDS);
- }
- public void stop()
- {
- this.scheduler.shutdown();
- }
- @Override
- public void close() throws Exception {
- stop();
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/MaintenanceRPCServiceAPI.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/MaintenanceRPCServiceAPI.java
deleted file mode 100644
index 3687625a0..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/MaintenanceRPCServiceAPI.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetMaintenanceModeInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetMaintenanceModeOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetRequiredNetworkElementKeysOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SetMaintenanceModeInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SetMaintenanceModeOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ShowRequiredNetworkElementInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ShowRequiredNetworkElementOutputBuilder;
-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;
-
-public interface MaintenanceRPCServiceAPI {
-
- public GetRequiredNetworkElementKeysOutputBuilder getRequiredNetworkElementKeys();
-
- public ShowRequiredNetworkElementOutputBuilder showRequiredNetworkElement(ShowRequiredNetworkElementInput input);
-
- public GetMaintenanceModeOutputBuilder getMaintenanceMode(GetMaintenanceModeInput input);
-
- public SetMaintenanceModeOutputBuilder setMaintenanceMode(SetMaintenanceModeInput input);
-
- public TestMaintenanceModeOutputBuilder testMaintenanceMode(TestMaintenanceModeInput input);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/MaintenanceService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/MaintenanceService.java
deleted file mode 100644
index e9aec4146..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/MaintenanceService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance;
-
-public interface MaintenanceService {
-
- /**
- * 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);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/database/types/EsMaintenanceFilter.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/database/types/EsMaintenanceFilter.java
deleted file mode 100644
index 46b434217..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/database/types/EsMaintenanceFilter.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.database.types;
-
-import com.fasterxml.jackson.annotation.JsonGetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonSetter;
-import java.time.Instant;
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.time.format.DateTimeParseException;
-import java.util.Collections;
-import java.util.Map;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.maintenance.mode.g.Filter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.maintenance.mode.g.filter.Definition;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * One filter element to describe a maintenance status for an object referenced by definition.
- * TODO: Merge Filter and ES driven implementation
- */
-public class EsMaintenanceFilter implements Filter {
-
- private static final Logger LOG = LoggerFactory.getLogger(EsMaintenanceFilter.class);
-
- private static ZoneId EsMaintenanceFilterTimeZone = ZoneId.of("UTC");
- //private static DateTimeFormatter FORMAT = DateTimeFormatter.ISO_DATE_TIME; // "1986-04-08T12:30:00"
- private static DateTimeFormatter FORMAT = DateTimeFormatter.ISO_OFFSET_DATE_TIME; // 2011-12-03T10:15:30+01:00
- private static ZonedDateTime EMPTYDATETIME = ZonedDateTime.ofInstant(Instant.EPOCH, EsMaintenanceFilterTimeZone);
- private static String EMPTY = "";
-
- //yang tools
- @JsonIgnore
- private final Map<java.lang.Class<? extends Augmentation<Filter>>, Augmentation<Filter>> augmentation = Collections.emptyMap();
-
- @JsonIgnore
- private ZonedDateTime start = EMPTYDATETIME;
- @JsonIgnore
- private ZonedDateTime end = EMPTYDATETIME;
-
- private EsMaintenanceFilterDefinition definition = new EsMaintenanceFilterDefinition();
- private String description = EMPTY;
-
- // For jackson
- public EsMaintenanceFilter() {
- }
-
- public EsMaintenanceFilter(Filter filter) {
- setStartAsString(filter.getStartDate());
- setEndAsString(filter.getEndDate());
- description = filter.getDescription();
- definition = new EsMaintenanceFilterDefinition(filter.getDefinition());
- }
-
- /*------
- * start
- */
- public ZonedDateTime getStart() {
- return start;
- }
- @JsonGetter("start")
- public String getStartAsString() {
- return toString(start);
- }
- public void setStart(ZonedDateTime start) {
- this.start = start;
- }
- @JsonSetter("start")
- public void setStartAsString(String startAsString) {
- this.start = valueOf(startAsString);
- }
-
- /*------
- * end
- */
- public ZonedDateTime getEnd() {
- return end;
- }
- @JsonGetter("end")
- public String getEndAsString() {
- return toString(end);
- }
- public void setEnd(ZonedDateTime end) {
- this.end = end;
- }
- @JsonSetter("end")
- public void setEndAsString(String endAsString) {
- this.end = valueOf(endAsString);
- }
-
- /*-----------------
- * other parameters
- */
-
- public EsMaintenanceFilterDefinition getDefinition2() {
- return definition;
- }
- public void setDefinition(EsMaintenanceFilterDefinition definition) {
- this.definition = definition;
- }
- @Override
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Get the actual time in the Filter time zone.
- * @return actual Time
- */
- public static ZonedDateTime getNow() {
- return ZonedDateTime.now(EsMaintenanceFilterTimeZone);
- }
-
-
- /**
- * Verify if the filter is active for an object
- * @param now point of time to verify
- * @return if the object is covered by filter and now within point of time
- */
- public boolean isInMaintenance(String objectIdRef, String problem, ZonedDateTime now) {
- return definition.appliesToObjectReference(objectIdRef, problem) && isInPeriod(start, end, now);
- }
-
- @Override
- public String toString() {
- return "EsMaintenanceFilter [start=" + start + ", end=" + end + ", definition=" + definition + ", description="
- + description + "]";
- }
-
- /*---------------------------------------------
- * YANG tools related functions for interface
- */
-
- @Override
- public Class<? extends DataContainer> getImplementedInterface() {
- return Filter.class;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <E extends Augmentation<Filter>> E augmentation(Class<E> augmentationType) {
- return (E) augmentation.get(augmentationType);
- }
-
- @Override
- public Definition getDefinition() {
- return definition;
- }
-
- @Override
- public String getStartDate() {
- return getStartAsString();
- }
-
- @Override
- public String getEndDate() {
- return getEndAsString();
- }
-
- /*---------------------------------------------
- * private static helper functions to verify
- */
-
- /**
- * Compare the if probe is within the range of start and end.
- * @param start of range
- * @param end of range
- * @param probe time to verify
- * @return boolean result true if (start <= probe <= end)
- */
- public static boolean isInPeriod(ZonedDateTime start, ZonedDateTime end, ZonedDateTime probe) {
- return start.compareTo(end) < 0 && start.compareTo(probe) <= 0 && end.compareTo(probe) >= 0;
- }
-
- /**
- * Convert to time value to String
- * @param ldt ZonedDateTime format
- * @return String output
- */
- public static String toString(ZonedDateTime ldt) {
- if(ldt==null) {
- return "";
- }
- return ldt.format(FORMAT);
- }
-
- /**
- * Convert String to time value
- * @param zoneTimeString with time
- * @return ZonedDateTime string
- */
- public static ZonedDateTime valueOf(String zoneTimeString) {
- if (zoneTimeString == null || zoneTimeString.isEmpty()) {
- LOG.warn("Null or empty zoneTimeString");
- return EMPTYDATETIME;
- }
- try {
- return ZonedDateTime.parse(zoneTimeString, FORMAT);
- } catch (DateTimeParseException e) {
- LOG.warn("Can not parse zoneTimeString '{}'",zoneTimeString);
- return EMPTYDATETIME;
- }
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/database/types/EsMaintenanceFilterDefinition.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/database/types/EsMaintenanceFilterDefinition.java
deleted file mode 100644
index c548a98e2..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/database/types/EsMaintenanceFilterDefinition.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.database.types;
-
-import java.util.Collections;
-import java.util.Map;
-import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.maintenance.mode.g.filter.Definition;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class EsMaintenanceFilterDefinition implements Definition {
-
- private static final Logger LOG = LoggerFactory.getLogger(EsMaintenanceFilterDefinition.class);
- private static final String ALL = "";
-
- //yang tools
- @JsonIgnore
- private final Map<java.lang.Class<? extends Augmentation<Definition>>, Augmentation<Definition>> augmentation = Collections.emptyMap();
-
- private String objectIdRef = ALL;
- private String problem = ALL;
-
- public EsMaintenanceFilterDefinition() {
- }
-
- public EsMaintenanceFilterDefinition(Definition definition) {
- objectIdRef = definition.getObjectIdRef();
- problem = definition.getProblem();
- }
-
- @Override
- @JsonProperty("object-id-ref")
- public String getObjectIdRef() {
- return objectIdRef;
- }
-
- @JsonProperty("object-id-ref")
- public void setObjectIdRef(String objectIdRef) {
- this.objectIdRef = objectIdRef == null ? ALL : objectIdRef;
- }
-
- @Override
- @JsonProperty("problem")
- public String getProblem() {
- return problem;
- }
-
- @JsonProperty("problem")
- public void setProblem(String pProblem) {
- this.problem = pProblem == null ? ALL : pProblem;
- }
-
- public boolean appliesToObjectReference(String pObjectIdRef, String pProblem) {
- boolean res = (pObjectIdRef.isEmpty() || pObjectIdRef.contains(pObjectIdRef)) && (pProblem.isEmpty() || pProblem.contains(pProblem));
- LOG.debug("Check result applies {}: {} {} against: {}",res, pObjectIdRef, pProblem, this);
- return res;
- }
-
- @Override
- public String toString() {
- return "EsMaintenanceFilterDefinition [objectIdRef=" + objectIdRef + ", problem=" + problem + "]";
- }
-
- @Override
- public Class<? extends DataContainer> getImplementedInterface() {
- return Definition.class;
- }
-
- @Override
- public <E extends Augmentation<Definition>> @Nullable E augmentation(Class<E> augmentationType) {
- return null;
- }
-
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/database/types/EsMaintenanceMode.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/database/types/EsMaintenanceMode.java
deleted file mode 100644
index 456c146b1..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/database/types/EsMaintenanceMode.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.database.types;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import java.time.ZonedDateTime;
-import java.util.ArrayList;
-import java.util.List;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.MaintenanceModeG;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.maintenance.mode.g.Filter;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Database record entry for maintenance mode, as specified. Used for read operations Structure: _id
- * : Contains the mountpoint name, must be specified before read. startTime: String representing
- * Java LocalDateTime with absolute UTC Time endTime: String representing Java LocalDateTime with
- * absolute UTC Time JSON Structure example { "_index": "mwtn_v1", "_type": "maintenancemode",
- * "_id": "LumpiWave-Z3", "_score": 1, "_source": { "node": "LumpiWave-Z3", "filter": [ {
- * "definition": { "object-id-ref": "", "problem": "" }, "description": "", "start":
- * "2018-01-01T10:00+00:00", "end": "2018-10-10T10:00+00:00" }, { "definition": { "object-id-ref":
- * "network-element", "problem": "power-alarm" }, "description": "", "start":
- * "2018-01-01T10:00+00:00", "end": "2018-10-10T10:00+00:00" } ] } },
- *
- * Two filters for all element and one for network-element power-alarm
- */
-
-public class EsMaintenanceMode extends EsObject implements MaintenanceModeG {
-
- @SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(EsMaintenanceMode.class);
-
- public static final String ESDATATYPENAME = "maintenancemode";
-
- private static final EsMaintenanceMode NOT_IN_MAINTENANCE = new EsMaintenanceMode("notinmaintenance");
-
- private String node;
-
- @JsonDeserialize(as = ArrayList.class)
- private List<EsMaintenanceFilter> filter;
-
- private boolean active;
-
- // for jackson
- public EsMaintenanceMode() {
- this.active = false;
- this.filter = new ArrayList<>();
- }
-
- public EsMaintenanceMode(String mountpoint) {
- this();
- this.setEsId(mountpoint);
- this.node = mountpoint;
- }
-
- public EsMaintenanceMode(MaintenanceModeG maintenanceModeG) {
- this.setEsId(maintenanceModeG.getMountpointName());
- this.node = maintenanceModeG.getNodeName();
- List<Filter> filters = maintenanceModeG.getFilter();
- if (filter != null) {
- for (Filter filterElement : filters) {
- this.filter.add(new EsMaintenanceFilter(filterElement));
- }
- }
- }
-
-
- public String getNode() {
- return node;
- }
-
- public void setNode(String node) {
- this.node = node;
- }
-
- public List<EsMaintenanceFilter> getFilter2() {
- return filter;
- }
-
- public void setActive(boolean a) {
- this.active = a;
- }
-
- /**
- * Replace list with new one.
- *
- * @param filterList new filter list
- */
- public void setFilter(List<EsMaintenanceFilter> filterList) {
- this.filter = filterList;
- }
-
- /**
- * Add one filter to internal list
- *
- * @param pFilter the Filter
- */
- public void addFilter(EsMaintenanceFilter pFilter) {
- this.filter.add(pFilter);
- }
-
- /**
- * Verify maintenance status
- *
- * @param objectIdRef NETCONF object id
- * @param problem name that was provided
- * @param now time to verify with
- * @return true if in maintenance status
- */
- public boolean isONFObjectInMaintenance(String objectIdRef, String problem, ZonedDateTime now) {
- if (!active) {
- return false;
- }
- boolean res = false;
- if (this != NOT_IN_MAINTENANCE) {
- for (EsMaintenanceFilter oneFilter : filter) {
- if (oneFilter.isInMaintenance(objectIdRef, problem, now)) {
- res = true;
- break;
- }
- }
- }
- return res;
- }
-
- /** Shortcut **/
- public boolean isONFObjectInMaintenance(String objectIdRef, String problem) {
- return isONFObjectInMaintenance(objectIdRef, problem, EsMaintenanceFilter.getNow());
- }
-
- @Override
- public String toString() {
- return "EsMaintenanceMode [node=" + node + ", filter=" + filter + ", active=" + active + "]";
- }
-
- public static EsMaintenanceMode getNotInMaintenance() {
- return NOT_IN_MAINTENANCE;
- }
-
- /*---------------------------------------------
- * yang tools related functions
- */
-
- @Override
- public Class<? extends DataContainer> getImplementedInterface() {
- return MaintenanceModeG.class;
- }
-
- @Override
- public String getMountpointName() {
- return this.getEsId();
- }
-
- @Override
- public String getNodeName() {
- return node;
- }
-
- @Override
- public List<Filter> getFilter() {
- return filter.isEmpty() ? null : new ArrayList<>(filter);
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java
deleted file mode 100644
index 1db3433e2..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.impl;
-
-import java.time.ZonedDateTime;
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsBaseRequireNetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDataBaseReaderAndWriter;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseClientAbstract;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseNode;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.index.impl.IndexMwtnService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceRPCServiceAPI;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.database.types.EsMaintenanceFilter;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.database.types.EsMaintenanceFilterDefinition;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.database.types.EsMaintenanceMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetMaintenanceModeInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetMaintenanceModeOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetRequiredNetworkElementKeysOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SetMaintenanceModeInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SetMaintenanceModeOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ShowRequiredNetworkElementInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ShowRequiredNetworkElementOutputBuilder;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MaintenanceServiceImpl implements MaintenanceService, MaintenanceRPCServiceAPI, AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(MaintenanceServiceImpl.class);
-
- /**
- * Use the Client Index
- */
- private HtDataBaseReaderAndWriter<EsMaintenanceMode> maintenanceRW;
- private HtDataBaseReaderAndWriter<EsBaseRequireNetworkElement> requiredNeRW;
-
- public MaintenanceServiceImpl(HtDatabaseClientAbstract client) {
-
- LOG.info("Create {} start", MaintenanceServiceImpl.class);
-
- try {
- // Create control structure
- maintenanceRW = new HtDataBaseReaderAndWriter<>(client, EsMaintenanceMode.ESDATATYPENAME, EsMaintenanceMode.class);
- requiredNeRW = new HtDataBaseReaderAndWriter<>(client, EsBaseRequireNetworkElement.ESDATATYPENAME, EsBaseRequireNetworkElement.class);
-
- } catch (Exception e) {
- LOG.error("Can not start database client. Exception: {}", e.getMessage());
- }
- LOG.info("Create {} finished. DB Service {} started.", MaintenanceServiceImpl.class, client != null ? "sucessfully" : "not" );
-
- }
-
- public MaintenanceServiceImpl(HtDatabaseNode database) {
- this(getDatabaseClient(database));
- }
-
- private static HtDatabaseClientAbstract getDatabaseClient(HtDatabaseNode database) {
- return new HtDatabaseClientAbstract(IndexMwtnService.INDEX,database);
- }
-
- /**
- * Get existing object for mountpoint to manage maintenance mode
- * @return Object with configuration
- */
- private @Nonnull EsMaintenanceMode getMaintenance(String mountpointId)
- {
- EsMaintenanceMode deviceMaintenanceMode = null;
- if (maintenanceRW != null) {
- deviceMaintenanceMode = maintenanceRW.doRead(mountpointId);
- }
-
- return deviceMaintenanceMode == null ? EsMaintenanceMode.getNotInMaintenance() : deviceMaintenanceMode;
- }
- /**
- * Check in required ne if entry exists for mountpointNodeName
- * @param mountPointNodeName
- * @return
- */
- private boolean isRequireNe(String mountPointNodeName) {
- EsBaseRequireNetworkElement ne=null;
- if( requiredNeRW!=null)
- {
- LOG.debug("searching for entry in required-networkelement for "+mountPointNodeName);
- ne = requiredNeRW.doRead(mountPointNodeName);
- } else {
- LOG.warn("cannot read db. no db reader writer initialized");
- }
- return ne!=null;
- }
- public EsMaintenanceMode createIfNotExists(String mountpointId)
- {
- EsMaintenanceMode deviceMaintenanceMode = null;
- if (maintenanceRW != null)
- {
- deviceMaintenanceMode = maintenanceRW.doRead(mountpointId);
- if(deviceMaintenanceMode==null)
- {
- LOG.debug("creating empty maintenance object in database");
- deviceMaintenanceMode=new EsMaintenanceMode(mountpointId);
- EsMaintenanceFilter filter = new EsMaintenanceFilter();
- filter.setDescription("");
- filter.setStart(null);
- filter.setEnd(null);
- EsMaintenanceFilterDefinition definition=new EsMaintenanceFilterDefinition();
- definition.setObjectIdRef("");
- definition.setProblem("");
- filter.setDefinition(definition);
- deviceMaintenanceMode.addFilter(filter );
- maintenanceRW.doWrite(deviceMaintenanceMode);
- } else {
- LOG.debug("maintenance object already exists in database");
- }
- } else {
- LOG.warn("cannot create maintenance obj. db reader/writer is null");
- }
-
- return deviceMaintenanceMode;
- }
- public void deleteIfNotRequired(String mountPointNodeName) {
-
- if(!this.isRequireNe(mountPointNodeName))
- {
- EsMaintenanceMode deviceMaintenanceMode = new EsMaintenanceMode(mountPointNodeName);
- if (maintenanceRW != null)
- {
- LOG.debug("removing maintenance object in database for "+mountPointNodeName);
- maintenanceRW.doRemove(deviceMaintenanceMode);
- } else {
- LOG.warn("cannot create maintenance obj. db reader/writer is null");
- }
- }
-
- }
-
-
-
- /*-------------------------------------------------
- * Interface AutoClosable
- */
-
- @Override
- public void close() throws Exception {
- }
-
- /*-------------------------------------------------
- * Interface MaintenanceRPCServiceAPI
- */
-
- @Override
- public GetRequiredNetworkElementKeysOutputBuilder getRequiredNetworkElementKeys() {
- GetRequiredNetworkElementKeysOutputBuilder outputBuilder = new GetRequiredNetworkElementKeysOutputBuilder();
- List<EsMaintenanceMode> all = maintenanceRW != null ? maintenanceRW.doReadAll() : new ArrayList<>();
- List<String> mountpointList = new ArrayList<>();
- for (EsMaintenanceMode oneOfAll : all) {
- mountpointList.add(oneOfAll.getEsId());
-
- }
- outputBuilder.setMountpointNames(mountpointList);
- return outputBuilder;
- }
-
- @Override
- public ShowRequiredNetworkElementOutputBuilder showRequiredNetworkElement(ShowRequiredNetworkElementInput input) {
- ShowRequiredNetworkElementOutputBuilder outputBuilder = new ShowRequiredNetworkElementOutputBuilder();
- EsMaintenanceMode maintenanceMode = new EsMaintenanceMode(input.getMountpointName());
- if (maintenanceRW != null) {
- maintenanceMode = maintenanceRW.doRead(maintenanceMode);
- }
- if (maintenanceMode != null) {
- RequiredNetworkElementBuilder valueBuilder = new RequiredNetworkElementBuilder();
-
- valueBuilder.setMountpointName(maintenanceMode.getNode());
- valueBuilder.setStatus(String.valueOf(maintenanceMode.isONFObjectInMaintenance("","")));
- valueBuilder.setDescription("Pretty description here");
- outputBuilder.setRequiredNetworkElement(valueBuilder.build());
- } else {
- LOG.warn("No info in database for {}",input.getMountpointName());
- }
- return outputBuilder;
- }
-
- @Override
- public GetMaintenanceModeOutputBuilder getMaintenanceMode(GetMaintenanceModeInput input) {
- EsMaintenanceMode maintenanceMode = null;
- GetMaintenanceModeOutputBuilder outputBuilder;
- if (maintenanceRW != null) {
- maintenanceMode = maintenanceRW.doRead(input.getMountpointName());
- }
- if (maintenanceMode != null) {
- outputBuilder = new GetMaintenanceModeOutputBuilder(maintenanceMode);
- } else {
- throw new IllegalArgumentException("No info in database for "+input.getMountpointName());
- }
- return outputBuilder;
- }
-
- @Override
- public SetMaintenanceModeOutputBuilder setMaintenanceMode(SetMaintenanceModeInput input) {
-
- SetMaintenanceModeOutputBuilder outputBuilder = new SetMaintenanceModeOutputBuilder();
- if (maintenanceRW != null) {
- EsMaintenanceMode m = new EsMaintenanceMode(input);
- if (maintenanceRW.doWrite(m) == null) {
- throw new IllegalArgumentException("Problem writing to database: "+input.getMountpointName());
- }
- outputBuilder = new SetMaintenanceModeOutputBuilder(m);
- LOG.info("Wrote maintenance object {}", m.toString());
- }
- return outputBuilder;
- }
-
- @Override
- public TestMaintenanceModeOutputBuilder testMaintenanceMode(TestMaintenanceModeInput input) {
-
- StringBuffer resultString = new StringBuffer();
-
- EsMaintenanceMode maintenanceMode = getMaintenance(input.getMountpointName());
-
- TestMaintenanceModeOutputBuilder outputBuilder = new TestMaintenanceModeOutputBuilder(maintenanceMode);
-
- ZonedDateTime now = EsMaintenanceFilter.valueOf(input.getTestDate());
-
- resultString.append("In database table: ");
- resultString.append(!(EsMaintenanceMode.getNotInMaintenance() == maintenanceMode));
- resultString.append(" Maintenance active: ");
- resultString.append(maintenanceMode.isONFObjectInMaintenance(input.getObjectIdRef(), input.getProblemName(), now));
- resultString.append(" at Timestamp: ");
- resultString.append(now);
-
- outputBuilder.setResultString(resultString.toString());
-
- return outputBuilder;
- }
-
- /*-------------------------------------------------
- * Interface MaintenaceService
- */
-
- @Override
- public boolean isONFObjectInMaintenance(String mountpointReference, String objectIdRef, String problem) {
- EsMaintenanceMode maintenanceMode = getMaintenance(mountpointReference);
- boolean res = maintenanceMode.isONFObjectInMaintenance(objectIdRef, problem);
- LOG.debug("inMaintenance={} for mountpoint/id/problem:{} {} {} Definition: {}",res, mountpointReference, objectIdRef, problem, this );
- return res;
- }
-
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/MicrowaveModelPerformanceDataProvider.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/MicrowaveModelPerformanceDataProvider.java
deleted file mode 100644
index d6391aabd..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/MicrowaveModelPerformanceDataProvider.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.AllPm;
-
-
-/**
- * Identify the NE as provider for performance data according to microwave model.
- *
- * @author herbert
- */
-
-public interface MicrowaveModelPerformanceDataProvider {
-
- public void resetPMIterator();
-
- public boolean hasNext();
-
- public void next();
-
- public AllPm getHistoricalPM();
-
- public String pmStatusToString();
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerImpl.java
deleted file mode 100644
index b4c5abd7d..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl;
-
-import javax.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.ONFCoreNetworkElementRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.service.MicrowaveHistoricalPerformanceWriterService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PerformanceManagerImpl implements AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(PerformanceManagerImpl.class);
-
- private @Nullable PerformanceManagerTask task;
-
- public PerformanceManagerImpl(long seconds, MicrowaveHistoricalPerformanceWriterService databaseService) {
-
- LOG.info("Construct begin {} with {} Seconds",PerformanceManagerImpl.class.getSimpleName(), seconds);
-
- if (MicrowaveHistoricalPerformanceWriterService.isAvailable(databaseService)) {
-
- LOG.info("Do start of PM task");
- task = new PerformanceManagerTask(seconds, databaseService);
- task.start();
- LOG.info("PM task scheduled");
-
- } else {
- LOG.info("Database not available. Do not start PM task");
- }
-
- LOG.info("Construct end {}",PerformanceManagerImpl.class.getSimpleName());
- }
-
- @Override
- public void close() {
- LOG.info("Close {}", PerformanceManagerImpl.class.getSimpleName());
- if (task != null) {
- task.stop();
- }
- }
-
- public void registration(String mountPointNodeName, ONFCoreNetworkElementRepresentation ne) {
- LOG.debug("Register {}",mountPointNodeName);
- if (task != null) {
- task.registration(mountPointNodeName, ne);
- }
- }
-
- public void deRegistration(String mountPointNodeName) {
- LOG.debug("Deregister {}",mountPointNodeName);
- if (task != null) {
- task.deRegistration(mountPointNodeName);
- }
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerTask.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerTask.java
deleted file mode 100644
index ef2a0b8db..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerTask.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl;
-
-import java.util.Iterator;
-import java.util.concurrent.ConcurrentHashMap;
-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.base.netconf.ONFCoreNetworkElementRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.AllPm;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.service.MicrowaveHistoricalPerformanceWriterService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PerformanceManagerTask implements Runnable {
-
- private static final Logger LOG = LoggerFactory.getLogger(PerformanceManagerTask.class);
- private static final String LOGMARKER = "PMTick";
-
- private int tickCounter = 0;
-
- private final ConcurrentHashMap<String, ONFCoreNetworkElementRepresentation> queue = new ConcurrentHashMap<>();
- private final MicrowaveHistoricalPerformanceWriterService databaseService;
- private final ScheduledExecutorService scheduler;
- private final long seconds;
-
- private ScheduledFuture<?> taskHandle = null;
- private Iterator<ONFCoreNetworkElementRepresentation> neIterator = null;
- private ONFCoreNetworkElementRepresentation actualNE = null;
-
- /**
- * Constructor of PM Task
- * @param seconds seconds to call PM Task
- * @param databaseService DB Service to load PM data to
- */
-
- public PerformanceManagerTask(long seconds, MicrowaveHistoricalPerformanceWriterService databaseService) {
-
- LOG.debug("Init task {}", PerformanceManagerTask.class.getSimpleName());
- this.seconds = seconds;
- this.databaseService = databaseService;
- this.scheduler = Executors.newSingleThreadScheduledExecutor();
-
- }
-
- /**
- * Start PM Task
- */
- public void start() {
- LOG.info("PM task created");
- taskHandle = this.scheduler.scheduleAtFixedRate(this, 0, seconds, TimeUnit.SECONDS);
- LOG.info("PM task scheduled");
- }
-
- /**
- * Stop everything
- */
- public void stop() {
- LOG.info("Stop {}", PerformanceManagerImpl.class.getSimpleName());
- if (taskHandle != null) {
- taskHandle.cancel(true);
- try {
- scheduler.awaitTermination(10, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- LOG.debug("Schdule stopped.",e);
- // Restore interrupted state...
- Thread.currentThread().interrupt();
- }
- }
- }
-
- /**
- * Add NE/Mountpoint to PM Processig
- * @param mountPointNodeName to be added
- * @param ne that is connected to the mountpoint
- */
- public void registration(String mountPointNodeName, ONFCoreNetworkElementRepresentation ne) {
- queue.put(mountPointNodeName, ne);
- }
-
- /**
- * Remove mountpoint/NE from PM process
- * @param mountPointNodeName that has to be removed
- */
- public void deRegistration(String mountPointNodeName) {
- LOG.debug("Deregister {}",mountPointNodeName);
- ONFCoreNetworkElementRepresentation removedNE = queue.remove(mountPointNodeName);
-
- if ( removedNE == null) {
- LOG.warn("Couldn't delete {}",mountPointNodeName);
- }
- }
-
-
- /*--------------------------------------------------------------
- * Task to read PM data from NE
- */
-
- /**
- * Task runner to read all performance data from Network Elements.
- * Catch exceptions to make sure, that the Task is not stopped.
- */
- @Override
- public void run() {
-
- LOG.debug("{} start {} Start with mountpoint {}",LOGMARKER, tickCounter, actualNE == null ? "No NE" : actualNE.getMountPointNodeName());
-
- //Proceed to next NE/Interface
- getNextInterface();
-
- LOG.debug("{} {} Next interface to handle {}", LOGMARKER, tickCounter,
- actualNE == null ? "No NE/IF" : actualNE.getMountPointNodeName() + " " + actualNE.pmStatusToString());
-
- if (actualNE != null) {
- try {
- LOG.debug("{} Start to read PM from NE ({})", LOGMARKER, tickCounter);
- AllPm allPm = actualNE.getHistoricalPM();
- LOG.debug("{} {} Got PM list. Start write to DB", LOGMARKER, tickCounter);
- databaseService.writePM(allPm);
- LOG.debug("{} {} PM List end.", LOGMARKER, tickCounter);
- } catch (Exception e) {
- LOG.warn("{} {} PM read/write failed. Write log entry {}", LOGMARKER, tickCounter, e);
- String msg = e.getMessage();
- if (msg == null || msg.isEmpty()) {
- if (e.getCause() != null) {
- msg = e.getCause().toString();
- }
- if (msg == null || msg.isEmpty()){
- msg = "No message or cause";
- }
- }
- databaseService.writePMLog(actualNE.getMountPointNodeName(), actualNE.pmStatusToString(), msg);
- }
- }
-
- LOG.debug("{} end {}",LOGMARKER, tickCounter);
- tickCounter++;
- }
-
- /**
- * Reset queue to start from beginning
- */
- private void resetQueue() {
- actualNE = null;
- neIterator = null;
- }
-
- /**
- * Get then next interface in the list.
- * First try to find a next on the actual NE.
- * If not available search next interface at a NE
- * Special Situations to handle: Empty queue, NEs, but no interfaces
- */
- private void getNextInterface() {
- boolean started = false;
- int loopCounter = 0;
-
- LOG.debug("{} {} getNextInterface enter. Queue size {} ", LOGMARKER, tickCounter, queue.size());
-
- if (actualNE != null && !queue.containsValue(actualNE)) {
- LOG.debug("{} {} NE Removed duringprocessing A",LOGMARKER, tickCounter);
- resetQueue();
- }
-
- while (true) {
-
- if (loopCounter++ >= 1000) {
- LOG.error("{} {} Problem in PM iteration. endless condition reached", LOGMARKER, tickCounter);
- resetQueue();
- break;
- }
-
- LOG.debug("{} {} Loop ne {}:neiterator {}:Interfaceiterator:{} Loop:{}",
- LOGMARKER,
- tickCounter,
- actualNE == null? "null" : actualNE.getMountPointNodeName(),
- neIterator == null ? "null" : neIterator.hasNext(),
- actualNE == null ? "null" : actualNE.hasNext(),
- loopCounter);
-
- if (actualNE != null && actualNE.hasNext()) {
- // Yes, there is an interface, deliver back
- LOG.debug("{} {} getNextInterface yes A",LOGMARKER, tickCounter);
- actualNE.next();
- break;
-
- } else {
- // No element in neInterfaceInterator .. get next NE and try
- if (neIterator != null && neIterator.hasNext()) {
- // Set a new NE
- LOG.debug("{} {} Next NE A",LOGMARKER, tickCounter);
- actualNE = neIterator.next();
- actualNE.resetPMIterator();
-
- } else {
- // Goto start condition 1) first entry 2) end of queue reached
- LOG.debug("{} {} Reset",LOGMARKER, tickCounter);
- resetQueue();
-
- if (queue.isEmpty()) {
- LOG.debug("{} {} no nextInterfac. queue empty",LOGMARKER, tickCounter);
- break;
- } else if (!started){
- LOG.debug("{} {} getNextInterface start condition. Get interator.",LOGMARKER, tickCounter);
- neIterator = queue.values().iterator();
- started = true;
- } else {
- LOG.debug("{} {} no nextInterface",LOGMARKER, tickCounter);
- break;
- }
- }
- }
- } //while
-
- if (actualNE != null && !queue.containsValue(actualNE)) {
- LOG.debug("{} {} NE Removed duringprocessing B",LOGMARKER, tickCounter);
- resetQueue();
- }
-
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/service/MicrowaveHistoricalPerformanceWriterService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/service/MicrowaveHistoricalPerformanceWriterService.java
deleted file mode 100644
index 4782f3305..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/service/MicrowaveHistoricalPerformanceWriterService.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.service;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDataBaseReaderAndWriter;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseClientAbstract;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseNode;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.IndexClientBuilder;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.AllPm;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance15Minutes;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance24Hours;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformanceLogEntry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MicrowaveHistoricalPerformanceWriterService {
-
- private static final Logger LOG = LoggerFactory.getLogger(MicrowaveHistoricalPerformanceWriterService.class);
- private static final String INDEX = "sdnperformance";
- private static final String MAPPING = "/elasticsearch/index/sdnperformance/sdnperformanceMapping.json";
- private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter();
-
-
- private HtDatabaseClientAbstract client;
- private HtDataBaseReaderAndWriter<EsHistoricalPerformance15Minutes> historicalPerformance15mRW;
- private HtDataBaseReaderAndWriter<EsHistoricalPerformance24Hours> historicalPerformance24hRW;
- private HtDataBaseReaderAndWriter<EsHistoricalPerformanceLogEntry> historicalPerformanceLogRW;
-
- public MicrowaveHistoricalPerformanceWriterService(HtDatabaseNode database) {
-
- LOG.info("Create {} start", MicrowaveHistoricalPerformanceWriterService.class);
-
- try {
-
- IndexClientBuilder clientBuilder =
- IndexClientBuilder.getBuilder(INDEX).setMappingSettingJsonFileName(MAPPING);
- client = clientBuilder.create(database);
- clientBuilder.close();
-
- historicalPerformance15mRW = new HtDataBaseReaderAndWriter<>(client,
- EsHistoricalPerformance15Minutes.ESDATATYPENAME, EsHistoricalPerformance15Minutes.class);
- historicalPerformance24hRW = new HtDataBaseReaderAndWriter<>(client,
- EsHistoricalPerformance24Hours.ESDATATYPENAME, EsHistoricalPerformance24Hours.class);
- historicalPerformanceLogRW = new HtDataBaseReaderAndWriter<>(client,
- EsHistoricalPerformanceLogEntry.ESDATATYPENAME, EsHistoricalPerformanceLogEntry.class);
-
- } catch (Exception e) {
- client = null;
- LOG.error("Can not start database client. Exception: {}", e.getMessage());
- }
-
- LOG.info("Create {} finished. DB Service {} started.", MicrowaveHistoricalPerformanceWriterService.class,
- client != null ? "sucessfully" : "not");
- }
-
-
- public void writePM(AllPm pm) {
-
- LOG.debug("Write {} pm records", pm.size());
-
- LOG.debug("Write 15m write to DB");
- historicalPerformance15mRW.doWrite(pm.getPm15());
- LOG.debug("Write 15m done, Write 24h write to DB");
- historicalPerformance24hRW.doWrite(pm.getPm24());
- LOG.debug("Write 24h done");
-
- }
-
- public void writePMLog(String mountpointName, String layerProtocolName, String msg) {
-
- LOG.debug("Write PM Log: {}", msg);
- EsHistoricalPerformanceLogEntry logEntry = new EsHistoricalPerformanceLogEntry(mountpointName,
- layerProtocolName, NETCONFTIME_CONVERTER.getTimeStamp().getValue(), msg);
- historicalPerformanceLogRW.doWrite(logEntry);
- LOG.debug("Write PM Log done");
-
- }
-
-
- static public boolean isAvailable(MicrowaveHistoricalPerformanceWriterService s) {
-
- if (s == null || s.client == null) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformance15Minutes.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformance15Minutes.java
deleted file mode 100644
index 6754fced9..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformance15Minutes.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types;
-
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class EsHistoricalPerformance15Minutes extends EsHistoricalPerformanceBase {
-
- public static final String ESDATATYPENAME = "historicalperformance15min";
-
- private static final Logger LOG = LoggerFactory.getLogger(EsHistoricalPerformance15Minutes.class);
-
- public EsHistoricalPerformance15Minutes(String nodeName, Lp lp) {
- super(nodeName, lp);
- }
-
- public <T extends OtnHistoryDataG> EsHistoricalPerformance15Minutes setHistoricalRecord15Minutes(OtnHistoryDataG record) {
- if (record.getGranularityPeriod() != org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType.Period15Min) {
- LOG.warn("Granularity mismatch for {} expected {} found {}", getNodeName(),getUuidInterface(), org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType.Period15Min, record.getGranularityPeriod());
- }
- set(record);
- return this;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformance24Hours.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformance24Hours.java
deleted file mode 100644
index 03c68451d..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformance24Hours.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types;
-
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-
-public class EsHistoricalPerformance24Hours extends EsHistoricalPerformanceBase {
-
- public static final String ESDATATYPENAME = "historicalperformance24h";
-
- public EsHistoricalPerformance24Hours(String nodeName, Lp lp) {
- super(nodeName, lp);
- }
-
- public <T extends OtnHistoryDataG> EsHistoricalPerformance24Hours setHistoricalRecord24Hours(T record) {
- set(record);
- return this;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformanceBase.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformanceBase.java
deleted file mode 100644
index 5f8370f60..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformanceBase.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.LinkIdentifyingObject;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.annotation.JsonGetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class EsHistoricalPerformanceBase extends EsObject {
-
- private static final Logger LOG = LoggerFactory.getLogger(EsHistoricalPerformanceBase.class);
- private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter();
-
- @JsonIgnore private final String nodeName;
- @JsonIgnore private final String uuidInterface;
- @JsonIgnore private final String layerProtocolName;
-
- @JsonIgnore private String radioSignalId = null; //Meaning of connection Id
- @JsonIgnore private String timeStamp = null;
- @JsonIgnore private Boolean suspectIntervalFlag = null;
- @JsonIgnore private String granularityPeriod = null; //Representation of GranularityPeriodType
- @JsonIgnore private String scannerId = null;
- @JsonIgnore private Object performanceData = null;
-
-
- public EsHistoricalPerformanceBase(String nodeName, Lp actualInterface) {
- this.nodeName = nodeName;
- this.uuidInterface = actualInterface.getUuid().getValue();
- this.layerProtocolName = actualInterface.getLayerProtocolName().getValue();
-
- }
-
- protected <T extends OtnHistoryDataG> void set(T record) {
- if (record == null) {
- LOG.warn("PM Record: null record. Can not handle");
- return;
- }
-
- if (LOG.isTraceEnabled()) {
- LOG.trace("PM Record: class {} '{}' ", record.getClass().getSimpleName(), record);
- }
-
- timeStamp = NETCONFTIME_CONVERTER.getTimeStampFromNetconf(record.getPeriodEndTime().getValue());
- suspectIntervalFlag = record.isSuspectIntervalFlag();
- granularityPeriod = getYangGranularityPeriodString( record.getGranularityPeriod() );
- scannerId = record.getHistoryDataId();
-
- if (record instanceof LinkIdentifyingObject) {
- radioSignalId = ((LinkIdentifyingObject) record).getSignalId();
- }
-
- performanceData = new EsPerformanceData(record);
- setEsId(genSpecificEsId(record.getPeriodEndTime().getValue()));
- }
-
-
- @JsonGetter("node-name")
- public String getNodeName() {
- return nodeName;
- }
-
- @JsonGetter("uuid-interface")
- public String getUuidInterface() {
- return uuidInterface;
- }
-
- @JsonGetter("layer-protocol-name")
- public String getLayerProtocolName() {
- return layerProtocolName;
- }
-
- @JsonGetter("radio-signal-id")
- public String getRadioSignalId() {
- return radioSignalId;
- }
-
- @JsonGetter("time-stamp")
- public String getTimeStamp() {
- return timeStamp;
- }
-
- @JsonGetter("suspect-interval-flag")
- public Boolean getSuspect() {
- return suspectIntervalFlag;
- }
-
- @JsonGetter("granularity-period")
- public String getGranularityPeriod() {
- return granularityPeriod;
- }
-
- @JsonGetter("scanner-id")
- public String getScannerId() {
- return scannerId;
- }
-
- @JsonGetter("performance-data")
- public Object getData() {
- return performanceData;
- }
-
-
-
- //Adapt JSON Text
- //@JsonGetter("granularityPeriod")
-
- private static String getYangGranularityPeriodString(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType yangGanularityPeriod) {
- switch(yangGanularityPeriod == null ? org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType.Unknown : yangGanularityPeriod) {
- case Period15Min:
- return "PERIOD_15MIN";
- case Period24Hours:
- return "PERIOD_24HOURS";
- default:
- return "PERIOD_UNKOWN";
- }
- }
-
- /**
- * Create a specific ES id for the current log.
- * @param time is the input.
- * @return a string with the generated ES Id
- */
- protected String genSpecificEsId(String time) {
-
- StringBuffer strBuf = new StringBuffer();
- strBuf.append(nodeName);
- strBuf.append("/");
- strBuf.append(uuidInterface);
- strBuf.append("/");
- strBuf.append(time == null || time.isEmpty() ? "Empty" : time);
-
- return strBuf.toString();
- }
-
- @Override
- public String toString() {
- return "EsHistoricalPerformanceBase [nodeName=" + nodeName + ", uuidInterface=" + uuidInterface
- + ", layerProtocolName=" + layerProtocolName + ", radioSignalId=" + radioSignalId + ", timeStamp="
- + timeStamp + ", suspectIntervalFlag=" + suspectIntervalFlag + ", granularityPeriod="
- + granularityPeriod + ", scannerId=" + scannerId + ", performanceData=" + performanceData + "]";
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformanceLogEntry.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformanceLogEntry.java
deleted file mode 100644
index ebbf8b435..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsHistoricalPerformanceLogEntry.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject;
-
-/**
- *
- * Event from Network to be recorded in the database
- *
- */
-
-public class EsHistoricalPerformanceLogEntry extends EsObject {
-
- public static final String ESDATATYPENAME = "performancelog";
-
- private String mountpoint;
- private String interfaceIdx;
- private String timeStamp;
- private String logText;
-
- /**
- * Create Log entry for NE/Interfaceproblems during PM execution
- * @param mountpoint Name of
- * @param interfaceIdx Name of
- * @param timeStamp Time and date of occurence
- * @param logText to write
- */
- public EsHistoricalPerformanceLogEntry(String mountpoint, String interfaceIdx, String timeStamp, String logText) {
- super();
- this.mountpoint = mountpoint;
- this.interfaceIdx = interfaceIdx;
- this.timeStamp = timeStamp;
- this.logText = logText;
- }
-
- /**
- * For jackson purpose
- */
- EsHistoricalPerformanceLogEntry() {
- }
-
- /**
- * @return the mountpoint
- */
- public String getMountpoint() {
- return mountpoint;
- }
-
- /**
- * @return the interfaceIdx
- */
- public String getInterfaceIdx() {
- return interfaceIdx;
- }
-
- /**
- * @return the timeStamp
- */
- public String getTimeStamp() {
- return timeStamp;
- }
-
- /**
- * @return the logText
- */
- public String getLogText() {
- return logText;
- }
-
-
-
- public static String getEsdatatypename() {
- return ESDATATYPENAME;
- }
-
- }
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsPerformanceData.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsPerformanceData.java
deleted file mode 100644
index d55311164..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/types/EsPerformanceData.java
+++ /dev/null
@@ -1,444 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types;
-
-import com.fasterxml.jackson.annotation.JsonGetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ExtendedAirInterfaceHistoricalPerformanceType12;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ExtendedAirInterfaceHistoricalPerformanceType1211;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ExtendedAirInterfaceHistoricalPerformanceType1211p;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfacePerformanceTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerHistoricalPerformanceTypeG;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerPerformanceTypeG;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class EsPerformanceData {
-
- @JsonIgnore
- private static final Logger LOG = LoggerFactory.getLogger(EsPerformanceData.class);
-
- @JsonIgnore
- private AirInterfacePerformanceTypeG dataAirInterface12 = null;
- @JsonIgnore
- private ContainerPerformanceTypeG dataEthContainer12 = null;
-
- @JsonIgnore
- private org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfacePerformanceTypeG dataAirInterface1211 = null;
- @JsonIgnore
- private org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerPerformanceTypeG dataEthContainer1211 = null;
-
- @JsonIgnore
- private org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfacePerformanceTypeG dataAirInterface1211p = null;
- @JsonIgnore
- private org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerPerformanceTypeG dataEthContainer1211p = null;
-
- public <T extends OtnHistoryDataG> EsPerformanceData(T otnHistoryData) {
-
- if (otnHistoryData instanceof AirInterfaceHistoricalPerformanceTypeG) {
- this.dataAirInterface12 = ((AirInterfaceHistoricalPerformanceTypeG) otnHistoryData).getPerformanceData();
- } else if (otnHistoryData instanceof ContainerHistoricalPerformanceTypeG) {
- this.dataEthContainer12 = ((ContainerHistoricalPerformanceTypeG) otnHistoryData).getPerformanceData();
- } else if (otnHistoryData instanceof ExtendedAirInterfaceHistoricalPerformanceType12) {
- this.dataAirInterface12 = ((ExtendedAirInterfaceHistoricalPerformanceType12) otnHistoryData)
- .getAirInterfaceHistoricalPerformanceType().getPerformanceData();
- } else if (otnHistoryData instanceof org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceHistoricalPerformanceTypeG) {
- this.dataAirInterface1211 = ((org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceHistoricalPerformanceTypeG) otnHistoryData)
- .getPerformanceData();
- } else if (otnHistoryData instanceof org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerHistoricalPerformanceTypeG) {
- this.dataEthContainer1211 = ((org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerHistoricalPerformanceTypeG) otnHistoryData)
- .getPerformanceData();
- } else if (otnHistoryData instanceof ExtendedAirInterfaceHistoricalPerformanceType1211) {
- this.dataAirInterface1211 = ((ExtendedAirInterfaceHistoricalPerformanceType1211) otnHistoryData)
- .getAirInterfaceHistoricalPerformanceType().getPerformanceData();
- } else if (otnHistoryData instanceof org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceHistoricalPerformanceTypeG) {
- this.dataAirInterface1211p = ((org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceHistoricalPerformanceTypeG) otnHistoryData)
- .getPerformanceData();
- } else if (otnHistoryData instanceof org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerHistoricalPerformanceTypeG) {
- this.dataEthContainer1211p = ((org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ContainerHistoricalPerformanceTypeG) otnHistoryData)
- .getPerformanceData();
- } else if (otnHistoryData instanceof ExtendedAirInterfaceHistoricalPerformanceType1211p) {
- this.dataAirInterface1211p = ((ExtendedAirInterfaceHistoricalPerformanceType1211p) otnHistoryData)
- .getAirInterfaceHistoricalPerformanceType().getPerformanceData();
- } else {
- LOG.warn("Can not assign historical performance type {}", otnHistoryData.getClass().getName());
- }
- }
-
- @JsonGetter("es")
- public java.lang.Integer getEs() {
- return dataAirInterface12 != null ? dataAirInterface12.getEs()
- : dataAirInterface1211 != null ? dataAirInterface1211.getEs()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getEs() : null;
- }
-
- @JsonGetter("ses")
- java.lang.Integer getSes() {
- return dataAirInterface12 != null ? dataAirInterface12.getSes()
- : dataAirInterface1211 != null ? dataAirInterface1211.getSes()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getSes() : null;
- }
-
- @JsonGetter("cses")
- java.lang.Integer getCses() {
- return dataAirInterface12 != null ? dataAirInterface12.getCses()
- : dataAirInterface1211 != null ? dataAirInterface1211.getCses()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getCses() : null;
- }
-
- @JsonGetter("unavailability")
- java.lang.Integer getUnavailability() {
- return dataAirInterface12 != null ? dataAirInterface12.getUnavailability()
- : dataAirInterface1211 != null ? dataAirInterface1211.getUnavailability()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getUnavailability() : null;
- }
-
- @JsonGetter("tx-level-min")
- java.lang.Byte getTxLevelMin() {
- return dataAirInterface12 != null ? dataAirInterface12.getTxLevelMin()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTxLevelMin()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTxLevelMin() : null;
- }
-
- @JsonGetter("tx-level-max")
- java.lang.Byte getTxLevelMax() {
- return dataAirInterface12 != null ? dataAirInterface12.getTxLevelMax()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTxLevelMax()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTxLevelMax() : null;
- }
-
- @JsonGetter("tx-level-avg")
- java.lang.Byte getTxLevelAvg() {
- return dataAirInterface12 != null ? dataAirInterface12.getTxLevelAvg()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTxLevelAvg()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTxLevelAvg() : null;
- }
-
- @JsonGetter("rx-level-min")
- java.lang.Byte getRxLevelMin() {
- return dataAirInterface12 != null ? dataAirInterface12.getRxLevelMin()
- : dataAirInterface1211 != null ? dataAirInterface1211.getRxLevelMin()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getRxLevelMin() : null;
- }
-
- @JsonGetter("rx-level-max")
- java.lang.Byte getRxLevelMax() {
- return dataAirInterface12 != null ? dataAirInterface12.getRxLevelMax()
- : dataAirInterface1211 != null ? dataAirInterface1211.getRxLevelMax()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getRxLevelMax() : null;
- }
-
- @JsonGetter("rx-level-avg")
- java.lang.Byte getRxLevelAvg() {
- return dataAirInterface12 != null ? dataAirInterface12.getRxLevelAvg()
- : dataAirInterface1211 != null ? dataAirInterface1211.getRxLevelAvg()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getRxLevelAvg() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time2-states")
- java.lang.Integer getTime2States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime2States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime2States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime2States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time4-states-s")
- java.lang.Integer getTime4StatesS() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime4StatesS()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime4StatesS()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime4StatesS() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time4-states")
- java.lang.Integer getTime4States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime4States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime4States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime4States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time8-states")
- java.lang.Integer getTime8States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime8States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime8States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime8States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time16-states-s")
- java.lang.Integer getTime16StatesS() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime16StatesS()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime16StatesS()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime16StatesS() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time16-states")
- java.lang.Integer getTime16States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime16States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime16States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime16States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time32-states")
- java.lang.Integer getTime32States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime32States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime32States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime32States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time64-states")
- java.lang.Integer getTime64States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime64States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime64States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime64States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time128-states")
- java.lang.Integer getTime128States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime128States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime128States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime128States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time256-states")
- java.lang.Integer getTime256States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime256States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime256States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime256States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time512-states")
- java.lang.Integer getTime512States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime512States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime512States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime512States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time512-states-l")
- java.lang.Integer getTime512StatesL() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime512StatesL()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime512StatesL()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime512StatesL() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time1024-states")
- java.lang.Integer getTime1024States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime1024States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime1024States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime1024States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time1024-states-l")
- java.lang.Integer getTime1024StatesL() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime1024StatesL()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime1024StatesL()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime1024StatesL() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time2048-states")
- java.lang.Integer getTime2048States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime2048States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime2048States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime2048States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time2048-states-l")
- java.lang.Integer getTime2048StatesL() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime2048StatesL()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime2048StatesL()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime2048StatesL() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time4096-states")
- java.lang.Integer getTime4096States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime4096States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime4096States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime4096States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time4096-states-l")
- java.lang.Integer getTime4096StatesL() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime4096StatesL()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime4096StatesL()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime4096StatesL() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time8192-states")
- java.lang.Integer getTime8192States() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime8192States()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime8192States()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTime8192States() : null;
- }
-
- @SuppressWarnings("deprecation")
- @JsonGetter("time8192-states-l")
- java.lang.Integer getTime8192StatesL() {
- return dataAirInterface12 != null ? dataAirInterface12.getTime8192StatesL()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTime8192StatesL()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getEs() : null;
- }
-
- @JsonGetter("snir-min")
- java.lang.Byte getSnirMin() {
- return dataAirInterface12 != null ? dataAirInterface12.getSnirMin()
- : dataAirInterface1211 != null ? dataAirInterface1211.getSnirMin()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getSnirMin() : null;
- }
-
- @JsonGetter("snir-max")
- java.lang.Byte getSnirMax() {
- return dataAirInterface12 != null ? dataAirInterface12.getSnirMax()
- : dataAirInterface1211 != null ? dataAirInterface1211.getSnirMax()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getSnirMax() : null;
- }
-
- @JsonGetter("snir-avg")
- java.lang.Byte getSnirAvg() {
- return dataAirInterface12 != null ? dataAirInterface12.getSnirAvg()
- : dataAirInterface1211 != null ? dataAirInterface1211.getSnirAvg()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getSnirAvg() : null;
- }
-
- @JsonGetter("xpd-min")
- java.lang.Byte getXpdMin() {
- return dataAirInterface12 != null ? dataAirInterface12.getXpdMin()
- : dataAirInterface1211 != null ? dataAirInterface1211.getXpdMin()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getXpdMin() : null;
- }
-
- @JsonGetter("xpd-max")
- java.lang.Byte getXpdMax() {
- return dataAirInterface12 != null ? dataAirInterface12.getXpdMax()
- : dataAirInterface1211 != null ? dataAirInterface1211.getXpdMax()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getXpdMax() : null;
- }
-
- @JsonGetter("xpd-avg")
- java.lang.Byte getXpdAvg() {
- return dataAirInterface12 != null ? dataAirInterface12.getXpdAvg()
- : dataAirInterface1211 != null ? dataAirInterface1211.getXpdAvg()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getXpdAvg() : null;
- }
-
- @JsonGetter("rf-temp-min")
- java.lang.Byte getRfTempMin() {
- return dataAirInterface12 != null ? dataAirInterface12.getRfTempMin()
- : dataAirInterface1211 != null ? dataAirInterface1211.getRfTempMin()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getRfTempMin() : null;
- }
-
- @JsonGetter("rf-temp-max")
- java.lang.Byte getRfTempMax() {
- return dataAirInterface12 != null ? dataAirInterface12.getRfTempMax()
- : dataAirInterface1211 != null ? dataAirInterface1211.getRfTempMax()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getRfTempMax() : null;
- }
-
- @JsonGetter("rf-temp-avg")
- java.lang.Byte getRfTempAvg() {
- return dataAirInterface12 != null ? dataAirInterface12.getRfTempAvg()
- : dataAirInterface1211 != null ? dataAirInterface1211.getRfTempAvg()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getRfTempAvg() : null;
- }
-
- @JsonGetter("defect-blocks-sum")
- java.lang.Short getDefectBlocksSum() {
- return dataAirInterface12 != null ? dataAirInterface12.getDefectBlocksSum()
- : dataAirInterface1211 != null ? dataAirInterface1211.getDefectBlocksSum()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getDefectBlocksSum() : null;
- }
-
- @JsonGetter("time-period")
- java.lang.Integer getTimePeriod() {
- return dataAirInterface12 != null ? dataAirInterface12.getTimePeriod()
- : dataEthContainer12 != null ? dataEthContainer12.getTimePeriod()
- : dataAirInterface1211 != null ? dataAirInterface1211.getTimePeriod()
- : dataEthContainer1211 != null ? dataEthContainer1211.getTimePeriod()
- : dataAirInterface1211p != null ? dataAirInterface1211p.getTimePeriod()
- : dataEthContainer1211p != null ? dataEthContainer1211p.getTimePeriod()
- : null;
- }
-
- @JsonGetter("tx-ethernet-bytes-max-s")
- java.lang.Integer getTxEthernetBytesMaxS() {
- return dataEthContainer12 != null ? dataEthContainer12.getTxEthernetBytesMaxS()
- : dataEthContainer1211 != null ? dataEthContainer1211.getTxEthernetBytesMaxS()
- : dataEthContainer1211p != null ? dataEthContainer1211p.getTxEthernetBytesMaxS() : null;
- }
-
- @JsonGetter("tx-ethernet-bytes-max-m")
- java.lang.Long getTxEthernetBytesMaxM() {
- return dataEthContainer12 != null ? dataEthContainer12.getTxEthernetBytesMaxM()
- : dataEthContainer1211 != null ? dataEthContainer1211.getTxEthernetBytesMaxM()
- : dataEthContainer1211p != null ? dataEthContainer1211p.getTxEthernetBytesMaxM() : null;
- }
-
- @JsonGetter("tx-ethernet-bytes-sum")
- public java.lang.Long getTxEthernetBytesSum() {
- return dataEthContainer12 != null ? dataEthContainer12.getTxEthernetBytesSum()
- : dataEthContainer1211 != null ? dataEthContainer1211.getTxEthernetBytesSum()
- : dataEthContainer1211p != null ? dataEthContainer1211p.getTxEthernetBytesSum() : null;
- }
-
- @Override
- public String toString() {
- return "EsPerformanceData [getEs()=" + getEs() + ", getSes()=" + getSes() + ", getCses()=" + getCses()
- + ", getUnavailability()=" + getUnavailability() + ", getTxLevelMin()=" + getTxLevelMin()
- + ", getTxLevelMax()=" + getTxLevelMax() + ", getTxLevelAvg()=" + getTxLevelAvg() + ", getRxLevelMin()="
- + getRxLevelMin() + ", getRxLevelMax()=" + getRxLevelMax() + ", getRxLevelAvg()=" + getRxLevelAvg()
- + ", getTime2States()=" + getTime2States() + ", getTime4StatesS()=" + getTime4StatesS()
- + ", getTime4States()=" + getTime4States() + ", getTime8States()=" + getTime8States()
- + ", getTime16StatesS()=" + getTime16StatesS() + ", getTime16States()=" + getTime16States()
- + ", getTime32States()=" + getTime32States() + ", getTime64States()=" + getTime64States()
- + ", getTime128States()=" + getTime128States() + ", getTime256States()=" + getTime256States()
- + ", getTime512States()=" + getTime512States() + ", getTime512StatesL()=" + getTime512StatesL()
- + ", getTime1024States()=" + getTime1024States() + ", getTime1024StatesL()=" + getTime1024StatesL()
- + ", getTime2048States()=" + getTime2048States() + ", getTime2048StatesL()=" + getTime2048StatesL()
- + ", getTime4096States()=" + getTime4096States() + ", getTime4096StatesL()=" + getTime4096StatesL()
- + ", getTime8192States()=" + getTime8192States() + ", getTime8192StatesL()=" + getTime8192StatesL()
- + ", getSnirMin()=" + getSnirMin() + ", getSnirMax()=" + getSnirMax() + ", getSnirAvg()=" + getSnirAvg()
- + ", getXpdMin()=" + getXpdMin() + ", getXpdMax()=" + getXpdMax() + ", getXpdAvg()=" + getXpdAvg()
- + ", getRfTempMin()=" + getRfTempMin() + ", getRfTempMax()=" + getRfTempMax() + ", getRfTempAvg()="
- + getRfTempAvg() + ", getDefectBlocksSum()=" + getDefectBlocksSum() + ", getTimePeriod()="
- + getTimePeriod() + ", getTxEthernetBytesMaxS()=" + getTxEthernetBytesMaxS()
- + ", getTxEthernetBytesMaxM()=" + getTxEthernetBytesMaxM() + ", getTxEthernetBytesSum()="
- + getTxEthernetBytesSum() + "]";
- }
-
-}