-
Notifications
You must be signed in to change notification settings - Fork 4
Policy Manager Quick guide via CURL requests
In order to be able to test the following curl requests, make sure that you have completed all steps described at the quick guide of how to use service platform .
Following curl requests refer to the ns-squid-haproxy network service with version 0.2, that has to be available at the Service Platform.
Action | HTTP Method | Endpoint |
---|---|---|
Create a Runtime Policy | POST |
/api/v1 |
POST body can be also found here
curl -X POST \ http://int-sp-ath.5gtango.eu:8081/api/v1 \ -H 'content-type: application/json' \ -d '{ "descriptor_schema": "https://raw.githubusercontent.com/sonata-nfv/tng-schema/master/policy-descriptor/policy-schema.yml", "name": "ns-squid-haproxy-Elasticity-Policy-Premium", "vendor": "eu.5gtango", "version": "0.1", "network_service": { "vendor": "eu.5gtango", "name": "ns-squid-haproxy", "version": "0.2" }, "monitoring_rules": [ { "name": "haproxy-vnf:vdu01:haproxy_backend_sespsrv:more150", "description": "Trigger events if haproxy number of the active sessions per squid server are more than 150.", "duration": 20, "duration_unit": "s", "condition": "haproxy_backend_sespsrv", "threshold": " > 150" }, { "name": "haproxy-vnf:vdu01:haproxy_backend_sespsrv:less30", "description": "Trigger events if haproxy number of the active sessions per squid server are less than 30.", "duration": 1, "duration_unit": "m", "condition": "haproxy_backend_sespsrv", "threshold": " < 30" }, { "name": "haproxy-vnf:vdu01:haproxy_backend_actsrvs:more1", "description": "Trigger events if haproxy number of the squid servers which are in active state are more than 1.", "duration": 1, "duration_unit": "m", "condition": "haproxy_backend_actsrvs", "threshold": " > 1" } ], "policyRules": [{ "name": "ElasticityRuleScaleOut", "salience": 1, "inertia": { "value": 30, "duration_unit": "m" }, "conditions": { "condition": "AND", "rules": [{ "id": "haproxy-vnf.LogMetric", "field": "haproxy-vnf.LogMetric", "type": "string", "input": "text", "operator": "equal", "value": "haproxy_vnf_vdu01_haproxy_backend_sespsrv_more150" }] }, "actions": [{ "action_object": "ElasticityAction", "action_type": "ScalingType", "name": "addvnf", "value": "1", "target": { "name": "squid-vnf", "vendor": "eu.5gtango", "version": "0.1" } }] }, { "name": "ElasticityRuleScaleIn", "salience": 1, "inertia": { "value": 30, "duration_unit": "m" }, "conditions": { "condition": "AND", "rules": [{ "id": "haproxy-vnf.LogMetric", "field": "haproxy-vnf.LogMetric", "type": "string", "input": "text", "operator": "equal", "value": "haproxy_vnf_vdu01_haproxy_backend_sespsrv_less30" }, { "id": "haproxy-vnf.LogMetric", "field": "haproxy-vnf.LogMetric", "type": "string", "input": "text", "operator": "equal", "value": "haproxy_vnf_vdu01_haproxy_backend_actsrvs_more1" } ] }, "actions": [{ "action_object": "ElasticityAction", "action_type": "ScalingType", "name": "removevnf", "value": "1", "criterion": "random", "target": { "name": "squid-vnf", "vendor": "eu.5gtango", "version": "0.2" } }] }] }'
Action | HTTP Method | Endpoint |
---|---|---|
Bind a Runtime Policy to an SLA | PATCH |
/api/v1/bind/{policy_uuid} |
curl -X PATCH \ http://int-sp-ath.5gtango.eu:8081/api/v1/bind/0d544d12-7eba-4fdf-a6a5-159930ccffa8 \ -H 'content-type: application/json' \ -d '{ "slaid":"d596b839-b17a-42a2-9ca9-e0211c8870e4", "nsid":"689da7eb-5f24-4378-b814-c85917a54390" }'
Action | HTTP Method | Endpoint |
---|---|---|
Define a Runtime Policy as default | PATCH |
/api/v1/default/{policy_uuid} |
curl -X PATCH \ http://int-sp-ath.5gtango.eu:8081/api/v1/default/098e257e-fd31-4347-8fb9-908d53ef6553 \ -H 'content-type: application/json' \ -d '{ "defaultPolicy":true, "nsid":"c2dfff38-9650-42a9-a283-9b80c44a5fe2" }'
Action | HTTP Method | Endpoint |
---|---|---|
Delete a Runtime Policy | DELETE |
/api/v1/{policy_uuid} |
curl -X DELETE \ http://int-sp-ath.5gtango.eu:8081/api/v1/6a72ddc9-36e5-4055-8c58-d691b39d4cc6