Method: Rbeapi::Api::StpInterfaces#set_bpduguard

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

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

Configures the interface bpdu guard value

Parameters:

  • name (String)

    The name of the interface to configure.

  • opts (Hash) (defaults to: {})

    The configuration parameters for bpduguard.

Options Hash (opts):

  • value (Boolean)

    The value to set bpduguard.

  • enable (Boolean)

    If false then the bpduguard is disabled. If true then the bpduguard is enabled. Default is true.

  • default (Boolean)

    The value should be set to default.

Returns:

  • (Boolean)

    True if the commands succeed otherwise False.



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/rbeapi/api/stp.rb', line 458

def set_bpduguard(name, opts = {})
  enable = opts.fetch(:enable, true)
  default = opts[:default] || false

  case default
  when true
    cmds = 'default spanning-tree bpduguard'
  when false
    cmds = if enable
             'spanning-tree bpduguard enable'
           else
             'spanning-tree bpduguard disable'
           end
  end
  configure_interface(name, cmds)
end