1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
19 package org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl;
21 import org.eclipse.jdt.annotation.NonNull;
22 import org.eclipse.jdt.annotation.Nullable;
23 import org.onap.ccsdk.features.sdnr.wt.common.HtAssert;
24 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.ProviderClient;
25 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.handler.NetconfEventListenerHandler12;
26 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
27 import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.MaintenanceService;
28 import org.slf4j.Logger;
29 import org.slf4j.LoggerFactory;
31 public class DcaeForwarderImpl implements DcaeForwarderInternal, AutoCloseable {
33 private static final Logger LOG = LoggerFactory.getLogger(NetconfEventListenerHandler12.class);
35 private final @Nullable ProviderClient aotsmClient;
36 private final ProviderClient dcaeProvider;
37 private final MaintenanceService maintenanceService;
39 public DcaeForwarderImpl(@Nullable ProviderClient aotsmClient, @Nullable ProviderClient dcaeProvider,
40 @NonNull MaintenanceService maintenanceService) {
43 HtAssert.nonnull(maintenanceService);
44 this.aotsmClient = aotsmClient;
45 this.dcaeProvider = dcaeProvider;
46 this.maintenanceService = maintenanceService;
50 @SuppressWarnings("null")
51 public void sendProblemNotificationUsingMaintenanceFilter(String nodeId, ProblemNotificationXml notificationXml) {
52 if (!this.maintenanceService.isONFObjectInMaintenance(nodeId, notificationXml.getObjectId(),
53 notificationXml.getProblem())) {
54 if (dcaeProvider != null) {
55 this.dcaeProvider.sendProblemNotification(nodeId, notificationXml);
57 if (this.aotsmClient != null) {
58 this.aotsmClient.sendProblemNotification(nodeId, notificationXml);
61 LOG.debug("Notification will not be sent to external services. Device " + nodeId
62 + " is in maintenance mode");
67 public void sendProblemNotification(String nodeId, ProblemNotificationXml notificationXml) {
68 //to prevent push alarms on reconnect
69 //=> only pushed alarms are forwared to dcae
70 //dcaeProvider.sendProblemNotification(nodeName, notificationXml);
71 if(aotsmClient!=null) {
72 aotsmClient.sendProblemNotification(nodeId, notificationXml);
78 public void close() throws Exception {