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

Java RawPacket类代码示例

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

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



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

示例1: floodPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
/**
 *The function is a modification of an another function. The original
 *is property of SDNHUB.org and it's used under a GPLv3 License. All the credits for SDNHUB.org
 *The original code can be find in
 *https://github.com/sdnhub/SDNHub_Opendaylight_Tutorial/blob/master/adsal_L2_forwarding/src/main/java/org/opendaylight/tutorial/tutorial_L2_forwarding/internal/TutorialL2Forwarding.java
 * Función utilizada para inundar en caso de no tener la dirección destino
 * @param inPkt: paquete entrante al nodo
 */
private void floodPacket(RawPacket inPkt) {
	log.info("flooding packet");
    NodeConnector incoming_connector = inPkt.getIncomingNodeConnector();
    Node incoming_node = incoming_connector.getNode();
    Set<NodeConnector> nodeConnectors = this.switchManager.getUpNodeConnectors(incoming_node);
    for (NodeConnector p : nodeConnectors) {
        if (!p.equals(incoming_connector)) {
            try {
                RawPacket destPkt = new RawPacket(inPkt);
                destPkt.setOutgoingNodeConnector(p);
                this.dataPacketService.transmitDataPacket(destPkt);
                //log.info("Datos de paquete transmitido dentro de floodpacket: "+this.dataPacketService.decodeDataPacket(destPkt).toString());
            } catch (ConstructionException e2) {
                continue;
            }
        }
    }
}
 
开发者ID:pahharo,项目名称:dissectorapp,代码行数:27,代码来源:DissectorHandler.java


