Revert "Feature 11001: Robot framework linting for E2E tests"
This reverts commit 5e001f506b744021d5ef25999c9da28cf56d8fbc.
Change-Id: I37e214089048810454eee0e1e2fcea54632f8b3f
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/robot-systest/lib/connectivity_lib.resource b/robot-systest/lib/connectivity_lib.robot
similarity index 60%
rename from robot-systest/lib/connectivity_lib.resource
rename to robot-systest/lib/connectivity_lib.robot
index e91aedd..79381e4 100644
--- a/robot-systest/lib/connectivity_lib.resource
+++ b/robot-systest/lib/connectivity_lib.robot
@@ -1,4 +1,3 @@
-*** Comments ***
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -11,17 +10,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
-*** Settings ***
-Documentation Library providing keywords for testing connectivity to hosts via ping.
-Library OperatingSystem
-
-
*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-${CONNECTIVITY_POL_TIME} 5sec
-${CONNECTIVITY_MAX_WAIT_TIME} 30sec
-
+${success_return_code} 0
+${connectivity_pol_time} 5sec
+${connectivity_max_wait_time} 30sec
*** Keywords ***
Test Ping Host
@@ -30,12 +22,14 @@
... host: IP or name of the host
... Execution example:
... Ping Test \${host}
+
[Arguments] ${host}
- ${rc} ${stdout}= Run And Return Rc And Output ping -c 2 -W 1 ${host}
+
+ ${rc} ${stdout}= Run and Return RC and Output ping -c 2 -W 1 ${host}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
Test Connectivity
- [Documentation] Ping a host several times during ${CONNECTIVITY_MAX_WAIT_TIME} until it succeeds or raises a timeout.
[Arguments] ${host}
- Wait Until Keyword Succeeds ${CONNECTIVITY_MAX_WAIT_TIME} ${CONNECTIVITY_POL_TIME} Test Ping Host ${host}
+
+ WAIT UNTIL KEYWORD SUCCEEDS ${connectivity_max_wait_time} ${connectivity_pol_time} Test Ping Host ${host}
diff --git a/robot-systest/lib/juju_lib.resource b/robot-systest/lib/juju_lib.robot
similarity index 77%
rename from robot-systest/lib/juju_lib.resource
rename to robot-systest/lib/juju_lib.robot
index 3d02901..45208a8 100644
--- a/robot-systest/lib/juju_lib.resource
+++ b/robot-systest/lib/juju_lib.robot
@@ -1,4 +1,3 @@
-*** Comments ***
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -11,66 +10,59 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
-*** Settings ***
-Documentation Library providing keywords to read objects from Juju using juju client.
-Library String
-Resource ssh_lib.resource
-
-
*** Variables ***
-${SUCCESS_RETURN_CODE} 0
+${success_return_code} 0
*** Keywords ***
Get Scale Number
- [Documentation] Get from Juju the number of units (scale) of a juju application and return it.
[Arguments] ${endpoint} ${username} ${password} ${privatekey} ${application_name} ${model_name}
+
Should Not Be Empty ${application_name} ${model_name}
${host}= Remove String Using Regexp ${endpoint} :([0-9]+)$
${stdout}= Execute Remote Command Check Rc Return Output ${host} ${username} ${password} ${privatekey} juju show-status ${application_name} --format yaml -m ${model_name} | grep scale | awk -F ': ' '{print $2}'
Log ${stdout}
- RETURN ${stdout}
+ [Return] ${stdout}
Get Model Name
- [Documentation] Get from Juju the model from a KDU name and a NS id.
[Arguments] ${endpoint} ${username} ${password} ${privatekey} ${ns_id} ${kdu_name}
+
Should Not Be Empty ${ns_id} ${kdu_name}
${host}= Remove String Using Regexp ${endpoint} :([0-9]+)$
${stdout}= Execute Remote Command Check Rc Return Output ${host} ${username} ${password} ${privatekey} juju models | grep -i ${kdu_name} | grep -i ${ns_id} | cut -f1 -d " "
Log ${stdout}
${model_name}= Set Variable ${kdu_name}-${ns_id}
Should Be Equal As Strings ${model_name} ${stdout}
- RETURN ${stdout}
+ [Return] ${stdout}
Get Application Name VDU Level Charm
- [Documentation] Get from Juju the application name matching a model and a VDU profile id passed as arguments. The application name must contain the EE passed as argument.
[Arguments] ${endpoint} ${username} ${password} ${privatekey} ${model_name} ${vdu_profile_id} ${ee_name}
+
Should Not Be Empty ${model_name}
${host}= Remove String Using Regexp ${endpoint} :([0-9]+)$
${stdout}= Execute Remote Command Check Rc Return Output ${host} ${username} ${password} ${privatekey} juju status -m ${model_name} | grep "\\-vdu" | grep -v "*" | grep -i ${vdu_profile_id} | cut -f1 -d " "
Log ${stdout}
Should Not Be Empty ${stdout}
Should Contain ${stdout} ${ee_name}
- RETURN ${stdout}
+ [Return] ${stdout}
Get Application Name NS Level Charm
- [Documentation] Get from Juju the application name matching a model and a NS charm passed as arguments.
[Arguments] ${endpoint} ${username} ${password} ${privatekey} ${model_name} ${charm_name}
+
Should Not Be Empty ${model_name}
${host}= Remove String Using Regexp ${endpoint} :([0-9]+)$
${stdout}= Execute Remote Command Check Rc Return Output ${host} ${username} ${password} ${privatekey} juju status -m ${model_name} | grep "\\-ns" | grep -v "*" | grep -i ${charm_name} | cut -f1 -d " "
Log ${stdout}
Should Not Be Empty ${stdout}
- RETURN ${stdout}
+ [Return] ${stdout}
Get Application Name VNF Level Charm
- [Documentation] Get from Juju the application name matching a model and a VNF profile id passed as arguments. The application name must contain the EE passed as argument.
[Arguments] ${endpoint} ${username} ${password} ${privatekey} ${model_name} ${vnf_profile_id} ${ee_name}
+
Should Not Be Empty ${model_name}
${host}= Remove String Using Regexp ${endpoint} :([0-9]+)$
${stdout}= Execute Remote Command Check Rc Return Output ${host} ${username} ${password} ${privatekey} juju status -m ${model_name} | grep "\\-vnf" | grep -v "*" | grep -i ${vnf_profile_id} | cut -f1 -d " "
Log ${stdout}
Should Not Be Empty ${stdout}
Should Contain ${stdout} ${ee_name}
- RETURN ${stdout}
+ [Return] ${stdout}
\ No newline at end of file
diff --git a/robot-systest/lib/k8scluster_lib.resource b/robot-systest/lib/k8scluster_lib.resource
deleted file mode 100644
index 0895da7..0000000
--- a/robot-systest/lib/k8scluster_lib.resource
+++ /dev/null
@@ -1,90 +0,0 @@
-*** Comments ***
-# Copyright 2020 Canonical Ltd.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-*** Settings ***
-Documentation Library providing keywords for CRUD operations over Kubernetes clusters with OSM client.
-Library OperatingSystem
-
-
-*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-${K8SCLUSTER_LAUNCH_MAX_WAIT_TIME} 6min
-${K8SCLUSTER_LAUNCH_POL_TIME} 30sec
-${K8SCLUSTER_DELETE_MAX_WAIT_TIME} 2min
-${K8SCLUSTER_DELETE_POL_TIME} 15sec
-
-
-*** Keywords ***
-Create K8s Cluster
- [Documentation] Register a Kubernetes cluster in OSM using the name, version and credentials passed as arguments.
- [Arguments] ${k8scluster_creds} ${k8scluster_version} ${k8scluster_vim} ${k8scluster_net} ${k8scluster_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-add --creds ${k8scluster_creds} --version ${k8scluster_version} --vim ${k8scluster_vim} --k8s-nets '{"net1": "${k8scluster_net}"}' ${k8scluster_name} --description "Robot cluster"
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Wait Until Keyword Succeeds ${K8SCLUSTER_LAUNCH_MAX_WAIT_TIME} ${K8SCLUSTER_LAUNCH_POL_TIME} Check For K8s Cluster To Be Ready ${k8scluster_name}
- Check For K8s Cluster To Be Enabled ${k8scluster_name}
- RETURN ${stdout}
-
-Delete K8s Cluster
- [Documentation] Unregister/delete a Kubernetes cluster from OSM.
- [Arguments] ${k8scluster_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-delete ${k8scluster_name}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Wait Until Keyword Succeeds ${K8SCLUSTER_DELETE_MAX_WAIT_TIME} ${K8SCLUSTER_DELETE_POL_TIME} Check For K8s Cluster To Be Deleted ${k8scluster_name}
-
-Get K8s Cluster
- [Documentation] Get the list of Kubernetes clusters in OSM, and return it.
- ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-list
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Log ${stdout}
- RETURN ${stdout}
-
-Check For K8s Cluster
- [Documentation] Check if a Kubernetes cluster identified by name exists in OSM, and return it.
- [Arguments] ${k8scluster_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-list --filter name="${k8scluster_name}"
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Check For K8s Cluster To Be Deleted
- [Documentation] Check if a Kubernetes cluster identified by name is not present in OSM.
- [Arguments] ${k8scluster_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-list --filter name="${k8scluster_name}" | awk '{print $2}' | grep ${k8scluster_name}
- Log ${rc},${stdout}
- Should Be Empty ${stdout}
-
-Check For K8s Cluster To Be Ready
- [Documentation] Check if a Kubernetes cluster registered in OSM is ready (the state must be ENABLED or DEGRADED).
- [Arguments] ${k8scluster_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-list --filter name="${k8scluster_name}" --filter _admin.operationalState="ENABLED,DEGRADED"
- Log ${rc},${stdout}
- ${rc} ${stdout}= Run And Return Rc And Output echo "${stdout}" | awk '{print $2}' | grep ${k8scluster_name}
- Log ${rc},${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Be Equal As Strings ${stdout} ${k8scluster_name}
-
-Check For K8s Cluster To Be Enabled
- [Documentation] Check if the state of Kubernetes cluster registered in OSM is ENABLED.
- [Arguments] ${k8scluster_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-show ${k8scluster_name}
- Log ${rc},${stdout}
- ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-list --filter name="${k8scluster_name}" --filter _admin.operationalState="ENABLED"
- Log ${rc},${stdout}
- ${rc} ${stdout}= Run And Return Rc And Output echo "${stdout}" | awk '{print $2}' | grep ${k8scluster_name}
- Log ${rc},${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Be Equal As Strings ${stdout} ${k8scluster_name}
diff --git a/robot-systest/lib/k8scluster_lib.robot b/robot-systest/lib/k8scluster_lib.robot
new file mode 100644
index 0000000..8f642a3
--- /dev/null
+++ b/robot-systest/lib/k8scluster_lib.robot
@@ -0,0 +1,71 @@
+# Copyright 2020 Canonical Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Variables ***
+${success_return_code} 0
+${k8scluster_launch_max_wait_time} 6min
+${k8scluster_launch_pol_time} 30sec
+${k8scluster_delete_max_wait_time} 2min
+${k8scluster_delete_pol_time} 15sec
+
+*** Keywords ***
+Create K8s Cluster
+ [Arguments] ${k8scluster_creds} ${k8scluster_version} ${k8scluster_vim} ${k8scluster_net} ${k8scluster_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-add --creds ${k8scluster_creds} --version ${k8scluster_version} --vim ${k8scluster_vim} --k8s-nets '{"net1": "${k8scluster_net}"}' ${k8scluster_name} --description "Robot cluster"
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ WAIT UNTIL KEYWORD SUCCEEDS ${k8scluster_launch_max_wait_time} ${k8scluster_launch_pol_time} Check For K8s Cluster To Be Ready ${k8scluster_name}
+ Check For K8s Cluster To Be Enabled ${k8scluster_name}
+ [Return] ${stdout}
+
+Delete K8s Cluster
+ [Arguments] ${k8scluster_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-delete ${k8scluster_name}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ WAIT UNTIL KEYWORD SUCCEEDS ${k8scluster_delete_max_wait_time} ${k8scluster_delete_pol_time} Check For K8s Cluster To Be Deleted ${k8scluster_name}
+
+Get K8s Cluster
+ ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Log ${stdout}
+ [Return] ${stdout}
+
+Check for K8s Cluster
+ [Arguments] ${k8scluster_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list --filter name="${k8scluster_name}"
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+Check For K8s Cluster To Be Deleted
+ [Arguments] ${k8scluster_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list --filter name="${k8scluster_name}" | awk '{print $2}' | grep ${k8scluster_name}
+ Should Be Empty ${stdout}
+
+Check For K8s Cluster To Be Ready
+ [Arguments] ${k8scluster_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list --filter name="${k8scluster_name}" --filter _admin.operationalState="ENABLED,DEGRADED"
+ Log ${stdout}
+ ${rc} ${stdout}= Run and Return RC and Output echo "${stdout}" | awk '{print $2}' | grep ${k8scluster_name}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Be Equal As Strings ${stdout} ${k8scluster_name}
+
+Check For K8s Cluster To Be Enabled
+ [Arguments] ${k8scluster_name}
+ ${rc2} ${stdout2}= Run and Return RC and Output osm k8scluster-show ${k8scluster_name}
+ Log ${stdout2}
+ ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list --filter name="${k8scluster_name}" --filter _admin.operationalState="ENABLED"
+ Log ${stdout}
+ ${rc} ${stdout}= Run and Return RC and Output echo "${stdout}" | awk '{print $2}' | grep ${k8scluster_name}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Be Equal As Strings ${stdout} ${k8scluster_name}
diff --git a/robot-systest/lib/ns_lib.resource b/robot-systest/lib/ns_lib.resource
deleted file mode 100644
index 9d7276f..0000000
--- a/robot-systest/lib/ns_lib.resource
+++ /dev/null
@@ -1,221 +0,0 @@
-*** Comments ***
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-*** Settings ***
-Documentation Library to deploy and delete NS, and run operations on them.
-
-Library Collections
-Library DateTime
-Library OperatingSystem
-Library String
-
-
-*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-${NS_LAUNCH_POL_TIME} 30sec
-${NS_DELETE_POL_TIME} 15sec
-${VIM_TIMEOUT_MULTIPLIER} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0}
-
-
-*** Keywords ***
-Create Network Service
- [Documentation] Launch the instantation of a NS and verify in a loop that the NS instance is successfully created in a given time, and return the NS instance id.
- [Arguments] ${nsd} ${vim_name} ${ns_name} ${ns_config} ${publickey} ${ns_launch_max_wait_time}=5min ${config_file}=${EMPTY}
- ${ns_launch_max_wait_time}= Convert Time ${ns_launch_max_wait_time} result_format=number
- ${ns_launch_max_wait_time}= Evaluate ${ns_launch_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER}
- Log ${ns_launch_max_wait_time}
- ${config_attr}= Set Variable If "${ns_config}" != "${EMPTY}" --config '${ns_config}' ${EMPTY}
- ${sshkeys_attr}= Set Variable If "${publickey}" != "${EMPTY}" --ssh_keys ${publickey} ${EMPTY}
- ${config_file_attr}= Set Variable If "${config_file}" != "${EMPTY}" --config_file '${config_file}' ${EMPTY}
- ${ns_id}= Instantiate Network Service ${ns_name} ${nsd} ${vim_name} ${config_attr} ${sshkeys_attr} ${config_file_attr}
- Log ${ns_id}
- Wait Until Keyword Succeeds ${ns_launch_max_wait_time} ${NS_LAUNCH_POL_TIME} Check For NS Instance To Configured ${ns_name}
- Check For NS Instance For Failure ${ns_name}
- RETURN ${ns_id}
-
-Instantiate Network Service
- [Documentation] Launch the instantation of a NS, and return the NS instance id.
- [Arguments] ${ns_name} ${nsd} ${vim_name} ${ns_extra_args}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-create --ns_name ${ns_name} --nsd_name ${nsd} --vim_account ${vim_name} ${ns_extra_args}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Get Vnf Management Ip Address
- [Documentation] Get the mgmt IP address of a member VNF in a NS instance, and return it.
- [Arguments] ${ns_id} ${vnf_member_index}
- Should Not Be Empty ${ns_id}
- Should Not Be Empty ${vnf_member_index}
- ${rc} ${stdout}= Run And Return Rc And Output osm vnf-list --filter member-vnf-index-ref=${vnf_member_index} | grep ${ns_id} | awk '{print $14}' 2>&1
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Get Vnf Id
- [Documentation] Get the VNF instance ID of a member VNF in a NS instance, and return it.
- [Arguments] ${ns_id} ${vnf_member_index}
- Should Not Be Empty ${ns_id}
- Should Not Be Empty ${vnf_member_index}
- ${rc} ${stdout}= Run And Return Rc And Output osm vnf-list --filter member-vnf-index-ref=${vnf_member_index} | grep ${ns_id} | awk '{print $2}' 2>&1
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Get Ns Id
- [Documentation] Get the NS instance ID from a NS instance name passed as argument, and return it.
- [Arguments] ${ns_name}
- Should Not Be Empty ${ns_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-list | grep ${ns_name} | awk '{print $4}' 2>&1
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Not Be Empty ${stdout}
- RETURN ${stdout}
-
-Get Ns List
- [Documentation] Get the list of NS instances and return it.
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-list 2>&1
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Get Ns Vnf List
- [Documentation] Get the list of VNF instances of a given NS instance id, and return it.
- [Arguments] ${ns_id}
- Should Not Be Empty ${ns_id}
- @{vnf_list_string}= Run And Return Rc And Output osm vnf-list --ns ${ns_id} | grep ${ns_id} | awk '{print $2}' 2>&1
- # Returns a String of vnf_id and needs to be converted into a list
- @{vnf_list}= Split String ${vnf_list_string}[1]
- Log List ${vnf_list}
- RETURN @{vnf_list}
-
-Get Ns Ip List
- [Documentation] Obtain the list of IP addresses of all VM in a NS, and return it.
- [Arguments] @{vnf_list}
- Should Not Be Empty @{vnf_list}
- @{temp_list}= Create List
- FOR ${vnf_id} IN @{vnf_list}
- Log ${vnf_id}
- @{vnf_ip_list}= Get Vnf Ip List ${vnf_id}
- @{temp_list}= Combine Lists ${temp_list} ${vnf_ip_list}
- END
- Should Not Be Empty ${temp_list}
- RETURN @{temp_list}
-
-Get Vnf Ip List
- [Documentation] Obtain the list of IP addresses of all VM in a VNF, and return it.
- [Arguments] ${vnf_id}
- Should Not Be Empty ${vnf_id}
- @{vnf_ip_list_string}= Run And Return Rc And Output osm vnf-list --filter id=${vnf_id} | grep -o '[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}' | sort -t: -u -k1,1 2>&1
- # returns a string of ip addresses and needs to be converted into a list
- Should Not Be Empty ${vnf_ip_list_string}[1]
- @{vnf_ip_list}= Split String ${vnf_ip_list_string}[1]
- Log Many ${vnf_ip_list}
- Should Not Be Empty ${vnf_ip_list}
- RETURN @{vnf_ip_list}
-
-Check For Ns Instance To Configured
- [Documentation] Check if a given NS instance has completed the instantiation, no matter if it succeeded (the status should be READY or BROKEN).
- [Arguments] ${ns_name}
- ${rc} ${stdout}= Run And Return Rc And Output openstack server list
- Log ${rc},${stdout}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-list --filter name="${ns_name}"
- Log ${rc},${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Contain Any ${stdout} READY BROKEN
-
-Check For NS Instance For Failure
- [Documentation] Check if a given NS instance has not failed in the instantiation (the status should not be BROKEN).
- [Arguments] ${ns_name}
- ${rc} ${stdout}= Run And Return Rc And Output openstack server list
- Log ${rc},${stdout}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-list --filter name="${ns_name}"
- Log ${rc},${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Not Contain ${stdout} BROKEN
-
-Check For NS Instance To Be Deleted
- [Documentation] Check if a given NS instance is not present in OSM.
- [Arguments] ${ns}
- ${rc} ${stdout}= Run And Return Rc And Output openstack server list
- Log ${rc},${stdout}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-list | awk '{print $2}' | grep ${ns}
- Log ${rc},${stdout}
- Should Not Be Equal As Strings ${stdout} ${ns}
-
-Delete NS
- [Documentation] Delete a NS instance.
- [Arguments] ${ns} ${ns_delete_max_wait_time}=4min
- ${ns_delete_max_wait_time}= Convert Time ${ns_delete_max_wait_time} result_format=number
- ${ns_delete_max_wait_time}= Evaluate ${ns_delete_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER}
- Log ${ns_delete_max_wait_time}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-delete ${ns}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Wait Until Keyword Succeeds ${ns_delete_max_wait_time} ${NS_DELETE_POL_TIME} Check For NS Instance To Be Deleted ${ns}
-
-Get Ns Vnfr Ids
- [Documentation] Return a list with the IDs of the VNF records of a NS instance.
- [Arguments] ${ns_id}
- Should Not Be Empty ${ns_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm vnf-list --ns ${ns_id} | grep ${ns_id} | awk '{print $2}' 2>&1
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
- @{vdur}= Split String ${stdout}
- RETURN @{vdur}
-
-Get Vnf Vdur Names
- [Documentation] Return a list with the names of the VDU records of a VNF instance.
- [Arguments] ${vnf_id}
- Should Not Be Empty ${vnf_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq -r .vdur[].name
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
- @{vdur}= Split String ${stdout}
- RETURN @{vdur}
-
-Get Vnf Kdu Replica Count
- [Documentation] Return the number of KDU replicas (empty if none) of a VNF instance.
- [Arguments] ${vnf_id} ${kdu_name}
- Should Not Be Empty ${vnf_id}
- Should Not Be Empty ${kdu_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm vnf-show ${vnf_id} --kdu ${kdu_name} | yq -r .config.replicaCount
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
- ${return}= Set Variable If '${stdout}' == 'null' ${EMPTY} ${stdout}
- RETURN ${return}
-
-Get Application Names
- [Documentation] Return the list of the application of a VNF instance.
- [Arguments] ${ns_name}
- Should Not Be Empty ${ns_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-show ${ns_name} --literal | yq -r ._admin.deployed.VCA[].application
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
- @{app_names}= Split String ${stdout}
- RETURN ${app_names}
-
-Get VDU Affinity Group Name
- [Documentation] Return the affinity group name for a NF
- [Arguments] ${ns_name} ${vnf_id} ${vdur_id}
- ${rc} ${affinity_group_id}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(.id == "'${vdur_id}'")' | yq -r '."affinity-or-anti-affinity-group-id"[0]' 2>&1
- Log ${affinity_group_id}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${affinity_group_id} values=False
- ${rc} ${affinity_group_name}= Run And Return Rc And Output osm ns-show ${ns_name} --literal | yq '."affinity-or-anti-affinity-group"[] | select(.id == "'${affinity_group_id}'")' | yq -r '.name' 2>&1
- Log ${affinity_group_name}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${affinity_group_name} values=False
- RETURN ${affinity_group_name}
-
-GET Dual Ip
- [Documentation] Get dual ip from the ns list
- [Arguments] ${ns_id}
- Should Not Be Empty ${ns_id}
- ${rc} ${stdout}= Run And Return RC And Output osm ns-show ${ns_id} --literal | grep -A2 ip-address | awk '{print $2}' | paste -sd ',' | sed 's/^,//; s/,/, /g' | sed 's/^/[/; s/$/]/'
- Log ${rc},${stdout}
- RETURN ${stdout}
diff --git a/robot-systest/lib/ns_lib.robot b/robot-systest/lib/ns_lib.robot
new file mode 100644
index 0000000..c8da271
--- /dev/null
+++ b/robot-systest/lib/ns_lib.robot
@@ -0,0 +1,427 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Documentation Library to deploy and delete NS, and run operations on them.
+
+Library DateTime
+
+
+*** Variables ***
+${success_return_code} 0
+${ns_launch_pol_time} 30sec
+${ns_delete_pol_time} 15sec
+${ns_action_max_wait_time} 1min
+${ns_action_pol_time} 15sec
+${vnf_scale_pol_time} 15sec
+${healing_pol_time} 15sec
+${vim_timeout_multiplier} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0}
+
+
+*** Keywords ***
+Create Network Service
+ [Arguments] ${nsd} ${vim_name} ${ns_name} ${ns_config} ${publickey} ${ns_launch_max_wait_time}=5min ${config_file}=${EMPTY}
+
+ ${ns_launch_max_wait_time}= Convert Time ${ns_launch_max_wait_time} result_format=number
+ ${ns_launch_max_wait_time}= Evaluate ${ns_launch_max_wait_time} * ${vim_timeout_multiplier}
+ Log ${ns_launch_max_wait_time}
+ ${config_attr} Set Variable If '${ns_config}'!='${EMPTY}' --config '${ns_config}' \
+ ${sshkeys_attr} Set Variable If '${publickey}'!='${EMPTY}' --ssh_keys ${publickey} \
+ ${config_file_attr} Set Variable If '${config_file}'!='${EMPTY}' --config_file '${config_file}' \
+
+ ${ns_id}= Instantiate Network Service ${ns_name} ${nsd} ${vim_name} ${config_attr} ${sshkeys_attr} ${config_file_attr}
+ Log ${ns_id}
+
+ WAIT UNTIL KEYWORD SUCCEEDS ${ns_launch_max_wait_time} ${ns_launch_pol_time} Check For NS Instance To Configured ${ns_name}
+ Check For NS Instance For Failure ${ns_name}
+ [Return] ${ns_id}
+
+
+Instantiate Network Service
+ [Arguments] ${ns_name} ${nsd} ${vim_name} ${ns_extra_args}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-create --ns_name ${ns_name} --nsd_name ${nsd} --vim_account ${vim_name} ${ns_extra_args}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Update Network Service
+ [Arguments] ${ns_id} ${update_type} ${ns_update_config} ${ns_update_timeout}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-update ${ns_id} --updatetype ${update_type} --config ${ns_update_config} --timeout ${ns_update_timeout} --wait
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Get Vnf Management Ip Address
+ [Arguments] ${ns_id} ${vnf_member_index}
+
+ Should Not Be Empty ${ns_id}
+ Should Not Be Empty ${vnf_member_index}
+ ${rc} ${stdout}= Run and Return RC and Output osm vnf-list --filter member-vnf-index-ref=${vnf_member_index} | grep ${ns_id} | awk '{print $14}' 2>&1
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Get Vnf Id
+ [Arguments] ${ns_id} ${vnf_member_index}
+
+ Should Not Be Empty ${ns_id}
+ Should Not Be Empty ${vnf_member_index}
+ ${rc} ${stdout}= Run and Return RC and Output osm vnf-list --filter member-vnf-index-ref=${vnf_member_index} | grep ${ns_id} | awk '{print $2}' 2>&1
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Get Ns Id
+ [Arguments] ${ns_name}
+
+ Should Not Be Empty ${ns_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-list | grep ${ns_name} | awk '{print $4}' 2>&1
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Not Be Empty ${stdout}
+ [Return] ${stdout}
+
+
+Get Ns List
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-list 2>&1
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Get Ns Vnf List
+ [Arguments] ${ns_id}
+
+ Should Not Be Empty ${ns_id}
+ @{vnf_list_string}= Run and Return RC and Output osm vnf-list --ns ${ns_id} | grep ${ns_id} | awk '{print $2}' 2>&1
+ # Returns a String of vnf_id and needs to be converted into a list
+ @{vnf_list} = Split String ${vnf_list_string}[1]
+ Log List ${vnf_list}
+ [Return] @{vnf_list}
+
+
+Get Ns Ip List
+ [Arguments] @{vnf_list}
+
+ should not be empty @{vnf_list}
+ @{temp_list}= Create List
+ FOR ${vnf_id} IN @{vnf_list}
+ Log ${vnf_id}
+ @{vnf_ip_list} Get Vnf Ip List ${vnf_id}
+ @{temp_list}= Combine Lists ${temp_list} ${vnf_ip_list}
+ END
+ should not be empty ${temp_list}
+ [return] @{temp_list}
+
+
+Get Vnf Ip List
+ [arguments] ${vnf_id}
+
+ should not be empty ${vnf_id}
+ @{vnf_ip_list_string}= run and return rc and output osm vnf-list --filter id=${vnf_id} | grep -o '[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}' | sort -t: -u -k1,1 2>&1
+ # returns a string of ip addresses and needs to be converted into a list
+ should not be empty ${vnf_ip_list_string}[1]
+ @{vnf_ip_list} = split string ${vnf_ip_list_string}[1]
+ Log Many ${vnf_ip_list}
+ should not be empty ${vnf_ip_list}
+ [return] @{vnf_ip_list}
+
+
+Check For Ns Instance To Configured
+ [arguments] ${ns_name}
+
+ ${rc} ${stdout}= Run and Return RC and Output openstack server list
+ Log ${stdout}
+ ${rc} ${stdout}= run and return rc and output osm ns-list --filter name="${ns_name}"
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Contain Any ${stdout} READY BROKEN
+
+Check For NS Instance For Failure
+ [Arguments] ${ns_name}
+
+ ${rc} ${stdout}= Run and Return RC and Output openstack server list
+ Log ${stdout}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-list --filter name="${ns_name}"
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Not Contain ${stdout} BROKEN
+
+Check For NS Instance To Be Deleted
+ [Arguments] ${ns}
+
+ ${rc} ${stdout}= Run and Return RC and Output openstack server list
+ Log ${stdout}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-list | awk '{print $2}' | grep ${ns}
+ Should Not Be Equal As Strings ${stdout} ${ns}
+
+Delete NS
+ [Documentation] Delete ns
+ [Arguments] ${ns} ${ns_delete_max_wait_time}=4min
+
+ ${ns_delete_max_wait_time}= Convert Time ${ns_delete_max_wait_time} result_format=number
+ ${ns_delete_max_wait_time}= Evaluate ${ns_delete_max_wait_time} * ${vim_timeout_multiplier}
+ Log ${ns_delete_max_wait_time}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-delete ${ns}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+ WAIT UNTIL KEYWORD SUCCEEDS ${ns_delete_max_wait_time} ${ns_delete_pol_time} Check For NS Instance To Be Deleted ${ns}
+
+Execute NS Action
+ [Documentation] Execute an action over the desired NS.
+ ... Parameters are given to this function in key=value format (one argument per key/value pair).
+ ... Return the ID of the operation associated to the executed action.
+ ... Examples of execution:
+ ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index}
+ ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} \${param1}=\${value1} \${param2}=\${value2}
+
+ [Arguments] ${ns_name} ${ns_action} ${vnf_member_index} @{action_params}
+
+ ${params}= Set Variable ${EMPTY}
+ FOR ${param} IN @{action_params}
+ ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in parameters
+ ${params}= Catenate SEPARATOR= ${params} "${param_name}":"${param_value}",
+ END
+ ${osm_ns_action_command}= Set Variable osm ns-action --action_name ${ns_action} --vnf_name ${vnf_member_index}
+ ${osm_ns_action_command}= Run Keyword If '${params}'!='${EMPTY}' Catenate ${osm_ns_action_command} --params '{${params}}'
+ ... ELSE Set Variable ${osm_ns_action_command}
+ ${osm_ns_action_command}= Catenate ${osm_ns_action_command} ${ns_name}
+ ${rc} ${stdout}= Run and Return RC and Output ${osm_ns_action_command}
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
+ Wait Until Keyword Succeeds ${ns_action_max_wait_time} ${ns_action_pol_time} Check For NS Operation Ended ${stdout}
+ Check For NS Operation Completed ${stdout}
+ [Return] ${stdout}
+
+
+Execute NS K8s Action
+ [Documentation] Execute an action over the desired K8s NS.
+ ... Parameters are given to this function in key=value format (one argument per key/value pair).
+ ... Return the ID of the operation associated to the executed action.
+ ... Examples of execution:
+ ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index}
+ ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} \${param1}=\${value1} \${param2}=\${value2}
+
+ [Arguments] ${ns_name} ${ns_action} ${vnf_member_index} ${kdu_name} @{action_params}
+
+ ${params}= Set Variable ${EMPTY}
+ FOR ${param} IN @{action_params}
+ ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in parameters
+ ${params}= Catenate SEPARATOR= ${params} "${param_name}":"${param_value}",
+ END
+ ${osm_ns_action_command}= Set Variable osm ns-action --action_name ${ns_action} --vnf_name ${vnf_member_index} --kdu_name ${kdu_name}
+ ${osm_ns_action_command}= Run Keyword If '${params}'!='${EMPTY}' Catenate ${osm_ns_action_command} --params '{${params}}'
+ ... ELSE Set Variable ${osm_ns_action_command}
+ ${osm_ns_action_command}= Catenate ${osm_ns_action_command} ${ns_name}
+ ${rc} ${stdout}= Run and Return RC and Output ${osm_ns_action_command}
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
+ Wait Until Keyword Succeeds ${ns_action_max_wait_time} ${ns_action_pol_time} Check For NS Operation Ended ${stdout}
+ Check For NS Operation Completed ${stdout}
+ [Return] ${stdout}
+
+
+Execute Manual VNF Scale
+ [Documentation] Execute a manual VNF Scale action.
+ ... The parameter 'scale_type' must be SCALE_IN or SCALE_OUT.
+ ... Return the ID of the operation associated to the executed scale action.
+
+ [Arguments] ${ns_name} ${vnf_member_index} ${scaling_group} ${scale_type} ${vnf_scale_max_wait_time}=2min
+
+ ${vnf_scale_max_wait_time}= Convert Time ${vnf_scale_max_wait_time} result_format=number
+ ${vnf_scale_max_wait_time}= Evaluate ${vnf_scale_max_wait_time} * ${vim_timeout_multiplier}
+ Should Contain Any ${scale_type} SCALE_IN SCALE_OUT msg=Unknown scale type: ${scale_type} values=False
+ ${osm_vnf_scale_command}= Set Variable osm vnf-scale --scaling-group ${scaling_group}
+ ${osm_vnf_scale_command}= Run Keyword If '${scale_type}'=='SCALE_IN' Catenate ${osm_vnf_scale_command} --scale-in
+ ... ELSE Catenate ${osm_vnf_scale_command} --scale-out
+ ${osm_vnf_scale_command}= Catenate ${osm_vnf_scale_command} ${ns_name} ${vnf_member_index}
+ ${rc} ${stdout}= Run and Return RC and Output ${osm_vnf_scale_command}
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
+ Wait Until Keyword Succeeds ${vnf_scale_max_wait_time} ${vnf_scale_pol_time} Check For NS Operation Ended ${stdout}
+ Check For NS Operation Completed ${stdout}
+ [Return] ${stdout}
+
+
+Heal Network Service
+ [Documentation] Execute healing operation over one NS.
+ ... Return the ID of the operation associated to the executed healing action.
+
+ [Arguments] ${ns_name} ${params} ${healing_max_wait_time}=10m
+
+ Should Not Be Empty ${ns_name}
+ Should Not Be Empty ${params}
+ ${healing_max_wait_time}= Convert Time ${healing_max_wait_time} result_format=number
+ ${healing_max_wait_time}= Evaluate ${healing_max_wait_time} * ${vim_timeout_multiplier}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-heal ${ns_name} ${params}
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
+ Wait Until Keyword Succeeds ${healing_max_wait_time} ${healing_pol_time} Check For NS Operation Ended ${stdout}
+ Check For NS Operation Completed ${stdout}
+ [Return] ${stdout}
+
+
+Get Operations List
+ [Arguments] ${ns_name}
+
+ Should Not Be Empty ${ns_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-op-list ${ns_name}
+ Log ${stdout}
+ Log ${rc}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+
+Check For NS Operation Completed
+ [Documentation] Check whether the status of the desired operation is "COMPLETED" or not.
+
+ [Arguments] ${ns_operation_id}
+
+ Should Not Be Empty ${ns_operation_id}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Contain ${stdout} COMPLETED msg=The ns-action with id ${ns_operation_id} was not completed values=False
+
+
+Check For NS Operation Failed
+ [Documentation] Check whether the status of the desired operation is "FAILED" or not.
+
+ [Arguments] ${ns_operation_id}
+
+ Should Not Be Empty ${ns_operation_id}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Contain ${stdout} FAILED msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False
+
+
+Check For NS Operation Ended
+ [Documentation] Check whether the status of the desired operation is "FAILED" or "COMPLETED".
+
+ [Arguments] ${ns_operation_id}
+
+ Should Not Be Empty ${ns_operation_id}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Contain Any ${stdout} FAILED COMPLETED msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False
+
+
+Check For NS Operation Cancelled
+ [Documentation] Check whether the operation was cancelled or not.
+
+ [Arguments] ${ns_operation_id}
+
+ Should Not Be Empty ${ns_operation_id}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq -r '.operationState, .isCancelPending'
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Contain ${stdout} FAILED_TEMP\nfalse msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False
+
+
+Get Ns Vnfr Ids
+ [Documentation] Return a list with the IDs of the VNF records of a NS instance.
+
+ [Arguments] ${ns_id}
+
+ Should Not Be Empty ${ns_id}
+ ${rc} ${stdout}= Run and Return RC and Output osm vnf-list --ns ${ns_id} | grep ${ns_id} | awk '{print $2}' 2>&1
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
+ @{vdur} = Split String ${stdout}
+ [Return] @{vdur}
+
+
+Get Vnf Vdur Names
+ [Documentation] Return a list with the names of the VDU records of a VNF instance.
+
+ [Arguments] ${vnf_id}
+
+ Should Not Be Empty ${vnf_id}
+ ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r .vdur[].name
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
+ @{vdur} = Split String ${stdout}
+ [Return] @{vdur}
+
+
+Get Vnf Kdu Replica Count
+ [Documentation] Return the number of KDU replicas (empty if none) of a VNF instance.
+
+ [Arguments] ${vnf_id} ${kdu_name}
+
+ Should Not Be Empty ${vnf_id}
+ Should Not Be Empty ${kdu_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --kdu ${kdu_name} | yq -r .config.replicaCount
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
+ ${return} = Set Variable If '${stdout}' == 'null' ${EMPTY} ${stdout}
+ [Return] ${return}
+
+
+Get Application Names
+ [Documentation] Return the list of the application of a VNF instance.
+
+ [Arguments] ${ns_name}
+
+ Should Not Be Empty ${ns_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-show ${ns_name} --literal | yq -r ._admin.deployed.VCA[].application
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
+ @{app_names} = Split String ${stdout}
+ [Return] ${app_names}
+
+
+Get VDU Affinity Group Name
+ [Documentation] Return the affinity group name for a NF
+
+ [Arguments] ${ns_name} ${vnf_id} ${vdur_id}
+
+ ${rc} ${affinity_group_id}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(.id == "'${vdur_id}'")' | yq -r '."affinity-or-anti-affinity-group-id"[0]' 2>&1
+ Log ${affinity_group_id}
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${affinity_group_id} values=False
+ ${rc} ${affinity_group_name}= Run and Return RC and Output osm ns-show ${ns_name} --literal | yq '."affinity-or-anti-affinity-group"[] | select(.id == "'${affinity_group_id}'")' | yq -r '.name' 2>&1
+ Log ${affinity_group_name}
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${affinity_group_name} values=False
+ [Return] ${affinity_group_name}
+
+Get Operations By Type
+ [Documentation] Keyword to get the operation by type
+
+ [Arguments] ${ns_id} ${type}
+
+ Should Not Be Empty ${ns_id}
+ Should Not Be Empty ${type}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-op-list ${ns_id} | grep ${type} | awk '{print $2}' 2>&1
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Not Be Empty ${stdout}
+ [Return] ${stdout}
+
+Cancel operation By Id
+ [Documentation] Cancels an ongoing operation by operation ID
+
+ [Arguments] ${op_id} ${cancel_mode}=GRACEFUL
+
+ Should Not Be Empty ${op_id}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-op-cancel ${op_id} --cancel_mode ${cancel_mode} --wait
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+GET Dual Ip
+ [Documentation] Get dual ip from the ns list
+ [Arguments] ${ns_id}
+ Should Not Be Empty ${ns_id}
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-show ${ns_id} --literal | grep -A2 ip-address | awk '{print $2}' | paste -sd ',' | sed 's/^,//; s/,/, /g' | sed 's/^/[/; s/$/]/'
+ Log ${stdout}
+ [Return] ${stdout}
+
diff --git a/robot-systest/lib/ns_operation_lib.resource b/robot-systest/lib/ns_operation_lib.resource
deleted file mode 100644
index 968fdd9..0000000
--- a/robot-systest/lib/ns_operation_lib.resource
+++ /dev/null
@@ -1,189 +0,0 @@
-*** Comments ***
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-*** Settings ***
-Documentation Library to deploy and delete NS, and run operations on them.
-
-Library Collections
-Library DateTime
-Library OperatingSystem
-Library String
-
-
-*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-${NS_ACTION_MAX_WAIT_TIME} 1min
-${NS_ACTION_POL_TIME} 15sec
-${VNF_SCALE_POL_TIME} 15sec
-${HEALING_POL_TIME} 15sec
-${VIM_TIMEOUT_MULTIPLIER} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0}
-
-
-*** Keywords ***
-Update Network Service
- [Documentation] Run an update operation over a NS instance, and return the operation id.
- [Arguments] ${ns_id} ${update_type} ${ns_update_config} ${ns_update_timeout}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-update ${ns_id} --updatetype ${update_type} --config ${ns_update_config} --timeout ${ns_update_timeout} --wait
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Execute NS Action
- [Documentation] Execute an action over the desired NS.
- ... Parameters are given to this function in key=value format (one argument per key/value pair).
- ... Return the ID of the operation associated to the executed action.
- ... Examples of execution:
- ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index}
- ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} \${param1}=\${value1} \${param2}=\${value2}
-
- [Arguments] ${ns_name} ${ns_action} ${vnf_member_index} @{action_params}
- ${params}= Set Variable ${EMPTY}
- FOR ${param} IN @{action_params}
- ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in parameters
- Log ${match},${param_name},${param_value}
- ${params}= Catenate SEPARATOR= ${params} "${param_name}":"${param_value}",
- END
- ${osm_ns_action_command}= Set Variable osm ns-action --action_name ${ns_action} --vnf_name ${vnf_member_index}
- IF '${params}' != '${EMPTY}'
- ${osm_ns_action_command}= Catenate ${osm_ns_action_command} --params '{${params}}'
- ELSE
- ${osm_ns_action_command}= Set Variable ${osm_ns_action_command}
- END
- ${osm_ns_action_command}= Catenate ${osm_ns_action_command} ${ns_name}
- ${rc} ${stdout}= Run And Return Rc And Output ${osm_ns_action_command}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
- Wait Until Keyword Succeeds ${NS_ACTION_MAX_WAIT_TIME} ${NS_ACTION_POL_TIME} Check For NS Operation Ended ${stdout}
- Check For NS Operation Completed ${stdout}
- RETURN ${stdout}
-
-Execute NS K8s Action
- [Documentation] Execute an action over the desired K8s NS.
- ... Parameters are given to this function in key=value format (one argument per key/value pair).
- ... Return the ID of the operation associated to the executed action.
- ... Examples of execution:
- ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index}
- ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} \${param1}=\${value1} \${param2}=\${value2}
-
- [Arguments] ${ns_name} ${ns_action} ${vnf_member_index} ${kdu_name} @{action_params}
-
- ${params}= Set Variable ${EMPTY}
- FOR ${param} IN @{action_params}
- ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in parameters
- Log ${match},${param_name},${param_value}
- ${params}= Catenate SEPARATOR= ${params} "${param_name}":"${param_value}",
- END
- ${osm_ns_action_command}= Set Variable osm ns-action --action_name ${ns_action} --vnf_name ${vnf_member_index} --kdu_name ${kdu_name}
- IF '${params}' != '${EMPTY}'
- ${osm_ns_action_command}= Catenate ${osm_ns_action_command} --params '{${params}}'
- ELSE
- ${osm_ns_action_command}= Set Variable ${osm_ns_action_command}
- END
- ${osm_ns_action_command}= Catenate ${osm_ns_action_command} ${ns_name}
- ${rc} ${stdout}= Run And Return Rc And Output ${osm_ns_action_command}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
- Wait Until Keyword Succeeds ${NS_ACTION_MAX_WAIT_TIME} ${NS_ACTION_POL_TIME} Check For NS Operation Ended ${stdout}
- Check For NS Operation Completed ${stdout}
- RETURN ${stdout}
-
-Execute Manual VNF Scale
- [Documentation] Execute a manual VNF Scale action.
- ... The parameter 'scale_type' must be SCALE_IN or SCALE_OUT.
- ... Return the ID of the operation associated to the executed scale action.
- [Arguments] ${ns_name} ${vnf_member_index} ${scaling_group} ${scale_type} ${vnf_scale_max_wait_time}=2min
- ${vnf_scale_max_wait_time}= Convert Time ${vnf_scale_max_wait_time} result_format=number
- ${vnf_scale_max_wait_time}= Evaluate ${vnf_scale_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER}
- Should Contain Any ${scale_type} SCALE_IN SCALE_OUT msg=Unknown scale type: ${scale_type} values=False
- ${osm_vnf_scale_command}= Set Variable osm vnf-scale --scaling-group ${scaling_group}
- IF ${scale_type}=='SCALE_IN'
- ${osm_vnf_scale_command}= Catenate ${osm_vnf_scale_command} --scale-in
- ELSE
- ${osm_vnf_scale_command}= Catenate ${osm_vnf_scale_command} --scale-out
- END
- ${osm_vnf_scale_command}= Catenate ${osm_vnf_scale_command} ${ns_name} ${vnf_member_index}
- ${rc} ${stdout}= Run And Return Rc And Output ${osm_vnf_scale_command}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
- Wait Until Keyword Succeeds ${vnf_scale_max_wait_time} ${VNF_SCALE_POL_TIME} Check For NS Operation Ended ${stdout}
- Check For NS Operation Completed ${stdout}
- RETURN ${stdout}
-
-Heal Network Service
- [Documentation] Execute healing operation over one NS.
- ... Return the ID of the operation associated to the executed healing action.
- [Arguments] ${ns_name} ${params} ${healing_max_wait_time}=10m
- Should Not Be Empty ${ns_name}
- Should Not Be Empty ${params}
- ${healing_max_wait_time}= Convert Time ${healing_max_wait_time} result_format=number
- ${healing_max_wait_time}= Evaluate ${healing_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-heal ${ns_name} ${params}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
- Wait Until Keyword Succeeds ${healing_max_wait_time} ${HEALING_POL_TIME} Check For NS Operation Ended ${stdout}
- Check For NS Operation Completed ${stdout}
- RETURN ${stdout}
-
-Get Operations List
- [Documentation] Get the list of operations of a given NS instance.
- [Arguments] ${ns_name}
- Should Not Be Empty ${ns_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-op-list ${ns_name}
- Log ${stdout}
- Log ${rc}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
-
-Check For NS Operation Completed
- [Documentation] Check wheter the status of the desired operation is "COMPLETED" or not.
- [Arguments] ${ns_operation_id}
- Should Not Be Empty ${ns_operation_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Contain ${stdout} COMPLETED msg=The ns-action with id ${ns_operation_id} was not completed values=False
-
-Check For NS Operation Failed
- [Documentation] Check wheter the status of the desired operation is "FAILED" or not.
- [Arguments] ${ns_operation_id}
- Should Not Be Empty ${ns_operation_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Contain ${stdout} FAILED msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False
-
-Check For NS Operation Ended
- [Documentation] Check wheter the status of the desired operation is "FAILED" or "COMPLETED".
- [Arguments] ${ns_operation_id}
- Should Not Be Empty ${ns_operation_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Contain Any ${stdout} FAILED COMPLETED msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False
-
-Get Operations By Type
- [Documentation] Keyword to get the operation by type
- [Arguments] ${ns_id} ${type}
- Should Not Be Empty ${ns_id}
- Should Not Be Empty ${type}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-op-list ${ns_id} | grep ${type} | awk '{print $2}' 2>&1
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Not Be Empty ${stdout}
- RETURN ${stdout}
-
-Cancel Operation By Id
- [Documentation] Cancels an ongoing operation by operation ID
- [Arguments] ${op_id} ${cancel_mode}=GRACEFUL
-
- Should Not Be Empty ${op_id}
- ${rc} ${stdout}= Run And Return RC And Output osm ns-op-cancel ${op_id} --cancel_mode ${cancel_mode} --wait
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${success_return_code}
- RETURN ${stdout}
diff --git a/robot-systest/lib/nsd_lib.resource b/robot-systest/lib/nsd_lib.resource
deleted file mode 100644
index 175322b..0000000
--- a/robot-systest/lib/nsd_lib.resource
+++ /dev/null
@@ -1,63 +0,0 @@
-*** Comments ***
-# Copyright 2019 Tech Mahindra Limited
-#
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-
-*** Settings ***
-Documentation Library providing keywords for CRUD operations over NSD/NSpkg with OSM client.
-
-Library OperatingSystem
-Library String
-
-
-*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-${NSD_DELETE_MAX_WAIT_TIME} 1min
-${NSD_DELETE_POL_TIME} 15sec
-
-
-*** Keywords ***
-Get NSDs List
- [Documentation] Get the list of NS packages and log it.
- ${rc} ${stdout}= Run And Return Rc And Output osm nspkg-list
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
-
-Create NSD
- [Documentation] Upload a NS package to OSM and return the id.
- [Arguments] ${nsd_pkg}
- ${rc} ${stdout}= Run And Return Rc And Output osm nspkg-create ${nsd_pkg}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- ${lines}= Get Line Count ${stdout}
- ${last}= Evaluate ${lines} - 1
- ${id}= Get Line ${stdout} ${last}
- RETURN ${id}
-
-Delete NSD
- [Documentation] Delete a NS package from OSM.
- [Arguments] ${nsd_id}
- ${rc} ${stdout}= Run Keyword And Continue On Failure Run And Return Rc And Output osm nspkg-delete ${nsd_id}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Log ${stdout}
- Wait Until Keyword Succeeds ${NSD_DELETE_MAX_WAIT_TIME} ${NSD_DELETE_POL_TIME} Check For NSD ${nsd_id}
-
-Check For NSD
- [Documentation] Check that a NS package exists in OSM.
- [Arguments] ${nsd_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm nspkg-list | awk '{print $2}' | grep ${nsd_id}
- Log ${rc},${stdout}
- Should Not Be Equal As Strings ${stdout} ${nsd_id}
diff --git a/robot-systest/lib/nsd_lib.robot b/robot-systest/lib/nsd_lib.robot
new file mode 100644
index 0000000..40132d7
--- /dev/null
+++ b/robot-systest/lib/nsd_lib.robot
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+
+##
+# Copyright 2019 Tech Mahindra Limited
+#
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+##
+
+## Change log:
+# 1. Feature 7829: Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 06-sep-2019
+##
+
+*** Settings ***
+Library String
+
+
+*** Variables ***
+${success_return_code} 0
+${delete_max_wait_time} 1min
+${delete_pol_time} 15sec
+
+
+*** Keywords ***
+Get NSDs List
+ ${rc} ${stdout}= Run and Return RC and Output osm nspkg-list
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+
+Create NSD
+ [Arguments] ${nsd_pkg}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm nspkg-create ${nsd_pkg}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ ${lines}= Get Line Count ${stdout}
+ ${last}= Evaluate ${lines} - 1
+ ${id}= Get Line ${stdout} ${last}
+ [Return] ${id}
+
+
+Delete NSD
+ [Arguments] ${nsd_id}
+
+ ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm nspkg-delete ${nsd_id}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Log ${stdout}
+ WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For NSD ${nsd_id}
+
+
+Check For NSD
+ [Arguments] ${nsd_id}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm nspkg-list | awk '{print $2}' | grep ${nsd_id}
+ Should Not Be Equal As Strings ${stdout} ${nsd_id}
diff --git a/robot-systest/lib/nsi_lib.resource b/robot-systest/lib/nsi_lib.robot
similarity index 75%
rename from robot-systest/lib/nsi_lib.resource
rename to robot-systest/lib/nsi_lib.robot
index 74c67a6..1b88396 100644
--- a/robot-systest/lib/nsi_lib.resource
+++ b/robot-systest/lib/nsi_lib.robot
@@ -1,4 +1,3 @@
-*** Comments ***
# Copyright 2020 Atos
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,26 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
*** Settings ***
-Documentation Library providing keywords for CRUD operations over Network Slice Instances with OSM client.
-
Library Collections
-Library OperatingSystem
-Library DateTime
-Library String
-
-Resource ns_lib.resource
*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-${SLICE_LAUNCH_POL_TIME} 30sec
-${SLICE_DELETE_POL_TIME} 15sec
-${VIM_TIMEOUT_MULTIPLIER} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0}
+${success_return_code} 0
+${slice_launch_pol_time} 30sec
+${slice_delete_pol_time} 15sec
+${vim_timeout_multiplier} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0}
*** Keywords ***
+
Create Network Slice
[Documentation] Instantiates a NST and returns an instantiation id (nsi), verifying the slice is successfully instantiated
... Parameters:
@@ -43,17 +35,22 @@
... publickey: SSH public key of the local machine
... Execution example:
... \${nsi}= Create Network Slice \${nst} \${vim_name} \${slice_name} \${slice_config} \${publickey}
+
[Arguments] ${nst} ${vim_name} ${slice_name} ${slice_config} ${publickey} ${slice_launch_max_wait_time}=6min ${config_file}=${EMPTY}
+
${slice_launch_max_wait_time}= Convert Time ${slice_launch_max_wait_time} result_format=number
- ${slice_launch_max_wait_time}= Evaluate ${slice_launch_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER}
- ${config_attr}= Set Variable If "${slice_config}" != "${EMPTY}" --config '${slice_config}' ${EMPTY}
- ${sshkeys_attr}= Set Variable If "${publickey}" != "${EMPTY}" --ssh_keys ${publickey} ${EMPTY}
- ${config_file_attr}= Set Variable If "${config_file}" != "${EMPTY}" --config_file '${config_file}' ${EMPTY}
+ ${slice_launch_max_wait_time}= Evaluate ${slice_launch_max_wait_time} * ${vim_timeout_multiplier}
+ ${config_attr} Set Variable If '${slice_config}'!='${EMPTY}' --config '${slice_config}' \
+ ${sshkeys_attr} Set Variable If '${publickey}'!='${EMPTY}' --ssh_keys ${publickey} \
+ ${config_file_attr} Set Variable If '${config_file}'!='${EMPTY}' --config_file '${config_file}' \
+
${nsi_id}= Instantiate Network Slice ${slice_name} ${nst} ${vim_name} ${config_attr} ${config_file_attr} ${sshkeys_attr}
Log ${nsi_id}
- Wait Until Keyword Succeeds ${slice_launch_max_wait_time} ${SLICE_LAUNCH_POL_TIME} Check For Network Slice Instance To Configured ${slice_name}
+
+ WAIT UNTIL KEYWORD SUCCEEDS ${slice_launch_max_wait_time} ${slice_launch_pol_time} Check For Network Slice Instance To Configured ${slice_name}
Check For Network Slice Instance For Failure ${slice_name}
- RETURN ${nsi_id}
+ [Return] ${nsi_id}
+
Instantiate Network Slice
[Documentation] Instantiates a NST and returns an instantiation id (nsi)
@@ -64,11 +61,14 @@
... slice_extra_args: Extra parameters that might require the slice instantiation i.e. configuration attributes
... Execution example:
... \${nsi}= Instantiate Network Slice \${slice_name} \${nst} \${vim_name} \${config_attr}
+
[Arguments] ${slice_name} ${nst} ${vim_name} ${slice_extra_args} ${sshkeys_attr}
- ${rc} ${stdout}= Run And Return Rc And Output osm nsi-create --nsi_name ${slice_name} --nst_name ${nst} --vim_account ${vim_name} ${sshkeys_attr} ${slice_extra_args}
- Log ${rc},${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm nsi-create --nsi_name ${slice_name} --nst_name ${nst} --vim_account ${vim_name} ${sshkeys_attr} ${slice_extra_args}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Get Slice Ns List
[Documentation] Retrieves the list of NS in a slice
@@ -76,13 +76,16 @@
... slice_name: Name of the slice instance
... Execution example:
... \@{slice_ns_list}= Get Slice Ns List \${slice_name}
+
[Arguments] ${slice_name}
+
Should Not Be Empty ${slice_name}
- @{ns_list_string}= Run And Return Rc And Output osm ns-list | grep ${slice_name} | awk '{print $4}' 2>&1
+ @{ns_list_string}= Run and Return RC and Output osm ns-list | grep ${slice_name} | awk '{print $4}' 2>&1
# Returns a String of ns_id and needs to be converted into a list
- @{ns_list}= Split String ${ns_list_string}[1]
+ @{ns_list} = Split String ${ns_list_string}[1]
Log List ${ns_list}
- RETURN @{ns_list}
+ [Return] @{ns_list}
+
Get Slice Ns List Except One
[Documentation] Retrieves the list of NS in a slice removing one from the list. This is done to save time in the tests, avoiding one VNF to ping itself.
@@ -91,14 +94,18 @@
... exception_ns: Name of the ns that will not appear in the final list
... Execution example:
... \@{slice_ns_list}= Get Slice Ns List Except One \${slice_name} \${exception_ns}
+
[Arguments] ${slice_name} ${exception_ns}
+
Should Not Be Empty ${slice_name}
Should Not Be Empty ${exception_ns}
- @{ns_list_string}= Run And Return Rc And Output osm ns-list | grep ${slice_name} | awk '!/${exception_ns}/' | awk '{print $4}' 2>&1
+
+ @{ns_list_string}= Run and Return RC and Output osm ns-list | grep ${slice_name} | awk '!/${exception_ns}/' | awk '{print $4}' 2>&1
# Returns a String of ns_id and needs to be converted into a list
- @{ns_list}= Split String ${ns_list_string}[1]
+ @{ns_list} = Split String ${ns_list_string}[1]
Log List ${ns_list}
- RETURN @{ns_list}
+ [Return] @{ns_list}
+
Get Slice Ns Count
[Documentation] Returns the count of all the NS in a slice
@@ -106,12 +113,15 @@
... slice_name: Name of the slice instance
... Execution example:
... \${slice_ns_count}= Get Slice Ns Count \${slice_name}
+
[Arguments] ${slice_name}
+
Should Not Be Empty ${slice_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm ns-list | grep ${slice_name} | wc -l 2>&1
+ ${rc} ${stdout}= Run and Return RC and Output osm ns-list | grep ${slice_name} | wc -l 2>&1
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Get Slice Vnf Ip Addresses
[Documentation] Retrieves the list of IP addresses that belong to each of the VNFs in the slice
@@ -119,21 +129,24 @@
... slice_name: Name of the slice instance
... Execution example:
... \@{slice_ip_address_list}= Get Slice Vnf Ip Addresses \${slice_name}
+
[Arguments] ${slice_name}
+
# Get all the ns_id in the slice
- @{slice_ns_list}= Get Slice Ns List ${slice_name}
+ @{slice_ns_list} Get Slice Ns List ${slice_name}
Log Many @{slice_ns_list}
@{temp_list}= Create List
# For each ns_id in the list, get all the vnf_id and their IP addresses
FOR ${ns_id} IN @{slice_ns_list}
Log ${ns_id}
- @{vnf_id_list}= Get Ns Vnf List ${ns_id}
+ @{vnf_id_list} Get Ns Vnf List ${ns_id}
# For each vnf_id in the list, get all its IP addresses
- @{ns_ip_list}= Get Ns Ip List @{vnf_id_list}
+ @{ns_ip_list} Get Ns Ip List @{vnf_id_list}
@{temp_list}= Combine Lists ${temp_list} ${ns_ip_list}
END
Log List ${temp_list}
- RETURN @{temp_list}
+ [Return] @{temp_list}
+
Check For Network Slice Instance To Configured
[Documentation] Verify the slice has been instantiated
@@ -141,24 +154,30 @@
... slice_name: Name of the slice instance
... Execution example:
... Check For Network Slice Instance To Configured \${slice_name}
+
[Arguments] ${slice_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm nsi-list --filter name="${slice_name}"
+
+ ${rc} ${stdout}= Run and Return RC and Output osm nsi-list --filter name="${slice_name}"
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
Should Contain Any ${stdout} READY BROKEN configured
+
Check For Network Slice Instance For Failure
[Documentation] Verify the slice instance is not in failure
... Parameters:
... slice_name: Name of the slice instance
... Execution example:
... Check For Network Slice Instance For Failure \${slice_name}
+
[Arguments] ${slice_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm nsi-list --filter name="${slice_name}"
+
+ ${rc} ${stdout}= Run and Return RC and Output osm nsi-list --filter name="${slice_name}"
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
Should Not Contain ${stdout} failed
+
Delete NSI
[Documentation] Delete Network Slice Instance (NSI)
... Parameters:
@@ -166,13 +185,17 @@
... slice_delete_max_wait_time: Delete operation timeout
... Execution example:
... Delete NST \${slice_name}
+
[Arguments] ${slice_name} ${slice_delete_max_wait_time}=4min
- ${rc} ${stdout}= Run And Return Rc And Output osm nsi-delete ${slice_name}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm nsi-delete ${slice_name}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
${slice_delete_max_wait_time}= Convert Time ${slice_delete_max_wait_time} result_format=number
- ${slice_delete_max_wait_time}= Evaluate ${slice_delete_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER}
- Wait Until Keyword Succeeds ${slice_delete_max_wait_time} ${SLICE_DELETE_POL_TIME} Check For Network Slice Instance To Be Deleted ${slice_name}
+ ${slice_delete_max_wait_time}= Evaluate ${slice_delete_max_wait_time} * ${vim_timeout_multiplier}
+ WAIT UNTIL KEYWORD SUCCEEDS ${slice_delete_max_wait_time} ${slice_delete_pol_time} Check For Network Slice Instance To Be Deleted ${slice_name}
+
Check For Network Slice Instance To Be Deleted
[Documentation] Verify the slice instance is not present
@@ -180,7 +203,10 @@
... slice_name: Name of the slice instance
... Execution example:
... Check For Network Slice Instance \${slice_name}
+
[Arguments] ${slice_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm nsi-list | awk '{print $2}' | grep ${slice_name}
- Log ${rc},${stdout}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm nsi-list | awk '{print $2}' | grep ${slice_name}
Should Not Be Equal As Strings ${stdout} ${slice_name}
+
+
diff --git a/robot-systest/lib/nst_lib.resource b/robot-systest/lib/nst_lib.resource
deleted file mode 100644
index 0bb2e1b..0000000
--- a/robot-systest/lib/nst_lib.resource
+++ /dev/null
@@ -1,57 +0,0 @@
-*** Comments ***
-# Copyright 2020 Atos
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-*** Settings ***
-Documentation Library providing keywords for CRUD operations over Network Slice Templates with OSM client.
-Library OperatingSystem
-
-
-*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-${NST_DELETE_MAX_WAIT_TIME} 1min
-${NST_DELETE_POL_TIME} 15sec
-
-
-*** Keywords ***
-Get NST List
- [Documentation] Get the list of Network Slice Templates (NST) and log it.
- ${rc} ${stdout}= Run And Return Rc And Output osm netslice-template-list
- Log ${stdout}
- Log ${rc}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
-
-Create NST
- [Documentation] Upload a Network Slice Template (NST) to OSM and return the id.
- [Arguments] ${nst}
- ${rc} ${stdout}= Run And Return Rc And Output osm netslice-template-create ${nst}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Delete NST
- [Documentation] Delete a Network Slice Template (NST) from OSM.
- [Arguments] ${nst_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm netslice-template-delete ${nst_id}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Wait Until Keyword Succeeds ${NST_DELETE_MAX_WAIT_TIME} ${NST_DELETE_POL_TIME} Check For NST ${nst_id}
-
-Check For NST
- [Documentation] Check that a Network Slice Template (NST) exists in OSM.
- [Arguments] ${nst_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm netslice-template-list | awk '{print $2}' | grep ${nst_id}
- Log ${rc},${stdout}
- Should Not Be Equal As Strings ${stdout} ${nst_id}
diff --git a/robot-systest/lib/nst_lib.robot b/robot-systest/lib/nst_lib.robot
new file mode 100644
index 0000000..6fac729
--- /dev/null
+++ b/robot-systest/lib/nst_lib.robot
@@ -0,0 +1,53 @@
+# Copyright 2020 Atos
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Variables ***
+${success_return_code} 0
+${ns_launch_max_wait_time} 5min
+${ns_launch_pol_time} 30sec
+${ns_delete_max_wait_time} 1min
+${ns_delete_pol_time} 15sec
+
+*** Keywords ***
+Get NST List
+ ${rc} ${stdout}= Run and Return RC and Output osm netslice-template-list
+ Log ${stdout}
+ Log ${rc}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+
+Create NST
+ [Arguments] ${nst}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm netslice-template-create ${nst}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Delete NST
+ [Arguments] ${nst_id}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm netslice-template-delete ${nst_id}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For NST ${nst_id}
+
+
+Check For NST
+ [Arguments] ${nst_id}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm netslice-template-list | awk '{print $2}' | grep ${nst_id}
+ Should Not Be Equal As Strings ${stdout} ${nst_id}
+
diff --git a/robot-systest/lib/openstack_lib.resource b/robot-systest/lib/openstack_lib.robot
similarity index 61%
rename from robot-systest/lib/openstack_lib.resource
rename to robot-systest/lib/openstack_lib.robot
index 385362b..b654cfd 100644
--- a/robot-systest/lib/openstack_lib.resource
+++ b/robot-systest/lib/openstack_lib.robot
@@ -1,4 +1,3 @@
-*** Comments ***
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -11,183 +10,204 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
-*** Settings ***
-Documentation Library providing keywords to interact with Openstack with openstack client.
-
-Library OperatingSystem
-Library String
-
-Resource ns_lib.resource
-Resource vnf_lib.resource
-
-
*** Variables ***
-${SUCCESS_RETURN_CODE} 0
+${success_return_code} 0
*** Keywords ***
Get Server Flavor ID
- [Documentation] Get from Openstack the flavor id of a server/VM passed as argument.
[Arguments] ${server_id}
+
Should Not Be Empty ${server_id}
- ${rc} ${stdout}= Run And Return Rc And Output openstack server show ${server_id} | grep flavor | awk 'NR>1{print $1}' RS='(' FS=')'
+ ${rc} ${stdout}= Run and Return RC and Output openstack server show ${server_id} | grep flavor | awk 'NR>1{print $1}' RS='(' FS=')'
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Get Flavor Properties
- [Documentation] Get from Openstack the properties of a flavor passed as argument.
[Arguments] ${flavor_id}
+
Should Not Be Empty ${flavor_id}
- ${rc} ${stdout}= Run And Return Rc And Output openstack flavor show ${flavor_id} | grep properties | awk -F '|' '{print $3}'
+ ${rc} ${stdout}= Run and Return RC and Output openstack flavor show ${flavor_id} | grep properties | awk -F '|' '{print $3}'
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Check NS Servers In VIM
[Documentation] Check if the number of servers in Openstack by filtering by NS name is as expected.
[Arguments] ${ns_name} ${number}
+
Should Not Be Empty ${ns_name}
- ${rc} ${stdout}= Run And Return Rc And Output openstack server list | grep ${ns_name} | awk '{print $4}'
+ ${rc} ${stdout}= Run and Return RC and Output openstack server list | grep ${ns_name} | awk '{print $4}'
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- @{servers}= Split String ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ @{servers} = Split String ${stdout}
${n_servers}= Get Length ${servers}
Should Be Equal As Integers ${number} ${n_servers}
+
Check If Volume Bootable
[Documentation] Check the volume properties and return whether it is bootable or not.
[Arguments] ${volume_id}
+
Should Not Be Empty ${volume_id}
- ${rc} ${stdout}= Run And Return Rc And Output openstack volume show ${volume_id} | grep bootable | awk '{print $4}'
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ ${rc} ${stdout}= Run and Return RC and Output openstack volume show ${volume_id} | grep bootable | awk '{print $4}'
+ log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Get Project Quota
[Documentation] Get a field (ram, cores, ports, etc.) from quota in current project.
[Arguments] ${field}
+
Should Not Be Empty ${field}
- ${rc} ${stdout}= Run And Return Rc And Output openstack quota show -f yaml | yq '.[] | select(.Resource=="${field}") | .Limit'
+ ${rc} ${stdout}= Run and Return RC and Output openstack quota show -f yaml | yq '.[] | select(.Resource=="${field}") | .Limit'
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Get Server Property
[Documentation] Get a field (flavor, image, volumes_attached, etc.) from a server.
[Arguments] ${server_id} ${field}
+
Should Not Be Empty ${server_id}
Should Not Be Empty ${field}
- ${rc} ${stdout}= Run And Return Rc And Output openstack server show ${server_id} -c ${field} -f value
+ ${rc} ${stdout}= Run and Return RC and Output openstack server show ${server_id} -c ${field} -f value
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Check VM In Server Group
[Documentation] Check if a given server is included in an Openstack server group
[Arguments] ${server_id} ${server_group_name}
+
Should Not Be Empty ${server_group_name}
Should Not Be Empty ${server_id}
- ${rc} ${stdout}= Run And Return Rc And Output openstack server group show ${server_group_name} -c members -f value
+ ${rc} ${stdout}= Run and Return RC and Output openstack server group show ${server_group_name} -c members -f value
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
Should Contain ${stdout} ${server_id}
+
Set Volume Id
[Documentation] Sets the root volume ID and ordinary volume ID by checking bootable property of volumes
[Arguments] ${volume_match} ${index}
+
Should Not Be Empty ${volume_match} ${index}
${bootable}= Check If Volume Bootable ${volume_match}[${index}]
- IF ${bootable}=='true'
- Set Suite Variable ${ROOT_VOL_ID} ${volume_match}[${index}]
- IF not ${index}
- Set Suite Variable ${ORDINARY_VOL_ID} ${volume_match}[1]
+ Set Suite Variable ${bootable}
+ IF '${bootable}'=='true'
+ Set Suite Variable ${root_vol_id} ${volume_match}[${index}]
+ IF ${index}==0
+ Set Suite Variable ${ordinary_vol_id} ${volume_match}[1]
ELSE
- Set Suite Variable ${ORDINARY_VOL_ID} ${volume_match}[0]
+ Set Suite Variable ${ordinary_vol_id} ${volume_match}[0]
END
END
+
Get Persistent Volumes Attached To Vm
[Documentation] Sets the root volume ID and ordinary volume ID by checking bootable property of volumes
[Arguments] ${ns_id}
+
Variable Should Exist ${ns_id} msg=NS is not available
${vnfs_list}= Get Ns Vnf List ${ns_id}
${vim_id}= Get VNF VIM ID ${vnfs_list}[0]
${volumes_attached}= Get Server Property ${vim_id} volumes_attached
- Log ${volumes_attached}
+ log ${volumes_attached}
${stdout}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1
- Log ${stdout}
- RETURN ${stdout}
+ log ${stdout}
+ [Return] ${stdout}
+
Check If Volume Exists
[Documentation] Checks if a volume id exists
[Arguments] ${volume_id}
+
Should Not Be Empty ${volume_id}
- ${rc} ${stdout}= Run And Return Rc And Output openstack volume list | grep ${volume_id} | wc -l
+ ${rc} ${stdout}= Run and Return RC and Output openstack volume list | grep ${volume_id} | wc -l
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Delete Volume
[Documentation] Delete a volume by its identifier
[Arguments] ${volume_id}
+
Should Not Be Empty ${volume_id}
- ${rc} ${stdout}= Run And Return Rc And Output openstack volume delete ${volume_id}
+ ${rc} ${stdout}= Run and Return RC and Output openstack volume delete ${volume_id}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Get Subnet
[Documentation] Get subnet information in JSON format
[Arguments] ${subnet_id}
+
Should Not Be Empty ${subnet_id}
- ${rc} ${stdout}= Run And Return Rc And Output openstack subnet show ${subnet_id} -f json
+ ${rc} ${stdout}= Run and Return RC and Output openstack subnet show ${subnet_id} -f json
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Stop Server
[Documentation] Stop a server
[Arguments] ${server_id}
+
Should Not Be Empty ${server_id}
- ${rc} ${stdout}= Run And Return Rc And Output openstack server stop ${server_id}
+ ${rc} ${stdout}= Run and Return RC and Output openstack server stop ${server_id}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Halt Server
[Documentation] Reset a server
[Arguments] ${server_id}
+
Should Not Be Empty ${server_id}
- ${rc} ${stdout}= Run And Return Rc And Output openstack server set --state error ${server_id}
+ ${rc} ${stdout}= Run and Return RC and Output openstack server set --state error ${server_id}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Delete Server
[Documentation] Delete a server
[Arguments] ${server_id}
+
Should Not Be Empty ${server_id}
- ${rc} ${stdout}= Run And Return Rc And Output openstack server delete ${server_id}
+ ${rc} ${stdout}= Run and Return RC and Output openstack server delete ${server_id}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Create Flavor
[Documentation] Create a Flavor
[Arguments] ${flavor_name} ${cpu}=1 ${ram}=1024 ${disk}=10
+
Should Not Be Empty ${flavor_name}
- ${rc} ${flavor_id}= Run And Return Rc And Output openstack flavor create ${flavor_name} --ram ${ram} --disk ${disk} --vcpus ${cpu} -c id -f value
+ ${rc} ${flavor_id}= Run and Return RC and Output openstack flavor create ${flavor_name} --ram ${ram} --disk ${disk} --vcpus ${cpu} -c id -f value
Log ${flavor_id}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${flavor_id}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${flavor_id}
+
Delete Flavor
[Documentation] Delete a Flavor
[Arguments] ${flavor_id}
+
Should Not Be Empty ${flavor_id}
- ${rc} ${stdout}= Run And Return Rc And Output openstack flavor delete ${flavor_id}
+ ${rc} ${stdout}= Run and Return RC and Output openstack flavor delete ${flavor_id}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
diff --git a/robot-systest/lib/package_lib.resource b/robot-systest/lib/package_lib.resource
deleted file mode 100644
index b563463..0000000
--- a/robot-systest/lib/package_lib.resource
+++ /dev/null
@@ -1,67 +0,0 @@
-*** Comments ***
-# Copyright ETSI Contributors and Others.
-#
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-
-*** Settings ***
-Documentation Library providing keywords for building, validating and uploading tar.gz NS and VNF package files with OSM client.
-Library String
-Library OperatingSystem
-
-
-*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-
-
-*** Keywords ***
-Upload Package
- [Documentation] Onboards ("creates") a NF Package into OSM.
- ... - Parameters:
- ... - pkg: Name (and location) of the NF Package
- [Arguments] ${pkg}
- # Proceeds with the onboarding with the appropriate arguments
- ${rc} ${stdout}= Run And Return Rc And Output tar -czf ${pkg}.tar.gz -C ${pkg} .
- Log ${rc},${stdout}
- ${rc} ${stdout}= Run And Return Rc And Output osm upload-package ${pkg}.tar.gz
- Log ${rc},${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Delete Package
- [Documentation] Delete a tar.gz package passed as argument from the filesystem.
- [Arguments] ${pkg}
- # Proceeds with the onboarding with the appropriate arguments
- ${rc} ${stdout}= Run And Return Rc And Output rm ${pkg}.tar.gz
- Log ${rc},${stdout}
-
-Package Build
- [Documentation] Build the package NS, VNF given the package_folder
- [Arguments] ${pkg_folder} ${skip_charm_build}=${EMPTY}
- ${skip_charm}= Set Variable If "${skip_charm_build}" != "${EMPTY}" "--skip-charm-build" ${EMPTY}
- ${rc} ${stdout}= Run And Return Rc And Output osm package-build ${pkg_folder} ${skip_charm}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Contain ${stdout} Package created
- ${package}= Get Line ${stdout} -1
- RETURN ${package}
-
-Package Validate
- [Documentation] Validate descriptors given a base directory
- [Arguments] ${pkg_folder}
- ${rc} ${stdout}= Run And Return Rc And Output osm package-validate ${pkg_folder} | awk -F\| '$2 !~ /-/ && $4 ~ /OK|ERROR/ {print $4}'
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Contain ${stdout} 'OK'
- ${package}= Get Line ${stdout} -1
- RETURN ${package}
diff --git a/robot-systest/lib/package_lib.robot b/robot-systest/lib/package_lib.robot
new file mode 100644
index 0000000..a9d3804
--- /dev/null
+++ b/robot-systest/lib/package_lib.robot
@@ -0,0 +1,79 @@
+# -*- coding: utf-8 -*-
+
+##
+# Copyright ETSI Contributors and Others.
+#
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+##
+
+*** Settings ***
+Library String
+Library OperatingSystem
+
+
+*** Variables ***
+${success_return_code} 0
+${delete_max_wait_time} 1min
+${delete_pol_time} 15sec
+
+
+*** Keywords ***
+Upload Package
+ [Documentation] Onboards ("creates") a NF Package into OSM.
+ ... - Parameters:
+ ... - pkg: Name (and location) of the NF Package
+
+ [Arguments] ${pkg}
+
+ # Proceedes with the onboarding with the appropriate arguments
+ ${rc} ${stdout}= Run and Return RC and Output tar -czf ${pkg}.tar.gz -C ${pkg} .
+ ${rc} ${stdout}= Run and Return RC and Output osm upload-package ${pkg}.tar.gz
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Delete Package
+ [Arguments] ${pkg}
+
+ # Proceedes with the onboarding with the appropriate arguments
+ ${rc} ${stdout}= Run and Return RC and Output rm ${pkg}.tar.gz
+
+
+Package Build
+ [Documentation] Build the package NS, VNF given the package_folder
+
+ [Arguments] ${pkg_folder} ${skip_charm_build}=${EMPTY}
+
+ ${skip_charm} Set Variable If '${skip_charm_build}'!='${EMPTY}' --skip-charm-build \
+ ${rc} ${stdout}= Run and Return RC and Output osm package-build ${pkg_folder} ${skip_charm}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Contain ${stdout} Package created
+ ${package}= Get Line ${stdout} -1
+
+ [Return] ${package}
+
+
+Package Validate
+ [Documentation] Validate descriptors given a base directory
+
+ [Arguments] ${pkg_folder}
+ ${rc} ${stdout}= Run and Return RC and Output osm package-validate ${pkg_folder} | awk -F\| '$2 !~ /-/ && $4 ~ /OK|ERROR/ {print $4}'
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Contain ${stdout} 'OK'
+ ${package}= Get Line ${stdout} -1
+
+ [Return] ${package}
+
diff --git a/robot-systest/lib/project_lib.resource b/robot-systest/lib/project_lib.resource
deleted file mode 100644
index a46ee61..0000000
--- a/robot-systest/lib/project_lib.resource
+++ /dev/null
@@ -1,125 +0,0 @@
-*** Comments ***
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-*** Settings ***
-Documentation Library providing keywords for CRUD operations over projects with OSM client.
-Library OperatingSystem
-
-
-*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-
-
-*** Keywords ***
-Create Project
- [Documentation] Create a project in OSM with the name passed as argument, and return the project id.
- [Arguments] ${project_name}
- Should Not Be Empty ${project_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm project-create ${project_name}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Create Project With Quotas
- [Documentation] Create a project in OSM with the name and quotas passed as arguments, and return the project id.
- [Arguments] ${project_name} ${project_quotas}
- Should Not Be Empty ${project_name}
- Should Not Be Empty ${project_quotas}
- ${rc} ${stdout}= Run And Return Rc And Output osm project-create ${project_name} --quotas ${project_quotas}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Get Project Quotas
- [Documentation] Get from OSM a specific quota parameter from the project passed as argument.
- [Arguments] ${project_name} ${quotas_name}
- Should Not Be Empty ${project_name}
- Should Not Be Empty ${quotas_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm project-show ${project_name} | grep '${quotas_name}' | awk -F ',|: ' '{print $2}' | awk '{print $1}'
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Update Project Quotas
- [Documentation] Update in OSM the quotas of a project with the new quotas passed as arguments.
- [Arguments] ${project_name} ${project_quotas}
- Should Not Be Empty ${project_name}
- Should Not Be Empty ${project_quotas}
- ${rc} ${stdout}= Run And Return Rc And Output osm project-update ${project_name} --quotas ${project_quotas}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
-
-Update Project Name
- [Documentation] Update in OSM the name of a project with the new name passed as argument.
- [Arguments] ${project_name} ${new_name}
- Should Not Be Empty ${project_name}
- Should Not Be Empty ${new_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm project-update ${project_name} --name ${new_name}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
-
-Check If User Is Assigned To Project
- [Documentation] Check in OSM if a user exists in a project passed as argument.
- [Arguments] ${user_name} ${project_name}
- Should Not Be Empty ${user_name}
- Should Not Be Empty ${project_name}
- ${rc} ${stdout}= Run And Return RC And Output osm user-show ${user_name} | grep "project_name" | grep "${project_name}"
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
-
-Create VNFD In Project
- [Documentation] Onboards a VNF package into an OSM project.
- ... Extra parameters (such as 'override') are given to this function in name=value format. These parameters will be appended to the 'osm vnfpkg-create' command with the next syntax: --param_name=param_value
- [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password} @{optional_parameters}
- Should Not Be Empty ${project_name}
- Should Not Be Empty ${vnfd_pkg}
- Should Not Be Empty ${project_user}
- Should Not Be Empty ${user_password}
- ${osm_pkg_create_command}= Set Variable osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-create ${vnfd_pkg}
- FOR ${param} IN @{optional_parameters}
- ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters
- Log ${match},${param_name},${param_value}
- ${osm_pkg_create_command}= Catenate ${osm_pkg_create_command} --${param_name}=${param_value}
- END
- ${rc} ${stdout}= Run And Return Rc And Output ${osm_pkg_create_command}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Delete VNFD In Project
- [Documentation] Deletes a VNF package from an OSM project.
- [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password}
- Should Not Be Empty ${project_name}
- Should Not Be Empty ${vnfd_pkg}
- Should Not Be Empty ${project_user}
- Should Not Be Empty ${user_password}
- ${rc} ${stdout}= Run And Return Rc And Output osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-delete ${vnfd_pkg}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
-
-Remove User From Project
- [Documentation] Remove a specific user from a specific project in OSM.
- [Arguments] ${user_name} ${project_name}
- Should Not Be Empty ${user_name}
- Should Not Be Empty ${project_name}
- ${rc} ${stdout}= Run And Return RC And Output osm user-update ${user_name} --remove-project ${project_name}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
-
-Delete Project
- [Documentation] Delete from OSM the project passed as argument.
- [Arguments] ${project_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm project-delete ${project_name}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
diff --git a/robot-systest/lib/project_lib.robot b/robot-systest/lib/project_lib.robot
new file mode 100644
index 0000000..35366e2
--- /dev/null
+++ b/robot-systest/lib/project_lib.robot
@@ -0,0 +1,130 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Variables ***
+${success_return_code} 0
+
+
+*** Keywords ***
+Create Project
+ [Arguments] ${project_name}
+
+ Should Not Be Empty ${project_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm project-create ${project_name}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Create Project With Quotas
+ [Arguments] ${project_name} ${project_quotas}
+
+ Should Not Be Empty ${project_name}
+ Should Not Be Empty ${project_quotas}
+ ${rc} ${stdout}= Run and Return RC and Output osm project-create ${project_name} --quotas ${project_quotas}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Get Project Quotas
+ [Arguments] ${project_name} ${quotas_name}
+
+ Should Not Be Empty ${project_name}
+ Should Not Be Empty ${quotas_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm project-show ${project_name} | grep '${quotas_name}' | awk -F ',|: ' '{print $2}' | awk '{print $1}'
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Update Project Quotas
+ [Arguments] ${project_name} ${project_quotas}
+
+ Should Not Be Empty ${project_name}
+ Should Not Be Empty ${project_quotas}
+ ${rc} ${stdout}= Run and Return RC and Output osm project-update ${project_name} --quotas ${project_quotas}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+
+Update Project Name
+ [Arguments] ${project_name} ${new_name}
+
+ Should Not Be Empty ${project_name}
+ Should Not Be Empty ${new_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm project-update ${project_name} --name ${new_name}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+
+Check If User Is Assigned To Project
+ [Arguments] ${user_name} ${project_name}
+
+ Should Not Be Empty ${user_name}
+ Should Not Be Empty ${project_name}
+ ${rc} ${stdout}= Run And Return RC And Output osm user-show ${user_name} | grep "project_name" | grep "${project_name}"
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+
+Create VNFD In Project
+ [Documentation] Onboards a VNFD package into an OSM project.
+ ... Extra parameters (such as 'override') are given to this function in name=value format. These parameters will be appended to the 'osm vnfpkg-create' command with the next syntax: --param_name=param_value
+
+ [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password} @{optional_parameters}
+
+ Should Not Be Empty ${project_name}
+ Should Not Be Empty ${vnfd_pkg}
+ Should Not Be Empty ${project_user}
+ Should Not Be Empty ${user_password}
+
+ ${osm_pkg_create_command}= Set Variable osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-create ${vnfd_pkg}
+ FOR ${param} IN @{optional_parameters}
+ ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters
+ ${osm_pkg_create_command}= Catenate ${osm_pkg_create_command} --${param_name}=${param_value}
+ END
+
+ ${rc} ${stdout}= Run and Return RC and Output ${osm_pkg_create_command}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Delete VNFD In Project
+ [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password}
+
+ Should Not Be Empty ${project_name}
+ Should Not Be Empty ${vnfd_pkg}
+ Should Not Be Empty ${project_user}
+ Should Not Be Empty ${user_password}
+ ${rc} ${stdout}= Run and Return RC and Output osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-delete ${vnfd_pkg}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+
+Remove User From Project
+ [Arguments] ${user_name} ${project_name}
+
+ Should Not Be Empty ${user_name}
+ Should Not Be Empty ${project_name}
+ ${rc} ${stdout}= Run And Return RC And Output osm user-update ${user_name} --remove-project ${project_name}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+
+Delete Project
+ [Arguments] ${project_name}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm project-delete ${project_name}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
diff --git a/robot-systest/lib/prometheus_lib.resource b/robot-systest/lib/prometheus_lib.robot
similarity index 71%
rename from robot-systest/lib/prometheus_lib.resource
rename to robot-systest/lib/prometheus_lib.robot
index be3c120..0f4f07c 100644
--- a/robot-systest/lib/prometheus_lib.resource
+++ b/robot-systest/lib/prometheus_lib.robot
@@ -1,4 +1,3 @@
-*** Comments ***
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -11,7 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
*** Settings ***
Documentation Library to obtain metrics from Prometheus.
@@ -22,27 +20,28 @@
*** Variables ***
-${TIMEOUT} 30
-${MAX_RETRIES} 1
-${PROMETHEUS_HOST} %{PROMETHEUS_HOSTNAME=UNKNOWN}
-${PROMETHEUS_PORT} %{PROMETHEUS_PORT=9090}
-${PROMETHEUS_USER} %{PROMETHEUS_USER=""}
-${PROMETHEUS_PASSWORD} %{PROMETHEUS_PASSWORD=""}
+${timeout} 30
+${max_retries} 1
+${prometheus_host} %{PROMETHEUS_HOSTNAME=UNKNOWN}
+${prometheus_port} %{PROMETHEUS_PORT=9090}
+${prometheus_user} %{PROMETHEUS_USER=""}
+${prometheus_password} %{PROMETHEUS_PASSWORD=""}
*** Keywords ***
Set Testsuite Prometheus Variables
[Documentation] Set Testsuite Prometheus Variables to be used in subsequent test cases
- IF ${PROMETHEUS_HOST} == 'UNKNOWN'
+ IF '${prometheus_host}' == 'UNKNOWN'
${local_prometheus_host}= Get Environment Variable OSM_HOSTNAME
- Set Suite Variable ${PROMETHEUS_HOST} ${local_prometheus_host}
- Set Suite Variable ${PROMETHEUS_HOST} 9091
+ Set Suite Variable ${prometheus_host} ${local_prometheus_host}
+ Set Suite Variable ${prometheus_port} 9091
END
- Log ${PROMETHEUS_PORT}
- Log ${PROMETHEUS_HOST}
- Log ${PROMETHEUS_USER}
- Log ${PROMETHEUS_PASSWORD}
+ Log ${prometheus_port}
+ Log ${prometheus_host}
+ Log ${prometheus_user}
+ Log ${prometheus_password}
+
Get Metric
[Documentation] Get the instant value of a metric from Prometheus using multiple filter parameters.
@@ -51,27 +50,30 @@
... Examples of execution:
... \${metric}= Get Metric \${prometheus_ip} \${prometheus_port} ${prometheus_password} \${metric}
... \${metric}= Get Metric \${prometheus_ip} \${prometheus_port} ${prometheus_password} \${metric} \${param1}=\${value1} \${param2}=\${value2}
+
[Arguments] ${prometheus_ip} ${prometheus_port} ${prometheus_user} ${prometheus_password} ${metric} @{filter_parameters}
+
${filter}= Set Variable ${EMPTY}
FOR ${param} IN @{filter_parameters}
- ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in filter parameters
- Log ${match},${param_name},${param_value}
+ ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in filter parameters
${filter}= Catenate SEPARATOR= ${filter} ${param_name}="${param_value}",
END
- ${resp}= Execute Prometheus Instant Query ${prometheus_ip} ${prometheus_port} ${prometheus_user} ${prometheus_password} query=${metric}{${filter}}
+ ${resp}= Execute Prometheus Instant Query ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} query=${metric}{${filter}}
${result_list}= Convert To List ${resp["data"]["result"]}
${results}= Get Length ${result_list}
Should Not Be Equal As Numbers 0 ${results} msg=Metric ${metric} not found values=false
Should Be Equal As Integers 1 ${results} msg=Metric ${metric} with multiple values values=false
- RETURN ${result_list[0]["value"][1]}
+ [Return] ${result_list[0]["value"][1]}
+
Execute Prometheus Instant Query
[Documentation] Execute a Prometheus Instant Query using HTTP API.
... Return an inline json with the result of the query.
... The requested URL is the next: http://\${prometheus_ip}:\${prometheus_port}/api/v1/query?\${querystring}
+
[Arguments] ${prometheus_ip} ${prometheus_port} ${prometheus_user} ${prometheus_password} ${querystring}
- ${auth}= IF '${prometheus_password}' != '${EMPTY}' Create List ${prometheus_user} ${prometheus_password} ELSE Set Variable None
- Create Session prometheus http://${prometheus_ip}:${prometheus_port} timeout=${TIMEOUT} max_retries=${MAX_RETRIES} verify=false auth=${auth}
- ${resp}= GET On Session prometheus /api/v1/query?${querystring} timeout=${TIMEOUT}
+ ${auth}= IF '${prometheus_password}'!='${EMPTY}' Create List ${prometheus_user} ${prometheus_password} ELSE Set Variable None
+ Create Session prometheus http://${prometheus_ip}:${prometheus_port} timeout=${timeout} max_retries=${max_retries} verify=false auth=${auth}
+ ${resp}= GET On Session prometheus /api/v1/query?${querystring} timeout=${timeout}
Status Should Be 200 ${resp}
- RETURN ${resp.json()}
+ [Return] ${resp.json()}
diff --git a/robot-systest/lib/repo_lib.resource b/robot-systest/lib/repo_lib.resource
deleted file mode 100644
index a339255..0000000
--- a/robot-systest/lib/repo_lib.resource
+++ /dev/null
@@ -1,59 +0,0 @@
-*** Comments ***
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-*** Settings ***
-Documentation Library to deploy and delete OSM repos.
-
-Library OperatingSystem
-
-Resource ../lib/nsd_lib.resource
-
-
-*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-${REPO_DELETE_MAX_WAIT_TIME} 1min
-${REPO_DELETE_POL_TIME} 15sec
-
-
-*** Keywords ***
-Get Repos List
- [Documentation] Get the list of repos and log it.
- ${rc} ${stdout}= Run And Return RC And Output osm repo-list
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
-
-Create Repo
- [Documentation] Create a repository in OSM with the name and options passed as arguments, and return the repo id.
- [Arguments] ${repo_name} ${repo_uri} ${repo_type} ${user} ${password} ${additional_options}=""
- ${user_attr}= Set Variable If '${user}'!='${EMPTY}' --user ${user} \
- ${password_attr}= Set Variable If '${password}'!='${EMPTY}' --password ${password} \
- ${rc} ${stdout}= Run And Return RC And Output osm repo-add --type ${repo_type} ${user_attr} ${password_attr} ${additional_options} ${repo_name} ${repo_uri}
- Log ${rc},${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Delete Repo
- [Documentation] Delete from OSM the repo passed as argument.
- [Arguments] ${repo_id}
- ${rc} ${stdout}= Run Keyword And Continue On Failure Run And Return RC And Output osm repo-delete ${repo_id}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Log ${stdout}
- WAIT UNTIL KEYWORD SUCCEEDS ${REPO_DELETE_MAX_WAIT_TIME} ${REPO_DELETE_POL_TIME} Check For NSD ${repo_id}
-
-Check For Repo
- [Documentation] Check that a repository exists in OSM.
- [Arguments] ${repo_id}
- ${rc} ${stdout}= Run And Return RC And Output osm repo-list | awk '{print $2}' | grep ${repo_id}
- Log ${rc},${stdout}
- Should Not Be Equal As Strings ${stdout} ${repo_id}
diff --git a/robot-systest/lib/repo_lib.robot b/robot-systest/lib/repo_lib.robot
new file mode 100644
index 0000000..8237b18
--- /dev/null
+++ b/robot-systest/lib/repo_lib.robot
@@ -0,0 +1,52 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Documentation Library to deploy and delete OSM repos.
+
+
+*** Variables ***
+${success_return_code} 0
+
+*** Keywords ***
+Get Repos List
+ ${rc} ${stdout}= Run and Return RC and Output osm repo-list
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+
+Create Repo
+ [Arguments] ${repo_name} ${repo_uri} ${repo_type} ${user} ${password} ${additional_options}=""
+
+ ${user_attr} Set Variable If '${user}'!='${EMPTY}' --user ${user} \
+ ${password_attr} Set Variable If '${password}'!='${EMPTY}' --password ${password} \
+
+ ${rc} ${stdout}= Run and Return RC and Output osm repo-add --type ${repo_type} ${user_attr} ${password_attr} ${additional_options} ${repo_name} ${repo_uri}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Delete Repo
+ [Arguments] ${repo_id}
+
+ ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm repo-delete ${repo_id}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Log ${stdout}
+ WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For NSD ${repo_id}
+
+
+Check For Repo
+ [Arguments] ${repo_id}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm repo-list | awk '{print $2}' | grep ${repo_id}
+ Should Not Be Equal As Strings ${stdout} ${repo_id}
diff --git a/robot-systest/lib/rest_lib.resource b/robot-systest/lib/rest_lib.resource
deleted file mode 100644
index 74e97e9..0000000
--- a/robot-systest/lib/rest_lib.resource
+++ /dev/null
@@ -1,109 +0,0 @@
-*** Comments ***
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License
-
-
-*** Settings ***
-Documentation Library with sol003 keywords and variables .
-
-Library String
-Library OperatingSystem
-Library RequestsLibrary
-Library JsonValidator
-Library yaml
-Library JSONLibrary
-
-Resource ../lib/vim_lib.resource
-
-
-*** Variables ***
-@{SUCCESS_STATUS_CODE_LIST} 200 201 202 204
-${AUTH_TOKEN_URI} /osm/admin/v1/tokens
-${REST_API_HOST} ${EMPTY}
-${OSM_USER} %{OSM_USER=admin}
-${OSM_PASSWORD} %{OSM_PASSWORD=admin}
-${OSM_PROJECT} %{OSM_PROJECT=admin}
-
-
-*** Keywords ***
-Get Auth Token
- [Documentation] Send a REST POST message to OSM to get an authentication token,
- ... and store the authentication token in a suite variable to be used later on.
- Set REST API Host
- Create Session osmhit ${REST_API_HOST} disable_warnings=1
- &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
- &{data}= Create Dictionary username=${OSM_USER} password=${OSM_PASSWORD} project-id=${OSM_PROJECT}
- ${resp}= Post On Session osmhit ${AUTH_TOKEN_URI} json=${data} headers=${headers}
- Log ${resp}
- Pass Execution If ${resp.status_code} in ${SUCCESS_STATUS_CODE_LIST} Get Auth Token completed
- Set Suite Variable ${TOKEN_STATUS_CODE} ${resp.status_code}
- ${access_token}= Get Value From Json ${resp.json()} $..id
- Set Test Variable ${ACCESS_TOKEN} ${access_token[0]}
- Set Test Variable ${TOKEN_RESPONSE} ${resp}
- Sleep 2s
-
-Set Dockerized Host
- [Documentation] Set the suite variable REST_API_HOST to be used in this library and the testsuites using it.
- ... This method must be used if the tests are run from a container in the same K8s cluster where OSM is running.
- [Arguments] ${env_host}
- Set Suite Variable ${REST_API_HOST} https://${env_host}
-
-Set Standalone Host
- [Documentation] Set a suite variable REST_API_HOST to be used in this library and the testsuites using it.
- ... This method must be used if the tests are run from any place outside the K8s cluster where OSM is running.
- [Arguments] ${env_host}
- Set Suite Variable ${REST_API_HOST} https://${env_host}:9999
-
-Read Directory
- [Documentation] Read Current Directory and return it
- ${Directory}= Replace String ${CURDIR} lib resources/
- ${json_path}= Set Variable ${Directory}
- RETURN ${json_path}
-
-Post Api Request
- [Documentation] Send to OSM a POST API message to OSM to the given uri with the given json data,
- ... and save response and status code in suite variables to be used later on.
- [Arguments] ${PostApi} ${json_data}
- Create Session APISession ${REST_API_HOST}
- &{headers}= Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${ACCESS_TOKEN}
- ${request_response}= Post On Session APISession ${PostApi} json=${json_data} headers=${headers}
- Set Suite Variable ${REQUEST_RESPONSE} ${request_response}
- ${response_statuscode}= Convert To String ${request_response.status_code}
- Set Suite Variable ${RESPONSE_STATUSCODE} ${response_statuscode}
-
-Set REST API Host
- [Documentation] Set the REST_API_HOST suite variable from OSM_HOSTNAME env variable
- ${nbi_host}= Get Environment Variable OSM_HOSTNAME
- ${passed}= Run Keyword And Return Status Should Contain ${nbi_host} :
- IF ${passed}
- Set Dockerized Host ${nbi_host}
- ELSE
- Set Standalone Host ${nbi_host}
- END
-
-Get ID
- [Documentation] Examine a REQUEST_RESPONSE dictionary as JSON and return the requested key passed as argument.
- [Arguments] ${Key}
- Pass Execution If ${REQUEST_RESPONSE.status_code} in ${SUCCESS_STATUS_CODE_LIST} Get Auth Token completed
- ${id}= Get Value From Json ${REQUEST_RESPONSE.json()} $..${Key}
- RETURN ${id[0]}
-
-Get Api Request
- [Documentation] Send to OSM a GET API message to OSM to the given uri,
- ... and save response and status code in suite variables to be used later on.
- [Arguments] ${uri}
- Create Session Session ${REST_API_HOST}
- &{headers}= Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${ACCESS_TOKEN}
- ${request_response}= Get On Session Session ${uri} headers=${headers}
- Set Suite Variable ${REQUEST_RESPONSE} ${request_response}
- ${response_statuscode}= Convert To String ${request_response.status_code}
- Set Suite Variable ${RESPONSE_STATUSCODE} ${response_statuscode}
diff --git a/robot-systest/lib/rest_lib.robot b/robot-systest/lib/rest_lib.robot
new file mode 100644
index 0000000..ced8a21
--- /dev/null
+++ b/robot-systest/lib/rest_lib.robot
@@ -0,0 +1,95 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+*** Settings ***
+Documentation Library with sol003 keywords and variables .
+
+Library RequestsLibrary
+Library JsonValidator
+Library yaml
+Library JSONLibrary
+Library String
+Library OperatingSystem
+
+Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot
+
+*** Variables ***
+@{success_status_code_list} 200 201 202 204
+${auth_token_uri} /osm/admin/v1/tokens
+${HOST} ${EMPTY}
+${osm_user} %{OSM_USER=admin}
+${osm_password} %{OSM_PASSWORD=admin}
+${osm_project} %{OSM_PROJECT=admin}
+
+*** Keywords ***
+Get Auth Token
+ [Tags] auth_token
+ Get Hostname
+ Create Session osmhit ${HOST} disable_warnings=1
+ &{headers} Create Dictionary Content-Type=application/json Accept=application/json
+ &{data} Create Dictionary username=${osm_user} password=${osm_password} project-id=${osm_project}
+ ${resp}= Post On Session osmhit ${auth_token_uri} json=${data} headers=${headers}
+ Log ${resp}
+ Pass Execution If ${resp.status_code} in ${success_status_code_list} Get Auth Token completed
+ Set Suite Variable ${token_status_code} ${resp.status_code}
+ ${access_token}= Get Value From Json ${resp.json()} $..id
+ Set Test Variable ${access_token} ${access_token[0]}
+ Set Test Variable ${token_response} ${resp}
+ sleep 2s
+
+Set Dockerized Host
+ [Arguments] ${env_host}
+ Set Suite Variable ${HOST} https://${env_host}
+
+Set Standalone Host
+ [Arguments] ${env_host}
+ Set Suite Variable ${HOST} https://${env_host}:9999
+
+Read Directory
+ [Documentation] To Read Current Direct ory
+ ${Directory}= Replace String ${CURDIR} lib resources/
+ ${json_path}= Set Variable ${Directory}
+ [Return] ${JsonPath}
+
+Post Api Request
+ [Arguments] ${PostApi}
+ [Documentation] Keword to Post API Request
+ Create Session APISession ${HOST}
+ &{headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${access_token}
+ ${request_response}= Post On Session APISession ${PostApi} json=${updated_json_obj} headers=${headers}
+ Set Suite Variable ${request_response}
+ ${response_statuscode} Convert To String ${request_response.status_code}
+ Set Suite Variable ${response_statuscode}
+
+Get Hostname
+ [Documentation] Keyword to get the default osm Hostname
+ ${nbi_host}= Get Environment Variable OSM_HOSTNAME
+ ${passed}= Run Keyword And Return Status Should Contain ${nbi_host} :
+ Run Keyword If ${passed} Set Dockerized Host ${nbi_host}
+ ... ELSE Set Standalone Host ${nbi_host}
+
+Get ID
+ [Arguments] ${Key}
+ Pass Execution If ${request_response.status_code} in ${success_status_code_list} Get Auth Token completed
+ ${id}= Get Value From Json ${request_response.json()} $..${Key}
+ Set Suite Variable ${value} ${id[0]}
+ [Return] ${value}
+
+Get Api Request
+ [Arguments] ${uri}
+ [Documentation] Keyword to Get API Request
+ Create Session Session ${HOST}
+ &{headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${access_token}
+ ${request_response}= Get On Session Session ${uri} headers=${Headers}
+ Set Suite Variable ${request_response}
+ ${response_statuscode} Convert To String ${request_response.status_code}
+ Set Suite Variable ${response_statuscode}
diff --git a/robot-systest/lib/role_lib.resource b/robot-systest/lib/role_lib.robot
similarity index 62%
rename from robot-systest/lib/role_lib.resource
rename to robot-systest/lib/role_lib.robot
index 1ba3a2d..984b69a 100644
--- a/robot-systest/lib/role_lib.resource
+++ b/robot-systest/lib/role_lib.robot
@@ -1,4 +1,3 @@
-*** Comments ***
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -11,63 +10,62 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
-*** Settings ***
-Documentation Library providing keywords for CRUD operations over roles with OSM client.
-Library OperatingSystem
-
-
*** Variables ***
-${SUCCESS_RETURN_CODE} 0
+${success_return_code} 0
*** Keywords ***
Create Role
- [Documentation] Create a role in OSM with the name passed as argument, and return the role id.
[Arguments] ${role_name}
+
Should Not Be Empty ${role_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm role-create ${role_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm role-create ${role_name}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Update Role
- [Documentation] Update a role in OSM.
+ [Documentation] Updates a role in OSM.
... The extra parameters (like '--add') are given to this function in name=value format. These parameters will be appended to the 'osm role-update' command with the next syntax: --param_name=param_value
... Example of execution:
... Update Role \${role_name} add='vims: true'
+
[Arguments] ${role_name} @{optional_parameters}
+
${osm_update_command}= Set Variable osm role-update ${role_name}
FOR ${param} IN @{optional_parameters}
- ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters
- Log ${match},${param_name},${param_value}
+ ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters
${osm_update_command}= Catenate ${osm_update_command} --${param_name}=${param_value}
END
- ${rc} ${stdout}= Run And Return Rc And Output ${osm_update_command}
+ ${rc} ${stdout}= Run and Return RC and Output ${osm_update_command}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
Check If Role Exists
- [Documentation] Check if a role exists in OSM.
[Arguments] ${role_name}
+
Should Not Be Empty ${role_name}
${rc} ${stdout}= Run And Return RC And Output osm role-list | awk 'NR>3 {print $2}' | grep "${role_name}"
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
Check If User Has Role
- [Documentation] Check if a user has a role in a specific project in OSM.
[Arguments] ${user_name} ${role_name} ${project_name}
+
Should Not Be Empty ${user_name}
Should Not Be Empty ${role_name}
Should Not Be Empty ${project_name}
${rc} ${stdout}= Run And Return RC And Output osm user-show ${user_name} | grep -B1 "role_name" | grep -B1 "${role_name}" | grep "project_name" | grep "${project_name}"
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
Delete Role
- [Documentation] Delete from OSM the role passed as argument.
[Arguments] ${role_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm role-delete ${role_name}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm role-delete ${role_name}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
diff --git a/robot-systest/lib/sdnc_lib.resource b/robot-systest/lib/sdnc_lib.resource
deleted file mode 100644
index c9cd8c7..0000000
--- a/robot-systest/lib/sdnc_lib.resource
+++ /dev/null
@@ -1,97 +0,0 @@
-*** Comments ***
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-*** Settings ***
-Documentation Library to manage SDNCs.
-
-Library String
-Library Collections
-Library OperatingSystem
-
-Resource ../lib/prometheus_lib.resource
-
-
-*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-${SDNC_DELETE_MAX_WAIT_TIME} 1min
-${SDNC_DELETE_POL_TIME} 15sec
-${SDNC_STATUS_MAX_WAIT_TIME} 6min
-${SDNC_STATUS_POL_TIME} 1min
-
-
-*** Keywords ***
-Create SDNC
- [Documentation] Register an SDN Controller in OSM.
- ... The optional parameters (such as 'switch_dpid' or 'ip-address') are given to this function in name=value format. These parameters will be appended to the 'osm sdnc-create' command with the next syntax: --param_name=param_value
- ... Returns the ID of the created SDNC Target.
- ... Example of execution:
- ... \${sdnc_id}= Create SDNC \${sdnc_name} \${sdnc_user} \${sdnc_password} \${sdnc_url} \${sdnc_type} switch_dpid='{...}'
- [Arguments] ${sdnc_name} ${sdnc_user} ${sdnc_password} ${sdnc_url} ${sdnc_type} @{optional_parameters}
- ${osm_sdnc_create_command}= Set Variable osm sdnc-create --name ${sdnc_name} --user ${sdnc_user} --password ${sdnc_password} --url ${sdnc_url} --type ${sdnc_type}
- FOR ${param} IN @{optional_parameters}
- ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters
- Log ${match},${param_name},${param_value}
- ${osm_sdnc_create_command}= Catenate ${osm_sdnc_create_command} --${param_name}=${param_value}
- END
- ${rc} ${stdout}= Run And Return Rc And Output ${osm_sdnc_create_command}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Check For SDNC To Be Deleted
- [Documentation] Check if an SDN controller identified by name is not present in OSM.
- [Arguments] ${sdnc_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm sdnc-list | awk '{print $2}' | grep ${sdnc_name}
- Log ${rc},${stdout}
- Should Not Be Equal As Strings ${stdout} ${sdnc_name}
-
-Delete SDNC
- [Documentation] Unregister/delete from OSM an SDN controller identified by name.
- [Arguments] ${sdnc_name}
- ${rc} ${stdout}= Run Keyword And Continue On Failure Run And Return Rc And Output osm sdnc-delete ${sdnc_name}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
- Wait Until Keyword Succeeds ${SDNC_DELETE_MAX_WAIT_TIME} ${SDNC_DELETE_POL_TIME} Check For SDNC To Be Deleted ${sdnc_name}
-
-Get SDNC List
- [Documentation] Get the list of SDN controllers from OSM and log it.
- ${rc} ${stdout}= Run And Return Rc And Output osm sdnc-list
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
-
-Check For SDNC
- [Documentation] Check if an SDN Controller identified by name or id exists in OSM and is enabled.
- [Arguments] ${sdnc_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm sdnc-show ${sdnc_id} | grep -io ENABLED
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
-
-Check For SDNC Status
- [Documentation] Check in a loop if the value of the metric osm_sdnc_status in Prometheus for the SDN controller is 1 (reachable).
- [Arguments] ${sdnc_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
- Wait Until Keyword Succeeds ${SDNC_STATUS_MAX_WAIT_TIME} ${SDNC_STATUS_POL_TIME} Check If SDNC Is Available ${sdnc_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
-
-Get SDNC ID
- [Documentation] Check if an SDN controller identified by name exists in OSM, and return the id.
- [Arguments] ${sdnc_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm sdnc-list | grep " ${sdnc_name} " | awk '{print $4}'
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Not Be Equal As Strings ${stdout} ${EMPTY} msg=SDNC '${sdnc_name}' not found values=false
- RETURN ${stdout}
-
-Check If SDNC Is Available
- [Documentation] Check if the value of the metric osm_sdnc_status in Prometheus for the SDN controller is 1 (reachable).
- [Arguments] ${sdnc_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
- ${metric}= Get Metric ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} osm_sdnc_status sdnc_id=${sdnc_id}
- Should Be Equal As Integers ${metric} 1 msg=SDNC '${sdnc_id}' is not active values=false
diff --git a/robot-systest/lib/sdnc_lib.robot b/robot-systest/lib/sdnc_lib.robot
new file mode 100644
index 0000000..a897675
--- /dev/null
+++ b/robot-systest/lib/sdnc_lib.robot
@@ -0,0 +1,101 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Documentation Library to manage SDNCs.
+
+Library String
+Library Collections
+Library OperatingSystem
+
+Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot
+
+
+*** Variables ***
+${success_return_code} 0
+${delete_max_wait_time} 1min
+${delete_pol_time} 15sec
+${sdnc_status_max_wait_time} 6min
+${sdnc_status_pol_time} 1min
+
+
+*** Keywords ***
+Create SDNC
+ [Documentation] Creates an SDNC in OSM.
+ ... The optional parameters (such as 'switch_dpid' or 'ip-address') are given to this function in name=value format. These parameters will be appended to the 'osm sdnc-create' command with the next syntax: --param_name=param_value
+ ... Returns the ID of the created SDNC Target.
+ ... Example of execution:
+ ... \${sdnc_id}= Create SDNC \${sdnc_name} \${sdnc_user} \${sdnc_password} \${sdnc_url} \${sdnc_type} switch_dpid='{...}'
+
+ [Arguments] ${sdnc_name} ${sdnc_user} ${sdnc_password} ${sdnc_url} ${sdnc_type} @{optional_parameters}
+
+ ${osm_sdnc_create_command}= Set Variable osm sdnc-create --name ${sdnc_name} --user ${sdnc_user} --password ${sdnc_password} --url ${sdnc_url} --type ${sdnc_type}
+ FOR ${param} IN @{optional_parameters}
+ ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters
+ ${osm_sdnc_create_command}= Catenate ${osm_sdnc_create_command} --${param_name}=${param_value}
+ END
+ ${rc} ${stdout}= Run and Return RC and Output ${osm_sdnc_create_command}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Check for SDNC To Be Deleted
+ [Arguments] ${sdnc_name}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm sdnc-list | awk '{print $2}' | grep ${sdnc_name}
+ Should Not Be Equal As Strings ${stdout} ${sdnc_name}
+
+
+Delete SDNC
+ [Arguments] ${sdnc_name}
+
+ ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm sdnc-delete ${sdnc_name}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
+ Wait Until Keyword Succeeds ${delete_max_wait_time} ${delete_pol_time} Check for SDNC To Be Deleted ${sdnc_name}
+
+
+Get SDNC List
+ ${rc} ${stdout}= Run and Return RC and Output osm sdnc-list
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+
+Check for SDNC
+ [Arguments] ${sdnc_id}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm sdnc-show ${sdnc_id} | grep -io ENABLED
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+
+Check for SDNC Status
+ [Arguments] ${sdnc_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
+
+ Wait Until Keyword Succeeds ${sdnc_status_max_wait_time} ${sdnc_status_pol_time} Check If SDNC Is Available ${sdnc_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
+
+
+Get SDNC ID
+ [Arguments] ${sdnc_name}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm sdnc-list | grep " ${sdnc_name} " | awk '{print $4}'
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Not Be Equal As Strings ${stdout} ${EMPTY} msg=SDNC '${sdnc_name}' not found values=false
+ [Return] ${stdout}
+
+
+Check If SDNC Is Available
+ [Arguments] ${sdnc_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
+
+ ${metric}= Get Metric ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} osm_sdnc_status sdnc_id=${sdnc_id}
+ Should Be Equal As Integers ${metric} 1 msg=SDNC '${sdnc_id}' is not active values=false
diff --git a/robot-systest/lib/ssh_lib.resource b/robot-systest/lib/ssh_lib.resource
deleted file mode 100644
index 15d48a6..0000000
--- a/robot-systest/lib/ssh_lib.resource
+++ /dev/null
@@ -1,102 +0,0 @@
-*** Comments ***
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-*** Settings ***
-Documentation Library providing keywords to interact with NF via SSH.
-Library SSHLibrary
-
-
-*** Keywords ***
-Test SSH Connection
- [Documentation] Test the SSH connection to the host with the user and credentials passed as arguments.
- [Arguments] ${host} ${username} ${password} ${privatekey}
- Open Connection ${host}
- IF "${password}" != "${EMPTY}"
- Login ${username} ${password}
- ELSE
- Login With Public Key ${username} ${privatekey}
- END
- Execute Command hostname
- Close All Connections
-
-Check If Remote File Exists
- [Documentation] Check via SSH if a file exists in in the remote host, using the user and credentials passed as arguments.
- [Arguments] ${host} ${username} ${password} ${privatekey} ${file}
- Open Connection ${host}
- IF "${password}" != "${EMPTY}"
- Login ${username} ${password}
- ELSE
- Login With Public Key ${username} ${privatekey}
- END
- ${rc}= Execute Command ls ${file} >& /dev/null return_stdout=False return_rc=True
- Close All Connections
- Should Be Equal As Integers ${rc} 0
-
-Check If Remote Folder Exists
- [Documentation] Check via SSH if a folder exists in in the remote host, using the user and credentials passed as arguments.
- [Arguments] ${host} ${username} ${password} ${privatekey} ${folder}
- Open Connection ${host}
- IF "${password}" != "${EMPTY}"
- Login ${username} ${password}
- ELSE
- Login With Public Key ${username} ${privatekey}
- END
- ${output}= Execute Command ls -d ${folder}
- Close All Connections
- Should Be Equal As Strings ${output} ${folder}
-
-Get Remote File Content
- [Documentation] Get via SSH the content of a remote file and return it.
- [Arguments] ${host} ${username} ${password} ${privatekey} ${file}
- Open Connection ${host}
- IF "${password}" != "${EMPTY}"
- Login ${username} ${password}
- ELSE
- Login With Public Key ${username} ${privatekey}
- END
- ${output}= Execute Command cat ${file}
- Close All Connections
- RETURN ${output}
-
-Ping Many
- [Documentation] Connect via SSH to a remote host and test ping to a list of IP addresses, passed as argument.
- [Arguments] ${host} ${username} ${password} ${privatekey} @{ip_list}
- Open Connection ${host}
- IF "${password}" != "${EMPTY}"
- Login ${username} ${password}
- ELSE
- Login With Public Key ${username} ${privatekey}
- END
- FOR ${ip} IN @{ip_list}
- ${result}= Execute Command ping -c 5 -W 1 ${ip} > /dev/null && echo OK shell=True
- Log ${result}
- Should Contain ${result} OK
- END
- Close All Connections
-
-Execute Remote Command Check Rc Return Output
- [Documentation] Execute via SSH a command in a remote host and, if the command succeeds, return the output.
- [Arguments] ${host} ${username} ${password} ${privatekey} ${command}
- Open Connection ${host}
- IF "${password}" != "${EMPTY}"
- Login ${username} ${password}
- ELSE
- Login With Public Key ${username} ${privatekey}
- END
- ${stdout} ${rc}= Execute Command ${command} return_rc=True return_stdout=True
- Log ${rc}
- Log ${stdout}
- Close All Connections
- Should Be Equal As Integers ${rc} 0
- RETURN ${stdout}
diff --git a/robot-systest/lib/ssh_lib.robot b/robot-systest/lib/ssh_lib.robot
new file mode 100644
index 0000000..3e3c00b
--- /dev/null
+++ b/robot-systest/lib/ssh_lib.robot
@@ -0,0 +1,79 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Keywords ***
+Test SSH Connection
+ [Arguments] ${host} ${username} ${password} ${privatekey}
+
+ Open Connection ${host}
+ Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password}
+ ... ELSE Login With Public Key ${username} ${privatekey}
+ Execute Command hostname
+ Close All Connections
+
+Check If remote File Exists
+ [Arguments] ${host} ${username} ${password} ${privatekey} ${file}
+
+ Open Connection ${host}
+ Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password}
+ ... ELSE Login With Public Key ${username} ${privatekey}
+ ${rc}= Execute Command ls ${file} >& /dev/null return_stdout=False return_rc=True
+ Close All Connections
+ Should Be Equal As Integers ${rc} 0
+
+Check If Remote Folder Exists
+ [Arguments] ${host} ${username} ${password} ${privatekey} ${folder}
+
+ Open Connection ${host}
+ Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password}
+ ... ELSE Login With Public Key ${username} ${privatekey}
+ ${output}= Execute Command ls -d ${folder}
+ Close All Connections
+ Should Be Equal As Strings ${output} ${folder}
+
+Get Remote File Content
+ [Arguments] ${host} ${username} ${password} ${privatekey} ${file}
+
+ Open Connection ${host}
+ Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password}
+ ... ELSE Login With Public Key ${username} ${privatekey}
+ ${output}= Execute Command cat ${file}
+ Close All Connections
+ [Return] ${output}
+
+Ping Many
+ [Arguments] ${host} ${username} ${password} ${privatekey} @{ip_list}
+
+ Open Connection ${host}
+ Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password}
+ ... ELSE Login With Public Key ${username} ${privatekey}
+ FOR ${ip} IN @{ip_list}
+ ${result}= Execute Command ping -c 5 -W 1 ${ip} > /dev/null && echo OK shell=True
+ Log ${result}
+ Should Contain ${result} OK
+ END
+ Close All Connections
+
+
+Execute Remote Command Check Rc Return Output
+ [Arguments] ${host} ${username} ${password} ${privatekey} ${command}
+
+ Open Connection ${host}
+ Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password}
+ ... ELSE Login With Public Key ${username} ${privatekey}
+ ${stdout} ${rc}= Execute Command ${command} return_rc=True return_stdout=True
+ Log ${rc}
+ Log ${stdout}
+ Close All Connections
+ Should Be Equal As Integers ${rc} 0
+ [Return] ${stdout}
+
diff --git a/robot-systest/lib/user_lib.resource b/robot-systest/lib/user_lib.robot
similarity index 60%
rename from robot-systest/lib/user_lib.resource
rename to robot-systest/lib/user_lib.robot
index 8dd7601..4e5893c 100644
--- a/robot-systest/lib/user_lib.resource
+++ b/robot-systest/lib/user_lib.robot
@@ -1,4 +1,3 @@
-*** Comments ***
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -11,58 +10,56 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
-*** Settings ***
-Documentation Library providing keywords for CRUD operations over Network Slice Templates with OSM client.
-Library OperatingSystem
-
-
*** Variables ***
-${SUCCESS_RETURN_CODE} 0
+${success_return_code} 0
*** Keywords ***
Create User
- [Documentation] Create a user in OSM with the name and password passed as arguments, and return the user id.
[Arguments] ${user_name} ${user_password}
+
Should Not Be Empty ${user_name}
Should Not Be Empty ${user_password}
- ${rc} ${stdout}= Run And Return Rc And Output osm user-create ${user_name} --password ${user_password}
+ ${rc} ${stdout}= Run and Return RC and Output osm user-create ${user_name} --password ${user_password}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
Update User Password
- [Documentation] Update the password of a user in OSM.
[Arguments] ${user_name} ${user_password} ${user_new_password}
+
Should Not Be Empty ${user_name}
Should Not Be Empty ${user_password}
Should Not Be Empty ${user_new_password}
- ${rc} ${stdout}= Run And Return Rc And Output osm user-update ${user_name} --current-password ${user_password} --new-password ${user_new_password}
+ ${rc} ${stdout}= Run and Return RC and Output osm user-update ${user_name} --current-password ${user_password} --new-password ${user_new_password}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
Update User Role
- [Documentation] Update the role of a user in a project in OSM.
[Arguments] ${user_name} ${project_name} ${role_name}
+
Should Not Be Empty ${user_name}
Should Not Be Empty ${project_name}
Should Not Be Empty ${role_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm user-update --add-project-role '${project_name},${role_name}' ${user_name}
+ ${rc} ${stdout}= Run and Return RC and Output osm user-update --add-project-role '${project_name},${role_name}' ${user_name}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
Check If User Exists
- [Documentation] Check if a user exists in OSM.
[Arguments] ${user_name}
+
Should Not Be Empty ${user_name}
${rc} ${stdout}= Run And Return RC And Output osm user-list | awk 'NR>3 {print $2}' | grep "${user_name}"
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
Delete User
- [Documentation] Delete from OSM the user passed as argument.
[Arguments] ${user_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm user-delete ${user_name}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm user-delete ${user_name}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
diff --git a/robot-systest/lib/vim_lib.resource b/robot-systest/lib/vim_lib.resource
deleted file mode 100644
index e46f632..0000000
--- a/robot-systest/lib/vim_lib.resource
+++ /dev/null
@@ -1,116 +0,0 @@
-*** Comments ***
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-*** Settings ***
-Documentation Library to manage VIM Targets.
-
-Library String
-Library Collections
-Library OperatingSystem
-
-Resource ../lib/prometheus_lib.resource
-
-
-*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-${VIM_DELETE_MAX_WAIT_TIME} 1min
-${VIM_DELETE_POL_TIME} 15sec
-${VIM_STATUS_MAX_WAIT_TIME} 3min
-${VIM_STATUS_POL_TIME} 15sec
-${VIM_OPSTATE_MAX_WAIT_TIME} 40sec
-${VIM_OPSTATE_POL_TIME} 10sec
-
-
-*** Keywords ***
-Create VIM Target
- [Documentation] Register a VIM account in OSM and return the id.
- ... The optional parameters (such as 'config' or 'sdn_controller') are given to this function in name=value format. These parameters will be appended to the 'osm vim-create' command with the next syntax: --param_name=param_value
- ... Return the ID of the created VIM Target.
- ... Example of execution:
- ... \${vim_account_id}= Create VIM Target \${vim_name} \${vim_user} \${vim_password} \${vim_auth_url} \${vim_tenant} \${vim_account_type} config='{...}'
- [Arguments] ${vim_name} ${vim_user} ${vim_password} ${vim_auth_url} ${vim_tenant} ${vim_account_type} @{optional_parameters}
- ${osm_vim_create_command}= Set Variable osm vim-create --name ${vim_name} --user ${vim_user} --password ${vim_password} --auth_url ${vim_auth_url} --tenant ${vim_tenant} --account_type ${vim_account_type}
- FOR ${param} IN @{optional_parameters}
- ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters
- Log ${match},${param_name},${param_value}
- ${osm_vim_create_command}= Catenate ${osm_vim_create_command} --${param_name}=${param_value}
- END
- ${rc} ${stdout}= Run And Return Rc And Output ${osm_vim_create_command}
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Delete VIM Target
- [Documentation] Unregister/delete a VIM account from OSM.
- [Arguments] ${vim_name}
- ${rc} ${stdout}= Run Keyword And Continue On Failure Run And Return Rc And Output osm vim-delete ${vim_name}
- Log ${rc},${stdout}
- Wait Until Keyword Succeeds ${VIM_DELETE_MAX_WAIT_TIME} ${VIM_DELETE_POL_TIME} Check For VIM Target ${vim_name}
-
-Get VIM Targets
- [Documentation] Get the list of VIM accounts in OSM.
- ${rc} ${stdout}= Run And Return Rc And Output osm vim-list
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
-
-Check For VIM Target
- [Documentation] Check if a VIM account has been registered in OSM.
- [Arguments] ${vim_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm vim-list | awk '{print $2}' | grep ${vim_name}
- Log ${rc},${stdout}
- Should Not Be Equal As Strings ${stdout} ${vim_name}
-
-Check For VIM Target Metric
- [Documentation] Check in a loop if the metric of osm_vim_status is present in Prometheus for the VIM account in OSM.
- [Arguments] ${vim_name} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
- ${vim_account_id}= Get VIM Target ID ${vim_name}
- Wait Until Keyword Succeeds ${VIM_STATUS_MAX_WAIT_TIME} ${VIM_STATUS_POL_TIME} Check If VIM Target Has Metric ${vim_account_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
-
-Check For VIM Target Status
- [Documentation] Check in a loop if the value of the metric osm_vim_status in Prometheus for the VIM account is 1 (reachable).
- [Arguments] ${vim_name} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
- ${vim_account_id}= Get VIM Target ID ${vim_name}
- Wait Until Keyword Succeeds ${VIM_STATUS_MAX_WAIT_TIME} ${VIM_STATUS_POL_TIME} Check If VIM Target Is Available ${vim_account_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
-
-Get VIM Target ID
- [Documentation] Get from OSM the VIM account id associated to the VIM account name passed as parameter.
- [Arguments] ${vim_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm vim-list | grep " ${vim_name} " | awk '{print $4}'
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Not Be Equal As Strings ${stdout} ${EMPTY} msg=VIM Target '${vim_name}' not found values=false
- RETURN ${stdout}
-
-Check VIM Target Operational State
- [Documentation] Check if the VIM account in OSM is enabled.
- [Arguments] ${vim_name}
- Wait Until Keyword Succeeds ${VIM_OPSTATE_MAX_WAIT_TIME} ${VIM_OPSTATE_POL_TIME} Check If VIM Target Is Enabled ${vim_name}
-
-Check If VIM Target Is Enabled
- [Documentation] Check if the VIM account passed as argument is enabled in OSM (meaning that the RO could reach the VIM account).
- [Arguments] ${vim_name}
- ${rc} ${stdout}= Run And Return Rc And Output osm vim-list | grep " ${vim_name} " | awk '{print $6}'
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Should Be Equal As Strings ${stdout} ENABLED msg=VIM Target '${vim_name}' is not enabled values=false
-
-Check If VIM Target Is Available
- [Documentation] Check if the value of the metric osm_vim_status in Prometheus for the VIM account is 1 (reachable).
- [Arguments] ${vim_account_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
- ${metric}= Get Metric ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} osm_vim_status vim_account_id=${vim_account_id}
- Should Be Equal As Integers ${metric} 1 msg=VIM Target '${vim_account_id}' is not active values=false
-
-Check If VIM Target Has Metric
- [Documentation] Check if the metric of osm_vim_status is present in Prometheus for the VIM account in OSM.
- [Arguments] ${vim_account_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
- ${metric}= Get Metric ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} osm_vim_status vim_account_id=${vim_account_id}
- Should Be True ${metric} <2 msg=VIM Target '${vim_account_id}' has no metric
diff --git a/robot-systest/lib/vim_lib.robot b/robot-systest/lib/vim_lib.robot
new file mode 100644
index 0000000..2c96802
--- /dev/null
+++ b/robot-systest/lib/vim_lib.robot
@@ -0,0 +1,124 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Documentation Library to manage VIM Targets.
+
+Library String
+Library Collections
+Library OperatingSystem
+
+# Gerardo
+Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot
+
+
+*** Variables ***
+${success_return_code} 0
+${delete_max_wait_time} 1min
+${delete_pol_time} 15sec
+${vim_status_max_wait_time} 3min
+${vim_status_pol_time} 15sec
+${vim_opstate_max_wait_time} 40sec
+${vim_opstate_pol_time} 10sec
+
+
+*** Keywords ***
+Create VIM Target
+ [Documentation] Create a VIM Target in OSM.
+ ... The optional parameters (such as 'config' or 'sdn_controller') are given to this function in name=value format. These parameters will be appended to the 'osm vim-create' command with the next syntax: --param_name=param_value
+ ... Return the ID of the created VIM Target.
+ ... Example of execution:
+ ... \${vim_account_id}= Create VIM Target \${vim_name} \${vim_user} \${vim_password} \${vim_auth_url} \${vim_tenant} \${vim_account_type} config='{...}'
+
+ [Arguments] ${vim_name} ${vim_user} ${vim_password} ${vim_auth_url} ${vim_tenant} ${vim_account_type} @{optional_parameters}
+
+ ${osm_vim_create_command}= Set Variable osm vim-create --name ${vim_name} --user ${vim_user} --password ${vim_password} --auth_url ${vim_auth_url} --tenant ${vim_tenant} --account_type ${vim_account_type}
+ FOR ${param} IN @{optional_parameters}
+ ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters
+ ${osm_vim_create_command}= Catenate ${osm_vim_create_command} --${param_name}=${param_value}
+ END
+ ${rc} ${stdout}= Run and Return RC and Output ${osm_vim_create_command}
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Delete VIM Target
+ [Arguments] ${vim_name}
+
+ ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm vim-delete ${vim_name}
+ Log ${stdout}
+ Wait Until Keyword Succeeds ${delete_max_wait_time} ${delete_pol_time} Check for VIM Target ${vim_name}
+
+
+Get VIM Targets
+ ${rc} ${stdout}= Run and Return RC and Output osm vim-list
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
+
+Check for VIM Target
+ [Arguments] ${vim_name}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm vim-list | awk '{print $2}' | grep ${vim_name}
+ Should Not Be Equal As Strings ${stdout} ${vim_name}
+
+
+Check for VIM Target Metric
+ [Arguments] ${vim_name} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
+
+ ${vim_account_id}= Get VIM Target ID ${vim_name}
+ Wait Until Keyword Succeeds ${vim_status_max_wait_time} ${vim_status_pol_time} Check If VIM Target Has Metric ${vim_account_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
+
+
+Check for VIM Target Status
+ [Arguments] ${vim_name} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
+
+ ${vim_account_id}= Get VIM Target ID ${vim_name}
+ Wait Until Keyword Succeeds ${vim_status_max_wait_time} ${vim_status_pol_time} Check If VIM Target Is Available ${vim_account_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
+
+
+Get VIM Target ID
+ [Arguments] ${vim_name}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm vim-list | grep " ${vim_name} " | awk '{print $4}'
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Not Be Equal As Strings ${stdout} ${EMPTY} msg=VIM Target '${vim_name}' not found values=false
+ [Return] ${stdout}
+
+
+Check VIM Target Operational State
+ [Arguments] ${vim_name}
+
+ Wait Until Keyword Succeeds ${vim_opstate_max_wait_time} ${vim_opstate_pol_time} Check If VIM Target Is Enabled ${vim_name}
+
+
+Check If VIM Target Is Enabled
+ [Arguments] ${vim_name}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm vim-list | grep " ${vim_name} " | awk '{print $6}'
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ Should Be Equal As Strings ${stdout} ENABLED msg=VIM Target '${vim_name}' is not enabled values=false
+
+
+Check If VIM Target Is Available
+ [Arguments] ${vim_account_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
+
+ ${metric}= Get Metric ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} osm_vim_status vim_account_id=${vim_account_id}
+ Should Be Equal As Integers ${metric} 1 msg=VIM Target '${vim_account_id}' is not active values=false
+
+
+Check If VIM Target Has Metric
+ [Arguments] ${vim_account_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
+
+ ${metric}= Get Metric ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} osm_vim_status vim_account_id=${vim_account_id}
+ Should Be True ${metric} <2 msg=VIM Target '${vim_account_id}' has no metric
diff --git a/robot-systest/lib/vnf_lib.resource b/robot-systest/lib/vnf_lib.resource
deleted file mode 100644
index 2700135..0000000
--- a/robot-systest/lib/vnf_lib.resource
+++ /dev/null
@@ -1,77 +0,0 @@
-*** Comments ***
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-*** Settings ***
-Documentation Library providing keywords for CRUD operations over VNF instances with OSM client.
-Library OperatingSystem
-Library String
-
-
-*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-
-
-*** Keywords ***
-Get Vnf List
- [Documentation] Get the list of VNF instances and return it.
- ${rc} ${stdout}= Run And Return Rc And Output osm vnf-list 2>&1
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Get VNF VIM ID
- [Documentation] Get the identifier of the first VDU of a VNF instance. Useful to get the id when a VNF has a single VDU.
- [Arguments] ${vnf_id}
- Should Not Be Empty ${vnf_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[]."vim-id"'
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- RETURN ${stdout}
-
-Get VDU List From VNF
- [Documentation] Return a list of the VDU instance ids of a VNF instance
- [Arguments] ${vnf_id}
- Should Not Be Empty ${vnf_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq '.vdur[].id'
- Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
- @{vdur_ids}= Split String ${stdout}
- RETURN @{vdur_ids}
-
-Get VDU VIM Id
- [Documentation] Return the VIM VM ID for a VDU
- [Arguments] ${vnf_id} ${vdur_id}
- Should Not Be Empty ${vnf_id}
- ${rc} ${vm_vim_id}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(.id == "'${vdur_id}'")' | yq -r '."vim-id"'
- Log ${vm_vim_id}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${vm_vim_id} values=False
- RETURN ${vm_vim_id}
-
-Get Vnf Vdur IPs
- [Documentation] Return a list with the IP addresses of the VDU records of a VNF instance.
- [Arguments] ${vnf_id}
- Should Not Be Empty ${vnf_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[].interfaces[]."ip-address"'
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
- @{ip}= Split String ${stdout}
- RETURN @{ip}
-
-Get Vdu Attribute
- [Documentation] Return an attribute from VDU records selected by count_index of a VNF instance.
- [Arguments] ${vnf_id} ${attribute} ${count_index}=0
- Should Not Be Empty ${vnf_id}
- Should Not Be Empty ${attribute}
- ${rc} ${stdout}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(."count-index" == ${count_index})' | yq -r '."${attribute}"'
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
- RETURN ${stdout}
diff --git a/robot-systest/lib/vnf_lib.robot b/robot-systest/lib/vnf_lib.robot
new file mode 100644
index 0000000..b7d6cc3
--- /dev/null
+++ b/robot-systest/lib/vnf_lib.robot
@@ -0,0 +1,81 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Variables ***
+${success_return_code} 0
+
+
+*** Keywords ***
+Get Vnf List
+ ${rc} ${stdout}= Run and Return RC and Output osm vnf-list 2>&1
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Get VNF VIM ID
+ [Arguments] ${vnf_id}
+
+ Should Not Be Empty ${vnf_id}
+ ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[]."vim-id"'
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ [Return] ${stdout}
+
+
+Get VDU list from VNF
+ [Documentation] Return a list of the VDUr ids for a VNF
+
+ [Arguments] ${vnf_id}
+
+ Should Not Be Empty ${vnf_id}
+ ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[].id'
+ Log ${stdout}
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
+ @{vdur_ids}= Split String ${stdout}
+ [Return] @{vdur_ids}
+
+
+Get VDU VIM Id
+ [Documentation] Return the VIM VM ID for a VDU
+
+ [Arguments] ${vnf_id} ${vdur_id}
+
+ Should Not Be Empty ${vnf_id}
+ ${rc} ${vm_vim_id}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(.id == "'${vdur_id}'")' | yq -r '."vim-id"'
+ Log ${vm_vim_id}
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${vm_vim_id} values=False
+ [Return] ${vm_vim_id}
+
+
+Get Vnf Vdur IPs
+ [Documentation] Return a list with the IP addresses of the VDU records of a VNF instance.
+
+ [Arguments] ${vnf_id}
+
+ Should Not Be Empty ${vnf_id}
+ ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[].interfaces[]."ip-address"'
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
+ @{ip} = Split String ${stdout}
+ [Return] @{ip}
+
+
+Get Vdu Attribute
+ [Documentation] Return an attribute from VDU records selected by count_index of a VNF instance.
+
+ [Arguments] ${vnf_id} ${attribute} ${count_index}=0
+
+ Should Not Be Empty ${vnf_id}
+ Should Not Be Empty ${attribute}
+ ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(."count-index" == ${count_index})' | yq -r '."${attribute}"'
+ Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
+ [Return] ${stdout}
diff --git a/robot-systest/lib/vnfd_lib.resource b/robot-systest/lib/vnfd_lib.robot
similarity index 72%
rename from robot-systest/lib/vnfd_lib.resource
rename to robot-systest/lib/vnfd_lib.robot
index 2e4e2a6..4433a48 100644
--- a/robot-systest/lib/vnfd_lib.resource
+++ b/robot-systest/lib/vnfd_lib.robot
@@ -1,4 +1,6 @@
-*** Comments ***
+# -*- coding: utf-8 -*-
+
+##
# Copyright 2019 Tech Mahindra Limited
#
# All Rights Reserved.
@@ -14,28 +16,30 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+##
+## Change log:
+# 1. Feature 7829: Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 06-sep-2019
+##
*** Settings ***
-Documentation Library providing keywords for CRUD operations over VNFD / VNF packages with OSM client.
-Library OperatingSystem
Library String
*** Variables ***
-${SUCCESS_RETURN_CODE} 0
-${FAILURE_RETURN_CODE} 1
-${VNFD_DELETE_MAX_WAIT_TIME} 1min
-${VNFD_DELETE_POL_TIME} 15sec
+${success_return_code} 0
+${failure_return_code} 1
+${delete_max_wait_time} 1min
+${delete_pol_time} 15sec
*** Keywords ***
Get VNFDs List
- [Documentation] Get the list of VNF packages and log it.
- ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-list
+ ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-list
Log ${stdout}
Log ${rc}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+
Create VNFD
[Documentation] Onboards ("creates") a NF Package into OSM.
@@ -51,32 +55,39 @@
... - Relevant environment variables:
... - OVERRIDES: If the environment variable "OVERRIDES" exists, it prevails over the value in the argument.
... This is often more convenient to enforce the same behaviour for every test run in a given VIM.
+
[Arguments] ${vnfd_pkg} ${overrides}=${EMPTY}
+
# If env variable "OVERRIDES" exists, it prevails over the value in the argument
${overrides}= Get Environment Variable OVERRIDES default=${overrides}
- # Proceeds with the onboarding with the appropriate arguments
- ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-create ${overrides} ${vnfd_pkg}
+
+ # Proceedes with the onboarding with the appropriate arguments
+ ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-create ${overrides} ${vnfd_pkg}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
${lines}= Get Line Count ${stdout}
${last}= Evaluate ${lines} - 1
${id}= Get Line ${stdout} ${last}
- RETURN ${id}
+ [Return] ${id}
+
Update VNFD
- [Documentation] Onboard ("Update") a NF Package into OSM.
+ [Documentation] Onboards ("Updates") a NF Package into OSM.
... - Parameters:
... - vnfd_pkg: Name (and location) of the NF Package
... - vnfd_name: Name of the existing NF Package
+
[Arguments] ${vnfd_pkg} ${vnfd_name}
- # Proceeds with the onboarding with the appropriate arguments
- ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-update --content ${vnfd_pkg} ${vnfd_name}
+
+ # Proceedes with the onboarding with the appropriate arguments
+ ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-update --content ${vnfd_pkg} ${vnfd_name}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
${lines}= Get Line Count ${stdout}
${last}= Evaluate ${lines} - 1
${id}= Get Line ${stdout} ${last}
- RETURN ${id}
+ [Return] ${id}
+
Create VNFD Overriding Fields
[Documentation] Onboards ("creates") a NF Package into OSM.
@@ -93,42 +104,46 @@
... - Relevant environment variables:
... - OVERRIDES: If the environment variable "OVERRIDES" exists, it prevails over the value in the argument.
... This is often more convenient to enforce the same behaviour for every test run in a given VIM.
+
[Arguments] ${vnfd_pkg} ${override_fields} ${overrides}=${EMPTY}
+
# If env variable "OVERRIDES" exists, it prevails over the value in the argument
${overrides}= Get Environment Variable OVERRIDES default=${overrides}
- # Proceeds with the onboarding with the appropriate arguments
- ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-create ${overrides} ${vnfd_pkg} --override '${override_fields}'
+
+ # Proceedes with the onboarding with the appropriate arguments
+ ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-create ${overrides} ${vnfd_pkg} --override '${override_fields}'
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${success_return_code}
${lines}= Get Line Count ${stdout}
${last}= Evaluate ${lines} - 1
${id}= Get Line ${stdout} ${last}
- RETURN ${id}
+ [Return] ${id}
+
Delete VNFD
- [Documentation] Delete a VNF package from OSM.
[Arguments] ${vnfd_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-delete ${vnfd_id}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-delete ${vnfd_id}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
- Wait Until Keyword Succeeds ${VNFD_DELETE_MAX_WAIT_TIME} ${VNFD_DELETE_POL_TIME} Check For VNFD ${vnfd_id}
+ Should Be Equal As Integers ${rc} ${success_return_code}
+ WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For VNFD ${vnfd_id}
+
Assert Failure Delete VNFD
[Documentation] Deletes a NF Package that cannot be deleted and asserts the failure
[Arguments] ${vnfd_id}
- ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-delete ${vnfd_id}
+
+ ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-delete ${vnfd_id}
Log ${stdout}
- Should Be Equal As Integers ${rc} ${FAILURE_RETURN_CODE}
+ Should Be Equal As Integers ${rc} ${failure_return_code}
Should Contain ${stdout} 409 msg=Expected Conflict values=False
- Wait Until Keyword Succeeds ${VNFD_DELETE_MAX_WAIT_TIME} ${VNFD_DELETE_POL_TIME} Check For VNFD ${vnfd_id} True
+ WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For VNFD ${vnfd_id} True
+
Check For VNFD
- [Documentation] Check that a VNF package exists in OSM.
[Arguments] ${vnfd_id} ${exists}=False
- ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-list | awk '{print $2}' | grep ${vnfd_id}
- Log ${rc},${stdout}
- IF ${exists}
- Should Be Equal As Strings ${stdout} ${vnfd_id}
- ELSE
- Should Not Be Equal As Strings ${stdout} ${vnfd_id}
- END
+
+ ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-list | awk '{print $2}' | grep ${vnfd_id}
+ Run Keyword If ${exists} Should Be Equal As Strings ${stdout} ${vnfd_id}
+ ... ELSE Should Not Be Equal As Strings ${stdout} ${vnfd_id}
+