blob: a1d002218b03f2eb433b4de7ee41b7d64a44a856 [file] [log] [blame]
Olivia.Zhan8e3e4582019-07-08 15:19:42 +08001*** Settings ***
2Resource ../../common.robot
3Library Collections
4Library RequestsLibrary
5Library OperatingSystem
6Library json
7Library 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 ***
Olivia.Zhan1e0cd762019-07-09 15:25:30 +080021Create new VNF Package subscription
22 Log Create new VNF Package subscription
23 [Documentation] The objective is to test the creation of a new VNF package subscription
Olivia.Zhan8e3e4582019-07-08 15:19:42 +080024 ${json_value}= json_from_file ${vnf_subscription_json}
25 ${json_string}= string_from_json ${json_value}
26 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
27 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
28 Set Request Body ${json_string}
29 ${resp}= Post Request web_session ${subscriptions_url} ${json_string}
30 ${responese_code}= Convert To String ${resp.status_code}
31 List Should Contain Value ${return_ok_list} ${responese_code}
32 ${response_json} json.loads ${resp.content}
33 ${callback_uri}= Convert To String ${response_json['callbackUri']}
34 Should Be Equal ${callback_uri} http://127.0.0.1:${catalog_port}/api/catalog/v1/callback_sample
35 ${subscriptionId}= Convert To String ${response_json['id']}
36 Set Global Variable ${subscriptionId}
37
Olivia.Zhan1e0cd762019-07-09 15:25:30 +080038Create duplicated VNF Package subscription
39 Log Create duplicated VNF Package subscription
40 [Documentation] The objective is to test the attempt of a creation of a duplicated VNF package subscription
41 ${json_value}= json_from_file ${vnf_subscription_json}
42 ${json_string}= string_from_json ${json_value}
43 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
44 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
45 Set Request Body ${json_string}
46 ${resp}= Post Request web_session ${subscriptions_url} ${json_string}
47 Should Be Equal As Strings 303 ${resp.status_code}
48
49GET All VNF Package Subscriptions
50 Log GET All VNF Package Subscriptions
51 [Documentation] The objective is to test the retrieval of all VNF package subscriptions
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}= Get Request web_session ${subscriptions_url}
55 Should Be Equal As Strings 200 ${resp.status_code}
56
57PUT VNF Package Subscriptions - Method not implemented
58 Log PUT VNF Package Subscriptions - Method not implemented
59 [Documentation] The objective is to test that PUT method is not allowed to modify VNF package subscriptions
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}
63 Should Be Equal As Strings 405 ${resp.status_code}
64
65PATCH VNF Package Subscriptions - Method not implemented
66 Log PATCH VNF Package Subscriptions - Method not implemented
67 [Documentation] The objective is to test that PATCH method is not allowed to update VNF package subscriptions
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}
71 Should Be Equal As Strings 405 ${resp.status_code}
72
73DELETE VNF Package Subscriptions - Method not implemented
74 Log DELETE VNF Package Subscriptions - Method not implemented
75 [Documentation] The objective is to test that DELETE method is not allowed to delete VNF package subscriptions
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}
79 Should Be Equal As Strings 405 ${resp.status_code}
80
81DELETE VNF Package Subscription
82 Log DELETE VNF Package Subscription
Olivia.Zhan8e3e4582019-07-08 15:19:42 +080083 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
84 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
85 ${resp}= Delete Request web_session ${subscriptions_url}/${subscriptionId}
86 ${responese_code}= Convert To String ${resp.status_code}
87 List Should Contain Value ${return_ok_list} ${responese_code}