blob: 7ebda39de5782168a99bdc3ac1c14346cea134ec [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
2Documentation Create A&AI Customer API.
3...
4... Create A&AI Customer API
5
6Resource aai_interface.robot
7Resource ../json_templater.robot
8Library Collections
9Library OperatingSystem
10
11
12*** Variables ***
13${INDEX PATH} /aai/v8
14${ROOT_CUSTOMER_PATH} /business/customers/customer/
15${SYSTEM USER} robot-ete
16${A&AI ADD CUSTOMER BODY} robot/assets/templates/aai/add_customer.template
17
18*** Keywords ***
19Create Customer
20 [Documentation] Creates a customer in A&AI
21 [Arguments] ${customer_name} ${customer_id} ${customer_type} ${service_type} ${clouder_owner} ${cloud_region_id} ${tenant_id}
22 ${data_template}= OperatingSystem.Get File ${A&AI ADD CUSTOMER BODY}
23 ${arguments}= Create Dictionary subscriber_name=${customer_name} global_customer_id=${customer_id} subscriber_type=${customer_type} cloud_owner1=${clouder_owner} cloud_region_id1=${cloud_region_id} tenant_id1=${tenant_id} service1=${service_type}
24 ${data}= Fill JSON Template ${data_template} ${arguments}
25 ${put_resp}= Run A&AI Put Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${data}
26 Should Be Equal As Strings ${put_resp.status_code} 201
27 [Return] ${put_resp.status_code}
28
29*** Keywords ***
30Delete Customer
31 [Documentation] Deletes a customer in A&AI
32 [Arguments] ${customer_id}
33 ${get_resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id}
34 Run Keyword If '${get_resp.status_code}' == '200' Delete Customer Exists ${customer_id} ${get_resp.json()['resource-version']}
35
36*** Keywords ***
37Delete Customer Exists
38 [Documentation] Deletes a customer in A&AI
39 [Arguments] ${customer_id} ${resource_version_id}
40 ${put_resp}= Run A&AI Delete Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${resource_version_id}
41 Should Be Equal As Strings ${put_resp.status_code} 204