summaryrefslogtreecommitdiffstats
path: root/appc-inbound/appc-design-services/model
diff options
context:
space:
mode:
Diffstat (limited to 'appc-inbound/appc-design-services/model')
-rwxr-xr-xappc-inbound/appc-design-services/model/.gitignore1
-rwxr-xr-xappc-inbound/appc-design-services/model/pom.xml155
-rwxr-xr-xappc-inbound/appc-design-services/model/scripts/python/yang2props.py57
-rw-r--r--appc-inbound/appc-design-services/model/src/main/yang/appc-design-services.yang144
4 files changed, 357 insertions, 0 deletions
diff --git a/appc-inbound/appc-design-services/model/.gitignore b/appc-inbound/appc-design-services/model/.gitignore
new file mode 100755
index 000000000..b83d22266
--- /dev/null
+++ b/appc-inbound/appc-design-services/model/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-inbound/appc-design-services/model/pom.xml b/appc-inbound/appc-design-services/model/pom.xml
new file mode 100755
index 000000000..ef7b83e55
--- /dev/null
+++ b/appc-inbound/appc-design-services/model/pom.xml
@@ -0,0 +1,155 @@
+<?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-design-services</artifactId>
+ <groupId>org.openecomp.appc</groupId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>appc-design-services-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.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/appc-design-services.yang</argument>
+ <argument>target/appc-design-services.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}/appc-design-services.properties</file>
+ <type>properties</type>
+ <classifier>appc-design-services</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>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-yang-types</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/appc-inbound/appc-design-services/model/scripts/python/yang2props.py b/appc-inbound/appc-design-services/model/scripts/python/yang2props.py
new file mode 100755
index 000000000..559d31b8b
--- /dev/null
+++ b/appc-inbound/appc-design-services/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-design-services/model/src/main/yang/appc-design-services.yang b/appc-inbound/appc-design-services/model/src/main/yang/appc-design-services.yang
new file mode 100644
index 000000000..b43ce0fad
--- /dev/null
+++ b/appc-inbound/appc-design-services/model/src/main/yang/appc-design-services.yang
@@ -0,0 +1,144 @@
+/*-
+ * ============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=========================================================
+ */
+
+/*
+ * Yang model for the Application Controller (APP-C) component of ECOMP
+ *
+ *
+ *The main purpose of this model to provide an interface bewteen APPC Runtime and APPC design time environment
+ * to communicate.
+ *
+ *
+ *
+ *
+*/
+
+module design-services {
+
+ yang-version 1;
+ namespace "org:openecomp:appc";
+ prefix design-services;
+ organization "AT&T. Copyright (C) 2015. All rights reserved.";
+
+ description
+ "Defines the services and request/response requirements for the APP-C Design and RunTime.";
+
+ /*
+ * Note, the revision changes the package name of the generated java code. Do not
+ * change the revision unless you also update all references to the bindings.
+ */
+ revision "2017-06-27" {
+ description
+ "APP-C Design interface version 1.1.0";
+ }
+
+ grouping design-request {
+ container design-request {
+ leaf request-id {
+ type string;
+ description "The request ID ";
+ mandatory true;
+ }
+ leaf action {
+ type string;
+ description "The Action Name";
+ mandatory true;
+ }
+ leaf payload {
+ type string;
+ description "The Payload";
+ }
+ leaf data-type {
+ description "Data type for validation";
+ type string;
+
+ }
+ }
+ }
+
+
+ grouping data {
+ description "The Generic Data response which includes data from run Time for Design time environment";
+ container data {
+ description "The Data from run Time for Design time environment";
+ leaf block {
+ description "Response message";
+ type string;
+ }
+ leaf requestId {
+ description "Response message reqesut ID";
+ type string;
+ mandatory true;
+ }
+ }
+
+ }
+ grouping status {
+ description "The specific response codes are to be aligned with APPC/ECOMP messaging Systems";
+ container status {
+ description "The specific response codes are to be aligned with ASDC reference doc (main table removed to avoid duplication and digression from main table). See ASDC and ECOMP Distribution Consumer Interface Agreement";
+ leaf code {
+ description "Response code";
+ type string;
+ mandatory true;
+ }
+ leaf message {
+ description "Response message";
+ type string;
+ }
+ }
+ }
+
+ rpc dbservice {
+ description "Runs a given task if it exists.";
+ input {
+ uses design-request;
+ }
+ output {
+ uses data ;
+ uses status;
+ }
+ }
+ rpc validator {
+ description "Runs a given task if it exists.";
+
+ input {
+ uses design-request;
+ }
+ output {
+ uses status;
+ }
+ }
+ rpc xinterfaceservice {
+ description "Runs a given task if it exists.";
+ input {
+ uses design-request;
+ }
+ output {
+ uses data ;
+ uses status;
+
+ }
+ }
+}