A hardware flow with an idle timeout of 10 seconds gets deleted even though packets match the flow within the idle timeout

Problem statement

A hardware rule is programmed with idle timeout as 10 seconds and hard timeout as 0. Packets are pumped at 1000 pps to the switch matching the flow. However, after 10 seconds, the rule gets removed from the switch.

Reason for this behavior

By default the hardware statistics refresh rate (set using openflow hardware-statistics refresh-rate policy-engine-table <seconds> and information available through show openflow) is 20 seconds. This rate means that the packet count statistics get updated only every 20 seconds. So, when the idle timeout is set to less than 20 seconds, when a check is done for flow statistics after 10 seconds, it is not updated. Hence, the flow is deleted.

Customer Note

The user has the option of reducing or incriminating the refresh rate. However, the user must be aware of its implications. An increase in refresh rate leads to deletion of flows, which have an idle timeout less than the configured refresh rate. A decrease in refresh rate leads to over‐use of the CPU (because of polling hardware statistics more frequently.)