Merge "Added support for resolving augmentations."
authorGiovanni Meo <gmeo@cisco.com>
Wed, 22 May 2013 10:41:27 +0000 (10:41 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 22 May 2013 10:41:27 +0000 (10:41 +0000)
16 files changed:
opendaylight/distribution/opendaylight/pom.xml
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/AugmentationSchemaBuilderImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/test/java/org/opendaylight/controller/yang/parser/impl/YangParserTest.java
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/Deviation.java
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/FeatureDefinition.java
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/GroupingDefinition.java
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/IdentitySchemaNode.java
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/KeyDefinition.java [deleted file]
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/LeafListSchemaNode.java
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/LeafSchemaNode.java
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/ListSchemaNode.java
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/ModuleImport.java
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/NotificationDefinition.java
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/RpcDefinition.java
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/Status.java
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/UsesNode.java

index 3ebd4c80aae4b46f87a30178141a8525d930a681..f9cddd45f9c605128f8b26a66f4e016ba087a7ef 100644 (file)
@@ -7,8 +7,8 @@
   </prerequisites>
 
   <scm>
-    <connection>scm:svn:https://wwwin-svn-sjc.cisco.com/eng/csdncontroller/trunk/</connection>
-    <developerConnection>scm:svn:https://wwwin-svn-sjc.cisco.com/eng/csdncontroller/trunk/</developerConnection>
+    <connection>scm:git:https://git.opendaylight.org/gerrit/p/controller.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
   </scm>
   <parent>
     <groupId>org.opendaylight.controller</groupId>
index 29c38dfa0e727eaaba4c61adf7320f8893bb90c8..605ca6dcf4509ade3a24cbe7c61aed43a362445a 100644 (file)
@@ -350,6 +350,8 @@ public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder
                     + ((targetPath == null) ? 0 : targetPath.hashCode());
             result = prime * result
                     + ((whenCondition == null) ? 0 : whenCondition.hashCode());
+            result = prime * result
+                    + ((childNodes == null) ? 0 : childNodes.hashCode());
             return result;
         }
 
@@ -379,6 +381,13 @@ public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder
             } else if (!whenCondition.equals(other.whenCondition)) {
                 return false;
             }
+            if (childNodes == null) {
+                if (other.childNodes != null) {
+                    return false;
+                }
+            } else if (!childNodes.equals(other.childNodes)) {
+                return false;
+            }
             return true;
         }
 
index f6240c9a3f9f2d203711a6e4d3f25053367614d8..9cbf5b9719f68a7d20956442f77221b29d563f49 100644 (file)
@@ -248,10 +248,7 @@ public class YangParserTest {
 
         // check
         assertEquals(augmentedContainer, augmentedContainerDefinition);
-        assertEquals(augmentedContainerAugments.iterator().next(), augment1);
-
         assertEquals(augmentedLeaf, augmentedLeafDefinition);
-        assertEquals(ifEntryAugments.iterator().next(), augment3);
     }
 
     @Test
index b3b2c06caa03502c904351d27e1d90a9b4d1e1fa..8745dda8ba63112c4e221a17e8aa8260b796c94d 100644 (file)
@@ -7,16 +7,40 @@
  */\r
 package org.opendaylight.controller.yang.model.api;\r
 \r
+/**\r
+ * Interface describing YANG 'deviation' statement.\r
+ * <p>\r
+ * The 'deviation' statement defines a hierarchy of a module that the device\r
+ * does not implement faithfully. Deviations define the way a device deviate\r
+ * from a standard.\r
+ * </p>\r
+ */\r
 public interface Deviation {\r
 \r
+    /**\r
+     * Enum describing YANG deviation 'deviate' statement. It defines how the\r
+     * device's implementation of the target node deviates from its original\r
+     * definition.\r
+     */\r
     enum Deviate {\r
         NOT_SUPPORTED, ADD, REPLACE, DELETE\r
     }\r
 \r
+    /**\r
+     * @return SchemaPath that identifies the node in the schema tree where a\r
+     *         deviation from the module occurs.\r
+     */\r
     SchemaPath getTargetPath();\r
 \r
+    /**\r
+     * @return deviate statement of this deviation\r
+     */\r
     Deviate getDeviate();\r
 \r
+    /**\r
+     * @return textual cross-reference to an external document that provides\r
+     *         additional information relevant to this node.\r
+     */\r
     String getReference();\r
 \r
 }\r
index efd0e18d1877da9fc310d6ae5bd1c8b390f191e7..a6d6331aae75b259108ee8f00f1bff66083268c5 100644 (file)
@@ -7,6 +7,14 @@
  */\r
 package org.opendaylight.controller.yang.model.api;\r
 \r
+/**\r
+ * Interface describing YANG 'feature' statement.\r
+ * <p>\r
+ * The feature statement is used to define a mechanism by which portions of the\r
+ * schema are marked as conditional. A feature name can later be referenced\r
+ * using the 'if-feature' statement.\r
+ * </p>\r
+ */\r
 public interface FeatureDefinition extends SchemaNode {\r
 \r
 }\r
