test of namespace suplement (from xml) 64/2864/2
authorJozef Gloncak <jgloncak@cisco.com>
Tue, 19 Nov 2013 10:44:23 +0000 (11:44 +0100)
committerJozef Gloncak <jgloncak@cisco.com>
Tue, 19 Nov 2013 14:37:41 +0000 (15:37 +0100)
Change-Id: Ibc19654ab3decb6d9eb6a093cf0a00304503690b
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToCompositeNodeProvider.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyFuture.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/FromJsonToCompositeNode.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/FromXmlToCompositeNode.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-composite-node/data-container-yang/data-container.yang [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-composite-node/data-list-yang/data-container.yang [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-composite-node/data-list-yang/data-list.yang [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-composite-node/data-list.xml

index 07b30327f07d7c8d8723e79268d213702bc189b4..19720107d3b2e12a63e10cedec8ec173b7ea52e8 100644 (file)
@@ -20,10 +20,10 @@ import org.opendaylight.controller.sal.rest.api.RestconfService;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 
 @Provider
-@Consumes({API+RestconfService.XML})
+@Consumes({ API + RestconfService.XML })
 public enum XmlToCompositeNodeProvider implements MessageBodyReader<CompositeNode> {
     INSTANCE;
-    
+
     @Override
     public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
         return true;
@@ -37,8 +37,8 @@ public enum XmlToCompositeNodeProvider implements MessageBodyReader<CompositeNod
         try {
             return xmlReader.read(entityStream);
         } catch (XMLStreamException | UnsupportedFormatException e) {
-            throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)
-                    .entity(e.getMessage()).build());
+            throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage())
+                    .build());
         }
     }
 
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyFuture.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyFuture.java
new file mode 100644 (file)
index 0000000..a32a347
--- /dev/null
@@ -0,0 +1,35 @@
+package org.opendaylight.controller.sal.restconf.impl.test;
+
+import java.util.concurrent.*;
+
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+public class DummyFuture implements Future<RpcResult<TransactionStatus>> {
+
+    @Override
+    public boolean cancel(boolean mayInterruptIfRunning) {
+        return false;
+    }
+
+    @Override
+    public boolean isCancelled() {
+        return false;
+    }
+
+    @Override
+    public boolean isDone() {
+        return false;
+    }
+
+    @Override
+    public RpcResult<TransactionStatus> get() throws InterruptedException, ExecutionException {
+        return null;
+    }
+
+    @Override
+    public RpcResult<TransactionStatus> get(long timeout, TimeUnit unit) throws InterruptedException,
+            ExecutionException, TimeoutException {
+        return null;
+    }
+}
\ No newline at end of file
index 8e9334565d9b289cb3b79fffdf6d8c276fc047b3..dbbb4a69962d0af10f5def0e1964bef2918a37b0 100644 (file)
@@ -14,7 +14,7 @@ import java.util.concurrent.*;
 
 import javax.ws.rs.WebApplicationException;
 
-import org.junit.Test;
+import org.junit.*;
 import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider;
 import org.opendaylight.controller.sal.restconf.impl.*;
 import org.opendaylight.yangtools.yang.data.api.*;
