Move CSIT to integration/csit repo
[integration/csit.git] / tests / vfc / nfvo-lcm / test.robot
1 *** settings ***
2 Resource    ../../common.robot
3 Library     Collections
4 Library     RequestsLibrary
5 Library     OperatingSystem
6 Library     json
7 Library     HttpLibrary.HTTP
8
9 *** Variables ***
10 @{return_ok_list}=   200  201  202  204
11 ${queryswagger_url}    /api/nslcm/v1/swagger.json
12 ${create_ns_url}    /api/nslcm/v1/ns
13 ${delete_ns_url}    /api/nslcm/v1/ns
14
15 #json files
16 ${create_ns_json}    ${SCRIPTS}/../tests/vfc/nfvo-lcm/jsoninput/create_ns.json
17
18 #global variables
19 ${nsInstId}
20
21 *** Test Cases ***
22 NslcmSwaggerTest
23     [Documentation]    query swagger info of nslcm
24     ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
25     Create Session    web_session    http://${NSLCM_IP}:8403    headers=${headers}
26     ${resp}=  Get Request    web_session    ${queryswagger_url}
27     ${responese_code}=     Convert To String      ${resp.status_code}
28     List Should Contain Value    ${return_ok_list}   ${responese_code}
29     ${response_json}    json.loads    ${resp.content}
30     ${swagger_version}=    Convert To String      ${response_json['swagger']}
31     Should Be Equal    ${swagger_version}    2.0
32
33 NslcmSwaggerByMSBTest
34     [Documentation]    query swagger info of nslcm by MSB
35     ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
36     Create Session    web_session    http://${MSB_IAG_IP}:80    headers=${headers}
37     ${resp}=  Get Request    web_session    ${queryswagger_url}
38     ${responese_code}=     Convert To String      ${resp.status_code}
39     List Should Contain Value    ${return_ok_list}   ${responese_code}
40     ${response_json}    json.loads    ${resp.content}
41     ${swagger_version}=    Convert To String      ${response_json['swagger']}
42     Should Be Equal    ${swagger_version}    2.0
43
44 CreateNSTest
45     [Documentation]    Create NS function test
46     ${json_value}=     json_from_file      ${create_ns_json}
47     ${json_string}=     string_from_json   ${json_value}
48     ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
49     Create Session    web_session    http://${MSB_IAG_IP}:80    headers=${headers}
50     Set Request Body    ${json_string}
51     ${resp}=    Post Request    web_session     ${create_ns_url}    ${json_string}
52     ${responese_code}=     Convert To String      ${resp.status_code}
53     List Should Contain Value    ${return_ok_list}   ${responese_code}
54     ${response_json}    json.loads    ${resp.content}
55     ${nsInstId}=    Convert To String      ${response_json['nsInstanceId']}
56     Set Global Variable     ${nsInstId}
57
58 DeleteNS Test
59     [Documentation]    Delete NS function test
60     ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
61     Create Session    web_session    http://${MSB_IAG_IP}:80    headers=${headers}
62     ${resp}=    Delete Request    web_session     ${delete_ns_url}/${nsInstId}
63     ${responese_code}=     Convert To String      ${resp.status_code}
64     List Should Contain Value    ${return_ok_list}   ${responese_code}