blob: 056b896f74df0ecdb6d2a4b8f836655b04ccca42 [file] [log] [blame]
Keong Limeff1eab2019-03-19 15:44:35 +11001*** Settings ***
2Documentation Operations on relationship-list sub-object in AAI,
3... using specified base URL path including API version where it is implemented,
4... relies on system to choose default EdgeRule for the pair of object classes
5
6Resource ../json_templater.robot
7Resource aai_interface.robot
8Resource api_version_properties.robot
9Library OperatingSystem
10Library Collections
11
12
13*** Variables ***
14${AAI_RELATIONSHIPLIST_PATH}= relationship-list
15${AAI_RELATIONSHIP_PATH}= ${AAI_RELATIONSHIPLIST_PATH}/relationship
16${AAI_ADD_RELATIONSHIP_BODY}= robot/assets/templates/aai/add-relationship.template
17${AAI_RELATIONSHIP_DEPTH}= ?depth=1
18
19*** Keywords ***
20Add Relationship
21 [Documentation] Adds Relationship sub-object to existing object in AAI
22 [Arguments] ${api_version_base_object_url} ${related_class_name} ${related_object_url}
23 ${arguments}= Create Dictionary related_class_name=${related_class_name} related_object_url=${related_object_url}
24 ${data}= Fill JSON Template File ${AAI_ADD_RELATIONSHIP_BODY} ${arguments}
25 ${put_resp}= Run A&AI Put Request ${api_version_base_object_url}/${AAI_RELATIONSHIP_PATH} ${data}
26 ${status_string}= Convert To String ${put_resp.status_code}
27 Should Match Regexp ${status_string} ^(201|200)$
28
29Get RelationshipList
30 [Documentation] Return RelationshipList of the object in AAI
31 [Arguments] ${api_version_base_object_url}
32 ${resp}= Get Object With Depth ${api_version_base_object_url}
33 Log Returning response ${resp['${AAI_RELATIONSHIPLIST_PATH}']}
34 [Return] ${resp['${AAI_RELATIONSHIPLIST_PATH}']}
35
36Get Object With Depth
37 [Documentation] Return Object with Depth parameter to show RelationshipList
38 [Arguments] ${api_version_base_object_url}
39 ${resp}= Run A&AI Get Request ${api_version_base_object_url}${AAI_RELATIONSHIP_DEPTH}
40 Should Be Equal As Strings ${resp.status_code} 200
41 Log Returning response ${resp.json()}
42 [Return] ${resp.json()}
43