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
13 changes: 9 additions & 4 deletions lib/cisco_node_utils/feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ def self.ngmvpn_disable
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', state: '')
result = config_set('feature', 'nv_overlay', state: '')
cli_error_check(result)
sleep 1
end

Expand Down Expand Up @@ -311,14 +312,18 @@ def self.cli_error_check(result)
# instead just displays a STDOUT error message; thus NXAPI does not detect
# the failure and we must catch it by inspecting the "body" hash entry
# returned by NXAPI. This cli behavior is unlikely to change soon.
patterns = [
'Hardware is not capable of supporting',
'is unsupported on this node',
'Feature NOT supported on this Platform',
]
fail result[2]['body'] if
result[2].is_a?(Hash) &&
/Hardware is not capable of supporting/.match(result[2]['body'].to_s)
result[2]['body'].to_s[Regexp.union(patterns)]

# Some test environments get result as a string instead of a hash
fail result if
result.is_a?(String) &&
/Hardware is not capable of supporting/.match(result)
result.is_a?(String) && result[Regexp.union(patterns)]
end

# ---------------------------
Expand Down
1 change: 1 addition & 0 deletions tests/ciscotest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def address_match?(int_ip)
def hardware_supports_feature?(message)
patterns = ['Hardware is not capable of supporting',
'is unsupported on this node',
'Feature NOT supported on this Platform',
]
skip('Skip test: Feature is unsupported on this device') if
message[Regexp.union(patterns)]
Expand Down
2 changes: 2 additions & 0 deletions tests/test_feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def feature(feat)

# Return testbed to pre-clean state
config("no feature #{feat_str}") unless pre_clean_enabled
rescue RuntimeError => e
hardware_supports_feature?(e.message)
end

###################
Expand Down