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.ccsdk.features.sdnr.northbound.oofpcipoc;
24 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;
29 import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.GreetingOutputBuilder;
30 import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.ConfigurationPhyCellIdOutputBuilder;
31 import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.AddNeighborOutputBuilder;
32 import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.DeleteNeighborOutputBuilder;
33 import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.GenericNeighborConfigurationOutputBuilder;
36 import org.slf4j.Logger;
37 import org.slf4j.LoggerFactory;
39 public class OofpcipocClient {
41 private static final Logger LOG = LoggerFactory.getLogger(OofpcipocClient.class);
43 private SvcLogicService svcLogicService = null;
45 public OofpcipocClient(final SvcLogicService svcLogicService) {
46 this.svcLogicService = svcLogicService;
49 public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException
51 return svcLogicService.hasGraph(module, rpc, version, mode);
54 public Properties execute(String module, String rpc, String version, String mode, GreetingOutputBuilder serviceData)
55 throws SvcLogicException {
57 Properties parms = new Properties();
59 return execute(module,rpc,version, mode,serviceData,parms);
62 public Properties execute(String module, String rpc, String version, String mode, GreetingOutputBuilder serviceData, Properties parms)
63 throws SvcLogicException {
65 localProp = MdsalHelper.toProperties(parms, serviceData);
67 if (LOG.isDebugEnabled())
69 LOG.debug("Parameters passed to SLI");
71 for (Object key : localProp.keySet()) {
72 String parmName = (String) key;
73 String parmValue = localProp.getProperty(parmName);
75 LOG.debug(parmName+" = "+parmValue);
80 Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
82 if (LOG.isDebugEnabled())
84 LOG.debug("Parameters returned by SLI");
86 for (Object key : respProps.keySet()) {
87 String parmName = (String) key;
88 String parmValue = respProps.getProperty(parmName);
90 LOG.debug(parmName+" = "+parmValue);
94 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
98 MdsalHelper.toBuilder(respProps, serviceData);
103 public Properties execute(String module, String rpc, String version, String mode, ConfigurationPhyCellIdOutputBuilder serviceData)
104 throws SvcLogicException {
106 Properties parms = new Properties();
108 return execute(module,rpc,version, mode,serviceData,parms);
111 public Properties execute(String module, String rpc, String version, String mode, ConfigurationPhyCellIdOutputBuilder serviceData, Properties parms)
112 throws SvcLogicException {
114 Properties localProp;
116 localProp = MdsalHelper.toProperties(parms, serviceData);
117 if (LOG.isDebugEnabled())
119 LOG.debug("Parameters passed to SLI");
121 for (Object key : localProp.keySet()) {
122 String parmName = (String) key;
123 String parmValue = localProp.getProperty(parmName);
125 LOG.debug(parmName+" = "+parmValue);
130 Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
132 if (LOG.isDebugEnabled())
134 LOG.debug("Parameters returned by SLI");
136 for (Object key : respProps.keySet()) {
137 String parmName = (String) key;
138 String parmValue = respProps.getProperty(parmName);
140 LOG.debug(parmName+" = "+parmValue);
144 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
148 MdsalHelper.toBuilder(respProps, serviceData);
154 public Properties execute(String module, String rpc, String version, String mode, AddNeighborOutputBuilder serviceData)
155 throws SvcLogicException {
157 Properties parms = new Properties();
159 return execute(module,rpc,version, mode,serviceData,parms);
162 public Properties execute(String module, String rpc, String version, String mode, AddNeighborOutputBuilder serviceData, Properties parms)
163 throws SvcLogicException {
164 Properties localProp;
165 localProp = MdsalHelper.toProperties(parms, serviceData);
167 if (LOG.isDebugEnabled())
169 LOG.debug("Parameters passed to SLI");
171 for (Object key : localProp.keySet()) {
172 String parmName = (String) key;
173 String parmValue = localProp.getProperty(parmName);
175 LOG.debug(parmName+" = "+parmValue);
180 Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
182 if (LOG.isDebugEnabled())
184 LOG.debug("Parameters returned by SLI");
186 for (Object key : respProps.keySet()) {
187 String parmName = (String) key;
188 String parmValue = respProps.getProperty(parmName);
190 LOG.debug(parmName+" = "+parmValue);
194 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
198 MdsalHelper.toBuilder(respProps, serviceData);
206 public Properties execute(String module, String rpc, String version, String mode, DeleteNeighborOutputBuilder serviceData)
207 throws SvcLogicException {
209 Properties parms = new Properties();
211 return execute(module,rpc,version, mode,serviceData,parms);
214 public Properties execute(String module, String rpc, String version, String mode, DeleteNeighborOutputBuilder serviceData, Properties parms)
215 throws SvcLogicException {
216 Properties localProp;
217 localProp = MdsalHelper.toProperties(parms, serviceData);
219 if (LOG.isDebugEnabled())
221 LOG.debug("Parameters passed to SLI");
223 for (Object key : localProp.keySet()) {
224 String parmName = (String) key;
225 String parmValue = localProp.getProperty(parmName);
227 LOG.debug(parmName+" = "+parmValue);
232 Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
234 if (LOG.isDebugEnabled())
236 LOG.debug("Parameters returned by SLI");
238 for (Object key : respProps.keySet()) {
239 String parmName = (String) key;
240 String parmValue = respProps.getProperty(parmName);
242 LOG.debug(parmName+" = "+parmValue);
246 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
250 MdsalHelper.toBuilder(respProps, serviceData);
256 // genericNeighborConfiguration
258 public Properties execute(String module, String rpc, String version, String mode, GenericNeighborConfigurationOutputBuilder serviceData)
259 throws SvcLogicException {
261 Properties parms = new Properties();
263 return execute(module,rpc,version, mode,serviceData,parms);
266 public Properties execute(String module, String rpc, String version, String mode, GenericNeighborConfigurationOutputBuilder serviceData, Properties parms)
267 throws SvcLogicException {
268 Properties localProp;
269 localProp = MdsalHelper.toProperties(parms, serviceData);
271 if (LOG.isDebugEnabled())
273 LOG.debug("Parameters passed to SLI");
275 for (Object key : localProp.keySet()) {
276 String parmName = (String) key;
277 String parmValue = localProp.getProperty(parmName);
279 LOG.debug(parmName+" = "+parmValue);
284 Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
286 if (LOG.isDebugEnabled())
288 LOG.debug("Parameters returned by SLI");
290 for (Object key : respProps.keySet()) {
291 String parmName = (String) key;
292 String parmValue = respProps.getProperty(parmName);
294 LOG.debug(parmName+" = "+parmValue);
298 if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
302 MdsalHelper.toBuilder(respProps, serviceData);