Release image version 1.12.2
[testsuite.git] / robot / resources / aai / add-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    aai_interface.robot
7 Library    Collections
8 Library    ONAPLibrary.Templating    WITH NAME    Templating
9 Library    ONAPLibrary.AAI    WITH NAME    AAI
10
11 *** Variables ***
12 ${AAI_RELATIONSHIPLIST_PATH}      relationship-list
13 ${AAI_RELATIONSHIP_PATH}=      ${AAI_RELATIONSHIPLIST_PATH}/relationship
14 ${AAI_ADD_RELATIONSHIP_BODY}    aai/add-relationship.jinja
15 ${AAI_RELATIONSHIP_DEPTH}=    ?depth=1
16
17 *** Keywords ***
18 Add Relationship
19     [Documentation]    Adds Relationship sub-object to existing object in AAI
20     [Arguments]    ${api_version_base_object_url}  ${related_class_name}  ${related_object_url}
21     ${arguments}=    Create Dictionary     related_class_name=${related_class_name}  related_object_url=${related_object_url}
22     Templating.Create Environment    aai    ${GLOBAL_TEMPLATE_FOLDER}
23     ${data}=   Templating.Apply Template    aai   ${AAI_ADD_RELATIONSHIP_BODY}    ${arguments}
24     ${put_resp}=    AAI.Run Put Request     ${AAI_FRONTEND_ENDPOINT}    ${api_version_base_object_url}/${AAI_RELATIONSHIP_PATH}     ${data}    auth=${GLOBAL_AAI_AUTHENTICATION}
25     ${status_string}=    Convert To String    ${put_resp.status_code}
26     Should Match Regexp    ${status_string}     ^(201|200)$
27
28 Get RelationshipList
29     [Documentation]   Return RelationshipList of the object in AAI
30     [Arguments]    ${api_version_base_object_url}
31     ${resp}=  Get Object With Depth  ${api_version_base_object_url}
32     Log    Returning response ${resp['${AAI_RELATIONSHIPLIST_PATH}']}
33     [Return]  ${resp['${AAI_RELATIONSHIPLIST_PATH}']}
34
35 Get Object With Depth
36     [Documentation]   Return Object with Depth parameter to show RelationshipList
37     [Arguments]    ${api_version_base_object_url}
38     ${resp}=    AAI.Run Get Request     ${AAI_FRONTEND_ENDPOINT}    ${api_version_base_object_url}${AAI_RELATIONSHIP_DEPTH}    auth=${GLOBAL_AAI_AUTHENTICATION}
39     Should Be Equal As Strings  ${resp.status_code}     200
40     Log    Returning response ${resp.json()}
41     [Return]  ${resp.json()}