-
Notifications
You must be signed in to change notification settings - Fork 18
Functions usage
This page details the Function-related endpoints of the SONATA Gatekeeper API.
Please note that functions are created, updated or deleted only when a package containing them is created, updated or deleted.
Through this endpoint GET request, the Gatekeeper returns a JSON formatted paginated list of functions meta-data.
- Request:
curl <base URL>/functions -H 'authorization:bearer <token>'
Like Packages, Functions are univocally identified by the trio of fields vendor, name and version, which is unique, besides the UUID.
- Response:
[
{
"created_at": "2017-08-28T15:23:31.653+00:00",
"md5": "add46509964fb841584777155ac06bdd",
"signature": null,
"status": "active",
"updated_at": "2017-08-28T15:23:31.653+00:00",
"user_licence": "public",
"username": "sonata-1503933806",
"uuid": "39cfccd6-9475-4e99-aa88-9a2066ac3976",
"vnfd": {
"author": "George Xilouris, NCSRD",
"connection_points": [
{
"id": "mgmt",
"interface": "ipv4",
"type": "management"
},
{
"id": "input",
"interface": "ipv4",
"type": "external"
},
{
"id": "output",
"interface": "ipv4",
"type": "external"
}
],
"description": "\"Virtual traffic classifier (vTC) descriptor file. vTC uses ndpi library for the implementation of the vTC\"\n",
"descriptor_version": "vnfd-schema-01",
"monitoring_rules": [
{
"condition": "vdu01:vm_cpu_perc > 85",
"description": "Trigger events if CPU load is above 85 percent.",
"duration": 10,
"duration_unit": "s",
"name": "mon:rule:vm_cpu_usage_85_perc",
"notification": [
{
"name": "notification01",
"type": "rabbitmq_message"
}
]
}
],
"name": "vtc-vnf",
"vendor": "eu.sonata-nfv",
"version": "0.1",
"virtual_deployment_units": [
{
"connection_points": [
{
"id": "eth0",
"interface": "ipv4",
"type": "management"
},
{
"id": "eth1",
"interface": "ipv4",
"type": "internal"
},
{
"id": "eth2",
"interface": "ipv4",
"type": "internal"
}
],
"description": "VNFC for the dashboard and the time-series database",
"id": "vdu01",
"monitoring_parameters": [
{
"name": "vm_cpu_perc",
"unit": "Percentage"
},
{
"name": "vm_mem_perc",
"unit": "Percentage"
},
{
"name": "vm_net_rx_bps",
"unit": "bps"
},
{
"name": "vm_net_tx_bps",
"unit": "bps"
}
],
"resource_requirements": {
"cpu": {
"vcpus": 1
},
"memory": {
"size": 2,
"size_unit": "GB"
},
"storage": {
"size": 40,
"size_unit": "GB"
}
},
"vm_image": "sonata-vtc",
"vm_image_format": "qcow2"
}
],
"virtual_links": [
{
"connection_points_reference": [
"vdu01:eth0",
"mgmt"
],
"connectivity_type": "E-LAN",
"dhcp": true,
"id": "mgmt"
},
{
"connection_points_reference": [
"vdu01:eth1",
"input"
],
"connectivity_type": "E-Line",
"dhcp": true,
"id": "input"
},
{
"connection_points_reference": [
"vdu01:eth2",
"output"
],
"connectivity_type": "E-Line",
"dhcp": true,
"id": "output"
}
]
}
}
]
Through this endpoint GET request, the Gatekeeper returns a JSON formatted function meta-data.
- Request:
curl <base URL>/functions/<function_uuid> -H 'authorization:bearer <token>'
Like Packages, Functions are univocally identified by the trio of fields vendor, name and version, which is unique, besides the UUID.
- Response:
{
"created_at": "2017-08-28T15:23:31.653+00:00",
"md5": "add46509964fb841584777155ac06bdd",
"signature": null,
"status": "active",
"updated_at": "2017-08-28T15:23:31.653+00:00",
"username": "sonata-1503933806",
"uuid": "39cfccd6-9475-4e99-aa88-9a2066ac3976",
"vnfd": {
"author": "George Xilouris, NCSRD",
"connection_points": [
{
"id": "mgmt",
"interface": "ipv4",
"type": "management"
},
{
"id": "input",
"interface": "ipv4",
"type": "external"
},
{
"id": "output",
"interface": "ipv4",
"type": "external"
}
],
"description": "\"Virtual traffic classifier (vTC) descriptor file. vTC uses ndpi library for the implementation of the vTC\"\n",
"descriptor_version": "vnfd-schema-01",
"monitoring_rules": [
{
"condition": "vdu01:vm_cpu_perc > 85",
"description": "Trigger events if CPU load is above 85 percent.",
"duration": 10,
"duration_unit": "s",
"name": "mon:rule:vm_cpu_usage_85_perc",
"notification": [
{
"name": "notification01",
"type": "rabbitmq_message"
}
]
}
],
"name": "vtc-vnf",
"vendor": "eu.sonata-nfv",
"version": "0.1",
"virtual_deployment_units": [
{
"connection_points": [
{
"id": "eth0",
"interface": "ipv4",
"type": "management"
},
{
"id": "eth1",
"interface": "ipv4",
"type": "internal"
},
{
"id": "eth2",
"interface": "ipv4",
"type": "internal"
}
],
"description": "VNFC for the dashboard and the time-series database",
"id": "vdu01",
"monitoring_parameters": [
{
"name": "vm_cpu_perc",
"unit": "Percentage"
},
{
"name": "vm_mem_perc",
"unit": "Percentage"
},
{
"name": "vm_net_rx_bps",
"unit": "bps"
},
{
"name": "vm_net_tx_bps",
"unit": "bps"
}
],
"resource_requirements": {
"cpu": {
"vcpus": 1
},
"memory": {
"size": 2,
"size_unit": "GB"
},
"storage": {
"size": 40,
"size_unit": "GB"
}
},
"vm_image": "sonata-vtc",
"vm_image_format": "qcow2"
}
],
"virtual_links": [
{
"connection_points_reference": [
"vdu01:eth0",
"mgmt"
],
"connectivity_type": "E-LAN",
"dhcp": true,
"id": "mgmt"
},
{
"connection_points_reference": [
"vdu01:eth1",
"input"
],
"connectivity_type": "E-Line",
"dhcp": true,
"id": "input"
},
{
"connection_points_reference": [
"vdu01:eth2",
"output"
],
"connectivity_type": "E-Line",
"dhcp": true,
"id": "output"
}
]
}
}
Through this endpoint GET request, the Gatekeeper returns a JSON formatted monitoring data, according to the filtering mandatory parameters:
-
metrics: a comma-separated list of metric names; -
since: the starting date of the metrics collection; -
until: the ending date of the metrics collection; -
step: the step to be used, in seconds, in the metrics' collection. -
Request:
curl <base URL>/functions/<function instance uuid>/<vdu id>/<vc uuid>/asynch-mon-data/metrics=<metric name>&since=<starting date>&until=<ending date>&step=<step of collection> \
-H 'authorization:bearer <token>'
- Response:
{:status=>nil, :function_instance_uuid=>"e60558d6-91c3-4196-abad-46079a0e3c61", :vdu_id=>"vdu01", :vc_uuid=>"fa8869e3-cc5f-4a5e-8520-932226d804e1", :metrics=>["vm_cpu_perc"], :requested_data=>[{:metrics=>{:resultType=>"matrix", :result=>[{:metric=>{:exported_instance=>"vtc-vnf", :core=>"cpu", :group=>"development", :exported_job=>"vnf", :instance=>"pushgateway:9091", :job=>"sonata", :__name__=>"vm_cpu_perc", :id=>"fa8869e3-cc5f-4a5e-8520-932226d804e1"}, :values=>[[1504011287, "0"], [1504011301, "0"], [1504011315, "0"], [1504011329, "0"], [1504011343, "0"], [1504011357, "0"], [1504011371, "0"], [1504011385, "0"], [1504011399, "0"], [1504011413, "0"], [1504011427, "0.99"], [1504011441, "0.99"], [1504011455, "0.99"], [1504011469, "1"], [1504011483, "1"], [1504011497, "1"], [1504011511, "1"], [1504011525, "0"], [1504011539, "0"], [1504011553, "0"], [1504011567, "0"], [1504011581, "0"], [1504011595, "0"], [1504011609, "0"], [1504011623, "0"], [1504011637, "0"], [1504011651, "0"], [1504011665, "0"], [1504011679, "0"], [1504011693, "1"], [1504011707, "1"], [1504011721, "1"], [1504011735, "1"], [1504011749, "0"], [1504011763, "0"], [1504011777, "0"], [1504011791, "0"], [1504011805, "0"], [1504011819, "0"], [1504011833, "0"], [1504011847, "0"], [1504011861, "0"], [1504011875, "0"], [1504011889, "0"], [1504011903, "0.99"], [1504011917, "0.99"], [1504011931, "0.99"], [1504011945, "0.99"], [1504011959, "1.98"], [1504011973, "1.98"], [1504011987, "1.98"], [1504012001, "1.98"], [1504012015, "1.98"], [1504012029, "1.98"], [1504012043, "1.98"], [1504012057, "1.98"], [1504012071, "0"], [1504012085, "0"], [1504012099, "0.99"], [1504012113, "0"], [1504012127, "0.99"], [1504012141, "0"], [1504012155, "1"], [1504012169, "0"], [1504012183, "1"], [1504012197, "0"], [1504012211, "0"], [1504012225, "0"], [1504012239, "0"], [1504012253, "0"], [1504012267, "0"], [1504012281, "0"]]}, {:metric=>{:exported_instance=>"vtc-vnf", :core=>"cpu0", :group=>"development", :exported_job=>"vnf", :instance=>"pushgateway:9091", :job=>"sonata", :__name__=>"vm_cpu_perc", :id=>"fa8869e3-cc5f-4a5e-8520-932226d804e1"}, :values=>[[1504011287, "0"], [1504011301, "0"], [1504011315, "0"], [1504011329, "0"], [1504011343, "0"], [1504011357, "0"], [1504011371, "0"], [1504011385, "0"], [1504011399, "0"], [1504011413, "0"], [1504011427, "0.99"], [1504011441, "0.99"], [1504011455, "0.99"], [1504011469, "1"], [1504011483, "1"], [1504011497, "1"], [1504011511, "1"], [1504011525, "0"], [1504011539, "0"], [1504011553, "0"], [1504011567, "0"], [1504011581, "0"], [1504011595, "0"], [1504011609, "0"], [1504011623, "0"], [1504011637, "0"], [1504011651, "0"], [1504011665, "0"], [1504011679, "0"], [1504011693, "1"], [1504011707, "1"], [1504011721, "1"], [1504011735, "1"], [1504011749, "0"], [1504011763, "0"], [1504011777, "0"], [1504011791, "0"], [1504011805, "0"], [1504011819, "0"], [1504011833, "0"], [1504011847, "0"], [1504011861, "0"], [1504011875, "0"], [1504011889, "0"], [1504011903, "0.99"], [1504011917, "0.99"], [1504011931, "0.99"], [1504011945, "0.99"], [1504011959, "1.98"], [1504011973, "1.98"], [1504011987, "1.98"], [1504012001, "1.98"], [1504012015, "1.98"], [1504012029, "1.98"], [1504012043, "1.98"], [1504012057, "1.98"], [1504012071, "0"], [1504012085, "0"], [1504012099, "0.99"], [1504012113, "0"], [1504012127, "0.99"], [1504012141, "0"], [1504012155, "1"], [1504012169, "0"], [1504012183, "1"], [1504012197, "0"], [1504012211, "0"], [1504012225, "0"], [1504012239, "0"], [1504012253, "0"], [1504012267, "0"], [1504012281, "0"]]}]}}]}
Through this endpoint GET request, the Gatekeeper returns a Web Socket URL, through which the client can get the monitoring data, according to the filtering mandatory parameters:
-
metrics: a comma-separated list of metric names; -
since: the starting date of the metrics collection; -
until: the ending date of the metrics collection; -
step: the step to be used, in seconds, in the metrics' collection. -
Request:
curl <base URL>/functions/<function instance uuid>/<vdu id>/<vc uuid>/synch-mon-data/metrics=<metric name>&since=<starting date>&until=<ending date>&step=<step of collection> \
-H 'authorization:bearer <token>'
- Response: