summaryrefslogtreecommitdiffstats
path: root/appc-inbound/appc-interfaces-service/model
diff options
context:
space:
mode:
Diffstat (limited to 'appc-inbound/appc-interfaces-service/model')
-rw-r--r--appc-inbound/appc-interfaces-service/model/.gitignore1
-rw-r--r--appc-inbound/appc-interfaces-service/model/pom.xml156
-rw-r--r--appc-inbound/appc-interfaces-service/model/scripts/python/yang2props.py57
-rw-r--r--appc-inbound/appc-interfaces-service/model/src/main/yang/appc-interfaces-service.yang122
4 files changed, 336 insertions, 0 deletions
diff --git a/appc-inbound/appc-interfaces-service/model/.gitignore b/appc-inbound/appc-interfaces-service/model/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-inbound/appc-interfaces-service/model/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-inbound/appc-interfaces-service/model/pom.xml b/appc-inbound/appc-interfaces-service/model/pom.xml
new file mode 100644
index 000000000..63e855f06
--- /dev/null
+++ b/appc-inbound/appc-interfaces-service/model/pom.xml
@@ -0,0 +1,156 @@
+<?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-interfaces-service</artifactId>
+ <groupId>org.onap.appc</groupId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>appc-interfaces-service-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>
+ <version>${odl.yangtools.version}</version>
+ <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.mdsal.binding.maven.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-interfaces-service.yang</argument>
+ <argument>target/appc-interfaces-service.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-interfaces-service.properties</file>
+ <type>properties</type>
+ <classifier>appc-interfaces-service</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-interfaces-service/model/scripts/python/yang2props.py b/appc-inbound/appc-interfaces-service/model/scripts/python/yang2props.py
new file mode 100644
index 000000000..559d31b8b
--- /dev/null
+++ b/appc-inbound/appc-interfaces-service/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-interfaces-service/model/src/main/yang/appc-interfaces-service.yang b/appc-inbound/appc-interfaces-service/model/src/main/yang/appc-interfaces-service.yang
new file mode 100644
index 000000000..b6e0438a8
--- /dev/null
+++ b/appc-inbound/appc-interfaces-service/model/src/main/yang/appc-interfaces-service.yang
@@ -0,0 +1,122 @@
+/*-
+ * ============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 other interface
+ * to communicate.
+ *
+ *
+ *
+ * Author: Anand Chaturvedi (ac204h@att.com)
+ */
+
+module interfaces-service {
+
+ yang-version 1;
+ namespace "org:onap:appc:interfaces:service";
+ prefix interfaces.service;
+ organization "AT&T. Copyright (C) 2015. All rights reserved.";
+ contact
+ "Anand Chaturvedi <ac204h@att.com>";
+
+ description
+ "Defines the services provided by Application Controller to external interfaces.";
+
+ /*
+ * 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-08-18" {
+ description
+ "APP-C Interface services version 1.1.0";
+ }
+
+ grouping request-info {
+ container request {
+ leaf request-id {
+ type string;
+ description "The request ID ";
+ mandatory true;
+ }
+ leaf action {
+ type string;
+ description "The Action Name";
+ mandatory true;
+ }
+ leaf request-data {
+ type string;
+ description "The Payload";
+ }
+ leaf request-data-type {
+ description "Data type for validation";
+ type string;
+ }
+ }
+ }
+
+ grouping response-info {
+ description "The Generic Data response which includes data key value pair as requested in Model";
+ container response-info {
+ description "Data returned from APPC to external Interaface";
+ 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 APPC.";
+ leaf code {
+ description "Response code";
+ type string;
+ mandatory true;
+ }
+ leaf message {
+ description "Response message";
+ type string;
+ }
+ }
+ }
+
+ rpc execute-service {
+ description "Runs a given action if it exists.";
+ input {
+ uses request-info;
+ }
+ output {
+ uses response-info ;
+ uses status;
+ }
+ }
+}