Class: Cisco::EvpnMulticast

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

Overview

node_utils class for evpn_multisite

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

#initializeEvpnMulticast

Returns a new instance of EvpnMulticast


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

def initialize
  @get_args = @set_args = {}
  create
end

Class Method Details

.multicastObject


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

def self.multicast
  config_get('evpn_multicast', 'multicast')
end

Instance Method Details

#createObject


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

def create
  return unless multicast == default_multicast
  Feature.ngmvpn_enable
  config_set('feature', 'nv_overlay', state: '')
  @set_args[:state] = ''
  config_set('evpn_multicast', 'multicast', @set_args)
end

#default_multicastObject


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

def default_multicast
  config_get_default('evpn_multicast', 'multicast')
end

#destroyObject


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

def destroy
  @set_args[:state] = 'no'
  config_set('evpn_multicast', 'multicast', @set_args)
end

#multicastObject


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

def multicast
  config_get('evpn_multicast', 'multicast')
end

#multicast=(bool) ⇒ Object


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

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