Expanded UnknownSchemaNode implementation, refactored java source code generation. 68/268/1
authorMartin Vitez <mvitez@cisco.com>
Tue, 30 Apr 2013 14:02:15 +0000 (16:02 +0200)
committerMartin Vitez <mvitez@cisco.com>
Tue, 30 Apr 2013 14:02:15 +0000 (16:02 +0200)
Signed-off-by: Martin Vitez <mvitez@cisco.com>
13 files changed:
opendaylight/sal/yang-prototype/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/controller/sal/java/api/generator/GeneratorJavaFile.java
opendaylight/sal/yang-prototype/code-generator/binding-java-api-generator/src/test/java/org/opendaylight/controller/sal/java/api/generator/test/GeneratorJavaFileTest.java
opendaylight/sal/yang-prototype/code-generator/maven-sal-api-gen-plugin/src/main/java/org/opendaylight/controller/maven/sal/api/gen/plugin/CodeGeneratorImpl.java
opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/YangToSourcesMojo.java
opendaylight/sal/yang-prototype/code-generator/maven-yang/src/main/java/org/opendaylight/controller/yang2sources/spi/CodeGenerator.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/ModuleBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/UnknownSchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/impl/YangModelParserImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/impl/YangModelParserListenerImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/test/java/org/opendaylight/controller/yang/model/parser/impl/YangModelParserTest.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/test/resources/abstract-topology.yang [deleted file]
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/test/resources/test-model.yang [deleted file]
opendaylight/sal/yang-prototype/yang/yang-model-api/src/main/java/org/opendaylight/controller/yang/model/api/UnknownSchemaNode.java

index 32b3fa03eb0814e8a3902a63e7c4e370652818da..be115c9a45fb9e5b6d40a332bafcd4909a32ae5f 100644 (file)
@@ -44,75 +44,68 @@ public class GeneratorJavaFile {
         this.genTransferObjects = genTransferObjects;
     }
 
