Class: Havox::RuleExpander

Inherits:
Object
  • Object
show all
Defined in:
lib/havox/classes/rule_expander.rb

Constant Summary collapse

SET_VLAN_REGEX =
/SetField\(vlan,\s?(<none>|\d+)\)/
SET_VLAN_ID_REGEX =
/SetField\(vlan,\s?(?<vlan_id>\d+)\)/
VLAN_MATCH_REGEX =
/vlanId\s?=\s?(?<vlan_id>\d+)/
PREDICATE_REGEX =
/\(switch\s?=\s?\d+\s?and(?<pred>.+)\)/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_rules) ⇒ RuleExpander

Returns a new instance of RuleExpander.



10
11
12
13
14
15
16
# File 'lib/havox/classes/rule_expander.rb', line 10

def initialize(raw_rules)
  @raw_rules = raw_rules
  @vlan_predicates = {}
  @expanded_rules = []
  scan_vlan_predicates
  expand
end

Instance Attribute Details

#expanded_rulesObject (readonly)

Returns the value of attribute expanded_rules.



3
4
5
# File 'lib/havox/classes/rule_expander.rb', line 3

def expanded_rules
  @expanded_rules
end