Method: Rbeapi::Api::BaseInterface#set_encapsulation

Defined in:
lib/rbeapi/api/interfaces.rb

#set_encapsulation(name, opts = {}) ⇒ Boolean

set_encapsulation configures the VLAN ID value for the specified interface name in the nodes running configuration. If the enable keyword is false then the encapsulation value is negated using the no keyword. If the default keyword is set to true, then the encapsulation value is defaulted using the default keyword. The default keyword takes precedence over the enable keyword if both are provided.

Options Hash (opts):

  • value (String)

    The value to configure the VLAN ID to be used in the encapsulation dot1q vlan setting for a subinterface.

  • enable (Boolean)

    If false then the command is negated. Default is true.

  • default (Boolean)

    Configure the interface encapsulation using the default keyword.

Since:

  • eos_version X.XX.XM



373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/rbeapi/api/interfaces.rb', line 373

def set_encapsulation(name, opts = {})
  unless name =~ /\./
    raise ArgumentError, 'Parameter encapsulation can be set only on '\
      'subinterfaces'
  end
  unless name.downcase =~ /et|po/
    raise ArgumentError, 'Parameter encapsulation can be set only on '\
      'Ethernet and PostChannel interfaces'
  end
  commands = command_builder('encapsulation dot1q vlan', opts)
  configure_interface(name, commands)
end