• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java FlowRuleProvider类的典型用法和代码示例

java 1次浏览

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

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

示例1: flowMissing

点赞 3

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的package包/类
private void flowMissing(FlowEntry flowRule) {
    checkNotNull(flowRule, FLOW_RULE_NULL);
    checkValidity();
    Device device = deviceService.getDevice(flowRule.deviceId());
    FlowRuleProvider frp = getProvider(device.providerId());
    FlowRuleEvent event = null;
    switch (flowRule.state()) {
        case PENDING_REMOVE:
        case REMOVED:
            event = store.removeFlowRule(flowRule);
            frp.removeFlowRule(flowRule);
            break;
        case ADDED:
        case PENDING_ADD:
            frp.applyFlowRule(flowRule);
            break;
        default:
            log.debug("Flow {} has not been installed.", flowRule);
    }

    if (event != null) {
        log.debug("Flow {} removed", flowRule);
        post(event);
    }

}
 

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

示例2: flowRemoved

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的package包/类
@Override
public void flowRemoved(FlowEntry flowEntry) {
    checkNotNull(flowEntry, FLOW_RULE_NULL);
    checkValidity();
    lastSeen.remove(flowEntry);
    FlowEntry stored = store.getFlowEntry(flowEntry);
    if (stored == null) {
        log.debug("Rule already evicted from store: {}", flowEntry);
        return;
    }
    Device device = deviceService.getDevice(flowEntry.deviceId());
    FlowRuleProvider frp = getProvider(device.providerId());
    FlowRuleEvent event = null;
    switch (stored.state()) {
        case ADDED:
        case PENDING_ADD:
            frp.applyFlowRule(stored);
            break;
        case PENDING_REMOVE:
        case REMOVED:
            event = store.removeFlowRule(stored);
            break;
        default:
            break;

    }
    if (event != null) {
        log.debug("Flow {} removed", flowEntry);
        post(event);
    }
}
 

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

示例3: flowMissing

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的package包/类
private void flowMissing(FlowEntry flowRule) {
    checkNotNull(flowRule, FLOW_RULE_NULL);
    checkValidity();
    Device device = deviceService.getDevice(flowRule.deviceId());
    FlowRuleProvider frp = getProvider(device.providerId());
    FlowRuleEvent event = null;
    switch (flowRule.state()) {
        case PENDING_REMOVE:
        case REMOVED:
            event = store.removeFlowRule(flowRule);
            break;
        case ADDED:
        case PENDING_ADD:
            event = store.pendingFlowRule(flowRule);
            try {
                frp.applyFlowRule(flowRule);
            } catch (UnsupportedOperationException e) {
                log.warn(e.getMessage());
                if (flowRule instanceof DefaultFlowEntry) {
                    //FIXME modification of "stored" flow entry outside of store
                    ((DefaultFlowEntry) flowRule).setState(FlowEntry.FlowEntryState.FAILED);
                }
            }
            break;
        default:
            log.debug("Flow {} has not been installed.", flowRule);
    }

    if (event != null) {
        log.debug("Flow {} removed", flowRule);
        post(event);
    }
}
 

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

示例4: extraneousFlow

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的package包/类
private void extraneousFlow(FlowRule flowRule) {
    checkNotNull(flowRule, FLOW_RULE_NULL);
    checkValidity();
    FlowRuleProvider frp = getProvider(flowRule.deviceId());
    frp.removeFlowRule(flowRule);
    log.debug("Flow {} is on switch but not in store.", flowRule);
}
 

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

示例5: notify

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的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

示例6: getProvider

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * if the Device does not support {@link FlowRuleProgrammable}.
 */
@Override
protected synchronized FlowRuleProvider getProvider(DeviceId deviceId) {
    // if device supports FlowRuleProgrammable,
    // use FlowRuleProgrammable via FlowRuleDriverProvider
    return Optional.ofNullable(deviceService.getDevice(deviceId))
                    .filter(dev -> dev.is(FlowRuleProgrammable.class))
                    .<FlowRuleProvider>map(x -> driverProvider)
                    .orElseGet(() -> super.getProvider(deviceId));
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:14,
代码来源:FlowRuleManager.java

示例7: flowRemoved

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的package包/类
@Override
public void flowRemoved(FlowEntry flowEntry) {
    checkNotNull(flowEntry, FLOW_RULE_NULL);
    checkValidity();
    lastSeen.remove(flowEntry);
    firstSeen.remove(flowEntry);
    FlowEntry stored = store.getFlowEntry(flowEntry);
    if (stored == null) {
        log.debug("Rule already evicted from store: {}", flowEntry);
        return;
    }
    if (flowEntry.reason() == FlowEntry.FlowRemoveReason.HARD_TIMEOUT) {
        ((DefaultFlowEntry) stored).setState(FlowEntry.FlowEntryState.REMOVED);
    }
    FlowRuleProvider frp = getProvider(flowEntry.deviceId());
    FlowRuleEvent event = null;
    switch (stored.state()) {
        case ADDED:
        case PENDING_ADD:
            frp.applyFlowRule(stored);
            break;
        case PENDING_REMOVE:
        case REMOVED:
            event = store.removeFlowRule(stored);
            break;
        default:
            break;

    }
    if (event != null) {
        log.debug("Flow {} removed", flowEntry);
        post(event);
    }
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:35,
代码来源:FlowRuleManager.java

示例8: extraneousFlow

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的package包/类
private void extraneousFlow(FlowRule flowRule) {
    checkNotNull(flowRule, FLOW_RULE_NULL);
    checkValidity();
    // getProvider is customized to favor driverProvider
    FlowRuleProvider frp = getProvider(flowRule.deviceId());
    frp.removeFlowRule(flowRule);
    log.debug("Flow {} is on switch but not in store.", flowRule);
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:9,
代码来源:FlowRuleManager.java

示例9: defaultProvider

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的package包/类
@Override
protected FlowRuleProvider defaultProvider() {
    return defaultProvider;
}
 

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

示例10: createProviderService

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的package包/类
@Override
protected FlowRuleProviderService createProviderService(
        FlowRuleProvider provider) {
    return new InternalFlowRuleProviderService(provider);
}
 

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

示例11: InternalFlowRuleProviderService

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的package包/类
protected InternalFlowRuleProviderService(FlowRuleProvider provider) {
    super(provider);
}
 

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

示例12: notify

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的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

示例13: rate

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的package包/类
@Override
public long rate() {
    return (current - previous) / FlowRuleProvider.POLL_INTERVAL;
}
 

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

示例14: notify

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的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

示例15: defaultProvider

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的package包/类
@Override
protected FlowRuleProvider defaultProvider() {
    return driverProvider;
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:5,
代码来源:FlowRuleManager.java

示例16: notify

点赞 2

import org.onosproject.net.flow.FlowRuleProvider; //导入依赖的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().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);
        // getProvider is customized to favor driverProvider
        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:opennetworkinglab,
项目名称:onos,
代码行数:53,
代码来源:FlowRuleManager.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)