Class: Cisco::OverlayGlobal

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

Overview

node_utils class for overlay_global

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?

Instance Method Details

#anycast_gateway_macObject

anycast-gateway-mac



128
129
130
131
132
# File 'lib/cisco_node_utils/overlay_global.rb', line 128

def anycast_gateway_mac
  return nil unless Feature.nv_overlay_evpn_enabled?
  mac = config_get('overlay_global', 'anycast_gateway_mac')
  mac.nil? || mac.empty? ? default_anycast_gateway_mac : mac.downcase
end

#anycast_gateway_mac=(mac_addr) ⇒ Object



134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/cisco_node_utils/overlay_global.rb', line 134

def anycast_gateway_mac=(mac_addr)
  fail TypeError unless mac_addr.is_a?(String)

  Feature.nv_overlay_evpn_enable
  Feature.fabric_forwarding_enable
  if mac_addr == default_anycast_gateway_mac
    state = 'no'
    mac_addr = ''
  else
    state = ''
  end
  config_set('overlay_global', 'anycast_gateway_mac',
             state: state, mac_addr: mac_addr)
end

#default_anycast_gateway_macObject



149
150
151
# File 'lib/cisco_node_utils/overlay_global.rb', line 149

def default_anycast_gateway_mac
  config_get_default('overlay_global', 'anycast_gateway_mac')
end

#default_dup_host_ip_addr_detectionObject



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

def default_dup_host_ip_addr_detection
  [default_dup_host_ip_addr_detection_host_moves,
   default_dup_host_ip_addr_detection_timeout]
end

#default_dup_host_ip_addr_detection_host_movesObject



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

def default_dup_host_ip_addr_detection_host_moves
  config_get_default('overlay_global',
                     'dup_host_ip_addr_detection_host_moves')
end

#default_dup_host_ip_addr_detection_timeoutObject



76
77
78
# File 'lib/cisco_node_utils/overlay_global.rb', line 76

def default_dup_host_ip_addr_detection_timeout
  config_get_default('overlay_global', 'dup_host_ip_addr_detection_timeout')
end

#default_dup_host_mac_detectionObject



114
115
116
117
# File 'lib/cisco_node_utils/overlay_global.rb', line 114

def default_dup_host_mac_detection
  [default_dup_host_mac_detection_host_moves,
   default_dup_host_mac_detection_timeout]
end

#default_dup_host_mac_detection_host_movesObject



119
120
121
# File 'lib/cisco_node_utils/overlay_global.rb', line 119

def default_dup_host_mac_detection_host_moves
  config_get_default('overlay_global', 'dup_host_mac_detection_host_moves')
end

#default_dup_host_mac_detection_timeoutObject



123
124
125
# File 'lib/cisco_node_utils/overlay_global.rb', line 123

def default_dup_host_mac_detection_timeout
  config_get_default('overlay_global', 'dup_host_mac_detection_timeout')
end

#dup_host_ip_addr_detectionObject

dup-host-ip-addr-detection



33
34
35
36
37
38
39
40
41
# File 'lib/cisco_node_utils/overlay_global.rb', line 33

def dup_host_ip_addr_detection
  return nil unless Feature.nv_overlay_evpn_enabled?
  match = config_get('overlay_global', 'dup_host_ip_addr_detection')
  if match.nil?
    default_dup_host_ip_addr_detection
  else
    match.collect(&:to_i)
  end
end

#dup_host_ip_addr_detection_host_movesObject



43
44
45
46
# File 'lib/cisco_node_utils/overlay_global.rb', line 43

def dup_host_ip_addr_detection_host_moves
  host_moves, _timeout = dup_host_ip_addr_detection
  host_moves
end

#dup_host_ip_addr_detection_set(host_moves, timeout) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/cisco_node_utils/overlay_global.rb', line 53

def dup_host_ip_addr_detection_set(host_moves, timeout)
  Feature.fabric_forwarding_enable
  Feature.nv_overlay_evpn_enable
  if host_moves == default_dup_host_ip_addr_detection_host_moves &&
     timeout == default_dup_host_ip_addr_detection_timeout
    state = 'no'
  else
    state = ''
  end
  set_args = { state: state, host_moves: host_moves, timeout: timeout }
  config_set('overlay_global', 'dup_host_ip_addr_detection', set_args)
end

#dup_host_ip_addr_detection_timeoutObject



48
49
50
51
# File 'lib/cisco_node_utils/overlay_global.rb', line 48

def dup_host_ip_addr_detection_timeout
  _host_moves, timeout = dup_host_ip_addr_detection
  timeout
end

#dup_host_mac_detectionObject

dup-host-mac-detection



81
82
83
84
85
86
87
88
# File 'lib/cisco_node_utils/overlay_global.rb', line 81

def dup_host_mac_detection
  match = config_get('overlay_global', 'dup_host_mac_detection')
  if match.nil?
    default_dup_host_mac_detection
  else
    match.collect(&:to_i)
  end
end

#dup_host_mac_detection_defaultObject



110
111
112
# File 'lib/cisco_node_utils/overlay_global.rb', line 110

def dup_host_mac_detection_default
  config_set('overlay_global', 'dup_host_mac_detection_default')
end

#dup_host_mac_detection_host_movesObject



90
91
92
93
# File 'lib/cisco_node_utils/overlay_global.rb', line 90

def dup_host_mac_detection_host_moves
  host_moves, _timeout = dup_host_mac_detection
  host_moves
end

#dup_host_mac_detection_set(host_moves, timeout) ⇒ Object



100
101
102
103
104
105
106
107
108
# File 'lib/cisco_node_utils/overlay_global.rb', line 100

def dup_host_mac_detection_set(host_moves, timeout)
  set_args = { host_moves: host_moves, timeout: timeout }
  if host_moves == default_dup_host_mac_detection_host_moves &&
     timeout == default_dup_host_mac_detection_timeout
    dup_host_mac_detection_default
  else
    config_set('overlay_global', 'dup_host_mac_detection', set_args)
  end
end

#dup_host_mac_detection_timeoutObject



95
96
97
98
# File 'lib/cisco_node_utils/overlay_global.rb', line 95

def dup_host_mac_detection_timeout
  _host_moves, timeout = dup_host_mac_detection
  timeout
end