Adjust to yangtools-2.0.0 changes
[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 INVALID_QNAME = QName.create(TEST_QNAME, "invalid");
98     private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
99     private static final String DATASTORE_AUG_YANG = "/odl-datastore-augmentation.yang";
100     private static final String DATASTORE_TEST_NOTIFICATION_YANG = "/odl-datastore-test-notification.yang";
101
102     public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
103     public static final YangInstanceIdentifier DESC_PATH = YangInstanceIdentifier
104             .builder(TEST_PATH).node(DESC_QNAME).build();
105     public static final YangInstanceIdentifier OUTER_LIST_PATH =
106             YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
107     public static final QName TWO_THREE_QNAME = QName.create(TEST_QNAME, "two");
108     public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
109     public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
110
111     private static final Integer ONE_ID = 1;
112     private static final Integer TWO_ID = 2;
113     private static final String TWO_ONE_NAME = "one";
114     private static final String TWO_TWO_NAME = "two";
115     private static final String DESC = "Hello there";
116     private static final Boolean ENABLED = true;
117     private static final Short SHORT_ID = 1;
118     private static final Byte BYTE_ID = 1;
119     // Family specific constants
120     public static final QName FAMILY_QNAME = QName.create(
121         "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test", "2014-04-17", "family");
122     public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME, "children");
123     public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME, "grand-children");
124     public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME, "child-number");
125     public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME, "child-name");
126     public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME, "grand-child-number");
127     public static final QName GRAND_CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,"grand-child-name");
128
129     public static final YangInstanceIdentifier FAMILY_PATH = YangInstanceIdentifier.of(FAMILY_QNAME);
130     public static final YangInstanceIdentifier FAMILY_DESC_PATH =
131             YangInstanceIdentifier.builder(FAMILY_PATH).node(DESC_QNAME).build();
132     public static final YangInstanceIdentifier CHILDREN_PATH =
133             YangInstanceIdentifier.builder(FAMILY_PATH).node(CHILDREN_QNAME).build();
134
135     private static final Integer FIRST_CHILD_ID = 1;
136     private static final Integer SECOND_CHILD_ID = 2;
137
138     private static final String FIRST_CHILD_NAME = "first child";
139     private static final String SECOND_CHILD_NAME = "second child";
140
141     private static final Integer FIRST_GRAND_CHILD_ID = 1;
142     private static final Integer SECOND_GRAND_CHILD_ID = 2;
143
144     private static final String FIRST_GRAND_CHILD_NAME = "first grand child";
145     private static final String SECOND_GRAND_CHILD_NAME = "second grand child";
146
147     private static final MapEntryNode BAR_NODE = mapEntryBuilder(
148             OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
149             .withChild(mapNodeBuilder(INNER_LIST_QNAME) //
150                     .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) //
151                     .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) //
152                     .build()) //
153             .build();
154
155     private TestModel() {
156         throw new UnsupportedOperationException();
157     }
158
159     public static InputStream getDatastoreTestInputStream() {
160         return getInputStream(DATASTORE_TEST_YANG);
161     }
162
163     public static InputStream getDatastoreAugInputStream() {
164         return getInputStream(DATASTORE_AUG_YANG);
165     }
166
167     public static InputStream getDatastoreTestNotificationInputStream() {
168         return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG);
169     }
170
171     private static InputStream getInputStream(final String resourceName) {
172         return TestModel.class.getResourceAsStream(resourceName);
173     }
174
175     public static SchemaContext createTestContext() {
176         return YangParserTestUtils.parseYangResources(TestModel.class, DATASTORE_TEST_YANG, DATASTORE_AUG_YANG,
177             DATASTORE_TEST_NOTIFICATION_YANG);
178     }
179
180     public static SchemaContext createTestContextWithoutTestSchema() {
181         return YangParserTestUtils.parseYangResource(DATASTORE_TEST_NOTIFICATION_YANG);
182     }
183
184     public static SchemaContext createTestContextWithoutAugmentationSchema() {
185         return YangParserTestUtils.parseYangResources(TestModel.class, DATASTORE_TEST_YANG,
186             DATASTORE_TEST_NOTIFICATION_YANG);
187     }
188
189     /**
190      * Returns a test document.
191      * <p/>
192      * <p/>
193      * <pre>
194      * test
195      *     outer-list
196      *          id 1
197      *     outer-list
198      *          id 2
199      *          inner-list
200      *                  name "one"
201      *          inner-list
202      *                  name "two"
203      *
204      * </pre>
205      */
206     public static NormalizedNode<?, ?> createDocumentOne(final SchemaContext schemaContext) {
207         return ImmutableContainerNodeBuilder
208                 .create()
209                 .withNodeIdentifier(
210                         new NodeIdentifier(schemaContext.getQName()))
211                 .withChild(createTestContainer()).build();
212
213     }
214
215     public static DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> createBaseTestContainerBuilder() {
216         // Create a list of shoes
217         // This is to test leaf list entry
218         final LeafSetEntryNode<Object> nike = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
219                 new NodeWithValue<>(SHOE_QNAME, "nike")).withValue("nike").build();
220
221         final LeafSetEntryNode<Object> puma = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
222                 new NodeWithValue<>(SHOE_QNAME, "puma")).withValue("puma").build();
223
224         final LeafSetNode<Object> shoes = ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(
225                 new NodeIdentifier(SHOE_QNAME)).withChild(nike).withChild(puma).build();
226
227         // Test a leaf-list where each entry contains an identity
228         final LeafSetEntryNode<Object> cap1 =
229                 ImmutableLeafSetEntryNodeBuilder
230                         .create()
231                         .withNodeIdentifier(
232                                 new NodeWithValue<>(QName.create(
233                                         TEST_QNAME, "capability"), DESC_QNAME))
234                         .withValue(DESC_QNAME).build();
235
236         final LeafSetNode<Object> capabilities =
237                 ImmutableLeafSetNodeBuilder
238                         .create()
239                         .withNodeIdentifier(
240                                 new NodeIdentifier(QName.create(
241                                         TEST_QNAME, "capability"))).withChild(cap1).build();
242
243         ContainerNode switchFeatures =
244                 ImmutableContainerNodeBuilder
245                         .create()
246                         .withNodeIdentifier(
247                                 new NodeIdentifier(SWITCH_FEATURES_QNAME))
248                         .withChild(capabilities).build();
249
250         // Create a leaf list with numbers
251         final LeafSetEntryNode<Object> five =
252                 ImmutableLeafSetEntryNodeBuilder
253                         .create()
254                         .withNodeIdentifier(
255                                 new NodeWithValue<>(QName.create(
256                                         TEST_QNAME, "number"), 5)).withValue(5).build();
257         final LeafSetEntryNode<Object> fifteen =
258                 ImmutableLeafSetEntryNodeBuilder
259                         .create()
260                         .withNodeIdentifier(
261                                 new NodeWithValue<>(QName.create(
262                                         TEST_QNAME, "number"), 15)).withValue(15).build();
263         final LeafSetNode<Object> numbers =
264                 ImmutableLeafSetNodeBuilder
265                         .create()
266                         .withNodeIdentifier(
267                                 new NodeIdentifier(QName.create(
268                                         TEST_QNAME, "number"))).withChild(five).withChild(fifteen)
269                         .build();
270
271
272         // Create augmentations
273         MapEntryNode augMapEntry = createAugmentedListEntry(1, "First Test");
274
275         // Create a bits leaf
276         NormalizedNodeAttrBuilder<NodeIdentifier, Object, LeafNode<Object>>
277                 myBits = Builders.leafBuilder()
278                 .withNodeIdentifier(new NodeIdentifier(QName.create(TEST_QNAME, "my-bits")))
279                 .withValue(ImmutableSet.of("foo", "bar"));
280
281         // Create unkeyed list entry
282         UnkeyedListEntryNode unkeyedListEntry =
283                 Builders.unkeyedListEntryBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(
284                     UNKEYED_LIST_QNAME)).withChild(ImmutableNodes.leafNode(NAME_QNAME, "unkeyed-entry-name")).build();
285
286         // Create YangInstanceIdentifier with all path arg types.
287         YangInstanceIdentifier instanceID = YangInstanceIdentifier.create(
288                 new NodeIdentifier(QName.create(TEST_QNAME, "qname")),
289                 new NodeIdentifierWithPredicates(QName.create(TEST_QNAME, "list-entry"),
290                         QName.create(TEST_QNAME, "key"), 10),
291                 new AugmentationIdentifier(ImmutableSet.of(
292                         QName.create(TEST_QNAME, "aug1"), QName.create(TEST_QNAME, "aug2"))),
293                 new NodeWithValue<>(QName.create(TEST_QNAME, "leaf-list-entry"), "foo"));
294
295         Map<QName, Object> keyValues = new HashMap<>();
296         keyValues.put(CHILDREN_QNAME, FIRST_CHILD_NAME);
297
298
299         // Create the document
300         return ImmutableContainerNodeBuilder
301                 .create()
302                 .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME))
303                 .withChild(myBits.build())
304                 .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC))
305                 .withChild(ImmutableNodes.leafNode(BOOLEAN_LEAF_QNAME, ENABLED))
306                 .withChild(ImmutableNodes.leafNode(SHORT_LEAF_QNAME, SHORT_ID))
307                 .withChild(ImmutableNodes.leafNode(BYTE_LEAF_QNAME, BYTE_ID))
308                 .withChild(ImmutableNodes.leafNode(TestModel.BIGINTEGER_LEAF_QNAME, BigInteger.valueOf(100)))
309                 .withChild(ImmutableNodes.leafNode(TestModel.BIGDECIMAL_LEAF_QNAME, BigDecimal.valueOf(1.2)))
310                 .withChild(ImmutableNodes.leafNode(SOME_REF_QNAME, instanceID))
311                 .withChild(ImmutableNodes.leafNode(MYIDENTITY_QNAME, DESC_QNAME))
312                 .withChild(Builders.unkeyedListBuilder()
313                         .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(UNKEYED_LIST_QNAME))
314                         .withChild(unkeyedListEntry).build())
315                 .withChild(Builders.choiceBuilder()
316                         .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TWO_THREE_QNAME))
317                         .withChild(ImmutableNodes.leafNode(TWO_QNAME, "two")).build())
318                 .withChild(Builders.orderedMapBuilder()
319                         .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(ORDERED_LIST_QNAME))
320                         .withValue(ImmutableList.<MapEntryNode>builder().add(
321                                 mapEntryBuilder(ORDERED_LIST_QNAME, ORDERED_LIST_ENTRY_QNAME, "1").build(),
322                                 mapEntryBuilder(ORDERED_LIST_QNAME, ORDERED_LIST_ENTRY_QNAME, "2").build()).build())
323                         .build())
324                 .withChild(shoes)
325                 .withChild(numbers)
326                 .withChild(switchFeatures)
327                 .withChild(mapNodeBuilder(AUGMENTED_LIST_QNAME).withChild(augMapEntry).build())
328                 .withChild(mapNodeBuilder(OUTER_LIST_QNAME)
329                                 .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
330                                 .withChild(BAR_NODE).build()
331                 );
332     }
333
334     public static ContainerNode createTestContainer() {
335         return createBaseTestContainerBuilder().build();
336     }
337
338     public static MapEntryNode createAugmentedListEntry(final int id, final String name) {
339
340         Set<QName> childAugmentations = new HashSet<>();
341         childAugmentations.add(AUG_CONT_QNAME);
342
343         ContainerNode augCont =
344                 ImmutableContainerNodeBuilder
345                         .create()
346                         .withNodeIdentifier(
347                                 new YangInstanceIdentifier.NodeIdentifier(AUG_CONT_QNAME))
348                         .withChild(ImmutableNodes.leafNode(AUG_NAME_QNAME, name)).build();
349
350
351         final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
352                 new YangInstanceIdentifier.AugmentationIdentifier(childAugmentations);
353
354         final AugmentationNode augmentationNode =
355                 Builders.augmentationBuilder()
356                         .withNodeIdentifier(augmentationIdentifier).withChild(augCont)
357                         .build();
358
359         return ImmutableMapEntryNodeBuilder
360                 .create()
361                 .withNodeIdentifier(
362                         new YangInstanceIdentifier.NodeIdentifierWithPredicates(
363                                 AUGMENTED_LIST_QNAME, ID_QNAME, id))
364                 .withChild(ImmutableNodes.leafNode(ID_QNAME, id))
365                 .withChild(augmentationNode).build();
366     }
367
368
369     public static ContainerNode createFamily() {
370         final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode>
371             familyContainerBuilder = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
372                         new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME));
373
374         final CollectionNodeBuilder<MapEntryNode, MapNode> childrenBuilder =
375                 mapNodeBuilder(CHILDREN_QNAME);
376
377         final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
378             firstChildBuilder = mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID);
379         final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
380             secondChildBuilder = mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID);
381
382         final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
383             firstGrandChildBuilder = mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
384                     FIRST_GRAND_CHILD_ID);
385         final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
386             secondGrandChildBuilder = mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
387                     SECOND_GRAND_CHILD_ID);
388
389         firstGrandChildBuilder
390                 .withChild(
391                         ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME,
392                                 FIRST_GRAND_CHILD_ID)).withChild(
393                 ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
394                         FIRST_GRAND_CHILD_NAME));
395
396         secondGrandChildBuilder.withChild(
397                 ImmutableNodes
398                         .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID))
399                 .withChild(
400                         ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
401                                 SECOND_GRAND_CHILD_NAME));
402
403         firstChildBuilder
404                 .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID))
405                 .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME))
406                 .withChild(
407                         mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
408                                 firstGrandChildBuilder.build()).build());
409
410
411         secondChildBuilder
412                 .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID))
413                 .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME))
414                 .withChild(
415                         mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
416                                 firstGrandChildBuilder.build()).build());
417
418         childrenBuilder.withChild(firstChildBuilder.build());
419         childrenBuilder.withChild(secondChildBuilder.build());
420
421         return familyContainerBuilder.withChild(childrenBuilder.build()).build();
422     }
423
424 }

©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.