Method: Rbeapi::Api::Prefixlists#getall

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

#getallHash<String, Array>

Returns all prefix lists configured on the node.

Examples:

{
  <name1>: [
    {
      seq: <string>,
      action: <string>,
      prefix: <string>
    },
    ...
    {
      seq: <string>,
      action: <string>,
      prefix: <string>
    }
  ],
  ...,
  <nameN>: [
    {
      seq: <string>,
      action: <string>,
      prefix: <string>
    },
    ...
    {
      seq: <string>,
      action: <string>,
      prefix: <string>
    }
  ]
}

Returns:

  • (Hash<String, Array>)

    The method will return all the prefix lists configured on the node as a Ruby hash object. If there are no prefix lists configured, an empty hash will be returned.



128
129
130
131
132
133
134
# File 'lib/rbeapi/api/prefixlists.rb', line 128

def getall
  lists = config.scan(/(?<=^ip\sprefix-list\s)[^\s]+(?=\sseq.+)?/)
  lists.uniq.each_with_object({}) do |name, hsh|
    values = get name
    hsh[name] = values if values
  end
end