Method: Rbeapi::Api::Ospf#set_passive_interfaces

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

#set_passive_interfaces(pid, opts = {}) ⇒ Boolean

set_passive_interfaces sets router ospf passive interface with pid and options.

default.

Parameters:

  • pid (String)

    The router ospf name.

  • 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 passive interface to

Returns:

  • (Boolean)

    Returns true if the command completed successfully.



299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/rbeapi/api/ospf.rb', line 299

def set_passive_interfaces(pid, opts = {})
  values = opts[:value]
  current = get(pid)[:passive_interfaces]
  cmds = ["router ospf #{pid}"]
  current.each do |name|
    unless Array(values).include?(name)
      cmds << "no passive-interface #{name}"
    end
  end
  Array(values).each do |name|
    cmds << "passive-interface #{name}"
  end
  configure cmds
end