aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager/provider/src/main/java
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-04-19 12:46:16 +0200
committerMichael DÜrre <michael.duerre@highstreet-technologies.com>2021-04-20 08:01:27 +0200
commit05fe114a5969727c32cd9f1051cd7b9fde0344d5 (patch)
tree4cb505cd98ddb5b9c6f188f9febe93b07cf743db /sdnr/wt/devicemanager/provider/src/main/java
parent6ae7e8a1bae83d407b22d8b066dd0bcca730e1bb (diff)
Reorganization of devicemanager directory structure
Organized into core, onap and o-ran-sc directories Issue-ID: CCSDK-3242 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: I3c23710f990a2d96ba01104c97315fc8c6b1921b Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager/provider/src/main/java')
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiProviderClient.java164
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiWebApiClient.java158
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/URLParamEncoder.java46
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/config/AaiClientPropertiesFile.java91
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/config/AaiConfig.java281
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.java162
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderImpl.java81
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderInternal.java40
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeMessages.java353
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderClient.java84
-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.java84
-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/dcaeconnector/impl/config/DcaeConfig.java83
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/Checker.java50
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitor.java59
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorEmptyImpl.java42
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java289
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorProblems.java68
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorTask.java322
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/config/DmConfig.java66
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java216
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java359
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java108
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java259
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/HouseKeepingConfig.java63
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ResyncNetworkElementHouskeepingService.java170
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ResyncNetworkElementsListener.java36
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java239
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java429
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfConnectHandler.java187
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfNotConnectHandler.java146
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/NetconfNodeService.java38
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ProviderClient.java42
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/PushNotifications.java30
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalDateAndTime.java104
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalSeverity.java227
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java93
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NotificationProxyParserImpl.java343
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/OdlClusterSingleton.java72
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/FaultEntityManager.java94
-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.java88
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ProblemNotificationXml.java161
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.java59
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.java37
-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/impl/MaintenanceCalculator.java149
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.java170
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerImpl.java83
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerTask.java250
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/config/PmConfig.java54
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/DevicemanagerNotificationDelayService.java34
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayFilter.java181
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayService.java71
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayedListener.java25
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationWithServerTimeStamp.java78
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/ToggleAlarmFilterable.java33
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/conf/ToggleAlarmConfig.java60
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorServiceImpl.java207
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/config/VESCollectorCfgImpl.java138
62 files changed, 0 insertions, 8044 deletions
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 193b96a44..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiProviderClient.java
+++ /dev/null
@@ -1,164 +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 java.util.Optional;
-import javax.annotation.Nonnull;
-import org.onap.ccsdk.features.sdnr.wt.common.HtAssert;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPResponse;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl.config.AaiConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.InventoryProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.AaiService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InventoryInformationDcae;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AaiProviderClient implements AaiService, AutoCloseable {
-
- private static Logger LOG = LoggerFactory.getLogger(AaiProviderClient.class);
- @SuppressWarnings("unused") // @TODO Remove code
- private static boolean reloadConfigFlag;
- private static final IConfigChangedListener configChangedListener = () -> reloadConfigFlag = true;
-
- private final AaiConfig config;
- private final DeviceManagerImpl deviceManager;
- private final ConfigurationFileRepresentation htconfig;
-
-
- public AaiProviderClient(@Nonnull ConfigurationFileRepresentation cfg, DeviceManagerImpl devMgr) {
- HtAssert.nonnull(cfg);
- this.config = new AaiConfig(cfg);
- LOG.debug("AaiProviderClient configuration setting: {}", this.config);
- this.htconfig = cfg;
- this.htconfig.registerConfigChangedListener(configChangedListener);
- this.deviceManager = devMgr;
-
- }
-
- public AaiConfig getConfig() {
- return this.config;
- }
-
- public void onDeviceRegistered(String mountPointName) {
- if (this.config.isOff()) {
- return;
- }
- NetworkElement ne =
- this.deviceManager != null ? this.deviceManager.getConnectedNeByMountpoint(mountPointName) : null;
- Optional<InventoryProvider> oip = ne != null ? ne.getService(InventoryProvider.class) : Optional.empty();
- this.onDeviceRegistered(mountPointName,
- oip.isPresent() ? oip.get().getInventoryInformation("MWPS") : InventoryInformationDcae.getDefault());
- }
-
- public void onDeviceRegistered(String mountPointName, InventoryInformationDcae i) {
- 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) {
- 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 5a366a839..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/AaiWebApiClient.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.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.common.http.BaseHTTPClient;
-import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AaiWebApiClient extends BaseHTTPClient {
-
- private static Logger LOG = LoggerFactory.getLogger(AaiWebApiClient.class);
- // @formatter:off
- 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"
- + " }\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" + "";
- // @formatter:on
- 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 71d748b50..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/URLParamEncoder.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.aaiconnector.impl;
-
-class URLParamEncoder {
-
- public static String encode(String input) {
- StringBuilder resultStr = new StringBuilder();
- for (char ch : input.toCharArray()) {
- if (isUnsafe(ch)) {
- resultStr.append('%');
- resultStr.append(toHex(ch / 16));
- resultStr.append(toHex(ch % 16));
- } else {
- resultStr.append(ch);
- }
- }
- return resultStr.toString();
- }
-
- private static char toHex(int ch) {
- return (char) (ch < 10 ? '0' + ch : 'A' + ch - 10);
- }
-
- private static boolean isUnsafe(char ch) {
- if (ch > 128 || ch < 0) {
- return true;
- }
- return " %$&+,/:;=?@<>#%".indexOf(ch) >= 0;
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/config/AaiClientPropertiesFile.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/config/AaiClientPropertiesFile.java
deleted file mode 100644
index 8329ec0e9..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/config/AaiClientPropertiesFile.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.aaiconnector.impl.config;
-
-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/aaiconnector/impl/config/AaiConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/config/AaiConfig.java
deleted file mode 100644
index e590d7faf..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/config/AaiConfig.java
+++ /dev/null
@@ -1,281 +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.config;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Base64;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Optional;
-import java.util.Properties;
-import org.json.JSONArray;
-import org.onap.ccsdk.features.sdnr.wt.common.HtAssert;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AaiConfig implements Configuration {
-
- private static Logger LOG = LoggerFactory.getLogger(AaiConfig.class);
-
- private static final String SECTION_MARKER_AAI = "aai";
-
- private enum Config {
- // @formatter:off
- AAIPROP_FILE("aaiPropertiesFile", "null"),
- BASEURL("aaiUrl", "off", "org.onap.ccsdk.sli.adaptors.aai.uri"),
- USERCREDENTIALS("aaiUserCredentials", ""),
- HEADERS("aaiHeaders", "[\"X-TransactionId: 9999\"]"),
- DELETEONMOUNTPOINTREMOVED("aaiDeleteOnMountpointRemove", false),
- TRUSTALLCERTS("aaiTrustAllCerts", false, "org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore"),
- APIVERSION("aaiApiVersion", "aai/v13"),
- PCKS12CERTFILENAME("aaiPcks12ClientCertFile", "", "org.onap.ccsdk.sli.adaptors.aai.ssl.key"),
- PCKS12PASSPHRASE("aaiPcks12ClientCertPassphrase", "", "org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd"),
- CONNECTIONTIMEOUT("aaiClientConnectionTimeout",
- String.valueOf(DEFAULT_VALUE_CONNECTION_TIMEOUT), "connection.timeout"), //in ms;
- APPLICATIONID("aaiApplicationId", "SDNR", "org.onap.ccsdk.sli.adaptors.aai.application"),
- HTTPREADTIMEOUT("aaiReadTimeout", "60000", "read.timeout");
- // @formatter:on
-
- private String propertyKey;
- private String propertyValue;
- private Optional<String> propertyKeySecondFile;
-
- Config(String propertyKey, Object propertyValue) {
- this.propertyKey = propertyKey;
- this.propertyValue = propertyValue.toString();
- this.propertyKeySecondFile = Optional.empty();
- }
-
- Config(String propertyKey, Object propertyValue, String propertyKeySecondFile) {
- this(propertyKey, propertyValue);
- this.propertyKeySecondFile = Optional.of(propertyKeySecondFile);
- }
- }
-
- private static final long DEFAULT_VALUE_CONNECTION_TIMEOUT = 30000; //in ms
- private static final String HEADER_KEY_APPLICATION = "X-FromAppId";
-
- private final ConfigurationFileRepresentation configuration;
-
- public AaiConfig(ConfigurationFileRepresentation configuration) {
- HtAssert.nonnull(configuration);
- this.configuration = configuration;
- this.configuration.addSection(SECTION_MARKER_AAI);
- defaults();
- }
-
- /*
- * Getter
- */
-
- public boolean doDeleteOnMountPointRemoved() {
- return configuration.getPropertyBoolean(SECTION_MARKER_AAI, Config.DELETEONMOUNTPOINTREMOVED.propertyKey);
- }
-
- public boolean getTrustAll() {
- return configuration.getPropertyBoolean(SECTION_MARKER_AAI, Config.TRUSTALLCERTS.propertyKey);
- }
-
- public String getPcks12CertificateFilename() {
- return configuration.getProperty(SECTION_MARKER_AAI, Config.PCKS12CERTFILENAME.propertyKey);
- }
-
- public String getPcks12CertificatePassphrase() {
- return configuration.getProperty(SECTION_MARKER_AAI, Config.PCKS12PASSPHRASE.propertyKey);
- }
-
- public int getConnectionTimeout() {
- long res = configuration.getPropertyLong(SECTION_MARKER_AAI, Config.CONNECTIONTIMEOUT.propertyKey)
- .orElse(DEFAULT_VALUE_CONNECTION_TIMEOUT);
- return (int) res;
- }
-
- public boolean isOff() {
- return configuration.getProperty(SECTION_MARKER_AAI, Config.BASEURL.propertyKey).equalsIgnoreCase("off");
- }
-
- public String getBaseUri() {
- String res = configuration.getProperty(SECTION_MARKER_AAI, Config.APIVERSION.propertyKey);
- if (!res.startsWith("/")) {
- res = "/" + res;
- }
- return res;
- }
-
- public String getBaseUrl() {
- if (isOff()) {
- return "";
- }
-
- String url = configuration.getProperty(SECTION_MARKER_AAI, Config.BASEURL.propertyKey);
- if (!url.endsWith("/")) {
- url += "/";
- }
- String apiVersion = configuration.getProperty(SECTION_MARKER_AAI, Config.APIVERSION.propertyKey);
- if (apiVersion.startsWith("/")) {
- apiVersion = apiVersion.substring(1);
- }
- return url + apiVersion;
-
- }
-
- public Map<String, String> getHeaders() {
-
- Map<String, String> headers =
- _parseHeadersMap(configuration.getProperty(SECTION_MARKER_AAI, Config.HEADERS.propertyKey));
- headers.put(HEADER_KEY_APPLICATION,
- configuration.getProperty(SECTION_MARKER_AAI, Config.APPLICATIONID.propertyKey));
-
- String credentials = configuration.getProperty(SECTION_MARKER_AAI, Config.USERCREDENTIALS.propertyKey);
- if (!nullorempty(credentials)) {
- String credentialParts[] = credentials.split(":");
- if (credentialParts.length == 2) {
- // 0:username 1:password
- String s = headers.getOrDefault("Authorization", null);
- if (nullorempty(s) && !nullorempty(credentialParts[0]) && !nullorempty(credentialParts[1])) {
- headers.put("Authorization",
- "Basic " + new String(Base64.getEncoder().encode(credentials.getBytes())));
- }
- }
- }
- return headers;
- }
-
- @Override
- public String getSectionName() {
- return SECTION_MARKER_AAI;
- }
-
- @Override
- public void defaults() {
- for (Config conf : Config.values()) {
- configuration.setPropertyIfNotAvailable(SECTION_MARKER_AAI, conf.propertyKey, conf.propertyValue);
- }
- // If file is available, the content is assigned to related parameters.
- getAaiPropertiesFile();
- }
-
- @Override
- public String toString() {
- return "AaiConfig [doDeleteOnMountPointRemoved()=" + doDeleteOnMountPointRemoved() + ", getTrustAll()="
- + getTrustAll() + ", getPcks12CertificateFilename()=" + getPcks12CertificateFilename()
- + ", getPcks12CertificatePassphrase()=" + getPcks12CertificatePassphrase() + ", getConnectionTimeout()="
- + getConnectionTimeout() + ", isOff()=" + isOff() + ", getBaseUri()=" + getBaseUri() + ", getBaseUrl()="
- + getBaseUrl() + ", getHeaders()=" + getHeaders() + ", getSectionName()=" + getSectionName() + "]";
- }
-
- /*
- * Private
- */
-
- private boolean nullorempty(String s) {
- return s == null || s.isEmpty();
- }
-
- /**
- * Convert headers to configuration string.
- *
- * @param headers
- * @return
- */
- @SuppressWarnings("unused")
- 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) {
-
- LOG.info("Parse: '{}'", s);
- Map<String, String> r = new HashMap<>();
- if (s != null) {
- s = s.trim();
- if (!s.isEmpty()) {
- JSONArray a;
- try {
- a = new JSONArray(s);
- if (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]);
- }
- }
- }
- } catch (Exception e) {
- LOG.debug("Unparsable '{}'", s);
- }
- }
- }
- return r;
- }
-
- /**
- * Read file if available and assign to configuration
- */
- private void getAaiPropertiesFile() {
- String aaiPropertiesFileName = configuration.getProperty(SECTION_MARKER_AAI, Config.AAIPROP_FILE.propertyKey);
- File f = new File(aaiPropertiesFileName);
- if (f.exists()) {
- InputStream in = null;
- try {
- in = new FileInputStream(f);
- Properties defaultProps = new Properties();
- defaultProps.load(in);
-
- for (Config conf : Config.values()) {
- if (conf.propertyKeySecondFile.isPresent()) {
- String config = defaultProps.getProperty(conf.propertyKeySecondFile.get(), conf.propertyValue);
- LOG.debug("Property file assign {} = {} ", conf.propertyKey, config);
- configuration.setProperty(SECTION_MARKER_AAI, conf.propertyKey, config);
- }
- }
-
- } catch (IOException e) {
- LOG.warn("Problem during file read {} {}", f.getAbsoluteFile(), e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- LOG.warn("problem closing file string for {}: {}", f.getAbsoluteFile(), e);
- }
- }
- }
- }
- }
-
-}
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 e15a577b7..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/archiveservice/ArchiveCleanService.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.archiveservice;
-
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-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.eclipse.jdt.annotation.NonNull;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.ArchiveCleanProvider;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.IEsConfig;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
-import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-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 Runnable doClean;
-
- private final IEsConfig esConfig;
- private Future<?> taskReference;
- private boolean isMaster;
- private final ClusterSingletonServiceRegistration cssRegistration;
-
- public ArchiveCleanService(IEsConfig config, ClusterSingletonServiceProvider clusterSingletonServiceProvider,
- ArchiveCleanProvider... indexCleanList) {
-
- this.esConfig = config;
- this.esConfig.registerConfigChangedListener(this);
-
- this.indexCleanList = indexCleanList;
- this.doClean = this;
- this.taskReference = null;
-
- this.reinit();
-
- this.cssRegistration = clusterSingletonServiceProvider.registerClusterSingletonService(this);
-
- }
-
- private void reinit() {
-
- if (taskReference != null) {
- taskReference.cancel(false);
- }
- if (this.isMaster) {
- if (this.esConfig.getArchiveCheckIntervalSeconds() > 0) {
- LOG.info("DBCleanService is turned on for entries older than {} seconds",
- this.esConfig.getArchiveLifetimeSeconds());
- taskReference = this.scheduler.scheduleAtFixedRate(doClean, 0,
- this.esConfig.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() - esConfig.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.info("Not yet implemented. config changed. reninit timer");
- };
-
- @Override
- public void close() throws Exception {
- this.esConfig.unregisterConfigChangedListener(this);
- this.scheduler.shutdown();
- if (this.cssRegistration != null)
- this.cssRegistration.close();
- }
-
- @Override
- public String toString() {
- return "ArchivCleanService [ArchiveCheckIntervalSeconds=" + esConfig.getArchiveCheckIntervalSeconds()
- + "ArchiveLifetimeSeconds=" + esConfig.getArchiveLifetimeSeconds() + "]";
- }
-
- @Override
- public @NonNull 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/dcaeconnector/impl/DcaeForwarderImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderImpl.java
deleted file mode 100644
index 8e091bef5..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderImpl.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.dcaeconnector.impl;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.common.HtAssert;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.ProviderClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.MaintenanceService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DcaeForwarderImpl implements DcaeForwarderInternal, AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(DcaeForwarderImpl.class);
-
- private final @Nullable ProviderClient aotsmClient;
- private final ProviderClient dcaeProvider;
- private final MaintenanceService maintenanceService;
-
- public DcaeForwarderImpl(@Nullable ProviderClient aotsmClient, @Nullable ProviderClient dcaeProvider,
- @NonNull MaintenanceService maintenanceService) {
- super();
-
- HtAssert.nonnull(maintenanceService);
- this.aotsmClient = aotsmClient;
- this.dcaeProvider = dcaeProvider;
- this.maintenanceService = maintenanceService;
- }
-
- @Override
- @SuppressWarnings("null")
- public void sendProblemNotificationUsingMaintenanceFilter(String nodeId, ProblemNotificationXml notificationXml) {
- if (!this.maintenanceService.isONFObjectInMaintenance(nodeId, notificationXml.getObjectId(),
- notificationXml.getProblem())) {
- if (dcaeProvider != null) {
- this.dcaeProvider.sendProblemNotification(nodeId, notificationXml);
- }
- if (this.aotsmClient != null) {
- this.aotsmClient.sendProblemNotification(nodeId, notificationXml);
- }
- } else {
- LOG.debug(
- "Notification will not be sent to external services. Device " + nodeId + " is in maintenance mode");
- }
- }
-
- @Override
- public void sendProblemNotification(String nodeId, ProblemNotificationXml notificationXml) {
- //to prevent push alarms on reconnect
- //=> only pushed alarms are forwared to dcae
- if (dcaeProvider != null) {
- dcaeProvider.sendProblemNotification(nodeId, notificationXml);
- }
- if (aotsmClient != null) {
- aotsmClient.sendProblemNotification(nodeId, notificationXml);
- }
-
- }
-
- @Override
- public void close() throws Exception {}
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderInternal.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderInternal.java
deleted file mode 100644
index d86e0b451..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeForwarderInternal.java
+++ /dev/null
@@ -1,40 +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.impl.xml.ProblemNotificationXml;
-
-/**
- * @author herbert
- *
- */
-public interface DcaeForwarderInternal {
-
- /**
- * @param oWNKEYNAME
- * @param notificationXml
- */
- void sendProblemNotificationUsingMaintenanceFilter(String oWNKEYNAME, ProblemNotificationXml notificationXml);
-
- /**
- * @param nodeName
- * @param notificationXml
- */
- void sendProblemNotification(String nodeName, ProblemNotificationXml notificationXml);
-
-}
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 de62af08e..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeMessages.java
+++ /dev/null
@@ -1,353 +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 java.util.Optional;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.InventoryProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InventoryInformationDcae;
-import org.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 = NetconfTimeStampImpl.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();
- }
- // @formatter:off
- 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");
- // @formatter:on
-
- 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();
- }
-
- NetworkElement optionalNe =
- deviceManager != null ? deviceManager.getConnectedNeByMountpoint(mountpointName) : null;
- InventoryInformationDcae neInventory = InventoryInformationDcae.getDefault();
- if (optionalNe != null) {
- Optional<InventoryProvider> inventoryProvider = optionalNe.getService(InventoryProvider.class);
- if (inventoryProvider.isPresent()) {
- neInventory = inventoryProvider.get().getInventoryInformation();
- }
- }
-
- // @formatter:off
- 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");
- // @formatter:on
-
- 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 7ceafcb46..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderClient.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.dcaeconnector.impl;
-
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.config.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 ConfigurationFileRepresentation htConfig;
- private final IConfigChangedListener configChangedListener;
-
- private final Object lock = new Object();
- private DcaeProviderWorker worker;
- private DcaeConfig config;
-
- public DcaeProviderClient(ConfigurationFileRepresentation cfg, String entityName, DeviceManagerImpl deviceManager) {
- LOG.info("Create");
- this.htConfig = cfg;
- this.config = new DcaeConfig(cfg);
- worker = new DcaeProviderWorker(config, entityName, deviceManager);
- this.configChangedListener = () -> {
- LOG.info("Configuration change. Worker exchanged");
- synchronized (lock) {
- worker.close();
- worker = new DcaeProviderWorker(this.config, 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 18a36f7d6..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 1ef50c3e9..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/DcaeProviderWorker.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.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.dcaeconnector.impl.config.DcaeConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.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 cd7043e4c..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 e76db2cee..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.common.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/dcaeconnector/impl/config/DcaeConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/config/DcaeConfig.java
deleted file mode 100644
index 883c74399..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeconnector/impl/config/DcaeConfig.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.config;
-
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-
-public class DcaeConfig implements Configuration {
-
- private static final String SECTION_MARKER_DCAE = "dcae";
-
- private static final String PROPERTY_KEY_EVENTRECEIVERURL = "dcaeUrl";
- private static final String PROPERTY_KEY_USERCREDENTIALS = "dcaeUserCredentials";
- private static final String PROPERTY_KEY_TIMERPERIOD = "dcaeHeartbeatPeriodSeconds";
-
- private static final String DEFAULT_VALUE_EVENTRECEIVERURL = "off";
- private static final String DEFAULT_VALUE_USERCREDENTIALS = "admin:admin";
- private static final long DEFAULT_VALUE_TIMERPERIOD = 120;
-
- private final ConfigurationFileRepresentation configuration;
-
- public DcaeConfig(ConfigurationFileRepresentation configuration) {
- this.configuration = configuration;
- this.configuration.addSection(SECTION_MARKER_DCAE);
- defaults();
- }
-
- /* ***********************
- * Getter
- */
-
- public String getEventReveicerUrl() {
- return configuration.getProperty(SECTION_MARKER_DCAE, PROPERTY_KEY_EVENTRECEIVERURL);
- }
-
- public String getUserCredentials() {
- return configuration.getProperty(SECTION_MARKER_DCAE, PROPERTY_KEY_USERCREDENTIALS);
- }
-
- public Integer getTimerPeriodSeconds() {
- long res = configuration.getPropertyLong(SECTION_MARKER_DCAE, PROPERTY_KEY_TIMERPERIOD)
- .orElse(DEFAULT_VALUE_TIMERPERIOD);
- return (int) res;
- }
-
-
- @Override
- public String getSectionName() {
- return SECTION_MARKER_DCAE;
- }
-
- @Override
- public void defaults() {
- this.configuration.setPropertyIfNotAvailable(SECTION_MARKER_DCAE, PROPERTY_KEY_EVENTRECEIVERURL,
- DEFAULT_VALUE_EVENTRECEIVERURL);
- this.configuration.setPropertyIfNotAvailable(SECTION_MARKER_DCAE, PROPERTY_KEY_USERCREDENTIALS,
- DEFAULT_VALUE_USERCREDENTIALS);
- this.configuration.setPropertyIfNotAvailable(SECTION_MARKER_DCAE, PROPERTY_KEY_TIMERPERIOD,
- DEFAULT_VALUE_TIMERPERIOD);
- }
-
- @Override
- public String toString() {
- return "DcaeConfig [getEventReveicerUrl()=" + getEventReveicerUrl() + ", getUserCredentials()="
- + getUserCredentials() + ", getTimerPeriodSeconds()=" + getTimerPeriodSeconds() + ", getSectionName()="
- + getSectionName() + "]";
- }
-}
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 9d64a3b5a..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/Checker.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==========================================================================
- */
-/**
- * (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 c2c8b3d6b..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitor.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
- *
- * 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;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-
-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" or "connecting". For mountpoint creation or leaving connected
- * state. 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, NetworkElement 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 fbd8e0f40..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorEmptyImpl.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.devicemonitor.impl;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-
-public class DeviceMonitorEmptyImpl implements DeviceMonitor {
-
- @Override
- public void refreshAlarmsInDb() {}
-
- @Override
- public void removeMountpointIndication(String mountPointNodeName) {}
-
- @Override
- public void deviceConnectMasterIndication(String mountPointNodeName, NetworkElement 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 55e223c79..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java
+++ /dev/null
@@ -1,289 +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.Optional;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.config.DmConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.ODLEventListenerHandler;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.DeviceMonitoredNe;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
-import org.opendaylight.mdsal.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
- */
-
-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 ODLEventListenerHandler odlEventListener;
- @SuppressWarnings("unused")
- private final DataBroker dataBroker; //Future usage
- private final DmConfig dmConfig;
- private final DeviceMonitoredNe dummyNe;
-
- /*-------------------------------------------------------------
- * Construction/ destruction of service
- */
-
- /**
- * Basic implementation of devicemonitoring
- *
- * @param odlEventListener as destination for problems
- */
- public DeviceMonitorImpl(DataBroker dataBroker, ODLEventListenerHandler odlEventListener,
- ConfigurationFileRepresentation htconfig) {
- LOG.info("Construct {}", this.getClass().getSimpleName());
-
- this.odlEventListener = odlEventListener;
- this.dataBroker = dataBroker;
- this.dummyNe = getDummyNe();
-
- htconfig.registerConfigChangedListener(this);
- this.dmConfig = new DmConfig(htconfig);
- 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() {
- setDmConfig(dmConfig);
- }
-
- 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
- */
- @Override
- synchronized public void deviceConnectSlaveIndication(String mountPointNodeName) {
- deviceConnectMasterIndication(mountPointNodeName, (DeviceMonitoredNe) null);
- }
-
- @Override
- public void deviceConnectMasterIndication(String mountPointNodeName, NetworkElement networkElement) {
- Optional<DeviceMonitoredNe> monitoredNe = networkElement.getService(DeviceMonitoredNe.class);
- deviceConnectMasterIndication(mountPointNodeName, monitoredNe.isPresent() ? monitoredNe.get() : dummyNe);
- }
-
- /**
- * Notify of device state changes to "connected"
- *
- * @param mountPointNodeName name of mount point
- * @param ne to monitor
- */
- synchronized private void deviceConnectMasterIndication(String mountPointNodeName, @Nullable 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
- */
- @Override
- 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
- */
- @Override
- 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.
- */
- @Override
- public void refreshAlarmsInDb() {
- synchronized (queue) {
- for (DeviceMonitorTask task : queue.values()) {
- task.refreshAlarms();
- }
- }
- }
-
- /**
- * For test run the tasks
- */
- public void taskTestRun() {
- synchronized (queue) {
- for (DeviceMonitorTask task : queue.values()) {
- task.run();
- }
- }
- }
-
- /*-------------------------------------------------------------
- * 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;
- }
-
-
- private static DeviceMonitoredNe getDummyNe() {
- return new DeviceMonitoredNe() {
-
- @Override
- public void prepareCheck() {
- // Do nothing
- }
-
- @Override
- public boolean checkIfConnectionToMediatorIsOk() {
- return true;
- }
-
- @Override
- public boolean checkIfConnectionToNeIsOk() {
- return true;
- }
-
- @Override
- public Optional<NetconfAccessor> getAcessor() {
- return Optional.empty();
- }
- };
- }
-}
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 ecc62cfd2..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorProblems.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==========================================================================
- */
-/**
- * Problems generated by DeviceMonitor
- *
- * @author herbert
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.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);
- private InternalSeverity severity;
-
- DeviceMonitorProblems(@Nullable InternalSeverity severity) {
- if (severity != null) {
- this.severity = severity;
- }
- }
-
- public 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 ea5f7da87..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorTask.java
+++ /dev/null
@@ -1,322 +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 org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.ODLEventListenerHandler;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.DeviceMonitoredNe;
-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 = NetconfTimeStampImpl.getConverter();
-
- private final String mountPointName;
- private final ODLEventListenerHandler 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, ODLEventListenerHandler 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(@Nullable 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/config/DmConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/config/DmConfig.java
deleted file mode 100644
index 80e865990..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/config/DmConfig.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.config;
-
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitorProblems;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
-
-/**
- * Configuration of devicemonitor, section [devicemonitor] SeverityConnectionlossNeOAM=minor
- * SeverityConnectionlossOAM=major SeverityConnectionlossMediator=critical
- */
-public class DmConfig implements Configuration {
-
- private static final String SECTION_MARKER_TA = "devicemonitor";
-
- private static final String PROPERTY_KEY_PREFIX_Severity = "Severity";
-
- private final ConfigurationFileRepresentation configuration;
-
- public DmConfig(ConfigurationFileRepresentation configuration) {
- this.configuration = configuration;
- this.configuration.addSection(SECTION_MARKER_TA);
- defaults();
- }
-
- public InternalSeverity getSeverity(DeviceMonitorProblems problem) {
- String severityString = configuration.getProperty(SECTION_MARKER_TA, getPropertyName(problem));
- InternalSeverity result = InternalSeverity.valueOfString(severityString);
- return result != null ? result : InternalSeverity.Major;
- }
-
- @Override
- public String getSectionName() {
- return SECTION_MARKER_TA;
- }
-
- @Override
- public void defaults() {
- for (DeviceMonitorProblems problem : DeviceMonitorProblems.values()) {
- configuration.setPropertyIfNotAvailable(SECTION_MARKER_TA, getPropertyName(problem),
- problem.getSeverity().name());
- }
- }
-
- private String getPropertyName(DeviceMonitorProblems problem) {
- return PROPERTY_KEY_PREFIX_Severity + problem.name();
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java
deleted file mode 100644
index 830969a10..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java
+++ /dev/null
@@ -1,216 +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.eventdatahandler;
-
-import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.common.HtAssert;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeForwarderInternal;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientInternal;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.impl.MaintenanceServiceImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EquipmentService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.DevicemanagerNotificationDelayService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.NotificationDelayFilter;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.NotificationDelayedListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EquipmentData;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EventlogNotificationBuilder;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Faultcurrent;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultcurrentBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.AttributeValueChangedNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.AttributeValueChangedNotificationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectCreationNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectCreationNotificationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectDeletionNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectDeletionNotificationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ProblemNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ProblemNotificationBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DeviceManagerDatabaseNotificationService implements NotificationService, EquipmentService, FaultService,
- NotificationDelayedListener<ProblemNotificationXml> {
-
- private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerDatabaseNotificationService.class);
-
- private final @NonNull DataProvider databaseService;
- private final @NonNull WebSocketServiceClientInternal webSocketService;
- private @NonNull final DevicemanagerNotificationDelayService notificationDelayService;
- private @NonNull final DcaeForwarderInternal aotsDcaeForwarder;
-
- private final @NonNull MaintenanceServiceImpl maintenanceService;
-
- /**
- * @param databaseService to access database
- * @param maintenanceService
- * @param webSocketService to send notifications
- * @param notificationDelayService filter to prevent toggle alarms
- * @param aotsDcaeForwarder
- */
- public DeviceManagerDatabaseNotificationService(@NonNull DataProvider databaseService,
- @NonNull MaintenanceServiceImpl maintenanceService,
- @NonNull WebSocketServiceClientInternal webSocketService,
- @NonNull DevicemanagerNotificationDelayService notificationDelayService,
- @NonNull DcaeForwarderInternal aotsDcaeForwarder) {
- super();
- HtAssert.nonnull(databaseService, maintenanceService, webSocketService, notificationDelayService);
-
- this.databaseService = databaseService;
- this.maintenanceService = maintenanceService;
- this.webSocketService = webSocketService;
- this.notificationDelayService = notificationDelayService;
- this.aotsDcaeForwarder = aotsDcaeForwarder;
- }
-
- @Override
- public void eventNotification(@NonNull EventlogEntity eventNotification) {
- String nodeId = eventNotification.getNodeId();
- if (nodeId == null) {
- nodeId = "EmptyNodeId";
- }
- databaseService.writeEventLog(eventNotification);
- AttributeValueChangedNotification notification = new AttributeValueChangedNotificationBuilder()
- .setAttributeName(eventNotification.getAttributeName()).setCounter(eventNotification.getCounter())
- .setNewValue(eventNotification.getNewValue()).setObjectIdRef(eventNotification.getObjectId())
- .setTimeStamp(eventNotification.getTimestamp()).build();
- this.webSocketService.sendViaWebsockets(nodeId, notification, AttributeValueChangedNotification.QNAME,
- eventNotification.getTimestamp());
- }
-
- @Override
- public void changeNotification(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp,
- @Nullable String objectId, @Nullable String attributeName, @Nullable String newValue) {
- EventlogEntity eventlogEntity =
- new EventlogNotificationBuilder(nodeId, counter, timeStamp, objectId, attributeName, newValue).build();
- this.eventNotification(eventlogEntity);
- }
-
- @Override
- public void creationNotification(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp,
- @Nullable String objectId) {
- EventlogEntity eventlogEntity =
- new EventlogNotificationBuilder(nodeId, counter, timeStamp, objectId, "creation", null).build();
- databaseService.writeEventLog(eventlogEntity);
- ObjectCreationNotification notification = new ObjectCreationNotificationBuilder().setCounter(counter)
- .setObjectIdRef(objectId).setTimeStamp(eventlogEntity.getTimestamp()).build();
- this.webSocketService.sendViaWebsockets(nodeId.getValue(), notification, ObjectCreationNotification.QNAME,
- eventlogEntity.getTimestamp());
- }
-
-
- @Override
- public void deletionNotification(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp,
- @Nullable String objectId) {
- EventlogEntity eventlogEntity =
- new EventlogNotificationBuilder(nodeId, counter, timeStamp, objectId, "deletion", null).build();
- databaseService.writeEventLog(eventlogEntity);
- ObjectDeletionNotification notification = new ObjectDeletionNotificationBuilder().setCounter(counter)
- .setObjectIdRef(objectId).setTimeStamp(eventlogEntity.getTimestamp()).build();
- this.webSocketService.sendViaWebsockets(nodeId.getValue(), notification, ObjectDeletionNotification.QNAME,
- eventlogEntity.getTimestamp());
- }
-
- @Override
- public void writeEquipment(NodeId nodeId, @NonNull EquipmentData equipment) {
- HtAssert.nonnull(equipment);
- List<Inventory> list = equipment.getList();
- HtAssert.nonnull(list);
- databaseService.writeInventory(nodeId.getValue(), list);
-
- }
-
- @Override
- public void faultNotification(@NonNull FaultlogEntity faultNotification) {
- databaseService.writeFaultLog(faultNotification);
- databaseService.updateFaultCurrent(getFaultCurrent(faultNotification));
-
- ProblemNotificationXml notificationXml = new ProblemNotificationXml(faultNotification);
- String nodeName = faultNotification.getNodeId();
- if (NotificationDelayFilter.isEnabled()) {
- if (notificationXml.getSeverity() == InternalSeverity.NonAlarmed) {
- this.notificationDelayService.getInstance(nodeName, this).clearAlarmNotification(notificationXml);
- } else {
- this.notificationDelayService.getInstance(nodeName, this).pushAlarmNotification(notificationXml);
- }
- } else {
- this.pushAlarmIfNotInMaintenance(nodeName, notificationXml);
- }
- ProblemNotification notification = new ProblemNotificationBuilder().setCounter(faultNotification.getCounter())
- .setObjectIdRef(faultNotification.getObjectId()).setTimeStamp(faultNotification.getTimestamp())
- .setProblem(faultNotification.getProblem())
- .setSeverity(InternalSeverity.toYang(faultNotification.getSeverity())).build();
- this.webSocketService.sendViaWebsockets(faultNotification.getNodeId(), notification,
- ObjectDeletionNotification.QNAME, faultNotification.getTimestamp());
- }
-
- private void pushAlarmIfNotInMaintenance(String nodeName, ProblemNotificationXml notificationXml) {
- if (!this.maintenanceService.isONFObjectInMaintenance(nodeName, notificationXml.getObjectId(),
- notificationXml.getProblem())) {
- this.aotsDcaeForwarder.sendProblemNotification(nodeName, notificationXml);
- } else {
- LOG.debug("Notification will not be sent to external services. Device " + nodeName
- + " is in maintenance mode");
- }
- }
-
- @Override
- public int removeAllCurrentProblemsOfNode(@NonNull NodeId nodeId) {
- int deleted = databaseService.clearFaultsCurrentOfNode(nodeId.getValue());
- return deleted;
- }
-
- @Override
- public void initCurrentProblemStatus(@NonNull NodeId nodeId, FaultData resultList) {
- resultList.getProblemList().forEach(problem -> {
- FaultcurrentBuilder bFaultcurrent = new FaultcurrentBuilder();
- bFaultcurrent.fieldsFrom(problem);
- databaseService.updateFaultCurrent(bFaultcurrent.build());
- });
- }
-
- @Override
- public int removeObjectsCurrentProblemsOfNode(@NonNull NodeId nodeId, String objectId) {
- int deleted = databaseService.clearFaultsCurrentOfNodeWithObjectId(nodeId.getValue(), objectId);
- return deleted;
- }
-
- private Faultcurrent getFaultCurrent(@NonNull FaultlogEntity problem) {
- FaultcurrentBuilder bFaultcurrent = new FaultcurrentBuilder();
- bFaultcurrent.fieldsFrom(problem);
- return bFaultcurrent.build();
-
- }
-
- @Override
- public void onNotificationDelay(String nodeName, ProblemNotificationXml notification) {
- LOG.debug("Got delayed event of type :: {}", ProblemNotificationXml.class.getSimpleName());
- this.pushAlarmIfNotInMaintenance(nodeName, notification);
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java
deleted file mode 100644
index d031d25b6..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java
+++ /dev/null
@@ -1,359 +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.eventdatahandler;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeForwarderInternal;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.NetworkElementConnectionEntitiyUtil;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientInternal;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EventHandlingService;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionLogStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Connectionlog;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.AttributeValueChangedNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.AttributeValueChangedNotificationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectCreationNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectCreationNotificationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectDeletionNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectDeletionNotificationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ProblemNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ProblemNotificationBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * 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
- */
-
-@SuppressWarnings("deprecation")
-public class ODLEventListenerHandler implements EventHandlingService, AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(ODLEventListenerHandler.class);
-
- private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStampImpl.getConverter();
-
- /**
- * if update NE failed delay before retrying to write data into database
- */
- private static final long DBWRITE_RETRY_DELAY_MS = 3000;
-
- private final String ownKeyName;
- private final WebSocketServiceClientInternal webSocketService;
- private final DataProvider databaseService;
- private final DcaeForwarderInternal aotsDcaeForwarder;
- private final ExecutorService executor = Executors.newFixedThreadPool(5);
- 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 dcaeForwarder to deliver problems to external service
- */
- public ODLEventListenerHandler(String ownKeyName, WebSocketServiceClientInternal webSocketService,
- DataProvider databaseService, DcaeForwarderInternal dcaeForwarder) {
- super();
-
- this.ownKeyName = ownKeyName;
- this.webSocketService = webSocketService;
-
- this.databaseService = databaseService;
- this.aotsDcaeForwarder = dcaeForwarder;
-
- this.eventNumber = 0;
- }
-
- /*---------------------------------------------------------------
- * Handling of ODL Controller events
- */
-
- /**
- * (NonConnected) A registration after creation of a mountpoint occured
- *
- * @param registrationName of device (mountpoint name)
- * @param nNode with mountpoint data
- */
- @Override
- public void registration(String registrationName, NetconfNode nNode) {
-
- DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp();
- ObjectCreationNotification notification = new ObjectCreationNotificationBuilder()
- .setObjectIdRef(registrationName).setCounter(popEvntNumber()).setTimeStamp(ts).build();
- Connectionlog log = new ConnectionlogBuilder().setNodeId(registrationName)
- .setStatus(ConnectionLogStatus.Mounted).setTimestamp(ts).build();
- NetworkElementConnectionEntity e =
- NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode);
- LOG.debug("registration networkelement-connection for {} with status {}", registrationName, e.getStatus());
-
- // Write first to prevent missing entries
- databaseService.updateNetworkConnection22(e, registrationName);
- databaseService.writeConnectionLog(log);
- webSocketService.sendViaWebsockets(ownKeyName, notification, ObjectCreationNotification.QNAME,
- NetconfTimeStampImpl.getConverter().getTimeStamp());
- }
-
- /**
- * (Connected) mountpoint state moves to connected
- *
- * @param mountpointNodeName uuid that is nodeId or mountpointId
- * @param deviceType according to assessement
- */
- @Override
- public void connectIndication(String mountpointNodeName, NetworkElementDeviceType deviceType) {
-
- // Write first to prevent missing entries
- LOG.debug("updating networkelement-connection devicetype for {} with {}", mountpointNodeName, deviceType);
- NetworkElementConnectionEntity e =
- NetworkElementConnectionEntitiyUtil.getNetworkConnectionDeviceTpe(deviceType);
- //if updating db entry for ne connection fails retry later on (due elasticsearch max script executions error)
- if (!databaseService.updateNetworkConnectionDeviceType(e, mountpointNodeName)) {
- this.updateNeConnectionRetryWithDelay(e, mountpointNodeName);
- }
- DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp();
- AttributeValueChangedNotification notification = new AttributeValueChangedNotificationBuilder()
- .setCounter(popEvntNumber()).setTimeStamp(ts).setObjectIdRef(mountpointNodeName)
- .setAttributeName("deviceType").setNewValue(deviceType.name()).build();
- webSocketService.sendViaWebsockets(ownKeyName, notification, AttributeValueChangedNotification.QNAME, ts);
- }
-
- /**
- * (NonConnected) mountpoint state changed.
- *
- * @param mountpointNodeName nodeid
- * @param netconfNode node
- */
- public void onStateChangeIndication(String mountpointNodeName, NetconfNode netconfNode) {
- LOG.debug("mountpoint state changed indication for {}", mountpointNodeName);
- ConnectionStatus csts = netconfNode.getConnectionStatus();
- this.updateRegistration(mountpointNodeName, ConnectionStatus.class.getSimpleName(),
- csts != null ? csts.getName() : "null", netconfNode);
-
- }
-
- /**
- * (NonConnected) A deregistration after removal of a mountpoint occured.
- *
- * @param registrationName Name of the event that is used as key in the database.
- */
- @SuppressWarnings("null")
- @Override
- public void deRegistration(String registrationName) {
-
- DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp();
- ObjectDeletionNotification notification = new ObjectDeletionNotificationBuilder().setCounter(popEvntNumber())
- .setTimeStamp(ts).setObjectIdRef(registrationName).build();
- Connectionlog log = new ConnectionlogBuilder().setNodeId(registrationName)
- .setStatus(ConnectionLogStatus.Unmounted).setTimestamp(ts).build();
- // Write first to prevent missing entries
- databaseService.removeNetworkConnection(registrationName);
- databaseService.writeConnectionLog(log);
- webSocketService.sendViaWebsockets(registrationName, notification, ObjectDeletionNotification.QNAME, ts);
-
- }
-
- /**
- * Mountpoint state changed .. from connected -> connecting or unable-to-connect or vis-e-versa.
- *
- * @param registrationName Name of the event that is used as key in the database.
- */
- @Override
- public void updateRegistration(String registrationName, String attribute, String attributeNewValue,
- NetconfNode nNode) {
- DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp();
- AttributeValueChangedNotification notification = new AttributeValueChangedNotificationBuilder()
- .setCounter(popEvntNumber()).setTimeStamp(ts).setObjectIdRef(registrationName)
- .setAttributeName(attribute).setNewValue(attributeNewValue).build();
- Connectionlog log = new ConnectionlogBuilder().setNodeId(registrationName).setStatus(getStatus(attributeNewValue))
- .setTimestamp(ts).build();
- NetworkElementConnectionEntity e =
- NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode);
- LOG.debug("updating networkelement-connection for {} with status {}", registrationName, e.getStatus());
-
- //if updating db entry for ne connection fails retry later on (due elasticsearch max script executions error)
- if (!databaseService.updateNetworkConnection22(e, registrationName)) {
- this.updateNeConnectionRetryWithDelay(nNode, registrationName);
- }
- databaseService.writeConnectionLog(log);
- webSocketService.sendViaWebsockets(ownKeyName, notification, AttributeValueChangedNotification.QNAME, ts);
- }
-
-
- private void updateNeConnectionRetryWithDelay(NetconfNode nNode, String registrationName) {
- LOG.debug("try to rewrite networkelement-connection in {} for node {}", DBWRITE_RETRY_DELAY_MS,
- registrationName);
- executor.execute(new DelayedThread(DBWRITE_RETRY_DELAY_MS) {
- @Override
- public void run() {
- super.run();
- databaseService.updateNetworkConnection22(
- NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode),
- registrationName);
- }
- });
- }
-
- private void updateNeConnectionRetryWithDelay(NetworkElementConnectionEntity e, String registrationName) {
- LOG.debug("try to rewrite networkelement-connection in {} for node {}", DBWRITE_RETRY_DELAY_MS,
- registrationName);
- executor.execute(new DelayedThread(DBWRITE_RETRY_DELAY_MS) {
- @Override
- public void run() {
- super.run();
- databaseService.updateNetworkConnection22(e, registrationName);
- }
- });
- }
-
- /**
- * 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 {} {} {}", registrationName, problemName, problemSeverity);
- // notification
-
- ProblemNotificationXml notificationXml =
- new ProblemNotificationXml(ownKeyName, registrationName, problemName, problemSeverity,
- // popEvntNumberAsString(), InternalDateAndTime.TESTPATTERN );
- popEvntNumber(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()));
- DateAndTime ts = NETCONFTIME_CONVERTER.getTimeStamp();
- ProblemNotification notification =
- new ProblemNotificationBuilder().setObjectIdRef(registrationName).setCounter(popEvntNumber())
- .setProblem(problemName).setSeverity(InternalSeverity.toYang(problemSeverity)).build();
- databaseService.writeFaultLog(notificationXml.getFaultlog(SourceType.Controller));
- databaseService.updateFaultCurrent(notificationXml.getFaultcurrent());
-
- aotsDcaeForwarder.sendProblemNotificationUsingMaintenanceFilter(ownKeyName, notificationXml);
-
- webSocketService.sendViaWebsockets(ownKeyName, notification, ProblemNotification.QNAME, ts);
- }
-
- @Override
- public void writeEventLog(String objectId, String msg, String value) {
-
- LOG.debug("Got startComplete");
- EventlogBuilder eventlogBuilder = new EventlogBuilder();
- eventlogBuilder.setNodeId(ownKeyName).setTimestamp(new DateAndTime(NETCONFTIME_CONVERTER.getTimeStamp()))
- .setObjectId(objectId).setAttributeName(msg).setNewValue(value).setCounter(popEvntNumber())
- .setSourceType(SourceType.Controller);
- databaseService.writeEventLog(eventlogBuilder.build());
-
- }
-
- /*---------------------------------------------
- * 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;
- }
-
- @Override
- public void close() throws Exception {
- executor.shutdown();
- executor.awaitTermination(DBWRITE_RETRY_DELAY_MS * 3, TimeUnit.SECONDS);
- }
-
- /*---------------------------------------------------------------
- * Private
- */
- private Integer popEvntNumber() {
- return eventNumber++;
- }
-
- private static ConnectionLogStatus getStatus(String newValue) {
-
- if (newValue.equals(ConnectionStatus.Connected.getName())) {
- return ConnectionLogStatus.Connected;
-
- } else if (newValue.equals(ConnectionStatus.Connecting.getName())) {
- return ConnectionLogStatus.Connecting;
-
- } else if (newValue.equals(ConnectionStatus.UnableToConnect.getName())) {
- return ConnectionLogStatus.UnableToConnect;
-
- }
- return ConnectionLogStatus.Undefined;
- }
-
- private class DelayedThread extends Thread {
- private final long delay;
-
- public DelayedThread(long delayms) {
- this.delay = delayms;
- }
-
- @Override
- public void run() {
- try {
- Thread.sleep(this.delay);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java
deleted file mode 100644
index 57f258b3b..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
- * All rights reserved.
- * ================================================================================
- * Update Copyright (C) 2020 AT&T 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.eventdatahandler;
-
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeForwarderInternal;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.PushNotifications;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientInternal;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultcurrentBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultcurrentEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.AttributeValueChangedNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.AttributeValueChangedNotificationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ProblemNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ProblemNotificationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushAttributeChangeNotificationInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInput;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RpcPushNotificationsHandler implements PushNotifications {
-
- private static final Logger LOG = LoggerFactory.getLogger(RpcPushNotificationsHandler.class);
-
- private static final String OWNKEYNAME = "VES";
- private final WebSocketServiceClientInternal webSocketService;
- private final DataProvider databaseService;
- private final DcaeForwarderInternal aotsDcaeForwarder;
-
- public RpcPushNotificationsHandler(WebSocketServiceClientInternal webSocketService, DataProvider databaseService,
- DcaeForwarderInternal aotsDcaeForwarder) {
- super();
- this.webSocketService = webSocketService;
- this.databaseService = databaseService;
- this.aotsDcaeForwarder = aotsDcaeForwarder;
- }
-
- @Override
- public void pushAttributeChangeNotification(PushAttributeChangeNotificationInput input) {
-
- LOG.debug("Got attribute change event {}", input);
-
- EventlogBuilder enventlogBuilder = new EventlogBuilder();
- enventlogBuilder.setSourceType(SourceType.Ves);
- enventlogBuilder.fieldsFrom(input);
- EventlogEntity eventlogEntity = enventlogBuilder.build();
- databaseService.writeEventLog(eventlogEntity);
- AttributeValueChangedNotification notification =
- new AttributeValueChangedNotificationBuilder().setAttributeName(input.getAttributeName())
- .setCounter(input.getCounter()).setNewValue(input.getNewValue())
- .setObjectIdRef(input.getObjectId()).setTimeStamp(input.getTimestamp()).build();
- webSocketService.sendViaWebsockets(OWNKEYNAME, notification, AttributeValueChangedNotification.QNAME,
- input.getTimestamp());
-
- }
-
- @Override
- public void pushFaultNotification(PushFaultNotificationInput input) {
-
- LOG.debug("Got fault event {}", input);
-
- FaultlogBuilder faultlogBuilder = new FaultlogBuilder();
- faultlogBuilder.setSourceType(SourceType.Ves);
- faultlogBuilder.fieldsFrom(input);
- FaultlogEntity faultlogEntity = faultlogBuilder.build();
- databaseService.writeFaultLog(faultlogEntity);
-
- FaultcurrentBuilder faultcurrentBuilder = new FaultcurrentBuilder();
- faultcurrentBuilder.fieldsFrom(input);
- FaultcurrentEntity faultcurrentEntity = faultcurrentBuilder.build();
- databaseService.updateFaultCurrent(faultcurrentEntity);
-
- ProblemNotificationXml notificationXml = new ProblemNotificationXml(faultlogEntity);
- ProblemNotification notification = new ProblemNotificationBuilder().setProblem(input.getProblem())
- .setCounter(input.getCounter()).setObjectIdRef(input.getObjectId())
- .setSeverity(InternalSeverity.toYang(input.getSeverity())).setTimeStamp(input.getTimestamp()).build();
- aotsDcaeForwarder.sendProblemNotificationUsingMaintenanceFilter(OWNKEYNAME, notificationXml);
- webSocketService.sendViaWebsockets(OWNKEYNAME, notification, ProblemNotification.QNAME, input.getTimestamp());
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java
deleted file mode 100644
index 49c678ebc..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ConnectionStatusHousekeepingService.java
+++ /dev/null
@@ -1,259 +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.housekeeping;
-
-import com.google.common.util.concurrent.FluentFuture;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import org.eclipse.jdt.annotation.NonNull;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InternalConnectionStatus;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
-import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionLogStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
-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;
-
-public class ConnectionStatusHousekeepingService
- implements ClusterSingletonService, AutoCloseable, IConfigChangedListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConnectionStatusHousekeepingService.class);
-
- private static final long INTERVAL_SECONDS = 30;
- private static final InstanceIdentifier<Topology> NETCONF_TOPO_IID =
- InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,
- new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName())));
- private static final ServiceGroupIdentifier IDENT =
- ServiceGroupIdentifier.create("ConnectionStatusHousekeepingService");
-
- private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(3);
- private final DataBroker dataBroker;
- private final DataProvider dataProvider;
- private final Runnable runner = () -> doClean();
- private final HouseKeepingConfig config;
- private final ConfigurationFileRepresentation cfg;
-
- private final ClusterSingletonServiceRegistration cssRegistration2;
- private boolean isMaster;
- private Future<?> taskReference;
- private int eventNumber;
- private volatile boolean enabled;
-
- public ConnectionStatusHousekeepingService(ConfigurationFileRepresentation cfg,
- ClusterSingletonServiceProvider clusterSingletonServiceProvider, DataBroker dataBroker,
- DataProvider dataProvider) {
- this.config = new HouseKeepingConfig(cfg);
- this.cfg = cfg;
- cfg.registerConfigChangedListener(this);
- this.dataBroker = dataBroker;
- this.dataProvider = dataProvider;
- this.eventNumber = 0;
-
- setEnabled(this.config.isEnabled());
- this.start();
-
- this.cssRegistration2 = clusterSingletonServiceProvider.registerClusterSingletonService(this);
- }
-
- private void setEnabled(boolean pEnabled) {
- LOG.info("ConnectionStatusHousekeepingService status change from {} to {}", enabled, pEnabled);
- this.enabled = pEnabled;
- }
-
- private boolean isEnabled() {
- return this.enabled;
- }
-
- private void start() {
- if (taskReference != null) {
- taskReference.cancel(false);
- }
- if (!isMaster) {
- LOG.info("Do not start. not the master node");
- } else {
- LOG.info("Starting scheduler with interval {}", INTERVAL_SECONDS);
- this.taskReference =
- this.scheduler.scheduleAtFixedRate(runner, INTERVAL_SECONDS, INTERVAL_SECONDS, TimeUnit.SECONDS);
- }
- }
-
- private void doClean() {
- if (!isEnabled()) {
- LOG.debug("service is disabled by config");
- return;
- }
- LOG.debug("start housekeeping");
- // get all devices from networkelement-connection index
- try {
- List<NetworkElementConnectionEntity> list = this.dataProvider.getNetworkElementConnections();
-
- ConnectionLogStatus dbStatus;
- ConnectionLogStatus mdsalStatus;
- String nodeId;
- if (list == null || list.size() <= 0) {
- LOG.trace("no items in list.");
- } else {
- NetconfTimeStamp ts = NetconfTimeStampImpl.getConverter();
- //check all db entries and sync connection status
- for (NetworkElementConnectionEntity item : list) {
-
- // compare with MD-SAL
- nodeId = item.getNodeId();
- LOG.trace("check status of {}", nodeId);
- dbStatus = item.getStatus();
- mdsalStatus = this.getMDSalConnectionStatus(nodeId);
- if (mdsalStatus == null) {
- LOG.trace("unable to get connection status. jump over");
- continue;
- }
- // if different then update db
- if (dbStatus != mdsalStatus) {
- LOG.trace("status is inconsistent db={}, mdsal={}. updating db", dbStatus, mdsalStatus);
- this.dataProvider.writeEventLog(new EventlogBuilder().setNodeId("SDN-Controller")
- .setTimestamp(new DateAndTime(ts.getTimeStamp())).setObjectId(item.getNodeId())
- .setAttributeName("status").setNewValue(String.valueOf(mdsalStatus))
- .setCounter(popEvntNumber()).setSourceType(SourceType.Controller).build());
- if ((item.isIsRequired() == null || item.isIsRequired() == false)
- && mdsalStatus == ConnectionLogStatus.Disconnected) {
- LOG.info("removing entry for node {} ({}) from database due missing MD-SAL entry",
- item.getNodeId(), mdsalStatus);
- this.dataProvider.removeNetworkConnection(nodeId);
- } else {
- NetworkElementConnectionBuilder ne =
- new NetworkElementConnectionBuilder().setStatus(mdsalStatus);
-
- this.dataProvider.updateNetworkConnection22(ne.build(), nodeId);
- }
- } else {
- LOG.trace("no difference");
- }
- }
- }
-
- } catch (Exception e) {
- LOG.warn("problem executing housekeeping task: {}", e);
- }
- LOG.debug("finish housekeeping");
- }
-
- private Integer popEvntNumber() {
- return eventNumber++;
- }
-
- private ConnectionLogStatus getMDSalConnectionStatus(String nodeId) {
-
- @SuppressWarnings("null")
- @NonNull
- InstanceIdentifier<Node> instanceIdentifier =
- NETCONF_TOPO_IID.child(Node.class, new NodeKey(new NodeId(nodeId)));
- ReadTransaction trans = this.dataBroker.newReadOnlyTransaction();
- FluentFuture<Optional<Node>> optionalNode = trans.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier);
- try {
- //Node node = optionalNode.get(5, TimeUnit.SECONDS).get();
- Node node = optionalNode.get().get();
- LOG.debug("node is {}", node);
- NetconfNode nNode = node.augmentation(NetconfNode.class);
- LOG.debug("nnode is {}", nNode);
- if (nNode != null) {
- return InternalConnectionStatus.statusFromNodeStatus(nNode.getConnectionStatus());
- }
- } catch (NoSuchElementException e) {
- return ConnectionLogStatus.Disconnected;
- } catch (ExecutionException | InterruptedException e) {// | TimeoutException e) {
- LOG.warn("unable to get node info: {}", e);
- } finally {
- trans.close();
- }
-
- return null;
- }
-
- @Override
- public void close() throws Exception {
- if (taskReference != null) {
- taskReference.cancel(false);
- }
- if (this.cfg != null) {
- this.cfg.unregisterConfigChangedListener(this);
- }
- this.scheduler.shutdown();
- if (this.cssRegistration2 != null)
- this.cssRegistration2.close();
- }
-
- @Override
- public @NonNull ServiceGroupIdentifier getIdentifier() {
- return IDENT;
- }
-
- @Override
- public void instantiateServiceInstance() {
- LOG.info("We take Leadership");
- this.isMaster = true;
- this.start();
- }
-
- @Override
- public ListenableFuture<? extends Object> closeServiceInstance() {
- LOG.info("We lost Leadership");
- this.isMaster = false;
- this.start();
- return Futures.immediateFuture(null);
- }
-
- @Override
- public void onConfigChanged() {
-
- setEnabled(this.config.isEnabled());
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/HouseKeepingConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/HouseKeepingConfig.java
deleted file mode 100644
index 230488a09..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/HouseKeepingConfig.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
- * All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.housekeeping;
-
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-
-/**
- * @author Michael Dürre
- *
- */
-public class HouseKeepingConfig implements Configuration {
-
- private static final String SECTION_MARKER_HK = "housekeeping";
-
- private static final String PROPERTY_KEY_ENABLED = "hkEnabled";
-
- private static final boolean DEFAULT_VALUE_ENABLED = false;
-
- private final ConfigurationFileRepresentation configuration;
-
- public HouseKeepingConfig(ConfigurationFileRepresentation configuration) {
- this.configuration = configuration;
- this.configuration.addSection(SECTION_MARKER_HK);
- defaults();
- }
-
- public boolean isEnabled() {
- return configuration.getPropertyBoolean(SECTION_MARKER_HK, PROPERTY_KEY_ENABLED);
- }
-
-
- @Override
- public String getSectionName() {
- return SECTION_MARKER_HK;
- }
-
- @Override
- public void defaults() {
- //Add default if not available
- configuration.setPropertyIfNotAvailable(SECTION_MARKER_HK, PROPERTY_KEY_ENABLED, DEFAULT_VALUE_ENABLED);
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ResyncNetworkElementHouskeepingService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ResyncNetworkElementHouskeepingService.java
deleted file mode 100644
index 50b0215d6..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ResyncNetworkElementHouskeepingService.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.housekeeping;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitor;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.ODLEventListenerHandler;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-import org.opendaylight.mdsal.binding.api.MountPoint;
-import org.opendaylight.mdsal.binding.api.MountPointService;
-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;
-
-public class ResyncNetworkElementHouskeepingService implements ResyncNetworkElementsListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(ResyncNetworkElementHouskeepingService.class);
-
- private static final InstanceIdentifier<Topology> NETCONF_TOPO_IID =
- InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,
- new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName())));
-
- // Services to use
- private final MountPointService mountPointService;
- private final ODLEventListenerHandler odlEventListenerHandler;
- private final DataProvider databaseClientEvents;
- private final DeviceMonitor deviceMonitor;
- private final DeviceManagerImpl deviceManager;
-
- /** Thread is started to du the clean up action **/
- private Thread threadDoClearCurrentFaultByNodename;
- /** Indicate number of refresh activities for log **/
- private int refreshCounter = 0;
-
- /**
- * @param deviceManager to provide devices information
- * @param mountPointService service
- * @param odlEventListenerHandler handler for events
- * @param databaseClientEvents database to clean
- * @param deviceMonitor devicemonitor
- */
- public ResyncNetworkElementHouskeepingService(DeviceManagerImpl deviceManager, MountPointService mountPointService,
- ODLEventListenerHandler odlEventListenerHandler, DataProvider databaseClientEvents,
- DeviceMonitor deviceMonitor) {
- super();
- this.deviceManager = deviceManager;
- this.mountPointService = mountPointService;
- this.odlEventListenerHandler = odlEventListenerHandler;
- this.databaseClientEvents = databaseClientEvents;
- this.deviceMonitor = deviceMonitor;
- }
-
- /**
- * Async RPC Interface implementation
- */
- @Override
- public @NonNull List<String> doClearCurrentFaultByNodename(@Nullable List<String> nodeNames)
- 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 {
- List<String> nodeNamesInput;
-
- // Create list of mountpoints if input is empty, using the content in ES
- if (nodeNames == null || nodeNames.size() <= 0) {
- nodeNamesInput = this.databaseClientEvents.getAllNodesWithCurrentAlarms();
- } else {
- nodeNamesInput = nodeNames;
- }
-
- // 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 (odlEventListenerHandler != null && mountpointName.equals(odlEventListenerHandler.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 (deviceManager.getConnectedNeByMountpoint(mountpointName) != null) {
- LOG.info("At node known mountpoint {}", mountpointName);
- nodeNamesHandled.add(mountpointName);
- } else {
- LOG.info("At node unknown mountpoint {}", mountpointName);
- }
- }
- }
- }
- }
-
- // Force a sync
- deviceMonitor.refreshAlarmsInDb();
-
- threadDoClearCurrentFaultByNodename = new Thread(() -> {
- refreshCounter++;
- LOG.info("Start refresh mountpoint task {}", refreshCounter);
- // for(String nodeName:nodeNamesOutput) {
- for (String nodeName : nodeNamesHandled) {
- NetworkElement ne = deviceManager.getConnectedNeByMountpoint(nodeName);
- if (ne != null) {
- LOG.info("Refresh mountpoint {}", nodeName);
- ne.warmstart();
- } else {
- LOG.info("Unhandled mountpoint {}", nodeName);
- }
- }
- LOG.info("End refresh mountpoint task {}", refreshCounter);
- });
- threadDoClearCurrentFaultByNodename.start();
- return nodeNamesHandled;
- }
- };
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ResyncNetworkElementsListener.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ResyncNetworkElementsListener.java
deleted file mode 100644
index 652d543f0..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/housekeeping/ResyncNetworkElementsListener.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.housekeeping;
-
-import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.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/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 266bb04ba..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java
+++ /dev/null
@@ -1,239 +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 org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.housekeeping.ResyncNetworkElementsListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceRPCServiceAPI;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.impl.MaintenanceServiceImpl;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-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.PushAttributeChangeNotificationInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushAttributeChangeNotificationOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationOutput;
-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.concepts.ObjectRegistration;
-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;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(DevicemanagerService.class);
-
- private final ObjectRegistration<DevicemanagerService> rpcReg;
- private @Nullable final MaintenanceRPCServiceAPI maintenanceService;
- private @Nullable final PushNotifications pushNotificationsListener;
- private @Nullable final ResyncNetworkElementsListener resyncCallbackListener;
-
- public DeviceManagerApiServiceImpl(final RpcProviderService rpcProviderRegistry,
- MaintenanceServiceImpl maintenanceService, ResyncNetworkElementsListener listener,
- PushNotifications pushNotificationsListener) {
- this.maintenanceService = maintenanceService;
- this.pushNotificationsListener = pushNotificationsListener;
- this.resyncCallbackListener = listener;
-
- // Register ourselves as the REST API RPC implementation
- LOG.info("Register RPC Service " + DevicemanagerService.class.getSimpleName());
- this.rpcReg = rpcProviderRegistry.registerRpcImplementation(DevicemanagerService.class, this);
- }
-
- @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.getNodeId());
- 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();
- }
-
- @Override
- public ListenableFuture<RpcResult<PushFaultNotificationOutput>> pushFaultNotification(
- PushFaultNotificationInput input) {
- LOG.info("RPC Received fault notification {}", input);
- RpcResultBuilder<PushFaultNotificationOutput> result;
- try {
- pushNotificationsListener.pushFaultNotification(input);
- result = RpcResultBuilder.success();
- } catch (Exception e) {
- result = RpcResultBuilder.failed();
- result.withError(ErrorType.APPLICATION, "Exception", e);
- }
- return result.buildFuture();
- }
-
- @Override
- public ListenableFuture<RpcResult<PushAttributeChangeNotificationOutput>> pushAttributeChangeNotification(
- PushAttributeChangeNotificationInput input) {
- LOG.info("RPC Received change notification {}", input);
- RpcResultBuilder<PushAttributeChangeNotificationOutput> result;
- try {
- pushNotificationsListener.pushAttributeChangeNotification(input);
- result = RpcResultBuilder.success();
- } catch (Exception e) {
- result = RpcResultBuilder.failed();
- result.withError(ErrorType.APPLICATION, "Exception", e);
- }
- return result.buildFuture();
- }
-
-
-
-}
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 0b69830c7..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
- * All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- */
-/*
- * ============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 java.util.concurrent.CopyOnWriteArrayList;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.IEntityDataProvider;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.IEsConfig;
-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.dcaeconnector.impl.DcaeForwarderImpl;
-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.DeviceMonitorImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.DeviceManagerDatabaseNotificationService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.ODLEventListenerHandler;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.RpcPushNotificationsHandler;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.housekeeping.ConnectionStatusHousekeepingService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.housekeeping.ResyncNetworkElementHouskeepingService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.WebSocketServiceClientInternal;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.impl.MaintenanceServiceImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.FactoryRegistration;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.NetworkElementFactory;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.PerformanceManagerImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.AaiService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EquipmentService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EventHandlingService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.MaintenanceService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.PerformanceManager;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.DevicemanagerNotificationDelayService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.vescollectorconnector.impl.VESCollectorServiceImpl;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateService;
-import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.MountPointService;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Devicemanager - Handles startup and closedown of network element handlers for netconf session - Provide common
- * services for network element specific components
- */
-public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceManagerServiceProvider, AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerImpl.class);
- private static final String APPLICATION_NAME = "DeviceManager";
- private static final String MYDBKEYNAMEBASE = "SDN-Controller";
- private static final String CONFIGURATIONFILE = "etc/devicemanager.properties";
- public static final long DATABASE_TIMEOUT_MS = 120 * 1000L;
-
- @SuppressWarnings("unused")
- private static final String STARTUPLOG_FILENAME = "etc/devicemanager.startup.log";
-
- // MDSAL Services
- private DataBroker dataBroker;
- private MountPointService mountPointService;
- private RpcProviderService rpcProviderRegistry;
- private ClusterSingletonServiceProvider clusterSingletonServiceProvider;
- private WebsocketManagerService websocketmanagerService;
- private IEntityDataProvider iEntityDataProvider;
-
- // Devicemanager common services for network element handler
- private WebSocketServiceClientInternal webSocketService;
- private ODLEventListenerHandler odlEventListenerHandler; //EventHandlingService
- private DeviceManagerApiServiceImpl rpcApiService;
- private PerformanceManagerImpl performanceManager;
- private DcaeProviderClient dcaeProviderClient;
- private AaiProviderClient aaiProviderClient;
- private DcaeForwarderImpl aotsDcaeForwarder;
- private DeviceMonitor deviceMonitor;
- private MaintenanceServiceImpl maintenanceService;
- private DevicemanagerNotificationDelayService notificationDelayService;
- private ResyncNetworkElementHouskeepingService resyncNetworkElementHouskeepingService;
- private ArchiveCleanService archiveCleanService;
- private ConnectionStatusHousekeepingService housekeepingService;
- private NetconfNodeStateService netconfNodeStateService;
- private DataProvider dataProvider;
- private VESCollectorServiceImpl vesCollectorServiceImpl;
-
- // Handler
- private DeviceManagerNetconfConnectHandler deviceManagerNetconfConnectHandler;
-
- // Attributes
- private final List<NetworkElementFactory> factoryList;
-
- private DeviceManagerDatabaseNotificationService deviceManagerDatabaseAndNotificationService;
-
- ConfigurationFileRepresentation config;
- private Boolean devicemanagerInitializationOk;
-
- // Blueprint 1
- public DeviceManagerImpl() {
- LOG.info("Creating provider for {}", APPLICATION_NAME);
- this.devicemanagerInitializationOk = false;
- this.factoryList = new CopyOnWriteArrayList<>();
-
- this.dataBroker = null;
- this.mountPointService = null;
- this.rpcProviderRegistry = null;
- this.clusterSingletonServiceProvider = null;
- this.websocketmanagerService = null;
- this.iEntityDataProvider = null;
-
- this.webSocketService = null;
- }
-
- public void setDataBroker(DataBroker dataBroker) {
- this.dataBroker = dataBroker;
- }
-
- public void setRpcProviderRegistry(RpcProviderService rpcProviderRegistry) {
- this.rpcProviderRegistry = rpcProviderRegistry;
- }
-
- public void setNotificationPublishService(NotificationPublishService notificationPublishService) {}
-
- public void setMountPointService(MountPointService mountPointService) {
- this.mountPointService = mountPointService;
- }
-
- public void setClusterSingletonService(ClusterSingletonServiceProvider clusterSingletonService) {
- this.clusterSingletonServiceProvider = clusterSingletonService;
- }
-
- public void setNetconfNodeStateService(NetconfNodeStateService netconfNodeStateService) {
- this.netconfNodeStateService = netconfNodeStateService;
- }
-
- public void setWebsocketmanagerService(WebsocketManagerService websocketmanagerService) {
- this.websocketmanagerService = websocketmanagerService;
- }
-
- public void setEntityDataProvider(IEntityDataProvider iEntityDataProvider) {
- this.iEntityDataProvider = iEntityDataProvider;
- }
-
- public void init() {
-
- LOG.info("Session Initiated start {}", APPLICATION_NAME);
-
- this.iEntityDataProvider.setReadyStatus(false);
-
- this.dataProvider = iEntityDataProvider.getDataProvider();
-
- // Get configuration
- this.config = new ConfigurationFileRepresentation(CONFIGURATIONFILE);
-
- this.notificationDelayService = new DevicemanagerNotificationDelayService(config);
-
- // start service for device maintenance service
- this.maintenanceService = new MaintenanceServiceImpl(iEntityDataProvider.getHtDatabaseMaintenance());
-
- // Websockets
- this.webSocketService = new WebSocketServiceClientImpl(websocketmanagerService);
-
- IEsConfig esConfig = iEntityDataProvider.getEsConfig();
- // DCAE
- this.dcaeProviderClient = new DcaeProviderClient(config, esConfig.getCluster(), this);
-
- this.aaiProviderClient = new AaiProviderClient(config, this);
-
- this.vesCollectorServiceImpl = new VESCollectorServiceImpl(config);
- // EM
- String myDbKeyNameExtended = MYDBKEYNAMEBASE + "-" + esConfig.getCluster();
-
- this.aotsDcaeForwarder = new DcaeForwarderImpl(null, dcaeProviderClient, maintenanceService);
-
- this.deviceManagerDatabaseAndNotificationService = new DeviceManagerDatabaseNotificationService(dataProvider,
- maintenanceService, webSocketService, notificationDelayService, aotsDcaeForwarder);
-
- RpcPushNotificationsHandler rpcPushNotificationsHandler =
- new RpcPushNotificationsHandler(webSocketService, dataProvider, aotsDcaeForwarder);
- this.odlEventListenerHandler =
- new ODLEventListenerHandler(myDbKeyNameExtended, webSocketService, dataProvider, aotsDcaeForwarder);
- this.archiveCleanService = new ArchiveCleanService(iEntityDataProvider.getEsConfig(),
- clusterSingletonServiceProvider, dataProvider);
- this.housekeepingService = new ConnectionStatusHousekeepingService(config, clusterSingletonServiceProvider,
- this.dataBroker, dataProvider);
- // PM
- this.performanceManager = new PerformanceManagerImpl(60, this, dataProvider, config);
- // DM
- // DeviceMonitor has to be available before netconfSubscriptionManager is
- // configured
- LOG.debug("start DeviceMonitor Service");
- this.deviceMonitor = new DeviceMonitorImpl(dataBroker, odlEventListenerHandler, config);
-
- // ResyncNetworkElementHouskeepingService
- this.resyncNetworkElementHouskeepingService = new ResyncNetworkElementHouskeepingService(this,
- mountPointService, odlEventListenerHandler, dataProvider, deviceMonitor);
-
- // RPC Service for specific services
- // Start RPC Service
- LOG.debug("start rpc service");
- this.rpcApiService = new DeviceManagerApiServiceImpl(rpcProviderRegistry, maintenanceService,
- resyncNetworkElementHouskeepingService, rpcPushNotificationsHandler);
-
- // netconfSubscriptionManager should be the last one because this is a callback
-
- // service
- LOG.debug("start NetconfSubscriptionManager Service");
- this.deviceManagerNetconfConnectHandler = new DeviceManagerNetconfConnectHandler(netconfNodeStateService,
- clusterSingletonServiceProvider, odlEventListenerHandler, deviceMonitor, this, factoryList);
-
- writeToEventLog(APPLICATION_NAME, "startup", "done");
- this.devicemanagerInitializationOk = true;
-
- LOG.info("Session Initiated end. Initialization done {}", devicemanagerInitializationOk);
- this.iEntityDataProvider.setReadyStatus(true);
-
- }
-
- @Override
- public void close() {
- LOG.info("DeviceManagerImpl closing ...");
- close(performanceManager);
- close(dcaeProviderClient);
- close(aotsDcaeForwarder);
- close(aaiProviderClient);
- close(deviceMonitor);
- close(maintenanceService);
- close(rpcApiService);
- close(notificationDelayService);
- close(archiveCleanService);
- close(housekeepingService);
- close(deviceManagerNetconfConnectHandler);
- close(vesCollectorServiceImpl);
- LOG.info("DeviceManagerImpl closing done");
- }
-
- @Override
- public @NonNull <L extends NetworkElementFactory> FactoryRegistration<L> registerBindingNetworkElementFactory(
- @NonNull final L factory) {
- LOG.info("Factory registration {}", factory.getClass().getName());
-
- factoryList.add(factory);
- factory.init(getServiceProvider());
- return new FactoryRegistration<L>() {
-
- @Override
- public @NonNull L getInstance() {
- return factory;
- }
-
- @Override
- public void close() {
- factoryList.remove(factory);
- }
-
- };
- }
-
- @SuppressWarnings("null")
- @Override
- public @NonNull DataProvider getDataProvider() {
- return this.dataProvider;
- }
-
- @SuppressWarnings("null")
- @Override
- public @NonNull NotificationService getNotificationService() {
- return this.deviceManagerDatabaseAndNotificationService;
- }
-
- @SuppressWarnings("null")
- @Override
- public @NonNull FaultService getFaultService() {
- return this.deviceManagerDatabaseAndNotificationService;
- }
-
- @SuppressWarnings("null")
- @Override
- public @NonNull EquipmentService getEquipmentService() {
- return this.deviceManagerDatabaseAndNotificationService;
- }
-
- @SuppressWarnings("null")
- @Override
- public @NonNull AaiService getAaiService() {
- return this.aaiProviderClient;
- }
-
- @SuppressWarnings("null")
- @Override
- public @NonNull MaintenanceService getMaintenanceService() {
- return this.maintenanceService;
- }
-
- @SuppressWarnings("null")
- @Override
- public @NonNull PerformanceManager getPerformanceManagerService() {
- return this.performanceManager;
- }
-
- @SuppressWarnings("null")
- @Override
- public @NonNull EventHandlingService getEventHandlingService() {
- return this.odlEventListenerHandler;
- }
-
- @SuppressWarnings("null")
- @Override
- public @NonNull ConfigurationFileRepresentation getConfigurationFileRepresentation() {
- return this.config;
- }
-
- // Deviceinitialization
-
- /**
- * Used to close all Services, that should support AutoCloseable Pattern
- *
- * @param toClose
- */
- private void close(AutoCloseable... toCloseList) {
- for (AutoCloseable element : toCloseList) {
- if (element != null) {
- try {
- element.close();
- } catch (Exception e) {
- LOG.warn("Problem during close {}", e);
- }
- }
- }
- }
-
- /*-------------------------------------------------------------------------------------------
- * Functions
- */
-
- public ArchiveCleanService getArchiveCleanService() {
- return this.archiveCleanService;
- }
-
- public DataProvider getDatabaseClientEvents() {
- return dataProvider;
- }
-
- @Override
- public DeviceManagerServiceProvider getServiceProvider() {
- return this;
- }
-
- /**
- * 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 NE object. Used by DCAE Service
- *
- * @param mountpoint mount point name
- * @return null or NE specific data
- */
- public @Nullable NetworkElement getConnectedNeByMountpoint(String mountpoint) {
-
- return this.deviceManagerNetconfConnectHandler.getConnectedNeByMountpoint(mountpoint);
-
- }
-
- @Override
- public void writeToEventLog(String objectId, String msg, String value) {
- this.odlEventListenerHandler.writeEventLog(objectId, msg, value);
- }
-
- @Override
- public @NonNull VESCollectorService getVESCollectorService() {
- return this.vesCollectorServiceImpl;
- }
-
- @Override
- public WebsocketManagerService getWebsocketService() {
- return this.websocketmanagerService;
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfConnectHandler.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfConnectHandler.java
deleted file mode 100644
index bb61a82b4..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfConnectHandler.java
+++ /dev/null
@@ -1,187 +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 java.util.Objects;
-import java.util.Optional;
-import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.concurrent.GuardedBy;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitor;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.ODLEventListenerHandler;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.NetworkElementFactory;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeConnectListener;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-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;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DeviceManagerNetconfConnectHandler extends DeviceManagerNetconfNotConnectHandler
- implements NetconfNodeConnectListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerNetconfConnectHandler.class);
-
- private final Object networkelementLock;
- /** Contains all connected devices */
- @GuardedBy("networkelementLock")
- private final ConcurrentHashMap<String, NetworkElement> connectedNetworkElementRepresentations;
-
- private final @NonNull ListenerRegistration<DeviceManagerNetconfConnectHandler> registerNetconfNodeConnectListener;
-
- public DeviceManagerNetconfConnectHandler(@NonNull NetconfNodeStateService netconfNodeStateService,
- @NonNull ClusterSingletonServiceProvider clusterSingletonServiceProvider,
- @NonNull ODLEventListenerHandler odlEventListenerHandler, @NonNull DeviceMonitor deviceMonitor,
- @NonNull DeviceManagerServiceProvider serviceProvider, @NonNull List<NetworkElementFactory> factoryList) {
-
- super(netconfNodeStateService, clusterSingletonServiceProvider, odlEventListenerHandler, deviceMonitor,
- serviceProvider, factoryList);
-
- this.networkelementLock = new Object();
- this.connectedNetworkElementRepresentations = new ConcurrentHashMap<>();
-
- this.registerNetconfNodeConnectListener = netconfNodeStateService.registerNetconfNodeConnectListener(this);
- }
-
- @Override
- public void onEnterConnected(@NonNull NetconfAccessor acessor) {
- //@NonNull NodeId nNodeId, @NonNull NetconfNode netconfNode,
- //@NonNull MountPoint mountPoint, @NonNull DataBroker netconfNodeDataBroker
- String mountPointNodeName = acessor.getNodeId().getValue();
- LOG.info("onEnterConnected - starting Event listener on Netconf for mountpoint {}", mountPointNodeName);
-
- LOG.info("Master mountpoint {}", mountPointNodeName);
-
- // 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.
-
- if (isInNetworkElementRepresentations(mountPointNodeName)) {
- LOG.warn("Mountpoint {} already registered. Leave startup procedure.", mountPointNodeName);
- return;
- }
- // update db with connect status
- NetconfNode netconfNode = acessor.getNetconfNode();
- sendUpdateNotification(mountPointNodeName, netconfNode.getConnectionStatus(), netconfNode);
-
- for (NetworkElementFactory f : getFactoryList()) {
- Optional<NetworkElement> optionalNe = f.create(acessor, getServiceProvider());
- if (optionalNe.isPresent()) {
- // sendUpdateNotification(mountPointNodeName, nNode.getConnectionStatus(), nNode);
- handleNeStartup(mountPointNodeName, optionalNe.get());
- break; // Use the first provided
- }
- }
- }
-
- @Override
- public void onLeaveConnected(@NonNull NodeId nNodeId, @NonNull Optional<NetconfNode> optionalNetconfNode) {
-
- LOG.info("onLeaveConnected {}", nNodeId);
- String mountPointNodeName = nNodeId.getValue();
-
- if (optionalNetconfNode.isPresent()) {
- NetconfNode nNode = optionalNetconfNode.get();
- ConnectionStatus csts = nNode.getConnectionStatus();
- sendUpdateNotification(mountPointNodeName, csts, nNode);
- }
-
- // Handling if mountpoint exist. connected -> connecting/UnableToConnect
- stopListenerOnNodeForConnectedState(mountPointNodeName);
- if (isDeviceMonitorEnabled()) {
- getDeviceMonitor().deviceDisconnectIndication(mountPointNodeName);
- }
- }
-
- @Override
- public void close() {
- if (Objects.nonNull(registerNetconfNodeConnectListener)) {
- registerNetconfNodeConnectListener.close();
- }
- super.close();
- }
-
- public @Nullable NetworkElement getConnectedNeByMountpoint(String mountpoint) {
- return this.connectedNetworkElementRepresentations.get(mountpoint);
- }
-
- /*--------------------------------------------
- * Private functions
- */
-
- /**
- * Do all tasks necessary to move from mountpoint state connected -> connecting
- *
- * @param mountPointNodeName provided
- */
- private void stopListenerOnNodeForConnectedState(String mountPointNodeName) {
- NetworkElement ne = connectedNetworkElementRepresentations.remove(mountPointNodeName);
- if (ne != null) {
- ne.deregister();
- }
- }
-
- private boolean isInNetworkElementRepresentations(String mountPointNodeName) {
- synchronized (networkelementLock) {
- return connectedNetworkElementRepresentations.contains(mountPointNodeName);
- }
- }
-
-
- private void handleNeStartup(String mountPointNodeName, NetworkElement inNe) {
-
- LOG.info("NE Management for {} with {}", mountPointNodeName, inNe.getClass().getName());
- NetworkElement result;
- synchronized (networkelementLock) {
- result = connectedNetworkElementRepresentations.put(mountPointNodeName, inNe);
- }
- if (result != null) {
- LOG.warn("NE list was not empty as expected, but contained {} ", result.getNodeId());
- } else {
- LOG.debug("refresh necon entry for {} with type {}", mountPointNodeName, inNe.getDeviceType());
- if (isOdlEventListenerHandlerEnabled()) {
- getOdlEventListenerHandler().connectIndication(mountPointNodeName, inNe.getDeviceType());
- }
- }
- if (isDeviceMonitorEnabled()) {
- getDeviceMonitor().deviceConnectMasterIndication(mountPointNodeName, inNe);
- }
-
- inNe.register();
- }
-
- private void sendUpdateNotification(String mountPointNodeName, ConnectionStatus csts, NetconfNode nNode) {
- LOG.info("update ConnectedState for device :: Name : {} ConnectionStatus {}", mountPointNodeName, csts);
- if (isOdlEventListenerHandlerEnabled()) {
- getOdlEventListenerHandler().updateRegistration(mountPointNodeName, ConnectionStatus.class.getSimpleName(),
- csts != null ? csts.getName() : "null", nNode);
- }
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfNotConnectHandler.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfNotConnectHandler.java
deleted file mode 100644
index df833018d..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfNotConnectHandler.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl;
-
-import java.util.List;
-import java.util.Objects;
-import org.eclipse.jdt.annotation.NonNull;
-import org.onap.ccsdk.features.sdnr.wt.common.HtAssert;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitor;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.eventdatahandler.ODLEventListenerHandler;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.OdlClusterSingleton;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.NetworkElementFactory;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateListener;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DeviceManagerNetconfNotConnectHandler implements NetconfNodeStateListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerNetconfNotConnectHandler.class);
-
- private final @NonNull ListenerRegistration<NetconfNodeStateListener> registerNetconfNodeStateListener;
-
- private final @NonNull ODLEventListenerHandler odlEventListenerHandler;
- private final @NonNull DeviceMonitor deviceMonitor;
- private final @NonNull List<NetworkElementFactory> factoryList;
- private final @NonNull DeviceManagerServiceProvider serviceProvider;
-
-
- private final boolean odlEventListenerHandlerEnabled;
- private final boolean deviceMonitorEnabled;
-
- private final OdlClusterSingleton singleton;
-
- public DeviceManagerNetconfNotConnectHandler(@NonNull NetconfNodeStateService netconfNodeStateService,
- @NonNull ClusterSingletonServiceProvider clusterSingletonServiceProvider,
- @NonNull ODLEventListenerHandler odlEventListenerHandler, @NonNull DeviceMonitor deviceMonitor,
- @NonNull DeviceManagerServiceProvider serviceProvider, @NonNull List<NetworkElementFactory> factoryList) {
-
- HtAssert.nonnull(netconfNodeStateService, this.odlEventListenerHandler = odlEventListenerHandler,
- this.deviceMonitor = deviceMonitor, this.serviceProvider = serviceProvider,
- this.factoryList = factoryList, odlEventListenerHandler);
-
- /* Used for debug purpose */
- this.odlEventListenerHandlerEnabled = true;
- this.deviceMonitorEnabled = false;
-
- this.singleton = new OdlClusterSingleton(clusterSingletonServiceProvider);
- this.registerNetconfNodeStateListener = netconfNodeStateService.registerNetconfNodeStateListener(this);
-
- }
-
- @Override
- public void onCreated(NodeId nNodeId, NetconfNode netconfNode) {
- LOG.info("onCreated {}", nNodeId);
- if (isOdlEventListenerHandlerMaster()) {
- odlEventListenerHandler.registration(nNodeId.getValue(), netconfNode);
- }
- if (deviceMonitorEnabled) {
- deviceMonitor.deviceDisconnectIndication(nNodeId.getValue());
- }
- }
-
- @Override
- public void onStateChange(NodeId nNodeId, NetconfNode netconfNode) {
- LOG.info("onStateChange {}", nNodeId);
- if (isOdlEventListenerHandlerMaster()) {
- odlEventListenerHandler.onStateChangeIndication(nNodeId.getValue(), netconfNode);
- }
- }
-
- @Override
- public void onRemoved(NodeId nNodeId) {
- String mountPointNodeName = nNodeId.getValue();
- LOG.info("mountpointNodeRemoved {}", nNodeId.getValue());
-
- if (deviceMonitorEnabled) {
- deviceMonitor.removeMountpointIndication(mountPointNodeName);
- }
- if (isOdlEventListenerHandlerMaster()) {
- odlEventListenerHandler.deRegistration(mountPointNodeName); //Additional indication for log
- }
- }
-
- @Override
- public void close() {
- if (Objects.nonNull(registerNetconfNodeStateListener)) {
- registerNetconfNodeStateListener.close();
- }
- }
-
- /*--------------------------------------------
- * Private functions
- */
-
- private boolean isOdlEventListenerHandlerMaster() {
- return odlEventListenerHandlerEnabled && singleton.isMaster();
- }
-
- protected @NonNull DeviceManagerServiceProvider getServiceProvider() {
- return serviceProvider;
- }
-
- protected @NonNull List<NetworkElementFactory> getFactoryList() {
- return factoryList;
- }
-
-
- protected boolean isDeviceMonitorEnabled() {
- return deviceMonitorEnabled;
- }
-
- protected @NonNull DeviceMonitor getDeviceMonitor() {
- return deviceMonitor;
- }
-
- protected boolean isOdlEventListenerHandlerEnabled() {
- return odlEventListenerHandlerEnabled;
- }
-
- protected @NonNull ODLEventListenerHandler getOdlEventListenerHandler() {
- return odlEventListenerHandler;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/NetconfNodeService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/NetconfNodeService.java
deleted file mode 100644
index cc73fc791..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/NetconfNodeService.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;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-
-public interface NetconfNodeService {
-
- 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 netconfNodeChangeHandler(Action action, 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 82519e48b..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/ProviderClient.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.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/PushNotifications.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/PushNotifications.java
deleted file mode 100644
index f424878f8..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/PushNotifications.java
+++ /dev/null
@@ -1,30 +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.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushAttributeChangeNotificationInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInput;
-
-public interface PushNotifications {
-
- void pushAttributeChangeNotification(PushAttributeChangeNotificationInput input);
-
- void pushFaultNotification(PushFaultNotificationInput input);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalDateAndTime.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalDateAndTime.java
deleted file mode 100644
index 3a5224bbd..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalDateAndTime.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.impl.util;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-
-/**
- * Converts time stamps into internal format according to ONF1.2 and ISO 8601. To be replaced by NetconfTimeStampImpl
- */
-@Deprecated
-public class InternalDateAndTime {
-
- private static final String TESTPATTERNSTRING = "2017-01-01T00:00:00.0Z";
- private static final String INITIALPATTERN = "0000-00-00T00:00:00.0Z";
-
- private static final InternalDateAndTime TESTPATTERN = new InternalDateAndTime(TESTPATTERNSTRING);
- private static final DateAndTime TESTPATTERN2 = new DateAndTime(TESTPATTERNSTRING);
-
- private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStampImpl.getConverter();
-
- /** Internal variable to hold the value, that is converted **/
- private final String internalDateAndTime;
-
- /**
- * 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;
- }
-
- /**
- * Get a testpattern
- *
- * @return testpattern
- */
- public static InternalDateAndTime getTestpattern() {
- return TESTPATTERN;
- }
-
- /**
- * @return DateAndTime testpattern
- */
- public static @Nullable DateAndTime getTestpatternDateAndTime() {
- return TESTPATTERN2;
- }
-
- /*----------------------------------------------------------------
- * Private constructors
- */
-
- /**
- * 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;
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalSeverity.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalSeverity.java
deleted file mode 100644
index 3381d61b4..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/InternalSeverity.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==========================================================================
- */
-/**
- * @author herbert
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util;
-
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
-
-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";
- }
-
- public SeverityType toDataProviderSeverityType() {
- switch (this) {
- case NonAlarmed:
- return SeverityType.NonAlarmed;
- case Warning:
- return SeverityType.Warning;
- case Minor:
- return SeverityType.Minor;
- case Major:
- return SeverityType.Major;
- case Critical:
- return SeverityType.Critical;
- }
- return null; //Should never happen
- }
-
- // /**
- // * convert ONF 1.2 Severity
- // * @param severity as input
- // * @return String with related output
- // */
- public static InternalSeverity valueOf(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType severity) {
- switch (severity) {
- case NonAlarmed:
- return InternalSeverity.NonAlarmed;
- case Warning:
- return InternalSeverity.Warning;
- case Minor:
- return InternalSeverity.Minor;
- case Major:
- return InternalSeverity.Major;
- case Critical:
- return InternalSeverity.Critical;
- }
- return null;
- }
-
-
- public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType toYang(
- InternalSeverity severity) {
- switch (severity) {
- case NonAlarmed:
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.NonAlarmed;
- case Warning:
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Warning;
- case Minor:
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Minor;
- case Major:
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Major;
- case Critical:
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Critical;
- }
- return null;
- }
- public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType toYang(
- @Nullable SeverityType severity) {
- switch (severity) {
- case NonAlarmed:
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.NonAlarmed;
- case Warning:
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Warning;
- case Minor:
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Minor;
- case Major:
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Major;
- case Critical:
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.SeverityType.Critical;
- }
- return null;
- }
- //
- // /**
- // * convert ONF 1.2.1.1 Severity
- // * @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: warning minor major critical non[-]alarmed. (Capital or lowercase)
- * @return related enum. Unknown oe illegal are converted to NonAlarm
- */
- public static @Nullable InternalSeverity valueOfString(String severityString) {
-
- switch (severityString.toLowerCase().trim()) {
- case "warning":
- return InternalSeverity.Warning;
- case "minor":
- return InternalSeverity.Minor;
- case "major":
- return InternalSeverity.Major;
- case "critical":
- return InternalSeverity.Critical;
- }
- return InternalSeverity.NonAlarmed;
-
- }
-
- /**
- * Convert to InternalSeverity
- *
- * @param severity to be converted
- * @return InternalSeverity, null converted to NonAlarmed
- */
- public static InternalSeverity valueOf(@org.eclipse.jdt.annotation.Nullable SeverityType severity) {
- if (severity != null) {
- 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 InternalSeverity.NonAlarmed;
- }
-
-
-
-
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java
deleted file mode 100644
index 5b8105a07..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java
+++ /dev/null
@@ -1,93 +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.util;
-
-import javax.annotation.Nonnull;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InternalConnectionStatus;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.Credentials;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionLogStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.network.element.connection.entity.NodeDetailsBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("deprecation")
-public class NetworkElementConnectionEntitiyUtil {
-
- private static final Logger LOG = LoggerFactory.getLogger(NetworkElementConnectionEntitiyUtil.class);
-
- /**
- * Update devicetype and let all other field emptys
- *
- * @param deviceType that should be updated
- * @return NetworkElementConnectionEntity with related parameter
- */
- public static NetworkElementConnectionEntity getNetworkConnectionDeviceTpe(NetworkElementDeviceType deviceType) {
- NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder();
- eb.setDeviceType(deviceType);
- return eb.build();
- }
-
- /**
- * Provide device specific data
- *
- * @param nodeId mountpoint id
- * @param nNode data
- * @return NetworkElementConnectionEntity specific information
- */
- public static NetworkElementConnectionEntity getNetworkConnection(String nodeId, @Nonnull NetconfNode nNode) {
-
- NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder();
- // -- basics
- eb.setId(nodeId).setNodeId(nodeId).setDeviceType(NetworkElementDeviceType.Unknown).setIsRequired(false);
-
- // -- connection status
- ConnectionLogStatus status = InternalConnectionStatus.statusFromNodeStatus(nNode.getConnectionStatus());
- eb.setStatus(status);
-
- // -- capabilites
- Capabilities availableCapabilities = Capabilities.getAvailableCapabilities(nNode);
- Capabilities unAvailableCapabilities = Capabilities.getUnavailableCapabilities(nNode);
-
- NodeDetailsBuilder nodeDetails =
- new NodeDetailsBuilder().setAvailableCapabilities(availableCapabilities.getCapabilities())
- .setUnavailableCapabilities(unAvailableCapabilities.getCapabilities());
- eb.setNodeDetails(nodeDetails.build());
- // -- host information
- Host host = nNode.getHost();
- PortNumber portNumber = nNode.getPort();
- if (host != null && portNumber != null) {
- eb.setHost(host.stringValue()).setPort(portNumber.getValue().longValue());
- }
-
- Credentials credentials = nNode.getCredentials();
- if (credentials instanceof LoginPassword) {
- LoginPassword loginPassword = (LoginPassword) credentials;
- eb.setUsername(loginPassword.getUsername()).setPassword(loginPassword.getPassword());
- }
- eb.setCoreModelCapability("Unsupported"); // Default value. Specific value (if any) is set in the specific devicemanagers
- return eb.build();
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NotificationProxyParserImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NotificationProxyParserImpl.java
deleted file mode 100644
index 802c05d0c..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NotificationProxyParserImpl.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
- * All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util;
-
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.time.Instant;
-import java.util.HashMap;
-import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationProxyParser;
-import org.opendaylight.yangtools.concepts.Identifier;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.EventInstantAware;
-import org.opendaylight.yangtools.yang.binding.Identifiable;
-import org.opendaylight.yangtools.yang.binding.Notification;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NotificationProxyParserImpl implements NotificationProxyParser {
-
-
- /*
- * Converter of TR069 notifications to VES key, value hashmap.
- * Notifications are received as cascade if proxy object.
- * References: https://stackoverflow.com/questions/19633534/what-is-com-sun-proxy-proxy
- *
- * Attributes are provided by getters starting with "get", "is", "key".
- * Proxy received: "com.sun.proxy.$ProxyNN". NN is a number.
- *
- * Example result:
- *
- * Expected output via VES in JSON
- * {
- * "event": {
- * "commonEventHeader": {
- * "domain": "notification",
- * "eventId": "ABCD",
- * "eventName": "Notification_LTE_Enterprise_C-RANSC_Cntrl-ACME",
- * "eventType": "TR069_RAN_notification",
- * "sequence": 0,
- * "priority": "High",
- * "reportingEntityId": "0005B942CDB4",
- * "reportingEntityName": "ABCD",
- * "sourceId": "0005B942CDB4",
- * "sourceName": "ABCD",
- * "startEpochMicrosec": 1569579510211,
- * "lastEpochMicrosec": 1569579510211,
- * "nfcNamingCode": "",
- * "nfNamingCode": "",
- * "nfVendorName": "",
- * "timeZoneOffset": "+00:00",
- * "version": "4.0.1",
- * "vesEventListenerVersion": "7.0.1"
- * },
- * "notificationFields": {
- * "arrayOfNamedHashMap": [
- * {
- * "name": "VALUECHANGE",
- * "hashMap": {
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/device-info/serial-number": "0005B94238A0",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/device-info/software-version": "4.3.00.244",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/device-info/hardware-version": "1",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/device-info/provisioning-code": "",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/device-info/manufacturer": "ACME",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/device-info/product-class": "LTE_Enterprise_C-RANSC_Cntrl",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/device-info/manufacturer-oui": "0005B9",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/services/fap-service[1]/index": "1",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/services/fap-service[1]/fap-control/lte/rf-tx-status": "false",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/services/fap-service[1]/fap-control/lte/op-state": "true",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/services/fap-service[2]/index": "2",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/services/fap-service[2]/fap-control/lte/rf-tx-status": "false",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/services/fap-service[2]/fap-control/lte/op-state": "true",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/services/fap-service[2]/cell-config/lte/ran/rf/phy-cell-id": "201",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/management-server/connection-request-url": "http://10.220.68.2/acscall",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/management-server/parameter-key": "none",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/management-server/connection-request-password": "password",
- * "/notification/VALUECHANGE[@xmlns=\"urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notification\"]/device/management-server/connection-request-username": "0005B9-LTE_Enterprise_C-RANSC_Cntrl-0005B94238A0"
- * },
- * }
- * ],
- * "changeContact": "",
- * "changeIdentifier": "SessionID",
- * "changeType": "ValueChange",
- * "newState": "",
- * "oldState": "",
- * "stateInterface": "",
- * "notificationFieldsVersion": "2.0",
- * }
- * }
- * }
- *
- */
- private static final Logger log = LoggerFactory.getLogger(NotificationProxyParserImpl.class);
- private Notification notification;
-
- @Override
- public HashMap<String, String> parseNotificationProxy(Notification notification)
- /*throws ORanNotificationMapperException*/ {
-
- try {
- return extractFields(notification);
- } catch (IllegalArgumentException | SecurityException | NoSuchFieldException | IllegalAccessException
- | InvocationTargetException e) {
- //throw new ORanNotificationMapperException("Mapping/JSON Creation problem", e);
- log.info("Exception in performMapping method {}",e);
- return null;
- }
-
- }
-
- private HashMap<String, String> extractFields(Object o) throws IllegalAccessException, IllegalArgumentException,
- InvocationTargetException, NoSuchFieldException, SecurityException {
- String start = "/notification/" + getExtendedInterfaceName(Notification.class, o) + getXmlNameSpace(o);
- return recurseExtractData(o, start, 0, new HashMap<String, String>());
- }
-
- private HashMap<String, String> recurseExtractData(Object o, String namePath, int level,
- HashMap<String, String> result)
- throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- log.debug("In recurseExtractData - {} {} {}", namePath, level, log.isTraceEnabled() ? result : result.size());
- if (level > 20) {
- log.warn("Level to deep protection ended the recusive loop.");
- } else {
- if (o != null) {
- Class<?> classz = o.getClass();
- //notification/VALUECHANGE$$$eventInstantAware[@xmlns=urn:org:onap:ccsdk:features:sdnr:northbound:onecell-notificationon] 0 {}
- //org.opendaylight.yang.gen.v1.urn.org.onap.ccsdk.features.sdnr.northbound.onecell.notification.rev200622.VALUECHANGE$$$eventInstantAware
- //if (Proxy.isProxyClass(classz)) {
- handleInterface(classz, o, namePath, level, result);
- //}
- } else {
- log.warn("Null not expected here.");
- }
- }
- return result;
- }
-
- private void handleInterface(Class<?> clazz, Object o, String namePath, int level, HashMap<String, String> result)
- throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- log.debug("In extract Interface {}", clazz);
- if (clazz == null) {
- log.warn("Loop with null class");
- return;
- }
- if (level > 20) {
- log.warn("Level to deep protection ended the recusive loop.");
- }
- if (clazz.getName().contentEquals("org.opendaylight.mdsal.binding.dom.codec.impl.AugmentableCodecDataObject")) {
- log.trace("Leave AugmentableCodecDataObject");
- return;
- }
-
- Method[] methods = clazz.getDeclaredMethods();
- if (methods != null) {
- for (Method method : methods) {
- String methodName = method.getName();
- log.trace("Method {}", methodName);
- if (methodName.startsWith("get")) {
- if (!methodName.equals("getImplementedInterface")) {
- handleGetterValue(method, methodName.substring(3), namePath, o, level, result);
- }
- } else if (methodName.startsWith("is")) {
- handleGetterValue(method, methodName.substring(2), namePath, o, level, result);
- } else if (methodName.equals("key")) {
- handleGetterValue(method, methodName, namePath, o, level, result);
- }
- }
- }
- Class<?> sc = clazz.getSuperclass(); //Sodium
- log.trace("Superclass is - {}", sc);
- if (sc != null && !(sc.getName().contains("java.lang.reflect.Proxy")) && !Proxy.isProxyClass(sc)) {
- handleInterface(sc, o, namePath, level + 1, result);
- }
- }
-
- private void handleGetterValue(Method method, String name, String namePath, Object o, int level,
- HashMap<String, String> result)
- throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- log.debug("Begin: {}-{}-{}-{}", method.getName(), name, namePath, level);
- if (!method.isAccessible()) {
- method.setAccessible(true);
- }
- Object value = method.invoke(o);
- namePath += "/" + convertCamelToKebabCase(name);
- log.trace("Namepath {}", namePath);
- if (value != null) {
- Class<?> type = value.getClass();
- log.trace("Class {}", type.getSimpleName());
- if (List.class.isAssignableFrom(type)) {
- int idx = 0;
- String keyString;
- for (Object listObject : (List<?>) value) {
- if (listObject != null) {
- if (Identifiable.class.isAssignableFrom(listObject.getClass())) {
- keyString = getKeyString((Identifiable<?>) listObject);
- } else {
- keyString = String.valueOf(idx);
- }
- recurseExtractData(listObject, namePath + "[" + keyString + "]", level + 1, result);
- } else {
- log.warn("Null value received {} {} {}", namePath, idx, name);
- }
- idx++;
- }
- } else if (DataObject.class.isAssignableFrom(type)) {
- recurseExtractData(value, namePath, level + 1, result);
- } else if (Proxy.isProxyClass(type)) {
- recurseExtractData(value, namePath, level + 1, result);
- } else if (Identifier.class.isAssignableFrom(type)) {
- //don't put the key
- } else {
- result.put(namePath, value.toString());
- }
- } else {
- log.trace("Null value");
- }
- }
-
- private String getExtendedInterfaceName(Class<?> assignableClazz, Object o) {
- Class<?> interfaces[] = o.getClass().getInterfaces();
- for (Class<?> oneInterface : interfaces) {
- log.trace("In getExtendedInterfaceName, oneInterface = {}", oneInterface.getClass().getName());
- if (assignableClazz.isAssignableFrom(oneInterface)) {
- return oneInterface.getSimpleName().contains("eventInstantAware")?oneInterface.getSimpleName().substring(0, oneInterface.getSimpleName().indexOf("$")):oneInterface.getSimpleName();
- }
- }
- log.trace("In getExtendedInterfaceName, o.getClass().getName() = {}", o.getClass().getName());
- return o.getClass().getSimpleName().contains("eventInstantAware")?o.getClass().getSimpleName().substring(0, o.getClass().getSimpleName().indexOf("$")):o.getClass().getSimpleName();
- }
-
- private String getXmlNameSpace(Object o)
- throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- Field f = o.getClass().getField("QNAME");
- Object couldQName = f.get(o);
- if (couldQName instanceof QName) {
- QName qname = (QName) couldQName;
- return "[@xmlns=" + qname.getNamespace().toString() + "]";
- }
- return "";
- }
-
- /*private String convertCamelToKebabCase(String camel) {
- KebabCaseStrategy kbCase = new KebabCaseStrategy();
- return kbCase.translate(camel);
- //return camel.replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase();
- } */
-
- /**
- * @param input string in Camel Case
- * @return String in Kebab case
- * Inspiration from KebabCaseStrategy class of com.fasterxml.jackson.databind with an additional condition to handle numbers as well
- * Using QNAME would have been a more fool proof solution, however it can lead to performance problems due to usage of Java reflection
- */
- private String convertCamelToKebabCase(String input)
- {
- if (input == null) return input; // garbage in, garbage out
- int length = input.length();
- if (length == 0) {
- return input;
- }
-
- StringBuilder result = new StringBuilder(length + (length >> 1));
-
- int upperCount = 0;
-
- for (int i = 0; i < length; ++i) {
- char ch = input.charAt(i);
- char lc = Character.toLowerCase(ch);
-
- if (lc == ch) { // lower-case letter means we can get new word
- // but need to check for multi-letter upper-case (acronym), where assumption
- // is that the last upper-case char is start of a new word
- if ((upperCount > 1) ){
- // so insert hyphen before the last character now
- result.insert(result.length() - 1, '-');
- } else if ((upperCount == 1) && Character.isDigit(ch) && i != length-1) {
- result.append('-');
- }
- upperCount = 0;
- } else {
- // Otherwise starts new word, unless beginning of string
- if ((upperCount == 0) && (i > 0)) {
- result.append('-');
- }
- ++upperCount;
- }
- result.append(lc);
- }
- return result.toString();
- }
-
- /**
- * Key format like this: "FapServiceKey{_index=2}"
- *
- * @return
- */
- private String getKeyString(Identifiable<?> indentifiableObject) {
- String keyString = (indentifiableObject.key()).toString();
- int start = keyString.indexOf("=") + 1;
- int end = keyString.length() - 1;
- if (start > 0 && start < end)
- return keyString.substring(keyString.indexOf("=") + 1, keyString.length() - 1);
- else
- throw new IllegalArgumentException("indentifiable object without key");
- }
-
- public Instant getTime(Notification notification) {
- @NonNull
- Instant time;
- if (notification instanceof EventInstantAware) { // If notification class extends/implements the EventInstantAware
- time = ((EventInstantAware) notification).eventInstant();
- log.info("Event time {}", time);
- } else {
- time = Instant.now();
- log.info("Defaulting to actual time of processing the notification - {}", time);
- }
- return time;
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/OdlClusterSingleton.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/OdlClusterSingleton.java
deleted file mode 100644
index 49c04016a..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/OdlClusterSingleton.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util;
-
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
-import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class OdlClusterSingleton implements ClusterSingletonService, AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(OdlClusterSingleton.class);
- private final @NonNull ServiceGroupIdentifier ident;
- private final ClusterSingletonServiceRegistration cssRegistration;
- private volatile boolean master;
-
- @SuppressWarnings("null")
- public OdlClusterSingleton(ClusterSingletonServiceProvider clusterSingletonServiceProvider) {
- this.ident = ServiceGroupIdentifier.create("ODLEventListenerHandler");
- this.cssRegistration = clusterSingletonServiceProvider.registerClusterSingletonService(this);
- this.master = false;
- }
-
- @Override
- public @NonNull ServiceGroupIdentifier getIdentifier() {
- return ident;
- }
-
- @Override
- public void instantiateServiceInstance() {
- LOG.debug("We take Leadership");
- this.master = true;
- }
-
- @Override
- public ListenableFuture<? extends Object> closeServiceInstance() {
- LOG.debug("We lost Leadership");
- this.master = false;
- return Futures.immediateFuture(null);
- }
-
- public boolean isMaster() {
- return master;
- }
-
- @Override
- public void close() throws Exception {
- if (cssRegistration != null) {
- cssRegistration.close();
- }
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/FaultEntityManager.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/FaultEntityManager.java
deleted file mode 100644
index 785f5dbab..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/FaultEntityManager.java
+++ /dev/null
@@ -1,94 +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.regex.Matcher;
-import java.util.regex.Pattern;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Fault;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultcurrentEntity;
-
-public class FaultEntityManager {
-
- 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 = "#";
-
- /**
- * Specific problems are not moving into current problem list
- *
- * @param problemName to be verified
- * @return true if problem is current
- */
- public static boolean isManagedAsCurrentProblem(String problemName) {
- return !problemName.startsWith(NOCURRENTPROBLEMINDICATION);
- }
-
- public static boolean isManagedAsCurrentProblem(Fault problem) {
- return isManagedAsCurrentProblem(problem.getProblem());
- }
-
- /**
- * Specific problems are not moving into current problem list
- *
- * @param fault to be verified
- * @return true if cleared indication
- */
- public static boolean isNoAlarmIndication(Fault fault) {
- InternalSeverity severity = InternalSeverity.valueOf(fault.getSeverity());
- return severity.isNoAlarmIndication();
- }
-
- /**
- * Create a specific ES id for the current log.
- *
- * @return a string with the generated ES Id
- */
- public static String genSpecificEsId(String nodeName, String objectId, String problemName) {
-
- String uuId;
-
- Matcher matcher = pattern.matcher(objectId);
- if (matcher.matches() && matcher.groupCount() == 1) {
- uuId = matcher.group(1);
- } else {
- uuId = objectId;
- }
-
- StringBuffer strBuf = new StringBuffer();
- strBuf.append(nodeName);
- strBuf.append("/");
- strBuf.append(uuId);
- strBuf.append("/");
- strBuf.append(problemName);
- return strBuf.toString();
- }
-
- /**
- * Create Es id
- *
- * @param fault used to create uuid for faultcurrent
- * @return String with Id
- */
- public static String genSpecificEsId(FaultcurrentEntity fault) {
- return genSpecificEsId(fault.getNodeId(), fault.getObjectId(), fault.getProblem());
- }
-}
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 a70777b63..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 de7ccc31c..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/MwtNotificationBase.java
+++ /dev/null
@@ -1,88 +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.annotation.Nonnull;
-import javax.xml.bind.annotation.XmlElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
-
-@Deprecated
-public class MwtNotificationBase {
-
- private static String EMPTY = "empty";
-
- private String nodeName;
- private String counter;
- private String timeStamp;
- private @Nonnull String objectId;
-
- public MwtNotificationBase() {
- // For Jaxb
- this.objectId = EMPTY;
- }
-
- public MwtNotificationBase(String nodeName, Integer counter, InternalDateAndTime timeStamp, String objectId) {
- this.nodeName = nodeName;
- this.counter = String.valueOf(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/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 33db3baed..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/ProblemNotificationXml.java
+++ /dev/null
@@ -1,161 +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 javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.ToggleAlarmFilterable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Faultcurrent;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultcurrentBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Faultlog;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
-import org.slf4j.Logger;
-
-@Deprecated
-@XmlRootElement(name = "ProblemNotification")
-public class ProblemNotificationXml extends MwtNotificationBase implements GetEventType, ToggleAlarmFilterable {
-
- private static String EVENTTYPE = "ProblemNotification";
-
- @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 counter Counter from device
- * @param internaltimeStampString Timestamp according to internal format.
- */
- public ProblemNotificationXml(String nodeName, String uuId, String problemNameString,
- InternalSeverity problemSeverityString, Integer counter, InternalDateAndTime internaltimeStampString) {
- super(nodeName, counter, internaltimeStampString, uuId);
- this.problem = problemNameString;
- this.severity = problemSeverityString;
- }
-
- public ProblemNotificationXml(FaultlogEntity input) {
- this(input.getNodeId(), input.getObjectId(), input.getProblem(), InternalSeverity.valueOf(input.getSeverity()),
- input.getCounter(), InternalDateAndTime.valueOf(input.getTimestamp()));
- }
-
- public String getProblem() {
- return problem;
- }
-
- public InternalSeverity getSeverity() {
- return severity;
- }
-
- public boolean isNotManagedAsCurrentProblem() {
- return !FaultEntityManager.isManagedAsCurrentProblem(getProblem());
- }
-
- public boolean isNoAlarmIndication() {
- return severity.isNoAlarmIndication();
- }
-
- @Override
- public String getUuidForMountpoint() {
- return genSpecificEsId();
- }
-
- @Override
- public boolean isCleared() {
- return !isNotManagedAsCurrentProblem() && isNoAlarmIndication();
- }
-
-
- /**
- * Create a specific ES id for the current log.
- *
- * @return a string with the generated ES Id
- */
- @JsonIgnore
- public String genSpecificEsId() {
- return FaultEntityManager.genSpecificEsId(getNodeName(), getObjectId(), getProblem());
- }
-
- @JsonIgnore
- public Faultlog getFaultlog(SourceType sourceType) {
- return new FaultlogBuilder().setNodeId(getNodeName()).setCounter(Integer.parseInt(getCounter()))
- .setObjectId(getObjectId()).setProblem(getProblem()).setSourceType(sourceType)
- .setSeverity(getSeverity().toDataProviderSeverityType()).setTimestamp(new DateAndTime(getTimeStamp()))
- .build();
- }
-
- @JsonIgnore
- public Faultcurrent getFaultcurrent() {
- return new FaultcurrentBuilder().setNodeId(getNodeName()).setCounter(Integer.parseInt(getCounter()))
- .setObjectId(genSpecificEsId()).setProblem(getProblem())
- .setSeverity(getSeverity().toDataProviderSeverityType()).setTimestamp(new DateAndTime(getTimeStamp()))
- .build();
- }
-
- @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 log of logger
- * @param uuid as log info
- * @param resultList with all problems
- * @param idxStart start of listing till end
- */
- 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/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 6cf984b11..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.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
- *
- * 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.eclipse.jdt.annotation.NonNull;
-import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yangtools.yang.binding.Notification;
-import org.opendaylight.yangtools.yang.common.QName;
-
-/**
- * Wrapper for forwarding web-socket notifications to the web-socket service, that is running as bundle.
- */
-public class WebSocketServiceClientImpl implements WebSocketServiceClientInternal {
-
-// private static final Logger LOG = LoggerFactory.getLogger(ODLEventListenerHandler.class);
-
- private final WebsocketManagerService websocketmanagerService;
-
- /**
- * New: Implementation of Websocket notification processor.
- *
- * @param websocketmanagerService2 to be used
- */
- public WebSocketServiceClientImpl(WebsocketManagerService websocketmanagerService2) {
- super();
- this.websocketmanagerService = websocketmanagerService2;
- }
-
-
-
- @Override
- public void close() throws Exception {}
-
-
-
- @Override
- public void sendViaWebsockets(@NonNull String nodeName, Notification notification, QName qname,
- DateAndTime timestamp) {
- this.websocketmanagerService.sendNotification(notification, nodeName, qname, timestamp);
-
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.java
deleted file mode 100644
index 83fbd5c7d..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.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.impl.xml;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yangtools.yang.binding.Notification;
-import org.opendaylight.yangtools.yang.common.QName;
-
-/**
- * Wrapper for forwarding websocket notifications to the websocket service, that is running as container.
- *
- * @author herbert
- */
-public interface WebSocketServiceClientInternal extends AutoCloseable {
-
- public void sendViaWebsockets(@NonNull String nodeName,Notification notification, QName qname, DateAndTime timestamp);
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/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 8856d30ed..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/impl/MaintenanceCalculator.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceCalculator.java
deleted file mode 100644
index 23ff50fb9..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceCalculator.java
+++ /dev/null
@@ -1,149 +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.Instant;
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.time.format.DateTimeParseException;
-import javax.annotation.Nonnull;
-
-import org.onap.ccsdk.features.sdnr.wt.common.HtAssert;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.MaintenanceEntity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MaintenanceCalculator {
-
- private static final Logger LOG = LoggerFactory.getLogger(MaintenanceCalculator.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);
-
- /** Intended to be used static **/
- private MaintenanceCalculator() {}
-
- /**
- * Verify maintenance status
- *
- * @param maintenance if null false, else according to settings
- * @param objectIdRef NETCONF object id
- * @param problem name that was provided
- * @param now time to verify with
- * @return true if in maintenance status
- */
- public static boolean isONFObjectInMaintenance(MaintenanceEntity maintenance, String objectIdRef, String problem,
- ZonedDateTime now) {
-
- if (maintenance != null) {
- Boolean isActive = maintenance.isActive();
- if (isActive != null && isActive && isInMaintenance(maintenance, objectIdRef, problem, now)) {
- return true;
- }
-
- }
- return false;
- }
-
- /** Shortcut **/
- public static boolean isONFObjectInMaintenance(MaintenanceEntity maintenance, String objectIdRef, String problem) {
- return isONFObjectInMaintenance(maintenance, objectIdRef, problem, getNow());
- }
-
- /*---------------------------------------------
- * private static helper functions to verify
- */
-
- /**
- * Get the actual time in the Filter time zone.
- *
- * @return actual Time
- */
- private 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
- */
- private static boolean isInMaintenance(MaintenanceEntity maintenance, String objectIdRef, String problem,
- ZonedDateTime now) {
- return appliesToObjectReference(maintenance, objectIdRef, problem)
- && isInPeriod(maintenance.getStart(), maintenance.getEnd(), now);
- }
-
- /**
- * 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(DateAndTime start, DateAndTime end, ZonedDateTime probe) {
- HtAssert.nonnull(start, end, probe);
- ZonedDateTime startZT = valueOf(start.getValue());
- ZonedDateTime endZT = valueOf(end.getValue());
- return startZT.compareTo(endZT) < 0 && startZT.compareTo(probe) <= 0 && endZT.compareTo(probe) >= 0;
- }
-
- /**
- * Verify if the definied object is matching to the referenced object
- *
- * @param definition definition with parameters
- * @param pObjectIdRef object-id-ref of fault notification
- * @param pProblem problem of fault notification
- * @return true if if referenced
- */
- private static boolean appliesToObjectReference(@Nonnull MaintenanceEntity definition, @Nonnull String pObjectIdRef,
- @Nonnull String pProblem) {
- HtAssert.nonnull(definition, pObjectIdRef, pProblem);
- boolean res = (definition.getObjectIdRef() == null || pObjectIdRef.contains(definition.getObjectIdRef()))
- && (definition.getProblem() == null || pProblem.contains(definition.getProblem()));
- LOG.debug("Check result applies {}: {} {} against: {}", res, pObjectIdRef, pProblem, definition);
- return res;
- }
-
- /**
- * 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/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 7dad49e01..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/maintenance/impl/MaintenanceServiceImpl.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.maintenance.impl;
-
-import java.time.ZonedDateTime;
-import java.util.ArrayList;
-import java.util.List;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMaintenance;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceRPCServiceAPI;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.MaintenanceService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.MaintenanceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.MaintenanceEntity;
-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);
-
- private final HtDatabaseMaintenance database;
-
- public MaintenanceServiceImpl(HtDatabaseMaintenance client) {
-
- LOG.info("Create {} start", MaintenanceServiceImpl.class);
- database = client;
- LOG.info("Create {} finished. DB Service {} started.", MaintenanceServiceImpl.class,
- client != null ? "sucessfully" : "not");
-
- }
-
- @Override
- public void createIfNotExists(String mountPointNodeName) {
- database.createIfNotExists(mountPointNodeName);
- }
-
- @Override
- public void deleteIfNotRequired(String mountPointNodeName) {
- database.deleteIfNotRequired(mountPointNodeName);
- }
-
- /*-------------------------------------------------
- * Interface AutoClosable
- */
-
- @Override
- public void close() throws Exception {}
-
- /*-------------------------------------------------
- * Interface MaintenanceRPCServiceAPI
- */
-
- @Override
- public GetRequiredNetworkElementKeysOutputBuilder getRequiredNetworkElementKeys() {
- List<MaintenanceEntity> all = database.getAll();
-
- List<String> mountpointList = new ArrayList<>();
- for (MaintenanceEntity oneOfAll : all) {
- mountpointList.add(oneOfAll.getNodeId());
-
- }
- GetRequiredNetworkElementKeysOutputBuilder outputBuilder = new GetRequiredNetworkElementKeysOutputBuilder();
- outputBuilder.setMountpointNames(mountpointList);
- return outputBuilder;
- }
-
- @Override
- public ShowRequiredNetworkElementOutputBuilder showRequiredNetworkElement(ShowRequiredNetworkElementInput input) {
- ShowRequiredNetworkElementOutputBuilder outputBuilder = new ShowRequiredNetworkElementOutputBuilder();
- MaintenanceEntity maintenanceMode = database.getMaintenance(input.getMountpointName());
- if (maintenanceMode != null) {
- RequiredNetworkElementBuilder valueBuilder = new RequiredNetworkElementBuilder();
-
- valueBuilder.setMountpointName(maintenanceMode.getNodeId());
- valueBuilder
- .setStatus(String.valueOf(MaintenanceCalculator.isONFObjectInMaintenance(maintenanceMode, "", "")));
- 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) {
-
- GetMaintenanceModeOutputBuilder outputBuilder;
- MaintenanceEntity maintenanceMode = database.getMaintenance(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();
- MaintenanceBuilder mb = new MaintenanceBuilder(input);
- MaintenanceEntity m = mb.build();
- database.setMaintenance(m);
- return outputBuilder;
-
- }
-
- @Override
- public TestMaintenanceModeOutputBuilder testMaintenanceMode(TestMaintenanceModeInput input) {
-
- StringBuffer resultString = new StringBuffer();
-
- MaintenanceEntity maintenanceMode = database.getMaintenance(input.getMountpointName());
-
- ZonedDateTime now = MaintenanceCalculator.valueOf(input.getTestDate());
-
- resultString.append("In database table: ");
- resultString.append(maintenanceMode != null);
- resultString.append(" Maintenance active: ");
- resultString.append(MaintenanceCalculator.isONFObjectInMaintenance(maintenanceMode, input.getObjectIdRef(),
- input.getProblemName(), now));
- resultString.append(" at Timestamp: ");
- resultString.append(now);
- TestMaintenanceModeOutputBuilder outputBuilder =
- maintenanceMode != null ? new TestMaintenanceModeOutputBuilder(maintenanceMode)
- : new TestMaintenanceModeOutputBuilder();
- outputBuilder.setResultString(resultString.toString());
- return outputBuilder;
-
- }
-
- /*-------------------------------------------------
- * Interface MaintenaceService
- */
-
- @Override
- public boolean isONFObjectInMaintenance(String mountpointReference, String objectIdRef, String problem) {
- MaintenanceEntity maintenanceMode = database.getMaintenance(mountpointReference);
- boolean res = MaintenanceCalculator.isONFObjectInMaintenance(maintenanceMode, 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/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 22098675b..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerImpl.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.performancemanager.impl;
-
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.config.PmConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.PerformanceManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PerformanceManagerImpl implements PerformanceManager, AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(PerformanceManagerImpl.class);
-
- private PerformanceManagerTask task;
-
- public PerformanceManagerImpl(long seconds, NetconfNetworkElementService netconfNetworkElementService,
- DataProvider microwaveHistoricalPerformanceWriterService, ConfigurationFileRepresentation config) {
-
- LOG.info("Construct {}", PerformanceManagerImpl.class.getSimpleName());
-
- this.task = null;
- PmConfig configurationPM = new PmConfig(config);
- LOG.info("Performance manager configuration: {}", configurationPM);
-
- if (!configurationPM.isPerformanceManagerEnabled()) {
- LOG.info("Don't start performance manager");
-
- } else {
- LOG.info("{} Seconds", seconds);
- LOG.info("Start of PM task");
- task = new PerformanceManagerTask(seconds, microwaveHistoricalPerformanceWriterService,
- netconfNetworkElementService);
- task.start();
- LOG.info("PM task scheduled");
- }
-
- LOG.info("Construct end {}", PerformanceManagerImpl.class.getSimpleName());
- }
-
- @Override
- public void close() {
- LOG.info("Close {}", PerformanceManagerImpl.class.getSimpleName());
- if (task != null) {
- task.stop();
- }
- }
-
- @Override
- public void registration(String mountPointNodeName, NetworkElement ne) {
- LOG.debug("Register {}", mountPointNodeName);
- if (task != null) {
- task.registration(mountPointNodeName, ne);
- }
- }
-
- @Override
- 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 8fe6b9565..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/PerformanceManagerTask.java
+++ /dev/null
@@ -1,250 +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.Optional;
-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.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.PerformanceDataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp;
-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, PerformanceDataProvider> queue = new ConcurrentHashMap<>();
- private final DataProvider databaseService;
- private final ScheduledExecutorService scheduler;
- private final long seconds;
-
- private ScheduledFuture<?> taskHandle = null;
- private Iterator<PerformanceDataProvider> neIterator = null;
- private PerformanceDataProvider actualNE = null;
- private final NetconfNetworkElementService netconfNetworkElementService;
-
- /**
- * Constructor of PM Task
- *
- * @param seconds seconds to call PM Task
- * @param microwaveHistoricalPerformanceWriterService DB Service to load PM data to
- * @param netconfNetworkElementService to write into log
- */
-
- public PerformanceManagerTask(long seconds, DataProvider microwaveHistoricalPerformanceWriterService,
- NetconfNetworkElementService netconfNetworkElementService) {
-
- LOG.debug("Init task {}", PerformanceManagerTask.class.getSimpleName());
- this.seconds = seconds;
- this.databaseService = microwaveHistoricalPerformanceWriterService;
- this.scheduler = Executors.newSingleThreadScheduledExecutor();
- this.netconfNetworkElementService = netconfNetworkElementService;
-
- }
-
- /**
- * 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, NetworkElement ne) {
-
- Optional<PerformanceDataProvider> oPmNe = ne.getService(PerformanceDataProvider.class);
- if (oPmNe.isPresent()) {
- queue.put(mountPointNodeName, oPmNe.get());
- }
- }
-
- /**
- * Remove mountpoint/NE from PM process
- *
- * @param mountPointNodeName that has to be removed
- */
- public void deRegistration(String mountPointNodeName) {
- LOG.debug("Deregister {}", mountPointNodeName);
- PerformanceDataProvider 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() {
-
- String mountpointName = "No NE";
- if (actualNE != null && actualNE.getAcessor().isPresent()) {
- mountpointName = actualNE.getAcessor().get().getNodeId().getValue();
- }
- LOG.debug("{} start {} Start with mountpoint {}", LOGMARKER, tickCounter, mountpointName);
-
- //Proceed to next NE/Interface
- getNextInterface(mountpointName);
-
- LOG.debug("{} {} Next interface to handle {}", LOGMARKER, tickCounter,
- actualNE == null ? "No NE/IF" : actualNE.pmStatusToString());
-
- if (actualNE != null) {
- try {
- LOG.debug("{} Start to read PM from NE ({})", LOGMARKER, tickCounter);
- Optional<PerformanceDataLtp> allPm = actualNE.getLtpHistoricalPerformanceData();
- if (allPm.isPresent()) {
- LOG.debug("{} {} Got PM list. Start write to DB", LOGMARKER, tickCounter);
- databaseService.doWritePerformanceData(allPm.get().getList());
- }
- LOG.debug("{} {} PM List end.", LOGMARKER, tickCounter);
- } catch (Exception e) {
- StringBuffer msg = new StringBuffer();
- msg.append(e.getMessage());
- msg.append(" - ");
- msg.append(e.getCause().toString());
- msg.append(" - ");
- msg.append(actualNE.pmStatusToString());
- String msgString = msg.toString();
- LOG.warn("{} {} PM read/write failed. Write log entry {}", LOGMARKER, tickCounter, msgString);
- netconfNetworkElementService.writeToEventLog(mountpointName, "PM Problem", msgString);
- }
- }
-
- 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(String mountpointName) {
- 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" : mountpointName, 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/config/PmConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/config/PmConfig.java
deleted file mode 100644
index bbe854339..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/config/PmConfig.java
+++ /dev/null
@@ -1,54 +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.config;
-
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-
-public class PmConfig implements Configuration {
-
- private static final String SECTION_MARKER_PM = "pm";
-
- private static final String PROPERTY_KEY_ENABLED = "pmEnabled";
- private static final String DEFAULT_VALUE_ENABLED = String.valueOf(true);
-
-
- private final ConfigurationFileRepresentation configuration;
-
- public PmConfig(ConfigurationFileRepresentation configuration) {
- this.configuration = configuration;
- this.configuration.addSection(SECTION_MARKER_PM);
- defaults();
- }
-
- public boolean isPerformanceManagerEnabled() {
- return configuration.getPropertyBoolean(SECTION_MARKER_PM, PROPERTY_KEY_ENABLED);
- }
-
- @Override
- public String getSectionName() {
- return SECTION_MARKER_PM;
- }
-
- @Override
- public void defaults() {
- //Add default if not available
- configuration.setPropertyIfNotAvailable(SECTION_MARKER_PM, PROPERTY_KEY_ENABLED, DEFAULT_VALUE_ENABLED);
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/DevicemanagerNotificationDelayService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/DevicemanagerNotificationDelayService.java
deleted file mode 100644
index 5157aad53..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/DevicemanagerNotificationDelayService.java
+++ /dev/null
@@ -1,34 +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.toggleAlarmFilter;
-
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerService;
-
-/**
- * Devicemanager service
- */
-public class DevicemanagerNotificationDelayService extends NotificationDelayService<ProblemNotificationXml>
- implements DeviceManagerService {
-
- public DevicemanagerNotificationDelayService(ConfigurationFileRepresentation htconfig) {
- super(htconfig);
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayFilter.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayFilter.java
deleted file mode 100644
index fd288c3c0..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayFilter.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.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.eclipse.jdt.annotation.NonNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NotificationDelayFilter<T extends ToggleAlarmFilterable> implements AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(NotificationDelayFilter.class);
-
- private static long delay;
- private static boolean enabled;
-
- private final ConcurrentHashMap<String, NotificationWithServerTimeStamp<T>> problemItems;
- // private final HashMap<String, NotificationWithServerTimeStamp<T>> nonProblemItems;
- private final NotificationDelayedListener<T> timeoutListener;
-
- 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();
- }
-
- 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;
- }
-
- /**
- * If process the notification
- *
- * @return true if other processing is required, false if not
- */
- public boolean processNotification(@NonNull T notificationXml) {
- // ToggleAlarmFilter functionality
- if (NotificationDelayFilter.isEnabled()) {
- if (notificationXml.isCleared()) {
- clearAlarmNotification(notificationXml);
- } else {
- pushAlarmNotification(notificationXml);
- }
- return false;
- } else {
- return true;
- }
- // end of ToggleAlarmFilter
- }
-
- /**
- * Push notification with a specific severity (everything except non-alarmed)
- *
- * @param notification related notification
- */
- public void pushAlarmNotification(@NonNull T notification) {
- synchronized (problemItems) {
- String problemName = notification.getUuidForMountpoint();
- 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(this.nodeName, 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 notification related notification
- */
- public void clearAlarmNotification(@NonNull T notification) {
- synchronized (problemItems) {
- String problemName = notification.getUuidForMountpoint();
- 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(this.nodeName, 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(this.nodeName,
- 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/toggleAlarmFilter/NotificationDelayService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayService.java
deleted file mode 100644
index 01cfcc5fc..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayService.java
+++ /dev/null
@@ -1,71 +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.toggleAlarmFilter;
-
-import java.util.HashMap;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.conf.ToggleAlarmConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NotificationDelayService<T extends ToggleAlarmFilterable>
- implements DeviceManagerService, AutoCloseable, IConfigChangedListener {
- private static final Logger LOG = LoggerFactory.getLogger(NotificationDelayService.class);
-
- private final HashMap<String, NotificationDelayFilter<T>> filters;
- private final ToggleAlarmConfig config;
-
- public NotificationDelayService(ConfigurationFileRepresentation htconfig) {
- this.filters = new HashMap<>();
- htconfig.registerConfigChangedListener(this);
- config = new ToggleAlarmConfig(htconfig);
- onConfigChanged();
- }
-
- 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;
- }
-
- @Override
- public void onConfigChanged() {
- if (config != null) {
- NotificationDelayFilter.setDelay(config.getDelay());
- NotificationDelayFilter.setEnabled(config.isEnabled());
- } else {
- LOG.error("Can not process configuration change");
- }
- }
-
- @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/toggleAlarmFilter/NotificationDelayedListener.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayedListener.java
deleted file mode 100644
index 26402b28b..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/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.toggleAlarmFilter;
-
-public interface NotificationDelayedListener<T> {
-
- public void onNotificationDelay(String nodeName, T notification);
-
-}
-
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationWithServerTimeStamp.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationWithServerTimeStamp.java
deleted file mode 100644
index 8e1bf9189..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/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.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/toggleAlarmFilter/ToggleAlarmFilterable.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/ToggleAlarmFilterable.java
deleted file mode 100644
index 0231201e1..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/ToggleAlarmFilterable.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.toggleAlarmFilter;
-
-/**
- * @author herbert
- *
- */
-public interface ToggleAlarmFilterable {
-
-
- /** Provide id for toggle alarm filter that is unique for the mountpoint/nodeId **/
- String getUuidForMountpoint();
-
- /** Provide indication if cleared **/
- boolean isCleared();
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/conf/ToggleAlarmConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/conf/ToggleAlarmConfig.java
deleted file mode 100644
index 3450e8c3b..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/conf/ToggleAlarmConfig.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.toggleAlarmFilter.conf;
-
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-
-public class ToggleAlarmConfig implements Configuration {
-
- 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 final ConfigurationFileRepresentation configuration;
-
- public ToggleAlarmConfig(ConfigurationFileRepresentation configuration) {
- this.configuration = configuration;
- this.configuration.addSection(SECTION_MARKER_TA);
- defaults();
- }
-
- public boolean isEnabled() {
- return configuration.getPropertyBoolean(SECTION_MARKER_TA, PROPERTY_KEY_ENABLED);
- }
-
- public long getDelay() {
- return configuration.getPropertyLong(SECTION_MARKER_TA, PROPERTY_KEY_DELAY).orElse(DEFAULT_VALUE_DELAY);
- }
-
- @Override
- public String getSectionName() {
- return SECTION_MARKER_TA;
- }
-
- @Override
- public void defaults() {
- //Add default if not available
- configuration.setPropertyIfNotAvailable(SECTION_MARKER_TA, PROPERTY_KEY_ENABLED, DEFAULT_VALUE_ENABLED);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER_TA, PROPERTY_KEY_DELAY, DEFAULT_VALUE_DELAY);
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorServiceImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorServiceImpl.java
deleted file mode 100644
index 47ac9c785..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorServiceImpl.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
- * All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.vescollectorconnector.impl;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Base64;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.jdt.annotation.NonNull;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPClient;
-import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPResponse;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.NotificationProxyParserImpl;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationProxyParser;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorConfigChangeListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESFaultFieldsPOJO;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESMessage;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESNotificationFieldsPOJO;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESPNFRegistrationFieldsPOJO;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.vescollectorconnector.impl.config.VESCollectorCfgImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class VESCollectorServiceImpl implements VESCollectorService, IConfigChangedListener, AutoCloseable {
- private static final Logger LOG = LoggerFactory.getLogger(VESCollectorServiceImpl.class);
- private final VESCollectorCfgImpl vesConfig;
- private final ConfigurationFileRepresentation cfg;
- private BaseHTTPClient httpClient;
- private final Map<String, String> headerMap;
- private List<VESCollectorConfigChangeListener> registeredObjects;
- private final ObjectMapper objMapper;
-
-
- public VESCollectorServiceImpl(ConfigurationFileRepresentation config) {
- registeredObjects = new ArrayList<VESCollectorConfigChangeListener>();
- this.vesConfig = new VESCollectorCfgImpl(config);
- this.cfg = config;
- this.cfg.registerConfigChangedListener(this);
- this.objMapper = new ObjectMapper();
-
- httpClient = new BaseHTTPClient(getBaseUrl(), this.vesConfig.isTrustAllCerts());
-
- this.headerMap = new HashMap<>();
- this.headerMap.put("Content-Type", "application/json");
- this.headerMap.put("Accept", "application/json");
-
- setAuthorization(getConfig().getUsername(), getConfig().getPassword());
- }
-
- @Override
- public VESCollectorCfgImpl getConfig() {
- return this.vesConfig;
- }
-
- public String getBaseUrl() {
- LOG.debug("IP Address is - {}", getConfig().getIP());
- if (!getConfig().getTLSEnabled()) {
- return "http://" + getConfig().getIP() + ":" + getConfig().getPort();
- } else {
- return "https://" + getConfig().getIP() + ":" + getConfig().getPort();
- }
- }
-
- private void setAuthorization(String username, String password) {
- if (getConfig().getTLSEnabled()) {
- String credentials = username + ":" + password;
- this.headerMap.put("Authorization",
- "Basic " + new String(Base64.getEncoder().encode(credentials.getBytes())));
- }
-
- }
-
- @Override
- public boolean publishVESMessage(VESMessage message) {
- LOG.info("In VESClient - {} ", message.getMessage());
- BaseHTTPResponse response;
- try {
- String uri = "eventListener" + "/" + getConfig().getVersion();
- response = httpClient.sendRequest(uri, "POST", message.getMessage(), headerMap);
- LOG.debug("finished with responsecode {}", response.code);
- return response.code == 200;
- } catch (IOException e) {
- LOG.warn("problem publishing VES message {} ", e.getMessage());
- return false;
- }
-
- }
-
- @Override
- public void close() throws Exception {
- this.cfg.unregisterConfigChangedListener(this);
- }
-
- @Override
- public void onConfigChanged() {
- LOG.debug("In onConfigChanged - isTrustAllCerts = {} getBaseUrl = {}", getConfig().isTrustAllCerts(), getBaseUrl());
- httpClient = new BaseHTTPClient(getBaseUrl(), this.vesConfig.isTrustAllCerts());
- setAuthorization(getConfig().getUsername(), getConfig().getPassword());
- Iterator<VESCollectorConfigChangeListener> it = registeredObjects.iterator();
- while (it.hasNext()) {
- VESCollectorConfigChangeListener o = it.next();
- o.notify(getConfig());
- }
- }
-
- @Override
- public void registerForChanges(VESCollectorConfigChangeListener o) {
- registeredObjects.add(o);
- }
-
- @Override
- public void deregister(VESCollectorConfigChangeListener o) {
- registeredObjects.remove(o);
- }
-
- @Override
- public @NonNull NotificationProxyParser getNotificationProxyParser() {
- return new NotificationProxyParserImpl();
- }
-
- /**
- * Generates VES Event JSON containing commonEventHeader and notificationFields fields
- *
- * @param commonEventHeader
- * @param notifFields
- * @return VESMessage - representing the VESEvent JSON
- * @throws JsonProcessingException
- */
- @Override
- public VESMessage generateVESEvent(VESCommonEventHeaderPOJO commonEventHeader,
- VESNotificationFieldsPOJO notifFields) throws JsonProcessingException {
- Map<String, Object> innerEvent = new HashMap<String, Object>();
- innerEvent.put("commonEventHeader", commonEventHeader);
- innerEvent.put("notificationFields", notifFields);
-
- Map<String, Object> outerEvent = new HashMap<String, Object>();
- outerEvent.put("event", innerEvent);
- LOG.info("in generateVESEvent - {}", objMapper.writeValueAsString(outerEvent));
- return new VESMessage(objMapper.writeValueAsString(outerEvent));
- }
-
- /**
- * Generates VES Event JSON containing commonEventHeader and faultFields fields
- *
- * @param commonEventHeader
- * @param faultFields
- * @return VESMessage - representing the VES Event JSON
- * @throws JsonProcessingException
- */
- @Override
- public VESMessage generateVESEvent(VESCommonEventHeaderPOJO commonEventHeader, VESFaultFieldsPOJO faultFields) throws JsonProcessingException {
- Map<String, Object> innerEvent = new HashMap<String, Object>();
- innerEvent.put("commonEventHeader", commonEventHeader);
- innerEvent.put("faultFields", faultFields);
-
- Map<String, Object> outerEvent = new HashMap<String, Object>();
- outerEvent.put("event", innerEvent);
- return new VESMessage(objMapper.writeValueAsString(outerEvent));
- }
-
- /**
- * Generates VES Event JSON containing commonEventHeader and pnfRegistration fields
- *
- * @param commonEventHeader
- * @param pnfRegistrationFields
- * @return VESMessage - representing the VES Event JSON
- * @throws JsonProcessingException
- */
- @Override
- public VESMessage generateVESEvent(VESCommonEventHeaderPOJO commonEventHeader, VESPNFRegistrationFieldsPOJO pnfRegistrationFields) throws JsonProcessingException {
- Map<String, Object> innerEvent = new HashMap<String, Object>();
- innerEvent.put("commonEventHeader", commonEventHeader);
- innerEvent.put("pnfRegistration", pnfRegistrationFields);
-
- Map<String, Object> outerEvent = new HashMap<String, Object>();
- outerEvent.put("event", innerEvent);
- return new VESMessage(objMapper.writeValueAsString(outerEvent));
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/config/VESCollectorCfgImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/config/VESCollectorCfgImpl.java
deleted file mode 100644
index 105b915c7..000000000
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/config/VESCollectorCfgImpl.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
- * All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.vescollectorconnector.impl.config;
-
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorCfgService;
-
-public class VESCollectorCfgImpl implements VESCollectorCfgService, Configuration {
-
- private static final String SECTION_MARKER = "VESCollector";
-
- /** set to true if VES Collector is installed and configured */
- private static final String PROPERTY_KEY_VES_COLLECTOR_ENABLED = "VES_COLLECTOR_ENABLED";
- private static final boolean DEFAULT_VALUE_VES_COLLECTOR_ENABLED = false;
-
- private static final String PROPERTY_KEY_VES_COLLECTOR_IP = "VES_COLLECTOR_IP";
- private static final String DEFAULT_VALUE_VES_COLLECTOR_IP = "127.0.0.1";
-
- private static final String PROPERTY_KEY_VES_COLLECTOR_PORT = "VES_COLLECTOR_PORT";
- private static final String DEFAULT_VALUE_VES_COLLECTOR_PORT = "8080";
-
- private static final String PROPERTY_KEY_VES_COLLECTOR_TLS_ENABLED = "VES_COLLECTOR_TLS_ENABLED";
- private static final String PROPERTY_KEY_VES_COLLECTOR_TRUST_ALL_CERTS = "VES_COLLECTOR_TRUST_ALL_CERTS";
-
- private static final String PROPERTY_KEY_VES_COLLECTOR_USERNAME = "VES_COLLECTOR_USERNAME";
- private static final String DEFAULT_VALUE_VES_COLLECTOR_USERNAME = "sample1";
-
- private static final String PROPERTY_KEY_VES_COLLECTOR_PASSWORD = "VES_COLLECTOR_PASSWORD";
- private static final String DEFAULT_VALUE_VES_COLLECTOR_PASSWORD = "sample1";
-
- private static final String PROPERTY_KEY_VES_COLLECTOR_VERSION = "VES_COLLECTOR_VERSION";
- private static final String DEFAULT_VALUE_VES_COLLECTOR_VERSION = "v7";
-
- private static final String PROPERTY_KEY_REPORTING_ENTITY_NAME = "REPORTING_ENTITY_NAME";
- private static final String DEFAULT_VALUE_REPORTING_ENTITY_NAME = "ONAP SDN-R";
-
- private static final String PROPERTY_KEY_EVENTLOG_DETAIL = "EVENTLOG_MSG_DETAIL";
- private static final String DEFAULT_VALUE_EVENTLOG_DETAIL = "SHORT"; // "SHORT", "MEDIUM", "LONG"
-
-
- private static ConfigurationFileRepresentation configuration;
-
- public VESCollectorCfgImpl(ConfigurationFileRepresentation configuration) {
- VESCollectorCfgImpl.configuration = configuration;
- VESCollectorCfgImpl.configuration.addSection(SECTION_MARKER);
- defaults();
- }
-
- @Override
- public String getSectionName() {
- return SECTION_MARKER;
- }
-
- @Override
- public String getReportingEntityName() {
- return configuration != null ? configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_REPORTING_ENTITY_NAME) : "ONAP SDN-R";
- }
-
- @Override
- public String getEventLogMsgDetail() {
- return configuration != null ?configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_EVENTLOG_DETAIL) : DEFAULT_VALUE_EVENTLOG_DETAIL;
- }
-
- @Override
- public boolean isVESCollectorEnabled() {
- return configuration.getPropertyBoolean(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_ENABLED);
- }
-
- public boolean getTLSEnabled() {
- return configuration.getPropertyBoolean(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_TLS_ENABLED);
- }
-
- public String getUsername() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_USERNAME);
- }
-
- public String getPassword() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_PASSWORD);
- }
-
- public String getIP() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_IP);
- }
-
- public String getPort() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_PORT);
- }
-
- public String getVersion() {
- return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_VERSION);
- }
-
- public boolean isTrustAllCerts() {
- return configuration.getPropertyBoolean(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_TRUST_ALL_CERTS);
- }
-
- @Override
- public synchronized void defaults() {
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_ENABLED, DEFAULT_VALUE_VES_COLLECTOR_ENABLED);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_TLS_ENABLED, Boolean.FALSE);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_TRUST_ALL_CERTS, Boolean.FALSE);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_USERNAME,
- DEFAULT_VALUE_VES_COLLECTOR_USERNAME);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_PASSWORD,
- DEFAULT_VALUE_VES_COLLECTOR_PASSWORD);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_IP,
- DEFAULT_VALUE_VES_COLLECTOR_IP);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_PORT,
- DEFAULT_VALUE_VES_COLLECTOR_PORT);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_VERSION,
- DEFAULT_VALUE_VES_COLLECTOR_VERSION);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_REPORTING_ENTITY_NAME,
- DEFAULT_VALUE_REPORTING_ENTITY_NAME);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_EVENTLOG_DETAIL,
- DEFAULT_VALUE_EVENTLOG_DETAIL);
- }
-
-}