Add new fields to config file in slice-analysis and remove unused files
[integration/csit.git] / tests / vfc / nfvo-catalog / PNFDescriptors.robot
1 *** Settings ***
2 Resource    ../../common.robot
3 Library     Collections
4 Library     RequestsLibrary
5 Library     OperatingSystem
6 Library     json
7 Library     HttpLibrary.HTTP
8
9 *** Variables ***
10 ${catalog_port}            8806
11 ${pnf_descriptors_url}         /api/nsd/v1/pnf_descriptors
12
13 #json files
14 ${request_json}    ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/CreatePnfdInfoRequest.json
15
16 #global variables
17 ${pnfdId}
18
19 *** Test Cases ***
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}
34
35 GET all PNF Descriptors Information
36     Log    GET all PNF Descriptors Information
37     [Documentation]    The objective is to test the retrieval of all the PNF Descriptors 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}
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[0]['id']}
44
45 PUT all PNF Descriptors - Method not implemented
46     Log    PUT all PNF Descriptors - Method not implemented
47     [Documentation]    The objective is to test that PUT method is not allowed to modify existing PNF Descriptors
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     ${pnf_descriptors_url}
51     Should Be Equal As Strings    405    ${resp.status_code}
52
53 PATCH all PNF Descriptors - Method not implemented
54     Log    PATCH all PNF Descriptors - Method not implemented
55     [Documentation]    The objective is to test that PATCH method is not allowed to update existing PNF Descriptors
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     ${pnf_descriptors_url}
59     Should Be Equal As Strings    405    ${resp.status_code}
60
61 DELETE all PNF Descriptors - Method not implemented
62     Log    DELETE all PNF Descriptors - Method not implemented
63     [Documentation]    The objective is to test that DELETE method is not allowed to delete existing PNF Descriptors
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     ${pnf_descriptors_url}
67     Should Be Equal As Strings    405    ${resp.status_code}
68
69 DELETE PNF Descriptor
70     Log   DELETE PNF Descriptor
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     ${pnf_descriptors_url}/${pnfdId}
74     Should Be Equal As Strings    204    ${resp.status_code}