YMS migration to onos-yangtool 1.10
Change-Id: I22ddf23f813840e0afec1e7713a86891f2a52f28
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ych/DefaultYangCodecHandlerTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ych/DefaultYangCodecHandlerTest.java
new file mode 100644
index 0000000..7a1c8ea
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ych/DefaultYangCodecHandlerTest.java
@@ -0,0 +1,1403 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ych;
+
+import org.junit.Test;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.CombinedOpParam;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.AsNum;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.Attributes;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.DefaultAttributes;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.Metric;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.PathId;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.Aigp;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.BgpParameters;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.DefaultAigp;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.DefaultBgpParameters;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.DefaultLocalPref;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.DefaultMultiExitDisc;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.DefaultOrigin;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.DefaultUnrecognizedAttributes;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.LocalPref;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.MultiExitDisc;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.Origin;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.UnrecognizedAttributes;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.aigp.AigpTlv;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.aigp.DefaultAigpTlv;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.bgpparameters.DefaultOptionalCapabilities;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.bgpparameters.OptionalCapabilities;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.bgpparameters.optionalcapabilities.Cparameters;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.bgpparameters.optionalcapabilities.DefaultCparameters;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.bgpparameters.optionalcapabilities.cparameters.As4BytesCapability;
+import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.bgpparameters.optionalcapabilities.cparameters.DefaultAs4BytesCapability;
+import org.onosproject.yang.gen.v1.ych.empty.container.rev20160524.EmptyContainerOpParam;
+import org.onosproject.yang.gen.v1.ych.empty.container.rev20160524.emptycontainer.EmptyContainer;
+import org.onosproject.yang.gen.v1.ydt.customs.supervisor.rev20160524.CustomssupervisorOpParam;
+import org.onosproject.yang.gen.v1.ydt.material.supervisor.rev20160524.MaterialsupervisorOpParam;
+import org.onosproject.yang.gen.v1.ydt.material.supervisor.rev20160524.materialsupervisor.DefaultSupervisor;
+import org.onosproject.yang.gen.v1.ydt.material.supervisor.rev20160524.materialsupervisor.Supervisor;
+import org.onosproject.yang.gen.v1.ydt.merchandiser.supervisor.rev20160524.MerchandisersupervisorOpParam;
+import org.onosproject.yang.gen.v1.ydt.root.rev20160524.LogisticsManagerOpParam;
+import org.onosproject.yang.gen.v1.ydt.trading.supervisor.rev20160524.TradingsupervisorOpParam;
+import org.onosproject.yms.app.ych.defaultcodecs.YangCodecRegistry;
+import org.onosproject.yms.app.ysr.DefaultYangSchemaRegistry;
+import org.onosproject.yms.app.ysr.TestYangSchemaNodeProvider;
+import org.onosproject.yms.ych.YangCompositeEncoding;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.onosproject.yms.ych.YangProtocolEncodingFormat.XML;
+import static org.onosproject.yms.ydt.YmsOperationType.QUERY_CONFIG_REQUEST;
+import static org.onosproject.yms.ydt.YmsOperationType.QUERY_REQUEST;
+
+/**
+ * Unit test case for default codec handler.
+ */
+public class DefaultYangCodecHandlerTest {
+ private TestYangSchemaNodeProvider testYangSchemaNodeProvider =
+ new TestYangSchemaNodeProvider();
+ private static final String AM_XML = "Incorrect XML generated: ";
+ private static final String AM_OBJ = "Incorrect object generated: ";
+ private static final String EMPTY_CONTAINER = "EmptyContainerOpParam";
+ private static final String LOGISTIC_MOD = "LogisticsManagerOpParam";
+ private static final String MERCHA_MOD = "MerchandisersupervisorOpParam";
+
+ /**
+ * Returns the xml string for customssupervisor module.
+ *
+ * @return the xml string for customssupervisor module
+ */
+ private static String customsXml() {
+ return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\">" +
+ "<customssupervisor xmlns=\"ydt.customs-supervisor\">" +
+ "<supervisor>Customssupervisor</supervisor>" +
+ "</customssupervisor>" +
+ "</filter>";
+ }
+
+ /**
+ * Returns the xml string for merchandisersupervisor module.
+ *
+ * @return the xml string for merchandisersupervisor module
+ */
+ private static String merchandXml() {
+ return "<config xmlns=\"ydt.root\">" +
+ "<merchandisersupervisor xmlns=\"ydt.Merchandiser-" +
+ "supervisor\">" +
+ "<supervisor>Merchandisersupervisor</supervisor>" +
+ "</merchandisersupervisor>" +
+ "</config>";
+ }
+
+ /**
+ * Returns the xml string for tradingsupervisor module.
+ *
+ * @return the xml string for tradingsupervisor module
+ */
+ private static String tradingXml() {
+ return "<config xmlns=\"ydt.root\">" +
+ "<tradingsupervisor xmlns=\"ydt.trading-supervisor\">" +
+ "<supervisor>Tradingsupervisor</supervisor>" +
+ "</tradingsupervisor>" +
+ "</config>";
+ }
+
+ /**
+ * Returns the xml string for customssupervisor module.
+ *
+ * @return the xml string for customssupervisor module
+ */
+ private static String customsCompositeXml() {
+ return "<filter xmlns=\"ydt.filter-type\"><customssupervisor " +
+ "xmlns=\"ydt.customs-supervisor\">" +
+ "<supervisor>Customssupervisor</supervisor>" +
+ "</customssupervisor></filter>";
+ }
+
+ /**
+ * Returns the xml string for customssupervisor module with filter-type.
+ *
+ * @return the xml string for customssupervisor module with filter-type
+ */
+ private static String customsEmptyXml() {
+ return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\">" +
+ "<customssupervisor xmlns=\"ydt.customs-supervisor\"/>" +
+ "</filter>";
+ }
+
+ /**
+ * Returns the xml string for materialsupervisor module.
+ *
+ * @return the xml string for materialsupervisor module
+ */
+ private static String materialXml() {
+ return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\">" +
+ "<materialsupervisor xmlns=\"ydt.material-supervisor\">" +
+ "<supervisor>" +
+ "<name>abc1</name><departmentId>xyz1</departmentId>" +
+ "</supervisor>" +
+ "<supervisor><name>abc2</name><departmentId>xyz2</departmentId>" +
+ "</supervisor>" +
+ "<supervisor><name>abc3</name><departmentId>xyz3</departmentId>" +
+ "</supervisor>" +
+ "<supervisor><name>abc4</name><departmentId>xyz4</departmentId>" +
+ "</supervisor>" +
+ "<supervisor><name>abc5</name><departmentId>xyz5</departmentId>" +
+ "</supervisor>" +
+ "</materialsupervisor>" +
+ "</filter>";
+ }
+
+ /**
+ * Returns the xml string for EmptyContainer module.
+ *
+ * @return the xml string for EmptyContainer module
+ */
+ private static String containerEmptyXml() {
+ return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\">" +
+ "<EmptyContainer xmlns=\"ych.Empty.Container\"/>" +
+ "</filter>";
+ }
+
+ /**
+ * Returns the xml string for Combined module.
+ *
+ * @return the xml string for Combined module
+ */
+ private static String listTestXml() {
+ return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\">" +
+ "<Combined xmlns=\"ych:combined\"><attributes>" +
+ "<origin><value>123</value></origin>" +
+ "<multi-exit-disc><med>456</med></multi-exit-disc>" +
+ "<local-pref><pref>23</pref></local-pref>" +
+ "<aigp><aigp-tlv><metric>456</metric></aigp-tlv></aigp>" +
+ "<unrecognized-attributes><partial>false</partial>" +
+ "<transitive>false</transitive><type>1</type>" +
+ "<value>QUJD</value></unrecognized-attributes>" +
+ "<unrecognized-attributes><partial>true</partial>" +
+ "<transitive>true</transitive><type>2</type>" +
+ "<value>QUJD</value></unrecognized-attributes>" +
+ "<unrecognized-attributes><partial>true</partial>" +
+ "<transitive>false</transitive><type>3</type>" +
+ "<value>QUJD</value></unrecognized-attributes>" +
+ "<unrecognized-attributes><partial>false</partial>" +
+ "<transitive>true</transitive><type>4</type>" +
+ "<value>QUJD</value></unrecognized-attributes>" +
+ "<bgp-parameters><optional-capabilities><c-parameters>" +
+ "<as4-bytes-capability><as-number>11</as-number>" +
+ "</as4-bytes-capability></c-parameters>" +
+ "</optional-capabilities><optional-capabilities>" +
+ "<c-parameters><as4-bytes-capability>" +
+ "<as-number>22</as-number></as4-bytes-capability>" +
+ "</c-parameters></optional-capabilities>" +
+ "<optional-capabilities><c-parameters><as4-bytes-capability>" +
+ "<as-number>33</as-number></as4-bytes-capability>" +
+ "</c-parameters></optional-capabilities></bgp-parameters>" +
+ "<bgp-parameters><optional-capabilities><c-parameters>" +
+ "<as4-bytes-capability><as-number>11</as-number>" +
+ "</as4-bytes-capability></c-parameters>" +
+ "</optional-capabilities><optional-capabilities>" +
+ "<c-parameters><as4-bytes-capability>" +
+ "<as-number>22</as-number></as4-bytes-capability>" +
+ "</c-parameters></optional-capabilities>" +
+ "<optional-capabilities><c-parameters><as4-bytes-capability>" +
+ "<as-number>33</as-number></as4-bytes-capability>" +
+ "</c-parameters></optional-capabilities>" +
+ "</bgp-parameters></attributes></Combined></filter>";
+ }
+
+ /**
+ * Returns the xml string for ych-purchasingsupervisor module.
+ *
+ * @return the xml string for ych-purchasingsupervisor module
+ */
+ private static String purchaseXml() {
+ return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\">" +
+ "<ych-purchasingsupervisor xmlns=\"ych.purchasing-supervisor\">" +
+ "<ych-purchasing-supervisor operation=\"create\">" +
+ "<ych-purchasing-specialist>purchasingSpecialist" +
+ "</ych-purchasing-specialist>" +
+ "<ych-purchasing-support>support</ych-purchasing-support>" +
+ "</ych-purchasing-supervisor>" +
+ "</ych-purchasingsupervisor>" +
+ "</filter>";
+ }
+
+ /**
+ * Returns the xml string for employeeid module.
+ *
+ * @return the xml string for employeeid module
+ */
+ private static String emplyIdXml() {
+ return "<config xmlns=\"ydt.root\">" +
+ "<employeeid xmlns=\"ydt.employee-id\">" +
+ "<employeeid>Employ1</employeeid>" +
+ "<employeeid>Employ2</employeeid>" +
+ "<employeeid>Employ3</employeeid>" +
+ "<employeeid>Employ4</employeeid>" +
+ "<employeeid>Employ5</employeeid>" +
+ "</employeeid>" +
+ "</config>";
+ }
+
+ /**
+ * Returns the xml string for warehousesupervisor module.
+ *
+ * @return the xml string for warehousesupervisor module
+ */
+ private static String wareHseXml() {
+ return "<config xmlns=\"ydt.root\">" +
+ "<warehousesupervisor xmlns=\"ydt.warehouse-supervisor\">" +
+ "<supervisor>supervisor1</supervisor>" +
+ "<supervisor>supervisor2</supervisor>" +
+ "<supervisor>supervisor3</supervisor>" +
+ "<supervisor>supervisor4</supervisor>" +
+ "<supervisor>supervisor5</supervisor>" +
+ "</warehousesupervisor>" +
+ "</config>";
+ }
+
+ /**
+ * Returns the xml string for more than one module.
+ *
+ * @return the xml string for more than one module
+ */
+ private static String multiModuleXml() {
+ return "<config xmlns=\"ydt.root\">" +
+ "<customssupervisor xmlns=\"ydt.customs-supervisor\">" +
+ "<supervisor>Customssupervisor</supervisor>" +
+ "</customssupervisor>" +
+ "<merchandisersupervisor xmlns=\"ydt.Merchandiser-supervisor\">" +
+ "<supervisor>Merchandisersupervisor</supervisor>" +
+ "</merchandisersupervisor>" +
+ "<materialsupervisor xmlns=\"ydt.material-supervisor\">" +
+ "<supervisor>" +
+ "<name>abc1</name>" +
+ "<departmentId>xyz1</departmentId>" +
+ "</supervisor>" +
+ "<supervisor>" +
+ "<name>abc2</name>" +
+ "<departmentId>xyz2</departmentId>" +
+ "</supervisor>" +
+ "<supervisor>" +
+ "<name>abc3</name>" +
+ "<departmentId>xyz3</departmentId>" +
+ "</supervisor>" +
+ "<supervisor>" +
+ "<name>abc4</name>" +
+ "<departmentId>xyz4</departmentId>" +
+ "</supervisor>" +
+ "<supervisor>" +
+ "<name>abc5</name>" +
+ "<departmentId>xyz5</departmentId>" +
+ "</supervisor>" +
+ "</materialsupervisor>" +
+ "<ych-purchasingsupervisor xmlns=\"ych.purchasing-supervisor\">" +
+ "<ych-purchasing-supervisor>" +
+ "<ych-purchasing-specialist>purchasingSpecialist" +
+ "</ych-purchasing-specialist>" +
+ "<ych-purchasing-support>support</ych-purchasing-support>" +
+ "</ych-purchasing-supervisor>" +
+ "</ych-purchasingsupervisor>" +
+ "<warehousesupervisor xmlns=\"ydt.warehouse-supervisor\">" +
+ "<supervisor>supervisor1</supervisor>" +
+ "<supervisor>supervisor2</supervisor>" +
+ "<supervisor>supervisor3</supervisor>" +
+ "<supervisor>supervisor4</supervisor>" +
+ "<supervisor>supervisor5</supervisor>" +
+ "</warehousesupervisor>" +
+ "<tradingsupervisor xmlns=\"ydt.trading-supervisor\">" +
+ "<supervisor>Tradingsupervisor</supervisor>" +
+ "</tradingsupervisor>" +
+ "<employeeid xmlns=\"ydt.employee-id\">" +
+ "<employeeid>Employ1</employeeid>" +
+ "<employeeid>Employ2</employeeid>" +
+ "<employeeid>Employ3</employeeid>" +
+ "<employeeid>Employ4</employeeid>" +
+ "<employeeid>Employ5</employeeid>" +
+ "</employeeid>" +
+ "</config>";
+ }
+
+ /**
+ * Unit test case in which verifying xml string for module object with leaf
+ * for composite encode.
+ */
+ @Test
+ public void proceessCodecHandlerForCompositeEnc() {
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry schemaRegistry = testYangSchemaNodeProvider
+ .getDefaultYangSchemaRegistry();
+
+ // Creating the object
+ Object object = CustomssupervisorOpParam.builder()
+ .supervisor("Customssupervisor").build();
+
+ // Get the xml string and compare
+ Map<String, String> tagAttr = new HashMap<String, String>();
+ tagAttr.put("type", "subtree");
+
+ YangCodecRegistry.initializeDefaultCodec();
+ DefaultYangCodecHandler defaultYangCodecHandler =
+ new DefaultYangCodecHandler(schemaRegistry);
+ YangCompositeEncoding xml =
+ defaultYangCodecHandler
+ .encodeCompositeOperation("filter", "ydt.filter-type",
+ object, XML, null);
+
+ assertNull("customs-super: resource id not null",
+ xml.getResourceIdentifier());
+ assertEquals(AM_XML + "customs-super: comp res info",
+ customsCompositeXml(), xml.getResourceInformation());
+
+ // Creating the object
+ object = MerchandisersupervisorOpParam.builder()
+ .supervisor("Merchandisersupervisor").build();
+
+ // Get the xml string and compare
+ xml = defaultYangCodecHandler.encodeCompositeOperation("config",
+ "ydt.root",
+ object, XML,
+ null);
+ assertNull("merch-super: res id not null", xml.getResourceIdentifier());
+ assertEquals(AM_XML + "merch-super: comp res info",
+ merchandXml(), xml.getResourceInformation());
+
+ // Creating the object
+ object = TradingsupervisorOpParam.builder()
+ .supervisor("Tradingsupervisor").build();
+
+ // Get the xml string and compare
+ xml = defaultYangCodecHandler
+ .encodeCompositeOperation("config", "ydt.root", object, XML,
+ null);
+ assertNull("trading-super: res id not null",
+ xml.getResourceIdentifier());
+ assertEquals(AM_XML + "trading-super: comp res info",
+ tradingXml(), xml.getResourceInformation());
+ }
+
+ /**
+ * Unit test case in which verifying xml string for module object with leaf.
+ */
+ @Test
+ public void proceessCodecHandlerForLeaf() {
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry schemaRegistry = testYangSchemaNodeProvider
+ .getDefaultYangSchemaRegistry();
+ List<Object> yangModuleList = new ArrayList<>();
+
+ // Creating the object
+ Object object = CustomssupervisorOpParam.builder()
+ .supervisor("Customssupervisor").build();
+ yangModuleList.add(object);
+
+ // Get the xml string and compare
+ Map<String, String> tagAttr = new HashMap<String, String>();
+ tagAttr.put("type", "subtree");
+
+ YangCodecRegistry.initializeDefaultCodec();
+ DefaultYangCodecHandler defaultYangCodecHandler =
+ new DefaultYangCodecHandler(schemaRegistry);
+ String xml =
+ defaultYangCodecHandler.encodeOperation("filter",
+ "ydt.filter-type",
+ tagAttr, yangModuleList,
+ XML, null);
+
+ assertEquals(AM_XML + "customs-super: leaf info", customsXml(), xml);
+
+ // Creating the object
+ object = MerchandisersupervisorOpParam.builder()
+ .supervisor("Merchandisersupervisor").build();
+ yangModuleList.clear();
+ yangModuleList.add(object);
+
+ // Get the xml string and compare
+ xml = defaultYangCodecHandler.encodeOperation("config", "ydt.root",
+ null, yangModuleList,
+ XML, null);
+ assertEquals(AM_XML + "merchandiser-super: leaf info", merchandXml(),
+ xml);
+
+ // Creating the object
+ object = TradingsupervisorOpParam.builder()
+ .supervisor("Tradingsupervisor").build();
+ yangModuleList.clear();
+ yangModuleList.add(object);
+
+ // Get the xml string and compare
+ xml = defaultYangCodecHandler.encodeOperation("config", "ydt.root",
+ null, yangModuleList,
+ XML, null);
+ assertEquals(AM_XML + "trading-super: leaf info", tradingXml(), xml);
+ }
+
+ /**
+ * Unit test case in which verifying xml string for module object with
+ * empty leaf.
+ */
+ @Test
+ public void proceessCodecHandlerForEmptyLeaf() {
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry schemaRegistry = testYangSchemaNodeProvider
+ .getDefaultYangSchemaRegistry();
+ List<Object> yangModuleList = new ArrayList<>();
+
+ // Creating the object
+ Object object = CustomssupervisorOpParam.builder().supervisor("")
+ .build();
+ yangModuleList.add(object);
+
+ // Get the xml string and compare
+ Map<String, String> tagAttr = new HashMap<String, String>();
+ tagAttr.put("type", "subtree");
+
+ YangCodecRegistry.initializeDefaultCodec();
+ DefaultYangCodecHandler codecHandler =
+ new DefaultYangCodecHandler(schemaRegistry);
+ String xml = codecHandler.encodeOperation("filter", "ydt.filter-type",
+ tagAttr, yangModuleList,
+ XML, null);
+
+ assertEquals(AM_XML + "customs-super: leaf is not empty",
+ customsEmptyXml(), xml);
+ }
+
+ /**
+ * Unit test case in which verifying xml string for module object with list.
+ */
+ @Test
+ public void proceessCodecHandlerForList() {
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry schemaRegistry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+ List<Object> yangModuleList = new ArrayList<>();
+
+ // Creating the object
+ Supervisor supervisor1 = new DefaultSupervisor.SupervisorBuilder()
+ .name("abc1").departmentId("xyz1").build();
+ Supervisor supervisor2 = new DefaultSupervisor.SupervisorBuilder()
+ .name("abc2").departmentId("xyz2").build();
+ Supervisor supervisor3 = new DefaultSupervisor.SupervisorBuilder()
+ .name("abc3").departmentId("xyz3").build();
+ Supervisor supervisor4 = new DefaultSupervisor.SupervisorBuilder()
+ .name("abc4").departmentId("xyz4").build();
+ Supervisor supervisor5 = new DefaultSupervisor.SupervisorBuilder()
+ .name("abc5").departmentId("xyz5").build();
+
+ Object object = MaterialsupervisorOpParam.builder()
+ .addToSupervisor(supervisor1)
+ .addToSupervisor(supervisor2)
+ .addToSupervisor(supervisor3)
+ .addToSupervisor(supervisor4)
+ .addToSupervisor(supervisor5).build();
+
+ yangModuleList.add(object);
+
+ // Get the xml string and compare
+ Map<String, String> tagAttr = new HashMap<String, String>();
+ tagAttr.put("type", "subtree");
+
+ YangCodecRegistry.initializeDefaultCodec();
+ DefaultYangCodecHandler codecHandler =
+ new DefaultYangCodecHandler(schemaRegistry);
+ String xml = codecHandler.encodeOperation("filter", "ydt.filter-type",
+ tagAttr, yangModuleList,
+ XML, null);
+ assertEquals(AM_XML + "material-super: list info", materialXml(), xml);
+ }
+
+ /**
+ * Unit test case in which verifying xml string for module object with
+ * empty container.
+ */
+ @Test
+ public void proceessCodecHandlerForEmptyContainer() {
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry schemaRegistry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+ List<Object> yangModuleList = new ArrayList<>();
+
+ // Creating the object
+ EmptyContainer emptyContainer = EmptyContainerOpParam.builder()
+ .emptyContainer();
+ Object object = EmptyContainerOpParam.builder()
+ .emptyContainer(emptyContainer).build();
+
+ yangModuleList.add(object);
+
+ // Get the xml string and compare
+ Map<String, String> tagAttr = new HashMap<String, String>();
+ tagAttr.put("type", "subtree");
+
+ YangCodecRegistry.initializeDefaultCodec();
+ DefaultYangCodecHandler codecHandler =
+ new DefaultYangCodecHandler(schemaRegistry);
+ String xml = codecHandler.encodeOperation("filter", "ydt.filter-type",
+ tagAttr, yangModuleList,
+ XML, null);
+ assertEquals(AM_XML + "empty-contain: container is not empty",
+ containerEmptyXml(), xml);
+ }
+
+ /**
+ * Unit test case in which verifying xml string for module object with list
+ * inside list.
+ */
+ @Test
+ public void proceessCodecHandlerForListInsideList() {
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry schemaRegistry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+ List<Object> yangModuleList = new ArrayList<>();
+
+ // Creating the object
+ PathId pathId = new PathId(123);
+ Origin origin = new DefaultOrigin.OriginBuilder().value(pathId)
+ .build();
+ MultiExitDisc multiExitDisc = new DefaultMultiExitDisc
+ .MultiExitDiscBuilder().med(456).build();
+ LocalPref localPref = new DefaultLocalPref.LocalPrefBuilder()
+ .pref(23).build();
+ Metric metric = new Metric(456);
+ AigpTlv aigpTlv = new DefaultAigpTlv.AigpTlvBuilder().metric(metric)
+ .build();
+ Aigp aigp = new DefaultAigp.AigpBuilder().aigpTlv(aigpTlv).build();
+
+ UnrecognizedAttributes unrecognizedAttributes1 =
+ new DefaultUnrecognizedAttributes
+ .UnrecognizedAttributesBuilder()
+ .partial(false).transitive(false).type((short) 1)
+ .value("ABC".getBytes()).build();
+
+ UnrecognizedAttributes unrecognizedAttributes2 =
+ new DefaultUnrecognizedAttributes
+ .UnrecognizedAttributesBuilder()
+ .partial(true).transitive(true).type((short) 2)
+ .value("ABC".getBytes())
+ .build();
+
+ UnrecognizedAttributes unrecognizedAttributes3 =
+ new DefaultUnrecognizedAttributes
+ .UnrecognizedAttributesBuilder()
+ .partial(true).transitive(false).type((short) 3)
+ .value("ABC".getBytes())
+ .build();
+
+ UnrecognizedAttributes unrecognizedAttributes4 =
+ new DefaultUnrecognizedAttributes
+ .UnrecognizedAttributesBuilder()
+ .partial(false).transitive(true).type((short) 4)
+ .value("ABC".getBytes()).build();
+
+ AsNum asNum1 = new AsNum(11);
+ As4BytesCapability as4BytesCapability1 =
+ new DefaultAs4BytesCapability.As4BytesCapabilityBuilder()
+ .asNumber(asNum1).build();
+ Cparameters cparameters1 = new DefaultCparameters.CparametersBuilder()
+ .as4BytesCapability(as4BytesCapability1)
+ .build();
+ OptionalCapabilities optionalCapabilities1 =
+ new DefaultOptionalCapabilities.OptionalCapabilitiesBuilder()
+ .cParameters(cparameters1).build();
+
+ AsNum asNum2 = new AsNum(22);
+ As4BytesCapability as4BytesCapability2 =
+ new DefaultAs4BytesCapability.As4BytesCapabilityBuilder()
+ .asNumber(asNum2).build();
+ Cparameters cparameters2 = new DefaultCparameters.CparametersBuilder()
+ .as4BytesCapability(as4BytesCapability2)
+ .build();
+ OptionalCapabilities optionalCapabilities2 =
+ new DefaultOptionalCapabilities.OptionalCapabilitiesBuilder()
+ .cParameters(cparameters2).build();
+
+ AsNum asNum3 = new AsNum(33);
+ As4BytesCapability as4BytesCapability3 =
+ new DefaultAs4BytesCapability.As4BytesCapabilityBuilder()
+ .asNumber(asNum3).build();
+ Cparameters cparameters3 = new DefaultCparameters.CparametersBuilder()
+ .as4BytesCapability(as4BytesCapability3)
+ .build();
+ OptionalCapabilities optionalCapabilities3 =
+ new DefaultOptionalCapabilities.OptionalCapabilitiesBuilder()
+ .cParameters(cparameters3).build();
+
+ BgpParameters bgpParameters1 =
+ new DefaultBgpParameters.BgpParametersBuilder()
+ .addToOptionalCapabilities(optionalCapabilities1)
+ .addToOptionalCapabilities(optionalCapabilities2)
+ .addToOptionalCapabilities(optionalCapabilities3)
+ .build();
+
+ AsNum asNum4 = new AsNum(11);
+ As4BytesCapability as4BytesCapability4 = new DefaultAs4BytesCapability
+ .As4BytesCapabilityBuilder()
+ .asNumber(asNum4).build();
+ Cparameters cparameters4 = new DefaultCparameters.CparametersBuilder()
+ .as4BytesCapability(as4BytesCapability4)
+ .build();
+ OptionalCapabilities optionalCapabilities4 =
+ new DefaultOptionalCapabilities.OptionalCapabilitiesBuilder()
+ .cParameters(cparameters4).build();
+
+ AsNum asNum5 = new AsNum(22);
+ As4BytesCapability as4BytesCapability5 =
+ new DefaultAs4BytesCapability.As4BytesCapabilityBuilder()
+ .asNumber(asNum5).build();
+ Cparameters cparameters5 =
+ new DefaultCparameters.CparametersBuilder()
+ .as4BytesCapability(as4BytesCapability5)
+ .build();
+ OptionalCapabilities optionalCapabilities5 =
+ new DefaultOptionalCapabilities.OptionalCapabilitiesBuilder()
+ .cParameters(cparameters5).build();
+
+ AsNum asNum6 = new AsNum(33);
+ As4BytesCapability as4BytesCapability6 =
+ new DefaultAs4BytesCapability.As4BytesCapabilityBuilder()
+ .asNumber(asNum6).build();
+ Cparameters cparameters6 =
+ new DefaultCparameters.CparametersBuilder()
+ .as4BytesCapability(as4BytesCapability6)
+ .build();
+ OptionalCapabilities optionalCapabilities6 =
+ new DefaultOptionalCapabilities.OptionalCapabilitiesBuilder()
+ .cParameters(cparameters6).build();
+
+ BgpParameters bgpParameters2 =
+ new DefaultBgpParameters.BgpParametersBuilder()
+ .addToOptionalCapabilities(optionalCapabilities4)
+ .addToOptionalCapabilities(optionalCapabilities5)
+ .addToOptionalCapabilities(optionalCapabilities6)
+ .build();
+
+ Attributes attributes = new DefaultAttributes.AttributesBuilder()
+ .origin(origin)
+ .multiExitDisc(multiExitDisc)
+ .localPref(localPref)
+ .aigp(aigp)
+ .addToUnrecognizedAttributes(unrecognizedAttributes1)
+ .addToUnrecognizedAttributes(unrecognizedAttributes2)
+ .addToUnrecognizedAttributes(unrecognizedAttributes3)
+ .addToUnrecognizedAttributes(unrecognizedAttributes4)
+ .addToBgpParameters(bgpParameters1)
+ .addToBgpParameters(bgpParameters2).build();
+ Object object = CombinedOpParam.builder().attributes(attributes)
+ .build();
+
+ yangModuleList.add(object);
+
+ // Get the xml string and compare
+ Map<String, String> tagAttr = new HashMap<String, String>();
+ tagAttr.put("type", "subtree");
+
+ YangCodecRegistry.initializeDefaultCodec();
+ DefaultYangCodecHandler codecHandler =
+ new DefaultYangCodecHandler(schemaRegistry);
+ String xml = codecHandler.encodeOperation("filter", "ydt.filter-type",
+ tagAttr, yangModuleList,
+ XML, null);
+ assertEquals(AM_XML + "combined: list info", listTestXml(), xml);
+ }
+
+ //TODO negative scenario will be handled later
+// /**
+// * Unit test case in which verifying xml string for module object with
+// * container.
+// */
+// @Test
+// public void proceessCodecHandlerForContainer() {
+// testYangSchemaNodeProvider.processSchemaRegistry(null);
+// DefaultYangSchemaRegistry schemaRegistry =
+// testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+// List<Object> yangModuleList = new ArrayList<>();
+//
+// // Creating the object
+// YchPurchasingSupervisor supervisor =
+// new DefaultYchPurchasingSupervisor
+// .YchPurchasingSupervisorBuilder()
+// .ychPurchasingSpecialist("purchasingSpecialist")
+// .ychPurchasingSupport("support")
+// .yangYchPurchasingSupervisorOpType(CREATE).build();
+// Object object = YchPurchasingsupervisorOpParam.builder()
+// .ychPurchasingSupervisor(supervisor).build();
+// yangModuleList.add(object);
+//
+// // Get the xml string and compare
+// Map<String, String> tagAttr = new HashMap<String, String>();
+// tagAttr.put("type", "subtree");
+//
+// YangCodecRegistry.initializeDefaultCodec();
+// DefaultYangCodecHandler codecHandler =
+// new DefaultYangCodecHandler(schemaRegistry);
+// String xml = codecHandler.encodeOperation("filter", "ydt.filter-type",
+// tagAttr, yangModuleList,
+// XML, null);
+// assertEquals(AM_XML + "puchas-super: container info", purchaseXml(),
+// xml);
+// }
+
+// /**
+// * Unit test case in which verifying xml string for module object with
+// * leaf list.
+// */
+// @Test
+// public void proceessCodecHandlerForLeafList() {
+// testYangSchemaNodeProvider.processSchemaRegistry(null);
+// DefaultYangSchemaRegistry schemaRegistry =
+// testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+// List<Object> yangModuleList = new ArrayList<>();
+//
+// // Creating the object
+// EmployeeidOpParam.EmployeeidBuilder employeeidBuilder =
+// EmployeeidOpParam.builder();
+// employeeidBuilder.addToEmployeeid("Employ1");
+// employeeidBuilder.addToEmployeeid("Employ2");
+// employeeidBuilder.addToEmployeeid("Employ3");
+// employeeidBuilder.addToEmployeeid("Employ4");
+// employeeidBuilder.addToEmployeeid("Employ5");
+//
+// Object object = employeeidBuilder.build();
+// yangModuleList.add(object);
+//
+// // Get the xml string and compare
+// YangCodecRegistry.initializeDefaultCodec();
+// DefaultYangCodecHandler codecHandler =
+// new DefaultYangCodecHandler(schemaRegistry);
+// String xml = codecHandler.encodeOperation("config", "ydt.root", null,
+// yangModuleList, XML, null);
+// assertEquals(AM_XML + "employ-id: leaf-list info", emplyIdXml(), xml);
+// WarehousesupervisorOpParam.WarehousesupervisorBuilder warehsebldr =
+// WarehousesupervisorOpParam.builder();
+// warehsebldr.addToSupervisor("supervisor1");
+// warehsebldr.addToSupervisor("supervisor2");
+// warehsebldr.addToSupervisor("supervisor3");
+// warehsebldr.addToSupervisor("supervisor4");
+// warehsebldr.addToSupervisor("supervisor5");
+//
+// object = warehsebldr.build();
+// yangModuleList.clear();
+// yangModuleList.add(object);
+//
+//
+// // Get the xml string and compare
+// xml = codecHandler.encodeOperation("config", "ydt.root", null,
+// yangModuleList, XML, null);
+//
+// assertEquals(AM_XML + "warehouse-super: leaf-list info", wareHseXml(),
+// xml);
+// }
+
+// /**
+// * Unit test case in which verifying xml string for multiple module object.
+// */
+// @Test
+// public void proceessCodecHandlerForMultipleModule() {
+// testYangSchemaNodeProvider.processSchemaRegistry(null);
+// DefaultYangSchemaRegistry schemaRegistry =
+// testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+//
+// List<Object> yangModuleList = new ArrayList<>();
+// YangCodecRegistry.initializeDefaultCodec();
+// DefaultYangCodecHandler codecHandler =
+// new DefaultYangCodecHandler(schemaRegistry);
+//
+// // Creating the object for customssupervisor module
+// Object object = CustomssupervisorOpParam.builder()
+// .supervisor("Customssupervisor").build();
+// yangModuleList.add(object);
+//
+// // Creating the object for merchandisersupervisor module
+// object = MerchandisersupervisorOpParam.builder()
+// .supervisor("Merchandisersupervisor").build();
+// yangModuleList.add(object);
+//
+// // Creating the object for materialsupervisor module
+// Supervisor supervisor1 = new DefaultSupervisor.SupervisorBuilder()
+// .name("abc1").departmentId("xyz1").build();
+// Supervisor supervisor2 = new DefaultSupervisor.SupervisorBuilder()
+// .name("abc2").departmentId("xyz2").build();
+// Supervisor supervisor3 = new DefaultSupervisor.SupervisorBuilder()
+// .name("abc3").departmentId("xyz3").build();
+// Supervisor supervisor4 = new DefaultSupervisor.SupervisorBuilder()
+// .name("abc4").departmentId("xyz4").build();
+// Supervisor supervisor5 = new DefaultSupervisor.SupervisorBuilder()
+// .name("abc5").departmentId("xyz5").build();
+//
+// object = MaterialsupervisorOpParam.builder()
+// .addToSupervisor(supervisor1)
+// .addToSupervisor(supervisor2)
+// .addToSupervisor(supervisor3)
+// .addToSupervisor(supervisor4)
+// .addToSupervisor(supervisor5).build();
+//
+// yangModuleList.add(object);
+//
+// // Creating the object for YchPurchasingsupervisor module
+// YchPurchasingSupervisor purSupervisor =
+// new DefaultYchPurchasingSupervisor
+// .YchPurchasingSupervisorBuilder()
+// .ychPurchasingSpecialist("purchasingSpecialist")
+// .ychPurchasingSupport("support").build();
+// object = YchPurchasingsupervisorOpParam.builder()
+// .ychPurchasingSupervisor(purSupervisor).build();
+// yangModuleList.add(object);
+//
+// // Creating the object for warehousesupervisor module
+// WarehousesupervisorOpParam.WarehousesupervisorBuilder warehsebldr =
+// WarehousesupervisorOpParam.builder();
+// warehsebldr.addToSupervisor("supervisor1");
+// warehsebldr.addToSupervisor("supervisor2");
+// warehsebldr.addToSupervisor("supervisor3");
+// warehsebldr.addToSupervisor("supervisor4");
+// warehsebldr.addToSupervisor("supervisor5");
+//
+// object = warehsebldr.build();
+// yangModuleList.add(object);
+//
+// // Creating the object for tradingsupervisor module
+// object = TradingsupervisorOpParam.builder()
+// .supervisor("Tradingsupervisor").build();
+// yangModuleList.add(object);
+//
+// List<String> employeeid = EmployeeidOpParam.builder().employeeid();
+// if (employeeid == null) {
+// employeeid = new ArrayList<>();
+// }
+// employeeid.add("Employ1");
+// employeeid.add("Employ2");
+// employeeid.add("Employ3");
+// employeeid.add("Employ4");
+// employeeid.add("Employ5");
+//
+// // Creating the object for employeeid module
+// object = EmployeeidOpParam.builder().employeeid(employeeid).build();
+// yangModuleList.add(object);
+//
+// // Get the xml string and compare
+// String xml = codecHandler.encodeOperation("config", "ydt.root", null,
+// yangModuleList, XML, null);
+// assertEquals(AM_XML + "multiple: module info", multiModuleXml(), xml);
+// }
+
+ /**
+ * Unit test case in which verifying object for xml string with config as
+ * root name and empty container.
+ */
+ @Test
+ public void proceessCodecDecodeFunctionForEmptyContainer() {
+ String path = "src/test/resources/ychTestResourceFiles/getconfigemptycontainer.xml";
+ StringBuilder sb = new StringBuilder();
+ String sCurrentLine;
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry schemaRegistry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+
+ YangCodecRegistry.initializeDefaultCodec();
+ DefaultYangCodecHandler defaultYangCodecHandler =
+ new DefaultYangCodecHandler(schemaRegistry);
+
+ try (BufferedReader br = new BufferedReader(new FileReader(path))) {
+
+ while ((sCurrentLine = br.readLine()) != null) {
+ sb.append(sCurrentLine);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ // Verify the received object list
+ List<Object> objectList =
+ defaultYangCodecHandler.decode(sb.toString(),
+ XML, QUERY_CONFIG_REQUEST);
+ Iterator<Object> iterator = objectList.iterator();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ if (object.getClass().getSimpleName()
+ .equals(EMPTY_CONTAINER)) {
+ EmptyContainerOpParam emptyContainerOpParam =
+ (EmptyContainerOpParam) object;
+ assertNull(AM_OBJ + "empty-container: container value is not" +
+ "null",
+ emptyContainerOpParam.emptyContainer());
+ } else {
+ assertEquals(AM_OBJ, EMPTY_CONTAINER, object
+ .getClass().getSimpleName());
+ }
+ }
+ }
+
+
+ /**
+ * Unit test case in which verifying object for xml string with config as
+ * root name and multiple module.
+ */
+ @Test
+ public void proceessCodecDecodeFunctionForListInsideList() {
+ String path = "src/test/resources/ychTestResourceFiles/combinedrootname.xml";
+ StringBuilder sb = new StringBuilder();
+ String sCurrentLine;
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry schemaRegistry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+
+ YangCodecRegistry.initializeDefaultCodec();
+ DefaultYangCodecHandler defaultYangCodecHandler =
+ new DefaultYangCodecHandler(schemaRegistry);
+
+ try (BufferedReader br = new BufferedReader(new FileReader(path))) {
+
+ while ((sCurrentLine = br.readLine()) != null) {
+ sb.append(sCurrentLine);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ // TODO YOB and YTB need to do some changes for binary
+ // Verify the received object list
+ /*objectList = defaultYangCodecHandler.decode(sb.toString(),
+ XML_ENCODING,
+ EDIT_CONFIG_REQUEST);
+ Iterator<Object> iterator = objectList.iterator();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ if (object.getClass().getSimpleName().equals("CombinedOpParam")) {
+ CombinedOpParam combinedOpParam = (CombinedOpParam) object;
+
+ PathId pathId = new PathId(123);
+ Origin origin = new DefaultOrigin.OriginBuilder()
+ .value(pathId).build();
+ assertTrue(combinedOpParam.attributes().origin()
+ .equals(origin));
+
+ MultiExitDisc multiExitDisc = new DefaultMultiExitDisc
+ .MultiExitDiscBuilder().med(456).build();
+ assertTrue(combinedOpParam.attributes().multiExitDisc()
+ .equals(multiExitDisc));
+
+ LocalPref localPref = new DefaultLocalPref.LocalPrefBuilder()
+ .pref(23).build();
+ assertTrue(combinedOpParam.attributes().localPref()
+ .equals(localPref));
+
+ Metric metric = new Metric(456);
+ AigpTlv aigpTlv = new DefaultAigpTlv.AigpTlvBuilder()
+ .metric(metric).build();
+ Aigp aigp = new DefaultAigp.AigpBuilder().aigpTlv(aigpTlv)
+ .build();
+ assertTrue(combinedOpParam.attributes().aigp().equals(aigp));
+
+ UnrecognizedAttributes unrecognizedAttributes1 =
+ new DefaultUnrecognizedAttributes
+ .UnrecognizedAttributesBuilder()
+ .partial(false).transitive(false).type((short) 1)
+ .value("ABC".getBytes()).build();
+
+ UnrecognizedAttributes unrecognizedAttributes2 =
+ new DefaultUnrecognizedAttributes
+ .UnrecognizedAttributesBuilder()
+ .partial(true).transitive(true).type((short) 2)
+ .value("BCA".getBytes()).build();
+
+ UnrecognizedAttributes unrecognizedAttributes3 =
+ new DefaultUnrecognizedAttributes
+ .UnrecognizedAttributesBuilder()
+ .partial(true).transitive(false).type((short) 3)
+ .value("CAB".getBytes()).build();
+
+ UnrecognizedAttributes unrecognizedAttributes4 =
+ new DefaultUnrecognizedAttributes
+ .UnrecognizedAttributesBuilder()
+ .partial(false).transitive(true).type((short) 4)
+ .value("111".getBytes()).build();
+
+ AsNum asNum1 = new AsNum(11);
+ As4BytesCapability as4BytesCapability1 =
+ new DefaultAs4BytesCapability
+ .As4BytesCapabilityBuilder()
+ .asNumber(asNum1).build();
+ Cparameters cparameters1 = new DefaultCparameters
+ .CparametersBuilder()
+ .as4BytesCapability(as4BytesCapability1)
+ .build();
+ OptionalCapabilities optionalCapabilities1 =
+ new DefaultOptionalCapabilities
+ .OptionalCapabilitiesBuilder()
+ .cParameters(cparameters1).build();
+
+ AsNum asNum2 = new AsNum(22);
+ As4BytesCapability as4BytesCapability2 =
+ new DefaultAs4BytesCapability
+ .As4BytesCapabilityBuilder()
+ .asNumber(asNum2).build();
+ Cparameters cparameters2 = new DefaultCparameters
+ .CparametersBuilder()
+ .as4BytesCapability(as4BytesCapability2)
+ .build();
+ OptionalCapabilities optionalCapabilities2 =
+ new DefaultOptionalCapabilities
+ .OptionalCapabilitiesBuilder()
+ .cParameters(cparameters2).build();
+
+ AsNum asNum3 = new AsNum(33);
+ As4BytesCapability as4BytesCapability3 =
+ new DefaultAs4BytesCapability
+ .As4BytesCapabilityBuilder()
+ .asNumber(asNum3).build();
+ Cparameters cparameters3 =
+ new DefaultCparameters.CparametersBuilder()
+ .as4BytesCapability(as4BytesCapability3)
+ .build();
+ OptionalCapabilities optionalCapabilities3 =
+ new DefaultOptionalCapabilities
+ .OptionalCapabilitiesBuilder()
+ .cParameters(cparameters3).build();
+
+ BgpParameters bgpParameters1 =
+ new DefaultBgpParameters.BgpParametersBuilder()
+ .addToOptionalCapabilities(optionalCapabilities1)
+ .addToOptionalCapabilities(optionalCapabilities2)
+ .addToOptionalCapabilities(optionalCapabilities3)
+ .build();
+
+ AsNum asNum4 = new AsNum(11);
+ As4BytesCapability as4BytesCapability4 =
+ new DefaultAs4BytesCapability
+ .As4BytesCapabilityBuilder()
+ .asNumber(asNum4).build();
+ Cparameters cparameters4 =
+ new DefaultCparameters.CparametersBuilder()
+ .as4BytesCapability(as4BytesCapability4)
+ .build();
+ OptionalCapabilities optionalCapabilities4 =
+ new DefaultOptionalCapabilities
+ .OptionalCapabilitiesBuilder()
+ .cParameters(cparameters4).build();
+
+ AsNum asNum5 = new AsNum(22);
+ As4BytesCapability as4BytesCapability5 =
+ new DefaultAs4BytesCapability
+ .As4BytesCapabilityBuilder()
+ .asNumber(asNum5).build();
+ Cparameters cparameters5 =
+ new DefaultCparameters.CparametersBuilder()
+ .as4BytesCapability(as4BytesCapability5)
+ .build();
+ OptionalCapabilities optionalCapabilities5 =
+ new DefaultOptionalCapabilities
+ .OptionalCapabilitiesBuilder()
+ .cParameters(cparameters5).build();
+
+ AsNum asNum6 = new AsNum(33);
+ As4BytesCapability as4BytesCapability6 =
+ new DefaultAs4BytesCapability
+ .As4BytesCapabilityBuilder()
+ .asNumber(asNum6).build();
+ Cparameters cparameters6 =
+ new DefaultCparameters.CparametersBuilder()
+ .as4BytesCapability(as4BytesCapability6)
+ .build();
+ OptionalCapabilities optionalCapabilities6 =
+ new DefaultOptionalCapabilities
+ .OptionalCapabilitiesBuilder()
+ .cParameters(cparameters6).build();
+
+ BgpParameters bgpParameters2 =
+ new DefaultBgpParameters.BgpParametersBuilder()
+ .addToOptionalCapabilities(optionalCapabilities4)
+ .addToOptionalCapabilities(optionalCapabilities5)
+ .addToOptionalCapabilities(optionalCapabilities6)
+ .build();
+
+ Attributes attributes =
+ new DefaultAttributes.AttributesBuilder()
+ .origin(origin)
+ .multiExitDisc(multiExitDisc)
+ .localPref(localPref)
+ .aigp(aigp)
+ .addToUnrecognizedAttributes(unrecognizedAttributes1)
+ .addToUnrecognizedAttributes(unrecognizedAttributes2)
+ .addToUnrecognizedAttributes(unrecognizedAttributes3)
+ .addToUnrecognizedAttributes(unrecognizedAttributes4)
+ .addToBgpParameters(bgpParameters1)
+ .addToBgpParameters(bgpParameters2).build();
+ } else {
+ assertTrue(false);
+ }
+ }*/
+ }
+
+// /**
+// * Unit test case in which verifying object for xml string with config as root name and
+// * operation type.
+// */
+// @Test
+// public void proceessCodecDecodeFunctionForOperTypeTest() {
+// String path = "src/test/resources/ychTestResourceFiles/configrootnameOperationType.xml";
+// testYangSchemaNodeProvider.processSchemaRegistry(null);
+// DefaultYangSchemaRegistry schemaRegistry =
+// testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+//
+// YangCodecRegistry.initializeDefaultCodec();
+// DefaultYangCodecHandler defaultYangCodecHandler =
+// new DefaultYangCodecHandler(schemaRegistry);
+//
+// StringBuilder sb = new StringBuilder();
+// String sCurrentLine;
+//
+// try (BufferedReader br = new BufferedReader(new FileReader(path))) {
+//
+// while ((sCurrentLine = br.readLine()) != null) {
+// sb.append(sCurrentLine);
+// }
+//
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
+//
+// // Verify the received object list
+// List<Object> objectList =
+// defaultYangCodecHandler.decode(sb.toString(),
+// XML, EDIT_CONFIG_REQUEST);
+// Iterator<Object> iterator = objectList.iterator();
+// while (iterator.hasNext()) {
+// Object object = iterator.next();
+// if (object.getClass().getSimpleName()
+// .equals(LOGISTIC_MOD)) {
+// LogisticsManagerOpParam logistics =
+// (LogisticsManagerOpParam) object;
+// DefaultPurchasingSupervisor purchasingSupervisor =
+// (DefaultPurchasingSupervisor) logistics
+// .purchasingSupervisor();
+//
+// assertEquals(AM_OBJ + "purchase-super: operation type", DELETE,
+// purchasingSupervisor.yangPurchasingSupervisorOpType());
+// assertEquals(AM_OBJ + "customs-super: leaf value", "abc",
+// logistics.customsSupervisor());
+// assertEquals(AM_OBJ + "purchase-spec: leaf value", "bcd",
+// logistics.purchasingSupervisor()
+// .purchasingSpecialist());
+// assertEquals(AM_OBJ + "purchase-support: leaf value",
+// "cde", logistics.purchasingSupervisor()
+// .support());
+//
+// } else if (object.getClass().getSimpleName()
+// .equals(MERCHA_MOD)) {
+// MerchandisersupervisorOpParam merchandisersupervisorOpParam =
+// (MerchandisersupervisorOpParam) object;
+// assertEquals(AM_OBJ + "merchandiser-super: leaf value",
+// "abc", merchandisersupervisorOpParam.supervisor());
+// } else {
+// assertEquals(AM_OBJ, LOGISTIC_MOD, object
+// .getClass().getSimpleName());
+// assertEquals(AM_OBJ, MERCHA_MOD, object
+// .getClass().getSimpleName());
+// }
+// }
+// }
+
+ /**
+ * Validate the leaf value for purchasing specialist.
+ *
+ * @param objectList object list
+ */
+ private void processPurchasingSpecObj(List<Object> objectList) {
+ Iterator<Object> iterator = objectList.iterator();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ if (object.getClass().getSimpleName()
+ .equals("LogisticsManagerOpParam")) {
+ LogisticsManagerOpParam logisticsManagerOpParam =
+ (LogisticsManagerOpParam) object;
+ assertEquals(AM_OBJ + "purchasing-spec: leaf value", "bcd",
+ logisticsManagerOpParam.purchasingSupervisor()
+ .purchasingSpecialist());
+ } else {
+ assertEquals(AM_OBJ, "LogisticsManagerOpParam", object
+ .getClass().getSimpleName());
+ }
+ }
+ }
+
+ /**
+ * Validate the leaf value for merchandiser supervisor.
+ *
+ * @param objectList object list
+ */
+ private void processMerchandiserObj(List<Object> objectList) {
+ Iterator<Object> iterator = objectList.iterator();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ if (object.getClass().getSimpleName()
+ .equals(MERCHA_MOD)) {
+ MerchandisersupervisorOpParam merchandisersupervisorOpParam =
+ (MerchandisersupervisorOpParam) object;
+ assertEquals(AM_OBJ + "merchandiser-super: leaf value", "abc",
+ merchandisersupervisorOpParam.supervisor());
+ } else {
+ assertEquals(AM_OBJ, MERCHA_MOD, object
+ .getClass().getSimpleName());
+ }
+ }
+ }
+
+ /**
+ * Unit test case in which verifying object for xml string with get and
+ * filter as root name.
+ */
+ @Test
+ public void proceessCodecDecodeFunctionForGet() {
+ String path = "src/test/resources/ychTestResourceFiles/getrootname.xml";
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry schemaRegistry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+
+ YangCodecRegistry.initializeDefaultCodec();
+ DefaultYangCodecHandler defaultYangCodecHandler =
+ new DefaultYangCodecHandler(schemaRegistry);
+
+ StringBuilder sb = new StringBuilder();
+ String sCurrentLine;
+
+ try (BufferedReader br = new BufferedReader(new FileReader(path))) {
+
+ while ((sCurrentLine = br.readLine()) != null) {
+ sb.append(sCurrentLine);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ // Verify the received object list
+ List<Object> objectList =
+ defaultYangCodecHandler.decode(sb.toString(),
+ XML, QUERY_REQUEST);
+ processPurchasingSpecObj(objectList);
+ }
+
+ /**
+ * Unit test case in which verifying object for xml string with get-config
+ * and filter as root name.
+ */
+ @Test
+ public void proceessCodecDecodeFunctionForGetConfig() {
+ String path = "src/test/resources/ychTestResourceFiles/getconfigrootname.xml";
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry schemaRegistry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+
+ YangCodecRegistry.initializeDefaultCodec();
+ DefaultYangCodecHandler defaultYangCodecHandler =
+ new DefaultYangCodecHandler(schemaRegistry);
+
+ StringBuilder sb = new StringBuilder();
+ String sCurrentLine;
+
+ try (BufferedReader br = new BufferedReader(new FileReader(path))) {
+
+ while ((sCurrentLine = br.readLine()) != null) {
+ sb.append(sCurrentLine);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ // Verify the received object list
+ List<Object> objectList = defaultYangCodecHandler.decode(
+ sb.toString(),
+ XML, QUERY_CONFIG_REQUEST);
+ processMerchandiserObj(objectList);
+ }
+
+ /**
+ * Unit test case in which verifying object for xml string with data as
+ * root name.
+ */
+ @Test
+ public void proceessCodecDecodeFunctionForGetData() {
+ String path = "src/test/resources/ychTestResourceFiles/getReply.xml";
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry schemaRegistry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+
+ YangCodecRegistry.initializeDefaultCodec();
+ DefaultYangCodecHandler defaultYangCodecHandler =
+ new DefaultYangCodecHandler(schemaRegistry);
+
+ StringBuilder sb = new StringBuilder();
+ String sCurrentLine;
+
+ try (BufferedReader br = new BufferedReader(new FileReader(path))) {
+
+ while ((sCurrentLine = br.readLine()) != null) {
+ sb.append(sCurrentLine);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ // Verify the received object list
+ List<Object> objectList = defaultYangCodecHandler.decode(
+ sb.toString(),
+ XML, QUERY_CONFIG_REQUEST);
+ processPurchasingSpecObj(objectList);
+ }
+
+ /**
+ * Unit test case in which verifying object for xml string with rpc-reply
+ * and data as root name .
+ */
+ @Test
+ public void proceessCodecDecodeFunctionForGetConfigData() {
+ String path = "src/test/resources/ychTestResourceFiles/getconfigReply.xml";
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry schemaRegistry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+
+ YangCodecRegistry.initializeDefaultCodec();
+ DefaultYangCodecHandler defaultYangCodecHandler =
+ new DefaultYangCodecHandler(schemaRegistry);
+
+ StringBuilder sb = new StringBuilder();
+ String sCurrentLine;
+
+ try (BufferedReader br = new BufferedReader(new FileReader(path))) {
+
+ while ((sCurrentLine = br.readLine()) != null) {
+ sb.append(sCurrentLine);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ // Verify the received object list
+ List<Object> objectList = defaultYangCodecHandler.decode(sb.toString(),
+ XML, null);
+ processMerchandiserObj(objectList);
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/AugmentSequenceTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/AugmentSequenceTest.java
new file mode 100644
index 0000000..72d68c1
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/AugmentSequenceTest.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2016. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
+ * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
+ * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
+ * Vestibulum commodo. Ut rhoncus gravida arcu.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.OTHER_EDIT;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUGNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUGSE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.augmentSequenceYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppLogicalNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppModuleNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class AugmentSequenceTest {
+
+ private static final String[] EXPECTED = {
+ "Entry Node is augment.",
+ "Entry Node is augmentSequence.",
+ "Entry Node is l1.",
+ "Entry Node is leaf1.",
+ "Exit Node is leaf1.",
+
+ "Entry Node is c1.",
+ "Entry Node is leaf2.",
+ "Exit Node is leaf2.",
+ "Exit Node is c1.",
+
+ "Entry Node is c2.",
+ "Entry Node is leaf2.",
+ "Exit Node is leaf2.",
+ "Exit Node is c2.",
+
+ "Exit Node is l1.",
+ "Exit Node is augmentSequence.",
+ "Exit Node is augment.",
+ };
+
+ /**
+ * Creates and validates sequence of augment in ydt.
+ */
+ @Test
+ public void augmentTest() {
+ YangRequestWorkBench ydtBuilder = augmentSequenceYdt();
+ validateTree(ydtBuilder);
+ validateAppTree(ydtBuilder);
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "augment", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "augmentSequence", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "l1", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+
+ validateLeafContents(ydtNode, "leaf1", "1");
+ ydtNode = ydtNode.getNextSibling();
+
+ //Augmenting leaf2
+ validateNodeContents(ydtNode, "c1", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "leaf2", "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Augmenting leaf3
+ validateNodeContents(ydtNode, "c2", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "leaf2", "3");
+ }
+
+ /**
+ * Validates the given built ydt application tree.
+ */
+ private void validateAppTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtAppContext ydtAppContext = ydtBuilder.getAppRootNode();
+ // Logical root node does not have operation type
+ validateAppLogicalNodeContents(ydtAppContext);
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppModuleNodeContents(ydtAppContext, "augmentSequence",
+ OTHER_EDIT);
+ ydtAppContext = ydtAppContext.getFirstChild();
+
+ //Inside list checking the first augmented leaf
+ validateAppNodeContents(ydtAppContext, AUGSE, AUGNS, OTHER_EDIT);
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/AugmentTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/AugmentTest.java
new file mode 100644
index 0000000..dee5648
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/AugmentTest.java
@@ -0,0 +1,519 @@
+/*
+ * Copyright (c) 2016. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
+ * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
+ * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
+ * Vestibulum commodo. Ut rhoncus gravida arcu.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.BOTH;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A2L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A5L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A6L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG1;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.IETF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.NETNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SLINK;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.STP;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TOPONS;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.augmentNetworkYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppLogicalNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppModuleNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafListContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.DELETE;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class AugmentTest {
+
+ private Set<String> valueSet = new HashSet();
+
+ private static final String[] EXPECTED = {
+ "Entry Node is yms-ietf-network.",
+ "Entry Node is yms-ietf-network.",
+ "Entry Node is networks.",
+ "Entry Node is network.",
+ "Entry Node is network-id.",
+ "Exit Node is network-id.",
+ "Entry Node is link.",
+ "Entry Node is link-id.",
+ "Exit Node is link-id.",
+ "Entry Node is source.",
+ "Entry Node is source-node.",
+ "Exit Node is source-node.",
+ "Entry Node is source-tp.",
+ "Exit Node is source-tp.",
+ "Exit Node is source.",
+
+ "Entry Node is destination.",
+ "Entry Node is dest-node.",
+ "Exit Node is dest-node.",
+ "Entry Node is dest-tp.",
+ "Exit Node is dest-tp.",
+ "Exit Node is destination.",
+
+ "Entry Node is supporting-link.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is link-ref.",
+ "Exit Node is link-ref.",
+ "Exit Node is supporting-link.",
+
+ "Entry Node is supporting-link.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is link-ref.",
+ "Exit Node is link-ref.",
+ "Exit Node is supporting-link.",
+
+ "Entry Node is augment1.",
+ "Entry Node is value1.",
+ "Exit Node is value1.",
+ "Exit Node is augment1.",
+
+ "Entry Node is augment2.",
+ "Entry Node is key1.",
+ "Exit Node is key1.",
+ "Entry Node is key2.",
+ "Exit Node is key2.",
+
+ "Entry Node is augment5.",
+
+ "Entry Node is augment6leafList.",
+ "Exit Node is augment6leafList.",
+
+ "Entry Node is value5.",
+ "Exit Node is value5.",
+ "Exit Node is augment5.",
+
+ "Entry Node is augment5leafList.",
+ "Exit Node is augment5leafList.",
+
+ "Entry Node is augment3.",
+
+ "Entry Node is augment4.",
+ "Entry Node is value4.",
+ "Exit Node is value4.",
+ "Exit Node is augment4.",
+
+ "Entry Node is augment5.",
+
+ "Entry Node is leaf6.",
+ "Exit Node is leaf6.",
+
+ "Entry Node is value5.",
+ "Exit Node is value5.",
+ "Exit Node is augment5.",
+
+ "Entry Node is augment6.",
+ "Entry Node is value6.",
+ "Exit Node is value6.",
+ "Exit Node is augment6.",
+
+ "Entry Node is value3.",
+ "Exit Node is value3.",
+ "Exit Node is augment3.",
+
+ "Entry Node is augment3leaf.",
+ "Exit Node is augment3leaf.",
+
+ "Exit Node is augment2.",
+
+ "Entry Node is augment2leafList.",
+ "Exit Node is augment2leafList.",
+
+ "Exit Node is link.",
+
+ "Entry Node is supporting-network.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Exit Node is supporting-network.",
+ "Entry Node is node.",
+ "Entry Node is node-id.",
+ "Exit Node is node-id.",
+ "Entry Node is t-point.",
+ "Entry Node is tp-id.",
+ "Exit Node is tp-id.",
+
+ "Entry Node is supporting-termination-point.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is node-ref.",
+ "Exit Node is node-ref.",
+ "Entry Node is tp-ref.",
+ "Exit Node is tp-ref.",
+
+ "Entry Node is augment1.",
+ "Entry Node is value1.",
+ "Exit Node is value1.",
+ "Exit Node is augment1.",
+
+ "Entry Node is augment1-leaf.",
+ "Exit Node is augment1-leaf.",
+
+ "Entry Node is augment2.",
+
+ "Entry Node is augment3.",
+ "Entry Node is value3.",
+ "Exit Node is value3.",
+ "Exit Node is augment3.",
+
+ "Entry Node is augment4leaf.",
+ "Exit Node is augment4leaf.",
+
+ "Entry Node is value2.",
+ "Exit Node is value2.",
+ "Exit Node is augment2.",
+ "Entry Node is augment2leafList.",
+ "Exit Node is augment2leafList.",
+ "Entry Node is augment2leaf.",
+ "Exit Node is augment2leaf.",
+
+ "Exit Node is supporting-termination-point.",
+ "Exit Node is t-point.",
+ "Entry Node is supporting-node.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is node-ref.",
+ "Exit Node is node-ref.",
+ "Exit Node is supporting-node.",
+
+ "Exit Node is node.",
+ // last augmented sibling in network
+ "Entry Node is link-id.",
+ "Exit Node is link-id.",
+
+ "Exit Node is network.",
+ "Exit Node is networks.",
+ "Entry Node is networks-state.",
+ "Entry Node is network.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is server-provided.",
+ "Exit Node is server-provided.",
+ "Exit Node is network.",
+ "Exit Node is networks-state.",
+ "Exit Node is yms-ietf-network.",
+
+ "Entry Node is augmentNetwork.",
+ "Entry Node is node.",
+ "Entry Node is name.",
+ "Exit Node is name.",
+ "Entry Node is cont1s.",
+ "Entry Node is cont1s.",
+ "Entry Node is fine.",
+ "Exit Node is fine.",
+
+ // augmenting node augment1 under cont1s
+ "Entry Node is augment1.",
+ "Entry Node is value1.",
+ "Exit Node is value1.",
+ "Exit Node is augment1.",
+
+ "Exit Node is cont1s.",
+ "Exit Node is cont1s.",
+ "Exit Node is node.",
+ "Exit Node is augmentNetwork.",
+
+ "Exit Node is yms-ietf-network."
+ };
+
+ /**
+ * Creates and validates ietf network augment ydt.
+ */
+ @Test
+ public void augmentTest() {
+ YangRequestWorkBench ydtBuilder = augmentNetworkYdt();
+ validateTree(ydtBuilder);
+ validateAppTree(ydtBuilder);
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "yms-ietf-network", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "yms-ietf-network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "networks", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-id", "network1");
+ ydtNode = ydtNode.getNextSibling();
+
+ // Validating augmented child
+ validateNodeContents(ydtNode, "link", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "link-id", "id1");
+ ydtNode = ydtNode.getNextSibling();
+
+ // Inside source node
+ validateNodeContents(ydtNode, "source", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "source-node", "source1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "source-tp", "source2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside destination node
+ validateNodeContents(ydtNode, "destination", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "dest-node", "dest1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "dest-tp", "dest2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside supporting links
+ validateNodeContents(ydtNode, SLINK, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "link-ref", "id2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside another supporting links instance
+ validateNodeContents(ydtNode, SLINK, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network2");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "link-ref", "id3");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ validateNodeContents(ydtNode, "augment1", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "value1", "1");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "augment2", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "key1", "1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "key2", "2");
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "augment5", DELETE);
+ ydtNode = ydtNode.getFirstChild();
+ valueSet.add("1");
+ valueSet.add("2");
+ validateLeafListContents(ydtNode, A6L, valueSet);
+ ydtNode = ydtNode.getNextSibling();
+
+ validateLeafContents(ydtNode, "value5", "5");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafListContents(ydtNode, A5L, valueSet);
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "augment3", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+
+ validateNodeContents(ydtNode, "augment4", DELETE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "value4", "4");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ validateNodeContents(ydtNode, "augment5", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+
+ validateLeafContents(ydtNode, "leaf6", "6");
+ ydtNode = ydtNode.getNextSibling();
+
+ validateLeafContents(ydtNode, "value5", "5");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ validateNodeContents(ydtNode, "augment6", DELETE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "value6", "6");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ validateLeafContents(ydtNode, "value3", "3");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "augment3leaf", "3");
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafListContents(ydtNode, A2L, valueSet);
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supporting-network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network2");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "node-id", "node1");
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside termination-point
+ validateNodeContents(ydtNode, "t-point", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "tp-id", "tp_id1");
+ ydtNode = ydtNode.getNextSibling();
+
+ validateTerminationPointAugment(ydtNode);
+ }
+
+ /**
+ * Validates the termination point node in given built ydt.
+ */
+ private void validateTerminationPointAugment(YdtNode ydtNode) {
+
+ //Inside supporting-termination-point
+ validateNodeContents(ydtNode, STP, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network-ref");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "node-ref", "node-ref");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "tp-ref", "tp-ref");
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "augment1", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "value1", "1");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "augment1-leaf", "1");
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "augment2", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+
+ validateNodeContents(ydtNode, "augment3", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "value3", "3");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "augment4leaf", "4");
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "value2", "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafListContents(ydtNode, A2L, valueSet);
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "augment2leaf", "2");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supporting-node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network3");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "node-ref", "network4");
+
+ ydtNode = ydtNode.getParent().getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "link-id", "id1");
+ ydtNode = ydtNode.getParent().getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "networks-state", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network5");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "server-provided", "true");
+ ydtNode = ydtNode.getParent().getParent().getParent();
+
+ validateAugmentNetworkModule(ydtNode);
+ }
+
+ /**
+ * Validates the given built ydt for augment network module.
+ */
+ private void validateAugmentNetworkModule(YdtNode ydtNode) {
+
+ ydtNode = ydtNode.getNextSibling();
+ //augmenting network module node
+ validateNodeContents(ydtNode, "augmentNetwork", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "name", "node1");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "cont1s", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "cont1s", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "fine", "leaf");
+
+ // checking augmenting node augment1
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "augment1", DELETE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "value1", "1");
+ }
+
+ /**
+ * Validates the given built ydt application tree.
+ */
+ private void validateAppTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtAppContext ydtAppContext = ydtBuilder.getAppRootNode();
+ // Logical root node does not have operation type
+ validateAppLogicalNodeContents(ydtAppContext);
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppModuleNodeContents(ydtAppContext, IETF, BOTH);
+ ydtAppContext = ydtAppContext.getFirstChild();
+
+ //Inside link node
+ validateAppNodeContents(ydtAppContext, AUG1, TOPONS, BOTH);
+
+ ydtAppContext = ydtAppContext.getParent();
+ validateAugmentNetworkAppTree(ydtAppContext);
+ }
+
+ /**
+ * Validates the given built ydt application tree for augmenting network
+ * module.
+ */
+ private void validateAugmentNetworkAppTree(YdtAppContext ydtAppContext) {
+
+ ydtAppContext = ydtAppContext.getNextSibling();
+ //augmenting network module node
+ validateAppModuleNodeContents(ydtAppContext, "augmentNetwork", BOTH);
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppNodeContents(ydtAppContext, "/node", NETNS, BOTH);
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/EmptyLeafListTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/EmptyLeafListTest.java
new file mode 100644
index 0000000..c1fd7e3
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/EmptyLeafListTest.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2016. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
+ * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
+ * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
+ * Vestibulum commodo. Ut rhoncus gravida arcu.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafListContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class EmptyLeafListTest {
+
+ // Logger list is used for walker testing.
+ private final List<String> logger = new ArrayList<>();
+
+ private static final String[] EXPECTED = {
+ "Entry Node is empty.",
+ "Entry Node is EmptyLeafList.",
+ "Entry Node is l1.",
+ "Exit Node is l1.",
+ "Entry Node is l2.",
+ "Exit Node is l2.",
+ "Entry Node is l3.",
+ "Exit Node is l3.",
+ "Entry Node is list1.",
+ "Exit Node is list1.",
+ "Entry Node is list2.",
+ "Exit Node is list2.",
+ "Entry Node is list3.",
+ "Exit Node is list3.",
+ "Exit Node is EmptyLeafList.",
+ "Exit Node is empty."
+ };
+
+ /**
+ * Creates and validates empty leaf list ydt.
+ */
+ @Test
+ public void emptyListTest() throws IOException {
+
+ //TODO need to be handled later
+// YangRequestWorkBench ydtBuilder = emptyLeafListYdt();
+// validateTree(ydtBuilder);
+// walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ Set<String> valueSet = new HashSet();
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "empty", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "EmptyLeafList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "l1", null);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "l2", null);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "l3", null);
+ ydtNode = ydtNode.getNextSibling();
+
+ validateLeafListContents(ydtNode, "list1", valueSet);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafListContents(ydtNode, "list2", valueSet);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafListContents(ydtNode, "list3", valueSet);
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/FoodArenaTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/FoodArenaTest.java
new file mode 100644
index 0000000..7f058a9
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/FoodArenaTest.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.onosproject.yms.app.ydt.YdtTestUtils.foodArenaYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class FoodArenaTest {
+
+ // Logger list is used for walker testing.
+ private final List<String> logger = new ArrayList<>();
+
+ private static final String[] EXPECTED = {
+ "Entry Node is foodarena.",
+ "Entry Node is food.",
+ "Entry Node is food.",
+ "Entry Node is chocolate.",
+ "Exit Node is chocolate.",
+ "Exit Node is food.",
+ "Exit Node is food.",
+ "Exit Node is foodarena."
+ };
+
+ /**
+ * Creates and validates food arena ydt.
+ */
+ @Test
+ public void foodArenaTest() throws IOException {
+
+ YangRequestWorkBench ydtBuilder = foodArenaYdt();
+ validateTree(ydtBuilder);
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+ // Assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "foodarena", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "food", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "food", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "chocolate", "dark");
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/IdentityTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/IdentityTest.java
new file mode 100644
index 0000000..4c825a0
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/IdentityTest.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2016. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
+ * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
+ * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
+ * Vestibulum commodo. Ut rhoncus gravida arcu.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.yob.DefaultYobBuilder;
+import org.onosproject.yms.app.ytb.DefaultYangTreeBuilder;
+import org.onosproject.yms.ydt.YdtContext;
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.OTHER_EDIT;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.identityRefYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppLogicalNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppModuleNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafListContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+import static org.onosproject.yms.ydt.YmsOperationType.EDIT_CONFIG_REPLY;
+
+public class IdentityTest {
+
+ Set<String> valueSet = new HashSet();
+
+ private static final String[] EXPECTED = {
+ "Entry Node is identityref.",
+ "Entry Node is crypto-base.",
+ "Entry Node is crypto.",
+ "Exit Node is crypto.",
+ "Entry Node is abc-zeunion.",
+ "Exit Node is abc-zeunion.",
+ "Entry Node is level2.",
+ "Exit Node is level2.",
+ "Entry Node is level3.",
+ "Exit Node is level3.",
+ "Entry Node is level4.",
+ "Exit Node is level4.",
+ "Entry Node is abc-type.",
+ "Exit Node is abc-type.",
+ "Exit Node is crypto-base.",
+ "Exit Node is identityref.",
+ };
+
+ /**
+ * Creates and validates identity ref in ydt.
+ */
+ @Test
+ public void identityRefTest() {
+ YangRequestWorkBench ydtBuilder = identityRefYdt();
+ validateTree(ydtBuilder);
+ validateAppTree(ydtBuilder);
+ walkINTree(ydtBuilder, EXPECTED);
+
+ //TODO need to be handled later
+// validateYangObject(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ valueSet.add("crypto-alg");
+ // Assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "identityref", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "crypto-base", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+
+ validateLeafContents(ydtNode, "crypto", "crypto-alg");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "abc-zeunion", "crypto-alg");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "level2", "crypto-alg2");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "level3", "crypto-alg3");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "level4", "crypto-alg3");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafListContents(ydtNode, "abc-type", valueSet);
+
+ }
+
+ /**
+ * Validates the given built ydt application tree.
+ */
+ private void validateAppTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtAppContext ydtAppContext = ydtBuilder.getAppRootNode();
+ // Logical root node does not have operation type
+ validateAppLogicalNodeContents(ydtAppContext);
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppModuleNodeContents(ydtAppContext, "crypto-base",
+ OTHER_EDIT);
+ }
+
+ /**
+ * Creates Ydt from YO using YTB.
+ */
+ private void validateYangObject(YangRequestWorkBench ydtBuilder) {
+
+ YdtContext rootCtx = ydtBuilder.getRootNode();
+
+ YdtContext childCtx = rootCtx.getFirstChild();
+
+ DefaultYobBuilder builder = new DefaultYobBuilder();
+
+ Object yangObject = builder.getYangObject(
+ (YdtExtendedContext) childCtx, YdtTestUtils
+ .getSchemaRegistry());
+
+ List<Object> list = new LinkedList<>();
+ list.add(yangObject);
+ // Builds YANG tree in YTB.
+ DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+ YangRequestWorkBench defaultYdtBuilder =
+ (YangRequestWorkBench) treeBuilder.getYdtBuilderForYo(
+ list, "identityref", "ydt.crypto-base",
+ EDIT_CONFIG_REPLY, YdtTestUtils
+ .getSchemaRegistry());
+
+ // Validate the created YDT
+ walkINTree(defaultYdtBuilder, EXPECTED);
+ validateTree(defaultYdtBuilder);
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/IetfNetworkTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/IetfNetworkTest.java
new file mode 100644
index 0000000..0befc4d
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/IetfNetworkTest.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import static org.onosproject.yms.app.ydt.YdtTestUtils.ietfNetwork1Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class IetfNetworkTest {
+
+ private static final String[] EXPECTED = {
+ "Entry Node is yms-ietf-network.",
+ "Entry Node is yms-ietf-network.",
+ "Entry Node is networks.",
+ "Entry Node is network.",
+ "Entry Node is network-id.",
+ "Exit Node is network-id.",
+ "Entry Node is supporting-network.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Exit Node is supporting-network.",
+ "Entry Node is node.",
+ "Entry Node is node-id.",
+ "Exit Node is node-id.",
+ "Entry Node is supporting-node.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is node-ref.",
+ "Exit Node is node-ref.",
+ "Exit Node is supporting-node.",
+ "Exit Node is node.",
+ "Exit Node is network.",
+ "Exit Node is networks.",
+ "Entry Node is networks-state.",
+ "Entry Node is network.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is server-provided.",
+ "Exit Node is server-provided.",
+ "Exit Node is network.",
+ "Exit Node is networks-state.",
+ "Exit Node is yms-ietf-network.",
+ "Exit Node is yms-ietf-network."
+ };
+
+ /**
+ * Creates and validates ietf network ydt.
+ */
+ @Test
+ public void ietfNetwork1Test() {
+ YangRequestWorkBench ydtBuilder = ietfNetwork1Ydt();
+ validateTree(ydtBuilder);
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "yms-ietf-network", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "yms-ietf-network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "networks", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-id", "network1");
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supporting-network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network2");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "node-id", "node1");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supporting-node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network3");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "node-ref", "network4");
+
+ ydtNode = ydtNode.getParent().getParent().getParent().getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "networks-state", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network5");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "server-provided", "true");
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/IetfTopologyTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/IetfTopologyTest.java
new file mode 100644
index 0000000..0469a35
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/IetfTopologyTest.java
@@ -0,0 +1,264 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import static org.onosproject.yms.app.ydt.YdtAppNodeOperationType.OTHER_EDIT;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.AUG1;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.IETF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SLINK;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.STP;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TOPONS;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.ietfNetworkTopologyYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppLogicalNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppModuleNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateAppNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class IetfTopologyTest {
+
+ private static final String[] EXPECTED = {
+ "Entry Node is yms-ietf-network.",
+ "Entry Node is yms-ietf-network.",
+ "Entry Node is networks.",
+ "Entry Node is network.",
+ "Entry Node is network-id.",
+ "Exit Node is network-id.",
+ "Entry Node is link.",
+ "Entry Node is link-id.",
+ "Exit Node is link-id.",
+ "Entry Node is source.",
+ "Entry Node is source-node.",
+ "Exit Node is source-node.",
+ "Entry Node is source-tp.",
+ "Exit Node is source-tp.",
+ "Exit Node is source.",
+
+ "Entry Node is destination.",
+ "Entry Node is dest-node.",
+ "Exit Node is dest-node.",
+ "Entry Node is dest-tp.",
+ "Exit Node is dest-tp.",
+ "Exit Node is destination.",
+
+ "Entry Node is supporting-link.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is link-ref.",
+ "Exit Node is link-ref.",
+ "Exit Node is supporting-link.",
+
+ "Entry Node is supporting-link.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is link-ref.",
+ "Exit Node is link-ref.",
+ "Exit Node is supporting-link.",
+ "Exit Node is link.",
+
+ "Entry Node is supporting-network.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Exit Node is supporting-network.",
+ "Entry Node is node.",
+ "Entry Node is node-id.",
+ "Exit Node is node-id.",
+ "Entry Node is t-point.",
+ "Entry Node is tp-id.",
+ "Exit Node is tp-id.",
+
+ "Entry Node is supporting-termination-point.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is node-ref.",
+ "Exit Node is node-ref.",
+ "Entry Node is tp-ref.",
+ "Exit Node is tp-ref.",
+
+ "Exit Node is supporting-termination-point.",
+ "Exit Node is t-point.",
+ "Entry Node is supporting-node.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is node-ref.",
+ "Exit Node is node-ref.",
+ "Exit Node is supporting-node.",
+
+ "Exit Node is node.",
+ // last augmented sibling in network
+ "Entry Node is link-id.",
+ "Exit Node is link-id.",
+
+ "Exit Node is network.",
+ "Exit Node is networks.",
+ "Entry Node is networks-state.",
+ "Entry Node is network.",
+ "Entry Node is network-ref.",
+ "Exit Node is network-ref.",
+ "Entry Node is server-provided.",
+ "Exit Node is server-provided.",
+ "Exit Node is network.",
+ "Exit Node is networks-state.",
+ "Exit Node is yms-ietf-network.",
+ "Exit Node is yms-ietf-network."
+ };
+
+ /**
+ * Creates and validates ietf network ydt.
+ */
+ @Test
+ public void ietfNetwork1Test() {
+ YangRequestWorkBench ydtBuilder = ietfNetworkTopologyYdt();
+ validateTree(ydtBuilder);
+ validateAppTree(ydtBuilder);
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "yms-ietf-network", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "yms-ietf-network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "networks", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-id", "network1");
+ ydtNode = ydtNode.getNextSibling();
+
+ // Validating augmented child
+ validateNodeContents(ydtNode, "link", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "link-id", "id1");
+ ydtNode = ydtNode.getNextSibling();
+
+ // Inside source node
+ validateNodeContents(ydtNode, "source", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "source-node", "source1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "source-tp", "source2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside destination node
+ validateNodeContents(ydtNode, "destination", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "dest-node", "dest1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "dest-tp", "dest2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside supporting links
+ validateNodeContents(ydtNode, SLINK, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network1");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "link-ref", "id2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside another supporting links instance
+ validateNodeContents(ydtNode, SLINK, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network2");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "link-ref", "id3");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supporting-network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network2");
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "node-id", "node1");
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside termination-point
+ validateNodeContents(ydtNode, "t-point", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "tp-id", "tp_id1");
+ ydtNode = ydtNode.getNextSibling();
+
+ //Inside supporting-termination-point
+ validateNodeContents(ydtNode, STP, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network-ref");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "node-ref", "node-ref");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "tp-ref", "tp-ref");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supporting-node", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network3");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "node-ref", "network4");
+
+ ydtNode = ydtNode.getParent().getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "link-id", "id1");
+ ydtNode = ydtNode.getParent().getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "networks-state", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "network", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "network-ref", "network5");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "server-provided", "true");
+ }
+
+ /**
+ * Validates the given built ydt application tree.
+ */
+ private void validateAppTree(YangRequestWorkBench ydtBuilder) {
+
+ // Assign root node to ydtNode for validating purpose.
+ YdtAppContext ydtAppContext = ydtBuilder.getAppRootNode();
+ // Logical root node does not have operation type
+ validateAppLogicalNodeContents(ydtAppContext);
+ ydtAppContext = ydtAppContext.getFirstChild();
+ validateAppModuleNodeContents(ydtAppContext, IETF, OTHER_EDIT);
+ ydtAppContext = ydtAppContext.getFirstChild();
+
+ //Inside link node
+ validateAppNodeContents(ydtAppContext, AUG1, TOPONS, OTHER_EDIT);
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/ListTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/ListTest.java
new file mode 100644
index 0000000..4cee8b2
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/ListTest.java
@@ -0,0 +1,478 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.E_LEAF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.E_LIST;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.E_TOPARENT;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.LISTNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.LWC;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.getTestYdtBuilder;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.getYdtBuilder;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.listWithContainer1Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.listWithContainer2Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.listWithContainerYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.listWithoutContainerYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafListContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+import static org.onosproject.yms.ydt.YdtType.SINGLE_INSTANCE_NODE;
+
+public class ListTest {
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private Set<String> valueSet = new HashSet();
+
+ private static final String[] ERROR = {
+ "rootlist is missing some of the keys of listwithcontainer.",
+ "Duplicate entry with name invalid.",
+ "Some of the key elements are not unique in listwithcontainer.",
+ "Too few key parameters in listwithcontainer." +
+ " Expected 2; actual 1.",
+ "Too many key parameters in listwithcontainer." +
+ " Expected 2; actual 3.",
+ "Application with name \"" + "invalid\" doesn't exist.",
+ "Too many instances of listwithcontainer. Expected maximum " +
+ "instances 3.",
+ "Duplicate entry found under invalidinterval leaf-list node.",
+ "YANG file error : Input value \"string\" is not a valid uint16.",
+ "Schema node with name listwithcontainer doesn't exist.",
+ "Duplicate entry with name rootlist."
+ };
+
+ private static final String[] EXPECTED = {
+ "Entry Node is list.",
+ "Entry Node is rootlist.",
+ "Entry Node is listwithoutcontainer.",
+ "Entry Node is invalidinterval.",
+ "Exit Node is invalidinterval.",
+ "Exit Node is listwithoutcontainer.",
+ "Exit Node is rootlist.",
+ "Exit Node is list."
+ };
+
+ List<String> keysValueList = new ArrayList<>();
+
+ /**
+ * Creates and validates rootlist module with listwithoutcontainer node.
+ */
+ @Test
+ public void listwithoutcontainerTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = listWithoutContainerYdt();
+ validateTree(ydtBuilder);
+ // walker test
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Creates and validates rootlist module with listwithcontainer node
+ * using addMultiInstanceChild interface for adding multi instance node.
+ */
+ @Test
+ public void listwithcontainerTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = listWithContainerYdt();
+ validateListwithcontainerTree(ydtBuilder);
+ }
+
+ /**
+ * Creates and validates rootlist module with listwithcontainer
+ * node using addChild interface for adding multi instance node.
+ */
+ @Test
+ public void listwithcontainer1Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = listWithContainer1Ydt();
+ validateListwithcontainerTree(ydtBuilder);
+ }
+
+ /**
+ * Creates and validates rootlist module with multiple instances of
+ * listwithcontainer node using addMultiInstanceChild interface for adding
+ * multi instance node.
+ */
+ @Test
+ public void listwithcontainer2Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = listWithContainer2Ydt();
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "list", null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "rootlist", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "listwithoutcontainer", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, INV, "12");
+ }
+
+ /**
+ * Validates the given list with container built ydt.
+ */
+ private void validateListwithcontainerTree(
+ YangRequestWorkBench ydtBuilder) {
+
+ valueSet.add("1");
+ valueSet.add("2");
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "list", null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "rootlist", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, LWC, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "invalid", "12");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "invalid1", "12");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafListContents(ydtNode, INV, valueSet);
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "interface", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, INV, "12");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "invalid", "121");
+ }
+
+ /**
+ * Tests the negative error scenario when application name for ydt is
+ * invalid.
+ */
+ @Test
+ public void negative1Test() {
+ thrown.expect(IllegalArgumentException.class);
+ thrown.expectMessage(ERROR[5]);
+ getYdtBuilder("list", "invalid", "ydt.invalid", MERGE);
+ }
+
+ /**
+ * Tests the negative error scenario when list node is not having all
+ * key elements.
+ */
+ @Test
+ public void negative2Test() throws YdtException {
+
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+
+ traversToParentErrorMsgValidator(ydtBuilder, ERROR[0]);
+ }
+
+ /**
+ * Tests the negative error scenario when duplicate entry of list node
+ * is created.
+ */
+ @Test
+ public void negative3Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ leafErrorMsgValidator(ydtBuilder, "invalid", "12", ERROR[1]);
+ }
+
+ /**
+ * Tests the negative error scenario when key elements of list node
+ * are not unique.
+ */
+ @Test
+ public void negative4Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ traversToParentErrorMsgValidator(ydtBuilder, ERROR[2]);
+ }
+
+ /**
+ * Tests the negative error scenario when all key elements of list node
+ * are not supplied.
+ */
+ @Test
+ public void negative5Test() throws YdtException {
+ keysValueList.clear();
+ keysValueList.add("1");
+ keysValueList.add("2");
+ keysValueList.add("2");
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ listNodeErrorMsgValidator(ydtBuilder, keysValueList, ERROR[4]);
+
+ keysValueList.clear();
+ keysValueList.add("1");
+ ydtBuilder = getTestYdtBuilder(LISTNS);
+ listNodeErrorMsgValidator(ydtBuilder, keysValueList, ERROR[3]);
+ }
+
+ /**
+ * Tests the negative error scenario when instances of a list node are
+ * created above the allowed limit.
+ */
+ @Test
+ public void negative6Test() throws YdtException {
+ keysValueList.clear();
+ keysValueList.add("1");
+ keysValueList.add("1");
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addMultiInstanceChild(LWC, LISTNS, keysValueList, null);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "121");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "1211");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "21");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ traversToParentErrorMsgValidator(ydtBuilder, ERROR[6]);
+ }
+
+ /**
+ * Tests the negative error scenario when list node is not having all
+ * key elements.
+ */
+ @Test
+ public void negative7Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ traversToParentErrorMsgValidator(ydtBuilder, ERROR[0]);
+ }
+
+ /**
+ * Tests the negative error scenario when duplicate key entry is created
+ * inside leaf-list node.
+ */
+ @Test
+ public void negative8Test() throws YdtException {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.addChild(LWC, LISTNS);
+ ydtBuilder.addLeaf("invalid", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, LISTNS, "12");
+ ydtBuilder.traverseToParent();
+ leafErrorMsgValidator(ydtBuilder, INV, "12", ERROR[7]);
+ }
+
+ //TODO negative scenario will be handled later
+// /**
+// * Tests the negative error scenario when string is passed for uint16 type
+// * leaf node.
+// */
+// @Test
+// public void negative9Test() throws YdtException {
+// YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+// ydtBuilder.addChild(LWC, LISTNS);
+// ydtBuilder.addLeaf("invalid", LISTNS, "12");
+// ydtBuilder.traverseToParent();
+// ydtBuilder.addLeaf("invalid1", LISTNS, "12");
+// ydtBuilder.traverseToParent();
+// leafErrorMsgValidator(ydtBuilder, INV, "string", ERROR[8]);
+// }
+//
+// /**
+// * Tests the negative error scenario when duplicate key entry created
+// * inside a leaf-list node.
+// */
+// @Test
+// public void negative10Test() throws YdtException {
+// valueSet.clear();
+// valueSet.add("1");
+// valueSet.add("2");
+// valueSet.add("12");
+// YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+// ydtBuilder.addChild(LWC, LISTNS);
+// ydtBuilder.addLeaf("invalid", LISTNS, "12");
+// ydtBuilder.traverseToParent();
+// ydtBuilder.addLeaf("invalid1", LISTNS, "12");
+// ydtBuilder.traverseToParent();
+// ydtBuilder.addLeaf(INV, LISTNS, "12");
+// ydtBuilder.traverseToParent();
+// thrown.expect(IllegalArgumentException.class);
+// thrown.expectMessage(ERROR[7]);
+// ydtBuilder.addLeaf(INV, LISTNS, valueSet);
+// }
+
+// /**
+// * Tests the negative error scenario when string is passed for uint16 type
+// * key entry inside a leaf-list node.
+// */
+// @Test
+// public void negative11Test() throws YdtException {
+// valueSet.clear();
+// valueSet.add("string");
+// YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+// ydtBuilder.addChild(LWC, LISTNS);
+// ydtBuilder.addLeaf("invalid", LISTNS, "12");
+// ydtBuilder.traverseToParent();
+// ydtBuilder.addLeaf("invalid1", LISTNS, "12");
+// ydtBuilder.traverseToParent();
+// ydtBuilder.addLeaf(INV, LISTNS, "12");
+// ydtBuilder.traverseToParent();
+// thrown.expect(DataTypeException.class);
+// thrown.expectMessage(ERROR[8]);
+// ydtBuilder.addLeaf(INV, LISTNS, valueSet);
+// }
+
+ /**
+ * Tests the negative error scenario when list node addition requested
+ * with single instance request type.
+ */
+ @Test
+ public void negative12Test() {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ thrown.expect(IllegalArgumentException.class);
+ thrown.expectMessage(ERROR[9]);
+ ydtBuilder.addChild(LWC, LISTNS, SINGLE_INSTANCE_NODE, MERGE);
+ }
+
+ /**
+ * Tests the negative error scenario when application with requested
+ * name is already part of tree.
+ */
+ @Test
+ public void negative13Test() {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(LISTNS);
+ ydtBuilder.traverseToParent();
+ thrown.expect(IllegalArgumentException.class);
+ thrown.expectMessage(ERROR[10]);
+ ydtBuilder.addChild("rootlist", LISTNS, MERGE);
+ }
+
+ /**
+ * Validate the error message obtained by adding multi instance node in
+ * current context against the given error string.
+ *
+ * @param bldr ydt builder
+ * @param list list of key values
+ * @param error error string
+ */
+ private void listNodeErrorMsgValidator(YangRequestWorkBench bldr,
+ List<String> list, String error) {
+ /*
+ * This try catch is explicitly written to use as utility in other
+ * test cases.
+ */
+ boolean isExpOccurred = false;
+ try {
+ bldr.addMultiInstanceChild(LWC, LISTNS, list, null);
+ } catch (IllegalArgumentException e) {
+ isExpOccurred = true;
+ assertEquals(e.getMessage(), error);
+ }
+ assertEquals(E_LIST + LWC, isExpOccurred, true);
+ }
+
+ /**
+ * Validate the error message obtained by traversing back to parent of
+ * current context against the given error string.
+ *
+ * @param ydtBuilder ydt builder
+ * @param error error string
+ */
+ private void traversToParentErrorMsgValidator(
+ YangRequestWorkBench ydtBuilder, String error) {
+ /*
+ * This try catch is explicitly written to use as utility in other
+ * test cases.
+ */
+ boolean isExpOccurred = false;
+ try {
+ ydtBuilder.traverseToParent();
+ } catch (IllegalStateException e) {
+ isExpOccurred = true;
+ assertEquals(e.getMessage(), error);
+ }
+ assertEquals(E_TOPARENT, isExpOccurred, true);
+ }
+
+ /**
+ * Validate the error message obtained by adding leaf node in
+ * current context against the given error string.
+ *
+ * @param bldr ydt builder
+ * @param name name of the leaf
+ * @param val leaf value
+ * @param error error string
+ */
+ private void leafErrorMsgValidator(
+ YangRequestWorkBench bldr, String name, String val, String error) {
+ /*
+ * This try catch is explicitly written to use as utility in other
+ * test cases.
+ */
+ boolean isExpOccurred = false;
+ try {
+ bldr.addLeaf(name, LISTNS, val);
+ } catch (IllegalArgumentException e) {
+ isExpOccurred = true;
+ assertEquals(e.getMessage(), error);
+ }
+ assertEquals(E_LEAF + name, isExpOccurred, true);
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/LogisticsManagerTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/LogisticsManagerTest.java
new file mode 100644
index 0000000..a64c4c4
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/LogisticsManagerTest.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.onosproject.yms.app.ydt.YdtTestUtils.logisticsManagerYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafListContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class LogisticsManagerTest {
+
+ // Logger list is used for walker testing.
+ private final List<String> logger = new ArrayList<>();
+
+ private Set<String> valueSet = new HashSet();
+
+ private static final String[] EXPECTED = {
+ "Entry Node is logisticsmanager.",
+ "Entry Node is customssupervisor.",
+ "Entry Node is supervisor.",
+ "Exit Node is supervisor.",
+ "Exit Node is customssupervisor.",
+ "Entry Node is merchandisersupervisor.",
+ "Entry Node is supervisor.",
+ "Exit Node is supervisor.",
+ "Exit Node is merchandisersupervisor.",
+ "Entry Node is materialsupervisor.",
+ "Entry Node is supervisor.",
+ "Entry Node is name.",
+ "Exit Node is name.",
+ "Entry Node is departmentId.",
+ "Exit Node is departmentId.",
+ "Exit Node is supervisor.",
+ "Entry Node is supervisor.",
+ "Entry Node is name.",
+ "Exit Node is name.",
+ "Entry Node is departmentId.",
+ "Exit Node is departmentId.",
+ "Exit Node is supervisor.",
+ "Exit Node is materialsupervisor.",
+ "Entry Node is purchasingsupervisor.",
+ "Entry Node is supervisor.",
+ "Entry Node is purchasing-specialist.",
+ "Exit Node is purchasing-specialist.",
+ "Entry Node is support.",
+ "Exit Node is support.",
+ "Exit Node is supervisor.",
+ "Exit Node is purchasingsupervisor.",
+ "Entry Node is warehousesupervisor.",
+ "Entry Node is supervisor.",
+ "Exit Node is supervisor.",
+ "Exit Node is warehousesupervisor.",
+ "Entry Node is tradingsupervisor.",
+ "Entry Node is supervisor.",
+ "Exit Node is supervisor.",
+ "Exit Node is tradingsupervisor.",
+ "Entry Node is employeeid.",
+ "Entry Node is employeeid.",
+ "Exit Node is employeeid.",
+ "Exit Node is employeeid.",
+ "Exit Node is logisticsmanager."
+ };
+
+ /**
+ * Creates and validates logistics manager ydt.
+ */
+ @Test
+ public void logisticsManagerTest() {
+ YangRequestWorkBench ydtBuilder = logisticsManagerYdt();
+ validateTree(ydtBuilder);
+ // walker test
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+ valueSet.add("1");
+ valueSet.add("2");
+ valueSet.add("3");
+ valueSet.add("4");
+ valueSet.add("5");
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "logisticsmanager", null);
+
+ ydtNode = ydtNode.getFirstChild();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "customssupervisor", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "supervisor", "abc");
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "merchandisersupervisor", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "supervisor", "abc");
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "materialsupervisor", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "supervisor", MERGE);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "name", "abc");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "departmentId", "xyz");
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "supervisor", MERGE);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "name", "ab");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "departmentId", "xy");
+
+ ydtNode = ydtNode.getParent().getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "purchasingsupervisor", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "supervisor", MERGE);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "purchasing-specialist", "abc");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "support", "xyz");
+
+ ydtNode = ydtNode.getParent().getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "warehousesupervisor", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafListContents(ydtNode, "supervisor", valueSet);
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "tradingsupervisor", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "supervisor", "abc");
+
+ ydtNode = ydtNode.getParent();
+
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "employeeid", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafListContents(ydtNode, "employeeid", valueSet);
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/MockYangSchemaRegistry.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/MockYangSchemaRegistry.java
new file mode 100644
index 0000000..253332e
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/MockYangSchemaRegistry.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.onosproject.yangutils.datamodel.YangSchemaNode;
+import org.onosproject.yms.app.ysr.DefaultYangSchemaRegistry;
+import org.onosproject.yms.app.ysr.TestYangSchemaNodeProvider;
+import org.onosproject.yms.app.ysr.YangSchemaRegistry;
+import org.onosproject.yms.ysr.YangModuleIdentifier;
+import org.onosproject.yms.ysr.YangModuleLibrary;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * Represent Yang schema registry. Yang schema registry provides
+ * interface to an application to register its YANG
+ * schema with YMS. It provides YANG schema nodes to YDT, YNB and YSB.
+ */
+public class MockYangSchemaRegistry implements YangSchemaRegistry {
+
+ @Override
+ public void registerApplication(Object managerObject, Class<?> serviceClass) {
+
+ }
+
+ @Override
+ public void unRegisterApplication(Object managerObject,
+ Class<?> serviceClass) {
+ }
+
+ @Override
+ public Object getRegisteredApplication(YangSchemaNode yangSchemaNode) {
+ return null;
+ }
+
+ @Override
+ public YangSchemaNode getYangSchemaNodeUsingAppName(String schemaName) {
+ return null;
+ }
+
+ @Override
+ public YangSchemaNode getYangSchemaNodeUsingSchemaName(String appName) {
+
+ final String target = "target/TestYangSchemaNodeProvider";
+ TestYangSchemaNodeProvider testYangSchemaNodeProvider =
+ new TestYangSchemaNodeProvider();
+
+ String searchDir = "src/test/resources/ydtTestYangFiles/";
+
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+
+ DefaultYangSchemaRegistry registry = testYangSchemaNodeProvider
+ .getDefaultYangSchemaRegistry();
+ YangSchemaNode yangNode = registry
+ .getYangSchemaNodeUsingSchemaName(appName);
+ assertEquals(appName, yangNode.getName());
+ return yangNode;
+ }
+
+ @Override
+ public YangSchemaNode
+ getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ String rootInterfaceFileName) {
+ return null;
+ }
+
+ @Override
+ public YangSchemaNode getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ String rootOpParamFileName) {
+ return null;
+ }
+
+ @Override
+ public YangSchemaNode getRootYangSchemaNodeForNotification(
+ String eventSubject) {
+ return null;
+ }
+
+ @Override
+ public Class<?> getRegisteredClass(YangSchemaNode schemaNode) {
+ return null;
+ }
+
+ @Override
+ public boolean verifyNotificationObject(Object appObj, Class<?> service) {
+ return false;
+ }
+
+ @Override
+ public void flushYsrData() {
+
+ }
+
+ @Override
+ public String getYangFile(YangModuleIdentifier moduleIdentifier) {
+ return null;
+ }
+
+ @Override
+ public void processModuleLibrary(String serviceName, YangModuleLibrary library) {
+
+ }
+
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/RpcTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/RpcTest.java
new file mode 100644
index 0000000..8ca52c1
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/RpcTest.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.onosproject.yms.app.ydt.YdtTestUtils.helloOnos;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.walkINTree;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class RpcTest {
+
+ // Logger list is used for walker testing.
+ private final List<String> logger = new ArrayList<>();
+
+ private static final String[] EXPECTED = {
+ "Entry Node is Hello-ONOS.",
+ "Entry Node is Hello_ONOS.",
+ "Entry Node is hello-world.",
+ "Entry Node is input.",
+ "Entry Node is name.",
+ "Exit Node is name.",
+ "Entry Node is surName.",
+ "Exit Node is surName.",
+ "Entry Node is stringList.",
+ "Entry Node is string1.",
+ "Exit Node is string1.",
+ "Entry Node is string2.",
+ "Exit Node is string2.",
+ "Exit Node is stringList.",
+ "Exit Node is input.",
+ "Exit Node is hello-world.",
+ "Exit Node is Hello_ONOS.",
+ "Exit Node is Hello-ONOS."
+ };
+
+ /**
+ * Creates and validates hello onos ydt.
+ */
+ @Test
+ public void rpc1Test() {
+ YangRequestWorkBench ydtBuilder = helloOnos();
+ validateTree(ydtBuilder);
+ // walker test
+ walkINTree(ydtBuilder, EXPECTED);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "Hello-ONOS", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "Hello_ONOS", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "hello-world", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "input", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "name", "onos");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "surName", "yang");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "stringList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "string1", "ON");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "string2", "LAB");
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtBitTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtBitTest.java
new file mode 100644
index 0000000..babd005
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtBitTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import static org.onosproject.yms.app.ydt.YdtTestUtils.bitYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtBitTest {
+
+ /*
+ BINARY
+
+ Positive scenario
+ input with position 0
+ input with position 1
+ input with position 2
+ */
+
+ /**
+ * Creates and validates bit ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() {
+ YangRequestWorkBench ydtBuilder = bitYdt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "builtInType", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "bit", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "bitList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "bit", "disable-nagle");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "bitList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "bit", "auto-sense-speed");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "bitList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "bit", "ten-Mb-only");
+ }
+
+ //TODO negative scenario will be handled later
+// /*
+// Negative scenario
+//
+// input with position 0
+// input with position 1
+// input with position 2
+// */
+//
+// /**
+// * Tests all the negative scenario's for bit data type.
+// */
+// @Test
+// public void negativeTest() {
+// validateErrMsg("bit", BITNS, "0", BIT, "bitList");
+// validateErrMsg("bit", BITNS, "default", BIT, "bitList");
+// validateErrMsg("bit", BITNS, "1", BIT, "bitList");
+// validateErrMsg("bit", BITNS, "", BIT, "bitList");
+// }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtBooleanTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtBooleanTest.java
new file mode 100644
index 0000000..88cc608
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtBooleanTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+
+import static org.onosproject.yms.app.ydt.YdtTestUtils.booleanYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtBooleanTest {
+
+ /*
+ BOOLEAN
+ Positive scenario
+ input with in "booleanList" and false
+ */
+
+ /**
+ * Creates and validates boolean ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() {
+ YangRequestWorkBench ydtBuilder = booleanYdt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, "builtInType", null);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "bool", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "booleanList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "boolean", "true");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "booleanList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "boolean", "false");
+ }
+
+ //TODO negative scenario will be handled later
+// /*
+// Negative scenario
+//
+// input with in non zero value in case of "booleanList"
+// input with zero value in case of false
+// input with empty value in case of false
+// */
+//
+// /**
+// * Tests all the negative scenario's for boolean data type.
+// */
+// @Test
+// public void negativeTest() {
+// validateErrMsg("boolean", BOOLNS, "10", BOOL, "booleanList");
+// validateErrMsg("boolean", BOOLNS, "0", BOOL, "booleanList");
+// validateErrMsg("boolean", BOOLNS, "", BOOL, "booleanList");
+// validateErrMsg("boolean", BOOLNS, "-1", BOOL, "booleanList");
+// validateErrMsg("boolean", BOOLNS, "tru", BOOL, "booleanList");
+// validateErrMsg("boolean", BOOLNS, "boolean", BOOL, "booleanList");
+// }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtDecimal64Test.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtDecimal64Test.java
new file mode 100644
index 0000000..3a0befb
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtDecimal64Test.java
@@ -0,0 +1,226 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.B;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.C;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.E;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.F;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.G;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.H;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MRV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.NIWMF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.NWF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.PIWMF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.PWF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.decimal64Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtDecimal64Test {
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ /*
+
+ Positive scenario
+
+ input at boundry for decimal64 with fraction 2
+ i. min value
+ ii. max value
+
+ input at boundry for decimal64 with minimum fraction
+ i. min value
+ ii. mid value
+ iii. max value
+
+ input at boundry for decimal64 with maximum fraction
+ i. min value
+ ii. mid value
+ iii. max value
+
+ input with in range
+ if range is 10 to 100 for integer
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for decimal64
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is "min .. 3.14 | 10 | 20..max" for decimal64
+ i.1. input min
+ i.2. input 2.505
+ i.3. input 3.14
+ i.4. input 10
+ i.5. input 20
+ i.6. input 92233720368547757
+ i.7. input 92233720368547758.07
+
+ */
+
+ /**
+ * Creates and validates decimal64 ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = decimal64Ydt();
+ validateTree(ydtBuilder);
+
+ //TODO need to be handled later
+// YangRequestWorkBench sbiYdt = validateYangObject(
+// ydtBuilder, "builtInType", "ydt.decimal64");
+// validateTree(sbiYdt);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "decimal64", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "negInt", C);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "posInt", A);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, NIWMF, F);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, PIWMF, G);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, NWF, H);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, PWF, E);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "decimal", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "decimal", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "decimal", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "decimal", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "decimal", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "decimal", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", C);
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", "2.505");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", "3.14");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", B);
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revDecimal", A);
+ }
+
+ //TODO negative scenario will be handled later
+ /*
+ Negative scenario
+
+ input with position 0
+ input with position 1
+ input with position 2
+ */
+
+// /**
+// * Tests all the negative scenario's for bit data type.
+// */
+// @Test
+// public void negativeTest() {
+// thrown.expect(IllegalArgumentException.class);
+// thrown.expectMessage(E_D64);
+// YangRequestWorkBench ydtBuilder;
+// ydtBuilder = getYdtBuilder("builtInType", "decimal64", "ydt.decimal64",
+// MERGE);
+// ydtBuilder.addLeaf("l1", null, "-9.1999999999e17");
+// ydtBuilder.traverseToParent();
+// }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtEmptyTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtEmptyTest.java
new file mode 100644
index 0000000..7c41f5f
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtEmptyTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.emptyTypeYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtEmptyTest {
+
+ /*
+ EMPTY
+ Positive scenario
+ input with in empty.
+ */
+
+ /**
+ * Creates and validates empty ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = emptyTypeYdt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "emptydata", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "emptyList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "empty", "");
+ }
+
+ //TODO negative scenario will be handled later
+// /*
+// Negative scenario
+//
+// input with " "
+// input with "tab"
+// input with """"
+// */
+//
+// /**
+// * Tests all the negative scenario's for empty data type.
+// */
+// @Test
+// public void negativeTest() throws YdtException {
+// validateErrMsg("empty", EMPTYNS, " ", EMPTY, "emptyList");
+// validateErrMsg("empty", EMPTYNS, " ", EMPTY, "emptyList");
+// validateErrMsg("empty", EMPTYNS, " ", EMPTY, "emptyList");
+// }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtEnumTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtEnumTest.java
new file mode 100644
index 0000000..7fedce9
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtEnumTest.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.enumYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtEnumTest {
+
+/*
+ ENUM
+
+ Positive scenario
+
+ input with in enum
+ input with "ten"
+ input with "hundred"
+ input with "thousand"
+*/
+
+ /**
+ * Creates and validates enum ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = enumYdt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "enumtest", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "enumList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "enumleaf", "ten");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "enumList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "enumleaf", "hundred");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "enumList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "enumleaf", "thousand");
+ }
+
+ //TODO negative scenario will be handled later
+// /*
+// Negative scenario
+//
+// input with "10"
+// input with "thousands"
+// */
+//
+// /**
+// * Tests all the negative scenario's for enum data type.
+// */
+// @Test
+// public void negativeTest() throws YdtException {
+// validateErrMsg("enumleaf", ENUMNS, "10", ENUM, "enumList");
+// validateErrMsg("enumleaf", ENUMNS, "thousands", ENUM, "enumList");
+// validateErrMsg("enumleaf", ENUMNS, "enumeration", ENUM, "enumList");
+// }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtInteger16Test.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtInteger16Test.java
new file mode 100644
index 0000000..a842d4c
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtInteger16Test.java
@@ -0,0 +1,418 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MRV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.RUI;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.integer16Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtInteger16Test {
+
+ /*
+ Positive scenario
+
+ input at boundry for integer
+ i. min value
+ ii. max value
+
+ input at boundry for uinteger
+ i. min value
+ ii. max value
+
+ input with in range
+ if range is 10 to 100 for integer
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ if range is 10 to 100 for uinteger
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is "min .. 2 | 10 | 20..max" for integer
+ i.1. input -32768
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 32767
+
+ if range is "min .. 2 | 10 | 20..max" for uInteger
+ i.1. input 0
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 65535
+ */
+
+ /**
+ * Creates and validates integer16 ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = integer16Ydt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "integer16", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "negInt", "-32768");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "posInt", "32767");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "minUInt", "0");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "maxUInt", "65535");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDUIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINUIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXUIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "100");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "-32768");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+
+ validate1Tree(ydtNode);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validate1Tree(YdtNode ydtNode) {
+
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "32767");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "0");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "65535");
+ }
+
+ //TODO negative scenario will be handled later
+ /*
+ Negative scenario
+
+ wrong type input
+ i. input string instead of integer
+ ii. input string instead of uinteger
+
+ input out of range
+ i. input for int 8 range -32768 to 32767
+ i.1. input -32769
+ i.2. input 32768
+
+ ii. input for uint 8 range 0 to 65535
+ ii.1. input -32769
+ ii.2. input 65536
+
+ input out of range parameter
+ if range is 10 to 100 for int
+ i.1. input 9
+ i.2. input 101
+
+ if range is 10 to 100 for uInt
+ i.1. input 9
+ i.2. input 101
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ input with multi interval range
+ if range is min .. | 10 | 20..max for integer
+ i.1. input -32769
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 32768
+
+ if range is min .. 3 | 10 | 20..max for uinteger
+ i.1. input -32769
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 65536
+
+ */
+
+ /**
+ * Tests all the minimum and maximum value's negative scenario's for
+ * signed integer16 data type.
+ */
+// @Test
+// public void negative1Test() throws YdtException {
+// validateErrMsg("posInt", INT16NS, "integer", SINT16, null);
+// validateErrMsg("posInt", INT16NS, "127.0", SINT16, null);
+// validateErrMsg("negInt", INT16NS, "-32769", SINT16, null);
+// validateErrMsg("posInt", INT16NS, "32768", SINT16, null);
+// validateErrMsg(MINIWR, INT16NS, "9", CAPSINT16, null);
+// validateErrMsg(MAXIWR, INT16NS, "101", CAPSINT16, null);
+// }
+//
+// /**
+// * Tests all the minimum and maximum value's negative scenario's for
+// * unsigned integer16 data type.
+// */
+// @Test
+// public void negative2Test() throws YdtException {
+// validateErrMsg("maxUInt", INT16NS, "integer", SUINT16, null);
+// validateErrMsg("maxUInt", INT16NS, "127.0", SUINT16, null);
+// validateErrMsg("minUInt", INT16NS, "-32769", MINVALUE, null);
+// validateErrMsg("maxUInt", INT16NS, "65536", MAXUINT16, null);
+// validateErrMsg(MINUIWR, INT16NS, "9", CAPSUINT16, null);
+// validateErrMsg(MAXUIWR, INT16NS, "101", CAPSUINT16, null);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for signed integer16 data type
+// * with range "10..40 | 50..100".
+// */
+// @Test
+// public void negative3Test() throws YdtException {
+// validateErrMsg("integer", INT16NS, "9", CAPSINT16, MRV);
+// validateErrMsg("integer", INT16NS, "41", CAPSINT16, MRV);
+// validateErrMsg("integer", INT16NS, "49", CAPSINT16, MRV);
+// validateErrMsg("integer", INT16NS, "101", CAPSINT16, MRV);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for unsigned integer16 data type
+// * with range "10..40 | 50..100".
+// */
+// @Test
+// public void negative4Test() throws YdtException {
+// validateErrMsg("UnInteger", INT16NS, "9", CAPSUINT16, MRV);
+// validateErrMsg("UnInteger", INT16NS, "41", CAPSUINT16, MRV);
+// validateErrMsg("UnInteger", INT16NS, "49", CAPSUINT16, MRV);
+// validateErrMsg("UnInteger", INT16NS, "101", CAPSUINT16, MRV);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for signed integer16 data type
+// * with range "min .. 2 | 10 | 20..max".
+// */
+// @Test
+// public void negative5Test() throws YdtException {
+// // multi range validation
+// validateErrMsg("revInteger", INT16NS, "-32769", SINT16, MRV);
+// validateErrMsg("revInteger", INT16NS, "19", CAPSINT16, MRV);
+// validateErrMsg("revInteger", INT16NS, "4", CAPSINT16, MRV);
+// validateErrMsg("revInteger", INT16NS, "32768", SINT16, MRV);
+// validateErrMsg("revInteger", INT16NS, "9", CAPSINT16, MRV);
+// validateErrMsg("revInteger", INT16NS, "11", CAPSINT16, MRV);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for unsigned integer16 data type
+// * with range "min .. 2 | 10 | 20..max".
+// */
+// @Test
+// public void negative6Test() throws YdtException {
+// // multi range validation
+// validateErrMsg(RUI, INT16NS, "-32769", MINVALUE, MRV);
+// validateErrMsg(RUI, INT16NS, "4", CAPSUINT16, MRV);
+// validateErrMsg(RUI, INT16NS, "9", CAPSUINT16, MRV);
+// validateErrMsg(RUI, INT16NS, "11", CAPSUINT16, MRV);
+// validateErrMsg(RUI, INT16NS, "19", CAPSUINT16, MRV);
+// validateErrMsg(RUI, INT16NS, "65536", MAXUINT16, MRV);
+// }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtInteger32Test.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtInteger32Test.java
new file mode 100644
index 0000000..c9c22ba
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtInteger32Test.java
@@ -0,0 +1,419 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINVALUE;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MRV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.RUI;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.integer32Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtInteger32Test {
+
+ /*
+ Positive scenario
+
+ input at boundry for integer
+ i. min value
+ ii. max value
+
+ input at boundry for uinteger
+ i. min value
+ ii. max value
+
+ input with in range
+ if range is 10 to 100 for integer
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ if range is 10 to 100 for uinteger
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is "min .. 2 | 10 | 20..max" for integer
+ i.1. input -2147483648
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 2147483647
+
+ if range is "min .. 2 | 10 | 20..max" for uInteger
+ i.1. input 0
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 4294967295
+ */
+
+ /**
+ * Creates and validates integer32 ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = integer32Ydt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "integer32", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "negInt", "-2147483648");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "posInt", "2147483647");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "minUInt", MINVALUE);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "maxUInt", MAXUINT32);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDUIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINUIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXUIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "100");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "-2147483648");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+
+ validate1Tree(ydtNode);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validate1Tree(YdtNode ydtNode) {
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "2147483647");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, MINVALUE);
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, MAXUINT32);
+ }
+
+ //TODO negative scenario will be handled later
+ /*
+ Negative scenario
+
+ wrong type input
+ i. input string instead of integer
+ ii. input string instead of uinteger
+
+ input out of range
+ i. input for int 8 range -2147483648 to 2147483647
+ i.1. input -2147483649
+ i.2. input 2147483648
+
+ ii. input for uint 8 range 0 to 4294967295
+ ii.1. input -2147483649
+ ii.2. input 4294967296
+
+ input out of range parameter
+ if range is 10 to 100 for int
+ i.1. input 9
+ i.2. input 101
+
+ if range is 10 to 100 for uInt
+ i.1. input 9
+ i.2. input 101
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ input with multi interval range
+ if range is min .. | 10 | 20..max for integer
+ i.1. input -2147483649
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 256
+
+ if range is min .. 3 | 10 | 20..max for uinteger
+ i.1. input -2147483649
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 4294967296
+
+ */
+
+ /**
+ * Tests all the minimum and maximum value's negative scenario's for
+ * signed integer32 data type.
+ */
+// @Test
+// public void negative1Test() throws YdtException {
+// validateErrMsg("posInt", INT32NS, "integer", SINT32, null);
+// validateErrMsg("posInt", INT32NS, "127.0", SINT32, null);
+// validateErrMsg("negInt", INT32NS, "-2147483649", SINT32, null);
+// validateErrMsg("posInt", INT32NS, "2147483648", SINT32, null);
+// validateErrMsg(MINIWR, INT32NS, "9", CAPSINT32, null);
+// validateErrMsg(MAXIWR, INT32NS, "101", CAPSINT32, null);
+// }
+//
+// /**
+// * Tests all the minimum and maximum value's negative scenario's for
+// * unsigned integer32 data type.
+// */
+// @Test
+// public void negative2Test() throws YdtException {
+// validateErrMsg("maxUInt", INT32NS, "integer", SUINT32, null);
+// validateErrMsg("maxUInt", INT32NS, "127.0", SUINT32, null);
+// validateErrMsg("minUInt", INT32NS, "-2147483649", MINVALUE, null);
+// validateErrMsg("maxUInt", INT32NS, "4294967296", MAXUINT32, null);
+// validateErrMsg(MINUIWR, INT32NS, "9", CAPSUINT32, null);
+// validateErrMsg(MAXUIWR, INT32NS, "101", CAPSUINT32, null);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for signed integer32 data type
+// * with range "10..40 | 50..100".
+// */
+// @Test
+// public void negative3Test() throws YdtException {
+// validateErrMsg("integer", INT32NS, "9", CAPSINT32, MRV);
+// validateErrMsg("integer", INT32NS, "41", CAPSINT32, MRV);
+// validateErrMsg("integer", INT32NS, "49", CAPSINT32, MRV);
+// validateErrMsg("integer", INT32NS, "101", CAPSINT32, MRV);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for unsigned integer32 data type
+// * with range "10..40 | 50..100".
+// */
+// @Test
+// public void negative4Test() throws YdtException {
+// validateErrMsg("UnInteger", INT32NS, "9", CAPSUINT32, MRV);
+// validateErrMsg("UnInteger", INT32NS, "41", CAPSUINT32, MRV);
+// validateErrMsg("UnInteger", INT32NS, "49", CAPSUINT32, MRV);
+// validateErrMsg("UnInteger", INT32NS, "101", CAPSUINT32, MRV);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for signed integer32 data type
+// * with range "min .. 2 | 10 | 20..max".
+// */
+// @Test
+// public void negative5Test() throws YdtException {
+// // Multi range validation
+// validateErrMsg("revInteger", INT32NS, "-2147483649", SINT32, MRV);
+// validateErrMsg("revInteger", INT32NS, "4", CAPSINT32, MRV);
+// validateErrMsg("revInteger", INT32NS, "9", CAPSINT32, MRV);
+// validateErrMsg("revInteger", INT32NS, "11", CAPSINT32, MRV);
+// validateErrMsg("revInteger", INT32NS, "19", CAPSINT32, MRV);
+// validateErrMsg("revInteger", INT32NS, "2147483648", SINT32, MRV);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for unsigned integer32 data type
+// * with range "min .. 2 | 10 | 20..max".
+// */
+// @Test
+// public void negative6Test() throws YdtException {
+// // Multi range validation
+// validateErrMsg(RUI, INT32NS, "-2147483649", MINVALUE, MRV);
+// validateErrMsg(RUI, INT32NS, "4", CAPSUINT32, MRV);
+// validateErrMsg(RUI, INT32NS, "9", CAPSUINT32, MRV);
+// validateErrMsg(RUI, INT32NS, "11", CAPSUINT32, MRV);
+// validateErrMsg(RUI, INT32NS, "19", CAPSUINT32, MRV);
+// validateErrMsg(RUI, INT32NS, "4294967296", MAXUINT32, MRV);
+// }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtInteger64Test.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtInteger64Test.java
new file mode 100644
index 0000000..da2b86c
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtInteger64Test.java
@@ -0,0 +1,422 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.J;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.K;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINVALUE;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MRV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.RUI;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.integer64Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtInteger64Test {
+
+ /*
+
+ Positive scenario
+
+ input at boundry for integer
+ i. min value
+ ii. max value
+
+ input at boundry for uinteger
+ i. min value
+ ii. max value
+
+ input with in range
+ if range is 10 to 100 for integer
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ if range is 10 to 100 for uinteger
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is "min .. 2 | 10 | 20..max" for integer
+ i.1. input -9223372036854775808
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 9223372036854775807
+
+ if range is "min .. 2 | 10 | 20..max" for uInteger
+ i.1. input 0
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 18446744073709551615
+ */
+
+ /**
+ * Creates and validates integer64 ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = integer64Ydt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "integer64", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "negInt", K);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "posInt", J);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "minUInt", MINVALUE);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "maxUInt", MAXUINT64);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDUIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINUIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXUIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "100");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", K);
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+
+ validate1Tree(ydtNode);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validate1Tree(YdtNode ydtNode) {
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", J);
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, MINVALUE);
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, MAXUINT64);
+ }
+
+ //TODO negative scenario will be handled later
+ /*
+ Negative scenario
+
+ wrong type input
+ i. input string instead of integer
+ ii. input string instead of uinteger
+
+ input out of range
+ i. input for int 8 range -9223372036854775808 to 9223372036854775807
+ i.1. input -9223372036854775809
+ i.2. input 9223372036854775808
+
+ ii. input for uint 8 range 0 to 18446744073709551615
+ ii.1. input -9223372036854775809
+ ii.2. input 18446744073709551616
+
+ input out of range parameter
+ if range is 10 to 100 for int
+ i.1. input 9
+ i.2. input 101
+
+ if range is 10 to 100 for uInt
+ i.1. input 9
+ i.2. input 101
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ input with multi interval range
+ if range is min .. | 10 | 20..max for integer
+ i.1. input -9223372036854775809
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 9223372036854775808
+
+ if range is min .. 3 | 10 | 20..max for uinteger
+ i.1. input -9223372036854775809
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 18446744073709551616
+
+ */
+
+ /**
+ * Tests all the minimum and maximum value's negative scenario's for
+ * signed integer64 data type.
+ */
+// @Test
+// public void negative1Test() throws YdtException {
+// validateErrMsg("posInt", INT64NS, "integer", SMALLINT64, null);
+// validateErrMsg("posInt", INT64NS, "127.0", SMALLINT64, null);
+// validateErrMsg("negInt", INT64NS, L, SMALLINT64, null);
+// validateErrMsg("posInt", INT64NS, I, SMALLINT64, null);
+// validateErrMsg(MINIWR, INT64NS, "9", CAPSINT64, null);
+// validateErrMsg(MAXIWR, INT64NS, "101", CAPSINT64, null);
+// }
+//
+// /**
+// * Tests all the minimum and maximum value's negative scenario's for
+// * unsigned integer64 data type.
+// */
+// @Test
+// public void negative2Test() throws YdtException {
+// validateErrMsg("maxUInt", INT64NS, "integer", SMALLUINT64, null);
+// validateErrMsg("maxUInt", INT64NS, "127.0", SMALLUINT64, null);
+// validateErrMsg("minUInt", INT64NS, L, MINVALUE, null);
+// validateErrMsg("maxUInt", INT64NS, M, MAXUINT64, null);
+// validateErrMsg(MINUIWR, INT64NS, "9", CAPSUINT64, null);
+// validateErrMsg(MAXUIWR, INT64NS, "101", CAPSUINT64, null);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for signed integer64 data type
+// * with range "10..40 | 50..100".
+// */
+// @Test
+// public void negative3Test() throws YdtException {
+// validateErrMsg("integer", INT64NS, "9", CAPSINT64, MRV);
+// validateErrMsg("integer", INT64NS, "41", CAPSINT64, MRV);
+// validateErrMsg("integer", INT64NS, "49", CAPSINT64, MRV);
+// validateErrMsg("integer", INT64NS, "101", CAPSINT64, MRV);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for unsigned integer64 data type
+// * with range "10..40 | 50..100".
+// */
+// @Test
+// public void negative4Test() throws YdtException {
+// validateErrMsg("UnInteger", INT64NS, "9", CAPSUINT64, MRV);
+// validateErrMsg("UnInteger", INT64NS, "41", CAPSUINT64, MRV);
+// validateErrMsg("UnInteger", INT64NS, "49", CAPSUINT64, MRV);
+// validateErrMsg("UnInteger", INT64NS, "101", CAPSUINT64, MRV);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for signed integer64 data type
+// * with range "min .. 2 | 10 | 20..max".
+// */
+// @Test
+// public void negative5Test() throws YdtException {
+// // multi range validation
+// validateErrMsg("revInteger", INT64NS, L, SMALLINT64, MRV);
+// validateErrMsg("revInteger", INT64NS, "11", CAPSINT64, MRV);
+// validateErrMsg("revInteger", INT64NS, "4", CAPSINT64, MRV);
+// validateErrMsg("revInteger", INT64NS, "9", CAPSINT64, MRV);
+// validateErrMsg("revInteger", INT64NS, "19", CAPSINT64, MRV);
+// validateErrMsg("revInteger", INT64NS, I, SMALLINT64, MRV);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for unsigned integer64 data type
+// * with range "min .. 2 | 10 | 20..max".
+// */
+// @Test
+// public void negative6Test() throws YdtException {
+// // multi range validation
+// validateErrMsg(RUI, INT64NS, L, MINVALUE, MRV);
+// validateErrMsg(RUI, INT64NS, "4", CAPSUINT64, MRV);
+// validateErrMsg(RUI, INT64NS, "9", CAPSUINT64, MRV);
+// validateErrMsg(RUI, INT64NS, "11", CAPSUINT64, MRV);
+// validateErrMsg(RUI, INT64NS, "19", CAPSUINT64, MRV);
+// validateErrMsg(RUI, INT64NS, M, MAXUINT64, MRV);
+// }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtInteger8Test.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtInteger8Test.java
new file mode 100644
index 0000000..65c8fe9
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtInteger8Test.java
@@ -0,0 +1,418 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MIDUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINUIWR;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINVALUE;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MRV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.RUI;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.integer8Ydt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtInteger8Test {
+
+ /*
+ Positive scenario
+
+ input at boundry for integer
+ i. min value
+ ii. max value
+
+ input at boundry for uinteger
+ i. min value
+ ii. max value
+
+ input with in range
+ if range is 10 to 100 for integer
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ if range is 10 to 100 for uinteger
+ i.1. input 11
+ i.2. min value 10
+ i.3. max value 100
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 11
+ i.2. input 10
+ i.3. input 40
+ i.4. input 50
+ i.5. input 55
+ i.6. input 100
+
+ if range is "min .. 2 | 10 | 20..max" for integer
+ i.1. input -128
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 127
+
+ if range is "min .. 2 | 10 | 20..max" for uInteger
+ i.1. input 0
+ i.2. input 1
+ i.3. input 2
+ i.4. input 10
+ i.5. input 20
+ i.6. input 100
+ i.7. input 255
+ */
+
+ /**
+ * Creates and validates integer8 ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = integer8Ydt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "integer8", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "negInt", "-128");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "posInt", "127");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "minUInt", MINVALUE);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, "maxUInt", MAXUINT8);
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MIDUIWR, "11");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MINUIWR, "10");
+ ydtNode = ydtNode.getNextSibling();
+ validateLeafContents(ydtNode, MAXUIWR, "100");
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "integer", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "11");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "40");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "50");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "55");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "UnInteger", "100");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "-128");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ validate1Tree(ydtNode);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validate1Tree(YdtNode ydtNode) {
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "revInteger", "127");
+
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, MINVALUE);
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "1");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "2");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "10");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "20");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, "100");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, MRV, MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, RUI, MAXUINT8);
+ }
+
+ //TODO negative scenario will be handled later
+ /*
+ Negative scenario
+
+ wrong type input
+ i. input string instead of integer
+ ii. input string instead of uinteger
+
+ input out of range
+ i. input for int 8 range -128 to 127
+ i.1. input -129
+ i.2. input 128
+
+ ii. input for uint 8 range 0 to 255
+ ii.1. input -128
+ ii.2. input 256
+
+ input out of range parameter
+ if range is 10 to 100 for int
+ i.1. input 9
+ i.2. input 101
+
+ if range is 10 to 100 for uInt
+ i.1. input 9
+ i.2. input 101
+
+ input with multi interval range
+ if range is 10..40 | 50..100 for integer
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ if range is 10..40 | 50..100 for uinteger
+ i.1. input 9
+ i.2. input 41
+ i.3. input 49
+ i.4. input 101
+
+ input with multi interval range
+ if range is min .. | 10 | 20..max for integer
+ i.1. input -129
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 128
+
+ if range is min .. 3 | 10 | 20..max for uinteger
+ i.1. input -129
+ i.2. input 4
+ i.3. input 9
+ i.4. input 11
+ i.5. input 19
+ i.6. input 256
+
+ */
+
+ /**
+ * Tests all the minimum and maximum value's negative scenario's for
+ * signed integer8 data type.
+ */
+// @Test
+// public void negative1Test() throws YdtException {
+// validateErrMsg("posInt", INT8NS, "integer", SMALLINT8, null);
+// validateErrMsg("posInt", INT8NS, "127.0", SMALLINT8, null);
+// validateErrMsg("negInt", INT8NS, "-129", SMALLINT8, null);
+// validateErrMsg("posInt", INT8NS, "128", SMALLINT8, null);
+// validateErrMsg(MINIWR, INT8NS, "9", CAPSINT8, null);
+// validateErrMsg(MAXIWR, INT8NS, "101", CAPSINT8, null);
+// }
+//
+// /**
+// * Tests all the minimum and maximum value's negative scenario's for
+// * unsigned integer8 data type.
+// */
+// @Test
+// public void negative2Test() throws YdtException {
+// validateErrMsg("maxUInt", INT8NS, "integer", SMALLUINT8, null);
+// validateErrMsg("maxUInt", INT8NS, "127.0", SMALLUINT8, null);
+// validateErrMsg("minUInt", INT8NS, "-128", MINVALUE, null);
+// validateErrMsg("maxUInt", INT8NS, "256", MAXUINT8, null);
+// validateErrMsg(MINUIWR, INT8NS, "9", CAPSUINT8, null);
+// validateErrMsg(MAXUIWR, INT8NS, "101", CAPSUINT8, null);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for signed integer8 data type
+// * with range "10..40 | 50..100".
+// */
+// @Test
+// public void negative3Test() throws YdtException {
+// validateErrMsg("integer", INT8NS, "9", CAPSINT8, MRV);
+// validateErrMsg("integer", INT8NS, "41", CAPSINT8, MRV);
+// validateErrMsg("integer", INT8NS, "49", CAPSINT8, MRV);
+// validateErrMsg("integer", INT8NS, "101", CAPSINT8, MRV);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for unsigned integer8 data type
+// * with range "10..40 | 50..100".
+// */
+// @Test
+// public void negative4Test() throws YdtException {
+// validateErrMsg("UnInteger", INT8NS, "9", CAPSUINT8, MRV);
+// validateErrMsg("UnInteger", INT8NS, "41", CAPSUINT8, MRV);
+// validateErrMsg("UnInteger", INT8NS, "49", CAPSUINT8, MRV);
+// validateErrMsg("UnInteger", INT8NS, "101", CAPSUINT8, MRV);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for signed integer8 data type
+// * with range "min .. 2 | 10 | 20..max".
+// */
+// @Test
+// public void negative5Test() throws YdtException {
+// // multi range validation
+// validateErrMsg("revInteger", INT8NS, "-129", SMALLINT8, MRV);
+// validateErrMsg("revInteger", INT8NS, "128", SMALLINT8, MRV);
+// validateErrMsg("revInteger", INT8NS, "4", CAPSINT8, MRV);
+// validateErrMsg("revInteger", INT8NS, "11", CAPSINT8, MRV);
+// validateErrMsg("revInteger", INT8NS, "9", CAPSINT8, MRV);
+// validateErrMsg("revInteger", INT8NS, "19", CAPSINT8, MRV);
+// }
+//
+// /**
+// * Tests all possible negative scenario's for unsigned integer8 data type
+// * with range "min .. 2 | 10 | 20..max".
+// */
+// @Test
+// public void negative6Test() throws YdtException {
+// // multi range validation
+// validateErrMsg(RUI, INT8NS, "-129", MINVALUE, MRV);
+// validateErrMsg(RUI, INT8NS, "4", CAPSUINT8, MRV);
+// validateErrMsg(RUI, INT8NS, "9", CAPSUINT8, MRV);
+// validateErrMsg(RUI, INT8NS, "11", CAPSUINT8, MRV);
+// validateErrMsg(RUI, INT8NS, "19", CAPSUINT8, MRV);
+// validateErrMsg(RUI, INT8NS, "256", MAXUINT8, MRV);
+// }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtTestConstants.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtTestConstants.java
new file mode 100644
index 0000000..bd1207c
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtTestConstants.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ydt;
+
+/**
+ * Represents common constant utility for YANG data tree UT framework.
+ */
+final class YdtTestConstants {
+
+ // No instantiation.
+ private YdtTestConstants() {
+ }
+
+ public static final String BACKSLASH = "\"";
+ public static final String PERIOD = ".";
+ public static final String A = "92233720368547758.07";
+ public static final String B = "92233720368547757";
+ public static final String C = "-92233720368547758.08";
+ public static final String D = "92233720368547757";
+ public static final String E = "9.223372036854775807";
+ public static final String F = "-922337203685477580.8";
+ public static final String G = "922337203685477580.7";
+ public static final String H = "-9.223372036854775808";
+ public static final String I = "9223372036854775808";
+ public static final String J = "9223372036854775807";
+ public static final String K = "-9223372036854775808";
+ public static final String L = "-9223372036854775809";
+ public static final String M = "18446744073709551616";
+ public static final String NWF = "negIntWithMaxFraction";
+ public static final String PWF = "posIntWithMaxFraction";
+ public static final String NIWMF = "negIntWithMinFraction";
+ public static final String PIWMF = "posIntWithMinFraction";
+ public static final String CAPSUINT8 = "UINT8";
+ public static final String CAPSINT8 = "INT8";
+ public static final String SMALLUINT8 = "uint8.";
+ public static final String SMALLINT8 = "int8.";
+ public static final String MAXUINT8 = "255";
+ public static final String CAPSUINT16 = "UINT16";
+ public static final String CAPSINT16 = "INT16";
+ public static final String SUINT16 = "uint16.";
+ public static final String SINT16 = "int16.";
+ public static final String MAXUINT16 = "65535";
+ public static final String CAPSUINT32 = "UINT32";
+ public static final String CAPSINT32 = "INT32";
+ public static final String SUINT32 = "uint32.";
+ public static final String SINT32 = "int32.";
+ public static final String MAXUINT32 = "4294967295";
+ public static final String CAPSUINT64 = "UINT64";
+ public static final String CAPSINT64 = "INT64";
+ public static final String SMALLUINT64 = "uint64.";
+ public static final String SMALLINT64 = "int64.";
+ public static final String MAXUINT64 = "18446744073709551615";
+ public static final String MINVALUE = "0";
+ public static final String MINIWR = "minIntWithRange";
+ public static final String MIDIWR = "midIntWithRange";
+ public static final String MAXIWR = "maxIntWithRange";
+ public static final String MINUIWR = "minUIntWithRange";
+ public static final String MIDUIWR = "midUIntWithRange";
+ public static final String MAXUIWR = "maxUIntWithRange";
+ public static final String MRV = "multiRangeValidation";
+ public static final String RUI = "revUnInteger";
+ public static final String TYPE = "builtInType";
+ public static final String INT8NS = "ydt.integer8";
+ public static final String BIT = "BITS";
+ public static final String BOOL = "BOOLEAN";
+ public static final String EMPTY = "";
+ public static final String ENUM = "ENUMERATION";
+ public static final String LIST = "List";
+ public static final String LWC = "listwithcontainer";
+ public static final String INV = "invalidinterval";
+ public static final String INT16NS = "ydt.integer16";
+ public static final String INT32NS = "ydt.integer32";
+ public static final String INT64NS = "ydt.integer64";
+ public static final String BITNS = "ydt.bit";
+ public static final String BOOLNS = "ydt.boolean";
+ public static final String EMPTYNS = "ydt.emptydata";
+ public static final String ENUMNS = "ydt.enumtest";
+ public static final String LISTNS = "ydt.rootlist";
+ public static final String A1 = "ydt.augment-topology1";
+ public static final String A2 = "ydt.augment-topology2";
+ public static final String A3 = "ydt.augment-topology3";
+ public static final String A4 = "ydt.augment-topology4";
+ public static final String A5 = "ydt.augment-topology5";
+ public static final String A6 = "ydt.augment-topology6";
+ public static final String A2L = "augment2leafList";
+ public static final String A5L = "augment5leafList";
+ public static final String A6L = "augment6leafList";
+ public static final String MATERIALNS = "ydt.material-supervisor";
+ public static final String PURCHASNS = "ydt.purchasing-supervisor";
+ public static final String WAREHNS = "ydt.warehouse-supervisor";
+ public static final String TRADNS = "ydt.trading-supervisor";
+ public static final String EMPNS = "ydt.employee-id";
+ public static final String COUSTOMNS = "ydt.customs-supervisor";
+ public static final String MERCHNS = "ydt.Merchandiser-supervisor";
+ public static final String STP = "supporting-termination-point";
+ public static final String SLINK = "supporting-link";
+ public static final String AUGSE = "/aug:l1";
+ public static final String ELNS = "ydt.Empty.leafList";
+ public static final String AUG1 = "/nd:networks/nd:network";
+ public static final String AUG2 = "/nd:networks/nd:network/nd:node";
+ public static final String AUG3 = "/nd:networks/nd:network/topo:link";
+ public static final String AUG4 = "/nd:networks/nd:network/nd:node/" +
+ "topo:t-point/supporting-termination-point";
+ public static final String AUG5 = "/nd:networks/nd:network/topo:link/" +
+ "aug2:augment2";
+ public static final String AUG6 = "/nd:networks/nd:network/nd:node/" +
+ "topo:t-point/supporting-termination-point/aug2:augment2";
+ public static final String AUG7 = "/nd:networks/nd:network/topo:link/" +
+ "aug2:augment2/aug3:augment3";
+ public static final String AUG8 = "/nd:networks/nd:network/topo:link/" +
+ "aug2:augment2/aug3:augment3/aug5:augment5";
+ public static final String AUG9 = "/nd:networks/nd:network/topo:link/" +
+ "aug2:augment2/aug5:augment5";
+ public static final String AUG10 = "/aug:node/aug:cont1s/aug:cont1s";
+ public static final String NETNS = "ydt.augmentNetwork";
+ public static final String AUGNS = "ydt.augmentSequence1";
+ public static final String IETFNS =
+ "urn:ietf:params:xml:ns:yang:ietf-network";
+ public static final String IETF = "yms-ietf-network";
+ public static final String TOPONS =
+ "urn:ietf:params:xml:ns:yang:ietf-network-topology";
+ public static final String E_LEAF = "Exception has not occurred for " +
+ "invalid leaf value with name ";
+ public static final String E_LIST = "Exception has not occurred for " +
+ "invalid node addition with the name ";
+ public static final String E_TOPARENT = "Exception has not occurred " +
+ "in traverse back to parent for multi instance node.";
+ public static final String E_D64 = "YANG file error : value is not in" +
+ " decimal64 range.";
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtTestUtils.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtTestUtils.java
new file mode 100644
index 0000000..cd21447
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtTestUtils.java
@@ -0,0 +1,1938 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yms.app.ydt;
+
+import org.junit.Rule;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yms.app.yob.DefaultYobBuilder;
+import org.onosproject.yms.app.ysr.TestYangSchemaNodeProvider;
+import org.onosproject.yms.app.ysr.YangSchemaRegistry;
+import org.onosproject.yms.app.ytb.DefaultYangTreeBuilder;
+import org.onosproject.yms.ydt.YdtContext;
+import org.onosproject.yms.ydt.YdtContextOperationType;
+import org.onosproject.yms.ydt.YdtListener;
+import org.onosproject.yms.ydt.YdtType;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A1;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A2;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A2L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A3;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A4;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A5;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A5L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A6;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.A6L;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BACKSLASH;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BIT;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BITNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BOOL;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.BOOLNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSUINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSUINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSUINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.CAPSUINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.COUSTOMNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.ELNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.EMPNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.EMPTY;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.EMPTYNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.ENUM;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.ENUMNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.E_LEAF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.IETF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.IETFNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INT16NS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INT32NS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INT64NS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INT8NS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.INV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.LIST;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.LISTNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.LWC;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MATERIALNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MAXUINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MERCHNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MINVALUE;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.MRV;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.NETNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.NIWMF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.NWF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.PERIOD;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.PIWMF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.PURCHASNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.PWF;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SLINK;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SMALLINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SMALLINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SMALLUINT64;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SMALLUINT8;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.STP;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SUINT16;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.SUINT32;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TOPONS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TRADNS;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestConstants.WAREHNS;
+import static org.onosproject.yms.ydt.YdtContextOperationType.DELETE;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+import static org.onosproject.yms.ydt.YmsOperationType.EDIT_CONFIG_REPLY;
+
+public class YdtTestUtils implements YdtListener {
+
+ private static List<String> kValList = new ArrayList<>();
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private static YangSchemaRegistry schemaRegistry;
+
+ private static TestYangSchemaNodeProvider schemaProvider =
+ new TestYangSchemaNodeProvider();
+
+ // Logger list is used for walker testing.
+ private static final List<String> LOGGER = new ArrayList<>();
+
+ /**
+ * Returns the LOGGER with log for testing the YDT walker.
+ *
+ * @return list of logs
+ */
+ public static List<String> getLogger() {
+ return LOGGER;
+ }
+
+ /**
+ * Clear the LOGGER array.
+ */
+ public static void resetLogger() {
+ LOGGER.clear();
+ }
+
+ @Override
+ public void enterYdtNode(YdtContext ydtContext) {
+ LOGGER.add("Entry Node is " + ydtContext.getName() + PERIOD);
+ }
+
+ @Override
+ public void exitYdtNode(YdtContext ydtContext) {
+ LOGGER.add("Exit Node is " + ydtContext.getName() + PERIOD);
+ }
+
+ /**
+ * Returns schema registry of YDT.
+ *
+ * @return schema registry
+ */
+ public static YangSchemaRegistry getSchemaRegistry() {
+ return schemaRegistry;
+ }
+
+ /**
+ * Sets the ydt schema registry.
+ *
+ * @param registry schema registry
+ */
+ public static void setSchemaRegistry(YangSchemaRegistry registry) {
+ schemaRegistry = registry;
+ }
+
+ /**
+ * Returns the ydt builder for food module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench foodArenaYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("foodarena", "food", "ydt.food", MERGE);
+ ydtBuilder.addChild("food", "ydt.food");
+// ydtBuilder.addChild("snack", null, "ydt.food");
+// ydtBuilder.addChild("latenight", null, "ydt.food");
+ ydtBuilder.addLeaf("chocolate", "ydt.food", "dark");
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for empty leaf list module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench emptyLeafListYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("empty", "EmptyLeafList", ELNS, MERGE);
+ ydtBuilder.addChild("l1", ELNS);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("l2", ELNS);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("l3", ELNS);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("list1", ELNS);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("list2", ELNS);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("list3", ELNS);
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for yms-ietf-network module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench ietfNetwork1Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(IETF, IETF, IETFNS, MERGE);
+ // Adding container
+ ydtBuilder.addChild("networks", null);
+ // Adding list inside container
+ ydtBuilder.addChild("network", null);
+ // Adding key element network Id
+ ydtBuilder.addLeaf("network-id", null, "network1");
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("supporting-network", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("node", null);
+ // Adding key element node-id
+ ydtBuilder.addLeaf("node-id", null, "node1");
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("supporting-node", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network3");
+ ydtBuilder.traverseToParent();
+
+ // Adding key element node-ref
+ ydtBuilder.addLeaf("node-ref", null, "network4");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding container
+ ydtBuilder.addChild("networks-state", null);
+ // Adding list inside container
+ ydtBuilder.addChild("network", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network5");
+ ydtBuilder.traverseToParent();
+ // Adding leaf server-provided
+ ydtBuilder.addLeaf("server-provided", null, "true");
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for yms-ietf-network-topology module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench ietfNetworkTopologyYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(IETF, IETF, IETFNS, MERGE);
+ // Adding container
+ ydtBuilder.addChild("networks", IETFNS, MERGE);
+ // Adding list inside container
+ ydtBuilder.addChild("network", IETFNS, MERGE);
+
+ // Adding key element network Id
+ ydtBuilder.addLeaf("network-id", null, "network1");
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("id1");
+ // adding the augmented node
+ ydtBuilder.addMultiInstanceChild("link", TOPONS, kValList, MERGE);
+ // container source
+ ydtBuilder.addChild("source", TOPONS, MERGE);
+ ydtBuilder.addLeaf("source-node", null, "source1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("source-tp", null, "source2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // container destination
+ ydtBuilder.addChild("destination", TOPONS, MERGE);
+ ydtBuilder.addLeaf("dest-node", null, "dest1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("dest-tp", null, "dest2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("network1");
+ kValList.add("id2");
+ // adding the supporting-link list node
+ ydtBuilder.addMultiInstanceChild(SLINK, TOPONS, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("network2");
+ kValList.add("id3");
+ // adding the supporting-link list another instance
+ ydtBuilder.addMultiInstanceChild(SLINK, TOPONS, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("supporting-network", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("node", null);
+ // Adding key element node-id
+ ydtBuilder.addLeaf("node-id", null, "node1");
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("tp_id1");
+ //adding augmented termination-point list
+ ydtBuilder.addMultiInstanceChild("t-point", TOPONS,
+ kValList, MERGE);
+ kValList.clear();
+ kValList.add("network-ref");
+ kValList.add("node-ref");
+ kValList.add("tp-ref");
+ //adding supporting-termination-point
+ ydtBuilder.addMultiInstanceChild(STP, TOPONS, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("supporting-node", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network3");
+ ydtBuilder.traverseToParent();
+
+ // Adding key element node-ref
+ ydtBuilder.addLeaf("node-ref", null, "network4");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("link-id", TOPONS, "id1");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding container
+ ydtBuilder.addChild("networks-state", null);
+ // Adding list inside container
+ ydtBuilder.addChild("network", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network5");
+ ydtBuilder.traverseToParent();
+ // Adding leaf server-provided
+ ydtBuilder.addLeaf("server-provided", null, "true");
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for augmented module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench augmentNetworkYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(IETF, IETF, IETFNS, MERGE);
+ // Adding container
+ ydtBuilder.addChild("networks", IETFNS, MERGE);
+ // Adding list inside container
+ ydtBuilder.addChild("network", IETFNS, MERGE);
+
+ // Adding key element network Id
+ ydtBuilder.addLeaf("network-id", null, "network1");
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("id1");
+ // adding the augmented node
+ ydtBuilder.addMultiInstanceChild("link", TOPONS, kValList, MERGE);
+ // container source
+ ydtBuilder.addChild("source", TOPONS, MERGE);
+ ydtBuilder.addLeaf("source-node", null, "source1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("source-tp", null, "source2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // container destination
+ ydtBuilder.addChild("destination", TOPONS, MERGE);
+ ydtBuilder.addLeaf("dest-node", null, "dest1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("dest-tp", null, "dest2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("network1");
+ kValList.add("id2");
+ // adding the supporting-link list node
+ ydtBuilder.addMultiInstanceChild(SLINK, TOPONS, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("network2");
+ kValList.add("id3");
+ // adding the supporting-link list another instance
+ ydtBuilder.addMultiInstanceChild(SLINK, TOPONS, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("1");
+ ydtBuilder.addMultiInstanceChild("augment1", A1, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("1");
+ kValList.add("2");
+ ydtBuilder.addMultiInstanceChild("augment2", A2, kValList, MERGE);
+
+ ydtBuilder.addChild("augment5", A5, DELETE);
+
+ ydtBuilder.addMultiInstanceChild(A6L, A6, kValList, DELETE);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("value5", null, "5");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addMultiInstanceChild(A5L, A5, kValList, DELETE);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("augment3", A3, MERGE);
+
+ ydtBuilder.addChild("augment4", A4, DELETE);
+ ydtBuilder.addLeaf("value4", null, "4");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("augment5", A5, MERGE);
+
+ ydtBuilder.addLeaf("leaf6", A6, "6");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("value5", null, "5");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("augment6", A6, DELETE);
+ ydtBuilder.addLeaf("value6", null, "6");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("value3", null, "3");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("augment3leaf", A3, "3");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addMultiInstanceChild(A2L, A2, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("supporting-network", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("node", null);
+ // Adding key element node-id
+ ydtBuilder.addLeaf("node-id", null, "node1");
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("tp_id1");
+ //adding augmented termination-point list
+ ydtBuilder.addMultiInstanceChild("t-point", TOPONS,
+ kValList, MERGE);
+ kValList.clear();
+ kValList.add("network-ref");
+ kValList.add("node-ref");
+ kValList.add("tp-ref");
+ //adding supporting-termination-point
+ ydtBuilder.addMultiInstanceChild(STP, TOPONS, kValList, MERGE);
+
+ // Adding augmented container1 inside supporting-termination-point
+ augmentTerminationPointYdt(ydtBuilder);
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Adds augments inside supporting-termination-point in augmented module.
+ *
+ * @param ydtBuilder ydt builder which need to be updated
+ */
+ private static void augmentTerminationPointYdt(YangRequestWorkBench ydtBuilder) {
+
+ ydtBuilder.addChild("augment1", A1);
+ ydtBuilder.addLeaf("value1", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("augment1-leaf", A1, "1");
+
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("augment2", A2, MERGE);
+
+ ydtBuilder.addChild("augment3", A3, MERGE);
+ ydtBuilder.addLeaf("value3", null, "3");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("augment4leaf", A4, "4");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("value2", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("1");
+ kValList.add("2");
+ ydtBuilder.addMultiInstanceChild(A2L, A2, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("augment2leaf", A2, "2");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding list inside list
+ ydtBuilder.addChild("supporting-node", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network3");
+ ydtBuilder.traverseToParent();
+
+ // Adding key element node-ref
+ ydtBuilder.addLeaf("node-ref", null, "network4");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("link-id", TOPONS, "id1");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ // Adding container
+ ydtBuilder.addChild("networks-state", null);
+ // Adding list inside container
+ ydtBuilder.addChild("network", null);
+ // Adding key element network-ref
+ ydtBuilder.addLeaf("network-ref", null, "network5");
+ ydtBuilder.traverseToParent();
+ // Adding leaf server-provided
+ ydtBuilder.addLeaf("server-provided", null, "true");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ augmentNetworkYdt(ydtBuilder);
+ }
+
+ /**
+ * Adds augmented module augment-network under logical node ietf-network.
+ *
+ * @param ydtBuilder ydt builder which need to be updated
+ */
+ private static void augmentNetworkYdt(YangRequestWorkBench ydtBuilder) {
+ ydtBuilder.addChild("augmentNetwork", NETNS);
+
+ //adding list with name node under module node
+ ydtBuilder.addChild("node", null);
+
+ //adding key leaf for node
+ ydtBuilder.addLeaf("name", null, "node1");
+ ydtBuilder.traverseToParent();
+
+ // adding augmented container cont1s under list
+ ydtBuilder.addChild("cont1s", null);
+ // adding container cont1s under cont1s
+ ydtBuilder.addChild("cont1s", null);
+ //adding leaf under cont1s
+ ydtBuilder.addLeaf("fine", null, "leaf");
+
+ //adding augmented list node bu augment-topology1 under container
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("augment1", A1, DELETE);
+ //adding key leaf for list node augment1
+ ydtBuilder.addLeaf("value1", null, "1");
+ }
+
+ /**
+ * Returns the ydt builder for rootlist module with listwithcontainer node
+ * using addMultiInstanceChild interface for adding multi instance node.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench listWithContainerYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("list", "rootlist", "ydt.rootlist", MERGE);
+ kValList.clear();
+ kValList.add("12");
+ kValList.add("12");
+ ydtBuilder.addMultiInstanceChild(LWC, null, kValList, MERGE);
+ ydtBuilder.addLeaf(INV, null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("interface", null);
+ ydtBuilder.addLeaf(INV, null, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid", null, "121");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for rootlist module with listwithcontainer
+ * node using addChild interface for adding multi instance node.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench listWithContainer1Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("list", "rootlist", "ydt.rootlist", MERGE);
+ ydtBuilder.addChild(LWC, null);
+ ydtBuilder.addLeaf("invalid", null, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid1", null, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("interface", null);
+ ydtBuilder.addLeaf(INV, null, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("invalid", null, "121");
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for rootlist module with multiple instances of
+ * listwithcontainer node using addMultiInstanceChild interface for adding
+ * multi instance node.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench listWithContainer2Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("list", "rootlist", "ydt.rootlist", MERGE);
+ kValList.clear();
+ kValList.add("1222");
+ kValList.add("1212");
+ ydtBuilder.addMultiInstanceChild(LWC, null, kValList, MERGE);
+
+ kValList.clear();
+ kValList.add("12");
+ kValList.add("1");
+ ydtBuilder.addMultiInstanceChild(INV, null, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, null, "122");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(INV, null, "2222");
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("1222");
+ kValList.add("1212");
+ ydtBuilder.addMultiInstanceChild(INV, null, kValList, MERGE);
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("interface", null);
+ ydtBuilder.addLeaf(INV, null, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for rootlist module with listwithoutcontainer
+ * node.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench listWithoutContainerYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("list", "rootlist", "ydt.rootlist", MERGE);
+ ydtBuilder.addChild("listwithoutcontainer", null);
+ ydtBuilder.addLeaf(INV, null, "12");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for logisticsmanager module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench logisticsManagerYdt() {
+
+ Set<String> valueSet = new HashSet();
+ valueSet.add("1");
+ valueSet.add("2");
+ valueSet.add("3");
+ valueSet.add("4");
+ valueSet.add("5");
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("logisticsmanager", "customssupervisor",
+ null, MERGE);
+ ydtBuilder.addLeaf("supervisor", COUSTOMNS, "abc");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("merchandisersupervisor", MERCHNS, MERGE);
+ ydtBuilder.addLeaf("supervisor", MERCHNS, "abc");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("materialsupervisor", MATERIALNS, MERGE);
+ ydtBuilder.addChild("supervisor", MATERIALNS);
+ ydtBuilder.addLeaf("name", MATERIALNS, "abc");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("departmentId", MATERIALNS, "xyz");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("supervisor", MATERIALNS);
+ ydtBuilder.addLeaf("name", MATERIALNS, "ab");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("departmentId", MATERIALNS, "xy");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("purchasingsupervisor", PURCHASNS, MERGE);
+ ydtBuilder.addChild("supervisor", PURCHASNS);
+ ydtBuilder.addLeaf("purchasing-specialist", PURCHASNS, "abc");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("support", "ydt.purchasing-supervisor", "xyz");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("warehousesupervisor", WAREHNS, MERGE);
+ ydtBuilder.addLeaf("supervisor", WAREHNS, valueSet);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("tradingsupervisor", TRADNS, MERGE);
+ ydtBuilder.addLeaf("supervisor", TRADNS, "abc");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("employeeid", EMPNS, MERGE);
+ ydtBuilder.addLeaf("employeeid", EMPNS, valueSet);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for bit module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench bitYdt() {
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("builtInType", "bit", "ydt.bit", MERGE);
+ ydtBuilder.addChild("bitList", null);
+ ydtBuilder.addLeaf("bit", null, "disable-nagle");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("bitList", null);
+ ydtBuilder.addLeaf("bit", null, "auto-sense-speed");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("bitList", null);
+ ydtBuilder.addLeaf("bit", null, "ten-Mb-only");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("bitList", null);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for bool module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench booleanYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder("builtInType", "bool", "ydt.boolean", MERGE);
+ ydtBuilder.addChild("booleanList", null);
+ ydtBuilder.addLeaf("boolean", null, "true");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("booleanList", null);
+ ydtBuilder.addLeaf("boolean", null, "false");
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for emptydata module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench emptyTypeYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "emptydata", "ydt.emptydata", MERGE);
+ ydtBuilder.addChild("emptyList", null);
+ ydtBuilder.addLeaf("empty", null, "");
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for enumtest module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench enumYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "enumtest", "ydt.enumtest", MERGE);
+ ydtBuilder.addChild("enumList", null);
+ ydtBuilder.addLeaf("enumleaf", null, "ten");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("enumList", null);
+ ydtBuilder.addLeaf("enumleaf", null, "hundred");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild("enumList", null);
+ ydtBuilder.addLeaf("enumleaf", null, "thousand");
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for augmentSequence module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench augmentSequenceYdt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "augment", "augmentSequence", "ydt.augmentSequence", MERGE);
+ ydtBuilder.addChild("l1", null);
+ ydtBuilder.addLeaf("leaf1", null, "1");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("c1", "ydt.augmentSequence1");
+ ydtBuilder.addLeaf("leaf2", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild("c2", "ydt.augmentSequence2");
+ ydtBuilder.addLeaf("leaf2", null, "3");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for crypto-base module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench identityRefYdt() {
+
+ Set<String> valueSet = new HashSet();
+ valueSet.add("crypto-alg");
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "identityref", "crypto-base", "ydt.crypto-base", MERGE);
+ ydtBuilder.addLeaf("crypto", null, "crypto-alg");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("abc-zeunion", null, "crypto-alg");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("level2", null, "crypto-alg2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("level3", null, "crypto-alg3");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("level4", null, "crypto-alg3");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("abc-type", null, valueSet);
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for builtin type integer8 module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench integer8Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "integer8", "ydt.integer8", MERGE);
+ ydtBuilder.addLeaf("negInt", null, "-128");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("posInt", null, "127");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("minUInt", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUInt", null, "255");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midUIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minUIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("UnInteger", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revInteger", null, "-128");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "127");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "255");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for builtin type integer16 module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench integer16Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "integer16", "ydt.integer16", MERGE);
+ ydtBuilder.addLeaf("negInt", null, "-32768");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("posInt", null, "32767");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("minUInt", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUInt", null, "65535");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midUIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minUIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("UnInteger", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revInteger", null, "-32768");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "32767");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "65535");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for builtin type integer32 module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench integer32Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "integer32", "ydt.integer32", MERGE);
+ ydtBuilder.addLeaf("negInt", null, "-2147483648");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("posInt", null, "2147483647");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("minUInt", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUInt", null, "4294967295");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midUIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minUIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("UnInteger", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revInteger", null, "-2147483648");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "2147483647");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "4294967295");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for builtin type integer64 module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench integer64Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "integer64", "ydt.integer64", MERGE);
+ ydtBuilder.addLeaf("negInt", null, "-9223372036854775808");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("posInt", null, "9223372036854775807");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("minUInt", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUInt", null, "18446744073709551615");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addLeaf("midUIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minUIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxUIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("integer", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("UnInteger", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("UnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revInteger", null, "-9223372036854775808");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revInteger", null, "9223372036854775807");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "0");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "1");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "2");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null, YdtType.MULTI_INSTANCE_NODE);
+ ydtBuilder.addLeaf("revUnInteger", null, "18446744073709551615");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder for builtin type decimal64 module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench decimal64Ydt() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "builtInType", "decimal64", "ydt.decimal64", MERGE);
+ ydtBuilder.addLeaf("negInt", null, "-92233720368547758.08");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("posInt", null, "92233720368547758.07");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(NIWMF, null, "-922337203685477580.8");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(PIWMF, null, "922337203685477580.7");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(NWF, null, "-9.223372036854775808");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf(PWF, null, "9.223372036854775807");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("midIntWithRange", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("minIntWithRange", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("maxIntWithRange", null, "100");
+ ydtBuilder.traverseToParent();
+
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("decimal", null, "11");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("decimal", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("decimal", null, "40");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("decimal", null, "50");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("decimal", null, "55");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("decimal", null, "100");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "-92233720368547758.08");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "2.505");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "3.14");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "10");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "20");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "92233720368547757");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addChild(MRV, null);
+ ydtBuilder.addLeaf("revDecimal", null, "92233720368547758.07");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the ydt builder with requested logical root name and module name.
+ *
+ * @param rootName logical rootNode name
+ * @param moduleName application(module) name
+ * @param nameSpace namespace of module
+ * @param opType operation type
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench getYdtBuilder(String rootName, String
+ moduleName, String nameSpace, YdtContextOperationType opType) {
+ setSchemaRegistry(schemaProvider.getDefaultYangSchemaRegistry());
+ YangRequestWorkBench ydtBuilder;
+ schemaProvider.processSchemaRegistry(null);
+ ydtBuilder = new YangRequestWorkBench(
+ rootName, null, null, schemaProvider
+ .getDefaultYangSchemaRegistry(), true);
+ ydtBuilder.addChild(moduleName, nameSpace, opType);
+ return ydtBuilder;
+ }
+
+ /**
+ * Compares the two value sets.
+ */
+ public static void compareValueSet(Set<String> valueSet,
+ Set<String> userInputValueSet) {
+ // Check the value against user input.
+ assertTrue("Expected 'valueSet' and 'userInputValueSet' to be equal.",
+ valueSet.containsAll(userInputValueSet));
+ }
+
+ /**
+ * Returns the ydt builder for Hello_ONOS module.
+ *
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench helloOnos() {
+
+ YangRequestWorkBench ydtBuilder;
+ ydtBuilder = getYdtBuilder(
+ "Hello-ONOS", "Hello_ONOS", "ydt:hello_onos", MERGE);
+ ydtBuilder.addChild("hello-world", null);
+ ydtBuilder.addChild("input", null);
+ ydtBuilder.addLeaf("name", null, "onos");
+ ydtBuilder.traverseToParent();
+ ydtBuilder.addLeaf("surName", null, "yang");
+ ydtBuilder.traverseToParent();
+
+ kValList.clear();
+ kValList.add("ON");
+ kValList.add("LAB");
+ ydtBuilder.addMultiInstanceChild("stringList", null, kValList,
+ MERGE);
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+ ydtBuilder.traverseToParent();
+
+ return ydtBuilder;
+ }
+
+ /**
+ * Returns the error message for requested node.
+ *
+ * @param value value in string format
+ * @param dataType requested data type
+ * @return error string
+ */
+ static String getErrorString(String value, String dataType) {
+ StringBuilder msg = new StringBuilder();
+ switch (dataType) {
+ case SINT16:
+ case SINT32:
+ case SMALLINT8:
+ case SMALLINT64:
+ case SMALLUINT8:
+ case SMALLUINT64:
+ case SUINT16:
+ case SUINT32:
+ case CAPSINT8:
+ case CAPSINT16:
+ case CAPSINT32:
+ case CAPSINT64:
+ case CAPSUINT8:
+ case CAPSUINT16:
+ case CAPSUINT32:
+ case CAPSUINT64:
+ case BIT:
+ case BOOL:
+ case ENUM:
+ msg.append("YANG file error : Input value ").append(BACKSLASH)
+ .append(value).append(BACKSLASH)
+ .append(" is not a valid ").append(dataType);
+ break;
+ case EMPTY:
+ msg.append("YANG file error : Input value ").append(BACKSLASH)
+ .append(value).append(BACKSLASH).append(
+ " is not allowed for a data type EMPTY");
+ break;
+ case MINVALUE:
+ msg.append("YANG file error : ").append(value)
+ .append(" is lesser than minimum value ")
+ .append(MINVALUE).append(PERIOD);
+ break;
+ case MAXUINT8:
+ case MAXUINT16:
+ case MAXUINT32:
+ case MAXUINT64:
+ msg.append("YANG file error : ").append(value)
+ .append(" is greater than maximum value ")
+ .append(dataType).append(PERIOD);
+ break;
+ default:
+ return null;
+ }
+ return msg.toString();
+ }
+
+ /**
+ * Validates the error message which is obtained by checking the given
+ * value against its data type restrictions.
+ *
+ * @param name leaf name
+ * @param nameSpace leaf namespace
+ * @param val leaf value
+ * @param type data type suffix string for exception message
+ * @param childName child name
+ */
+ public static void validateErrMsg(String name, String nameSpace,
+ String val, String type, String childName) {
+ YangRequestWorkBench ydtBuilder = getTestYdtBuilder(nameSpace);
+ boolean isExpOccurred = false;
+ /*
+ * If childName exist then leaf need to be added under the
+ * child node with the given childName
+ */
+ if (childName != null) {
+ ydtBuilder.addChild(childName, nameSpace);
+ }
+ /*
+ * This try catch is explicitly written to use as utility in other
+ * test cases.
+ */
+ try {
+ ydtBuilder.addLeaf(name, nameSpace, val);
+ } catch (IllegalArgumentException e) {
+ isExpOccurred = true;
+ assertEquals(e.getMessage(), getErrorString(val, type));
+ }
+ assertEquals(E_LEAF + name, isExpOccurred, true);
+ }
+
+ /**
+ * Returns ydt builder for requested namespace.
+ *
+ * @param namespace namespace of the requested yang data tree
+ * @return ydt builder
+ */
+ public static YangRequestWorkBench getTestYdtBuilder(String namespace) {
+
+ switch (namespace) {
+ case INT8NS:
+ return getYdtBuilder(TYPE, "integer8", INT8NS, MERGE);
+ case INT16NS:
+ return getYdtBuilder(TYPE, "integer16", INT16NS, MERGE);
+ case INT32NS:
+ return getYdtBuilder(TYPE, "integer32", INT32NS, MERGE);
+ case INT64NS:
+ return getYdtBuilder(TYPE, "integer64", INT64NS, MERGE);
+ case BITNS:
+ return getYdtBuilder(TYPE, "bit", BITNS, MERGE);
+ case BOOLNS:
+ return getYdtBuilder(TYPE, "bool", BOOLNS, MERGE);
+ case EMPTYNS:
+ return getYdtBuilder(TYPE, "emptydata", EMPTYNS, MERGE);
+ case ENUMNS:
+ return getYdtBuilder(TYPE, "enumtest", ENUMNS, MERGE);
+ case LISTNS:
+ return getYdtBuilder(LIST, "rootlist", LISTNS, MERGE);
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Validates the contents of node like name, namespace and operation type.
+ *
+ * @param ydtNode node need to be validate
+ * @param name name of the node
+ * @param opType operation type of the node
+ */
+ public static void validateNodeContents(YdtNode ydtNode, String name,
+ YdtContextOperationType opType) {
+ assertEquals(ydtNode.getName(), name);
+ assertEquals(ydtNode.getYdtContextOperationType(), opType);
+ }
+
+ /**
+ * Validates the contents of leaf node like name, namespace and operation
+ * type.
+ *
+ * @param ydtNode node need to be validate
+ * @param name name of the node
+ * @param value value of the leaf node
+ */
+ public static void validateLeafContents(YdtNode ydtNode, String name,
+ String value) {
+ validateNodeContents(ydtNode, name, null);
+ assertEquals(ydtNode.getValue(), value);
+ }
+
+ /**
+ * Validates the contents of leaf-list node like name, namespace and
+ * operation type.
+ *
+ * @param ydtNode node need to be validate
+ * @param name name of the node
+ * @param valueSet value of the leaf node
+ */
+ public static void validateLeafListContents(YdtNode ydtNode, String name,
+ Set<String> valueSet) {
+ validateNodeContents(ydtNode, name, null);
+ compareValueSet(ydtNode.getValueSet(), valueSet);
+ }
+
+ /**
+ * Validates the contents of ydt application logical node.
+ *
+ * @param ydtAppNode node need to be validate
+ */
+ public static void validateAppLogicalNodeContents(
+ YdtAppContext ydtAppNode) {
+
+ assertNull(ydtAppNode.getOperationType());
+ assertNull(ydtAppNode.getParent());
+ assertNull(ydtAppNode.getNextSibling());
+ assertNull(ydtAppNode.getPreviousSibling());
+ assertNotNull(ydtAppNode.getFirstChild());
+ assertNotNull(ydtAppNode.getLastChild());
+ }
+
+ /**
+ * Validates the contents of ydt application module node.
+ *
+ * @param ydtAppNode node need to be validate
+ * @param name name of the node
+ * @param opType operation type of the app node
+ */
+ public static void validateAppModuleNodeContents(
+ YdtAppContext ydtAppNode, String name,
+ YdtAppNodeOperationType opType) {
+
+ assertEquals(ydtAppNode.getModuleContext().getName(), name);
+ assertEquals(ydtAppNode.getOperationType(), opType);
+ }
+
+ /**
+ * Validates the contents of ydt application node like name, namespace
+ * and operation type.
+ *
+ * @param ydtAppNode node need to be validate
+ * @param name name of the schema node
+ * @param ns namespace of the schema node
+ * @param opType operation type of the app node
+ */
+ public static void validateAppNodeContents(
+ YdtAppContext ydtAppNode, String name, String ns,
+ YdtAppNodeOperationType opType) {
+ assertEquals(ydtAppNode.getAugmentingSchemaNode().getName(), name);
+ assertEquals(ydtAppNode.getAugmentingSchemaNode().getNameSpace()
+ .getModuleNamespace(), ns);
+ assertEquals(ydtAppNode.getOperationType(), opType);
+ }
+
+ /**
+ * Walks in the given built ydt and validates it.
+ */
+ public static void walkINTree(YangRequestWorkBench ydtBuilder,
+ String[] expected) {
+ DefaultYdtWalker ydtWalker = new DefaultYdtWalker();
+ resetLogger();
+
+ YdtTestUtils utils = new YdtTestUtils();
+ // Assign root node as starting node to walk the whole tree.
+ ydtWalker.walk(utils, ydtBuilder.getRootNode());
+ // Logger list is used for walker testing.
+ List<String> logger = getLogger();
+
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals(expected[i], logger.get(i));
+ }
+ }
+
+ /**
+ * Creates Ydt from YO using YTB.
+ */
+ static YangRequestWorkBench validateYangObject(
+ YangRequestWorkBench ydtBuilder, String name, String namespace) {
+
+ YdtContext rootCtx = ydtBuilder.getRootNode();
+
+ YdtContext childCtx = rootCtx.getFirstChild();
+
+ DefaultYobBuilder builder = new DefaultYobBuilder();
+
+ Object yangObject = builder.getYangObject(
+ (YdtExtendedContext) childCtx, YdtTestUtils
+ .getSchemaRegistry());
+
+ List<Object> list = new LinkedList<>();
+ list.add(yangObject);
+ // Builds YANG tree in YTB.
+ DefaultYangTreeBuilder treeBuilder = new DefaultYangTreeBuilder();
+ YangRequestWorkBench defaultYdtBuilder =
+ (YangRequestWorkBench) treeBuilder.getYdtBuilderForYo(
+ list, name, namespace, EDIT_CONFIG_REPLY, YdtTestUtils
+ .getSchemaRegistry());
+ return defaultYdtBuilder;
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/MockCoreService.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/MockCoreService.java
new file mode 100644
index 0000000..62f00aa
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/MockCoreService.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ymsm;
+
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.core.IdGenerator;
+import org.onosproject.core.Version;
+
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * Represents implementation of CoreService interfaces.
+ */
+public class MockCoreService implements CoreService {
+ @Override
+ public Version version() {
+ return null;
+ }
+
+ @Override
+ public Set<ApplicationId> getAppIds() {
+ return null;
+ }
+
+ @Override
+ public ApplicationId getAppId(Short id) {
+ return null;
+ }
+
+ @Override
+ public ApplicationId getAppId(String name) {
+ return null;
+ }
+
+ @Override
+ public ApplicationId registerApplication(String name) {
+ return null;
+ }
+
+ @Override
+ public ApplicationId registerApplication(String name,
+ Runnable preDeactivate) {
+ return null;
+ }
+
+ @Override
+ public IdGenerator getIdGenerator(String topic) {
+ return new IdGenerator() {
+ private AtomicLong counter = new AtomicLong(0);
+
+ @Override
+ public long getNewId() {
+ return counter.getAndIncrement();
+ }
+ };
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/MockOverriddenDataTreeCodec.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/MockOverriddenDataTreeCodec.java
new file mode 100644
index 0000000..73fddbf
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/MockOverriddenDataTreeCodec.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ymsm;
+
+import org.onosproject.yms.app.ych.YchException;
+import org.onosproject.yms.ych.YangCompositeEncoding;
+import org.onosproject.yms.ych.YangDataTreeCodec;
+import org.onosproject.yms.ydt.YdtBuilder;
+import org.onosproject.yms.ydt.YmsOperationType;
+
+/**
+ * Represents implementation of overridden YANG data tree codec interfaces.
+ */
+public class MockOverriddenDataTreeCodec implements YangDataTreeCodec {
+ private static final String PREFIX = "OverriddenDataTreeCodec ";
+ private static final String ENCODE = PREFIX +
+ "encodeYdtToProtocolFormat Called.";
+ private static final String COMPOSITE_ENCODE = PREFIX +
+ "encodeYdtToCompositeProtocolFormat Called.";
+ private static final String DECODE = PREFIX +
+ "decodeProtocolDataToYdt Called.";
+ private static final String COMPOSITE_DECODE = PREFIX +
+ "decodeCompositeProtocolDataToYdt Called.";
+
+ @Override
+ public String encodeYdtToProtocolFormat(YdtBuilder ydtBuilder) {
+
+ throw new YchException(ENCODE);
+ }
+
+ @Override
+ public YangCompositeEncoding encodeYdtToCompositeProtocolFormat(
+ YdtBuilder ydtBuilder) {
+
+ throw new YchException(COMPOSITE_ENCODE);
+ }
+
+ @Override
+ public YdtBuilder decodeProtocolDataToYdt(String protocolData,
+ Object schemaRegistryForYdt,
+ YmsOperationType proOper) {
+
+ throw new YchException(DECODE);
+ }
+
+ @Override
+ public YdtBuilder decodeCompositeProtocolDataToYdt(
+ YangCompositeEncoding protocolData,
+ Object schemaRegistryForYdt,
+ YmsOperationType proOper) {
+
+ throw new YchException(COMPOSITE_DECODE);
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/MockRegisteredDataTreeCodec.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/MockRegisteredDataTreeCodec.java
new file mode 100644
index 0000000..557f914
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/MockRegisteredDataTreeCodec.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yms.app.ymsm;
+
+import org.onosproject.yms.app.ych.YchException;
+import org.onosproject.yms.ych.YangCompositeEncoding;
+import org.onosproject.yms.ych.YangDataTreeCodec;
+import org.onosproject.yms.ydt.YdtBuilder;
+import org.onosproject.yms.ydt.YmsOperationType;
+
+/**
+ * Represents implementation of YANG SBI broker interfaces.
+ */
+public class MockRegisteredDataTreeCodec implements YangDataTreeCodec {
+ private static final String PREFIX = "RegisteredDataTreeCodec ";
+ private static final String ENCODE = PREFIX +
+ "encodeYdtToProtocolFormat Called.";
+ private static final String COMPOSITE_ENCODE = PREFIX +
+ "encodeYdtToCompositeProtocolFormat Called.";
+ private static final String DECODE = PREFIX +
+ "decodeProtocolDataToYdt Called.";
+ private static final String COMPOSITE_DECODE = PREFIX +
+ "decodeCompositeProtocolDataToYdt Called.";
+
+ @Override
+ public String encodeYdtToProtocolFormat(YdtBuilder ydtBuilder) {
+ throw new YchException(ENCODE);
+ }
+
+ @Override
+ public YangCompositeEncoding encodeYdtToCompositeProtocolFormat(
+ YdtBuilder ydtBuilder) {
+
+ throw new YchException(COMPOSITE_ENCODE);
+ }
+
+ @Override
+ public YdtBuilder decodeProtocolDataToYdt(String protocolData,
+ Object schemaRegistry,
+ YmsOperationType proOper) {
+
+ throw new YchException(DECODE);
+ }
+
+ @Override
+ public YdtBuilder decodeCompositeProtocolDataToYdt(
+ YangCompositeEncoding protocolData,
+ Object schemaRegistry,
+ YmsOperationType proOper) {
+
+ throw new YchException(COMPOSITE_DECODE);
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/MockYangCompositeEncoding.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/MockYangCompositeEncoding.java
new file mode 100644
index 0000000..1f52da6
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/MockYangCompositeEncoding.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ymsm;
+
+import org.onosproject.yms.ych.YangCompositeEncoding;
+import org.onosproject.yms.ych.YangResourceIdentifierType;
+
+/**
+ * Represents implementation of YangCompositeEncoding interfaces.
+ */
+public class MockYangCompositeEncoding implements YangCompositeEncoding {
+ /**
+ * Resource identifier for composite encoding.
+ */
+ private String resourceIdentifier;
+
+ /**
+ * Resource information for composite encoding.
+ */
+ private String resourceInformation;
+
+ /**
+ * Resource identifier type.
+ */
+ private YangResourceIdentifierType resourceIdentifierType;
+
+ /**
+ * Sets resource identifier.
+ *
+ * @param resIdentifier resource identifier
+ */
+ public void setResourceIdentifier(String resIdentifier) {
+ resourceIdentifier = resIdentifier;
+ }
+
+ /**
+ * Sets the resource information.
+ *
+ * @param resInformation resource information
+ */
+ public void setResourceInformation(String resInformation) {
+ resourceInformation = resInformation;
+ }
+
+ /**
+ * Sets the resource identifier type.
+ *
+ * @param resIdent resource identifier
+ */
+ public void setResourceIdentifierType(YangResourceIdentifierType resIdent) {
+ resourceIdentifierType = resIdent;
+ }
+
+ @Override
+ public String getResourceIdentifier() {
+ return resourceIdentifier;
+ }
+
+ @Override
+ public YangResourceIdentifierType getResourceIdentifierType() {
+ return resourceIdentifierType;
+ }
+
+ @Override
+ public String getResourceInformation() {
+ return resourceInformation;
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/YchCompositeHandlerTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/YchCompositeHandlerTest.java
new file mode 100644
index 0000000..794298e
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ymsm/YchCompositeHandlerTest.java
@@ -0,0 +1,288 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ymsm;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.gen.v1.ydt.customs.supervisor.rev20160524.CustomssupervisorOpParam;
+import org.onosproject.yms.app.ych.defaultcodecs.YangCodecRegistry;
+import org.onosproject.yms.app.ysr.TestYangSchemaNodeProvider;
+import org.onosproject.yms.ych.YangCodecHandler;
+import org.onosproject.yms.ych.YangCompositeEncoding;
+import org.onosproject.yms.ych.YangDataTreeCodec;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static junit.framework.TestCase.assertNotNull;
+import static org.onosproject.yms.ych.YangProtocolEncodingFormat.XML;
+
+/**
+ * Unit test case for YCH composite codec handler.
+ */
+public class YchCompositeHandlerTest {
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private static final String REG_PREFIX = "RegisteredDataTreeCodec ";
+ private static final String REG_ENCODE = REG_PREFIX +
+ "encodeYdtToProtocolFormat Called.";
+ private static final String REG_DECODE = REG_PREFIX +
+ "decodeProtocolDataToYdt Called.";
+ private static final String REG_COMPO_ENCODE = REG_PREFIX +
+ "encodeYdtToCompositeProtocolFormat Called.";
+ private static final String REG_COMPO_DECODE = REG_PREFIX +
+ "decodeCompositeProtocolDataToYdt Called.";
+ private static final String OVERRIDE_PREFIX = "OverriddenDataTreeCodec ";
+ private static final String OVERRIDE_ENCODE = OVERRIDE_PREFIX +
+ "encodeYdtToProtocolFormat Called.";
+ private static final String OVERRIDE_DECODE = OVERRIDE_PREFIX +
+ "decodeProtocolDataToYdt Called.";
+ private static final String OVERRIDE_COMPO_ENCODE = OVERRIDE_PREFIX +
+ "encodeYdtToCompositeProtocolFormat Called.";
+ private static final String OVERRIDE_COMPO_DECODE = OVERRIDE_PREFIX +
+ "decodeCompositeProtocolDataToYdt Called.";
+
+ private TestYangSchemaNodeProvider provider =
+ new TestYangSchemaNodeProvider();
+
+ /**
+ * Unit test case in which verifying codec handler is null or not.
+ */
+ @Test
+ public void checkForCodecHandler() {
+ YmsManager ymsManager = new YmsManager();
+ ymsManager.coreService = new MockCoreService();
+ ymsManager.activate();
+ YangCodecHandler yangCodecHandler = ymsManager.getYangCodecHandler();
+ assertNotNull("Codec handler is null", yangCodecHandler);
+ }
+
+ /**
+ * Unit test case in which verifying registered codec handler for encode is
+ * null or not.
+ */
+ @Test
+ public void checkForRegisterDefaultCodecEncode() {
+ thrown.expectMessage(REG_ENCODE);
+ YangDataTreeCodec yangDataTreeCodec = new MockRegisteredDataTreeCodec();
+ YmsManager ymsManager = new YmsManager();
+ YangCodecRegistry.initializeDefaultCodec();
+ ymsManager.coreService = new MockCoreService();
+ ymsManager.activate();
+ ymsManager.registerDefaultCodec(yangDataTreeCodec, XML);
+ YangCodecHandler yangCodecHandler = ymsManager.getYangCodecHandler();
+ assertNotNull("Codec handler is null", yangCodecHandler);
+
+ provider.processSchemaRegistry(null);
+ List<Object> yangModuleList = new ArrayList<>();
+
+ // Creating the object
+ Object object = CustomssupervisorOpParam.builder()
+ .supervisor("Customssupervisor").build();
+ yangModuleList.add(object);
+
+ // Get the xml string and compare
+ Map<String, String> tagAttr = new HashMap<String, String>();
+ tagAttr.put("type", "subtree");
+
+ yangCodecHandler.encodeOperation("filter", "ydt.filter-type",
+ tagAttr, yangModuleList,
+ XML, null);
+ }
+
+ /**
+ * Unit test case in which verifying registered codec handler for decode is
+ * null or not.
+ */
+ @Test
+ public void checkForRegisterDefaultCodecDecode() {
+ thrown.expectMessage(REG_DECODE);
+ YangDataTreeCodec yangDataTreeCodec = new MockRegisteredDataTreeCodec();
+ YmsManager ymsManager = new YmsManager();
+ YangCodecRegistry.initializeDefaultCodec();
+ ymsManager.coreService = new MockCoreService();
+ ymsManager.activate();
+ ymsManager.registerDefaultCodec(yangDataTreeCodec, XML);
+ YangCodecHandler yangCodecHandler = ymsManager.getYangCodecHandler();
+ assertNotNull("Codec handler is null", yangCodecHandler);
+
+ provider.processSchemaRegistry(null);
+ yangCodecHandler.decode("XML String", XML, null);
+ }
+
+ /**
+ * Unit test case in which verifying registered codec handler for
+ * composite encode is null or not.
+ */
+ @Test
+ public void checkForRegisterDefaultCodecCompEncode() {
+ thrown.expectMessage(REG_COMPO_ENCODE);
+ YangDataTreeCodec yangDataTreeCodec = new MockRegisteredDataTreeCodec();
+ YmsManager ymsManager = new YmsManager();
+ YangCodecRegistry.initializeDefaultCodec();
+ ymsManager.coreService = new MockCoreService();
+ ymsManager.activate();
+ ymsManager.registerDefaultCodec(yangDataTreeCodec, XML);
+ YangCodecHandler yangCodecHandler = ymsManager.getYangCodecHandler();
+ assertNotNull("Codec handler is null", yangCodecHandler);
+
+ provider.processSchemaRegistry(null);
+ // Creating the object
+ Object object = CustomssupervisorOpParam.builder()
+ .supervisor("Customssupervisor").build();
+
+ yangCodecHandler.encodeCompositeOperation("filter",
+ "ydt.filter-type", object,
+ XML, null);
+ }
+
+ /**
+ * Unit test case in which verifying registered codec handler for
+ * composite decode is null or not.
+ */
+ @Test
+ public void checkForRegisterDefaultCodecCompDecode() {
+ thrown.expectMessage(REG_COMPO_DECODE);
+ YangDataTreeCodec yangDataTreeCodec = new MockRegisteredDataTreeCodec();
+ YmsManager ymsManager = new YmsManager();
+ YangCodecRegistry.initializeDefaultCodec();
+ ymsManager.coreService = new MockCoreService();
+ ymsManager.activate();
+ ymsManager.registerDefaultCodec(yangDataTreeCodec, XML);
+ YangCodecHandler yangCodecHandler = ymsManager.getYangCodecHandler();
+ assertNotNull("Codec handler is null", yangCodecHandler);
+
+ provider.processSchemaRegistry(null);
+ // Creating the object
+ YangCompositeEncoding yangCompositeEncoding =
+ new MockYangCompositeEncoding();
+ yangCodecHandler.decode(yangCompositeEncoding, XML, null);
+ }
+
+ /**
+ * Unit test case in which verifying overridden codec handler for encode is
+ * null or not.
+ */
+ @Test
+ public void checkForOverriddenDataTreeCodecEncode() {
+ thrown.expectMessage(OVERRIDE_ENCODE);
+ YangDataTreeCodec yangDataTreeCodec = new MockRegisteredDataTreeCodec();
+ YmsManager ymsManager = new YmsManager();
+ ymsManager.coreService = new MockCoreService();
+ ymsManager.activate();
+ ymsManager.registerDefaultCodec(yangDataTreeCodec, XML);
+ YangCodecHandler yangCodecHandler = ymsManager.getYangCodecHandler();
+ assertNotNull("Codec handler is null", yangCodecHandler);
+
+ YangDataTreeCodec overriddenCodec = new MockOverriddenDataTreeCodec();
+ yangCodecHandler.registerOverriddenCodec(overriddenCodec, XML);
+
+ provider.processSchemaRegistry(null);
+ List<Object> yangModuleList = new ArrayList<>();
+
+ // Creating the object
+ Object object = CustomssupervisorOpParam.builder()
+ .supervisor("Customssupervisor").build();
+ yangModuleList.add(object);
+
+ // Get the xml string and compare
+ Map<String, String> tagAttr = new HashMap<String, String>();
+ tagAttr.put("type", "subtree");
+ yangCodecHandler.encodeOperation("filter", "ydt.filter-type",
+ tagAttr, yangModuleList,
+ XML, null);
+ }
+
+ /**
+ * Unit test case in which verifying overridden codec handler for decode is
+ * null or not.
+ */
+ @Test
+ public void checkForOverriddenDataTreeCodecDecode() {
+ thrown.expectMessage(OVERRIDE_DECODE);
+ YangDataTreeCodec yangDataTreeCodec = new MockRegisteredDataTreeCodec();
+ YmsManager ymsManager = new YmsManager();
+ ymsManager.coreService = new MockCoreService();
+ ymsManager.activate();
+ ymsManager.registerDefaultCodec(yangDataTreeCodec, XML);
+ YangCodecHandler yangCodecHandler = ymsManager.getYangCodecHandler();
+ assertNotNull("Codec handler is null", yangCodecHandler);
+
+ YangDataTreeCodec overriddenCodec = new MockOverriddenDataTreeCodec();
+ yangCodecHandler.registerOverriddenCodec(overriddenCodec, XML);
+
+ provider.processSchemaRegistry(null);
+ yangCodecHandler.decode("XML String", XML, null);
+ }
+
+ /**
+ * Unit test case in which verifying overridden codec handler for
+ * composite encode is null or not.
+ */
+ @Test
+ public void checkForOverriddenDataTreeCodecCompoEncode() {
+ thrown.expectMessage(OVERRIDE_COMPO_ENCODE);
+ YangDataTreeCodec yangDataTreeCodec = new MockRegisteredDataTreeCodec();
+ YmsManager ymsManager = new YmsManager();
+ ymsManager.coreService = new MockCoreService();
+ ymsManager.activate();
+ ymsManager.registerDefaultCodec(yangDataTreeCodec, XML);
+ YangCodecHandler yangCodecHandler = ymsManager.getYangCodecHandler();
+ assertNotNull("Codec handler is null", yangCodecHandler);
+
+ YangDataTreeCodec overriddenCodec = new MockOverriddenDataTreeCodec();
+ yangCodecHandler.registerOverriddenCodec(overriddenCodec, XML);
+
+ provider.processSchemaRegistry(null);
+ // Creating the object
+ Object object = CustomssupervisorOpParam.builder()
+ .supervisor("Customssupervisor").build();
+ yangCodecHandler.encodeCompositeOperation("filter",
+ "ydt.filter-type",
+ object,
+ XML, null);
+ }
+
+ /**
+ * Unit test case in which verifying overridden codec handler for
+ * composite decode is null or not.
+ */
+ @Test
+ public void checkForOverriddenDataTreeCodecCompoDecode() {
+ thrown.expectMessage(OVERRIDE_COMPO_DECODE);
+ YangDataTreeCodec yangDataTreeCodec = new MockRegisteredDataTreeCodec();
+ YmsManager ymsManager = new YmsManager();
+ ymsManager.coreService = new MockCoreService();
+ ymsManager.activate();
+ ymsManager.registerDefaultCodec(yangDataTreeCodec, XML);
+ YangCodecHandler yangCodecHandler = ymsManager.getYangCodecHandler();
+ assertNotNull("Codec handler is null", yangCodecHandler);
+
+ YangDataTreeCodec overriddenCodec = new MockOverriddenDataTreeCodec();
+ yangCodecHandler.registerOverriddenCodec(overriddenCodec, XML);
+
+ provider.processSchemaRegistry(null);
+ // Verify the received object list
+ YangCompositeEncoding yangCompositeEncoding =
+ new MockYangCompositeEncoding();
+ yangCodecHandler.decode(yangCompositeEncoding, XML, null);
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ypm/DefaultYpmNodeTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ypm/DefaultYpmNodeTest.java
new file mode 100644
index 0000000..bec2eef
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ypm/DefaultYpmNodeTest.java
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ypm;
+
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.nullValue;
+
+import org.onosproject.yms.ypm.YpmContext;
+import org.onosproject.yms.ypm.DefaultYpmNode;
+
+/**
+ * Unit tests for DefaultYpmNode class.
+ */
+public class DefaultYpmNodeTest {
+ private final String logicalName = "logicalYpmNode";
+ private final String moduleName1 = "portPairModule1";
+ private final String moduleName2 = "portPairModule2";
+ private final String xNodeName = "x";
+ private final String yNodeName = "y";
+ private final String zNodeName = "z";
+ private final String x1NodeName = "x1";
+ private final String x2NodeName = "x2";
+ private final String y1NodeName = "y1";
+ private final String y2NodeName = "y2";
+ private final String z1NodeName = "z1";
+ private final String z2NodeName = "z2";
+
+ /**
+ * Constructs ypm tree with single module.
+ *
+ * @return ypm tree root node
+ */
+ private YpmContext constructYpmTreeSingleModule() {
+ // Create logical node
+ DefaultYpmNode rootNode = new DefaultYpmNode(logicalName);
+ // Create module node with moduleName1
+ rootNode.addChild(moduleName1); // child to logical node
+ YpmContext moduleNode = rootNode.getChild(moduleName1);
+ moduleNode.addChild(xNodeName); // child to module node
+ moduleNode.addChild(yNodeName); // sibling node to child node "x"
+ YpmContext xNode = moduleNode.getChild("x");
+ xNode.addSibling(zNodeName); // sibling node to child node "x"
+ xNode.addChild(x1NodeName); // child to node x
+ xNode.addChild(x2NodeName); // child to node x
+ YpmContext yNode = moduleNode.getChild(yNodeName);
+ yNode.addChild(y1NodeName); // child to node y
+ yNode.addChild(y2NodeName); // child to node y
+ YpmContext zNode = moduleNode.getChild(zNodeName);
+ zNode.addChild(z1NodeName); // child to node z
+ zNode.addChild(z2NodeName); // child to node z
+ return rootNode;
+ }
+
+ /**
+ * Constructs ypm tree with multi module.
+ *
+ * @return ypm tree root node
+ */
+ private YpmContext constructYpmTreeMultiModule(DefaultYpmNode rootNode) {
+ rootNode.addChild(moduleName2); // child to logical node
+ YpmContext moduleNode = rootNode.getChild(moduleName2);
+ moduleNode.addChild(xNodeName); // child to module node
+ moduleNode.addChild(yNodeName); // sibling node to child node "x"
+ YpmContext xNode = moduleNode.getChild("x");
+ xNode.addSibling(zNodeName); // sibling node to child node "x"
+ xNode.addChild(x1NodeName); // child to node x
+ xNode.addChild(x2NodeName); // child to node x
+ YpmContext yNode = moduleNode.getChild(yNodeName);
+ yNode.addChild(y1NodeName); // child to node y
+ yNode.addChild(y2NodeName); // child to node y
+ YpmContext zNode = moduleNode.getChild(zNodeName);
+ zNode.addChild(z1NodeName); // child to node z
+ zNode.addChild(z2NodeName); // child to node z
+ return rootNode;
+ }
+
+ /**
+ * Checks ypm tree single module construction.
+ */
+ @Test
+ public void testYpmTreeSingleModuleConstruction() {
+ DefaultYpmNode rootNode = (DefaultYpmNode) constructYpmTreeSingleModule();
+ // Check one by one node
+ String name = rootNode.getName();
+ assertThat(name, is(logicalName));
+ YpmContext moduleNode = rootNode.getChild(moduleName1);
+ assertThat(moduleNode.getName(), is(moduleName1));
+ YpmContext ypmNode = moduleNode.getChild(xNodeName);
+ assertThat(ypmNode.getName(), is(xNodeName));
+ // Check sibling by using getNextSibling();
+ ypmNode = ypmNode.getNextSibling();
+ assertThat(ypmNode, notNullValue()); // either y or z should be there as sibling
+ ypmNode = ypmNode.getNextSibling();
+ assertThat(ypmNode, notNullValue()); // either y or z should be there as sibling
+ ypmNode = ypmNode.getNextSibling();
+ assertThat(ypmNode, nullValue()); // last sibling point to next sibling as null
+ // Check sibling by using getPreviousSibling()
+ ypmNode = moduleNode.getChild(zNodeName);
+ assertThat(ypmNode.getName(), is(zNodeName));
+ ypmNode = ypmNode.getPreviousSibling();
+ assertThat(ypmNode, notNullValue()); // either x or y should be there as sibling
+ ypmNode = ypmNode.getPreviousSibling();
+ assertThat(ypmNode, notNullValue()); // either x or y should be there as sibling
+ ypmNode = ypmNode.getPreviousSibling();
+ assertThat(ypmNode, nullValue()); // last sibling point to next sibling as null
+ // Checks the child x1 and x2
+ ypmNode = moduleNode.getChild(xNodeName);
+ ypmNode = ypmNode.getChild(x1NodeName);
+ assertThat(ypmNode.getName(), is(x1NodeName));
+ ypmNode = ypmNode.getSibling(x2NodeName);
+ assertThat(ypmNode.getName(), is(x2NodeName));
+ // Checks the child y1 and y2
+ ypmNode = moduleNode.getChild(yNodeName);
+ ypmNode = ypmNode.getChild(y1NodeName);
+ assertThat(ypmNode.getName(), is(y1NodeName));
+ ypmNode = ypmNode.getSibling(y2NodeName);
+ assertThat(ypmNode.getName(), is(y2NodeName));
+ // Checks the child z1 and z2
+ ypmNode = moduleNode.getChild(zNodeName);
+ ypmNode = ypmNode.getChild(z1NodeName);
+ assertThat(ypmNode.getName(), is(z1NodeName));
+ ypmNode = ypmNode.getSibling(z2NodeName);
+ assertThat(ypmNode.getName(), is(z2NodeName));
+ }
+
+ /**
+ * Checks ypm tree multiple module construction.
+ */
+ @Test
+ public void testYpmTreeMultiModuleConstruction() {
+ DefaultYpmNode rootNode = (DefaultYpmNode) constructYpmTreeSingleModule();
+ rootNode = (DefaultYpmNode) constructYpmTreeMultiModule(rootNode);
+ // Check one by one node
+ String name = rootNode.getName();
+ assertThat(name, is(logicalName));
+ YpmContext moduleNode = rootNode.getChild(moduleName2);
+ assertThat(moduleNode.getName(), is(moduleName2));
+ YpmContext ypmNode = moduleNode.getChild(xNodeName);
+ assertThat(ypmNode.getName(), is(xNodeName));
+ // Check sibling by using getNextSibling();
+ ypmNode = ypmNode.getNextSibling();
+ assertThat(ypmNode, notNullValue()); // either y or z should be there as sibling
+ ypmNode = ypmNode.getNextSibling();
+ assertThat(ypmNode, notNullValue()); // either y or z should be there as sibling
+ ypmNode = ypmNode.getNextSibling();
+ assertThat(ypmNode, nullValue()); // last sibling point to next sibling as null
+ // Check sibling by using getPreviousSibling()
+ ypmNode = moduleNode.getChild(zNodeName);
+ assertThat(ypmNode.getName(), is(zNodeName));
+ ypmNode = ypmNode.getPreviousSibling();
+ assertThat(ypmNode, notNullValue()); // either x or y should be there as sibling
+ ypmNode = ypmNode.getPreviousSibling();
+ assertThat(ypmNode, notNullValue()); // either x or y should be there as sibling
+ ypmNode = ypmNode.getPreviousSibling();
+ assertThat(ypmNode, nullValue()); // last sibling point to next sibling as null
+ // Checks the child x1 and x2
+ ypmNode = moduleNode.getChild(xNodeName);
+ ypmNode = ypmNode.getChild(x1NodeName);
+ assertThat(ypmNode.getName(), is(x1NodeName));
+ ypmNode = ypmNode.getSibling(x2NodeName);
+ assertThat(ypmNode.getName(), is(x2NodeName));
+ // Checks the child y1 and y2
+ ypmNode = moduleNode.getChild(yNodeName);
+ ypmNode = ypmNode.getChild(y1NodeName);
+ assertThat(ypmNode.getName(), is(y1NodeName));
+ ypmNode = ypmNode.getSibling(y2NodeName);
+ assertThat(ypmNode.getName(), is(y2NodeName));
+ // Checks the child z1 and z2
+ ypmNode = moduleNode.getChild(zNodeName);
+ ypmNode = ypmNode.getChild(z1NodeName);
+ assertThat(ypmNode.getName(), is(z1NodeName));
+ ypmNode = ypmNode.getSibling(z2NodeName);
+ assertThat(ypmNode.getName(), is(z2NodeName));
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ypm/YdtNodeAdapter.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ypm/YdtNodeAdapter.java
new file mode 100644
index 0000000..c7d1efb
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ypm/YdtNodeAdapter.java
@@ -0,0 +1,327 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ypm;
+
+import org.onosproject.yangutils.datamodel.YangSchemaNode;
+import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
+import org.onosproject.yms.app.ydt.AppType;
+import org.onosproject.yms.app.ydt.YdtExtendedContext;
+import org.onosproject.yms.app.ydt.YdtNode;
+import org.onosproject.yms.ydt.YdtContext;
+import org.onosproject.yms.ydt.YdtContextOperationType;
+import org.onosproject.yms.ydt.YdtExtendedInfoType;
+import org.onosproject.yms.ydt.YdtType;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Represents implementation of interfaces to build and obtain YANG data tree.
+ */
+public class YdtNodeAdapter<T> implements YdtExtendedContext {
+
+ /**
+ * Parent reference.
+ */
+ private YdtNodeAdapter parent;
+
+ /**
+ * First child reference.
+ */
+ private YdtNodeAdapter child;
+
+ /**
+ * Next sibling reference.
+ */
+ private YdtNodeAdapter nextSibling;
+
+ /**
+ * Previous sibling reference.
+ */
+ private YdtNodeAdapter previousSibling;
+
+ /**
+ * Last child reference.
+ */
+ private YdtNode lastChild;
+
+ /**
+ * Type of node.
+ */
+ private YdtType ydtType;
+
+ /**
+ * Flag to keep the track of context switch.
+ */
+ private boolean isContextSwitch;
+
+ private T ydtExtendedInfo;
+
+ /**
+ * YDT extended information type.
+ */
+ YdtExtendedInfoType ydtExtendedInfoType;
+
+ /**
+ * Ydt map to keep the track of node added in YDT.
+ */
+ private Map<YangSchemaNodeIdentifier, List<YdtNode<T>>> ydtNodeMap = new HashMap<>();
+
+ /**
+ * Reference for data-model schema node.
+ */
+ private YangSchemaNode yangSchemaNode;
+
+ /**
+ * Reference for ydt node operation type.
+ */
+ private YdtContextOperationType ydtContextOperationType;
+
+ /**
+ * Key object for ydtNodeMap.
+ */
+ protected YangSchemaNodeIdentifier nodeIdentifier;
+
+ /**
+ * Ydt map to keep the track of application information object with respective type.
+ */
+ Map<AppType, Object> ydtAppInfoMap = new HashMap<>();
+
+
+ /**
+ * Creation of YANG node object.
+ */
+ public YdtNodeAdapter() {
+ }
+
+ /**
+ * Creates a specific type of node.
+ *
+ * @param type of YDT node
+ * @param name name of the YDT node
+ */
+ public YdtNodeAdapter(YdtType type, String name) {
+ setYdtType(type);
+ }
+
+ @Override
+ public String getName() {
+ return this.nodeIdentifier.getName();
+ }
+
+ @Override
+ public String getNamespace() {
+ return yangSchemaNode.getNameSpace().getModuleNamespace();
+ }
+
+ @Override
+ public String getModuleNameAsNameSpace() {
+ return null;
+ }
+
+ @Override
+ public <T> T getYdtContextExtendedInfo() {
+ return (T) ydtExtendedInfo;
+ }
+
+ @Override
+ public YdtExtendedInfoType getYdtExtendedInfoType() {
+ return ydtExtendedInfoType;
+ }
+
+ @Override
+ public YdtType getYdtType() {
+ return ydtType;
+ }
+
+ /**
+ * Sets the node type.
+ *
+ * @param ydtType type of YDT attribute
+ */
+ public void setYdtType(YdtType ydtType) {
+ this.ydtType = ydtType;
+ }
+
+ @Override
+ public YdtNodeAdapter getParent() {
+ return parent;
+ }
+
+ /**
+ * Sets the parent of node.
+ *
+ * @param parent node
+ */
+ public void setParent(YdtNodeAdapter parent) {
+ this.parent = parent;
+ }
+
+ @Override
+ public YdtNodeAdapter getFirstChild() {
+ return child;
+ }
+
+ @Override
+ public YdtNodeAdapter getNextSibling() {
+ return nextSibling;
+ }
+
+ /**
+ * Sets the next sibling of node.
+ *
+ * @param sibling YANG node
+ */
+ public void setNextSibling(YdtNodeAdapter sibling) {
+ nextSibling = sibling;
+ }
+
+ @Override
+ public YdtNodeAdapter getPreviousSibling() {
+ return previousSibling;
+ }
+
+ /**
+ * Sets the previous sibling.
+ *
+ * @param previousSibling points to predecessor sibling
+ */
+ public void setPreviousSibling(YdtNodeAdapter previousSibling) {
+ this.previousSibling = previousSibling;
+ }
+
+ /**
+ * Returns data-model node reference for of a given node.
+ *
+ * @return yang schema data node of a data-model.
+ */
+ public YangSchemaNode getYangSchemaNode() {
+ return yangSchemaNode;
+ }
+
+ /**
+ * Sets the data-model node reference for of a given node..
+ *
+ * @param yangSchemaNode YANG data node.
+ */
+ public void setYangSchemaNode(YangSchemaNode yangSchemaNode) {
+ this.yangSchemaNode = yangSchemaNode;
+ }
+
+ @Override
+ public YdtNode getLastChild() {
+ return lastChild;
+ }
+
+ /**
+ * Sets the last instance of a child node.
+ *
+ * @param child is last child to be set
+ */
+ public void setLastChild(YdtNode child) {
+ this.lastChild = child;
+ }
+
+ public void setNodeIdentifier(YangSchemaNodeIdentifier nodeIdentifier) {
+ this.nodeIdentifier = nodeIdentifier;
+ }
+
+ /**
+ * Adds a child node.
+ *
+ * @param newChild refers to a child to be added
+ */
+ public void addChild(YdtContext newChild) {
+
+ ((YdtNodeAdapter) newChild).setParent(this);
+
+ if (this.child == null) {
+ this.child = (YdtNodeAdapter) newChild;
+ return;
+ }
+
+ YdtNodeAdapter currNode = this.child;
+ while (currNode.getNextSibling() != null) {
+ currNode = currNode.getNextSibling();
+ }
+ currNode.setNextSibling((YdtNodeAdapter) newChild);
+ ((YdtNodeAdapter) newChild).setPreviousSibling(currNode);
+ }
+
+ /**
+ * Adds a sibling to YANG data tree.
+ *
+ * @param newSibling context of sibling to be added
+ */
+ public void addSibling(YdtContext newSibling) {
+
+ ((YdtNodeAdapter) newSibling).setParent(this.getParent());
+
+ YdtNodeAdapter currNode = this;
+
+ while (currNode.getNextSibling() != null) {
+ currNode = currNode.getNextSibling();
+ }
+ currNode.setNextSibling((YdtNodeAdapter) newSibling);
+ ((YdtNodeAdapter) newSibling).setPreviousSibling(currNode);
+ }
+
+ /**
+ * Gets the flag for node if context switch.
+ *
+ * @return isContextSwitch flag of a node.
+ */
+ public boolean getContextSwitch() {
+ return isContextSwitch;
+ }
+
+ /**
+ * Sets the flag to keep the track of context switch.
+ *
+ * @param contextSwitch boolean flag.
+ */
+ public void setContextSwitch(boolean contextSwitch) {
+ isContextSwitch = contextSwitch;
+ }
+
+ @Override
+ public String getValue() {
+ return null;
+ }
+
+ @Override
+ public Set<String> getValueSet() {
+ return null;
+ }
+
+ @Override
+ public Object getAppInfo(AppType appType) {
+ return null;
+ }
+
+ @Override
+ public void addAppInfo(AppType appType, Object object) {
+
+ }
+
+ @Override
+ public YdtContextOperationType getYdtContextOperationType() {
+ return ydtContextOperationType;
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ypm/YpmManagerTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ypm/YpmManagerTest.java
new file mode 100644
index 0000000..37df836
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ypm/YpmManagerTest.java
@@ -0,0 +1,492 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ypm;
+
+import org.junit.Test;
+import org.onosproject.yangutils.datamodel.YangSchemaNodeIdentifier;
+import org.onosproject.yms.ypm.DefaultYpmNode;
+import org.onosproject.yms.ypm.YpmContext;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.nullValue;
+
+/**
+ * Unit tests for YpmManager class.
+ */
+public class YpmManagerTest {
+ private final String logicalName = "logicalYpmNode";
+ private final String moduleName1 = "portPairModule1";
+ private final String moduleName2 = "portPairModule2";
+ private final String xNodeName = "x";
+ private final String yNodeName = "y";
+ private final String zNodeName = "z";
+ private final String x1NodeName = "x1";
+ private final String x2NodeName = "x2";
+ private final String y1NodeName = "y1";
+ private final String y2NodeName = "y2";
+ private final String y11NodeName = "y11";
+ private final String z1NodeName = "z1";
+ private final String z2NodeName = "z2";
+ private final String z3NodeName = "z3";
+
+ /**
+ * Creates module1 ydt tree.
+ */
+ public YdtNodeAdapter createModule1Tree() throws CloneNotSupportedException {
+ YangSchemaNodeIdentifier tmpNodeIdentifier;
+ YdtNodeAdapter rootNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(logicalName);
+ rootNode.setNodeIdentifier(tmpNodeIdentifier);
+
+ // Create module node with moduleName1
+ YdtNodeAdapter moduleNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(moduleName1);
+ moduleNode.setNodeIdentifier(tmpNodeIdentifier);
+ moduleNode.setParent(rootNode);
+ rootNode.addChild(moduleNode); // child to logical node
+ YdtNodeAdapter xNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(xNodeName);
+ xNode.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter yNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(yNodeName);
+ yNode.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter zNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(zNodeName);
+ zNode.setNodeIdentifier(tmpNodeIdentifier);
+ moduleNode.addChild(xNode); // child to module node
+ xNode.addSibling(yNode);
+ yNode.addSibling(zNode);
+ YdtNodeAdapter x1Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(x1NodeName);
+ x1Node.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter x2Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(x2NodeName);
+ x2Node.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter y1Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(y1NodeName);
+ y1Node.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter y2Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(y2NodeName);
+ y2Node.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter z1Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(z1NodeName);
+ z1Node.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter z2Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(z2NodeName);
+ z2Node.setNodeIdentifier(tmpNodeIdentifier);
+ xNode.addChild(x1Node);
+ x1Node.addSibling(x2Node);
+ yNode.addChild(y1Node);
+ y1Node.addSibling(y2Node);
+ zNode.addChild(z1Node);
+ z1Node.addSibling(z2Node);
+
+ return rootNode;
+ }
+
+ /**
+ * Checks the protocol data added in YpmManger when only single module exists.
+ */
+ @Test
+ public void retrieveAndCheckProtocolDataWhenSingleModule() throws CloneNotSupportedException {
+ YdtNodeAdapter rootNode = createModule1Tree();
+
+ YpmManager ypmManager = new YpmManager();
+ Object metaData = 10;
+ ypmManager.setProtocolData(rootNode, metaData);
+ YpmContext ypmContext = ypmManager.getProtocolData(rootNode);
+ DefaultYpmNode rootYpmNode = (DefaultYpmNode) ypmContext;
+ assertThat(rootYpmNode.getName(), is(logicalName));
+ DefaultYpmNode currYpmNode = (DefaultYpmNode) rootYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(moduleName1));
+ currYpmNode = (DefaultYpmNode) currYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(xNodeName)); // x node
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), notNullValue()); // y or z node
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), notNullValue()); // y or z node
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), nullValue()); // no sibling
+
+ // Check x node leaf's x1 and x2
+ DefaultYpmNode moduleYpmNode = currYpmNode.getParent();
+ assertThat(moduleYpmNode.getName(), is(moduleName1));
+ DefaultYpmNode xYpmNode = (DefaultYpmNode) moduleYpmNode.getFirstChild();
+ assertThat(xYpmNode.getName(), is(xNodeName));
+ assertThat(xYpmNode.getMetaData(), is(metaData));
+ // Check x1 node
+ currYpmNode = (DefaultYpmNode) xYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(x1NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ // Check x2 node
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getName(), is(x2NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+
+ // Check y node leaf's y1 and y2
+ DefaultYpmNode yYpmNode = xYpmNode.getNextSibling();
+ assertThat(yYpmNode.getName(), is(yNodeName));
+ assertThat(yYpmNode.getMetaData(), is(metaData));
+ // Check y1 node
+ currYpmNode = (DefaultYpmNode) yYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(y1NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ // Check y2 node
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getName(), is(y2NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+
+ // Check z node leaf's z1 and z2
+ DefaultYpmNode zYpmNode = yYpmNode.getNextSibling();
+ assertThat(zYpmNode.getName(), is(zNodeName));
+ assertThat(zYpmNode.getMetaData(), is(metaData));
+ // Check z1 node
+ currYpmNode = (DefaultYpmNode) zYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(z1NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ // Check z2 node
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getName(), is(z2NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ }
+
+ /**
+ * Creates module2 ydt tree. Module1 and Module2 trees are point to same logical root.
+ */
+ public YdtNodeAdapter createModule2Tree() throws CloneNotSupportedException {
+ YangSchemaNodeIdentifier tmpNodeIdentifier;
+ YdtNodeAdapter rootNode = createModule1Tree();
+ YdtNodeAdapter moduleNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(moduleName2);
+ moduleNode.setNodeIdentifier(tmpNodeIdentifier);
+ moduleNode.setParent(rootNode);
+ rootNode.addChild(moduleNode); // child to logical node
+ YdtNodeAdapter xNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(xNodeName);
+ xNode.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter yNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(yNodeName);
+ yNode.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter zNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(zNodeName);
+ zNode.setNodeIdentifier(tmpNodeIdentifier);
+ moduleNode.addChild(xNode); // child to module node
+ xNode.addSibling(yNode);
+ yNode.addSibling(zNode);
+ YdtNodeAdapter x1Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(x1NodeName);
+ x1Node.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter x2Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(x2NodeName);
+ x2Node.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter y1Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(y1NodeName);
+ y1Node.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter y2Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(y2NodeName);
+ y2Node.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter z1Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(z1NodeName);
+ z1Node.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter z2Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(z2NodeName);
+ z2Node.setNodeIdentifier(tmpNodeIdentifier);
+ xNode.addChild(x1Node);
+ x1Node.addSibling(x2Node);
+ yNode.addChild(y1Node);
+ y1Node.addSibling(y2Node);
+ zNode.addChild(z1Node);
+ z1Node.addSibling(z2Node);
+
+ return rootNode;
+ }
+
+ /**
+ * Checks the protocol data added in YpmManger when multiple modules exists.
+ */
+ @Test
+ public void retrieveAndCheckProtocolDataWhenMultipleModule() throws CloneNotSupportedException {
+ YdtNodeAdapter rootNode = createModule2Tree();
+
+ YpmManager ypmManager = new YpmManager();
+ Object metaData = 10;
+ ypmManager.setProtocolData(rootNode, metaData);
+ YpmContext ypmContext = ypmManager.getProtocolData(rootNode);
+ DefaultYpmNode rootYpmNode = (DefaultYpmNode) ypmContext;
+ assertThat(rootYpmNode.getName(), is(logicalName));
+ DefaultYpmNode currYpmNode = (DefaultYpmNode) rootYpmNode.getFirstChild();
+ currYpmNode = currYpmNode.getNextSibling(); // jump to next module (module2)
+ assertThat(currYpmNode.getName(), is(moduleName2));
+ currYpmNode = (DefaultYpmNode) currYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(xNodeName)); // x node
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), notNullValue()); // y or z node
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), notNullValue()); // y or z node
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), nullValue()); // no sibling
+
+ // Check x node leaf's x1 and x2
+ DefaultYpmNode moduleYpmNode = currYpmNode.getParent();
+ assertThat(moduleYpmNode.getName(), is(moduleName2));
+ DefaultYpmNode xYpmNode = (DefaultYpmNode) moduleYpmNode.getFirstChild();
+ assertThat(xYpmNode.getName(), is(xNodeName));
+ assertThat(xYpmNode.getMetaData(), is(metaData));
+ // Check x1 node
+ currYpmNode = (DefaultYpmNode) xYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(x1NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ // Check x2 node
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getName(), is(x2NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+
+ // Check y node leaf's y1 and y2
+ DefaultYpmNode yYpmNode = xYpmNode.getNextSibling();
+ assertThat(yYpmNode.getName(), is(yNodeName));
+ assertThat(yYpmNode.getMetaData(), is(metaData));
+ // Check y1 node
+ currYpmNode = (DefaultYpmNode) yYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(y1NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ // Check y2 node
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getName(), is(y2NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+
+ // Check z node leaf's z1 and z2
+ DefaultYpmNode zYpmNode = yYpmNode.getNextSibling();
+ assertThat(zYpmNode.getName(), is(zNodeName));
+ assertThat(zYpmNode.getMetaData(), is(metaData));
+ // Check z1 node
+ currYpmNode = (DefaultYpmNode) zYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(z1NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ // Check z2 node
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getName(), is(z2NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ }
+
+ /**
+ * Checks the protocol data added in YpmManger, but tests only part of module1 tree.
+ */
+ @Test
+ public void retrieveAndCheckProtocolDataChosenFromPartOfModule1Tree() throws CloneNotSupportedException {
+ YangSchemaNodeIdentifier tmpNodeIdentifier;
+ YdtNodeAdapter rootNode = createModule2Tree();
+
+ // Sets the tree
+ YpmManager ypmManager = new YpmManager();
+ Object metaData = 10;
+ ypmManager.setProtocolData(rootNode, metaData);
+
+ // Create new ydt tree part of module1 tree
+ YdtNodeAdapter rootNewYdtNode = new YdtNodeAdapter();
+ // Create module node with moduleName1
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(logicalName);
+ rootNewYdtNode.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter moduleNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(moduleName1);
+ moduleNode.setNodeIdentifier(tmpNodeIdentifier);
+ moduleNode.setParent(rootNewYdtNode);
+ rootNewYdtNode.addChild(moduleNode); // child to logical node
+ YdtNodeAdapter yNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(yNodeName);
+ yNode.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter zNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(zNodeName);
+ zNode.setNodeIdentifier(tmpNodeIdentifier);
+ moduleNode.addChild(yNode); // child to module node
+ yNode.addSibling(zNode);
+ YdtNodeAdapter y1Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(y1NodeName);
+ y1Node.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter y2Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(y2NodeName);
+ y2Node.setNodeIdentifier(tmpNodeIdentifier);
+ yNode.addChild(y1Node);
+ y1Node.addSibling(y2Node);
+
+ // Again sets the protocol data
+ metaData = 20;
+ ypmManager.setProtocolData(rootNewYdtNode, metaData);
+
+ // Retrieve protocol data and check the contents
+ YpmContext ypmContext = ypmManager.getProtocolData(rootNewYdtNode);
+ DefaultYpmNode rootYpmNode = (DefaultYpmNode) ypmContext;
+ assertThat(rootYpmNode.getName(), is(logicalName));
+ DefaultYpmNode currYpmNode = (DefaultYpmNode) rootYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(moduleName1));
+ // Check y and z node
+ currYpmNode = (DefaultYpmNode) currYpmNode.getFirstChild();
+ DefaultYpmNode yYpmNode = currYpmNode;
+ assertThat(currYpmNode.getName(), is(yNodeName)); // x node
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), notNullValue()); // z node
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getName(), is(zNodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), nullValue()); // no sibling
+ // Check y1 and y2 node
+ currYpmNode = (DefaultYpmNode) yYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(y1NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), notNullValue()); // y2 should exists
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getName(), is(y2NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), nullValue());
+ }
+
+ /**
+ * Checks the protocol data added in YpmManger, but tests part of module1 tree with little bit extended tree.
+ */
+ @Test
+ public void retrieveAndCheckProtocolDataChosenFromPartOfModule1TreeWithExtended()
+ throws CloneNotSupportedException {
+ YangSchemaNodeIdentifier tmpNodeIdentifier;
+ YdtNodeAdapter rootNode = createModule2Tree();
+
+ // Sets the tree
+ YpmManager ypmManager = new YpmManager();
+ Object metaData = 10;
+ ypmManager.setProtocolData(rootNode, metaData);
+
+ // Create new ydt tree part of module1 tree
+ YdtNodeAdapter rootNewYdtNode = new YdtNodeAdapter();
+ // Create module node with moduleName1
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(logicalName);
+ rootNewYdtNode.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter moduleNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(moduleName1);
+ moduleNode.setNodeIdentifier(tmpNodeIdentifier);
+ moduleNode.setParent(rootNewYdtNode);
+ rootNewYdtNode.addChild(moduleNode); // child to logical node
+ YdtNodeAdapter yNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(yNodeName);
+ yNode.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter zNode = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(zNodeName);
+ zNode.setNodeIdentifier(tmpNodeIdentifier);
+ moduleNode.addChild(yNode); // child to module node
+ yNode.addSibling(zNode);
+ YdtNodeAdapter y1Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(y1NodeName);
+ y1Node.setNodeIdentifier(tmpNodeIdentifier);
+ YdtNodeAdapter y2Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(y2NodeName);
+ y2Node.setNodeIdentifier(tmpNodeIdentifier);
+ yNode.addChild(y1Node);
+ y1Node.addSibling(y2Node);
+ YdtNodeAdapter y11Node = new YdtNodeAdapter();
+ // Add new y11 node
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(y11NodeName);
+ y11Node.setNodeIdentifier(tmpNodeIdentifier);
+ y1Node.addChild(y11Node);
+ // Add new y3 node
+ YdtNodeAdapter z3Node = new YdtNodeAdapter();
+ tmpNodeIdentifier = new YangSchemaNodeIdentifier();
+ tmpNodeIdentifier.setName(z3NodeName);
+ z3Node.setNodeIdentifier(tmpNodeIdentifier);
+ zNode.addChild(z3Node);
+
+ // Again sets the protocol data
+ metaData = 20;
+ ypmManager.setProtocolData(rootNewYdtNode, metaData);
+
+ // Retrieve protocol data and check the contents
+ YpmContext ypmContext = ypmManager.getProtocolData(rootNewYdtNode);
+ DefaultYpmNode rootYpmNode = (DefaultYpmNode) ypmContext;
+ assertThat(rootYpmNode.getName(), is(logicalName));
+ DefaultYpmNode currYpmNode = (DefaultYpmNode) rootYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(moduleName1));
+ // Check y and z node
+ currYpmNode = (DefaultYpmNode) currYpmNode.getFirstChild();
+ DefaultYpmNode yYpmNode = currYpmNode;
+ assertThat(currYpmNode.getName(), is(yNodeName)); // y node
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), notNullValue()); // z node
+ currYpmNode = currYpmNode.getNextSibling();
+ DefaultYpmNode zYpmNode = currYpmNode;
+ assertThat(currYpmNode.getName(), is(zNodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), nullValue()); // no sibling
+ // Check y1 and y2 node
+ currYpmNode = (DefaultYpmNode) yYpmNode.getFirstChild();
+ DefaultYpmNode y1YpmNode = currYpmNode;
+ assertThat(currYpmNode.getName(), is(y1NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), notNullValue()); // y2 should exists
+ currYpmNode = currYpmNode.getNextSibling();
+ assertThat(currYpmNode.getName(), is(y2NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), nullValue());
+ // Check new y11 node
+ currYpmNode = (DefaultYpmNode) y1YpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(y11NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), nullValue());
+ assertThat(currYpmNode.getFirstChild(), nullValue());
+ // Check new z3 node
+ currYpmNode = (DefaultYpmNode) zYpmNode.getFirstChild();
+ assertThat(currYpmNode.getName(), is(z3NodeName));
+ assertThat(currYpmNode.getMetaData(), is(metaData));
+ assertThat(currYpmNode.getNextSibling(), nullValue());
+ assertThat(currYpmNode.getFirstChild(), nullValue());
+ }
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ysr/DefaultYangSchemaRegistryTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ysr/DefaultYangSchemaRegistryTest.java
new file mode 100644
index 0000000..bf8d46a
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ysr/DefaultYangSchemaRegistryTest.java
@@ -0,0 +1,677 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ysr;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network1.rev20151208.IetfNetwork1Service;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network2.rev20151208.IetfNetwork2Service;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangSchemaNode;
+
+import java.io.IOException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Unit test case for default schema registry.
+ */
+public class DefaultYangSchemaRegistryTest {
+
+ private static final String SERVICE_NAME_1 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network1.rev20151208.IetfNetwork1Service";
+ private static final String SCHEMA_NAME_1 = "ietf-network1";
+ private static final String EVENT_NAME_1 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network1.rev20151208.ietfnetwork1.IetfNetwork1Event";
+ private static final String INTERFACE_NAME_1 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network1.rev20151208.IetfNetwork1";
+ private static final String OP_PARAM_NAME_1 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network1.rev20151208.IetfNetwork1OpParam";
+
+ private static final String SERVICE_NAME_2 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network2.rev20151208.IetfNetwork2Service";
+ private static final String SCHEMA_NAME_2 = "ietf-network2";
+ private static final String EVENT_NAME_2 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network2.rev20151208.ietfnetwork2.IetfNetwork2Event";
+ private static final String INTERFACE_NAME_2 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network2.rev20151208.IetfNetwork2";
+ private static final String OP_PARAM_NAME_2 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network2.rev20151208.IetfNetwork2OpParam";
+
+ private static final String SERVICE_NAME_3 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network3.rev20151208.IetfNetwork3Service";
+ private static final String SCHEMA_NAME_3 = "ietf-network3";
+ private static final String EVENT_NAME_3 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network3.rev20151208.ietfnetwork3.IetfNetwork3Event";
+ private static final String INTERFACE_NAME_3 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network3.rev20151208.IetfNetwork3";
+ private static final String OP_PARAM_NAME_3 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network3.rev20151208.IetfNetwork3OpParam";
+
+ private static final String SCHEMA_NAME_4_14 = "ietf-network4@2014-00-08";
+ private static final String SCHEMA_NAME_4_15 = "ietf-network4@2015-00-08";
+ private static final String SCHEMA_NAME_4_16 = "ietf-network4@2016-00-08";
+ private static final String SCHEMA_NAME_4_17 = "ietf-network4@2017-00-08";
+ private static final String SCHEMA_NAME_4 = "ietf-network4";
+ private static final String SERVICE_NAME_REV_14 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20141208.IetfNetwork4Service";
+ private static final String EVENT_NAME_REV_14 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20141208.ietfnetwork4.IetfNetwork4Event";
+ private static final String INTERFACE_NAME_REV_14 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20141208.IetfNetwork4";
+ private static final String OP_PARAM_NAME_REV_14 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20141208.IetfNetwork4OpParam";
+
+ private static final String SERVICE_NAME_REV_15 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20151208.IetfNetwork4Service";
+ private static final String EVENT_NAME_REV_15 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20151208.ietfnetwork4.IetfNetwork4Event";
+ private static final String INTERFACE_NAME_REV_15 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20151208.IetfNetwork4";
+ private static final String OP_PARAM_NAME_REV_15 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20151208.IetfNetwork4OpParam";
+
+ private static final String SERVICE_NAME_REV_16 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20161208.IetfNetwork4Service";
+
+ private static final String EVENT_NAME_REV_16 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20161208.ietfnetwork4.IetfNetwork4Event";
+ private static final String INTERFACE_NAME_REV_16 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20161208.IetfNetwork4";
+ private static final String OP_PARAM_NAME_REV_16 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20161208.IetfNetwork4OpParam";
+
+ private static final String SERVICE_NAME_REV_17 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20171208.IetfNetwork4Service";
+ private static final String EVENT_NAME_REV_17 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20171208.ietfnetwork4.IetfNetwork4Event";
+ private static final String INTERFACE_NAME_REV_17 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20171208.IetfNetwork4";
+ private static final String OP_PARAM_NAME_REV_17 =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.rev20171208.IetfNetwork4OpParam";
+
+ private static final String SERVICE_NAME_NO_REV =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.IetfNetwork4Service";
+ private static final String EVENT_NAME_NO_REV =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.ietfnetwork4.IetfNetwork4Event";
+ private static final String INTERFACE_NAME_NO_REV =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.IetfNetwork4";
+ private static final String OP_PARAM_NAME_NO_REV =
+ "org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf" +
+ ".network4.IetfNetwork4OpParam";
+
+ private static final String DATE = "2014-00-08";
+ private static final String SCHEMA_NAME_WITH_DATE =
+ "ietf-network4@2014-00-08";
+
+ private static final String UN_REG_SCHEMA_NAME = "ietf-routing";
+ private static final String UN_REG_INTERFACE_NAME = "IetfRouting";
+ private static final String UN_REG_OP_PARAM_NAME = "IetfRoutingOpParam";
+ private static final String UN_REG_SERVICE_NAME = "IetfRoutingService";
+ private static final String UN_REG_EVENT_NAME = "IetfRoutingEvent";
+
+ private final TestYangSchemaNodeProvider testYangSchemaNodeProvider =
+ new TestYangSchemaNodeProvider();
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ /**
+ * Unit test case in which schema node should be present.
+ *
+ * @throws IOException when fails to do IO operation
+ */
+ @Test
+ public void testForGetSchemaNode()
+ throws IOException {
+
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+
+ DefaultYangSchemaRegistry registry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+
+ YangSchemaNode yangNode =
+ registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_1);
+ assertThat(true, is(SCHEMA_NAME_1.equals(yangNode.getName())));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_1);
+ assertThat(true, is(SCHEMA_NAME_1.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_1);
+ assertThat(true, is(SCHEMA_NAME_1.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_1);
+ assertThat(true, is(SCHEMA_NAME_1.equals(yangNode.getName())));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(EVENT_NAME_1);
+ assertThat(true, is(SCHEMA_NAME_1.equals(yangNode.getName())));
+
+ //As we have not registered an application this object should be null.
+ Object object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+ testYangSchemaNodeProvider.unregisterService(SERVICE_NAME_1);
+
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_1);
+ assertThat(true, is(yangNode == null));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_1);
+ assertThat(true, is(yangNode == null));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_1);
+ assertThat(true, is(yangNode == null));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_1);
+ assertThat(true, is(yangNode == null));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(EVENT_NAME_1);
+ assertThat(true, is(yangNode == null));
+
+ //As we have not registered an application this object should be null.
+ object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+
+ //With second service.
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_2);
+ assertThat(true, is(SCHEMA_NAME_2.equals(yangNode.getName())));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_2);
+ assertThat(true, is(SCHEMA_NAME_2.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_2);
+ assertThat(true, is(SCHEMA_NAME_2.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_2);
+ assertThat(true, is(SCHEMA_NAME_2.equals(yangNode.getName())));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(EVENT_NAME_2);
+ assertThat(true, is(SCHEMA_NAME_2.equals(yangNode.getName())));
+
+ //As we have not registered an application this object should be null.
+ object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+
+ testYangSchemaNodeProvider.unregisterService(SERVICE_NAME_2);
+
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_2);
+ assertThat(true, is(yangNode == null));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_2);
+ assertThat(true, is(yangNode == null));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_2);
+ assertThat(true, is(yangNode == null));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_2);
+ assertThat(true, is(yangNode == null));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(EVENT_NAME_2);
+ assertThat(true, is(yangNode == null));
+
+ //As we have not registered an application this object should be null.
+ object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+
+ //With third service.
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_3);
+ assertThat(true, is(SCHEMA_NAME_3.equals(yangNode.getName())));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_3);
+ assertThat(true, is(SCHEMA_NAME_3.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_3);
+ assertThat(true, is(SCHEMA_NAME_3.equals(yangNode.getName())));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(EVENT_NAME_3);
+ assertThat(true, is(yangNode == null));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_3);
+ assertThat(true, is(SCHEMA_NAME_3.equals(yangNode.getName())));
+
+ //As we have not registered an application this object should be null.
+ object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+
+ testYangSchemaNodeProvider.unregisterService(SERVICE_NAME_3);
+
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_3);
+ assertThat(true, is(yangNode == null));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_3);
+ assertThat(true, is(yangNode == null));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_3);
+ assertThat(true, is(yangNode == null));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_3);
+ assertThat(true, is(yangNode == null));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(EVENT_NAME_3);
+ assertThat(true, is(yangNode == null));
+
+ //As we have not registered an application this object should be null.
+ object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+ }
+
+ /**
+ * Unit test case in which schema node should not be present.
+ *
+ * @throws IOException when fails to do IO operation
+ */
+ @Test
+ public void testForDoNotGetSchemaNode()
+ throws IOException {
+
+ DefaultYangSchemaRegistry registry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+
+ // here all nodes should be null as we have not done any registration
+ // for this application.
+ YangSchemaNode yangNode =
+ registry.getYangSchemaNodeUsingAppName(UN_REG_SERVICE_NAME);
+ assertThat(true, is(yangNode == null));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(UN_REG_SCHEMA_NAME);
+ assertThat(true, is(yangNode == null));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ UN_REG_INTERFACE_NAME);
+ assertThat(true, is(yangNode == null));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ UN_REG_OP_PARAM_NAME);
+ assertThat(true, is(yangNode == null));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(
+ UN_REG_EVENT_NAME);
+ assertThat(true, is(yangNode == null));
+
+ //As we have not registered an application this object should be null.
+ Object object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+ }
+
+ /**
+ * Unit test case in which schema node should be present with multi
+ * revisions.
+ *
+ * @throws IOException when fails to do IO operation
+ */
+ @Test
+ public void testForGetSchemaNodeWhenNoRevision()
+ throws IOException {
+
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry registry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+
+ //Service with rev.
+ YangSchemaNode yangNode =
+ registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_REV_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_REV_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_REV_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(
+ EVENT_NAME_REV_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ //As we have not registered an application this object should be null.
+ Object object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+ testYangSchemaNodeProvider.unregisterService(SERVICE_NAME_REV_15);
+
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_REV_15);
+ assertThat(true, is(yangNode == null));
+
+ //Here the yangNode should be the node which does not have revision.
+ // asset should pass with false.
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(((YangNode) yangNode).getRevision() == null));
+
+ //Service no revision.
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_NO_REV);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_NO_REV);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_NO_REV);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(EVENT_NAME_NO_REV);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ //As we have not registered an application this object should be null.
+ object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+ testYangSchemaNodeProvider.unregisterService(SERVICE_NAME_NO_REV);
+
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_NO_REV);
+ assertThat(true, is(yangNode == null));
+
+ //Here the yangNode should be the node which have different revision.
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(yangNode != null));
+ assertThat(true, is(((YangNode) yangNode).getRevision() != null));
+ }
+
+ /**
+ * Unit test case in which schema node should be present with multi
+ * revisions.
+ *
+ * @throws IOException when fails to do IO operation
+ */
+ @Test
+ public void testForGetSchemaNodeWhenMultiRevision()
+ throws IOException {
+
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ DefaultYangSchemaRegistry registry =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry();
+
+ //Service with rev.
+ YangSchemaNode yangNode =
+ registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_REV_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_REV_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_REV_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(
+ EVENT_NAME_REV_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ //As we have not registered an application this object should be null.
+ Object object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+ testYangSchemaNodeProvider.unregisterService(SERVICE_NAME_REV_15);
+
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_REV_15);
+ assertThat(true, is(yangNode == null));
+
+ //Here the yangNode should be the node which does not have revision.
+ // asset should pass with false.
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(((YangNode) yangNode).getRevision() == null));
+
+ //Service with different revision.
+ yangNode = registry
+ .getYangSchemaNodeUsingAppName(SERVICE_NAME_REV_16);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4_16);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_REV_16);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_REV_16);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(EVENT_NAME_REV_16);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ //As we have not registered an application this object should be null.
+ object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+ testYangSchemaNodeProvider.unregisterService(SERVICE_NAME_REV_16);
+
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_REV_16);
+ assertThat(true, is(yangNode == null));
+
+ //Here the yangNode should be the node which have different revision.
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(((YangNode) yangNode).getRevision() == null));
+
+ //Service with different revision.
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_REV_17);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4_17);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_REV_17);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_REV_17);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(
+ EVENT_NAME_REV_17);
+ assertThat(true, is(yangNode == null));
+
+ //As we have not registered an application this object should be null.
+ object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+ testYangSchemaNodeProvider.unregisterService(SERVICE_NAME_REV_17);
+
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_REV_17);
+ assertThat(true, is(yangNode == null));
+
+ //Here the yangNode should be the node which have different revision.
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(((YangNode) yangNode).getRevision() == null));
+
+ //Service no revision.
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_NO_REV);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_NO_REV);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_NO_REV);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(EVENT_NAME_NO_REV);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ //As we have not registered an application this object should be null.
+ object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+ testYangSchemaNodeProvider.unregisterService(SERVICE_NAME_NO_REV);
+
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_NO_REV);
+ assertThat(true, is(yangNode == null));
+
+ //Here the yangNode should be the node which have different revision.
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(yangNode != null));
+ assertThat(true, is(((YangNode) yangNode).getRevision() != null));
+
+ //Service with different revision.
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_REV_14);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_4_14);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
+ INTERFACE_NAME_REV_14);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
+ OP_PARAM_NAME_REV_14);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getRootYangSchemaNodeForNotification(
+ EVENT_NAME_REV_14);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ //As we have not registered an application this object should be null.
+ object = registry.getRegisteredApplication(yangNode);
+ assertThat(true, is(object == null));
+ testYangSchemaNodeProvider.unregisterService(SERVICE_NAME_REV_14);
+
+ yangNode = registry.getYangSchemaNodeUsingAppName(SERVICE_NAME_REV_14);
+ assertThat(true, is(yangNode == null));
+ }
+
+ /**
+ * Unit test case should generate exceptions.
+ */
+ @Test
+ public void testRegistration() {
+ thrown.expect(RuntimeException.class);
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ testYangSchemaNodeProvider.processRegistrationOfApp();
+ }
+
+ /**
+ * Unit test case should not generate any exceptions and should
+ * return specific revision node.
+ */
+ @Test
+ public void testGetWithSpecificRevision() {
+ testYangSchemaNodeProvider.processSchemaRegistry(null);
+ YangSchemaNode schemaNode = testYangSchemaNodeProvider
+ .getDefaultYangSchemaRegistry()
+ .getYangSchemaNodeUsingSchemaName(SCHEMA_NAME_WITH_DATE);
+
+ assertThat(true, is(schemaNode.getName().equals(SCHEMA_NAME_4)));
+ String date = testYangSchemaNodeProvider
+ .getDefaultYangSchemaRegistry()
+ .getDateInStringFormat(schemaNode);
+ assertThat(true, is(date.equals(DATE)));
+ }
+
+ /**
+ * Unit test case should not generate any exceptions
+ * verify notification should be checked for registration.
+ */
+ @Test
+ public void testNotification() {
+ MockIetfManager manager = new MockIetfManager();
+ testYangSchemaNodeProvider.processSchemaRegistry(manager);
+ boolean isRegWithNotification =
+ testYangSchemaNodeProvider.getDefaultYangSchemaRegistry()
+ .verifyNotificationObject(manager, IetfNetwork1Service.class);
+ assertThat(true, is(isRegWithNotification));
+ isRegWithNotification = testYangSchemaNodeProvider
+ .getDefaultYangSchemaRegistry()
+ .verifyNotificationObject(manager, IetfNetwork2Service.class);
+ assertThat(false, is(isRegWithNotification));
+ //TODO fix with YAB
+// isRegWithNotification = testYangSchemaNodeProvider
+// .getDefaultYangSchemaRegistry()
+// .verifyNotificationObject(new TestManager(), TestService.class);
+// assertThat(false, is(isRegWithNotification));
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ysr/MockIetfManager.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ysr/MockIetfManager.java
new file mode 100644
index 0000000..1126cdf
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ysr/MockIetfManager.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ysr;
+
+import org.onosproject.event.ListenerRegistry;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network2.rev20151208.IetfNetwork2;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network2.rev20151208.IetfNetwork2OpParam;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network2.rev20151208.IetfNetwork2Service;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network2.rev20151208.ietfnetwork2.IetfNetwork2Event;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network2.rev20151208.ietfnetwork2.IetfNetwork2EventListener;
+
+/**
+ * Represent mock implementation for services.
+ */
+public class MockIetfManager
+ extends ListenerRegistry<IetfNetwork2Event, IetfNetwork2EventListener>
+ implements IetfNetwork2Service {
+
+ @Override
+ public IetfNetwork2 getIetfNetwork2(IetfNetwork2OpParam ietfNetwork2) {
+ return null;
+ }
+
+ @Override
+ public void setIetfNetwork2(IetfNetwork2OpParam ietfNetwork2) {
+
+ }
+
+}
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ysr/TestYangSchemaNodeProvider.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ysr/TestYangSchemaNodeProvider.java
new file mode 100644
index 0000000..ef91d85
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ysr/TestYangSchemaNodeProvider.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yms.app.ysr;
+
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network1.rev20151208.IetfNetwork1Service;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangSchemaNode;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.deSerializeDataModel;
+import static org.onosproject.yangutils.utils.UtilConstants.TEMP;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
+
+/**
+ * Represents mock bundle context. provides bundle context for YSR to do unit
+ * testing.
+ */
+public class TestYangSchemaNodeProvider {
+
+ private static final String FS = File.separator;
+ private static final String PATH = System.getProperty("user.dir") +
+ FS + "target" + FS + "classes" + FS;
+ private static final String SER_FILE_PATH = "yang" + FS + "resources" +
+ FS + "YangMetaData.ser";
+ private static final String TEMP_FOLDER_PATH = PATH + TEMP;
+ private final DefaultYangSchemaRegistry registry =
+ new DefaultYangSchemaRegistry();
+ private static final String RESOURCE = "src/test/resources";
+ private List<YangNode> nodes = new ArrayList<>();
+
+ /**
+ * Creates an instance of mock bundle context.
+ */
+ public TestYangSchemaNodeProvider() {
+ }
+
+ /**
+ * Process YANG schema node for a application.
+ *
+ * @param appObject application object
+ */
+ public void processSchemaRegistry(Object appObject) {
+ try {
+ Set<YangNode> appNode = deSerializeDataModel(PATH + SER_FILE_PATH);
+ nodes.addAll(appNode);
+ String appName;
+ ClassLoader classLoader = TestYangSchemaNodeProvider.class.getClassLoader();
+ for (YangSchemaNode node : nodes) {
+ appName = registry.getServiceName(node);
+ Class<?> cls;
+ try {
+ cls = classLoader.loadClass(appName);
+ } catch (ClassNotFoundException e) {
+ continue;
+ }
+ registry.processRegistration(cls, RESOURCE, nodes, appObject, true);
+ registry.updateServiceClass(cls);
+ //interface generation.
+ appName = registry.getInterfaceClassName(node);
+ try {
+ cls = classLoader.loadClass(appName);
+ } catch (ClassNotFoundException e) {
+ continue;
+ }
+ registry.processRegistration(cls, RESOURCE,
+ nodes, appObject, true);
+ registry.updateServiceClass(cls);
+ }
+ deleteDirectory(TEMP_FOLDER_PATH);
+ } catch (IOException e) {
+ }
+ }
+
+ /**
+ * Unregisters services.
+ *
+ * @param appName application name
+ */
+ void unregisterService(String appName) {
+ ClassLoader classLoader = TestYangSchemaNodeProvider.class.getClassLoader();
+ try {
+ Class<?> cls = classLoader.loadClass(appName);
+ registry.unRegisterApplication(null, cls);
+ } catch (ClassNotFoundException e) {
+ }
+
+ }
+
+ /**
+ * Returns schema registry.
+ *
+ * @return schema registry
+ */
+ public DefaultYangSchemaRegistry getDefaultYangSchemaRegistry() {
+ return registry;
+ }
+
+ /**
+ * Process registration of a service.
+ */
+ void processRegistrationOfApp() {
+ getDefaultYangSchemaRegistry().doPreProcessing(IetfNetwork1Service.class,
+ new MockIetfManager());
+ }
+
+}
diff --git a/apps/yms/ut/src/test/resources/YobTestYangFiles/ip-topology.yang b/apps/yms/ut/src/test/resources/YobTestYangFiles/ip-topology.yang
new file mode 100644
index 0000000..ca117b7
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/YobTestYangFiles/ip-topology.yang
@@ -0,0 +1,29 @@
+
+module yms-ip-topology {
+ yang-version 1;
+ namespace urn:ip:topo;
+ prefix ip-topo;
+ import yms-topology {
+ prefix topo;
+ revision-date "2014-01-01";
+ }
+ revision 2014-01-01 {
+ description "desc";
+ reference "ref";
+ }
+
+ augment /topo:node{
+ leaf router-id {
+ type string;
+ }
+ leaf router-ip {
+ type string;
+ }
+ }
+
+ augment /topo:node/topo:termination-points/topo:termination-point {
+ leaf ip-address {
+ type string;
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/YobTestYangFiles/topology.yang b/apps/yms/ut/src/test/resources/YobTestYangFiles/topology.yang
new file mode 100644
index 0000000..62c0279
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/YobTestYangFiles/topology.yang
@@ -0,0 +1,74 @@
+
+module yms-topology {
+ yang-version 1;
+ namespace urn:topo;
+ prefix topo;
+ revision 2014-01-01 {
+ description "desc";
+ reference "ref";
+ }
+ list node {
+ key "node-id";
+ leaf node-id{
+ type string;
+ }
+ leaf-list node-prop{
+ type string;
+ }
+ container termination-points{
+ leaf number-of-tp {
+ type int16;
+ }
+ list termination-point {
+ key "tp-id";
+ leaf tp-id {
+ type string;
+ }
+ }
+ }
+ choice choice1{
+ case case1a{
+ leaf leaf1a1{
+ type string;
+ }
+ leaf leaf1a2{
+ type string;
+ }
+ }
+ case case1b{
+ choice choice1b{
+ case case1bi{
+ leaf leaf1bia{
+ type string;
+ }
+ leaf leaf1bib{
+ type string;
+ }
+ }
+ case case1bii{
+ leaf leaf1biia{
+ type string;
+ }
+ leaf leaf1biib{
+ type string;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ rpc set-node-limit {
+ input {
+ leaf node-limit {
+ type int16;
+ }
+ }
+ }
+
+ notification node-limit-reached {
+ leaf node-limit {
+ type int16;
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/yabTestYangFiles/test.yang b/apps/yms/ut/src/test/resources/yabTestYangFiles/test.yang
new file mode 100644
index 0000000..e37bed6
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/yabTestYangFiles/test.yang
@@ -0,0 +1,111 @@
+module test {
+
+ yang-version 1;
+ namespace "ydt.test";
+ prefix "t6";
+ organization "ON-LAB";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ container cont1 {
+ container cont2 {
+ container cont3 {
+ leaf leaf1 {
+ type string;
+ }
+ }
+ }
+ list list1 {
+ key leaf2;
+ leaf leaf2 {
+ type string;
+ }
+ leaf leaf3 {
+ type string;
+ }
+ }
+ leaf leaf4 {
+ type string;
+ }
+ }
+ list list2 {
+ key "leaf5 leaf6";
+ leaf leaf5 {
+ type string;
+ }
+ leaf leaf6 {
+ type string;
+ }
+ leaf leaf7 {
+ type string;
+ }
+ leaf-list leaflist8 {
+ type string;
+ }
+ container cont7 {
+ leaf leaf12 {
+ type string;
+ }
+ }
+ }
+ container cont4 {
+ container cont5 {
+ leaf leaf9 {
+ type string;
+ }
+ }
+ }
+ leaf leaf10 {
+ type string;
+ }
+
+ rpc rock-the-house {
+ input {
+ leaf zip-code {
+ type string;
+ }
+ }
+ output {
+ leaf hello {
+ type string;
+ }
+ }
+ }
+
+ rpc rock-the-house1 {
+ input {
+ leaf leaf13 {
+ type string;
+ }
+ }
+ }
+
+ rpc rock-the-house2 {
+ output {
+ leaf leaf14 {
+ type string;
+ }
+ }
+ }
+
+ rpc rock-the-house3 {
+ }
+
+ augment "/cont4" {
+ container cont6 {
+ leaf leaf11 {
+ type string;
+ }
+ }
+ }
+
+ augment "/cont4/cont6" {
+ container cont7 {
+ leaf leaf12 {
+ type string;
+ }
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ychTestResourceFiles/Combined.yang b/apps/yms/ut/src/test/resources/ychTestResourceFiles/Combined.yang
new file mode 100644
index 0000000..a9c2f48
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ychTestResourceFiles/Combined.yang
@@ -0,0 +1,114 @@
+module Combined {
+
+ yang-version 1;
+ namespace "ych:combined";
+ prefix "combined";
+
+ organization "Huawei India Pvt. Ltd.";
+
+ description "This module defines for purchasing-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ typedef protocol-version {
+ type uint8 {
+ range 1..7;
+ }
+ }
+
+ typedef path-id {
+ type uint32;
+ default 0;
+ description
+ "Identifier of a single path. The identifier does not
+ carry any semantic meaning beyond uniquely identifying
+ a path.";
+ }
+
+ typedef as-num {
+ type uint32;
+ default 0;
+ description
+ "Identifier of a single path. The identifier does not
+ carry any semantic meaning beyond uniquely identifying
+ a path.";
+ }
+
+ typedef metric {
+ type uint32;
+ default 0;
+ description
+ "Identifier of a single path. The identifier does not
+ carry any semantic meaning beyond uniquely identifying
+ a path.";
+ }
+
+ container attributes {
+ container origin {
+ reference "http://tools.ietf.org/html/rfc4271#section-5.1.1";
+ leaf value {
+ type path-id;
+ mandatory true;
+ }
+ }
+ container multi-exit-disc {
+ reference "http://tools.ietf.org/html/rfc4271#section-5.1.4";
+ leaf med {
+ type uint32;
+ }
+ }
+ container local-pref {
+ reference "http://tools.ietf.org/html/rfc4271#section-5.1.5";
+ leaf pref {
+ type uint32;
+ }
+ }
+ container aigp {
+ container aigp-tlv {
+ leaf metric {
+ type metric;
+ }
+ }
+ }
+
+ list unrecognized-attributes {
+ key type;
+ leaf partial {
+ type boolean;
+ mandatory true;
+ }
+ leaf transitive {
+ type boolean;
+ mandatory true;
+ }
+ leaf type {
+ type uint8;
+ mandatory true;
+ }
+ leaf value {
+ type binary {
+ length 0..65535;
+ }
+ mandatory true;
+ }
+ }
+
+ list bgp-parameters {
+ config false;
+ list optional-capabilities {
+ config false;
+ reference "http://tools.ietf.org/html/rfc5492#section-4";
+ container c-parameters {
+ container as4-bytes-capability {
+ reference "http://tools.ietf.org/html/rfc6793";
+ leaf as-number {
+ type as-num;
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ychTestResourceFiles/EmptyContainer.yang b/apps/yms/ut/src/test/resources/ychTestResourceFiles/EmptyContainer.yang
new file mode 100644
index 0000000..92106e9
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ychTestResourceFiles/EmptyContainer.yang
@@ -0,0 +1,19 @@
+module EmptyContainer {
+
+ yang-version 1;
+
+ namespace "ych.Empty.Container";
+
+ prefix "purchasing";
+
+ organization "ON-LAB";
+
+ description "This module defines for purchasing-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ container EmptyContainer {
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ychTestResourceFiles/combinedrootname.xml b/apps/yms/ut/src/test/resources/ychTestResourceFiles/combinedrootname.xml
new file mode 100644
index 0000000..1997f3d
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ychTestResourceFiles/combinedrootname.xml
@@ -0,0 +1,98 @@
+<rpc message-id="101"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <edit-config>
+ <target>
+ <running/>
+ </target>
+ <filter xmlns="ydt.filter-type" type="subtree">
+ <Combined xmlns="ych:combined">
+ <attributes>
+ <origin>
+ <value>123</value>
+ </origin>
+ <multi-exit-disc>
+ <med>456</med>
+ </multi-exit-disc>
+ <local-pref>
+ <pref>23</pref>
+ </local-pref>
+ <aigp>
+ <aigp-tlv>
+ <metric>456</metric>
+ </aigp-tlv>
+ </aigp>
+ <unrecognized-attributes>
+ <partial>false</partial>
+ <transitive>false</transitive>
+ <type>1</type>
+ <value>QUJD</value>
+ </unrecognized-attributes>
+ <unrecognized-attributes>
+ <partial>true</partial>
+ <transitive>true</transitive>
+ <type>2</type>
+ <value>QUJD</value>
+ </unrecognized-attributes>
+ <unrecognized-attributes>
+ <partial>true</partial>
+ <transitive>false</transitive>
+ <type>3</type>
+ <value>QUJD</value>
+ </unrecognized-attributes>
+ <unrecognized-attributes>
+ <partial>false</partial>
+ <transitive>true</transitive>
+ <type>4</type>
+ <value>QUJD</value>
+ </unrecognized-attributes>
+ <bgp-parameters>
+ <optional-capabilities>
+ <c-parameters>
+ <as4-bytes-capability>
+ <as-number>11</as-number>
+ </as4-bytes-capability>
+ </c-parameters>
+ </optional-capabilities>
+ <optional-capabilities>
+ <c-parameters>
+ <as4-bytes-capability>
+ <as-number>22</as-number>
+ </as4-bytes-capability>
+ </c-parameters>
+ </optional-capabilities>
+ <optional-capabilities>
+ <c-parameters>
+ <as4-bytes-capability>
+ <as-number>33</as-number>
+ </as4-bytes-capability>
+ </c-parameters>
+ </optional-capabilities>
+ </bgp-parameters>
+ <bgp-parameters>
+ <optional-capabilities>
+ <c-parameters>
+ <as4-bytes-capability>
+ <as-number>33</as-number>
+ </as4-bytes-capability>
+ </c-parameters>
+ </optional-capabilities>
+ <optional-capabilities>
+ <c-parameters>
+ <as4-bytes-capability>
+ <as-number>33</as-number>
+ </as4-bytes-capability>
+ </c-parameters>
+ </optional-capabilities>
+ <optional-capabilities>
+ <c-parameters>
+ <as4-bytes-capability>
+ <as-number>33</as-number>
+ </as4-bytes-capability>
+ </c-parameters>
+ </optional-capabilities>
+ </bgp-parameters>
+ </attributes>
+ </Combined>
+ </filter>
+ </edit-config>
+</rpc>
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ychTestResourceFiles/configrootname.xml b/apps/yms/ut/src/test/resources/ychTestResourceFiles/configrootname.xml
new file mode 100644
index 0000000..c8509f1
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ychTestResourceFiles/configrootname.xml
@@ -0,0 +1,20 @@
+<rpc message-id="101"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <edit-config>
+ <target>
+ <running/>
+ </target>
+ <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <Logistics-manager xmlns="ydt.root">
+ <Customs-supervisor>abc</Customs-supervisor>
+ <Purchasing-supervisor xmlns="ydt.root">
+ <purchasing-specialist>bcd</purchasing-specialist>
+ <support>cde</support>
+ </Purchasing-supervisor>
+ </Logistics-manager>
+ <merchandisersupervisor xmlns="ydt.Merchandiser-supervisor">
+ <supervisor>abc</supervisor>
+ </merchandisersupervisor>
+ </config>
+ </edit-config>
+</rpc>
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ychTestResourceFiles/configrootnameOperationType.xml b/apps/yms/ut/src/test/resources/ychTestResourceFiles/configrootnameOperationType.xml
new file mode 100644
index 0000000..6cecea49
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ychTestResourceFiles/configrootnameOperationType.xml
@@ -0,0 +1,20 @@
+<rpc message-id="101"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <edit-config>
+ <target>
+ <running/>
+ </target>
+ <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <Logistics-manager xmlns="ydt.root">
+ <Customs-supervisor>abc</Customs-supervisor>
+ <Purchasing-supervisor xmlns="ydt.root" operation="delete">
+ <purchasing-specialist>bcd</purchasing-specialist>
+ <support>cde</support>
+ </Purchasing-supervisor>
+ </Logistics-manager>
+ <merchandisersupervisor xmlns="ydt.Merchandiser-supervisor">
+ <supervisor>abc</supervisor>
+ </merchandisersupervisor>
+ </config>
+ </edit-config>
+</rpc>
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ychTestResourceFiles/getReply.xml b/apps/yms/ut/src/test/resources/ychTestResourceFiles/getReply.xml
new file mode 100644
index 0000000..b6d11fe
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ychTestResourceFiles/getReply.xml
@@ -0,0 +1,11 @@
+<rpc-reply message-id="101"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
+ xmlns:ex="http://example.net/content/1.0">
+ <data>
+ <Logistics-manager xmlns="ydt.root">
+ <Purchasing-supervisor xmlns="ydt.root">
+ <purchasing-specialist>bcd</purchasing-specialist>
+ </Purchasing-supervisor>
+ </Logistics-manager>
+ </data>
+</rpc-reply>
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ychTestResourceFiles/getconfigReply.xml b/apps/yms/ut/src/test/resources/ychTestResourceFiles/getconfigReply.xml
new file mode 100644
index 0000000..e27beab
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ychTestResourceFiles/getconfigReply.xml
@@ -0,0 +1,8 @@
+<rpc message-id="101"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <data>
+ <merchandisersupervisor xmlns="ydt.Merchandiser-supervisor">
+ <supervisor>abc</supervisor>
+ </merchandisersupervisor>
+ </data>
+</rpc>
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ychTestResourceFiles/getconfigemptycontainer.xml b/apps/yms/ut/src/test/resources/ychTestResourceFiles/getconfigemptycontainer.xml
new file mode 100644
index 0000000..adc7902
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ychTestResourceFiles/getconfigemptycontainer.xml
@@ -0,0 +1,11 @@
+<rpc message-id="101"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <get-config>
+ <source>
+ <running/>
+ </source>
+ <filter xmlns="ydt.filter-type" type="subtree">
+ <EmptyContainer xmlns="ych.Empty.Container"/>
+ </filter>
+ </get-config>
+</rpc>
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ychTestResourceFiles/getconfigrootname.xml b/apps/yms/ut/src/test/resources/ychTestResourceFiles/getconfigrootname.xml
new file mode 100644
index 0000000..df69691
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ychTestResourceFiles/getconfigrootname.xml
@@ -0,0 +1,13 @@
+<rpc message-id="101"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <get-config>
+ <source>
+ <running/>
+ </source>
+ <filter type="subtree">
+ <merchandisersupervisor xmlns="ydt.Merchandiser-supervisor">
+ <supervisor>abc</supervisor>
+ </merchandisersupervisor>
+ </filter>
+ </get-config>
+</rpc>
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ychTestResourceFiles/getrootname.xml b/apps/yms/ut/src/test/resources/ychTestResourceFiles/getrootname.xml
new file mode 100644
index 0000000..9773893
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ychTestResourceFiles/getrootname.xml
@@ -0,0 +1,12 @@
+<rpc message-id="101"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <get>
+ <filter type="subtree">
+ <Logistics-manager xmlns="ydt.root">
+ <Purchasing-supervisor xmlns="ydt.root">
+ <purchasing-specialist>bcd</purchasing-specialist>
+ </Purchasing-supervisor>
+ </Logistics-manager>
+ </filter>
+ </get>
+</rpc>
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ychTestResourceFiles/purchasingsupervisor.yang b/apps/yms/ut/src/test/resources/ychTestResourceFiles/purchasingsupervisor.yang
new file mode 100644
index 0000000..507c64e
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ychTestResourceFiles/purchasingsupervisor.yang
@@ -0,0 +1,28 @@
+module ych-purchasingsupervisor {
+
+ yang-version 1;
+
+ namespace "ych.purchasing-supervisor";
+
+ prefix "purchasing";
+
+ organization "ON-LAB";
+
+ description "This module defines for purchasing-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ container ych-purchasing-supervisor {
+ leaf ych-purchasing-specialist {
+ type string;
+ description "name of the purchasing-specialist person";
+ }
+
+ leaf ych-purchasing-support {
+ type string;
+ description "name of the support person";
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/EmptyLeafList.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/EmptyLeafList.yang
new file mode 100644
index 0000000..b6174c7
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/EmptyLeafList.yang
@@ -0,0 +1,51 @@
+module EmptyLeafList {
+
+ yang-version 1;
+
+ namespace "ydt.Empty.leafList";
+
+ prefix "emptyleaflist";
+
+ organization "ON-LAB";
+
+ description "This module defines for empty leaf list.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ typedef type-def {
+ type leafref {
+ path /l1;
+ }
+ }
+
+ leaf l1 {
+ type empty;
+ }
+
+ leaf l2 {
+ type leafref {
+ path /l1;
+ }
+ }
+
+ leaf l3 {
+ type type-def;
+ }
+
+ leaf-list list1 {
+ type empty;
+ }
+
+ leaf-list list2 {
+ type leafref {
+ path /l1;
+ }
+ }
+
+ leaf-list list3 {
+ type type-def;
+ }
+
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/Hello_ONOS.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/Hello_ONOS.yang
new file mode 100644
index 0000000..d5eafbe
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/Hello_ONOS.yang
@@ -0,0 +1,57 @@
+module Hello_ONOS {
+ yang-version 1;
+ namespace "ydt:hello_onos";
+ prefix "hello";
+
+ revision "2016-09-03" {
+ description "Initial revision of hello model";
+ }
+
+ grouping greeting {
+ leaf name {
+ type string;
+ }
+
+ leaf surName {
+ type string;
+ }
+ }
+
+ rpc hello-world {
+ input {
+
+ // uses greeting;
+
+ leaf name {
+ type string;
+ }
+
+ leaf surName {
+ type string;
+ }
+
+ leaf inputDefault {
+ type string;
+ }
+
+ list stringList {
+ key "string1 string2";
+ unique "string3";
+ leaf string1 {
+ type string;
+ }
+ leaf string2 {
+ type string;
+ }
+ leaf string3 {
+ type string;
+ }
+ }
+ }
+ output {
+ leaf greetingOut {
+ type string;
+ }
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/Logistics-manager.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/Logistics-manager.yang
new file mode 100644
index 0000000..3cd4321
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/Logistics-manager.yang
@@ -0,0 +1,66 @@
+module Logistics-manager {
+
+ yang-version 1;
+
+ namespace "ydt.root";
+
+ prefix "root";
+
+ organization "ON-LAB";
+
+ description "This module defines for organisation.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ leaf Customs-supervisor {
+ type string;
+ description "name of the customs-supervisor.";
+ }
+
+ leaf Merchandiser-supervisor {
+ type string;
+ description "name of merchandiser-supervisor";
+ }
+
+ list Material-supervisor {
+ key "name";
+ leaf name {
+ type string;
+ description "name of logistics-supervisor";
+ }
+
+ leaf departmentId {
+ type string;
+ description "name of department";
+ }
+ }
+
+ container Purchasing-supervisor {
+ leaf purchasing-specialist {
+ type string;
+ description "name of the purchasing-specialist person";
+ }
+
+ leaf support {
+ type string;
+ description "name of the support person";
+ }
+ }
+
+ leaf-list Warehouse-supervisor {
+ type string;
+ description "name of the warehouse-supervisor's";
+ }
+
+ leaf trading-supervisor {
+ type string;
+ description "name of the trading-supervisor";
+ }
+
+ leaf-list employee-id {
+ type string;
+ description "list of the employee id";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology1.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology1.yang
new file mode 100644
index 0000000..fc0eee5
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology1.yang
@@ -0,0 +1,66 @@
+module augment-topology1 {
+
+ yang-version 1;
+
+ namespace "ydt.augment-topology1";
+
+ prefix "aug1";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ import yms-network-topology {
+ prefix topo;
+ }
+
+ import augmentNetwork {
+ prefix aug;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augment-topology1 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network/topo:link" {
+ description
+ "Add augment1 to the link model.";
+ list augment1 {
+ key "value1";
+ leaf value1 {
+ type int8;
+ }
+ }
+ }
+
+ augment "/nd:networks/nd:network/nd:node/topo:t-point" +
+ "/supporting-termination-point" {
+ description
+ "Add augment1 to the termination-point model.";
+ container augment1 {
+ leaf value1 {
+ type int8;
+ }
+ }
+
+ leaf augment1-leaf {
+ type string;
+ }
+
+ }
+
+ augment "/aug:node/aug:cont1s/aug:cont1s" {
+ description
+ "Add augment1 to the link model.";
+ list augment1 {
+ key "value1";
+ leaf value1 {
+ type int8;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology2.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology2.yang
new file mode 100644
index 0000000..82a19d7
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology2.yang
@@ -0,0 +1,63 @@
+module augment-topology2 {
+
+ yang-version 1;
+
+ namespace "ydt.augment-topology2";
+
+ prefix "aug2";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ import yms-network-topology {
+ prefix topo;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augment-topology2 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network/topo:link" {
+ description
+ "Add augment2 to the link model.";
+ list augment2 {
+ key "key1 key2";
+ leaf key1 {
+ type int8;
+ }
+ leaf key2 {
+ type int8;
+ }
+ }
+
+ leaf-list augment2leafList {
+ type string;
+ }
+ }
+
+ augment "/nd:networks/nd:network/nd:node/topo:t-point/" +
+ "supporting-termination-point" {
+ description
+ "Add augment2 to the supporting-termination-point model.";
+ container augment2 {
+ config false;
+ leaf value2 {
+ type int8;
+ }
+ }
+
+ leaf-list augment2leafList {
+ type string;
+ }
+
+ leaf augment2leaf {
+ type string;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology3.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology3.yang
new file mode 100644
index 0000000..d2c58ce
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology3.yang
@@ -0,0 +1,59 @@
+module augment-topology3 {
+
+ yang-version 1;
+
+ namespace "ydt.augment-topology3";
+
+ prefix "aug3";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ import augment-topology1 {
+ prefix aug1;
+ }
+
+ import augment-topology2 {
+ prefix aug2;
+ }
+
+ import yms-network-topology {
+ prefix topo;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augment-topology3 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2" {
+ description
+ "Add augment3 to the augment2 model.";
+ container augment3 {
+ config false;
+ leaf value3 {
+ type int8;
+ }
+ }
+
+ leaf augment3leaf {
+ type string;
+ }
+ }
+
+ augment "/nd:networks/nd:network/nd:node/topo:t-point/" +
+ "supporting-termination-point/aug2:augment2" {
+ description
+ "Add augment3 to the augment2 model.";
+ container augment3 {
+ config false;
+ leaf value3 {
+ type int8;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology4.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology4.yang
new file mode 100644
index 0000000..b8cea93
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology4.yang
@@ -0,0 +1,58 @@
+module augment-topology4 {
+
+ yang-version 1;
+
+ namespace "ydt.augment-topology4";
+
+ prefix "aug4";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ import augment-topology1 {
+ prefix aug1;
+ }
+
+ import augment-topology2 {
+ prefix aug2;
+ }
+
+ import augment-topology3 {
+ prefix aug3;
+ }
+
+ import yms-network-topology {
+ prefix topo;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augment-topology4 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2/aug3:augment3" {
+ description
+ "Add augment4 to the augment3 model.";
+ container augment4 {
+ config false;
+ leaf value4 {
+ type int8;
+ }
+ }
+ }
+
+ augment "/nd:networks/nd:network/nd:node/topo:t-point/" +
+ "supporting-termination-point/aug2:augment2" {
+ description
+ "Add augment4leaf to the augment2 model.";
+
+ leaf augment4leaf{
+ type string;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology5.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology5.yang
new file mode 100644
index 0000000..a13a688
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology5.yang
@@ -0,0 +1,66 @@
+module augment-topology5 {
+
+ yang-version 1;
+
+ namespace "ydt.augment-topology5";
+
+ prefix "aug5";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ import augment-topology1 {
+ prefix aug1;
+ }
+
+ import augment-topology2 {
+ prefix aug2;
+ }
+
+ import augment-topology3 {
+ prefix aug3;
+ }
+
+ import augment-topology4 {
+ prefix aug4;
+ }
+
+ import yms-network-topology {
+ prefix topo;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augment-topology5 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2" {
+ description
+ "Add container to the augment2 model.";
+ container augment5 {
+ config false;
+ leaf value5 {
+ type int8;
+ }
+ }
+
+ leaf-list augment5leafList {
+ type string;
+ }
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2/aug3:augment3" {
+ description
+ "Add augment5 to the augment3 model.";
+ container augment5 {
+ config false;
+ leaf value5 {
+ type int8;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology6.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology6.yang
new file mode 100644
index 0000000..15bd3d5
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment-topology6.yang
@@ -0,0 +1,73 @@
+module augment-topology6 {
+
+ yang-version 1;
+
+ namespace "ydt.augment-topology6";
+
+ prefix "aug5";
+
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ import augment-topology1 {
+ prefix aug1;
+ }
+
+ import augment-topology2 {
+ prefix aug2;
+ }
+
+ import augment-topology3 {
+ prefix aug3;
+ }
+
+ import augment-topology4 {
+ prefix aug4;
+ }
+
+ import augment-topology5 {
+ prefix aug5;
+ }
+
+ import yms-network-topology {
+ prefix topo;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augment-topology6 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2/aug3:augment3" {
+ description
+ "Add augment6 to the augment3 model.";
+ container augment6 {
+ config true;
+ leaf value6 {
+ type int8;
+ }
+ }
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2/aug3:augment3/" +
+ "aug5:augment5" {
+ description
+ "Add leaf6 to the augment5 model.";
+ leaf leaf6 {
+ type string;
+ }
+
+ }
+
+ augment "/nd:networks/nd:network/topo:link/aug2:augment2/aug5:augment5" {
+ description
+ "Add list to the augment5 model.";
+ leaf-list augment6leafList {
+ type string;
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment2.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment2.yang
new file mode 100644
index 0000000..70d45c4
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augment2.yang
@@ -0,0 +1,32 @@
+module augment2 {
+
+ yang-version 1;
+
+ namespace "ydt.augment2";
+
+ prefix "aug";
+
+ organization "ON-LAB";
+
+ description "This module defines for augmentNetwork classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ container aug {
+ container aug {
+ leaf aug {
+ type string;
+ }
+ }
+ }
+
+ augment "/aug:" {
+ description
+ "Add container to the augment2 model.";
+ leaf aug1 {
+ type string;
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/augmentNetwork.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augmentNetwork.yang
new file mode 100644
index 0000000..a769a5e
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augmentNetwork.yang
@@ -0,0 +1,36 @@
+module augmentNetwork {
+
+ yang-version 1;
+
+ namespace "ydt.augmentNetwork";
+
+ prefix "aug";
+
+ organization "ON-LAB";
+
+ description "This module defines for augmentNetwork classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list node {
+ key "name";
+ leaf name {
+ type string;
+ description "name of node";
+ }
+ }
+
+ augment "/node" {
+ description
+ "Add container to the node model.";
+ container cont1s {
+ container cont1s {
+ leaf fine {
+ type string;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/augmentSequence.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augmentSequence.yang
new file mode 100644
index 0000000..aba3c17
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augmentSequence.yang
@@ -0,0 +1,23 @@
+module augmentSequence {
+
+ yang-version 1;
+
+ namespace "ydt.augmentSequence";
+
+ prefix "aug";
+
+ organization "ON-LAB";
+
+ description "This module defines for augmentSequence classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list l1 {
+ key leaf1;
+ leaf leaf1 {
+ type int8;
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/augmentSequence1.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augmentSequence1.yang
new file mode 100644
index 0000000..adaf43f
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augmentSequence1.yang
@@ -0,0 +1,28 @@
+module augmentSequence1 {
+
+ yang-version 1;
+
+ namespace "ydt.augmentSequence1";
+
+ prefix "sequence1";
+
+ import augmentSequence {
+ prefix aug;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augmentSequence1 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/aug:l1" {
+ container c1 {
+ leaf leaf2 {
+ type int8;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/augmentSequence2.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augmentSequence2.yang
new file mode 100644
index 0000000..f32d508
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/augmentSequence2.yang
@@ -0,0 +1,28 @@
+module augmentSequence2 {
+
+ yang-version 1;
+
+ namespace "ydt.augmentSequence2";
+
+ prefix "sequence2";
+
+ import augmentSequence {
+ prefix aug;
+ }
+
+ organization "ON-LAB";
+
+ description "This module defines for augmentSequence2 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ augment "/aug:l1" {
+ container c2 {
+ leaf leaf2 {
+ type int8;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/binarytest.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/binarytest.yang
new file mode 100644
index 0000000..71ada48
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/binarytest.yang
@@ -0,0 +1,33 @@
+module binarytest {
+
+ yang-version 1;
+
+ namespace "ydt.binarytest";
+
+ prefix "binarytest";
+
+ organization "ON-LAB";
+
+ description "This module defines for binarytest classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list binaryList {
+ config false;
+ leaf binary {
+ type binary;
+ }
+ leaf binaryWithRange {
+ type binary {
+ length "2 .. 10";
+ }
+ }
+ leaf binaryWithMultiRange {
+ type binary {
+ length "min..10 | 20 | 30..max";
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/bit.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/bit.yang
new file mode 100644
index 0000000..6d97ccc
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/bit.yang
@@ -0,0 +1,51 @@
+module bit {
+
+ yang-version 1;
+
+ namespace "ydt.bit";
+
+ prefix "bit";
+
+ organization "ON-LAB";
+
+ description "This module defines for bit classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+/*
+ leaf mybits {
+ type bits {
+ bit disable-nagle {
+ position 0;
+ }
+ bit auto-sense-speed {
+ position 1;
+ }
+ bit 10-Mb-only {
+ position 2;
+ }
+ }
+ default "auto-sense-speed";
+ }
+ */
+
+ list bitList {
+ config false;
+ leaf bit {
+ type bits {
+ bit disable-nagle {
+ position 0;
+ }
+ bit auto-sense-speed {
+ position 1;
+ }
+ bit ten-Mb-only {
+ position 2;
+ }
+ }
+ default "auto-sense-speed";
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/bool.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/bool.yang
new file mode 100644
index 0000000..1bb6181
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/bool.yang
@@ -0,0 +1,23 @@
+module bool {
+
+ yang-version 1;
+
+ namespace "ydt.boolean";
+
+ prefix "bool";
+
+ organization "ON-LAB";
+
+ description "This module defines for bool classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list booleanList {
+ key boolean;
+ leaf boolean {
+ type boolean;
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/crypto-base.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/crypto-base.yang
new file mode 100644
index 0000000..602b911
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/crypto-base.yang
@@ -0,0 +1,76 @@
+module crypto-base {
+
+ yang-version 1;
+
+ namespace "ydt.crypto-base";
+
+ prefix "crypto";
+
+ organization "ON-LAB";
+
+ description "This module defines for crypto-base classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ identity crypto-alg {
+ description
+ "Base identity from which all crypto algorithms
+ are derived.";
+ }
+
+ identity crypto-alg2 {
+ base crypto-alg;
+ }
+
+ identity crypto-alg3 {
+ base crypto-alg2;
+ }
+
+ leaf crypto {
+ type identityref {
+ base "crypto-alg";
+ }
+ }
+
+ typedef abc {
+ type identityref {
+ base "crypto-alg";
+ }
+ }
+
+ leaf-list abc-type {
+ type abc;
+ }
+
+ leaf abc-zeunion {
+ type union {
+ type identityref {
+ base "crypto-alg";
+ }
+ type abc;
+ }
+ }
+
+ leaf level2 {
+ type identityref {
+ base "crypto-alg2";
+ }
+ }
+
+ leaf level3 {
+ type identityref {
+ base "crypto-alg3";
+ }
+ }
+
+ leaf level4 {
+ type union {
+ type identityref {
+ base "crypto-alg3";
+ }
+ type abc;
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/customssupervisor.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/customssupervisor.yang
new file mode 100644
index 0000000..73aa806
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/customssupervisor.yang
@@ -0,0 +1,21 @@
+module customssupervisor {
+
+ yang-version 1;
+
+ namespace "ydt.customs-supervisor";
+
+ prefix "customs";
+
+ organization "ON-LAB";
+
+ description "This module defines for customs-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ leaf supervisor {
+ type string;
+ description "name of the customs-supervisor.";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/decimal64.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/decimal64.yang
new file mode 100644
index 0000000..746c23e3
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/decimal64.yang
@@ -0,0 +1,95 @@
+module decimal64 {
+
+ yang-version 1;
+
+ namespace "ydt.decimal64";
+
+ prefix "decimal64";
+
+ organization "ON-LAB";
+
+ description "This module defines for decimal64 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+ leaf negInt {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+
+ leaf posInt {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+
+ leaf negIntWithMinFraction {
+ type decimal64 {
+ fraction-digits 1;
+ }
+ }
+
+ leaf posIntWithMinFraction {
+ type decimal64 {
+ fraction-digits 1;
+ }
+
+ }
+ leaf negIntWithMaxFraction {
+ type decimal64 {
+ fraction-digits 18;
+ }
+ }
+
+ leaf posIntWithMaxFraction {
+ type decimal64 {
+ fraction-digits 18;
+ }
+
+ }
+
+ leaf midIntWithRange {
+ type decimal64 {
+ fraction-digits 2;
+ range "10 .. 100";
+ }
+ }
+
+ leaf minIntWithRange {
+ type decimal64 {
+ fraction-digits 2;
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxIntWithRange {
+ type decimal64 {
+ fraction-digits 2;
+ range "10 .. 100";
+ }
+ }
+
+ list multiRangeValidation {
+ config false;
+ leaf decimal {
+ type decimal64 {
+ fraction-digits 2;
+ range "10..40 | 50..100";
+ }
+ }
+ leaf revDecimal {
+ type decimal64 {
+ fraction-digits 2;
+ range "min .. 3.14 | 10 | 20..max";
+ }
+ }
+ }
+
+ leaf l1 {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/employeeid.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/employeeid.yang
new file mode 100644
index 0000000..be27c70
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/employeeid.yang
@@ -0,0 +1,21 @@
+module employeeid {
+
+ yang-version 1;
+
+ namespace "ydt.employee-id";
+
+ prefix "id";
+
+ organization "ON-LAB";
+
+ description "This module defines for employee-id.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ leaf-list employeeid {
+ type string;
+ description "list of the employee id";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/emptydata.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/emptydata.yang
new file mode 100644
index 0000000..33f58b3
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/emptydata.yang
@@ -0,0 +1,23 @@
+module emptydata {
+
+ yang-version 1;
+
+ namespace "ydt.emptydata";
+
+ prefix "emptydata";
+
+ organization "ON-LAB";
+
+ description "This module defines for emptydata classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list emptyList {
+ config false;
+ leaf empty {
+ type empty;
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/enumtest.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/enumtest.yang
new file mode 100644
index 0000000..a9255c5
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/enumtest.yang
@@ -0,0 +1,27 @@
+module enumtest {
+
+ yang-version 1;
+
+ namespace "ydt.enumtest";
+
+ prefix "enumtest";
+
+ organization "ON-LAB";
+
+ description "This module defines for enumtest classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list enumList {
+ key enumleaf;
+ leaf enumleaf {
+ type enumeration {
+ enum ten { value "10";}
+ enum hundred { value "100";}
+ enum thousand { value "1000"; }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/food.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/food.yang
new file mode 100644
index 0000000..202d11f
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/food.yang
@@ -0,0 +1,39 @@
+module food {
+
+ yang-version 1;
+
+ namespace "ydt.food";
+
+ prefix "foodType";
+
+ organization "ON-LAB";
+
+ description "This module defines for food.";
+
+ revision "2016-06-24" {
+ description "Initial revision.";
+ }
+
+ container food {
+ choice snack {
+ case sportsarena {
+
+ leaf pretzel {
+ type empty;
+ }
+ leaf beer {
+ type empty;
+ }
+ }
+ case latenight {
+ leaf chocolate {
+ type enumeration {
+ enum dark;
+ enum milk;
+ enum first-available;
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/integer16.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/integer16.yang
new file mode 100644
index 0000000..8db77be
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/integer16.yang
@@ -0,0 +1,98 @@
+module integer16 {
+
+ yang-version 1;
+
+ namespace "ydt.integer16";
+
+ prefix "integer16";
+
+ organization "ON-LAB";
+
+ description "This module defines for integer16 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list multiRangeValidation {
+ config false;
+ leaf integer {
+ type int16 {
+ range "10..40 | 50..100";
+ }
+ }
+ leaf UnInteger {
+ type uint16 {
+ range "10..40 | 50..100";
+ }
+ }
+
+ leaf revInteger {
+ type int16 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+
+ leaf revUnInteger {
+ type uint16 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+ }
+
+ leaf negInt {
+ type int16 {
+ }
+ }
+
+ leaf posInt {
+ type int16 {
+ }
+ }
+
+ leaf minIntWithRange {
+ type int16 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midIntWithRange {
+ type int16 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxIntWithRange {
+ type int16 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf minUInt {
+ type uint16 {
+ }
+ }
+
+ leaf maxUInt {
+ type uint16 {
+ }
+ }
+
+ leaf minUIntWithRange {
+ type uint16 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midUIntWithRange {
+ type uint16 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxUIntWithRange {
+ type uint16 {
+ range "10 .. 100";
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/integer32.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/integer32.yang
new file mode 100644
index 0000000..fb596cf
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/integer32.yang
@@ -0,0 +1,98 @@
+module integer32 {
+
+ yang-version 1;
+
+ namespace "ydt.integer32";
+
+ prefix "integer32";
+
+ organization "ON-LAB";
+
+ description "This module defines for integer32 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list multiRangeValidation {
+ config false;
+ leaf integer {
+ type int32 {
+ range "10..40 | 50..100";
+ }
+ }
+ leaf UnInteger {
+ type uint32 {
+ range "10..40 | 50..100";
+ }
+ }
+
+ leaf revInteger {
+ type int32 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+
+ leaf revUnInteger {
+ type uint32 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+ }
+
+ leaf negInt {
+ type int32 {
+ }
+ }
+
+ leaf posInt {
+ type int32 {
+ }
+ }
+
+ leaf minIntWithRange {
+ type int32 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midIntWithRange {
+ type int32 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxIntWithRange {
+ type int32 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf minUInt {
+ type uint32 {
+ }
+ }
+
+ leaf maxUInt {
+ type uint32 {
+ }
+ }
+
+ leaf minUIntWithRange {
+ type uint32 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midUIntWithRange {
+ type uint32 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxUIntWithRange {
+ type uint32 {
+ range "10 .. 100";
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/integer64.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/integer64.yang
new file mode 100644
index 0000000..39479c6
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/integer64.yang
@@ -0,0 +1,98 @@
+module integer64 {
+
+ yang-version 1;
+
+ namespace "ydt.integer64";
+
+ prefix "integer64";
+
+ organization "ON-LAB";
+
+ description "This module defines for integer64 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list multiRangeValidation {
+ config false;
+ leaf integer {
+ type int64 {
+ range "10..40 | 50..100";
+ }
+ }
+ leaf UnInteger {
+ type uint64 {
+ range "10..40 | 50..100";
+ }
+ }
+
+ leaf revInteger {
+ type int64 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+
+ leaf revUnInteger {
+ type uint64 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+ }
+
+ leaf negInt {
+ type int64 {
+ }
+ }
+
+ leaf posInt {
+ type int64 {
+ }
+ }
+
+ leaf minIntWithRange {
+ type int64 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midIntWithRange {
+ type int64 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxIntWithRange {
+ type int64 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf minUInt {
+ type uint64 {
+ }
+ }
+
+ leaf maxUInt {
+ type uint64 {
+ }
+ }
+
+ leaf minUIntWithRange {
+ type uint64 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midUIntWithRange {
+ type uint64 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxUIntWithRange {
+ type uint64 {
+ range "10 .. 100";
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/integer8.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/integer8.yang
new file mode 100644
index 0000000..e05c235
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/integer8.yang
@@ -0,0 +1,99 @@
+module integer8 {
+
+ yang-version 1;
+
+ namespace "ydt.integer8";
+
+ prefix "integer8";
+
+ organization "ON-LAB";
+
+ description "This module defines for integer8 classifier.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list multiRangeValidation {
+ config false;
+ leaf integer {
+ type int8 {
+ range "10..40 | 50..100";
+ }
+ }
+ leaf UnInteger {
+ type uint8 {
+ range "10..40 | 50..100";
+ }
+ }
+
+ leaf revInteger {
+ type int8 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+
+ leaf revUnInteger {
+ type uint8 {
+ range "min .. 2 | 10 | 20..max";
+ }
+ }
+ }
+
+
+ leaf negInt {
+ type int8 {
+ }
+ }
+
+ leaf posInt {
+ type int8 {
+ }
+ }
+
+ leaf minIntWithRange {
+ type int8 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midIntWithRange {
+ type int8 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxIntWithRange {
+ type int8 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf minUInt {
+ type uint8 {
+ }
+ }
+
+ leaf maxUInt {
+ type uint8 {
+ }
+ }
+
+ leaf minUIntWithRange {
+ type uint8 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf midUIntWithRange {
+ type uint8 {
+ range "10 .. 100";
+ }
+ }
+
+ leaf maxUIntWithRange {
+ type uint8 {
+ range "10 .. 100";
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/logisticsmanager.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/logisticsmanager.yang
new file mode 100644
index 0000000..7198611
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/logisticsmanager.yang
@@ -0,0 +1,16 @@
+module logisticsmanager {
+
+ yang-version 1;
+
+ namespace "ydt.logistics-manager";
+
+ prefix "root";
+
+ organization "ON-LAB";
+
+ description "This module defines for logistics-manager.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/materialsupervisor.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/materialsupervisor.yang
new file mode 100644
index 0000000..6ab16ea
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/materialsupervisor.yang
@@ -0,0 +1,29 @@
+module materialsupervisor {
+
+ yang-version 1;
+
+ namespace "ydt.material-supervisor";
+
+ prefix "material";
+
+ organization "ON-LAB";
+
+ description "This module defines for material-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ list supervisor {
+ key "name";
+ leaf name {
+ type string;
+ description "name of material-supervisor";
+ }
+
+ leaf departmentId {
+ type string;
+ description "name of department";
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/merchandisersupervisor.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/merchandisersupervisor.yang
new file mode 100644
index 0000000..db40c7e
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/merchandisersupervisor.yang
@@ -0,0 +1,21 @@
+module merchandisersupervisor {
+
+ yang-version 1;
+
+ namespace "ydt.Merchandiser-supervisor";
+
+ prefix "merchandiser";
+
+ organization "ON-LAB";
+
+ description "This module defines for Merchandiser-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ leaf supervisor {
+ type string;
+ description "name of the Merchandiser-supervisor.";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/purchasingsupervisor.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/purchasingsupervisor.yang
new file mode 100644
index 0000000..a52b4c5
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/purchasingsupervisor.yang
@@ -0,0 +1,27 @@
+module purchasingsupervisor {
+
+ yang-version 1;
+
+ namespace "ydt.purchasing-supervisor";
+
+ prefix "purchasing";
+
+ organization "ON-LAB";
+
+ description "This module defines for purchasing-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ container supervisor {
+ leaf purchasing-specialist {
+ type string;
+ description "name of the purchasing-specialist person";
+ }
+ leaf support {
+ type string;
+ description "name of the support person";
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/rootlist.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/rootlist.yang
new file mode 100644
index 0000000..ef5a0a0
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/rootlist.yang
@@ -0,0 +1,111 @@
+module rootlist {
+
+ yang-version 1;
+
+ namespace "ydt.rootlist";
+
+ prefix "rootlist";
+
+ organization "ON-LAB";
+
+ description "This submodule defines for root.";
+
+ revision "2016-06-24" {
+ description "Initial revision.";
+ }
+/*
+ +--------------+---------+-------------+
+ | substatement | section | cardinality |
+ +--------------+---------+-------------+
+ | anyxml | 7.10 | 0..n |
+ | choice | 7.9 | 0..n |
+ | config | 7.19.1 | 0..1 |
+ | container | 7.5 | 0..n |
+ | description | 7.19.3 | 0..1 |
+ | grouping | 7.11 | 0..n |
+ | if-feature | 7.18.2 | 0..n |
+ | key | 7.8.2 | 0..1 |
+ | leaf | 7.6 | 0..n |
+ | leaf-list | 7.7 | 0..n |
+ | list | 7.8 | 0..n |
+ | max-elements | 7.7.4 | 0..1 |
+ | min-elements | 7.7.3 | 0..1 |
+ | must | 7.5.3 | 0..n |
+ | ordered-by | 7.7.5 | 0..1 |
+ | reference | 7.19.4 | 0..1 |
+ | status | 7.19.2 | 0..1 |
+ | typedef | 7.3 | 0..n |
+ | unique | 7.8.3 | 0..n |
+ | uses | 7.12 | 0..n |
+ | when | 7.19.5 | 0..1 |
+ +--------------+---------+-------------+
+*/
+
+ list listwithoutcontainer {
+ key "invalidinterval";
+ min-elements 1; //-- comment
+ leaf invalidinterval {
+ type "uint16";
+ units "seconds";
+ description "Interval before a route is declared invalid";
+ config true;
+ mandatory true;
+ status current;
+ reference "RFC 6020";
+ }
+ }
+
+ list listwithcontainer {
+ key "invalid invalid1";
+ max-elements 3;
+ min-elements 1;
+ reference "list reference";
+ unique "invalid";
+ leaf-list invalidinterval {
+ type "uint16";
+ units "seconds";
+ description "Interval before a route is declared invalid";
+ config false;
+ status current;
+ reference "RFC 6020";
+ }
+
+ container interface {
+ leaf invalidinterval {
+ type "uint16";
+ units "seconds";
+ status current;
+ mandatory true;
+ reference "RFC 6020";
+ }
+
+ leaf invalid {
+ type "uint16";
+ units "seconds";
+ description "Interval before a route is declared invalid";
+ default "16";
+ status current;
+ reference "RFC 6020";
+ }
+
+ }
+
+ leaf invalid {
+ type "uint16";
+ units "seconds";
+ description "Interval before a route is declared invalid";
+ mandatory true;
+ status current;
+ reference "RFC 6020";
+ }
+
+ leaf invalid1 {
+ type "uint16";
+ units "seconds";
+ description "Interval before a route is declared invalid";
+ mandatory true;
+ status current;
+ reference "RFC 6020";
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/tradingsupervisor.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/tradingsupervisor.yang
new file mode 100644
index 0000000..a6c8681
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/tradingsupervisor.yang
@@ -0,0 +1,21 @@
+module tradingsupervisor {
+
+ yang-version 1;
+
+ namespace "ydt.trading-supervisor";
+
+ prefix "trading";
+
+ organization "ON-LAB";
+
+ description "This module defines for trading-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ leaf supervisor {
+ type string;
+ description "name of the trading-supervisor";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/warehousesupervisor.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/warehousesupervisor.yang
new file mode 100644
index 0000000..5145824
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/warehousesupervisor.yang
@@ -0,0 +1,21 @@
+module warehousesupervisor {
+
+ yang-version 1;
+
+ namespace "ydt.warehouse-supervisor";
+
+ prefix "warehouse";
+
+ organization "ON-LAB";
+
+ description "This module defines for warehouse-supervisor.";
+
+ revision "2016-05-24" {
+ description "Initial revision.";
+ }
+
+ leaf-list supervisor {
+ type string;
+ description "name of the warehouse-supervisor's";
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-inet-types.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-inet-types.yang
new file mode 100644
index 0000000..6b994bb
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-inet-types.yang
@@ -0,0 +1,454 @@
+ module yms-ietf-inet-types {
+
+ yang-version 1;
+
+ namespace
+ "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+
+ prefix inet;
+
+ organization
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netmod/>
+ WG List: <mailto:netmod@ietf.org>
+
+ WG Chair: David Kessens
+ <mailto:david.kessens@nsn.com>
+
+ WG Chair: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>
+
+ Editor: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>";
+
+ description
+ "This module contains a collection of generally useful derived
+ YANG data types for Internet addresses and related things.
+
+ Copyright (c) 2013 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of RFC 6991; see
+ the RFC itself for full legal notices.";
+
+ revision "2013-07-15" {
+ description
+ "This revision adds the following new data types:
+ - ip-address-no-zone
+ - ipv4-address-no-zone
+ - ipv6-address-no-zone";
+ reference
+ "RFC 6991: Common YANG Data Types";
+
+ }
+
+ revision "2010-09-24" {
+ description "Initial revision.";
+ reference
+ "RFC 6021: Common YANG Data Types";
+
+ }
+
+
+ typedef ip-version {
+ type enumeration {
+ enum "unknown" {
+ value 0;
+ description
+ "An unknown or unspecified version of the Internet
+ protocol.";
+ }
+ enum "ipv4" {
+ value 1;
+ description
+ "The IPv4 protocol as defined in RFC 791.";
+ }
+ enum "ipv6" {
+ value 2;
+ description
+ "The IPv6 protocol as defined in RFC 2460.";
+ }
+ }
+ description
+ "This value represents the version of the IP protocol.
+
+ In the value set and its semantics, this type is equivalent
+ to the InetVersion textual convention of the SMIv2.";
+ reference
+ "RFC 791: Internet Protocol
+ RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
+ RFC 4001: Textual Conventions for Internet Network Addresses";
+
+ }
+
+ typedef dscp {
+ type uint8 {
+ range "0..63";
+ }
+ description
+ "The dscp type represents a Differentiated Services Code Point
+ that may be used for marking packets in a traffic stream.
+ In the value set and its semantics, this type is equivalent
+ to the Dscp textual convention of the SMIv2.";
+ reference
+ "RFC 3289: Management Information Base for the Differentiated
+ Services Architecture
+ RFC 2474: Definition of the Differentiated Services Field
+ (DS Field) in the IPv4 and IPv6 Headers
+ RFC 2780: IANA Allocation Guidelines For Values In
+ the Internet Protocol and Related Headers";
+
+ }
+
+ typedef ipv6-flow-label {
+ type uint32 {
+ range "0..1048575";
+ }
+ description
+ "The ipv6-flow-label type represents the flow identifier or Flow
+ Label in an IPv6 packet header that may be used to
+ discriminate traffic flows.
+
+ In the value set and its semantics, this type is equivalent
+ to the IPv6FlowLabel textual convention of the SMIv2.";
+ reference
+ "RFC 3595: Textual Conventions for IPv6 Flow Label
+ RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
+
+ }
+
+ typedef port-number {
+ type uint16 {
+ range "0..65535";
+ }
+ description
+ "The port-number type represents a 16-bit port number of an
+ Internet transport-layer protocol such as UDP, TCP, DCCP, or
+ SCTP. Port numbers are assigned by IANA. A current list of
+ all assignments is available from <http://www.iana.org/>.
+
+ Note that the port number value zero is reserved by IANA. In
+ situations where the value zero does not make sense, it can
+ be excluded by subtyping the port-number type.
+ In the value set and its semantics, this type is equivalent
+ to the InetPortNumber textual convention of the SMIv2.";
+ reference
+ "RFC 768: User Datagram Protocol
+ RFC 793: Transmission Control Protocol
+ RFC 4960: Stream Control Transmission Protocol
+ RFC 4340: Datagram Congestion Control Protocol (DCCP)
+ RFC 4001: Textual Conventions for Internet Network Addresses";
+
+ }
+
+ typedef as-number {
+ type uint32;
+ description
+ "The as-number type represents autonomous system numbers
+ which identify an Autonomous System (AS). An AS is a set
+ of routers under a single technical administration, using
+ an interior gateway protocol and common metrics to route
+ packets within the AS, and using an exterior gateway
+ protocol to route packets to other ASes. IANA maintains
+ the AS number space and has delegated large parts to the
+ regional registries.
+
+ Autonomous system numbers were originally limited to 16
+ bits. BGP extensions have enlarged the autonomous system
+ number space to 32 bits. This type therefore uses an uint32
+ base type without a range restriction in order to support
+ a larger autonomous system number space.
+
+ In the value set and its semantics, this type is equivalent
+ to the InetAutonomousSystemNumber textual convention of
+ the SMIv2.";
+ reference
+ "RFC 1930: Guidelines for creation, selection, and registration
+ of an Autonomous System (AS)
+ RFC 4271: A Border Gateway Protocol 4 (BGP-4)
+ RFC 4001: Textual Conventions for Internet Network Addresses
+ RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
+ Number Space";
+
+ }
+
+ typedef ip-address {
+ type union {
+ type ipv4-address;
+ type ipv6-address;
+ }
+ description
+ "The ip-address type represents an IP address and is IP
+ version neutral. The format of the textual representation
+ implies the IP version. This type supports scoped addresses
+ by allowing zone identifiers in the address format.";
+ reference
+ "RFC 4007: IPv6 Scoped Address Architecture";
+
+ }
+
+ typedef ipv4-address {
+ type string {
+ pattern
+ '(([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}]+)?';
+ }
+ description
+ "The ipv4-address type represents an IPv4 address in
+ dotted-quad notation. The IPv4 address may include a zone
+ index, separated by a % sign.
+
+ The zone index is used to disambiguate identical address
+ values. For link-local addresses, the zone index will
+ typically be the interface index number or the name of an
+ interface. If the zone index is not present, the default
+ zone of the device will be used.
+
+ The canonical format for the zone index is the numerical
+ format";
+ }
+
+ typedef ipv6-address {
+ type string {
+ pattern
+ '((:|[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}]+)?';
+ pattern
+ '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(%.+)?';
+ }
+ description
+ "The ipv6-address type represents an IPv6 address in full,
+ mixed, shortened, and shortened-mixed notation. The IPv6
+ address may include a zone index, separated by a % sign.
+
+ The zone index is used to disambiguate identical address
+ values. For link-local addresses, the zone index will
+ typically be the interface index number or the name of an
+ interface. If the zone index is not present, the default
+ zone of the device will be used.
+
+
+
+ The canonical format of IPv6 addresses uses the textual
+ representation defined in Section 4 of RFC 5952. The
+ canonical format for the zone index is the numerical
+ format as described in Section 11.2 of RFC 4007.";
+ reference
+ "RFC 4291: IP Version 6 Addressing Architecture
+ RFC 4007: IPv6 Scoped Address Architecture
+ RFC 5952: A Recommendation for IPv6 Address Text
+ Representation";
+
+ }
+
+ typedef ip-address-no-zone {
+ type union {
+ type ipv4-address-no-zone;
+ type ipv6-address-no-zone;
+ }
+ description
+ "The ip-address-no-zone type represents an IP address and is
+ IP version neutral. The format of the textual representation
+ implies the IP version. This type does not support scoped
+ addresses since it does not allow zone identifiers in the
+ address format.";
+ reference
+ "RFC 4007: IPv6 Scoped Address Architecture";
+
+ }
+
+ typedef ipv4-address-no-zone {
+ type ipv4-address {
+ pattern '[0-9\.]*';
+ }
+ description
+ "An IPv4 address without a zone index. This type, derived from
+ ipv4-address, may be used in situations where the zone is
+ known from the context and hence no zone index is needed.";
+ }
+
+ typedef ipv6-address-no-zone {
+ type ipv6-address {
+ pattern '[0-9a-fA-F:\.]*';
+ }
+ description
+ "An IPv6 address without a zone index. This type, derived from
+ ipv6-address, may be used in situations where the zone is
+ known from the context and hence no zone index is needed.";
+ reference
+ "RFC 4291: IP Version 6 Addressing Architecture
+ RFC 4007: IPv6 Scoped Address Architecture
+ RFC 5952: A Recommendation for IPv6 Address Text
+ Representation";
+
+ }
+
+ typedef ip-prefix {
+ type union {
+ type ipv4-prefix;
+ type ipv6-prefix;
+ }
+ description
+ "The ip-prefix type represents an IP prefix and is IP
+ version neutral. The format of the textual representations
+ implies the IP version.";
+ }
+
+ typedef ipv4-prefix {
+ type string {
+ pattern
+ '(([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])/(([0-9])|([1-2][0-9])|(3[0-2]))';
+ }
+ description
+ "The ipv4-prefix type represents an IPv4 address prefix.
+ The prefix length is given by the number following the
+ slash character and must be less than or equal to 32.
+
+ A prefix length value of n corresponds to an IP address
+ mask that has n contiguous 1-bits from the most
+ significant bit (MSB) and all other bits set to 0.
+
+ The canonical format of an IPv4 prefix has all bits of
+ the IPv4 address set to zero that are not part of the
+ IPv4 prefix.";
+ }
+
+ typedef ipv6-prefix {
+ type string {
+ pattern
+ '((:|[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])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
+ pattern
+ '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)(/.+)';
+ }
+ description
+ "The ipv6-prefix type represents an IPv6 address prefix.
+ The prefix length is given by the number following the
+ slash character and must be less than or equal to 128.
+
+ A prefix length value of n corresponds to an IP address
+ mask that has n contiguous 1-bits from the most
+ significant bit (MSB) and all other bits set to 0.
+
+ The IPv6 address should have all bits that do not belong
+ to the prefix set to zero.
+
+ The canonical format of an IPv6 prefix has all bits of
+ the IPv6 address set to zero that are not part of the
+ IPv6 prefix. Furthermore, the IPv6 address is represented
+ as defined in Section 4 of RFC 5952.";
+ reference
+ "RFC 5952: A Recommendation for IPv6 Address Text
+ Representation";
+
+ }
+
+ typedef domain-name {
+ type string {
+ length "1..253";
+ pattern
+ '((([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]\.?)|\.';
+ }
+ description
+ "The domain-name type represents a DNS domain name. The
+ name SHOULD be fully qualified whenever possible.
+
+ Internet domain names are only loosely specified. Section
+ 3.5 of RFC 1034 recommends a syntax (modified in Section
+ 2.1 of RFC 1123). The pattern above is intended to allow
+ for current practice in domain name use, and some possible
+ future expansion. It is designed to hold various types of
+ domain names, including names used for A or AAAA records
+ (host names) and other records, such as SRV records. Note
+ that Internet host names have a stricter syntax (described
+ in RFC 952) than the DNS recommendations in RFCs 1034 and
+ 1123, and that systems that want to store host names in
+ schema nodes using the domain-name type are recommended to
+ adhere to this stricter standard to ensure interoperability.
+
+ The encoding of DNS names in the DNS protocol is limited
+ to 255 characters. Since the encoding consists of labels
+ prefixed by a length bytes and there is a trailing NULL
+ byte, only 253 characters can appear in the textual dotted
+ notation.
+
+ The description clause of schema nodes using the domain-name
+ type MUST describe when and how these names are resolved to
+ IP addresses. Note that the resolution of a domain-name value
+ may require to query multiple DNS records (e.g., A for IPv4
+ and AAAA for IPv6). The order of the resolution process and
+ which DNS record takes precedence can either be defined
+ explicitly or may depend on the configuration of the
+ resolver.
+
+ Domain-name values use the US-ASCII encoding. Their canonical
+ format uses lowercase US-ASCII characters. Internationalized
+ domain names MUST be A-labels as per RFC 5890.";
+ reference
+ "RFC 952: DoD Internet Host Table Specification
+ RFC 1034: Domain Names - Concepts and Facilities
+ RFC 1123: Requirements for Internet Hosts -- Application
+ and Support
+ RFC 2782: A DNS RR for specifying the location of services
+ (DNS SRV)
+ RFC 5890: Internationalized Domain Names in Applications
+ (IDNA): Definitions and Document Framework";
+
+ }
+
+ typedef host {
+ type union {
+ type ip-address;
+ type domain-name;
+ }
+ description
+ "The host type represents either an IP address or a DNS
+ domain name.";
+ }
+
+ typedef uri {
+ type string;
+ description
+ "The uri type represents a Uniform Resource Identifier
+ (URI) as defined by STD 66.
+
+ Objects using the uri type MUST be in US-ASCII encoding,
+ and MUST be normalized as described by RFC 3986 Sections
+ 6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary
+ percent-encoding is removed, and all case-insensitive
+ characters are set to lowercase except for hexadecimal
+ digits, which are normalized to uppercase as described in
+ Section 6.2.2.1.
+
+ The purpose of this normalization is to help provide
+ unique URIs. Note that this normalization is not
+ sufficient to provide uniqueness. Two URIs that are
+ textually distinct after this normalization may still be
+ equivalent.
+
+ Objects using the uri type may restrict the schemes that
+ they permit. For example, 'data:' and 'urn:' schemes
+ might not be appropriate.
+
+ A zero-length URI is not a valid URI. This can be used to
+ express 'URI absent' where required.
+
+ In the value set and its semantics, this type is equivalent
+ to the Uri SMIv2 textual convention defined in RFC 5017.";
+ reference
+ "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
+ RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
+ Group: Uniform Resource Identifiers (URIs), URLs,
+ and Uniform Resource Names (URNs): Clarifications
+ and Recommendations
+ RFC 5017: MIB Textual Conventions for Uniform Resource
+ Identifiers (URIs)";
+
+ }
+ } // module ietf-inet-types
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-network.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-network.yang
new file mode 100644
index 0000000..dc65182
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-network.yang
@@ -0,0 +1,216 @@
+ module yms-ietf-network {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network";
+ prefix nd;
+
+ import yms-ietf-inet-types {
+ prefix inet;
+ }
+
+ organization
+ "IETF I2RS (Interface to the Routing System) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/i2rs/>
+ WG List: <mailto:i2rs@ietf.org>
+
+ WG Chair: Susan Hares
+ <mailto:shares@ndzh.com>
+
+ WG Chair: Jeffrey Haas
+ <mailto:jhaas@pfrc.org>
+
+ Editor: Alexander Clemm
+ <mailto:alex@cisco.com>
+
+ Editor: Jan Medved
+ <mailto:jmedved@cisco.com>
+
+ Editor: Robert Varga
+ <mailto:rovarga@cisco.com>
+
+ Editor: Tony Tkacik
+ <mailto:ttkacik@cisco.com>
+
+ Editor: Nitin Bahadur
+ <mailto:nitin_bahadur@yahoo.com>
+
+ Editor: Hariharan Ananthakrishnan
+ <mailto:hari@packetdesign.com>";
+
+ description
+ "This module defines a common base model for a collection
+ of nodes in a network. Node definitions are further used
+ in network topologies and inventories.
+
+ Copyright (c) 2015 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of
+ draft-ietf-i2rs-yang-network-topo-02;
+ see the RFC itself for full legal notices.
+
+ NOTE TO RFC EDITOR: Please replace above reference to
+ draft-ietf-i2rs-yang-network-topo-02 with RFC
+ number when published (i.e. RFC xxxx).";
+
+ revision 2015-12-08 {
+ description
+ "Initial revision.
+ NOTE TO RFC EDITOR: Please replace the following reference
+ to draft-ietf-i2rs-yang-network-topo-02 with
+ RFC number when published (i.e. RFC xxxx).";
+ reference
+ "draft-ietf-i2rs-yang-network-topo-02";
+ }
+
+ typedef node-id {
+ type inet:uri;
+ description
+ "Identifier for a node.";
+ }
+
+ typedef network-id {
+ type inet:uri;
+ description
+ "Identifier for a network.";
+ }
+ grouping network-ref {
+ description
+ "Contains the information necessary to reference a network,
+ for example an underlay network.";
+ leaf network-ref {
+ type leafref {
+ path "/nd:networks/nd:network/nd:network-id";
+ require-instance false;
+ }
+ description
+ "Used to reference a network, for example an underlay
+ network.";
+ }
+ }
+
+ grouping node-ref {
+ description
+ "Contains the information necessary to reference a node.";
+ leaf node-ref {
+ type leafref {
+ path "/nd:networks/nd:network[nd:network-id=current()/../"+
+ "network-ref]/nd:node/nd:node-id";
+ require-instance false;
+ }
+ description
+ "Used to reference a node.
+ Nodes are identified relative to the network they are
+ contained in.";
+ }
+ uses network-ref;
+ }
+
+ container networks {
+ description
+ "Serves as top-level container for a list of networks.";
+ list network {
+ key "network-id";
+ description
+ "Describes a network.
+ A network typically contains an inventory of nodes,
+ topological information (augmented through
+ network-topology model), as well as layering
+ information.";
+ container network-types {
+ description
+ "Serves as an augmentation target.
+ The network type is indicated through corresponding
+ presence containers augmented into this container.";
+ }
+ leaf network-id {
+ type network-id;
+ description
+ "Identifies a network.";
+ }
+ list supporting-network {
+ key "network-ref";
+ description
+ "An underlay network, used to represent layered network
+ topologies.";
+ leaf network-ref {
+ type leafref {
+ path "/networks/network/network-id";
+ require-instance false;
+ }
+ description
+ "References the underlay network.";
+ }
+ }
+ list node {
+ key "node-id";
+ description
+ "The inventory of nodes of this network.";
+ leaf node-id {
+ type node-id;
+ description
+ "Identifies a node uniquely within the containing
+ network.";
+ }
+ list supporting-node {
+ key "network-ref node-ref";
+ description
+ "Represents another node, in an underlay network, that
+ this node is supported by. Used to represent layering
+ structure.";
+ leaf network-ref {
+ type leafref {
+ path "../../../supporting-network/network-ref";
+ require-instance false;
+ }
+ description
+ "References the underlay network that the
+ underlay node is part of.";
+ }
+ leaf node-ref {
+ type leafref {
+ path "/networks/network/node/node-id";
+ require-instance false;
+ }
+ description
+ "References the underlay node itself.";
+ }
+ }
+ }
+ }
+ }
+ container networks-state {
+ config false;
+ description
+ "Serves as top-level container for a list of state information
+ for networks";
+ list network {
+ key "network-ref";
+ description
+ "Data nodes representing operational data and state of
+ networks.
+ An instance is automatically created for every network
+ in the corresponding list under the networks container.";
+ uses network-ref;
+ leaf server-provided {
+ type boolean;
+ description
+ "Indicates whether the information concerning this
+ particular network is populated by the server
+ (server-provided true, the general case for network
+ information discovered from the server),
+ or whether it is configured by a client
+ (server-provided true, possible e.g. for
+ service overlays managed through a controller).";
+ }
+ }
+ }
+ }
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-schedule.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-schedule.yang
new file mode 100644
index 0000000..6b278b7
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-schedule.yang
@@ -0,0 +1,64 @@
+ module yms-ietf-schedule {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-schedule";
+ // replace with IANA namespace when assigned
+
+ prefix "sch";
+
+ import yms-ietf-yang-types {
+ prefix "yang";
+ }
+
+ organization "TBD";
+ contact "TBD";
+ description
+ "The model allows time scheduling parameters to be specified.";
+
+ revision "2016-03-01" {
+ description "Initial revision";
+ reference "TBD";
+ }
+
+ /*
+ * Groupings
+ */
+
+ grouping schedules {
+ description
+ "A list of schedules defining when a particular
+ configuration takes effect.";
+ container schedules {
+ description
+ "Container of a schedule list defining when a particular
+ configuration takes effect.";
+ list schedule {
+ key "schedule-id";
+ description "A list of schedule elements.";
+
+ leaf schedule-id {
+ type uint32;
+ description "Identifies the schedule element.";
+ }
+ leaf start {
+ type yang:date-and-time;
+ description "Start time.";
+ }
+ leaf schedule-duration {
+ type string {
+ pattern
+ 'P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?T(\d+H)?(\d+M)?(\d+S)?';
+ }
+ description "Schedule duration in ISO 8601 format.";
+ }
+ leaf repeat-interval {
+ type string {
+ pattern
+ 'R\d*/P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?T(\d+H)?(\d+M)?'
+ + '(\d+S)?';
+ }
+ description "Repeat interval in ISO 8601 format.";
+ }
+ }
+ }
+ } // schedules
+ }
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-te-topology.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-te-topology.yang
new file mode 100644
index 0000000..8815682
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-te-topology.yang
@@ -0,0 +1,1112 @@
+module yms-ietf-te-topology {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-te-topology";
+ // replace with IANA namespace when assigned
+
+ prefix "tet";
+
+ import yms-ietf-inet-types {
+ prefix "inet";
+ }
+
+ import yms-ietf-schedule {
+ prefix "sch";
+ }
+
+ import yms-ietf-te-types {
+ prefix "te-types";
+ }
+
+ import yms-ietf-network {
+ prefix "nw";
+ }
+
+ import yms-network-topology {
+ prefix "nt";
+ }
+
+ organization
+ "Traffic Engineering Architecture and Signaling (TEAS)
+ Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/teas/>
+ WG List: <mailto:teas@ietf.org>
+ WG Chair: Lou Berger
+ <mailto:lberger@labn.net>
+ WG Chair: Vishnu Pavan Beeram
+ <mailto:vbeeram@juniper.net>
+ Editor: Xufeng Liu
+ <mailto:xliu@kuatrotech.com>
+ Editor: Igor Bryskin
+ <mailto:Igor.Bryskin@huawei.com>
+ Editor: Vishnu Pavan Beeram
+ <mailto:vbeeram@juniper.net>
+ Editor: Tarek Saad
+ <mailto:tsaad@cisco.com>
+ Editor: Himanshu Shah
+ <mailto:hshah@ciena.com>
+ Editor: Oscar Gonzalez De Dios
+ <mailto:oscar.gonzalezdedios@telefonica.com>";
+
+ description "TE topology model";
+
+ revision "2016-03-17" {
+ description "Initial revision";
+ reference "TBD";
+ }
+
+ /*
+ * Features
+ */
+
+ feature configuration-schedule {
+ description
+ "This feature indicates that the system supports
+ configuration scheduling.";
+ }
+
+ feature te-topology-hierarchy {
+ description
+ "This feature indicates that the system allows underlay
+ and/or overlay TE topology hierarchy.";
+ }
+
+ feature te-performance-metric {
+ description
+ "This feature indicates that the system supports
+ TE performance metric defined in
+ RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
+ }
+
+ feature template {
+ description
+ "This feature indicates that the system supports
+ template configuration.";
+ }
+
+ /*
+ * Typedefs
+ */
+ typedef performance-metric-normality {
+ type enumeration {
+ enum "unknown" {
+ value 0;
+ description
+ "Unknown.";
+ }
+ enum "normal" {
+ value 1;
+ description
+ "Normal.";
+ }
+ enum "abnormal" {
+ value 2;
+ description
+ "Abnormal. The anomalous bit is set.";
+ }
+ }
+ description
+ "Indicates whether a performance metric is normal, abnormal, or
+ unknown.";
+ reference
+ "RFC7471: OSPF Traffic Engineering (TE) Metric Extensions.";
+ }
+
+ typedef te-admin-status {
+ type enumeration {
+ enum up {
+ description
+ "Enabled.";
+ }
+ enum down {
+ description
+ "Disabled.";
+ }
+ enum testing {
+ description
+ "In some test mode.";
+ }
+ enum preparing-maintenance {
+ description
+ "Resource is disabled in the control plane to prepare for
+ graceful shutdown for maintenance purposes.";
+ reference
+ "RFC5817: Graceful Shutdown in MPLS and Generalized MPLS
+ Traffic Engineering Networks";
+ }
+ enum maintenance {
+ description
+ "Resource is disabled in the data plane for maintenance
+ purposes.";
+ }
+ }
+ description
+ "Defines a type representing the administrative status of
+ a TE resource.";
+ }
+ typedef te-global-id {
+ type uint32;
+ description
+ "An identifier to uniquely identify an operator, which can be
+ either a provider or a client.
+ The definition of this type is taken from RFC6370 and RFC5003.
+ This attribute type is used solely to provide a globally
+ unique context for TE topologies.";
+ }
+
+ typedef te-link-access-type {
+ type enumeration {
+ enum point-to-point {
+ description
+ "The link is point-to-point.";
+ }
+ enum multi-access {
+ description
+ "The link is multi-access, including broacast and NBMA.";
+ }
+ }
+ description
+ "Defines a type representing the access type of a TE link.";
+ reference
+ "RFC3630: Traffic Engineering (TE) Extensions to OSPF
+ Version 2.";
+ }
+
+ typedef te-node-id {
+ type inet:ip-address;
+ description
+ "An identifier for a node in a topology.
+ The identifier is represented as an IPv4 or IPv6 address.
+ This attribute is mapped to Router ID in
+ RFC3630, RFC5329, RFC5305, and RFC 6119.";
+ }
+
+ typedef te-oper-status {
+ type enumeration {
+ enum up {
+ description
+ "Operational up.";
+ }
+ enum down {
+ description
+ "Operational down.";
+ }
+ enum testing {
+ description
+ "In some test mode.";
+ }
+ enum unknown {
+ description
+ "Status cannot be determined for some reason.";
+ }
+ enum preparing-maintenance {
+ description
+ "Resource is disabled in the control plane to prepare for
+ graceful shutdown for maintenance purposes.";
+ reference
+ "RFC5817: Graceful Shutdown in MPLS and Generalized MPLS
+ Traffic Engineering Networks";
+ }
+ enum maintenance {
+ description
+ "Resource is disabled in the data plane for maintenance
+ purposes.";
+ }
+ }
+ description
+ "Defines a type representing the operational status of
+ a TE resource.";
+ }
+
+ typedef te-recovery-status {
+ type enumeration {
+ enum normal {
+ description
+ "Both the recovery and working spans are fully
+ allocated and active, data traffic is being
+ transported over (or selected from) the working
+ span, and no trigger events are reported.";
+ }
+ enum recovery-started {
+ description
+ "The recovery action has been started, but not completed.";
+ }
+ enum recovery-succeeded {
+ description
+ "The recovery action has succeeded. The working span has
+ reported a failure/degrade condition and the user traffic
+ is being transported (or selected) on the recovery span.";
+ }
+ enum recovery-failed {
+ description
+ "The recovery action has failed.";
+ }
+ enum reversion-started {
+ description
+ "The reversion has started.";
+ }
+ enum reversion-failed {
+ description
+ "The reversion has failed.";
+ }
+ enum recovery-unavailable {
+ description
+ "The recovery is unavailable -- either as a result of an
+ operator Lockout command or a failure condition detected
+ on the recovery span.";
+ }
+ enum recovery-admin {
+ description
+ "The operator has issued a command switching the user
+ traffic to the recovery span.";
+ }
+ enum wait-to-restore {
+ description
+ "The recovery domain is recovering from a failuer/degrade
+ condition on the working span that is being controlled by
+ the Wait-to-Restore (WTR) timer.";
+ }
+ }
+ }
+
+ typedef te-template-name {
+ type string {
+ pattern '/?([a-zA-Z0-9\-_.]+)(/[a-zA-Z0-9\-_.]+)*';
+ }
+ }
+
+ typedef te-topology-event-type {
+ type enumeration {
+ enum "add" {
+ value 0;
+ }
+ enum "remove" {
+ value 1;
+ }
+ enum "update" {
+ value 2;
+ }
+ }
+ } // te-topology-event-type
+ typedef te-topology-id {
+ type string {
+ pattern '/?([a-zA-Z0-9\-_.]+)(/[a-zA-Z0-9\-_.]+)*';
+ }
+ }
+
+ typedef te-tp-id {
+ type union {
+ type uint32; // Unnumbered
+ type inet:ip-address; // IPv4 or IPv6 address
+ }
+ }
+
+ /*
+ * Identities
+ */
+
+ /*
+ * Groupings
+ */
+ grouping information-source-attributes {
+ leaf information-source {
+ type enumeration {
+ enum "unknown";
+ enum "locally-configured";
+ enum "ospfv2";
+ enum "ospfv3";
+ enum "isis";
+ enum "system-processed";
+ enum "other";
+ }
+ }
+ container information-source-state {
+ leaf credibility-preference {
+ type uint16;
+ }
+ container topology {
+ uses te-topology-ref;
+ } // topology
+ leaf routing-instance {
+ type string;
+ } // routing-information
+ }
+ } // information-source-attributes
+
+ grouping performance-metric-attributes {
+ leaf unidirectional-delay {
+ type uint32 {
+ range 0..16777215;
+ }
+ }
+ leaf unidirectional-min-delay {
+ type uint32 {
+ range 0..16777215;
+ }
+ }
+ leaf unidirectional-max-delay {
+ type uint32 {
+ range 0..16777215;
+ }
+ }
+ leaf unidirectional-delay-variation {
+ type uint32 {
+ range 0..16777215;
+ }
+ }
+ leaf unidirectional-packet-loss {
+ type decimal64 {
+ fraction-digits 6;
+ range "0 .. 50.331642";
+ }
+ }
+ leaf unidirectional-residual-bandwidth {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+ leaf unidirectional-available-bandwidth {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+ leaf unidirectional-utilized-bandwidth {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+ } // performance-metric-attributes
+ grouping performance-metric-normality-attributes {
+ leaf unidirectional-delay {
+ type performance-metric-normality;
+ }
+ leaf unidirectional-min-delay {
+ type performance-metric-normality;
+ }
+ leaf unidirectional-max-delay {
+ type performance-metric-normality;
+ }
+ leaf unidirectional-delay-variation {
+ type performance-metric-normality;
+ }
+ leaf unidirectional-packet-loss {
+ type performance-metric-normality;
+ }
+ leaf unidirectional-residual-bandwidth {
+ type performance-metric-normality;
+ }
+ leaf unidirectional-available-bandwidth {
+ type performance-metric-normality;
+ }
+ leaf unidirectional-utilized-bandwidth {
+ type performance-metric-normality;
+ }
+ } // performance-metric-normality-attributes
+
+ grouping performance-metric-throttle-container {
+ container performance-metric-throttle {
+ leaf unidirectional-delay-offset {
+ type uint32 {
+ range 0..16777215;
+ }
+ }
+ leaf measure-interval {
+ type uint32;
+ default 30;
+ }
+ leaf advertisement-interval {
+ type uint32;
+ }
+ leaf suppression-interval {
+ type uint32 {
+ range "1 .. max";
+ }
+ default 120;
+ }
+ container threshold-out {
+ uses performance-metric-attributes;
+ }
+ container threshold-in {
+ uses performance-metric-attributes;
+ }
+ container threshold-accelerated-advertisement {
+ uses performance-metric-attributes;
+ }
+ }
+ } // performance-metric-throttle-container
+
+ grouping te-link-augment {
+ container te {
+ presence "TE support.";
+ container config {
+ uses te-link-config;
+ } // config
+ container state {
+ config false;
+ uses te-link-config;
+ uses te-link-state-derived;
+ } // state
+ } // te
+ } // te-link-augment
+
+ grouping te-link-config {
+ choice bundle-stack-level {
+ case bundle {
+ container bundled-links {
+ list bundled-link {
+ key "sequence";
+ leaf sequence {
+ type uint32;
+ }
+ leaf src-tp-ref {
+ type leafref {
+ path "../../../../../../nw:node[nw:node-id = "
+ + "current()/../../../../../nt:source/"
+ + "nt:source-node]/"
+ + "nt:t-point/nt:tp-id";
+ require-instance true;
+ }
+ }
+ leaf des-tp-ref {
+ type leafref {
+ path "../../../../../../nw:node[nw:node-id = "
+ + "current()/../../../../../nt:destination/"
+ + "nt:dest-node]/"
+ + "nt:t-point/nt:tp-id";
+ require-instance true;
+ }
+ }
+ } // list bundled-link
+ }
+ }
+ case component {
+ container component-links {
+ list component-link {
+ key "sequence";
+ leaf sequence {
+ type uint32;
+ }
+ leaf src-interface-ref {
+ type string;
+ }
+ leaf des-interface-ref {
+ type string;
+ }
+ }
+ }
+ }
+ } // bundle-stack-level
+
+ leaf-list te-link-template {
+ if-feature template;
+ type leafref {
+ path "../../../../../te/templates/link-template/name";
+ }
+ }
+ uses te-link-config-attributes;
+ } // te-link-config
+
+ grouping te-link-config-attributes {
+ container te-link-attributes {
+ uses sch:schedules;
+ leaf access-type {
+ type te-link-access-type;
+ }
+ leaf is-abstract {
+ type empty;
+ }
+ leaf name {
+ type string;
+ }
+ container underlay {
+ presence
+ "Indicates the underlay exists for this link.";
+ uses te-link-underlay-attributes;
+ } // underlay
+ leaf admin-status {
+ type te-admin-status;
+ description
+ "The administrative state of the link.";
+ }
+
+ uses performance-metric-throttle-container;
+ uses te-link-info-attributes;
+ } // te-link-attributes
+ } // te-link-config-attributes
+
+ grouping te-link-info-attributes {
+ leaf link-index {
+ type uint64;
+ }
+ leaf administrative-group {
+ type te-types:admin-groups;
+ }
+ leaf max-link-bandwidth {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+ leaf max-resv-link-bandwidth {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+ list unreserved-bandwidth {
+ key "priority";
+ max-elements "8";
+ leaf priority {
+ type uint8 {
+ range "0..7";
+ }
+ }
+ leaf bandwidth {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+ }
+ leaf te-default-metric {
+ type uint32;
+ }
+ container performance-metric {
+ container measurement {
+ uses performance-metric-attributes;
+ }
+ container normality
+ {
+ uses performance-metric-normality-attributes;
+ }
+ }
+ leaf link-protection-type {
+ type enumeration {
+ enum "unprotected";
+ enum "extra-traffic";
+ enum "shared";
+ enum "1-for-1";
+ enum "1-plus-1";
+ enum "enhanced";
+ }
+ }
+ list interface-switching-capability {
+ key "switching-capability";
+ leaf switching-capability {
+ type identityref {
+ base te-types:switching-capabilities;
+ }
+ }
+ leaf encoding {
+ type identityref {
+ base te-types:lsp-encoding-types;
+ }
+ }
+ list max-lsp-bandwidth {
+ key "priority";
+ max-elements "8";
+ leaf priority {
+ type uint8 {
+ range "0..7";
+ }
+ }
+ leaf bandwidth {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+ }
+ container time-division-multiplex-capable {
+ leaf minimum-lsp-bandwidth {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+ leaf indication {
+ type enumeration {
+ enum "standard";
+ enum "arbitrary";
+ }
+ }
+ }
+ list interface-adjustment-capability {
+ key "upper-sc";
+ leaf upper-sc {
+ type identityref {
+ base te-types:switching-capabilities;
+ }
+ }
+ leaf upper-encoding {
+ type identityref {
+ base te-types:lsp-encoding-types;
+ }
+ }
+ list max-lsp-bandwidth {
+ key "priority";
+ max-elements "8";
+ leaf priority {
+ type uint8 {
+ range "0..7";
+ }
+ description "Priority.";
+ }
+ leaf bandwidth {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+ }
+ } // interface-adjustment-capability
+ } // interface-switching-capability
+ container te-srlgs {
+ leaf-list values {
+ type te-types:srlg;
+ }
+ }
+ } // te-link-info-attributes
+
+ grouping te-link-state-derived {
+ leaf oper-status {
+ type te-oper-status;
+ }
+ uses information-source-attributes;
+ list alt-information-sources {
+ key "information-source";
+ uses information-source-attributes;
+ uses te-link-info-attributes;
+ }
+ container recovery {
+ leaf restoration-status {
+ type te-recovery-status;
+ }
+ leaf protection-status {
+ type te-recovery-status;
+ }
+ }
+ container underlay {
+ uses te-link-state-underlay-attributes;
+ }
+ } // te-link-state-derived
+ grouping te-link-state-underlay-attributes {
+ leaf dynamic {
+ type boolean;
+ }
+ leaf committed {
+ type boolean;
+ }
+ } // te-link-state-underlay-attributes
+
+ grouping te-link-underlay-attributes {
+ container underlay-primary-path {
+ uses te-topology-ref;
+ list path-element {
+ key "path-element-id";
+ leaf path-element-id {
+ type uint32;
+ }
+ uses te-path-element;
+ }
+ } // underlay-primary-path
+ list underlay-backup-path {
+ key "index";
+ leaf index {
+ type uint32;
+ }
+ uses te-topology-ref;
+ list path-element {
+ key "path-element-id";
+ leaf path-element-id {
+ type uint32;
+ }
+ uses te-path-element;
+ }
+ } // underlay-backup-path
+ leaf underlay-protection-type {
+ type uint16;
+ }
+ container underlay-trail-src {
+ uses nt:tp-ref;
+ }
+ container underlay-trail-des {
+ uses nt:tp-ref;
+ }
+ } // te-link-underlay-attributes
+
+ grouping te-node-augment {
+ container te {
+ presence "TE support.";
+ leaf te-node-id {
+ type te-node-id;
+ }
+
+ container config {
+ description
+ "Configuration data.";
+ uses te-node-config;
+ } // config
+ container state {
+ config false;
+ description
+ "Operational state data.";
+
+ uses te-node-config;
+ uses te-node-state-derived;
+ } // state
+
+ list tunnel-termination-point {
+ key "tunnel-tp-id";
+ leaf tunnel-tp-id {
+ type binary;
+ }
+ container config {
+ uses te-node-tunnel-termination-capability;
+ }
+
+ container state {
+ config false;
+ uses te-node-tunnel-termination-capability;
+ leaf switching-capability {
+ type identityref {
+ base te-types:switching-capabilities;
+ }
+ }
+ leaf encoding {
+ type identityref {
+ base te-types:lsp-encoding-types;
+ }
+ }
+ } // state
+
+ } // tunnel-termination-point
+ } // te
+ } // te-node-augment
+
+ grouping te-node-config {
+ leaf-list te-node-template {
+ if-feature template;
+ type leafref {
+ path "../../../../../te/templates/node-template/name";
+ }
+ }
+ uses te-node-config-attributes;
+ } // te-node-config
+
+ grouping te-node-config-attributes {
+ container te-node-attributes {
+ uses sch:schedules;
+ leaf admin-status {
+ type te-admin-status;
+ description
+ "The administrative state of the link.";
+ }
+ uses te-node-connectivity-matrix;
+ uses te-node-info-attributes;
+ } // te-node-attributes
+ } // te-node-config-attributes
+
+ grouping te-node-config-attributes-notification {
+ container te-node-attributes {
+ uses sch:schedules;
+ leaf admin-status {
+ type te-admin-status;
+ }
+ uses te-node-connectivity-matrix-abs;
+ uses te-node-info-attributes;
+ } // te-node-attributes
+ } // te-node-config-attributes-notification
+
+ grouping te-node-config-attributes-template {
+ container te-node-attributes {
+ uses sch:schedules;
+ leaf admin-status {
+ type te-admin-status;
+ }
+ uses te-node-info-attributes;
+ } // te-node-attributes
+ } // te-node-config-attributes-template
+
+ grouping te-node-connectivity-matrix {
+ list connectivity-matrix {
+ key "id";
+ leaf id {
+ type uint32;
+ }
+ container from {
+ leaf tp-ref {
+ type leafref {
+ path "../../../../../../nt:t-point/nt:tp-id";
+ }
+ }
+ }
+ container to {
+ leaf tp-ref {
+ type leafref {
+ path "../../../../../../nt:t-point/nt:tp-id";
+ }
+ }
+ }
+ leaf is-allowed {
+ type boolean;
+ }
+ }
+ } // te-node-connectivity-matrix
+
+ grouping te-node-connectivity-matrix-abs {
+ list connectivity-matrix {
+ key "id";
+ leaf id {
+ type uint32;
+ }
+ container from {
+ uses nt:tp-ref;
+ }
+ container to {
+ uses nt:tp-ref;
+ }
+ leaf is-allowed {
+ type boolean;
+ }
+ }
+ } // te-node-connectivity-matrix-abs
+
+ grouping te-node-info-attributes {
+ leaf domain-id {
+ type uint32;
+ }
+ leaf is-abstract {
+ type empty;
+ }
+ leaf name {
+ type inet:domain-name;
+ }
+ leaf-list signaling-address {
+ type inet:ip-address;
+ }
+ container underlay-topology {
+ if-feature te-topology-hierarchy;
+ uses te-topology-ref;
+ }
+ } // te-node-info-attributes
+
+ grouping te-node-state-derived {
+ description "Node state attributes in a TE topology.";
+ leaf oper-status {
+ type te-oper-status;
+ }
+ leaf is-multi-access-dr {
+ type empty;
+ }
+ uses information-source-attributes;
+ list alt-information-sources {
+ key "information-source";
+ uses information-source-attributes;
+ uses te-node-connectivity-matrix;
+ uses te-node-info-attributes;
+ }
+ } // te-node-state-derived
+
+ grouping te-node-state-derived-notification {
+ description "Node state attributes in a TE topology.";
+ leaf oper-status {
+ type te-oper-status;
+ }
+ leaf is-multi-access-dr {
+ type empty;
+ }
+ uses information-source-attributes;
+ list alt-information-sources {
+ key "information-source";
+ uses information-source-attributes;
+ uses te-node-connectivity-matrix-abs;
+ uses te-node-info-attributes;
+ }
+ } // te-node-state-derived-notification
+
+ grouping te-node-tunnel-termination-capability {
+ list termination-capability {
+ key "link-tp";
+ leaf link-tp {
+ type leafref {
+ path "../../../../../nt:t-point/nt:tp-id";
+ }
+ }
+ } // termination-capability
+ } // te-node-tunnel-termination-capability
+
+ grouping te-path-element {
+ uses te-types:explicit-route-subobject;
+ } // te-path-element
+
+ grouping te-termination-point-augment {
+
+ container te {
+ presence "TE support.";
+
+ leaf te-tp-id {
+ type te-tp-id;
+ mandatory true;
+ }
+
+ container config {
+ uses te-termination-point-config;
+ } // config
+ container state {
+ config false;
+ uses te-termination-point-config;
+ } // state
+ } // te
+ } // te-termination-point-augment
+
+ grouping te-termination-point-config {
+ uses sch:schedules;
+ } // te-termination-point-config
+
+ grouping te-topologies-augment {
+
+ container te {
+ presence "TE support.";
+
+ container templates {
+ list node-template {
+ if-feature template;
+ key "name";
+ leaf name {
+ type te-template-name;
+ }
+ uses template-attributes;
+ uses te-node-config-attributes-template;
+ } // node-template
+
+ list link-template {
+ if-feature template;
+ key "name";
+ leaf name {
+ type te-template-name;
+ }
+ uses template-attributes;
+ uses te-link-config-attributes;
+ } // link-template
+ } // templates
+ } // te
+ } // te-topologies-augment
+
+ grouping te-topology-augment {
+
+ container te {
+ presence "TE support.";
+ leaf provider-id {
+ type te-global-id;
+ }
+ leaf client-id {
+ type te-global-id;
+ }
+ leaf te-topology-id {
+ type te-topology-id;
+ mandatory true;
+ }
+
+ container config {
+ uses te-topology-config;
+ } // config
+ container state {
+ config false;
+ uses te-topology-config;
+ } // state
+ } // te
+ } // te-topology-augment
+
+ grouping te-topology-config {
+ uses sch:schedules;
+ leaf preference {
+ type uint8 {
+ range "1..255";
+ }
+ }
+ } // te-topology-config
+
+ grouping te-topology-ref {
+ leaf provider-id-ref {
+ type leafref {
+ path "/nw:networks/nw:network[nw:network-id = "
+ + "current()/../network-id-ref]/tet:te/tet:provider-id";
+ require-instance false;
+ }
+ }
+ leaf client-id-ref {
+ type leafref {
+ path "/nw:networks/nw:network[nw:network-id = "
+ + "current()/../network-id-ref]/tet:te/tet:client-id";
+ require-instance false;
+ }
+ }
+ leaf te-topology-id-ref {
+ type leafref {
+ path "/nw:networks/nw:network[nw:network-id = "
+ + "current()/../network-id-ref]/tet:te/tet:te-topology-id";
+ require-instance false;
+ }
+ }
+ leaf network-id-ref {
+ type leafref {
+ path "/nw:networks/nw:network/nw:network-id";
+ require-instance false;
+ }
+ }
+ } // te-topology-ref
+
+ grouping te-topology-type {
+ container te-topology {
+ presence "Indicates TE topology.";
+ }
+ } // te-topology-type
+
+ grouping template-attributes {
+ leaf priority {
+ type uint16;
+ }
+ leaf reference-change-policy {
+ type enumeration {
+ enum no-action;
+ enum not-allowed;
+ enum cascade;
+ }
+ }
+ } // template-attributes
+
+ /*
+ * Configuration data nodes
+ */
+ augment "/nw:networks/nw:network/nw:network-types" {
+ uses te-topology-type;
+ }
+
+ augment "/nw:networks" {
+ uses te-topologies-augment;
+ }
+
+ augment "/nw:networks/nw:network" {
+ uses te-topology-augment;
+ }
+
+ augment "/nw:networks/nw:network/nw:node" {
+ uses te-node-augment;
+ }
+
+ augment "/nw:networks/nw:network/nt:link" {
+ uses te-link-augment;
+ }
+
+ augment "/nw:networks/nw:network/nw:node/"
+ + "nt:t-point" {
+ uses te-termination-point-augment;
+ }
+
+ container te-node-event {
+ leaf event-type {
+ type te-topology-event-type;
+ description "Event type.";
+ }
+ uses nw:node-ref;
+ uses te-topology-type;
+ uses tet:te-node-config-attributes-notification;
+ uses tet:te-node-state-derived-notification;
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-te-types.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-te-types.yang
new file mode 100644
index 0000000..206346b
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-te-types.yang
@@ -0,0 +1,870 @@
+ module yms-ietf-te-types {
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-te-types";
+
+ /* Replace with IANA when assigned */
+ prefix "te-types";
+
+ import yms-ietf-inet-types {
+ prefix inet;
+ }
+
+ organization
+ "IETF Traffic Engineering Architecture and Signaling (TEAS)
+ Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/teas/>
+ WG List: <mailto:teas@ietf.org>
+
+ WG Chair: Lou Berger
+ <mailto:lberger@labn.net>
+
+ WG Chair: Vishnu Pavan Beeram
+ <mailto:vbeeram@juniper.net>
+
+ Editor: Tarek Saad
+ <mailto:tsaad@cisco.com>
+
+ Editor: Rakesh Gandhi
+ <mailto:rgandhi@cisco.com>
+
+ Editor: Vishnu Pavan Beeram
+ <mailto:vbeeram@juniper.net>
+
+ Editor: Himanshu Shah
+ <mailto:hshah@ciena.com>
+
+ Editor: Xufeng Liu
+ <mailto:xufeng.liu@ericsson.com>
+
+ Editor: Xia Chen
+ <mailto:jescia.chenxia@huawei.com>
+
+ Editor: Raqib Jones
+ <mailto:raqib@Brocade.com>
+
+ Editor: Bin Wen
+ <mailto:Bin_Wen@cable.comcast.com>";
+
+ description
+ "This module contains a collection of generally
+ useful TE specific YANG data type defintions.";
+
+ revision 2016-03-20 {
+ description "Latest revision of TE generic types";
+ reference "RFC3209";
+ }
+
+ identity tunnel-type {
+ description
+ "Base identity from which specific tunnel types are
+ derived.";
+ }
+
+ identity tunnel-p2p {
+ base tunnel-type;
+ description
+ "TE point-to-point tunnel type.";
+ }
+
+ identity tunnel-p2mp {
+ base tunnel-type;
+ description
+ "TE point-to-multipoint tunnel type.";
+ }
+
+ identity state-type {
+ description
+ "Base identity for TE states";
+ }
+
+ identity state-up {
+ base state-type;
+ description
+ "State up";
+ }
+
+ identity state-down {
+ base state-type;
+ description
+ "State down";
+ }
+
+ identity lsp-prot-type {
+ description
+ "Base identity from which LSP protection types are
+ derived.";
+ }
+
+ identity lsp-prot-unprotected {
+ description
+ "LSP protection 'Unprotected'";
+ reference "RFC4872";
+ }
+
+ identity lsp-prot-reroute-extra {
+ description
+ "LSP protection '(Full) Rerouting'";
+ reference "RFC4872";
+ }
+
+ identity lsp-prot-reroute {
+ description
+ "LSP protection 'Rerouting without Extra-Traffic'";
+ reference "RFC4872";
+ }
+
+ identity lsp-prot-1-for-n {
+ description
+ "LSP protection '1:N Protection with Extra-Traffic'";
+ reference "RFC4872";
+ }
+
+ identity lsp-prot-unidir-1-to-1 {
+ description
+ "LSP protection '1+1 Unidirectional Protection'";
+ reference "RFC4872";
+ }
+
+ identity lsp-prot-bidir-1-to-1 {
+ description
+ "LSP protection '1+1 Bidirectional Protection'";
+ reference "RFC4872";
+ }
+
+ identity switching-capabilities {
+ description
+ "Base identity for interface switching capabilities";
+ }
+
+ identity switching-psc1 {
+ base switching-capabilities;
+ description
+ "Packet-Switch Capable-1 (PSC-1)";
+ }
+
+ identity switching-evpl {
+ base switching-capabilities;
+ description
+ "Ethernet Virtual Private Line (EVPL)";
+ }
+
+ identity switching-l2sc {
+ base switching-capabilities;
+ description
+ "Layer-2 Switch Capable (L2SC)";
+ }
+
+ identity switching-tdm {
+ base switching-capabilities;
+ description
+ "Time-Division-Multiplex Capable (TDM)";
+ }
+
+ identity switching-otn {
+ base switching-capabilities;
+ description
+ "OTN-TDM capable";
+ }
+
+ identity switching-dcsc {
+ base switching-capabilities;
+ description
+ "Data Channel Switching Capable (DCSC)";
+ }
+ identity switching-lsc {
+ base switching-capabilities;
+ description
+ "Lambda-Switch Capable (LSC)";
+ }
+
+ identity switching-fsc {
+ base switching-capabilities;
+ description
+ "Fiber-Switch Capable (FSC)";
+ }
+
+ identity lsp-encoding-types {
+ description
+ "Base identity for encoding types";
+ }
+
+ identity lsp-encoding-packet {
+ base lsp-encoding-types;
+ description
+ "Packet LSP encoding";
+ }
+
+ identity lsp-encoding-ethernet {
+ base lsp-encoding-types;
+ description
+ "Ethernet LSP encoding";
+ }
+
+ identity lsp-encoding-pdh {
+ base lsp-encoding-types;
+ description
+ "ANSI/ETSI LSP encoding";
+ }
+
+ identity lsp-encoding-sdh {
+ base lsp-encoding-types;
+ description
+ "SDH ITU-T G.707 / SONET ANSI T1.105 LSP encoding";
+ }
+
+ identity lsp-encoding-digital-wrapper {
+ base lsp-encoding-types;
+ description
+ "Digital Wrapper LSP encoding";
+ }
+
+ identity lsp-encoding-lambda {
+ base lsp-encoding-types;
+ description
+ "Lambda (photonic) LSP encoding";
+ }
+
+ identity lsp-encoding-fiber {
+ base lsp-encoding-types;
+ description
+ "Fiber LSP encoding";
+ }
+
+ identity lsp-encoding-fiber-channel {
+ base lsp-encoding-types;
+ description
+ "FiberChannel LSP encoding";
+ }
+
+ identity lsp-encoding-oduk {
+ base lsp-encoding-types;
+ description
+ "G.709 ODUk (Digital Path)LSP encoding";
+ }
+
+ identity lsp-encoding-optical-channel {
+ base lsp-encoding-types;
+ description
+ "Line (e.g., 8B/10B) LSP encoding";
+ }
+
+ identity lsp-encoding-line {
+ base lsp-encoding-types;
+ description
+ "Line (e.g., 8B/10B) LSP encoding";
+ }
+
+ /* TE basic features */
+ feature p2mp-te {
+ description
+ "Indicates support for P2MP-TE";
+ }
+
+ feature frr-te {
+ description
+ "Indicates support for TE FastReroute (FRR)";
+ }
+
+ feature extended-admin-groups {
+ description
+ "Indicates support for TE link extended admin
+ groups.";
+ }
+
+ feature named-path-affinities {
+ description
+ "Indicates support for named path affinities";
+ }
+
+ feature named-extended-admin-groups {
+ description
+ "Indicates support for named extended admin groups";
+ }
+
+ feature named-srlg-groups {
+ description
+ "Indicates support for named SRLG groups";
+ }
+
+ feature named-path-constraints {
+ description
+ "Indicates support for named path constraints";
+ }
+
+ grouping explicit-route-subobject {
+ description
+ "The explicit route subobject grouping";
+ choice type {
+ description
+ "The explicit route subobject type";
+ case ipv4-address {
+ description
+ "IPv4 address explicit route subobject";
+ leaf v4-address {
+ type inet:ipv4-address;
+ description
+ "An IPv4 address. This address is
+ treated as a prefix based on the
+ prefix length value below. Bits beyond
+ the prefix are ignored on receipt and
+ SHOULD be set to zero on transmission.";
+ }
+ leaf v4-prefix-length {
+ type uint8;
+ description
+ "Length in bits of the IPv4 prefix";
+ }
+ leaf v4-loose {
+ type boolean;
+ description
+ "Describes whether the object is loose
+ if set, or otherwise strict";
+ }
+ }
+ case ipv6-address {
+ description
+ "IPv6 address Explicit Route Object";
+ leaf v6-address {
+ type inet:ipv6-address;
+ description
+ "An IPv6 address. This address is
+ treated as a prefix based on the
+ prefix length value below. Bits
+ beyond the prefix are ignored on
+ receipt and SHOULD be set to zero
+ on transmission.";
+ }
+ leaf v6-prefix-length {
+ type uint8;
+ description
+ "Length in bits of the IPv4 prefix";
+ }
+ leaf v6-loose {
+ type boolean;
+ description
+ "Describes whether the object is loose
+ if set, or otherwise strict";
+ }
+ }
+ case as-number {
+ leaf as-number {
+ type uint16;
+ description "AS number";
+ }
+ description
+ "Autonomous System explicit route subobject";
+ }
+ case unnumbered-link {
+ leaf router-id {
+ type inet:ip-address;
+ description
+ "A router-id address";
+ }
+ leaf interface-id {
+ type uint32;
+ description "The interface identifier";
+ }
+ description
+ "Unnumbered link explicit route subobject";
+ reference
+ "RFC3477: Signalling Unnumbered Links in
+ RSVP-TE";
+ }
+ case label {
+ leaf value {
+ type uint32;
+ description "the label value";
+ }
+ description
+ "The Label ERO subobject";
+ }
+ /* AS domain sequence..? */
+ }
+ }
+
+ grouping record-route-subobject {
+ description
+ "The record route subobject grouping";
+ choice type {
+ description
+ "The record route subobject type";
+ case ipv4-address {
+ leaf v4-address {
+ type inet:ipv4-address;
+ description
+ "An IPv4 address. This address is
+ treated as a prefix based on the prefix
+ length value below. Bits beyond the
+ prefix are ignored on receipt and
+ SHOULD be set to zero on transmission.";
+ }
+ leaf v4-prefix-length {
+ type uint8;
+ description
+ "Length in bits of the IPv4 prefix";
+ }
+ leaf v4-flags {
+ type uint8;
+ description
+ "IPv4 address sub-object flags";
+ reference "RFC3209";
+ }
+ }
+ case ipv6-address {
+ leaf v6-address {
+ type inet:ipv6-address;
+ description
+ "An IPv6 address. This address is
+ treated as a prefix based on the
+ prefix length value below. Bits
+ beyond the prefix are ignored on
+ receipt and SHOULD be set to zero
+ on transmission.";
+ }
+ leaf v6-prefix-length {
+ type uint8;
+ description
+ "Length in bits of the IPv4 prefix";
+ }
+ leaf v6-flags {
+ type uint8;
+ description
+ "IPv6 address sub-object flags";
+ reference "RFC3209";
+ }
+ }
+ case label {
+ leaf value {
+ type uint32;
+ description "the label value";
+ }
+ leaf flags {
+ type uint8;
+ description
+ "Label sub-object flags";
+ reference "RFC3209";
+ }
+ description
+ "The Label ERO subobject";
+ }
+ }
+ }
+
+ identity route-usage-type {
+ description
+ "Base identity for route usage";
+ }
+
+ identity route-include-ero {
+ base route-usage-type;
+ description
+ "Include ERO from route";
+ }
+
+ identity route-exclude-ero {
+ base route-usage-type;
+ description
+ "Exclude ERO from route";
+ }
+
+ identity route-exclude-srlg {
+ base route-usage-type;
+ description
+ "Exclude SRLG from route";
+ }
+
+ identity path-metric-type {
+ description
+ "Base identity for path metric type";
+ }
+
+ identity path-metric-te {
+ base path-metric-type;
+ description
+ "TE path metric";
+ }
+
+ identity path-metric-igp {
+ base path-metric-type;
+ description
+ "IGP path metric";
+ }
+
+ identity path-tiebreaker-type {
+ description
+ "Base identity for path tie-breaker type";
+ }
+
+ identity path-tiebreaker-minfill {
+ base path-tiebreaker-type;
+ description
+ "Min-Fill LSP path placement";
+ }
+
+ identity path-tiebreaker-maxfill {
+ base path-tiebreaker-type;
+ description
+ "Max-Fill LSP path placement";
+ }
+
+ identity path-tiebreaker-randoom {
+ base path-tiebreaker-type;
+ description
+ "Random LSP path placement";
+ }
+
+ identity bidir-provisioning-mode {
+ description
+ "Base identity for bidirectional provisioning
+ mode.";
+ }
+
+ identity bidir-provisioning-single-sided {
+ base bidir-provisioning-mode;
+ description
+ "Single-sided bidirectional provioning mode";
+ }
+
+ identity bidir-provisioning-double-sided {
+ base bidir-provisioning-mode;
+ description
+ "Double-sided bidirectional provioning mode";
+ }
+
+ identity bidir-association-type {
+ description
+ "Base identity for bidirectional association type";
+ }
+
+ identity bidir-assoc-corouted {
+ base bidir-association-type;
+ description
+ "Co-routed bidirectional association type";
+ }
+
+ identity bidir-assoc-non-corouted {
+ base bidir-association-type;
+ description
+ "Non co-routed bidirectional association type";
+ }
+
+ identity resource-affinities-type {
+ description
+ "Base identity for resource affinities";
+ }
+
+ identity resource-aff-include-all {
+ base resource-affinities-type;
+ description
+ "The set of attribute filters associated with a
+ tunnel all of which must be present for a link
+ to be acceptable";
+ }
+
+ identity resource-aff-include-any {
+ base resource-affinities-type;
+ description
+ "The set of attribute filters associated with a
+ tunnel any of which must be present for a link
+ to be acceptable";
+ }
+
+ identity resource-aff-exclude-any {
+ base resource-affinities-type;
+ description
+ "The set of attribute filters associated with a
+ tunnel any of which renders a link unacceptable";
+ }
+
+ typedef admin-group {
+ type binary {
+ length 32;
+ }
+ description
+ "Administrative group/Resource class/Color.";
+ }
+
+ typedef extended-admin-group {
+ type binary;
+ description
+ "Extended administrative group/Resource class/Color.";
+ }
+
+ typedef admin-groups {
+ type union {
+ type admin-group;
+ type extended-admin-group;
+ }
+ description "TE administrative group derived type";
+ }
+
+ typedef srlg {
+ type uint32;
+ description "SRLG type";
+ }
+
+ identity path-computation-srlg-type {
+ description
+ "Base identity for SRLG path computation";
+ }
+
+ identity srlg-ignore {
+ base path-computation-srlg-type;
+ description
+ "Ignores SRLGs in path computation";
+ }
+
+ identity srlg-strict {
+ base path-computation-srlg-type;
+ description
+ "Include strict SRLG check in path computation";
+ }
+
+ identity srlg-preferred {
+ base path-computation-srlg-type;
+ description
+ "Include preferred SRLG check in path computation";
+ }
+
+ identity srlg-weighted {
+ base path-computation-srlg-type;
+ description
+ "Include weighted SRLG check in path computation";
+ }
+
+ typedef te-metric {
+ type uint32;
+ description
+ "TE link metric";
+ }
+
+ typedef topology-id {
+ type string {
+ pattern '/?([a-zA-Z0-9\-_.]+)(/[a-zA-Z0-9\-_.]+)*';
+ }
+ description
+ "An identifier for a topology.";
+ }
+
+ /**
+ * TE tunnel generic groupings
+ **/
+
+ /* Tunnel path selection parameters */
+ grouping tunnel-path-selection {
+ description
+ "Tunnel path selection properties grouping";
+ container path-selection {
+ description
+ "Tunnel path selection properties container";
+ leaf topology {
+ type te-types:topology-id;
+ description
+ "The tunnel path is computed using the specific
+ topology identified by this identifier";
+ }
+ leaf cost-limit {
+ type uint32 {
+ range "1..4294967295";
+ }
+ description
+ "The tunnel path cost limit.";
+ }
+ leaf hop-limit {
+ type uint8 {
+ range "1..255";
+ }
+ description
+ "The tunnel path hop limit.";
+ }
+ leaf metric-type {
+ type identityref {
+ base path-metric-type;
+ }
+ default path-metric-te;
+ description
+ "The tunnel path metric type.";
+ }
+ leaf tiebreaker-type {
+ type identityref {
+ base path-tiebreaker-type;
+ }
+ default path-tiebreaker-maxfill;
+ description
+ "The tunnel path computation tie breakers.";
+ }
+ leaf ignore-overload {
+ type boolean;
+ description
+ "The tunnel path can traverse overloaded node.";
+ }
+ uses tunnel-path-affinities;
+ uses tunnel-path-srlgs;
+ }
+ }
+
+ grouping tunnel-path-affinities {
+ description
+ "Path affinities grouping";
+ container tunnel-path-affinities {
+ if-feature named-path-affinities;
+ description
+ "Path affinities container";
+ choice style {
+ description
+ "Path affinities representation style";
+ case values {
+ leaf value {
+ type uint32 {
+ range "0..4294967295";
+ }
+ description
+ "Affinity value";
+ }
+ leaf mask {
+ type uint32 {
+ range "0..4294967295";
+ }
+ description
+ "Affinity mask";
+ }
+ }
+ case named {
+ list constraints {
+ key "usage";
+ leaf usage {
+ type identityref {
+ base resource-affinities-type;
+ }
+ description "Affinities usage";
+ }
+ container constraint {
+ description
+ "Container for named affinities";
+ list affinity-names {
+ key "name";
+ leaf name {
+ type string;
+ description
+ "Affinity name";
+ }
+ description
+ "List of named affinities";
+ }
+ }
+ description
+ "List of named affinity constraints";
+ }
+ }
+ }
+ }
+ }
+
+ grouping tunnel-path-srlgs {
+ description
+ "Path SRLG properties grouping";
+ container tunnel-path-srlgs {
+ description
+ "Path SRLG properties container";
+ choice style {
+ description
+ "Type of SRLG representation";
+ case values {
+ leaf usage {
+ type identityref {
+ base route-exclude-srlg;
+ }
+ description "SRLG usage";
+ }
+ leaf-list values {
+ type te-types:srlg;
+ description "SRLG value";
+ }
+ }
+ case named {
+ list constraints {
+ key "usage";
+ leaf usage {
+ type identityref {
+ base route-exclude-srlg;
+ }
+ description "SRLG usage";
+ }
+ container constraint {
+ description
+ "Container for named SRLG list";
+ list srlg-names {
+ key "name";
+ leaf name {
+ type string;
+ description
+ "The SRLG name";
+ }
+ description
+ "List named SRLGs";
+ }
+ }
+ description
+ "List of named SRLG constraints";
+ }
+ }
+ }
+ }
+ }
+
+ grouping tunnel-bidir-assoc-properties {
+ description
+ "TE tunnel associated bidirectional properties
+ grouping";
+ container bidirectional {
+ description
+ "TE tunnel associated bidirectional attributes.";
+ container association {
+ description
+ "Tunnel bidirectional association properties";
+ leaf id {
+ type uint16;
+ description
+ "The TE tunnel association identifier.";
+ }
+ leaf source {
+ type inet:ip-address;
+ description
+ "The TE tunnel association source.";
+ }
+ leaf global-source {
+ type inet:ip-address;
+ description
+ "The TE tunnel association global
+ source.";
+ }
+ leaf type {
+ type identityref {
+ base bidir-association-type;
+ }
+ default bidir-assoc-non-corouted;
+ description
+ "The TE tunnel association type.";
+ }
+ leaf provisioing {
+ type identityref {
+ base bidir-provisioning-mode;
+ }
+ description
+ "Describes the provisioning model of the
+ associated bidirectional LSP";
+ reference
+ "draft-ietf-teas-mpls-tp-rsvpte-ext-
+ associated-lsp, section-3.2";
+ }
+ }
+ }
+ }
+ /*** End of TE tunnel groupings ***/
+
+ /**
+ * TE interface generic groupings
+ **/
+ }
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-yang-types.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-yang-types.yang
new file mode 100644
index 0000000..bc248a6
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-ietf-yang-types.yang
@@ -0,0 +1,490 @@
+ module yms-ietf-yang-types {
+
+ yang-version 1;
+
+ namespace
+ "urn:ietf:params:xml:ns:yang:ietf-yang-types";
+
+ prefix yang;
+
+ organization
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netmod/>
+ WG List: <mailto:netmod@ietf.org>
+
+ WG Chair: David Kessens
+ <mailto:david.kessens@nsn.com>
+
+ WG Chair: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>
+
+ Editor: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>";
+
+ description
+ "This module contains a collection of generally useful derived
+ YANG data types.
+
+ Copyright (c) 2013 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of RFC 6991; see
+ the RFC itself for full legal notices.";
+
+ revision "2013-07-15" {
+ description
+ "This revision adds the following new data types:
+ - yang-identifier
+ - hex-string
+ - uuid
+ - dotted-quad";
+ reference
+ "RFC 6991: Common YANG Data Types";
+
+ }
+
+ revision "2010-09-24" {
+ description "Initial revision.";
+ reference
+ "RFC 6021: Common YANG Data Types";
+
+ }
+
+
+ typedef counter32 {
+ type uint32;
+ description
+ "The counter32 type represents a non-negative integer
+ that monotonically increases until it reaches a
+ maximum value of 2^32-1 (4294967295 decimal), when it
+ wraps around and starts increasing again from zero.
+
+ Counters have no defined 'initial' value, and thus, a
+ single value of a counter has (in general) no information
+ content. Discontinuities in the monotonically increasing
+ value normally occur at re-initialization of the
+ management system, and at other times as specified in the
+ description of a schema node using this type. If such
+ other times can occur, for example, the creation of
+ a schema node of type counter32 at times other than
+ re-initialization, then a corresponding schema node
+ should be defined, with an appropriate type, to indicate
+ the last discontinuity.
+
+ The counter32 type should not be used for configuration
+ schema nodes. A default statement SHOULD NOT be used in
+ combination with the type counter32.
+
+ In the value set and its semantics, this type is equivalent
+ to the Counter32 type of the SMIv2.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2
+ (SMIv2)";
+
+ }
+
+ typedef zero-based-counter32 {
+ type counter32;
+ default "0";
+ description
+ "The zero-based-counter32 type represents a counter32
+ that has the defined 'initial' value zero.
+
+ A schema node of this type will be set to zero (0) on creation
+ and will thereafter increase monotonically until it reaches
+ a maximum value of 2^32-1 (4294967295 decimal), when it
+ wraps around and starts increasing again from zero.
+
+ Provided that an application discovers a new schema node
+ of this type within the minimum time to wrap, it can use the
+ 'initial' value as a delta. It is important for a management
+ station to be aware of this minimum time and the actual time
+ between polls, and to discard data if the actual time is too
+ long or there is no defined minimum time.
+
+ In the value set and its semantics, this type is equivalent
+ to the ZeroBasedCounter32 textual convention of the SMIv2.";
+ reference
+ "RFC 4502: Remote Network Monitoring Management Information
+ Base Version 2";
+
+ }
+
+ typedef counter64 {
+ type uint64;
+ description
+ "The counter64 type represents a non-negative integer
+ that monotonically increases until it reaches a
+ maximum value of 2^64-1 (18446744073709551615 decimal),
+ when it wraps around and starts increasing again from zero.
+
+ Counters have no defined 'initial' value, and thus, a
+ single value of a counter has (in general) no information
+ content. Discontinuities in the monotonically increasing
+ value normally occur at re-initialization of the
+ management system, and at other times as specified in the
+ description of a schema node using this type. If such
+ other times can occur, for example, the creation of
+ a schema node of type counter64 at times other than
+ re-initialization, then a corresponding schema node
+ should be defined, with an appropriate type, to indicate
+ the last discontinuity.
+
+ The counter64 type should not be used for configuration
+ schema nodes. A default statement SHOULD NOT be used in
+ combination with the type counter64.
+
+ In the value set and its semantics, this type is equivalent
+ to the Counter64 type of the SMIv2.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2
+ (SMIv2)";
+
+ }
+
+ typedef zero-based-counter64 {
+ type counter64;
+ default "0";
+ description
+ "The zero-based-counter64 type represents a counter64 that
+ has the defined 'initial' value zero.
+
+
+
+
+ A schema node of this type will be set to zero (0) on creation
+ and will thereafter increase monotonically until it reaches
+ a maximum value of 2^64-1 (18446744073709551615 decimal),
+ when it wraps around and starts increasing again from zero.
+
+ Provided that an application discovers a new schema node
+ of this type within the minimum time to wrap, it can use the
+ 'initial' value as a delta. It is important for a management
+ station to be aware of this minimum time and the actual time
+ between polls, and to discard data if the actual time is too
+ long or there is no defined minimum time.
+
+ In the value set and its semantics, this type is equivalent
+ to the ZeroBasedCounter64 textual convention of the SMIv2.";
+ reference
+ "RFC 2856: Textual Conventions for Additional High Capacity
+ Data Types";
+
+ }
+
+ typedef gauge32 {
+ type uint32;
+ description
+ "The gauge32 type represents a non-negative integer, which
+ may increase or decrease, but shall never exceed a maximum
+ value, nor fall below a minimum value. The maximum value
+ cannot be greater than 2^32-1 (4294967295 decimal), and
+ the minimum value cannot be smaller than 0. The value of
+ a gauge32 has its maximum value whenever the information
+ being modeled is greater than or equal to its maximum
+ value, and has its minimum value whenever the information
+ being modeled is smaller than or equal to its minimum value.
+ If the information being modeled subsequently decreases
+ below (increases above) the maximum (minimum) value, the
+ gauge32 also decreases (increases).
+
+ In the value set and its semantics, this type is equivalent
+ to the Gauge32 type of the SMIv2.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2
+ (SMIv2)";
+
+ }
+
+ typedef gauge64 {
+ type uint64;
+ description
+ "The gauge64 type represents a non-negative integer, which
+ may increase or decrease, but shall never exceed a maximum
+ value, nor fall below a minimum value. The maximum value
+ cannot be greater than 2^64-1 (18446744073709551615), and
+ the minimum value cannot be smaller than 0. The value of
+ a gauge64 has its maximum value whenever the information
+ being modeled is greater than or equal to its maximum
+ value, and has its minimum value whenever the information
+ being modeled is smaller than or equal to its minimum value.
+ If the information being modeled subsequently decreases
+ below (increases above) the maximum (minimum) value, the
+ gauge64 also decreases (increases).
+
+ In the value set and its semantics, this type is equivalent
+ to the CounterBasedGauge64 SMIv2 textual convention defined
+ in RFC 2856";
+ reference
+ "RFC 2856: Textual Conventions for Additional High Capacity
+ Data Types";
+
+ }
+
+ typedef object-identifier {
+ type string {
+ pattern
+ '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))(\.(0|([1-9]\d*)))*';
+ }
+ description
+ "The object-identifier type represents administratively
+ assigned names in a registration-hierarchical-name tree.
+
+ Values of this type are denoted as a sequence of numerical
+ non-negative sub-identifier values. Each sub-identifier
+ value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers
+ are separated by single dots and without any intermediate
+ whitespace.
+
+ The ASN.1 standard restricts the value space of the first
+ sub-identifier to 0, 1, or 2. Furthermore, the value space
+ of the second sub-identifier is restricted to the range
+ 0 to 39 if the first sub-identifier is 0 or 1. Finally,
+ the ASN.1 standard requires that an object identifier
+ has always at least two sub-identifiers. The pattern
+ captures these restrictions.
+
+ Although the number of sub-identifiers is not limited,
+ module designers should realize that there may be
+ implementations that stick with the SMIv2 limit of 128
+ sub-identifiers.
+
+ This type is a superset of the SMIv2 OBJECT IDENTIFIER type
+ since it is not restricted to 128 sub-identifiers. Hence,
+ this type SHOULD NOT be used to represent the SMIv2 OBJECT
+ IDENTIFIER type; the object-identifier-128 type SHOULD be
+ used instead.";
+ reference
+ "ISO9834-1: Information technology -- Open Systems
+ Interconnection -- Procedures for the operation of OSI
+ Registration Authorities: General procedures and top
+ arcs of the ASN.1 Object Identifier tree";
+
+ }
+
+ typedef object-identifier-128 {
+ type object-identifier {
+ pattern '\d*(\.\d*){1,127}';
+ }
+ description
+ "This type represents object-identifiers restricted to 128
+ sub-identifiers.
+
+ In the value set and its semantics, this type is equivalent
+ to the OBJECT IDENTIFIER type of the SMIv2.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2
+ (SMIv2)";
+
+ }
+
+ typedef yang-identifier {
+ type string {
+ length "1..max";
+ pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
+ pattern
+ '.|..|[^xX].*|.[^mM].*|..[^lL].*';
+ }
+ description
+ "A YANG identifier string as defined by the 'identifier'
+ rule in Section 12 of RFC 6020. An identifier must
+ start with an alphabetic character or an underscore
+ followed by an arbitrary sequence of alphabetic or
+ numeric characters, underscores, hyphens, or dots.
+
+ A YANG identifier MUST NOT start with any possible
+ combination of the lowercase or uppercase character
+ sequence 'xml'.";
+ reference
+ "RFC 6020: YANG - A Data Modeling Language for the Network
+ Configuration Protocol (NETCONF)";
+
+ }
+
+ typedef date-and-time {
+ type string {
+ pattern
+ '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-]\d{2}:\d{2})';
+ }
+ description
+ "The date-and-time type is a profile of the ISO 8601
+ standard for representation of dates and times using the
+ Gregorian calendar. The profile is defined by the
+ date-time production in Section 5.6 of RFC 3339.
+
+ The date-and-time type is compatible with the dateTime XML
+ schema type with the following notable exceptions:
+
+ (a) The date-and-time type does not allow negative years.
+
+ (b) The date-and-time time-offset -00:00 indicates an unknown
+ time zone (see RFC 3339) while -00:00 and +00:00 and Z
+ all represent the same time zone in dateTime.
+
+ (c) The canonical format (see below) of data-and-time values
+ differs from the canonical format used by the dateTime XML
+ schema type, which requires all times to be in UTC using
+ the time-offset 'Z'.
+
+ This type is not equivalent to the DateAndTime textual
+ convention of the SMIv2 since RFC 3339 uses a different
+ separator between full-date and full-time and provides
+ higher resolution of time-secfrac.
+
+ The canonical format for date-and-time values with a known time
+ zone uses a numeric time zone offset that is calculated using
+ the device's configured known offset to UTC time. A change of
+ the device's offset to UTC time will cause date-and-time values
+ to change accordingly. Such changes might happen periodically
+ in case a server follows automatically daylight saving time
+ (DST) time zone offset changes. The canonical format for
+ date-and-time values with an unknown time zone (usually
+ referring to the notion of local time) uses the time-offset
+ -00:00.";
+ reference
+ "RFC 3339: Date and Time on the Internet: Timestamps
+ RFC 2579: Textual Conventions for SMIv2
+ XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
+
+ }
+
+ typedef timeticks {
+ type uint32;
+ description
+ "The timeticks type represents a non-negative integer that
+ represents the time, modulo 2^32 (4294967296 decimal), in
+ hundredths of a second between two epochs. When a schema
+ node is defined that uses this type, the description of
+ the schema node identifies both of the reference epochs.
+
+ In the value set and its semantics, this type is equivalent
+ to the TimeTicks type of the SMIv2.";
+ reference
+ "RFC 2578: Structure of Management Information Version 2
+ (SMIv2)";
+
+ }
+
+ typedef timestamp {
+ type timeticks;
+ description
+ "The timestamp type represents the value of an associated
+ timeticks schema node at which a specific occurrence
+ happened. The specific occurrence must be defined in the
+ description of any schema node defined using this type. When
+ the specific occurrence occurred prior to the last time the
+ associated timeticks attribute was zero, then the timestamp
+ value is zero. Note that this requires all timestamp values
+ to be reset to zero when the value of the associated timeticks
+ attribute reaches 497+ days and wraps around to zero.
+
+ The associated timeticks schema node must be specified
+ in the description of any schema node using this type.
+
+ In the value set and its semantics, this type is equivalent
+ to the TimeStamp textual convention of the SMIv2.";
+ reference
+ "RFC 2579: Textual Conventions for SMIv2";
+
+ }
+
+ typedef phys-address {
+ type string {
+ pattern
+ '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
+ }
+ description
+ "Represents media- or physical-level addresses represented
+ as a sequence octets, each octet represented by two hexadecimal
+ numbers. Octets are separated by colons. The canonical
+ representation uses lowercase characters.
+
+ In the value set and its semantics, this type is equivalent
+ to the PhysAddress textual convention of the SMIv2.";
+ reference
+ "RFC 2579: Textual Conventions for SMIv2";
+
+ }
+
+ typedef mac-address {
+ type string {
+ pattern
+ '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
+ }
+ description
+ "The mac-address type represents an IEEE 802 MAC address.
+ The canonical representation uses lowercase characters.
+
+ In the value set and its semantics, this type is equivalent
+ to the MacAddress textual convention of the SMIv2.";
+ reference
+ "IEEE 802: IEEE Standard for Local and Metropolitan Area
+ Networks: Overview and Architecture
+ RFC 2579: Textual Conventions for SMIv2";
+
+ }
+
+ typedef xpath1.0 {
+ type string;
+ description
+ "This type represents an XPATH 1.0 expression.
+
+ When a schema node is defined that uses this type, the
+ description of the schema node MUST specify the XPath
+ context in which the XPath expression is evaluated.";
+ reference
+ "XPATH: XML Path Language (XPath) Version 1.0";
+
+ }
+
+ typedef hex-string {
+ type string {
+ pattern
+ '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
+ }
+ description
+ "A hexadecimal string with octets represented as hex digits
+ separated by colons. The canonical representation uses
+ lowercase characters.";
+ }
+
+ typedef uuid {
+ type string {
+ pattern
+ '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
+ }
+ description
+ "A Universally Unique IDentifier in the string representation
+ defined in RFC 4122. The canonical representation uses
+ lowercase characters.
+
+ The following is an example of a UUID in string representation:
+ f81d4fae-7dec-11d0-a765-00a0c91e6bf6
+ ";
+ reference
+ "RFC 4122: A Universally Unique IDentifier (UUID) URN
+ Namespace";
+
+ }
+
+ typedef dotted-quad {
+ type string {
+ pattern
+ '(([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])';
+ }
+ description
+ "An unsigned 32-bit number expressed in the dotted-quad
+ notation, i.e., four octets written as decimal numbers
+ and separated with the '.' (full stop) character.";
+ }
+ } // module ietf-yang-types
+
diff --git a/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-network-topology.yang b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-network-topology.yang
new file mode 100644
index 0000000..4700365
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ydtTestYangFiles/yms-network-topology.yang
@@ -0,0 +1,304 @@
+ module yms-network-topology {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";
+ prefix lnk;
+
+ import yms-ietf-inet-types {
+ prefix inet;
+ }
+ import yms-ietf-network {
+ prefix nd;
+ }
+
+ organization
+ "IETF I2RS (Interface to the Routing System) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/i2rs/>
+ WG List: <mailto:i2rs@ietf.org>
+
+ WG Chair: Susan Hares
+ <mailto:shares@ndzh.com>
+
+ WG Chair: Jeffrey Haas
+ <mailto:jhaas@pfrc.org>
+
+ Editor: Alexander Clemm
+ <mailto:alex@cisco.com>
+
+ Editor: Jan Medved
+ <mailto:jmedved@cisco.com>
+
+ Editor: Robert Varga
+ <mailto:rovarga@cisco.com>
+
+ Editor: Tony Tkacik
+ <mailto:ttkacik@cisco.com>
+
+ Editor: Nitin Bahadur
+ <mailto:nitin_bahadur@yahoo.com>
+
+ Editor: Hariharan Ananthakrishnan
+ <mailto:hari@packetdesign.com>";
+
+ description
+ "This module defines a common base model for network topology,
+ augmenting the base network model with links to connect nodes,
+ as well as termination points to terminate links on nodes.
+
+ Copyright (c) 2015 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of
+ draft-ietf-i2rs-yang-network-topo-02;
+ see the RFC itself for full legal notices.
+
+ NOTE TO RFC EDITOR: Please replace above reference to
+ draft-ietf-i2rs-yang-network-topo-02 with RFC
+ number when published (i.e. RFC xxxx).";
+
+ revision 2015-12-08 {
+ description
+ "Initial revision.
+ NOTE TO RFC EDITOR: Please replace the following reference
+ to draft-ietf-i2rs-yang-network-topo-02 with
+ RFC number when published (i.e. RFC xxxx).";
+ reference
+ "draft-ietf-i2rs-yang-network-topo-02.";
+ }
+
+ typedef link-id {
+ type inet:uri;
+ description
+ "An identifier for a link in a topology.
+ The identifier SHOULD be chosen such that the same link in a
+ real network topology will always be identified through the
+ same identifier, even if the model is instantiated in
+ separate datastores. An implementation MAY choose to capture
+ semantics in the identifier, for example to indicate the type
+ of link and/or the type of topology that the link is a part
+ of.";
+ }
+
+ typedef tp-id {
+ type inet:uri;
+ description
+ "An identifier for termination points on a node.
+ The identifier SHOULD be chosen such that the same TP in a
+ real network topology will always be identified through the
+ same identifier, even if the model is instantiated in
+ separate datastores. An implementation MAY choose to capture
+ semantics in the identifier, for example to indicate the type
+ of TP and/or the type of node and topology that the TP is a
+ part of.";
+ }
+ grouping link-ref {
+ description
+ "References a link in a specific network.";
+ leaf link-ref {
+ type leafref {
+ path "/nd:networks/nd:network[nd:network-id=current()/../"+
+ "network-ref]/lnk:link/lnk:link-id";
+ require-instance false;
+ }
+ description
+ "A type for an absolute reference a link instance.
+ (This type should not be used for relative references.
+ In such a case, a relative path should be used instead.)";
+ }
+ uses nd:network-ref;
+ }
+
+ grouping tp-ref {
+ description
+ "References a termination point in a specific node.";
+ leaf tp-ref {
+ type leafref {
+ path "/nd:networks/nd:network[nd:network-id=current()/../"+
+ "network-ref]/nd:node[nd:node-id=current()/../"+
+ "node-ref]/lnk:t-point/lnk:tp-id";
+ require-instance false;
+ }
+ description
+ "A type for an absolute reference to a termination point.
+ (This type should not be used for relative references.
+ In such a case, a relative path should be used instead.)";
+ }
+ uses nd:node-ref;
+ }
+
+ augment "/nd:networks/nd:network" {
+ description
+ "Add links to the network model.";
+ list link {
+ key "link-id";
+ description
+ "A Network Link connects a by Local (Source) node and
+ a Remote (Destination) Network Nodes via a set of the
+ nodes' termination points.
+ As it is possible to have several links between the same
+ source and destination nodes, and as a link could
+ potentially be re-homed between termination points, to
+ ensure that we would always know to distinguish between
+ links, every link is identified by a dedicated link
+ identifier.
+ Note that a link models a point-to-point link, not a
+ multipoint link.
+ Layering dependencies on links in underlay topologies are
+ not represented as the layering information of nodes and of
+ termination points is sufficient.";
+ container source {
+ description
+ "This container holds the logical source of a particular
+ link.";
+ leaf source-node {
+ type leafref {
+ path "../../../nd:node/nd:node-id";
+ }
+ mandatory true;
+ description
+ "Source node identifier, must be in same topology.";
+ }
+ leaf source-tp {
+ type leafref {
+ path "../../../nd:node[nd:node-id=current()/../"+
+ "source-node]/t-point/tp-id";
+ }
+ description
+ "Termination point within source node that terminates
+ the link.";
+ }
+ }
+ container destination {
+ description
+ "This container holds the logical destination of a
+ particular link.";
+ leaf dest-node {
+ type leafref {
+ path "../../../nd:node/nd:node-id";
+ }
+ mandatory true;
+ description
+ "Destination node identifier, must be in the same
+ network.";
+ }
+ leaf dest-tp {
+ type leafref {
+ path "../../../nd:node[nd:node-id=current()/../"+
+ "dest-node]/t-point/tp-id";
+ }
+ description
+ "Termination point within destination node that
+ terminates the link.";
+ }
+ }
+ leaf link-id {
+ type link-id;
+ description
+ "The identifier of a link in the topology.
+ A link is specific to a topology to which it belongs.";
+ }
+ list supporting-link {
+ key "network-ref link-ref";
+ description
+ "Identifies the link, or links, that this link
+ is dependent on.";
+ leaf network-ref {
+ type leafref {
+ path "../../../nd:supporting-network/nd:network-ref";
+ require-instance false;
+ }
+ description
+ "This leaf identifies in which underlay topology
+ supporting link is present.";
+ }
+ leaf link-ref {
+ type leafref {
+ path "/nd:networks/nd:network[nd:network-id=current()/"+
+ "../network-ref]/link/link-id";
+ require-instance false;
+ }
+ description
+ "This leaf identifies a link which is a part
+ of this link's underlay. Reference loops, in which
+ a link identifies itself as its underlay, either
+ directly or transitively, are not allowed.";
+ }
+ }
+ }
+
+ leaf link-id {
+ type link-id;
+ description
+ "The identifier of a link in the topology.
+ A link is specific to a topology to which it belongs.";
+ }
+ }
+ augment "/nd:networks/nd:network/nd:node" {
+ description
+ "Augment termination points which terminate links.
+ Termination points can ultimately be mapped to interfaces.";
+ list t-point {
+ key "tp-id";
+ description
+ "A termination point can terminate a link.
+ Depending on the type of topology, a termination point
+ could, for example, refer to a port or an interface.";
+ leaf tp-id {
+ type tp-id;
+ description
+ "Termination point identifier.";
+ }
+ list supporting-termination-point {
+ key "network-ref node-ref tp-ref";
+ description
+ "The leaf list identifies any termination points that
+ the termination point is dependent on, or maps onto.
+ Those termination points will themselves be contained
+ in a supporting node.
+ This dependency information can be inferred from
+ the dependencies between links. For this reason,
+ this item is not separately configurable. Hence no
+ corresponding constraint needs to be articulated.
+ The corresponding information is simply provided by the
+ implementing system.";
+ leaf network-ref {
+ type leafref {
+ path "../../../nd:supporting-node/nd:network-ref";
+ require-instance false;
+ }
+ description
+ "This leaf identifies in which topology the
+ supporting termination point is present.";
+ }
+ leaf node-ref {
+ type leafref {
+ path "../../../nd:supporting-node/nd:node-ref";
+ require-instance false;
+ }
+ description
+ "This leaf identifies in which node the supporting
+ termination point is present.";
+ }
+ leaf tp-ref {
+ type leafref {
+ path "/nd:networks/nd:network[nd:network-id=current()/"+
+ "../network-ref]/nd:node[nd:node-id=current()/../"+
+ "node-ref]/t-point/tp-id";
+ require-instance false;
+ }
+ description
+ "Reference to the underlay node, must be in a
+ different topology";
+ }
+ }
+ }
+ }
+ }
diff --git a/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/norev.yang b/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/norev.yang
new file mode 100644
index 0000000..23eaaba
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/norev.yang
@@ -0,0 +1,85 @@
+ module ietf-network4 {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network4";
+ prefix nd;
+
+ organization
+ "IETF I2RS (Interface to the Routing System) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/i2rs/>
+ WG List: <mailto:i2rs@ietf.org>
+
+ WG Chair: Susan Hares
+ <mailto:shares@ndzh.com>
+
+ WG Chair: Jeffrey Haas
+ <mailto:jhaas@pfrc.org>
+
+ Editor: Alexander Clemm
+ <mailto:alex@cisco.com>
+
+ Editor: Jan Medved
+ <mailto:jmedved@cisco.com>
+
+ Editor: Robert Varga
+ <mailto:rovarga@cisco.com>
+
+ Editor: Tony Tkacik
+ <mailto:ttkacik@cisco.com>
+
+ Editor: Nitin Bahadur
+ <mailto:nitin_bahadur@yahoo.com>
+
+ Editor: Hariharan Ananthakrishnan
+ <mailto:hari@packetdesign.com>";
+
+ description
+ "This module defines a common base model for a collection
+ of nodes in a network. Node definitions are further used
+ in network topologies and inventories.
+
+ Copyright (c) 2015 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of
+ draft-ietf-i2rs-yang-network-topo-02;
+ see the RFC itself for full legal notices.
+
+ NOTE TO RFC EDITOR: Please replace above reference to
+ draft-ietf-i2rs-yang-network-topo-02 with RFC
+ number when published (i.e. RFC xxxx).";
+
+ notification network-up {
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+ }
+ notification network-down {
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+ }
+
+}
diff --git a/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/withrev.yang b/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/withrev.yang
new file mode 100644
index 0000000..ab0cffa
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/withrev.yang
@@ -0,0 +1,95 @@
+ module ietf-network4 {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network4";
+ prefix nd;
+
+ organization
+ "IETF I2RS (Interface to the Routing System) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/i2rs/>
+ WG List: <mailto:i2rs@ietf.org>
+
+ WG Chair: Susan Hares
+ <mailto:shares@ndzh.com>
+
+ WG Chair: Jeffrey Haas
+ <mailto:jhaas@pfrc.org>
+
+ Editor: Alexander Clemm
+ <mailto:alex@cisco.com>
+
+ Editor: Jan Medved
+ <mailto:jmedved@cisco.com>
+
+ Editor: Robert Varga
+ <mailto:rovarga@cisco.com>
+
+ Editor: Tony Tkacik
+ <mailto:ttkacik@cisco.com>
+
+ Editor: Nitin Bahadur
+ <mailto:nitin_bahadur@yahoo.com>
+
+ Editor: Hariharan Ananthakrishnan
+ <mailto:hari@packetdesign.com>";
+
+ description
+ "This module defines a common base model for a collection
+ of nodes in a network. Node definitions are further used
+ in network topologies and inventories.
+
+ Copyright (c) 2015 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of
+ draft-ietf-i2rs-yang-network-topo-02;
+ see the RFC itself for full legal notices.
+
+ NOTE TO RFC EDITOR: Please replace above reference to
+ draft-ietf-i2rs-yang-network-topo-02 with RFC
+ number when published (i.e. RFC xxxx).";
+
+ revision 2015-12-08 {
+ description
+ "Initial revision.
+ NOTE TO RFC EDITOR: Please replace the following reference
+ to draft-ietf-i2rs-yang-network-topo-02 with
+ RFC number when published (i.e. RFC xxxx).";
+ reference
+ "draft-ietf-i2rs-yang-network-topo-02";
+ }
+
+ notification network-up {
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+ }
+ notification network-down {
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+ }
+
+}
diff --git a/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/withrev2.yang b/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/withrev2.yang
new file mode 100644
index 0000000..f7c9a16
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/withrev2.yang
@@ -0,0 +1,95 @@
+ module ietf-network4 {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network4";
+ prefix nd;
+
+ organization
+ "IETF I2RS (Interface to the Routing System) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/i2rs/>
+ WG List: <mailto:i2rs@ietf.org>
+
+ WG Chair: Susan Hares
+ <mailto:shares@ndzh.com>
+
+ WG Chair: Jeffrey Haas
+ <mailto:jhaas@pfrc.org>
+
+ Editor: Alexander Clemm
+ <mailto:alex@cisco.com>
+
+ Editor: Jan Medved
+ <mailto:jmedved@cisco.com>
+
+ Editor: Robert Varga
+ <mailto:rovarga@cisco.com>
+
+ Editor: Tony Tkacik
+ <mailto:ttkacik@cisco.com>
+
+ Editor: Nitin Bahadur
+ <mailto:nitin_bahadur@yahoo.com>
+
+ Editor: Hariharan Ananthakrishnan
+ <mailto:hari@packetdesign.com>";
+
+ description
+ "This module defines a common base model for a collection
+ of nodes in a network. Node definitions are further used
+ in network topologies and inventories.
+
+ Copyright (c) 2015 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of
+ draft-ietf-i2rs-yang-network-topo-02;
+ see the RFC itself for full legal notices.
+
+ NOTE TO RFC EDITOR: Please replace above reference to
+ draft-ietf-i2rs-yang-network-topo-02 with RFC
+ number when published (i.e. RFC xxxx).";
+
+ revision 2016-12-08 {
+ description
+ "Initial revision.
+ NOTE TO RFC EDITOR: Please replace the following reference
+ to draft-ietf-i2rs-yang-network-topo-02 with
+ RFC number when published (i.e. RFC xxxx).";
+ reference
+ "draft-ietf-i2rs-yang-network-topo-02";
+ }
+
+ notification network-up {
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+ }
+ notification network-down {
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+ }
+
+}
diff --git a/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/withrev3.yang b/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/withrev3.yang
new file mode 100644
index 0000000..f4abc06
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/withrev3.yang
@@ -0,0 +1,95 @@
+ module ietf-network4 {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network4";
+ prefix nd;
+
+ organization
+ "IETF I2RS (Interface to the Routing System) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/i2rs/>
+ WG List: <mailto:i2rs@ietf.org>
+
+ WG Chair: Susan Hares
+ <mailto:shares@ndzh.com>
+
+ WG Chair: Jeffrey Haas
+ <mailto:jhaas@pfrc.org>
+
+ Editor: Alexander Clemm
+ <mailto:alex@cisco.com>
+
+ Editor: Jan Medved
+ <mailto:jmedved@cisco.com>
+
+ Editor: Robert Varga
+ <mailto:rovarga@cisco.com>
+
+ Editor: Tony Tkacik
+ <mailto:ttkacik@cisco.com>
+
+ Editor: Nitin Bahadur
+ <mailto:nitin_bahadur@yahoo.com>
+
+ Editor: Hariharan Ananthakrishnan
+ <mailto:hari@packetdesign.com>";
+
+ description
+ "This module defines a common base model for a collection
+ of nodes in a network. Node definitions are further used
+ in network topologies and inventories.
+
+ Copyright (c) 2015 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of
+ draft-ietf-i2rs-yang-network-topo-02;
+ see the RFC itself for full legal notices.
+
+ NOTE TO RFC EDITOR: Please replace above reference to
+ draft-ietf-i2rs-yang-network-topo-02 with RFC
+ number when published (i.e. RFC xxxx).";
+
+ revision 2014-12-08 {
+ description
+ "Initial revision.
+ NOTE TO RFC EDITOR: Please replace the following reference
+ to draft-ietf-i2rs-yang-network-topo-02 with
+ RFC number when published (i.e. RFC xxxx).";
+ reference
+ "draft-ietf-i2rs-yang-network-topo-02";
+ }
+
+ notification network-up {
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+ }
+ notification network-down {
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+ }
+
+}
diff --git a/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/withrev4.yang b/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/withrev4.yang
new file mode 100644
index 0000000..9352fb4
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ysrTestYangFiles/multiRevisions/withrev4.yang
@@ -0,0 +1,76 @@
+ module ietf-network4 {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network4";
+ prefix nd;
+
+ organization
+ "IETF I2RS (Interface to the Routing System) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/i2rs/>
+ WG List: <mailto:i2rs@ietf.org>
+
+ WG Chair: Susan Hares
+ <mailto:shares@ndzh.com>
+
+ WG Chair: Jeffrey Haas
+ <mailto:jhaas@pfrc.org>
+
+ Editor: Alexander Clemm
+ <mailto:alex@cisco.com>
+
+ Editor: Jan Medved
+ <mailto:jmedved@cisco.com>
+
+ Editor: Robert Varga
+ <mailto:rovarga@cisco.com>
+
+ Editor: Tony Tkacik
+ <mailto:ttkacik@cisco.com>
+
+ Editor: Nitin Bahadur
+ <mailto:nitin_bahadur@yahoo.com>
+
+ Editor: Hariharan Ananthakrishnan
+ <mailto:hari@packetdesign.com>";
+
+ description
+ "This module defines a common base model for a collection
+ of nodes in a network. Node definitions are further used
+ in network topologies and inventories.
+
+ Copyright (c) 2015 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of
+ draft-ietf-i2rs-yang-network-topo-02;
+ see the RFC itself for full legal notices.
+
+ NOTE TO RFC EDITOR: Please replace above reference to
+ draft-ietf-i2rs-yang-network-topo-02 with RFC
+ number when published (i.e. RFC xxxx).";
+
+ revision 2017-12-08 {
+ description
+ "Initial revision.
+ NOTE TO RFC EDITOR: Please replace the following reference
+ to draft-ietf-i2rs-yang-network-topo-02 with
+ RFC number when published (i.e. RFC xxxx).";
+ reference
+ "draft-ietf-i2rs-yang-network-topo-02";
+ }
+
+ container network {
+ leaf ip {
+ type int32;
+ }
+ }
+
+}
diff --git a/apps/yms/ut/src/test/resources/ysrTestYangFiles/withNotification/ysr1.yang b/apps/yms/ut/src/test/resources/ysrTestYangFiles/withNotification/ysr1.yang
new file mode 100644
index 0000000..a58e99d
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ysrTestYangFiles/withNotification/ysr1.yang
@@ -0,0 +1,95 @@
+ module ietf-network1 {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network1";
+ prefix nd;
+
+ organization
+ "IETF I2RS (Interface to the Routing System) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/i2rs/>
+ WG List: <mailto:i2rs@ietf.org>
+
+ WG Chair: Susan Hares
+ <mailto:shares@ndzh.com>
+
+ WG Chair: Jeffrey Haas
+ <mailto:jhaas@pfrc.org>
+
+ Editor: Alexander Clemm
+ <mailto:alex@cisco.com>
+
+ Editor: Jan Medved
+ <mailto:jmedved@cisco.com>
+
+ Editor: Robert Varga
+ <mailto:rovarga@cisco.com>
+
+ Editor: Tony Tkacik
+ <mailto:ttkacik@cisco.com>
+
+ Editor: Nitin Bahadur
+ <mailto:nitin_bahadur@yahoo.com>
+
+ Editor: Hariharan Ananthakrishnan
+ <mailto:hari@packetdesign.com>";
+
+ description
+ "This module defines a common base model for a collection
+ of nodes in a network. Node definitions are further used
+ in network topologies and inventories.
+
+ Copyright (c) 2015 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of
+ draft-ietf-i2rs-yang-network-topo-02;
+ see the RFC itself for full legal notices.
+
+ NOTE TO RFC EDITOR: Please replace above reference to
+ draft-ietf-i2rs-yang-network-topo-02 with RFC
+ number when published (i.e. RFC xxxx).";
+
+ revision 2015-12-08 {
+ description
+ "Initial revision.
+ NOTE TO RFC EDITOR: Please replace the following reference
+ to draft-ietf-i2rs-yang-network-topo-02 with
+ RFC number when published (i.e. RFC xxxx).";
+ reference
+ "draft-ietf-i2rs-yang-network-topo-02";
+ }
+
+ notification network-up {
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+ }
+ notification network-down {
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+ }
+
+}
diff --git a/apps/yms/ut/src/test/resources/ysrTestYangFiles/withNotification/ysr2.yang b/apps/yms/ut/src/test/resources/ysrTestYangFiles/withNotification/ysr2.yang
new file mode 100644
index 0000000..c241068
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ysrTestYangFiles/withNotification/ysr2.yang
@@ -0,0 +1,95 @@
+ module ietf-network2 {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network2";
+ prefix nd;
+
+ organization
+ "IETF I2RS (Interface to the Routing System) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/i2rs/>
+ WG List: <mailto:i2rs@ietf.org>
+
+ WG Chair: Susan Hares
+ <mailto:shares@ndzh.com>
+
+ WG Chair: Jeffrey Haas
+ <mailto:jhaas@pfrc.org>
+
+ Editor: Alexander Clemm
+ <mailto:alex@cisco.com>
+
+ Editor: Jan Medved
+ <mailto:jmedved@cisco.com>
+
+ Editor: Robert Varga
+ <mailto:rovarga@cisco.com>
+
+ Editor: Tony Tkacik
+ <mailto:ttkacik@cisco.com>
+
+ Editor: Nitin Bahadur
+ <mailto:nitin_bahadur@yahoo.com>
+
+ Editor: Hariharan Ananthakrishnan
+ <mailto:hari@packetdesign.com>";
+
+ description
+ "This module defines a common base model for a collection
+ of nodes in a network. Node definitions are further used
+ in network topologies and inventories.
+
+ Copyright (c) 2015 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of
+ draft-ietf-i2rs-yang-network-topo-02;
+ see the RFC itself for full legal notices.
+
+ NOTE TO RFC EDITOR: Please replace above reference to
+ draft-ietf-i2rs-yang-network-topo-02 with RFC
+ number when published (i.e. RFC xxxx).";
+
+ revision 2015-12-08 {
+ description
+ "Initial revision.
+ NOTE TO RFC EDITOR: Please replace the following reference
+ to draft-ietf-i2rs-yang-network-topo-02 with
+ RFC number when published (i.e. RFC xxxx).";
+ reference
+ "draft-ietf-i2rs-yang-network-topo-02";
+ }
+
+ notification network-up {
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+ }
+ notification network-down {
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+ }
+
+}
diff --git a/apps/yms/ut/src/test/resources/ysrTestYangFiles/withoutNotification/ysr3.yang b/apps/yms/ut/src/test/resources/ysrTestYangFiles/withoutNotification/ysr3.yang
new file mode 100644
index 0000000..0e86062
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ysrTestYangFiles/withoutNotification/ysr3.yang
@@ -0,0 +1,81 @@
+ module ietf-network3 {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network3";
+ prefix nd;
+
+ organization
+ "IETF I2RS (Interface to the Routing System) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/i2rs/>
+ WG List: <mailto:i2rs@ietf.org>
+
+ WG Chair: Susan Hares
+ <mailto:shares@ndzh.com>
+
+ WG Chair: Jeffrey Haas
+ <mailto:jhaas@pfrc.org>
+
+ Editor: Alexander Clemm
+ <mailto:alex@cisco.com>
+
+ Editor: Jan Medved
+ <mailto:jmedved@cisco.com>
+
+ Editor: Robert Varga
+ <mailto:rovarga@cisco.com>
+
+ Editor: Tony Tkacik
+ <mailto:ttkacik@cisco.com>
+
+ Editor: Nitin Bahadur
+ <mailto:nitin_bahadur@yahoo.com>
+
+ Editor: Hariharan Ananthakrishnan
+ <mailto:hari@packetdesign.com>";
+
+ description
+ "This module defines a common base model for a collection
+ of nodes in a network. Node definitions are further used
+ in network topologies and inventories.
+
+ Copyright (c) 2015 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of
+ draft-ietf-i2rs-yang-network-topo-02;
+ see the RFC itself for full legal notices.
+
+ NOTE TO RFC EDITOR: Please replace above reference to
+ draft-ietf-i2rs-yang-network-topo-02 with RFC
+ number when published (i.e. RFC xxxx).";
+
+ revision 2015-12-08 {
+ description
+ "Initial revision.
+ NOTE TO RFC EDITOR: Please replace the following reference
+ to draft-ietf-i2rs-yang-network-topo-02 with
+ RFC number when published (i.e. RFC xxxx).";
+ reference
+ "draft-ietf-i2rs-yang-network-topo-02";
+ }
+
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+
+}
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbAugmentForRpcInput.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbAugmentForRpcInput.yang
new file mode 100644
index 0000000..2e8d1b3
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbAugmentForRpcInput.yang
@@ -0,0 +1,20 @@
+module YtbAugmentForRpcInput {
+ yang-version 1;
+ namespace "yms:test:ytb:augment:for:rpc:input";
+ prefix "sch";
+ import YtbRpcResponseWithAdvancedInputAndOutput {
+ prefix rpc;
+ }
+ revision "2016-08-26";
+
+ augment "/rpc:activate-software-image/rpc:output/" {
+ choice selection {
+ list value-in {
+ key "kinetic";
+ leaf kinetic {
+ type "string";
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbAugmentForRpcInput2.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbAugmentForRpcInput2.yang
new file mode 100644
index 0000000..af59b47
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbAugmentForRpcInput2.yang
@@ -0,0 +1,17 @@
+module YtbAugmentForRpcInput2 {
+ yang-version 1;
+ namespace "yms:test:ytb:augment:for:rpc:input";
+ prefix "sch";
+ import YtbRpcResponseWithAdvancedInputAndOutput {
+ prefix input;
+ }
+ revision "2016-08-26";
+ augment "/input:activate-software-image/input:output/" {
+ list friction {
+ key "speed";
+ leaf speed {
+ type uint64;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbAugmentFromAnotherFile.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbAugmentFromAnotherFile.yang
new file mode 100644
index 0000000..990bf55
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbAugmentFromAnotherFile.yang
@@ -0,0 +1,41 @@
+module YtbAugmentFromAnotherFile {
+ yang-version 1;
+ namespace "yms:test:ytb:augment:from:another:file";
+ prefix "sch";
+ import yms-ietf-network {
+ prefix nd;
+ }
+ revision "2016-08-26";
+
+ augment "/nd:networks/nd:network/nd:node" {
+ list termination-point {
+ key "tp-id";
+ leaf tp-id {
+ type string;
+ }
+ list supporting-termination-point {
+ key "network-ref node-ref tp-ref";
+ leaf network-ref {
+ type leafref {
+ path "../../../nd:supporting-node/nd:network-ref";
+ require-instance false;
+ }
+ }
+ leaf node-ref {
+ type leafref {
+ path "../../../nd:supporting-node/nd:node-ref";
+ require-instance false;
+ }
+ }
+ leaf tp-ref {
+ type leafref {
+ path "/nd:networks/nd:network[nd:network-id=current()/"+
+ "../network-ref]/nd:node[nd:node-id=current()/../"+
+ "node-ref]/termination-point/tp-id";
+ require-instance false;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbChoiceWithContainerAndLeafList.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbChoiceWithContainerAndLeafList.yang
new file mode 100644
index 0000000..9ae462e
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbChoiceWithContainerAndLeafList.yang
@@ -0,0 +1,76 @@
+module YtbChoiceWithContainerAndLeafList {
+ yang-version 1;
+ namespace "yms:test:ytb:choice:with:container:and:leaf:list";
+ prefix "sch";
+ revision "2016-08-26";
+ leaf refer {
+ type binary;
+ }
+ rpc invalid1 {
+ input {
+ leaf value {
+ type string;
+ }
+ }
+ output {
+ leaf value {
+ type string;
+ }
+ }
+ }
+ choice content-test {
+ leaf-list list-items {
+ type leafref {
+ path "/refer";
+ }
+ }
+ container choice-container {
+ list predict {
+ config "false";
+ container reproduce {
+ leaf catch {
+ type int16;
+ }
+ }
+ }
+ }
+ case valid {
+ list validlistincase {
+ config "false";
+ leaf validity {
+ type int32;
+ }
+ }
+ }
+ case invalid {
+ leaf create-invalid {
+ type uint16;
+ }
+ }
+ }
+ notification invalid {
+ leaf value {
+ type string;
+ }
+ }
+ notification invalid2 {
+ list node {
+ config false;
+ leaf value {
+ type string;
+ }
+ }
+ }
+ choice current-value {
+ case ytb-present {
+ leaf-list represent {
+ type uint32;
+ }
+ }
+ case ytb-absent {
+ leaf-list final {
+ type instance-identifier;
+ }
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbDerivedTypeWithBitsAndBinary.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbDerivedTypeWithBitsAndBinary.yang
new file mode 100644
index 0000000..1ca30a4
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbDerivedTypeWithBitsAndBinary.yang
@@ -0,0 +1,56 @@
+module YtbDerivedTypeWithBitsAndBinary {
+ yang-version 1;
+ namespace "yms:test:ytb:derived:type:with:bits:and:binary";
+ prefix "sch";
+ revision "2016-08-26";
+
+ typedef derivedbinarya {
+ type derivedbinaryb;
+ }
+
+ typedef derivedbinaryb {
+ type binary;
+ }
+
+ typedef derivedbitsa {
+ type derivedbitsb;
+ }
+
+ typedef derivedbitsb {
+ type bits {
+ bit index {
+ position 1;
+ }
+ bit name {
+ position 10;
+ }
+ bit signature {
+ position 100;
+ }
+ }
+ }
+
+ leaf forbinary {
+ type derivedbinarya;
+ }
+
+ leaf forbits {
+ type derivedbitsa;
+ }
+
+ leaf-list forbinarylist {
+ type derivedbinarya;
+ }
+
+ leaf-list forbitslist {
+ type derivedbitsa;
+ }
+
+ leaf forunion {
+ type union {
+ type binary;
+ type int8;
+ }
+ }
+}
+
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbIetfSchedule.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbIetfSchedule.yang
new file mode 100644
index 0000000..84c908b
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbIetfSchedule.yang
@@ -0,0 +1,29 @@
+module YtbIetfSchedule {
+ yang-version 1;
+ namespace "yms:test:ytb:module:with:leaf:ietfschedule";
+ prefix "sch";
+ revision "2016-08-26";
+ leaf time {
+ type int8;
+ }
+ leaf enum1 {
+ type enumeration {
+ enum ten { value "10";}
+ enum hundred { value "100";}
+ enum thousand { value "1000"; }
+ }
+ }
+ leaf-list enum2 {
+ type enumeration {
+ enum ten-10 { value "10";}
+ enum hundred-100 { value "100";}
+ enum thousand-1000 { value "1000"; }
+ }
+ }
+ container monitor {
+ leaf check {
+ type uint8;
+ }
+ }
+}
+
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbModuleWithContainer.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbModuleWithContainer.yang
new file mode 100644
index 0000000..d611bee
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbModuleWithContainer.yang
@@ -0,0 +1,13 @@
+module YtbModuleWithContainer {
+ yang-version 1;
+ namespace "yms:test:ytb:module:with:container";
+ prefix "sch";
+ revision "2016-08-26";
+ container sched {
+ leaf predict {
+ type decimal64 {
+ fraction-digits 2;
+ }
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbModuleWithLeafList.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbModuleWithLeafList.yang
new file mode 100644
index 0000000..3d02384
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbModuleWithLeafList.yang
@@ -0,0 +1,9 @@
+module YtbModuleWithLeafList {
+ yang-version 1;
+ namespace "yms:test:ytb:module:with:leaflist";
+ prefix "sch";
+ revision "2016-08-26";
+ leaf-list time {
+ type int64;
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbModuleWithList.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbModuleWithList.yang
new file mode 100644
index 0000000..297a8f4
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbModuleWithList.yang
@@ -0,0 +1,15 @@
+module YtbModuleWithList {
+ yang-version 1;
+ namespace "yms:test:ytb:module:with:list";
+ prefix "sch";
+ revision "2016-08-26";
+ list ytblistlist {
+ config false;
+ leaf-list prediction {
+ type find;
+ }
+ }
+ typedef find {
+ type boolean;
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbMultiModulea.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbMultiModulea.yang
new file mode 100644
index 0000000..523f400
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbMultiModulea.yang
@@ -0,0 +1,12 @@
+module YtbMultiModulea {
+ yang-version 1;
+ namespace "yms:test:ytb:multi:module:a";
+ prefix "sch";
+ revision "2016-08-26";
+ list ytbmultilist {
+ config false;
+ leaf-list check {
+ type uint64;
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbMultiModuleb.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbMultiModuleb.yang
new file mode 100644
index 0000000..7c2c257
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbMultiModuleb.yang
@@ -0,0 +1,12 @@
+module YtbMultiModuleb {
+ yang-version 1;
+ namespace "yms:test:ytb:multi:module:b";
+ prefix "sch";
+ revision "2016-08-26";
+ list ytbmultilistb {
+ config false;
+ leaf-list checkin {
+ type string;
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbMultiNotificationWithContainer.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbMultiNotificationWithContainer.yang
new file mode 100644
index 0000000..9a66110
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbMultiNotificationWithContainer.yang
@@ -0,0 +1,31 @@
+module YtbMultiNotificationWithContainer {
+ yang-version 1;
+ namespace "yms:test:ytb:multi:notification:with:container";
+ prefix "sch";
+ revision "2016-08-26";
+ notification fortesta {
+ container ytbnot {
+ leaf notileaf {
+ type bits {
+ bit leaf1 {
+ position 0;
+ }
+ bit leaf2 {
+ position 1;
+ }
+ }
+ }
+ }
+ }
+ list cumulative {
+ key "sum";
+ leaf sum {
+ type int8;
+ }
+ }
+ notification fortestb {
+ leaf-list notileaflist {
+ type empty;
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbRpcResponseWithAdvancedInputAndOutput.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbRpcResponseWithAdvancedInputAndOutput.yang
new file mode 100644
index 0000000..c9f708e
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbRpcResponseWithAdvancedInputAndOutput.yang
@@ -0,0 +1,39 @@
+module YtbRpcResponseWithAdvancedInputAndOutput {
+ yang-version 1;
+ namespace "yms:test:ytb:rpc:response:with:advanced:input:and:output";
+ prefix "sch";
+ revision "2016-08-26";
+ leaf refer {
+ type binary;
+ }
+ rpc activate-software-image {
+ input {
+ container final {
+ leaf-list value {
+ type uint16;
+ }
+ }
+ }
+ output {
+ list output-list {
+ key "list-key";
+ leaf list-key {
+ type leafref {
+ path "/refer";
+ }
+ }
+ container content_inside {
+ leaf-list available {
+ type int16;
+ }
+ }
+ }
+ }
+ }
+ list cumulative {
+ key "sum";
+ leaf sum {
+ type int8;
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbSimpleAugment.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbSimpleAugment.yang
new file mode 100644
index 0000000..919d5ed
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbSimpleAugment.yang
@@ -0,0 +1,26 @@
+module YtbSimpleAugment {
+ yang-version 1;
+ namespace "yms:test:ytb:simple:augment";
+ prefix "sch";
+ revision "2016-08-26";
+ container cont1 {
+ container cont2 {
+ leaf fine {
+ type string;
+ }
+ }
+ }
+
+ augment /cont1/cont2 {
+ leaf leaf4 {
+ type int32;
+ }
+ container cont1s {
+ container cont1s {
+ leaf fine {
+ type string;
+ }
+ }
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbSimpleChoiceCase.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbSimpleChoiceCase.yang
new file mode 100644
index 0000000..818d04e
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbSimpleChoiceCase.yang
@@ -0,0 +1,23 @@
+module YtbSimpleChoiceCase {
+ yang-version 1;
+ namespace "yms:test:ytb:simple:choice:case";
+ prefix "sch";
+ revision "2016-08-26";
+ container YtbFood {
+ choice YtbSnack {
+ case ytb-sports-arena {
+ leaf pretzel {
+ type string;
+ }
+ leaf beer {
+ type string;
+ }
+ }
+ case ytb-late-night {
+ leaf chocolate {
+ type string;
+ }
+ }
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbSimpleRpcResponse.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbSimpleRpcResponse.yang
new file mode 100644
index 0000000..7aaa50f
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbSimpleRpcResponse.yang
@@ -0,0 +1,26 @@
+module YtbSimpleRpcResponse {
+ yang-version 1;
+ namespace "yms:test:ytb:simple:rpc:response";
+ prefix "sch";
+ revision "2016-08-26";
+ container ytb-rpc-cont {
+ leaf vary {
+ type uint8;
+ }
+ }
+ rpc rpc {
+ input {
+ }
+ output {
+ leaf output-leaf {
+ type uint32;
+ }
+ }
+ }
+ list cumulative {
+ key "sum";
+ leaf sum {
+ type int8;
+ }
+ }
+}
diff --git a/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbTreeBuilderForListHavingList.yang b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbTreeBuilderForListHavingList.yang
new file mode 100644
index 0000000..bd58e30
--- /dev/null
+++ b/apps/yms/ut/src/test/resources/ytbTestYangFiles/YtbTreeBuilderForListHavingList.yang
@@ -0,0 +1,26 @@
+module YtbTreeBuilderForListHavingList {
+ yang-version 1;
+ namespace "yms:test:ytb:tree:builder:for:list:having:list";
+ prefix "sch";
+ revision "2016-08-26";
+ container carrier {
+ list multiplexes {
+ key "types";
+ list application-areas {
+ config false;
+ leaf-list destination-areas {
+ type binary;
+ }
+ }
+ leaf types {
+ type enumeration {
+ enum space-division;
+ enum frequency-division;
+ enum time-division {
+ value 3;
+ }
+ }
+ }
+ }
+ }
+}