Method: Rbeapi::Api::Bgp#set_maximum_paths

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

#set_maximum_paths(maximum_paths, maximum_ecmp_paths, opts = {}) ⇒ Boolean

set_maximum_paths sets the maximum number of equal cost paths and the maximum number of installed ECMP routes.

Commands

router bgp <bgp_as>
  {no | default}
    maximum-paths <maximum_paths> [ecmp <maximum_ecmp_paths>]

Parameters:

  • maximum_paths (Integer)

    Maximum number of equal cost paths.

  • maximum_ecmp_paths (Integer)

    Maximum number of installed ECMP routes.

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

    Optional keyword arguments

Options Hash (opts):

  • enable (Boolean)

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

  • default (Boolean)

    Configure the maximum paths using the default keyword.

Returns:

  • (Boolean)

    Returns true if the command complete successfully.



374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/rbeapi/api/bgp.rb', line 374

def set_maximum_paths(maximum_paths, maximum_ecmp_paths, opts = {})
  enable = opts.fetch(:enable, true)
  default = opts[:default] || false

  case default
  when true
    cmd = 'default maximum-paths'
  when false
    if enable
      cmd = "maximum-paths #{maximum_paths} ecmp #{maximum_ecmp_paths}"
    else
      cmd = 'no maximum-paths'
    end
  end
  configure_bgp(cmd)
end