Method: Rbeapi::Api::StpInterfaces#set_portfast_type

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

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

Configures the interface portfast type value

Parameters:

  • name (String)

    The name of the interface to configure.

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

    The configuration parameters for portfast type.

Options Hash (opts):

  • value (String)

    The value to set portfast type to. The value must be set for calls to this method.

  • enable (Boolean)

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

  • default (Boolean)

    The value should be set to default.

Returns:

  • (Boolean)

    True if the commands succeed otherwise False.

Raises:

  • (ArgumentError)


424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# File 'lib/rbeapi/api/stp.rb', line 424

def set_portfast_type(name, opts = {})
  value = opts[:value]
  raise ArgumentError, 'value must be set' unless value
  enable = opts.fetch(:enable, true)
  default = opts[:default] || false

  case default
  when true
    cmds = "default spanning-tree portfast #{value}"
  when false
    cmds = if enable
             "spanning-tree portfast #{value}"
           else
             "no spanning-tree portfast #{value}"
           end
  end
  configure_interface(name, cmds)
end