Merge "Added codec utilities for w3c.Document format."
authorTony Tkacik <ttkacik@cisco.com>
Mon, 6 Jan 2014 19:51:21 +0000 (19:51 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 6 Jan 2014 19:51:21 +0000 (19:51 +0000)
code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/BindingGeneratorImpl.xtend
code-generator/maven-sal-api-gen-plugin/src/main/java/org/opendaylight/yangtools/yang/unified/doc/generator/GeneratorImpl.xtend
model/ietf/ietf-inet-types/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev100924/HostBuilder.java
model/ietf/ietf-ted/src/main/yang/ted@2013-10-21.yang
model/ietf/ietf-topology-l3-unicast-igp/src/main/yang/l3-unicast-igp-topology@2013-10-21.yang
model/ietf/ietf-topology-ospf/src/main/yang/ospf-topology@2013-10-21.yang [moved from model/ietf/ietf-topology-ospf/src/main/yang/ospf-topology.yang@2013-10-21.yang with 99% similarity]
model/ietf/ietf-topology/src/main/yang/network-topology@2013-10-21.yang
model/pom.xml
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/StringType.java
yang/yang-parser-impl/src/main/antlr/YangParser.g4

index 7c3ba6b1e6d84eaf1b74714bbf7a22573bc55230..3630ce973731a56eaaef4e9828fa179518a486f4 100644 (file)
@@ -1685,13 +1685,13 @@ public class BindingGeneratorImpl implements BindingGenerator {
     }
 
     /**\r
-     * Creates the name of the getter method from <code>methodName</code>.\r
+     * Creates the name of the getter method from <code>localName</code>.\r
      *\r
-     * @param methodName\r
+     * @param localName\r
      *            string with the name of the getter method\r
      * @param returnType return type\r
      * @return string with the name of the getter method for\r
-     *         <code>methodName</code> in JAVA method format\r
+     *         <code>localName</code> in JAVA method format\r
      */
     public static def String getterMethodName(String localName, Type returnType) {
         val method = new StringBuilder();
index e7323720b2ed48c2e8d1539b3071cf2387622b38..b910609042b7f58f41b9ae7f3ae0a62ffca86d39 100644 (file)
@@ -7,7 +7,6 @@ import org.opendaylight.yangtools.yang.model.api.Module
 import java.io.IOException\r
 import java.util.HashSet\r
 import java.io.BufferedWriter\r
-import java.io.OutputStream;\r
 import java.io.OutputStreamWriter;\r
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode\r
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode\r
@@ -27,7 +26,6 @@ import org.opendaylight.yangtools.yang.model.api.NotificationDefinition
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer\r
 import org.slf4j.LoggerFactory\r
 import org.slf4j.Logger\r
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema\r
 import java.util.List\r
 import org.opendaylight.yangtools.yang.common.QName\r
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition\r
@@ -46,12 +44,10 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates\r
 import java.util.LinkedHashMap\r
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier\r
-import com.google.common.collect.FluentIterable\r
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode\r
-import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode\r
-import java.net.URLEncoder\r
-import javax.swing.text.StyledEditorKit.ForegroundAction\r
-\r
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode\rimport java.util.HashMap
+import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode
+
 class GeneratorImpl {\r
 \r
     File path\r
@@ -66,18 +62,18 @@ class GeneratorImpl {
         path.mkdirs();\r
         val it = new HashSet;\r
         for (module : modulesToGen) {\r
-            add(module.generateDocumentation());\r
+            add(generateDocumentation(module, context));\r
         }\r
         return it;\r
     }\r
 \r
-    def generateDocumentation(Module module) {\r
+    def generateDocumentation(Module module, SchemaContext ctx) {\r
         val destination = new File(path, '''«module.name».html''')\r
         try {\r
             val fw = new OutputStreamWriter(CTX.newFileOutputStream(destination))\r
             val bw = new BufferedWriter(fw)\r
             currentModule = module;\r
-            bw.append(module.generate);\r
+            bw.append(generate(module, ctx));\r
             bw.close();\r
             fw.close();\r
         } catch (IOException e) {\r
@@ -86,19 +82,19 @@ class GeneratorImpl {
         return destination;\r
     }\r
 \r
-    def generate(Module module) '''\r
+    def generate(Module module, SchemaContext ctx) '''\r
         <!DOCTYPE html>\r
         <html lang="en">\r
           <head>\r
             <title>«module.name»</title>\r
           </head>\r
           <body>\r
-            «module.body»\r
+            «body(module, ctx)»\r
           </body>\r
         </html>\r
     '''\r
 \r
-    def body(Module module) '''\r
+    def body(Module module, SchemaContext ctx) '''\r
         «header(module)»\r
 \r
         «typeDefinitions(module)»\r
@@ -113,7 +109,7 @@ class GeneratorImpl {
 \r
         «notifications(module)»\r
 \r
-        «augmentations(module)»\r
+        «augmentations(module, ctx\r
 \r
         «rpcs(module)»\r
 \r
@@ -136,7 +132,7 @@ class GeneratorImpl {
                 <li>\r
                     «strong("typedef " + typedef.QName.localName)»\r
                     <ul>\r
-                    «typedef.descAndRef»\r
+                    «typedef.descAndRefLi»\r
                     «typedef.restrictions»\r
                     </ul>\r
                 </li>\r
@@ -156,7 +152,7 @@ class GeneratorImpl {
                 <li>\r
                     «strong("identity " + identity.QName.localName)»\r
                     <ul>\r
-                    «identity.descAndRef»\r
+                    «identity.descAndRefLi»\r
                     «IF identity.baseIdentity != null»\r
                         «listItem("base", identity.baseIdentity.QName.localName)»\r
                     «ENDIF»\r
@@ -178,7 +174,7 @@ class GeneratorImpl {
                 <li>\r
                     «strong("grouping " + grouping.QName.localName)»\r
                     <ul>\r
-                        «grouping.descAndRef»\r
+                        «grouping.descAndRefLi»\r
                     </ul>\r
                 </li>\r
             «ENDFOR»\r
@@ -196,7 +192,7 @@ class GeneratorImpl {
         '''\r
     }\r
 \r
-    def augmentations(Module module) {\r
+    def augmentations(Module module, SchemaContext context) {\r
         if (module.augmentations.empty) {\r
             return '';\r
         }\r
@@ -206,9 +202,15 @@ class GeneratorImpl {
             <ul>\r
             «FOR augment : module.augmentations»\r
                 <li>\r
-                    augment\r
-                    «augment.augmentationInfo(InstanceIdentifier.builder().toInstance())»\r
-                    «augment.childNodes.printChildren(2,InstanceIdentifier.builder().toInstance())»\r
+                    <h3>Target [«schemaPathAsRestconfPath(module, augment.targetPath, context)»]</h3>\r
+                    «augment.description»\r
+                    «IF augment.reference !== null»\r
+                        Reference «augment.reference»\r
+                    «ENDIF»\r
+                    «IF augment.whenCondition !== null»\r
+                        When «augment.whenCondition.toString»\r
+                    «ENDIF»\r
+                    «augment.childNodes.printChildren(3,InstanceIdentifier.builder().toInstance())»\r
                 </li>\r
             «ENDFOR»\r
             </ul>\r
@@ -220,13 +222,14 @@ class GeneratorImpl {
         if (notificationdefs.empty) {\r
             return '';\r
         }\r
-        \r
+\r
         return '''\r
             <h2>Notifications</h2>\r
             «FOR notificationdef : notificationdefs»\r
-                \r
+\r
                 <h3>«notificationdef.nodeName»</h3>\r
-                    «notificationdef.notificationInfo(InstanceIdentifier.builder().node(notificationdef.QName).toInstance())»\r
+                    «notificationdef.descAndRef»\r
+                    «notificationdef.childNodes.printChildren(3,InstanceIdentifier.builder().toInstance())»\r
             «ENDFOR»\r
         '''\r
     }\r
@@ -235,7 +238,7 @@ class GeneratorImpl {
         if (module.rpcs.empty) {\r
             return '';\r
         }\r
-        \r
+\r
         return '''\r
             <h2>RPC Definitions</h2>\r
             «FOR rpc : module.rpcs»\r
@@ -256,6 +259,7 @@ class GeneratorImpl {
                 <li>\r
                     <h3>«ext.nodeName»</h3>\r
                 </li>\r
+                «extensionInfo(ext)»\r
             «ENDFOR»\r
         '''\r
     }\r
@@ -272,7 +276,7 @@ class GeneratorImpl {
                 <li>\r
                     «strong("feature " + feature.QName.localName)»\r
                     <ul>\r
-                        «feature.descAndRef»\r
+                        «feature.descAndRefLi»\r
                     </ul>\r
                 </li>\r
             «ENDFOR»\r
@@ -282,7 +286,7 @@ class GeneratorImpl {
 \r
     def header(Module module) '''\r
         <h1>«module.name»</h1>\r
-        \r
+\r
         <h2>Base Information</h2>\r
         <dl>\r
             <dt>Prefix</dt>\r
@@ -291,15 +295,15 @@ class GeneratorImpl {
             <dd>«pre(module.namespace.toString)»</dd>\r
             <dt>Revision</dt>\r
             <dd>«pre(REVISION_FORMAT.format(module.revision))»</dd>\r
-            \r
+\r
             «FOR imp : module.imports BEFORE "<dt>Imports</dt>" »\r
                 <dd>«code(imp.prefix)» = «code(imp.moduleName)»</dd>\r
             «ENDFOR»\r
         </dl>\r
     '''\r
-    \r
+\r
     def code(String string) '''<code>«string»</code>'''\r
-        \r
+\r
     def process(Module module) {\r
         throw new UnsupportedOperationException("TODO: auto-generated method stub")\r
     }\r
@@ -308,12 +312,12 @@ class GeneratorImpl {
         «strong("module " + module.name)»\r
         «module.childNodes.treeSet(InstanceIdentifier.builder.toInstance())»\r
     '''\r
-    \r
+\r
     private def dispatch CharSequence tree(ChoiceNode node,InstanceIdentifier path) '''\r
         «node.nodeName» (choice)\r
         «casesTree(node.cases,path)»\r
     '''\r
-    \r
+\r
     def casesTree(Set<ChoiceCaseNode> nodes,InstanceIdentifier path) '''\r
         <ul>\r
         «FOR node : nodes»\r
@@ -334,7 +338,7 @@ class GeneratorImpl {
         «localLink(newPath,node.nodeName)»\r
         «node.childNodes.treeSet(newPath)»\r
     '''\r
-    \r
+\r
     private def dispatch CharSequence tree(ContainerSchemaNode node,InstanceIdentifier path) '''\r
         «val newPath = path.append(node)»\r
         «localLink(newPath,node.nodeName)»\r
@@ -346,11 +350,12 @@ class GeneratorImpl {
         «IF childNodes !== null && !childNodes.empty»\r
             <h2>Child nodes</h2>\r
 \r
-            «childNodes.printChildren(2,InstanceIdentifier.builder().toInstance())»\r
+            «childNodes.printChildren(3,InstanceIdentifier.builder().toInstance())»\r
         «ENDIF»\r
     '''\r
-    \r
+\r
     def CharSequence printChildren(Set<DataSchemaNode> nodes, int level, InstanceIdentifier path) {\r
+    val anyxmlNodes = nodes.filter(AnyXmlSchemaNode)\r
     val leafNodes = nodes.filter(LeafSchemaNode)\r
     val leafListNodes = nodes.filter(LeafListSchemaNode)\r
     val choices = nodes.filter(ChoiceNode)\r
@@ -358,8 +363,12 @@ class GeneratorImpl {
     val containers = nodes.filter(ContainerSchemaNode)\r
     val lists = nodes.filter(ListSchemaNode)\r
     return '''\r
+        «IF ((anyxmlNodes.size + leafNodes.size + leafListNodes.size + containers.size + lists.size) > 0)»\r
         <h3>Direct children</h3>\r
         <ul>\r
+        «FOR childNode : anyxmlNodes»\r
+            «childNode.printShortInfo(level,path)»\r
+        «ENDFOR»\r
         «FOR childNode : leafNodes»\r
             «childNode.printShortInfo(level,path)»\r
         «ENDFOR»\r
@@ -373,7 +382,8 @@ class GeneratorImpl {
             «childNode.printShortInfo(level,path)»\r
         «ENDFOR»\r
         </ul>\r
-        \r
+        «ENDIF»\r
+\r
         «IF !path.path.empty»\r
         <h3>XML example</h3>\r
         «nodes.xmlExample(path.path.last.nodeType,path)»\r
@@ -394,53 +404,68 @@ class GeneratorImpl {
         \r
     '''\r
     }\r
-    \r
+\r
     def CharSequence xmlExample(Set<DataSchemaNode> nodes, QName name,InstanceIdentifier path) '''\r
     <pre>\r
         «xmlExampleTag(name,nodes.xmplExampleTags(path))»\r
     </pre>\r
     '''\r
-    \r
+\r
     def CharSequence xmplExampleTags(Set<DataSchemaNode> nodes, InstanceIdentifier identifier) '''\r
         <!-- Child nodes -->\r
         «FOR node : nodes»\r
         <!-- «node.QName.localName» -->\r
             «node.asXmlExampleTag(identifier)»\r
         «ENDFOR»\r
-        \r
+\r
     '''\r
-    \r
+\r
     private def dispatch CharSequence asXmlExampleTag(LeafSchemaNode node, InstanceIdentifier identifier) '''\r
         «node.QName.xmlExampleTag("...")»\r
     '''\r
-    \r
+\r
     private def dispatch CharSequence asXmlExampleTag(LeafListSchemaNode node, InstanceIdentifier identifier) '''\r
         &lt!-- This node could appear multiple times --&gt\r
         «node.QName.xmlExampleTag("...")»\r
     '''\r
-    \r
+\r
     private def dispatch CharSequence asXmlExampleTag(ContainerSchemaNode node, InstanceIdentifier identifier) '''\r
         &lt!-- See «localLink(identifier.append(node),"definition")» for child nodes.  --&gt\r
         «node.QName.xmlExampleTag("...")»\r
     '''\r
-    \r
-    \r
+\r
+\r
     private def dispatch CharSequence asXmlExampleTag(ListSchemaNode node, InstanceIdentifier identifier) '''\r
         &lt!-- See «localLink(identifier.append(node),"definition")» for child nodes.  --&gt\r
         &lt!-- This node could appear multiple times --&gt\r
         «node.QName.xmlExampleTag("...")»\r
     '''\r
-    \r
-    \r
+\r
+\r
     private def dispatch CharSequence asXmlExampleTag(DataSchemaNode node, InstanceIdentifier identifier) '''\r
         <!-- noop -->\r
     '''\r
-    \r
-    \r
+\r
+\r
     def xmlExampleTag(QName name, CharSequence data) {\r
         return '''&lt;«name.localName» xmlns="«name.namespace»"&gt;«data»&lt;/«name.localName»&gt;'''\r
     }\r
-    \r
+\r
+    def header(int level,QName name) '''<h«level»>«name.localName»</h«level»>'''\r
+\r
+\r
+    def header(int level,InstanceIdentifier name) '''\r
+        <h«level» id="«FOR cmp : name.path SEPARATOR "/"»«cmp.nodeType.localName»«ENDFOR»">\r
+            «FOR cmp : name.path SEPARATOR "/"»«cmp.nodeType.localName»«ENDFOR»\r
+        </h«level»>\r
+    '''\r
+\r
+\r
+\r
+    private def dispatch CharSequence printInfo(DataSchemaNode node, int level, InstanceIdentifier path) '''\r
+        «header(level+1,node.QName)»\r
+    '''\r
+\r
     private def dispatch CharSequence printInfo(ContainerSchemaNode node, int level, InstanceIdentifier path) '''\r
         «val newPath = path.append(node)»\r
         «header(level,newPath)»\r
@@ -452,17 +477,7 @@ class GeneratorImpl {
         </dl>\r
         «node.childNodes.printChildren(level,newPath)»\r
     '''\r
-    \r
-    def header(int level,QName name) '''<h«level»>«name.localName»</h«level»>'''\r
-    \r
-    \r
-    def header(int level,InstanceIdentifier name) \r
-        '''\r
-        <h«level» id="«FOR cmp : name.path SEPARATOR "/"»«cmp.nodeType.localName»«ENDFOR»">\r
-            «FOR cmp : name.path SEPARATOR "/"»«cmp.nodeType.localName»«ENDFOR»\r
-        </h«level»>'''\r
-    \r
-    \r
+\r
     private def dispatch CharSequence printInfo(ListSchemaNode node, int level, InstanceIdentifier path) '''\r
         «val newPath = path.append(node)»\r
         «header(level,newPath)»\r
@@ -484,26 +499,34 @@ class GeneratorImpl {
         «node.childNodes.printChildren(level,path)»\r
     '''\r
 \r
+\r
+\r
     def CharSequence printShortInfo(ContainerSchemaNode node, int level, InstanceIdentifier path) {\r
         val newPath = path.append(node);\r
         return '''\r
             <li>«strong(localLink(newPath,node.QName.localName))» (container)</li>\r
         '''\r
     }\r
-    \r
+\r
     def CharSequence printShortInfo(ListSchemaNode node, int level, InstanceIdentifier path) {\r
         val newPath = path.append(node);\r
         return '''\r
             <li>«strong(localLink(newPath,node.QName.localName))» (list)</li>\r
         '''\r
     }\r
-    \r
+\r
+    def CharSequence printShortInfo(AnyXmlSchemaNode node, int level, InstanceIdentifier path) {\r
+        return '''\r
+            <li>«strong((node.QName.localName))» (anyxml)</li>\r
+        '''\r
+    }\r
+\r
     def CharSequence printShortInfo(LeafSchemaNode node, int level, InstanceIdentifier path) {\r
         return '''\r
             <li>«strong((node.QName.localName))» (leaf)</li>\r
         '''\r
     }\r
-    \r
+\r
     def CharSequence printShortInfo(LeafListSchemaNode node, int level, InstanceIdentifier path) {\r
         return '''\r
             <li>«strong((node.QName.localName))» (leaf-list)</li>\r
@@ -513,14 +536,14 @@ class GeneratorImpl {
     def CharSequence localLink(InstanceIdentifier identifier, CharSequence text) '''\r
         <a href="#«FOR cmp : identifier.path SEPARATOR "/"»«cmp.nodeType.localName»«ENDFOR»">«text»</a>\r
     '''\r
-    \r
-    \r
+\r
+\r
     private def dispatch InstanceIdentifier append(InstanceIdentifier identifier, ContainerSchemaNode node) {\r
         val pathArguments = new ArrayList(identifier.path)\r
         pathArguments.add(new NodeIdentifier(node.QName));\r
         return new InstanceIdentifier(pathArguments);\r
     }\r
-    \r
+\r
     private def dispatch InstanceIdentifier append(InstanceIdentifier identifier, ListSchemaNode node) {\r
         val pathArguments = new ArrayList(identifier.path)\r
         val keyValues = new LinkedHashMap<QName,Object>();\r
@@ -532,12 +555,12 @@ class GeneratorImpl {
         pathArguments.add(new NodeIdentifierWithPredicates(node.QName,keyValues));\r
         return new InstanceIdentifier(pathArguments);\r
     }\r
-    \r
-    \r
+\r
+\r
     def asXmlPath(InstanceIdentifier identifier) {\r
         return "";\r
     }\r
-    \r
+\r
     def asRestconfPath(InstanceIdentifier identifier) {\r
         val it = new StringBuilder();\r
         append(currentModule.name)\r
@@ -556,17 +579,57 @@ class GeneratorImpl {
                 }\r
             }\r
         }\r
-        \r
+\r
         return it.toString;\r
     }\r
-    \r
-    \r
-    private def dispatch CharSequence printInfo(DataSchemaNode node, int level, InstanceIdentifier path) '''\r
-        «header(level+1,node.QName)»\r
-    '''\r
-    \r
 \r
+    private def String schemaPathAsRestconfPath(Module module, SchemaPath schemaPath, SchemaContext ctx) {\r
+        val Map<String, String> imports = new HashMap();\r
+        for (mImport : module.imports) {\r
+            imports.put(mImport.prefix, mImport.moduleName)\r
+        }\r
 \r
+        val List<QName> path = schemaPath.path\r
+        val StringBuilder pathString = new StringBuilder()\r
+        if (schemaPath.absolute) {\r
+            pathString.append("/")\r
+        }\r
+\r
+        val QName qname = path.get(0)\r
+        var Object parent = ctx.findModuleByNamespaceAndRevision(qname.namespace, qname.revision)\r
+\r
+        for (name : path) {\r
+            if (parent instanceof DataNodeContainer) {\r
+                var SchemaNode node = (parent as DataNodeContainer).getDataChildByName(name)\r
+                if (node == null && (parent instanceof Module)) {\r
+                    val notifications = (parent as Module).notifications;\r
+                    for (notification : notifications) {\r
+                        if (notification.QName.localName.equals(name.localName)) {\r
+                            node = notification\r
+                        }\r
+                    }\r
+                }\r
+\r
+                if (!(node instanceof ChoiceNode) && !(node instanceof ChoiceCaseNode)) {\r
+                    var String prefix = node.QName.prefix\r
+                    var String moduleName\r
+                    if (prefix == null || "".equals(prefix) || prefix.equals(module.prefix)) {\r
+                        moduleName = module.name\r
+                    } else {\r
+                        moduleName = imports.get(prefix)\r
+                    }\r
+                    pathString.append(moduleName)\r
+                    pathString.append(":")\r
+                    pathString.append(node.QName.localName)\r
+                    pathString.append("/")\r
+                }\r
+                parent = node\r
+            } else if (parent instanceof ChoiceNode) {\r
+                parent = (parent as ChoiceNode).getCaseNodeByName(qname.localName)\r
+            }\r
+        }\r
+        return pathString.toString;\r
+    }\r
 \r
 \r
     def CharSequence childNodesInfoTree(Map<SchemaPath, DataSchemaNode> childNodes) '''\r
@@ -583,7 +646,7 @@ class GeneratorImpl {
             «code(path)»\r
                 «IF node !== null»\r
                 <ul>\r
-                «node.descAndRef»\r
+                «node.descAndRefLi»\r
                 </ul>\r
             «ENDIF»\r
         «ENDIF»\r
@@ -605,36 +668,9 @@ class GeneratorImpl {
         [«FOR key : node.keyDefinition SEPARATOR " "»«key.localName»«ENDFOR»]\r
     '''\r
 \r
-    private def CharSequence augmentationInfo(AugmentationSchema augment, InstanceIdentifier path) '''\r
-        <ul>\r
-            «listItem(augment.description)»\r
-            «listItem("Reference", augment.reference)»\r
-            «IF augment.whenCondition !== null»\r
-                «listItem("When", augment.whenCondition.toString)»\r
-            «ENDIF»\r
-            <li>\r
-                Path «augment.targetPath.path.pathToTree»\r
-            </li>\r
-            <li>\r
-                Child nodes\r
-                «augment.childNodes.treeSet(path)»\r
-            </li>\r
-        </ul>\r
-    '''\r
-\r
-    private def CharSequence notificationInfo(NotificationDefinition notification,InstanceIdentifier path) '''\r
-        <ul>\r
-            «notification.descAndRef»\r
-            <li>\r
-                Child nodes\r
-                «notification.childNodes.treeSet(path)»\r
-            </li>\r
-        </ul>\r
-    '''\r
-\r
     private def CharSequence rpcInfo(RpcDefinition rpc,InstanceIdentifier path) '''\r
         <ul>\r
-            «rpc.descAndRef»\r
+            «rpc.descAndRefLi»\r
             <li>\r
                 «rpc.input.tree(path)»\r
             </li>\r
@@ -644,9 +680,9 @@ class GeneratorImpl {
         </ul>\r
     '''\r
 \r
-    private def CharSequence extensionInfo(ExtensionDefinition ext, InstanceIdentifier path) '''\r
+    private def CharSequence extensionInfo(ExtensionDefinition ext) '''\r
         <ul>\r
-            «ext.descAndRef»\r
+            «ext.descAndRefLi»\r
             «listItem("Argument", ext.argument)»\r
         </ul>\r
     '''\r
@@ -737,11 +773,18 @@ class GeneratorImpl {
     private def italic(CharSequence str) '''<i>«str»</i>'''\r
     private def pre(CharSequence str) '''<pre>«str»</pre>'''\r
 \r
-    def CharSequence descAndRef(SchemaNode node) '''\r
+    def CharSequence descAndRefLi(SchemaNode node) '''\r
         «listItem(node.description)»\r
         «listItem("Reference", node.reference)»\r
     '''\r
 \r
+    def CharSequence descAndRef(SchemaNode node) '''\r
+        «node.description»\r
+        «IF node.reference !== null»\r
+            Reference «node.reference»\r
+        «ENDIF»\r
+    '''\r
+\r
     private def listItem(String value) '''\r
         «IF value !== null && !value.empty»\r
             <li>\r
@@ -753,12 +796,7 @@ class GeneratorImpl {
     private def listItem(String name, String value) '''\r
         «IF value !== null && !value.empty»\r
             <li>\r
-                «name»\r
-                <ul>\r
-                    <li>\r
-                        «value»\r
-                    </li>\r
-                </ul>\r
+                «name»: «value»\r
             </li>\r
         «ENDIF»\r
     '''\r
@@ -808,18 +846,6 @@ class GeneratorImpl {
         }\r
     }\r
 \r
-    private def CharSequence pathToTree(List<QName> path) '''\r
-        «IF path !== null && !path.empty»\r
-            <ul>\r
-            «FOR pathElement : path»\r
-                <li>\r
-                    «pathElement.namespace» «pathElement.localName»\r
-                </li>\r
-            «ENDFOR»\r
-            </ul>\r
-        «ENDIF»\r
-    '''\r
-\r
     private def dispatch addedByInfo(SchemaNode node) '''\r
     '''\r
 \r
index eddb222a39adc12b50a6687ed6f7f64c55f2506a..776ecd7869e8d74b204a918d3ab4f0104eface49 100644 (file)
@@ -2,25 +2,26 @@ package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.regex.Pattern;
 
 /**
 **/
 public class HostBuilder {
+    private static final Pattern ipv4Pattern = Pattern.compile("(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\\p{N}\\p{L}]+)?");
+    private static final Pattern  ipv6Pattern1 = Pattern.compile("((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\\p{N}\\p{L}]+)?");
+    private static final Pattern ipv6Pattern2 = Pattern.compile("(([^:]+:){6}(([^:]+:[^:]+)|(.*\\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(%.+)?");
+    private static final Pattern domainPattern = Pattern.compile("((([a-zA-Z0-9_]([a-zA-Z0-9\\-_]){0,61})?[a-zA-Z0-9]\\.)*([a-zA-Z0-9_]([a-zA-Z0-9\\-_]){0,61})?[a-zA-Z0-9]\\.?)|\\.");
 
     public static Host getDefaultInstance(String defaultValue) {
-        String ipv4Pattern = "(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\\p{N}\\p{L}]+)?";
-        String ipv6Pattern1 = "((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\\p{N}\\p{L}]+)?";
-        String ipv6Pattern2 = "(([^:]+:){6}(([^:]+:[^:]+)|(.*\\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(%.+)?";
-        String domainPattern = "((([a-zA-Z0-9_]([a-zA-Z0-9\\-_]){0,61})?[a-zA-Z0-9]\\.)*([a-zA-Z0-9_]([a-zA-Z0-9\\-_]){0,61})?[a-zA-Z0-9]\\.?)|\\.";
 
         List<String> matchers = new ArrayList<>();
-        if (defaultValue.matches(ipv4Pattern)) {
+        if (ipv4Pattern.matcher(defaultValue).matches()) {
             matchers.add(Ipv4Address.class.getSimpleName());
         }
-        if (defaultValue.matches(ipv6Pattern1) && defaultValue.matches(ipv6Pattern2)) {
+        if (ipv6Pattern1.matcher(defaultValue).matches() && ipv6Pattern2.matcher(defaultValue).matches()) {
             matchers.add(Ipv6Address.class.getSimpleName());
         }
-        if (defaultValue.matches(domainPattern)) {
+        if (domainPattern.matcher(defaultValue).matches()) {
             matchers.add(DomainName.class.getSimpleName());
         }
         if (matchers.size() > 1) {
@@ -28,17 +29,17 @@ public class HostBuilder {
                     + matchers);
         }
 
-        if (defaultValue.matches(ipv4Pattern)) {
+        if (ipv4Pattern.matcher(defaultValue).matches()) {
             Ipv4Address ipv4 = new Ipv4Address(defaultValue);
             IpAddress ipAddress = new IpAddress(ipv4);
             return new Host(ipAddress);
         }
-        if (defaultValue.matches(ipv6Pattern1) && defaultValue.matches(ipv6Pattern2)) {
+        if (ipv6Pattern1.matcher(defaultValue).matches() && ipv6Pattern2.matcher(defaultValue).matches()) {
             Ipv6Address ipv6 = new Ipv6Address(defaultValue);
             IpAddress ipAddress = new IpAddress(ipv6);
             return new Host(ipAddress);
         }
-        if (defaultValue.matches(domainPattern)) {
+        if (domainPattern.matcher(defaultValue).matches()) {
             DomainName domainName = new DomainName(defaultValue);
             return new Host(domainName);
         }
index fc91e9eae99514a8d5599972c6fb779ce53f89fe..745662380ca8d95b2e1808fecf3137c2481a2218 100644 (file)
@@ -6,6 +6,7 @@ module ted {
 
   import ietf-inet-types {
     prefix inet;
+    revision-date 2010-09-24;
   }
 
   organization "TBD";
index 894d9b81f80f7b0eb862186a158a481e4d956c31..00db145c96e92cfc63c8bf118de7d16112cefcb1 100644 (file)
@@ -10,6 +10,7 @@ module l3-unicast-igp-topology {
 
     import ietf-inet-types {
         prefix "inet";
+       revision-date 2010-09-24;
     }
 
     organization "TBD";
similarity index 99%
rename from model/ietf/ietf-topology-ospf/src/main/yang/ospf-topology.yang@2013-10-21.yang
rename to model/ietf/ietf-topology-ospf/src/main/yang/ospf-topology@2013-10-21.yang
index 166573c43603c33f1c300e8a994988464cf12aeb..a8a1507aad798fe0fa97375302011bb427ea3ded 100644 (file)
@@ -16,6 +16,7 @@ module ospf-topology {
     }
     import ietf-inet-types {
         prefix "inet";
+       revision-date 2010-09-24;
     }
     import ted {
         prefix "ted";
index 3c5ae5e7e385cd245fbf1a906cf809bb1c687e92..19d9b85273ea50e676244acc160cb9e61bdbe386 100644 (file)
@@ -4,7 +4,7 @@ module network-topology  {
     // replace with IANA namespace when assigned
     prefix "nt";
 
-    import ietf-inet-types { prefix "inet"; }
+    import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
 
     organization "TBD";
 
index fa58708be060fa73341a3227504e8c1aef24ec65..724c8a4e1189d9ed7c8a367affb5ae5b5fed7ed6 100644 (file)
                                     <codeGeneratorClass>org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl</codeGeneratorClass>
                                     <outputBaseDir>target/site/restconf</outputBaseDir>
                                 </generator>
+                                <generator>
+                                    <codeGeneratorClass>org.opendaylight.yangtools.yang.wadl.generator.maven.WadlGenerator</codeGeneratorClass>
+                                    <outputBaseDir>target/site/restconf</outputBaseDir>
+                                </generator>
                             </codeGenerators>
                             <inspectDependencies>true</inspectDependencies>
                         </configuration>
index edbbfff6a08f45f7c915f07a9551fb28cfe5d7b1..c40622ed30d47da7f190ede85f7dc488b9d414d9 100644 (file)
@@ -40,7 +40,7 @@ public final class StringType implements StringTypeDefinition {
      */
     private StringType() {
         final List<LengthConstraint> constraints = new ArrayList<LengthConstraint>();
-        constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", ""));
+        constraints.add(BaseConstraints.lengthConstraint(0, Integer.MAX_VALUE, "", ""));
         lengthStatements = Collections.unmodifiableList(constraints);
         patterns = Collections.emptyList();
     }
index 9e67cd85f0413acc9856427bf713b56885fdd702..977887ffe0c8c56bf858da04c3b313d16d12a8ff 100644 (file)
@@ -23,8 +23,8 @@ deviate_add_stmt : DEVIATE_KEYWORD string /*ADD_KEYWORD*/ (SEMICOLON | (LEFT_BRA
 deviate_not_supported_stmt : DEVIATE_KEYWORD string /*NOT_SUPPORTED_KEYWORD*/ (SEMICOLON | (LEFT_BRACE identifier_stmt? RIGHT_BRACE));
 deviation_stmt : DEVIATION_KEYWORD string LEFT_BRACE (identifier_stmt |description_stmt | reference_stmt | deviate_not_supported_stmt | deviate_add_stmt | deviate_replace_stmt | deviate_delete_stmt)+ RIGHT_BRACE;
 notification_stmt : NOTIFICATION_KEYWORD string (SEMICOLON | (LEFT_BRACE (identifier_stmt |if_feature_stmt | status_stmt | description_stmt | reference_stmt | typedef_stmt | grouping_stmt | data_def_stmt )* RIGHT_BRACE));
-output_stmt : OUTPUT_KEYWORD LEFT_BRACE (identifier_stmt |typedef_stmt | grouping_stmt | data_def_stmt )+ RIGHT_BRACE;
-input_stmt : INPUT_KEYWORD LEFT_BRACE (identifier_stmt |typedef_stmt | grouping_stmt | data_def_stmt )+ RIGHT_BRACE;
+output_stmt : OUTPUT_KEYWORD LEFT_BRACE (identifier_stmt |typedef_stmt | grouping_stmt | data_def_stmt )* RIGHT_BRACE;
+input_stmt : INPUT_KEYWORD LEFT_BRACE (identifier_stmt |typedef_stmt | grouping_stmt | data_def_stmt )* RIGHT_BRACE;
 rpc_stmt : RPC_KEYWORD string (SEMICOLON | (LEFT_BRACE (identifier_stmt |if_feature_stmt  | status_stmt | description_stmt | reference_stmt | typedef_stmt | grouping_stmt | input_stmt | output_stmt )* RIGHT_BRACE));
 when_stmt : WHEN_KEYWORD string (SEMICOLON | (LEFT_BRACE (identifier_stmt |description_stmt | reference_stmt )* RIGHT_BRACE));