Class: Cisco::Feature

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

Overview

Feature - node util class for managing common features

Class Method Summary collapse

Methods inherited from NodeUtil

config_get, #config_get, config_get_default, #config_get_default, #config_set, config_set, #node, node, #show

Class Method Details

.bgp_enableObject

Note that in most cases the enable methods should only enable; however, for test purposes it is sometimes convenient to support feature disablement for cleanup purposes.




26
27
28
29
# File 'lib/cisco_node_utils/feature.rb', line 26

def self.bgp_enable
  return if bgp_enabled?
  config_set('feature', 'bgp')
end

.bgp_enabled?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/cisco_node_utils/feature.rb', line 31

def self.bgp_enabled?
  config_get('feature', 'bgp')
end

.fabric_enableObject




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

def self.fabric_enable
  # install feature-set and enable it
  return if fabric_enabled?
  config_set('feature', 'fabric', state: 'install') unless fabric_installed?
  config_set('feature', 'fabric', state: '')
end

.fabric_enabled?Boolean

Returns:

  • (Boolean)


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

def self.fabric_enabled?
  config_get('feature', 'fabric') =~ /^enabled/
end

.fabric_forwarding_enableObject




56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/cisco_node_utils/feature.rb', line 56

def self.fabric_forwarding_enable
  return if fabric_forwarding_enabled?
  Feature.fabric_enable if Feature.fabric_supported?
  # The feature fabric-forwarding cli is required in some older nxos images
  # but is not present in newer images because nv_overlay_evpn handles
  # both features; therefore feature fabric-forwarding is best-effort
  # and ignored on cli failure.
  begin
    config_set('feature', 'fabric_forwarding')
  rescue Cisco::CliError
    CiscoLogger.debug '"feature fabric forwarding" CLI was rejected'
  end
end

.fabric_forwarding_enabled?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/cisco_node_utils/feature.rb', line 70

def self.fabric_forwarding_enabled?
  config_get('feature', 'fabric_forwarding')
end

.fabric_installed?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/cisco_node_utils/feature.rb', line 47

def self.fabric_installed?
  config_get('feature', 'fabric') !~ /^uninstalled/
end

.fabric_supported?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/cisco_node_utils/feature.rb', line 51

def self.fabric_supported?
  config_get('feature', 'fabric')
end

.nv_overlay_enableObject




75
76
77
78
79
# File 'lib/cisco_node_utils/feature.rb', line 75

def self.nv_overlay_enable
  # Note: vdc platforms restrict this feature to F3 or newer linecards
  return if nv_overlay_enabled?
  config_set('feature', 'nv_overlay')
end

.nv_overlay_enabled?Boolean

Returns:

  • (Boolean)


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

def self.nv_overlay_enabled?
  config_get('feature', 'nv_overlay')
rescue Cisco::CliError => e
  # cmd will syntax reject when feature is not enabled.
  raise unless e.clierror =~ /Syntax error/
  return false
end

.nv_overlay_evpn_enableObject




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

def self.nv_overlay_evpn_enable
  return if nv_overlay_evpn_enabled?
  config_set('feature', 'nv_overlay_evpn')
end

.nv_overlay_evpn_enabled?Boolean

Returns:

  • (Boolean)


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

def self.nv_overlay_evpn_enabled?
  config_get('feature', 'nv_overlay_evpn')
end

.vn_segment_vlan_based_enableObject




100
101
102
103
# File 'lib/cisco_node_utils/feature.rb', line 100

def self.vn_segment_vlan_based_enable
  return if vn_segment_vlan_based_enabled?
  config_set('feature', 'vn_segment_vlan_based')
end

.vn_segment_vlan_based_enabled?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/cisco_node_utils/feature.rb', line 105

def self.vn_segment_vlan_based_enabled?
  config_get('feature', 'vn_segment_vlan_based')
end