Class: Rbeapi::Api::Mlag
Overview
The Mlag class provides a configuration instance for working with the global MLAG configuration of the node
Constant Summary collapse
- DEFAULT_DOMAIN_ID =
''- DEFAULT_LOCAL_INTF =
''- DEFAULT_PEER_ADDR =
''- DEFAULT_PEER_LINK =
''
Instance Attribute Summary
Attributes inherited from Entity
Instance Method Summary collapse
-
#get ⇒ nil, Hash<Symbol, Object] returns the nodes current running configuration as a Hash. If mlag is not configured on the node this method will return nil
get scans the current nodes configuration and returns the values as a Hash describing the current state.
-
#set_domain_id(opts = {}) ⇒ Boolean
set_domain_id configures the mlag domain-id value in the current nodes running configuration.
-
#set_local_interface(opts = {}) ⇒ Boolean
set_local_interface configures the mlag local-interface value in the current nodes running configuration.
-
#set_mlag_id(name, opts = {}) ⇒ Boolean
set_mlag_id configures the mlag id on the interface in the nodes current running configuration.
-
#set_peer_address(opts = {}) ⇒ Boolean
set_peer_address configures the mlag peer-address value in the current nodes running configuration.
-
#set_peer_link(opts = {}) ⇒ Boolean
set_peer_link configures the mlag peer-link value in the current nodes running configuration.
-
#set_shutdown(opts = {}) ⇒ Boolean
set_shutdown configures the administrative state of the mlag process on the current node.
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 ⇒ nil, Hash<Symbol, Object] returns the nodes current running configuration as a Hash. If mlag is not configured on the node this method will return nil
get scans the current nodes configuration and returns the values as a Hash describing the current state.
The resource hash returned contains the following:
* domain_id: (String) The MLAG domain-id value
* local_interface: (String) The MLAG local-interface value
* peer_address: (String) The IP address of the MLAG peer
* peer_link: (String) The MLAG transit peer-link value
* shutdown: (Boolean) The administrative staet of the mlag
configuration
* interfaces: (Hash) The list of configured MLAG interfaces. (See
parse_interfaces for the Hash details)
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/rbeapi/api/mlag.rb', line 68 def get config = get_block('mlag configuration') global = {} global.merge!(parse_domain_id(config)) global.merge!(parse_local_interface(config)) global.merge!(parse_peer_address(config)) global.merge!(parse_peer_link(config)) global.merge!(parse_shutdown(config)) { global: global, interfaces: parse_interfaces } end |
#set_domain_id(opts = {}) ⇒ Boolean
set_domain_id configures the mlag domain-id value in the current nodes running configuration. If the enable keyword is false, the the domain-id is configured with the no keyword. If the default keyword is provided, the configuration is defaulted using the default keyword. The default keyword takes precedence over the enable keyword if both options are specified
222 223 224 225 226 |
# File 'lib/rbeapi/api/mlag.rb', line 222 def set_domain_id(opts = {}) cmd = command_builder('domain-id', opts) cmds = ['mlag configuration', cmd] configure(cmds) end |
#set_local_interface(opts = {}) ⇒ Boolean
set_local_interface configures the mlag local-interface value in the current nodes running configuration. If the enable keyword is false, the local-interface is configured with the no keyword. If the default keyword is provided, the configuration is defaulted using the default keyword. The default keyword takes precedence over the enable keyword if both options are specified
257 258 259 260 261 |
# File 'lib/rbeapi/api/mlag.rb', line 257 def set_local_interface(opts = {}) cmd = command_builder('local-interface', opts) cmds = ['mlag configuration', cmd] configure(cmds) end |
#set_mlag_id(name, opts = {}) ⇒ Boolean
set_mlag_id configures the mlag id on the interface in the nodes current running configuration. If the enable keyword is false, then the interface mlag id is configured using the no keyword. If the default keyword is provided and set to true, the interface mlag id is configured using the default keyword. The default keyword takes precedence over the enable keyword if both options are specified
401 402 403 404 |
# File 'lib/rbeapi/api/mlag.rb', line 401 def set_mlag_id(name, opts = {}) cmd = command_builder('mlag', opts) configure_interface(name, cmd) end |
#set_peer_address(opts = {}) ⇒ Boolean
set_peer_address configures the mlag peer-address value in the current nodes running configuration. If the enable keyword is false, then the peer-address is configured with the no keyword. If the default keyword is provided, the configuration is defaulted using the default keyword. The default keyword takes precedence over the enable keyword if both options are specified
327 328 329 330 331 |
# File 'lib/rbeapi/api/mlag.rb', line 327 def set_peer_address(opts = {}) cmd = command_builder('peer-address', opts) cmds = ['mlag configuration', cmd] configure(cmds) end |
#set_peer_link(opts = {}) ⇒ Boolean
set_peer_link configures the mlag peer-link value in the current nodes running configuration. If enable keyword is false, then the peer-link is configured with the no keyword. If the default keyword is provided, the configuration is defaulted using the default keyword. The default keyword takes precedence over the enable keyword if both options are specified
292 293 294 295 296 |
# File 'lib/rbeapi/api/mlag.rb', line 292 def set_peer_link(opts = {}) cmd = command_builder('peer-link', opts) cmds = ['mlag configuration', cmd] configure(cmds) end |
#set_shutdown(opts = {}) ⇒ Boolean
set_shutdown configures the administrative state of the mlag process on the current node. If the enable keyword is true, then mlag is enabled and if the enable keyword is false, then mlag is disabled. If the default keyword is provided, the configuration is defaulted using the default keyword. The default keyword takes precedence over the enable keyword if both options are specified
359 360 361 362 363 364 365 366 367 |
# File 'lib/rbeapi/api/mlag.rb', line 359 def set_shutdown(opts = {}) fail 'set_shutdown has the value option set' if opts[:value] # Shutdown semantics are opposite of enable semantics so invert enable value = !opts[:enable] opts.merge!(enable: value) cmd = command_builder('shutdown', opts) cmds = ['mlag configuration', cmd] configure(cmds) end |