From 356e5110896658b6d054ff89e4e5234cc03afeaa Mon Sep 17 00:00:00 2001 From: Jakub Toth Date: Wed, 30 Nov 2016 16:35:35 +0100 Subject: [PATCH] Bug 5679 - new module 'models' for new models in restconf * added new module to models - ietf-yang-library with model ietf-yang-library.yang * added dependencies to sal-rest-connector and features on ietf-yang-library Change-Id: If372a629443cab496fd42b7a71d726c181c4000e Signed-off-by: Jakub Toth --- features/restconf/pom.xml | 5 + .../restconf/src/main/features/features.xml | 1 + restconf/models/ietf-yang-library/pom.xml | 36 +++ .../list/CommonLeafsRevisionBuilder.java | 20 ++ .../yang/ietf-yang-library@2016-06-21.yang | 208 ++++++++++++++++++ restconf/models/pom.xml | 25 +++ restconf/pom.xml | 1 + restconf/restconf-artifacts/pom.xml | 5 + restconf/sal-rest-connector/pom.xml | 5 + 9 files changed, 306 insertions(+) create mode 100644 restconf/models/ietf-yang-library/pom.xml create mode 100644 restconf/models/ietf-yang-library/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/yang/library/rev160621/module/list/CommonLeafsRevisionBuilder.java create mode 100644 restconf/models/ietf-yang-library/src/main/yang/ietf-yang-library@2016-06-21.yang create mode 100644 restconf/models/pom.xml diff --git a/features/restconf/pom.xml b/features/restconf/pom.xml index 45be172585..c2af176b82 100644 --- a/features/restconf/pom.xml +++ b/features/restconf/pom.xml @@ -165,6 +165,11 @@ sal-rest-docgen ${restconf.version} + + ${project.groupId} + ietf-yang-library + ${project.version} + diff --git a/features/restconf/src/main/features/features.xml b/features/restconf/src/main/features/features.xml index fc13c74f34..b6482f2a41 100644 --- a/features/restconf/src/main/features/features.xml +++ b/features/restconf/src/main/features/features.xml @@ -30,6 +30,7 @@ odl-mdsal-broker odl-netty war + mvn:org.opendaylight.netconf/ietf-yang-library/{{VERSION}} mvn:org.opendaylight.netconf/sal-rest-connector/{{VERSION}} mvn:com.google.code.gson/gson/{{VERSION}} mvn:org.opendaylight.yangtools/yang-data-codec-gson/{{VERSION}} diff --git a/restconf/models/ietf-yang-library/pom.xml b/restconf/models/ietf-yang-library/pom.xml new file mode 100644 index 0000000000..2b4f2b8752 --- /dev/null +++ b/restconf/models/ietf-yang-library/pom.xml @@ -0,0 +1,36 @@ + + + + + 4.0.0 + + + org.opendaylight.mdsal + binding-parent + 0.10.0-SNAPSHOT + ../../../binding/binding-parent + + + org.opendaylight.netconf + ietf-yang-library + 1.5.0-SNAPSHOT + bundle + ${project.artifactId} + + + + org.opendaylight.mdsal.model + ietf-inet-types-2013-07-15 + + + org.opendaylight.mdsal.model + ietf-yang-types-20130715 + + + diff --git a/restconf/models/ietf-yang-library/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/yang/library/rev160621/module/list/CommonLeafsRevisionBuilder.java b/restconf/models/ietf-yang-library/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/yang/library/rev160621/module/list/CommonLeafsRevisionBuilder.java new file mode 100644 index 0000000000..e0b6bfab93 --- /dev/null +++ b/restconf/models/ietf-yang-library/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/yang/library/rev160621/module/list/CommonLeafsRevisionBuilder.java @@ -0,0 +1,20 @@ +package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160621.module.list; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160621.module.list.CommonLeafs.Revision; + + +/** + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. + * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * + * The reason behind putting it under src/main/java is: + * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent + * loss of user code. + * + */ +public class CommonLeafsRevisionBuilder { + + public static Revision getDefaultInstance(final java.lang.String defaultValue) { + return new Revision(defaultValue); + } + +} diff --git a/restconf/models/ietf-yang-library/src/main/yang/ietf-yang-library@2016-06-21.yang b/restconf/models/ietf-yang-library/src/main/yang/ietf-yang-library@2016-06-21.yang new file mode 100644 index 0000000000..bc466ee09d --- /dev/null +++ b/restconf/models/ietf-yang-library/src/main/yang/ietf-yang-library@2016-06-21.yang @@ -0,0 +1,208 @@ +module ietf-yang-library { + namespace "urn:ietf:params:xml:ns:yang:ietf-yang-library"; + prefix "yanglib"; + import ietf-yang-types { + prefix yang; + } + import ietf-inet-types { + prefix inet; + } + organization + "IETF NETCONF (Network Configuration) Working Group"; + contact + "WG Web: + WG List: + WG Chair: Mehmet Ersue + + WG Chair: Mahesh Jethanandani + + Editor: Andy Bierman + + Editor: Martin Bjorklund + + Editor: Kent Watsen + "; + description + "This module contains monitoring information about the YANG + modules and submodules that are used within a YANG-based + server. + Copyright (c) 2016 IETF Trust and the persons identified as + authors of the code. All rights reserved. + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Simplified BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (http://trustee.ietf.org/license-info). + This version of this YANG module is part of RFC 7895; see + the RFC itself for full legal notices."; + revision 2016-06-21 { + description + "Initial revision."; + reference + "RFC 7895: YANG Module Library."; + } + /* + * Typedefs + */ + typedef revision-identifier { + type string { + pattern '\d{4}-\d{2}-\d{2}'; + } + description + "Represents a specific date in YYYY-MM-DD format."; + } + /* + * Groupings + */ + grouping module-list { + description + "The module data structure is represented as a grouping + so it can be reused in configuration or another monitoring + data structure."; + grouping common-leafs { + description + "Common parameters for YANG modules and submodules."; + leaf name { + type yang:yang-identifier; + description + "The YANG module or submodule name."; + } + leaf revision { + type union { + type revision-identifier; + type string { length 0; } + } + description + "The YANG module or submodule revision date. + A zero-length string is used if no revision statement + is present in the YANG module or submodule."; + } + } + grouping schema-leaf { + description + "Common schema leaf parameter for modules and submodules."; + leaf schema { + type inet:uri; + description + "Contains a URL that represents the YANG schema + resource for this module or submodule. + This leaf will only be present if there is a URL + available for retrieval of the schema for this entry."; + } + } + list module { + key "name revision"; + description + "Each entry represents one revision of one module + currently supported by the server."; + uses common-leafs; + uses schema-leaf; + leaf namespace { + type inet:uri; + mandatory true; + description + "The XML namespace identifier for this module."; + } + leaf-list feature { + type yang:yang-identifier; + description + "List of YANG feature names from this module that are + supported by the server, regardless of whether they are + defined in the module or any included submodule."; + } + list deviation { + key "name revision"; + description + "List of YANG deviation module names and revisions + used by this server to modify the conformance of + the module associated with this entry. Note that + the same module can be used for deviations for + multiple modules, so the same entry MAY appear + within multiple 'module' entries. + The deviation module MUST be present in the 'module' + list, with the same name and revision values. + The 'conformance-type' value will be 'implement' for + the deviation module."; + uses common-leafs; + } + leaf conformance-type { + type enumeration { + enum implement { + description + "Indicates that the server implements one or more + protocol-accessible objects defined in the YANG module + identified in this entry. This includes deviation + statements defined in the module. + For YANG version 1.1 modules, there is at most one + module entry with conformance type 'implement' for a + particular module name, since YANG 1.1 requires that, + at most, one revision of a module is implemented. + For YANG version 1 modules, there SHOULD NOT be more + than one module entry for a particular module name."; + } + enum import { + description + "Indicates that the server imports reusable definitions + from the specified revision of the module but does + not implement any protocol-accessible objects from + this revision. + Multiple module entries for the same module name MAY + exist. This can occur if multiple modules import the + same module but specify different revision dates in + the import statements."; + } + } + mandatory true; + description + "Indicates the type of conformance the server is claiming + for the YANG module identified by this entry."; + } + list submodule { + key "name revision"; + description + "Each entry represents one submodule within the + parent module."; + uses common-leafs; + uses schema-leaf; + } + } + } + /* + * Operational state data nodes + */ + container modules-state { + config false; + description + "Contains YANG module monitoring information."; + leaf module-set-id { + type string; + mandatory true; + description + "Contains a server-specific identifier representing + the current set of modules and submodules. The + server MUST change the value of this leaf if the + information represented by the 'module' list instances + has changed."; + } + uses module-list; + } + /* + * Notifications + */ + notification yang-library-change { + description + "Generated when the set of modules and submodules supported + by the server has changed."; + leaf module-set-id { + type leafref { + path "/yanglib:modules-state/yanglib:module-set-id"; + } + mandatory true; + description + "Contains the module-set-id value representing the + set of modules and submodules supported at the server at + the time the notification is generated."; + } + } +} diff --git a/restconf/models/pom.xml b/restconf/models/pom.xml new file mode 100644 index 0000000000..91534e0ca8 --- /dev/null +++ b/restconf/models/pom.xml @@ -0,0 +1,25 @@ + + + + 4.0.0 + + + org.opendaylight.netconf + restconf-parent + 1.5.0-SNAPSHOT + + + restconf-models + pom + ${project.artifactId} + + + ietf-yang-library + + diff --git a/restconf/pom.xml b/restconf/pom.xml index 8e335edf58..2c9957a7c7 100644 --- a/restconf/pom.xml +++ b/restconf/pom.xml @@ -32,6 +32,7 @@ sal-restconf-broker --> restconf-artifacts + models diff --git a/restconf/restconf-artifacts/pom.xml b/restconf/restconf-artifacts/pom.xml index aaf6ab54ea..1fe2c88155 100644 --- a/restconf/restconf-artifacts/pom.xml +++ b/restconf/restconf-artifacts/pom.xml @@ -26,6 +26,11 @@ + + ${project.groupId} + ietf-yang-library + ${project.version} + ${project.groupId} sal-rest-connector diff --git a/restconf/sal-rest-connector/pom.xml b/restconf/sal-rest-connector/pom.xml index bce2cbfe3b..0481ad923e 100644 --- a/restconf/sal-rest-connector/pom.xml +++ b/restconf/sal-rest-connector/pom.xml @@ -123,6 +123,11 @@ org.opendaylight.yangtools yang-model-export + + org.opendaylight.netconf + ietf-yang-library + ${project.version} + net.java.dev.stax-utils stax-utils -- 2.36.6