diff options
author | Skip Wonnell <kw5258@att.com> | 2017-08-14 17:47:10 -0500 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2017-08-18 05:46:15 +0000 |
commit | ab6c2c0cd441cf40723016e9a82aeeeb933fec7e (patch) | |
tree | 10d9de942694ca129cfc78d13cf2269f5c37cfc9 /appc-inbound/appc-artifact-handler/model | |
parent | 5166a76913fcb658be58adffed441590979e41cf (diff) |
Initial adds artifact handler and design services
asdc-artifact-handler: an interface to receive artifacts distributed
by SDC and persist them into the local database.
appc-design-services: an interface to manage VNF configuration
artifacts, primarily those generated by the configuration design tool.
Includes these user stories: APPC-28/85
Change-Id: Ib207070d4593554fa424fc69d9c77a6cd5349fec
Signed-off-by: Skip Wonnell <kw5258@att.com>
Issue-Id: APPC-9
Diffstat (limited to 'appc-inbound/appc-artifact-handler/model')
5 files changed, 357 insertions, 0 deletions
diff --git a/appc-inbound/appc-artifact-handler/model/.gitignore b/appc-inbound/appc-artifact-handler/model/.gitignore new file mode 100755 index 000000000..0f44a0f25 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/model/.gitignore @@ -0,0 +1,2 @@ +/target/ +/.classpath diff --git a/appc-inbound/appc-artifact-handler/model/pom.xml b/appc-inbound/appc-artifact-handler/model/pom.xml new file mode 100755 index 000000000..7b9402d8f --- /dev/null +++ b/appc-inbound/appc-artifact-handler/model/pom.xml @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>appc-artifact-handler</artifactId> + <groupId>org.openecomp.appc</groupId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>appc-artifact-handler-model</artifactId> + <packaging>bundle</packaging> + + <build> + + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Import-Package>*</Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>maven-sal-api-gen-plugin</artifactId> + <!-- <version>${odl.yangtools.version}</version> --> + <version>${odl.sal.api.gen.plugin.version}</version> + <type>jar</type> + </dependency> + </dependencies> + <executions> + <execution> + <goals> + <goal>generate-sources</goal> + </goals> + <configuration> + <yangFilesRootDir>${yang.file.directory}</yangFilesRootDir> + <codeGenerators> + <generator> + <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass> + <outputBaseDir>${salGeneratorPath}</outputBaseDir> + </generator> + </codeGenerators> + <inspectDependencies>true</inspectDependencies> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <configuration> + <executable>python</executable> + <arguments> + <argument>scripts/python/yang2props.py</argument> + <argument>src/main/yang/artifact-handler.yang</argument> + <argument>target/artifact-handler.properties</argument> + </arguments> + </configuration> + <id>generation</id> + <phase>generate-resources</phase> + <goals> + <goal>exec</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-artifacts</id> + <goals> + <goal>attach-artifact</goal> + </goals> + <phase>package</phase> + <configuration> + <artifacts> + <artifact> + <file>${project.build.directory}/artifact-handler.properties</file> + <type>properties</type> + <classifier>artifact-handler</classifier> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings + only. It has no influence on the Maven build itself. --> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId> + org.codehaus.mojo + </groupId> + <artifactId> + exec-maven-plugin + </artifactId> + <versionRange> + [1.2.1,) + </versionRange> + <goals> + <goal>exec</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore /> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>yang-binding</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-common</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-inet-types</artifactId> + <version>${odl.ietf-inet-types.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-yang-types</artifactId> + <version>${odl.ietf-yang-types.version}</version> + </dependency> + </dependencies> +</project> diff --git a/appc-inbound/appc-artifact-handler/model/scripts/python/yang2props.py b/appc-inbound/appc-artifact-handler/model/scripts/python/yang2props.py new file mode 100755 index 000000000..559d31b8b --- /dev/null +++ b/appc-inbound/appc-artifact-handler/model/scripts/python/yang2props.py @@ -0,0 +1,57 @@ +#!/usr/bin/python + +import re +import sys + + +# Convert word from foo-bar to FooBar +# words begining with a digit will be converted to _digit +def to_enum(s): + if s[0].isdigit(): + s = "_" + s + else: + s = s[0].upper() + s[1:] + return re.sub(r'(?!^)-([a-zA-Z])', lambda m: m.group(1).upper(), s) + +leaf = "" +val = "" +li = [] + +if len(sys.argv) < 3: + print 'yang2props.py <input yang> <output properties>' + sys.exit(2) + +with open(sys.argv[1], "r") as ins: + for line in ins: + # if we see a leaf save the name for later + if "leaf " in line: + match = re.search(r'leaf (\S+)', line) + if match: + leaf = match.group(1) + + # if we see enum convert the value to enum format and see if it changed + # if the value is different write a property entry + if "enum " in line: + match = re.search(r'enum "(\S+)";', line) + if match: + val = match.group(1) + enum = to_enum(val) + + # see if converting to enum changed the string + if val != enum: + property = "yang."+leaf+"."+enum+"="+val + if property not in li: + li.append( property) + + +# Open output file +fo = open(sys.argv[2], "wb") +fo.write("# yang conversion properties \n") +fo.write("# used to convert Enum back to the original yang value \n") +fo.write("\n".join(li)) +fo.write("\n") + +# Close opend file +fo.close() + + diff --git a/appc-inbound/appc-artifact-handler/model/src/main/.gitignore b/appc-inbound/appc-artifact-handler/model/src/main/.gitignore new file mode 100755 index 000000000..380e77fc2 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/model/src/main/.gitignore @@ -0,0 +1 @@ +/yang-gen-sal/ diff --git a/appc-inbound/appc-artifact-handler/model/src/main/yang/artifact-handler.yang b/appc-inbound/appc-artifact-handler/model/src/main/yang/artifact-handler.yang new file mode 100644 index 000000000..1839fbd67 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/model/src/main/yang/artifact-handler.yang @@ -0,0 +1,139 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * 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. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +module artifact-handler { + yang-version 1; + + namespace "org.openecomp.appc:artifacthandler"; + prefix artifacthandler; + + import ietf-inet-types { prefix "ietf"; revision-date "2010-09-24"; } + organization "AT&T, Inc."; + + description + "Defines APPC interface to push reference data and templates."; + + revision "2017-03-21" { + description + "Initial draft"; + } + + grouping configuration-document-information { + uses request-information; + uses document-parameters; + } + + grouping request-information { + container request-information { + leaf request-id { + type string; + } + leaf request-action { + type enumeration { + enum "StoreAsdcDocumentRequest"; + } + } + leaf request-sub-action { + type enumeration { + enum "STOREDOCUMENT"; + } + } + leaf source { + type string; + } + } + } + grouping document-parameters { + container document-parameters { + leaf service-uuid { + type string; + mandatory true; + } + leaf distribution-id { + type string; + } + leaf service-name { + type string; + } + leaf service-description { + type string; + } + leaf service-artifacts { + type string; + } + leaf resource-uuid { + type string; + } + leaf resource-instance-name { + type string; + } + leaf resource-name { + type string; + } + leaf resource-version { + type string; + } + leaf resource-type { + type string; + } + leaf artifact-uuid { + type string; + } + leaf artifact-name { + type string; + } + leaf artifact-type { + type string; + } + leaf artifact-version { + type string; + } + leaf artifact-description { + type string; + } + leaf artifact-contents { + type string; + } + } + } + rpc uploadartifact { + description "upload the artifact into APPC"; + input { + uses configuration-document-information; + } + output { + container config-document-response { + leaf request-id { + type string; + } + leaf status { + type string; + } + leaf error-reason { + type string; + } + } + } + } +} |