• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DefaultTrafficSelector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setupMockFlowRules

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
/**
 * Populates some flow rules used as testing data.
 */
private void setupMockFlowRules() {
    flowRule2.treatment = DefaultTrafficTreatment.builder()
            .setEthDst(MacAddress.BROADCAST)
            .build();
    flowRule2.selector = DefaultTrafficSelector.builder()
            .matchEthType((short) 3)
            .matchIPProtocol((byte) 9)
            .build();
    flowRule4.treatment = DefaultTrafficTreatment.builder()
            .build();

    flowRules.add(flowRule1);
    flowRules.add(flowRule2);
    flowRules.add(flowRule3);
    flowRules.add(flowRule4);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:FlowsResourceTest.java


示例2: removeL3Rules

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
/**
 * Removes L3 rules for routerInterface events.
 *
 * @param vmIp Corresponding Vm ip
 * @param routerInterfaces Corresponding routerInterfaces
 */
public void removeL3Rules(Ip4Address vmIp, List<OpenstackRouterInterface> routerInterfaces) {
    if (vmIp == null) {
        return;
    }

    OpenstackRoutingService routingService = getService(OpenstackRoutingService.class);

    deviceService.getAvailableDevices().forEach(d -> {
        if (!d.equals(getGatewayNode())) {
            routerInterfaces.forEach(routerInterface -> {
                String networkId = routingService.networkIdForRouterInterface(routerInterface.portId());
                long vni = getVni(networkId);

                TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();

                sBuilder.matchEthType(Ethernet.TYPE_IPV4)
                        .matchIPDst(vmIp.toIpPrefix())
                        .matchTunnelId(vni);

                removeRule(d.id(), sBuilder, ForwardingObjective.Flag.SPECIFIC, ROUTING_RULE_PRIORITY);
            });
        }
    });
}
 
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:OpenstackRoutingRulePopulator.java


示例3: fwdObjBuilder

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
/**
 * Creates a forwarding objective builder for multicast.
 *
 * @param mcastIp multicast group
 * @param assignedVlan assigned VLAN ID
 * @param nextId next ID of the L3 multicast group
 * @return forwarding objective builder
 */
private ForwardingObjective.Builder fwdObjBuilder(IpAddress mcastIp,
        VlanId assignedVlan, int nextId) {
    TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
    IpPrefix mcastPrefix = IpPrefix.valueOf(mcastIp, IpPrefix.MAX_INET_MASK_LENGTH);
    sbuilder.matchEthType(Ethernet.TYPE_IPV4);
    sbuilder.matchIPDst(mcastPrefix);
    TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder();
    metabuilder.matchVlanId(assignedVlan);

    ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective.builder();
    fwdBuilder.withSelector(sbuilder.build())
            .withMeta(metabuilder.build())
            .nextStep(nextId)
            .withFlag(ForwardingObjective.Flag.SPECIFIC)
            .fromApp(srManager.appId)
            .withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
    return fwdBuilder;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:McastHandler.java


示例4: processAclTable

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
private void processAclTable(boolean install) {
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();

    treatment.wipeDeferred();
    treatment.drop();

    FlowRule flowRule = DefaultFlowRule.builder()
            .forDevice(deviceId)
            .withSelector(selector.build())
            .withTreatment(treatment.build())
            .withPriority(DROP_PRIORITY)
            .fromApp(appId)
            .makePermanent()
            .forTable(ACL_TABLE)
            .build();

    applyRules(install, flowRule);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:OpenstackPipeline.java


示例5: processEthDstOnlyFilter

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
protected List<FlowRule> processEthDstOnlyFilter(EthCriterion ethCriterion,
        ApplicationId applicationId) {
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
    selector.matchEthType(Ethernet.TYPE_IPV4);
    selector.matchEthDst(ethCriterion.mac());
    treatment.transition(UNICAST_ROUTING_TABLE);
    FlowRule rule = DefaultFlowRule.builder()
            .forDevice(deviceId)
            .withSelector(selector.build())
            .withTreatment(treatment.build())
            .withPriority(DEFAULT_PRIORITY)
            .fromApp(applicationId)
            .makePermanent()
            .forTable(TMAC_TABLE).build();
    return ImmutableList.<FlowRule>builder().add(rule).build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:Ofdpa2Pipeline.java


示例6: processMcastEthDstFilter

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
protected List<FlowRule> processMcastEthDstFilter(EthCriterion ethCriterion,
        ApplicationId applicationId) {
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
    selector.matchEthType(Ethernet.TYPE_IPV4);
    selector.matchEthDstMasked(ethCriterion.mac(), ethCriterion.mask());
    treatment.transition(MULTICAST_ROUTING_TABLE);
    FlowRule rule = DefaultFlowRule.builder()
            .forDevice(deviceId)
            .withSelector(selector.build())
            .withTreatment(treatment.build())
            .withPriority(DEFAULT_PRIORITY)
            .fromApp(applicationId)
            .makePermanent()
            .forTable(TMAC_TABLE).build();
    return ImmutableList.<FlowRule>builder().add(rule).build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:Ofdpa2Pipeline.java


示例7: ingressFlow

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
private FlowRule ingressFlow(PortNumber inPort, Link link,
                             MplsPathIntent intent,
                             MplsLabel label) {

    TrafficSelector.Builder ingressSelector = DefaultTrafficSelector
            .builder(intent.selector());
    TrafficTreatment.Builder treat = DefaultTrafficTreatment.builder();
    ingressSelector.matchInPort(inPort);

    if (intent.ingressLabel().isPresent()) {
        ingressSelector.matchEthType(Ethernet.MPLS_UNICAST)
                .matchMplsLabel(intent.ingressLabel().get());

        // Swap the MPLS label
        treat.setMpls(label);
    } else {
        // Push and set the MPLS label
        treat.pushMpls().setMpls(label);
    }
    // Add the output action
    treat.setOutput(link.src().port());

    return createFlowRule(intent, link.src().deviceId(), ingressSelector.build(), treat.build());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:MplsPathIntentCompiler.java


示例8: populateTableMissEntry

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
protected void populateTableMissEntry(int tableToAdd,
                                      boolean toControllerNow,
                                      boolean toControllerWrite,
                                      boolean toTable, int tableToSend) {
    TrafficSelector selector = DefaultTrafficSelector.builder().build();
    TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();

    if (toControllerNow) {
        tBuilder.setOutput(PortNumber.CONTROLLER);
    }

    if (toControllerWrite) {
        tBuilder.deferred().setOutput(PortNumber.CONTROLLER);
    }

    if (toTable) {
        tBuilder.transition(tableToSend);
    }

    FlowRule flow = DefaultFlowRule.builder().forDevice(deviceId)
            .withSelector(selector).withTreatment(tBuilder.build())
            .withPriority(0).fromApp(appId).makePermanent()
            .forTable(tableToAdd).build();

    flowRuleService.applyFlowRules(flow);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:SpringOpenTTP.java


示例9: setFlowRuleForTunnelTag

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
private void setFlowRuleForTunnelTag(DeviceId deviceId, Port port, String vni) {

        TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();
        TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();

        sBuilder.matchEthType(Ethernet.TYPE_IPV4)
                .matchInPort(port.number());

        tBuilder.setTunnelId(Long.parseLong(vni));

        ForwardingObjective fo = DefaultForwardingObjective.builder()
                .withSelector(sBuilder.build())
                .withTreatment(tBuilder.build())
                .withPriority(TUNNELTAG_RULE_PRIORITY)
                .withFlag(ForwardingObjective.Flag.SPECIFIC)
                .fromApp(appId)
                .add();

        flowObjectiveService.forward(deviceId, fo);
    }
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:OpenstackSwitchingRulePopulator.java


示例10: processTableMissDrop

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
protected void processTableMissDrop(boolean install, int table, String description) {
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();

    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
    treatment.drop();

    FlowRule rule = DefaultFlowRule.builder()
            .forDevice(deviceId)
            .withSelector(selector.build())
            .withTreatment(treatment.build())
            .withPriority(DROP_PRIORITY)
            .fromApp(appId)
            .makePermanent()
            .forTable(table).build();

    processFlowRule(install, rule, description);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:AbstractCorsaPipeline.java


示例11: processVlanFiler

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
@Override
protected FlowRule.Builder processVlanFiler(FilteringObjective filt, VlanIdCriterion vlan, PortCriterion port) {
    log.debug("adding rule for VLAN: {}", vlan.vlanId());
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
    selector.matchVlanId(vlan.vlanId());
    selector.matchInPort(port.port());
    treatment.transition(ETHER_TABLE);
    treatment.deferred().popVlan();
    return DefaultFlowRule.builder()
            .forDevice(deviceId)
            .withSelector(selector.build())
            .withTreatment(treatment.build())
            .withPriority(CONTROLLER_PRIORITY)
            .makePermanent()
            .forTable(VLAN_TABLE);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:OvsCorsaPipeline.java


示例12: fwdObjBuilder

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
/**
 * Creates a forwarding objective builder for XConnect.
 *
 * @param key XConnect key
 * @param nextId next ID of the broadcast group for this XConnect key
 * @return next objective builder
 */
private ForwardingObjective.Builder fwdObjBuilder(XConnectStoreKey key, int nextId) {
    /*
     * Driver should treat objectives with MacAddress.NONE and !VlanId.NONE
     * as the VLAN cross-connect broadcast rules
     */
    TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
    sbuilder.matchVlanId(key.vlanId());
    sbuilder.matchEthDst(MacAddress.NONE);

    ForwardingObjective.Builder fob = DefaultForwardingObjective.builder();
    fob.withFlag(ForwardingObjective.Flag.SPECIFIC)
            .withSelector(sbuilder.build())
            .nextStep(nextId)
            .withPriority(SegmentRoutingService.XCONNECT_PRIORITY)
            .fromApp(srManager.appId)
            .makePermanent();
    return fob;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:XConnectHandler.java


示例13: processVlanMplsTable

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
protected void processVlanMplsTable(boolean install) {
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
    TrafficTreatment.Builder treatment = DefaultTrafficTreatment
            .builder();
    FlowRuleOperations.Builder ops = FlowRuleOperations.builder();
    FlowRule rule;

    selector.matchVlanId(VlanId.ANY);
    treatment.transition(VLAN_TABLE);

    rule = DefaultFlowRule.builder()
            .forDevice(deviceId)
            .withSelector(selector.build())
            .withTreatment(treatment.build())
            .withPriority(CONTROLLER_PRIORITY)
            .fromApp(appId)
            .makePermanent()
            .forTable(VLAN_MPLS_TABLE).build();

    processFlowRule(true, rule, "Provisioned vlan/mpls table");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:OvsCorsaPipeline.java


示例14: processCosTable

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
private void processCosTable(boolean install) {
    TrafficTreatment.Builder treatment = DefaultTrafficTreatment
            .builder()
            .transition(FIB_TABLE);
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();

    FlowRule rule = DefaultFlowRule.builder()
            .forDevice(deviceId)
            .withSelector(selector.build())
            .withTreatment(treatment.build())
            .withPriority(DROP_PRIORITY)
            .fromApp(appId)
            .makePermanent()
            .forTable(COS_MAP_TABLE).build();
    processFlowRule(true, rule, "Provisioned cos table");

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


示例15: processLocalTable

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
private void processLocalTable(boolean install) {
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();

    TrafficTreatment.Builder treatment = DefaultTrafficTreatment
            .builder()
    .punt();

    FlowRule rule = DefaultFlowRule.builder()
            .forDevice(deviceId)
            .withSelector(selector.build())
            .withTreatment(treatment.build())
            .withPriority(CONTROLLER_PRIORITY)
            .fromApp(appId)
            .makePermanent()
            .forTable(LOCAL_TABLE).build();

    processFlowRule(true, rule, "Provisioned Local table");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:OvsCorsaPipeline.java


示例16: processSpecificSwitch

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
@Override
protected Collection<FlowRule> processSpecificSwitch(ForwardingObjective fwd) {
    TrafficSelector filteredSelector =
            DefaultTrafficSelector.builder()
                    .matchInPort(
                            ((PortCriterion) fwd.selector().getCriterion(Criterion.Type.IN_PORT)).port())
                    .matchVlanId(
                            ((VlanIdCriterion) fwd.selector().getCriterion(Criterion.Type.VLAN_VID)).vlanId())
                    .build();

    Builder ruleBuilder = DefaultFlowRule.builder()
            .fromApp(fwd.appId())
            .withPriority(fwd.priority())
            .forDevice(deviceId)
            .withSelector(filteredSelector)
            .withTreatment(fwd.treatment())
            .forTable(VLAN_CIRCUIT_TABLE);

    if (fwd.permanent()) {
        ruleBuilder.makePermanent();
    } else {
        ruleBuilder.makeTemporary(fwd.timeout());
    }

    return Collections.singletonList(ruleBuilder.build());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:CorsaPipelineV3.java


示例17: processVlanFiler

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
@Override
protected Builder processVlanFiler(FilteringObjective filt, VlanIdCriterion vlan, PortCriterion port) {
    log.debug("adding rule for VLAN: {}", vlan.vlanId());
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
    selector.matchVlanId(vlan.vlanId());
    selector.matchInPort(port.port());
            /* Static treatment for VLAN_CIRCUIT_TABLE */
    treatment.setVlanPcp(MAX_VLAN_PCP);
    treatment.setQueue(0);
    treatment.meter(MeterId.meterId(defaultMeterId.id())); /* use default meter (Green) */
    treatment.transition(L3_IF_MAC_DA_TABLE);
    return DefaultFlowRule.builder()
            .withSelector(selector.build())
            .withTreatment(treatment.build())
            .withPriority(CONTROLLER_PRIORITY)
            .makePermanent()
            .forTable(VLAN_CIRCUIT_TABLE);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:CorsaPipelineV3.java


示例18: processTaggedPackets

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
protected void processTaggedPackets(boolean install) {
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
    selector.matchVlanId(VlanId.ANY);

    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
    treatment.transition(VLAN_MAC_XLATE_TABLE);

    FlowRule rule = DefaultFlowRule.builder()
            .forDevice(deviceId)
            .withSelector(selector.build())
            .withTreatment(treatment.build())
            .withPriority(CONTROLLER_PRIORITY)
            .fromApp(appId)
            .makePermanent()
            .forTable(VLAN_CHECK_TABLE).build();
    processFlowRule(install, rule, "Provisioned vlan table tagged packets");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:CorsaPipelineV3.java


示例19: processRouterPacket

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
private void processRouterPacket(boolean install) {

        deviceService.getPorts(deviceId).forEach(port -> {
            if (!port.number().isLogical()) {
                TrafficSelector.Builder selector = DefaultTrafficSelector.builder()
                        .matchVlanId(VlanId.vlanId(NATIVE_VLAN))
                        .matchInPort(port.number());

                TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder()
                        .setVlanPcp((byte) 0)
                        .setQueue(0)
                        .meter(defaultMeterId)
                        .transition(L3_IF_MAC_DA_TABLE);

                FlowRule rule = DefaultFlowRule.builder()
                        .forDevice(deviceId)
                        .withSelector(selector.build())
                        .withTreatment(treatment.build())
                        .withPriority(CONTROLLER_PRIORITY)
                        .fromApp(appId)
                        .makePermanent()
                        .forTable(VLAN_CIRCUIT_TABLE).build();
                processFlowRule(install, rule, "Provisioned vlan circuit table");
            }
        });
    }
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:CorsaPipelineV39.java


示例20: processEtherTable

import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
protected void processEtherTable(boolean install) {

        //Default action
        processTableMissDrop(install, ETHER_TABLE, "Provisioned ether type table drop");

        //IP to FIB_TABLE
        TrafficSelector.Builder selector = DefaultTrafficSelector.builder()
                .matchEthType(Ethernet.TYPE_IPV4);

        TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder().transition(FIB_TABLE);

        FlowRule rule = DefaultFlowRule.builder()
                .forDevice(deviceId)
                .withSelector(selector.build())
                .withTreatment(treatment.build())
                .withPriority(CONTROLLER_PRIORITY)
                .fromApp(appId)
                .makePermanent()
                .forTable(ETHER_TABLE).build();
        processFlowRule(install, rule, "Provisioned ether type table ip");
    }
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:CorsaPipelineV39.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MethodEncodedValue类代码示例发布时间:2022-05-22
下一篇:
Java ExceptionContext类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap