class PuppetX::Eos::Vxlan

The Vxlan provides an instance for managing vxlan virtual tunnel interfaces in EOS

Public Class Methods

new(api) click to toggle source
# File lib/puppet_x/eos/modules/vxlan.rb, line 44
def initialize(api)
  @api = api
end

Public Instance Methods

create() click to toggle source

Creates a new logical vxlan virtual interface in the running-config

@return [Boolean] returns true if the command completed successfully

# File lib/puppet_x/eos/modules/vxlan.rb, line 65
def create
  @api.config('interface vxlan 1') == [{}]
end
default() click to toggle source

Defaults an existing vxlan logical interface from the running-config)

@return [Boolean] returns true if the command completed successfully

# File lib/puppet_x/eos/modules/vxlan.rb, line 81
def default
  @api.config('default interface vxlan 1') == [{}]
end
delete() click to toggle source

Deletes an existing vxlan logical interface from the running-config

@return [Boolean] always returns true

# File lib/puppet_x/eos/modules/vxlan.rb, line 73
def delete
  @api.config('no interface vxlan 1') == [{}]
end
get() click to toggle source

Returns the vlan data for the provided id with the show vlan <id> command. If the id doesn’t exist then nil is returned

@return [nil, Hash<String, String|Hash|Array>] Hash describing the

vlan configuration specified by id.  If the id is not
found then nil is returned
# File lib/puppet_x/eos/modules/vxlan.rb, line 57
def get
  @api.enable('show interfaces vxlan 1')
end
set_multicast_group(opts = {}) click to toggle source

Configures the multicast-group parameter for the Vxlan interface

@param [Hash] opts The configuration parameters for the VLAN @option opts [string] :value The value to set the name to @option opts [Boolean] :default The value should be set to default

@return [Boolean] returns true if the command completed successfully

# File lib/puppet_x/eos/modules/vxlan.rb, line 116
def set_multicast_group(opts = {})
  value = opts[:value]
  default = opts[:default] || false

  cmds = ['interface vxlan 1']
  case default
  when true
    cmds << 'default vxlan multicast-group'
  when false
    cmds << (value.nil? ?  'no vxlan multicast-group' : \
                           "vxlan multicast-group #{value}")
  end
  @api.config(cmds) == [{}, {}]
end
set_source_interface(opts = {}) click to toggle source

Configures the source-interface parameter for the Vxlan interface

@param [Hash] opts The configuration parameters for the VLAN @option opts [string] :value The value to set the name to @option opts [Boolean] :default The value should be set to default

@return [Boolean] returns true if the command completed successfully

# File lib/puppet_x/eos/modules/vxlan.rb, line 93
def set_source_interface(opts = {})
  value = opts[:value]
  default = opts[:default] || false

  cmds = ['interface vxlan 1']
  case default
  when true
    cmds << 'default vxlan source-interface'
  when false
    cmds << (value.nil? ?  'no vxlan source-interface' : \
                           "vxlan source-interface #{value}")
  end
  @api.config(cmds) == [{}, {}]
end