blob: b87c20f9fbcd4ad9e5d4f4195775fb76ea2b2b55 [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 ***
21POST Subscription
22 Log Trying to create a new subscription
23 [Documentation] Create Vnf Subscription function test
24 ${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
38DeleteVnfSubscriptionTest
39 [Documentation] Delete Vnf Subscription function test
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}= Delete Request web_session ${subscriptions_url}/${subscriptionId}
43 ${responese_code}= Convert To String ${resp.status_code}
44 List Should Contain Value ${return_ok_list} ${responese_code}
45