Search in sources :

Example 11 with TopBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder in project controller by opendaylight.

the class WriteTransactionTest method test.

@Test
public void test() throws InterruptedException, ExecutionException {
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.OPERATIONAL, TOP_PATH, new TopBuilder().build());
    writeTx.put(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE);
    writeTx.submit().get();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) TopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TopBuilder) AbstractConcurrentDataBrokerTest(org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest) Test(org.junit.Test)

Example 12 with TopBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder in project mdsal by opendaylight.

the class NormalizedNodeSerializeDeserializeTest method leafListFromNormalized.

@Test
public void leafListFromNormalized() {
    final ContainerNode topWithLeafList = ImmutableContainerNodeBuilder.create().withNodeIdentifier(new NodeIdentifier(TOP_QNAME)).withChild(ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(new NodeIdentifier(TOP_LEVEL_LEAF_LIST_QNAME)).withChild(ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(new NodeWithValue<>(TOP_LEVEL_LEAF_LIST_QNAME, "foo")).withValue("foo").build()).build()).build();
    final Entry<InstanceIdentifier<?>, DataObject> entry = codecContext.fromNormalizedNode(BI_TOP_PATH, topWithLeafList);
    final Top top = new TopBuilder().setTopLevelLeafList(Set.of("foo")).build();
    assertEquals(top, entry.getValue());
}
Also used : DataObject(org.opendaylight.yangtools.yang.binding.DataObject) TopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder) Top(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.Top) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) Test(org.junit.Test)

Example 13 with TopBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder in project mdsal by opendaylight.

the class NormalizedNodeSerializeDeserializeTest method leafListToNormalized.

@Test
public void leafListToNormalized() {
    final Top top = new TopBuilder().setTopLevelLeafList(Set.of("foo")).build();
    final Entry<YangInstanceIdentifier, NormalizedNode> entry = codecContext.toNormalizedNode(InstanceIdentifier.create(Top.class), top);
    final ContainerNode containerNode = ImmutableContainerNodeBuilder.create().withNodeIdentifier(new NodeIdentifier(TOP_QNAME)).withChild(ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(new NodeIdentifier(TOP_LEVEL_LEAF_LIST_QNAME)).withChild(ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(new NodeWithValue<>(TOP_LEVEL_LEAF_LIST_QNAME, "foo")).withValue("foo").build()).build()).build();
    assertEquals(containerNode, entry.getValue());
}
Also used : TopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder) Top(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.Top) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) Test(org.junit.Test)

Example 14 with TopBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder in project mdsal by opendaylight.

the class LazyBindingMapTest method prepareTop.

@BeforeClass
public static void prepareTop() {
    final Map<TopLevelListKey, TopLevelList> map = new HashMap<>();
    for (int i = 0; i < 2 * LazyBindingMap.LAZY_CUTOFF; i++) {
        final TopLevelList item = new TopLevelListBuilder().setName(String.valueOf(i)).build();
        map.put(item.key(), item);
    }
    TOP = new TopBuilder().setTopLevelList(map).build();
}
Also used : TopLevelListBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListBuilder) TopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder) HashMap(java.util.HashMap) TopLevelList(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList) TopLevelListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListKey) BeforeClass(org.junit.BeforeClass)

Example 15 with TopBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder in project mdsal by opendaylight.

the class Bug1125RegressionTest method writeInitialState.

private TreeComplexUsesAugment writeInitialState() {
    WriteTransaction initialTx = getDataBroker().newWriteOnlyTransaction();
    initialTx.put(LogicalDatastoreType.OPERATIONAL, TOP_PATH, new TopBuilder().build());
    TreeComplexUsesAugment fooAugment = new TreeComplexUsesAugmentBuilder().setContainerWithUses(new ContainerWithUsesBuilder().setLeafFromGrouping("foo").build()).build();
    initialTx.put(LogicalDatastoreType.OPERATIONAL, path(TOP_FOO_KEY), topLevelList(TOP_FOO_KEY, fooAugment));
    assertCommit(initialTx.commit());
    return fooAugment;
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) TopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder) TreeComplexUsesAugment(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeComplexUsesAugment) ContainerWithUsesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.complex.from.grouping.ContainerWithUsesBuilder) TreeComplexUsesAugmentBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeComplexUsesAugmentBuilder)

Aggregations

TopBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder)14 Test (org.junit.Test)13 Top (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.Top)8 WriteTransaction (org.opendaylight.mdsal.binding.api.WriteTransaction)7 AbstractDataBrokerTest (org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataBrokerTest)5 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)5 NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)5 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)4 TopBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TopBuilder)4 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)4 NormalizedNode (org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)4 TopLevelList (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList)3 TopLevelListBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListBuilder)3 TopLevelListKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListKey)3 DataObject (org.opendaylight.yangtools.yang.binding.DataObject)3 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)3 AbstractConcurrentDataBrokerTest (org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest)2 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)2 ReadWriteTransaction (org.opendaylight.mdsal.binding.api.ReadWriteTransaction)2 TreeComplexUsesAugment (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.augment.rev140709.TreeComplexUsesAugment)2