Fixing Jenkins Job
[integration/csit.git] / tests / vfc / gvnfm-vnflcm / Subscriptions.robot
1 *** Settings ***
2 Resource    ../../common.robot
3 Library     Collections
4 Library     RequestsLibrary
5 Library     OperatingSystem
6 Library     json
7
8 *** Variables ***
9 @{return_ok_list}=         200  201  202  204
10 ${vnflcm_port}            8801
11 ${subscriptions_url}         /api/vnflcm/v1/subscriptions
12
13 #json files
14 ${vnf_subscription_json}    ${SCRIPTS}/../tests/vfc/gvnfm-vnflcm/jsoninput/vnf_subscription.json
15
16 #global variables
17 ${subscriptionId}
18
19 *** Test Cases ***
20 Create new VNF Package subscription
21     Log    Create new VNF Package subscription
22     [Documentation]    The objective is to test the creation of a new VNF package subscription
23     ${data}=    Get Binary File     ${vnf_subscription_json}
24     ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
25     Create Session    web_session    http://${VNFLCM_IP}:${vnflcm_port}    headers=${headers}
26     ${resp}=    POST On Session    web_session    ${subscriptions_url}   data=${data}
27     ${responese_code}=     Convert To String      ${resp.status_code}
28     List Should Contain Value    ${return_ok_list}   ${responese_code}
29     ${response_json}    json.loads    ${resp.content}
30     ${callback_uri}=    Convert To String      ${response_json['callbackUri']}
31     Should Be Equal    ${callback_uri}    http://127.0.0.1:${vnflcm_port}/api/vnflcm/v1/callback_sample
32     ${subscriptionId}=    Convert To String      ${response_json['id']}
33     Set Global Variable     ${subscriptionId}
34
35 Create duplicated VNF Package subscription
36     Log    Create duplicated VNF Package subscription
37     [Documentation]    The objective is to test the attempt of a creation of a duplicated VNF package subscription
38     ${data}=    Get Binary File     ${vnf_subscription_json}
39     ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
40     Create Session    web_session    http://${VNFLCM_IP}:${vnflcm_port}    headers=${headers}
41     ${resp}=    POST On Session    web_session    ${subscriptions_url}   data=${data}    expected_status=any
42     Should Be Equal As Strings    502    ${resp.status_code}
43
44 GET All VNF Package Subscriptions
45     Log    GET All VNF Package Subscriptions
46     [Documentation]    The objective is to test the retrieval of all VNF package subscriptions
47     ${headers}            Create Dictionary    Content-Type=application/json    Accept=application/json
48     Create Session        web_session          http://${VNFLCM_IP}:${vnflcm_port}      headers=${headers}
49     ${resp}=   GET On Session    web_session    ${subscriptions_url}
50     Should Be Equal As Strings    200    ${resp.status_code}
51
52 PUT VNF Package Subscriptions - Method not implemented
53     Log    PUT VNF Package Subscriptions - Method not implemented
54     [Documentation]    The objective is to test that PUT method is not allowed to modify VNF package subscriptions
55     ${headers}            Create Dictionary    Content-Type=application/json    Accept=application/json
56     Create Session        web_session          http://${VNFLCM_IP}:${vnflcm_port}      headers=${headers}
57     ${resp}=    Put On Session    web_session    ${subscriptions_url}    expected_status=any
58     Should Be Equal As Strings    405    ${resp.status_code}
59
60 PATCH VNF Package Subscriptions - Method not implemented
61     Log    PATCH VNF Package Subscriptions - Method not implemented
62     [Documentation]    The objective is to test that PATCH method is not allowed to update VNF package subscriptions
63     ${headers}            Create Dictionary    Content-Type=application/json    Accept=application/json
64     Create Session        web_session          http://${VNFLCM_IP}:${vnflcm_port}      headers=${headers}
65     ${resp}=    Patch On Session    web_session    ${subscriptions_url}    expected_status=any
66     Should Be Equal As Strings    405    ${resp.status_code}
67
68 DELETE VNF Package Subscriptions - Method not implemented
69     Log    DELETE VNF Package Subscriptions - Method not implemented
70     [Documentation]    The objective is to test that DELETE method is not allowed to delete VNF package subscriptions
71     ${headers}            Create Dictionary    Content-Type=application/json    Accept=application/json
72     Create Session        web_session          http://${VNFLCM_IP}:${vnflcm_port}      headers=${headers}
73     ${resp}=    Delete On Session    web_session    ${subscriptions_url}    expected_status=any
74     Should Be Equal As Strings    405    ${resp.status_code}
75
76 DELETE VNF Package Subscription
77     Log   DELETE VNF Package Subscription
78     ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
79     Create Session    web_session    http://${VNFLCM_IP}:${vnflcm_port}    headers=${headers}
80     ${resp}=    Delete On Session    web_session    ${subscriptions_url}/${subscriptionId}
81     ${responese_code}=     Convert To String      ${resp.status_code}
82     List Should Contain Value    ${return_ok_list}   ${responese_code}