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