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


Java DefaultTrafficSelector.builder方法代码示例

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


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

示例1: processL3IFMacDATable

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
@Override
protected void processL3IFMacDATable(boolean install) {
    int table = L3_IF_MAC_DA_TABLE;

    //Default action
    processTableMissDrop(install, table, "Provisioned l3 table drop");

    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();

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

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

示例2: removeVxLanFlowRule

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * Removes the flow rules between traffic from VMs in different Cnode.
 *
 * @param deviceId device id
 * @param vmIp ip
 * @param vni vni which removed VM was belonged
 */
private void removeVxLanFlowRule(DeviceId deviceId, Ip4Address vmIp, long vni) {
    TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();

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

    ForwardingObjective fo = DefaultForwardingObjective.builder()
            .withSelector(sBuilder.build())
            .withTreatment(DefaultTrafficTreatment.builder().build())
            .withFlag(ForwardingObjective.Flag.SPECIFIC)
            .withPriority(SWITCHING_RULE_PRIORITY)
            .fromApp(appId)
            .remove();

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

示例3: 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

示例4: processEthDstOnlyFilter

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

示例5: deactivate

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
@Deactivate
protected void deactivate() {
    cfgService.removeListener(cfgListener);
    cfgService.unregisterConfigFactory(deviceConfigFactory);
    cfgService.unregisterConfigFactory(appConfigFactory);
    cfgService.unregisterConfigFactory(mcastConfigFactory);

    // Withdraw ARP packet-in
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
    selector.matchEthType(Ethernet.TYPE_ARP);
    packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId, Optional.empty());

    packetService.removeProcessor(processor);
    linkService.removeListener(linkListener);
    deviceService.removeListener(deviceListener);
    multicastRouteService.removeListener(mcastListener);
    cordConfigService.removeListener(cordConfigListener);

    processor = null;
    linkListener = null;
    deviceListener = null;
    groupHandlerMap.clear();

    nsNextObjStore.destroy();
    subnetNextObjStore.destroy();
    portNextObjStore.destroy();
    tunnelStore.destroy();
    policyStore.destroy();
    subnetVidStore.destroy();
    log.info("Stopped");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:32,代码来源:SegmentRoutingManager.java

示例6: withdrawIntercepts

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * Cancel request for packet in via packet service.
 */
private void withdrawIntercepts() {
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
    selector.matchEthType(Ethernet.TYPE_IPV4);
    packetService.cancelPackets(selector.build(), PacketPriority.REACTIVE, appId);
    selector.matchEthType(Ethernet.TYPE_ARP);
    packetService.cancelPackets(selector.build(), PacketPriority.REACTIVE, appId);
    selector.matchEthType(Ethernet.TYPE_IPV6);
    packetService.cancelPackets(selector.build(), PacketPriority.REACTIVE, appId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:ReactiveForwarding.java

示例7: revokeIpRuleForRouter

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * Revokes IP flow rules for the router IP address.
 *
 * @param ipPrefix the IP address of the destination router
 * @return true if all rules are removed successfully, false otherwise
 */
public boolean revokeIpRuleForRouter(IpPrefix ipPrefix) {
    TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
    sbuilder.matchIPDst(ipPrefix);
    sbuilder.matchEthType(Ethernet.TYPE_IPV4);
    TrafficSelector selector = sbuilder.build();
    TrafficTreatment dummyTreatment = DefaultTrafficTreatment.builder().build();

    ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective
            .builder()
            .fromApp(srManager.appId)
            .makePermanent()
            .withSelector(selector)
            .withTreatment(dummyTreatment)
            .withPriority(getPriorityFromPrefix(ipPrefix))
            .withFlag(ForwardingObjective.Flag.SPECIFIC);

    ObjectiveContext context = new DefaultObjectiveContext(
            (objective) -> log.debug("IP rule for router {} revoked", ipPrefix),
            (objective, error) ->
                    log.warn("Failed to revoke IP rule for router {}: {}", ipPrefix, error));

    srManager.deviceService.getAvailableDevices().forEach(device -> {
        srManager.flowObjectiveService.forward(device.id(), fwdBuilder.remove(context));
    });

    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:34,代码来源:RoutingRulePopulator.java

示例8: intentBuilder

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * MultiPointToSinglePointIntent builder.
 *
 * @param ipPrefix the ipPrefix to match
 * @param nextHopMacAddress to which the destination MAC address in packet
 * should be rewritten
 * @param egressPoint to which packets should be sent
 * @return the constructed MultiPointToSinglePointIntent
 */
private MultiPointToSinglePointIntent intentBuilder(IpPrefix ipPrefix,
        String nextHopMacAddress, ConnectPoint egressPoint) {

    TrafficSelector.Builder selectorBuilder =
            DefaultTrafficSelector.builder();
    if (ipPrefix.isIp4()) {
        selectorBuilder.matchEthType(Ethernet.TYPE_IPV4);
        selectorBuilder.matchIPDst(ipPrefix);
    } else {
        selectorBuilder.matchEthType(Ethernet.TYPE_IPV6);
        selectorBuilder.matchIPv6Dst(ipPrefix);
    }

    TrafficTreatment.Builder treatmentBuilder =
            DefaultTrafficTreatment.builder();
    treatmentBuilder.setEthDst(MacAddress.valueOf(nextHopMacAddress));

    Set<ConnectPoint> ingressPoints = new HashSet<>(connectPoints);
    ingressPoints.remove(egressPoint);

    MultiPointToSinglePointIntent intent =
            MultiPointToSinglePointIntent.builder()
                    .appId(APPID)
                    .key(Key.of(ipPrefix.toString(), APPID))
                    .selector(selectorBuilder.build())
                    .treatment(treatmentBuilder.build())
                    .ingressPoints(ingressPoints)
                    .egressPoint(egressPoint)
                    .build();
    return intent;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:41,代码来源:IntentSynchronizerTest.java

示例9: requestIntercepts

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * Request packet in via the PacketService.
 */
private void requestIntercepts() {
    //TODO: to support IPv6 later
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
    selector.matchEthType(TYPE_IPV4);
    packetService.requestPackets(selector.build(), REACTIVE, appId);
    selector.matchEthType(TYPE_ARP);
    packetService.requestPackets(selector.build(), REACTIVE, appId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:SdnIpReactiveRouting.java

示例10: modifyNextObjective

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * Creates a next objective for forwarding to a port. Handles metadata for
 * some pipelines that require vlan information for egress port.
 *
 * @param deviceId the device on which the next objective is being created
 * @param portNumber the egress port
 * @param vlanId vlan information for egress port
 * @param popVlan if vlan tag should be popped or not
 * @param install true to create an add next objective, false to create a remove
 *            next objective
 * @return nextId of the next objective created
 */
private int modifyNextObjective(DeviceId deviceId, PortNumber portNumber,
                                VlanId vlanId, boolean popVlan, boolean install) {
    int nextId = flowObjectiveService.allocateNextId();
    NextObjective.Builder nextObjBuilder = DefaultNextObjective
            .builder().withId(nextId)
            .withType(NextObjective.Type.SIMPLE)
            .fromApp(appId);

    TrafficTreatment.Builder ttBuilder = DefaultTrafficTreatment.builder();
    if (popVlan) {
        ttBuilder.popVlan();
    }
    ttBuilder.setOutput(portNumber);

    // setup metadata to pass to nextObjective - indicate the vlan on egress
    // if needed by the switch pipeline.
    TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder();
    metabuilder.matchVlanId(vlanId);

    nextObjBuilder.withMeta(metabuilder.build());
    nextObjBuilder.addTreatment(ttBuilder.build());
    log.debug("Submitted next objective {} in device {} for port/vlan {}/{}",
            nextId, deviceId, portNumber, vlanId);
    if (install) {
         flowObjectiveService.next(deviceId, nextObjBuilder.add());
    } else {
         flowObjectiveService.next(deviceId, nextObjBuilder.remove());
    }
    return nextId;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:43,代码来源:ControlPlaneRedirectManager.java

示例11: installLocalLabelRule

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
private void installLocalLabelRule(DeviceId deviceId, LabelResourceId labelId,
                                   PortNumber portNum, TunnelId tunnelId,
                                   Boolean isBos, Long labelType,
                                   Objective.Operation type) {
    checkNotNull(flowObjectiveService);
    checkNotNull(appId);
    TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();

    selectorBuilder.matchMplsLabel(MplsLabel.mplsLabel(labelId.id().intValue()));
    selectorBuilder.matchInPort(portNum);
    selectorBuilder.matchTunnelId(Long.parseLong(tunnelId.id()));
    selectorBuilder.matchMplsBos(isBos);
    selectorBuilder.matchMetadata(labelType);

    TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();

    ForwardingObjective.Builder forwardingObjective = DefaultForwardingObjective.builder()
            .withSelector(selectorBuilder.build())
            .withTreatment(treatment)
            .withFlag(ForwardingObjective.Flag.VERSATILE)
            .fromApp(appId)
            .makePermanent();

    if (type.equals(Objective.Operation.ADD)) {
        flowObjectiveService.forward(deviceId, forwardingObjective.add());
    } else {
        flowObjectiveService.forward(deviceId, forwardingObjective.remove());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:BasicPceccHandler.java

示例12: dstMatchIntentGenerator

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * PointToPointIntent Generator.
 * <p>
 * The intent will match the destination IP address in packet, rewrite the
 * destination IP address, and rewrite the destination MAC address.
 * </p>
 *
 * @param dstIpAddress the destination IP address in packet to match
 * @param newDstIpAddress the new destination IP address to set
 * @param dstMacAddress the destination MAC address to set
 * @param dstConnectPoint the egress point
 * @param srcConnectPoint the ingress point
 * @return a PointToPointIntent
 */
private PointToPointIntent dstMatchIntentGenerator(
                                            IpAddress dstIpAddress,
                                            IpAddress newDstIpAddress,
                                            MacAddress dstMacAddress,
                                            ConnectPoint dstConnectPoint,
                                            ConnectPoint srcConnectPoint) {
    checkNotNull(dstIpAddress);
    checkNotNull(newDstIpAddress);
    checkNotNull(dstMacAddress);
    checkNotNull(dstConnectPoint);
    checkNotNull(srcConnectPoint);

    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
    selector.matchEthType(Ethernet.TYPE_IPV4);
    selector.matchIPDst(IpPrefix.valueOf(dstIpAddress,
                                         IpPrefix.MAX_INET_MASK_LENGTH));

    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
    treatment.setEthDst(dstMacAddress);
    treatment.setIpDst(newDstIpAddress);

    Key key = Key.of(newDstIpAddress.toString() + "MatchDst", appId);
    PointToPointIntent intent = PointToPointIntent.builder()
            .appId(appId)
            .key(key)
            .selector(selector.build())
            .treatment(treatment.build())
            .egressPoint(dstConnectPoint)
            .ingressPoint(srcConnectPoint)
            .build();
    log.info("Generated a PointToPointIntent for traffic to local host "
            + ": {}", intent);

    return intent;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:50,代码来源:VbngManager.java

示例13: withdrawIntercepts

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * Withdraws packet intercepts.
 */
private void withdrawIntercepts() {
    TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
    selector.matchEthType(TYPE_LLDP);
    packetService.cancelPackets(selector.build(), PacketPriority.CONTROL,
                                appId, Optional.empty());
    selector.matchEthType(TYPE_BSN);
    packetService.cancelPackets(selector.build(), PacketPriority.CONTROL,
                                appId, Optional.empty());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:NetworkConfigLinksProvider.java

示例14: testRouteAddNoVlans

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * Tests adding a route. All interfaces have no VLAN Ids configured.
 *
 * We verify that the synchronizer records the correct state and that the
 * correct intent is submitted to the IntentService.
 */
@Test
public void testRouteAddNoVlans() {
    ResolvedRoute route = new ResolvedRoute(PREFIX1,
                                            Ip4Address.valueOf("192.168.30.1"),
                                            MacAddress.valueOf("00:00:00:00:00:03"));

    // Construct a MultiPointToSinglePointIntent intent
    TrafficSelector.Builder selectorBuilder =
            DefaultTrafficSelector.builder();
    selectorBuilder.matchEthType(Ethernet.TYPE_IPV4).matchIPDst(PREFIX1);

    TrafficTreatment.Builder treatmentBuilder =
            DefaultTrafficTreatment.builder();
    treatmentBuilder.setEthDst(MacAddress.valueOf("00:00:00:00:00:03"));

    Set<ConnectPoint> ingressPoints = new HashSet<>();
    ingressPoints.add(SW1_ETH1);
    ingressPoints.add(SW2_ETH1);

    MultiPointToSinglePointIntent intent =
            MultiPointToSinglePointIntent.builder()
                    .appId(APPID)
                    .key(Key.of(PREFIX1.toString(), APPID))
                    .selector(selectorBuilder.build())
                    .treatment(treatmentBuilder.build())
                    .ingressPoints(ingressPoints)
                    .egressPoint(SW3_ETH1)
                    .constraints(SdnIpFib.CONSTRAINTS)
                    .build();

    // Setup the expected intents
    intentSynchronizer.submit(eqExceptId(intent));
    replay(intentSynchronizer);

    // Send in the added event
    routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_ADDED, route));

    verify(intentSynchronizer);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:46,代码来源:SdnIpFibNoVlansTest.java

示例15: pushRules

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
private void pushRules(Device device) {

        TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
        TrafficTreatment.Builder tbuilder = DefaultTrafficTreatment.builder();
        int inport = 1;
        int outport = 2;
        MplsLabel mplsLabel = MplsLabel.mplsLabel(101);
        Integer switchNumber = uglyMap.get(device.id());
        if (switchNumber == null) {
            return;
        }

        switch (switchNumber) {
            case 1:
                sbuilder.matchInPort(PortNumber.portNumber(inport));
                tbuilder.setOutput(PortNumber.portNumber(outport))
                        .pushMpls()
                        .setMpls(mplsLabel);
                break;
            case 2:
                sbuilder.matchMplsLabel(mplsLabel)
                        .matchEthType(Ethernet.MPLS_UNICAST)
                        .matchInPort(PortNumber.portNumber(inport));
                tbuilder.setOutput(PortNumber.portNumber(outport));
                break;
            case 3:
                sbuilder.matchMplsLabel(mplsLabel)
                        .matchEthType(Ethernet.MPLS_UNICAST)
                        .matchInPort(PortNumber.portNumber(inport));
                tbuilder.popMpls().setOutput(PortNumber.portNumber(outport));
                break;
            default:
        }

        TrafficTreatment treatement = tbuilder.build();
        TrafficSelector selector = sbuilder.build();

        FlowRule f = DefaultFlowRule.builder()
                .forDevice(device.id())
                .withSelector(selector)
                .withTreatment(treatement)
                .withPriority(100)
                .fromApp(appId)
                .makeTemporary(600)
                .build();

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


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