use of org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeOdlDao 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.openflowplugin.applications.frsync.dao.FlowCapableNodeOdlDao in project openflowplugin by opendaylight.
the class ForwardingRulesSyncProvider method onSessionInitiated.
@Override
public void onSessionInitiated(final ProviderContext providerContext) {
final TableForwarder tableForwarder = new TableForwarder(salTableService);
final SyncPlanPushStrategy syncPlanPushStrategy = new SyncPlanPushStrategyFlatBatchImpl().setFlatBatchService(flatBatchService).setTableForwarder(tableForwarder);
final ReconciliationRegistry reconciliationRegistry = new ReconciliationRegistry();
final DeviceMastershipManager deviceMastershipManager = new DeviceMastershipManager(clusterSingletonService, reconciliationRegistry);
final SyncReactor syncReactorImpl = new SyncReactorImpl(syncPlanPushStrategy);
final SyncReactor syncReactorRetry = new SyncReactorRetryDecorator(syncReactorImpl, reconciliationRegistry);
final SyncReactor syncReactorGuard = new SyncReactorGuardDecorator(syncReactorRetry);
final SyncReactor syncReactorFutureZip = new SyncReactorFutureZipDecorator(syncReactorGuard, syncThreadPool);
final SyncReactor reactor = new SyncReactorClusterDecorator(syncReactorFutureZip, deviceMastershipManager);
final FlowCapableNodeSnapshotDao configSnapshot = new FlowCapableNodeSnapshotDao();
final FlowCapableNodeSnapshotDao operationalSnapshot = new FlowCapableNodeSnapshotDao();
final FlowCapableNodeDao configDao = new FlowCapableNodeCachedDao(configSnapshot, new FlowCapableNodeOdlDao(dataService, LogicalDatastoreType.CONFIGURATION));
final FlowCapableNodeDao operationalDao = new FlowCapableNodeCachedDao(operationalSnapshot, new FlowCapableNodeOdlDao(dataService, LogicalDatastoreType.OPERATIONAL));
final NodeListener<FlowCapableNode> nodeListenerConfig = new SimplifiedConfigListener(reactor, configSnapshot, operationalDao);
final NodeListener<Node> nodeListenerOperational = new SimplifiedOperationalListener(reactor, operationalSnapshot, configDao, reconciliationRegistry, deviceMastershipManager);
dataTreeConfigChangeListener = dataService.registerDataTreeChangeListener(nodeConfigDataTreePath, nodeListenerConfig);
dataTreeOperationalChangeListener = dataService.registerDataTreeChangeListener(nodeOperationalDataTreePath, nodeListenerOperational);
LOG.info("ForwardingRulesSync has started.");
}
use of org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeOdlDao in project openflowplugin by opendaylight.
the class SimplifiedConfigListenerTest 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 operationalDao = new FlowCapableNodeCachedDao(operationalSnapshot, new FlowCapableNodeOdlDao(db, LogicalDatastoreType.OPERATIONAL));
nodeListenerConfig = new SimplifiedConfigListener(reactor, configSnapshot, operationalDao);
fcNodePath = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(NODE_ID)).augmentation(FlowCapableNode.class);
final DataTreeIdentifier<FlowCapableNode> dataTreeIdentifier = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, fcNodePath);
Mockito.when(db.newReadOnlyTransaction()).thenReturn(roTx);
Mockito.when(dataTreeModification.getRootPath()).thenReturn(dataTreeIdentifier);
Mockito.when(dataTreeModification.getRootNode()).thenReturn(configModification);
}
Aggregations