index 5e94f3b5be6b24aa5bb9b9bda056f9da0014f4e3..1c8398b86c23bd86f46e4446157f1fff89660f67 100644 (file)
@@ -7,10 +7,14 @@
  */\r
 package org.opendaylight.controller.yang.model.api;\r
 \r
-import java.util.Set;\r
-\r
+/**\r
+ * Interface describing YANG 'grouping' statement.\r
+ * <p>\r
+ * It is used to define a reusable block of nodes, which may be used locally in\r
+ * the module, in modules that include it, and by other modules that import from\r
+ * it.\r
+ * </p>\r
+ */\r
 public interface GroupingDefinition extends DataNodeContainer, SchemaNode {\r
 \r
-    Set<UsesNode> getUses();\r
-\r
 }\r
index d1e68182c37f6a06abcc929b0661637cca1b6d98..7e08238c04888d1d38c966f74620a95548bfb2c9 100644 (file)
@@ -1,14 +1,27 @@
 /*\r
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
 *\r
 * This program and the accompanying materials are made available under the\r
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
 * and is available at http://www.eclipse.org/legal/epl-v10.html\r
 */\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
 package org.opendaylight.controller.yang.model.api;\r
 \r
+/**\r
+ * Interface describing YANG 'identity' statement.\r
+ * <p>\r
+ * The 'identity' statement is used to define a new globally unique, abstract,\r
+ * and untyped identity. Its only purpose is to denote its name, semantics, and\r
+ * existence. The built-in datatype "identityref" can be used to reference\r
+ * identities within a data model.\r
+ * </p>\r
+ */\r
 public interface IdentitySchemaNode extends SchemaNode {\r
 \r
+    /**\r
+     * @return an existing identity, from which the new identity is derived or\r
+     *         null, if the identity is defined from scratch.\r
+     */\r
     IdentitySchemaNode getBaseIdentity();\r
 \r
 }\r
diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/KeyDefinition.java b/opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/KeyDefinition.java
deleted file mode 100644 (file)
index 5e8b2c7..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.yang.model.api;\r
-\r
-public interface KeyDefinition extends SchemaNode {\r
-\r
-    TypeDefinition<? extends TypeDefinition<?>> getType();\r
-\r
-}\r
index 1d7287f0f7333ad8f6cdf2eed15ea0cbf27f99c2..8780322e52fa691fc34919fff44fcfbd52a36407 100644 (file)
@@ -7,10 +7,20 @@
  */\r
 package org.opendaylight.controller.yang.model.api;\r
 \r
+/**\r
+ * Interface describing YANG 'leaf-list' statement.\r
+ */\r
 public interface LeafListSchemaNode extends DataSchemaNode {\r
 \r
     TypeDefinition<? extends TypeDefinition<?>> getType();\r
 \r
+    /**\r
+     * YANG 'ordered-by' statement. It defines whether the order of entries\r
+     * within this leaf-list are determined by the user or the system. If not\r
+     * present, default is false.\r
+     *\r
+     * @return true if ordered-by argument is "user", false otherwise\r
+     */\r
     boolean isUserOrdered();\r
 \r
 }\r
index 3ad047f3b96e345cf3b9cd12af0db8edb2fbd613..9325cb8f0cfcc2c281531cb3cdd8543a6b98b27a 100644 (file)
@@ -7,8 +7,17 @@
  */\r
 package org.opendaylight.controller.yang.model.api;\r
 \r
+/**\r
+ * Interface describing YANG 'leaf' statement.\r
+ * <p>\r
+ * The 'leaf' statement is used to define a leaf node in the schema tree.\r
+ * </p>\r
+ */\r
 public interface LeafSchemaNode extends DataSchemaNode {\r
 \r
+    /**\r
+     * @return type of this leaf\r
+     */\r
     TypeDefinition<?> getType();\r
 \r
 }\r
index 824afb76e8fe217e584c63bdaae0d4fd8cf5c2b9..3a812bd35e537cf32777b01a4c82949c61753da7 100644 (file)
@@ -11,11 +11,29 @@ import java.util.List;
 \r
 import org.opendaylight.controller.yang.common.QName;\r
 \r
+/**\r
+ * Interface describing YANG 'list' statement.\r
+ * <p>\r
+ * The 'list' statement is used to define an interior data node in the schema\r
+ * tree. A list entry is uniquely identified by the values of the list's keys,\r
+ * if defined.\r
+ * </p>\r
+ */\r
 public interface ListSchemaNode extends DataNodeContainer, AugmentationTarget,\r
         DataSchemaNode {\r
 \r
+    /**\r
+     * @return List of QNames of leaf identifiers of this list\r
+     */\r
     public List<QName> getKeyDefinition();\r
 \r
+    /**\r
+     * YANG 'ordered-by' statement. It defines whether the order of entries\r
+     * within a list are determined by the user or the system. If not present,\r
+     * default is false.\r
+     *\r
+     * @return true if ordered-by argument is "user", false otherwise\r
+     */\r
     boolean isUserOrdered();\r
 \r
 }\r
