Search in sources :

Example 6 with DataTreeIdentifier

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;
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) DataObjectModification(org.opendaylight.controller.md.sal.binding.api.DataObjectModification)

Example 7 with DataTreeIdentifier

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);
}
Also used : FlowCapableNodeSnapshotDao(org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeSnapshotDao) FlowCapableNodeOdlDao(org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeOdlDao) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) FlowCapableNodeDao(org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeDao) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) FlowCapableNodeCachedDao(org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeCachedDao) Before(org.junit.Before)

Example 8 with DataTreeIdentifier

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() <--");
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) Table(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table) FlowCommitWrapper(org.opendaylight.openflowplugin.learningswitch.FlowCommitWrapper) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) WakeupOnNode(org.opendaylight.openflowplugin.learningswitch.WakeupOnNode) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) FlowCommitWrapperImpl(org.opendaylight.openflowplugin.learningswitch.FlowCommitWrapperImpl)

Example 9 with DataTreeIdentifier

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);
    }
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) SimpleTaskRetryLooper(org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper) TransactionCommitFailedException(org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) StaleFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.StaleFlow)

Example 10 with DataTreeIdentifier

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;
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) DataObjectModification(org.opendaylight.controller.md.sal.binding.api.DataObjectModification) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)

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