sonata-nfv / tng-portal

The 5GTANGO (web) Portal
Apache License 2.0
1 stars 7 forks source link

[V&V tests/services] Choose the SP and the policy for the test plan execution #441

Closed anapolg closed 5 years ago

anapolg commented 5 years ago

Include a dropdown menu with the list of available SPs for the user so that he/she can choose in which SP the test must be executed. This parameter is optional and will be requested when creating a test plan from services or tests Portal pages.

@srodriguezOPT The requests made right now to generate test plans from the Portal are: Tests: http://pre-int-vnv-bcn.5gtango.eu:32002/api/v3/tests/plans/tests?confirmRequired=${ confirmRequired }&testUuid=${ uuid } Services: http://pre-int-vnv-bcn.5gtango.eu:32002/api/v3/tests/plans/services?confirmRequired=${ confirmRequired }&serviceUuid=${ uuid }

They should both include the sp_name as another URL parameter. Like this the test plans will be related to one SP every time they are executed. If the user needs to change the SP chosen, he/she must create a new test plan.

Also, include in the same step an input text field to insert the execution_host (optional). This field must check that the data introduces matches with an IP.

cc @jbonnet @juanlucruz @felipevicens

jbonnet commented 5 years ago

@anapolg so you still need #63, right?

jbonnet commented 5 years ago

...and no drop-down when there's only one instance running, right?

anapolg commented 5 years ago

I would need https://github.com/sonata-nfv/tng-gtk-vnv/issues/63, yes.

When there is no SP (no SP retrieved: endpoint error or something) or just one I can ignore the dropdown step and continue with the flow as it is right now.

santiagordguez commented 5 years ago

@anapolg, @tblanco219 totally agree. The generated test plan only can be reused in the same SP. If a new platform needs to be selected, user needs to generate a new test plan with the updated flows:

anapolg commented 5 years ago

Related to https://git.cs.upb.de/5gtango/UserStories/issues/543 I will also need to introduce the policy UUID in this request.

Portal will need an endpoint or something to GET the possible policies for the user to choose. Otherwise the user would have to include the UUID manually as a text input.

anapolg commented 5 years ago

Fetch policies from the chosen SP. When the SP is selected do the request to GET the policies. If error or none, continue with the test plan generation normally.

anapolg commented 5 years ago

Request to GET the platforms: http://int-vnv.5gtango.eu/api/v3/settings/platforms Response:

[
{
"name": "osm",
"host": "http://172.31.8.163",
"type": "osm",
"username": "admin",
"password": "admin",
"project_name": "admin",
"vim_account": "openstack",
"service_token": "service_token",
"monitoring_urls": "http://son-vnv-monitor-manager:8000/api/v2/services"
},
{
"name": "sta-sp-ave",
"host": "http://172.31.8.180",
"type": "sonata",
"username": "admin",
"password": "admin",
"project_name": "admin",
"vim_account": "admin",
"service_token": "service_token",
"monitoring_urls": "http://son-vnv-monitor-manager:8000/api/v2/services"
}
]

cc @jbonnet

anapolg commented 5 years ago

Fetch the policies

http pre-int-vnv-bcn.5gtango.eu:5001/adapters/policies

(tng-vnv-platform-adapter)

it is a list of dicts

[
  {platform_name: XXX, policies; [xxxxx] }, 
  {platform_name: XXX, policies; [xxxxx] }
]

cc @jbonnet

anapolg commented 5 years ago

Since Comm pilot is only interested in selecting the policy (and not the SP) and we have the request that returns list of all the policies for all the SPs I suggest:

Please tell me if you agree @jbonnet @felipevicens , or if otherwise, the SP is required for something else in the V&V and it has to be there as an option for the user.

cc @DanielVilaFalcon

jbonnet commented 5 years ago

@anapolg For me it's ok... so, would something like

GET .../api/v3/test/plans/policies

be ok for the external (i.e., visible from the Portal) endpoint?

anapolg commented 5 years ago

Fine for me. Let's wait for @felipevicens to see if the purposed solution is fine with him.

