-
Notifications
You must be signed in to change notification settings - Fork 95
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
Conversation
e3f78be
to
1d93927
Compare
- move upf id allocation inside UPF related block - rename local variables
1d93927
to
ebadae4
Compare
|
||
func DeleteUpNodeLink(c *gin.Context) { | ||
// current version does not allow node deletions when ulcl is enabled | ||
if smf_context.SMF_Self().ULCLSupport { |
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 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 { |
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.
Hi @tim-ywliu , can you please help to fix this lint issue? Thanks.
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.
gofmt -s -w <file>
internal/sbi/producer/pdu_session.go
Outdated
@@ -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() |
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.
@tim-ywliu , how can this lint issue be fixed ? Thanks.
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.
gofmt -s -w <file>
Hi @tim-ywliu , can you please review this PR? Thanks. In case of |
@@ -60,6 +60,10 @@ func HandlePDUSessionSMContextCreate(request models.PostSmContextsRequest) *http | |||
smContext.SMLock.Lock() | |||
defer smContext.SMLock.Unlock() | |||
|
|||
upi := smf_context.GetUserPlaneInformation() | |||
upi.Mu.RLock() |
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.
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
.
- with "gofmt -s -w"
@tim-ywliu , I have added a termination of the heartbreat_association thread for the UPF that get deleted. |
@@ -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()) |
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.
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()) |
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.
Save context and cancel function on the UPF data model so that it can be used to cancel heartbeat thread of this UPF.
Hi, |
Can the PR please be reviewed? |
I have added additional test descriptions to validate that the proper UPF association thread is being canceled. |
This PR is in a continuation of PR #68 which adds delete Rest API support.
Delete upNode
Delete an upNode and its associated links from user_plane_information
REST path:
Return: