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

Java VlanId类代码示例

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

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



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

示例1: parseHost

import org.onlab.packet.VlanId; //导入依赖的package包/类
/**
 * Creates and adds new host based on given data and returns its host ID.
 *
 * @param node JsonNode containing host information
 * @return host ID of new host created
 */
private HostId parseHost(JsonNode node) {
    MacAddress mac = MacAddress.valueOf(node.get("mac").asText());
    VlanId vlanId = VlanId.vlanId((short) node.get("vlan").asInt(VlanId.UNTAGGED));
    JsonNode locationNode = node.get("location");
    String deviceAndPort = locationNode.get("elementId").asText() + "/" +
            locationNode.get("port").asText();
    HostLocation hostLocation = new HostLocation(ConnectPoint.deviceConnectPoint(deviceAndPort), 0);

    Iterator<JsonNode> ipStrings = node.get("ipAddresses").elements();
    Set<IpAddress> ips = new HashSet<>();
    while (ipStrings.hasNext()) {
        ips.add(IpAddress.valueOf(ipStrings.next().asText()));
    }

    // try to remove elements from json node after reading them
    SparseAnnotations annotations = annotations(removeElements(node, REMOVAL_KEYS));
    // Update host inventory

    HostId hostId = HostId.hostId(mac, vlanId);
    DefaultHostDescription desc = new DefaultHostDescription(mac, vlanId, hostLocation, ips, annotations);
    hostProviderService.hostDetected(hostId, desc, false);
    return hostId;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:HostsWebResource.java


示例2: createHost

import org.onlab.packet.VlanId; //导入依赖的package包/类
/**
 * Creates a default host connected at the given edge device and port. Note
 * that an identifying hex character ("a" - "f") should be supplied. This
 * will be included in the MAC address of the host (and equivalent value
 * as last byte in IP address).
 *
 * @param device  edge device
 * @param port    port number
 * @param hexChar identifying hex character
 * @return host connected at that location
 */
protected static Host createHost(Device device, int port, String hexChar) {
    DeviceId deviceId = device.id();
    String devNum = deviceId.toString().substring(1);

    MacAddress mac = MacAddress.valueOf(HOST_MAC_PREFIX + devNum + hexChar);
    HostId hostId = hostId(String.format("%s/-1", mac));

    int ipByte = Integer.valueOf(hexChar, 16);
    if (ipByte < 10 || ipByte > 15) {
        throw new IllegalArgumentException("hexChar must be a-f");
    }
    HostLocation loc = new HostLocation(deviceId, portNumber(port), 0);

    IpAddress ip = ip("10." + devNum + ".0." + ipByte);

    return new DefaultHost(ProviderId.NONE, hostId, mac, VlanId.NONE,
            loc, ImmutableSet.of(ip));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:AbstractTopoModelTest.java


示例3: processEthDstFilter

import org.onlab.packet.VlanId; //导入依赖的package包/类
@Override
//Dell switches need ETH_DST based match condition in all IP table entries.
//So while processing the ETH_DST based filtering objective, store
//the device MAC to be used locally to use it while pushing the IP rules.
protected List<FlowRule> processEthDstFilter(EthCriterion ethCriterion,
                                             VlanIdCriterion vlanIdCriterion,
                                             FilteringObjective filt,
                                             VlanId assignedVlan,
                                             ApplicationId applicationId) {
    // Store device termination Mac to be used in IP flow entries
    deviceTMac = ethCriterion.mac();

    log.debug("For now not adding any TMAC rules "
            + "into Dell switches as it is ignoring");

    return Collections.emptyList();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:SpringOpenTTPDell.java


示例4: fwdObjBuilder

import org.onlab.packet.VlanId; //导入依赖的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


示例5: processBroadcastNextObjective

import org.onlab.packet.VlanId; //导入依赖的package包/类
/**
 * As per the OFDPA 2.0 TTP, packets are sent out of ports by using
 * a chain of groups. The broadcast Next Objective passed in by the application
 * has to be broken up into a group chain comprising of an
 * L2 Flood group whose buckets point to L2 Interface groups.
 *
 * @param nextObj  the nextObjective of type BROADCAST
 */
private void processBroadcastNextObjective(NextObjective nextObj) {
    VlanId assignedVlan = Ofdpa2Pipeline.readVlanFromSelector(nextObj.meta());
    if (assignedVlan == null) {
        log.warn("VLAN ID required by broadcast next obj is missing. Abort.");
        Ofdpa2Pipeline.fail(nextObj, ObjectiveError.BADPARAMS);
        return;
    }

    List<GroupInfo> groupInfos = prepareL2InterfaceGroup(nextObj, assignedVlan);

    IpPrefix ipDst = Ofdpa2Pipeline.readIpDstFromSelector(nextObj.meta());
    if (ipDst != null) {
        if (ipDst.isMulticast()) {
            createL3MulticastGroup(nextObj, assignedVlan, groupInfos);
        } else {
            log.warn("Broadcast NextObj with non-multicast IP address {}", nextObj);
            Ofdpa2Pipeline.fail(nextObj, ObjectiveError.BADPARAMS);
            return;
        }
    } else {
        createL2FloodGroup(nextObj, assignedVlan, groupInfos);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:32,代码来源:Ofdpa2GroupHandler.java


示例6: mapAction

import org.onlab.packet.VlanId; //导入依赖的package包/类
@Override
public ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException {
    if (action.getType().equals(OFActionType.SET_FIELD)) {
        OFActionSetField setFieldAction = (OFActionSetField) action;
        OFOxm<?> oxm = setFieldAction.getField();
        switch (oxm.getMatchField().id) {
            case VLAN_VID:
                OFOxmVlanVid vlanVid = (OFOxmVlanVid) oxm;
                return new OfdpaSetVlanVid(VlanId.vlanId(vlanVid.getValue().getRawVid()));
            default:
                throw new UnsupportedOperationException(
                        "Driver does not support extension type " + oxm.getMatchField().id);
        }
    }
    throw new UnsupportedOperationException(
            "Unexpected OFAction: " + action.toString());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:OfdpaExtensionTreatmentInterpreter.java


示例7: mapSelector

import org.onlab.packet.VlanId; //导入依赖的package包/类
@Override
public OFOxm<?> mapSelector(OFFactory factory, ExtensionSelector extensionSelector) {
    ExtensionSelectorType type = extensionSelector.type();
    if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_VLAN_VID.type())) {
        VlanId vlanId = ((OfdpaMatchVlanVid) extensionSelector).vlanId();
        // Special VLAN 0x0000/0x1FFF required by OFDPA
        if (vlanId.equals(VlanId.NONE)) {
            OFVlanVidMatch vid = OFVlanVidMatch.ofRawVid((short) 0x0000);
            OFVlanVidMatch mask = OFVlanVidMatch.ofRawVid((short) 0x1FFF);
            return factory.oxms().vlanVidMasked(vid, mask);
        // Normal case
        } else if (vlanId.equals(VlanId.ANY)) {
            return factory.oxms().vlanVidMasked(OFVlanVidMatch.PRESENT, OFVlanVidMatch.PRESENT);
        } else {
            return factory.oxms().vlanVid(OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vlanId.toShort())));
        }
    }
    throw new UnsupportedOperationException(
            "Unexpected ExtensionSelector: " + extensionSelector.toString());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:OfdpaExtensionSelectorInterpreter.java


示例8: processVlanMplsTable

import org.onlab.packet.VlanId; //导入依赖的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


示例9: processTaggedPackets

import org.onlab.packet.VlanId; //导入依赖的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


示例10: processUntaggedPackets

import org.onlab.packet.VlanId; //导入依赖的package包/类
private void processUntaggedPackets(boolean install) {

        deviceService.getPorts(deviceId).forEach(port -> {
            if (!port.number().isLogical()) {

                TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder()
                        .pushVlan().setVlanId(VlanId.vlanId(NATIVE_VLAN))
                        .transition(VLAN_MAC_XLATE_TABLE);

                TrafficSelector.Builder selector = DefaultTrafficSelector.builder()
                        .matchVlanId(VlanId.NONE)
                        .matchInPort(port.number());

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

                processFlowRule(install, rule.build(), "Provisioned vlan untagged packet table");
            }
        });
    }
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:CorsaPipelineV39.java


示例11: addTrunkInterface

import org.onlab.packet.VlanId; //导入依赖的package包/类
/**
 *  Adds a trunk interface for VLANs.
 *
 * @param deviceId the device ID
 * @param intf the name of the interface
 * @param vlanIds the VLAN IDs
 * @return the result of operation
 */
@Override
public boolean addTrunkInterface(DeviceId deviceId, String intf, List<VlanId> vlanIds) {
    NetconfController controller = checkNotNull(handler()
                                   .get(NetconfController.class));

    NetconfSession session = controller.getDevicesMap().get(handler()
                             .data().deviceId()).getSession();
    String reply;
    try {
        reply = session.requestSync(addTrunkInterfaceBuilder(intf, vlanIds));
    } catch (NetconfException e) {
        log.error("Failed to configure trunk mode for VLAN ID {} on device {} interface {}.",
                  vlanIds, deviceId, intf, e);
        return false;
    }

    return XmlConfigParser.configSuccess(XmlConfigParser.loadXml(
            new ByteArrayInputStream(reply.getBytes(StandardCharsets.UTF_8))));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:InterfaceConfigCiscoIosImpl.java


示例12: setUpInterfaceService

import org.onlab.packet.VlanId; //导入依赖的package包/类
/**
 * Setup Interface expectation for all Testcases.
 **/
private void setUpInterfaceService() {
    Set<InterfaceIpAddress> interfaceIpAddresses1 = Sets.newHashSet();
    interfaceIpAddresses1
            .add(new InterfaceIpAddress(IpAddress.valueOf("192.168.10.101"), IpPrefix.valueOf("192.168.10.0/24")));
    Interface sw1Eth1 = new Interface(SW1_ETH1.deviceId().toString(), SW1_ETH1, interfaceIpAddresses1,
            MacAddress.valueOf("00:00:00:00:00:01"), VlanId.NONE);
    interfaces.add(sw1Eth1);

    Set<InterfaceIpAddress> interfaceIpAddresses2 = Sets.newHashSet();
    interfaceIpAddresses2
            .add(new InterfaceIpAddress(IpAddress.valueOf("192.168.20.101"), IpPrefix.valueOf("192.168.20.0/24")));
    Interface sw1Eth2 = new Interface(SW1_ETH1.deviceId().toString(), SW1_ETH2, interfaceIpAddresses2,
            MacAddress.valueOf("00:00:00:00:00:02"), VlanId.NONE);
    interfaces.add(sw1Eth2);

    Set<InterfaceIpAddress> interfaceIpAddresses3 = Sets.newHashSet();
    interfaceIpAddresses3
            .add(new InterfaceIpAddress(IpAddress.valueOf("192.168.30.101"), IpPrefix.valueOf("192.168.30.0/24")));
    Interface sw1Eth3 = new Interface(SW1_ETH1.deviceId().toString(), SW1_ETH3, interfaceIpAddresses3,
            MacAddress.valueOf("00:00:00:00:00:03"), VlanId.NONE);
    interfaces.add(sw1Eth3);

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


示例13: setupConnectivity

import org.onlab.packet.VlanId; //导入依赖的package包/类
protected void setupConnectivity() {
    /*
     * Parse Configuration and get Connect Point by VlanId.
     */
    SetMultimap<VlanId, ConnectPoint> confCPointsByVlan = getConfigCPoints();

    /*
     * Check that configured Connect Points have hosts attached and
     * associate their Mac Address to the Connect Points configured.
     */
    SetMultimap<VlanId, Pair<ConnectPoint, MacAddress>> confHostPresentCPoint =
            pairAvailableHosts(confCPointsByVlan);

    /*
     * Create and submit intents between the Connect Points.
     * Intents for broadcast between all the configured Connect Points.
     * Intents for unicast between all the configured Connect Points with
     * hosts attached.
     */
    intentInstaller.installIntents(confHostPresentCPoint);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:Vpls.java


示例14: removeGroupFromDevice

import org.onlab.packet.VlanId; //导入依赖的package包/类
/**
 * Removes entire group on given device.
 *
 * @param deviceId device ID
 * @param mcastIp multicast group to be removed
 * @param assignedVlan assigned VLAN ID
 */
private void removeGroupFromDevice(DeviceId deviceId, IpAddress mcastIp,
        VlanId assignedVlan) {
    McastStoreKey mcastStoreKey = new McastStoreKey(mcastIp, deviceId);
    // This device is not serving this multicast group
    if (!mcastNextObjStore.containsKey(mcastStoreKey)) {
        log.warn("{} is not serving {}. Abort.", deviceId, mcastIp);
        return;
    }
    NextObjective nextObj = mcastNextObjStore.get(mcastStoreKey).value();
    // NOTE: Rely on GroupStore garbage collection rather than explicitly
    //       remove L3MG since there might be other flows/groups refer to
    //       the same L2IG
    ObjectiveContext context = new DefaultObjectiveContext(
            (objective) -> log.debug("Successfully remove {} on {}, vlan {}",
                    mcastIp, deviceId, assignedVlan),
            (objective, error) ->
                    log.warn("Failed to remove {} on {}, vlan {}: {}",
                            mcastIp, deviceId, assignedVlan, error));
    ForwardingObjective fwdObj = fwdObjBuilder(mcastIp, assignedVlan, nextObj.id()).remove(context);
    srManager.flowObjectiveService.forward(deviceId, fwdObj);
    mcastNextObjStore.remove(mcastStoreKey);
    mcastRoleStore.remove(mcastStoreKey);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:McastHandler.java


示例15: createHosts

import org.onlab.packet.VlanId; //导入依赖的package包/类
/**
 * Creates simularted hosts for the specified device.
 *
 * @param deviceId   device identifier
 * @param portOffset port offset where to start attaching hosts
 */
protected void createHosts(DeviceId deviceId, int portOffset) {
    String s = deviceId.toString();
    byte dByte = Byte.parseByte(s.substring(s.length() - 1), 16);
    // TODO: this limits the simulation to 256 devices & 256 hosts/device.
    byte[] macBytes = new byte[]{0, 0, 0, 0, dByte, 0};
    byte[] ipBytes = new byte[]{(byte) 192, (byte) 168, dByte, 0};

    for (int i = 0; i < hostCount; i++) {
        int port = portOffset + i + 1;
        macBytes[5] = (byte) (i + 1);
        ipBytes[3] = (byte) (i + 1);
        HostId id = hostId(MacAddress.valueOf(macBytes), VlanId.NONE);
        IpAddress ip = IpAddress.valueOf(IpAddress.Version.INET, ipBytes);
        hostProviderService.hostDetected(id, description(id, ip, deviceId, port), false);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:TopologySimulator.java


示例16: filterObjBuilder

import org.onlab.packet.VlanId; //导入依赖的package包/类
/**
 * Creates a filtering objective builder for multicast.
 *
 * @param deviceId Device ID
 * @param ingressPort ingress port of the multicast stream
 * @param assignedVlan assigned VLAN ID
 * @return filtering objective builder
 */
private FilteringObjective.Builder filterObjBuilder(DeviceId deviceId, PortNumber ingressPort,
        VlanId assignedVlan) {
    FilteringObjective.Builder filtBuilder = DefaultFilteringObjective.builder();
    filtBuilder.withKey(Criteria.matchInPort(ingressPort))
            .addCondition(Criteria.matchEthDstMasked(MacAddress.IPV4_MULTICAST,
                    MacAddress.IPV4_MULTICAST_MASK))
            .addCondition(Criteria.matchVlanId(egressVlan()))
            .withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
    // vlan assignment is valid only if this instance is master
    if (srManager.mastershipService.isLocalMaster(deviceId)) {
        TrafficTreatment tt = DefaultTrafficTreatment.builder()
                .pushVlan().setVlanId(assignedVlan).build();
        filtBuilder.withMeta(tt);
    }
    return filtBuilder.permit().fromApp(srManager.appId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:McastHandler.java


示例17: buildBrcIntent

import org.onlab.packet.VlanId; //导入依赖的package包/类
/**
 * Builds a Single Point to Multi Point intent.
 *
 * @param key  The intent key
 * @param src  The source Connect Point
 * @param dsts The destination Connect Points
 * @return Single Point to Multi Point intent generated.
 */
private SinglePointToMultiPointIntent buildBrcIntent(Key key,
                                                     ConnectPoint src,
                                                     Set<ConnectPoint> dsts,
                                                     VlanId vlanId) {
    SinglePointToMultiPointIntent intent;

    TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();

    TrafficSelector selector = DefaultTrafficSelector.builder()
            .matchEthDst(MacAddress.BROADCAST)
            .matchVlanId(vlanId)
            .build();

    intent = SinglePointToMultiPointIntent.builder()
            .appId(APPID)
            .key(key)
            .selector(selector)
            .treatment(treatment)
            .ingressPoint(src)
            .egressPoints(dsts)
            .priority(PRIORITY_OFFSET)
            .build();
    return intent;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:33,代码来源:VplsTest.java


示例18: execute

import org.onlab.packet.VlanId; //导入依赖的package包/类
@Override
protected void execute() {
    InterfaceAdminService interfaceService = get(InterfaceAdminService.class);

    List<InterfaceIpAddress> ipAddresses = Lists.newArrayList();
    if (ips != null) {
        for (String strIp : ips) {
            ipAddresses.add(InterfaceIpAddress.valueOf(strIp));
        }
    }

    MacAddress macAddr = mac == null ? null : MacAddress.valueOf(mac);

    VlanId vlanId = vlan == null ? VlanId.NONE : VlanId.vlanId(Short.parseShort(vlan));

    Interface intf = new Interface(name,
            ConnectPoint.deviceConnectPoint(connectPoint),
            ipAddresses, macAddr, vlanId);

    interfaceService.add(intf);

    print("Interface added");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:InterfaceAddCommand.java


示例19: printAllocation

import org.onlab.packet.VlanId; //导入依赖的package包/类
private void printAllocation(DeviceId did, PortNumber num, int level) {
    if (level == 0) {
        // print DeviceId when Port was directly specified.
        print("%s", did);
    }
    print("%s%s", Strings.repeat(" ", level), asVerboseString(num));

    // FIXME: This workaround induces a lot of distributed store access.
    //        ResourceService should have an API to get all allocations under a parent resource.
    Set<Class<?>> subResourceTypes = ImmutableSet.<Class<?>>builder()
            .add(OchSignal.class)
            .add(VlanId.class)
            .add(MplsLabel.class)
            .add(Bandwidth.class)
            .add(TributarySlot.class)
            .build();

    DiscreteResourceId resourceId = Resources.discrete(did, num).id();
    for (Class<?> t : subResourceTypes) {
        resourceService.getResourceAllocations(resourceId, t).stream()
                .filter(a -> isSubjectToPrint(a))
                .forEach(a -> print("%s%s allocated by %s", Strings.repeat(" ", level + 1),
                        a.resource().valueAs(Object.class).orElse(""), asVerboseString(a.consumerId())));

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


示例20: modifyNextObjective

import org.onlab.packet.VlanId; //导入依赖的package包/类
/**
 * Setup expectations on flowObjectiveService.next for NextObjective.
 *
 **/
private int modifyNextObjective(DeviceId deviceId, PortNumber portNumber, VlanId vlanId, boolean popVlan,
        boolean modifyFlag) {
    NextObjective.Builder nextObjBuilder = DefaultNextObjective.builder().withId(1)
            .withType(NextObjective.Type.SIMPLE).fromApp(APPID);

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

    TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder();
    metabuilder.matchVlanId(vlanId);

    nextObjBuilder.withMeta(metabuilder.build());
    nextObjBuilder.addTreatment(ttBuilder.build());
    if (modifyFlag) {
        flowObjectiveService.next(deviceId, nextObjBuilder.add());
        expectLastCall().once();
    } else {
        flowObjectiveService.next(deviceId, nextObjBuilder.remove());
        expectLastCall().once();
    }
    return 1;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:ControlPlaneRedirectManagerTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ResourceFailedLocalizationEvent类代码示例发布时间:2022-05-22
下一篇:
Java TestSecurityMockRM类代码示例发布时间: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