Handle empty type in NormalizedNode streaming
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / test / java / org / opendaylight / controller / cluster / datastore / util / TestModel.java
1 /*
2  * Copyright (c) 2014, 2015 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
9 package org.opendaylight.controller.cluster.datastore.util;
10
11 import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntry;
12 import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder;
13 import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
14
15 import com.google.common.collect.ImmutableList;
16 import com.google.common.collect.ImmutableSet;
17 import java.io.InputStream;
18 import java.math.BigDecimal;
19 import java.math.BigInteger;
20 import java.util.HashMap;
21 import java.util.HashSet;
22 import java.util.Map;
23 import java.util.Set;
24 import org.opendaylight.yangtools.yang.common.QName;
25 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
26 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
27 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
28 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
29 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
30 import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
31 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
32 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
33 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
34 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
35 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
36 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
37 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
38 import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
39 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
40 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
41 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
42 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
43 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
44 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeAttrBuilder;
45 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
46 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetEntryNodeBuilder;
47 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetNodeBuilder;
48 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeBuilder;
49 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
50 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
51
52 public final class TestModel {
53
54     public static final QName TEST_QNAME = QName.create(
55             "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test",
56             "2014-03-13", "test");
57
58     public static final QName AUG_NAME_QNAME = QName.create(
59             "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
60             "2014-03-13", "name");
61
62     public static final QName AUG_CONT_QNAME = QName.create(
63             "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
64             "2014-03-13", "cont");
65
66
67     public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc");
68     public static final QName POINTER_QNAME = QName.create(TEST_QNAME, "pointer");
69     public static final QName SOME_BINARY_DATA_QNAME = QName.create(TEST_QNAME, "some-binary-data");
70     public static final QName BINARY_LEAF_LIST_QNAME = QName.create(TEST_QNAME, "binary_leaf_list");
71     public static final QName SOME_REF_QNAME = QName.create(TEST_QNAME, "some-ref");
72     public static final QName MYIDENTITY_QNAME = QName.create(TEST_QNAME, "myidentity");
73     public static final QName SWITCH_FEATURES_QNAME = QName.create(TEST_QNAME, "switch-features");
74
75     public static final QName AUGMENTED_LIST_QNAME = QName.create(TEST_QNAME, "augmented-list");
76     public static final QName AUGMENTED_LIST_ENTRY_QNAME = QName.create(TEST_QNAME, "augmented-list-entry");
77
78     public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, "outer-list");
79     public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, "inner-list");
80     public static final QName INNER_CONTAINER_QNAME = QName.create(TEST_QNAME, "inner-container");
81     public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME, "outer-choice");
82     public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
83     public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
84     public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
85     public static final QName BOOLEAN_LEAF_QNAME = QName.create(TEST_QNAME, "boolean-leaf");
86     public static final QName SHORT_LEAF_QNAME = QName.create(TEST_QNAME, "short-leaf");
87     public static final QName BYTE_LEAF_QNAME = QName.create(TEST_QNAME, "byte-leaf");
88     public static final QName BIGINTEGER_LEAF_QNAME = QName.create(TEST_QNAME, "biginteger-leaf");
89     public static final QName BIGDECIMAL_LEAF_QNAME = QName.create(TEST_QNAME, "bigdecimal-leaf");
90     public static final QName ORDERED_LIST_QNAME = QName.create(TEST_QNAME, "ordered-list");
91     public static final QName ORDERED_LIST_ENTRY_QNAME = QName.create(TEST_QNAME, "ordered-list-leaf");
92     public static final QName UNKEYED_LIST_QNAME = QName.create(TEST_QNAME, "unkeyed-list");
93     public static final QName UNKEYED_LIST_ENTRY_QNAME = QName.create(TEST_QNAME, "unkeyed-list-entry");
94     public static final QName CHOICE_QNAME = QName.create(TEST_QNAME, "choice");
95     public static final QName SHOE_QNAME = QName.create(TEST_QNAME, "shoe");
96     public static final QName ANY_XML_QNAME = QName.create(TEST_QNAME, "any");
97     public static final QName EMPTY_QNAME = QName.create(TEST_QNAME, "empty-leaf");
98     public static final QName INVALID_QNAME = QName.create(TEST_QNAME, "invalid");
99     private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
100     private static final String DATASTORE_AUG_YANG = "/odl-datastore-augmentation.yang";
101     private static final String DATASTORE_TEST_NOTIFICATION_YANG = "/odl-datastore-test-notification.yang";
102
103     public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
104     public static final YangInstanceIdentifier DESC_PATH = YangInstanceIdentifier
105             .builder(TEST_PATH).node(DESC_QNAME).build();
106     public static final YangInstanceIdentifier OUTER_LIST_PATH =
107             YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
108     public static final QName TWO_THREE_QNAME = QName.create(TEST_QNAME, "two");
109     public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
110     public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
111
112     private static final Integer ONE_ID = 1;
113     private static final Integer TWO_ID = 2;
114     private static final String TWO_ONE_NAME = "one";
115     private static final String TWO_TWO_NAME = "two";
116     private static final String DESC = "Hello there";
117     private static final Boolean ENABLED = true;
118     private static final Short SHORT_ID = 1;
119     private static final Byte BYTE_ID = 1;
120     // Family specific constants
121     public static final QName FAMILY_QNAME = QName.create(
122         "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test", "2014-04-17", "family");
123     public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME, "children");
124     public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME, "grand-children");
125     public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME, "child-number");
126     public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME, "child-name");
127     public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME, "grand-child-number");
128     public static final QName GRAND_CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,"grand-child-name");
129
130     public static final YangInstanceIdentifier FAMILY_PATH = YangInstanceIdentifier.of(FAMILY_QNAME);
131     public static final YangInstanceIdentifier FAMILY_DESC_PATH =
132             YangInstanceIdentifier.builder(FAMILY_PATH).node(DESC_QNAME).build();
133     public static final YangInstanceIdentifier CHILDREN_PATH =
134             YangInstanceIdentifier.builder(FAMILY_PATH).node(CHILDREN_QNAME).build();
135
136     private static final Integer FIRST_CHILD_ID = 1;
137     private static final Integer SECOND_CHILD_ID = 2;
138
139     private static final String FIRST_CHILD_NAME = "first child";
140     private static final String SECOND_CHILD_NAME = "second child";
141
142     private static final Integer FIRST_GRAND_CHILD_ID = 1;
143     private static final Integer SECOND_GRAND_CHILD_ID = 2;
144
145     private static final String FIRST_GRAND_CHILD_NAME = "first grand child";
146     private static final String SECOND_GRAND_CHILD_NAME = "second grand child";
147
148     private static final MapEntryNode BAR_NODE = mapEntryBuilder(
149             OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
150             .withChild(mapNodeBuilder(INNER_LIST_QNAME) //
151                     .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) //
152                     .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) //
153                     .build()) //
154             .build();
155
156     private TestModel() {
157         throw new UnsupportedOperationException();
158     }
159
160     public static InputStream getDatastoreTestInputStream() {
161         return getInputStream(DATASTORE_TEST_YANG);
162     }
163
164     public static InputStream getDatastoreAugInputStream() {
165         return getInputStream(DATASTORE_AUG_YANG);
166     }
167
168     public static InputStream getDatastoreTestNotificationInputStream() {
169         return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG);
170     }
171
172     private static InputStream getInputStream(final String resourceName) {
173         return TestModel.class.getResourceAsStream(resourceName);
174     }
175
176     public static SchemaContext createTestContext() {
177         return YangParserTestUtils.parseYangResources(TestModel.class, DATASTORE_TEST_YANG, DATASTORE_AUG_YANG,
178             DATASTORE_TEST_NOTIFICATION_YANG);
179     }
180
181     public static SchemaContext createTestContextWithoutTestSchema() {
182         return YangParserTestUtils.parseYangResource(DATASTORE_TEST_NOTIFICATION_YANG);
183     }
184
185     public static SchemaContext createTestContextWithoutAugmentationSchema() {
186         return YangParserTestUtils.parseYangResources(TestModel.class, DATASTORE_TEST_YANG,
187             DATASTORE_TEST_NOTIFICATION_YANG);
188     }
189
190     /**
191      * Returns a test document.
192      * <p/>
193      * <p/>
194      * <pre>
195      * test
196      *     outer-list
197      *          id 1
198      *     outer-list
199      *          id 2
200      *          inner-list
201      *                  name "one"
202      *          inner-list
203      *                  name "two"
204      *
205      * </pre>
206      */
207     public static NormalizedNode<?, ?> createDocumentOne(final SchemaContext schemaContext) {
208         return ImmutableContainerNodeBuilder
209                 .create()
210                 .withNodeIdentifier(
211                         new NodeIdentifier(schemaContext.getQName()))
212                 .withChild(createTestContainer()).build();
213
214     }
215
216     public static DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> createBaseTestContainerBuilder() {
217         // Create a list of shoes
218         // This is to test leaf list entry
219         final LeafSetEntryNode<Object> nike = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
220                 new NodeWithValue<>(SHOE_QNAME, "nike")).withValue("nike").build();
221
222         final LeafSetEntryNode<Object> puma = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
223                 new NodeWithValue<>(SHOE_QNAME, "puma")).withValue("puma").build();
224
225         final LeafSetNode<Object> shoes = ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(
226                 new NodeIdentifier(SHOE_QNAME)).withChild(nike).withChild(puma).build();
227
228         // Test a leaf-list where each entry contains an identity
229         final LeafSetEntryNode<Object> cap1 =
230                 ImmutableLeafSetEntryNodeBuilder
231                         .create()
232                         .withNodeIdentifier(
233                                 new NodeWithValue<>(QName.create(
234                                         TEST_QNAME, "capability"), DESC_QNAME))
235                         .withValue(DESC_QNAME).build();
236
237         final LeafSetNode<Object> capabilities =
238                 ImmutableLeafSetNodeBuilder
239                         .create()
240                         .withNodeIdentifier(
241                                 new NodeIdentifier(QName.create(
242                                         TEST_QNAME, "capability"))).withChild(cap1).build();
243
244         ContainerNode switchFeatures =
245                 ImmutableContainerNodeBuilder
246                         .create()
247                         .withNodeIdentifier(
248                                 new NodeIdentifier(SWITCH_FEATURES_QNAME))
249                         .withChild(capabilities).build();
250
251         // Create a leaf list with numbers
252         final LeafSetEntryNode<Object> five =
253                 ImmutableLeafSetEntryNodeBuilder
254                         .create()
255                         .withNodeIdentifier(
256                                 new NodeWithValue<>(QName.create(
257                                         TEST_QNAME, "number"), 5)).withValue(5).build();
258         final LeafSetEntryNode<Object> fifteen =
259                 ImmutableLeafSetEntryNodeBuilder
260                         .create()
261                         .withNodeIdentifier(
262                                 new NodeWithValue<>(QName.create(
263                                         TEST_QNAME, "number"), 15)).withValue(15).build();
264         final LeafSetNode<Object> numbers =
265                 ImmutableLeafSetNodeBuilder
266                         .create()
267                         .withNodeIdentifier(
268                                 new NodeIdentifier(QName.create(
269                                         TEST_QNAME, "number"))).withChild(five).withChild(fifteen)
270                         .build();
271
272
273         // Create augmentations
274         MapEntryNode augMapEntry = createAugmentedListEntry(1, "First Test");
275
276         // Create a bits leaf
277         NormalizedNodeAttrBuilder<NodeIdentifier, Object, LeafNode<Object>>
278                 myBits = Builders.leafBuilder()
279                 .withNodeIdentifier(new NodeIdentifier(QName.create(TEST_QNAME, "my-bits")))
280                 .withValue(ImmutableSet.of("foo", "bar"));
281
282         // Create unkeyed list entry
283         UnkeyedListEntryNode unkeyedListEntry =
284                 Builders.unkeyedListEntryBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(
285                     UNKEYED_LIST_QNAME)).withChild(ImmutableNodes.leafNode(NAME_QNAME, "unkeyed-entry-name")).build();
286
287         // Create YangInstanceIdentifier with all path arg types.
288         YangInstanceIdentifier instanceID = YangInstanceIdentifier.create(
289                 new NodeIdentifier(QName.create(TEST_QNAME, "qname")),
290                 new NodeIdentifierWithPredicates(QName.create(TEST_QNAME, "list-entry"),
291                         QName.create(TEST_QNAME, "key"), 10),
292                 new AugmentationIdentifier(ImmutableSet.of(
293                         QName.create(TEST_QNAME, "aug1"), QName.create(TEST_QNAME, "aug2"))),
294                 new NodeWithValue<>(QName.create(TEST_QNAME, "leaf-list-entry"), "foo"));
295
296         Map<QName, Object> keyValues = new HashMap<>();
297         keyValues.put(CHILDREN_QNAME, FIRST_CHILD_NAME);
298
299
300         // Create the document
301         return ImmutableContainerNodeBuilder
302                 .create()
303                 .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME))
304                 .withChild(myBits.build())
305                 .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC))
306                 .withChild(ImmutableNodes.leafNode(BOOLEAN_LEAF_QNAME, ENABLED))
307                 .withChild(ImmutableNodes.leafNode(SHORT_LEAF_QNAME, SHORT_ID))
308                 .withChild(ImmutableNodes.leafNode(BYTE_LEAF_QNAME, BYTE_ID))
309                 .withChild(ImmutableNodes.leafNode(TestModel.BIGINTEGER_LEAF_QNAME, BigInteger.valueOf(100)))
310                 .withChild(ImmutableNodes.leafNode(TestModel.BIGDECIMAL_LEAF_QNAME, BigDecimal.valueOf(1.2)))
311                 .withChild(ImmutableNodes.leafNode(SOME_REF_QNAME, instanceID))
312                 .withChild(ImmutableNodes.leafNode(MYIDENTITY_QNAME, DESC_QNAME))
313                 .withChild(Builders.unkeyedListBuilder()
314                         .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(UNKEYED_LIST_QNAME))
315                         .withChild(unkeyedListEntry).build())
316                 .withChild(Builders.choiceBuilder()
317                         .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TWO_THREE_QNAME))
318                         .withChild(ImmutableNodes.leafNode(TWO_QNAME, "two")).build())
319                 .withChild(Builders.orderedMapBuilder()
320                         .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(ORDERED_LIST_QNAME))
321                         .withValue(ImmutableList.<MapEntryNode>builder().add(
322                                 mapEntryBuilder(ORDERED_LIST_QNAME, ORDERED_LIST_ENTRY_QNAME, "1").build(),
323                                 mapEntryBuilder(ORDERED_LIST_QNAME, ORDERED_LIST_ENTRY_QNAME, "2").build()).build())
324                         .build())
325                 .withChild(shoes)
326                 .withChild(numbers)
327                 .withChild(switchFeatures)
328                 .withChild(mapNodeBuilder(AUGMENTED_LIST_QNAME).withChild(augMapEntry).build())
329                 .withChild(mapNodeBuilder(OUTER_LIST_QNAME)
330                                 .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
331                                 .withChild(BAR_NODE).build()
332                 );
333     }
334
335     public static ContainerNode createTestContainer() {
336         return createBaseTestContainerBuilder().build();
337     }
338
339     public static MapEntryNode createAugmentedListEntry(final int id, final String name) {
340
341         Set<QName> childAugmentations = new HashSet<>();
342         childAugmentations.add(AUG_CONT_QNAME);
343
344         ContainerNode augCont =
345                 ImmutableContainerNodeBuilder
346                         .create()
347                         .withNodeIdentifier(
348                                 new YangInstanceIdentifier.NodeIdentifier(AUG_CONT_QNAME))
349                         .withChild(ImmutableNodes.leafNode(AUG_NAME_QNAME, name)).build();
350
351
352         final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
353                 new YangInstanceIdentifier.AugmentationIdentifier(childAugmentations);
354
355         final AugmentationNode augmentationNode =
356                 Builders.augmentationBuilder()
357                         .withNodeIdentifier(augmentationIdentifier).withChild(augCont)
358                         .build();
359
360         return ImmutableMapEntryNodeBuilder
361                 .create()
362                 .withNodeIdentifier(
363                         new YangInstanceIdentifier.NodeIdentifierWithPredicates(
364                                 AUGMENTED_LIST_QNAME, ID_QNAME, id))
365                 .withChild(ImmutableNodes.leafNode(ID_QNAME, id))
366                 .withChild(augmentationNode).build();
367     }
368
369
370     public static ContainerNode createFamily() {
371         final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode>
372             familyContainerBuilder = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
373                         new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME));
374
375         final CollectionNodeBuilder<MapEntryNode, MapNode> childrenBuilder =
376                 mapNodeBuilder(CHILDREN_QNAME);
377
378         final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
379             firstChildBuilder = mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID);
380         final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
381             secondChildBuilder = mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID);
382
383         final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
384             firstGrandChildBuilder = mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
385                     FIRST_GRAND_CHILD_ID);
386         final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
387             secondGrandChildBuilder = mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
388                     SECOND_GRAND_CHILD_ID);
389
390         firstGrandChildBuilder
391                 .withChild(
392                         ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME,
393                                 FIRST_GRAND_CHILD_ID)).withChild(
394                 ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
395                         FIRST_GRAND_CHILD_NAME));
396
397         secondGrandChildBuilder.withChild(
398                 ImmutableNodes
399                         .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID))
400                 .withChild(
401                         ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
402                                 SECOND_GRAND_CHILD_NAME));
403
404         firstChildBuilder
405                 .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID))
406                 .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME))
407                 .withChild(
408                         mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
409                                 firstGrandChildBuilder.build()).build());
410
411
412         secondChildBuilder
413                 .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID))
414                 .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME))
415                 .withChild(
416                         mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
417                                 firstGrandChildBuilder.build()).build());
418
419         childrenBuilder.withChild(firstChildBuilder.build());
420         childrenBuilder.withChild(secondChildBuilder.build());
421
422         return familyContainerBuilder.withChild(childrenBuilder.build()).build();
423     }
424
425 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.