2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.sdnc.vnfapi;
24 import java.util.Properties;
26 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder;
27 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder;
28 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder;
29 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder;
30 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder;
32 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder;
33 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
34 import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
35 import org.osgi.framework.BundleContext;
36 import org.osgi.framework.FrameworkUtil;
37 import org.osgi.framework.ServiceReference;
38 import org.slf4j.Logger;
39 import org.slf4j.LoggerFactory;
41 public class VNFSDNSvcLogicServiceClient {
43 private static final Logger LOG = LoggerFactory
44 .getLogger(VNFSDNSvcLogicServiceClient.class);
46 private final SvcLogicService svcLogic;
48 public VNFSDNSvcLogicServiceClient(final SvcLogicService svcLogicService)
50 this.svcLogic = svcLogicService;
54 public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException
56 return(svcLogic.hasGraph(module, rpc, version, mode));
59 public Properties execute(String module, String rpc, String version, String mode, ServiceDataBuilder serviceData)
60 throws SvcLogicException {
62 Properties parms = new Properties();
64 return execute(module,rpc,version, mode,serviceData,parms);
67 public Properties execute(String module, String rpc, String version, String mode, PreloadDataBuilder serviceData)
68 throws SvcLogicException {
70 Properties parms = new Properties();
72 return execute(module,rpc,version, mode,serviceData,parms);
76 public Properties execute(String module, String rpc, String version, String mode, ServiceDataBuilder serviceData, Properties parms)
77 throws SvcLogicException {
79 parms = VnfSdnUtil.toProperties(parms, serviceData);
81 if (LOG.isDebugEnabled())
83 LOG.debug("Parameters passed to SLI");
85 for (Object key : parms.keySet()) {
86 String parmName = (String) key;
87 String parmValue = parms.getProperty(parmName);
89 LOG.debug(parmName+" = "+parmValue);
94 Properties respProps = svcLogic.execute(module, rpc, version, mode, parms);
96 if (LOG.isDebugEnabled())
98 LOG.debug("Parameters returned by SLI");
100 for (Object key : respProps.keySet()) {
101 String parmName = (String) key;
102 String parmValue = respProps.getProperty(parmName);
104 LOG.debug(parmName+" = "+parmValue);
108 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
112 VnfSdnUtil.toBuilder(respProps, serviceData);
118 public Properties execute(String module, String rpc, String version, String mode, PreloadDataBuilder serviceData, Properties parms)
119 throws SvcLogicException {
121 parms = VnfSdnUtil.toProperties(parms, serviceData);
123 if (LOG.isDebugEnabled())
125 LOG.debug("Parameters passed to SLI");
127 for (Object key : parms.keySet()) {
128 String parmName = (String) key;
129 String parmValue = parms.getProperty(parmName);
131 LOG.debug(parmName+" = "+parmValue);
136 Properties respProps = svcLogic.execute(module, rpc, version, mode, parms);
138 if (LOG.isDebugEnabled())
140 LOG.debug("Parameters returned by SLI");
142 for (Object key : respProps.keySet()) {
143 String parmName = (String) key;
144 String parmValue = respProps.getProperty(parmName);
146 LOG.debug(parmName+" = "+parmValue);
150 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
154 VnfSdnUtil.toBuilder(respProps, serviceData);
161 public Properties execute(String module, String rpc, String version, String mode, VnfInstanceServiceDataBuilder serviceData)
162 throws SvcLogicException {
164 Properties parms = new Properties();
166 return execute(module,rpc,version, mode,serviceData,parms);
170 public Properties execute(String module, String rpc, String version, String mode, VnfInstanceServiceDataBuilder serviceData, Properties parms)
171 throws SvcLogicException {
173 parms = VnfSdnUtil.toProperties(parms, serviceData);
175 if (LOG.isDebugEnabled())
177 LOG.debug("Parameters passed to SLI");
179 for (Object key : parms.keySet()) {
180 String parmName = (String) key;
181 String parmValue = parms.getProperty(parmName);
183 LOG.debug(parmName+" = "+parmValue);
188 Properties respProps = svcLogic.execute(module, rpc, version, mode, parms);
190 if (LOG.isDebugEnabled())
192 LOG.debug("Parameters returned by SLI");
194 for (Object key : respProps.keySet()) {
195 String parmName = (String) key;
196 String parmValue = respProps.getProperty(parmName);
198 LOG.debug(parmName+" = "+parmValue);
202 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
206 VnfSdnUtil.toBuilder(respProps, serviceData);
212 public Properties execute(String module, String rpc, String version, String mode, VfModuleServiceDataBuilder serviceData)
213 throws SvcLogicException {
215 Properties parms = new Properties();
217 return execute(module,rpc,version, mode,serviceData,parms);
221 public Properties execute(String module, String rpc, String version, String mode, VfModuleServiceDataBuilder serviceData, Properties parms)
222 throws SvcLogicException {
224 parms = VnfSdnUtil.toProperties(parms, serviceData);
226 if (LOG.isDebugEnabled())
228 LOG.debug("Parameters passed to SLI");
230 for (Object key : parms.keySet()) {
231 String parmName = (String) key;
232 String parmValue = parms.getProperty(parmName);
234 LOG.debug(parmName+" = "+parmValue);
239 Properties respProps = svcLogic.execute(module, rpc, version, mode, parms);
241 if (LOG.isDebugEnabled())
243 LOG.debug("Parameters returned by SLI");
245 for (Object key : respProps.keySet()) {
246 String parmName = (String) key;
247 String parmValue = respProps.getProperty(parmName);
249 LOG.debug(parmName+" = "+parmValue);
253 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
257 VnfSdnUtil.toBuilder(respProps, serviceData);
262 //1610 vnf-instance-preload
263 public Properties execute(String module, String rpc, String version, String mode, VnfInstancePreloadDataBuilder serviceData)
264 throws SvcLogicException {
266 Properties parms = new Properties();
268 return execute(module,rpc,version, mode,serviceData,parms);
272 //1610 vnf-instance-preload
273 public Properties execute(String module, String rpc, String version, String mode, VnfInstancePreloadDataBuilder serviceData, Properties parms)
274 throws SvcLogicException {
276 parms = VnfSdnUtil.toProperties(parms, serviceData);
278 if (LOG.isDebugEnabled())
280 LOG.debug("Parameters passed to SLI");
282 for (Object key : parms.keySet()) {
283 String parmName = (String) key;
284 String parmValue = parms.getProperty(parmName);
286 LOG.debug(parmName+" = "+parmValue);
291 Properties respProps = svcLogic.execute(module, rpc, version, mode, parms);
293 if (LOG.isDebugEnabled())
295 LOG.debug("Parameters returned by SLI");
297 for (Object key : respProps.keySet()) {
298 String parmName = (String) key;
299 String parmValue = respProps.getProperty(parmName);
301 LOG.debug(parmName+" = "+parmValue);
305 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
309 VnfSdnUtil.toBuilder(respProps, serviceData);
314 //1610 vf-module-preload
315 public Properties execute(String module, String rpc, String version, String mode, VfModulePreloadDataBuilder serviceData)
316 throws SvcLogicException {
318 Properties parms = new Properties();
320 return execute(module,rpc,version, mode,serviceData,parms);
324 //1610 vf-module-preload
325 public Properties execute(String module, String rpc, String version, String mode, VfModulePreloadDataBuilder serviceData, Properties parms)
326 throws SvcLogicException {
328 parms = VnfSdnUtil.toProperties(parms, serviceData);
330 if (LOG.isDebugEnabled())
332 LOG.debug("Parameters passed to SLI");
334 for (Object key : parms.keySet()) {
335 String parmName = (String) key;
336 String parmValue = parms.getProperty(parmName);
338 LOG.debug(parmName+" = "+parmValue);
343 Properties respProps = svcLogic.execute(module, rpc, version, mode, parms);
345 if (LOG.isDebugEnabled())
347 LOG.debug("Parameters returned by SLI");
349 for (Object key : respProps.keySet()) {
350 String parmName = (String) key;
351 String parmValue = respProps.getProperty(parmName);
353 LOG.debug(parmName+" = "+parmValue);
357 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
361 VnfSdnUtil.toBuilder(respProps, serviceData);