From bae8d839893d1ce5c1e9dfa670fbe536520093a0 Mon Sep 17 00:00:00 2001 From: Krzysztof Kuzmicki Date: Wed, 24 Nov 2021 12:00:45 +0100 Subject: [ROBOT] ADD HTTPS based BULKPM test cases that use helm based components Add https server based test cases Signed-off-by: Krzysztof Kuzmicki Issue-ID: INT-1895 Change-Id: I74f7102398a08e1629b50f510ef179d35c8761bd --- robot/assets/helm/pm-https-server/Chart.yaml | 27 +++++ robot/assets/helm/pm-https-server/README.md | 34 ++++++ .../E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz | Bin 0 -> 2046 bytes .../helm/pm-https-server/templates/_helpers.tpl | 78 ++++++++++++++ .../pm-https-server/templates/certificate.yaml | 26 +++++ .../helm/pm-https-server/templates/deployment.yaml | 46 ++++++++ .../helm/pm-https-server/templates/secret.yaml | 8 ++ .../helm/pm-https-server/templates/service.yaml | 24 +++++ robot/assets/helm/pm-https-server/values.yaml | 58 ++++++++++ robot/resources/bc_interface.robot | 8 ++ robot/resources/chart_museum.robot | 10 +- robot/resources/consul_interface.robot | 4 +- robot/resources/mr_interface.robot | 9 ++ .../usecases/5gbulkpm_helm_interface.robot | 119 ++++++++++++++++----- robot/testsuites/usecases/5gbulkpm_helm.robot | 44 +++++++- 15 files changed, 466 insertions(+), 29 deletions(-) create mode 100644 robot/assets/helm/pm-https-server/Chart.yaml create mode 100644 robot/assets/helm/pm-https-server/README.md create mode 100644 robot/assets/helm/pm-https-server/resources/E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz create mode 100644 robot/assets/helm/pm-https-server/templates/_helpers.tpl create mode 100644 robot/assets/helm/pm-https-server/templates/certificate.yaml create mode 100644 robot/assets/helm/pm-https-server/templates/deployment.yaml create mode 100644 robot/assets/helm/pm-https-server/templates/secret.yaml create mode 100644 robot/assets/helm/pm-https-server/templates/service.yaml create mode 100644 robot/assets/helm/pm-https-server/values.yaml diff --git a/robot/assets/helm/pm-https-server/Chart.yaml b/robot/assets/helm/pm-https-server/Chart.yaml new file mode 100644 index 00000000..32e1c595 --- /dev/null +++ b/robot/assets/helm/pm-https-server/Chart.yaml @@ -0,0 +1,27 @@ +apiVersion: v2 +name: pm-https-server +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: 1.0.1 +dependencies: + - name: repositoryGenerator + version: ~9.x-0 + repository: '@chart-museum' diff --git a/robot/assets/helm/pm-https-server/README.md b/robot/assets/helm/pm-https-server/README.md new file mode 100644 index 00000000..f7d80ee8 --- /dev/null +++ b/robot/assets/helm/pm-https-server/README.md @@ -0,0 +1,34 @@ +# PM HTTPS Server + +# How to deploy on lab + +1. Copy files from helm/pm-https-server to lab + + `scp -i -r /pm-https-server ubuntu@:/pm-https-server ` +2. Log into the RKE + +3. Install chart on your lab + + `helm install pm-https-server ./pm-https-server` + +# Checking if everything is working properly + +1. Find service on which your application runs + + `kubectl get service | grep pm-https-server` + +2. If service is running try to connect to server + + `curl -u demo:demo123456! ` + + if everything is working properly you should get response like below + + `

It works!

