Skip to content

Add HTTP/2 support

Stefan Spettel requested to merge http2_support into develop

Implements issue #9 (closed)

Changes

  • Move API handling code from the impl classes to handler.
  • Use the same handler for HTTP/1 (pistache) and HTTP/2 (nghttp2-asio) class to avoid duplicating code
  • Implemented error handling (wrong routes, parse errors, etc) for HTTP/2
  • Unified where to define the API routes (new class: api_defs.h
  • Some minor improvements (moved HTTP implementations to namespace, 2-3 const references)

Architecture

The architecture allows to completely re-use the logic from the previous handler. We could also apply the same to other NFs (long-term). There is also the potential to move some parts to common (e.g. api_response).

I decided to use Pistache headers in the api_response. While this breaks a bit the abstraction, I really like that they have defined classes for each header type. If we ever go away from pistache, we will need to update this.

Tests

Tested with CURL requests.

Create SM Policy

curl --http2-prior-knowledge -X POST http://host:port/npcf-smpolicycontrol/v1/sm-policies -H 'Content-Type: application/json' -d @test_request.json

test_request.json:

{
    "supi": "imsi-208950000000032", 
    "pduSessionType": "IPV4",
    "pduSessionId": 42,
    "dnn": "default",
    "notificationUri": "not_supported_right_now",
    "sliceInfo": {
        "sst": 222,
        "sd": "123"
    }
}

Get SM Policy

curl --http2-prior-knowledge -X GET http://192.168.70.1:8091/npcf-smpolicycontrol/v1/sm-policies/1

Update SM Policy

curl --http2-prior-knowledge -i -X POST  http://192.168.70.1:8091/npcf-smpolicycontrol/v1/sm-policies/1/update -H 'Content-Type: application/json' -d '{"repPolicyCtrlReqTriggers": ["UE_IP_CH"], "ipv4Address": "10.20.30.40"}'

Delete SM Policy

curl --http2-prior-knowledge -i -X POST  http://192.168.70.1:8091/npcf-smpolicycontrol/v1/sm-policies/1/delete -H 'Content-Type: application/json' -d '{}'
Edited by Stefan Spettel

Merge request reports