From 5014a4ffcfdca9a08cb172036e709c3fd93ac3d5 Mon Sep 17 00:00:00 2001 From: efiacor Date: Tue, 14 Mar 2023 18:19:10 +0000 Subject: [ROBOT] Clean up 5gbulkpm Signed-off-by: efiacor Change-Id: I4656d05892fa16dfe4ac05a096140fd9d8a511ee Issue-ID: OOM-3100 --- robot/resources/chart_museum.robot | 9 + robot/resources/dcae/inventory.robot | 46 --- robot/resources/dcaemod_interface.robot | 310 --------------------- robot/resources/strimzi_kafka.robot | 23 ++ .../usecases/5gbulkpm_helm_interface.robot | 143 ++++------ 5 files changed, 82 insertions(+), 449 deletions(-) delete mode 100644 robot/resources/dcae/inventory.robot delete mode 100644 robot/resources/dcaemod_interface.robot create mode 100644 robot/resources/strimzi_kafka.robot (limited to 'robot/resources') diff --git a/robot/resources/chart_museum.robot b/robot/resources/chart_museum.robot index 75accc68..b2a1e925 100644 --- a/robot/resources/chart_museum.robot +++ b/robot/resources/chart_museum.robot @@ -10,6 +10,15 @@ Library String ${registry_ovveride} ${GLOBAL_INJECTED_NEXUS_DOCKER_REPO} *** Keywords *** +Add OOM test chart repository + [Documentation] Add OOM test chart repository to helm in robot/xtesting pod + [Arguments] ${chart_repo_name} ${chart_repo_fqdn} + ${helm_repo_add}= Set Variable helm repo add ${chart_repo_name} ${chart_repo_fqdn} + ${command_output} = Run And Return Rc And Output ${helm_repo_add} + Should Be Equal As Integers ${command_output[0]} 0 + ${command_output} = Run And Return Rc And Output helm repo update + Should Be Equal As Integers ${command_output[0]} 0 + Add chart repository [Documentation] Add chart repository to helm in robot/xtesting pod [Arguments] ${chart_repo_name} ${chart_repo_fqdn} ${chart_repo_username} ${chart_repo_password} diff --git a/robot/resources/dcae/inventory.robot b/robot/resources/dcae/inventory.robot deleted file mode 100644 index 44f8202d..00000000 --- a/robot/resources/dcae/inventory.robot +++ /dev/null @@ -1,46 +0,0 @@ -*** Settings *** -Documentation The main interface for interacting with 5G Bulkpm. -Library RequestsLibrary -Library OperatingSystem -Library String -Library ONAPLibrary.Templating WITH NAME Templating -Resource ../global_properties.robot - - -*** Variables *** -${INVENTORY_SERVER} ${GLOBAL_INVENTORY_SERVER_PROTOCOL}://${GLOBAL_INVENTORY_SERVER_NAME}:${GLOBAL_INVENTORY_SERVER_PORT} -${INVENTORY_ENDPOINT} /dcae-service-types -${BLUEPRINT_TEMPLATE} ${EXECDIR}/robot/assets/cmpv2/blueprintTemplate.json -*** Keywords *** - -Load Blueprint To Inventory - [Arguments] ${blueprint_path} ${typeName} - Disable Warnings - ${blueprint}= OperatingSystem.Get File ${blueprint_path} - ${templatejson}= Load JSON From File ${BLUEPRINT_TEMPLATE} - ${templatejson}= Update Value To Json ${templatejson} blueprintTemplate ${blueprint} - ${templatejson}= Update Value To Json ${templatejson} typeName ${typeName} - ${data} Convert JSON To String ${templatejson} - ${headers}= Create Dictionary content-type=application/json - ${session}= Create Session inventory_session ${INVENTORY_SERVER} - ${resp}= Post Request inventory_session ${INVENTORY_ENDPOINT} data=${data} headers=${headers} - ${serviceTypeId}= Set Variable ${resp.json().get('typeId')} - [Return] ${serviceTypeId} - -Delete Blueprint From Inventory - [Arguments] ${serviceTypeId} - Disable Warnings - ${session}= Create Session inventory_session ${INVENTORY_SERVER} - ${resp}= Delete Request inventory_session ${INVENTORY_ENDPOINT}/${serviceTypeId} - [Return] ${resp} - -Get Blueprint From Inventory - [Arguments] ${typeName} - Disable Warnings - ${headers}= Create Dictionary content-type=application/json - ${session}= Create Session inventory_session ${INVENTORY_SERVER} - ${resp}= Get Request inventory_session ${INVENTORY_ENDPOINT}?typeName=${typeName} headers=${headers} - Should Not Be Equal As Integers ${resp.json().get('totalCount')} 0 msg=Blueprint ${typeName} does not exist in inventory! - [Return] ${resp} - - diff --git a/robot/resources/dcaemod_interface.robot b/robot/resources/dcaemod_interface.robot deleted file mode 100644 index 19720e80..00000000 --- a/robot/resources/dcaemod_interface.robot +++ /dev/null @@ -1,310 +0,0 @@ -*** Settings *** -Library ONAPLibrary.Templating WITH NAME Templating -Library ONAPLibrary.Utilities -Library RequestsLibrary -Library Collections -Library String -Library OperatingSystem -Resource ../resources/global_properties.robot -Resource chart_museum.robot - - -*** Variables *** - -${CLIENT_ID} robot123 -${SESSION_NAME} nifi-api -${DCAEMOD_SERVER} http://dcaemod.simpledemo.onap.org -${IS_PROCESS_GROUP_SET} False -${IS_FLOW_DISTRIBUTED} False -${IS_SERVICE_DEPLOYED} False -${PROCESS_GROUP_ID} ${EMPTY} -${TYPE_ID} ${EMPTY} -${BLUEPRINT_NAME} ${EMPTY} -${DISTRIBUTION_TARGET_ID} ${EMPTY} -${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 *** - -Deploy DCAE Application - [Arguments] ${componentSpec} ${dict_values} ${compSpecName} ${processGroupName} - - Onboard Component Spec ${componentSpec} ${dict_values} ${compSpecName} - ${processGroupId} = Create Process Group ${processGroupName} - Set Test Variable ${IS_PROCESS_GROUP_SET} True - Set Test Variable ${PROCESS_GROUP_ID} ${processGroupId} - - Create Processor ${PROCESS_GROUP_ID} ${compSpecName} - Save Flow By Version Controlling ${processGroupName} ${PROCESS_GROUP_ID} - Distribute The Flow ${PROCESS_GROUP_ID} - Set Test Variable ${IS_FLOW_DISTRIBUTED} True - - Deploy Applictaion ${processGroupName} ${compSpecName} - Set Test Variable ${CHART_NAME} ${compSpecName} - - - -Delete Config Map With Mounted Config File - ${configMapStatus} = Run Keyword And Return Status Config Map Exists ${CONFIG_MAP_NAME} - Run Keyword If ${configMapStatus} Delete Config Map ${CONFIG_MAP_NAME} - Remove File ${CONFIG_MAP_FILE} - -Delete Config Map - [Arguments] ${configMapName} - ${configMapDelete} = Run And Return Rc kubectl -n onap delete configmap ${configMapName} - Should Be Equal As Integers ${configMapDelete} 0 - -Create Config Map From File - [Arguments] ${configMapName} ${configMapFilePath} - - ${createConfigMapRC} = Run And Return Rc kubectl -n onap create configmap ${configMapName} --from-file=${configMapFilePath} - Should Be Equal As Integers ${createConfigMapRC} 0 - Wait Until Keyword Succeeds 1 min 5s Config Map Exists ${configMapName} - -Config Map Exists - [Arguments] ${configMapName} - ${configMapExists} = Run And Return Rc kubectl -n onap get configmap | grep ${configMapName} - Should Be Equal As Integers ${configMapExists} 0 - -Get Pod Yaml - [Arguments] ${compSpecName} - ${podYaml} = Run And Return Rc And Output kubectl -n onap get pod $(kubectl get pod -n onap | grep ${compSpecName} | awk '{print $1}') -o yaml - Should Be Equal As Integers ${podYaml[0]} 0 - ${podYaml} = Set Variable ${podYaml[1]} - - [Return] ${podYaml} - -Get Content Of Mounted Folder Inside Container - [Arguments] ${compSpecName} ${volumeMountPath} - ${mountedFolderContent} = Run And Return Rc And Output kubectl -n onap exec $(kubectl get pod -n onap | grep ${compSpecName} | awk '{print $1}') -c ${compSpecName} -- ls ${volumeMountPath} - Should Be Equal As Integers ${mountedFolderContent[0]} 0 - ${mountedFolderContent} = Set Variable ${mountedFolderContent[1]} - - [Return] ${mountedFolderContent} - -Verify If Volume Is Mounted - [Arguments] ${podYaml} ${volumeMountPath} - Should Contain ${podYaml} ${volumeMountPath} - -Verify If Config Map Is Mounted As Volume - [Arguments] ${podYaml} ${configMapName} - Should Contain ${podYaml} ${configMapName} - -Verify If Mounted Folder Is Empty - [Arguments] ${mountedFolderContent} - Should Be Empty ${mountedFolderContent} - -Verify If Mounted Folder Contains File - [Arguments] ${compSpecName} ${fileName} ${configMapDir} - - ${dirContent} = Run And Return Rc And Output kubectl -n onap exec $(kubectl get pod -n onap | grep ${compSpecName} | awk '{print $1}') -c ${compSpecName} -- ls ${configMapDir} - Should Be Equal As Integers ${dirContent[0]} 0 - Should Contain ${dirContent[1]} ${fileName} - -Verify File Content - [Arguments] ${compSpecName} ${configMapFilePath} ${content} - - ${fileContent} = Run And Return Rc And Output kubectl -n onap exec $(kubectl get pod -n onap | grep ${compSpecName} | awk '{print $1}') -c ${compSpecName} -- cat ${configMapFilePath} - Should Be Equal As Integers ${fileContent[0]} 0 - Should Contain ${fileContent[1]} ${content} - -Verify If Component Is Onboarded - [Arguments] ${compSpecName} - ${session}= Create Session ${SESSION_NAME} ${DCAEMOD_ONBOARDING_API_SERVER} - ${headers}= Create Dictionary content-type=application/json - ${resp} = Get Request ${SESSION_NAME} /onboarding/components?name=${compSpecName} headers=${headers} - Log ${resp.json()} - Should Not Be Empty ${resp.json().get('components')} - - -Onboard Component Spec - [Arguments] ${componentSpec} ${dict_values} ${compSpecName} - ${session}= Create Session ${SESSION_NAME} ${DCAEMOD_ONBOARDING_API_SERVER} - ${headers}= Create Dictionary content-type=application/json - Templating.Create Environment dcaemod ${GLOBAL_TEMPLATE_FOLDER} - ${componentSpec}= Templating.Apply Template dcaemod ${componentSpec} ${dict_values} - ${resp} = Post Request ${SESSION_NAME} /onboarding/components data=${componentSpec} headers=${headers} - Should Be True ${resp.status_code} < 300 - - Wait Until Keyword Succeeds 2 min 5s Verify If Component Is Onboarded ${compSpecName} - - Log ${resp.json()} - -Add Registry Client - - ${session}= Create Session ${SESSION_NAME} ${DCAEMOD_DESIGNTOOL_SERVER} - ${headers}= Create Dictionary content-type=application/json - ${data} = Set Variable {"revision": {"version": 0}, "component": {"name": "registry_test", "uri": "http://dcaemod-nifi-registry:18080"}} - ${resp} = Post Request ${SESSION_NAME} /nifi-api/controller/registry-clients data=${data} headers=${headers} - Should Be True ${resp.status_code} < 300 - - Set Global Variable ${REGISTRY_CLIENT_ID} ${resp.json().get('id')} - Set Global Variable ${REGISTRY_CLIENT_VERSION} ${resp.json().get('revision').get('version')} - -Add Distribution Target - - ${session}= Create Session distributor ${DCAEMOD_DISTRIBUTOR_API_SERVER} - ${headers}= Create Dictionary content-type=application/json - ${data} = Set Variable {"name": "runtime_test", "runtimeApiUrl": "http://dcaemod-runtime-api:9090"} - ${resp} = Post Request distributor /distributor/distribution-targets data=${data} headers=${headers} - Should Be True ${resp.status_code} < 300 - Set Global Variable ${DISTRIBUTION_TARGET_ID} ${resp.json().get('id')} - -Create Process Group - [Arguments] ${name} - ${session}= Create Session ${SESSION_NAME} ${DCAEMOD_DESIGNTOOL_SERVER} - ${headers}= Create Dictionary content-type=application/json - ${resp} = Get Request ${SESSION_NAME} /nifi-api/flow/process-groups/root/ headers=${headers} - Should Be True ${resp.status_code} < 300 - Log ${resp.json()} - ${parentGroupId} = Set Variable ${resp.json().get('processGroupFlow').get('id')} - - ${data} = Set Variable {"revision": {"clientId": "${CLIENT_ID}", "version": 0}, "component" : {"parentGroupId" : "${parentGroupId}", "name" : "${name}"}} - ${resp} = Post Request ${SESSION_NAME} /nifi-api/process-groups/${parentGroupId}/process-groups data=${data} headers=${headers} - Should Be True ${resp.status_code} < 300 - Log ${resp.json()} - - ${processGroupId} = Set Variable ${resp.json().get('id')} - - [Return] ${processGroupId} - - -Verify If NIFI Processor Is Created - [Arguments] ${typeName} - ${session}= Create Session ${SESSION_NAME} ${DCAEMOD_DESIGNTOOL_SERVER} - ${headers}= Create Dictionary content-type=application/json - ${resp} = Get Request ${SESSION_NAME} /nifi-api/flow/processor-types?type=org.onap.dcae.${typeName} headers=${headers} - Log ${resp.json()} - Should Not Be Empty ${resp.json().get('processorTypes')} - -Create Processor - [Arguments] ${processGroupId} ${compSpecName} - ${session}= Create Session ${SESSION_NAME} ${DCAEMOD_DESIGNTOOL_SERVER} - ${headers}= Create Dictionary content-type=application/json - ${typeName} = Evaluate $compSpecName.title() - ${typeName} = Remove String ${typeName} - - ${data} = Set Variable {"revision": {"clientId": "${CLIENT_ID}", "version": 0},"component": {"parentGroupId": "${processGroupId}", "name": "${compSpecName}", "type": "org.onap.dcae.${typeName}"}} - Wait Until Keyword Succeeds 60s 5s Verify If NIFI Processor Is Created ${typeName} - ${resp} = Post Request ${SESSION_NAME} /nifi-api/process-groups/${processGroupId}/processors data=${data} headers=${headers} - Should Be True ${resp.status_code} < 300 - - -Save Flow By Version Controlling - [Arguments] ${flowName} ${processGroupId} - - ${session}= Create Session ${SESSION_NAME} ${DCAEMOD_DESIGNTOOL_SERVER} - ${headers}= Create Dictionary content-type=application/json - - ${resp} = Get Request ${SESSION_NAME} /nifi-api/flow/registries/${REGISTRY_CLIENT_ID}/buckets headers=${headers} - Should Be True ${resp.status_code} < 300 - Log ${resp.json()} - ${bucketId} = Set Variable ${resp.json().get('buckets')[0].get('id')} - - ${processGrVersion} ${_}= Get Process Group Revision ${processGroupId} - - ${data} = Set Variable {"versionedFlow": {"flowName": "${flowName}", "bucketId": "${bucketId}", "registryId": "${REGISTRY_CLIENT_ID}"}, "processGroupRevision": {"clientId": "${CLIENT_ID}", "version": ${processGrVersion}}} - ${resp} = Post Request ${SESSION_NAME} /nifi-api/versions/process-groups/${processGroupId} data=${data} headers=${headers} - Should Be True ${resp.status_code} < 300 - -Distribute The Flow - [Arguments] ${processGroupId} - ${session}= Create Session ${SESSION_NAME} ${DCAEMOD_DESIGNTOOL_SERVER} - ${session}= Create Session distributor ${DCAEMOD_DISTRIBUTOR_API_SERVER} - ${headers}= Create Dictionary content-type=application/json - ${resp} = Get Request ${SESSION_NAME} /nifi-api/process-groups/${processGroupId} headers=${headers} - Should Be True ${resp.status_code} < 300 - Log ${resp.json()} - ${flowId} = Set Variable ${resp.json().get('component').get('versionControlInformation').get('flowId')} - ${data} = Set Variable {"processGroupId": "${flowId}"} - ${resp} = Post Request distributor /distributor/distribution-targets/${DISTRIBUTION_TARGET_ID}/process-groups data=${data} headers=${headers} - Should Be True ${resp.status_code} < 300 - -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 -n onap 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 -n onap 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 deployment -n onap | grep ${compSpecName} | 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} - ${session}= Create Session ${SESSION_NAME} ${DCAEMOD_DESIGNTOOL_SERVER} - ${headers}= Create Dictionary content-type=application/json - ${resp} = Get Request ${SESSION_NAME} /nifi-api/versions/process-groups/${processGroupId} headers=${headers} - Should Be True ${resp.status_code} < 300 - ${currentProcessGrVersion} = Set Variable ${resp.json().get('processGroupRevision').get('version')} - ${clientId} = Set Variable ${resp.json().get('processGroupRevision').get('clientId')} - - [Return] ${currentProcessGrVersion} ${clientId} - -Delete Distribution Target - ${session}= Create Session distributor ${DCAEMOD_DISTRIBUTOR_API_SERVER} - ${resp} = Delete Request distributor /distributor/distribution-targets/${DISTRIBUTION_TARGET_ID} - Should Be True ${resp.status_code} < 300 - -Delete Process Group - [Arguments] ${processGroupId} - ${session}= Create Session ${SESSION_NAME} ${DCAEMOD_DESIGNTOOL_SERVER} - ${processGrVersion} ${clientId}= Get Process Group Revision ${processGroupId} - ${resp} = Delete Request ${SESSION_NAME} /nifi-api/process-groups/${processGroupId}?version=${processGrVersion}&clientId=${clientId} - Should Be True ${resp.status_code} < 300 - -Delete Registry Client - ${session}= Create Session ${SESSION_NAME} ${DCAEMOD_DESIGNTOOL_SERVER} - ${resp} = Delete Request ${SESSION_NAME} /nifi-api/controller/registry-clients/${REGISTRY_CLIENT_ID}?version=${REGISTRY_CLIENT_VERSION} - 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 deployment -n onap | grep dcaemod-runtime-api | 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 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_SERVICE_DEPLOYED} Run Keywords Undeploy Application ${CHART_NAME} - ... AND Set Suite Variable ${IS_SERVICE_DEPLOYED} False diff --git a/robot/resources/strimzi_kafka.robot b/robot/resources/strimzi_kafka.robot new file mode 100644 index 00000000..262d28e6 --- /dev/null +++ b/robot/resources/strimzi_kafka.robot @@ -0,0 +1,23 @@ +*** Settings *** +Documentation Template for interfacing with strimzi kafka. +Library OperatingSystem +Library RequestsLibrary +Library BuiltIn +Library Collections +Library ONAPLibrary.Utilities +Library String +Library ONAPLibrary.Kafka + +*** Variables *** +${KAFKA_GET_PASSWORD} kubectl -n onap get secret strimzi-kafka-admin -o jsonpath="{.data.password}" | base64 -d + +*** Keywords *** +Get Last Message From Topic + [Documentation] Decode last message from Kafka topic. + [Arguments] ${kafka_server} ${kafka_topic} ${username} + ${command_output} = Run And Return Rc And Output ${KAFKA_GET_PASSWORD} + Should Be Equal As Integers ${command_output[0]} 0 + ${password} Set Variable ${command_output[1]} + Connect kafka ${kafka_server} ${username} ${password} SCRAM-SHA-512 + ${msg}= Consume kafka ${kafka_topic} + [Return] ${msg} diff --git a/robot/resources/usecases/5gbulkpm_helm_interface.robot b/robot/resources/usecases/5gbulkpm_helm_interface.robot index 0419ef43..17a5cff0 100644 --- a/robot/resources/usecases/5gbulkpm_helm_interface.robot +++ b/robot/resources/usecases/5gbulkpm_helm_interface.robot @@ -4,106 +4,62 @@ Library RequestsLibrary Library OperatingSystem Library String Library JSONLibrary -Resource ../dmaap/mr_interface.robot Resource ../dmaap/dr_interface.robot -Resource ../dmaap/bc_interface.robot Resource ../consul_interface.robot Resource ../chart_museum.robot +Resource ../strimzi_kafka.robot *** Variables *** -${INVENTORY_SERVER} ${GLOBAL_INVENTORY_SERVER_PROTOCOL}://${GLOBAL_INVENTORY_SERVER_NAME}:${GLOBAL_INVENTORY_SERVER_PORT} -${DEPLOYMENT_SERVER} ${GLOBAL_DEPLOYMENT_HANDLER_SERVER_PROTOCOL}://${GLOBAL_DEPLOYMENT_HANDLER_SERVER_NAME}:${GLOBAL_DEPLOYMENT_HANDLER_SERVER_PORT} ${DR_ENDPOINT} ${GLOBAL_DMAAP_DR_PROV_SERVER_PROTOCOL}://${GLOBAL_INJECTED_DMAAP_DR_PROV_IP_ADDR}:${GLOBAL_DMAAP_DR_PROV_SERVER_PORT} -${DMAAP_BC_SERVER} ${GLOBAL_BC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_BC_IP_ADDR}:${GLOBAL_BC_HTTPS_SERVER_PORT} ${VES_HEALTH_CHECK_PATH} ${GLOBAL_DCAE_VES_HTTPS_PROTOCOL}://${GLOBAL_INJECTED_DCAE_VES_HOST}:${GLOBAL_DCAE_VES_HTTPS_SERVER_PORT} -${MR_PUBLISH_TEMPLATE} mr/mr_publish.jinja -${INVENTORY_ENDPOINT} /dcae-service-types -${XNF_SFTP_BLUEPRINT_PATH} ${EXECDIR}/robot/assets/usecases/5gbulkpm/k8s-sftp.yaml -${XNF_HTTPS_BLUEPRINT_PATH} ${EXECDIR}/robot/assets/usecases/5gbulkpm/k8s-https.yaml -${BLUEPRINT_TEMPLATE_PATH} ${EXECDIR}/robot/assets/usecases/5gbulkpm/blueprintTemplate.json -${DEPLOYMENT_ENDPOINT} dcae-deployments -${MR_TOPIC_CHECK_PATH} /topics ${DR_SUB_CHECK_PATH} /internal/prov -${MR_TOPIC_URL_PATH} /events/unauthenticated.PERFORMANCE_MEASUREMENTS/CG1/C1 -${MR_TOPIC_URL_PATH_FOR_POST} /events/unauthenticated.PERFORMANCE_MEASUREMENTS -${DMAAP_BC_MR_CLIENT_PATH} /webapi/mr_clients -${DMAAP_BC_MR_CLUSTER_PATH} /webapi/mr_clusters -${PMMAPPER_HEALTH_CHECK_PATH} /healthcheck ${JSON_DATA_FILE} ${EXECDIR}/robot/assets/usecases/5gbulkpm/Notification.json ${VES_LISTENER_PATH} /eventListener/v7 -${PMMAPPER_SUB_ROLE_DATA} ${EXECDIR}/robot/assets/usecases/5gbulkpm/sub.json -${PMMAPPER_MR_CLUSTER_DATA} ${EXECDIR}/robot/assets/usecases/5gbulkpm/mr_clusters.json -${NEXUS3} ${GLOBAL_INJECTED_NEXUS_DOCKER_REPO} ${SET_KNOWN_HOSTS_FILE_PATH} kubectl set env deployment/$(kubectl get deployment -n onap | grep datafile | awk '{print $1}') KNOWN_HOSTS_FILE_PATH=/home/datafile/.ssh/known_hosts -n onap +${DR_NODE_FECTH_PROV} kubectl exec $(kubectl get pods -n onap | grep dmaap-dr-node | awk '{print $1}' | grep -v NAME) -n onap -- curl http://localhost:8080/internal/fetchProv ${CHECK_ENV_SET} kubectl set env pod/$(kubectl get pod -n onap | grep datafile | awk '{print $1}') -c dcae-datafile-collector --list -n onap ${COPY_RSA_KEY} kubectl cp /tmp/known_hosts $(kubectl get pod -n onap | grep datafile | awk '{print $1}'):/home/datafile/.ssh/known_hosts -c dcae-datafile-collector -n onap ${CHECK_DFC_LOGS} kubectl logs $(kubectl get pod -n onap | grep datafile | awk '{print $1}') -c dcae-datafile-collector -n onap --tail=10 ${CHECK_ALL_DFC_LOGS} kubectl logs $(kubectl get pod -n onap | grep datafile | awk '{print $1}') -n onap --all-containers ${CHECK_ALL_PMMAPPER_LOGS} kubectl logs $(kubectl get pod -n onap | grep pm-mapper | awk '{print $1}') -n onap --all-containers ${EXPECTED_PRINT} StrictHostKeyChecking is enabled but environment variable KNOWN_HOSTS_FILE_PATH is not set or points to not existing file -${MONGO_BLUEPRINT_PATH} ${EXECDIR}/robot/assets/cmpv2/k8s-mongo.yaml -${PNF_SIMULATOR_BLUEPRINT_PATH} ${EXECDIR}/robot/assets/cmpv2/k8s-pnf-simulator.yaml -${MONGO_VES_CLIENT_BLUEPRINT_PATH} ${EXECDIR}/robot/assets/cmpv2/k8s-mongo-ves-client.yaml -${VES_CLIENT_BLUEPRINT_PATH} ${EXECDIR}/robot/assets/cmpv2/k8s-ves-client.yaml -${VES_INPUTS} deployment/VesTlsCmpv2Inputs.jinja ${pm_notification_event} dfc/notification.jinja ${consul_change_event} dfc/consul.jinja -${ves_client_single_event}= ves/pnf_simulator_single_event.jinja ${SFTP_HELM_CHARTS} ${EXECDIR}/robot/assets/helm/sftp ${HTTPS_SERVER_HELM_CHARTS} ${EXECDIR}/robot/assets/helm/pm-https-server ${HELM_RELEASE} kubectl --namespace onap get pods | sed 's/ .*//' | grep robot | sed 's/-.*//' *** Keywords *** - xNF PM File Validate [Documentation] - ... This keyword gathers all events from message router topic and validates if in recived data is present an expected string: "${expected_pm_str}" . + ... This keyword gets the last event from the PM topic and validates if the expected string is present: "${expected_pm_str}" . [Arguments] ${expected_pm_str} - ${timestamp}= Get Time epoch - #${resp}= Run MR Auth Get Request ${MR_TOPIC_URL_PATH} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD} - ${resp}= Run MR Get Request ${MR_TOPIC_URL_PATH} - Should Contain ${resp.text} ${expected_pm_str} - -Topic Validate - [Arguments] ${value} - ${timestamp}= Get Current Date - ${dict}= Create Dictionary timestamp=${timestamp} - Templating.Create Environment mr ${GLOBAL_TEMPLATE_FOLDER} - ${data}= Templating.Apply Template mr ${MR_PUBLISH_TEMPLATE} ${dict} - ${resp}= Run MR Auth Post Request (User And Pass) ${MR_TOPIC_URL_PATH_FOR_POST} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD} ${data} - Should Be Equal As Strings ${resp.status_code} 200 - #${resp}= Run MR Auth Get Request ${MR_TOPIC_URL_PATH} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD} - ${resp}= Run MR Get Request ${MR_TOPIC_URL_PATH} - Should Contain ${resp.text} ${value} + ${bytes} = Encode String To Bytes ${expected_pm_str} UTF-8 + ${msg}= Run Keyword Get Last Message From Topic ${GLOBAL_KAFKA_BOOTSTRAP_SERVICE} unauthenticated.PERFORMANCE_MEASUREMENTS ${GLOBAL_KAFKA_USER} + Should Contain ${msg} ${bytes} + Send File Ready Event to VES Collector and Deploy all DCAE Applications [Arguments] ${pm_file} ${file_format_type} ${file_format_version} Disable Warnings Setting Global Variables + DR Node Fetch Prov + Sleep 10s Send File Ready Event to VES Collector ${pm_file} ${file_format_type} ${file_format_version} + Add OOM test chart repository onap-testing https://nexus3.onap.org/repository/onap-helm-testing/ Add chart repository chart-museum http://chart-museum:80 onapinitializer demo123456! -# Log To Console Deploying Data File Collector -# Deploying Data File Collector -# Log To Console Deploying 3GPP PM Mapper -# Deploying 3GPP PM Mapper Log To Console Deploying SFTP Server As xNF Deploying SFTP Server As xNF # Log To Console Deploying HTTPS Server with correct CMPv2 certificates as xNF # Deploying HTTPS server with correct certificates -# Log To Console Deploying HTTPS Server with wrong subject alternatives in CMPv2 certificates as xNF -# Deploying HTTPS server with wrong certificates - wrong SAN-s - DR Bulk PM Feed Check DR PM Mapper Subscriber Check Usecase Teardown Disable Warnings Get all logs from PM Mapper Get all logs from Data File Collector -# Uninstall helm charts ${ONAP_HELM_RELEASE}-dcae-datafile-collector -# Uninstall helm charts ${ONAP_HELM_RELEASE}-dcae-pm-mapper Uninstall helm charts ${ONAP_HELM_RELEASE}-sftp # Uninstall helm charts ${ONAP_HELM_RELEASE}-pm-https-server-correct-sans -# Uninstall helm charts ${ONAP_HELM_RELEASE}-pm-https-server-wrong-sans Setting Global Variables ${test_variables} = Create Dictionary @@ -193,9 +149,10 @@ Deploying HTTPS server with wrong certificates - wrong SAN-s ${override} = Set Variable --set fullnameOverride=${name} --set nameOverride=${name} --set certificates.name=${name} --set certificates.commonName=wrong-sans-1 --set certificates.dnsNames={wrong-sans-2} --debug Install helm charts from folder ${HTTPS_SERVER_HELM_CHARTS} ${name} set_values_override=${override} -DR Bulk PM Feed Check - ${resp}= Run DR Get Request ${DR_SUB_CHECK_PATH} - Should Contain ${resp.text} bulk_pm_feed +DR Node Fetch Prov + ${rc}= Run and Return RC ${DR_NODE_FECTH_PROV} + Should Be Equal As Integers ${rc} 0 + DR PM Mapper Subscriber Check ${resp}= Run DR Get Request ${DR_SUB_CHECK_PATH} @@ -263,39 +220,39 @@ Change DFC httpsHostnameVerify configuration in Consul Should Be Equal As Integers ${rc} 0 Wait Until Keyword Succeeds 360 sec 15 sec Check logs kubectl logs -n onap $(kubectl get pods -n onap | grep datafile-collector | awk '{print $1}' | grep -v NAME) ${container_name}-datafile-collector -#Sending File Ready Event to VES Collector for HTTPS Server -# [Arguments] ${https-server_host} -# Send File Ready Event to VES Collector for HTTPS Server ${PM_FILE} ${GLOBAL_TEST_VARIABLES["FILE_FORMAT_TYPE"]} ${GLOBAL_TEST_VARIABLES["FILE_FORMAT_VERSION"]} ${https-server_host} - -#Send File Ready Event to VES Collector for HTTPS Server -# [Arguments] ${pm_file} ${file_format_type} ${file_format_version} ${https_server_host} -# Disable Warnings -# ${pm_event} Create Dictionary https_server_host=${https_server_host} pm_file=${pm_file} fileFormatType=${file_format_type} fileFormatVersion=${file_format_version} -# Templating.Create Environment pm ${GLOBAL_TEMPLATE_FOLDER} -# ${VES_FILE_READY_NOTIFICATION}= Templating.Apply Template pm ${pm_notification_event} ${pm_event} -# ${headers}= Create Dictionary content-type=application/json -# ${auth}= Create List ${GLOBAL_DCAE_VES_USERNAME} ${GLOBAL_DCAE_VES_PASSWORD} -# ${session}= Create Session ves ${VES_HEALTH_CHECK_PATH} auth=${auth} -# ${resp}= Post Request ves ${VES_LISTENER_PATH} data=${VES_FILE_READY_NOTIFICATION} headers=${headers} -# Should Be Equal As Strings ${resp.status_code} 202 - - -#Uploading PM Files to xNF HTTPS Server -# [Arguments] ${https-server_host} -# ${pm_file}= Upload PM Files to xNF HTTPS Server ${GLOBAL_TEST_VARIABLES["PM_FILE_PATH"]} ${https-server_host} -# Set Global Variable ${PM_FILE} ${pm_file} - -#Upload PM Files to xNF HTTPS Server -# [Arguments] ${pm_file_path} ${https_server} -# ${epoch}= Get Current Date result_format=epoch -# ${pm_file} = Set Variable A${epoch}.xml.gz -# Copy File ${pm_file_path} tmp/${pm_file} -# ${fileData}= Get Binary File tmp/${pm_file} -# ${file_part}= Create List ${pm_file} ${fileData} application/octet-stream -# ${fileParts}= Create Dictionary -# Set to Dictionary ${fileParts} uploaded_file=${file_part} -# ${auth}= Create List demo demo123456! -# ${session}= Create Session https http://${https_server}:80 auth=${auth} -# ${resp}= Post Request https /upload.php files=${fileParts} -# Should Be Equal As Strings ${resp.status_code} 200 -# [Return] ${pm_file} +Sending File Ready Event to VES Collector for HTTPS Server + [Arguments] ${https-server_host} + Send File Ready Event to VES Collector for HTTPS Server ${PM_FILE} ${GLOBAL_TEST_VARIABLES["FILE_FORMAT_TYPE"]} ${GLOBAL_TEST_VARIABLES["FILE_FORMAT_VERSION"]} ${https-server_host} + +Send File Ready Event to VES Collector for HTTPS Server + [Arguments] ${pm_file} ${file_format_type} ${file_format_version} ${https_server_host} + Disable Warnings + ${pm_event} Create Dictionary https_server_host=${https_server_host} pm_file=${pm_file} fileFormatType=${file_format_type} fileFormatVersion=${file_format_version} + Templating.Create Environment pm ${GLOBAL_TEMPLATE_FOLDER} + ${VES_FILE_READY_NOTIFICATION}= Templating.Apply Template pm ${pm_notification_event} ${pm_event} + ${headers}= Create Dictionary content-type=application/json + ${auth}= Create List ${GLOBAL_DCAE_VES_USERNAME} ${GLOBAL_DCAE_VES_PASSWORD} + ${session}= Create Session ves ${VES_HEALTH_CHECK_PATH} auth=${auth} + ${resp}= Post Request ves ${VES_LISTENER_PATH} data=${VES_FILE_READY_NOTIFICATION} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 202 + + +Uploading PM Files to xNF HTTPS Server + [Arguments] ${https-server_host} + ${pm_file}= Upload PM Files to xNF HTTPS Server ${GLOBAL_TEST_VARIABLES["PM_FILE_PATH"]} ${https-server_host} + Set Global Variable ${PM_FILE} ${pm_file} + +Upload PM Files to xNF HTTPS Server + [Arguments] ${pm_file_path} ${https_server} + ${epoch}= Get Current Date result_format=epoch + ${pm_file} = Set Variable A${epoch}.xml.gz + Copy File ${pm_file_path} tmp/${pm_file} + ${fileData}= Get Binary File tmp/${pm_file} + ${file_part}= Create List ${pm_file} ${fileData} application/octet-stream + ${fileParts}= Create Dictionary + Set to Dictionary ${fileParts} uploaded_file=${file_part} + ${auth}= Create List demo demo123456! + ${session}= Create Session https http://${https_server}:80 auth=${auth} + ${resp}= Post Request https /upload.php files=${fileParts} + Should Be Equal As Strings ${resp.status_code} 200 + [Return] ${pm_file} -- cgit 1.2.3-korg