class PuppetX::Eos::Ospf
The Ospf
class provides a base class instance for working with instances of OSPF
Public Class Methods
Public Instance Methods
Creates a new instance of OSPF routing
@param [String] inst The instance id to create
@return [Boolean] True if the commands succeed otherwise False
# File lib/puppet_x/eos/modules/ospf.rb, line 81 def create(inst) @api.config("router ospf #{inst}") == [{}] end
Defaults an instance of OSPF routing
@param [String] inst The instance id to delete
@return [Boolean] True if the commands succeed otherwise False
# File lib/puppet_x/eos/modules/ospf.rb, line 101 def default(inst) @api.config("default router ospf #{inst}") == [{}] end
Deletes an instance of OSPF routing
@param [String] inst The instance id to delete
@return [Boolean] True if the commands succeed otherwise False
# File lib/puppet_x/eos/modules/ospf.rb, line 91 def delete(inst) @api.config("no router ospf #{inst}") == [{}] end
Returns the base interface hash representing physical and logical interfaces in EOS using eAPI
Example
{ "instances": { "1": { "router_id": <String> } } }
@return [Hash] returns an Hash
# File lib/puppet_x/eos/modules/ospf.rb, line 66 def getall result = @api.enable('show ip ospf') instances = {} result[0]['vrfs']['default']['instList'].map do |inst, attrs| instances[inst] = { router_id: attrs['routerId'] } end { instances: instances } end
Configures the OSPF process router-id
@param [String] inst The instance of ospf to configure @param [Hash] opts The configuration parameters @option opts [string] :value The value to set the router-id to @option opts [Boolean] :default The value should be set to default
@return [Boolean] True if the commands succeed otherwise False
# File lib/puppet_x/eos/modules/ospf.rb, line 114 def set_router_id(inst, opts = {}) value = opts[:value] || false default = opts[:default] || false cmds = ["router ospf #{inst}"] case default when true cmds << 'default router-id' when false cmds << (value ? "router-id #{value}" : 'no router-id') end @api.config(cmds) == [{}, {}] end