示例2: sendARPReply

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
protected void sendARPReply(NodeConnector p, byte[] sMAC, InetAddress sIP,
        byte[] tMAC, InetAddress tIP) {
    byte[] senderIP = sIP.getAddress();
    byte[] targetIP = tIP.getAddress();
    ARP arp = new ARP();
    arp.setHardwareType(ARP.HW_TYPE_ETHERNET).setProtocolType(
            EtherTypes.IPv4.shortValue())
            .setHardwareAddressLength((byte) 6).setProtocolAddressLength(
                    (byte) 4).setOpCode(ARP.REPLY)
            .setSenderHardwareAddress(sMAC).setSenderProtocolAddress(
                    senderIP).setTargetHardwareAddress(tMAC)
            .setTargetProtocolAddress(targetIP);

    Ethernet ethernet = new Ethernet();
    ethernet.setSourceMACAddress(sMAC).setDestinationMACAddress(tMAC)
            .setEtherType(EtherTypes.ARP.shortValue()).setPayload(arp);

    RawPacket destPkt = this.dataPacketService.encodeDataPacket(ethernet);
    destPkt.setOutgoingNodeConnector(p);

    this.dataPacketService.transmitDataPacket(destPkt);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:23,代码来源:ArpHandler.java


示例3: receiveDataPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
@Override
public PacketResult receiveDataPacket(RawPacket inPkt) {
    if (inPkt == null) {
        return PacketResult.IGNORED;
    }
    logger.trace("Received a frame of size: {}",
                    inPkt.getPacketData().length);
    Packet formattedPak = this.dataPacketService.decodeDataPacket(inPkt);
    if (formattedPak instanceof Ethernet) {
        Object nextPak = formattedPak.getPayload();
        if (nextPak instanceof IPv4) {
            handlePuntedIPPacket((IPv4) nextPak, inPkt
                    .getIncomingNodeConnector());
            logger.trace("Handled IP packet");
        }
        if (nextPak instanceof ARP) {
            handleARPPacket((Ethernet) formattedPak, (ARP) nextPak, inPkt
                    .getIncomingNodeConnector());
            logger.trace("Handled ARP packet");
        }
    }
    return PacketResult.IGNORED;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:24,代码来源:ArpHandler.java


示例4: decodeDataPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
@Override
public Packet decodeDataPacket(RawPacket pkt) {
    // Sanity checks
    if (pkt == null) {
        return null;
    }
    byte[] data = pkt.getPacketData();
    if (data.length <= 0) {
        return null;
    }
    if (pkt.getEncap().equals(LinkEncap.ETHERNET)) {
        Ethernet res = new Ethernet();
        try {
            res.deserialize(data, 0, data.length * NetUtils.NumBitsInAByte);
        } catch (Exception e) {
            logger.warn("Failed to decode packet: {}", e.getMessage());
        }
        return res;
    }
    return null;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:22,代码来源:DataPacketService.java


示例5: encodeDataPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
@Override
public RawPacket encodeDataPacket(Packet pkt) {
    // Sanity checks
    if (pkt == null) {
        return null;
    }
    byte[] data;
    try {
        data = pkt.serialize();
    } catch (Exception e) {
        logger.error("",e);
        return null;
    }
    if (data.length <= 0) {
        return null;
    }
    try {
        RawPacket res = new RawPacket(data);
        return res;
    } catch (ConstructionException cex) {
    }
    // If something goes wrong then we have to return null
    return null;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:25,代码来源:DataPacketService.java


示例6: run

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
@Override
public void run() {
    while (true) {
        try {
            NodeConnector nodeConnector = transmitQ.take();
            RawPacket outPkt = createDiscoveryPacket(nodeConnector);
            sendDiscoveryPacket(nodeConnector, outPkt);
            nodeConnector = null;
        } catch (InterruptedException e1) {
            logger.warn("DiscoveryTransmit interupted", e1.getMessage());
            if (shuttingDown) {
                return;
            }
        } catch (Exception e2) {
            logger.error("", e2);
        }
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:19,代码来源:DiscoveryService.java


示例7: receiveDataPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
@Override
public PacketResult receiveDataPacket(RawPacket inPkt) {
    log.trace("Received data packet.");

    // Convert packet to JSON representation.
    String jsonStr = pktToJSON(inPkt).toString();
            
    // Send notification to JMS topic.
    TextMessage message;
    try {
        if (session != null && publisher != null) {
            message = session.createTextMessage(jsonStr);
            setMsgProperties(message, inPkt);
            log.trace("Publishing the following packet-in event: " + jsonStr);
            publisher.send(message);
        } else {
            log.error("Cannot publish packet-in event. JMS not setup.");
        }
    } catch (JMSException e) {
        log.error("Error while publishing packet-in event: " + e.getMessage());
        return PacketResult.IGNORED;
    }
    
    // Also let other message handlers process this packet. 
    // If you don't want these services, remove them from
    // the OpenDaylight configuration.
    return PacketResult.KEEP_PROCESSING;
}
 
开发者ID:duerrfk,项目名称:sdn-mq,代码行数:29,代码来源:PacketHandler.java


示例8: receiveDataPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
public PacketResult receiveDataPacket(RawPacket inPkt) {
    PacketResult result = PacketResult.IGNORED;

    // Let's only do this for OF nodeTypes... IOFMessageListener only understand OF
    if(packetInListeners.size() > 0 &&
        inPkt.getIncomingNodeConnector().getNode().getType() == Node.NodeIDType.OPENFLOW) {
        /*
         * Looked in org.sdnplatform.devicemanager.internal.DeviceManagerImpl.processPacketInMessage()
         * and it appears to only need the OFPacketIn.data and OFPacketIn.inport
         * additionally it seems to only need IOFSwitch.getID() and IOFSwitch.getStringID()
         */
        // Create a new OFPacketIn
        OFPacketIn in = new OFPacketIn();
        // Set its data
        in.setPacketData(inPkt.getPacketData());
        // Set its inport
        in.setInPort(toOFPort(inPkt.getIncomingNodeConnector()));

        // Create a new Ethernet and deserialize the packet data into it
        Ethernet eth = new Ethernet();
        eth.deserialize(in.getPacketData(), 0,
        in.getPacketData().length);
        // Add the Ethernet to the ListenerContext
        ListenerContext ctx = new ListenerContext();
        ctx.getStorage().put(IControllerService.CONTEXT_PI_PAYLOAD, eth);

        // Create a new OFSwitchAdaptor and set its id

        OFSwitchAdaptor sw = new OFSwitchAdaptor();
        sw.setId((Long) inPkt.getIncomingNodeConnector().getNode().getID());

        // Send OFPacketIn to all IOFMessageListeners
        for(IOFMessageListener packetInListener: this.packetInListeners) {
            packetInListener.receive(sw, in, ctx);
        }
        result = PacketResult.KEEP_PROCESSING;
    }

    return result;
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:41,代码来源:ControllerServiceAdaptor.java


示例9: sendUcastARPRequest

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
protected void sendUcastARPRequest(HostNodeConnector host, Subnet subnet) {
    //Long swID = host.getnodeconnectornodeId();
    //Short portID = host.getnodeconnectorportId();
    //Node n = NodeCreator.createOFNode(swID);
    Node n = host.getnodeconnectorNode();
    if (n == null) {
        logger.error("cannot send UcastARP because cannot extract node "
                + "from HostNodeConnector: {}", host);
        return;
    }
    NodeConnector outPort = host.getnodeConnector();
    if (outPort == null) {
        logger.error("cannot send UcastARP because cannot extract "
                + "outPort from HostNodeConnector: {}", host);
        return;
    }

    byte[] senderIP = subnet.getNetworkAddress().getAddress();
    byte[] targetIP = host.getNetworkAddress().getAddress();
    byte[] targetMAC = host.getDataLayerAddressBytes();
    ARP arp = new ARP();
    arp.setHardwareType(ARP.HW_TYPE_ETHERNET).setProtocolType(
            EtherTypes.IPv4.shortValue())
            .setHardwareAddressLength((byte) 6).setProtocolAddressLength(
                    (byte) 4).setOpCode(ARP.REQUEST)
            .setSenderHardwareAddress(getControllerMAC())
            .setSenderProtocolAddress(senderIP).setTargetHardwareAddress(
                    targetMAC).setTargetProtocolAddress(targetIP);

    Ethernet ethernet = new Ethernet();
    ethernet.setSourceMACAddress(getControllerMAC())
            .setDestinationMACAddress(targetMAC).setEtherType(
                    EtherTypes.ARP.shortValue()).setPayload(arp);

    RawPacket destPkt = this.dataPacketService.encodeDataPacket(ethernet);
    destPkt.setOutgoingNodeConnector(outPort);

    this.dataPacketService.transmitDataPacket(destPkt);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:40,代码来源:ArpHandler.java


示例10: dispatchPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
/**
 * Loop for processing Received packets
 */
private void dispatchPacket(RawPacket pkt) {

    // for now we treat all listeners as serial listeners
    for (List<DataPacketListener> serialListeners : listenDataPacket) {
        for (DataPacketListener l : serialListeners) {

            // TODO: possibly deal with read-only and read-write packet
            // copies
            IListenDataPacket s = (l == null ? null : l.listener);
            if (s != null) {
                try {
                    // TODO Make sure to filter based on the match too,
                    // later on
                    PacketResult res = s.receiveDataPacket(pkt);
                    increaseStat("RXPacketSuccess");
                    if (res.equals(PacketResult.CONSUME)) {
                        increaseStat("RXPacketSerialExit");
                        break;
                    }
                } catch (Exception e) {
                    increaseStat("RXPacketFailedForException");
                }
            }
        }
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:30,代码来源:DataPacketService.java


示例11: receiveDataPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
@Override
public PacketResult receiveDataPacket(RawPacket inPkt) {
    if (inPkt.getIncomingNodeConnector() == null) {
        increaseStat("nullIncomingNodeConnector");
        return PacketResult.IGNORED;
    }

    // send the packet off to be processed by listeners
    this.dispatchPacket(inPkt);

    // Walk the chain of listener going first throw all the
    // parallel ones and for each parallel in serial
    return PacketResult.IGNORED;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:15,代码来源:DataPacketService.java


示例12: transmitDataPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
@Override
public void transmitDataPacket(RawPacket outPkt) {
    if (outPkt.getOutgoingNodeConnector() == null) {
        increaseStat("nullOutgoingNodeConnector");
        return;
    }

    if (!this.txQueue.offer(outPkt)) {
        increaseStat("fullTXQueue");
        return;
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:13,代码来源:DataPacketService.java


示例13: transmitDataPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
@Override
public void transmitDataPacket(RawPacket outPkt) {
    NodeConnector nc = outPkt.getOutgoingNodeConnector();
    if (connectionOutService != null && connectionOutService.isLocal(nc.getNode())) {
        this.iDataPacketMux.transmitDataPacket(outPkt);
    } else {
        logger.debug("{} is dropped in the controller "+outPkt);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:10,代码来源:DataPacketServices.java


示例14: sendDiscoveryPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
private void sendDiscoveryPacket(NodeConnector nodeConnector, RawPacket outPkt) {
    if (nodeConnector == null) {
        logger.debug("Can not send discovery packet out since nodeConnector is null");
        return;
    }

    if (!connectionOutService.isLocal(nodeConnector.getNode())) {
        logger.debug("Discoery packets will not be sent to {} in a non-master controller", nodeConnector.toString());
        return;
    }

    if (outPkt == null) {
        logger.debug("Can not send discovery packet out since outPkt is null");
        return;
    }

    long sid = (Long) nodeConnector.getNode().getID();
    ISwitch sw = controller.getSwitches().get(sid);

    if (sw == null) {
        logger.debug("Can not send discovery packet out since switch {} is null", sid);
        return;
    }

    if (!sw.isOperational()) {
        logger.debug("Can not send discovery packet out since switch {} is not operational", sw);
        return;
    }

    if (this.iDataPacketMux == null) {
        logger.debug("Can not send discovery packet out since DataPacket service is not available");
        return;
    }

    logger.trace("Sending topology discovery pkt thru {}", nodeConnector);
    this.iDataPacketMux.transmitDataPacket(outPkt);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:38,代码来源:DiscoveryService.java


示例15: receiveDataPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
@Override
public PacketResult receiveDataPacket(RawPacket inPkt) {
	NodeConnector inport = inPkt.getIncomingNodeConnector();
	RawPacket outPkt = null;
	IPv4 ipv4 = new IPv4();
	ipv4.setDiffServ((byte) 4);
	outPkt = this.dataPacketService.encodeDataPacket(ipv4);
	outPkt.setOutgoingNodeConnector(inport);
	this.dataPacketService.transmitDataPacket(outPkt);
	// outPkt.setOutgoingNodeConnector(outgoingNodeConnector);
	return null;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:13,代码来源:QoSHandler.java


示例16: pktToJSON

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
/**
 * Converts a packet to JSON representation.
 * 
 * @param pkt the packet to be converted
 * @return JSON representation.
 */
private JSONObject pktToJSON(RawPacket rawPkt) {
    log.trace("Received packet-in event.");
    
    JSONObject json = new JSONObject();
    
    // Add incoming node
    
    // The connector, the packet came from ("port")
    NodeConnector ingressConnector = rawPkt.getIncomingNodeConnector();
    // The node that received the packet ("switch")
    Node node = ingressConnector.getNode();

    JSONObject nodeJson = new JSONObject();
    nodeJson.put(NodeAttributes.Keys.ID.toJSON(), node.getNodeIDString());
    nodeJson.put(NodeAttributes.Keys.TYPE.toJSON(), node.getType());
    json.put(PacketInAttributes.Keys.NODE.toJSON(), nodeJson);
    
    // Add inport
    
    json.put(PacketInAttributes.Keys.INGRESS_PORT.toJSON(), ingressConnector.getNodeConnectorIDString());
    
    // Add raw packet data
    
    // Use DataPacketService to decode the packet.
    Packet pkt = dataPacketService.decodeDataPacket(rawPkt);

    while (pkt != null) {
        if (pkt instanceof Ethernet) {
            Ethernet ethernet = (Ethernet) pkt;
            ethernetToJSON(ethernet, json);
        } else if(pkt instanceof IEEE8021Q) {
            IEEE8021Q ieee802q = (IEEE8021Q) pkt;
            ieee8021qToJSON(ieee802q, json);
        } else if (pkt instanceof IPv4) {
            IPv4 ipv4 = (IPv4) pkt;
            ipv4ToJSON(ipv4, json);
        } else if (pkt instanceof TCP) {
            TCP tcp = (TCP) pkt;
            tcpToJSON(tcp, json);
        } else if (pkt instanceof UDP) {
            UDP udp = (UDP) pkt;
            udpToJSON(udp, json);
        }
        
        pkt = pkt.getPayload();
    }
    
    json.put(PacketInAttributes.Keys.PACKET.toJSON(), DatatypeConverter.printBase64Binary(rawPkt.getPacketData()));
    
    return json;
}
 
开发者ID:duerrfk,项目名称:sdn-mq,代码行数:58,代码来源:PacketHandler.java


示例17: sendBcastARPRequest

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
protected void sendBcastARPRequest(InetAddress targetIP, Subnet subnet) {
    Set<NodeConnector> nodeConnectors;
    if (subnet.isFlatLayer2()) {
        nodeConnectors = new HashSet<NodeConnector>();
        for (Node n : this.switchManager.getNodes()) {
            nodeConnectors.addAll(this.switchManager
                    .getUpNodeConnectors(n));
        }
    } else {
        nodeConnectors = subnet.getNodeConnectors();
    }
    for (NodeConnector p : nodeConnectors) {
        if (topologyManager.isInternal(p)) {
            continue;
        }
        ARP arp = new ARP();
        byte[] senderIP = subnet.getNetworkAddress().getAddress();
        byte[] targetIPB = targetIP.getAddress();
        arp.setHardwareType(ARP.HW_TYPE_ETHERNET)
           .setProtocolType(EtherTypes.IPv4.shortValue())
           .setHardwareAddressLength((byte) 6)
           .setProtocolAddressLength((byte) 4)
           .setOpCode(ARP.REQUEST)
           .setSenderHardwareAddress(getControllerMAC())
           .setSenderProtocolAddress(senderIP)
           .setTargetHardwareAddress(new byte[] { (byte) 0, (byte) 0,
                                                 (byte) 0, (byte) 0,
                                                 (byte) 0, (byte) 0 })
           .setTargetProtocolAddress(targetIPB);

        Ethernet ethernet = new Ethernet();
        ethernet.setSourceMACAddress(getControllerMAC())
                .setDestinationMACAddress(new byte[] { (byte) -1,
                                                      (byte) -1,
                                                      (byte) -1,
                                                      (byte) -1,
                                                      (byte) -1,
                                                      (byte) -1 })
                .setEtherType(EtherTypes.ARP.shortValue()).setPayload(arp);

        // TODO For now send port-by-port, see how to optimize to
        // send to multiple ports at once
        RawPacket destPkt = this.dataPacketService.encodeDataPacket(ethernet);
        destPkt.setOutgoingNodeConnector(p);

        this.dataPacketService.transmitDataPacket(destPkt);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:49,代码来源:ArpHandler.java


示例18: transmitDataPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
@Override
public void transmitDataPacket(RawPacket outPkt) {
    // Sanity check area
    if (outPkt == null) {
        logger.debug("outPkt is null!");
        return;
    }

    NodeConnector outPort = outPkt.getOutgoingNodeConnector();
    if (outPort == null) {
        logger.debug("outPort is null! outPkt: {}", outPkt);
        return;
    }

    if (!connectionOutService.isLocal(outPort.getNode())) {
        logger.debug("data packets will not be sent to {} in a non-master controller", outPort.toString());
        return;
    }


    if (!outPort.getType().equals(
            NodeConnector.NodeConnectorIDType.OPENFLOW)) {
        // The output Port is not of type OpenFlow
        logger.debug("outPort is not OF Type! outPort: {}", outPort);
        return;
    }

    Short port = (Short) outPort.getID();
    Long swID = (Long) outPort.getNode().getID();
    ISwitch sw = this.swID2ISwitch.get(swID);

    if (sw == null) {
        // If we cannot get the controller descriptor we cannot even
        // send out the frame
        logger.debug("swID: {} - sw is null!", swID);
        return;
    }

    byte[] data = outPkt.getPacketData();
    // build action
    OFActionOutput action = new OFActionOutput().setPort(port);
    // build packet out
    OFPacketOut po = new OFPacketOut()
            .setBufferId(OFPacketOut.BUFFER_ID_NONE)
            .setInPort(OFPort.OFPP_NONE)
            .setActions(Collections.singletonList((OFAction) action))
            .setActionsLength((short) OFActionOutput.MINIMUM_LENGTH);

    po.setLengthU(OFPacketOut.MINIMUM_LENGTH + po.getActionsLength()
            + data.length);
    po.setPacketData(data);

    // send PACKET_OUT at high priority
    sw.asyncFastSend(po);
    logger.trace("Transmitted a frame of size: {}", data.length);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:57,代码来源:DataPacketMuxDemux.java


示例19: receiveDataPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
@Override
public PacketResult receiveDataPacket(RawPacket inPkt) {
    if (inPkt == null) {
        logger.debug("Ignoring null packet");
        return PacketResult.IGNORED;
    }

    byte[] data = inPkt.getPacketData();
    if (data.length <= 0) {
        logger.trace("Ignoring zero length packet");
        return PacketResult.IGNORED;
    }

    if (!inPkt.getEncap().equals(LinkEncap.ETHERNET)) {
        logger.trace("Ignoring non ethernet packet");
        return PacketResult.IGNORED;
    }

    NodeConnector nodeConnector = inPkt.getIncomingNodeConnector();
    if (((Short) nodeConnector.getID()).equals(NodeConnector.SPECIALNODECONNECTORID)) {
        logger.trace("Ignoring ethernet packet received on special port: "
                + inPkt.getIncomingNodeConnector().toString());
        return PacketResult.IGNORED;
    }

    if (!connectionOutService.isLocal(nodeConnector.getNode())) {
        logger.debug("Discoery packets will not be processed from {} in a non-master controller", nodeConnector.toString());
        return PacketResult.IGNORED;
    }

    Ethernet ethPkt = new Ethernet();
    try {
        ethPkt.deserialize(data, 0, data.length * NetUtils.NumBitsInAByte);
    } catch (Exception e) {
        logger.warn("Failed to decode LLDP packet from {}: {}", inPkt.getIncomingNodeConnector(), e);
        return PacketResult.IGNORED;
    }

    if (ethPkt.getPayload() instanceof LLDP) {
        NodeConnector dst = inPkt.getIncomingNodeConnector();
        if (isEnabled(dst)) {
            if (!processDiscoveryPacket(dst, ethPkt)) {
                // Snoop the discovery pkt if not generated from us
                snoopDiscoveryPacket(dst, ethPkt);
            }
            return PacketResult.CONSUME;
        }
    }
    return PacketResult.IGNORED;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:51,代码来源:DiscoveryService.java


示例20: receiveDataPacket

import org.opendaylight.controller.sal.packet.RawPacket; //导入依赖的package包/类
/**
 * Dispatch received data packet
 *
 * @param inPkt
 *            The incoming raw packet
 * @return Possible results for Data packet processing handler
 */
public PacketResult receiveDataPacket(RawPacket inPkt);
 
开发者ID:lbchen,项目名称:ODL,代码行数:9,代码来源:IDataPacketListen.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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