-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
Signed-off-by: Abhishek Dosi <[email protected]>
This reverts commit adeb086.
Signed-off-by: Abhishek Dosi <[email protected]>
@@ -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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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]>
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.
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
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.
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
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.