summaryrefslogtreecommitdiffstats
path: root/sdnr/northbound/ranSlice/provider/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/northbound/ranSlice/provider/src/main')
-rw-r--r--sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceClient.java99
-rw-r--r--sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceProvider.java480
-rw-r--r--sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceResponseCode.java51
-rw-r--r--sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceRpcInvocationException.java25
-rw-r--r--sdnr/northbound/ranSlice/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml52
-rw-r--r--sdnr/northbound/ranSlice/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml52
6 files changed, 759 insertions, 0 deletions
diff --git a/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceClient.java b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceClient.java
new file mode 100644
index 000000000..f3d2a7da7
--- /dev/null
+++ b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceClient.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * Modifications Copyright © 2018 IBM.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.features.sdnr.northbound.ranSlice;
+
+
+import java.util.Properties;
+
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RANSliceClient {
+
+ private static final Logger LOG = LoggerFactory.getLogger(RANSliceClient.class);
+
+ private final SvcLogicService svcLogicService;
+
+ private String ErrorCode = "error-code";
+
+ public RANSliceClient(final SvcLogicService svcLogicService) {
+ this.svcLogicService = svcLogicService;
+ }
+
+ public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException
+ {
+ return svcLogicService.hasGraph(module, rpc, version, mode);
+ }
+
+
+ public Properties execute(String module, String rpc, String version, String mode, Properties parms, DOMDataBroker dataBroker)
+ throws SvcLogicException {
+
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : parms.keySet()) {
+ String parmName = (String) key;
+ String parmValue = parms.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogicService.execute(module, rpc, version, mode, parms, dataBroker);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+
+ if (!respProps.containsKey(ErrorCode)) {
+ respProps.setProperty(ErrorCode, "500");
+ }
+ } else {
+ if (!respProps.containsKey(ErrorCode)) {
+ respProps.setProperty(ErrorCode, "200");
+ }
+ }
+
+
+ return respProps;
+ }
+
+}
diff --git a/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceProvider.java b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceProvider.java
new file mode 100644
index 000000000..a88595bfb
--- /dev/null
+++ b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceProvider.java
@@ -0,0 +1,480 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * Modifications Copyright © 2018 IBM.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.features.sdnr.northbound.ranSlice;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.impl.AbstractForwardedDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200806.*;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200806.common.header.CommonHeaderBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200806.status.StatusBuilder;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import org.onap.ccsdk.features.sdnr.northbound.ranSlice.RANSliceResponseCode.*;
+
+/**
+ * Defines a base implementation for your provider. This class extends from a
+ * helper class which provides storage for the most commonly used components of
+ * the MD-SAL. Additionally the base class provides some basic logging and
+ * initialization / clean up methods.
+ *
+ */
+public class RANSliceProvider implements AutoCloseable, RanSliceApiService {
+
+ private class CommonRANSliceFields {
+ private StatusBuilder statusBuilder;
+ private CommonHeaderBuilder commonHeaderBuilder;
+ private Payload payload;
+
+ public CommonRANSliceFields(StatusBuilder statusBuilder, CommonHeaderBuilder commonHeaderBuilder) {
+ this.statusBuilder = statusBuilder;
+ this.commonHeaderBuilder = commonHeaderBuilder;
+ this.payload = null;
+ }
+
+ public CommonRANSliceFields(StatusBuilder statusBuilder, CommonHeaderBuilder commonHeaderBuilder, Payload payload) {
+ this.statusBuilder = statusBuilder;
+ this.commonHeaderBuilder = commonHeaderBuilder;
+ this.payload = payload;
+ }
+
+ public StatusBuilder getStatusBuilder() {
+ return statusBuilder;
+ }
+
+ public CommonHeaderBuilder getCommonHeaderBuilder() {
+ return commonHeaderBuilder;
+ }
+
+ public Payload getPayload() {
+ return payload;
+ }
+ }
+
+ private static final Logger LOG = LoggerFactory.getLogger(RANSliceProvider.class);
+
+ private static final String exceptionMessage = "Caught exception";
+
+ private static final String APPLICATION_NAME = "RANSlice";
+
+ private final ExecutorService executor;
+ protected DataBroker dataBroker;
+ protected DOMDataBroker domDataBroker;
+ protected NotificationPublishService notificationService;
+ protected RpcProviderRegistry rpcRegistry;
+ private final RANSliceClient RANSliceClient;
+
+ protected BindingAwareBroker.RpcRegistration<RanSliceApiService> rpcRegistration;
+
+ public RANSliceProvider(final DataBroker dataBroker, final NotificationPublishService notificationPublishService,
+ final RpcProviderRegistry rpcProviderRegistry, final RANSliceClient rANSliceClient) {
+
+ LOG.info("Creating provider for {}", APPLICATION_NAME);
+ executor = Executors.newFixedThreadPool(1);
+ this.dataBroker = dataBroker;
+ if (dataBroker instanceof AbstractForwardedDataBroker) {
+ domDataBroker = ((AbstractForwardedDataBroker) dataBroker).getDelegate();
+ }
+ notificationService = notificationPublishService;
+ rpcRegistry = rpcProviderRegistry;
+ this.RANSliceClient = rANSliceClient;
+ initialize();
+ }
+
+ public void initialize() {
+ LOG.info("Initializing {} for {}", this.getClass().getName(), APPLICATION_NAME);
+
+ if (rpcRegistration == null) {
+ if (rpcRegistry != null) {
+ rpcRegistration = rpcRegistry.addRpcImplementation(RanSliceApiService.class, this);
+ LOG.info("Initialization complete for {}", APPLICATION_NAME);
+ } else {
+ LOG.warn("Error initializing {} : rpcRegistry unset", APPLICATION_NAME);
+ }
+ }
+ }
+
+ protected void initializeChild() {
+ // Override if you have custom initialization intelligence
+ }
+
+ @Override
+ public void close() throws Exception {
+ LOG.info("Closing provider for " + APPLICATION_NAME);
+ executor.shutdown();
+ rpcRegistration.close();
+ LOG.info("Successfully closed provider for " + APPLICATION_NAME);
+ }
+
+
+//RPC configureNearRTRIC
+
+ @Override
+ public ListenableFuture<RpcResult<ConfigureNearRTRICOutput>> configureNearRTRIC(ConfigureNearRTRICInput input) {
+ ConfigureNearRTRICInputBuilder iBuilder = new ConfigureNearRTRICInputBuilder(input);
+ ConfigureNearRTRICOutputBuilder oBuilder = new ConfigureNearRTRICOutputBuilder();
+
+ try {
+ CommonRANSliceFields retval = callDG("configureNearRTRIC", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ } catch (RANSliceRpcInvocationException e) {
+ LOG.debug(exceptionMessage, e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<ConfigureNearRTRICOutput> rpcResult =
+ RpcResultBuilder.<ConfigureNearRTRICOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+
+ }
+
+ //RPC instantiateRANSlice
+
+ @Override
+ public ListenableFuture<RpcResult<InstantiateRANSliceOutput>> instantiateRANSlice(InstantiateRANSliceInput input) {
+ InstantiateRANSliceInputBuilder iBuilder = new InstantiateRANSliceInputBuilder(input);
+ InstantiateRANSliceOutputBuilder oBuilder = new InstantiateRANSliceOutputBuilder();
+
+ try {
+ CommonRANSliceFields retval = callDG("instantiateRANSlice", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ } catch (RANSliceRpcInvocationException e) {
+ LOG.debug(exceptionMessage, e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<InstantiateRANSliceOutput> rpcResult =
+ RpcResultBuilder.<InstantiateRANSliceOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+
+ }
+
+
+
+ //RPC configureRANSliceInstance
+
+ @Override
+ public ListenableFuture<RpcResult<ConfigureRANSliceInstanceOutput>> configureRANSliceInstance(ConfigureRANSliceInstanceInput input) {
+ ConfigureRANSliceInstanceInputBuilder iBuilder = new ConfigureRANSliceInstanceInputBuilder(input);
+ ConfigureRANSliceInstanceOutputBuilder oBuilder = new ConfigureRANSliceInstanceOutputBuilder();
+
+ try {
+ CommonRANSliceFields retval = callDG("configureRANSliceInstance", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ } catch (RANSliceRpcInvocationException e) {
+ LOG.debug(exceptionMessage, e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<ConfigureRANSliceInstanceOutput> rpcResult =
+ RpcResultBuilder.<ConfigureRANSliceInstanceOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+
+ }
+
+ //RPC configureCU
+
+ @Override
+ public ListenableFuture<RpcResult<ConfigureCUOutput>> configureCU(ConfigureCUInput input) {
+ ConfigureCUInputBuilder iBuilder = new ConfigureCUInputBuilder(input);
+ ConfigureCUOutputBuilder oBuilder = new ConfigureCUOutputBuilder();
+
+ try {
+ CommonRANSliceFields retval = callDG("configureCU", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ } catch (RANSliceRpcInvocationException e) {
+ LOG.debug(exceptionMessage, e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<ConfigureCUOutput> rpcResult =
+ RpcResultBuilder.<ConfigureCUOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+
+ }
+
+ //RPC configureDU
+
+ @Override
+ public ListenableFuture<RpcResult<ConfigureDUOutput>> configureDU(ConfigureDUInput input) {
+ ConfigureDUInputBuilder iBuilder = new ConfigureDUInputBuilder(input);
+ ConfigureDUOutputBuilder oBuilder = new ConfigureDUOutputBuilder();
+
+ try {
+ CommonRANSliceFields retval = callDG("configureDU", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ } catch (RANSliceRpcInvocationException e) {
+ LOG.debug(exceptionMessage, e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<ConfigureDUOutput> rpcResult =
+ RpcResultBuilder.<ConfigureDUOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+
+ }
+
+ //RPC activateRANSliceInstance
+
+ @Override
+ public ListenableFuture<RpcResult<ActivateRANSliceInstanceOutput>> activateRANSliceInstance(ActivateRANSliceInstanceInput input) {
+ ActivateRANSliceInstanceInputBuilder iBuilder = new ActivateRANSliceInstanceInputBuilder(input);
+ ActivateRANSliceInstanceOutputBuilder oBuilder = new ActivateRANSliceInstanceOutputBuilder();
+
+ try {
+ CommonRANSliceFields retval = callDG("activateRANSliceInstance", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ } catch (RANSliceRpcInvocationException e) {
+ LOG.debug(exceptionMessage, e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<ActivateRANSliceInstanceOutput> rpcResult =
+ RpcResultBuilder.<ActivateRANSliceInstanceOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+
+ }
+
+
+ //RPC deactivateRANSliceInstance
+
+ @Override
+ public ListenableFuture<RpcResult<DeactivateRANSliceInstanceOutput>> deactivateRANSliceInstance(DeactivateRANSliceInstanceInput input) {
+ DeactivateRANSliceInstanceInputBuilder iBuilder = new DeactivateRANSliceInstanceInputBuilder(input);
+ DeactivateRANSliceInstanceOutputBuilder oBuilder = new DeactivateRANSliceInstanceOutputBuilder();
+
+ try {
+ CommonRANSliceFields retval = callDG("deactivateRANSliceInstance", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ } catch (RANSliceRpcInvocationException e) {
+ LOG.debug(exceptionMessage, e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<DeactivateRANSliceInstanceOutput> rpcResult =
+ RpcResultBuilder.<DeactivateRANSliceInstanceOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+
+ }
+
+ //RPC terminateRANSliceInstance
+
+ @Override
+ public ListenableFuture<RpcResult<TerminateRANSliceInstanceOutput>> terminateRANSliceInstance(TerminateRANSliceInstanceInput input) {
+ TerminateRANSliceInstanceInputBuilder iBuilder = new TerminateRANSliceInstanceInputBuilder(input);
+ TerminateRANSliceInstanceOutputBuilder oBuilder = new TerminateRANSliceInstanceOutputBuilder();
+
+ try {
+ CommonRANSliceFields retval = callDG("terminateRANSliceInstance", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ } catch (RANSliceRpcInvocationException e) {
+ LOG.debug(exceptionMessage, e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<TerminateRANSliceInstanceOutput> rpcResult =
+ RpcResultBuilder.<TerminateRANSliceInstanceOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+
+ }
+
+ //RPC determineRANSliceResources
+
+ @Override
+ public ListenableFuture<RpcResult<DetermineRANSliceResourcesOutput>> determineRANSliceResources(DetermineRANSliceResourcesInput input) {
+ DetermineRANSliceResourcesInputBuilder iBuilder = new DetermineRANSliceResourcesInputBuilder(input);
+ DetermineRANSliceResourcesOutputBuilder oBuilder = new DetermineRANSliceResourcesOutputBuilder();
+
+ try {
+ CommonRANSliceFields retval = callDG("determineRANSliceResources", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ } catch (RANSliceRpcInvocationException e) {
+ LOG.debug(exceptionMessage, e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<DetermineRANSliceResourcesOutput> rpcResult =
+ RpcResultBuilder.<DetermineRANSliceResourcesOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+
+ }
+
+ //RPC cm-notify
+
+ @Override
+ public ListenableFuture<RpcResult<ConfigNotificationOutput>> configNotification(ConfigNotificationInput input) {
+
+ ConfigNotificationInputBuilder iBuilder = new ConfigNotificationInputBuilder(input);
+ ConfigNotificationOutputBuilder oBuilder = new ConfigNotificationOutputBuilder();
+
+ try {
+ CommonRANSliceFields retval = callDG("configNotification", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ } catch (RANSliceRpcInvocationException e) {
+ LOG.debug(exceptionMessage, e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<ConfigNotificationOutput> rpcResult =
+ RpcResultBuilder.<ConfigNotificationOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+
+ }
+
+
+ private CommonRANSliceFields callDG(String rpcName, Object input) throws RANSliceRpcInvocationException {
+
+ StatusBuilder statusBuilder = new StatusBuilder();
+
+ if (input == null) {
+ LOG.debug("Rejecting " +rpcName+ " because of invalid input");
+ statusBuilder.setCode(RANSliceResponseCode.REJECT_INVALID_INPUT.getValue());
+ statusBuilder.setMessage("REJECT - INVALID INPUT. Missing input");
+ CommonHeaderBuilder hBuilder = new CommonHeaderBuilder();
+ hBuilder.setApiVer("1");
+ hBuilder.setOriginatorId("unknown");
+ hBuilder.setRequestId("unset");
+ hBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date())));
+ throw new RANSliceRpcInvocationException(statusBuilder.build(), hBuilder.build());
+ }
+
+ CommonHeaderBuilder hBuilder = new CommonHeaderBuilder(((CommonHeader)input).getCommonHeader());
+
+ // add input to parms
+ LOG.info("Adding INPUT data for "+ rpcName +" input: " + input.toString());
+ Properties inputProps = new Properties();
+ MdsalHelper.toProperties(inputProps, input);
+
+ LOG.info("Printing SLI parameters to be passed");
+
+ // iterate properties file to get key-value pairs
+ for (String key : inputProps.stringPropertyNames()) {
+ String value = inputProps.getProperty(key);
+ LOG.info("The SLI parameter in " + key + " is: " + value);
+ }
+
+ Properties respProps = new Properties();
+
+ // Call SLI sync method
+ try
+ {
+ if (RANSliceClient.hasGraph("ran-slice-api", rpcName , null, "sync"))
+ {
+ try
+ {
+ respProps = RANSliceClient.execute("ran-slice-api", rpcName, null, "sync", inputProps, domDataBroker);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception executing service logic for "+ rpcName, e);
+ statusBuilder.setCode(RANSliceResponseCode.FAILURE_DG_FAILURE.getValue());
+ statusBuilder.setMessage("FAILURE - DG FAILURE ("+e.getMessage()+")");
+ throw new RANSliceRpcInvocationException(statusBuilder.build(), hBuilder.build());
+ }
+ } else {
+ LOG.error("No service logic active for RANSlice: '" + rpcName + "'");
+
+ statusBuilder.setCode(RANSliceResponseCode.REJECT_DG_NOT_FOUND.getValue());
+ statusBuilder.setMessage("FAILURE - DG not found for action "+rpcName);
+ throw new RANSliceRpcInvocationException(statusBuilder.build(), hBuilder.build());
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception looking for service logic", e);
+
+ statusBuilder.setCode(RANSliceResponseCode.FAILURE_DG_FAILURE.getValue());
+ statusBuilder.setMessage("FAILURE - Unexpected error looking for DG ("+e.getMessage()+")");
+ throw new RANSliceRpcInvocationException(statusBuilder.build(), hBuilder.build());
+ }
+
+
+ StatusBuilder sBuilder = new StatusBuilder();
+ MdsalHelper.toBuilder(respProps, sBuilder);
+ MdsalHelper.toBuilder(respProps, hBuilder);
+
+ Payload payload = null;
+ String payloadValue = respProps.getProperty("payload");
+ if (payloadValue != null) {
+ payload = new Payload(payloadValue);
+ }
+
+ String statusCode = sBuilder.getCode().toString();
+
+ if (!"400".equals(statusCode)) {
+ LOG.error("Returned FAILED for "+rpcName+" error code: '" + statusCode + "'");
+ } else {
+ LOG.info("Returned SUCCESS for "+rpcName+" ");
+ }
+
+ return new CommonRANSliceFields(sBuilder, hBuilder, payload);
+
+ }
+
+}
diff --git a/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceResponseCode.java b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceResponseCode.java
new file mode 100644
index 000000000..814b27e64
--- /dev/null
+++ b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceResponseCode.java
@@ -0,0 +1,51 @@
+package org.onap.ccsdk.features.sdnr.northbound.ranSlice;
+
+public enum RANSliceResponseCode {
+
+ // Accepted category
+ ACCEPT_ACCEPTED(100),
+ // Error category
+ ERROR_UNEXPECTED_ERROR(200),
+ // Rejected category
+ REJECT_REJECTED(300),
+ REJECT_INVALID_INPUT(301),
+ REJECT_MISSING_PARAM(302),
+ REJECT_PARSING_FAILED(303),
+ REJECT_NO_TRANSITION(304),
+ REJECT_ACTION_NOT_SUPPORTED(305),
+ REJECT_VNF_NOT_FOUND(306),
+ REJECT_DG_NOT_FOUND(307),
+ REJECT_WORKFLOW_NOT_FOUND(308),
+ REJECT_UNSTABLE_VNF(309),
+ REJECT_LOCKING_FAILURE(310),
+ REJECT_EXPIRED_REQUEST(311),
+ REJECT_DUPLICATE_REQUEST(312),
+ REJECT_MISSING_AAI_DATA(313),
+ REJECT_MULTIPLE_REQUESTS_FOR_SEARCH(315),
+ REJECT_POLICY_VALIDATION_FAILURE(316),
+ // Success category
+ SUCCESS(400),
+ // Failure category
+ FAILURE_DG_FAILURE(401),
+ FAILURE_NO_TRANSITION(402),
+ FAILURE_AAI_FAILURE(403),
+ FAILURE_EXPIRED_REQUEST(404),
+ FAILURE_UNEXPECTED_FAILURE(405),
+ FAILURE_UNSTABLE_VNF(406),
+ FAILURE_REQUEST_NOT_SUPPORTED(450),
+ // Partial success
+ PARTIAL_SUCCESS(500);
+
+
+
+ private int value;
+ private RANSliceResponseCode(int value) {
+ this.value = value;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+
+}
diff --git a/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceRpcInvocationException.java b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceRpcInvocationException.java
new file mode 100644
index 000000000..18b66312d
--- /dev/null
+++ b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceRpcInvocationException.java
@@ -0,0 +1,25 @@
+package org.onap.ccsdk.features.sdnr.northbound.ranSlice;
+
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200806.common.header.CommonHeader;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200806.status.Status;
+
+public class RANSliceRpcInvocationException extends SvcLogicException {
+
+ private Status status;
+ private CommonHeader commonHeader;
+
+ public RANSliceRpcInvocationException(Status status, CommonHeader commonHeader) {
+ this.status = status;
+ this.commonHeader = commonHeader;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public CommonHeader getCommonHeader() {
+ return commonHeader;
+ }
+
+}
diff --git a/sdnr/northbound/ranSlice/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/sdnr/northbound/ranSlice/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
new file mode 100644
index 000000000..57ebfbfcc
--- /dev/null
+++ b/sdnr/northbound/ranSlice/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ ============LICENSE_START=======================================================
+ ~ ONAP : ccsdk features
+ ~ ================================================================================
+ ~ Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ ~ ================================================================================
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~ ============LICENSE_END=======================================================
+ ~
+ -->
+
+<blueprint xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" odl:use-default-for-reference-types="true">
+
+ <reference id="svcLogicService"
+ interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService"/>
+
+ <bean id="client" class="org.onap.ccsdk.features.sdnr.northbound.ranSlice.RANSliceClient">
+ <argument ref="svcLogicService"/>
+ </bean>
+
+ <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default"/>
+
+ <reference id="notificationService"
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default"/>
+
+ <reference id="rpcRegistry" interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default"/>
+
+ <bean id="provider" class="org.onap.ccsdk.features.sdnr.northbound.ranSlice.RANSliceProvider">
+ <argument ref="dataBroker"/>
+ <argument ref="rpcRegistry"/>
+ <argument ref="notificationService"/>
+ <argument ref="client"/>
+ </bean>
+
+ <odl:rpc-implementation ref="provider"/>
+
+</blueprint>
diff --git a/sdnr/northbound/ranSlice/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/northbound/ranSlice/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
new file mode 100644
index 000000000..57ebfbfcc
--- /dev/null
+++ b/sdnr/northbound/ranSlice/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ ============LICENSE_START=======================================================
+ ~ ONAP : ccsdk features
+ ~ ================================================================================
+ ~ Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ ~ ================================================================================
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~ ============LICENSE_END=======================================================
+ ~
+ -->
+
+<blueprint xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" odl:use-default-for-reference-types="true">
+
+ <reference id="svcLogicService"
+ interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService"/>
+
+ <bean id="client" class="org.onap.ccsdk.features.sdnr.northbound.ranSlice.RANSliceClient">
+ <argument ref="svcLogicService"/>
+ </bean>
+
+ <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default"/>
+
+ <reference id="notificationService"
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default"/>
+
+ <reference id="rpcRegistry" interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default"/>
+
+ <bean id="provider" class="org.onap.ccsdk.features.sdnr.northbound.ranSlice.RANSliceProvider">
+ <argument ref="dataBroker"/>
+ <argument ref="rpcRegistry"/>
+ <argument ref="notificationService"/>
+ <argument ref="client"/>
+ </bean>
+
+ <odl:rpc-implementation ref="provider"/>
+
+</blueprint>