diff --git a/lib/cisco_node_utils/bgp.rb b/lib/cisco_node_utils/bgp.rb index 44c87f34..c1d62489 100644 --- a/lib/cisco_node_utils/bgp.rb +++ b/lib/cisco_node_utils/bgp.rb @@ -827,7 +827,7 @@ def route_distinguisher=(rd) # explicit values when removing the rd command. These restrictions are # not not needed in I3 and newer images. Feature.nv_overlay_evpn_enable if - Utils.nexus_i2_image || node.product_id[/N7/] + Utils.nexus_i2_image || node.product_id[/N[567]/] if rd == default_route_distinguisher return if route_distinguisher.empty? diff --git a/tests/ciscotest.rb b/tests/ciscotest.rb index dbddcd29..88c695c1 100644 --- a/tests/ciscotest.rb +++ b/tests/ciscotest.rb @@ -214,6 +214,12 @@ def skip_incompat_version?(feature, property) Gem::Version.new(lim) < Gem::Version.new(ver) end + def skip_if_UnsupportedCmdRef(feature_name, attribute_name) # rubocop:disable Style/MethodName + # Check if attr is excluded by the cmd_ref yaml + skip("UnsupportedCmdRef attribute: '#{attribute_name}'") if + cmd_ref.lookup(feature_name, attribute_name).is_a?(UnsupportedCmdRef) + end + def skip_nexus_i2_image? skip("This property is not supported on Nexus 'I2' images") if Utils.nexus_i2_image diff --git a/tests/test_interface_private_vlan.rb b/tests/test_interface_private_vlan.rb index a4fbec5e..995362c1 100755 --- a/tests/test_interface_private_vlan.rb +++ b/tests/test_interface_private_vlan.rb @@ -196,6 +196,9 @@ def test_sw_pvlan_host_association end def test_sw_pvlan_trunk_association + # N6k trunk association does not update primary-secondary associations automatically + skip('Test behavior not supported on device') if node.product_id[/N(5|6)/] + # Supports multiple instances of [[pri, sec], [pri2, sec2]] if validate_property_excluded?('interface', 'switchport_pvlan_trunk_association') @@ -254,6 +257,9 @@ def test_sw_pvlan_mapping end def test_sw_pvlan_mapping_trunk + # N6k mapping trunk does not update primary-secondary associations automatically + skip('Test behavior not supported on device') if node.product_id[/N(5|6)/] + if validate_property_excluded?('interface', 'switchport_pvlan_mapping_trunk') assert_raises(Cisco::UnsupportedError) do @@ -269,7 +275,6 @@ def test_sw_pvlan_mapping_trunk assert_equal([['2', '4-8,10-11']], i.switchport_pvlan_mapping_trunk) # Same primary, but change range - i.switchport_pvlan_mapping_trunk = ['2', '11,4-6,8'] assert_equal([['2', '4-6,8,11']], i.switchport_pvlan_mapping_trunk) diff --git a/tests/test_router_bgp.rb b/tests/test_router_bgp.rb index d55be1da..a557feaf 100644 --- a/tests/test_router_bgp.rb +++ b/tests/test_router_bgp.rb @@ -55,7 +55,8 @@ def setup_default end def setup_vrf - @asnum = 99 + # nexus does not support multiple BGP instances; VRF AS must be same as default AS + @asnum = platform == :nexus ? 55 : 99 @vrf = 'yamllll' create_bgp_vrf(@asnum, @vrf) end @@ -256,24 +257,18 @@ def test_asnum_dot end def test_nsr + skip_if_UnsupportedCmdRef('bgp', 'nsr') nsr(setup_default) nsr(setup_vrf) end def nsr(bgp) - if (platform == :nexus) || (platform == :ios_xr && !@vrf[/default/]) - if platform == :nexus - assert_nil(bgp.default_nsr, - 'default bgp nsr should be nil on Nexus') - assert_nil(bgp.nsr, - 'bgp nsr should be nil on Nexus') - else - assert_nil(bgp.default_nsr, - 'default bgp nsr should return nil on XR with non-default' \ - ' vrf') - assert_nil(bgp.nsr, - 'bgp nsr should return nil on XR with non-default vrf') - end + if platform == :ios_xr && !@vrf[/default/] + assert_nil(bgp.default_nsr, + 'default bgp nsr should return nil on XR with non-default' \ + ' vrf') + assert_nil(bgp.nsr, + 'bgp nsr should return nil on XR with non-default vrf') assert_raises(Cisco::UnsupportedError) do bgp.nsr = true end @@ -1100,6 +1095,7 @@ def test_reconnect_interval_default assert_nil(bgp.reconnect_interval, 'reconnect_interval should return nil on XR') else + skip_if_UnsupportedCmdRef('bgp', 'reconnect_interval') skip_incompat_version?('bgp', 'reconnect_interval') assert_equal(bgp.default_reconnect_interval, bgp.reconnect_interval, "reconnect_interval should be set to default value of '60'")