Add csit case for VNF Package Subscriptions and Individual VNF Package Subscription
[integration/csit.git] / tests / vfc / nfvo-catalog / IndividualSubscription.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 @{return_ok_list}=         200  201  202  204
11 ${catalog_port}            8806
12 ${subscriptions_url}         /api/vnfpkgm/v1/subscriptions
13
14 #json files
15 ${vnf_subscription_json}    ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/vnf_subscription.json
16
17 #global variables
18 ${subscriptionId}
19
20 *** Test Cases ***
21 Create new VNF Package subscription for pre-condition
22     Log    Create new VNF Package subscription for pre-condition
23     ${json_value}=     json_from_file      ${vnf_subscription_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     ${subscriptions_url}    ${json_string}
29     ${responese_code}=     Convert To String      ${resp.status_code}
30     List Should Contain Value    ${return_ok_list}   ${responese_code}
31     ${response_json}    json.loads    ${resp.content}
32     ${callback_uri}=    Convert To String      ${response_json['callbackUri']}
33     Should Be Equal    ${callback_uri}    http://127.0.0.1:${catalog_port}/api/catalog/v1/callback_sample
34     ${subscriptionId}=    Convert To String      ${response_json['id']}
35     Set Global Variable     ${subscriptionId}
36
37 GET Individual VNF Package Subscription
38     Log    GET Individual VNF Package Subscription
39     [Documentation]    The objective is to test the retrieval of individual VNF package subscription
40     ${headers}            Create Dictionary    Content-Type=application/json    Accept=application/json
41     Create Session        web_session          http://${CATALOG_IP}:${catalog_port}      headers=${headers}
42     ${resp}=              Get Request          web_session     ${subscriptions_url}/${subscriptionId}
43     Should Be Equal As Strings    200    ${resp.status_code}
44     ${response_json}    json.loads    ${resp.content}
45     ${callback_uri}=    Convert To String      ${response_json['callbackUri']}
46     Should Be Equal    ${callback_uri}    http://127.0.0.1:${catalog_port}/api/catalog/v1/callback_sample
47     Should Be Equal As Strings    ${subscriptionId}    ${response_json['id']}
48
49 POST Individual VNF Package Subscription - Method not implemented
50     Log    POST Individual VNF Package Subscription - Method not implemented
51     [Documentation]    The objective is to test that POST method is not allowed to create a new VNF Package Subscription
52     ${headers}            Create Dictionary    Content-Type=application/json    Accept=application/json
53     Create Session        web_session          http://${CATALOG_IP}:${catalog_port}      headers=${headers}
54     ${resp}=              Post Request          web_session     ${subscriptions_url}/${subscriptionId}
55     Should Be Equal As Strings    405    ${resp.status_code}
56
57 PUT Individual VNF Package Subscription - Method not implemented
58     Log    PUT Individual VNF Package Subscription - Method not implemented
59     [Documentation]    The objective is to test that PUT method is not allowed to update an existing VNF Package subscription
60     ${headers}            Create Dictionary    Content-Type=application/json    Accept=application/json
61     Create Session        web_session          http://${CATALOG_IP}:${catalog_port}      headers=${headers}
62     ${resp}=              Put Request          web_session     ${subscriptions_url}/${subscriptionId}
63     Should Be Equal As Strings    405    ${resp.status_code}
64
65 PATCH Individual VNF Package Subscription - Method not implemented
66     Log    PATCH Individual VNF Package Subscription - Method not implemented
67     [Documentation]    The objective is to test that PATCH method is not allowed to modify an existing VNF Package subscription
68     ${headers}            Create Dictionary    Content-Type=application/json    Accept=application/json
69     Create Session        web_session          http://${CATALOG_IP}:${catalog_port}      headers=${headers}
70     ${resp}=              Patch Request          web_session     ${subscriptions_url}/${subscriptionId}
71     Should Be Equal As Strings    405    ${resp.status_code}
72
73 DELETE Individual VNF Package Subscription
74     Log   DELETE Individual VNF Package Subscription
75     [Documentation]    The objective is to test the deletion of an individual VNF package subscription
76     ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
77     Create Session    web_session    http://${CATALOG_IP}:${catalog_port}    headers=${headers}
78     ${resp}=    Delete Request    web_session     ${subscriptions_url}/${subscriptionId}
79     ${responese_code}=     Convert To String      ${resp.status_code}
80     List Should Contain Value    ${return_ok_list}   ${responese_code}