Method: Rbeapi::Api::EthernetInterface#set_flowcontrol

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

#set_flowcontrol(name, direction, opts = {}) ⇒ Boolean

set_flowcontrol configures the flowcontrol value either on or off for the for the specified interface in the specified direction (either send or receive). If the value is not provided then the configuration is negated using the no keyword. If the default keyword is set to true, then the state value is defaulted using the default keyword. The default keyword takes precedence over the value keyword



575
576
577
578
579
580
581
582
583
584
585
586
587
588
# File 'lib/rbeapi/api/interfaces.rb', line 575

def set_flowcontrol(name, direction, opts = {})
  value = opts[:value]
  default = opts.fetch(:default, false)

  commands = ["interface #{name}"]
  case default
  when true
    commands << "default flowcontrol #{direction}"
  when false
    commands << (value.nil? ? "no flowcontrol #{direction}" :
                              "flowcontrol #{direction} #{value}")
  end
  configure(commands)
end