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


Java MacAddress.NONE属性代码示例

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


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

示例1: Interface

/**
 * Creates new Interface with the provided configuration.
 *
 * @param name name of the interface
 * @param connectPoint the connect point this interface maps to
 * @param ipAddresses list of IP addresses
 * @param macAddress MAC address
 * @param vlan VLAN ID
 */
public Interface(String name, ConnectPoint connectPoint,
                 List<InterfaceIpAddress> ipAddresses,
                 MacAddress macAddress, VlanId vlan) {
    this.name = name == null ? NO_INTERFACE_NAME : name;
    this.connectPoint = checkNotNull(connectPoint);
    this.ipAddresses = ipAddresses == null ? Lists.newArrayList() : ipAddresses;
    this.macAddress = macAddress == null ? MacAddress.NONE : macAddress;
    this.vlan = vlan == null ? VlanId.NONE : vlan;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:Interface.java

示例2: processArpPacketFromRouter

/**
 * Handles ARP packet.
 *
 * @param context packet context
 * @param ethernet ethernet
 */
public void processArpPacketFromRouter(PacketContext context, Ethernet ethernet) {
    checkNotNull(context, "context can not be null");
    checkNotNull(ethernet, "ethernet can not be null");


    ARP arp = (ARP) ethernet.getPayload();

    log.debug("arpEvent called from {} to {}",
            Ip4Address.valueOf(arp.getSenderProtocolAddress()).toString(),
            Ip4Address.valueOf(arp.getTargetProtocolAddress()).toString());

    if (arp.getOpCode() != ARP.OP_REQUEST) {
        return;
    }

    IpAddress targetIp = Ip4Address.valueOf(arp.getTargetProtocolAddress());
    MacAddress targetMac = getTargetMacForTargetIp(targetIp.getIp4Address());

    if (targetMac == MacAddress.NONE) {
        return;
    }

    Ethernet ethReply = ARP.buildArpReply(targetIp.getIp4Address(),
            targetMac, ethernet);

    TrafficTreatment treatment = DefaultTrafficTreatment.builder()
            .setOutput(context.inPacket().receivedFrom().port())
            .build();

    packetService.emit(new DefaultOutboundPacket(
            context.inPacket().receivedFrom().deviceId(),
            treatment,
            ByteBuffer.wrap(ethReply.serialize())));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:40,代码来源:OpenstackRoutingArpHandler.java

示例3: getTargetMacForTargetIp

private MacAddress getTargetMacForTargetIp(Ip4Address targetIp) {
    OpenstackPort port = openstackService.ports().stream()
            .filter(p -> p.deviceOwner().equals(NETWORK_ROUTER_GATEWAY))
            .filter(p -> p.fixedIps().containsValue(targetIp.getIp4Address()))
            .findAny().orElse(null);

    if (port == null) {
        return MacAddress.NONE;
    }
    return port.macAddress();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:OpenstackRoutingArpHandler.java


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