use of org.opendaylight.controller.md.sal.binding.api.DataTreeModification in project openflowplugin by opendaylight.
the class WakeupOnNode method onDataTreeChanged.
@Override
public void onDataTreeChanged(@Nonnull Collection<DataTreeModification<Table>> modifications) {
Short requiredTableId = 0;
for (DataTreeModification modification : modifications) {
if (modification.getRootNode().getModificationType() == ModificationType.SUBTREE_MODIFIED) {
DataObject table = modification.getRootNode().getDataAfter();
if (table instanceof Table) {
Table tableSure = (Table) table;
LOG.trace("table: {}", table);
if (requiredTableId.equals(tableSure.getId())) {
InstanceIdentifier<Table> tablePath = modification.getRootPath().getRootIdentifier();
learningSwitchHandler.onSwitchAppeared(tablePath);
}
}
}
}
}
use of org.opendaylight.controller.md.sal.binding.api.DataTreeModification in project controller by opendaylight.
the class Bug4513Test method testDataTreeChangeListener.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataTreeChangeListener() throws Exception {
DataBroker dataBroker = getDataBroker();
DataTreeChangeListener<ListItem> listener = mock(DataTreeChangeListener.class);
InstanceIdentifier<ListItem> wildCard = InstanceIdentifier.builder(ListenerTest.class).child(ListItem.class).build();
ListenerRegistration<DataTreeChangeListener<ListItem>> reg = dataBroker.registerDataTreeChangeListener(new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, wildCard), listener);
final ListItem item = writeListItem();
ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
verify(listener, timeout(100)).onDataTreeChanged(captor.capture());
Collection<DataTreeModification<ListItem>> mods = captor.getValue();
assertEquals("ListItem", item, mods.iterator().next().getRootNode().getDataAfter());
}
use of org.opendaylight.controller.md.sal.binding.api.DataTreeModification in project openflowplugin by opendaylight.
the class NodeNotificationSupplierImplTest method testCreateChangeEvent.
@Test
public void testCreateChangeEvent() {
final TestData testData = new TestData(createTestFlowCapableNodePath(), null, createTestFlowCapableNode(), DataObjectModification.ModificationType.WRITE);
Collection<DataTreeModification<FlowCapableNode>> collection = new ArrayList<>();
collection.add(testData);
notifSupplierImpl.onDataTreeChanged(collection);
verify(notifProviderService, times(1)).publish(Matchers.any(NodeUpdated.class));
}
use of org.opendaylight.controller.md.sal.binding.api.DataTreeModification in project openflowplugin by opendaylight.
the class FlowNotificationSupplierImplTest method testCreateChangeEvent.
@Test
public void testCreateChangeEvent() {
final TestData testData = new TestData(createTestFlowPath(), null, createTestFlow(), DataObjectModification.ModificationType.WRITE);
Collection<DataTreeModification<Flow>> collection = new ArrayList<>();
collection.add(testData);
notifSupplierImpl.onDataTreeChanged(collection);
verify(notifProviderService, times(1)).publish(Matchers.any(FlowAdded.class));
}
use of org.opendaylight.controller.md.sal.binding.api.DataTreeModification in project openflowplugin by opendaylight.
the class MeterNotificationSupplierImplTest method testUdateChangeEvent.
@Test
public void testUdateChangeEvent() {
final TestData testData = new TestData(createTestMeterPath(), createTestMeter(), createUpdatedTestMeter(), DataObjectModification.ModificationType.SUBTREE_MODIFIED);
Collection<DataTreeModification<Meter>> collection = new ArrayList<>();
collection.add(testData);
notifSupplierImpl.onDataTreeChanged(collection);
verify(notifProviderService, times(1)).publish(Matchers.any(MeterUpdated.class));
}
Aggregations