From ff3eecb980bfdc8d43d2ed3a4c786d634fa6f4e2 Mon Sep 17 00:00:00 2001 From: Jessica Wagantall Date: Tue, 1 Dec 2020 11:52:01 -0800 Subject: Migrate sli-northbound repo Migrate sli-northbound repo files into new directory "northbound". Signed-off-by: Jessica Wagantall --- dataChange/.gitignore | 34 ----- dataChange/.sonar/checkstyle.xml | 1 - dataChange/.sonar/pmd.xml | 67 --------- dataChange/README.txt | 35 ----- dataChange/installer/pom.xml | 135 ----------------- .../src/assembly/assemble_installer_zip.xml | 59 -------- .../src/assembly/assemble_mvnrepo_zip.xml | 47 ------ .../src/main/resources/scripts/install-feature.sh | 39 ----- dataChange/model/pom.xml | 31 ---- .../src/main/resources/dataChange.20150519.json | 132 ----------------- dataChange/model/src/main/yang/DataChange.yang | 73 ---------- dataChange/pom.xml | 24 --- dataChange/provider/pom.xml | 89 ------------ .../ccsdk/sli/northbound/DataChangeClient.java | 98 ------------- .../ccsdk/sli/northbound/DataChangeProvider.java | 161 --------------------- .../OSGI-INF/blueprint/datachange-blueprint.xml | 32 ---- .../blueprint/datachange-blueprint.xml | 32 ---- .../dataChange/DataChangeClientTest.java | 56 ------- .../sdnc/northbound/dataChange/TestDataChange.java | 95 ------------ 19 files changed, 1240 deletions(-) delete mode 100755 dataChange/.gitignore delete mode 100755 dataChange/.sonar/checkstyle.xml delete mode 100755 dataChange/.sonar/pmd.xml delete mode 100755 dataChange/README.txt delete mode 100755 dataChange/installer/pom.xml delete mode 100644 dataChange/installer/src/assembly/assemble_installer_zip.xml delete mode 100644 dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml delete mode 100644 dataChange/installer/src/main/resources/scripts/install-feature.sh delete mode 100755 dataChange/model/pom.xml delete mode 100644 dataChange/model/src/main/resources/dataChange.20150519.json delete mode 100755 dataChange/model/src/main/yang/DataChange.yang delete mode 100755 dataChange/pom.xml delete mode 100755 dataChange/provider/pom.xml delete mode 100644 dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeClient.java delete mode 100644 dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java delete mode 100644 dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml delete mode 100644 dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml delete mode 100644 dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java delete mode 100644 dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java (limited to 'dataChange') diff --git a/dataChange/.gitignore b/dataChange/.gitignore deleted file mode 100755 index b73caf31e..000000000 --- a/dataChange/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -#####standard .git ignore entries##### - -## IDE Specific Files ## -org.eclipse.core.resources.prefs -.classpath -.project -.settings -.idea -.externalToolBuilders -maven-eclipse.xml -workspace - -## Compilation Files ## -*.class -**/target -target -target-ide -MANIFEST.MF - -## Misc Ignores (OS specific etc) ## -bin/ -dist -*~ -*.ipr -*.iml -*.iws -classes -out/ -.DS_STORE -.metadata - -## Folders which contain auto generated source code ## -yang-gen-config -yang-gen-sal diff --git a/dataChange/.sonar/checkstyle.xml b/dataChange/.sonar/checkstyle.xml deleted file mode 100755 index 3fa231535..000000000 --- a/dataChange/.sonar/checkstyle.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dataChange/.sonar/pmd.xml b/dataChange/.sonar/pmd.xml deleted file mode 100755 index 80343b3bd..000000000 --- a/dataChange/.sonar/pmd.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - 2 - - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - 5 - - - 2 - - - 3 - - - 3 - - - diff --git a/dataChange/README.txt b/dataChange/README.txt deleted file mode 100755 index f9f4a2ab5..000000000 --- a/dataChange/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -====================== -Introduction -====================== -You have generated an MD-SAL module using the Brocade Archetype. - -* You should be able to successfully run 'mvn clean install' on this project. -* This will produce a .zip file under the karaf.extension directory which you can deploy using -Brocade's extension deployment mechanism. - -====================== -Next Steps: -====================== -* run a 'mvn clean install' if you haven't already. This will generate some code from the yang models. -* Modify the model yang file under the model project. -* Follow the comments in the generated provider class to wire your new provider into the generated -code. -* Modify the generated provider model to respond to and handle the yang model. Depending on what -you added to your model you may need to inherit additional interfaces or make other changes to -the provider model. - -====================== -Generated Bundles: -====================== -* model - - Provides the yang model for your application. This is your primary northbound interface. -* provider - - Provides a template implementation for a provider to respond to your yang model. -* features - - Defines a karaf feature. If you add dependencies on third-party bundles then you will need to - modify the features.xml to list out the dependencies. -* karaf.extension - - Bundles all of the jars and third party dependencies (minus ODL dependencies) into a single - .zip file with the necessary configuration files to work correctly with the Brocade extension - mechanism. - diff --git a/dataChange/installer/pom.xml b/dataChange/installer/pom.xml deleted file mode 100755 index 60217baa6..000000000 --- a/dataChange/installer/pom.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - odlparent-lite - 2.1.0 - - - - org.onap.ccsdk.sli.northbound - dataChange-installer - 1.1.1-SNAPSHOT - pom - - ccsdk-sli-northbound :: dataChange :: ${project.artifactId} - - - ccsdk-dataChange - ${application.name} - mvn:org.onap.ccsdk.sli.northbound/${features.boot}/${project.version}/xml/features - false - - - - - - org.onap.ccsdk.sli.northbound - dataChange-model - ${project.version} - - - - org.onap.ccsdk.sli.northbound - dataChange-provider - ${project.version} - - - - - - - - - maven-assembly-plugin - 2.6 - - - maven-repo-zip - - single - - package - - true - stage/${application.name}-${project.version} - - src/assembly/assemble_mvnrepo_zip.xml - - true - - - - installer-zip - - single - - package - - true - ${application.name}-${project.version}-installer - - src/assembly/assemble_installer_zip.xml - - false - - - - - - 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.sli.northbound - provided - - - - - - maven-resources-plugin - 2.6 - - - copy-version - - copy-resources - - validate - - ${basedir}/target/stage - - - src/main/resources/scripts - - install-feature.sh - - true - - - - - - - - - - - diff --git a/dataChange/installer/src/assembly/assemble_installer_zip.xml b/dataChange/installer/src/assembly/assemble_installer_zip.xml deleted file mode 100644 index 3bed4b5ef..000000000 --- a/dataChange/installer/src/assembly/assemble_installer_zip.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - installer_zip - - zip - - - - false - - - - target/stage/ - ${application.name} - 755 - - *.sh - - - - target/stage/ - ${application.name} - 644 - - *.sh - - - - - - - diff --git a/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml b/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml deleted file mode 100644 index 479896182..000000000 --- a/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - repo - - zip - - - - false - - - - target/assembly/ - . - - - - - - diff --git a/dataChange/installer/src/main/resources/scripts/install-feature.sh b/dataChange/installer/src/main/resources/scripts/install-feature.sh deleted file mode 100644 index cee4a4952..000000000 --- a/dataChange/installer/src/main/resources/scripts/install-feature.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -### -# ============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========================================================= -### - -ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} -ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} -INSTALLERDIR=$(dirname $0) - -REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip - -if [ -f ${REPOZIP} ] -then - unzip -d ${ODL_HOME} ${REPOZIP} -else - echo "ERROR : repo zip ($REPOZIP) not found" - exit 1 -fi - -${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories} -${ODL_KARAF_CLIENT} feature:install ${features.boot} diff --git a/dataChange/model/pom.xml b/dataChange/model/pom.xml deleted file mode 100755 index bce47e949..000000000 --- a/dataChange/model/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - binding-parent - 2.1.0 - - - - org.onap.ccsdk.sli.northbound - dataChange-model - 1.1.1-SNAPSHOT - bundle - - ccsdk-sli-northbound :: dataChange :: ${project.artifactId} - - - ${project.version} - - - - - org.opendaylight.mdsal.binding.model.ietf - rfc6991 - - - - - diff --git a/dataChange/model/src/main/resources/dataChange.20150519.json b/dataChange/model/src/main/resources/dataChange.20150519.json deleted file mode 100644 index be17d564b..000000000 --- a/dataChange/model/src/main/resources/dataChange.20150519.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "version": "1.0.0" - }, - "basePath": "/restconf", - "paths": { - "/operations/DataChange:data-change-notification": { - "post": { - "consumes": [ - "application/json", - "application/xml" - ], - "produces": [ - "application/json", - "application/xml" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "required": false, - "schema": { - "$ref": "#/definitions/(data-change-notification)input-TOP" - } - } - ], - "responses": { - "200": { - "description": "No response was specified", - "schema": { - "$ref": "#/definitions/(data-change-notification)output-TOP" - } - } - }, - "operationId": "data-change-notification" - } - } - }, - "definitions": { - "(config)DataChange_modulePOST": { - "type": "object" - }, - "(config)key-dataPOST": { - "properties": { - "key-name": { - "$ref": "#/definitions/Optional.empty" - }, - "key-value": { - "$ref": "#/definitions/Optional.empty" - } - }, - "type": "object" - }, - "(data-change-notification)input": { - "properties": { - "DataChange:aai-event-id": { - "$ref": "#/definitions/Optional.empty" - }, - "DataChange:aai-event-trigger": { - "$ref": "#/definitions/Optional.empty" - }, - "DataChange:aai-node-type": { - "$ref": "#/definitions/Optional.empty" - }, - "DataChange:key-data": { - "items": { - "$ref": "#/definitions/DataChange(config)key-data" - }, - "type": "array" - }, - "DataChange:selflink": { - "$ref": "#/definitions/Optional.empty" - } - }, - "type": "object" - }, - "(data-change-notification)input-TOP": { - "properties": { - "DataChange:input": { - "items": { - "$ref": "#/definitions/(data-change-notification)input" - }, - "type": "object" - } - }, - "type": "object" - }, - "(data-change-notification)output": { - "properties": { - "DataChange:data-change-response-code": { - "$ref": "#/definitions/Optional.empty" - } - }, - "type": "object" - }, - "(data-change-notification)output-TOP": { - "properties": { - "DataChange:output": { - "items": { - "$ref": "#/definitions/(data-change-notification)output" - }, - "type": "object" - } - }, - "type": "object" - }, - "DataChange(config)key-data": { - "properties": { - "DataChange:key-name": { - "$ref": "#/definitions/Optional.empty" - }, - "DataChange:key-value": { - "$ref": "#/definitions/Optional.empty" - } - }, - "type": "object" - }, - "DataChange(config)key-data-TOP": { - "properties": { - "DataChange:key-data": { - "items": { - "$ref": "#/definitions/DataChange(config)key-data" - }, - "type": "array" - } - }, - "type": "object" - }, - "unique_empty_identifier": {} - } -} diff --git a/dataChange/model/src/main/yang/DataChange.yang b/dataChange/model/src/main/yang/DataChange.yang deleted file mode 100755 index 8f9a8e6f7..000000000 --- a/dataChange/model/src/main/yang/DataChange.yang +++ /dev/null @@ -1,73 +0,0 @@ -module DataChange { - - yang-version 1; - - namespace "org:onap:ccsdk:sli:northbound:datachange"; - - prefix datachg; - - organization "AT&T, Inc."; - - contact - "Dan Timoney "; - - description - "Defines API interface for notification of data changes"; - - revision "2015-05-19" { - description - "Initial draft"; - } - - grouping data-change-request { - - leaf aai-event-id { - type string; - } - - leaf aai-node-type { - type string; - } - - leaf aai-event-trigger { - type enumeration { - enum "Update"; - enum "Delete"; - } - } - - list key-data { - key key-name; - leaf key-name { - type string; - } - leaf key-value { - type string; - } - } - - leaf selflink { - type string; - } - - } - - grouping data-change-response { - - leaf data-change-response-code { - type string; - } - } - - rpc data-change-notification { - - input { - uses data-change-request; - } - - output { - uses data-change-response; - } - } - -} diff --git a/dataChange/pom.xml b/dataChange/pom.xml deleted file mode 100755 index 6110bdf1d..000000000 --- a/dataChange/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - odlparent-lite - 2.1.0 - - - - org.onap.ccsdk.sli.northbound - dataChange - 1.1.1-SNAPSHOT - pom - - ccsdk-sli-northbound :: dataChange - - - model - provider - installer - - diff --git a/dataChange/provider/pom.xml b/dataChange/provider/pom.xml deleted file mode 100755 index cdefb5437..000000000 --- a/dataChange/provider/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - binding-parent - 2.1.0 - - - - org.onap.ccsdk.sli.northbound - dataChange-provider - 1.1.1-SNAPSHOT - bundle - - ccsdk-sli-northbound :: dataChange :: ${project.artifactId} - - - ${project.version} - - - - - - org.onap.ccsdk.sli.core - sli-core-artifacts - ${ccsdk.sli.core.version} - pom - import - - - - - - org.onap.ccsdk.sli.northbound - dataChange-model - ${project.version} - - - - org.opendaylight.controller - sal-binding-api - - - org.onap.ccsdk.sli.core - sli-common - - - org.onap.ccsdk.sli.core - sli-provider - - - - org.opendaylight.controller - sal-test-model - test - - - - - org.opendaylight.controller - sal-binding-broker-impl - test - - - org.opendaylight.controller - sal-binding-broker-impl - test-jar - tests - test - - - junit - junit - test - - - org.testng - testng - test - - - org.mockito - mockito-core - test - - - diff --git a/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeClient.java b/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeClient.java deleted file mode 100644 index 959b2b6fb..000000000 --- a/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeClient.java +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * ============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.sli.northbound; - -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.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DataChangeClient { - - private static final Logger LOG = LoggerFactory.getLogger(DataChangeClient.class); - - private SvcLogicService svcLogicService = null; - - public DataChangeClient(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, DataChangeNotificationOutputBuilder 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, DataChangeNotificationOutputBuilder 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/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java b/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java deleted file mode 100644 index 3301ca8e0..000000000 --- a/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java +++ /dev/null @@ -1,161 +0,0 @@ -/*- - * ============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.sli.northbound; - -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.RpcProviderRegistry; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInput; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInputBuilder; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutput; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeService; -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; - -/** - * 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 DataChangeProvider implements AutoCloseable, DataChangeService { - - private static final Logger LOG = LoggerFactory.getLogger(DataChangeProvider.class); - - private static final String APPLICATION_NAME = "DataChange"; - - private final ExecutorService executor; - - protected DataBroker dataBroker; - protected NotificationPublishService notificationService; - protected RpcProviderRegistry rpcRegistry; - protected BindingAwareBroker.RpcRegistration rpcRegistration; - private final DataChangeClient dataChangeClient; - - - public DataChangeProvider(final DataBroker dataBroker, - final NotificationPublishService notificationPublishService, - final RpcProviderRegistry rpcProviderRegistry, - final DataChangeClient dataChangeClient) { - - this.LOG.info( "Creating provider for {}", APPLICATION_NAME); - executor = Executors.newFixedThreadPool(1); - this.dataBroker = dataBroker; - this.notificationService = notificationPublishService; - this.rpcRegistry = rpcProviderRegistry; - this.dataChangeClient = dataChangeClient; - initialize(); - } - - public void initialize(){ - LOG.info( "Initializing provider for {}", APPLICATION_NAME); - rpcRegistration = rpcRegistry.addRpcImplementation(DataChangeService.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> dataChangeNotification( - DataChangeNotificationInput input) { - final String svcOperation = "data-change-notification"; - - Properties parms = new Properties(); - DataChangeNotificationOutputBuilder serviceDataBuilder = new DataChangeNotificationOutputBuilder(); - - LOG.info( svcOperation +" called." ); - - if(input == null || input.getAaiEventId() == null) { - LOG.debug("exiting " +svcOperation+ " because of invalid input"); - serviceDataBuilder.setDataChangeResponseCode("403"); - 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); - DataChangeNotificationInputBuilder inputBuilder = new DataChangeNotificationInputBuilder(input); - MdsalHelper.toProperties(parms, inputBuilder.build()); - - // Call SLI sync method - try - { - if (dataChangeClient.hasGraph(APPLICATION_NAME, svcOperation , null, "sync")) - { - try - { - dataChangeClient.execute(APPLICATION_NAME, svcOperation, null, "sync", serviceDataBuilder, parms); - } - catch (Exception e) - { - LOG.error("Caught exception executing service logic for "+ svcOperation, e); - serviceDataBuilder.setDataChangeResponseCode("500"); - } - } else { - LOG.error("No service logic active for DataChange: '" + svcOperation + "'"); - serviceDataBuilder.setDataChangeResponseCode("503"); - } - } - catch (Exception e) - { - LOG.error("Caught exception looking for service logic", e); - serviceDataBuilder.setDataChangeResponseCode("500"); - } - - String errorCode = serviceDataBuilder.getDataChangeResponseCode(); - - if (!("0".equals(errorCode) || "200".equals(errorCode))) { - LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'"); - } else { - LOG.info("Returned SUCCESS for "+svcOperation+" "); - } - - RpcResult rpcResult = - RpcResultBuilder. status(true).withResult(serviceDataBuilder.build()).build(); - // return error - return Futures.immediateFuture(rpcResult); - } -} diff --git a/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml b/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml deleted file mode 100644 index 5a38c81f1..000000000 --- a/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml b/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml deleted file mode 100644 index 5a38c81f1..000000000 --- a/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java b/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java deleted file mode 100644 index 9ba6c8742..000000000 --- a/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.onap.sdnc.northbound.dataChange; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; - -import java.util.Properties; - -import org.junit.Before; -import org.junit.Test; -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.onap.ccsdk.sli.northbound.DataChangeClient; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder; - -public class DataChangeClientTest { - - SvcLogicService mockSvcLogicService; - String module = "test-module"; - String rpc = "test-rpc"; - String version = "test-version"; - String mode = "test-mode"; - Properties localProp = new Properties(); - - @Before - public void setUp() throws Exception { - mockSvcLogicService = mock(SvcLogicService.class); - when(mockSvcLogicService.hasGraph(module, rpc, version, mode)).thenReturn(true); - } - - @Test - public void testDataChangeClientConstructor() { - DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService); - assertNotNull(dataChangeClient); - } - - @Test - public void testHasGraph() throws SvcLogicException { - DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService); - boolean result = dataChangeClient.hasGraph(module, rpc, version, mode); - assertTrue(result); - } - - @Test - public void testExecuteSvcLogicStatusFailure() throws SvcLogicException { - DataChangeNotificationOutputBuilder serviceData = mock(DataChangeNotificationOutputBuilder.class); - Properties parms = mock(Properties.class); - SvcLogicService svcLogicService = mock(SvcLogicService.class); - Properties properties = new Properties(); - properties.setProperty("SvcLogic.status", "failure"); - when(svcLogicService.execute(module, rpc, version, mode, properties)).thenReturn(properties); - DataChangeClient sliClient = new DataChangeClient(svcLogicService); - Properties prop = sliClient.execute(module, rpc, version, mode, serviceData, properties); - assertTrue(prop != null); - } -} \ No newline at end of file diff --git a/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java b/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java deleted file mode 100644 index f9c39b703..000000000 --- a/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * ============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.sdnc.northbound.dataChange; - -import org.junit.Before; -import org.junit.Test; -import org.onap.ccsdk.sli.northbound.DataChangeProvider; -import org.onap.ccsdk.sli.northbound.DataChangeClient; -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.test.AbstractConcurrentDataBrokerTest; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInput; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInputBuilder; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutput; -import org.opendaylight.yangtools.yang.common.RpcResult; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; - -public class TestDataChange extends AbstractConcurrentDataBrokerTest { - - private DataChangeProvider dataChangeProvider; - private static final Logger LOG = LoggerFactory.getLogger(DataChangeProvider.class); - - @Before - public void setUp() throws Exception { - if (null == dataChangeProvider) { - DataBroker dataBroker = getDataBroker(); - NotificationPublishService mockNotification = mock(NotificationPublishService.class); - RpcProviderRegistry mockRpcRegistry = mock(RpcProviderRegistry.class); - DataChangeClient mockSliClient = mock(DataChangeClient.class); - dataChangeProvider = new DataChangeProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient); - } - } - - //Testcase should return error 503 when No service logic active for dataChange. - @Test - public void testDataChangeNotification() { - - DataChangeNotificationInputBuilder inputBuilder = new DataChangeNotificationInputBuilder(); - - inputBuilder.setAaiEventId("1"); - - - // TODO: currently initialize SvcLogicServiceClient is failing, need to fix - java.util.concurrent.Future> future = dataChangeProvider - .dataChangeNotification(inputBuilder.build()); - RpcResult rpcResult = null; - try { - rpcResult = future.get(); - } catch (Exception e) { - fail("Error : " + e); - } - LOG.info("result: {}", rpcResult); - assertEquals("503", rpcResult.getResult().getDataChangeResponseCode()); - } - - //Input parameter validation - @Test - public void testDataChangeNotificationInputValidation() { - - java.util.concurrent.Future> future = dataChangeProvider - .dataChangeNotification(null); - RpcResult rpcResult = null; - try { - rpcResult = future.get(); - } catch (Exception e) { - fail("Error : " + e); - } - LOG.info("result: {}", rpcResult); - assertEquals("403", rpcResult.getResult().getDataChangeResponseCode()); - } -} -- cgit 1.2.3-korg