-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: delete UPF and gNB is propagated to NS #279
feat: delete UPF and gNB is propagated to NS #279
Conversation
Signed-off-by: Patricia Reinoso <[email protected]>
Signed-off-by: Patricia Reinoso <[email protected]>
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.
Overall looks good to me, I have some questions regarding the CORS header, and I would suggest taking the opportunity to clean up the different err
variables to be more idiomatic.
Signed-off-by: Patricia Reinoso <[email protected]>
Signed-off-by: Patricia Reinoso <[email protected]>
Signed-off-by: Patricia Reinoso <[email protected]>
After exploring transactions in mongoDB, turns out that they can only be used on MongoDB Replica Set or sharded deployments. Both the SD-Core Helm Charts and Charmed Aether SD-Core use Replica Set. But if there is a StandAlone deployment, the Delete operation will fail (it will not be possible to delete a gNB or UPF at all). Right now I handled both cases : Replica Set/sharded and Stand Alone (sequential execution). It needs this PR omec-project/util#96 to work. Is the use of a MongoDB in replica set /sharded configuration something that could impose in webconsole? it would be a check we do at initialization and it would simplify the delete and update operations as we would assume that transactions are supported. |
Signed-off-by: Patricia Reinoso <[email protected]>
e924ab3
to
c470089
Compare
Signed-off-by: Patricia Reinoso <[email protected]>
If it is already what is used in the Helm Charts, I think we can enforce it, as it makes the code more robust. I can ask the question on the TST if there are other types of deployments out there that would not be using a Replica Set. I looked a bit into it and Mongo does not suggest Standalone as a good production deployment, and it looks relatively simple to convert a standalone deployment to a replicat set. |
Signed-off-by: Patricia Reinoso <[email protected]>
Signed-off-by: Patricia Reinoso <[email protected]>
Signed-off-by: Patricia Reinoso <[email protected]>
Signed-off-by: Patricia Reinoso <[email protected]>
Signed-off-by: Patricia Reinoso <[email protected]>
Signed-off-by: Patricia Reinoso <[email protected]>
Signed-off-by: Patricia Reinoso <[email protected]>
LGTM, however I would like the input of @gab-arrobo or @thakurajayL before merging. |
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.
LGTM
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.
I am going to try to take a look at this PR tomorrow morning
Signed-off-by: Patricia Reinoso <[email protected]>
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.
Overall, it looks good to me.
dbadapter/db_adapter.go
Outdated
@@ -22,14 +25,18 @@ type DBInterface interface { | |||
RestfulAPIPutOneNotUpdate(collName string, filter bson.M, putData map[string]interface{}) (bool, error) | |||
RestfulAPIPutMany(collName string, filterArray []primitive.M, putDataArray []map[string]interface{}) error | |||
RestfulAPIDeleteOne(collName string, filter bson.M) error | |||
RestfulAPIDeleteOneWithContext(collName string, filter bson.M, context context.Context) error |
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.
What about setting the context
as first parameter to follow GO's common practices?
RestfulAPIDeleteOneWithContext(collName string, filter bson.M, context context.Context) error | |
RestfulAPIDeleteOneWithContext(context context.Context, collName string, filter bson.M) error |
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.
oh, I did not know about this convention. if I change this here, i would need to make an update also in utils/mongoapi
otherwise I get an error about not implementing the correct interface. Can we move forward with this PR? and I will make the changes in utils/mongoapi
to align all the methods and create another PR (way smaller) updating the interface here ?
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.
Draft PR for modify order of parameters omec-project/util#109
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.
I just approved and merged omec-project/util#109. It is up to you to make the changes in this PR or creating another small PR for those changes (However, keep in mind that dependabot will automatically open a PR for the dependency update on Sunday night. So, it will be good to have the PR to use the new changes in omec-project/util#109 before Sunday)
Signed-off-by: Patricia Reinoso <[email protected]>
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.
Looks good to me.
@patriciareinoso, it is up to you on how to proceed about the reordering of parameters (context) in the different functions
Signed-off-by: Patricia Reinoso <[email protected]>
Description
This PR improves the DELETE operation over UPFs and gNBs: when a UPF or gNB is deleted, it is also removed from the Network Slices containing them.
To delete the elements from the Network slice we use the patch operation.
DELETE operations on inventory no longer use the configChannel -> reduce complexity.
This PR uses transactions to ensure atomicity in operations. If the second operation fails, the transaction is rolled back. The mongoDB config needs to support transactions. This PR depends on omec-project/util#96
Enforce Transactions in Webconsole
During webconsole initialization we will check that transactions are supported (replica set or sharded config enabled) If not, initialization will fail and the program will exit. One request per minute is made to mongoDB and there is a time out of 3 minutes (total 3 requests). MongoDB refuses connections if too many requests are done, waiting 1 minute before checking again is useful if the container restarts the service automatically after failure.
Network Slice before and after deletion
Before
After