blob: f4a320b37727f8509f6207820237b34645039efa [file] [log] [blame]
Olivia.Zhan466ddef2019-07-18 09:09:53 +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/nsd/v1/subscriptions
13
14#json files
15${nsdm_subscription_json} ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/nsdm_subscription.json
16
17#global variables
18${subscriptionId}
19
20*** Test Cases ***
21Create new NSD management subscription for pre-condition
22 Log Create new NSD management subscription for pre-condition
23 ${json_value}= json_from_file ${nsdm_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 NSD management Subscription
38 Log GET Individual NSD management 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 NSD management Subscription - Method not implemented
50 Log POST Individual NSD management Subscription - Method not implemented
51 [Documentation] The objective is to test that POST method is not allowed to create a new NSD management 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 NSD management Subscription - Method not implemented
58 Log PUT Individual NSD management Subscription - Method not implemented
59 [Documentation] The objective is to test that PUT method is not allowed to update an existing NSD management 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 NSD management Subscription - Method not implemented
66 Log PATCH Individual NSD management Subscription - Method not implemented
67 [Documentation] The objective is to test that PATCH method is not allowed to modify an existing NSD management 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 NSD management Subscription
74 Log DELETE Individual NSD management 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}