Method: Rbeapi::Api::Routemaps#set_match_statements

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

#set_match_statements(name, action, seqno, value) ⇒ Boolean

set_match_statements will set the match values for a specified routemap. If the specified routemap does not exist, it will be created.

Commands

route-map <name> action <value> seqno <value> match <value>

Parameters:

  • name (String)

    The name of the routemap to create.

  • action (String)

    Either permit or deny.

  • seqno (Integer)

    The sequence number.

  • value (Array)

    The routemap match rules.

Returns:

  • (Boolean)

    Returns true if the command completed successfully.

Raises:

  • (ArgumentError)


448
449
450
451
452
453
454
455
456
457
# File 'lib/rbeapi/api/routemaps.rb', line 448

def set_match_statements(name, action, seqno, value)
  raise ArgumentError, 'value must be an Array' unless value.is_a?(Array)

  cmds = ["route-map #{name} #{action} #{seqno}"]
  remove_match_statements(name, action, seqno, cmds)
  Array(value).each do |options|
    cmds << "match #{options}"
  end
  configure(cmds)
end