Class: Rbeapi::Api::Varp
Overview
The Varp class provides an instance for working with the global VARP configuration of the node
Instance Attribute Summary
Attributes inherited from Entity
Instance Method Summary collapse
-
#get ⇒ Hash
Returns the global VARP configuration from the node.
- #interfaces ⇒ Object
-
#set_mac_address(opts = {}) ⇒ Boolean
Configure the VARP virtual-router mac-address value.
Methods inherited from Entity
#command_builder, #configure, #configure_interface, #get_block, #initialize, instance
Constructor Details
This class inherits a constructor from Rbeapi::Api::Entity
Instance Method Details
#get ⇒ Hash
Returns the global VARP configuration from the node
Example
{
"mac_address": <string>,
"interfaces": {...}
}
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/rbeapi/api/varp.rb', line 55 def get response = {} regex = /(?<=^ip\svirtual-router\smac-address\s) ((?:[a-f0-9]{2}:){5}[a-f0-9]{2})$/x mdata = regex.match(config) response['mac_address'] = mdata.nil? ? '' : mdata[1] response['interfaces'] = interfaces.getall response end |
#interfaces ⇒ Object
67 68 69 70 71 |
# File 'lib/rbeapi/api/varp.rb', line 67 def interfaces return @interfaces if @interfaces @interfaces = VarpInterfaces.new(node) @interfaces end |
#set_mac_address(opts = {}) ⇒ Boolean
Configure the VARP virtual-router mac-address value
83 84 85 86 |
# File 'lib/rbeapi/api/varp.rb', line 83 def set_mac_address(opts = {}) cmd = command_builder('ip virtual-router mac-address', opts) configure(cmd) end |