-    public boolean generateToFile() {
+    public List<File> generateToFile() throws IOException {
         return generateToFile(null);
     }
 
-    public boolean generateToFile(String path) {
-        try {
-            for (GeneratedType type : types) {
-                String parentPath = generateParentPath(path,
-                        type.getPackageName());
+    public List<File> generateToFile(String path) throws IOException {
+        final List<File> result = new ArrayList<File>();
 
-                File file = new File(parentPath, type.getName() + ".java");
-                File parent = file.getParentFile();
-                if (!parent.exists()) {
-                    parent.mkdirs();
-                }
+        for (GeneratedType type : types) {
+            String parentPath = generateParentPath(path,
+                    type.getPackageName());
 
-                if (!file.exists()) {
-                    FileWriter fw = null;
-                    BufferedWriter bw = null;
-
-                    file.createNewFile();
-                    fw = new FileWriter(file);
-                    bw = new BufferedWriter(fw);
-                    Writer writer = interfaceGenerator.generate(type);
-                    bw.write(writer.toString());
-
-                    if (bw != null) {
-                        try {
-                            bw.close();
-                        } catch (IOException e) {
-                            // TODO: log?
-                        }
-                    }
-                }
+            File file = new File(parentPath, type.getName() + ".java");
+            File parent = file.getParentFile();
+            if (!parent.exists()) {
+                parent.mkdirs();
             }
-            for (GeneratedTransferObject transferObject : genTransferObjects) {
-                String parentPath = generateParentPath(path,
-                        transferObject.getPackageName());
-
-                File file = new File(parentPath, transferObject.getName() + ".java");
-                File parent = file.getParentFile();
-                if (!parent.exists()) {
-                    parent.mkdirs();
+
+            if (!file.exists()) {
+                FileWriter fw = null;
+                BufferedWriter bw = null;
+
+                file.createNewFile();
+                fw = new FileWriter(file);
+                bw = new BufferedWriter(fw);
+                Writer writer = interfaceGenerator.generate(type);
+                bw.write(writer.toString());
+
+                if (bw != null) {
+                    bw.close();
                 }
+                result.add(file);
+            }
+        }
 
-                if (!file.exists()) {
-                    FileWriter fw = null;
-                    BufferedWriter bw = null;
-
-                    file.createNewFile();
-                    fw = new FileWriter(file);
-                    bw = new BufferedWriter(fw);
-                    Writer writer = classGenerator.generate(transferObject);
-                    bw.write(writer.toString());
-
-                    if (bw != null) {
-                        try {
-                            bw.close();
-                        } catch (IOException e) {
-                            // TODO: log?
-                        }
-                    }
+        for (GeneratedTransferObject transferObject : genTransferObjects) {
+            String parentPath = generateParentPath(path,
+                    transferObject.getPackageName());
+
+            File file = new File(parentPath, transferObject.getName() + ".java");
+            File parent = file.getParentFile();
+            if (!parent.exists()) {
+                parent.mkdirs();
+            }
+
+            if (!file.exists()) {
+                FileWriter fw = null;
+                BufferedWriter bw = null;
+
+                file.createNewFile();
+                fw = new FileWriter(file);
+                bw = new BufferedWriter(fw);
+                Writer writer = classGenerator.generate(transferObject);
+                bw.write(writer.toString());
+
+                if (bw != null) {
+                    bw.close();
                 }
+                result.add(file);
             }
-            return true;
-        } catch (IOException e) {
-            // TODO: log?
-            return false;
         }
+
+        return result;
     }
 
     private String generateParentPath(String path, String pkg) {
index 5b5d50319222951e14688b65248e6c149b267345..4ae8cc1275538a50763e3355ae00050eb08bf7ad 100644 (file)
@@ -11,6 +11,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -64,7 +65,7 @@ public class GeneratorJavaFileTest {
     }
 
     @Test
-    public void test() {
+    public void test() throws IOException {
         final Set<GeneratedType> types = new HashSet<GeneratedType>();
         GeneratedType t1 = createGeneratedType(
                 "org.opendaylight.controller.gen", "Type1");
@@ -79,7 +80,6 @@ public class GeneratorJavaFileTest {
                 new InterfaceGenerator(), types);
         generator.generateToFile(PATH);
 
-        // path: test-dir/com/cisco/yang
         String[] files = new File(PATH + FS + "org" + FS + "opendaylight" + FS + "controller" + FS + "gen").list();
         List<String> filesList = Arrays.asList(files);
 
index 40b8e430439bb5bd4ca73bc7ad7fe6c2ecfe8f77..c9b43d838eb81f1b9b5e44471fb313fedb9828df 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.maven.sal.api.gen.plugin;
 
 import java.io.File;
-import java.util.Arrays;
+import java.io.IOException;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
@@ -27,7 +27,7 @@ public class CodeGeneratorImpl implements CodeGenerator {
 
     @Override
     public Collection<File> generateSources(SchemaContext context,
-            File outputBaseDir) {
+            File outputBaseDir) throws IOException {
 
         final BindingGenerator bindingGenerator = new BindingGeneratorImpl();
         final List<Type> types = bindingGenerator.generateTypes(context);
@@ -40,13 +40,11 @@ public class CodeGeneratorImpl implements CodeGenerator {
                 typesToGenerate.add((GeneratedType) type);
             }
 
-           
+
         }
 
         final GeneratorJavaFile generator = new GeneratorJavaFile(typesToGenerate, tosToGenerate);
-        generator.generateToFile(outputBaseDir.getAbsolutePath());
-
-        return Arrays.asList(outputBaseDir.listFiles());
+        return generator.generateToFile(outputBaseDir.getAbsolutePath());
     }
 
 }
index 2b7dc33845d12e8a78833e57cc600b85377d4f7e..41f3ae4a65a5f45e2e64f87b6a4ba9cddaf14c3c 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.controller.yang2sources.plugin;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Map;
@@ -167,7 +168,7 @@ public final class YangToSourcesMojo extends AbstractMojo {
      */
     private void generateSourcesWithOneGenerator(SchemaContext context,
             CodeGeneratorArg codeGeneratorCfg) throws ClassNotFoundException,
-            InstantiationException, IllegalAccessException {
+            InstantiationException, IllegalAccessException, IOException {
 
         codeGeneratorCfg.check();
 
index 534c37de10399447b95a06962ce99e88d0303a96..f90c7ef7e404afd93aaa3d39e90b3e87812f35fd 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.controller.yang2sources.spi;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Collection;
 
 import org.opendaylight.controller.yang.model.api.SchemaContext;
@@ -20,7 +21,7 @@ public interface CodeGenerator {
 
     /**
      * Generate sources from provided {@link SchemaContext}
-     * 
+     *
      * @param context
      *            parsed from yang files
      * @param outputBaseDir
@@ -28,5 +29,5 @@ public interface CodeGenerator {
      *            user
      * @return collection of files that were generated from schema context
      */
-    Collection<File> generateSources(SchemaContext context, File outputBaseDir);
+    Collection<File> generateSources(SchemaContext context, File outputBaseDir) throws IOException;
 }
index 7cb51db6a60b3238b54c1b31355fc030282648ee..e0ba03adfb0013f4eb69873ee96973b9f1c2733f 100644 (file)
@@ -82,6 +82,7 @@ public class ModuleBuilder implements Builder {
     private final Map<String, DeviationBuilder> addedDeviations = new HashMap<String, DeviationBuilder>();
     private final Map<List<String>, TypeDefinitionBuilder> addedTypedefs = new HashMap<List<String>, TypeDefinitionBuilder>();
     private final List<ExtensionBuilder> addedExtensions = new ArrayList<ExtensionBuilder>();
+    private final Set<UnknownSchemaNodeBuilder> addedUnknownNodes = new HashSet<UnknownSchemaNodeBuilder>();
 
     private final Map<List<String>, TypeAwareBuilder> dirtyNodes = new HashMap<List<String>, TypeAwareBuilder>();
 
@@ -126,7 +127,6 @@ public class ModuleBuilder implements Builder {
         instance.setNotifications(notifications);
 
         // AUGMENTATIONS
-        // instance.setAugmentations(augmentations);
         final Set<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
         for (AugmentationSchemaBuilder builder : addedAugments) {
             augmentations.add(builder.build());
@@ -195,6 +195,10 @@ public class ModuleBuilder implements Builder {
         return addedUsesNodes;
     }
 
+    public Set<UnknownSchemaNodeBuilder> getAddedUnknownNodes() {
+        return addedUnknownNodes;
+    }
+
     public Set<TypeDefinitionBuilder> getModuleTypedefs() {
         Set<TypeDefinitionBuilder> typedefs = new HashSet<TypeDefinitionBuilder>();
         for (Map.Entry<List<String>, TypeDefinitionBuilder> entry : addedTypedefs
@@ -528,7 +532,7 @@ public class ModuleBuilder implements Builder {
         List<String> pathToCase = new ArrayList<String>(parentPath);
         ChoiceCaseBuilder builder = new ChoiceCaseBuilder(caseName);
 
-        final ChoiceBuilder parent = (ChoiceBuilder) moduleNodes
+        final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
                 .get(pathToCase);
         if (parent != null) {
             if (parent instanceof AugmentationSchemaBuilder) {
@@ -538,7 +542,6 @@ public class ModuleBuilder implements Builder {
         }
 
         pathToCase.add(caseName.getLocalName());
-        addedChilds.put(pathToCase, builder);
         moduleNodes.put(pathToCase, builder);
 
         return builder;
@@ -609,12 +612,13 @@ public class ModuleBuilder implements Builder {
 
     public void addIdentityrefType(String baseString, List<String> parentPath,
             SchemaPath schemaPath) {
+        List<String> pathToIdentityref = new ArrayList<String>(parentPath);
         TypeAwareBuilder parent = (TypeAwareBuilder) moduleNodes
-                .get(parentPath);
+                .get(pathToIdentityref);
         IdentityrefTypeBuilder identityref = new IdentityrefTypeBuilder(
                 baseString, schemaPath);
         parent.setType(identityref);
-        dirtyNodes.put(parentPath, parent);
+        dirtyNodes.put(pathToIdentityref, parent);
     }
 
     public DeviationBuilder addDeviation(String targetPath,
@@ -658,6 +662,7 @@ public class ModuleBuilder implements Builder {
         } else if (parent instanceof SchemaNodeBuilder) {
             ((SchemaNodeBuilder) parent).addUnknownSchemaNode(builder);
         }
+        addedUnknownNodes.add(builder);
         return builder;
     }
 
index ddbc927e515f3ef64271278fe105893b48f3623f..f24502bab2903d2ba545be05547c521f3ab26339 100644 (file)
@@ -18,11 +18,12 @@ import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.controller.yang.model.parser.builder.api.SchemaNodeBuilder;
 
 public class UnknownSchemaNodeBuilder implements SchemaNodeBuilder {
-
+    private final UnknownSchemaNodeImpl instance;
     private final QName qname;
     private SchemaPath schemaPath;
-    private final UnknownSchemaNodeImpl instance;
     private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
+    private QName nodeType;
+    private String nodeParameter;
 
     UnknownSchemaNodeBuilder(final QName qname) {
         this.qname = qname;
@@ -32,6 +33,8 @@ public class UnknownSchemaNodeBuilder implements SchemaNodeBuilder {
     @Override
     public UnknownSchemaNode build() {
         instance.setPath(schemaPath);
+        instance.setNodeType(nodeType);
+        instance.setNodeParameter(nodeParameter);
 
         // UNKNOWN NODES
         final List<UnknownSchemaNode> unknownNodes = new ArrayList<UnknownSchemaNode>();
@@ -77,6 +80,22 @@ public class UnknownSchemaNodeBuilder implements SchemaNodeBuilder {
         addedUnknownNodes.add(unknownNode);
     }
 
+    public QName getNodeType() {
+        return nodeType;
+    }
+
+    public void setNodeType(final QName nodeType) {
+        this.nodeType = nodeType;
+    }
+
+    public String getNodeParameter() {
+        return nodeParameter;
+    }
+
+    public void setNodeParameter(final String nodeParameter) {
+        this.nodeParameter = nodeParameter;
+    }
+
     private static class UnknownSchemaNodeImpl implements UnknownSchemaNode {
         private final QName qname;
         private SchemaPath path;
@@ -84,6 +103,8 @@ public class UnknownSchemaNodeBuilder implements SchemaNodeBuilder {
         private String reference;
         private Status status = Status.CURRENT;
         private List<UnknownSchemaNode> unknownNodes = Collections.emptyList();
+        private QName nodeType;
+        private String nodeParameter;
 
         private UnknownSchemaNodeImpl(final QName qname) {
             this.qname = qname;
@@ -143,6 +164,24 @@ public class UnknownSchemaNodeBuilder implements SchemaNodeBuilder {
                 this.unknownNodes = unknownNodes;
             }
         }
+
+        @Override
+        public QName getNodeType() {
+            return nodeType;
+        }
+
+        private void setNodeType(final QName nodeType) {
+            this.nodeType = nodeType;
+        }
+
+        @Override
+        public String getNodeParameter() {
+            return nodeParameter;
+        }
+
+        private void setNodeParameter(final String nodeParameter) {
+            this.nodeParameter = nodeParameter;
+        }
     }
 
 }
index 60937fff22dcac74e7d9ab24e891f9d066495c82..50943fa7403110d17e7d811d82c0b82f0337ab39 100644 (file)
@@ -209,6 +209,7 @@ public class YangModelParserImpl implements YangModelParser {
         resolveDirtyNodes(modules, builder);
         resolveIdentities(modules, builder);
         resolveUses(modules, builder);
+        resolveUnknownNodes(modules, builder);
     }
 
     /**
@@ -979,6 +980,29 @@ public class YangModelParserImpl implements YangModelParser {
         return result;
     }
 
+    private void resolveUnknownNodes(
+            final Map<String, TreeMap<Date, ModuleBuilder>> modules,
+            final ModuleBuilder module) {
+        for (UnknownSchemaNodeBuilder usnb : module.getAddedUnknownNodes()) {
+            QName nodeType = usnb.getNodeType();
+            if (nodeType.getNamespace() == null
+                    || nodeType.getRevision() == null) {
+                try {
+                    ModuleBuilder dependentModule = findDependentModule(
+                            modules, module, nodeType.getPrefix());
+                    QName newNodeType = new QName(
+                            dependentModule.getNamespace(),
+                            dependentModule.getRevision(),
+                            nodeType.getPrefix(), nodeType.getLocalName());
+                    usnb.setNodeType(newNodeType);
+                } catch (YangParseException e) {
+                    logger.debug("Failed to find unknown node type: "
+                            + nodeType);
+                }
+            }
+        }
+    }
+
     /**
      * Find dependent module based on given prefix
      *
index 11b655b4a140503103117d22bf5bc63e8ca92b4a..2023b47de3b960b9da29805440aeecb62b31f3df 100644 (file)
@@ -646,11 +646,21 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
     // Unknown types
     @Override
     public void enterIdentifier_stmt(YangParser.Identifier_stmtContext ctx) {
-        final String name = stringFromNode(ctx);
+        final String nodeParameter = stringFromNode(ctx);
+        QName nodeType = null;
+
+        final String nodeTypeStr = ctx.getChild(0).getText();
+        final String[] splittedElement = nodeTypeStr.split(":");
+        if (splittedElement.length == 1) {
+            nodeType = new QName(null, null, null, splittedElement[0]);
+        } else {
+            nodeType = new QName(null, null, splittedElement[0],
+                    splittedElement[1]);
+        }
 
         QName qname;
-        if (name != null) {
-            String[] splittedName = name.split(":");
+        if (nodeParameter != null) {
+            String[] splittedName = nodeParameter.split(":");
             if (splittedName.length == 2) {
                 qname = new QName(null, null, splittedName[0], splittedName[1]);
             } else {
@@ -658,12 +668,14 @@ public final class YangModelParserListenerImpl extends YangParserBaseListener {
                         splittedName[0]);
             }
         } else {
-            qname = new QName(namespace, revision, yangModelPrefix, name);
+            qname = new QName(namespace, revision, yangModelPrefix, nodeParameter);
         }
 
         UnknownSchemaNodeBuilder builder = moduleBuilder.addUnknownSchemaNode(
                 qname, actualPath);
-        updatePath(name);
+        builder.setNodeType(nodeType);
+        builder.setNodeParameter(nodeParameter);
+        updatePath(nodeParameter);
         builder.setPath(createActualSchemaPath(actualPath, namespace, revision,
                 yangModelPrefix));
         parseSchemaNodeArgs(ctx, builder);
index 736efe7efe9eb709ef73995c255ebc338728b71d..6f792a32467aff23b492aae9cade7f11c6ecbffb 100644 (file)
@@ -601,6 +601,9 @@ public class YangModelParserTest {
         ContainerSchemaNode network = (ContainerSchemaNode)testModule.getDataChildByName("network");
         List<UnknownSchemaNode> unknownNodes = network.getUnknownSchemaNodes();
         assertEquals(1, unknownNodes.size());
+        UnknownSchemaNode unknownNode = unknownNodes.get(0);
+        assertNotNull(unknownNode.getNodeType());
+        assertEquals("point", unknownNode.getNodeParameter());
     }
 
     @Test
diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/test/resources/abstract-topology.yang b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/test/resources/abstract-topology.yang
deleted file mode 100644 (file)
index dc7d0a9..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-module abstract-topology {
-    yang-version 1;
-    namespace "";
-    prefix "tp";
-
-    import ietf-inet-types { 
-        prefix "inet"; 
-        revision-date 2010-09-24;
-    }
-
-    organization "OPEN DAYLIGHT";
-    contact "http://www.opendaylight.org/";
-
-    description
-        "This module contains the definitions of elements that creates network 
-    topology i.e. definition of network nodes and links. This module is not designed to be used solely for network representation. This module SHOULD be used as base module in defining the network topology.";
-
-    revision "2013-02-08" {
-        reference "~~~ WILL BE DEFINED LATER";
-    }
-    
-    typedef node-id-ref {
-        type leafref {
-            path "/tp:topology/tp:network-nodes/tp:network-node/tp:node-id";
-        }
-        description "This type is used for leafs that reference network node instance.";
-    }
-
-    typedef link-id-ref {
-        type leafref {
-            path "/tp:topology/tp:network-links/tp:network-link/tp:link-id";
-        }
-        description "This type is used for leafs that reference network link instance.";
-    }
-
-    container topology {
-        description "This is the model of abstract topology which contains only Network Nodes and Network Links. Each topology MUST be identified by unique topology-id for reason that the store could contain many topologies.";
-
-        leaf topology-id {
-            type inet:uri;
-            description "It is presumed that datastore will contain many topologies. To distinguish between topologies it is vital to have
-            UNIQUE topology identifier.";
-        }
-
-        container network-nodes {
-            list network-node {
-                key "node-id";
-
-                leaf node-id {
-                    type inet:uri;
-                    description "The Topology identifier of network-node.";
-                }
-
-                container attributes {
-                    description "Aditional attributes that can Network Node contains.";
-                }
-                description "The list of network nodes defined for topology.";
-            }
-        }
-        
-        container network-links {
-            list network-link {
-                key "link-id";
-
-                leaf link-id {
-                    type inet:uri;
-                    description "";
-                }
-
-                container source-node {
-                    leaf id {
-                        type node-id-ref;
-                        description "Source node identifier.";
-                    }
-                }
-
-                container destination-node {
-                    leaf id {
-                        type node-id-ref;
-                        description "Destination node identifier.";
-                    }
-                }
-
-                container attributes {
-                    description "Aditional attributes that can Network Link contains.";
-                }
-                description "The Network Link which is defined by Local (Source) and Remote (Destination) Network Nodes. Every link MUST be defined either by identifier and
-                his local and remote Network Nodes (In real applications it is common that many links are originated from one node and end up in same remote node). To ensure that we would always know to distinguish between links, every link SHOULD have identifier.";
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/test/resources/test-model.yang b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/test/resources/test-model.yang
deleted file mode 100644 (file)
index 8127320..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-module test-model {
-       yang-version 1;
-       namespace "urn:cisco:params:xml:ns:yang:controller:network";
-       prefix "topos";
-
-       import ietf-inet-types { prefix "inet"; }
-       import iana-if-type {prefix "if-type";}
-       import mount {prefix "mnt";} 
-
-       organization "OPEN DAYLIGHT";
-    contact "http://www.opendaylight.org/";
-
-       description "module description";
-       reference "module reference";
-       
-       typedef topology-id {
-               type inet:uri;
-       }
-
-       typedef node-id {
-               type inet:uri;
-       }
-
-       typedef link-id {
-               type inet:uri;
-       }
-
-       typedef tp-id {
-               type inet:uri;
-               description "identifier for termination points on a port";
-       }
-
-       typedef tp-ref {
-               type leafref {
-                       path "/network/topologies/topology/nodes/node/termination-points/termination-point/tp-id";
-               }
-       }
-       typedef topology-ref {
-               type leafref {
-                       path "/network/topologies/topology/topology-id";
-               }
-               description "This type is used for leafs that reference topology identifier instance.";
-               // currently not used
-       }
-
-       typedef node-ref {
-               type leafref {
-                       path "/network/topologies/topology/nodes/node/node-id";
-               }
-               description "This type is used for leafs that reference a node instance.";
-       }
-
-       typedef link-ref {
-               type leafref {
-                       path "/network/topologies/topology/links/link/link-id";
-               }
-               description "This type is used for leafs that reference a link instance.";
-               // currently not used
-       }
-       
-       typedef network-element-ref {
-               type leafref {
-                       path "/network/network-elements/network-element/element-id";
-               }
-       }
-
-
-       typedef element-id {
-               type string;
-       }
-       
-       
-       container network {
-               description "network-description";
-               reference "network-reference";
-               status obsolete;
-               config true;
-               presence "some presence text";
-               
-               mnt:mountpoint point  {
-               mnt:target-ref target;
-               }
-               
-               leaf-list locked-node {
-               type instance-identifier;
-               min-elements 1;
-               when "a/b/c";
-               description "List of locked nodes in the running datastore";
-       }
-       
-       leaf locked-test {
-               mandatory true;
-       }
-       
-               container topologies {
-                       list topology {
-                               description "Test description of list 'topology'.";
-                               key "topology-id";
-                               leaf topology-id {
-                                       type topology-id; 
-                                       description "Test description of leaf 'topology-id'";
-                               }
-
-                               container nodes {
-                                       list node {
-                                               description "The list of network nodes defined for topology.";
-
-                                               key "node-id";
-                                               leaf node-id {
-                                                       type node-id;
-                                                       description "The Topology identifier of network-node.";
-                                               }
-
-                                               leaf supporting-ne {
-                                                       type network-element-ref;
-                                               }
-                                               
-                                               container termination-points {
-                                                       list termination-point {
-                                                               key "tp-id";
-                                                               leaf tp-id {
-                                                                       type tp-id;
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-               
-                               container links {
-                                       list link {
-                                               description "Test description of list 'link'.";
-                                               key "link-id";
-                                               leaf link-id {
-                                                       type link-id;
-                                                       description "";
-                                               }
-
-                                               container source { 
-                                                       leaf source-node {
-                                                               type node-ref;
-                                                               description "Source node identifier.";
-                                                       }
-                                                       leaf source-tp {
-                                                               type tp-ref;
-                                                       }
-                                               }
-                                       
-                                               container destination { 
-                                                       leaf dest-node {
-                                                               type node-ref;
-                                                               description "Destination node identifier.";
-                                                       }
-                                                       leaf dest-tp {
-                                                               type tp-ref;
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-       
-}
index f6f4ac7141d05553900748427e15a8296e15d1e5..0430b7ab453e58ebe842632957d5b61f72ed30c9 100644 (file)
@@ -7,6 +7,11 @@
  */
 package org.opendaylight.controller.yang.model.api;
 
+import org.opendaylight.controller.yang.common.QName;
+
 public interface UnknownSchemaNode extends SchemaNode {
 
+    QName getNodeType();
+    String getNodeParameter();
+
 }