当前位置: 首页>>代码示例>>Java>>正文


Java FlowRuleBatchEvent类代码示例

本文整理汇总了Java中org.onosproject.net.flow.FlowRuleBatchEvent的典型用法代码示例。如果您正苦于以下问题:Java FlowRuleBatchEvent类的具体用法?Java FlowRuleBatchEvent怎么用?Java FlowRuleBatchEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FlowRuleBatchEvent类属于org.onosproject.net.flow包,在下文中一共展示了FlowRuleBatchEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerMessageHandlers

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
private void registerMessageHandlers(ExecutorService executor) {

        clusterCommunicator.addSubscriber(APPLY_BATCH_FLOWS, new OnStoreBatch(), executor);
        clusterCommunicator.<FlowRuleBatchEvent>addSubscriber(
                REMOTE_APPLY_COMPLETED, SERIALIZER::decode, this::notifyDelegate, executor);
        clusterCommunicator.addSubscriber(
                GET_FLOW_ENTRY, SERIALIZER::decode, flowTable::getFlowEntry, SERIALIZER::encode, executor);
        clusterCommunicator.addSubscriber(
                GET_DEVICE_FLOW_ENTRIES, SERIALIZER::decode, flowTable::getFlowEntries, SERIALIZER::encode, executor);
        clusterCommunicator.addSubscriber(
                REMOVE_FLOW_ENTRY, SERIALIZER::decode, this::removeFlowRuleInternal, SERIALIZER::encode, executor);
        clusterCommunicator.addSubscriber(
                REMOVE_FLOW_ENTRY, SERIALIZER::decode, this::removeFlowRuleInternal, SERIALIZER::encode, executor);
        clusterCommunicator.addSubscriber(
                FLOW_TABLE_BACKUP, SERIALIZER::decode, flowTable::onBackupReceipt, SERIALIZER::encode, executor);
    }
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:DistributedFlowRuleStore.java

示例2: storeBatchInternal

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
private void storeBatchInternal(FlowRuleBatchOperation operation) {

        final DeviceId did = operation.deviceId();
        //final Collection<FlowEntry> ft = flowTable.getFlowEntries(did);
        Set<FlowRuleBatchEntry> currentOps = updateStoreInternal(operation);
        if (currentOps.isEmpty()) {
            batchOperationComplete(FlowRuleBatchEvent.completed(
                    new FlowRuleBatchRequest(operation.id(), Collections.emptySet()),
                    new CompletedBatchOperation(true, Collections.emptySet(), did)));
            return;
        }

        notifyDelegate(FlowRuleBatchEvent.requested(new
                           FlowRuleBatchRequest(operation.id(),
                                                currentOps), operation.deviceId()));
    }
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:DistributedFlowRuleStore.java

示例3: storeBatchInternal

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
private void storeBatchInternal(FlowRuleBatchOperation operation) {

        final DeviceId did = operation.deviceId();
        //final Collection<FlowEntry> ft = flowTable.getFlowEntries(did);
        Set<FlowRuleBatchEntry> currentOps = updateStoreInternal(operation);
        if (currentOps.isEmpty()) {
            batchOperationComplete(FlowRuleBatchEvent.completed(
                    new FlowRuleBatchRequest(operation.id(), Collections.emptySet()),
                    new CompletedBatchOperation(true, Collections.emptySet(), did)));
            return;
        }
        updateBackup(did, currentOps);

        notifyDelegate(FlowRuleBatchEvent.requested(new
                           FlowRuleBatchRequest(operation.id(),
                                                currentOps), operation.deviceId()));

    }
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:19,代码来源:DistributedFlowRuleStore.java

