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

Fix bgp_communities facts handling for empty member lists. #319

Merged
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- Fix incorrect "facts" handling for parsing of a BGP community list configured with an empty "members" list (https://github.com/ansible-collections/dellemc.enterprise_sonic/pull/319).
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,14 @@ def get_bgp_communities(self):
result['permit'] = True
if members:
result['type'] = 'expanded' if 'REGEX' in members[0] else 'standard'
if result['type'] == 'expanded':
members = [':'.join(i.split(':')[1:]) for i in members]
members.sort()
result['members'] = {'regex': members}
if result['type'] == 'expanded':
members = [':'.join(i.split(':')[1:]) for i in members]
members.sort()
result['members'] = {'regex': members}
else:
result['type'] = 'standard'

if result['type'] == 'standard':
result['local_as'] = None
result['no_advertise'] = None
result['no_export'] = None
Expand Down