Added CSIT for Macroflow with HEAT
[integration/csit.git] / tests / vfc / nfvo-catalog / IndividualVNFPackage.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 ${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 ***
21 Create 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
35 GET 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
46 PUT 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
54 POST 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
62 DELETE 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}