Class: Conpar::Directive::AccessList::EtherType

Inherits:
Base
  • Object
show all
Defined in:
lib/conpar/directive/access_list/ether_type.rb

Overview

Constant Summary collapse

SIGNATURE =

(0.1.4): “ethertype” should be followed by “permit” or “deny”

/^(access-list)\b.*\s(ethertype)\s+(permit|deny)/i

Constants inherited from Base

Base::NAME

Instance Attribute Summary

Attributes inherited from Base

#content, #ilk, #line_number, #line_span, #match_data, #rule, #sub_ilk

Instance Method Summary collapse

Methods inherited from Base

#to_s

Constructor Details

#initialize(content = "", options = {}) ⇒ EtherType


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/conpar/directive/access_list/ether_type.rb', line 10

def initialize(content="", options={})
  super

  @sub_ilk = "ethertype"

  # access-list access_list_name ethertype
  # {deny | permit}
  # {ipx | bpdu | mpls-unicast | mpls-multicast | is-is | any | hex_number}
  parse_regex = %r/^
    (access-list)\s*                 # Directive Signature
    (?<name>#{NAME})\s*              # ACL Name
    (?<type>(ethertype))\s*          # Ethertype ACL Type
    (?<permission>(permit|deny))?\s* # permit or deny
    (?<rule>.+)
  $/x
  @match_data = parse_regex.match(@content)

  self
end