2 Resource ../../common.robot
4 Library RequestsLibrary
5 Library OperatingSystem
7 Library HttpLibrary.HTTP
11 ${pnf_descriptors_url} /api/nsd/v1/pnf_descriptors
14 ${request_json} ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/CreatePnfdInfoRequest.json
20 Create new PNF Descriptor Resource
21 Log Create new PNF Descriptor Resource
22 [Documentation] The objective is to test the creation of a new Create new PNF Descriptor 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 ${pnf_descriptors_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['pnfdOnboardingState']}
32 ${pnfdId}= Convert To String ${response_json['id']}
33 Set Global Variable ${pnfdId}
35 GET Individual PNF Descriptor Information
36 Log GET Individual PNF Descriptor Information
37 [Documentation] The objective is to test the retrieval of an individual PNF Descriptor 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 ${pnf_descriptors_url}/${pnfdId}
41 Should Be Equal As Strings 200 ${resp.status_code}
42 ${response_json} json.loads ${resp.content}
43 Should Be Equal As Strings ${pnfdId} ${response_json['id']}
45 POST Individual PNF Descriptor - Method not implemented
46 Log POST Individual PNF Descriptor - Method not implemented
47 [Documentation] The objective is to test that POST method is not allowed to create a new PNF Descriptor
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}= Post Request web_session ${pnf_descriptors_url}/${pnfdId}
51 Should Be Equal As Strings 405 ${resp.status_code}
53 PUT Individual PNF Descriptor - Method not implemented
54 Log PUT Individual PNF Descriptor - Method not implemented
55 [Documentation] The objective is to test that PUT method is not allowed to modify a new PNF Descriptor
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}= Put Request web_session ${pnf_descriptors_url}/${pnfdId}
59 Should Be Equal As Strings 405 ${resp.status_code}
62 Log DELETE PNF Descriptor
63 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
64 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
65 ${resp}= Delete Request web_session ${pnf_descriptors_url}/${pnfdId}
66 Should Be Equal As Strings 204 ${resp.status_code}