Network services records usage - sonata-nfv/tng-rep GitHub Wiki

This page details the Network Service Records API.

Records are created or updated as a consequence of service instantiation, which creates or updates one record per each service and function instance.

/nsrs

GET

Through this endpoint GET request, the Records returns a JSON formatted paginated list of service records.

  • Request:
curl -X GET -H "Content-type:application/json" <base URL>/nsrs
  • Response:
[
    {
        "created_at": "2018-02-26T16:27:55.863+00:00",
        "descriptor_version": "u1XvQWLbFaQQn.X8rBMr9pRwJSAZy5WhBFy8_OUt9-SzGOAR.490Oc4Ns.XtUN_8QhIJ6VXKbXza.TdAy08kC4",
        "status": "normal operation",
        "updated_at": "2018-02-26T16:27:55.863+00:00",
        "uuid": "32adeb1e-d981-16ec-dc44-e288e80067a1",
        "version": "1"
    }
]

POST

Through this endpoint POST request, the Records store a JSON of service record.

  • Request:
curl -X POST -H "Content-type:application/json" --data-binary @spec/fixtures/nsr-example.json <base URL>/nsrs
  • Response:
{
   "created_at":"2018-02-26T16:27:55.863+00:00",
   "descriptor_version":"u1XvQWLbFaQQn.X8rBMr9pRwJSAZy5WhBFy8_OUt9-SzGOAR.490Oc4Ns.XtUN_8QhIJ6VXKbXza.TdAy08kC4",
   "status":"normal operation",
   "updated_at":"2018-02-26T16:27:55.863+00:00",
   "version":"1",
   "uuid":"32adeb1e-d981-16ec-dc44-e288e80067a1"
}

/nsrs/:<service_instance_uuid>

GET

Through this endpoint GET request, the Records returns a JSON of service record requested.

  • Request:
curl -X GET -H "Content-type:application/json" <base URL>/nsrs/<service_instance_uuid>
  • Response:
[
    {
        "created_at": "2018-02-26T16:27:55.863+00:00",
        "descriptor_version": "u1XvQWLbFaQQn.X8rBMr9pRwJSAZy5WhBFy8_OUt9-SzGOAR.490Oc4Ns.XtUN_8QhIJ6VXKbXza.TdAy08kC4",
        "status": "normal operation",
        "updated_at": "2018-02-26T16:27:55.863+00:00",
        "uuid": "32adeb1e-d981-16ec-dc44-e288e80067a1",
        "version": "1"
    }
]

PUT

Through this endpoint GET request, the Records sent as JSON of service record will be updated.

  • Request:
curl -X PUT -H "Content-type:application/json" <base URL>/nsrs/<service_instance_uuid> -d '{"id":<service uuid>,"descriptor_version":<latest service descriptor version>,"<field_to_be_updated>":<value>}'
  • Example:
curl -X PUT -H "Content-type:application/json" localhost:4011/nsrs/32adeb1e-d981-16ec-dc44-e288e80067a1 -d '{"status":"terminated","descriptor_version":"u1XvQWLbFaQQn.X8rBMr9pRwJSAZy5WhBFy8_OUt9-SzGOAR.490Oc4Ns.XtUN_8QhIJ6VXKbXza.TdAy08kC4","id":"32adeb1e-d981-16ec-dc44-e288e80067a1"}'
  • Response:
{
   "created_at":"2018-02-26T17:10:03.286+00:00",
   "descriptor_version":"u1XvQWLbFaQQn.X8rBMr9pRwJSAZy5WhBFy8_OUt9-SzGOAR.490Oc4Ns.XtUN_8QhIJ6VXKbXza.TdAy08kC4",
   "status":"terminated",
   "updated_at":"2018-02-26T17:10:03.286+00:00",
   "uuid":"32adeb1e-d981-16ec-dc44-e288e80067a1"
}

DELETE

Through this endpoint DELETE request, the uuid of the Record sent will be deleted.

curl -X DELETE <base URL>/nsrs/<service_instance_uuid>

Response:

  • Headers:
    • Status: 200 OK
    • Content-Type text/html
  • Body:
    • Empty

/nsrs/pings

GET

Through this endpoint GET request, the Records returns a plain text with the message pong and 200OK. It can be used as readiness probe.

  • Request:
curl -X GET <base URL>/nsrs/ping
  • Response:
pong
⚠️ **GitHub.com Fallback** ⚠️