diff options
Diffstat (limited to 'sdnr/wt/devicemanager/provider')
9 files changed, 45 insertions, 213 deletions
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java index 7c04ffc54..8a476f1db 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java @@ -45,7 +45,7 @@ public class RpcPushNotificationsHandler implements PushNotifications { private static final Logger LOG = LoggerFactory.getLogger(RpcPushNotificationsHandler.class); - private static String OWNKEYNAME = "VES"; + private static final String OWNKEYNAME = "VES"; private final WebSocketServiceClientInternal webSocketService; private final DataProvider databaseService; private final DcaeForwarderInternal aotsDcaeForwarder; 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 index ef666966f..bc6a068fb 100644 --- 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 @@ -56,7 +56,7 @@ public class ResyncNetworkElementHouskeepingService implements ResyncNetworkElem private final MountPointService mountPointService; private final ODLEventListenerHandler odlEventListenerHandler; private final DataProvider databaseClientEvents; - private @Nullable final DeviceMonitor deviceMonitor; + private final DeviceMonitor deviceMonitor; private final DeviceManagerImpl deviceManager; /** Thread is started to du the clean up action **/ @@ -87,7 +87,7 @@ public class ResyncNetworkElementHouskeepingService implements ResyncNetworkElem * Async RPC Interface implementation */ @Override - public @NonNull List<String> doClearCurrentFaultByNodename(@Nullable List<String> nodeNamesInput) + public @NonNull List<String> doClearCurrentFaultByNodename(@Nullable List<String> nodeNames) throws IllegalStateException { if (this.databaseClientEvents == null) { @@ -97,11 +97,14 @@ public class ResyncNetworkElementHouskeepingService implements ResyncNetworkElem 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 (nodeNamesInput == null || nodeNamesInput.size() <= 0) { + 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 diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java index d202def5e..d766e7a91 100644 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java +++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java @@ -29,7 +29,6 @@ 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.DcaeForwarderInternal; 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; @@ -45,7 +44,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.FactoryRegistrat 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.performancemanager.impl.database.service.MicrowaveHistoricalPerformanceWriterService; 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; @@ -58,7 +56,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.PerformanceManager; import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.DevicemanagerNotificationDelayService; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateService; import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.mdsal.binding.api.MountPoint; import org.opendaylight.mdsal.binding.api.MountPointService; import org.opendaylight.mdsal.binding.api.NotificationPublishService; import org.opendaylight.mdsal.binding.api.RpcProviderService; @@ -83,27 +80,23 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa @SuppressWarnings("unused") private static final String STARTUPLOG_FILENAME = "etc/devicemanager.startup.log"; - // private static final String STARTUPLOG_FILENAME2 = "data/cache/devicemanager.startup.log"; // MDSAL Services private DataBroker dataBroker; private MountPointService mountPointService; private RpcProviderService rpcProviderRegistry; - @SuppressWarnings("unused") - private NotificationPublishService notificationPublishService; private ClusterSingletonServiceProvider clusterSingletonServiceProvider; private WebsocketmanagerService websocketmanagerService; private IEntityDataProvider iEntityDataProvider; // Devicemanager common services for network element handler - private @Nullable WebSocketServiceClientInternal webSocketService; + private WebSocketServiceClientInternal webSocketService; private ODLEventListenerHandler odlEventListenerHandler; //EventHandlingService - //private NetconfChangeListener netconfChangeListener; private DeviceManagerApiServiceImpl rpcApiService; private PerformanceManagerImpl performanceManager; private DcaeProviderClient dcaeProviderClient; private AaiProviderClient aaiProviderClient; - private DcaeForwarderInternal aotsDcaeForwarder; + private DcaeForwarderImpl aotsDcaeForwarder; private DeviceMonitor deviceMonitor; private MaintenanceServiceImpl maintenanceService; private DevicemanagerNotificationDelayService notificationDelayService; @@ -112,14 +105,13 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa private ConnectionStatusHousekeepingService housekeepingService; private NetconfNodeStateService netconfNodeStateService; private DataProvider dataProvider; - //private HtDatabaseClient htDatabaseClient; + // Handler - private RpcPushNotificationsHandler rpcPushNotificationsHandler; private DeviceManagerNetconfConnectHandler forTest; + // Attributes - private final Object networkelementLock; private final ConcurrentHashMap<String, NetworkElement> networkElementRepresentations; - private final List<MyNetworkElementFactory<? extends NetworkElementFactory>> factoryList; + private final List<NetworkElementFactory> factoryList; private DeviceManagerDatabaseNotificationService deviceManagerDatabaseAndNotificationService; private ClusterSingletonServiceRegistration cssRegistration; @@ -133,13 +125,11 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa LOG.info("Creating provider for {}", APPLICATION_NAME); this.devicemanagerInitializationOk = false; this.factoryList = new CopyOnWriteArrayList<>(); - this.networkelementLock = new Object(); this.networkElementRepresentations = new ConcurrentHashMap<>(); this.dataBroker = null; this.mountPointService = null; this.rpcProviderRegistry = null; - this.notificationPublishService = null; this.clusterSingletonServiceProvider = null; this.websocketmanagerService = null; this.iEntityDataProvider = null; @@ -156,7 +146,6 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa } public void setNotificationPublishService(NotificationPublishService notificationPublishService) { - this.notificationPublishService = notificationPublishService; } public void setMountPointService(MountPointService mountPointService) { @@ -175,10 +164,10 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa this.iEntityDataProvider = iEntityDataProvider; } - @SuppressWarnings({ "deprecation", "null" }) - public void init() throws Exception { + public void init() { LOG.info("Session Initiated start {}", APPLICATION_NAME); + this.iEntityDataProvider.setReadyStatus(false); this.dataProvider = iEntityDataProvider.getDataProvider(); // Get configuration @@ -187,13 +176,6 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa this.notificationDelayService = new DevicemanagerNotificationDelayService(config); - //EsConfig dbConfig = new EsConfig(config); - //LOG.debug("esConfig=" + dbConfig.toString()); - // Start database - // TODO Remove this database client - //this.htDatabaseClient = new HtDatabaseClient(dbConfig.getHosts()); - //this.htDatabaseClient.waitForYellowStatus(DATABASE_TIMEOUT_MS); - // start service for device maintenance service this.maintenanceService = new MaintenanceServiceImpl(iEntityDataProvider.getHtDatabaseMaintenance()); @@ -210,9 +192,10 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa this.aotsDcaeForwarder = new DcaeForwarderImpl(null, dcaeProviderClient, maintenanceService); - this.deviceManagerDatabaseAndNotificationService = new DeviceManagerDatabaseNotificationService(dataProvider, maintenanceService,webSocketService, notificationDelayService, aotsDcaeForwarder); + this.deviceManagerDatabaseAndNotificationService = new DeviceManagerDatabaseNotificationService(dataProvider, + maintenanceService, webSocketService, notificationDelayService, aotsDcaeForwarder); - this.rpcPushNotificationsHandler = new RpcPushNotificationsHandler(webSocketService, + RpcPushNotificationsHandler rpcPushNotificationsHandler = new RpcPushNotificationsHandler(webSocketService, dataProvider, aotsDcaeForwarder); this.odlEventListenerHandler = new ODLEventListenerHandler(myDbKeyNameExtended, webSocketService, dataProvider, aotsDcaeForwarder); @@ -224,7 +207,7 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa this.cssRegistration2 = this.clusterSingletonServiceProvider .registerClusterSingletonService(this.housekeepingService); // PM - this.performanceManager = new PerformanceManagerImpl(60, this, new MicrowaveHistoricalPerformanceWriterService(dataProvider), config); + this.performanceManager = new PerformanceManagerImpl(60, this, dataProvider, config); // DM // DeviceMonitor has to be available before netconfSubscriptionManager is // configured @@ -243,17 +226,9 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa resyncNetworkElementHouskeepingService, rpcPushNotificationsHandler); // netconfSubscriptionManager should be the last one because this is a callback + // service LOG.debug("start NetconfSubscriptionManager Service"); - // this.netconfSubscriptionManager = new - // NetconfSubscriptionManagerOfDeviceManager(this, dataBroker); - // this.netconfSubscriptionManager.register(); - - //---->>>>>>> OLD OLD OLD - //this.netconfChangeListener = new NetconfChangeListener(this, dataBroker); - //this.netconfChangeListener.register(); - - //---->>>>>>> NEW NEW NEW this.forTest = new DeviceManagerNetconfConnectHandler(netconfNodeStateService, odlEventListenerHandler, deviceMonitor, this, factoryList); @@ -270,10 +245,9 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa LOG.info("DeviceManagerImpl closing ..."); close(performanceManager); close(dcaeProviderClient); + close(aotsDcaeForwarder); close(aaiProviderClient); close(deviceMonitor); - //close(htDatabaseClient); - //close(netconfChangeListener); close(maintenanceService); close(rpcApiService); close(notificationDelayService); @@ -287,45 +261,23 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa @Override public @NonNull <L extends NetworkElementFactory> FactoryRegistration<L> registerNetworkElementFactory(@NonNull L factory) { LOG.info("Factory registration {}", factory.getClass().getName()); - MyNetworkElementFactory<L> myFactory = new MyNetworkElementFactory<>(factory, (a,b,c) -> initDefault(a,b,c)); - factoryList.add(myFactory); + + factoryList.add(factory); return new FactoryRegistration<L>() { @Override public @NonNull L getInstance() { - return myFactory.getFactory(); + return factory; } @Override public void close() { - factoryList.remove(myFactory); + factoryList.remove(factory); } }; } - /** - * Execute register command, for network element - * @param mountPointNodeName of new network element - * @param mountPoint of new network element - * @param inNe that needs to register - */ - private void initDefault(String mountPointNodeName, MountPoint mountPoint, NetworkElement inNe) { - // sendUpdateNotification(mountPointNodeName, nNode.getConnectionStatus(), nNode); - - NetworkElement result; - synchronized (networkelementLock) { - result = networkElementRepresentations.put(mountPointNodeName, inNe); - } - if (result != null) { - LOG.warn("NE list was not empty as expected, but contained {} ", result.getNodeId()); - } else { - deviceMonitor.deviceConnectMasterIndication(mountPointNodeName, inNe); - inNe.register(); // Call NE specific initialization - odlEventListenerHandler.connectIndication(mountPointNodeName, inNe.getDeviceType()); - } - } - @SuppressWarnings("null") @Override public @NonNull DataProvider getDataProvider() { 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 index 9065ffd4b..c838c64fd 100644 --- 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 @@ -48,7 +48,7 @@ public class DeviceManagerNetconfConnectHandler implements NetconfNodeConnectLis private final @NonNull ODLEventListenerHandler odlEventListenerHandler; private final @NonNull DeviceMonitor deviceMonitor; - private final @NonNull List<MyNetworkElementFactory<? extends NetworkElementFactory>> factoryList; + private final @NonNull List<NetworkElementFactory> factoryList; private final @NonNull DeviceManagerServiceProvider serviceProvider; private final Object networkelementLock; @@ -57,7 +57,7 @@ public class DeviceManagerNetconfConnectHandler implements NetconfNodeConnectLis public DeviceManagerNetconfConnectHandler(@NonNull NetconfNodeStateService netconfNodeStateService, @NonNull ODLEventListenerHandler odlEventListenerHandler, @NonNull DeviceMonitor deviceMonitor, @NonNull DeviceManagerServiceProvider serviceProvider, - @NonNull List<MyNetworkElementFactory<? extends NetworkElementFactory>> factoryList) { + @NonNull List<NetworkElementFactory> factoryList) { HtAssert.nonnull(netconfNodeStateService, this.odlEventListenerHandler = odlEventListenerHandler, this.deviceMonitor = deviceMonitor, this.serviceProvider = serviceProvider, @@ -95,8 +95,8 @@ public class DeviceManagerNetconfConnectHandler implements NetconfNodeConnectLis NetconfNode netconfNode = acessor.getNetconfNode(); sendUpdateNotification(mountPointNodeName, netconfNode.getConnectionStatus(), netconfNode); - for ( MyNetworkElementFactory<? extends NetworkElementFactory> f : factoryList) { - Optional<NetworkElement> optionalNe = f.getFactory().create(acessor, serviceProvider); + for ( NetworkElementFactory f : factoryList) { + Optional<NetworkElement> optionalNe = f.create(acessor, serviceProvider); if (optionalNe.isPresent()) { // sendUpdateNotification(mountPointNodeName, nNode.getConnectionStatus(), nNode); NetworkElement inNe = optionalNe.get(); @@ -150,11 +150,11 @@ public class DeviceManagerNetconfConnectHandler implements NetconfNodeConnectLis @Override public void close() { if (registerNetconfNodeConnectListener != null) { - registerNetconfNodeConnectListener.close(); - } + registerNetconfNodeConnectListener.close(); + } if (registerNetconfNodeStateListener != null) { - registerNetconfNodeStateListener.close(); - } + registerNetconfNodeStateListener.close(); + } } /*-------------------------------------------- diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/MyNetworkElementFactory.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/MyNetworkElementFactory.java deleted file mode 100644 index e2ce10ded..000000000 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/MyNetworkElementFactory.java +++ /dev/null @@ -1,55 +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.eclipse.jdt.annotation.NonNull; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.NetworkElementFactory; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; -import org.opendaylight.mdsal.binding.api.MountPoint; - -/** - * @author herbert - * - */ -class MyNetworkElementFactory<L extends NetworkElementFactory> { - - - @FunctionalInterface - interface Register<X, Y, Z> { - public void register(X mountPointNodeName, Y mountPoint, Z ne); - } - - private final Register<String, MountPoint, NetworkElement> init; - private final @NonNull L factory; - - @SuppressWarnings("null") - MyNetworkElementFactory(@NonNull L factory, Register<String, MountPoint, NetworkElement> init) { - super(); - if (init == null || factory == null) { - throw new IllegalArgumentException("Null not allowed here."); - } - this.init = init; - this.factory = factory; - } - public Register<String, MountPoint, NetworkElement> getInit() { - return init; - } - public @NonNull L getFactory() { - return factory; - } -} 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 index de40fb1c4..d93f6e3d6 100644 --- 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 @@ -18,9 +18,9 @@ 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.performancemanager.impl.database.service.MicrowaveHistoricalPerformanceWriterService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.PerformanceManager; import org.slf4j.Logger; @@ -33,7 +33,7 @@ public class PerformanceManagerImpl implements PerformanceManager, AutoCloseable private PerformanceManagerTask task; public PerformanceManagerImpl(long seconds, NetconfNetworkElementService netconfNetworkElementService, - MicrowaveHistoricalPerformanceWriterService microwaveHistoricalPerformanceWriterService, + DataProvider microwaveHistoricalPerformanceWriterService, ConfigurationFileRepresentation config) { LOG.info("Construct {}", PerformanceManagerImpl.class.getSimpleName()); @@ -65,7 +65,7 @@ public class PerformanceManagerImpl implements PerformanceManager, AutoCloseable } @Override - public void registration(String mountPointNodeName, NetworkElement ne) { + public void registration(String mountPointNodeName, NetworkElement ne) { LOG.debug("Register {}",mountPointNodeName); if (task != null) { task.registration(mountPointNodeName, ne); 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 index 465d9ccee..603b106c0 100644 --- 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 @@ -24,9 +24,9 @@ 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.performancemanager.impl.database.service.MicrowaveHistoricalPerformanceWriterService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; import org.slf4j.Logger; @@ -40,7 +40,7 @@ public class PerformanceManagerTask implements Runnable { private int tickCounter = 0; private final ConcurrentHashMap<String, PerformanceDataProvider> queue = new ConcurrentHashMap<>(); - private final MicrowaveHistoricalPerformanceWriterService databaseService; + private final DataProvider databaseService; private final ScheduledExecutorService scheduler; private final long seconds; @@ -57,7 +57,7 @@ public class PerformanceManagerTask implements Runnable { */ public PerformanceManagerTask(long seconds, - MicrowaveHistoricalPerformanceWriterService microwaveHistoricalPerformanceWriterService, + DataProvider microwaveHistoricalPerformanceWriterService, NetconfNetworkElementService netconfNetworkElementService) { LOG.debug("Init task {}", PerformanceManagerTask.class.getSimpleName()); @@ -150,7 +150,7 @@ public class PerformanceManagerTask implements Runnable { Optional<PerformanceDataLtp> allPm = actualNE.getLtpHistoricalPerformanceData(); if (allPm.isPresent()) { LOG.debug("{} {} Got PM list. Start write to DB", LOGMARKER, tickCounter); - databaseService.writePM(allPm.get()); + databaseService.doWritePerformanceData(allPm.get().getList()); } LOG.debug("{} {} PM List end.", LOGMARKER, tickCounter); } catch (Exception e) { diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/service/MicrowaveHistoricalPerformanceWriterService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/service/MicrowaveHistoricalPerformanceWriterService.java deleted file mode 100644 index da4387a1a..000000000 --- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/performancemanager/impl/database/service/MicrowaveHistoricalPerformanceWriterService.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.service; - -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class MicrowaveHistoricalPerformanceWriterService { - - private static final Logger LOG = LoggerFactory.getLogger(MicrowaveHistoricalPerformanceWriterService.class); - - private final DataProvider dataProvider; -// private HtDataBaseReaderAndWriter<EsHistoricalPerformance15Minutes> historicalPerformance15mRW; -// private HtDataBaseReaderAndWriter<EsHistoricalPerformance24Hours> historicalPerformance24hRW; -// private HtDataBaseReaderAndWriter<EsHistoricalPerformanceLogEntry> historicalPerformanceLogRW; - - @Deprecated - public MicrowaveHistoricalPerformanceWriterService(DataProvider dataProvider) { - - LOG.info("Create {} start", MicrowaveHistoricalPerformanceWriterService.class); - this.dataProvider = dataProvider; - - LOG.info("Create {} finished. DB Service {} started.", MicrowaveHistoricalPerformanceWriterService.class, - dataProvider != null ? "sucessfully" : "not"); - } - - -// public void writePM(AllPm pm) { -// LOG.debug("Write {} pm records", pm.size()); -// -// LOG.debug("Write 15m write to DB"); -// historicalPerformance15mRW.doWrite(pm.getPm15()); -// LOG.debug("Write 15m done, Write 24h write to DB"); -// historicalPerformance24hRW.doWrite(pm.getPm24()); -// LOG.debug("Write 24h done"); -// } -// - /** - * @param performanceDataLtp - */ - public void writePM(PerformanceDataLtp performanceDataLtp) { - - dataProvider.doWritePerformanceData(performanceDataLtp.getList()); - } - - static public boolean isAvailable(MicrowaveHistoricalPerformanceWriterService s) { - - if (s == null || s.dataProvider == null) { - return false; - } - return true; - } - - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceMonitor.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceMonitor.java index 7fb417838..3cd9b4271 100644 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceMonitor.java +++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceMonitor.java @@ -20,6 +20,8 @@ ******************************************************************************/ package org.onap.ccsdk.features.sdnr.wt.devicemanager.test; +import java.io.File; + import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -66,6 +68,9 @@ public class TestDeviceMonitor extends Mockito { @AfterClass public static void after() throws Exception { deviceMonitor.close(); + File f = new File(CONFIGURATIONTESTFILE); + if (f.exists()) + f.delete(); } } |