[SessionD] Handle set interface from PolicyDB to update session rules #2472
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Marie Bremner marwhal@fb.com
Summary
This diff includes the actual implementation to handle a set message of session->rules from PolicyDB.
The steps needed to accomplish this is the following:
a. Fetch the list of sessions mentioned in the request from SessionStore
b. Go through each session and apply a combination of subscriber wide RuleSet and APN specific RuleSet
c. Since this is a set message, we will want to install any rules in the set that does not already exist and remove any rules in the session that does not exist in the set.
d. Propagate the rule change to PipelineD. If applicable, we will also create/delete dedicated bearers.
e. Apply the updates back to SessionStore
Since we need to do many looks up in the rule set we receive, I've defined two new structures to make that easier. By converting the received proto message to the following structures, we do not have to iterate through the rules every time.
Two additional unit tests were added to test the SessionState and LocalEnforcer layer.
Test Plan
SessionD unit tests
S1AP test
Additional Information