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

Implement OPTIONS method for M1 API endpoints #38

Open
rjb1000 opened this issue Feb 2, 2023 · 7 comments
Open

Implement OPTIONS method for M1 API endpoints #38

rjb1000 opened this issue Feb 2, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@rjb1000
Copy link
Contributor

rjb1000 commented Feb 2, 2023

Note that this feature goes beyond what is specified in TS 26.512.

Specification

To allow M1 clients to interrogate OpenAPI version compliance, the OPTIONS method (IETF RFC 9110, section 9.3.7) shall additionally be supported for each of the M1 API endpoints implemented by the 5GMS AF:

  • *
  • .../provisioning-sessions
  • .../provisioning-sessions/{provisioningSessionId}
  • .../provisioning-sessions/{provisioningSessionId}/server-certificates
  • .../provisioning-sessions/{provisioningSessionId}/server-certificates/{serverCertificateId}
  • .../provisioning-sessions/{provisioningSessionId}/content-hosting-configuration

For the request targets supported by the 5GMS AF implementation, a 204 (No Content) response shall be returned. For all other request targets (i.e. the ones not yet supported by the 5GMS AF implementation), a 404 (Not Found) response shall be generated.

The Server header shall be provided on all responses. With the exception of the first request target, this shall include the comment string as specified in #37 to indicate additional information about API compliance. This comment string shall be omitted for the first request target (only).

With the exception of the first request target, the response shall indicate which HTTP methods are supported by the requested target resource using an Allow response header (see RFC 9110, section 10.2.1). (These are the implemented subset of those defined in the paths property of the corresponding OpenAPI YAML definition.)

@rjb1000 rjb1000 converted this from a draft issue Feb 2, 2023
@rjb1000 rjb1000 added the enhancement New feature or request label Feb 2, 2023
@rjb1000 rjb1000 added this to the MWC23 milestone Feb 2, 2023
@davidjwbbc
Copy link
Contributor

davidjwbbc commented Feb 9, 2023

Moved this and the next comment to #45 as it could be distracting on this issue

@davidjwbbc davidjwbbc moved this from Backlog to Ready for development in 5GMS: M1d Provisioning Feb 14, 2023
@devbbc devbbc moved this from Ready for development to In Progress in 5GMS: M1d Provisioning Feb 21, 2023
@devbbc
Copy link
Contributor

devbbc commented Feb 23, 2023

Implemented request targets mentioned above other than the first one. Sample output below:

  • OPTIONS method for M1 API endpoint .../provisioning-sessions:
