aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources/aai
diff options
context:
space:
mode:
authorKeong Lim <keong.lim@huawei.com>2019-03-04 17:15:06 +1100
committerKeong Lim <keong.lim@huawei.com>2019-03-08 17:38:38 +1100
commit3a5d947fa699385b8180c890e96fe67e4a5c1905 (patch)
tree9fb8fb091f05779fca9703d76aa7a769fa8573fe /robot/resources/aai
parentb0e12b4535c7a63f81729f93e5d17d83aff6bc52 (diff)
AAI-2208 Add robot test cases for CCVPN use case
Testing of AAI in CSIT-style regression tests Testing of connectivities in AAI for CCVPN use case Ignore project file of RED tool Expand AAI properties to distinguish different AAI versions Fix bugs in aai_interface.robot Change-Id: Ie459e29aeb44840989360dd2da6858096fcfd358 Issue-ID: AAI-2208 Signed-off-by: Keong Lim <keong.lim@huawei.com>
Diffstat (limited to 'robot/resources/aai')
-rw-r--r--robot/resources/aai/aai_interface.robot4
-rw-r--r--robot/resources/aai/api_version_properties.robot12
-rw-r--r--robot/resources/aai/ccvpn-connectivities.robot80
3 files changed, 94 insertions, 2 deletions
diff --git a/robot/resources/aai/aai_interface.robot b/robot/resources/aai/aai_interface.robot
index b72103d0..c0600064 100644
--- a/robot/resources/aai/aai_interface.robot
+++ b/robot/resources/aai/aai_interface.robot
@@ -68,12 +68,12 @@ Run A&AI Delete Request
Delete A&AI Entity
[Documentation] Deletes an entity in A&AI
[Arguments] ${uri}
- ${get_resp}= Run A&AI Get Request ${VERSIONED_INDEX PATH}${uri}
+ ${get_resp}= Run A&AI Get Request ${VERSIONED_INDEX_PATH}${uri}
Run Keyword If '${get_resp.status_code}' == '200' Delete A&AI Entity Exists ${uri} ${get_resp.json()['resource-version']}
Delete A&AI Entity Exists
[Documentation] Deletes an A&AI entity
[Arguments] ${uri} ${resource_version_id}
- ${put_resp}= Run A&AI Delete Request ${VERSIONED_INDEX PATH}${uri} ${resource_version_id}
+ ${put_resp}= Run A&AI Delete Request ${VERSIONED_INDEX_PATH}${uri} ${resource_version_id}
Should Be Equal As Strings ${put_resp.status_code} 204
diff --git a/robot/resources/aai/api_version_properties.robot b/robot/resources/aai/api_version_properties.robot
new file mode 100644
index 00000000..17ba9de5
--- /dev/null
+++ b/robot/resources/aai/api_version_properties.robot
@@ -0,0 +1,12 @@
+*** Settings ***
+Documentation store all properties that can change or are used in multiple places here
+... format is all caps with underscores between words and prepended with AAI
+... make sure you prepend them with AAI so that other files can easily see it is from this file.
+
+
+*** Variables ***
+${AAI_AMSTERDAM_INDEX_PATH} /aai/v11
+${AAI_BEIJING_INDEX_PATH} /aai/v13
+${AAI_CASABLANCA_INDEX_PATH} /aai/v14
+${AAI_DUBLIN_INDEX_PATH} /aai/v16
+
diff --git a/robot/resources/aai/ccvpn-connectivities.robot b/robot/resources/aai/ccvpn-connectivities.robot
new file mode 100644
index 00000000..e4d7bd51
--- /dev/null
+++ b/robot/resources/aai/ccvpn-connectivities.robot
@@ -0,0 +1,80 @@
+*** Settings ***
+Documentation Operations on connectivities in AAI for CCVPN use case, using earliest API version where it is implemented and latest API version where it is not implemented
+
+Resource ../json_templater.robot
+Resource aai_interface.robot
+Resource api_version_properties.robot
+Library OperatingSystem
+Library Collections
+
+
+*** Variables ***
+${AAI_CONN_ROOT_PATH} /network/connectivities/connectivity
+${AAI_CONN_EXAMPLES_PATH} /examples/connectivities
+${AAI_CONN_NODES_PATH} /nodes/connectivities
+${AAI_ADD_CONNECTIVITY_BODY}= robot/assets/templates/aai/add-connectivity.template
+${AAI_CONN_API_NA_INDEX_PATH}= ${AAI_BEIJING_INDEX_PATH}
+${AAI_CONN_API_IMPL_INDEX_PATH}= ${AAI_CASABLANCA_INDEX_PATH}
+
+*** Keywords ***
+Create Connectivity If Not Exists
+ [Documentation] Creates Connectivity in AAI if it doesn't exist
+ [Arguments] ${connectivity_id}
+ ${get_resp}= Run A&AI Get Request ${AAI_CONN_API_IMPL_INDEX_PATH}${AAI_CONN_ROOT_PATH}/${connectivity_id}
+ Return From Keyword If '${get_resp.status_code}' == '200'
+ Create Connectivity ${connectivity_id}
+
+Create Connectivity
+ [Documentation] Creates Connectivity in AAI
+ [Arguments] ${connectivity_id}
+ ${arguments}= Create Dictionary connectivity_id=${connectivity_id}
+ ${data}= Fill JSON Template File ${AAI_ADD_CONNECTIVITY_BODY} ${arguments}
+ ${put_resp}= Run A&AI Put Request ${AAI_CONN_API_IMPL_INDEX_PATH}${AAI_CONN_ROOT_PATH}/${connectivity_id} ${data}
+ ${status_string}= Convert To String ${put_resp.status_code}
+ Should Match Regexp ${status_string} ^(201|200)$
+
+Delete Connectivity If Exists
+ [Documentation] Removes Connectivity from AAI if it exists
+ [Arguments] ${connectivity_id}
+ ${get_resp}= Run A&AI Get Request ${AAI_CONN_API_IMPL_INDEX_PATH}${AAI_CONN_ROOT_PATH}/${connectivity_id}
+ Run Keyword If '${get_resp.status_code}' == '200' Delete Connectivity ${connectivity_id} ${get_resp.json()}
+
+Delete Connectivity
+ [Documentation] Removes Connectivity from AAI
+ [Arguments] ${connectivity_id} ${json}
+ ${resource_version}= Catenate ${json['resource-version']}
+ ${put_resp}= Run A&AI Delete Request ${AAI_CONN_API_IMPL_INDEX_PATH}${AAI_CONN_ROOT_PATH}/${connectivity_id} ${resource_version}
+ Should Be Equal As Strings ${put_resp.status_code} 204
+
+Get Connectivity
+ [Documentation] Return Connectivity
+ [Arguments] ${connectivity_id}
+ ${resp}= Run A&AI Get Request ${AAI_CONN_API_IMPL_INDEX_PATH}${AAI_CONN_ROOT_PATH}/${connectivity_id}
+ Should Be Equal As Strings ${resp.status_code} 200
+ [Return] ${resp.json()}
+
+Get Nodes Query Connectivity
+ [Documentation] Return Nodes query Connectivity
+ [Arguments] ${connectivity_id}
+ ${resp}= Run A&AI Get Request ${AAI_CONN_API_IMPL_INDEX_PATH}${AAI_CONN_NODES_PATH}?connectivity-id=${connectivity_id}
+ Should Be Equal As Strings ${resp.status_code} 200
+ [Return] ${resp.json()}
+
+Get Example Connectivity
+ [Documentation] Return Example Connectivity
+ ${resp}= Run A&AI Get Request ${AAI_CONN_API_IMPL_INDEX_PATH}${AAI_CONN_EXAMPLES_PATH}
+ Should Be Equal As Strings ${resp.status_code} 200
+ [Return] ${resp.json()}
+
+Confirm No Connectivity
+ [Documentation] Confirm No Connectivity
+ [Arguments] ${connectivity_id}
+ ${resp}= Run A&AI Get Request ${AAI_CONN_API_IMPL_INDEX_PATH}${AAI_CONN_ROOT_PATH}/${connectivity_id}
+ Should Be Equal As Strings ${resp.status_code} 404
+
+Confirm API Not Implemented Connectivity
+ [Documentation] Confirm latest API version where Connectivity is not implemented
+ [Arguments] ${connectivity_id}
+ ${resp}= Run A&AI Get Request ${AAI_CONN_API_NA_INDEX_PATH}${AAI_CONN_ROOT_PATH}/${connectivity_id}
+ Should Be Equal As Strings ${resp.status_code} 400
+