blob: 52e500457f9421d1dcc0854792079a597f2c6961 [file] [log] [blame]
Olivia.Zhan88a563a2019-07-10 10:22:47 +08001*** Settings ***
2Resource ../../common.robot
3Library Collections
4Library RequestsLibrary
5Library OperatingSystem
6Library json
7Library HttpLibrary.HTTP
8
9*** Variables ***
10${catalog_port} 8806
11${vnf_packages_url} /api/vnfpkgm/v1/vnf_packages
12
13#json files
14${request_json} ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/CreateVnfPkgInfoRequest.json
15
16#global variables
17${packageId}
18
19*** Test Cases ***
20Create new VNF Package Resource
21 Log Create new VNF Package Resource
22 [Documentation] The objective is to test the creation of a new VNF Package Resource
23 ${json_value}= json_from_file ${request_json}
24 ${json_string}= string_from_json ${json_value}
25 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
26 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
27 Set Request Body ${json_string}
28 ${resp}= Post Request web_session ${vnf_packages_url} ${json_string}
29 Should Be Equal As Strings 201 ${resp.status_code}
30 ${response_json} json.loads ${resp.content}
31 Should Be Equal As Strings CREATED ${response_json['onboardingState']}
32 ${packageId}= Convert To String ${response_json['id']}
33 Set Global Variable ${packageId}
34
35GET all VNF Packages
36 Log GET all VNF Packages
37 [Documentation] The objective is to test the retrieval of all the available VNF packages information
38 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
39 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
40 ${resp}= Get Request web_session ${vnf_packages_url}
41 Should Be Equal As Strings 200 ${resp.status_code}
42 ${response_json} json.loads ${resp.content}
43 Should Be Equal As Strings ${packageId} ${response_json[0]['id']}
44
45PUT all VNF Packages - Method not implemented
46 Log PUT all VNF Packages - Method not implemented
47 [Documentation] The objective is to test that PUT method is not allowed to modify existing VNF Packages
48 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
49 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
50 ${resp}= Put Request web_session ${vnf_packages_url}
51 Should Be Equal As Strings 405 ${resp.status_code}
52
53PATCH all VNF Packages - Method not implemented
54 Log PATCH all VNF Packages - Method not implemented
55 [Documentation] The objective is to test that PATCH method is not allowed to update existing VNF Packages
56 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
57 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
58 ${resp}= Patch Request web_session ${vnf_packages_url}
59 Should Be Equal As Strings 405 ${resp.status_code}
60
61DELETE all VNF Packages - Method not implemented
62 Log DELETE all VNF Packages - Method not implemented
63 [Documentation] The objective is to test that DELETE method is not allowed to delete existing VNF Packages
64 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
65 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
66 ${resp}= Delete Request web_session ${vnf_packages_url}
67 Should Be Equal As Strings 405 ${resp.status_code}
68
69DELETE VNF Package
70 Log DELETE VNF Package
71 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
72 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
73 ${resp}= Delete Request web_session ${vnf_packages_url}/${packageId}
74 Should Be Equal As Strings 204 ${resp.status_code}