2 Documentation Framework for operations on sub-object in AAI,
3 ... using specified base URL path including API version where it is implemented
4 ... and specified sub-object URL path, object templates and parameters
6 Resource ../json_templater.robot
7 Resource aai_interface.robot
8 Resource csit-api-version-properties.robot
9 Library OperatingSystem
18 [Documentation] Creates sub-object in existing object in AAI
19 [Arguments] ${api_version_base_object_url} ${container_path} ${subobject_path} ${uniquekey_value} ${subobject_template} ${subobject_params}
20 ${data}= Fill JSON Template File ${subobject_template} ${subobject_params}
21 ${put_resp}= Run A&AI Put Request ${api_version_base_object_url}${container_path}${subobject_path}/${uniquekey_value} ${data}
22 Log Put response ${put_resp.text}
23 ${status_string}= Convert To String ${put_resp.status_code}
24 Should Match Regexp ${status_string} ^(201|200)$
27 [Documentation] Removes SubObject from existing object in AAI
28 [Arguments] ${api_version_base_object_url} ${container_path} ${subobject_path} ${uniquekey_value} ${json}
29 ${resource_version}= Catenate ${json['resource-version']}
30 ${del_resp}= Run A&AI Delete Request ${api_version_base_object_url}${container_path}${subobject_path}/${uniquekey_value} ${resource_version}
31 Log Put response ${del_resp.text}
32 Should Be Equal As Strings ${del_resp.status_code} 204
35 [Documentation] Return list of sub-objects of the object in AAI
36 [Arguments] ${api_version_base_object_url} ${container_path}
37 ${get_resp}= Run A&AI Get Request ${api_version_base_object_url}/${container_path}
38 Log Returning response ${get_resp.json()}
39 [Return] ${get_resp.json()}
42 [Documentation] Return individual sub-object of the object in AAI
43 [Arguments] ${api_version_base_object_url} ${container_path} ${subobject_path} ${search_key} ${search_value}
44 ${get_resp}= Run A&AI Get Request ${api_version_base_object_url}${container_path}${subobject_path}?${search_key}=${search_value}
45 Log Returning response ${get_resp.text}
48 Confirm Nodes Query SubObjects
49 [Documentation] Return Nodes query sub-objects
50 [Arguments] ${api_version_base_url} ${container_path} ${search_key} ${search_value}
51 ${nodes_resp}= Run A&AI Get Request ${api_version_base_url}${AAI_NODES_PATH}${container_path}?${search_key}=${search_value}
52 Should Be Equal As Strings ${nodes_resp.status_code} 200
53 Log Returning response ${nodes_resp.text}
54 [Return] ${nodes_resp}
56 Confirm Examples Query SubObjects
57 [Documentation] Return Examples query sub-objects
58 [Arguments] ${api_version_base_url} ${container_path}
59 ${eg_resp}= Run A&AI Get Request ${api_version_base_url}${AAI_EXAMPLES_PATH}${container_path}
60 Should Be Equal As Strings ${eg_resp.status_code} 200
61 Log Returning response ${eg_resp.text}
64 Get Valid SubObject URL
65 [Documentation] Return Valid SubObject URL
66 [Arguments] ${api_version_base_object_url} ${container_path} ${subobject_path} ${uniquekey_value}
67 ${resp}= Run A&AI Get Request ${api_version_base_object_url}${container_path}${subobject_path}/${uniquekey_value}
68 Should Be Equal As Strings ${resp.status_code} 200
69 [Return] ${api_version_base_object_url}${container_path}${subobject_path}/${uniquekey_value}
71 Confirm API Not Implemented SubObject
72 [Documentation] Confirm latest API version where SubObject is not implemented
73 [Arguments] ${api_version_base_object_url} ${container_path} ${subobject_path} ${uniquekey_value}
74 ${resp}= Run A&AI Get Request ${api_version_base_object_url}${container_path}${subobject_path}/${uniquekey_value}
75 Should Be Equal As Strings ${resp.status_code} 400