felipevicens commented 5 years ago

hey! for me is ok!, policies will have the same format you are getting now in the SP so you can reuse the code to get the fields you need it

anapolg commented 5 years ago
$ http pre-int-vnv-bcn.5gtango.eu:32002/api/v3/tests/plans/policies
HTTP/1.1 200 OK
Content-Length: 5029
X-Timing: 12.653427399
access-control-allow-methods: GET,PUT,POST,DELETE,OPTIONS,PATCH
access-control-allow-origin: *
content-type: application/json
date: Thu, 31 Oct 2019 09:43:54 GMT
server: Werkzeug/0.15.5 Python/3.6.7

[
    {
        "platform_name": "qual-sp-bcn",
        "policies": [
            {
                "created_at": "2019-09-30T15:05:01.046+00:00",
                "default_policy": true,
                "enforced": true,
                "md5": "c5c6d24de55e2875bacbdfdfa6db9454",
                "ns_uuid": "87ee692a-fb00-4a3b-899e-05e47c38dc80",
                "pld": {
                    "descriptor_schema": "https://raw.githubusercontent.com/sonata-nfv/tng-schema/master/policy-descriptor/policy-schema.yml",
                    "monitoring_rules": [
                        {
                            "condition": "sippoServerSessions",
                            "description": "Trigger events if sippoServerSessions is greater than 4.",
                            "duration": 10,
                            "duration_unit": "s",
                            "name": "wac-vnf:vdu01:sippoServerSessions:greater4",
                            "threshold": " < 4"
                        }
                    ],
                    "name": "ns-communication-pilot-service-sample-policy",
                    "network_service": {
                        "name": "communication-pilot",
                        "vendor": "quobis",
                        "version": "0.5"
                    },
                    "policyRules": [
                        {
                            "actions": [
                                {
                                    "action_object": "ElasticityAction",
                                    "action_type": "ScalingType",
                                    "name": "addvnf",
                                    "target": {
                                        "name": "wac-vnf",
                                        "vendor": "quobis",
                                        "version": "0.6"
                                    },
                                    "value": "1"
                                }
                            ],
                            "conditions": {
                                "condition": "AND",
                                "rules": [
                                    {
                                        "field": "wac-vnf.LogMetric",
                                        "id": "wac-vnf.LogMetric",
                                        "input": "text",
                                        "operator": "equal",
                                        "type": "string",
                                        "value": "wac_vnf_vdu01_sippoServerSessions_greater4"
                                    }
                                ]
                            },
                            "inertia": {
                                "duration_unit": "m",
                                "value": 30
                            },
                            "name": "ElasticityRuleScaleOut",
                            "salience": 1
                        }
                    ],
                    "vendor": "quobis",
                    "version": "0.5"
                },
                "signature": null,
                "sla_id": "31731e3a-3a57-4a0b-a167-f5fee72206fd",
                "sla_name": "comm-pilot-SLA",
                "status": "active",
                "updated_at": "2019-09-30T15:05:01.046+00:00",
                "username": null,
                "uuid": "d0b105a6-b178-491b-9511-f77e62dc569c"
            },
  …
anapolg commented 5 years ago

Hi @jbonnet I am doing this request to GET the policies available for the test plans (as agreed above) and it is failing. Any idea? Wasn't this implemented already? I though that... maybe I am wrong

REQUEST: GET http://pre-int-vnv-bcn.5gtango.eu:32002/api/v3/tests/plans/policies

image

image

jbonnet commented 5 years ago

@anapolg, check here: https://github.com/sonata-nfv/tng-api-gtw/blob/master/tng-router/config/vnv_routes.yml#L75, it is there. Can you reach the inner URL, http://tng-vnv-platform-adapter:5001/adapters/policies?

CC @fjvicens

anapolg commented 5 years ago

No, I can not.

felipevicens commented 5 years ago

A PR overlaped the routes created to support the policies. I'm merging it now so please try again.

anapolg commented 5 years ago

Also included input text box to select the host where it should be executed.