[VOL-3897] Software Minor Version Upgrades Tests Enhancement
Change-Id: Icc2430a675e5e0c3654d00613ceba07c72125903
diff --git a/Makefile b/Makefile
index 2e23ddf..1f52d9c 100755
--- a/Makefile
+++ b/Makefile
@@ -317,14 +317,14 @@
robot -V $(ROBOT_CONFIG_FILE) $(ROBOT_MISC_ARGS) $(ROBOT_FILE)
# ONOS Apps to test for Software Upgrade need to be passed in the 'onos_apps_under_test' variable in format:
-# <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>
+# <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>*
onos-app-upgrade-test: ROBOT_MISC_ARGS += -e notready -i functional
onos-app-upgrade-test: ROBOT_FILE := ONOS_AppsUpgrade.robot
onos-app-upgrade-test: ROBOT_CONFIG_FILE := $(ROBOT_ONOS_APP_UPGRADE_FILE)
onos-app-upgrade-test: software-upgrade-test
# Voltha Components to test for Software Upgrade need to be passed in the 'voltha_comps_under_test' variable in format:
-# <comp-label>,<comp-container>,<comp-image>*<comp-label>,<comp-container>,<comp-image>
+# <comp-label>,<comp-container>,<comp-image>*<comp-label>,<comp-container>,<comp-image>*
voltha-comp-upgrade-test: ROBOT_MISC_ARGS += -e notready -i functional
voltha-comp-upgrade-test: ROBOT_FILE := Voltha_ComponentsUpgrade.robot
voltha-comp-upgrade-test: ROBOT_CONFIG_FILE := $(ROBOT_ONOS_APP_UPGRADE_FILE)
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
index a8312e6..1bb8217 100755
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -496,3 +496,16 @@
${output}= Run
... kubectl -n ${namespace} get pods -l ${key}=${value} -o=jsonpath="{.items[].status.containerStatuses[].image}"
Should Be Equal '${output}' 'docker.io/${image}'
+
+Get Pod Image And App Version And Helm Chart By Label
+ [Arguments] ${namespace} ${key} ${value}
+ [Documentation] Retrieves Pod Image and, App and Helm Chart Version details
+ ${image}= Run
+ ... kubectl -n ${namespace} get pods -l ${key}=${value} -o=jsonpath="{.items[*].spec.containers[*].image}"
+ ${cmd}= Catenate SEPARATOR=
+ ... kubectl -n ${namespace} get pods -l ${key}=${value} -o=
+ ... jsonpath="{.items[*].metadata.labels.\\app\\.kubernetes\\.io\\/version}"
+ ${app_version}= Run ${cmd}
+ ${helm_chart}= Run
+ ... kubectl -n ${namespace} get pods -l ${key}=${value} -o=jsonpath="{.items[*].metadata.labels.\\helm\\.sh\\/chart}"
+ [Return] ${image} ${app_version} ${helm_chart}
diff --git a/libraries/onos.robot b/libraries/onos.robot
index b242e19..ffc30da 100755
--- a/libraries/onos.robot
+++ b/libraries/onos.robot
@@ -731,3 +731,11 @@
${rc} ${output} Run And Return Rc And Output ${cmd}
Should Be Equal As Integers ${rc} 0
Log ${output}
+
+Get ONOS App Details
+ [Arguments] ${url} ${app_name}
+ [Documentation] Retrieves ONOS App Details
+ ${rc} ${output} Run And Return Rc And Output
+ ... curl --fail -sSL ${url}/onos/v1/applications/${app_name}
+ Should Be Equal As Integers ${rc} 0
+ [Return] ${output}
diff --git a/tests/software-upgrades/ONOS_AppsUpgrade.robot b/tests/software-upgrades/ONOS_AppsUpgrade.robot
index e9a51e1..64135e8 100644
--- a/tests/software-upgrades/ONOS_AppsUpgrade.robot
+++ b/tests/software-upgrades/ONOS_AppsUpgrade.robot
@@ -57,9 +57,9 @@
${container_log_dir} ${None}
# ONOS Apps to Test for Software Upgrade need to be passed in the following variable in format:
-# <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>
+# <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>*
# Example: org.opencord.aaa,2.3.0.SNAPSHOT,
-# https://oss.sonatype.org/content/groups/public/org/opencord/aaa-app/2.3.0-SNAPSHOT/aaa-app-2.3.0-20201210.223737-1.oar
+# https://oss.sonatype.org/content/groups/public/org/opencord/aaa-app/2.3.0-SNAPSHOT/aaa-app-2.3.0-20201210.223737-1.oar*
${onos_apps_under_test} ${EMPTY}
*** Test Cases ***
@@ -67,7 +67,7 @@
[Documentation] Validates the ONOS App Minor Version Upgrade doesn't affect the system functionality
... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable
... Requirement: Apps to test needs to be passed in robot command variable 'onos_apps_under_test' in the format:
- ... <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>
+ ... <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>*
... Check [VOL-3844] for more details
[Tags] functional ONOSAppMinorVerUpgrade
[Setup] Run Keywords Start Logging ONOSAppMinorVerUpgrade
@@ -85,11 +85,15 @@
${url}= Set Variable ${list_onos_apps_under_test}[${I}][url]
${oar_file}= Set Variable ${CURDIR}/../../tests/data/onos-files/${app}-${version}.oar
Download App OAR File ${url} ${oar_file}
+ ${app_details} Get ONOS App Details ${onos_url} ${app}
+ Log ${app}: before upgrade: ${app_details}
Delete ONOS App ${onos_url} ${app}
Verify ONOS Apps Active Except App Under Test ${onos_url} ${app}
Install And Activate ONOS App ${onos_url} ${oar_file}
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
... Verify ONOS App Active ${onos_url} ${app} ${version}
+ ${app_details_1} Get ONOS App Details ${onos_url} ${app}
+ Log ${app}: after upgrade: ${app_details_1}
Verify ONOS Pod Restart False
Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test True
END
@@ -123,11 +127,11 @@
Create ONOS Apps Under Test List
[Documentation] Creates a list of ONOS Apps to Test from the input variable string
... The input string is expected to be in format:
- ... <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>
+ ... <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>*
${list_onos_apps_under_test} Create List
@{apps_under_test_arr}= Split String ${onos_apps_under_test} *
${num_apps_under_test}= Get Length ${apps_under_test_arr}
- FOR ${I} IN RANGE 0 ${num_apps_under_test}
+ FOR ${I} IN RANGE 0 ${num_apps_under_test}-1
@{app_under_test_arr}= Split String ${apps_under_test_arr[${I}]} ,
${app}= Set Variable ${app_under_test_arr[0]}
${version}= Set Variable ${app_under_test_arr[1]}
@@ -135,4 +139,5 @@
${app_under_test} Create Dictionary app ${app} version ${version} url ${url}
Append To List ${list_onos_apps_under_test} ${app_under_test}
END
+ Log ${list_onos_apps_under_test}
Set Suite Variable ${list_onos_apps_under_test}
diff --git a/tests/software-upgrades/Voltha_ComponentsUpgrade.robot b/tests/software-upgrades/Voltha_ComponentsUpgrade.robot
index 53d303f..369f9b0 100755
--- a/tests/software-upgrades/Voltha_ComponentsUpgrade.robot
+++ b/tests/software-upgrades/Voltha_ComponentsUpgrade.robot
@@ -58,8 +58,8 @@
${suppressaddsubscriber} True
# Voltha Components to Test for Software Upgrade need to be passed in the following variable in format:
-# <comp-label>,<comp-container>,<comp-image>*<comp-label>,<comp-container>,<comp-image>
-# Example: adapter-open-olt,adapter-open-olt,voltha/voltha-openolt-adapter:3.1.3
+# <comp-label>,<comp-container>,<comp-image>*<comp-label>,<comp-container>,<comp-image>*
+# Example: adapter-open-olt,adapter-open-olt,voltha/voltha-openolt-adapter:3.1.3*
${voltha_comps_under_test} ${EMPTY}
*** Test Cases ***
@@ -67,7 +67,7 @@
[Documentation] Validates the Voltha Components Minor Version Upgrade doesn't affect the system functionality
... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable
... Requirement: Components to test needs to be passed in robot command variable 'voltha_comps_under_test' in the format:
- ... <comp-label>,<comp-container>,<comp-image>*<comp-label>,<comp-container>,<comp-image>
+ ... <comp-label>,<comp-container>,<comp-image>*<comp-label>,<comp-container>,<comp-image>*
... Check [VOL-3843] for more details
[Tags] functional VolthaCompMinorVerUpgrade
[Setup] Start Logging VolthaCompMinorVerUpgrade
@@ -87,6 +87,9 @@
${label}= Set Variable ${list_voltha_comps_under_test}[${I}][label]
${container}= Set Variable ${list_voltha_comps_under_test}[${I}][container]
${image}= Set Variable ${list_voltha_comps_under_test}[${I}][image]
+ ${pod_image} ${app_ver} ${helm_chart} Get Pod Image And App Version And Helm Chart By Label
+ ... ${NAMESPACE} app ${label}
+ Log ${label}: image, app ver & helm chart before upgrade: ${pod_image}, ${app_ver} & ${helm_chart}
${deployment}= Wait Until Keyword Succeeds ${timeout} 15s
... Get K8s Deployment by Pod Label ${NAMESPACE} app ${label}
Wait Until Keyword Succeeds ${timeout} 15s Deploy Pod New Image ${NAMESPACE} ${deployment}
@@ -95,6 +98,9 @@
... app ${label} Running
Wait Until Keyword Succeeds ${timeout} 3s Pods Are Ready By Label ${NAMESPACE} app ${label}
Wait Until Keyword Succeeds ${timeout} 3s Verify Pod Image ${NAMESPACE} app ${label} ${image}
+ ${pod_image_1} ${app_ver_1} ${helm_chart_1} Get Pod Image And App Version And Helm Chart By Label
+ ... ${NAMESPACE} app ${label}
+ Log ${label}: image, app ver & helm chart after upgrade: ${pod_image_1}, ${app_ver_1} & ${helm_chart_1}
Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test ${suppressaddsubscriber}
END
${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
@@ -120,11 +126,11 @@
Create Voltha Comp Under Test List
[Documentation] Creates a list of Voltha Components to Test from the input variable string
... The input string is expected to be in format:
- ... <comp-label>,<comp-container>,<comp-image>*<comp-label>,<comp-container>,<comp-image>
+ ... <comp-label>,<comp-container>,<comp-image>*<comp-label>,<comp-container>,<comp-image>*
${list_voltha_comps_under_test} Create List
@{comps_under_test_arr}= Split String ${voltha_comps_under_test} *
${num_comps_under_test}= Get Length ${comps_under_test_arr}
- FOR ${I} IN RANGE 0 ${num_comps_under_test}
+ FOR ${I} IN RANGE 0 ${num_comps_under_test}-1
@{comp_under_test_arr}= Split String ${comps_under_test_arr[${I}]} ,
${label}= Set Variable ${comp_under_test_arr[0]}
${container}= Set Variable ${comp_under_test_arr[1]}
@@ -132,4 +138,5 @@
${comp_under_test} Create Dictionary label ${label} container ${container} image ${image}
Append To List ${list_voltha_comps_under_test} ${comp_under_test}
END
+ Log ${list_voltha_comps_under_test}
Set Suite Variable ${list_voltha_comps_under_test}