From 83837dc5af3df7d89541fee2f6c933369c419c6d Mon Sep 17 00:00:00 2001 From: Krzysztof Kuzmicki Date: Wed, 23 Mar 2022 10:29:20 +0100 Subject: [ROBOT] Adopt DCAEMOD test cases to helm based deployment Adopt DCAEMOD test cases to helm based deployment Signed-off-by: Krzysztof Kuzmicki Issue-ID: INT-1895 Change-Id: Id09932899f11ab37b391709c580d681674705432 --- robot/resources/dcaemod_interface.robot | 70 ++++++++++++++++------ robot/resources/test_templates/cmpv2.robot | 1 - .../usecases/5gbulkpm_helm_interface.robot | 4 +- 3 files changed, 53 insertions(+), 22 deletions(-) (limited to 'robot/resources') diff --git a/robot/resources/dcaemod_interface.robot b/robot/resources/dcaemod_interface.robot index 435de23d..d6d6e369 100644 --- a/robot/resources/dcaemod_interface.robot +++ b/robot/resources/dcaemod_interface.robot @@ -6,8 +6,7 @@ Library Collections Library String Library OperatingSystem Resource ../resources/global_properties.robot -Resource ../resources/dcae/inventory.robot -Resource ../resources/dcae/deployment.robot +Resource chart_museum.robot *** Variables *** @@ -26,6 +25,8 @@ ${REGISTRY_CLIENT_ID} ${EMPTY} ${DCAEMOD_ONBOARDING_API_SERVER} ${GLOBAL_DCAEMOD_ONBOARDING_API_SERVER_PROTOCOL}://${GLOBAL_DCAEMOD_ONBOARDING_API_SERVER_NAME}:${GLOBAL_DCAEMOD_ONBOARDING_API_SERVER_PORT} ${DCAEMOD_DESIGNTOOL_SERVER} ${GLOBAL_DCAEMOD_DESIGNTOOL_SERVER_PROTOCOL}://${GLOBAL_DCAEMOD_DESIGNTOOL_SERVER_NAME}:${GLOBAL_DCAEMOD_DESIGNTOOL_SERVER_PORT} ${DCAEMOD_DISTRIBUTOR_API_SERVER} ${GLOBAL_DCAEMOD_DISTRIBUTOR_API_SERVER_PROTOCOL}://${GLOBAL_DCAEMOD_DISTRIBUTOR_API_SERVER_NAME}:${GLOBAL_DCAEMOD_DISTRIBUTOR_API_SERVER_PORT} +${HELM_RELEASE} kubectl --namespace onap get pods | sed 's/ .*//' | grep robot | sed 's/-.*//' + *** Keywords *** @@ -42,10 +43,9 @@ Deploy DCAE Application Distribute The Flow ${PROCESS_GROUP_ID} Set Test Variable ${IS_FLOW_DISTRIBUTED} True - ${typeId} ${blueprintName} = Deploy Blueprint From Inventory ${processGroupName} ${compSpecName} - Set Test Variable ${IS_SERVICE_DEPLOYED} True - Set Test Variable ${TYPE_ID} ${typeId} - Set Test Variable ${BLUEPRINT_NAME} ${blueprintName} + Deploy Applictaion ${processGroupName} ${compSpecName} + Set Test Variable ${CHART_NAME} ${compSpecName} + Delete Config Map With Mounted Config File @@ -223,15 +223,31 @@ Distribute The Flow ${resp} = Post Request distributor /distributor/distribution-targets/${DISTRIBUTION_TARGET_ID}/process-groups data=${data} headers=${headers} Should Be True ${resp.status_code} < 300 -Deploy Blueprint From Inventory - [Arguments] ${processGroupName} ${compSpecName} - ${blueprintName} = Set Variable ${processGroupName}_${compSpecName} - ${resp} = Wait Until Keyword Succeeds 7 min 20s Get Blueprint From Inventory ${blueprintName} - ${typeId} = Set Variable ${resp.json().get('items')[0].get('typeId')} - ${data} = Set Variable {"serviceTypeId": "${typeId}"} - Deploy Service ${data} ${blueprintName} 10 minute - - [Return] ${typeId} ${blueprintName} +Deploy Applictaion + [Arguments] ${processGroupName} ${compSpecName} + ${command_output} = Run And Return Rc And Output helm repo update + Should Be Equal As Integers ${command_output[0]} 0 + ${helm_install}= Set Variable helm install ${ONAP_HELM_RELEASE}-${compSpecName} chart-museum/${compSpecName} --set global.repository=${registry_ovveride} + ${helm_install_command_output} = Run And Return Rc And Output ${helm_install} + Log ${helm_install_command_output[1]} + Should Be Equal As Integers ${helm_install_command_output[0]} 0 + Set Test Variable ${IS_SERVICE_DEPLOYED} True + ${kubectl_patch}= Set Variable kubectl patch deployment ${ONAP_HELM_RELEASE}-${compSpecName} -p '{"spec":{"template":{"spec":{"containers":[{"name": "${compSpecName}","image":"docker.io/nginx:latest"}]}}}}' + ${kubectl_patch_command_output}= Run And Return Rc And Output ${kubectl_patch} + Log ${kubectl_patch_command_output[1]} + Should Be Equal As Integers ${kubectl_patch_command_output[0]} 0 + Wait Until Keyword Succeeds 4 min 15s Check NGINX Applictaion ${compSpecName} + +Check NGINX Applictaion + [Arguments] ${compSpecName} + ${check_command}= Set Variable kubectl get pods -n onap | grep ${compSpecName} | grep Running | grep 1/1 + ${check_command_command_output}= Run And Return Rc And Output ${check_command} + Log ${check_command_command_output[1]} + Should Be Equal As Integers ${check_command_command_output[0]} 0 + +Undeploy Application + [Arguments] ${CHART_NAME} + Uninstall helm charts ${ONAP_HELM_RELEASE}-${CHART_NAME} Get Process Group Revision [Arguments] ${processGroupId} @@ -262,17 +278,33 @@ Delete Registry Client Should Be True ${resp.status_code} < 300 Configure Nifi Registry And Distribution Target + Restart Runtime API Add Registry Client Add Distribution Target + Add chart repository chart-museum http://chart-museum:80 onapinitializer demo123456! + ${command_output} = Run And Return Rc And Output ${HELM_RELEASE} + Should Be Equal As Integers ${command_output[0]} 0 + Set Global Variable ${ONAP_HELM_RELEASE} ${command_output[1]} + +Restart Runtime API + ${restart_command}= Set Variable kubectl delete pod $(kubectl get pods -n onap | grep dcaemod-runtime-api | awk '{print $1}') -n onap + ${restart_command_command_output}= Run And Return Rc And Output ${restart_command} + Log ${restart_command_command_output[1]} + Should Be Equal As Integers ${restart_command_command_output[0]} 0 + Wait Until Keyword Succeeds 2 min 5s Check Runtime API + +Check Runtime API + ${check_command}= Set Variable kubectl get pods -n onap | grep dcaemod-runtime-api | grep Running | grep 1/1 + ${check_command_command_output}= Run And Return Rc And Output ${check_command} + Log ${check_command_command_output[1]} + Should Be Equal As Integers ${check_command_command_output[0]} 0 Delete Nifi Registry And Distribution Target Run Keyword If '${DISTRIBUTION_TARGET_ID}' != '${EMPTY}' Wait Until Keyword Succeeds 2 min 5s Delete Distribution Target Run Keyword If '${REGISTRY_CLIENT_ID}' != '${EMPTY}' Wait Until Keyword Succeeds 2 min 5s Delete Registry Client -Delete Process Group And Blueprint And Deployment +Delete Process Group And Deployment Run Keyword If ${IS_PROCESS_GROUP_SET} Run Keywords Delete Process Group ${PROCESS_GROUP_ID} ... AND Set Suite Variable ${IS_PROCESS_GROUP_SET} False - Run Keyword If ${IS_FLOW_DISTRIBUTED} Run Keywords Delete Blueprint From Inventory ${TYPE_ID} - ... AND Set Suite Variable ${IS_FLOW_DISTRIBUTED} False - Run Keyword If ${IS_SERVICE_DEPLOYED} Run Keywords Undeploy Service ${BLUEPRINT_NAME} + Run Keyword If ${IS_SERVICE_DEPLOYED} Run Keywords Undeploy Application ${CHART_NAME} ... AND Set Suite Variable ${IS_SERVICE_DEPLOYED} False \ No newline at end of file diff --git a/robot/resources/test_templates/cmpv2.robot b/robot/resources/test_templates/cmpv2.robot index 6c50a368..0b317e9e 100644 --- a/robot/resources/test_templates/cmpv2.robot +++ b/robot/resources/test_templates/cmpv2.robot @@ -8,7 +8,6 @@ Library ONAPLibrary.Utilities Library ONAPLibrary.Templating WITH NAME Templating Resource pnf_registration_without_SO_template.robot Resource ../global_properties.robot -Resource ../resources/test_templates/pnf_registration_without_SO_template.robot Resource ../chart_museum.robot diff --git a/robot/resources/usecases/5gbulkpm_helm_interface.robot b/robot/resources/usecases/5gbulkpm_helm_interface.robot index 218f89b2..3408c8c2 100644 --- a/robot/resources/usecases/5gbulkpm_helm_interface.robot +++ b/robot/resources/usecases/5gbulkpm_helm_interface.robot @@ -176,10 +176,10 @@ Check Known Hosts In Env [Return] ${output} Deploying Data File Collector - Install helm charts chart-museum dcae-datafile-collector ${ONAP_HELM_RELEASE}-dcae-datafile-collector 6m --set useCmpv2Certificates=true --set global.cmpv2Enabled=true --set masterPasswordOverride=test --debug + Install helm charts chart-museum dcae-datafile-collector ${ONAP_HELM_RELEASE}-dcae-datafile-collector 6m --set useCmpv2Certificates=true --set global.cmpv2Enabled=true --set masterPasswordOverride=test --set global.centralizedLoggingEnabled=false --debug Deploying 3GPP PM Mapper - Install helm charts chart-museum dcae-pm-mapper ${ONAP_HELM_RELEASE}-dcae-pm-mapper 6m --debug + Install helm charts chart-museum dcae-pm-mapper ${ONAP_HELM_RELEASE}-dcae-pm-mapper 6m --set global.centralizedLoggingEnabled=false --debug Deploying SFTP Server As xNF ${override} = Set Variable --set fullnameOverride=${ONAP_HELM_RELEASE}-sftp --debug -- cgit 1.2.3-korg