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