$ curl -H 'User-Agent: AF' -X OPTIONS -v http://127.0.0.22:7777/3gpp-m1/v2/provisioning-sessions/
*   Trying 127.0.0.22:7777...
* TCP_NODELAY set
* Connected to 127.0.0.22 (127.0.0.22) port 7777 (#0)
> OPTIONS /3gpp-m1/v2/provisioning-sessions/ HTTP/1.1
> Host: 127.0.0.22:7777
> Accept: */*
> User-Agent: AF
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 204 No Content
< Connection: Keep-Alive
< Location: /3gpp-m1/v2/provisioning-sessions/
< Server: 5GMSdAF-af.localdomain/17 (info.title=M1_ProvisioningSessions; info.version=2.0.0) rt-5gms-application-function/1.2.0
< Allow: POST
< Date: Wed, 22 Feb 2023 17:07:28 GMT
< 
* Connection #0 to host 127.0.0.22 left intact
  • OPTIONS method for M1 API endpoint .../provisioning-sessions/{provisioningSessionId}:
$ curl -H 'User-Agent: AF' -X OPTIONS -v http://127.0.0.22:7777/3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711
*   Trying 127.0.0.22:7777...
* TCP_NODELAY set
* Connected to 127.0.0.22 (127.0.0.22) port 7777 (#0)
> OPTIONS /3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711 HTTP/1.1
> Host: 127.0.0.22:7777
> Accept: */*
> User-Agent: AF
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 204 No Content
< Connection: Keep-Alive
< Location: /3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711
< Server: 5GMSdAF-af.localdomain/17 (info.title=M1_ProvisioningSessions; info.version=2.0.0) rt-5gms-application-function/1.2.0
< Allow: GET, DELETE
< Date: Wed, 22 Feb 2023 17:08:21 GMT
< 
* Connection #0 to host 127.0.0.22 left intact
  • OPTIONS method for M1 API endpoint .../provisioning-sessions/{provisioningSessionId}/certificates:
$ curl -H 'User-Agent: AF' -X OPTIONS -v http://127.0.0.22:7777/3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711/certificates
*   Trying 127.0.0.22:7777...
* TCP_NODELAY set
* Connected to 127.0.0.22 (127.0.0.22) port 7777 (#0)
> OPTIONS /3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711/certificates HTTP/1.1
> Host: 127.0.0.22:7777
> Accept: */*
> User-Agent: AF
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 204 No Content
< Connection: Keep-Alive
< Location: /3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711/certificates
< Server: 5GMSdAF-af.localdomain/17 (info.title=M1_ServerCertificatesProvisioning; info.version=2.0.0) rt-5gms-application-function/1.2.0
< Allow: POST
< Date: Wed, 22 Feb 2023 17:08:59 GMT
< 
* Connection #0 to host 127.0.0.22 left intact
  • OPTIONS method for M1 API endpoint .../provisioning-sessions/{provisioningSessionId}/certificates/{certificateId}:
$ curl -H 'User-Agent: AF' -X OPTIONS -v http://127.0.0.22:7777/3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711/certificates/91fe9172-b31e-41ed-9676-6d2b4c83bb90
*   Trying 127.0.0.22:7777...
* TCP_NODELAY set
* Connected to 127.0.0.22 (127.0.0.22) port 7777 (#0)
> OPTIONS /3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711/certificates/91fe9172-b31e-41ed-9676-6d2b4c83bb90 HTTP/1.1
> Host: 127.0.0.22:7777
> Accept: */*
> User-Agent: AF
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 204 No Content
< Connection: Keep-Alive
< Allow: GET, PUT, DELETE
< Location: /3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711/certificates/91fe9172-b31e-41ed-9676-6d2b4c83bb90
< Server: 5GMSdAF-af.localdomain/17 (info.title=M1_ServerCertificatesProvisioning; info.version=2.0.0) rt-5gms-application-function/1.2.0
< Date: Wed, 22 Feb 2023 17:10:24 GMT
< 
* Connection #0 to host 127.0.0.22 left intact
  • OPTIONS method for M1 API endpoint .../provisioning-sessions/{provisioningSessionId}/content-hosting-configuration:
$ curl -H 'User-Agent: AF' -X OPTIONS -v http://127.0.0.22:7777/3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711/content-hosting-configuration
*   Trying 127.0.0.22:7777...
* TCP_NODELAY set
* Connected to 127.0.0.22 (127.0.0.22) port 7777 (#0)
> OPTIONS /3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711/content-hosting-configuration HTTP/1.1
> Host: 127.0.0.22:7777
> Accept: */*
> User-Agent: AF
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 204 No Content
< Connection: Keep-Alive
< Allow: POST, GET, PUT, DELETE
< Location: /3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711/content-hosting-configuration
< Server: 5GMSdAF-af.localdomain/17 (info.title=M1_ContentHostingProvisioning; info.version=2.1.1) rt-5gms-application-function/1.2.0
< Date: Wed, 22 Feb 2023 17:11:14 GMT
< 
* Connection #0 to host 127.0.0.22 left intact
  • Not yet supported request target
$ curl -H 'User-Agent: AF' -X OPTIONS -v http://127.0.0.22:7777/3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711/metrics
*   Trying 127.0.0.22:7777...
* TCP_NODELAY set
* Connected to 127.0.0.22 (127.0.0.22) port 7777 (#0)
> OPTIONS /3gpp-m1/v2/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711/metrics HTTP/1.1
> Host: 127.0.0.22:7777
> Accept: */*
> User-Agent: AF
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Connection: Keep-Alive
< Content-Length: 233
< Content-Type: application/problem+json
< Server: 5GMSdAF-af.localdomain/17 rt-5gms-application-function/1.2.0
< Date: Wed, 22 Feb 2023 17:12:47 GMT
< 
{
	"type":	"/3gpp-m1/v2",
	"title":	"Target not yet supported.",
	"status":	404,
	"detail":	"Method [OPTIONS]: Target [metrics] not yet supported.",
	"instance":	"/provisioning-sessions/2a5801de-b2d3-41ed-b9ec-95f2944d5711/metrics"
* Connection #0 to host 127.0.0.22 left intact

@rjb1000
Copy link
Contributor Author

rjb1000 commented Feb 23, 2023

Looks good. What about OPTIONS *?

@devbbc
Copy link
Contributor

devbbc commented Feb 23, 2023

Working on OPTIONS *. This case needs to be handled slightly different as * seems to be present in request.h.uri while for all for other request targets, the paths are present as components.

@devbbc
Copy link
Contributor

devbbc commented Feb 24, 2023

Implemented OPTIONS *:

$ curl -H 'User-Agent: AF' --request-target "*" -X OPTIONS -v http://127.0.0.22:7777
> OPTIONS * HTTP/1.1
> Host: 127.0.0.22:7777
> Accept: */*
> User-Agent: AF
> 
< HTTP/1.1 204 No Content
< Connection: Keep-Alive
< Server: 5GMSdAF-af.localdomain/17 rt-5gms-application-function/1.2.0
< Allow: POST, GET, PUT, DELETE, OPTIONS
< Date: Thu, 23 Feb 2023 17:25:53 GMT

@rjb1000
Copy link
Contributor Author

rjb1000 commented Feb 24, 2023

Thanks, @devbbc. Is this complete now and ready for review?

@devbbc devbbc moved this from In Progress to Ready for review in 5GMS: M1d Provisioning Feb 24, 2023
@davidjwbbc
Copy link
Contributor

Still need to surface this output in the m1-session tool.

@dsilhavy dsilhavy removed this from the MWC23 milestone Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Ready for review
Development

No branches or pull requests

4 participants