5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/puppet/util/network_device/cisco_ios/model/acl/base.rb', line 5
def self.register(base)
base.register_scoped :ensure, /^(ip\s+access-list\s+(?:standard|extended)\s+(\S+).*?\s*\n(?:\s[^\n]*\n)*)/ do
cmd 'sh run'
match do |txt|
txt.match(/\S+/) ? :present : :absent
end
default :absent
end
base.register_scoped :type, /^(ip\s+access-list\s+(?:standard|extended)\s+(\S+).*?\s*\n(?:\s[^\n]*\n)*)/ do
cmd 'sh run'
match /^ip\s+access-list\s+(standard|extended)/
add { |*_| }
remove { |*_| }
end
base.register_scoped :acl, /^(ip\s+access-list\s+(?:standard|extended)\s+(\S+).*?\s*\n(?:\s[^\n]*\n)*)/ do
cmd 'sh run'
match do |txt|
txt.split(/\n/).drop(1).collect {|l| l.strip }
end
add do |transport, value|
transport.command(value)
end
remove do |transport, old_value|
transport.command("no #{old_value}")
end
end
end
|