From d2b18639da81fbdfa9da97ad34ff039deead0919 Mon Sep 17 00:00:00 2001 From: Chris Van Heuveln Date: Tue, 5 Feb 2019 13:29:09 -0500 Subject: [PATCH 1/4] test_feature: n6k fix for vni --- tests/test_feature.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_feature.rb b/tests/test_feature.rb index 90e77500..07c141ba 100755 --- a/tests/test_feature.rb +++ b/tests/test_feature.rb @@ -185,7 +185,7 @@ def test_vni config_no_warn('no feature nv overlay') vdc_limit_f3_no_intf_needed(:set) end - feature('vni') + Feature.vni_enable rescue RuntimeError => e hardware_supports_feature?(e.message) end From 8e1547856057bb02979f632d0e4498c1438080c0 Mon Sep 17 00:00:00 2001 From: Chris Van Heuveln Date: Tue, 5 Feb 2019 13:52:19 -0500 Subject: [PATCH 2/4] restore the feature('vni') call in test_feature.rb --- tests/test_feature.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_feature.rb b/tests/test_feature.rb index 07c141ba..90e77500 100755 --- a/tests/test_feature.rb +++ b/tests/test_feature.rb @@ -185,7 +185,7 @@ def test_vni config_no_warn('no feature nv overlay') vdc_limit_f3_no_intf_needed(:set) end - Feature.vni_enable + feature('vni') rescue RuntimeError => e hardware_supports_feature?(e.message) end From f00692cf65cbd017c817f0681e7a89e627ea09aa Mon Sep 17 00:00:00 2001 From: Chris Van Heuveln Date: Tue, 5 Feb 2019 15:13:59 -0500 Subject: [PATCH 3/4] test_feature: n6k: test_nv_overlay, hw unsupp check --- lib/cisco_node_utils/feature.rb | 13 +++++++++---- tests/ciscotest.rb | 1 + tests/test_feature.rb | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/cisco_node_utils/feature.rb b/lib/cisco_node_utils/feature.rb index 575b90af..29a87b4e 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 ################### From b680d28a9da1c9713017e9ed272a1035ff61d29f Mon Sep 17 00:00:00 2001 From: Chris Van Heuveln Date: Tue, 5 Feb 2019 15:33:09 -0500 Subject: [PATCH 4/4] rubocop fix for feature.rb --- lib/cisco_node_utils/feature.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cisco_node_utils/feature.rb b/lib/cisco_node_utils/feature.rb index 29a87b4e..95324768 100644 --- a/lib/cisco_node_utils/feature.rb +++ b/lib/cisco_node_utils/feature.rb @@ -315,7 +315,7 @@ def self.cli_error_check(result) patterns = [ 'Hardware is not capable of supporting', 'is unsupported on this node', - 'Feature NOT supported on this Platform' + 'Feature NOT supported on this Platform', ] fail result[2]['body'] if result[2].is_a?(Hash) &&