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 returns the mlag configuration from the node as a resource hash.
-
#interfaces ⇒ Object
interfaces returns a memoized instance of MlagInterfaces that provide an api for working with mlag interfaces in the nodes current configuration.
-
#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_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
#configure, #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 returns the mlag configuration from the node as a resource hash
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/rbeapi/api/mlag.rb', line 66 def get() config = get_block('mlag configuration') response = {} response.merge!(parse_domain_id(config)) response.merge!(parse_local_interface(config)) response.merge!(parse_peer_address(config)) response.merge!(parse_peer_link(config)) response.merge!(parse_shutdown(config)) response[:interfaces] = interfaces.getall response end |
#interfaces ⇒ Object
interfaces returns a memoized instance of MlagInterfaces that provide an api for working with mlag interfaces in the nodes current configuration.
176 177 178 179 180 |
# File 'lib/rbeapi/api/mlag.rb', line 176 def interfaces return @interfaces if @interfaces @interfaces = MlagInterfaces.new(node) @interfaces end |
#set_domain_id(opts = {}) ⇒ Boolean
set_domain_id configures the mlag domain-id value in the current nodes running configuration. If the value keyword is not provided, 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 value keywork if both options are specified
207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/rbeapi/api/mlag.rb', line 207 def set_domain_id(opts = {}) value = opts[:value] default = opts[:default] || false cmds = ['mlag configuration'] case default when true cmds << 'default domain-id' when false cmds << (value ? "domain-id #{value}" : 'no domain-id') end 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 value keyword is not provided, 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 value keywork if both options are specified
247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/rbeapi/api/mlag.rb', line 247 def set_local_interface(opts = {}) value = opts[:value] default = opts[:default] || false cmds = ['mlag configuration'] case default when true cmds << 'default local-interface' when false cmds << (value ? "local-interface #{value}" : 'no local-interface') end configure(cmds) end |
#set_peer_address(opts = {}) ⇒ Boolean
set_peer_address configures the mlag peer-address value in the current nodes running configuration. If the value keyword is not provided, 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 value keywork if both options are specified
327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/rbeapi/api/mlag.rb', line 327 def set_peer_address(opts = {}) value = opts[:value] default = opts[:default] || false cmds = ['mlag configuration'] case default when true cmds << 'default peer-address' when false cmds << (value ? "peer-address #{value}" : 'no peer-address') end configure(cmds) end |
#set_peer_link(opts = {}) ⇒ Boolean
set_peer_link configures the mlag peer-link value in the current nodes running configuration. If the value keyword is not provided, 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 value keywork if both options are specified
287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/rbeapi/api/mlag.rb', line 287 def set_peer_link(opts = {}) value = opts[:value] default = opts[:default] || false cmds = ['mlag configuration'] case default when true cmds << 'default peer-link' when false cmds << (value ? "peer-link #{value}" : 'no peer-link') end configure(cmds) end |
#set_shutdown(opts = {}) ⇒ Boolean
set_shutdown configures the administrative state of the mlag process on the current node. If the value is true, then mlag is enabled and if the value is false, then mlag is disabled. If no value is provided, the shutdown command is configured using the no keyword argument. If the default keyword is provided, the configuration is defaulted using the default keyword. The default keyword takes precedence over the value keywork if both options are specified
367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/rbeapi/api/mlag.rb', line 367 def set_shutdown(opts = {}) value = opts[:value] default = opts[:default] || false cmds = ['mlag configuration'] case default when true cmds << 'default shutdown' when false cmds << (value ? 'shutdown' : 'no shutdown') end configure(cmds) end |