Method: Rbeapi::Api::EthernetInterface#set_speed
- Defined in:
- lib/rbeapi/api/interfaces.rb
#set_speed(name, opts = {}) ⇒ Boolean
set_speed configures the interface speed and negotiation values on the specified interface. If the value option is not provide, the speed setting is configured using the no keyword. If the default options is set to true, then the speed setting is configured using the default keyword. If both options are specified, the default keyword takes precedence.
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 |
# File 'lib/rbeapi/api/interfaces.rb', line 483 def set_speed(name, opts = {}) value = opts[:value] forced = opts.fetch(:forced, false) default = opts.fetch(:default, false) forced = 'forced' if forced forced = '' if value == 'auto' cmds = ["interface #{name}"] case default when true cmds << 'default speed' when false cmds << value ? "speed #{forced} #{value}" : 'no speed' end configure cmds end |