blob: 4c35a39e716bf1a75f8b1bc7f9d8182bf9cd8f69 [file] [log] [blame]
Olivia.Zhane2ccf762019-07-10 15:27:46 +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
17#global variables
18${packageId}
19
20*** Test Cases ***
21Create new VNF Package Resource for pre-condition
22 Log Create new VNF Package Resource for pre-condition
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 Individual VNF Package
36 Log GET Individual VNF Package
37 [Documentation] The objective is to test the retrieval of an individual VNF package 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}/${packageId}
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['id']}
44 Should Be Equal As Strings DISABLED ${response_json['operationalState']}
45
46PUT Individual VNF Package - Method not implemented
47 Log PUT Individual VNF Package - Method not implemented
48 [Documentation] The objective is to test that PUT method is not allowed to modify a VNF Package
49 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
50 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
51 ${resp}= Put Request web_session ${vnf_packages_url}/${packageId}
52 Should Be Equal As Strings 405 ${resp.status_code}
53
54POST Individual VNF Package - Method not implemented
55 Log POST Individual VNF Package - Method not implemented
56 [Documentation] The objective is to test that POST method is not allowed to create new VNF Package
57 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
58 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
59 ${resp}= Post Request web_session ${vnf_packages_url}/${packageId}
60 Should Be Equal As Strings 405 ${resp.status_code}
61
62DELETE Individual VNF Package
63 Log DELETE Individual VNF Package
64 [Documentation] The objective is to test the deletion of an individual VNF Package
65 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
66 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
67 ${resp}= Delete Request web_session ${vnf_packages_url}/${packageId}
68 Should Be Equal As Strings 204 ${resp.status_code}