index 37237dd057d8c112fb4eae6a4b76661d76cf2353..431479858914755b1c3a347bf31f8f79b7ae4415 100644 (file)
@@ -9,11 +9,28 @@ package org.opendaylight.controller.yang.model.api;
 \r
 import java.util.Date;\r
 \r
+/**\r
+ * Interface describing YANG 'import' statement.\r
+ * <p>\r
+ * The import statement makes definitions from one module available inside\r
+ * another module or submodule.\r
+ * </p>\r
+ */\r
 public interface ModuleImport {\r
 \r
+    /**\r
+     * @return Name of the module to import\r
+     */\r
     String getModuleName();\r
 \r
+    /**\r
+     * @return Revision of module to import\r
+     */\r
     Date getRevision();\r
 \r
+    /**\r
+     * @return Prefix used to point to imported module\r
+     */\r
     String getPrefix();\r
+\r
 }\r
index 4e805f0fa6bfa488d3d50841b5e559e5f586eb34..8e7686cf3b72d0554d92a5547fef99d518498557 100644 (file)
@@ -7,5 +7,10 @@
  */\r
 package org.opendaylight.controller.yang.model.api;\r
 \r
+/**\r
+ * Interface describing YANG 'notification' statement. The\r
+ * notification statement is used to define a NETCONF notification.\r
+ */\r
 public interface NotificationDefinition extends SchemaNode, DataNodeContainer {\r
+\r
 }\r
index a4c784e0cd7e096eba33b1266333d868c25ecf70..5ce453dd38887c092c2ee369b238de4aa243df9b 100644 (file)
@@ -9,13 +9,36 @@ package org.opendaylight.controller.yang.model.api;
 \r
 import java.util.Set;\r
 \r
+/**\r
+ * Interface describing YANG 'rpc' statement.\r
+ * <p>\r
+ * The rpc statement defines an rpc node in the schema tree. Under the rpc node,\r
+ * a schema node with the name 'input', and a schema node with the name 'output'\r
+ * are also defined.\r
+ * </p>\r
+ */\r
 public interface RpcDefinition extends SchemaNode {\r
 \r
+    /**\r
+     * @return Set of type definitions declared under this rpc statement.\r
+     */\r
     Set<TypeDefinition<?>> getTypeDefinitions();\r
 \r
+    /**\r
+     * @return Set of grouping statements declared under this rpc statement.\r
+     */\r
     Set<GroupingDefinition> getGroupings();\r
 \r
+    /**\r
+     * @return Definition of input parameters to the RPC operation. The\r
+     *         substatements of input define nodes under the RPC's input node.\r
+     */\r
     ContainerSchemaNode getInput();\r
 \r
+    /**\r
+     * @return Definition of output parameters to the RPC operation. The\r
+     *         substatements of output define nodes under the RPC's output node.\r
+     */\r
     ContainerSchemaNode getOutput();\r
+\r
 }\r
index 9a49d79d323a686d05e91a037c56c68c861e927b..39aa0c847283a5ba6f628b1a3f23d3a64ab71720 100644 (file)
@@ -7,6 +7,28 @@
  */\r
 package org.opendaylight.controller.yang.model.api;\r
 \r
+/**\r
+ * Enum describing YANG 'status' statement. If no status is specified, the\r
+ * default is CURRENT.\r
+ */\r
 public enum Status {\r
-    CURRENT, DEPRECATED, OBSOLETE\r
+\r
+    /**\r
+     * CURRENT means that the definition is current and valid.\r
+     */\r
+    CURRENT,\r
+\r
+    /**\r
+     * DEPRECATED indicates an obsolete definition, but it permits new/\r
+     * continued implementation in order to foster interoperability with\r
+     * older/existing implementations.\r
+     */\r
+    DEPRECATED,\r
+\r
+    /**\r
+     * OBSOLETE means the definition is obsolete and SHOULD NOT be implemented\r
+     * and/or can be removed from implementations.\r
+     */\r
+    OBSOLETE\r
+\r
 }\r
index 91fde5bd5c9bc17f1229a7405410500af1125aaa..e76f5e81318120f0af134446b1982ef3e1eef226 100644 (file)
@@ -12,11 +12,31 @@ import java.util.Set;
 \r
 public interface UsesNode {\r
 \r
+    /**\r
+     * @return path to 'grouping' on which this 'uses' statement points\r
+     */\r
     SchemaPath getGroupingPath();\r
-    \r
+\r
+    /**\r
+     * @return Set of augment statements defined under this uses node\r
+     */\r
     Set<AugmentationSchema> getAugmentations();\r
-    \r
+\r
+    /**\r
+     * Returns <code>true</code> if the data node was added by augmentation,\r
+     * otherwise returns <code>false</code>\r
+     *\r
+     * @return <code>true</code> if the data node was added by augmentation,\r
+     *         otherwise returns <code>false</code>\r
+     */\r
     boolean isAugmenting();\r
-    \r
+\r
+    /**\r
+     * Some of the properties of each node in the grouping can be refined with\r
+     * the "refine" statement.\r
+     *\r
+     * @return Map, where key is schema path of refined node and value is\r
+     *         refined node\r
+     */\r
     Map<SchemaPath, SchemaNode> getRefines();\r
 }\r