use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.list1.List11Builder in project controller by opendaylight.
the class WriteParentReadChildTest method writeParentReadChild.
/**
* The scenario tests writing parent node, which also contains child items
* and then reading child directly, by specifying path to the child.
* Expected behaviour is child is returned.
*/
@Test
public void writeParentReadChild() throws Exception {
DataBroker dataBroker = testContext.getDataBroker();
final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
List11 list11 = //
new List11Builder().setKey(//
LIST11_KEY).setAttrStr("primary").build();
List1 list1 = new List1Builder().setKey(LIST1_KEY).setList11(ImmutableList.of(list11)).build();
transaction.put(LogicalDatastoreType.OPERATIONAL, LIST1_INSTANCE_ID_BA, list1, true);
transaction.submit().get(5, TimeUnit.SECONDS);
Optional<List1> readList1 = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL, LIST1_INSTANCE_ID_BA).get(1000, TimeUnit.MILLISECONDS);
assertTrue(readList1.isPresent());
Optional<? extends DataObject> readList11 = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL, LIST11_INSTANCE_ID_BA).get(5, TimeUnit.SECONDS);
assertNotNull("Readed flow should not be null.", readList11);
assertTrue(readList11.isPresent());
assertEquals(list11, readList11.get());
}
Aggregations