Requirements#

SOVD Gateway Requirements
status: draft
security: YES
safety: QM
tags: requirements, sovd_gateway
version: 1

Functional Requirements#

Single Entry Point
status: valid
security: YES
safety: QM

The SOVD gateway shall serve the entities it hosts and the entities of its upstream SOVD servers under one SOVD API base URL.

Upstream Configuration
status: valid
security: YES
safety: QM

The SOVD gateway shall take its listen URL from SOVD_URL and the base URLs of its upstream SOVD servers from the comma-separated SOVD_UPSTREAM_URL. Each upstream shall use an http:// URL or a Unix domain socket URL of the form unix:<socket>[:<base path>], for example unix:///run/cda.sock:/vehicle/v15. The gateway shall refuse to start with an invalid upstream URL and shall forward nothing when SOVD_UPSTREAM_URL is unset or empty and no upstream is supplied on the command line.

Forwarding to the Upstream
status: valid
security: YES
safety: QM

The SOVD gateway shall forward requests for entities it does not host, and for locks, functions and collections, to its upstream SOVD server, and shall return the upstream’s status, headers and body to the client.

Combined Discovery
status: valid
security: YES
safety: QM
reqtype: Functional
version: 1

The SOVD gateway shall list the entities of its upstream SOVD server together with the entities it hosts.

No Upstream References
status: valid
security: YES
safety: QM
reqtype: Functional
version: 1

The SOVD gateway shall replace references to the API of its upstream SOVD server in forwarded responses, in the Location header and in JSON bodies, with references to its own API.

Unavailable Upstream
status: valid
security: YES
safety: QM

While its upstream SOVD server is unreachable, the SOVD gateway shall keep serving the entities it hosts and shall answer forwarded requests with HTTP 502 and an error that contains no upstream address.

Hosted Entities
status: valid
security: NO
safety: QM

The SOVD gateway shall host the S-CORE platform as a component and every application registered in its process as an app of that component, and shall answer requests below these entities itself, without forwarding them.

Vehicle Lock
status: valid
security: YES
safety: QM
reqtype: Functional
version: 1

The SOVD gateway shall acquire a lock of the whole vehicle from every SOVD server of the vehicle, its upstream SOVD servers and the SOVD server within the gateway itself, answer it with a lock ID of its own, and keep track of the lock until it is released. When an upstream refuses, the SOVD gateway shall send a release for the parts it acquired and answer the refusal. A release shall be sent to all servers holding a part of the lock at the same time, and a part that is already released shall not make a repeated release fail. If a part cannot be released, the SOVD gateway shall answer with that failure. The lock is then held only on the servers that still hold a part of it, until the client repeats the release or the upstream lock expires. The rollback after a refused acquisition is best-effort in the same way.

Discovery Time Limit
status: valid
security: NO
safety: QM
reqtype: Functional
version: 1

When its upstream SOVD server does not answer a discovery request within 5 s, the SOVD gateway shall list the entities it hosts; forwarded requests other than discovery shall have no time limit.

Dot Segments
status: valid
security: YES
safety: QM
reqtype: Functional
version: 1

The SOVD gateway shall not forward a request whose path contains a . or .. segment, also percent-encoded.

Authentication Before Forwarding
status: invalid
security: YES
safety: QM
reqtype: Functional
version: 1

When authentication is enabled in the SOVD gateway, it shall validate the access token of every request before forwarding the request to an upstream SOVD server, and shall not forward a request whose token is not valid. The v1.0 gateway does not enable authentication, so this requirement is not part of v1.0.

Assumptions of Use (AoU)#

Trusted Network
status: valid
security: YES
safety: QM
reqtype: Non-Functional
version: 1

The integrator shall make the SOVD gateway reachable only from trusted clients, and each upstream SOVD server reachable only from the gateway, as a lock taken on an upstream server directly would not be held on the other servers of the vehicle. The gateway connects to the upstream without TLS.

Verification in OpenSOVD Core#

The tests of this repository are linked to the requirements they verify. Behavior that the gateway takes over from opensovd-extra’s Federation unchanged is also verified by the tests of OpenSOVD Core at commit d296ccd. These do not carry requirement IDs, so they are listed here.