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

Add Delete REST API to user_plane_information (upNodes, links). #69

Merged
merged 6 commits into from
Mar 13, 2023

Conversation

aviweit
Copy link
Contributor

@aviweit aviweit commented Feb 6, 2023

This PR is in a continuation of PR #68 which adds delete Rest API support.

  • [DELETE] /upi/v1/upNodesLinks/

Delete upNode

Delete an upNode and its associated links from user_plane_information

curl -H "Content-type: application/json" -X DELETE http://<smf_ip_address>:<smf_port>/upi/v1/upNodesLinks/<upnode_name>

REST path:

    smf_ip_address - ipaddress of SMF service
    smf_port       - the service port
    upnode_name    - the name of the upNode that represents the upNode to be removed

Return:

    status - 200, 404

@aviweit aviweit changed the title Upi rest api delete Add Delete REST API to user_plane_information (upNodes, links). Feb 6, 2023
- move upf id allocation inside UPF related block
- rename local variables
@aviweit aviweit marked this pull request as ready for review February 6, 2023 12:47

func DeleteUpNodeLink(c *gin.Context) {
// current version does not allow node deletions when ulcl is enabled
if smf_context.SMF_Self().ULCLSupport {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suggest to support ULCL case under a different PR.


// update links
for name, n := range upi.UPNodes {
if index := nodeInLink (upNode, n.Links); index != -1 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @tim-ywliu , can you please help to fix this lint issue? Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

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

gofmt -s -w <file>

@@ -60,6 +60,10 @@ func HandlePDUSessionSMContextCreate(request models.PostSmContextsRequest) *http
smContext.SMLock.Lock()
defer smContext.SMLock.Unlock()

upi := smf_context.GetUserPlaneInformation()
upi.Mu.RLock()
defer upi.Mu.RUnlock()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tim-ywliu , how can this lint issue be fixed ? Thanks.

Copy link
Collaborator

@tim-ywliu tim-ywliu Feb 10, 2023

Choose a reason for hiding this comment

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

gofmt -s -w <file>

@aviweit
Copy link
Contributor Author

aviweit commented Feb 6, 2023

Hi @tim-ywliu , can you please review this PR? Thanks.

In case of pfcp.heartbeat is enabled, an heartbreat_association thread is being run for the UPFs.
Can you please help on how to terminate the proper thread when the UPF is being deleted from SMF?
Thanks.

@@ -60,6 +60,10 @@ func HandlePDUSessionSMContextCreate(request models.PostSmContextsRequest) *http
smContext.SMLock.Lock()
defer smContext.SMLock.Unlock()

upi := smf_context.GetUserPlaneInformation()
upi.Mu.RLock()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Read lock is being used for session creation because it seems that multiple session creations are allowed in respect to user_plane_information consistency. Same comment for HandlePDUSessionSMContextUpdate.

@aviweit
Copy link
Contributor Author

aviweit commented Feb 10, 2023

@tim-ywliu , I have added a termination of the heartbreat_association thread for the UPF that get deleted.
I also fixed lint issues.
Thanks.

@@ -273,6 +273,7 @@ func (smf *SMF) Start() {
smf_context.SMF_Self().Ctx = ctx
smf_context.SMF_Self().PFCPCancelFunc = cancel
for _, upNode := range smf_context.SMF_Self().UserPlaneInformation.UPFs {
upNode.UPF.Ctx, upNode.UPF.CancelFunc = context.WithCancel(context.Background())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Save context and cancel function on the UPF data model so that it can be used to cancel heartbeat thread of this UPF.

@@ -43,8 +50,33 @@ func PostUpNodesLinks(c *gin.Context) {
for _, upf := range upi.UPFs {
// only associate new ones
if upf.UPF.UPFStatus == smf_context.NotAssociated {
upf.UPF.Ctx, upf.UPF.CancelFunc = context.WithCancel(context.Background())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Save context and cancel function on the UPF data model so that it can be used to cancel heartbeat thread of this UPF.

@aviweit
Copy link
Contributor Author

aviweit commented Feb 20, 2023

Hi,
I have documented the tests I performed for this PR in the attached link. I confirm they pass in my docker-compose environment.

test descriptions

@aviweit
Copy link
Contributor Author

aviweit commented Feb 20, 2023

Can the PR please be reviewed?
Thanks.

@aviweit
Copy link
Contributor Author

aviweit commented Feb 21, 2023

I have added additional test descriptions to validate that the proper UPF association thread is being canceled.
Thanks.

@tim-ywliu tim-ywliu merged commit 73bb01d into free5gc:main Mar 13, 2023
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.

2 participants