Module: Puppet::Util::NetworkDevice::Cisco_ios::Model::Vlan::Base

Defined in:
lib/puppet/util/network_device/cisco_ios/model/vlan/base.rb

Class Method Summary collapse

Class Method Details

.register(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/puppet/util/network_device/cisco_ios/model/vlan/base.rb', line 6

def self.register(base)
  vlan_scope = /^((\d+)\s+(.*))/
  base.register_scoped :ensure, vlan_scope do
    match do |txt|
      unless txt.nil?
        txt.match(/\S+/) ? :present : :absent
      else
        :absent
      end
    end
    cmd 'sh vlan brief'
    default :absent
    add { |*_| }
    remove { |*_| }
  end
  base.register_scoped :desc, vlan_scope do
    match /^\d+\s+(\S+)/
    cmd 'sh vlan brief'
    add do |transport, value|
      transport.command("name #{value}")
    end
    remove { |*_| }
  end
end