Merge "Added CSIT test for abbreviated Monitor decision API call"
[integration/csit.git] / tests / vfc / nfvo-catalog / IndividualNSDescriptor.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 ${ns_descriptors_url}         /api/nsd/v1/ns_descriptors
12
13 #json files
14 ${request_json}    ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/CreateNsdInfoRequest.json
15
16 #global variables
17 ${nsdId}
18
19 *** Test Cases ***
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}
34
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']}
44
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}
52
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}
60
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}