Move old ietf-restconf into odl-restconf-nb-bierman02 87/84087/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 30 Aug 2019 08:16:18 +0000 (10:16 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 30 Aug 2019 08:35:09 +0000 (10:35 +0200)
This model is only used by this single artifact, and hence it
needs to be co-located there.

Change-Id: I0c1c86e68a90e75bff2ffeba7b69035a9f04dc5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
features/restconf/odl-restconf-nb-bierman02/pom.xml
features/restconf/odl-restconf-nb-bierman02/src/main/feature/feature.xml [deleted file]
restconf/restconf-nb-bierman02/pom.xml
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/DatastoreIdentifierBuilder.java [new file with mode: 0644]
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleRevisionBuilder.java [new file with mode: 0644]
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java [new file with mode: 0644]
restconf/restconf-nb-bierman02/src/main/yang/ietf-restconf@2013-10-19.yang [new file with mode: 0644]
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/DatastoreIdentifierBuilderTest.java [new file with mode: 0644]
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleBuilderTest.java [new file with mode: 0644]
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleRevisionBuilderTest.java [new file with mode: 0644]
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilderTest.java [new file with mode: 0644]

index d00b3cad43b5d2ffc2e9e10638054da32870a647..fcb069797ded09f94d2c981a16ded7beeace7690 100644 (file)
     </dependencyManagement>
 
     <dependencies>
-        <dependency>
-            <groupId>org.opendaylight.mdsal.model</groupId>
-            <artifactId>odl-mdsal-model-draft-bierman-netconf-restconf-02</artifactId>
-            <type>xml</type>
-            <classifier>features</classifier>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.netconf</groupId>
             <artifactId>odl-restconf-common</artifactId>
diff --git a/features/restconf/odl-restconf-nb-bierman02/src/main/feature/feature.xml b/features/restconf/odl-restconf-nb-bierman02/src/main/feature/feature.xml
deleted file mode 100644 (file)
index e62eccf..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Copyright © 2019 PANTHEON.tech, s.r.o. and others.
-  ~
-  ~ This program and the accompanying materials are made available under the
-  ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
-  ~ and is available at http://www.eclipse.org/legal/epl-v10.html
-  -->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-netconf-${project.version}">
-    <feature name="odl-restconf-nb-bierman02" version="${project.version}">
-        <feature version="[2,3)">odl-mdsal-model-draft-bierman-netconf-restconf-02</feature>
-    </feature>
-</features>
index ca2bf38f37fb9d925c761ed45e45e28d1ad31364..6dfae739cc0ceb869f8dd12247fdaa1396b6212e 100644 (file)
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>yang-test-util</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.mdsal.model</groupId>
-      <artifactId>ietf-restconf</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
-      <artifactId>rfc6991</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>yang-model-export</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
+      <artifactId>rfc6991</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
       <artifactId>rfc7895</artifactId>
diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/DatastoreIdentifierBuilder.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/DatastoreIdentifierBuilder.java
new file mode 100644 (file)
index 0000000..42defe5
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.DatastoreIdentifier.Enumeration;
+
+
+/**
+ **/
+public class DatastoreIdentifierBuilder {
+
+    public static DatastoreIdentifier getDefaultInstance(final String defaultValue) {
+        return new DatastoreIdentifier(Enumeration.valueOf(defaultValue));
+    }
+
+}
diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleRevisionBuilder.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleRevisionBuilder.java
new file mode 100644 (file)
index 0000000..dfd0aeb
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules.Module.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 ModuleRevisionBuilder {
+
+    public static Revision getDefaultInstance(java.lang.String defaultValue) {
+        return RevisionBuilder.getDefaultInstance(defaultValue);
+    }
+
+}
diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilder.java
new file mode 100644 (file)
index 0000000..d09646a
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules;
+
+import java.util.regex.Pattern;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.RevisionIdentifier;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules.Module.Revision;
+
+/**
+**/
+public class RevisionBuilder {
+
+    /**
+     * Defines the pattern for revisions. NOTE: This pattern will likely be
+     * updated in future versions of the ietf and should be adjusted accordingly
+     */
+    private static final Pattern REVISION_PATTERN = Pattern.compile("\\d{4}-\\d{2}-\\d{2}");
+
+    public static Revision getDefaultInstance(String defaultValue) {
+
+        if (defaultValue != null) {
+            if (REVISION_PATTERN.matcher(defaultValue).matches()) {
+                RevisionIdentifier id = new RevisionIdentifier(defaultValue);
+                return new Revision(id);
+            }
+            if (defaultValue.isEmpty()) {
+                return new Revision(defaultValue);
+            }
+        }
+
+        throw new IllegalArgumentException("Cannot create Revision from " + defaultValue
+                + ". Default value does not match pattern " + REVISION_PATTERN.pattern()
+                + " or empty string.");
+    }
+
+}
diff --git a/restconf/restconf-nb-bierman02/src/main/yang/ietf-restconf@2013-10-19.yang b/restconf/restconf-nb-bierman02/src/main/yang/ietf-restconf@2013-10-19.yang
new file mode 100644 (file)
index 0000000..83bb378
--- /dev/null
@@ -0,0 +1,689 @@
+module ietf-restconf {
+  namespace "urn:ietf:params:xml:ns:yang:ietf-restconf";
+  prefix "restconf";
+
+  import ietf-yang-types { prefix yang; revision-date 2013-07-15; }
+  import ietf-inet-types { prefix inet; }
+
+  organization
+    "IETF NETCONF (Network Configuration) Working Group";
+
+  contact
+    "Editor:   Andy Bierman
+               <mailto:andy@yumaworks.com>
+
+     Editor:   Martin Bjorklund
+               <mailto:mbj@tail-f.com>
+
+     Editor:   Kent Watsen
+               <mailto:kwatsen@juniper.net>
+
+     Editor:   Rex Fernando
+               <mailto:rex@cisco.com>";
+
+  description
+    "This module contains conceptual YANG specifications
+     for the YANG Patch and error content that is used in
+     RESTCONF protocol messages. A conceptual container
+     representing the RESTCONF API nodes (media type 
+     application/yang.api).
+
+     Note that the YANG definitions within this module do not
+     represent configuration data of any kind.
+     The YANG grouping statements provide a normative syntax
+     for XML and JSON message encoding purposes.
+
+     Copyright (c) 2013 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 XXXX; see
+     the RFC itself for full legal notices.";
+
+  // RFC Ed.: replace XXXX with actual RFC number and remove this
+  // note.
+
+  // RFC Ed.: remove this note
+  // Note: extracted from draft-bierman-netconf-restconf-02.txt
+
+  // RFC Ed.: update the date below with the date of RFC publication
+  // and remove this note.
+  revision 2013-10-19 {
+    description
+      "Initial revision.";
+    reference
+      "RFC XXXX: RESTCONF Protocol.";
+  }
+
+  typedef data-resource-identifier {
+    type string {
+      length "1 .. max";
+    }
+    description
+      "Contains a Data Resource Identifier formatted string
+       to identify a specific data node. The data node that
+       uses this data type SHOULD define the document root
+       for data resource identifiers.  The default document
+       root is the target datastore conceptual root node.
+       Data resource identifiers are defined relative to
+       this document root.";
+    reference
+      "RFC XXXX: [sec. 5.3.1.1 ABNF For Data Resource Identifiers]";
+  }
+
+  // this typedef is TBD; not currently used
+  typedef datastore-identifier {
+    type union {
+      type enumeration {
+        enum candidate {
+          description
+            "Identifies the NETCONF shared candidate datastore.";
+          reference
+            "RFC 6241, section 8.3";
+        }
+        enum running {
+          description
+            "Identifies the NETCONF running datastore.";
+          reference
+            "RFC 6241, section 5.1";
+        }
+        enum startup {
+          description
+            "Identifies the NETCONF startup datastore.";
+          reference
+            "RFC 6241, section 8.7";
+        }
+      }
+      type string;
+    }
+    description
+      "Contains a string to identify a specific datastore.
+       The enumerated datastore identifier values are
+       reserved for standard datastore names.";
+  }
+
+  typedef revision-identifier {
+    type string {
+      pattern '\d{4}-\d{2}-\d{2}';
+    }
+    description
+      "Represents a specific date in YYYY-MM-DD format.
+       TBD: make pattern more precise to exclude leading zeros.";
+  }
+
+  grouping yang-patch {
+
+    description
+      "A grouping that contains a YANG container
+       representing the syntax and semantics of a
+       YANG Patch edit request message.";
+
+    container yang-patch {
+      description
+        "Represents a conceptual sequence of datastore edits,
+         called a patch. Each patch is given a client-assigned
+         patch identifier. Each edit MUST be applied
+         in ascending order, and all edits MUST be applied.
+         If any errors occur, then the target datastore MUST NOT
+         be changed by the patch operation.
+  
+         A patch MUST be validated by the server to be a 
+         well-formed message before any of the patch edits
+         are validated or attempted.
+  
+         YANG datastore validation (defined in RFC 6020, section
+         8.3.3) is performed after all edits have been
+         individually validated.
+  
+         It is possible for a datastore constraint violation to occur
+         due to any node in the datastore, including nodes not
+         included in the edit list. Any validation errors MUST
+         be reported in the reply message.";
+  
+      reference
+        "RFC 6020, section 8.3.";
+  
+      leaf patch-id {
+        type string;
+        description
+          "An arbitrary string provided by the client to identify
+           the entire patch.  This value SHOULD be present in any
+           audit logging records generated by the server for the
+           patch. Error messages returned by the server pertaining
+           to this patch will be identified by this patch-id value.";
+      }
+
+      leaf comment {
+        type string {
+          length "0 .. 1024";
+        }
+        description
+          "An arbitrary string provided by the client to describe
+           the entire patch.  This value SHOULD be present in any
+           audit logging records generated by the server for the
+           patch.";
+      }
+  
+      list edit {
+        key edit-id;
+        ordered-by user;
+
+        description
+          "Represents one edit within the YANG Patch
+           request message.";
+
+        leaf edit-id {
+          type string;
+          description
+            "Arbitrary string index for the edit.
+             Error messages returned by the server pertaining
+             to a specific edit will be identified by this
+             value.";
+        }
+  
+        leaf operation {
+          type enumeration {
+            enum create {
+              description
+                "The target data node is created using the
+                 supplied value, only if it does not already
+                 exist.";
+            }
+            enum delete {
+              description
+                "Delete the target node, only if the data resource
+                 currently exists, otherwise return an error.";
+            }
+            enum insert {
+              description
+                "Insert the supplied value into a user-ordered
+                 list or leaf-list entry. The target node must
+                 represent a new data resource.";
+            }
+            enum merge {
+              description
+                "The supplied value is merged with the target data
+                 node.";
+            }
+            enum move {
+              description
+                "Move the target node. Reorder a user-ordered
+                 list or leaf-list. The target node must represent
+                 an existing data resource.";
+            }
+            enum replace {
+              description
+                "The supplied value is used to replace the target
+                 data node.";
+            }
+            enum remove {
+              description
+                "Delete the target node if it currently exists.";
+            }
+          }
+          mandatory true;
+          description
+            "The datastore operation requested for the associated
+             edit entry";
+        }
+  
+        leaf target {
+          type data-resource-identifier;
+          mandatory true;
+          description
+            "Identifies the target data resource for the edit
+             operation.";
+        }
+  
+        leaf point {
+          when "(../operation = 'insert' or " +
+            "../operation = 'move') and " +
+            "(../where = 'before' or ../where = 'after')" {
+            description
+              "Point leaf only applies for insert or move
+               operations, before or after an existing entry.";
+          }
+          type data-resource-identifier;
+          description
+            "The absolute URL path for the data node that is being
+             used as the insertion point or move point for the
+             target of this edit entry.";
+        }
+  
+        leaf where {
+          when "../operation = 'insert' or ../operation = 'move'" {
+            description
+              "Where leaf only applies for insert or move
+               operations.";
+          }
+          type enumeration {
+            enum before {
+              description
+                "Insert or move a data node before the data resource
+                 identified by the 'point' parameter.";
+            }
+            enum after {
+              description
+                "Insert or move a data node after the data resource
+                 identified by the 'point' parameter.";
+            }
+            enum first {
+              description
+                "Insert or move a data node so it becomes ordered
+                 as the first entry.";
+            }
+            enum last {
+              description
+                "Insert or move a data node so it becomes ordered
+                 as the last entry.";
+            }
+  
+          }
+          default last;
+          description
+            "Identifies where a data resource will be inserted or
+             moved. YANG only allows these operations for
+             list and leaf-list data nodes that are ordered-by
+             user.";
+        }
+  
+        anyxml value {
+          when "(../operation = 'create' or " +
+            "../operation = 'merge' " +
+            "or ../operation = 'replace' or " +
+            "../operation = 'insert')" {
+            description
+              "Value node only used for create, merge,
+               replace, and insert operations";
+          }
+          description
+            "Value used for this edit operation.";
+        }
+      }
+    }
+
+  } // grouping yang-patch
+
+
+  grouping yang-patch-status {
+
+    description
+      "A grouping that contains a YANG container
+       representing the syntax and semantics of
+       YANG Patch status response message.";
+    
+    container yang-patch-status {
+      description
+        "A container representing the response message
+         sent by the server after a YANG Patch edit
+         request message has been processed.";
+
+      leaf patch-id {
+        type string;
+        description
+          "The patch-id value used in the request";
+      }
+
+      choice global-status {
+        description
+          "Report global errors or complete success.
+           If there is no case selected then errors
+           are reported in the edit-status container.";
+
+        case global-errors {
+          uses errors;
+          description
+            "This container will be present if global
+             errors unrelated to a specific edit occurred.";
+        }
+        leaf ok {
+          type empty;
+          description
+            "This leaf will be present if the request succeeded
+             and there are no errors reported in the edit-status
+             container.";
+        }
+      }
+
+      container edit-status {
+        description
+          "This container will be present if there are
+           edit-specific status responses to report.";
+      
+        list edit {
+          key edit-id;
+
+          description
+            "Represents a list of status responses,
+             corresponding to edits in the YANG Patch
+             request message.  If an edit entry was
+             skipped or not reached by the server,
+             then this list will not contain a corresponding
+             entry for that edit.";
+
+          leaf edit-id {
+            type string;
+             description
+               "Response status is for the edit list entry
+                with this edit-id value.";
+          }
+          choice edit-status-choice {
+            description
+              "A choice between different types of status
+               responses for each edit entry.";
+            leaf ok {
+              type empty;
+              description
+                "This edit entry was invoked without any
+                 errors detected by the server associated
+                 with this edit.";
+            }
+            leaf location {
+              type inet:uri;
+              description
+                "Contains the Location header value that would be
+                 returned if this edit causes a new resource to be
+                 created. If the edit identified by the same edit-id
+                 value was successfully invoked and a new resource
+                 was created, then this field will be returned
+                 instead of 'ok'.";
+            }
+            case errors {
+              uses errors;
+              description
+                "The server detected errors associated with the
+                  edit identified by the same edit-id value.";
+            }
+          }
+        }
+      }
+    }
+  }  // grouping yang-patch-status
+
+
+  grouping errors {
+
+    description
+      "A grouping that contains a YANG container
+       representing the syntax and semantics of a
+       YANG Patch errors report within a response message.";
+
+    container errors {
+      config false;  // needed so list error does not need a key
+      description
+        "Represents an error report returned by the server if
+         a request results in an error.";
+  
+      list error {
+        description
+          "An entry containing information about one
+           specific error that occurred while processing
+           a RESTCONF request.";
+        reference "RFC 6241, Section 4.3";
+  
+        leaf error-type { 
+          type enumeration {
+            enum transport {
+              description "The transport layer";
+            }
+            enum rpc {
+              description "The rpc or notification layer";
+            }
+            enum protocol {
+              description "The protocol operation layer";
+            }
+            enum application {
+              description "The server application layer";
+            }
+          }
+          mandatory true;
+          description
+            "The protocol layer where the error occurred.";
+        }
+  
+        leaf error-tag {
+          type string;
+          mandatory true;
+          description
+            "The enumerated error tag.";
+        }
+  
+        leaf error-app-tag { 
+          type string;
+          description
+            "The application-specific error tag.";
+        }
+  
+        leaf error-path { 
+          type data-resource-identifier;
+          description
+            "The target data resource identifier associated
+             with the error, if any.";
+        }
+  
+        leaf error-message { 
+          type string;
+          description
+            "A message describing the error.";
+        }
+  
+        container error-info { 
+           description
+             "A container allowing additional information
+              to be included in the error report.";
+           // arbitrary anyxml content here
+        }
+      }
+    }
+  } // grouping errors
+
+
+  grouping restconf {
+
+    description
+      "A grouping that contains a YANG container
+       representing the syntax and semantics of
+       the RESTCONF API resource.";
+
+    container restconf {
+      description
+        "Conceptual container representing the
+         application/yang.api resource type.";
+  
+      container config {
+        description
+          "Container representing the application/yang.datastore
+           resource type. Represents the conceptual root of the
+           unified configuration datastore containing YANG data
+           nodes. The child nodes of this container are
+           configuration data resources (application/yang.data)
+           defined as top-level YANG data nodes from the modules
+           advertised by the server in /restconf/modules.";
+      }
+
+      container operational {
+        description
+          "Container representing the application/yang.datastore
+           resource type. Represents the conceptual root of the
+           operational data supported by the server.  The child
+           nodes of this container are operational data resources 
+           (application/yang.data) defined as top-level
+           YANG data nodes from the modules advertised by
+           the server in /restconf/modules.";
+      }
+
+      container modules {
+        description
+          "Contains a list of module description entries.
+           These modules are currently loaded into the server.";
+  
+        list module {
+          key "name revision";
+          description
+            "Each entry represents one module currently
+             supported by the server.";
+
+          leaf name {
+            type yang:yang-identifier;
+            description "The YANG module name.";
+          }
+          leaf revision {
+            type union {
+              type revision-identifier;
+              type string { length 0; }
+            }
+            description
+              "The YANG module revision date. An empty string is
+               used if no revision statement is present in the
+               YANG module.";
+          }
+          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.";
+          }
+          leaf-list deviation {
+            type yang:yang-identifier;
+            description
+              "List of YANG deviation module names used by this
+               server to modify the conformance of the module
+               associated with this entry.";
+          }
+        }
+      }
+
+      container operations {
+        description
+          "Container for all operation resources
+           (application/yang.operation),
+
+           Each resource is represented as an empty leaf with the
+           name of the RPC operation from the YANG rpc statement.
+  
+           E.g.;
+  
+              POST /restconf/operations/show-log-errors
+  
+              leaf show-log-errors {
+                type empty;
+              }
+          ";
+      }
+
+      container streams {
+        description
+          "Container representing the notification event streams
+           supported by the server.";
+         reference
+           "RFC 5277, Section 3.4, <streams> element.";
+
+        list stream {
+          key name;
+          description
+            "Each entry describes an event stream supported by
+             the server.";
+
+          leaf name {
+            type string;
+            description "The stream name";
+            reference "RFC 5277, Section 3.4, <name> element.";
+          }
+
+          leaf description {
+            type string;
+            description "Description of stream content";
+            reference
+              "RFC 5277, Section 3.4, <description> element.";
+          }
+
+          leaf replay-support {
+            type boolean;
+            description
+              "Indicates if replay buffer supported for this stream";
+            reference
+              "RFC 5277, Section 3.4, <replaySupport> element.";
+          }
+
+          leaf replay-log-creation-time {
+            type yang:date-and-time;
+            description
+              "Indicates the time the replay log for this stream
+               was created.";
+            reference
+              "RFC 5277, Section 3.4, <replayLogCreationTime>
+               element.";
+          }
+
+          leaf events {
+            type empty;
+            description
+              "Represents the entry point for establishing
+               notification delivery via server sent events.";
+          }
+        }
+      }
+
+      leaf version {
+        type enumeration {
+          enum "1.0" {
+            description 
+              "Version 1.0 of the RESTCONF protocol.";
+          }
+        }
+        config false;
+        description
+          "Contains the RESTCONF protocol version.";
+      }
+    }
+  }  // grouping restconf
+
+
+  grouping notification {
+    description
+      "Contains the notification message wrapper definition.";
+
+    container notification {
+      description
+        "RESTCONF notification message wrapper.";
+
+      leaf event-time {
+        type yang:date-and-time;
+        mandatory true;
+        description
+          "The time the event was generated by the
+           event source.";
+        reference
+          "RFC 5277, section 4, <eventTime> element.";
+      }
+
+      /* The YANG-specific notification container is encoded
+       * after the 'event-time' element.  The format
+       * corresponds to the notificationContent element
+       * in RFC 5277, section 4. For example:
+       *
+       *  module example-one {
+       *     ...
+       *     notification event1 { ... }
+       *
+       *  }
+       *
+       *  Encoded as element 'event1' in the namespace
+       *  for module 'example-one'.
+       */
+    }
+  }  // grouping notification
+
+}
\ No newline at end of file
diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/DatastoreIdentifierBuilderTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/DatastoreIdentifierBuilderTest.java
new file mode 100644 (file)
index 0000000..f3ab6f9
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class DatastoreIdentifierBuilderTest {
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testDatastoreIdentifierBuilder() {
+        final DatastoreIdentifierBuilder datastoreIdentifierBuilder = new DatastoreIdentifierBuilder();
+        assertNotNull(datastoreIdentifierBuilder);
+        DatastoreIdentifierBuilder.getDefaultInstance("");
+    }
+}
\ No newline at end of file
diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleBuilderTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleBuilderTest.java
new file mode 100644 (file)
index 0000000..416fe35
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules;
+
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.RevisionIdentifier;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.YangIdentifier;
+
+public class ModuleBuilderTest {
+
+    @Test
+    public void testModuleBuilder() {
+        final ModuleBuilder moduleBuilder = new ModuleBuilder();
+        final Module.Revision revision = new Module.Revision(new RevisionIdentifier("2016-10-11"));
+        final YangIdentifier yangIdentifierOne = new YangIdentifier("YangIdentifier1");
+        final YangIdentifier yangIdentifierTwo = new YangIdentifier("YangIdentifier2");
+        final Uri namespace = new Uri("namespace");
+        final List<YangIdentifier> yangIdentifierList = ImmutableList.of(yangIdentifierOne, yangIdentifierTwo);
+        final ModuleKey moduleKeyOne = new ModuleKey(yangIdentifierOne, revision);
+        final ModuleKey moduleKeyTwo = new ModuleKey(moduleKeyOne);
+        moduleBuilder.setRevision(revision);
+        moduleBuilder.setDeviation(yangIdentifierList);
+        moduleBuilder.setFeature(yangIdentifierList);
+        moduleBuilder.setName(yangIdentifierOne);
+        moduleBuilder.setNamespace(namespace);
+        moduleBuilder.withKey(moduleKeyOne);
+        final Module moduleOne = moduleBuilder.build();
+        final Module moduleTwo = new ModuleBuilder(moduleOne).build();
+
+        assertNotNull(moduleBuilder);
+        assertNotNull(revision);
+        assertNotNull(yangIdentifierOne);
+        assertNotNull(yangIdentifierTwo);
+        assertNotNull(namespace);
+        assertNotNull(yangIdentifierList);
+        assertNotNull(moduleKeyOne);
+        assertNotNull(moduleKeyOne.hashCode());
+        assertNotNull(moduleKeyOne.toString());
+        assertNotNull(moduleBuilder.toString());
+        assertNotNull(moduleBuilder.hashCode());
+
+        assertEquals(moduleKeyOne, moduleKeyTwo);
+        assertEquals(revision, moduleKeyOne.getRevision());
+        assertEquals(yangIdentifierOne, moduleKeyOne.getName());
+        assertEquals(revision, moduleBuilder.getRevision());
+        assertEquals(yangIdentifierList, moduleBuilder.getDeviation());
+        assertEquals(yangIdentifierList, moduleBuilder.getFeature());
+        assertEquals(yangIdentifierOne, moduleBuilder.getName());
+        assertEquals(namespace, moduleBuilder.getNamespace());
+        assertEquals(moduleKeyOne, moduleBuilder.key());
+        assertEquals(moduleOne.toString(), moduleTwo.toString());
+        assertEquals(moduleKeyOne.toString(), moduleKeyTwo.toString());
+
+        assertTrue(moduleOne.equals(moduleTwo));
+        assertTrue(moduleKeyOne.equals(moduleKeyTwo));
+    }
+}
diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleRevisionBuilderTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/ModuleRevisionBuilderTest.java
new file mode 100644 (file)
index 0000000..578d2dd
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules.Module.Revision;
+
+public class ModuleRevisionBuilderTest {
+
+    @Test
+    public void testModuleRevisionBuilder() {
+        final ModuleRevisionBuilder moduleRevisionBuilder = new ModuleRevisionBuilder();
+        assertNotNull(moduleRevisionBuilder);
+        final Revision revision = ModuleRevisionBuilder.getDefaultInstance("");
+        assertNotNull(revision);
+        assertEquals("", revision.getString());
+        assertEquals(null, revision.getRevisionIdentifier());
+    }
+}
\ No newline at end of file
diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilderTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/restconf/rev131019/restconf/restconf/modules/RevisionBuilderTest.java
new file mode 100644 (file)
index 0000000..1568b0c
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.RevisionIdentifier;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules.Module.Revision;
+
+public class RevisionBuilderTest {
+
+    @Test
+    public void testEmptyString() {
+        final RevisionBuilder revisionBuilder = new RevisionBuilder();
+        assertNotNull(revisionBuilder);
+        final Revision revision = RevisionBuilder.getDefaultInstance("");
+        validate(revision, "", null);
+    }
+
+    @Test
+    public void testValidDataString() {
+        final String dateString = "2014-04-23";
+        final Revision revision = RevisionBuilder.getDefaultInstance(dateString);
+        validate(revision, null, new RevisionIdentifier(dateString));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testNullString() {
+        RevisionBuilder.getDefaultInstance(null);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testBadFormatString() {
+        RevisionBuilder.getDefaultInstance("badFormat");
+    }
+
+    private void validate(final Revision revisionUnderTest, final String expectedRevisionString,
+            final RevisionIdentifier expectedRevisionIdentifier) {
+        assertNotNull(revisionUnderTest);
+        assertEquals(expectedRevisionString, revisionUnderTest.getString());
+        assertEquals(expectedRevisionIdentifier, revisionUnderTest.getRevisionIdentifier());
+    }
+}
\ No newline at end of file