[ONOS-5877][ONOS-5886] runtime api implementation changes.
Change-Id: Ie341b11b2c1a60734c894596a7f601f1c7280bb8
diff --git a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/DefaultYangModelRegistryTest.java b/runtime/app/src/test/java/org/onosproject/yang/runtime/app/DefaultYangModelRegistryTest.java
new file mode 100644
index 0000000..8445d34
--- /dev/null
+++ b/runtime/app/src/test/java/org/onosproject/yang/runtime/app/DefaultYangModelRegistryTest.java
@@ -0,0 +1,400 @@
+/*
+ * Copyright 2017-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.yang.runtime.app;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangRevision;
+import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
+
+import java.io.IOException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yang.compiler.plugin.utils.YangApacheUtils.getDateInStringFormat;
+
+/**
+ * Unit test for model registry.
+ */
+public class DefaultYangModelRegistryTest {
+
+ 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 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 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 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 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 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 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 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 CHECK = "check";
+ private static final String DATE_NAMESPACE = "2015-00-08";
+ private static final String NAMESPACE =
+ "urn:ietf:params:xml:ns:yang:ietf-network4:check:namespace";
+
+ private final TestYangSchemaNodeProvider provider =
+ 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 {
+
+ provider.processSchemaRegistry();
+
+ DefaultYangModelRegistry registry = provider.registry();
+
+ YangSchemaNode yangNode = registry.getForSchemaName(SCHEMA_NAME_3);
+ assertThat(true, is(SCHEMA_NAME_3.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForInterfaceFileName(
+ INTERFACE_NAME_3);
+ assertThat(true, is(SCHEMA_NAME_3.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForOpPramFileName(
+ OP_PARAM_NAME_3);
+ assertThat(true, is(SCHEMA_NAME_3.equals(yangNode.getName())));
+
+// provider.unregisterService(SERVICE_NAME_3);
+ //TODO: fix unregister UT.
+//
+// yangNode = registry.getForAppName(SERVICE_NAME_3);
+// assertThat(true, is(yangNode == null));
+//
+// yangNode = registry.getForSchemaName(SCHEMA_NAME_3);
+// assertThat(true, is(yangNode == null));
+//
+// yangNode =
+// registry.getForInterfaceFileName(
+// INTERFACE_NAME_3);
+// assertThat(true, is(yangNode == null));
+//
+// yangNode =
+// registry.getForOpPramFileName(
+// OP_PARAM_NAME_3);
+// assertThat(true, is(yangNode == 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 {
+
+ provider.processSchemaRegistry();
+ DefaultYangModelRegistry registry =
+ provider.registry();
+
+ //Service with rev.
+ YangSchemaNode yangNode = registry.getForSchemaName(SCHEMA_NAME_4_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForInterfaceFileName(
+ INTERFACE_NAME_REV_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForOpPramFileName(
+ OP_PARAM_NAME_REV_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ // provider.unregisterService(SERVICE_NAME_REV_15);
+
+ yangNode = registry.getForAppName(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.getForSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(((YangNode) yangNode).getRevision() == null));
+
+ yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForInterfaceFileName(
+ INTERFACE_NAME_NO_REV);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForOpPramFileName(
+ OP_PARAM_NAME_NO_REV);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ //provider.unregisterService(SERVICE_NAME_NO_REV);
+
+ yangNode = registry.getForAppName(SERVICE_NAME_NO_REV);
+ assertThat(true, is(yangNode == null));
+
+ //Here the yangNode should be the node which have different revision.
+ yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(yangNode != null));
+ //TODO: ureg.
+// 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
+ */
+ //TODO: add unreg in UT
+ public void testForGetSchemaNodeWhenMultiRevision()
+ throws IOException {
+
+ provider.processSchemaRegistry();
+ DefaultYangModelRegistry registry =
+ provider.registry();
+
+ //Service with rev.
+ YangSchemaNode yangNode = registry.getForSchemaName(SCHEMA_NAME_4_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForInterfaceFileName(
+ INTERFACE_NAME_REV_15);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForOpPramFileName(
+ OP_PARAM_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.getRegisteredClass(yangNode);
+ assertThat(true, is(object == null));
+// provider.unregisterService(SERVICE_NAME_REV_15);
+
+ yangNode = registry.getForAppName(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.getForSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(((YangNode) yangNode).getRevision() == null));
+
+ //Service with different revision.
+ yangNode = registry
+ .getForAppName(SERVICE_NAME_REV_16);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getForSchemaName(SCHEMA_NAME_4_16);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForInterfaceFileName(
+ INTERFACE_NAME_REV_16);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForOpPramFileName(
+ OP_PARAM_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.getRegisteredClass(yangNode);
+ assertThat(true, is(object == null));
+// provider.unregisterService(SERVICE_NAME_REV_16);
+
+ yangNode = registry.getForAppName(SERVICE_NAME_REV_16);
+ assertThat(true, is(yangNode == null));
+
+ //Here the yangNode should be the node which have different revision.
+ yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(((YangNode) yangNode).getRevision() == null));
+
+ //Service with different revision.
+ yangNode = registry.getForAppName(SERVICE_NAME_REV_17);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getForSchemaName(SCHEMA_NAME_4_17);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForInterfaceFileName(
+ INTERFACE_NAME_REV_17);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForOpPramFileName(
+ OP_PARAM_NAME_REV_17);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ //As we have not registered an application this object should be null.
+ object = registry.getRegisteredClass(yangNode);
+ assertThat(true, is(object == null));
+// provider.unregisterService(SERVICE_NAME_REV_17);
+
+ yangNode = registry.getForAppName(SERVICE_NAME_REV_17);
+ assertThat(true, is(yangNode == null));
+
+ //Here the yangNode should be the node which have different revision.
+ yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(((YangNode) yangNode).getRevision() == null));
+
+ //Service no revision.
+ yangNode = registry.getForAppName(SERVICE_NAME_NO_REV);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForInterfaceFileName(
+ INTERFACE_NAME_NO_REV);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForOpPramFileName(
+ OP_PARAM_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.getRegisteredClass(yangNode);
+ assertThat(true, is(object == null));
+ // provider.unregisterService(SERVICE_NAME_NO_REV);
+
+ yangNode = registry.getForAppName(SERVICE_NAME_NO_REV);
+ assertThat(true, is(yangNode == null));
+
+ //Here the yangNode should be the node which have different revision.
+ yangNode = registry.getForSchemaName(SCHEMA_NAME_4);
+ assertThat(true, is(yangNode != null));
+ assertThat(true, is(((YangNode) yangNode).getRevision() != null));
+
+ //Service with different revision.
+ yangNode = registry.getForAppName(SERVICE_NAME_REV_14);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode = registry.getForSchemaName(SCHEMA_NAME_4_14);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForInterfaceFileName(
+ INTERFACE_NAME_REV_14);
+ assertThat(true, is(SCHEMA_NAME_4.equals(yangNode.getName())));
+
+ yangNode =
+ registry.getForOpPramFileName(
+ OP_PARAM_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.getRegisteredClass(yangNode);
+ assertThat(true, is(object == null));
+// provider.unregisterService(SERVICE_NAME_REV_14);
+
+ yangNode = registry.getForAppName(SERVICE_NAME_REV_14);
+ assertThat(true, is(yangNode == null));
+ }
+
+ /**
+ * get schema for namespace in decode test.
+ */
+ @Test
+ public void testGetNodeWrtNamespace() {
+ provider.processSchemaRegistry();
+ DefaultYangModelRegistry registry = provider.registry();
+
+ YangSchemaNode yangNode = registry.getForNameSpace(NAMESPACE);
+ assertThat(true, is(CHECK.equals(yangNode.getName())));
+
+ YangRevision rev = ((YangNode) yangNode).getRevision();
+ assertThat(true, is(rev != null));
+
+ String date = getDateInStringFormat((YangNode) yangNode);
+ assertThat(true, is(DATE_NAMESPACE.equals(date)));
+ }
+}
diff --git a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestYangSchemaNodeProvider.java b/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestYangSchemaNodeProvider.java
new file mode 100644
index 0000000..a42f2fb
--- /dev/null
+++ b/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestYangSchemaNodeProvider.java
@@ -0,0 +1,113 @@
+/*
+ * 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.yang.runtime.app;
+
+import org.onosproject.yang.YangModel;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
+import org.onosproject.yang.runtime.api.AppModuleInfo;
+import org.onosproject.yang.runtime.api.ModelRegistrationParam;
+import org.onosproject.yang.runtime.api.YangModelRegistry;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.deSerializeDataModel;
+import static org.onosproject.yang.compiler.plugin.utils.YangApacheUtils.processModuleId;
+import static org.onosproject.yang.compiler.plugin.utils.YangApacheUtils.processYangModel;
+import static org.onosproject.yang.compiler.utils.UtilConstants.TEMP;
+import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.deleteDirectory;
+import static org.onosproject.yang.runtime.utils.RuntimeHelper.getInterfaceClassName;
+
+/**
+ * Represents mock bundle context. provides bundle context for YSR to do unit
+ * testing.
+ * //TODO: add unreg ut.
+ */
+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 META_PATH = PATH + SER_FILE_PATH;
+ private static final String TEMP_FOLDER_PATH = PATH + TEMP;
+ private YangModelRegistry reg = new DefaultYangModelRegistry();
+ private List<YangNode> nodes = new ArrayList<>();
+
+ /**
+ * Creates an instance of mock bundle context.
+ */
+ public TestYangSchemaNodeProvider() {
+ }
+
+ /**
+ * Process YANG schema node for a application.
+ */
+ public void processSchemaRegistry() {
+ try {
+ //Need to deserialize generated meta data file for unit tests.
+ Set<YangNode> appNode = deSerializeDataModel(META_PATH);
+ nodes.addAll(appNode);
+
+ //Process loading class file.
+ String appName;
+ ClassLoader classLoader = TestYangSchemaNodeProvider.class.getClassLoader();
+ for (YangSchemaNode node : nodes) {
+
+ //If service class is not generated then use
+ // interface file to load this class.
+ appName = getInterfaceClassName(node);
+ Class<?> cls;
+ try {
+ cls = classLoader.loadClass(appName);
+ } catch (ClassNotFoundException e) {
+ continue;
+ }
+
+ //Create model registration param.
+ ModelRegistrationParam param = new
+ DefaultModelRegistrationParam();
+
+ //create a new YANG model
+ YangModel model = processYangModel(META_PATH, nodes);
+ //set YANG model
+ param.setYangModel(model);
+ //generate app info.
+ AppModuleInfo info = new DefaultAppModuleInfo();
+ info.setModuleClass(cls);
+ param.addAppModuleInfo(processModuleId((YangNode) node), info);
+ reg.registerModel(param);
+ }
+ deleteDirectory(TEMP_FOLDER_PATH);
+ } catch (IOException e) {
+ }
+ }
+
+ /**
+ * Returns schema registry.
+ *
+ * @return schema registry
+ */
+ public DefaultYangModelRegistry registry() {
+ return (DefaultYangModelRegistry) reg;
+ }
+}
diff --git a/runtime/app/src/test/resources/ysrTestYangFiles/CheckWithNamespace.yang b/runtime/app/src/test/resources/ysrTestYangFiles/CheckWithNamespace.yang
new file mode 100644
index 0000000..7e5726e
--- /dev/null
+++ b/runtime/app/src/test/resources/ysrTestYangFiles/CheckWithNamespace.yang
@@ -0,0 +1,80 @@
+ module check {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network4:check:namespace";
+ 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/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/norev.yang b/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/norev.yang
new file mode 100644
index 0000000..a537824
--- /dev/null
+++ b/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/norev.yang
@@ -0,0 +1,71 @@
+ 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).";
+
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+
+}
diff --git a/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev.yang b/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev.yang
new file mode 100644
index 0000000..b181f36
--- /dev/null
+++ b/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev.yang
@@ -0,0 +1,81 @@
+ 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";
+ }
+
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+
+}
diff --git a/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev2.yang b/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev2.yang
new file mode 100644
index 0000000..29d5485
--- /dev/null
+++ b/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev2.yang
@@ -0,0 +1,80 @@
+ 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";
+ }
+
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+}
diff --git a/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev3.yang b/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev3.yang
new file mode 100644
index 0000000..c8a2a0a
--- /dev/null
+++ b/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev3.yang
@@ -0,0 +1,81 @@
+ 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";
+ }
+
+ container networks {
+ leaf id {
+ type int32;
+ }
+ container network {
+ leaf ip-address {
+ type int32;
+ }
+ }
+ }
+
+}
diff --git a/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev4.yang b/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev4.yang
new file mode 100644
index 0000000..9352fb4
--- /dev/null
+++ b/runtime/app/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/runtime/app/src/test/resources/ysrTestYangFiles/withoutNotification/ysr3.yang b/runtime/app/src/test/resources/ysrTestYangFiles/withoutNotification/ysr3.yang
new file mode 100644
index 0000000..0e86062
--- /dev/null
+++ b/runtime/app/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;
+ }
+ }
+ }
+
+}