Class: Cisco::IpMulticast

Inherits:
NodeUtil show all
Defined in:
lib/cisco_node_utils/ip_multicast.rb

Overview

node_utils class for evpn_multisite

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(instantiate = true) ⇒ IpMulticast


24
25
26
27
# File 'lib/cisco_node_utils/ip_multicast.rb', line 24

def initialize(instantiate=true)
  @get_args = @set_args = {}
  enable_features if instantiate
end

Instance Method Details

#default_overlay_distributed_drObject


62
63
64
# File 'lib/cisco_node_utils/ip_multicast.rb', line 62

def default_overlay_distributed_dr
  config_get_default('ip_multicast', 'overlay_distributed_dr')
end

#default_overlay_spt_onlyObject


77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/cisco_node_utils/ip_multicast.rb', line 77

def default_overlay_spt_only
  val = config_get_default('ip_multicast', 'overlay_spt_only')
  # The default value for this property is different for older
  # Nexus software verions.
  #
  # Versions: 7.0(3)I7(1), 7.0(3)I7(2), 7.0(3)I7(3)
  #   Default State: false
  #
  # Versions: 7.0(3)I7(4) and later
  #   Default State: true
  node.os_version[/7\.0\(3\)I7\([1-3]\)/] ? !val : val
end

#destroyObject


29
30
31
32
33
34
# File 'lib/cisco_node_utils/ip_multicast.rb', line 29

def destroy
  @set_args[:state] = 'no'
  config_set('ip_multicast', 'overlay_distributed_dr', @set_args)
  config_set('ip_multicast', 'overlay_spt_only', @set_args)
  Feature.ngmvpn_disable
end

#enable_featuresObject


36
37
38
39
40
# File 'lib/cisco_node_utils/ip_multicast.rb', line 36

def enable_features
  Feature.nv_overlay_enable
  Feature.nv_overlay_evpn_enable
  Feature.ngmvpn_enable
end

#ip_multicastObject


42
43
44
# File 'lib/cisco_node_utils/ip_multicast.rb', line 42

def ip_multicast
  Feature.ngmvpn_enabled?
end

#overlay_distributed_drObject


46
47
48
# File 'lib/cisco_node_utils/ip_multicast.rb', line 46

def overlay_distributed_dr
  config_get('ip_multicast', 'overlay_distributed_dr')
end

#overlay_distributed_dr=(bool) ⇒ Object


50
51
52
53
54
55
56
57
58
59
60
# File 'lib/cisco_node_utils/ip_multicast.rb', line 50

def overlay_distributed_dr=(bool)
  fail TypeError unless [true, false].include?(bool)
  @set_args[:state] = bool ? '' : 'no'
  if @set_args[:state] == 'no'
    unless overlay_distributed_dr == default_overlay_distributed_dr
      config_set('ip_multicast', 'overlay_distributed_dr', @set_args)
    end
  else
    config_set('ip_multicast', 'overlay_distributed_dr', @set_args)
  end
end

#overlay_spt_onlyObject


66
67
68
69
# File 'lib/cisco_node_utils/ip_multicast.rb', line 66

def overlay_spt_only
  result = config_get('ip_multicast', 'overlay_spt_only')
  result.nil? ? false : result
end

#overlay_spt_only=(bool) ⇒ Object


71
72
73
74
75
# File 'lib/cisco_node_utils/ip_multicast.rb', line 71

def overlay_spt_only=(bool)
  fail TypeError unless [true, false].include?(bool)
  @set_args[:state] = bool ? '' : 'no'
  config_set('ip_multicast', 'overlay_spt_only', @set_args)
end