Search in sources :

Example 6 with SalTableService

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService in project openflowplugin by opendaylight.

the class TableForwarder method update.

@Override
public void update(final InstanceIdentifier<TableFeatures> identifier, final TableFeatures original, final TableFeatures update, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    LOG.debug("Received the Table Update request [Tbl id, node Id, original, upd" + " " + identifier + " " + nodeIdent + " " + original + " " + update);
    final TableFeatures originalTableFeatures = original;
    TableFeatures updatedTableFeatures;
    if (null == update) {
        updatedTableFeatures = original;
    } else {
        updatedTableFeatures = update;
    }
    final UpdateTableInputBuilder builder = new UpdateTableInputBuilder();
    builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
    // TODO: reconsider model - this particular field is not used in service
    // implementation
    builder.setTableRef(new TableRef(identifier));
    builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
    builder.setUpdatedTable(new UpdatedTableBuilder().setTableFeatures(Collections.singletonList(updatedTableFeatures)).build());
    builder.setOriginalTable(new OriginalTableBuilder().setTableFeatures(Collections.singletonList(originalTableFeatures)).build());
    LOG.debug("Invoking SalTableService ");
    if (this.provider.getSalTableService() != null) {
        LOG.debug(" Handle to SalTableServices" + this.provider.getSalTableService());
    }
    final Future<RpcResult<UpdateTableOutput>> resultFuture = this.provider.getSalTableService().updateTable(builder.build());
    JdkFutures.addErrorLogging(resultFuture, LOG, "updateTable");
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) OriginalTableBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.OriginalTableBuilder) TableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) UpdatedTableBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder) UpdateTableInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInputBuilder) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri) TableRef(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableRef)

Example 7 with SalTableService

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService 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.");
}
Also used : FlowCapableNodeSnapshotDao(org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeSnapshotDao) FlowCapableNodeOdlDao(org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeOdlDao) SyncPlanPushStrategyFlatBatchImpl(org.opendaylight.openflowplugin.applications.frsync.impl.strategy.SyncPlanPushStrategyFlatBatchImpl) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) ReconciliationRegistry(org.opendaylight.openflowplugin.applications.frsync.util.ReconciliationRegistry) SyncPlanPushStrategy(org.opendaylight.openflowplugin.applications.frsync.SyncPlanPushStrategy) SyncReactor(org.opendaylight.openflowplugin.applications.frsync.SyncReactor) TableForwarder(org.opendaylight.openflowplugin.applications.frsync.impl.strategy.TableForwarder) FlowCapableNodeDao(org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeDao) FlowCapableNodeCachedDao(org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeCachedDao) DeviceMastershipManager(org.opendaylight.openflowplugin.applications.frsync.impl.clustering.DeviceMastershipManager)

Aggregations

TableFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures)4 UpdateTableInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInputBuilder)3 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)3 Test (org.junit.Test)2 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)2 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)2 UpdateTableInput (org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput)2 UpdateTableOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput)2 OriginalTableBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.OriginalTableBuilder)2 UpdatedTableBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder)2 TableRef (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableRef)2 FutureCallback (com.google.common.util.concurrent.FutureCallback)1 SettableFuture (com.google.common.util.concurrent.SettableFuture)1 Collections (java.util.Collections)1 List (java.util.List)1 ExecutionException (java.util.concurrent.ExecutionException)1 Future (java.util.concurrent.Future)1 Assert (org.junit.Assert)1 Before (org.junit.Before)1 Matchers (org.mockito.Matchers)1