From 3da6a9ea28f94ab6e33e52a72ca8af86f38ed8e7 Mon Sep 17 00:00:00 2001 From: Sandeep Shah Date: Sat, 6 Apr 2019 18:53:15 -0500 Subject: SDNR OOF PCI/ANR POC Feature Implementation OOF PCI/ANR POC use case implemented as a Karaf feature, leveraging CCSDK framework. Change-Id: Idb5d9987826234888a1ab94ce8bf2a63e8c6d205 Issue-ID: CCSDK-1203 Signed-off-by: SandeepLinux --- .../ccsdk-features-sdnr-northbound-all/pom.xml | 48 +++ sdnr/northbound/features/installer/pom.xml | 90 +++++ .../src/assembly/assemble_mvnrepo_zip.xml | 29 ++ sdnr/northbound/features/pom.xml | 26 ++ sdnr/northbound/oofpcipoc/feature/pom.xml | 50 +++ sdnr/northbound/oofpcipoc/installer/pom.xml | 99 +++++ .../src/assembly/assemble_mvnrepo_zip.xml | 49 +++ sdnr/northbound/oofpcipoc/model/pom.xml | 2 +- sdnr/northbound/oofpcipoc/pom.xml | 29 ++ sdnr/northbound/oofpcipoc/provider/pom.xml | 130 ++++++ .../sdnr/northbound/oofpcipoc/OofpcipocClient.java | 307 ++++++++++++++ .../northbound/oofpcipoc/OofpcipocProvider.java | 445 +++++++++++++++++++++ .../org/opendaylight/blueprint/impl-blueprint.xml | 34 ++ 13 files changed, 1337 insertions(+), 1 deletion(-) create mode 100644 sdnr/northbound/features/ccsdk-features-sdnr-northbound-all/pom.xml create mode 100644 sdnr/northbound/features/installer/pom.xml create mode 100644 sdnr/northbound/features/installer/src/assembly/assemble_mvnrepo_zip.xml create mode 100644 sdnr/northbound/features/pom.xml create mode 100644 sdnr/northbound/oofpcipoc/feature/pom.xml create mode 100644 sdnr/northbound/oofpcipoc/installer/pom.xml create mode 100644 sdnr/northbound/oofpcipoc/installer/src/assembly/assemble_mvnrepo_zip.xml create mode 100644 sdnr/northbound/oofpcipoc/pom.xml create mode 100644 sdnr/northbound/oofpcipoc/provider/pom.xml create mode 100644 sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocClient.java create mode 100644 sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocProvider.java create mode 100644 sdnr/northbound/oofpcipoc/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml diff --git a/sdnr/northbound/features/ccsdk-features-sdnr-northbound-all/pom.xml b/sdnr/northbound/features/ccsdk-features-sdnr-northbound-all/pom.xml new file mode 100644 index 000000000..d2ac73a1e --- /dev/null +++ b/sdnr/northbound/features/ccsdk-features-sdnr-northbound-all/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.2.2-SNAPSHOT + + + + org.onap.ccsdk.features.sdnr.northbound + sdnr-northbound-all + 0.4.2-SNAPSHOT + feature + + ccsdk-features-sdnr-northbound :: features :: ${project.artifactId} + + + + ${project.groupId} + sdnr-oofpcipoc + ${project.version} + xml + features + + + diff --git a/sdnr/northbound/features/installer/pom.xml b/sdnr/northbound/features/installer/pom.xml new file mode 100644 index 000000000..482390b37 --- /dev/null +++ b/sdnr/northbound/features/installer/pom.xml @@ -0,0 +1,90 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.2.2-SNAPSHOT + + + + org.onap.ccsdk.features.sdnr.northbound + sdnr-northbound-features-installer + 0.4.2-SNAPSHOT + pom + + ccsdk-features-sdnr-northbound :: features :: ${project.artifactId} + + + sdnr-northbound-all + false + + + + + org.onap.ccsdk.features.sdnr.northbound + ${application.name} + ${project.version} + xml + features + + + * + * + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + + copy-dependencies + + prepare-package + + false + ${project.build.directory}/assembly/system + false + true + true + true + false + false + org.onap.ccsdk.features.sdnr.northbound + provided + + + + + + maven-assembly-plugin + + + maven-repo-zip + + single + + package + + true + stage/${application.name}-${project.version} + + src/assembly/assemble_mvnrepo_zip.xml + + true + + + + + + + diff --git a/sdnr/northbound/features/installer/src/assembly/assemble_mvnrepo_zip.xml b/sdnr/northbound/features/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..86b07f1f3 --- /dev/null +++ b/sdnr/northbound/features/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,29 @@ + + + + repo + + + zip + + + + false + + + + target/assembly/ + . + + + + + + + + diff --git a/sdnr/northbound/features/pom.xml b/sdnr/northbound/features/pom.xml new file mode 100644 index 000000000..611fbbac0 --- /dev/null +++ b/sdnr/northbound/features/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.2.2-SNAPSHOT + + + + org.onap.ccsdk.features.sdnr.northbound + sdnr-northbound-feature-aggregator + 0.4.2-SNAPSHOT + pom + + ccsdk-features-sdnr-northbound :: features + + + ccsdk-features-sdnr-northbound-all + installer + + + diff --git a/sdnr/northbound/oofpcipoc/feature/pom.xml b/sdnr/northbound/oofpcipoc/feature/pom.xml new file mode 100644 index 000000000..b2f7153c1 --- /dev/null +++ b/sdnr/northbound/oofpcipoc/feature/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.2.2-SNAPSHOT + + + + org.onap.ccsdk.features.sdnr.northbound + sdnr-oofpcipoc + 0.4.2-SNAPSHOT + feature + + ccsdk-features-sdnr-northbound :: oofpcipoc :: ${project.artifactId} + + + + + + + ${project.groupId} + oofpcipoc-provider + ${project.version} + + + + diff --git a/sdnr/northbound/oofpcipoc/installer/pom.xml b/sdnr/northbound/oofpcipoc/installer/pom.xml new file mode 100644 index 000000000..22f1e6d96 --- /dev/null +++ b/sdnr/northbound/oofpcipoc/installer/pom.xml @@ -0,0 +1,99 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.2.2-SNAPSHOT + + + + org.onap.ccsdk.features.sdnr.northbound + oofpcipoc-installer + 0.4.2-SNAPSHOT + pom + + ccsdk-features-sdnr-northbound :: oofpcipoc :: ${project-artifactId} + + + sdnr-oofpcipoc + false + + + + + + org.onap.ccsdk.features.sdnr.northbound + ${application.name} + ${project.version} + xml + features + + + * + * + + + + + + org.onap.ccsdk.features.sdnr.northbound + oofpcipoc-provider + ${project.version} + + + + + + + + + maven-assembly-plugin + + + maven-repo-zip + + single + + package + + true + stage/${application.name}-${project.version} + + src/assembly/assemble_mvnrepo_zip.xml + + true + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + + copy-dependencies + + prepare-package + + false + ${project.build.directory}/assembly/system + false + true + true + true + false + false + oofpcipoc-model,oofpcipoc-provider,sdnr-oofpcipoc + provided + + + + + + + diff --git a/sdnr/northbound/oofpcipoc/installer/src/assembly/assemble_mvnrepo_zip.xml b/sdnr/northbound/oofpcipoc/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..c4eb9aa25 --- /dev/null +++ b/sdnr/northbound/oofpcipoc/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,49 @@ + + + + + + repo + + zip + + + + false + + + + target/assembly/ + . + + + + + + + + diff --git a/sdnr/northbound/oofpcipoc/model/pom.xml b/sdnr/northbound/oofpcipoc/model/pom.xml index 1fa0a9129..1c3334494 100644 --- a/sdnr/northbound/oofpcipoc/model/pom.xml +++ b/sdnr/northbound/oofpcipoc/model/pom.xml @@ -11,7 +11,7 @@ org.onap.ccsdk.features.sdnr.northbound oofpcipoc-model - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle diff --git a/sdnr/northbound/oofpcipoc/pom.xml b/sdnr/northbound/oofpcipoc/pom.xml new file mode 100644 index 000000000..d6b957b09 --- /dev/null +++ b/sdnr/northbound/oofpcipoc/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.2.2-SNAPSHOT + + + + org.onap.ccsdk.features.sdnr.northbound + oofpcipoc + 0.4.2-SNAPSHOT + pom + + ccsdk-features-sdnr-northbound :: oofpcipoc + + + model + feature + provider + installer + + + + oofpcipoc + + diff --git a/sdnr/northbound/oofpcipoc/provider/pom.xml b/sdnr/northbound/oofpcipoc/provider/pom.xml new file mode 100644 index 000000000..fe3e2fe55 --- /dev/null +++ b/sdnr/northbound/oofpcipoc/provider/pom.xml @@ -0,0 +1,130 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 1.2.2-SNAPSHOT + + + + org.onap.ccsdk.features.sdnr.northbound + oofpcipoc-provider + 0.4.2-SNAPSHOT + bundle + + + + + org.opendaylight.controller + mdsal-artifacts + 1.6.1 + pom + import + + + + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import + + + + + + + + + + org.onap.ccsdk.features.sdnr.northbound + oofpcipoc-model + ${project.version} + + + + org.opendaylight.controller + sal-binding-api + + + org.opendaylight.controller + sal-common-util + + + org.opendaylight.controller + sal-core-api + + + org.opendaylight.yangtools + yang-data-impl + + + junit + junit + test + + + org.mockito + mockito-core + test + + + + org.onap.ccsdk.sli.core + sli-common + compile + + + org.onap.ccsdk.sli.core + sli-provider + compile + + + org.onap.ccsdk.sli.core + utils-provider + + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.codehaus.mojo + properties-maven-plugin + [1.0.0,) + + set-system-properties + + + + + + + + + + + + + + + diff --git a/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocClient.java b/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocClient.java new file mode 100644 index 000000000..eca01d990 --- /dev/null +++ b/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocClient.java @@ -0,0 +1,307 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 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========================================================= + */ + +package org.onap.ccsdk.features.sdnr.northbound.oofpcipoc; + +import java.util.Properties; + +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.GreetingOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.ConfigurationPhyCellIdOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.AddNeighborOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.DeleteNeighborOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.GenericNeighborConfigurationOutputBuilder; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class OofpcipocClient { + + private static final Logger LOG = LoggerFactory.getLogger(OofpcipocClient.class); + + private SvcLogicService svcLogicService = null; + + public OofpcipocClient(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, GreetingOutputBuilder serviceData) + throws SvcLogicException { + + Properties parms = new Properties(); + + return execute(module,rpc,version, mode,serviceData,parms); + } + + public Properties execute(String module, String rpc, String version, String mode, GreetingOutputBuilder serviceData, Properties parms) + throws SvcLogicException { + Properties localProp; + localProp = MdsalHelper.toProperties(parms, serviceData); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters passed to SLI"); + + for (Object key : localProp.keySet()) { + String parmName = (String) key; + String parmValue = localProp.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp); + + 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"))) { + return respProps; + } + + MdsalHelper.toBuilder(respProps, serviceData); + + return respProps; + } + + public Properties execute(String module, String rpc, String version, String mode, ConfigurationPhyCellIdOutputBuilder serviceData) + throws SvcLogicException { + + Properties parms = new Properties(); + + return execute(module,rpc,version, mode,serviceData,parms); + } + + public Properties execute(String module, String rpc, String version, String mode, ConfigurationPhyCellIdOutputBuilder serviceData, Properties parms) + throws SvcLogicException { + + Properties localProp; + + localProp = MdsalHelper.toProperties(parms, serviceData); + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters passed to SLI"); + + for (Object key : localProp.keySet()) { + String parmName = (String) key; + String parmValue = localProp.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp); + + 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"))) { + return respProps; + } + + MdsalHelper.toBuilder(respProps, serviceData); + + return respProps; + } + +// addNeighbor + public Properties execute(String module, String rpc, String version, String mode, AddNeighborOutputBuilder serviceData) + throws SvcLogicException { + + Properties parms = new Properties(); + + return execute(module,rpc,version, mode,serviceData,parms); + } + + public Properties execute(String module, String rpc, String version, String mode, AddNeighborOutputBuilder serviceData, Properties parms) + throws SvcLogicException { + Properties localProp; + localProp = MdsalHelper.toProperties(parms, serviceData); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters passed to SLI"); + + for (Object key : localProp.keySet()) { + String parmName = (String) key; + String parmValue = localProp.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp); + + 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"))) { + return respProps; + } + + MdsalHelper.toBuilder(respProps, serviceData); + + return respProps; + } + + +// deleteNeighbor + +public Properties execute(String module, String rpc, String version, String mode, DeleteNeighborOutputBuilder serviceData) + throws SvcLogicException { + + Properties parms = new Properties(); + + return execute(module,rpc,version, mode,serviceData,parms); +} + +public Properties execute(String module, String rpc, String version, String mode, DeleteNeighborOutputBuilder serviceData, Properties parms) + throws SvcLogicException { + Properties localProp; + localProp = MdsalHelper.toProperties(parms, serviceData); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters passed to SLI"); + + for (Object key : localProp.keySet()) { + String parmName = (String) key; + String parmValue = localProp.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp); + + 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"))) { + return respProps; + } + + MdsalHelper.toBuilder(respProps, serviceData); + + return respProps; +} + + +// genericNeighborConfiguration + +public Properties execute(String module, String rpc, String version, String mode, GenericNeighborConfigurationOutputBuilder serviceData) + throws SvcLogicException { + + Properties parms = new Properties(); + + return execute(module,rpc,version, mode,serviceData,parms); +} + +public Properties execute(String module, String rpc, String version, String mode, GenericNeighborConfigurationOutputBuilder serviceData, Properties parms) + throws SvcLogicException { + Properties localProp; + localProp = MdsalHelper.toProperties(parms, serviceData); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters passed to SLI"); + + for (Object key : localProp.keySet()) { + String parmName = (String) key; + String parmValue = localProp.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp); + + 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"))) { + return respProps; + } + + MdsalHelper.toBuilder(respProps, serviceData); + + return respProps; +} + +} diff --git a/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocProvider.java b/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocProvider.java new file mode 100644 index 000000000..f52a72d10 --- /dev/null +++ b/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocProvider.java @@ -0,0 +1,445 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 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========================================================= + */ + + package org.onap.ccsdk.features.sdnr.northbound.oofpcipoc; + +import java.util.Properties; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +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.sal.binding.api.BindingAwareBroker; +import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.*; + +import com.google.common.base.Preconditions; +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.base.Preconditions; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; + +/** + * 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 OofpcipocProvider implements AutoCloseable, OofpcipocApiService { + + private static final Logger LOG = LoggerFactory.getLogger(OofpcipocProvider.class); + + private static final String APPLICATION_NAME = "Oofpcipoc"; + + private final ExecutorService executor; + + protected DataBroker dataBroker; + protected NotificationPublishService notificationService; + protected RpcProviderRegistry rpcRegistry; + protected BindingAwareBroker.RpcRegistration rpcRegistration; + private final OofpcipocClient OofpcipocClient; + + + public OofpcipocProvider(final DataBroker dataBroker, + final NotificationPublishService notificationPublishService, + final RpcProviderRegistry rpcProviderRegistry, + final OofpcipocClient OofpcipocClient) { + + this.LOG.info( "Creating provider for {}", APPLICATION_NAME); + executor = Executors.newFixedThreadPool(1); + this.dataBroker = dataBroker; + this.notificationService = notificationPublishService; + this.rpcRegistry = rpcProviderRegistry; + this.OofpcipocClient = OofpcipocClient; + initialize(); + } + + public void initialize(){ + LOG.info( "Initializing provider for {}", APPLICATION_NAME); + rpcRegistration = rpcRegistry.addRpcImplementation(OofpcipocApiService.class, this); + LOG.info( "Initialization complete for {}", 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); + } + + @Override + public ListenableFuture> greeting( + GreetingInput input) { + final String svcOperation = "greeting"; + + Properties parms = new Properties(); + GreetingOutputBuilder serviceDataBuilder = new GreetingOutputBuilder(); + + LOG.info( "Reached RPC greeting"); + + LOG.info( svcOperation +" called." ); + + if(input == null ) { + LOG.debug("exiting " +svcOperation+ " because of invalid input"); + serviceDataBuilder.setResponse("Input is null"); + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(serviceDataBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // add input to parms + LOG.info("Adding INPUT data for "+svcOperation+" input: " + input); + GreetingInputBuilder inputBuilder = new GreetingInputBuilder(input); + MdsalHelper.toProperties(parms, inputBuilder.build()); + + // Call SLI sync method + try + { + if (OofpcipocClient.hasGraph("Oofpcipoc", svcOperation , null, "sync")) + { + LOG.info( "OofpcipocClient has a Directed Graph for '" + svcOperation + "'"); + try + { + OofpcipocClient.execute("Oofpcipoc", svcOperation, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + LOG.error("Caught exception executing service logic for "+ svcOperation, e); + serviceDataBuilder.setResponse("500"); + } + } else { + LOG.error("No service logic active for Oofpcipoc: '" + svcOperation + "'"); + serviceDataBuilder.setResponse("503"); + } + } + catch (Exception e) + { + LOG.error("Caught exception looking for service logic", e); + serviceDataBuilder.setResponse("500"); + } + + String errorCode = serviceDataBuilder.getResponse(); + + if (!("0".equals(errorCode) || "200".equals(errorCode))) { + LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'"); + } else { + LOG.info("Returned SUCCESS for "+svcOperation+" "); + serviceDataBuilder.setResponse("Welcome OOF POC " + input.getSalutation()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(serviceDataBuilder.build()).build(); + + LOG.info("Successful exit from greeting "); + + return Futures.immediateFuture(rpcResult); + } + +// RPC configuration-phy-cell-id + @Override + public ListenableFuture> configurationPhyCellId( + ConfigurationPhyCellIdInput input) { + final String svcOperation = "configuration-phy-cell-id"; + + Properties parms = new Properties(); + ConfigurationPhyCellIdOutputBuilder serviceDataBuilder = new ConfigurationPhyCellIdOutputBuilder(); + + LOG.info( "Reached RPC configurationPhyCellId"); + + LOG.info( svcOperation +" called." ); + + if(input == null ) { + LOG.debug("exiting " +svcOperation+ " because of invalid input"); + serviceDataBuilder.setResponseCode("Input is null"); + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(serviceDataBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // add input to parms + LOG.info("Adding INPUT data for "+svcOperation+" input: " + input); + ConfigurationPhyCellIdInputBuilder inputBuilder = new ConfigurationPhyCellIdInputBuilder(input); + MdsalHelper.toProperties(parms, inputBuilder.build()); + + // Call SLI sync method + try + { + + if (OofpcipocClient.hasGraph("Oofpcipoc", svcOperation , null, "sync")) + { + LOG.info( "OofpcipocClient has a Directed Graph for '" + svcOperation + "'"); + + try + { + OofpcipocClient.execute("Oofpcipoc", svcOperation, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + LOG.error("Caught exception executing service logic for "+ svcOperation, e); + serviceDataBuilder.setResponseCode("500"); + } + } else { + LOG.error("No service logic active for Oofpcipoc: '" + svcOperation + "'"); + serviceDataBuilder.setResponseCode("503"); + } + } + catch (Exception e) + { + LOG.error("Caught exception looking for service logic", e); + serviceDataBuilder.setResponseCode("500"); + } + + String errorCode = serviceDataBuilder.getResponseCode(); + + if (!("0".equals(errorCode) || "200".equals(errorCode))) { + LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'"); + } else { + LOG.info("Returned SUCCESS for "+svcOperation+" "); + serviceDataBuilder.setResponseCode("Welcome OOF POC. Number of FAP entries " + input.getFapServiceNumberOfEntries()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(serviceDataBuilder.build()).build(); + + return Futures.immediateFuture(rpcResult); + } + + // RPC add-neighbor + @Override + public ListenableFuture> addNeighbor( + AddNeighborInput input) { + final String svcOperation = "add-neighbor"; + + Properties parms = new Properties(); + AddNeighborOutputBuilder serviceDataBuilder = new AddNeighborOutputBuilder(); + + LOG.info( "Reached RPC addNeighbor"); + + LOG.info( svcOperation +" called." ); + + if(input == null ) { + LOG.debug("exiting " +svcOperation+ " because of invalid input"); + serviceDataBuilder.setResponseCode("Input is null"); + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(serviceDataBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // add input to parms + LOG.info("Adding INPUT data for "+svcOperation+" input: " + input); + AddNeighborInputBuilder inputBuilder = new AddNeighborInputBuilder(input); + MdsalHelper.toProperties(parms, inputBuilder.build()); + + // Call SLI sync method + try + { + + if (OofpcipocClient.hasGraph("Oofpcipoc", svcOperation , null, "sync")) + { + LOG.info( "OofpcipocClient has a Directed Graph for '" + svcOperation + "'"); + + try + { + OofpcipocClient.execute("Oofpcipoc", svcOperation, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + LOG.error("Caught exception executing service logic for "+ svcOperation, e); + serviceDataBuilder.setResponseCode("500"); + } + } else { + LOG.error("No service logic active for Oofpcipoc: '" + svcOperation + "'"); + serviceDataBuilder.setResponseCode("503"); + } + } + catch (Exception e) + { + LOG.error("Caught exception looking for service logic", e); + serviceDataBuilder.setResponseCode("500"); + } + + String errorCode = serviceDataBuilder.getResponseCode(); + + if (!("0".equals(errorCode) || "200".equals(errorCode))) { + LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'"); + } else { + LOG.info("Returned SUCCESS for "+svcOperation+" "); + serviceDataBuilder.setResponseCode("Welcome OOF POC. Number of Neighbor entries to be added " + input.getLteCellNumberOfEntries()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(serviceDataBuilder.build()).build(); + + return Futures.immediateFuture(rpcResult); + } + + // RPC delete-neighbor + @Override + public ListenableFuture> deleteNeighbor( + DeleteNeighborInput input) { + final String svcOperation = "delete-neighbor"; + + Properties parms = new Properties(); + DeleteNeighborOutputBuilder serviceDataBuilder = new DeleteNeighborOutputBuilder(); + + LOG.info( "Reached RPC deleteNeighbor"); + + LOG.info( svcOperation +" called." ); + + if(input == null ) { + LOG.debug("exiting " +svcOperation+ " because of invalid input"); + serviceDataBuilder.setResponseCode("Input is null"); + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(serviceDataBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // add input to parms + LOG.info("Adding INPUT data for "+svcOperation+" input: " + input); + DeleteNeighborInputBuilder inputBuilder = new DeleteNeighborInputBuilder(input); + MdsalHelper.toProperties(parms, inputBuilder.build()); + + // Call SLI sync method + try + { + + if (OofpcipocClient.hasGraph("Oofpcipoc", svcOperation , null, "sync")) + { + LOG.info( "OofpcipocClient has a Directed Graph for '" + svcOperation + "'"); + + try + { + OofpcipocClient.execute("Oofpcipoc", svcOperation, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + LOG.error("Caught exception executing service logic for "+ svcOperation, e); + serviceDataBuilder.setResponseCode("500"); + } + } else { + LOG.error("No service logic active for Oofpcipoc: '" + svcOperation + "'"); + serviceDataBuilder.setResponseCode("503"); + } + } + catch (Exception e) + { + LOG.error("Caught exception looking for service logic", e); + serviceDataBuilder.setResponseCode("500"); + } + + String errorCode = serviceDataBuilder.getResponseCode(); + + if (!("0".equals(errorCode) || "200".equals(errorCode))) { + LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'"); + } else { + LOG.info("Returned SUCCESS for "+svcOperation+" "); + serviceDataBuilder.setResponseCode("Welcome OOF POC. Number of Neighbor entries to be deleted " + input.getLteCellNumberOfEntries()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(serviceDataBuilder.build()).build(); + + return Futures.immediateFuture(rpcResult); + } + + // RPC generic-neighbor-configuration + @Override + public ListenableFuture> genericNeighborConfiguration( + GenericNeighborConfigurationInput input) { + final String svcOperation = "generic-neighbor-configuration"; + + Properties parms = new Properties(); + GenericNeighborConfigurationOutputBuilder serviceDataBuilder = new GenericNeighborConfigurationOutputBuilder(); + + LOG.info( "Reached RPC genericNeighborConfiguration"); + + LOG.info( svcOperation +" called." ); + + if(input == null ) { + LOG.debug("exiting " +svcOperation+ " because of invalid input"); + serviceDataBuilder.setResponseCode("Input is null"); + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(serviceDataBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // add input to parms + LOG.info("Adding INPUT data for "+svcOperation+" input: " + input); + GenericNeighborConfigurationInputBuilder inputBuilder = new GenericNeighborConfigurationInputBuilder(input); + MdsalHelper.toProperties(parms, inputBuilder.build()); + + // Call SLI sync method + try + { + + if (OofpcipocClient.hasGraph("Oofpcipoc", svcOperation , null, "sync")) + { + LOG.info( "OofpcipocClient has a Directed Graph for '" + svcOperation + "'"); + + try + { + OofpcipocClient.execute("Oofpcipoc", svcOperation, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + LOG.error("Caught exception executing service logic for "+ svcOperation, e); + serviceDataBuilder.setResponseCode("500"); + } + } else { + LOG.error("No service logic active for Oofpcipoc: '" + svcOperation + "'"); + serviceDataBuilder.setResponseCode("503"); + } + } + catch (Exception e) + { + LOG.error("Caught exception looking for service logic", e); + serviceDataBuilder.setResponseCode("500"); + } + + String errorCode = serviceDataBuilder.getResponseCode(); + + if (!("0".equals(errorCode) || "200".equals(errorCode))) { + LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'"); + } else { + LOG.info("Returned SUCCESS for "+svcOperation+" "); + serviceDataBuilder.setResponseCode("Welcome OOF POC. Number of Neighbor entries to be configured " + input.getLteCellNumberOfEntries()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(serviceDataBuilder.build()).build(); + + return Futures.immediateFuture(rpcResult); + } + + +} diff --git a/sdnr/northbound/oofpcipoc/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/northbound/oofpcipoc/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml new file mode 100644 index 000000000..72278ffa2 --- /dev/null +++ b/sdnr/northbound/oofpcipoc/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg