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 Allow prefix Delete case #6671

Merged
merged 5 commits into from
Feb 4, 2021
Merged

Fix Allow prefix Delete case #6671

merged 5 commits into from
Feb 4, 2021

Conversation

abdosi
Copy link
Contributor

@abdosi abdosi commented Feb 3, 2021

What I did:
For Allow list prefix we have default route-map to set community define in template. Based on default action define in constants.yml the community value can be no-export (drop action) or drop-community (permit action) in the template generated route-map

            'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 65535',
            ' set community 123:123 additive',
            'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V6 permit 65535',
            ' set community 123:123 additive'

When we add allow-list key with action above route-map gets updated . For eg if we add deny action above template will become to no-export community. Now if we delete the key Issue is we still keep the no-export and do not move back to drop community.

This PR fixes this issue by rolling back default route-map community value back to constants.yml default action.

Why I did:
This is needed if we want to roll-back the allow list feature (delete allow prefix key) that was having deny action and move back to permit as default

How I verify:
Added Unit test cases to cover this scenario.

shi-su
shi-su previously approved these changes Feb 4, 2021
@@ -40,6 +40,8 @@ def push_list(args):
cfg_mgr.update.return_value = None
cfg_mgr.push_list = push_list
cfg_mgr.get_text.return_value = currect_config
if gloabl_default_action:
global_constants["bgp"]["allow_list"]["default_action"] = gloabl_default_action
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a personal preference, what about updating mgr.constants["bgp"]["allow_list"]["default_action"] afterwards? I feel updating this global default action and then revert it back looks a little strange.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shi-su Thanks updated accordingly usingdeepcopy() for constant.

Signed-off-by: Abhishek Dosi <[email protected]>
@abdosi abdosi merged commit 92e3517 into sonic-net:master Feb 4, 2021
@abdosi abdosi deleted the allow_prefix branch February 4, 2021 16:15
abdosi added a commit that referenced this pull request Feb 4, 2021
When we add allow-list key with action above route-map gets updated . For eg if we add deny action above template will become to no-export community. Now if we delete the key Issue is we still keep the no-export and do not move back to drop community.

This PR fixes this issue by rolling back default route-map community value back to constants.yml default action.
abdosi added a commit to sonic-net/sonic-mgmt that referenced this pull request Feb 5, 2021
Updated test case to align with sonic-net/sonic-buildimage#6370 which made allow list action dynamic
Added test case to cover sonic-net/sonic-buildimage#6671
Remove fixed value of Drop Community and read from /etc/sonic/constants.yml file.
Organized the case as three test case one to verify default pre/post-config behavior when no prefix list there on device and
then test case to verify with prefix list programmed with action as permit and deny
daall pushed a commit that referenced this pull request Feb 5, 2021
When we add allow-list key with action above route-map gets updated . For eg if we add deny action above template will become to no-export community. Now if we delete the key Issue is we still keep the no-export and do not move back to drop community.

This PR fixes this issue by rolling back default route-map community value back to constants.yml default action.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants