2 Resource ../../common.robot
4 Library RequestsLibrary
5 Library OperatingSystem
7 Library HttpLibrary.HTTP
11 ${ns_descriptors_url} /api/nsd/v1/ns_descriptors
14 ${request_json} ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/CreateNsdInfoRequest.json
20 Create new Network Service Descriptor Resource
21 Log Create new Network Service Descriptor Resource
22 [Documentation] The objective is to test the creation of a new Create new Network Service 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 ${ns_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['nsdOnboardingState']}
32 ${nsdId}= Convert To String ${response_json['id']}
33 Set Global Variable ${nsdId}
35 GET Individual Network Service Descriptor Information
36 Log GET Individual Network Service Descriptor Information
37 [Documentation] The objective is to test the retrieval of an individual Network Service 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 ${ns_descriptors_url}/${nsdId}
41 Should Be Equal As Strings 200 ${resp.status_code}
42 ${response_json} json.loads ${resp.content}
43 Should Be Equal As Strings ${nsdId} ${response_json['id']}
45 POST Individual Network Service Descriptor - Method not implemented
46 Log POST Individual Network Service Descriptor - Method not implemented
47 [Documentation] The objective is to test that POST method is not allowed to create a new Network Service 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 ${ns_descriptors_url}/${nsdId}
51 Should Be Equal As Strings 405 ${resp.status_code}
53 PUT Individual Network Service Descriptor - Method not implemented
54 Log PUT Individual Network Service Descriptor - Method not implemented
55 [Documentation] The objective is to test that PUT method is not allowed to modify a new Network Service 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 ${ns_descriptors_url}/${nsdId}
59 Should Be Equal As Strings 405 ${resp.status_code}
61 DELETE Network Service Descriptor
62 Log DELETE Network Service 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 ${ns_descriptors_url}/${nsdId}
66 Should Be Equal As Strings 204 ${resp.status_code}