Merge "BUG-1281: use SchemaContext lookups"
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / cnsn / to / json / test / CnSnJsonBasicYangTypesTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertNotNull;
13 import static org.junit.Assert.assertNull;
14 import static org.junit.Assert.assertTrue;
15
16 import com.google.gson.stream.JsonReader;
17 import com.google.gson.stream.JsonToken;
18 import java.io.IOException;
19 import java.io.StringReader;
20 import java.util.Map;
21 import java.util.Set;
22 import javax.ws.rs.WebApplicationException;
23 import org.junit.BeforeClass;
24 import org.junit.Test;
25 import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
26 import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
27 import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
28 import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
29 import org.opendaylight.controller.sal.restconf.impl.test.structures.Cont;
30 import org.opendaylight.controller.sal.restconf.impl.test.structures.Lf;
31 import org.opendaylight.controller.sal.restconf.impl.test.structures.LfLst;
32 import org.opendaylight.controller.sal.restconf.impl.test.structures.Lst;
33 import org.opendaylight.controller.sal.restconf.impl.test.structures.LstItem;
34 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
35 import org.opendaylight.yangtools.yang.data.api.ModifyAction;
36 import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode;
37 import org.opendaylight.yangtools.yang.data.api.MutableSimpleNode;
38 import org.opendaylight.yangtools.yang.data.api.Node;
39 import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
40
41 public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader {
42
43     @BeforeClass
44     public static void initialize() {
45         dataLoad("/cnsn-to-json/simple-yang-types", 1, "simple-yang-types", "cont1");
46     }
47
48     /**
49      * Test of json output when as input are specified composite node with empty data + YANG file
50      */
51
52     @Test
53     public void compositeNodeAndYangWithJsonReaderEmptyDataTest() {
54         CompositeNode compositeNode = prepareCompositeNodeWithEmpties();
55         TestUtils.normalizeCompositeNode(compositeNode, modules, searchedModuleName + ":" + searchedDataSchemaName);
56         String jsonOutput = null;
57         try {
58             jsonOutput = TestUtils.writeCompNodeWithSchemaContextToOutput(compositeNode, modules, dataSchemaNode,
59                     StructuredDataToJsonProvider.INSTANCE);
60         } catch (WebApplicationException | IOException e) {
61         }
62
63         verifyJsonOutputForEmptyData(jsonOutput);
64     }
65
66     /**
67      * Test of json output when as input are specified xml file (no empty elements)and YANG file
68      */
69     @Test
70     public void xmlAndYangTypesWithJsonReaderTest() {
71         Node<?> node = TestUtils.readInputToCnSn("/cnsn-to-json/simple-yang-types/xml/data.xml",
72                 XmlToCompositeNodeProvider.INSTANCE);
73         TestUtils.normalizeCompositeNode(node, modules, searchedModuleName + ":" + searchedDataSchemaName);
74         String jsonOutput = null;
75         try {
76             jsonOutput = TestUtils.writeCompNodeWithSchemaContextToOutput(node, modules, dataSchemaNode,
77                     StructuredDataToJsonProvider.INSTANCE);
78         } catch (WebApplicationException | IOException e) {
79         }
80
81         verifyJsonOutput(jsonOutput);
82     }
83
84     private void verifyJsonOutputForEmptyData(final String jsonOutput) {
85         assertNotNull(jsonOutput);
86         StringReader strReader = new StringReader(jsonOutput);
87         JsonReader jReader = new JsonReader(strReader);
88
89         String exception = null;
90         Cont dataFromJson = null;
91         try {
92             dataFromJson = jsonReadCont1(jReader);
93         } catch (IOException e) {
94             exception = e.getMessage();
95         }
96
97         assertNotNull("Data structures from json are missing.", dataFromJson);
98         checkDataFromJsonEmpty(dataFromJson);
99
100         assertNull("Error during reading Json output: " + exception, exception);
101     }
102
103     private void verifyJsonOutput(final String jsonOutput) {
104         assertNotNull(jsonOutput);
105         StringReader strReader = new StringReader(jsonOutput);
106         JsonReader jReader = new JsonReader(strReader);
107
108         String exception = null;
109         Cont dataFromJson = null;
110         try {
111             dataFromJson = jsonReadCont1(jReader);
112         } catch (IOException e) {
113             exception = e.getMessage();
114         }
115
116         assertNotNull("Data structures from json are missing.", dataFromJson);
117         checkDataFromJson(dataFromJson);
118
119         assertNull("Error during reading Json output: " + exception, exception);
120     }
121
122     private Cont jsonReadCont1(final JsonReader jReader) throws IOException {
123         jReader.beginObject();
124         assertNotNull("cont1 is missing.", jReader.hasNext());
125
126         Cont dataFromJson = new Cont(jReader.nextName());
127         dataFromJson = jsonReadCont1Elements(jReader, dataFromJson);
128
129         assertFalse("cont shouldn't have other element.", jReader.hasNext());
130         jReader.endObject();
131         return dataFromJson;
132
133     }
134
135     private Cont jsonReadCont1Elements(final JsonReader jReader, final Cont redData) throws IOException {
136         jReader.beginObject();
137         while (jReader.hasNext()) {
138             String keyName = jReader.nextName();
139             if (keyName.equals("lf11")) {
140                 redData.addLf(new Lf(keyName, nextValue(jReader)));
141             } else if (keyName.equals("lflst11")) {
142                 LfLst lfLst = new LfLst(keyName);
143                 lfLst = jsonReadLflstValues(jReader, lfLst);
144                 redData.addLfLst(lfLst);
145             } else if (keyName.equals("lflst12")) {
146                 LfLst lfLst = new LfLst(keyName);
147                 jsonReadLflstValues(jReader, lfLst);
148                 redData.addLfLst(lfLst);
149             } else if (keyName.equals("lst11")) {
150                 Lst lst = new Lst(keyName);
151                 lst = jsonReadLst11(jReader, lst);
152                 redData.addLst(lst);
153             } else {
154                 assertTrue("Key " + keyName + " doesn't exists in yang file.", false);
155             }
156         }
157         jReader.endObject();
158         return redData;
159
160     }
161
162     private Lst jsonReadLst11(final JsonReader jReader, final Lst lst) throws IOException {
163         jReader.beginArray();
164
165         while (jReader.hasNext()) {
166             LstItem lstItem = jsonReadLst11Elements(jReader);
167             lst.addLstItem(lstItem);
168         }
169         jReader.endArray();
170         return lst;
171     }
172
173     private LstItem jsonReadLst11Elements(final JsonReader jReader) throws IOException {
174         LstItem lstItem = new LstItem();
175         jReader.beginObject();
176         while (jReader.hasNext()) {
177             String keyName = jReader.nextName();
178             if (keyName.equals("lf111")) {
179                 lstItem.addLf(new Lf(keyName, nextValue(jReader)));
180             } else if (keyName.equals("lf112")) {
181                 lstItem.addLf(new Lf(keyName, nextValue(jReader)));
182             } else if (keyName.equals("cont111")) {
183                 Cont cont = new Cont(keyName);
184                 cont = jsonReadCont111(jReader, cont);
185                 lstItem.addCont(cont);
186             } else if (keyName.equals("lst111")) {
187                 Lst lst = new Lst(keyName);
188                 lst = jsonReadLst111(jReader, lst);
189                 lstItem.addLst(lst);
190             } else if (keyName.equals("lst112")) {
191                 Lst lst = new Lst(keyName);
192                 lst = jsonReadLst112(jReader, lst);
193                 lstItem.addLst(lst);
194             } else {
195                 assertTrue("Key " + keyName + " doesn't exists in yang file.", false);
196             }
197         }
198         jReader.endObject();
199         return lstItem;
200     }
201
202     private Lst jsonReadLst112(final JsonReader jReader, final Lst lst) throws IOException {
203         jReader.beginArray();
204         while (jReader.hasNext()) {
205             LstItem lstItem = jsonReadLst112Elements(jReader);
206             lst.addLstItem(lstItem);
207         }
208         jReader.endArray();
209         return lst;
210     }
211
212     private LstItem jsonReadLst112Elements(final JsonReader jReader) throws IOException {
213         LstItem lstItem = new LstItem();
214         jReader.beginObject();
215         if (jReader.hasNext()) {
216             String keyName = jReader.nextName();
217             if (keyName.equals("lf1121")) {
218                 lstItem.addLf(new Lf(keyName, nextValue(jReader)));
219             }
220         }
221         jReader.endObject();
222         return lstItem;
223
224     }
225
226     private Lst jsonReadLst111(final JsonReader jReader, final Lst lst) throws IOException {
227         jReader.beginArray();
228         while (jReader.hasNext()) {
229             LstItem lstItem = jsonReadLst111Elements(jReader);
230             lst.addLstItem(lstItem);
231         }
232         jReader.endArray();
233         return lst;
234     }
235
236     private LstItem jsonReadLst111Elements(final JsonReader jReader) throws IOException {
237         LstItem lstItem = new LstItem();
238         jReader.beginObject();
239         if (jReader.hasNext()) {
240             String keyName = jReader.nextName();
241             if (keyName.equals("lf1111")) {
242                 lstItem.addLf(new Lf(keyName, nextValue(jReader)));
243             }
244         }
245         jReader.endObject();
246         return lstItem;
247     }
248
249     private Object nextValue(final JsonReader jReader) throws IOException {
250         if (jReader.peek().equals(JsonToken.NULL)) {
251             jReader.nextNull();
252             return null;
253         } else if (jReader.peek().equals(JsonToken.NUMBER)) {
254             return jReader.nextInt();
255         } else {
256             return jReader.nextString();
257         }
258     }
259
260     private Cont jsonReadCont111(final JsonReader jReader, Cont cont) throws IOException {
261         jReader.beginObject();
262         cont = jsonReadCont111Elements(jReader, cont);
263         jReader.endObject();
264         return cont;
265     }
266
267     private Cont jsonReadCont111Elements(final JsonReader jReader, final Cont cont) throws IOException {
268         while (jReader.hasNext()) {
269             String keyName = jReader.nextName();
270             if (keyName.equals("lf1111")) {
271                 cont.addLf(new Lf(keyName, nextValue(jReader)));
272             } else if (keyName.equals("lflst1111")) {
273                 LfLst lfLst = new LfLst(keyName);
274                 lfLst = jsonReadLflstValues(jReader, lfLst);
275                 cont.addLfLst(lfLst);
276             } else if (keyName.equals("lst1111")) {
277                 Lst lst = new Lst(keyName);
278                 lst = jsonReadLst1111(jReader, lst);
279                 cont.addLst(lst);
280             } else {
281                 assertTrue("Key " + keyName + " doesn't exists in yang file.", false);
282             }
283         }
284         return cont;
285
286     }
287
288     private Lst jsonReadLst1111(final JsonReader jReader, final Lst lst) throws IOException {
289         jReader.beginArray();
290         while (jReader.hasNext()) {
291             LstItem lstItem = jsonReadLst1111Elements(jReader);
292             lst.addLstItem(lstItem);
293         }
294         jReader.endArray();
295         return lst;
296     }
297
298     private LstItem jsonReadLst1111Elements(final JsonReader jReader) throws IOException {
299         jReader.beginObject();
300         LstItem lstItem = new LstItem();
301         while (jReader.hasNext()) {
302             String keyName = jReader.nextName();
303             if (keyName.equals("lf1111A") || keyName.equals("lf1111B")) {
304                 lstItem.addLf(new Lf(keyName, nextValue(jReader)));
305             }
306         }
307         jReader.endObject();
308         return lstItem;
309     }
310
311     private LfLst jsonReadLflstValues(final JsonReader jReader, final LfLst lfLst) throws IOException {
312         jReader.beginArray();
313         while (jReader.hasNext()) {
314             lfLst.addLf(new Lf(nextValue(jReader)));
315         }
316         jReader.endArray();
317         return lfLst;
318     }
319
320     private void checkDataFromJsonEmpty(final Cont dataFromJson) {
321         assertTrue(dataFromJson.getLfs().isEmpty());
322         assertTrue(dataFromJson.getLfLsts().isEmpty());
323         assertTrue(dataFromJson.getConts().isEmpty());
324
325         Map<String, Lst> lsts = dataFromJson.getLsts();
326         assertEquals(1, lsts.size());
327         Lst lst11 = lsts.get("lst11");
328         assertNotNull(lst11);
329         Set<LstItem> lstItems = lst11.getLstItems();
330         assertNotNull(lstItems);
331
332         LstItem lst11_1 = null;
333         LstItem lst11_2 = null;
334         LstItem lst11_3 = null;
335         for (LstItem lstItem : lstItems) {
336             if (lstItem.getLfs().get("lf111").getValue().equals(1)) {
337                 lst11_1 = lstItem;
338             } else if (lstItem.getLfs().get("lf111").getValue().equals(2)) {
339                 lst11_2 = lstItem;
340             } else if (lstItem.getLfs().get("lf111").getValue().equals(3)) {
341                 lst11_3 = lstItem;
342             }
343         }
344
345         assertNotNull(lst11_1);
346         assertNotNull(lst11_2);
347         assertNotNull(lst11_3);
348
349         // lst11_1
350         assertTrue(lst11_1.getLfLsts().isEmpty());
351         assertEquals(1, lst11_1.getLfs().size());
352         assertEquals(1, lst11_1.getConts().size());
353         assertEquals(1, lst11_1.getLsts().size());
354         assertEquals(lst11_1.getLsts().get("lst111"), new Lst("lst111").addLstItem(new LstItem().addLf("lf1111", 35))
355                 .addLstItem(new LstItem().addLf("lf1111", 34)).addLstItem(new LstItem()).addLstItem(new LstItem()));
356         assertEquals(lst11_1.getConts().get("cont111"), new Cont("cont111"));
357         // : lst11_1
358
359         // lst11_2
360         assertTrue(lst11_2.getLfLsts().isEmpty());
361         assertEquals(1, lst11_2.getLfs().size());
362         assertEquals(1, lst11_2.getConts().size());
363         assertEquals(1, lst11_2.getLsts().size());
364
365         Cont lst11_2_cont111 = lst11_2.getConts().get("cont111");
366
367         // -cont111
368         assertNotNull(lst11_2_cont111);
369         assertTrue(lst11_2_cont111.getLfs().isEmpty());
370         assertEquals(1, lst11_2_cont111.getLfLsts().size());
371         assertEquals(1, lst11_2_cont111.getLsts().size());
372         assertTrue(lst11_2_cont111.getConts().isEmpty());
373
374         assertEquals(new LfLst("lflst1111").addLf(1024).addLf(4096), lst11_2_cont111.getLfLsts().get("lflst1111"));
375         assertEquals(
376                 new Lst("lst1111").addLstItem(new LstItem().addLf("lf1111B", 4)).addLstItem(
377                         new LstItem().addLf("lf1111A", "lf1111A str12")), lst11_2_cont111.getLsts().get("lst1111"));
378         // :-cont111
379         assertEquals(lst11_2.getLsts().get("lst112"), new Lst("lst112").addLstItem(new LstItem()));
380         // : lst11_2
381
382         // lst11_3
383         assertEquals(1, lst11_3.getLfs().size());
384         assertTrue(lst11_3.getLfLsts().isEmpty());
385         assertTrue(lst11_3.getLsts().isEmpty());
386         assertTrue(lst11_3.getLsts().isEmpty());
387
388         // -cont111
389         Cont lst11_3_cont111 = lst11_3.getConts().get("cont111");
390         assertEquals(0, lst11_3_cont111.getLfs().size());
391         assertEquals(0, lst11_3_cont111.getLfLsts().size());
392         assertEquals(1, lst11_3_cont111.getLsts().size());
393         assertTrue(lst11_3_cont111.getConts().isEmpty());
394
395         assertEquals(new Lst("lst1111").addLstItem(new LstItem()).addLstItem(new LstItem()), lst11_3_cont111.getLsts()
396                 .get("lst1111"));
397         // :-cont111
398         // : lst11_3
399
400     }
401
402     private void checkDataFromJson(final Cont dataFromJson) {
403         assertNotNull(dataFromJson.getLfs().get("lf11"));
404         assertEquals(dataFromJson.getLfs().get("lf11"), new Lf("lf11", "lf"));
405
406         LfLst lflst11 = null;
407         LfLst lflst12 = null;
408
409         lflst11 = dataFromJson.getLfLsts().get("lflst11");
410         lflst12 = dataFromJson.getLfLsts().get("lflst12");
411
412         assertNotNull(lflst11);
413         assertNotNull(lflst12);
414
415         assertEquals(3, lflst11.getLfs().size());
416         assertTrue(lflst11.getLfs().contains(new Lf(55)));
417         assertTrue(lflst11.getLfs().contains(new Lf(56)));
418         assertTrue(lflst11.getLfs().contains(new Lf(57)));
419
420         assertEquals(3, lflst12.getLfs().size());
421         assertTrue(lflst12.getLfs().contains(new Lf("lflst12 str1")));
422         assertTrue(lflst12.getLfs().contains(new Lf("lflst12 str2")));
423         assertTrue(lflst12.getLfs().contains(new Lf("lflst12 str3")));
424
425         assertEquals(1, dataFromJson.getLsts().size());
426         Lst lst11 = dataFromJson.getLsts().get("lst11");
427         assertNotNull(lst11);
428         assertEquals(2, lst11.getLstItems().size());
429
430         LstItem lst11_1 = null;
431         LstItem lst11_2 = null;
432         for (LstItem lstItem : lst11.getLstItems()) {
433             Lf lf = lstItem.getLfs().get("lf111");
434             if (lf != null && lf.getValue().equals(140)) {
435                 lst11_1 = lstItem;
436             } else if (lf != null && lf.getValue().equals(141)) {
437                 lst11_2 = lstItem;
438             }
439         }
440
441         checkLst11_1(lst11_1);
442         checkLst11_2(lst11_2);
443     }
444
445     private void checkLst11_2(final LstItem lst11_2) {
446         assertNotNull(lst11_2);
447         assertEquals(2, lst11_2.getLfs().size());
448         assertEquals(1, lst11_2.getConts().size());
449         assertEquals(2, lst11_2.getLsts().size());
450
451         assertEquals(lst11_2.getLfs().get("lf112"), new Lf("lf112", "lf112 str2"));
452
453         Cont lst11_2_cont = lst11_2.getConts().get("cont111");
454         assertEquals(0, lst11_2_cont.getConts().size());
455         assertEquals(1, lst11_2_cont.getLfLsts().size());
456         assertEquals(1, lst11_2_cont.getLfs().size());
457         assertEquals(1, lst11_2_cont.getLsts().size());
458
459         // cont111 check
460         assertEquals(new Lf("lf1111", "lf1111 str2"), lst11_2_cont.getLfs().get("lf1111"));
461         assertEquals(new LfLst("lflst1111").addLf(new Lf(2049)).addLf(new Lf(1025)).addLf(new Lf(4097)), lst11_2_cont
462                 .getLfLsts().get("lflst1111"));
463
464         assertNotNull(lst11_2_cont.getLsts().get("lst1111"));
465         checkLst1111(lst11_2_cont.getLsts().get("lst1111").getLstItems(), new Lf("lf1111A", "lf1111A str21"), new Lf(
466                 "lf1111B", 5), new Lf("lf1111A", "lf1111A str22"), new Lf("lf1111B", 8));
467
468         checkLst11x(lst11_2.getLsts().get("lst111"), new LstItem().addLf(new Lf("lf1111", 55)),
469                 new LstItem().addLf(new Lf("lf1111", 56)));
470         checkLst11x(lst11_2.getLsts().get("lst112"), new LstItem().addLf(new Lf("lf1121", "lf1121 str22")),
471                 new LstItem().addLf(new Lf("lf1121", "lf1121 str21")));
472     }
473
474     private void checkLst11_1(final LstItem lst11_1) {
475         assertNotNull(lst11_1);
476
477         assertEquals(2, lst11_1.getLfs().size());
478         assertEquals(1, lst11_1.getConts().size());
479         assertEquals(2, lst11_1.getLsts().size());
480
481         assertEquals(lst11_1.getLfs().get("lf112"), new Lf("lf112", "lf112 str"));
482
483         Cont lst11_1_cont = lst11_1.getConts().get("cont111");
484         assertEquals(0, lst11_1_cont.getConts().size());
485         assertEquals(1, lst11_1_cont.getLfLsts().size());
486         assertEquals(1, lst11_1_cont.getLfs().size());
487         assertEquals(1, lst11_1_cont.getLsts().size());
488
489         // cont111 check
490         assertEquals(new Lf("lf1111", "lf1111 str"), lst11_1_cont.getLfs().get("lf1111"));
491         assertEquals(new LfLst("lflst1111").addLf(new Lf(2048)).addLf(new Lf(1024)).addLf(new Lf(4096)), lst11_1_cont
492                 .getLfLsts().get("lflst1111"));
493
494         assertNotNull(lst11_1_cont.getLsts().get("lst1111"));
495         checkLst1111(lst11_1_cont.getLsts().get("lst1111").getLstItems(), new Lf("lf1111A", "lf1111A str11"), new Lf(
496                 "lf1111B", 4), new Lf("lf1111A", "lf1111A str12"), new Lf("lf1111B", 7));
497
498         checkLst11x(lst11_1.getLsts().get("lst111"), new LstItem().addLf(new Lf("lf1111", 65)));
499         checkLst11x(lst11_1.getLsts().get("lst112"), new LstItem().addLf(new Lf("lf1121", "lf1121 str11")));
500     }
501
502     private void checkLst11x(final Lst lst, final LstItem... lstItems) {
503         assertNotNull(lst);
504
505         Lst requiredLst = new Lst(lst.getName());
506         for (LstItem lstItem : lstItems) {
507             requiredLst.addLstItem(lstItem);
508         }
509
510         assertEquals(requiredLst, lst);
511
512     }
513
514     private void checkLst1111(final Set<LstItem> lstItems, final Lf lf11, final Lf lf12, final Lf lf21, final Lf lf22) {
515         LstItem lst11_1_cont_lst1111_1 = null;
516         LstItem lst11_1_cont_lst1111_2 = null;
517         for (LstItem lstItem : lstItems) {
518             if (new LstItem().addLf(lf11).addLf(lf12).equals(lstItem)) {
519                 lst11_1_cont_lst1111_1 = lstItem;
520             } else if (new LstItem().addLf(lf21).addLf(lf22).equals(lstItem)) {
521                 lst11_1_cont_lst1111_2 = lstItem;
522             }
523         }
524
525         assertNotNull(lst11_1_cont_lst1111_1);
526         assertNotNull(lst11_1_cont_lst1111_2);
527     }
528
529     private CompositeNode prepareCompositeNodeWithEmpties() {
530         MutableCompositeNode cont1 = NodeFactory.createMutableCompositeNode(
531                 TestUtils.buildQName("cont1", "simple:yang:types", "2013-11-5"), null, null, ModifyAction.CREATE, null);
532
533         // lst11_1
534         MutableCompositeNode lst11_1 = NodeFactory
535                 .createMutableCompositeNode(TestUtils.buildQName("lst11", "simple:yang:types", "2013-11-5"), cont1,
536                         null, ModifyAction.CREATE, null);
537         cont1.getValue().add(lst11_1);
538
539         MutableSimpleNode<?> lf111_1 = NodeFactory.createMutableSimpleNode(
540                 TestUtils.buildQName("lf111", "simple:yang:types", "2013-11-5"), lst11_1, (short) 1,
541                 ModifyAction.CREATE, null);
542         lst11_1.getValue().add(lf111_1);
543
544         // lst111_1_1
545         MutableCompositeNode lst111_1_1 = NodeFactory.createMutableCompositeNode(
546                 TestUtils.buildQName("lst111", "simple:yang:types", "2013-11-5"), lst11_1, null, ModifyAction.CREATE,
547                 null);
548         lst11_1.getValue().add(lst111_1_1);
549         MutableSimpleNode<?> lf1111_1_1 = NodeFactory.createMutableSimpleNode(
550                 TestUtils.buildQName("lf1111", "simple:yang:types", "2013-11-5"), lst111_1_1, 34, ModifyAction.CREATE,
551                 null);
552         lst111_1_1.getValue().add(lf1111_1_1);
553         lst111_1_1.init();
554         // :lst111_1_1
555
556         // lst111_1_2
557         MutableCompositeNode lst111_1_2 = NodeFactory.createMutableCompositeNode(
558                 TestUtils.buildQName("lst111", "simple:yang:types", "2013-11-5"), lst11_1, null, ModifyAction.CREATE,
559                 null);
560         lst11_1.getValue().add(lst111_1_2);
561         MutableSimpleNode<?> lf1111_1_2 = NodeFactory.createMutableSimpleNode(
562                 TestUtils.buildQName("lf1111", "simple:yang:types", "2013-11-5"), lst111_1_2, 35, ModifyAction.CREATE,
563                 null);
564         lst111_1_2.getValue().add(lf1111_1_2);
565         lst111_1_2.init();
566         // :lst111_1_2
567
568         // lst111_1_3
569         MutableCompositeNode lst111_1_3 = NodeFactory.createMutableCompositeNode(
570                 TestUtils.buildQName("lst111", "simple:yang:types", "2013-11-5"), lst11_1, null, ModifyAction.CREATE,
571                 null);
572         lst11_1.getValue().add(lst111_1_3);
573         lst111_1_2.init();
574         // :lst111_1_3
575
576         // lst111_1_4
577         MutableCompositeNode lst111_1_4 = NodeFactory.createMutableCompositeNode(
578                 TestUtils.buildQName("lst111", "simple:yang:types", "2013-11-5"), lst11_1, null, ModifyAction.CREATE,
579                 null);
580         lst11_1.getValue().add(lst111_1_4);
581         lst111_1_2.init();
582         // :lst111_1_4
583
584         MutableCompositeNode cont111_1 = NodeFactory.createMutableCompositeNode(
585                 TestUtils.buildQName("cont111", "simple:yang:types", "2013-11-5"), lst11_1, null, ModifyAction.CREATE,
586                 null);
587         lst11_1.getValue().add(cont111_1);
588
589         lst11_1.init();
590         // :lst11_1
591
592         // lst11_2
593         MutableCompositeNode lst11_2 = NodeFactory
594                 .createMutableCompositeNode(TestUtils.buildQName("lst11", "simple:yang:types", "2013-11-5"), cont1,
595                         null, ModifyAction.CREATE, null);
596         cont1.getValue().add(lst11_2);
597
598         MutableSimpleNode<?> lf111_2 = NodeFactory.createMutableSimpleNode(
599                 TestUtils.buildQName("lf111", "simple:yang:types", "2013-11-5"), lst11_2, (short) 2,
600                 ModifyAction.CREATE, null);
601         lst11_2.getValue().add(lf111_2);
602
603         // cont111_2
604         MutableCompositeNode cont111_2 = NodeFactory.createMutableCompositeNode(
605                 TestUtils.buildQName("cont111", "simple:yang:types", "2013-11-5"), lst11_2, null, ModifyAction.CREATE,
606                 null);
607         lst11_2.getValue().add(cont111_2);
608
609         MutableSimpleNode<?> lflst1111_2_2 = NodeFactory.createMutableSimpleNode(
610                 TestUtils.buildQName("lflst1111", "simple:yang:types", "2013-11-5"), cont111_2, 1024,
611                 ModifyAction.CREATE, null);
612         cont111_2.getValue().add(lflst1111_2_2);
613         MutableSimpleNode<?> lflst1111_2_3 = NodeFactory.createMutableSimpleNode(
614                 TestUtils.buildQName("lflst1111", "simple:yang:types", "2013-11-5"), cont111_2, 4096,
615                 ModifyAction.CREATE, null);
616         cont111_2.getValue().add(lflst1111_2_3);
617
618         // lst1111_2
619         MutableCompositeNode lst1111_2_1 = NodeFactory.createMutableCompositeNode(
620                 TestUtils.buildQName("lst1111", "simple:yang:types", "2013-11-5"), cont111_2, null,
621                 ModifyAction.CREATE, null);
622         cont111_2.getValue().add(lst1111_2_1);
623         MutableSimpleNode<?> lf1111B_2_1 = NodeFactory.createMutableSimpleNode(
624                 TestUtils.buildQName("lf1111B", "simple:yang:types", "2013-11-5"), lst1111_2_1, (short) 4,
625                 ModifyAction.CREATE, null);
626         lst1111_2_1.getValue().add(lf1111B_2_1);
627         lst1111_2_1.init();
628
629         MutableCompositeNode lst1111_2_2 = NodeFactory.createMutableCompositeNode(
630                 TestUtils.buildQName("lst1111", "simple:yang:types", "2013-11-5"), cont111_2, null,
631                 ModifyAction.CREATE, null);
632         cont111_2.getValue().add(lst1111_2_2);
633         MutableSimpleNode<?> lf1111A_2_2 = NodeFactory.createMutableSimpleNode(
634                 TestUtils.buildQName("lf1111A", "simple:yang:types", "2013-11-5"), lst1111_2_2, "lf1111A str12",
635                 ModifyAction.CREATE, null);
636         lst1111_2_2.getValue().add(lf1111A_2_2);
637         lst1111_2_2.init();
638         // :lst1111_2
639
640         cont111_2.init();
641         // :cont111_2
642
643         MutableCompositeNode lst112_2 = NodeFactory.createMutableCompositeNode(
644                 TestUtils.buildQName("lst112", "simple:yang:types", "2013-11-5"), lst11_2, null, ModifyAction.CREATE,
645                 null);
646         lst11_2.getValue().add(lst112_2);
647         lst112_2.init();
648         lst11_2.init();
649
650         // :lst11_2
651
652         // lst11_3
653         MutableCompositeNode lst11_3 = NodeFactory
654                 .createMutableCompositeNode(TestUtils.buildQName("lst11", "simple:yang:types", "2013-11-5"), cont1,
655                         null, ModifyAction.CREATE, null);
656         cont1.getValue().add(lst11_3);
657
658         MutableSimpleNode<?> lf111_3 = NodeFactory.createMutableSimpleNode(
659                 TestUtils.buildQName("lf111", "simple:yang:types", "2013-11-5"), lst11_3, (short) 3,
660                 ModifyAction.CREATE, null);
661         lst11_3.getValue().add(lf111_3);
662
663         // cont111_3
664         MutableCompositeNode cont111_3 = NodeFactory.createMutableCompositeNode(
665                 TestUtils.buildQName("cont111", "simple:yang:types", "2013-11-5"), lst11_3, null, ModifyAction.CREATE,
666                 null);
667         lst11_3.getValue().add(cont111_3);
668
669         MutableCompositeNode lst1111_3_1 = NodeFactory.createMutableCompositeNode(
670                 TestUtils.buildQName("lst1111", "simple:yang:types", "2013-11-5"), cont111_3, null,
671                 ModifyAction.CREATE, null);
672         cont111_3.getValue().add(lst1111_3_1);
673         lst1111_3_1.init();
674
675         MutableCompositeNode lst1111_3_2 = NodeFactory.createMutableCompositeNode(
676                 TestUtils.buildQName("lst1111", "simple:yang:types", "2013-11-5"), cont111_3, null,
677                 ModifyAction.CREATE, null);
678         cont111_3.getValue().add(lst1111_3_2);
679         lst1111_3_2.init();
680
681         cont111_3.init();
682         // :cont111_3
683
684         lst11_3.init();
685         // :lst11_3
686
687         cont1.init();
688         return cont1;
689     }
690
691 }