blob: ecae4d3a735a362d3ecee63d392607b97c22aa74 [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
DR695H3bb6cf42019-06-20 15:04:04 -04006Library ONAPLibrary.Templating
DR695Hccff30b2017-02-17 18:44:24 -05007
8*** Variables ***
Jerry Flood8a6b0b52017-11-12 15:44:21 -05009${INDEX PATH} /aai/v11
DR695Hccff30b2017-02-17 18:44:24 -050010${ROOT_CUSTOMER_PATH} /business/customers/customer/
11${SYSTEM USER} robot-ete
DR695H3bb6cf42019-06-20 15:04:04 -040012${A&AI ADD CUSTOMER BODY} aai/add_customer.jinja
DR695Hccff30b2017-02-17 18:44:24 -050013
Jerry Flood8a6b0b52017-11-12 15:44:21 -050014*** Keywords ***
DR695Hccff30b2017-02-17 18:44:24 -050015Create Customer
Jerry Flood8a6b0b52017-11-12 15:44:21 -050016 [Documentation] Creates a customer in A&AI
17 [Arguments] ${customer_name} ${customer_id} ${customer_type} ${service_type} ${clouder_owner} ${cloud_region_id} ${tenant_id}
Jerry Flood8a6b0b52017-11-12 15:44:21 -050018 ${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}
DR695H3bb6cf42019-06-20 15:04:04 -040019 Create Environment aai ${GLOBAL_TEMPLATE_FOLDER}
20 ${data}= Apply Template aai ${A&AI ADD CUSTOMER BODY} ${arguments}
DR695Hccff30b2017-02-17 18:44:24 -050021 ${put_resp}= Run A&AI Put Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${data}
22 Should Be Equal As Strings ${put_resp.status_code} 201
23 [Return] ${put_resp.status_code}
24
Jerry Flood8a6b0b52017-11-12 15:44:21 -050025*** Keywords ***
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}
Jerry Flood8a6b0b52017-11-12 15:44:21 -050029 ${get_resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id}
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
32*** Keywords ***
DR695Hccff30b2017-02-17 18:44:24 -050033Delete Customer Exists
Jerry Flood8a6b0b52017-11-12 15:44:21 -050034 [Documentation] Deletes a customer in A&AI
35 [Arguments] ${customer_id} ${resource_version_id}
DR695Hccff30b2017-02-17 18:44:24 -050036 ${put_resp}= Run A&AI Delete Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${resource_version_id}
Jerry Flood8a6b0b52017-11-12 15:44:21 -050037 Should Be Equal As Strings ${put_resp.status_code} 204