` + +3. If step 2 ends with success try to upload file + + `curl -F "uploaded_file=@./resources/E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz" -u demo:demo123456! http://WORKER_IP:PM_HTTPS_SERVER_PORT/upload.php` + + When file will be successfully uploaded you should see information like this: + + `The file E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz has been uploaded` \ No newline at end of file diff --git a/robot/assets/helm/pm-https-server/resources/E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz b/robot/assets/helm/pm-https-server/resources/E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz new file mode 100644 index 00000000..3af5ea8f Binary files /dev/null and b/robot/assets/helm/pm-https-server/resources/E_VES_bulkPM_IF_3GPP_3_example_1.xml.gz differ diff --git a/robot/assets/helm/pm-https-server/templates/_helpers.tpl b/robot/assets/helm/pm-https-server/templates/_helpers.tpl new file mode 100644 index 00000000..b7a3e1e8 --- /dev/null +++ b/robot/assets/helm/pm-https-server/templates/_helpers.tpl @@ -0,0 +1,78 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "pmhttpsserver.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common namespace +*/}} +{{- define "pmhttpsserver.namespace" -}} + {{- default .Release.Namespace .Values.nsPrefix -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "pmhttpsserver.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "pmhttpsserver.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "pmhttpsserver.labels" -}} +helm.sh/chart: {{ include "pmhttpsserver.chart" . }} +{{ include "pmhttpsserver.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "pmhttpsserver.selectorLabels" -}} +app.kubernetes.io/name: {{ include "pmhttpsserver.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "pmhttpsserver.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "pmhttpsserver.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Define dns names in certificate +*/}} +{{- define "pmhttpsserver.dnsNames" -}} +{{- range $dnsName := $.Values.certificates.dnsNames }} +- {{ $dnsName }} +{{- end }} +{{- end }} diff --git a/robot/assets/helm/pm-https-server/templates/certificate.yaml b/robot/assets/helm/pm-https-server/templates/certificate.yaml new file mode 100644 index 00000000..229ac940 --- /dev/null +++ b/robot/assets/helm/pm-https-server/templates/certificate.yaml @@ -0,0 +1,26 @@ +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + namespace: {{ include "pmhttpsserver.namespace" . }} + name: '{{ .Values.certificates.name }}-cert' +spec: + commonName: {{ .Values.certificates.commonName }} + secretName: '{{ .Values.certificates.name }}-secret' + renewBefore: {{ .Values.certificates.renewBefore }} + duration: {{ .Values.certificates.duration }} + subject: + organizations: + - {{ .Values.certificates.subject.organization }} + countries: + - {{ .Values.certificates.subject.country }} + localities: + - {{ .Values.certificates.subject.locality }} + provinces: + - {{ .Values.certificates.subject.province }} + organizationalUnits: + - {{ .Values.certificates.subject.organizationalUnit }} + issuerRef: + group: {{ .Values.certificates.issuerRef.group }} + kind: {{ .Values.certificates.issuerRef.kind }} + name: {{ .Values.certificates.issuerRef.name }} + dnsNames: {{ include "pmhttpsserver.dnsNames" . | indent 4 }} diff --git a/robot/assets/helm/pm-https-server/templates/deployment.yaml b/robot/assets/helm/pm-https-server/templates/deployment.yaml new file mode 100644 index 00000000..dc00607a --- /dev/null +++ b/robot/assets/helm/pm-https-server/templates/deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "pmhttpsserver.fullname" . }} + namespace: {{ include "pmhttpsserver.namespace" . }} + labels: + {{ include "pmhttpsserver.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{ include "pmhttpsserver.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{ include "pmhttpsserver.selectorLabels" . | nindent 8 }} + spec: + containers: + - name: {{ .Chart.Name }} + image: '{{ include "repositoryGenerator.repository" . }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}' + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + - name: http2 + containerPort: 8080 + protocol: TCP + - name: https + containerPort: 443 + protocol: TCP + volumeMounts: + - name: certstore + mountPath: {{ .Values.certsDir }} + volumes: + - name: certstore + projected: + sources: + - secret: + name: '{{.Values.certificates.name}}-secret' + items: + - key: tls.key + path: key.pem + - key: tls.crt + path: keystore.pem + - key: ca.crt + path: truststore.pem diff --git a/robot/assets/helm/pm-https-server/templates/secret.yaml b/robot/assets/helm/pm-https-server/templates/secret.yaml new file mode 100644 index 00000000..9d5547d4 --- /dev/null +++ b/robot/assets/helm/pm-https-server/templates/secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: '{{ .Values.certificates.name }}-secret' + namespace: {{ include "pmhttpsserver.namespace" . }} +data: + p12.pass: MjNlOTE3NzVjOTE4ZTRmNjY4ZTFhYzgyZDY5ZjExYWU0ZWU0ZGM2MTM3YzUwMzZkZjE3MmEyODJhYTA5 +type: Opaque diff --git a/robot/assets/helm/pm-https-server/templates/service.yaml b/robot/assets/helm/pm-https-server/templates/service.yaml new file mode 100644 index 00000000..c85c9c8c --- /dev/null +++ b/robot/assets/helm/pm-https-server/templates/service.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "pmhttpsserver.fullname" . }} + namespace: {{ include "pmhttpsserver.namespace" . }} + labels: + {{ include "pmhttpsserver.labels" . | nindent 4 }} +spec: + type: NodePort + ports: + - port: 80 + targetPort: http + protocol: TCP + name: http + - port: 8080 + targetPort: http2 + protocol: TCP + name: http2 + - port: 443 + targetPort: https + protocol: TCP + name: https + selector: + {{ include "pmhttpsserver.selectorLabels" . | nindent 4 }} diff --git a/robot/assets/helm/pm-https-server/values.yaml b/robot/assets/helm/pm-https-server/values.yaml new file mode 100644 index 00000000..2e854033 --- /dev/null +++ b/robot/assets/helm/pm-https-server/values.yaml @@ -0,0 +1,58 @@ +# Default values for myhttpsserver. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + repository: onap/org.onap.integration.nfsimulator.pmhttpsserver + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "1.0.1" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +podAnnotations: {} + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +certsDir: "/etc/apache2/certs/external" + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +certificates: + name: pm-http-server + dnsNames: + - pm-http-server + renewBefore: 720h #30 days + duration: 8760h #365 days + commonName: pm-http-server + subject: + organization: "Linux-Foundation" + country: "US" + locality: "San-Francisco" + province: "California" + organizationalUnit: "ONAP" + # issuer: + # group: certmanager.onap.org + # kind: CMPv2Issuer + # name: cmpv2-issuer-onap + issuerRef: + group: certmanager.onap.org + kind: CMPv2Issuer + name: cmpv2-issuer-onap + # ipAddresses: "127.0.0.1" diff --git a/robot/resources/bc_interface.robot b/robot/resources/bc_interface.robot index 3d0ebc02..7d4c1fb1 100644 --- a/robot/resources/bc_interface.robot +++ b/robot/resources/bc_interface.robot @@ -25,3 +25,11 @@ Return dmaap details with basic auth Log Received response from bus controller ${resp.text} [Return] ${resp} +Delete MR topic + [Documentation] Runs Bus Controller to remove topic + [Arguments] ${data_path} + ${auth}= Create List ${GLOBAL_BC_USERNAME} ${GLOBAL_BC_PASSWORD} + ${session}= Create Session bs ${BC_HTTPS_ENDPOINT} auth=${auth} + ${resp}= Delete Request bs ${data_path} + Log Received response from bus controller ${resp.status_code} + [Return] ${resp} \ No newline at end of file diff --git a/robot/resources/chart_museum.robot b/robot/resources/chart_museum.robot index e201a914..7b46deb3 100644 --- a/robot/resources/chart_museum.robot +++ b/robot/resources/chart_museum.robot @@ -43,25 +43,31 @@ Install helm charts [Arguments] ${chart_repo_name} ${dcae_servcie_helm_charts} ${dcae_service_helm_name} ${wait_time}=2 min ${set_values_override}=${EMPTY} ${helm_install}= Set Variable helm install ${dcae_service_helm_name} ${chart_repo_name}/${dcae_servcie_helm_charts} --set global.repository=${registry_ovveride} ${set_values_override} ${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 Wait Until Keyword Succeeds ${wait_time} 20 sec Checking Status Of Deployed Appliction Using Helm ${dcae_servcie_helm_charts} ${dcae_service_helm_name} Install helm charts from folder [Documentation] Install DCAE Servcie using helm charts not in repo [Arguments] ${chart_folder} ${dcae_service_helm_name} ${wait_time}=2 min ${set_values_override}=${EMPTY} + ${helm_dependency_update}= Set Variable helm dependency update ${chart_folder} + ${helm_dependency_update_output} = Run And Return Rc And Output ${helm_dependency_update} + Log ${helm_dependency_update_output[1]} + Should Be Equal As Integers ${helm_dependency_update_output[0]} 0 ${rest} ${dcae_servcie_helm_charts} = Split String From Right ${chart_folder} / 1 ${helm_install}= Set Variable helm install ${dcae_service_helm_name} ${chart_folder} --set global.repository=${registry_ovveride} ${set_values_override} ${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 Wait Until Keyword Succeeds ${wait_time} 20 sec Checking Status Of Deployed Appliction Using Helm ${dcae_servcie_helm_charts} ${dcae_service_helm_name} Checking Status Of Deployed Appliction Using Helm [Arguments] ${dcae_servcie_helm_charts} ${dcae_service_helm_name} - ${pod_status}= Set Variable kubectl get pods -n onap | grep ${ONAP_HELM_RELEASE}-${dcae_servcie_helm_charts} | awk '{print $3}' + ${pod_status}= Set Variable kubectl get pods -n onap | grep ${dcae_service_helm_name} | awk '{print $3}' ${pod_status_command_output} = Run And Return Rc And Output ${pod_status} Should Be Equal As Integers ${pod_status_command_output[0]} 0 Should Be Equal As Strings ${pod_status_command_output[1]} Running - ${pod_ready}= Set Variable kubectl get pods -n onap | grep ${ONAP_HELM_RELEASE}-${dcae_servcie_helm_charts} | awk '{print $2}' + ${pod_ready}= Set Variable kubectl get pods -n onap | grep ${dcae_service_helm_name} | awk '{print $2}' ${pod_ready_command_output} = Run And Return Rc And Output ${pod_ready} Should Be Equal As Integers ${pod_ready_command_output[0]} 0 ${pre} ${post} = Split String ${pod_ready_command_output[1]} / 1 diff --git a/robot/resources/consul_interface.robot b/robot/resources/consul_interface.robot index 5b6f948f..ca0244b7 100644 --- a/robot/resources/consul_interface.robot +++ b/robot/resources/consul_interface.robot @@ -6,7 +6,9 @@ Library String Resource global_properties.robot *** Variables *** -${CONSUL_ENDPOINT} http://consul.onap:8500 +${CONSUL_ENDPOINT} http://consul-server-ui:8500 +#${CONSUL_ENDPOINT} ${GLOBAL_CONSUL_SERVER_PROTOCOL}://${GLOBAL_CONSUL_SERVER_NAME}:${GLOBAL_CONSUL_SERVER_PORT} + *** Keywords *** diff --git a/robot/resources/mr_interface.robot b/robot/resources/mr_interface.robot index 2d3cda28..f4c57cd2 100644 --- a/robot/resources/mr_interface.robot +++ b/robot/resources/mr_interface.robot @@ -143,3 +143,12 @@ Run MR Post Request Log Received response from message router ${resp.text} [Return] ${resp} +Run MR Delete Request + [Documentation] Runs MR Delete request + [Arguments] ${data_path} + ${session}= Create Session mr ${MR_ENDPOINT} + ${uuid}= Generate UUID4 + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Delete Request mr ${data_path} headers=${headers} + Log Received response from message router ${resp.status_code} + [Return] ${resp} \ No newline at end of file diff --git a/robot/resources/usecases/5gbulkpm_helm_interface.robot b/robot/resources/usecases/5gbulkpm_helm_interface.robot index 6707767f..8dfc3972 100644 --- a/robot/resources/usecases/5gbulkpm_helm_interface.robot +++ b/robot/resources/usecases/5gbulkpm_helm_interface.robot @@ -6,6 +6,7 @@ Library String Library JSONLibrary Resource ../mr_interface.robot Resource ../dr_interface.robot +Resource ../bc_interface.robot Resource ../consul_interface.robot Resource ../chart_museum.robot @@ -37,6 +38,8 @@ ${SET_KNOWN_HOSTS_FILE_PATH} kubectl set env deployment/$ ${CHECK_ENV_SET} kubectl set env pod/$(kubectl get pod -n onap | grep datafile | awk '{print $1}') --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 -n onap ${CHECK_DFC_LOGS} kubectl logs $(kubectl get pod -n onap | grep datafile | awk '{print $1}') -n onap --tail=4 +${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 @@ -47,6 +50,7 @@ ${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 *** @@ -73,6 +77,7 @@ Topic Validate Send File Ready Event to VES Collector and Deploy all DCAE Applications [Arguments] ${pm_file} ${file_format_type} ${file_format_version} Disable Warnings + Delete PERFORMANCE_MEASUREMENTS topic Setting Global Variables Send File Ready Event to VES Collector ${pm_file} ${file_format_type} ${file_format_version} Add chart repository chart-museum http://chart-museum:80 onapinitializer demo123456! @@ -82,15 +87,26 @@ Send File Ready Event to VES Collector and Deploy all DCAE Applications 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 Checking PERFORMANCE_MEASUREMENTS Topic In Message Router DR Bulk PM Feed Check DR PM Mapper Subscriber Check Usecase Teardown Disable Warnings - Uninstall helm charts ${ONAP_HELM_RELEASE}-dfc - Uninstall helm charts ${ONAP_HELM_RELEASE}-pmmapper + 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 + +Delete PERFORMANCE_MEASUREMENTS topic + ${resp}= Delete MR topic /webapi/topics/org.onap.dmaap.mr.PERFORMANCE_MEASUREMENTS Setting Global Variables ${test_variables} = Create Dictionary @@ -125,21 +141,6 @@ Upload PM Files to xNF SFTP Server Put File ${pm_file_path} upload/${pm_file} [Return] ${pm_file} -Upload PM Files to xNF HTTPS Server - [Arguments] ${pm_file_path} ${https_server} - ${epoch}= Get Current Date result_format=epoch - 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} - Check Given Print In DFC Log [Arguments] ${check_dfc_logs} ${dfc_logs}= Run Given Command On DFC Container ${CHECK_DFC_LOGS} @@ -167,15 +168,25 @@ Check Known Hosts In Env [Return] ${output} Deploying Data File Collector - Install helm charts chart-museum dcae-datafile-collector ${ONAP_HELM_RELEASE}-dfc 3 min + Install helm charts chart-museum dcae-datafile-collector ${ONAP_HELM_RELEASE}-dcae-datafile-collector 3 min --set useCmpv2Certificates=true --set global.cmpv2Enabled=true --set masterPasswordOverride=test --debug Deploying 3GPP PM Mapper - Install helm charts chart-museum dcae-pm-mapper ${ONAP_HELM_RELEASE}-pmmapper 3 min + Install helm charts chart-museum dcae-pm-mapper ${ONAP_HELM_RELEASE}-dcae-pm-mapper 3 min --debug Deploying SFTP Server As xNF - ${override} = Set Variable --set fullnameOverride=${ONAP_HELM_RELEASE}-sftp + ${override} = Set Variable --set fullnameOverride=${ONAP_HELM_RELEASE}-sftp --debug Install helm charts from folder ${SFTP_HELM_CHARTS} ${ONAP_HELM_RELEASE}-sftp set_values_override=${override} +Deploying HTTPS server with correct certificates + ${name} = Set Variable ${ONAP_HELM_RELEASE}-pm-https-server-correct-sans + ${override} = Set Variable --set fullnameOverride=${name} --set nameOverride=${name} --set certificates.name=${name} --set certificates.commonName=${name} --set certificates.dnsNames={${name}} --debug + Install helm charts from folder ${HTTPS_SERVER_HELM_CHARTS} ${name} set_values_override=${override} + +Deploying HTTPS server with wrong certificates - wrong SAN-s + ${name} = Set Variable ${ONAP_HELM_RELEASE}-pm-https-server-wrong-sans + ${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} + Checking PERFORMANCE_MEASUREMENTS Topic In Message Router ${headers}= Create Dictionary content-type=application/json ${subdata}= OperatingSystem.Get File ${PMMAPPER_SUB_ROLE_DATA} @@ -228,10 +239,70 @@ Checking DFC Logs After KNOWN_HOSTS_FILE_PATH Env Variable Added ${dfc_logs}= Run Given Command On DFC Container ${CHECK_DFC_LOGS} Should Not Contain ${dfc_logs} ${EXPECTED_PRINT} +Get all logs from PM Mapper + ${pmmapper_logs}= Check logs ${CHECK_ALL_PMMAPPER_LOGS} + Log ${pmmapper_logs} + +Get all logs from Data File Collector + ${pmmapper_logs}= Check logs ${CHECK_ALL_DFC_LOGS} + Log ${pmmapper_logs} + Checking DFC Logs After SFTP Server RSA Key Changed Wait Until Keyword Succeeds 5 min 30 sec Check Given Print In DFC LOG ${CHECK_DFC_LOGS} -Check DFC logs - [Arguments] ${DFC_LOG_CHECK} - ${rc} = Run and Return RC ${DFC_LOG_CHECK} - Should Be Equal As Integers ${rc} 0 +Check logs + [Arguments] ${LOG_CHECK} + ${rc} = Run And Return Rc And Output ${LOG_CHECK} + Should Be Equal As Integers ${rc[0]} 0 + [Return] ${rc[1]} + +Change DFC httpsHostnameVerify configuration in Consul + [Documentation] Changes DFC httpsHostnameVerify config. + [Arguments] ${httpsHostnameVerify} + ${httpsHostnameVerify_conf} Create Dictionary httpsHostnameVerify=${httpsHostnameVerify} + Templating.Create Environment pm ${GLOBAL_TEMPLATE_FOLDER} + ${event}= Templating.Apply Template pm ${consul_change_event} ${httpsHostnameVerify_conf} + ${rc} ${container_name} = Run and Return RC and Output kubectl get pods -n onap | grep datafile-collector | awk '{print $1}' | grep -v NAME | awk -F'-' '{print $2}' + Should Be Equal As Integers ${rc} 0 + ${resp}= Run Consul Put Request /v1/kv/${container_name}-datafile-collector?raw=1 ${event} + Should Be Equal As Strings ${resp.status_code} 200 + ${rc} = Run and Return RC kubectl delete pods -n onap $(kubectl get pods -n onap | grep datafile-collector | awk '{print $1}' | grep -v NAME) + Should Be Equal As Integers ${rc} 0 + Wait Until Keyword Succeeds 120 sec 5 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} \ No newline at end of file diff --git a/robot/testsuites/usecases/5gbulkpm_helm.robot b/robot/testsuites/usecases/5gbulkpm_helm.robot index 67039d87..6d805e37 100644 --- a/robot/testsuites/usecases/5gbulkpm_helm.robot +++ b/robot/testsuites/usecases/5gbulkpm_helm.robot @@ -17,18 +17,19 @@ Suite Setup Send File Ready Event to VES Collector and Deploy all DCAE App Suite Teardown Usecase Teardown *** Variables *** -${DFC_ERROR_GREP_COMMAND_SANS} kubectl logs $(kubectl get pods -n onap | grep datafile-collector | awk '{print $1}' | grep -v NAME) --all-containers -n onap --since=15s | grep "Certificate for .* subject alternative names: .*wrong-cert" +${DFC_ERROR_GREP_COMMAND_SANS} kubectl logs $(kubectl get pods -n onap | grep datafile-collector | awk '{print $1}' | grep -v NAME) --all-containers -n onap --since=15s | grep "Certificate for .* subject alternative names: .*wrong-sans-2" *** Test Cases *** SFTP Server based bulk PM test, no SFTP Server know host veryfication on DFC side - [Tags] 5gbulkpm 5gbulkpm_sftp 5gbulkpm_cust_pm_validate + [Tags] 5gbulkpm 5gbulkpm_sftp [Documentation] ... This test case triggers successful bulk pm upload from SFTP server without SFTP server host verification in DFC known host file. ... Known host verification is turned off on DFC Uploading PM Files to xNF SFTP Server Sending File Ready Event to VES Collector Verifying 3GPP Perf VES Content On PERFORMANCE_MEASUREMENTS Topic + Get all logs from Data File Collector SFTP Server based bulk PM test, successful SFTP Server known host verification on DFC side [Tags] 5gbulkpm 5gbulkpm_sftp @@ -40,6 +41,7 @@ SFTP Server based bulk PM test, successful SFTP Server known host verification o Sending File Ready Event to VES Collector Verifying 3GPP Perf VES Content On PERFORMANCE_MEASUREMENTS Topic Checking DFC Logs After KNOWN_HOSTS_FILE_PATH Env Variable Added + Get all logs from Data File Collector SFTP Server based bulk PM test, not successful SFTP Server know host verification on DFC side [Tags] 5gbulkpm 5gbulkpm_sftp @@ -50,4 +52,42 @@ SFTP Server based bulk PM test, not successful SFTP Server know host verificatio Uploading PM Files to xNF SFTP Server Sending File Ready Event to VES Collector Checking DFC Logs After KNOWN_HOSTS_FILE_PATH Env Variable Added + Get all logs from Data File Collector + +HTTPS Server based bulk PM test (correct server certificate - correct SANs), successful HTTPS server certificate verification on DFC side + [Tags] 5gbulkpm 5gbulkpm_https + [Documentation] + ... This test case triggers successful bulk pm upload from HTTPS server using CMPv2 Certificate-based authentication + ... Both HTTPS server and DFC have correct certs with correct SAN-s. + ... DFC has turned on hostname verification option, verifies HTTPS server host name and downloads pm file from HTTPS server. + Change DFC httpsHostnameVerify configuration in Consul true + Uploading PM Files to xNF HTTPS Server ${ONAP_HELM_RELEASE}-pm-https-server-correct-sans + Sending File Ready Event to VES Collector for HTTPS Server ${ONAP_HELM_RELEASE}-pm-https-server-correct-sans + Verifying 3GPP Perf VES Content On PERFORMANCE_MEASUREMENTS Topic + Get all logs from Data File Collector + +HTTPS Server based bulk PM test (wrong server certificate - wrong SANs), unsuccessful validation on DFC side due to turned on host checking + [Tags] 5gbulkpm 5gbulkpm_https + [Documentation] + ... This test case triggers unsuccessful bulk pm upload from HTTPS server using CMPv2 Certificate-based authentication + ... HTTPS server has incorrect cert with wrong correct SAN-s. DFC has turned on hostname verification option. + ... DFC verifies HTTPS server host name against SAN-s and closes connection. + Change DFC httpsHostnameVerify configuration in Consul true + Uploading PM Files to xNF HTTPS Server ${ONAP_HELM_RELEASE}-pm-https-server-wrong-sans + Sending File Ready Event to VES Collector for HTTPS Server ${ONAP_HELM_RELEASE}-pm-https-server-wrong-sans + Wait Until Keyword Succeeds 120 sec 5 sec Check logs ${DFC_ERROR_GREP_COMMAND_SANS} + Get all logs from Data File Collector + +HTTPS Server based bulk PM test (wrong server certificate - wrong SANs), successful validation on DFC side due to turned off host checking + [Tags] 5gbulkpm 5gbulkpm_https + [Documentation] + ... This test case triggers successful bulk pm upload from HTTPS server using CMPv2 Certificate-based authentication + ... HTTPS server has incorrect cert with wrong correct SAN-s. DFC has turned off hostname verification option. + ... DFC does not verify HTTPS server host name against SAN-s and downloads pm file from HTTPS server. + Change DFC httpsHostnameVerify configuration in Consul false + Uploading PM Files to xNF HTTPS Server ${ONAP_HELM_RELEASE}-pm-https-server-wrong-sans + Sending File Ready Event to VES Collector for HTTPS Server ${ONAP_HELM_RELEASE}-pm-https-server-wrong-sans + Verifying 3GPP Perf VES Content On PERFORMANCE_MEASUREMENTS Topic + Get all logs from Data File Collector + -- cgit 1.2.3-korg