9bc508b491a385be819703cf45dc3fd39dc52f63
[aai/test-config.git] / testsuite / robot / resources / aai / csit-relationship-list.robot
1 *** Settings ***
2 Documentation     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
6 Resource    ../json_templater.robot
7 Resource    aai_interface.robot
8 Resource    csit-api-version-properties.robot
9 Library    OperatingSystem
10 Library    Collections
11
12
13 *** Variables ***
14 ${AAI_RELATIONSHIPLIST_PATH}=      relationship-list
15 ${AAI_RELATIONSHIP_PATH}=      ${AAI_RELATIONSHIPLIST_PATH}/relationship
16 ${AAI_CSIT_RELATIONSHIP_BODY}=    robot/assets/templates/aai/csit-relationship.template
17 ${AAI_RELATIONSHIP_DEPTH}=    ?depth=1
18
19 *** Keywords ***
20 Add 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_CSIT_RELATIONSHIP_BODY}    ${arguments}
25     ${put_resp}=    Run A&AI Put Request     ${api_version_base_object_url}/${AAI_RELATIONSHIP_PATH}     ${data}
26     Log    Put response ${put_resp.text}
27     ${status_string}=    Convert To String    ${put_resp.status_code}
28     Should Match Regexp    ${status_string}     ^(201|200)$
29
30 Get RelationshipList
31     [Documentation]   Return RelationshipList of the object in AAI
32     [Arguments]    ${api_version_base_object_url}
33     ${resp}=  Get Object With Depth  ${api_version_base_object_url}
34     Log    Returning response ${resp['${AAI_RELATIONSHIPLIST_PATH}']}
35     [Return]  ${resp['${AAI_RELATIONSHIPLIST_PATH}']}
36
37 Get Object With Depth
38     [Documentation]   Return Object with Depth parameter to show RelationshipList
39     [Arguments]    ${api_version_base_object_url}
40     ${resp}=    Run A&AI Get Request     ${api_version_base_object_url}${AAI_RELATIONSHIP_DEPTH}
41     Should Be Equal As Strings  ${resp.status_code}     200
42     Log    Returning response ${resp.json()}
43     [Return]  ${resp.json()}
44