Add csit for vnfres
[integration/csit.git] / tests / vfc / gvnfm-vnfres / test.robot
1 *** settings ***
2 Library     Collections
3 Library     RequestsLibrary
4 Library     OperatingSystem
5 Library     json
6
7 *** Variables ***
8 @{return_ok_list}=   200  201  202
9 ${queryswagger_url}    /api/vnfres/v1/swagger.json
10 ${healthcheck_url}   /api/vnfres/v1/health_check
11
12 *** Test Cases ***
13 VnfresSwaggerTest
14     [Documentation]    query vnfres swagger info rest test
15     ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
16     Create Session    web_session    http://${VNFRES_IP}:8802    headers=${headers}
17     ${resp}=  Get Request    web_session    ${queryswagger_url}
18     ${responese_code}=     Convert To String      ${resp.status_code}
19     List Should Contain Value    ${return_ok_list}   ${responese_code}
20     ${response_json}    json.loads    ${resp.content}
21     ${swagger_version}=    Convert To String      ${response_json['swagger']}
22     Should Be Equal    ${swagger_version}    2.0
23
24 VnfResHealthCheckTest
25     [Documentation]    check health for vnfres by MSB
26     ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
27     Create Session    web_session    http://${VNFRES_IP}:8802    headers=${headers}
28     ${resp}=  Get Request    web_session    ${healthcheck_url}
29     ${responese_code}=     Convert To String      ${resp.status_code}
30     List Should Contain Value    ${return_ok_list}   ${responese_code}
31     ${response_json}    json.loads    ${resp.content}
32     ${health_status}=    Convert To String      ${response_json['status']}
33     Should Be Equal    ${health_status}    active