use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project openflowplugin by opendaylight.
the class NodeConnectorInventoryEventTranslatorTest method setupDataTreeChange.
private <T extends DataObject> DataTreeModification setupDataTreeChange(final ModificationType type, final InstanceIdentifier<T> ii, final FlowCapableNodeConnector connector) {
final DataTreeModification dataTreeModification = mock(DataTreeModification.class);
when(dataTreeModification.getRootNode()).thenReturn(mock(DataObjectModification.class));
DataTreeIdentifier<T> identifier = new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, ii);
when(dataTreeModification.getRootNode().getModificationType()).thenReturn(type);
when(dataTreeModification.getRootPath()).thenReturn(identifier);
when(dataTreeModification.getRootNode().getDataAfter()).thenReturn(connector);
return dataTreeModification;
}
use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project openflowplugin by opendaylight.
the class SimplifiedOperationalListenerTest method setUp.
@Before
public void setUp() throws Exception {
final DataBroker db = Mockito.mock(DataBroker.class);
final FlowCapableNodeSnapshotDao configSnapshot = new FlowCapableNodeSnapshotDao();
final FlowCapableNodeSnapshotDao operationalSnapshot = new FlowCapableNodeSnapshotDao();
final FlowCapableNodeDao configDao = new FlowCapableNodeCachedDao(configSnapshot, new FlowCapableNodeOdlDao(db, LogicalDatastoreType.CONFIGURATION));
nodeListenerOperational = new SimplifiedOperationalListener(reactor, operationalSnapshot, configDao, reconciliationRegistry, deviceMastershipManager);
InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(NODE_ID));
fcNodePath = nodePath.augmentation(FlowCapableNode.class);
final DataTreeIdentifier<Node> dataTreeIdentifier = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, nodePath);
Mockito.when(db.newReadOnlyTransaction()).thenReturn(roTx);
Mockito.when(operationalNode.getId()).thenReturn(NODE_ID);
Mockito.when(dataTreeModification.getRootPath()).thenReturn(dataTreeIdentifier);
Mockito.when(dataTreeModification.getRootNode()).thenReturn(operationalModification);
Mockito.when(operationalNode.getAugmentation(FlowCapableNode.class)).thenReturn(fcOperationalNode);
}
use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project openflowplugin by opendaylight.
the class LearningSwitchManagerMultiImpl method start.
/**
* Starts learning switch.
*/
@Override
public void start() {
LOG.debug("start() -->");
FlowCommitWrapper dataStoreAccessor = new FlowCommitWrapperImpl(data);
PacketInDispatcherImpl packetInDispatcher = new PacketInDispatcherImpl();
MultipleLearningSwitchHandlerFacadeImpl learningSwitchHandler = new MultipleLearningSwitchHandlerFacadeImpl(dataStoreAccessor, packetProcessingService, packetInDispatcher);
packetInRegistration = notificationService.registerNotificationListener(packetInDispatcher);
WakeupOnNode wakeupListener = new WakeupOnNode();
wakeupListener.setLearningSwitchHandler(learningSwitchHandler);
final InstanceIdentifier<Table> instanceIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class).child(Table.class);
final DataTreeIdentifier<Table> dataTreeIdentifier = new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, instanceIdentifier);
dataTreeChangeListenerRegistration = data.registerDataTreeChangeListener(dataTreeIdentifier, wakeupListener);
LOG.debug("start() <--");
}
use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project openflowplugin by opendaylight.
the class FlowForwarder method registrationListener.
@SuppressWarnings("IllegalCatch")
private void registrationListener(final DataBroker db) {
final DataTreeIdentifier<Flow> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, getWildCardPath());
try {
SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(ForwardingRulesManagerImpl.STARTUP_LOOP_TICK, ForwardingRulesManagerImpl.STARTUP_LOOP_MAX_RETRIES);
listenerRegistration = looper.loopUntilNoException(() -> db.registerDataTreeChangeListener(treeId, FlowForwarder.this));
} catch (final Exception e) {
LOG.warn("FRM Flow DataTreeChange listener registration fail!");
LOG.debug("FRM Flow DataTreeChange listener registration fail ..", e);
throw new IllegalStateException("FlowForwarder startup fail! System needs restart.", e);
}
}
use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project openflowplugin by opendaylight.
the class DataTreeChangeListenerBase method setupDataTreeChange.
protected <T extends DataObject> DataTreeModification setupDataTreeChange(final ModificationType type, final InstanceIdentifier<T> ii) {
final DataTreeModification dataTreeModification = mock(DataTreeModification.class);
final DataTreeIdentifier identifier = new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, ii);
when(dataTreeModification.getRootNode()).thenReturn(mock(DataObjectModification.class));
when(dataTreeModification.getRootNode().getModificationType()).thenReturn(type);
when(dataTreeModification.getRootPath()).thenReturn(identifier);
when(dataTreeModification.getRootNode().getDataAfter()).thenReturn(mock(FlowCapableNodeConnector.class));
return dataTreeModification;
}
Aggregations