Class DefaultPacketInFilter
- java.lang.Object
-
- org.onosproject.net.packet.packetfilter.DefaultPacketInFilter
-
- All Implemented Interfaces:
PacketInFilter
public class DefaultPacketInFilter extends Object implements PacketInFilter
Default implementation of a packet-in filter.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.onosproject.net.packet.PacketInFilter
PacketInFilter.FilterAction
-
-
Constructor Summary
Constructors Constructor Description DefaultPacketInFilter(int pps, int winSize, int guardTime, int winThres, String counterName, PacketInClassifier classifier)
Only one filter object per packet type to be associated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
droppedPackets()
Get the count of the dropped packets for this filter type.boolean
equals(Object o)
int
hashCode()
String
name()
Get the name of the counter.int
pendingPackets()
Get the current value of the count of packets for this particular filter type waiting to get processed.PacketInFilter.FilterAction
preProcess(PacketContext packet)
Returns FilterAction before processing the packet.void
setGuardTime(int guardTime)
Set the Guard time in case WinThres is crossed.void
setPps(int pps)
Set the pps rate for the current filter type to calculate the max counter allowed with window size.void
setWinSize(int winSize)
Set the window size for rate limiting.void
setWinThres(int winThres)
Set the Window Threshold for dropping the packet.void
stop()
Stop the threads running for this filter.
-
-
-
Constructor Detail
-
DefaultPacketInFilter
public DefaultPacketInFilter(int pps, int winSize, int guardTime, int winThres, String counterName, PacketInClassifier classifier)
Only one filter object per packet type to be associated. Multiple filter types will result in undefined behavior.- Parameters:
pps
- Rate at which the packet is accepted in packets per secondwinSize
- Size of window in milli seconds within which the packet rate will be analyzedguardTime
- Time duration in seconds for which the packet processing will be on hold if there is a continuous window where cross of the rate happens and that window count crosses winThreswinThres
- Continuous window threshold after which gaurdTime will be activatedcounterName
- Name of the counterclassifier
- Packet classification
-
-
Method Detail
-
preProcess
public PacketInFilter.FilterAction preProcess(PacketContext packet)
Description copied from interface:PacketInFilter
Returns FilterAction before processing the packet. Decides if the packet is allowed to be processed or not.- Specified by:
preProcess
in interfacePacketInFilter
- Parameters:
packet
- PackerContext holding the packet information- Returns:
- FilterAction
-
name
public String name()
Description copied from interface:PacketInFilter
Get the name of the counter.- Specified by:
name
in interfacePacketInFilter
- Returns:
- name of the counter
-
pendingPackets
public int pendingPackets()
Description copied from interface:PacketInFilter
Get the current value of the count of packets for this particular filter type waiting to get processed.- Specified by:
pendingPackets
in interfacePacketInFilter
- Returns:
- count of packets with current filter type waiting to get processed
-
droppedPackets
public int droppedPackets()
Description copied from interface:PacketInFilter
Get the count of the dropped packets for this filter type.- Specified by:
droppedPackets
in interfacePacketInFilter
- Returns:
- count of dropped packets for this filter type
-
setPps
public void setPps(int pps)
Description copied from interface:PacketInFilter
Set the pps rate for the current filter type to calculate the max counter allowed with window size.- Specified by:
setPps
in interfacePacketInFilter
- Parameters:
pps
- Packet per second rate expected
-
setWinSize
public void setWinSize(int winSize)
Description copied from interface:PacketInFilter
Set the window size for rate limiting.- Specified by:
setWinSize
in interfacePacketInFilter
- Parameters:
winSize
- Window size in milli seconds
-
setGuardTime
public void setGuardTime(int guardTime)
Description copied from interface:PacketInFilter
Set the Guard time in case WinThres is crossed.- Specified by:
setGuardTime
in interfacePacketInFilter
- Parameters:
guardTime
- Guard time in seconds
-
setWinThres
public void setWinThres(int winThres)
Description copied from interface:PacketInFilter
Set the Window Threshold for dropping the packet.- Specified by:
setWinThres
in interfacePacketInFilter
- Parameters:
winThres
- Threshold count of the consecutive windows with packet drops
-
stop
public void stop()
Description copied from interface:PacketInFilter
Stop the threads running for this filter.- Specified by:
stop
in interfacePacketInFilter
-
-