blob: 1a134b017b98878771fe51be5606b0bff92b0f0d [file] [log] [blame]
Mickael JEZEQUEL7b945572018-03-14 17:27:16 +01001*** settings ***
2Library OperatingSystem
3Library Process
4Library String
5Library Collections
6Library RequestsLibrary
7Library json
8
9
10*** Variables ***
11${valid_heat_zip} ${SCRIPTS}/../tests/vnfsdk-ice/ice-server/heat_template_ok.zip
12${empty_heat_zip} ${SCRIPTS}/../tests/vnfsdk-ice/ice-server/heat_template_empty.zip
13${ice_uri} /onapapi/ice/v1/
14
15*** Test Cases ***
16
17ICE health Check
18 [Documentation] Validate that ICE is up
19 Create Session ice_session http://${ICE_IP}:5000
20 &{headers}= Create Dictionary Content-Type=application/json
21
22 ${resp}= Get Request ice_session ${ice_uri} headers=${headers}
23
24 Should Be Equal As Strings ${resp.status_code} 200
25
26Check status code for valid HEAT based VNF package
27 [Documentation] Post a valid VNF package and expect 200 Response
28 ${fileData}= Get Binary File ${valid_heat_zip}
29 ${fileDir} ${fileName}= Split Path ${valid_heat_zip}
30 ${partData}= Create List ${fileName} ${fileData} application/octet-stream
31 &{fileParts}= Create Dictionary
32 Set To Dictionary ${fileParts} file=${partData}
33
34 ${resp}= Post Request ice_session ${ice_uri} files=${fileParts}
35
36 Log Receive HTTP Status code ${resp.status_code}
37 Should Be Equal As Strings ${resp.status_code} 200
38 ${json} = Set Variable ${resp.json()}
39 ${message} = Get From Dictionary ${json} message
40 Should Be Equal ${message} OK
41
42Check status code for empty VNF package
43 [Documentation] Post an empty VNF package and expect 422 Response
44 ${fileData}= Get Binary File ${empty_heat_zip}
45 ${fileDir} ${fileName}= Split Path ${empty_heat_zip}
46 ${partData}= Create List ${fileName} ${fileData} application/octet-stream
47 &{fileParts}= Create Dictionary
48 Set To Dictionary ${fileParts} file=${partData}
49
50 ${resp}= Post Request ice_session ${ice_uri} files=${fileParts}
51
52 Log Receive HTTP Status code ${resp.status_code}
53 Should Be Equal As Strings ${resp.status_code} 422
54 ${json} = Set Variable ${resp.json()}
55 ${message} = Get From Dictionary ${json} message
56 Should Be Equal ${message} Tests failed
57
58Check status code for invalid request
59 [Documentation] Post an invalid request and expect 400 Response
60 ${fileData}= Get Binary File ${empty_heat_zip}
61 ${fileDir} ${fileName}= Split Path ${empty_heat_zip}
62 ${partData}= Create List ${fileName} ${fileData} application/octet-stream
63 &{fileParts}= Create Dictionary
64 Set To Dictionary ${fileParts} foo=${partData}
65
66 ${resp}= Post Request ice_session ${ice_uri} files=${fileParts}
67
68 Log Receive HTTP Status code ${resp.status_code}
69 Should Be Equal As Strings ${resp.status_code} 400