本文整理汇总了Java中org.openflow.protocol.OFType.PACKET_IN属性的典型用法代码示例。如果您正苦于以下问题:Java OFType.PACKET_IN属性的具体用法?Java OFType.PACKET_IN怎么用?Java OFType.PACKET_IN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.openflow.protocol.OFType
的用法示例。
在下文中一共展示了OFType.PACKET_IN属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isCallbackOrderingPrereq
@Override
public boolean isCallbackOrderingPrereq(OFType type, String name) {
return ((type == OFType.PACKET_IN || type == OFType.FLOW_MOD)
&& name.equals("topology"));
}
示例2: inputThrottled
/**
* Determine if this message should be dropped.
*
* We compute the current rate by taking a timestamp every 100 messages.
* Could change to a more complex scheme if more accuracy is needed.
*
* Enable throttling if the rate goes above packetInRateThresholdHigh
* Disable throttling when the rate drops below packetInRateThresholdLow
*
* While throttling is enabled, we do the following:
* - Remove duplicate packetIn's mapped to the same OFMatch
* - After filtering, if packetIn rate per host (mac) is above
* packetInRatePerMacThreshold, push a flow mod to block mac on port
* - After filtering, if packetIn rate per port is above
* packetInRatePerPortThreshold, push a flow mod to block port
* - Allow blocking flow mods have a hard timeout and expires automatically
*
* TODO: keep a history of all events related in input throttling
*
* @param ofm
* @return
*/
@Override
public boolean inputThrottled(OFMessage ofm) {
if (ofm.getType() != OFType.PACKET_IN) {
return false;
}
ctrSwitchPktin.updateCounterNoFlush();
// Compute current packet in rate
messageCount++;
if (messageCount % 1000 == 0) {
long now = System.currentTimeMillis();
if (now != lastMessageTime) {
currentRate = (int) (1000000 / (now - lastMessageTime));
lastMessageTime = now;
} else {
currentRate = Integer.MAX_VALUE;
}
}
if (!packetInThrottleEnabled) {
if (currentRate <= packetInRateThresholdHigh) {
return false; // most common case
}
enablePacketInThrottle();
} else if (currentRate < packetInRateThresholdLow) {
disablePacketInThrottle();
return false;
}
// Now we are in the slow path where we need to do filtering
// First filter based on OFMatch
OFPacketIn pin = (OFPacketIn)ofm;
OFMatch match = new OFMatch();
match.loadFromPacket(pin.getPacketData(), pin.getInPort());
if (ofMatchCache.update(match)) {
ctrSwitchPktinDrops.updateCounterNoFlush();
return true;
}
// We have packet in with a distinct flow, check per mac rate
messageCountUniqueOFMatch++;
if ((messageCountUniqueOFMatch % packetInRatePerMacThreshold) == 1) {
checkPerSourceMacRate(pin);
}
// Check per port rate
if ((messageCountUniqueOFMatch % packetInRatePerPortThreshold) == 1) {
checkPerPortRate(pin);
}
return false;
}
示例3: isCallbackOrderingPrereq
@Override
public boolean isCallbackOrderingPrereq(OFType type, String name) {
return (type == OFType.PACKET_IN && name.equals("devicemanager"));
}
示例4: isCallbackOrderingPostreq
@Override
public boolean isCallbackOrderingPostreq(OFType type, String name) {
return (type == OFType.PACKET_IN && name.equals("learningswitch"));
}