Migrated all YANG testfiles counting 50 lines or less.
JIRA: YANGTOOLS-1506
Change-Id: I90dc5abe72315090df3047a68cb83fee90224ef8
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
public class Bug5531Test {
@Test
public void test() throws Exception {
- final var schema = YangParserTestUtils.parseYangResourceDirectory("/bugs/bug5531");
+ final var schema = YangParserTestUtils.parseYang("""
+ module foo {
+ namespace "foo";
+ prefix foo;
+
+ revision 2015-01-01 {
+ description "test";
+ }
+ }""");
assertNotNull(schema);
assertNotNull(schema.getModules());
public class Bug6856Test {
@Test
public void testImplicitInputAndOutputInRpc() throws Exception {
- final var schemaContext = YangParserTestUtils.parseYangResources(Bug6856Test.class, "/bugs/bug-6856/foo.yang");
+ final var schemaContext = YangParserTestUtils.parseYang("""
+ module foo {
+ namespace foo;
+ prefix foo;
+ revision 2017-02-28;
+
+ rpc foo-rpc {}
+ }""");
assertNotNull(schemaContext);
final var byteArrayOutputStream = new ByteArrayOutputStream();
@Test
public void testExplicitInputAndOutputInRpc() throws Exception {
- final var schemaContext = YangParserTestUtils.parseYangResources(Bug6856Test.class, "/bugs/bug-6856/bar.yang");
+ final var schemaContext = YangParserTestUtils.parseYang("""
+ module bar {
+ namespace bar;
+ prefix bar;
+ revision 2017-02-28;
+
+ rpc bar-rpc {
+ input {
+ leaf input-leaf {
+ type string;
+ }
+ }
+ output {
+ leaf output-leaf {
+ type string;
+ }
+ }
+ }
+ }""");
assertNotNull(schemaContext);
final var byteArrayOutputStream = new ByteArrayOutputStream();
public class YT1313Test {
@Test
public void testSubmoduleImportPrefixes() {
- final var bar = YangParserTestUtils.parseYangResourceDirectory("/bugs/yt1313")
+ final var bar = YangParserTestUtils.parseYang("""
+ module bar {
+ namespace bar;
+ prefix bar;
+
+ include bar-one;
+ include bar-two;
+ }""", """
+ submodule bar-one {
+ belongs-to bar {
+ prefix bar;
+ }
+
+ import foo {
+ prefix foo1;
+ }
+
+ leaf one {
+ type foo1:foo;
+ }
+ }""", """
+ submodule bar-two {
+ belongs-to bar {
+ prefix bar;
+ }
+
+ import foo {
+ prefix foo2;
+ }
+
+ leaf two {
+ type foo2:foo;
+ }
+ }""", """
+ module foo {
+ namespace foo;
+ prefix foo;
+
+ typedef foo {
+ type string;
+ }
+ }""")
.getModuleStatement(QNameModule.create(XMLNamespace.of("bar")));
final StatementPrefixResolver resolver = StatementPrefixResolver.forModule(bar);
@Test
public void testSubmoduleNamespaces() throws Exception {
- assertFormat(YangParserTestUtils.parseYangResourceDirectory("/bugs/yt992"));
+ assertFormat(YangParserTestUtils.parseYang("""
+ module module1 {
+ yang-version "1.1";
+ namespace "urn:example:module1";
+ prefix "module1";
+
+ include module1submodule1;
+
+ revision "2019-05-17" {
+ }
+
+ container cont1 {
+ uses submodule-grouping;
+ }
+ }""", """
+ submodule module1submodule1 {
+ yang-version "1.1";
+
+ belongs-to "module1" {
+ prefix "module1";
+ }
+
+ import module2 {
+ prefix "module2";
+ }
+
+ revision "2019-05-17" {
+ }
+
+ grouping submodule-grouping {
+ uses module2:grouping1;
+
+ leaf leaf2 {
+ type string;
+ module2:ext1 "param1";
+ }
+ }
+ }""", """
+ module module2 {
+ yang-version "1.1";
+ namespace "urn:example:module2";
+ prefix "module2";
+
+ revision "2019-05-17" {
+ }
+
+ grouping grouping1 {
+ leaf leaf1 {
+ type string;
+ }
+ }
+
+ extension ext1 {
+ argument "parameter";
+ }
+ }"""));
}
private static void assertFormat(final EffectiveModelContext context) {
+++ /dev/null
-module bar {
- namespace bar;
- prefix bar;
-
- revision 2017-02-28;
-
- rpc bar-rpc {
- input {
- leaf input-leaf {
- type string;
- }
- }
- output {
- leaf output-leaf {
- type string;
- }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-module foo {
- namespace foo;
- prefix foo;
-
- revision 2017-02-28;
-
- rpc foo-rpc {}
-}
\ No newline at end of file
+++ /dev/null
-module foo {
- namespace "foo";
- prefix foo;
-
- revision 2015-01-01 {
- description "test";
- }
-}
+++ /dev/null
-submodule bar-one {
- belongs-to bar {
- prefix bar;
- }
-
- import foo {
- prefix foo1;
- }
-
- leaf one {
- type foo1:foo;
- }
-}
+++ /dev/null
-submodule bar-two {
- belongs-to bar {
- prefix bar;
- }
-
- import foo {
- prefix foo2;
- }
-
- leaf two {
- type foo2:foo;
- }
-}
+++ /dev/null
-module bar {
- namespace bar;
- prefix bar;
-
- include bar-one;
- include bar-two;
-}
-
+++ /dev/null
-module foo {
- namespace foo;
- prefix foo;
-
- typedef foo {
- type string;
- }
-}
-
+++ /dev/null
-module module1 {
- yang-version "1.1";
- namespace "urn:example:module1";
- prefix "module1";
-
- include module1submodule1;
-
- revision "2019-05-17" {
- }
-
- container cont1 {
- uses submodule-grouping;
- }
-}
\ No newline at end of file
+++ /dev/null
-submodule module1submodule1 {
- yang-version "1.1";
- belongs-to "module1" {
- prefix "module1";
- }
-
- import module2 {
- prefix "module2";
- }
-
- revision "2019-05-17" {
- }
-
- grouping submodule-grouping {
- uses module2:grouping1;
-
- leaf leaf2 {
- type string;
- module2:ext1 "param1";
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-module module2 {
- yang-version "1.1";
- namespace "urn:example:module2";
- prefix "module2";
-
- revision "2019-05-17" {
- }
-
- grouping grouping1 {
- leaf leaf1 {
- type string;
- }
- }
-
- extension ext1 {
- argument "parameter";
- }
-}
\ No newline at end of file