Release image version 1.12.2
[testsuite.git] / robot / resources / vvp_validation.robot
1 *** Settings ***
2 Documentation     The main interface for interacting with SDC. It handles low level stuff like managing the http request library and DCAE required fields
3 Library           OperatingSystem
4 Library           ONAPLibrary.SO    WITH NAME    SO
5 Library           ONAPLibrary.HeatVNFValidation    WITH NAME    HeatVNFValidation
6 Library           ONAPLibrary.VVPValidation.HeatValidationScripts    WITH NAME    VVPValidation
7
8 *** Variables ***
9 ${CLOUD_CONFIG_PATH}        /cloudSite
10
11 *** Keywords ***
12 Run VVP Validation Scripts
13     [Documentation]   Creates virtualenv and clones VVP scripts to build_dir, executes VVP validation scripts against a template directory, results stored in output directory.
14     [Arguments]    ${build_dir}    ${heat_template_directory}    ${output_directory}
15
16     VVPValidation.validate    ${build_dir}    ${heat_template_directory}    ${output_directory}
17
18 Run VNF Instantiation Report
19     [Documentation]   Validates that a stack was created correctly, used for OVP portal submission.
20     [Arguments]    ${region_id}    ${vnf_details}    ${os_password}    ${vnf_name}
21     ${auth}=  Create List  ${GLOBAL_SO_CATDB_USERNAME}    ${GLOBAL_SO_PASSWORD}
22     ${get_resp}=    SO.Run Get Request    ${GLOBAL_SO_CATDB_ENDPOINT}    ${CLOUD_CONFIG_PATH}/${region_id}   auth=${auth}
23
24     ${object}=      Evaluate    json.loads('''${get_resp.text}''')     json
25     ${auth_url} =    Set Variable    ${object["identityService"]["identity_url"]}
26     ${user_id} =    Set Variable    ${object["identityService"]["mso_id"]}
27     ${region_id} =    Set Variable    ${object["region_id"]}
28     ${tenant_id} =    Set Variable    ${object["identityService"]["admin_tenant"]}
29     ${identity_server_type}=    Set Variable    ${object["identityService"]["identity_server_type"]}
30     ${identity_server_type}=    Set Variable If    '${identity_server_type}' == 'KEYSTONE_V3'    v3    v2.0
31
32     Set Global Variable    ${GLOBAL_INJECTED_OPENSTACK_KEYSTONE_API_VERSION}    ${identity_server_type}
33     Set Global Variable    ${GLOBAL_INJECTED_KEYSTONE}    ${auth_url}
34     Set Global Variable    ${GLOBAL_INJECTED_OPENSTACK_PROJECT_NAME}    ${tenant_id}
35
36     Run Openstack Auth Request    mytest    username=${user_id}    password=${os_password}
37
38     ${token}=      Get Openstack Token      mytest
39     ${orchestration_url}=    Get Openstack Service Url    mytest    orchestration
40
41     ${report}=    HeatVNFValidation.validate    ${orchestration_url}    ${token}    ${vnf_details}    ${vnf_name}
42
43     ${status}=    Get From Dictionary    ${report}    summary
44
45     ${json_string}=    evaluate    json.dumps(${report}, indent=4)    json
46     OperatingSystem.Create File    ${OUTPUTDIR}/summary/stack_report.json    content=${json_string}
47
48     Run Keyword If    '${status}' == 'FAILED'    Fail    Stack Validation Failed
49     [Return]    ${report}