diff --git a/lib/cisco_node_utils/feature.rb b/lib/cisco_node_utils/feature.rb index 575b90af..95324768 100644 --- a/lib/cisco_node_utils/feature.rb +++ b/lib/cisco_node_utils/feature.rb @@ -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 @@ -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 # --------------------------- diff --git a/tests/ciscotest.rb b/tests/ciscotest.rb index 37e8ba18..dbddcd29 100644 --- a/tests/ciscotest.rb +++ b/tests/ciscotest.rb @@ -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)] diff --git a/tests/test_feature.rb b/tests/test_feature.rb index 90e77500..1fc07f55 100755 --- a/tests/test_feature.rb +++ b/tests/test_feature.rb @@ -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 ###################