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

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