From ea5bf0a1c8a4e525d2cee03841b8e8f9b3563ed0 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 18 Jul 2017 20:32:15 -0400 Subject: [CCSDK-6] Populate seed code Add seed code for sli/northbound repository Update groupId to org.onap.ccsdk.sli.northbound Update to use CCSDK version of sli core Change-Id: Id3a154a53150a74f4b65060544e76f3e0cad932e Signed-off-by: Dan Timoney --- asdcApi/.gitignore | 34 ++ asdcApi/features/pom.xml | 138 +++++++ asdcApi/features/src/main/resources/features.xml | 41 ++ asdcApi/installer/pom.xml | 140 +++++++ .../src/assembly/assemble_installer_zip.xml | 59 +++ .../src/assembly/assemble_mvnrepo_zip.xml | 55 +++ .../src/main/resources/scripts/install-feature.sh | 40 ++ asdcApi/model/pom.xml | 81 ++++ asdcApi/model/src/main/yang/ASDC-API.yang | 63 ++++ asdcApi/model/src/main/yang/asdc-api-common.yang | 53 +++ .../model/src/main/yang/asdc-license-model.yang | 369 ++++++++++++++++++ asdcApi/pom.xml | 63 ++++ asdcApi/provider/pom.xml | 129 +++++++ .../impl/rev140523/AsdcApiProviderModule.java | 57 +++ .../rev140523/AsdcApiProviderModuleFactory.java | 34 ++ .../openecomp/sdnc/asdcapi/AsdcApiProvider.java | 415 +++++++++++++++++++++ .../openecomp/sdnc/asdcapi/AsdcApiSliClient.java | 111 ++++++ .../org/openecomp/sdnc/asdcapi/AsdcApiUtil.java | 48 +++ .../main/resources/initial/asdcApi-provider.xml | 72 ++++ .../src/main/yang/asdcApi-provider-impl.yang | 61 +++ 20 files changed, 2063 insertions(+) create mode 100755 asdcApi/.gitignore create mode 100755 asdcApi/features/pom.xml create mode 100644 asdcApi/features/src/main/resources/features.xml create mode 100755 asdcApi/installer/pom.xml create mode 100644 asdcApi/installer/src/assembly/assemble_installer_zip.xml create mode 100644 asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml create mode 100644 asdcApi/installer/src/main/resources/scripts/install-feature.sh create mode 100755 asdcApi/model/pom.xml create mode 100755 asdcApi/model/src/main/yang/ASDC-API.yang create mode 100755 asdcApi/model/src/main/yang/asdc-api-common.yang create mode 100755 asdcApi/model/src/main/yang/asdc-license-model.yang create mode 100755 asdcApi/pom.xml create mode 100755 asdcApi/provider/pom.xml create mode 100644 asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModule.java create mode 100644 asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModuleFactory.java create mode 100644 asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiProvider.java create mode 100644 asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiSliClient.java create mode 100644 asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiUtil.java create mode 100644 asdcApi/provider/src/main/resources/initial/asdcApi-provider.xml create mode 100755 asdcApi/provider/src/main/yang/asdcApi-provider-impl.yang (limited to 'asdcApi') diff --git a/asdcApi/.gitignore b/asdcApi/.gitignore new file mode 100755 index 000000000..b73caf31e --- /dev/null +++ b/asdcApi/.gitignore @@ -0,0 +1,34 @@ +#####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/asdcApi/features/pom.xml b/asdcApi/features/pom.xml new file mode 100755 index 000000000..774d9e529 --- /dev/null +++ b/asdcApi/features/pom.xml @@ -0,0 +1,138 @@ + + + 4.0.0 + + asdcApi + org.onap.ccsdk.sli.northbound + 0.0.1-SNAPSHOT + + asdcApi-features + + jar + + + + org.onap.ccsdk.sli.northbound + asdcApi-model + ${project.version} + + + org.onap.ccsdk.sli.northbound + asdcApi-provider + ${project.version} + config + xml + + + org.onap.ccsdk.sli.northbound + asdcApi-provider + ${project.version} + + + + org.opendaylight.mdsal + features-mdsal + ${odl.mdsal.features.version} + features + xml + + + runtime + + + + + + + org.opendaylight.controller + opendaylight-karaf-empty + ${odl.karaf.empty.distro.version} + zip + + + + + + org.opendaylight.odlparent + features-test + test + ${odl.commons.opendaylight.version} + + + + org.opendaylight.yangtools + features-yangtools + ${odl.yangtools.version} + features + xml + runtime + + + + + + + true + src/main/resources + + + + + org.apache.maven.plugins + maven-resources-plugin + + + filter + + resources + + generate-resources + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + + attach-artifact + + package + + + + ${project.build.directory}/classes/${features.file} + xml + features + + + + + + + + + diff --git a/asdcApi/features/src/main/resources/features.xml b/asdcApi/features/src/main/resources/features.xml new file mode 100644 index 000000000..e72e0f653 --- /dev/null +++ b/asdcApi/features/src/main/resources/features.xml @@ -0,0 +1,41 @@ + + + + + + + mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features + + + + odl-mdsal-broker + + mvn:org.openecomp.sdnc.northbound/asdcApi-model/${project.version} + mvn:org.openecomp.sdnc.northbound/asdcApi-provider/${project.version} + + sdnc-sli + mvn:org.openecomp.sdnc.northbound/asdcApi-provider/${project.version}/xml/config + + + diff --git a/asdcApi/installer/pom.xml b/asdcApi/installer/pom.xml new file mode 100755 index 000000000..94008aaaf --- /dev/null +++ b/asdcApi/installer/pom.xml @@ -0,0 +1,140 @@ + + + 4.0.0 + + asdcApi + org.onap.ccsdk.sli.northbound + 0.0.1-SNAPSHOT + + asdcApi-installer + asdcApi - Karaf Installer + pom + + + sdnc-asdcApi + sdnc-asdcApi + mvn:org.onap.ccsdk.sli.northbound/asdcApi-features/${project.version}/xml/features + false + + + + + + org.onap.ccsdk.sli.northbound + asdcApi-features + ${project.version} + features + xml + + + * + * + + + + + + org.onap.ccsdk.sli.northbound + asdcApi-provider + ${project.version} + + + + + + + + + maven-assembly-plugin + 2.6 + + + maven-repo-zip + + single + + package + + false + stage/${application.name}-${project.version} + + src/assembly/assemble_mvnrepo_zip.xml + + false + + + + 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.openecomp.sdnc + sli-common,sli-provider,dblib-provider + 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/asdcApi/installer/src/assembly/assemble_installer_zip.xml b/asdcApi/installer/src/assembly/assemble_installer_zip.xml new file mode 100644 index 000000000..e278872a1 --- /dev/null +++ b/asdcApi/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,59 @@ + + + + + + installer_zip + + zip + + + + false + + + + target/stage/ + ${application.name} + 755 + + *.sh + + + + target/stage/ + ${application.name} + 644 + + *.sh + + + + + + + diff --git a/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml b/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..608200da1 --- /dev/null +++ b/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,55 @@ + + + + + + mvnrepo_zip + + zip + + + + false + + + + target/assembly/ + . + + + + + + + + ../provider/src/main/resources/initial/${feature-name}-provider.xml + ./etc/opendaylight/karaf/200-${feature-name}-provider.xml + + + + + diff --git a/asdcApi/installer/src/main/resources/scripts/install-feature.sh b/asdcApi/installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 000000000..9a47d2225 --- /dev/null +++ b/asdcApi/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 ONAP 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} +ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"} +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} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} diff --git a/asdcApi/model/pom.xml b/asdcApi/model/pom.xml new file mode 100755 index 000000000..b9f48326d --- /dev/null +++ b/asdcApi/model/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + + asdcApi + org.onap.ccsdk.sli.northbound + 0.0.1-SNAPSHOT + + org.onap.ccsdk.sli.northbound + asdcApi-model + 0.0.1-SNAPSHOT + bundle + + + + + + org.apache.felix + maven-bundle-plugin + true + + + * + + + + + org.opendaylight.yangtools + yang-maven-plugin + ${odl.yangtools.yang.maven.plugin.version} + + + org.opendaylight.mdsal + maven-sal-api-gen-plugin + ${odl.sal.api.gen.plugin.version} + jar + + + + + + generate-sources + + + ${yang.file.directory} + + + org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl + ${salGeneratorPath} + + + true + + + + + + + + + org.opendaylight.mdsal + yang-binding + ${odl.mdsal.yang.binding.version} + + + org.opendaylight.yangtools + yang-common + ${odl.yangtools.version} + + + org.opendaylight.mdsal.model + ietf-inet-types + ${odl.ietf-inet-types.version} + + + org.opendaylight.mdsal.model + ietf-yang-types + ${odl.ietf-yang-types.version} + + + diff --git a/asdcApi/model/src/main/yang/ASDC-API.yang b/asdcApi/model/src/main/yang/ASDC-API.yang new file mode 100755 index 000000000..401ec7da9 --- /dev/null +++ b/asdcApi/model/src/main/yang/ASDC-API.yang @@ -0,0 +1,63 @@ + +module ASDC-API { + yang-version "1"; + + namespace "org:openecomp:sdnc"; + + prefix asdc-api; + + import asdc-api-common { prefix asdc-api-common; } + + + import asdc-license-model { prefix asdc-license-model; } + + import ietf-inet-types { + prefix inet; + revision-date "2010-09-24"; + } + + organization + "OpenECOMP"; + + contact + "Dan Timoney"; + + description + "SDC Interface"; + + revision 2017-02-01 { + description "database definitions"; + } + + // Containers + container artifacts { + list artifact { + key "artifact-name artifact-version"; + + uses asdc-api-common:artifact-fields; + } + } + + + + container vf-license-model-versions { + list vf-license-model-version { + key artifact-version; + uses asdc-api-common:artifact-fields; + uses asdc-license-model:vf-license-model-grouping; + } + } + + + // RPCs + + rpc vf-license-model-update { + input { + uses asdc-api-common:artifact-fields; + uses asdc-license-model:vf-license-model-grouping; + } + output { + uses asdc-api-common:asdc-api-response; + } + } +} diff --git a/asdcApi/model/src/main/yang/asdc-api-common.yang b/asdcApi/model/src/main/yang/asdc-api-common.yang new file mode 100755 index 000000000..126368d4f --- /dev/null +++ b/asdcApi/model/src/main/yang/asdc-api-common.yang @@ -0,0 +1,53 @@ + +module asdc-api-common { + yang-version "1"; + + // Use same namespace defined for file upload in 15.12 + namespace "org:openecomp:sdnc:asdcapi:common"; + + prefix asdcapi; + + organization + "OpenECOMP"; + + contact + "Dan Timoney"; + + description + "ASDC/SDN-C API common data"; + + revision 2017-02-01 { + description "Initial release"; + } + + + + // Groupings + + grouping artifact-fields { + leaf artifact-name { + type string; + description "Name of artifact"; + } + + leaf artifact-version { + type string; + description "Version of artifact"; + } + } + + grouping asdc-api-response { + leaf asdc-api-response-code { + type string; + description "Code indicating success/failure"; + } + + leaf asdc-api-response-text { + type string; + description "Text indicating reason for failure"; + } + } + + + +} diff --git a/asdcApi/model/src/main/yang/asdc-license-model.yang b/asdcApi/model/src/main/yang/asdc-license-model.yang new file mode 100755 index 000000000..37ae869bd --- /dev/null +++ b/asdcApi/model/src/main/yang/asdc-license-model.yang @@ -0,0 +1,369 @@ +module asdc-license-model { + + namespace "http://xmlns.openecomp.org/asdc/license-model/1.0"; + prefix le; + organization "openecomp"; + contact "asdc"; + description "schema for both vendor license and VF license models"; + revision 2016-04-27 { + description "xxxx"; + reference "xxxx"; + } + + container vendor-license-model { + description "xxxx"; + leaf vendor-name { + type string{ + length "1..200"; + } + description "xxxx"; + } + uses entitlement-pools; + uses license-key-groups; + } + + grouping entitlement-pools { + description "xxxx"; + container entitlement-pool-list { + description "xxxx"; + uses entitlement-pool; + } + } + + grouping entitlement-pool { + description "xxxx"; + list entitlement-pool { + description "xxxx"; + leaf entitlement-pool-uuid { + type string; + description "xxxx"; + } + leaf name { + type string{ + length "1..120"; + } + description "xxxx"; + } + leaf description { + type string{ + length "1..1000"; + } + description "xxxx"; + } + leaf manufacturer-reference-number { + type string{ + length "1..100"; + } + description "xxxx"; + } + uses operational-scope; + uses threshold-value; + uses entitlement-metric; + leaf increments { + type string{ + length "1..120"; + } + description "xxxx"; + } + uses aggregation-function; + uses time; + } + } + + grouping operational-scope { + description "xxxx"; + container operational-scope { + description "xxxx"; + leaf value { + type enumeration { + enum "Network_Wide"{ + description "xxxx"; + } + enum "Availability_Zone"{ + description "xxxx"; + } + enum "Data_Center"{ + description "xxxx"; + } + enum "Tenant"{ + description "xxxx"; + } + enum "VM"{ + description "xxxx"; + } + enum "CPU"{ + description "xxxx"; + } + enum "Core"{ + description "xxxx"; + } + enum "Other"{ + description "xxxx"; + } + } + description "xxxx"; + } + leaf other { + type string{ + length "1..200"; + } + description "xxxx"; + } + } + } + + grouping threshold-value { + description "xxxx"; + container threshold-value { + description "xxxx"; + leaf value { + type uint32{ + range "0..9999999"; + } //TBD Change to type number + description "xxxx"; + } + leaf unit { + type enumeration { + enum "Absolute"{ + description "xxxx"; + } + enum "Percentage"{ + description "xxxx"; + } + } + description "xxxx"; + } + } + } + + grouping entitlement-metric { + description "xxxx"; + container entitlement-metric { + description "xxxx"; + leaf value { + type enumeration { + enum "Software_Instances_Count"{ + description "xxxx"; + } + enum "CPU"{ + description "xxxx"; + } + enum "Core"{ + description "xxxx"; + } + enum "Trunks"{ + description "xxxx"; + } + enum "User"{ + description "xxxx"; + } + enum "Subscribers"{ + description "xxxx"; + } + enum "Tenants"{ + description "xxxx"; + } + enum "Tokens"{ + description "xxxx"; + } + enum "Seats"{ + description "xxxx"; + } + enum "Units_TB"{ + description "xxxx"; + } + enum "Units_GB"{ + description "xxxx"; + } + enum "Units_MB"{ + description "xxxx"; + } + enum "Other"{ + description "xxxx"; + } + } + description "xxxx"; + } + leaf other { + type string{ + length "1..200"; + } + description "xxxx"; + } + } + } + + grouping aggregation-function { + description "xxxx"; + container aggregation-function { + description "xxxx"; + leaf value { + type enumeration { + enum "Peak"{ + description "xxxx"; + } + enum "Average"{ + description "xxxx"; + } + enum "Other"{ + description "xxxx"; + } + } + description "xxxx"; + } + leaf other { + type string{ + length "1..200"; + } + description "xxxx"; + } + } + } + + grouping time { + description "xxxx"; + container time { + description "xxxx"; + leaf value { + type enumeration { + enum "Hour"{ + description "xxxx"; + } + enum "Day"{ + description "xxxx"; + } + enum "Month"{ + description "xxxx"; + } + enum "Quarter"{ + description "xxxx"; + } + enum "Year"{ + description "xxxx"; + } + enum "Other"{ + description "xxxx"; + } + } + description "xxxx"; + } + leaf other { + type string{ + length "1..200"; + } + description "xxxx"; + } + } + } + + + + grouping license-key-groups { + description "xxxx"; + container license-key-group-list { + description "xxxx"; + leaf name { + type string; + description "xxxx"; + } + uses license-key-group; + } + } + + grouping license-key-group { + description "xxxx"; + list license-key-group { + description "xxxx"; + leaf license-key-group-uuid { + type string; + description "xxxx"; + } + leaf name { + type string{ + length "1..120"; + } + description "xxxx"; + } + leaf description { + type string{ + length "1..1000"; + } + description "xxxx"; + } + uses operational-scope; + leaf type { + type enumeration { + enum "Universal"{ + description "xxxx"; + } + enum "Unique"{ + description "xxxx"; + } + enum "One_Time"{ + description "xxxx"; + } + } + description "xxxx"; + } + } + } + + grouping vf-license-model-grouping { + description "xxxx"; + container vf-license-model { + description "xxxx"; + leaf vf-id { + type string{ + length "1..200"; + } + description "xxxx"; + } + leaf vendor-name { + type string{ + length "1..200"; + } + description "xxxx"; + } + uses feature-groups; + } + } + + grouping feature-groups { + description "xxxx"; + container feature-group-list { + description "xxxx"; + uses feature-group-grouping; + } + } + + grouping feature-group-grouping { + description "xxxx"; + list feature-group { + description "xxxx"; + leaf name{ + type string{ + length "1..120"; + } + description "xxxx"; + } + leaf feature-group-uuid{ + type string; + description "xxxx"; + } + leaf description { + type string{ + length "1..1000"; + } + description "xxxx"; + } + leaf att-part-number { + type string{ + length "1..100"; + } + description "xxxx"; + } + uses entitlement-pools; + uses license-key-groups; + } + } +} diff --git a/asdcApi/pom.xml b/asdcApi/pom.xml new file mode 100755 index 000000000..b4d538abd --- /dev/null +++ b/asdcApi/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + + org.onap.ccsdk.sli.northbound + sdnc-northbound + 0.0.1-SNAPSHOT + + + pom + org.onap.ccsdk.sli.northbound + asdcApi + 0.0.1-SNAPSHOT + + + asdcApi + + + + + + + org.onap.ccsdk.sli.northbound + asdcApi-features + features + xml + ${project.version} + + + + org.onap.ccsdk.sli.northbound + asdcApi-model + ${project.version} + + + org.onap.ccsdk.sli.northbound + asdcApi-provider + ${project.version} + config + xml + + + org.onap.ccsdk.sli.northbound + asdcApi-provider + ${project.version} + + + + + + + + + + + model + features + provider + installer + + + diff --git a/asdcApi/provider/pom.xml b/asdcApi/provider/pom.xml new file mode 100755 index 000000000..e8769fd7d --- /dev/null +++ b/asdcApi/provider/pom.xml @@ -0,0 +1,129 @@ + + + 4.0.0 + + asdcApi + org.onap.ccsdk.sli.northbound + 0.0.1-SNAPSHOT + + asdcApi-provider + bundle + + + + + org.apache.felix + maven-bundle-plugin + true + + + org.opendaylight.controller.config.yang.config.asdcApi_provider.impl + * + + + + + org.opendaylight.yangtools + yang-maven-plugin + ${odl.yangtools.yang.maven.plugin.version} + + + config + + generate-sources + + + + + org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator + ${jmxGeneratorPath} + + urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang + + + + org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl + ${salGeneratorPath} + + + true + + + + + + org.opendaylight.mdsal + maven-sal-api-gen-plugin + ${odl.sal.api.gen.plugin.version} + jar + + + org.opendaylight.controller + yang-jmx-generator-plugin + ${odl.yang.jmx.generator.version} + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + + attach-artifact + + package + + + + ${project.build.directory}/classes/initial/asdcApi-provider.xml + xml + config + + + + + + + + + + + + org.onap.ccsdk.sli.northbound + asdcApi-model + ${project.version} + + + org.opendaylight.controller + config-api + ${odl.controller.config.api.version} + + + org.opendaylight.controller + sal-binding-config + ${odl.mdsal.version} + + + org.opendaylight.controller + sal-binding-api + ${odl.mdsal.version} + + + org.opendaylight.controller + sal-common-util + ${odl.mdsal.version} + + + org.onap.ccsdk.sli.core + sli-common + ${sdnctl.sli.version} + + + org.onap.ccsdk.sli.core + sli-provider + ${sdnctl.sli.version} + + + diff --git a/asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModule.java b/asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModule.java new file mode 100644 index 000000000..c9223a15c --- /dev/null +++ b/asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModule.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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.opendaylight.yang.gen.v1.org.openecomp.sdnc.asdcapi.provider.impl.rev140523; + +import org.openecomp.sdnc.asdcapi.AsdcApiProvider; + +public class AsdcApiProviderModule extends org.opendaylight.yang.gen.v1.org.openecomp.sdnc.asdcapi.provider.impl.rev140523.AbstractAsdcApiProviderModule { + public AsdcApiProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public AsdcApiProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.org.openecomp.sdnc.asdcapi.provider.impl.rev140523.AsdcApiProviderModule oldModule, java.lang.AutoCloseable oldInstance) { + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + public void customValidation() { + // add custom validation form module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + + final AsdcApiProvider provider = new AsdcApiProvider(getDataBrokerDependency() + , getNotificationServiceDependency() + , getRpcRegistryDependency()); + + return new AutoCloseable() { + + @Override + public void close() throws Exception { + + provider.close(); + } + }; + } + +} diff --git a/asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModuleFactory.java b/asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModuleFactory.java new file mode 100644 index 000000000..6a1d8068e --- /dev/null +++ b/asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModuleFactory.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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========================================================= + */ + +/* +* Generated file +* +* Generated from: yang module name: asdcApi-provider-impl yang module local name: asdcApi-provider-impl +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Wed Nov 02 03:46:08 EDT 2016 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.yang.gen.v1.org.openecomp.sdnc.asdcapi.provider.impl.rev140523; +public class AsdcApiProviderModuleFactory extends org.opendaylight.yang.gen.v1.org.openecomp.sdnc.asdcapi.provider.impl.rev140523.AbstractAsdcApiProviderModuleFactory { + +} diff --git a/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiProvider.java b/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiProvider.java new file mode 100644 index 000000000..28e59c8d7 --- /dev/null +++ b/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiProvider.java @@ -0,0 +1,415 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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.openecomp.sdnc.asdcapi; + +import java.util.Properties; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; +import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; +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.yang.gen.v1.http.xmlns.openecomp.org.asdc.license.model._1._0.rev160427.vf.license.model.grouping.VfLicenseModel; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.ASDCAPIService; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.Artifacts; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.ArtifactsBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelUpdateInput; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelUpdateInputBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelUpdateOutput; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelUpdateOutputBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelVersions; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelVersionsBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.artifacts.Artifact; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.artifacts.ArtifactBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.artifacts.ArtifactKey; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.vf.license.model.versions.VfLicenseModelVersion; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.vf.license.model.versions.VfLicenseModelVersionBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +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.Optional; +import com.google.common.util.concurrent.CheckedFuture; +import com.google.common.util.concurrent.Futures; + +/** + * 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. + * + * To use this, copy and paste (overwrite) the following method into the TestApplicationProviderModule + * class which is auto generated under src/main/java in this project + * (created only once during first compilation): + * + *
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+
+         final asdcApiProvider provider = new asdcApiProvider();
+         provider.setDataBroker( getDataBrokerDependency() );
+         provider.setNotificationService( getNotificationServiceDependency() );
+         provider.setRpcRegistry( getRpcRegistryDependency() );
+         provider.initialize();
+         return new AutoCloseable() {
+
+            @Override
+            public void close() throws Exception {
+                //TODO: CLOSE ANY REGISTRATION OBJECTS CREATED USING ABOVE BROKER/NOTIFICATION
+                //SERVIE/RPC REGISTRY
+                provider.close();
+            }
+        };
+    }
+
+
+    
+ */ +public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { + + private static final String ACTIVE_VERSION = "active"; + + private final Logger log = LoggerFactory.getLogger( AsdcApiProvider.class ); + private final String appName = "asdcApi"; + + private final ExecutorService executor; + protected DataBroker dataBroker; + protected NotificationProviderService notificationService; + protected RpcProviderRegistry rpcRegistry; + + protected BindingAwareBroker.RpcRegistration rpcRegistration; + + public AsdcApiProvider(DataBroker dataBroker2, + NotificationProviderService notificationProviderService, + RpcProviderRegistry rpcProviderRegistry) { + this.log.info( "Creating provider for " + appName ); + executor = Executors.newFixedThreadPool(1); + dataBroker = dataBroker2; + notificationService = notificationProviderService; + rpcRegistry = rpcProviderRegistry; + initialize(); + } + + public void initialize(){ + log.info( "Initializing provider for " + appName ); + + + createContainers(); + + if (rpcRegistration == null) { + if (rpcRegistry != null) { + rpcRegistration = rpcRegistry.addRpcImplementation( + ASDCAPIService.class, this); + log.info("Initialization complete for " + appName); + } else { + log.warn("Error initializing " + appName + + " : rpcRegistry unset"); + } + } + } + + private void createContainers() { + + if (dataBroker != null) { + final WriteTransaction t = dataBroker.newReadWriteTransaction(); + + // Create the vf-model-license-versions and artifacts containers + t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(VfLicenseModelVersions.class), + new VfLicenseModelVersionsBuilder().build()); + + t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Artifacts.class), new ArtifactsBuilder().build()); + + + try { + CheckedFuture checkedFuture = t.submit(); + checkedFuture.get(); + log.info("Create Containers succeeded!: "); + + } catch (InterruptedException | ExecutionException e) { + log.error("Create Containers Failed: " + e); + e.printStackTrace(); + } + } else { + log.warn("createContainers : cannot find dataBroker to create containers"); + } + } + protected void initializeChild() { + //Override if you have custom initialization intelligence + } + + @Override + public void close() throws Exception { + log.info( "Closing provider for " + appName ); + executor.shutdown(); + rpcRegistration.close(); + log.info( "Successfully closed provider for " + appName ); + } + + public void setDataBroker(DataBroker dataBroker) { + this.dataBroker = dataBroker; + if( log.isDebugEnabled() ){ + log.debug( "DataBroker set to " + (dataBroker==null?"null":"non-null") + "." ); + } + } + + public void setNotificationService( + NotificationProviderService notificationService) { + this.notificationService = notificationService; + if( log.isDebugEnabled() ){ + log.debug( "Notification Service set to " + (notificationService==null?"null":"non-null") + "." ); + } + } + + public void setRpcRegistry(RpcProviderRegistry rpcRegistry) { + this.rpcRegistry = rpcRegistry; + + rpcRegistration = rpcRegistry.addRpcImplementation(ASDCAPIService.class, this); + + if( log.isDebugEnabled() ){ + log.debug( "RpcRegistry set to " + (rpcRegistry==null?"null":"non-null") + "." ); + } + } + + + protected boolean artifactVersionExists(String aName, String aVersion) { + InstanceIdentifier artifactInstanceId = + InstanceIdentifier.builder(Artifacts.class) + .child(Artifact.class, new ArtifactKey(aName, aVersion)).toInstance(); + ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction(); + Optional data = null; + try { + data = (Optional) readTx.read(LogicalDatastoreType.CONFIGURATION, artifactInstanceId).get(); + } catch (InterruptedException | ExecutionException e) { + log.error("Caught Exception reading MD-SAL for ["+aName+","+ aVersion+"] " ,e); + return false; + + } + + if (data.isPresent()) { + return true; + } else { + return false; + } + } + + protected void addArtifactVersion(String aName, String aVersion) { + + + try { + ArtifactBuilder aBuilder = new ArtifactBuilder(); + + aBuilder.setArtifactName(aName); + aBuilder.setArtifactVersion(aVersion); + + Artifact artifact = aBuilder.build(); + + InstanceIdentifier.InstanceIdentifierBuilder aIdBuilder = InstanceIdentifier + . builder(Artifacts.class) + .child(Artifact.class, artifact.getKey()); + + InstanceIdentifier path = aIdBuilder + .toInstance(); + + WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); + + tx.merge(LogicalDatastoreType.CONFIGURATION, path, + artifact); + tx.submit().checkedGet(); + } catch (Exception e) { + log.error("Caught exception trying to add artifact entry", e); + } + + } + + + private void applyVfLicenseModelUpdate(VfLicenseModelUpdateInput input) { + + String aName = input.getArtifactName(); + String aVersion = input.getArtifactVersion(); + VfLicenseModel vfLicenseModel = input.getVfLicenseModel(); + + + // Add new version (version = artifact-version) + try { + + VfLicenseModelVersionBuilder vBuilder = new VfLicenseModelVersionBuilder(); + vBuilder.setArtifactName(aName); + vBuilder.setArtifactVersion(aVersion); + vBuilder.setVfLicenseModel(vfLicenseModel); + + VfLicenseModelVersion version = vBuilder.build(); + + InstanceIdentifier.InstanceIdentifierBuilder versionIdBuilder = InstanceIdentifier + . builder(VfLicenseModelVersions.class) + .child(VfLicenseModelVersion.class, version.getKey()); + + InstanceIdentifier path = versionIdBuilder + .toInstance(); + + WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); + tx.merge(LogicalDatastoreType.CONFIGURATION, path, + version); + tx.submit().checkedGet(); + } catch (Exception e) { + log.error( + "Caught exception trying to save entry to MD-SAL", + e); + } + + + // Add "active" version (version = "active") + try { + + VfLicenseModelVersionBuilder vBuilder = new VfLicenseModelVersionBuilder(); + vBuilder.setArtifactName(aName); + vBuilder.setArtifactVersion(ACTIVE_VERSION); + vBuilder.setVfLicenseModel(vfLicenseModel); + + VfLicenseModelVersion version = vBuilder.build(); + InstanceIdentifier.InstanceIdentifierBuilder versionIdBuilder = InstanceIdentifier + . builder(VfLicenseModelVersions.class) + .child(VfLicenseModelVersion.class, version.getKey()); + + InstanceIdentifier path = versionIdBuilder + .toInstance(); + + WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); + + tx.merge(LogicalDatastoreType.CONFIGURATION, path, + version); + tx.submit().checkedGet(); + } catch (Exception e) { + log.error( + "Caught exception trying to save entry to MD-SAL", + e); + } + +} + +@Override +public Future> vfLicenseModelUpdate(VfLicenseModelUpdateInput input) { + final String SVC_OPERATION = "vf-license-model-update"; + + Properties parms = new Properties(); + + log.info( SVC_OPERATION +" called." ); + + if(input == null ) { + log.debug("exiting " +SVC_OPERATION+ " because of invalid input"); + return null; + } + + VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(input); + input = inputBuilder.build(); + + String errorMessage = "Success"; + String errorCode = "200"; + + // If this artifact already exists, reject this update + if (artifactVersionExists(input.getArtifactName(), input.getArtifactVersion())) { + errorCode = "409"; + errorMessage = "Artifact version already exists"; + } else { + // Translate input object into SLI-consumable properties + log.info("Adding INPUT data for "+SVC_OPERATION+" input: " + input); + AsdcApiUtil.toProperties(parms, input); + + + // Call directed graph + + Properties respProps = null; + + + AsdcApiSliClient sliClient = new AsdcApiSliClient(); + try + { + if (sliClient.hasGraph("ASDC-API", SVC_OPERATION , null, "sync")) + { + + try + { + respProps = sliClient.execute("ASDC-API", SVC_OPERATION, null, "sync", parms); + } + catch (Exception e) + { + log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + } + } else { + errorMessage = "No service logic active for ASDC-API: '" + SVC_OPERATION + "'"; + errorCode = "503"; + } + } + catch (Exception e) + { + errorCode = "500"; + errorMessage = e.getMessage(); + log.error("Caught exception looking for service logic", e); + } + + + if (respProps != null) + { + errorCode = respProps.getProperty("error-code"); + errorMessage = respProps.getProperty("error-message", ""); + } + } + + + if ("200".equals(errorCode)) { + log.info("ASDC update succeeded"); + + // Update config tree + applyVfLicenseModelUpdate(input); + addArtifactVersion(input.getArtifactName(), input.getArtifactVersion()); + + } else { + log.info("ASDC update failed ("+errorCode+" : "+errorMessage); + } + + // Send response + VfLicenseModelUpdateOutputBuilder respBuilder = new VfLicenseModelUpdateOutputBuilder(); + respBuilder.setAsdcApiResponseCode(errorCode); + if (errorMessage != null && errorMessage.length() > 0) { + respBuilder.setAsdcApiResponseText(errorMessage); + } + + RpcResult rpcResult; + + + rpcResult = RpcResultBuilder. status(true).withResult(respBuilder.build()).build(); + + + + return Futures.immediateFuture(rpcResult); +} + + +} diff --git a/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiSliClient.java b/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiSliClient.java new file mode 100644 index 000000000..2f3a783ba --- /dev/null +++ b/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiSliClient.java @@ -0,0 +1,111 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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.openecomp.sdnc.asdcapi; + +import java.util.Properties; + +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AsdcApiSliClient { + + private static final Logger LOG = LoggerFactory + .getLogger(AsdcApiSliClient.class); + + private SvcLogicService svcLogic = null; + + public AsdcApiSliClient() + { + BundleContext bctx = FrameworkUtil.getBundle(SvcLogicService.class).getBundleContext(); + + // Get SvcLogicService reference + ServiceReference sref = bctx.getServiceReference(SvcLogicService.NAME); + if (sref != null) + { + svcLogic = (SvcLogicService) bctx.getService(sref); + } + else + { + LOG.warn("Cannot find service reference for "+SvcLogicService.NAME); + + } + } + + public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException + { + return(svcLogic.hasGraph(module, rpc, version, mode)); + } + + + public Properties execute(String module, String rpc, String version, String mode, Properties parms) + 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 = svcLogic.execute(module, rpc, version, mode, parms); + + 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("error-code")) { + respProps.setProperty("error-code", "500"); + } + } else { + if (!respProps.containsKey("error-code")) { + respProps.setProperty("error-code", "200"); + } + } + + + return (respProps); + } + +} diff --git a/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiUtil.java b/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiUtil.java new file mode 100644 index 000000000..240c939b4 --- /dev/null +++ b/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiUtil.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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.openecomp.sdnc.asdcapi; + +import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.ArtifactsBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelUpdateInput; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelUpdateInputBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelVersionsBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.vf.license.model.versions.VfLicenseModelVersionBuilder; + +public class AsdcApiUtil extends MdsalHelper { + + static { + + // Input objects + + VfLicenseModelUpdateInput i13 = new VfLicenseModelUpdateInputBuilder().build(); + + + // Other builders + ArtifactsBuilder b1 = new ArtifactsBuilder(); + + VfLicenseModelVersionsBuilder b14a = new VfLicenseModelVersionsBuilder(); + VfLicenseModelVersionBuilder b26a = new VfLicenseModelVersionBuilder(); + + + } +} diff --git a/asdcApi/provider/src/main/resources/initial/asdcApi-provider.xml b/asdcApi/provider/src/main/resources/initial/asdcApi-provider.xml new file mode 100644 index 000000000..ab2da905f --- /dev/null +++ b/asdcApi/provider/src/main/resources/initial/asdcApi-provider.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + prefix:asdcApi-provider-impl + + asdcApi-provider-impl + + + + binding:binding-rpc-registry + binding-rpc-broker + + + + binding:binding-async-data-broker + binding-data-broker + + + + + binding:binding-notification-service + + binding-notification-broker + + + + + + + + + + + org:openecomp:sdnc:asdcapi:provider:impl?module=asdcApi-provider-impl&revision=2014-05-23 + + + diff --git a/asdcApi/provider/src/main/yang/asdcApi-provider-impl.yang b/asdcApi/provider/src/main/yang/asdcApi-provider-impl.yang new file mode 100755 index 000000000..94ee88368 --- /dev/null +++ b/asdcApi/provider/src/main/yang/asdcApi-provider-impl.yang @@ -0,0 +1,61 @@ +module asdcApi-provider-impl { + + yang-version 1; + namespace "org:openecomp:sdnc:asdcapi:provider:impl"; + prefix "asdcApi-provider-impl"; + + import config { prefix config; revision-date 2013-04-05; } + import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; } + + description + "This module contains the base YANG definitions for + asdcApi-provider impl implementation."; + + revision "2014-05-23" { + description + "Initial revision."; + } + + // This is the definition of the service implementation as a module identity. + identity asdcApi-provider-impl { + base config:module-type; + + // Specifies the prefix for generated java classes. + config:java-name-prefix AsdcApiProvider; + } + + // Augments the 'configuration' choice node under modules/module. + // We consume the three main services, RPCs, DataStore, and Notifications + augment "/config:modules/config:module/config:configuration" { + case asdcApi-provider-impl { + when "/config:modules/config:module/config:type = 'asdcApi-provider-impl'"; + + container rpc-registry { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity mdsal:binding-rpc-registry; + } + } + } + + container notification-service { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity mdsal:binding-notification-service; + } + } + } + + container data-broker { + uses config:service-ref { + refine type { + mandatory false; + config:required-identity mdsal:binding-async-data-broker; + } + } + } + } + } +} -- cgit 1.2.3-korg