blob: 6fbb84c7bf7ee527e2b17a824470700b2084a358 [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
2Documentation Create A&AI Customer API.
DR695Hccff30b2017-02-17 18:44:24 -05003
4Resource aai_interface.robot
DR695Hccff30b2017-02-17 18:44:24 -05005Library Collections
DR695Hd9794652019-07-19 18:20:40 -04006Library ONAPLibrary.Templating WITH NAME Templating
7Library ONAPLibrary.AAI WITH NAME AAI
DR695Hccff30b2017-02-17 18:44:24 -05008
9*** Variables ***
Jerry Flood8a6b0b52017-11-12 15:44:21 -050010${INDEX PATH} /aai/v11
DR695Hccff30b2017-02-17 18:44:24 -050011${ROOT_CUSTOMER_PATH} /business/customers/customer/
12${SYSTEM USER} robot-ete
DR695H3bb6cf42019-06-20 15:04:04 -040013${A&AI ADD CUSTOMER BODY} aai/add_customer.jinja
DR695Hccff30b2017-02-17 18:44:24 -050014
Jerry Flood8a6b0b52017-11-12 15:44:21 -050015*** Keywords ***
DR695Hccff30b2017-02-17 18:44:24 -050016Create Customer
Jerry Flood8a6b0b52017-11-12 15:44:21 -050017 [Documentation] Creates a customer in A&AI
18 [Arguments] ${customer_name} ${customer_id} ${customer_type} ${service_type} ${clouder_owner} ${cloud_region_id} ${tenant_id}
Jerry Flood8a6b0b52017-11-12 15:44:21 -050019 ${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}
DR695Hd9794652019-07-19 18:20:40 -040020 Templating.Create Environment aai ${GLOBAL_TEMPLATE_FOLDER}
21 ${data}= Templating.Apply Template aai ${A&AI ADD CUSTOMER BODY} ${arguments}
DR695Hc6184272019-07-26 15:50:23 -040022 ${put_resp}= AAI.Run Put Request ${AAI_FRONTEND_ENDPOINT} ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${data} auth=${GLOBAL_AAI_AUTHENTICATION}
DR695Hccff30b2017-02-17 18:44:24 -050023 Should Be Equal As Strings ${put_resp.status_code} 201
24 [Return] ${put_resp.status_code}
25
DR695Hccff30b2017-02-17 18:44:24 -050026Delete Customer
Jerry Flood8a6b0b52017-11-12 15:44:21 -050027 [Documentation] Deletes a customer in A&AI
DR695Hccff30b2017-02-17 18:44:24 -050028 [Arguments] ${customer_id}
DR695Hc6184272019-07-26 15:50:23 -040029 ${get_resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} auth=${GLOBAL_AAI_AUTHENTICATION}
DR695Hccff30b2017-02-17 18:44:24 -050030 Run Keyword If '${get_resp.status_code}' == '200' Delete Customer Exists ${customer_id} ${get_resp.json()['resource-version']}
Jerry Flood8a6b0b52017-11-12 15:44:21 -050031
DR695Hccff30b2017-02-17 18:44:24 -050032Delete Customer Exists
Jerry Flood8a6b0b52017-11-12 15:44:21 -050033 [Documentation] Deletes a customer in A&AI
34 [Arguments] ${customer_id} ${resource_version_id}
DR695Hc6184272019-07-26 15:50:23 -040035 ${put_resp}= AAI.Run Delete Request ${AAI_FRONTEND_ENDPOINT} ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${resource_version_id} auth=${GLOBAL_AAI_AUTHENTICATION}
36 Should Be Equal As Strings ${put_resp.status_code} 204