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

Some cleanup for the db migration script #956

Merged
merged 13 commits into from
Apr 25, 2021

Conversation

matt9j
Copy link
Contributor

@matt9j matt9j commented Apr 24, 2021

This pull request does some cleanup of the initial rough database migration script added by @nickvsnetworking . It also adds a basic test, although I was not sure how to incorporate python unit testing with the existing meson test infrastructure. I tried to keep the commits individually small, so it might be easier to review on a commit by commit basis rather than as a whole PR. I have tested this in my local virtual environment to make sure the daemons don't crash immediately, but have not tested it with an attached RAN.

* This commit should not change behavior, and only removes trailing
  whitespace.
Per pep-8 methods within a class should only have a single space
between them. Spacing before this commit was inconsistent, with a mix
of single and double spaces.
No symbols are currently used from mongo, only pymongo, and the mongo
package appears to be unmaintained. https://pypi.org/project/mongo/
points to https://github.com/imbolc/mongo, which shows no
contributions since 2012.
This commit does not intend to change behavior, but breaks the schema
updater script into a function to better support testing and code
decomposition.
Keeping the migration isolated allows for more easily testing the
migration logic for each subscriber.
In-place modification makes the code path for the schema update more
difficult to understand. This commit changes the way the update is
done to be formatted as a translation from old to new.
This commit improves the creation of new slice sessions from existing
pdn configurations by supporting additional fields (smf and ue), and
throwing an explicit error before writing breaking changes to the DB
when it encounters unsupported elements.
If the migration encounters an exception, allow the migration to abort
to prevent updating the database with a corrupted value.
Without an explicit unset operator in the query, mongo will leave the
existing PDN entry alone.
@CLAassistant
Copy link

CLAassistant commented Apr 24, 2021

CLA assistant check
All committers have signed the CLA.

@acetcom acetcom merged commit 72374e4 into open5gs:main Apr 25, 2021
@acetcom
Copy link
Member

acetcom commented Apr 25, 2021

Thank you so much!

@matt9j matt9j deleted the devel-db-migration branch April 26, 2021 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants