Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgp send-community fix #487

Merged
merged 5 commits into from
Oct 13, 2016
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 3 additions & 2 deletions lib/cisco_node_utils/bgp_neighbor_af.rb
Original file line number Diff line number Diff line change
Expand Up @@ -565,15 +565,16 @@ def default_route_reflector_client
# sense to split up the individual methods to support them
def send_community
val = config_get('bgp_neighbor_af', 'send_community', @get_args)
return default_send_community if val.nil?
return default_send_community if val.nil? || val.empty?
platform == :nexus ? send_community_nexus(val) : send_community_xr(val)
end

# Nexus: <state> send-community [ both | extended | standard ]
# NOTE: 'standard' is default but does not nvgen on some platforms
# Returns: none, both, extended, or standard
def send_community_nexus(val)
val = val.split.last
return 'both' if val.size > 1
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the specific contents of val when size > 1? Does it nvgen both extended and standard?

Copy link
Author

@saichint saichint Oct 13, 2016

Choose a reason for hiding this comment

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

yes, when we execute the CLI with 'both', it generates 2 lines, one with standard and the 2nd with extended.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I would prefer we be more explicit here and inspect val for extended and standard then rather then just check the size.

Copy link
Author

Choose a reason for hiding this comment

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

Ok. Changed it to test the actual values. Since the order of the nvgen could change in the future without our knowledge, I added sort just in case.

val = val[0].split.last
return 'standard' if val[/send-community/] # Workaround
val
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ route_reflector_client:
default_value: false

send_community:
multiple:
auto_default: false
default_value: 'none'
nexus:
get_value: '/^send-community(?: .*)?/'
set_value: '<state> send-community <attr>'
ios_xr:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you remove multiple under xr?

Copy link
Author

Choose a reason for hiding this comment

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

I did not remove it. I moved it above so that it is common for both xr and nexus.

Copy link
Contributor

Choose a reason for hiding this comment

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

@saichint Sorry my mistake.

multiple:
# XR three seperate commands: send-community-ebgp send-community-gshut-ebgp
# and send-extended-community-ebgp
# send-community-ebgp' and 'send-extended-community-ebgp' are the equivalents
Expand Down
1 change: 1 addition & 0 deletions tests/test_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ def test_bfd_echo
assert_raises(Cisco::UnsupportedError) { interface.bfd_echo = false }
return
end
interface.switchport_mode = :disabled
assert_equal(interface.default_bfd_echo,
interface.bfd_echo)
interface.bfd_echo = false
Expand Down