NftablesRuleScaleRecipe

class lnst.Recipes.ENRT.NftablesRuleScaleRecipe.NftablesRuleScaleRecipe(*args, **kwargs)

Bases: SimpleNetnsRouterRecipe, NftablesMixin

This recipe combines SimpleNetnsRouterRecipe and NftablesMixin for testing routing throughput impact of specific nftables rules. To generate meaningful results, the list of rules is simply repeated multiple times, thereby amplifying the impact. Rules are added to host2’s forwarding hook by default (defined by chainspec parameter) which routes test traffic between host1 and a local netns.

Parameters:
  • family (StrParam (default “inet”)) – The family to use for the tested ruleset.

  • tablename (StrParam (default “t”)) – The name to use for the tested ruleset’s table.

  • chainname (StrParam (default “c”)) – The name to use for the tested ruleset’s chain.

  • chainspec (StrParam (default “type filter hook forward priority filter”)) – The hook spec of the chain to add rules to.

  • extras (ListParam (default empty)) – Extra nftables commands to run after table and chain creation and before generating the list of rules to test. Use {family}, {tablename} and {chainname} to refer to ruleset elements.

  • rule (ListParam representing the nftables rules.) – The actual list of rules to insert repeatedly into the router’s chain.

  • scale (IntParam > 0) – The number of times to insert rule into the ruleset.

  • flowtable (BoolParam (default False)) – Whether to offload established connections to a flowtable or not. Besides creating a flowtable hooking into router’s input and output interfaces, this will append a final rule matching on conntrack state ‘established’ and adding the flow.