diff --git a/src/main/java/net/floodlightcontroller/core/IOFSwitch.java b/src/main/java/net/floodlightcontroller/core/IOFSwitch.java index 55195c66ede181e378eed869bc1dcb37a92dff96..388349f2bf46a24a402ddb277abbebe140e2f77e 100644 --- a/src/main/java/net/floodlightcontroller/core/IOFSwitch.java +++ b/src/main/java/net/floodlightcontroller/core/IOFSwitch.java @@ -114,6 +114,14 @@ public interface IOFSwitch { */ public boolean inputThrottled(OFMessage ofm); + /** + * Return if the switch is currently overloaded. The definition of + * overload refers to excessive traffic in the control path, namely + * a high packet in rate. + * @return + */ + boolean isOverloaded(); + /** * Write OFMessage to the output stream, subject to switch rate limiting. * The message will be handed to the floodlightProvider for possible filtering diff --git a/src/main/java/net/floodlightcontroller/core/OFSwitchBase.java b/src/main/java/net/floodlightcontroller/core/OFSwitchBase.java index 3da2f4e9d2cfd7d0f2e27ad013ed5cafeebdfe3b..351e3717b7bdb4ab12a26d3964a1cf0f4f4f369e 100644 --- a/src/main/java/net/floodlightcontroller/core/OFSwitchBase.java +++ b/src/main/java/net/floodlightcontroller/core/OFSwitchBase.java @@ -787,6 +787,15 @@ public abstract class OFSwitchBase implements IOFSwitch { packetInRatePerPortThreshold = pktInPerPort; } + /** + * Return if switch has exceeded the high threshold of packet in rate. + * @return + */ + @Override + public boolean isOverloaded() { + return packetInThrottleEnabled; + } + /** * Determine if this message should be dropped. * diff --git a/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java b/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java index 650ead70dd09fd875317f073139849c11762b039..1d1ff169b99bf5ac4de2ce881ee5b4184e32bf7a 100644 --- a/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java +++ b/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java @@ -439,4 +439,10 @@ public class OFMessageDamperMockSwitch implements IOFSwitch { return false; } + @Override + public boolean isOverloaded() { + // TODO Auto-generated method stub + return false; + } + }