本文整理汇总了Java中org.opendaylight.controller.sal.packet.PacketResult类的典型用法代码示例。如果您正苦于以下问题:Java PacketResult类的具体用法?Java PacketResult怎么用?Java PacketResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PacketResult类属于org.opendaylight.controller.sal.packet包,在下文中一共展示了PacketResult类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: receiveDataPacket
import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的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
示例2: receiveDataPacket
import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的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
示例3: receiveDataPacket
import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的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
示例4: dispatchPacket
import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的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
示例5: receiveDataPacket
import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的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
示例6: receiveDataPacket
import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的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
示例7: receiveDataPacket
import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的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
示例8: receiveDataPacket
import org.opendaylight.controller.sal.packet.PacketResult; //导入依赖的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.PacketResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论