VNF records usage - sonata-nfv/tng-rep GitHub Wiki

This page details the VNF Records API.

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

/vnfrs

GET

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

Options:

  • ?output=yaml or
  • ?output=json

Content-type can be:

  • Content-type:application/json

  • Content-type:application/x-yaml

  • Request:

curl -X GET -H "Content-type:application/json" <base URL>/vnfrs
  • Response:
[
   {
      "created_at":"2018-02-26T17:58:51.758+00:00",
      "descriptor_version":"i0ocAa",
      "status":"normal operation",
      "updated_at":"2018-02-26T17:58:51.758+00:00",
      "virtual_deployment_units":[
         {
            "id":"nostrud in",
            "resource_requirements":{
               "cpu":{
                  "vcpus":44612128
               },
               "memory":{
                  "size":80183833
               }
            }
         },
         {
            "id":"eu dolore nisi incididunt",
            "resource_requirements":{
               "cpu":{
                  "vcpus":2304668
               },
               "memory":{
                  "size":8962376
               }
            },
            "vdu_reference":"pariatur"
         },
         {
            "id":"commodo dolor nostrud",
            "resource_requirements":{
               "cpu":{
                  "vcpus":50962880
               },
               "memory":{
                  "size":91724292
               },
               "network":{
                  "data_processing_acceleration_library":"adipisicing tempor ut in in"
               },
               "hypervisor_parameters":{
                  "type":"qui laboris enim in",
                  "version":"4920.305.4"
               }
            }
         },
         {
            "id":"in non sint",
            "resource_requirements":{
               "cpu":{
                  "vcpus":82258996,
                  "cpu_support_accelerator":"non ea irure"
               },
               "memory":{
                  "size":89557457,
                  "numa_allocation_policy":"sint Duis voluptate consectetur"
               }
            },
            "number_of_instances":34083178
         }
      ],
      "uuid":"1b5bab2a-8286-2b40-4827-dc5d6e37bf8e"
   }
]

POST

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

  • Request:
curl -X POST -H "Content-type:application/json" --data-binary @spec/fixtures/vnfr-example.json <base URL>/vnfrs
  • Response:
{
   "created_at":"2018-02-26T17:58:51.758+00:00",
   "descriptor_version":"i0ocAa",
   "status":"normal operation",
   "updated_at":"2018-02-26T17:58:51.758+00:00",
   "virtual_deployment_units":[
      {
         "id":"nostrud in",
         "resource_requirements":{
            "cpu":{
               "vcpus":44612128
            },
            "memory":{
               "size":80183833
            }
         }
      },
      {
         "id":"eu dolore nisi incididunt",
         "resource_requirements":{
            "cpu":{
               "vcpus":2304668
            },
            "memory":{
               "size":8962376
            }
         },
         "vdu_reference":"pariatur"
      },
      {
         "id":"commodo dolor nostrud",
         "resource_requirements":{
            "cpu":{
               "vcpus":50962880
            },
            "memory":{
               "size":91724292
            },
            "network":{
               "data_processing_acceleration_library":"adipisicing tempor ut in in"
            },
            "hypervisor_parameters":{
               "type":"qui laboris enim in",
               "version":"4920.305.4"
            }
         }
      },
      {
         "id":"in non sint",
         "resource_requirements":{
            "cpu":{
               "vcpus":82258996,
               "cpu_support_accelerator":"non ea irure"
            },
            "memory":{
               "size":89557457,
               "numa_allocation_policy":"sint Duis voluptate consectetur"
            }
         },
         "number_of_instances":34083178
      }
   ],
   "uuid":"1b5bab2a-8286-2b40-4827-dc5d6e37bf8e"
}

/vnfrs/:<vnf_instance_uuid>

GET

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

  • Request:
curl -X GET -H "Content-type:application/json" <base URL>/vnfrs/<vnf_instance_uuid>
  • Response:
{
   "created_at":"2018-02-26T17:58:51.758+00:00",
   "descriptor_version":"i0ocAa",
   "status":"normal operation",
   "updated_at":"2018-02-26T17:58:51.758+00:00",
   "virtual_deployment_units":[
      {
         "id":"nostrud in",
         "resource_requirements":{
            "cpu":{
               "vcpus":44612128
            },
            "memory":{
               "size":80183833
            }
         }
      },
      {
         "id":"eu dolore nisi incididunt",
         "resource_requirements":{
            "cpu":{
               "vcpus":2304668
            },
            "memory":{
               "size":8962376
            }
         },
         "vdu_reference":"pariatur"
      },
      {
         "id":"commodo dolor nostrud",
         "resource_requirements":{
            "cpu":{
               "vcpus":50962880
            },
            "memory":{
               "size":91724292
            },
            "network":{
               "data_processing_acceleration_library":"adipisicing tempor ut in in"
            },
            "hypervisor_parameters":{
               "type":"qui laboris enim in",
               "version":"4920.305.4"
            }
         }
      },
      {
         "id":"in non sint",
         "resource_requirements":{
            "cpu":{
               "vcpus":82258996,
               "cpu_support_accelerator":"non ea irure"
            },
            "memory":{
               "size":89557457,
               "numa_allocation_policy":"sint Duis voluptate consectetur"
            }
         },
         "number_of_instances":34083178
      }
   ],
   "uuid":"1b5bab2a-8286-2b40-4827-dc5d6e37bf8e"
}

PUT

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

  • Request:
curl -X PUT -H "Content-type:application/json" <base URL>/records/nsr/ns-instances/<vnf_instance_uuid> -d '{"id":<vnfr uuid>,"descriptor_version":<latest vnf descriptor version>,"status":<vnfr status>,"virtual_deployment_unit":["id":<vdu_id>,"<field_to_be_updated>":<value>]}'
  • Example:
curl -X PUT -H "Content-type:application/json" localhost:4011/vnfrs/1b5bab2a-8286-2b40-4827-dc5d6e37bf8e -d '{"id":"1b5bab2a-8286-2b40-4827-dc5d6e37bf8e","descriptor_version":"i0ocAa","status":"normal operation","virtual_deployment_units":[{"id":"nostrud in","resource_requirements":{"cpu":{"vcpus":44612128},"memory":{"size":80183833}}}]}'
  • Response:
{
   "id":"1b5bab2a-8286-2b40-4827-dc5d6e37bf8e",
   "descriptor_version":"i0ocAa",
   "status":"normal operation",
   "virtual_deployment_units":[
      {
         "id":"nostrud in",
         "resource_requirements":{
            "cpu":{
               "vcpus":44612128
            },
            "memory":{
               "size":80183833
            }
         }
      }
   ]
}

DELETE

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

curl -X DELETE <base URL>/vnfrs/<vnf_instance_uuid>

Response:

  • Headers:
    • Status: 200 OK
  • body: "OK: vnfr removed"

/vnfrs/pings

GET

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

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