blob: 342ce3d12305f50d1fbe05c60f431c9a0565d00c [file] [log] [blame]
Olivia.Zhan1e0cd762019-07-09 15:25:30 +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 ***
21Create 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
37GET 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
49POST 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
57PUT 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
65PATCH 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
73DELETE 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}