2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * Modifications Copyright (C) 2020 Nordix Foundation.
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.ccsdk.features.sdnr.northbound.CMNotify;
25 import java.util.Properties;
26 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
27 import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
28 import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
30 import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationOutputBuilder;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
35 public class CMNotifyClient {
37 private static final Logger LOG = LoggerFactory.getLogger(CMNotifyClient.class);
39 private SvcLogicService svcLogicService = null;
41 public CMNotifyClient(final SvcLogicService svcLogicService) {
42 this.svcLogicService = svcLogicService;
45 public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException {
46 return svcLogicService.hasGraph(module, rpc, version, mode);
49 // Client for NbrlistChangeNotification
51 public Properties execute(String module, String rpc, String version, String mode,
52 NbrlistChangeNotificationOutputBuilder serviceData) throws SvcLogicException {
54 Properties parms = new Properties();
56 return execute(module, rpc, version, mode, serviceData, parms);
59 public Properties execute(String module, String rpc, String version, String mode,
60 NbrlistChangeNotificationOutputBuilder serviceData, Properties parms) throws SvcLogicException {
62 localProp = MdsalHelper.toProperties(parms, serviceData);
64 if (LOG.isDebugEnabled()) {
65 LOG.debug("Parameters passed to SLI");
67 for (Object key : localProp.keySet()) {
68 String parmName = (String) key;
69 String parmValue = localProp.getProperty(parmName);
71 LOG.debug(parmName + " = " + parmValue);
76 Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
78 if (LOG.isDebugEnabled()) {
79 LOG.debug("Parameters returned by SLI");
81 for (Object key : respProps.keySet()) {
82 String parmName = (String) key;
83 String parmValue = respProps.getProperty(parmName);
85 LOG.debug(parmName + " = " + parmValue);
89 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
93 MdsalHelper.toBuilder(respProps, serviceData);