@@ -27,41 +27,7 @@ import com.google.gson.JsonSyntaxException;
 
 public class FromJsonToCompositeNode {
 
-    /**
-     * 
-     * It is just dummy class which is used in mock method to specify return
-     * type
-     */
-    private class DummyFuture implements Future<RpcResult<TransactionStatus>> {
-
-        @Override
-        public boolean cancel(boolean mayInterruptIfRunning) {
-            return false;
-        }
-
-        @Override
-        public boolean isCancelled() {
-            return false;
-        }
-
-        @Override
-        public boolean isDone() {
-            return false;
-        }
-
-        @Override
-        public RpcResult<TransactionStatus> get() throws InterruptedException, ExecutionException {
-            return null;
-        }
-
-        @Override
-        public RpcResult<TransactionStatus> get(long timeout, TimeUnit unit) throws InterruptedException,
-                ExecutionException, TimeoutException {
-            return null;
-        }
-    };
-
-    Logger LOG = LoggerFactory.getLogger(FromJsonToCompositeNode.class);
+    private static Logger LOG = LoggerFactory.getLogger(FromJsonToCompositeNode.class);
 
     @Test
     public void simpleListTest() {
@@ -71,8 +37,8 @@ public class FromJsonToCompositeNode {
 
     @Test
     public void simpleContainerTest() {
-        simpleTest("/json-to-composite-node/simple-container.json", "/json-to-composite-node/simple-list-yang", "cont",
-                "simple:data:types");
+        simpleTest("/json-to-composite-node/simple-container.json", "/json-to-composite-node/simple-container-yang",
+                "cont", "simple:data:types");
     }
 
     /**
@@ -162,55 +128,22 @@ public class FromJsonToCompositeNode {
         CompositeNode compositeNode = compositeContainerFromJson(jsonPath);
         assertNotNull(compositeNode);
 
-        DataSchemaNode dataSchemaNode = obtainSchemaFromYang(yangPath);
-        assertNotNull(dataSchemaNode);
-
-        supplementNamespace(dataSchemaNode, compositeNode);
-
-        assertTrue(compositeNode instanceof CompositeNodeWrapper);
-        CompositeNode compNode = ((CompositeNodeWrapper) compositeNode).unwrap(null);
-
-        assertEquals(topLevelElementName, compNode.getNodeType().getLocalName());
-        verifyCompositeNode(compNode, namespace);
-    }
-
-    private DataSchemaNode obtainSchemaFromYang(String yangFolder) {
-        Set<Module> modules = null;
+        DataSchemaNode dataSchemaNode = null;
         try {
-            modules = TestUtils.loadModules(ToJsonBasicDataTypesTest.class.getResource(yangFolder).getPath());
+            dataSchemaNode = TestUtils.obtainSchemaFromYang(yangPath);
         } catch (FileNotFoundException e) {
             LOG.error(e.getMessage());
             assertTrue(false);
         }
+        assertNotNull(dataSchemaNode);
 
-        assertNotNull(modules);
-        assertEquals(1, modules.size());
-        Module module = modules.iterator().next();
-        assertNotNull(module.getChildNodes());
-        assertEquals(1, module.getChildNodes().size());
-        DataSchemaNode dataSchemaNode = module.getChildNodes().iterator().next();
-        return dataSchemaNode;
-    }
-
-    private void supplementNamespace(DataSchemaNode dataSchemaNode, CompositeNode compositeNode) {
-        RestconfImpl restconf = RestconfImpl.getInstance();
-
-        InstanceIdWithSchemaNode instIdAndSchema = new InstanceIdWithSchemaNode(mock(InstanceIdentifier.class),
-                dataSchemaNode);
-
-        ControllerContext controllerContext = mock(ControllerContext.class);
-        BrokerFacade broker = mock(BrokerFacade.class);
-
-        when(controllerContext.toInstanceIdentifier(any(String.class))).thenReturn(instIdAndSchema);
-        when(broker.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(
-                new DummyFuture());
+        TestUtils.supplementNamespace(dataSchemaNode, compositeNode);
 
-        restconf.setControllerContext(controllerContext);
-        restconf.setBroker(broker);
+        assertTrue(compositeNode instanceof CompositeNodeWrapper);
+        CompositeNode compNode = ((CompositeNodeWrapper) compositeNode).unwrap(null);
 
-        // method is called only because it contains call of method which
-        // supplement namespaces to compositeNode
-        restconf.createConfigurationData("something", compositeNode);
+        assertEquals(topLevelElementName, compNode.getNodeType().getLocalName());
+        verifyCompositeNode(compNode, namespace);
     }
 
     private void verityMultipleItemsInList(CompositeNode compositeNode) {
@@ -308,7 +241,7 @@ public class FromJsonToCompositeNode {
             assertTrue(compositeNode instanceof CompositeNodeWrapper);
             if (dummyNamespaces) {
                 try {
-                    addDummyNamespaceToAllNodes((CompositeNodeWrapper) compositeNode);
+                    TestUtils.addDummyNamespaceToAllNodes((CompositeNodeWrapper) compositeNode);
                     return ((CompositeNodeWrapper) compositeNode).unwrap(null);
                 } catch (URISyntaxException e) {
                     LOG.error(e.getMessage());
@@ -323,12 +256,4 @@ public class FromJsonToCompositeNode {
         return null;
     }
 
-    private void addDummyNamespaceToAllNodes(NodeWrapper<?> wrappedNode) throws URISyntaxException {
-        wrappedNode.setNamespace(new URI(""));
-        if (wrappedNode instanceof CompositeNodeWrapper) {
-            for (NodeWrapper<?> childNodeWrapper : ((CompositeNodeWrapper) wrappedNode).getValues()) {
-                addDummyNamespaceToAllNodes(childNodeWrapper);
-            }
-        }
-    }
 }
index 2d4097335e8f2bcd462e49de261b6f71033e0dde..093cac57d0a2427eb669164dd7873c8659b5fb9f 100644 (file)
@@ -5,16 +5,19 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.*;
+import java.net.URISyntaxException;
 
 import javax.ws.rs.WebApplicationException;
 
-import org.junit.Test;
+import org.junit.*;
 import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
+import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper;
 import org.opendaylight.yangtools.yang.data.api.*;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.slf4j.*;
 
 public class FromXmlToCompositeNode {
-    Logger LOG = LoggerFactory.getLogger(FromXmlToCompositeNode.class);
+    private static Logger LOG = LoggerFactory.getLogger(FromXmlToCompositeNode.class);
 
     /**
      * top level element represents container. second level element is list with
@@ -22,33 +25,68 @@ public class FromXmlToCompositeNode {
      */
     @Test
     public void testXmlDataContainer() {
-        CompositeNode compNode = compositeContainerFromXml("/xml-to-composite-node/data-container.xml");
-        verifyCommonPartAOfXml(compNode, "");
+        CompositeNode compNode = compositeContainerFromXml("/xml-to-composite-node/data-container.xml", false);
+        assertNotNull(compNode);
+        DataSchemaNode dataSchemaNode = null;
+        try {
+            dataSchemaNode = TestUtils.obtainSchemaFromYang("/xml-to-composite-node/data-container-yang");
+        } catch (FileNotFoundException e) {
+            LOG.error(e.getMessage());
+            assertTrue(false);
+        }
+
+        assertNotNull(dataSchemaNode);
+        TestUtils.supplementNamespace(dataSchemaNode, compNode);
+
+        String nameSpace = "data:container:yang";
+        assertEquals(nameSpace, compNode.getNodeType().getNamespace().toString());
+
+        verifyCommonPartAOfXml(compNode, "", nameSpace);
     }
 
     @Test
     public void testXmlDataList() {
-        CompositeNode compNode = compositeContainerFromXml("/xml-to-composite-node/data-list.xml");
+        CompositeNode compNode = compositeContainerFromXml("/xml-to-composite-node/data-list.xml", false);
         assertNotNull(compNode);
+
+        DataSchemaNode dataSchemaNode = null;
+        try {
+            dataSchemaNode = TestUtils.obtainSchemaFromYang("/xml-to-composite-node/data-list-yang",
+                    "data-container-yang");
+        } catch (FileNotFoundException e) {
+            LOG.error(e.getMessage());
+        }
+        assertNotNull(dataSchemaNode);
+        TestUtils.supplementNamespace(dataSchemaNode, compNode);
+
+        String nameSpaceList = "data:list:yang";
+        String nameSpaceCont = "data:container:yang";
+        assertEquals(nameSpaceCont, compNode.getNodeType().getNamespace().toString());
         assertEquals("cont", compNode.getNodeType().getLocalName());
-        assertEquals(2, compNode.getChildren().size());
+        assertEquals(3, compNode.getChildren().size());
         CompositeNode lst1_1 = null;
         CompositeNode lst1_2 = null;
         int loopCount = 0;
         for (Node<?> node : compNode.getChildren()) {
-            assertTrue(node instanceof CompositeNode);
-            switch (loopCount++) {
-            case 0:
-                lst1_1 = (CompositeNode) node;
-                break;
-            case 1:
-                lst1_2 = (CompositeNode) node;
-                break;
+            if (node.getNodeType().getLocalName().equals("lf1")) {
+                assertEquals(nameSpaceList, node.getNodeType().getNamespace().toString());
+                assertTrue(node instanceof SimpleNode<?>);
+                assertEquals("lf1", node.getValue());
+            } else {
+                assertTrue(node instanceof CompositeNode);
+                switch (loopCount++) {
+                case 0:
+                    lst1_1 = (CompositeNode) node;
+                    break;
+                case 1:
+                    lst1_2 = (CompositeNode) node;
+                    break;
+                }
+                assertEquals(nameSpaceCont, node.getNodeType().getNamespace().toString());
             }
-
         }
         // lst1_1
-        verifyCommonPartAOfXml(lst1_1, "1");
+        verifyCommonPartAOfXml(lst1_1, "1", nameSpaceCont);
         // :lst1_1
 
         // lst1_2
@@ -64,12 +102,14 @@ public class FromXmlToCompositeNode {
                 assertTrue(node instanceof CompositeNode);
                 cont11 = (CompositeNode) node;
             }
+            assertEquals(nameSpaceCont, compNode.getNodeType().getNamespace().toString());
         }
         assertEquals("221", lflst11.getValue());
 
         assertEquals(1, cont11.getChildren().size());
         assertTrue(cont11.getChildren().get(0) instanceof SimpleNode<?>);
         SimpleNode<?> cont11_lf111 = (SimpleNode<?>) cont11.getChildren().get(0);
+        assertEquals(nameSpaceCont, cont11_lf111.getNodeType().getNamespace().toString());
         assertEquals("lf111", cont11_lf111.getNodeType().getLocalName());
         assertEquals("100", cont11_lf111.getValue());
         // :lst1_2
@@ -78,7 +118,7 @@ public class FromXmlToCompositeNode {
 
     @Test
     public void testXmlEmptyData() {
-        CompositeNode compNode = compositeContainerFromXml("/xml-to-composite-node/empty-data.xml");
+        CompositeNode compNode = compositeContainerFromXml("/xml-to-composite-node/empty-data.xml", true);
         assertEquals("cont", compNode.getNodeType().getLocalName());
         SimpleNode<?> lf1 = null;
         SimpleNode<?> lflst1_1 = null;
@@ -122,7 +162,7 @@ public class FromXmlToCompositeNode {
 
     }
 
-    private void verifyCommonPartAOfXml(CompositeNode compNode, String suf) {
+    private void verifyCommonPartAOfXml(CompositeNode compNode, String suf, String nameSpace) {
         SimpleNode<?> lf1suf = null;
         SimpleNode<?> lflst1suf_1 = null;
         SimpleNode<?> lflst1suf_2 = null;
@@ -157,7 +197,9 @@ public class FromXmlToCompositeNode {
                 assertTrue(node instanceof CompositeNode);
                 cont1suf = (CompositeNode) node;
             }
+            assertEquals(nameSpace, node.getNodeType().getNamespace().toString());
         }
+
         assertNotNull(lf1suf);
         assertNotNull(lflst1suf_1);
         assertNotNull(lflst1suf_2);
@@ -174,20 +216,33 @@ public class FromXmlToCompositeNode {
 
         assertTrue(lst1suf.getChildren().get(0) instanceof SimpleNode<?>);
         SimpleNode<?> lst11_lf11 = (SimpleNode<?>) lst1suf.getChildren().get(0);
+        assertEquals(nameSpace, lst11_lf11.getNodeType().getNamespace().toString());
         assertEquals("lf11" + suf, lst11_lf11.getNodeType().getLocalName());
         assertEquals("str2", lst11_lf11.getValue());
 
         assertTrue(cont1suf.getChildren().get(0) instanceof SimpleNode<?>);
         SimpleNode<?> cont1_lf11 = (SimpleNode<?>) cont1suf.getChildren().get(0);
+        assertEquals(nameSpace, cont1_lf11.getNodeType().getNamespace().toString());
         assertEquals("lf11" + suf, cont1_lf11.getNodeType().getLocalName());
         assertEquals("100", cont1_lf11.getValue());
     }
 
-    private CompositeNode compositeContainerFromXml(String xmlPath) {
+    private CompositeNode compositeContainerFromXml(String xmlPath, boolean dummyNamespaces) {
         XmlToCompositeNodeProvider xmlToCompositeNodeProvider = XmlToCompositeNodeProvider.INSTANCE;
         try {
             InputStream xmlStream = FromXmlToCompositeNode.class.getResourceAsStream(xmlPath);
-            return xmlToCompositeNodeProvider.readFrom(null, null, null, null, null, xmlStream);
+            CompositeNode compositeNode = xmlToCompositeNodeProvider.readFrom(null, null, null, null, null, xmlStream);
+            if (dummyNamespaces) {
+                try {
+                    TestUtils.addDummyNamespaceToAllNodes((CompositeNodeWrapper) compositeNode);
+                    return ((CompositeNodeWrapper) compositeNode).unwrap(null);
+                } catch (URISyntaxException e) {
+                    LOG.error(e.getMessage());
+                    assertTrue(e.getMessage(), false);
+                }
+            }
+            return compositeNode;
+
         } catch (WebApplicationException | IOException e) {
             LOG.error(e.getMessage());
             assertTrue(false);
index 532e29df66dbe5962ab246e56b674710fede7622..3d06e4a759985f1eb938576b7bac10e9be9b8aae 100644 (file)
@@ -2,33 +2,30 @@ package org.opendaylight.controller.sal.restconf.impl.test;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import java.io.*;
 import java.net.*;
 import java.sql.Date;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 import javax.ws.rs.WebApplicationException;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.*;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
-import org.opendaylight.controller.sal.rest.impl.*;
-import org.opendaylight.controller.sal.restconf.impl.StructuredData;
+import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
+import org.opendaylight.controller.sal.restconf.impl.*;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.*;
-import org.opendaylight.yangtools.yang.data.impl.*;
+import org.opendaylight.yangtools.yang.data.impl.XmlTreeBuilder;
 import org.opendaylight.yangtools.yang.model.api.*;
 import org.opendaylight.yangtools.yang.model.parser.api.YangModelParser;
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.slf4j.*;
 import org.w3c.dom.Document;
 
 final class TestUtils {
@@ -265,4 +262,80 @@ final class TestUtils {
     static QName buildQName(String name) {
         return buildQName(name, "", null);
     }
+
+    static void supplementNamespace(DataSchemaNode dataSchemaNode, CompositeNode compositeNode) {
+        RestconfImpl restconf = RestconfImpl.getInstance();
+
+        InstanceIdWithSchemaNode instIdAndSchema = new InstanceIdWithSchemaNode(mock(InstanceIdentifier.class),
+                dataSchemaNode);
+
+        ControllerContext controllerContext = mock(ControllerContext.class);
+        BrokerFacade broker = mock(BrokerFacade.class);
+
+        when(controllerContext.toInstanceIdentifier(any(String.class))).thenReturn(instIdAndSchema);
+        when(broker.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(
+                new DummyFuture());
+
+        restconf.setControllerContext(controllerContext);
+        restconf.setBroker(broker);
+
+        // method is called only because it contains call of method which
+        // supplement namespaces to compositeNode
+        restconf.createConfigurationData("something", compositeNode);
+    }
+
+    static DataSchemaNode obtainSchemaFromYang(String yangFolder) throws FileNotFoundException {
+        return obtainSchemaFromYang(yangFolder, null);
+    }
+
+    static DataSchemaNode obtainSchemaFromYang(String yangFolder, String moduleName) throws FileNotFoundException {
+        Set<Module> modules = null;
+        modules = TestUtils.loadModules(ToJsonBasicDataTypesTest.class.getResource(yangFolder).getPath());
+
+        if (modules == null) {
+            return null;
+        }
+        if (modules.size() < 1) {
+            return null;
+        }
+        
+        Module moduleRes = null;        
+        if (modules.size() > 1) {
+            if (moduleName == null) {
+                return null;
+            } else {
+                for (Module module: modules) {
+                    if (module.getName().equals(moduleName)) {
+                        moduleRes = module; 
+                    }
+                }
+                if (moduleRes == null) {
+                    return null;
+                }
+            }
+        } else {
+            moduleRes = modules.iterator().next();
+        }
+        
+        if (moduleRes.getChildNodes() == null) {
+            return null;
+        }
+
+        if (moduleRes.getChildNodes().size() != 1) {
+            return null;
+        }
+        DataSchemaNode dataSchemaNode = moduleRes.getChildNodes().iterator().next();
+        return dataSchemaNode;
+
+    }
+
+    static void addDummyNamespaceToAllNodes(NodeWrapper<?> wrappedNode) throws URISyntaxException {
+        wrappedNode.setNamespace(new URI(""));
+        if (wrappedNode instanceof CompositeNodeWrapper) {
+            for (NodeWrapper<?> childNodeWrapper : ((CompositeNodeWrapper) wrappedNode).getValues()) {
+                addDummyNamespaceToAllNodes(childNodeWrapper);
+            }
+        }
+    }
+
 }
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-composite-node/data-container-yang/data-container.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-composite-node/data-container-yang/data-container.yang
new file mode 100644 (file)
index 0000000..7c17bf9
--- /dev/null
@@ -0,0 +1,26 @@
+module data-container-yang {
+  namespace "data:container:yang";  
+
+  prefix "dtconyg";
+  revision 2013-11-19 {    
+  }
+  
+  container cont {
+       leaf lf1 {
+               type string;
+       }
+       leaf-list lflst1 {
+               type string;
+       }
+       list lst1 {
+               leaf lf11 {
+                       type string;
+               } 
+       }
+       container cont1 {
+               leaf lf11 {
+                       type uint8;
+               }
+       }
+  }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-composite-node/data-list-yang/data-container.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-composite-node/data-list-yang/data-container.yang
new file mode 100644 (file)
index 0000000..3df3413
--- /dev/null
@@ -0,0 +1,28 @@
+module data-container-yang {
+  namespace "data:container:yang";  
+
+  prefix "dtconyg";
+  revision 2013-11-19 {    
+  }
+  
+  container cont {     
+         list lst1 {
+               leaf lf11 {
+                       type string;
+               }
+               leaf-list lflst11 {
+                       type string;
+               }
+               list lst11 {
+                       leaf lf111 {
+                               type string;
+                       } 
+               }
+               container cont11 {
+                       leaf lf111 {
+                               type uint8;
+                       }
+               }
+         }  
+  }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-composite-node/data-list-yang/data-list.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-composite-node/data-list-yang/data-list.yang
new file mode 100644 (file)
index 0000000..47e2a45
--- /dev/null
@@ -0,0 +1,22 @@
+module data-list-yang {
+  namespace "data:list:yang"; 
+  
+  prefix "dtlstyg";
+
+  import data-container-yang {
+       prefix "dtconyg";
+       revision-date 2013-11-19;
+  }
+  
+  
+  revision 2013-11-19 {    
+  }
+       
+
+
+  augment "/dtconyg:cont" {
+       leaf lf1 {
+               type string;
+       }
+  }    
+}
index 3fd8a4841a5441ce42f565dd08d2ad8031ce241b..cab23c656e7293329b7fd8d9073cc82f0723ce8f 100644 (file)
@@ -17,4 +17,5 @@
                        <lf111>100</lf111>
                </cont11>
        </lst1> 
+       <lf1>lf1</lf1>
 </cont>