Class: Cisco::InterfaceEvpnMultisite

Inherits:
NodeUtil
  • Object
show all
Defined in:
lib/cisco_node_utils/interface_evpn_multisite.rb

Overview

node_utils class for interface_evpn_multisite

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NodeUtil

client, #client, config_get, #config_get, #config_get_default, config_get_default, config_set, #config_set, #get, #ios_xr?, #nexus?, #node, node, platform, #platform, supports?, #supports?

Constructor Details

#initialize(interface, show_name = nil) ⇒ InterfaceEvpnMultisite

Returns a new instance of InterfaceEvpnMultisite.



24
25
26
27
28
29
# File 'lib/cisco_node_utils/interface_evpn_multisite.rb', line 24

def initialize(interface, show_name=nil)
  fail TypeError unless interface.is_a?(String)
  @interface = interface.downcase
  @show_name = show_name.nil? ? '' : Utils.normalize_intf_pattern(show_name)
  @get_args = @set_args = { interface: @interface, show_name: @show_name }
end

Instance Attribute Details

#interfaceObject (readonly)

Returns the value of attribute interface.



22
23
24
# File 'lib/cisco_node_utils/interface_evpn_multisite.rb', line 22

def interface
  @interface
end

#show_nameObject (readonly)

Returns the value of attribute show_name.



22
23
24
# File 'lib/cisco_node_utils/interface_evpn_multisite.rb', line 22

def show_name
  @show_name
end

#trackingObject

Returns the value of attribute tracking.



22
23
24
# File 'lib/cisco_node_utils/interface_evpn_multisite.rb', line 22

def tracking
  @tracking
end

Class Method Details

.interfaces(show_name = nil) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/cisco_node_utils/interface_evpn_multisite.rb', line 31

def self.interfaces(show_name=nil)
  hash = {}
  show_name = Utils.normalize_intf_pattern(show_name)
  begin
    intf_list = config_get('interface_evpn_multisite', 'all_interfaces',
                           show_name: show_name)
  rescue CliError => e
    raise unless show_name
    # ignore logical interfaces that do not exist
    debug 'InterfaceEvpnMultisite.interfaces ignoring CliError => ' + e.to_s
  end
  return hash if intf_list.nil?

  intf_list.each do |id|
    id = id.downcase
    intf = InterfaceEvpnMultisite.new(id, show_name)
    hash[id] = intf if intf.tracking
  end
  hash
end

Instance Method Details

#disable(tracking = 'dci-tracking') ⇒ Object



58
59
60
61
62
# File 'lib/cisco_node_utils/interface_evpn_multisite.rb', line 58

def disable(tracking='dci-tracking')
  @set_args[:tracking] = tracking
  @set_args[:state] = 'no'
  config_set('interface_evpn_multisite', 'evpn_multisite', @set_args)
end

#enable(tracking) ⇒ Object



52
53
54
55
56
# File 'lib/cisco_node_utils/interface_evpn_multisite.rb', line 52

def enable(tracking)
  @set_args[:tracking] = tracking
  @set_args[:state] = ''
  config_set('interface_evpn_multisite', 'evpn_multisite', @set_args)
end