2 Documentation Create A&AI Customer API.
4 Resource aai_interface.robot
6 Library ONAPLibrary.Utilities
7 Library ONAPLibrary.Templating
11 ${INDEX PATH} /aai/v11
12 ${ROOT_SERVICE_PATH} /service-design-and-creation/services
14 ${SYSTEM USER} robot-ete
15 ${AAI_ADD_SERVICE_BODY}= aai/add_service_body.jinja
18 Create Service If Not Exists
19 [Documentation] Creates a service in A&AI if it doesn't exist
20 [Arguments] ${service_type}
22 ${status} ${value}= Run Keyword And Ignore Error Dictionary Should Contain Key ${dict} ${service_type}
23 Run Keyword If '${status}' == 'FAIL' Create Service ${service_type}
26 [Documentation] Creates a service in A&AI
27 [Arguments] ${service_type}
28 ${uuid}= Generate UUID4
29 ${arguments}= Create Dictionary service_type=${service_type} UUID=${uuid}
30 Create Environment aai ${GLOBAL_TEMPLATE_FOLDER}
31 ${data}= Apply Template aai ${AAI_ADD_SERVICE_BODY} ${arguments}
32 ${fullpath}= Catenate ${INDEX PATH}${ROOT_SERVICE_PATH}/service/${uuid}
33 ${put_resp}= Run A&AI Put Request ${fullpath} ${data}
34 Should Be Equal As Strings ${put_resp.status_code} 201
35 [Return] ${put_resp.status_code}
38 Delete Service If Exists
39 [Documentation] Deletes a service in A&AI if it exists
40 [Arguments] ${service_type}
42 ${status} ${value}= Run Keyword And Ignore Error Dictionary Should Contain Key ${dict} ${service_type}
43 Run Keyword If '${status}' == 'PASS' Delete Service ${dict['${service_type}']}
46 [Documentation] Delete passed service in A&AI
48 ${uuid}= Get From Dictionary ${dict} service-id
49 ${resource_version}= Get From Dictionary ${dict} resource-version
50 ${fullpath}= Catenate ${INDEX PATH}${ROOT_SERVICE_PATH}/service/${uuid}
51 ${resp}= Run A&AI Delete Request ${fullpath} ${resource_version}
52 Should Be Equal As Strings ${resp.status_code} 204
56 [Documentation] Creates a service in A&AI
57 ${resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_SERVICE_PATH}
58 ${dict}= Create Dictionary
59 ${status} ${value}= Run Keyword And Ignore Error Should Be Equal As Strings ${resp.status_code} 200
60 Run Keyword If '${status}' == 'PASS' Update Service Dictionary ${dict} ${resp.json()}
63 Update Service Dictionary
64 [Arguments] ${dict} ${json}
65 ${list}= Evaluate ${json}['service']
66 :FOR ${map} IN @{list}
67 \ ${status} ${service_type}= Run Keyword And Ignore Error Get From Dictionary ${map} service-description
68 \ Run Keyword If '${status}' == 'PASS' Set To Dictionary ${dict} ${service_type}=${map}