Keong Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame^] | 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 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_ADD_RELATIONSHIP_BODY}= robot/assets/templates/aai/add-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_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 | |
| 29 | Get 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 | |
| 36 | Get 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 | |