-
Notifications
You must be signed in to change notification settings - Fork 36
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
Handle Deregistration Notification Implementation #214
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
941b39a
paging fix,handle deregistration notification implimentation
akhila-s06 84543ec
Merge branch 'master' into dereg_notif_impl
akhila-s06 602cb1b
Merge branch 'master' into dereg_notif_impl
gab-arrobo b50b3ae
Merge branch 'omec-project:master' into dereg_notif_impl
akhila-s06 b46983b
Merge branch 'master' into dereg_notif_impl
gab-arrobo 941aefd
Merge branch 'master' into dereg_notif_impl
gab-arrobo b45829f
Merge branch 'master' into dereg_notif_impl
akhila-s06 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// SPDX-FileCopyrightText: 2022 Infosys Limited | ||
// Copyright 2019 free5GC.org | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
package httpcallback | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/gin-gonic/gin" | ||
"github.com/omec-project/amf/logger" | ||
"github.com/omec-project/amf/producer" | ||
"github.com/omec-project/openapi" | ||
"github.com/omec-project/openapi/models" | ||
"github.com/omec-project/util/httpwrapper" | ||
) | ||
|
||
func HTTPDeregistrationNotification(c *gin.Context) { | ||
var deregistrationData models.DeregistrationData | ||
|
||
requestBody, err := c.GetRawData() | ||
if err != nil { | ||
logger.CallbackLog.Errorf("Get Request Body error: %+v", err) | ||
problemDetail := models.ProblemDetails{ | ||
Title: "System failure", | ||
Status: http.StatusInternalServerError, | ||
Detail: err.Error(), | ||
Cause: "SYSTEM_FAILURE", | ||
} | ||
c.JSON(http.StatusInternalServerError, problemDetail) | ||
return | ||
} | ||
|
||
err = openapi.Deserialize(&deregistrationData, requestBody, "application/json") | ||
if err != nil { | ||
problemDetail := "[Request Body] " + err.Error() | ||
rsp := models.ProblemDetails{ | ||
Title: "Malformed request syntax", | ||
Status: http.StatusBadRequest, | ||
Detail: problemDetail, | ||
} | ||
logger.CallbackLog.Errorln(problemDetail) | ||
c.JSON(http.StatusBadRequest, rsp) | ||
return | ||
} | ||
|
||
req := httpwrapper.NewRequest(c.Request, deregistrationData) | ||
if supi, exists := c.Params.Get("supi"); exists { | ||
req.Params["supi"] = supi | ||
} | ||
rsp := producer.HandleDeregistrationNotification(req) | ||
|
||
responseBody, err := openapi.Serialize(rsp.Body, "application/json") | ||
if err != nil { | ||
logger.CallbackLog.Errorln(err) | ||
problemDetails := models.ProblemDetails{ | ||
Status: http.StatusInternalServerError, | ||
Cause: "SYSTEM_FAILURE", | ||
Detail: err.Error(), | ||
} | ||
c.JSON(http.StatusInternalServerError, problemDetails) | ||
} else { | ||
c.Data(rsp.Status, "application/json", responseBody) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
Could you please tell us why this is removed.
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.
The map 'amfranpool' was populated with two entries for single NG connection.
This line of code adds one extra entry to amfranpool for the same NG connection.
Therefore, two paging messages are send by AMF.
Furthermore, this extra line of code is found in omec-project/amf repository but not in free5gc/amf repository (https://github.com/free5gc/amf/blob/main/internal/context/amf_ran.go).
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.
Could you please share where is the other entry added?
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.
Sure. Attaching the screenshot of the function where the other entry is added.
The function 'NewAmfRan' is called in 'ngap/dispatcher.go' (https://github.com/omec-project/amf/blob/master/ngap/dispatcher.go#L116).