-
-
Notifications
You must be signed in to change notification settings - Fork 697
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
Include cause in HTTP response ProblemDetails #3051
Conversation
@gstaa Is the Cause of ProblemDetails a required value? I think we should first check if it is required by the standard documentation. |
The attribute itself is not mandatory:
As seen in the table for the Each NF has situations specified where the e.g. PCF: TS 129 512:
Let's see the "USER_UNKNOWN" example solved by this PR: |
So why not add a comment to the source code as shown below? $ diff --git a/src/pcf/pcf-sm.c b/src/pcf/pcf-sm.c
index 2e1973860..cce05ebf3 100644
--- a/src/pcf/pcf-sm.c
+++ b/src/pcf/pcf-sm.c
@@ -207,10 +207,19 @@ void pcf_state_operational(ogs_fsm_t *s, pcf_event_t *e)
if (!sess) {
ogs_error("Not found [%s]", message.h.uri);
+ /*
+ * TS29.512
+ * 4.2.2.2 SM Policy Association establishment
+ *
+ * If the user information received within the "supi" attribute is
+ * unknown, the PCF shall reject the request with an HTTP "400 Bad
+ * Request" response message including the "cause" attribute
+ * of the ProblemDetails data structure set to "USER_UNKNOWN".
+ */
ogs_assert(true ==
ogs_sbi_server_send_error(stream,
OGS_SBI_HTTP_STATUS_NOT_FOUND,
- &message, "Not found", message.h.uri));
+ &message, "Not found", message.h.uri, "USER_UNKNOWN"));
break;
} If you don't, I can't verify that the cause value is correct. If it's too much, I think it's better to start with NULL at first. Thanks a lot! |
122ba1f
to
53f14d8
Compare
@acetcom
|
The comments you added appear to pull from the standard, but mostly appear to be your interpretation. If I were you, I would first set all causes to NULL, and only add cause values in obvious cases defined by the standard. |
That's pretty much it, but to be more precise, I think it's a good idea to define cause only where it's explicitly stated in the standard documentation first, otherwise it can be difficult for others to understand why you wrote the cause value the way you did. |
bdd984b
to
530e983
Compare
@acetcom
|
Is ERROR_INITIAL_PARAMETERS correct for pcf_nudr_dr_handle_query_am_data in src/pcf/nudr-handler.c? You are referring to the one in 4.2.2.2 SM Policy Association establishment, not AM_DATA. If you are trying to implement this feature for the first time now, it is recommended to minimize the example. If there are wrong usage during review, this pull request will not be merged. Thanks a lot! |
Cause is set according to particular NF standard. Additionally: - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED typo fixed. - [PCF] Fixed SM Policy establishment error handling
@acetcom |
Cause
is a mandatory attribute of theProblemDetails
IE.Cause
is set according to particular NF standard or TS 29.500.Additionally:
OGS_SBI_HTTP_STATUS_FORBIDDEN
statuses changed.OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED
typo fixed.In some cases
cause
does not need to be included(e.g. 404, 405, 501).