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
2 changes: 1 addition & 1 deletion lib/cisco_node_utils/bgp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
6 changes: 6 additions & 0 deletions tests/ciscotest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a nice addition.

# 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
Expand Down
7 changes: 6 additions & 1 deletion tests/test_interface_private_vlan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down
24 changes: 10 additions & 14 deletions tests/test_router_bgp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -256,24 +257,18 @@ def test_asnum_dot
end

def test_nsr
skip_if_UnsupportedCmdRef('bgp', 'nsr')
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the nsr stuff was added by the XR team when they were still doing puppet. I see that NSR is supported for OSPFv2 on Nexus but there is no mention of BGP. Did you find documentation that states it's not supported for BGP or is it the absence of the CLI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Neither. Our yaml excludes it so I added this check to obey the yaml. (sushirol exluded it from nexus when he added the attr)

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
Expand Down Expand Up @@ -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'")
Expand Down