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)));
}
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);
}
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);
}
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);
}
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);
}
Aggregations