1 package org.onap.sdnc.northbound;
3 import java.util.Properties;
5 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
6 import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
7 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadDataBuilder;
8 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder;
9 import org.osgi.framework.BundleContext;
10 import org.osgi.framework.FrameworkUtil;
11 import org.osgi.framework.ServiceReference;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
15 public class GenericResourceApiSvcLogicServiceClient {
17 private static final Logger LOG = LoggerFactory
18 .getLogger(GenericResourceApiSvcLogicServiceClient.class);
20 private SvcLogicService svcLogic = null;
22 public GenericResourceApiSvcLogicServiceClient(SvcLogicService svcLogic)
24 this.svcLogic = svcLogic;
27 public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException
29 return(svcLogic.hasGraph(module, rpc, version, mode));
32 public Properties execute(String module, String rpc, String version, String mode, ServiceDataBuilder serviceData)
33 throws SvcLogicException {
35 Properties parms = new Properties();
37 return execute(module,rpc,version, mode,serviceData,parms);
40 public Properties execute(String module, String rpc, String version, String mode, PreloadDataBuilder serviceData)
41 throws SvcLogicException {
43 Properties parms = new Properties();
45 return execute(module,rpc,version, mode,serviceData,parms);
49 public Properties execute(String module, String rpc, String version, String mode, ServiceDataBuilder serviceData, Properties parms)
50 throws SvcLogicException {
52 parms = GenericResourceApiUtil.toProperties(parms, serviceData);
54 if (LOG.isDebugEnabled())
56 LOG.debug("Parameters passed to SLI");
58 for (Object key : parms.keySet()) {
59 String parmName = (String) key;
60 String parmValue = parms.getProperty(parmName);
62 LOG.debug(parmName+" = "+parmValue);
68 Properties respProps = svcLogic.execute(module, rpc, version, mode, parms);
71 if (LOG.isDebugEnabled())
73 LOG.debug("Parameters returned by SLI");
75 for (Object key : respProps.keySet()) {
76 String parmName = (String) key;
77 String parmValue = respProps.getProperty(parmName);
79 LOG.debug(parmName+" = "+parmValue);
83 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
87 GenericResourceApiUtil.toBuilder(respProps, serviceData);
93 public Properties execute(String module, String rpc, String version, String mode, PreloadDataBuilder serviceData, Properties parms)
94 throws SvcLogicException {
96 parms = GenericResourceApiUtil.toProperties(parms, serviceData);
98 if (LOG.isDebugEnabled())
100 LOG.debug("Parameters passed to SLI");
102 for (Object key : parms.keySet()) {
103 String parmName = (String) key;
104 String parmValue = parms.getProperty(parmName);
106 LOG.debug(parmName+" = "+parmValue);
111 Properties respProps = svcLogic.execute(module, rpc, version, mode, parms);
113 if (LOG.isDebugEnabled())
115 LOG.debug("Parameters returned by SLI");
117 for (Object key : respProps.keySet()) {
118 String parmName = (String) key;
119 String parmValue = respProps.getProperty(parmName);
121 LOG.debug(parmName+" = "+parmValue);
125 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
129 GenericResourceApiUtil.toBuilder(respProps, serviceData);