示例4: batchOperationComplete

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
@Override
public void batchOperationComplete(FlowRuleBatchEvent event) {
    //FIXME: need a per device pending response

    NodeId nodeId = pendingResponses.remove(event.subject().batchId());
    if (nodeId == null) {
        notifyDelegate(event);
    } else {
        ClusterMessage message = new ClusterMessage(
                clusterService.getLocalNode().id(),
                REMOTE_APPLY_COMPLETED,
                SERIALIZER.encode(event));
        // TODO check unicast return value
        clusterCommunicator.unicast(message, nodeId);
        //error log: log.warn("Failed to respond to peer for batch operation result");
    }
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:18,代码来源:DistributedFlowRuleStore.java

示例5: batchOperationComplete

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
/**
 * Invoked on the completion of a storeBatch operation.
 *
 * @param event flow rule batch event
 */
@Override
public void batchOperationComplete(FlowRuleBatchEvent event) {
    // TODO Auto-generated method stub
    final Long batchId = event.subject().batchId();
    SettableFuture<FlowExtCompletedOperation> future = pendingExtendFutures
            .getIfPresent(batchId);
    if (future != null) {
        FlowRuleBatchRequest request = event.subject();
        CompletedBatchOperation result = event.result();
        FlowExtCompletedOperation completed =
                new FlowExtCompletedOperation(request.batchId(), result.isSuccess(), result.failedItems());
        future.set(completed);
        pendingExtendFutures.invalidate(batchId);
    }
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:21,代码来源:DefaultFlowRuleExtRouter.java

示例6: batchOperationCompleted

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
@Override
public void batchOperationCompleted(long batchId, CompletedBatchOperation operation) {
    store.batchOperationComplete(FlowRuleBatchEvent.completed(
            new FlowRuleBatchRequest(batchId, Collections.emptySet()),
            operation
    ));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:FlowRuleManager.java

示例7: batchOperationComplete

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
@Override
public void batchOperationComplete(FlowRuleBatchEvent event) {
    final Long batchId = event.subject().batchId();
    SettableFuture<CompletedBatchOperation> future
        = pendingFutures.getIfPresent(batchId);
    if (future != null) {
        future.set(event.result());
        pendingFutures.invalidate(batchId);
    }
    notifyDelegate(event);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:SimpleFlowRuleStore.java

示例8: batchOperationComplete

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
@Override
public void batchOperationComplete(FlowRuleBatchEvent event) {
    //FIXME: need a per device pending response
    NodeId nodeId = pendingResponses.remove(event.subject().batchId());
    if (nodeId == null) {
        notifyDelegate(event);
    } else {
        // TODO check unicast return value
        clusterCommunicator.unicast(event, REMOTE_APPLY_COMPLETED, SERIALIZER::encode, nodeId);
        //error log: log.warn("Failed to respond to peer for batch operation result");
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:DistributedFlowRuleStore.java

示例9: notify

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
@Override
public void notify(FlowRuleBatchEvent event) {
    // Request has been forwarded to MASTER Node
    for (FlowRuleBatchEntry entry : event.subject().ops()) {
        switch (entry.operator()) {
            case ADD:
                eventDispatcher
                        .post(new FlowRuleEvent(FlowRuleEvent.Type.RULE_ADD_REQUESTED,
                                                entry.target()));
                break;
            // FALLTHROUGH
            case REMOVE:
            case MODIFY:
            default:
                // TODO not implemented
                break;
        }
    }
    // send it
    FlowRuleProvider flowRuleProvider = getProvider(event.subject().ops()
                                                            .iterator().next().target().deviceId());
    // TODO we may want to specify a deviceId
    flowRuleProvider.executeBatch(event.subject().asBatchOperation(null));
    // do not have transaction, assume it install success
    // temporarily
    FlowExtCompletedOperation result = new FlowExtCompletedOperation(
            event.subject().batchId(), true, Collections.emptySet());
    futureService.submit(() -> {
        router.batchOperationComplete(FlowRuleBatchEvent
                                              .completed(event.subject(), result));
    });
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:33,代码来源:FlowRuleExtManager.java

示例10: notify

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
/**
 * Notify the listener of Router to do some reaction.
 *
 * @param request the requested operation to do
 */
public void notify(FlowRuleBatchRequest request) {
    for (FlowRuleExtRouterListener listener : routerListener) {
        listener.notify(FlowRuleBatchEvent
                                // TODO fill in the deviceId
                                .requested(request, null));
    }
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:13,代码来源:DefaultFlowRuleExtRouter.java

示例11: notify

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
@Override
public void notify(FlowRuleBatchEvent event) {
    final FlowRuleBatchRequest request = event.subject();
    switch (event.type()) {
    case BATCH_OPERATION_REQUESTED:
        // Request has been forwarded to MASTER Node, and was
        request.ops().stream().forEach(
                op -> {
                    switch (op.operator()) {

                        case ADD:
                            post(new FlowRuleEvent(RULE_ADD_REQUESTED,
                                                   op.target()));
                            break;
                        case REMOVE:
                            post(new FlowRuleEvent(RULE_REMOVE_REQUESTED,
                                                   op.target()));
                            break;
                        case MODIFY:
                            //TODO: do something here when the time comes.
                            break;
                        default:
                            log.warn("Unknown flow operation operator: {}", op.operator());
                    }
                }
        );

        DeviceId deviceId = event.deviceId();

        FlowRuleBatchOperation batchOperation =
                request.asBatchOperation(deviceId);

        FlowRuleProvider flowRuleProvider = getProvider(deviceId);
        if (flowRuleProvider != null) {
            flowRuleProvider.executeBatch(batchOperation);
        }

        break;

    case BATCH_OPERATION_COMPLETED:

        FlowOperationsProcessor fops = pendingFlowOperations.remove(
                event.subject().batchId());
        if (event.result().isSuccess()) {
            if (fops != null) {
                fops.satisfy(event.deviceId());
            }
        } else {
            fops.fail(event.deviceId(), event.result().failedItems());
        }

        break;

    default:
        break;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:58,代码来源:FlowRuleManager.java

示例12: storeBatch

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
@Override
public void storeBatch(
        FlowRuleBatchOperation operation) {
    List<FlowRuleBatchEntry> toAdd = new ArrayList<>();
    List<FlowRuleBatchEntry> toRemove = new ArrayList<>();

    for (FlowRuleBatchEntry entry : operation.getOperations()) {
        final FlowRule flowRule = entry.target();
        if (entry.operator().equals(FlowRuleOperation.ADD)) {
            if (!getFlowEntries(flowRule.deviceId(), flowRule.id()).contains(flowRule)) {
                storeFlowRule(flowRule);
                toAdd.add(entry);
            }
        } else if (entry.operator().equals(FlowRuleOperation.REMOVE)) {
            if (getFlowEntries(flowRule.deviceId(), flowRule.id()).contains(flowRule)) {
                deleteFlowRule(flowRule);
                toRemove.add(entry);
            }
        } else {
            throw new UnsupportedOperationException("Unsupported operation type");
        }
    }

    if (toAdd.isEmpty() && toRemove.isEmpty()) {
        notifyDelegate(FlowRuleBatchEvent.completed(
                new FlowRuleBatchRequest(operation.id(), Collections.emptySet()),
                new CompletedBatchOperation(true, Collections.emptySet(),
                                            operation.deviceId())));
        return;
    }

    SettableFuture<CompletedBatchOperation> r = SettableFuture.create();
    final int batchId = localBatchIdGen.incrementAndGet();

    pendingFutures.put(batchId, r);

    toAdd.addAll(toRemove);
    notifyDelegate(FlowRuleBatchEvent.requested(
            new FlowRuleBatchRequest(batchId, Sets.newHashSet(toAdd)), operation.deviceId()));

}
 
开发者ID:shlee89,项目名称:athena,代码行数:42,代码来源:SimpleFlowRuleStore.java

示例13: notify

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
@Override
public void notify(FlowRuleBatchEvent event) {
    final FlowRuleBatchRequest request = event.subject();
    switch (event.type()) {
    case BATCH_OPERATION_REQUESTED:
        // Request has been forwarded to MASTER Node, and was
        request.ops().stream().forEach(
                op -> {
                    switch (op.operator()) {

                        case ADD:
                            eventDispatcher.post(
                                    new FlowRuleEvent(
                                            FlowRuleEvent.Type.RULE_ADD_REQUESTED,
                                            op.target()));
                            break;
                        case REMOVE:
                            eventDispatcher.post(
                                    new FlowRuleEvent(
                                            FlowRuleEvent.Type.RULE_REMOVE_REQUESTED,
                                            op.target()));
                            break;
                        case MODIFY:
                            //TODO: do something here when the time comes.
                            break;
                        default:
                            log.warn("Unknown flow operation operator: {}", op.operator());
                    }
                }
        );

        DeviceId deviceId = event.deviceId();

        FlowRuleBatchOperation batchOperation =
                request.asBatchOperation(deviceId);

        FlowRuleProvider flowRuleProvider =
                getProvider(deviceId);

        flowRuleProvider.executeBatch(batchOperation);

        break;

    case BATCH_OPERATION_COMPLETED:

        FlowOperationsProcessor fops = pendingFlowOperations.remove(
                event.subject().batchId());
        if (event.result().isSuccess()) {
            if (fops != null) {
                fops.satisfy(event.deviceId());
            }
        } else {
            fops.fail(event.deviceId(), event.result().failedItems());
        }

        break;

    default:
        break;
    }
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:62,代码来源:FlowRuleManager.java

示例14: notify

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
/**
 * Notify monitor the router has down its work.
 *
 * @param event the event to notify
 */
void notify(FlowRuleBatchEvent event);
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:7,代码来源:FlowRuleExtRouterListener.java

示例15: batchOperationComplete

import org.onosproject.net.flow.FlowRuleBatchEvent; //导入依赖的package包/类
/**
 * Invoked on the completion of a storeBatch operation.
 *
 * @param event flow rule batch event
 */
void batchOperationComplete(FlowRuleBatchEvent event);
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:7,代码来源:FlowRuleExtRouter.java


注:本文中的org.onosproject.net.flow.FlowRuleBatchEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。