Merge "Add support for enums as configuration attributes in config and netconf subsys...
[controller.git] / opendaylight / netconf / config-netconf-connector / src / test / java / org / opendaylight / controller / netconf / confignetconfconnector / NetconfMappingTest.java
index 80b903b..73d39c6 100644 (file)
@@ -132,10 +132,11 @@ public class NetconfMappingTest extends AbstractConfigTest {
         // check after edit
         commit();
         Element response = getConfigRunning();
-        System.err.println(XmlUtil.toString(response));
+
         checkBinaryLeafEdited(response);
         checkTypeConfigAttribute(response);
         checkTypedefs(response);
+        checkEnum(response);
 
         edit("netconfMessages/editConfig_remove.xml");
 
@@ -367,6 +368,26 @@ public class NetconfMappingTest extends AbstractConfigTest {
         assertEquals(1, children.getLength());
     }
 
+    private void checkEnum(final Element response) {
+        XmlElement modulesElement = XmlElement.fromDomElement(response).getOnlyChildElement("data")
+                .getOnlyChildElement("modules");
+
+        String enumName = "extended-enum";
+        String enumContent = "TWO";
+
+        for (XmlElement moduleElement : modulesElement.getChildElements("module")) {
+            String name = moduleElement.getOnlyChildElement("name").getTextContent();
+            if(name.equals("test1")) {
+                XmlElement enumAttr = moduleElement.getOnlyChildElement(enumName);
+                assertEquals(enumContent, enumAttr.getTextContent());
+
+                return;
+            }
+        }
+
+        fail("Enum attribute " + enumName + ":" + enumContent + " not present in " + XmlUtil.toString(response));
+    }
+
     private void checkTypeConfigAttribute(Element response) {
 
         XmlElement modulesElement = XmlElement.fromDomElement(response).getOnlyChildElement("data")

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.