From 862311b61372bc944667e22f6d8b7cac90657b96 Mon Sep 17 00:00:00 2001 From: Tony Tkacik Date: Tue, 9 Jul 2013 17:22:53 +0200 Subject: [PATCH] Added YANG extensions module - Added YANG extensions module which defines - Context-aware RPCs - Named Augmentations Change-Id: I7b6cb7f579c519dfa726f966df466ad6c9e6aee1 Signed-off-by: Tony Tkacik --- pom.xml | 145 ++++++++++++++------------- yang-ext/pom.xml | 100 ++++++++++++++++++ yang-ext/src/main/yang/yang-ext.yang | 60 +++++++++++ 3 files changed, 233 insertions(+), 72 deletions(-) create mode 100644 yang-ext/pom.xml create mode 100644 yang-ext/src/main/yang/yang-ext.yang diff --git a/pom.xml b/pom.xml index 3076a6fd67..b9627a5a07 100644 --- a/pom.xml +++ b/pom.xml @@ -1,34 +1,35 @@ - 4.0.0 - - org.opendaylight.controller - yang-prototype - 0.5-SNAPSHOT - - 0.5.3-SNAPSHOT - yang - pom + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.opendaylight.controller + yang-prototype + 0.5-SNAPSHOT + + 0.5.3-SNAPSHOT + yang + pom UTF-8 - - yang-common - yang-data-api - yang-data-util + + yang-common + yang-data-api + yang-data-util yang-data-impl - yang-model-api - yang-model-util - yang-binding - ../code-generator/yang-model-parser-api - ../code-generator/yang-model-parser-impl - ../code-generator/maven-yang - ../code-generator/maven-yang-plugin - ../code-generator/maven-yang-plugin-it - + yang-model-api + yang-model-util + yang-binding + yang-ext + ../code-generator/yang-model-parser-api + ../code-generator/yang-model-parser-impl + ../code-generator/maven-yang + ../code-generator/maven-yang-plugin + ../code-generator/maven-yang-plugin-it + @@ -86,53 +87,53 @@ - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.0 - true - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.8.1 - - maven - - - - - aggregate - - site - - - - - - - - - org.codehaus.mojo - findbugs-maven-plugin - 2.4.0 - - Max - Low - site - - - - org.codehaus.mojo - jdepend-maven-plugin - 2.0-beta-2 - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0 + true + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8.1 + + maven + + + + + aggregate + + site + + + + + + + + + org.codehaus.mojo + findbugs-maven-plugin + 2.4.0 + + Max + Low + site + + + + org.codehaus.mojo + jdepend-maven-plugin + 2.0-beta-2 + + + diff --git a/yang-ext/pom.xml b/yang-ext/pom.xml new file mode 100644 index 0000000000..16cd65d3cf --- /dev/null +++ b/yang-ext/pom.xml @@ -0,0 +1,100 @@ + + 4.0.0 + + org.opendaylight.controller + yang + 0.5.3-SNAPSHOT + + yang-ext + 2013.09.07-SNAPSHOT + + + + + org.opendaylight.controller + yang-maven-plugin + 0.5.3-SNAPSHOT + + + + generate-sources + + + src/main/yang + + + false + + + + + + org.opendaylight.controller + maven-sal-api-gen-plugin + 0.5.3-SNAPSHOT + jar + + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + generate-sources + + add-source + + + + target/generated-sources/sal + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.opendaylight.controller + + + yang-maven-plugin + + + [0.5,) + + + + generate-sources + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yang-ext/src/main/yang/yang-ext.yang b/yang-ext/src/main/yang/yang-ext.yang new file mode 100644 index 0000000000..22aa48adba --- /dev/null +++ b/yang-ext/src/main/yang/yang-ext.yang @@ -0,0 +1,60 @@ +module yang-ext { + yang-version 1; + namespace "urn:opendaylight:params:ns:yang:extension:yang-ext"; + prefix "ext"; + + contact "Anton Tkacik "; + + revision "2013-07-09" { + description ""; + } + + // Augmentation name + + extension "augment-identifier" { + description + "YANG language extension which assigns an identifier to + augmentation. Augment identifier is used to identify + specific augment statement by name. + + The identifier syntax is defined formally defined by the rule + 'identifier' in Section 12 of RFC 6020. + + All augment identifiers defined in a namespace MUST be unique. + The namespace of augment identifiers is shared by module and + its submodules. + "; + /* + Discussion: + This extension allows for ease of development / debug + of YANG modules and it is suitable for code generation, + where each augment statement is nicely identified by + unique name instead of combination of augment target + and when condition. + */ + argument "identifier"; + } + + + // Context-aware RPCs + + grouping rpc-context-ref { + description + "A reference to RPC context."; + leaf context-instance { + type instance-identifier; + description "Pointer to the context. "; + } + } + + extension "rpc-context-instance" { + description + "YANG language extension which defines enclosing (parent) + schema node as referencable context for RPCs. + + The argument is identity which is used to identify RPC context + type."; + + argument "context-type"; + } +} \ No newline at end of file -- 2.36.6