Search in sources :

Example 11 with DataTreeIdentifier

use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project controller by opendaylight.

the class BindingDOMDataTreeChangeServiceAdapterTest method testRegisterDataTreeChangeListener.

@Test
public void testRegisterDataTreeChangeListener() {
    final BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
    final DataTreeChangeService service = BindingDOMDataTreeChangeServiceAdapter.create(codec, this.mockDOMService);
    doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID), any(DOMDataTreeChangeListener.class));
    final DataTreeIdentifier<Top> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, TOP_PATH);
    final TestClusteredDataTreeChangeListener mockClusteredListener = new TestClusteredDataTreeChangeListener();
    service.registerDataTreeChangeListener(treeId, mockClusteredListener);
    verify(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID), isA(ClusteredDOMDataTreeChangeListener.class));
    reset(this.mockDOMService);
    doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID), any(DOMDataTreeChangeListener.class));
    final TestDataTreeChangeListener mockNonClusteredListener = new TestDataTreeChangeListener();
    service.registerDataTreeChangeListener(treeId, mockNonClusteredListener);
    verify(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID), not(isA(ClusteredDOMDataTreeChangeListener.class)));
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) DOMDataTreeIdentifier(org.opendaylight.controller.md.sal.dom.api.DOMDataTreeIdentifier) DataTreeChangeService(org.opendaylight.controller.md.sal.binding.api.DataTreeChangeService) DOMDataTreeChangeService(org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService) Top(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top) ClusteredDOMDataTreeChangeListener(org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeListener) DOMDataTreeChangeListener(org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener) ClusteredDOMDataTreeChangeListener(org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeListener) Test(org.junit.Test)

Example 12 with DataTreeIdentifier

use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project bgpcep by opendaylight.

the class BmpDeployerImpl method init.

public synchronized void init() {
    final DOMDataWriteTransaction wTx = this.bmpDeployerDependencies.getDomDataBroker().newWriteOnlyTransaction();
    wTx.merge(LogicalDatastoreType.OPERATIONAL, BMP_MONITOR_YII, EMPTY_PARENT_NODE);
    wTx.submit();
    this.registration = this.bmpDeployerDependencies.getDataBroker().registerDataTreeChangeListener(new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, ODL_BMP_MONITORS_IID), this);
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) DOMDataWriteTransaction(org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction)

Example 13 with DataTreeIdentifier

use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project bgpcep by opendaylight.

the class LocRibWriter method init.

@SuppressWarnings("unchecked")
private synchronized void init() {
    final WriteTransaction tx = this.chain.newWriteOnlyTransaction();
    tx.merge(LogicalDatastoreType.OPERATIONAL, this.locRibTableIID.builder().child(Attributes.class).build(), new AttributesBuilder().setUptodate(true).build());
    tx.submit();
    final InstanceIdentifier<Tables> tableId = this.ribIId.builder().child(Peer.class).child(EffectiveRibIn.class).child(Tables.class, this.tk).build();
    this.reg = this.dataBroker.registerDataTreeChangeListener(new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, tableId), this);
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) Peer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.Peer) Tables(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables) AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.tables.AttributesBuilder)

Example 14 with DataTreeIdentifier

use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project bgpcep by opendaylight.

the class NodeChangedListenerTest method setUp.

@Before
public void setUp() throws TransactionCommitFailedException {
    final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
    wTx.put(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID, new TopologyBuilder().setKey(new TopologyKey(PCEP_TOPOLOGY_ID)).setNode(Lists.newArrayList()).setTopologyId(PCEP_TOPOLOGY_ID).build(), true);
    wTx.put(LogicalDatastoreType.OPERATIONAL, TUNNEL_TOPO_IID, new TopologyBuilder().setKey(new TopologyKey(TUNNEL_TOPOLOGY_ID)).setTopologyId(TUNNEL_TOPOLOGY_ID).build(), true);
    wTx.submit().checkedGet();
    final NodeChangedListener nodeListener = new NodeChangedListener(getDataBroker(), PCEP_TOPOLOGY_ID, TUNNEL_TOPO_IID);
    this.listenerRegistration = getDataBroker().registerDataTreeChangeListener(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID.child(Node.class)), nodeListener);
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) TopologyKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey) TopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder) SupportingNode(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) Before(org.junit.Before)

Example 15 with DataTreeIdentifier

use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project bgpcep by opendaylight.

the class PCEPTunnelTopologyProvider method init.

synchronized void init() {
    final WriteTransaction tx = this.dataBroker.newWriteOnlyTransaction();
    tx.put(LogicalDatastoreType.OPERATIONAL, getTopologyReference().getInstanceIdentifier(), new TopologyBuilder().setTopologyId(this.tunneltopologyId).setTopologyTypes(new TopologyTypesBuilder().addAugmentation(TopologyTypes1.class, new TopologyTypes1Builder().setTopologyTunnelPcep(new TopologyTunnelPcepBuilder().build()).build()).build()).setNode(new ArrayList<>()).build(), true);
    try {
        tx.submit().get();
    } catch (final InterruptedException | ExecutionException e) {
        LOG.error("Failed to create Tunnel Topology root", e);
    }
    this.reg = this.ncl.getDataProvider().registerDataTreeChangeListener(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, this.src), this.ncl);
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) TopologyTunnelPcepBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.topology.tunnel.pcep.type.TopologyTunnelPcepBuilder) TopologyTypesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypesBuilder) DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) TopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder) TopologyTypes1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.TopologyTypes1) TopologyTypes1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.TopologyTypes1Builder) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

DataTreeIdentifier (org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier)22 Before (org.junit.Before)7 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)7 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)5 DataTreeModification (org.opendaylight.controller.md.sal.binding.api.DataTreeModification)5 DataObjectModification (org.opendaylight.controller.md.sal.binding.api.DataObjectModification)4 SimpleTaskRetryLooper (org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper)4 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)4 Test (org.junit.Test)3 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)3 IMappingSystem (org.opendaylight.lispflowmapping.interfaces.mapcache.IMappingSystem)2 FlowCapableNodeCachedDao (org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeCachedDao)2 FlowCapableNodeDao (org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeDao)2 FlowCapableNodeOdlDao (org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeOdlDao)2 FlowCapableNodeSnapshotDao (org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeSnapshotDao)2 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)2 Tables (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables)2 TopologyBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder)2 Collection (java.util.Collection)1