Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/cisco_node_utils/cmd_ref/feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ fabric_forwarding:
get_value: '/^feature fabric forwarding$/'
set_value: "feature fabric forwarding"

fabricpath:
_exclude: [N3k, N3k-F, N9k-F, N9k]
get_command: "show feature-set"
get_value: '/^fabricpath[\s\d]+(\w+)/'
set_value: "<state> feature-set fabricpath"

fex:
_exclude: [C3048, C3064, C3132, N5k, N6k, N3k-F, N9k-F]
get_command: "show feature-set"
Expand Down
21 changes: 21 additions & 0 deletions lib/cisco_node_utils/feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,27 @@ def self.fabric_supported?
config_get('feature', 'fabric')
end

# ---------------------------
def self.fabricpath_enable
# install feature-set and enable it
return if fabricpath_enabled?
config_set('feature', 'fabricpath', state: 'install') unless
fabricpath_installed?
config_set('feature', 'fabricpath', state: '')
end

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

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

def self.fabricpath_supported?
config_get('feature', 'fabricpath')
end

# ---------------------------
def self.fabric_forwarding_enable
return if fabric_forwarding_enabled?
Expand Down
26 changes: 25 additions & 1 deletion tests/test_feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ def test_tacacs

def test_vn_segment_vlan_based
vxlan_linecard?
Feature.nv_overlay_enable unless node.product_id[/N3/]
Feature.fabricpath_enable if node.product_id[/N(5|6)/]
Feature.nv_overlay_enable unless node.product_id[/N(3|5|6)/]
feature('vn_segment_vlan_based')
rescue RuntimeError => e
hardware_supports_feature?(e.message)
Expand All @@ -187,6 +188,7 @@ def test_vni
config_no_warn('no feature nv overlay')
vdc_limit_f3_no_intf_needed(:set)
end
Feature.fabricpath_enable if node.product_id[/N(5|6)/]
feature('vni')
rescue RuntimeError => e
hardware_supports_feature?(e.message)
Expand Down Expand Up @@ -222,6 +224,28 @@ def test_feature_set_fabric
assert(Feature.fabric_enabled?, "(#{fs}) is not enabled")
end

def test_feature_set_fabricpath
if node.product_id[/N(3|8|9)/]
assert_nil(Feature.fabricpath_enabled?)
assert_raises(Cisco::UnsupportedError) { Feature.fabricpath_enable }
return
end
vdc_limit_f3_no_intf_needed(:set)
fs = 'feature-set fabricpath'
# Get current state of the feature-set
feature_set_installed = Feature.fabricpath_installed?

config("no #{fs} ; no install #{fs}") if feature_set_installed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit Why not just call Feature.fabricpath_installed? directly here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is just a copy/paste/rename from the other feature-set tests. I think the reason I used config() here back in the day was because it's marginally faster to send both commands at once.

Copy link
Contributor

@mikewiebe mikewiebe Feb 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not concerned about config(). I was suggesting you get rid of line 235 feature_set_installed = Feature.fabricpath_installed? and just do this.

config("no #{fs} ; no install #{fs}") if Feature.fabricpath_installed?

refute_show_match(
command: "show running | i '^install #{fs}$'",
pattern: /^install #{fs}$/,
msg: "(#{fs}) is still configured",
)

Feature.fabricpath_enable
assert(Feature.fabricpath_enabled?, "(#{fs}) is not enabled")
end

def test_feature_set_fex
if validate_property_excluded?('feature', 'fex')
assert_nil(Feature.fex_enabled?)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_vrf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ def test_route_distinguisher
assert_empty(v.route_distinguisher,
'v route_distinguisher should *NOT* be configured')
v.destroy
rescue RuntimeError => e
hardware_supports_feature?(e.message)
end

def test_vpn_id
Expand Down