Refactor ves client and mongo db host name usage in CMPv2 test 29/121929/1
authorKrzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>
Tue, 15 Jun 2021 13:46:54 +0000 (15:46 +0200)
committerKrzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>
Tue, 15 Jun 2021 13:46:54 +0000 (15:46 +0200)
Refactor ves client and mongo db host name usage in CMPv2 test

Issue-ID: TEST-345
Signed-off-by: Krzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>
Change-Id: I049e7b1111f9d142fff1348e2e2f901a0f2e926e

robot/resources/test_templates/cmpv2.robot
robot/testsuites/cmpv2.robot

index bc99ec2..e1fd30f 100644 (file)
@@ -21,7 +21,7 @@ ${users}  ${EXECDIR}/robot/assets/cmpv2/mongo-users.json
 
 
 *** Keywords ***
-Pnf simulator send single VES event
+VES Client send single VES event
     [Arguments]  ${event}   ${ves_host}   ${ves_port}  ${pnf_sim_host}  ${pnf_sim_port}  ${http_reposnse_code}=202
     ${pnf_sim_endpoint}=            Set Variable                http://${pnf_sim_host}:${pnf_sim_port}
     ${ves_url}=                     Set Variable                ${GLOBAL_DCAE_VES_HTTPS_PROTOCOL}://${ves_host}:${ves_port}/${VES_data_path}
@@ -35,11 +35,12 @@ Pnf simulator send single VES event
     Log                             PNF registration request ${data}
     Should Be Equal As Strings      ${post_resp.status_code}    ${http_reposnse_code}
     Log                             VES has accepted event with status code ${post_resp.status_code}
+    [Return]                        ${post_resp}
 
 
 Usecase Teardown
-    Undeploy Service                    mongo-dep
-    Undeploy Service                    pnf-simulator-dep
+    Undeploy Service                    ${mongo-dep}
+    Undeploy Service                    ${ves-client-dep}
     Undeploy Service                    ves-collector-cmpv2-dep
     Undeploy Service                    ves-collector-cmpv2-wrong-sans-dep
     Delete Blueprint From Inventory     ${serviceTypeIdMongo}
index b2f19bd..3a4ae50 100644 (file)
@@ -18,34 +18,37 @@ Suite Setup       Send VES integration request  ${initial entry}
 Suite Teardown    Usecase Teardown
 
 *** Variables ***
-${MONGO_BLUEPRINT_PATH}                  ${EXECDIR}/robot/assets/cmpv2/k8s-mongo.yaml
-${PNF_SIMULATOR_BLUEPRINT_PATH}          ${EXECDIR}/robot/assets/cmpv2/k8s-pnf-simulator.yaml
+${MONGO_BLUEPRINT_PATH}                  ${EXECDIR}/robot/assets/cmpv2/k8s-mongo-ves-client.yaml
+${PNF_SIMULATOR_BLUEPRINT_PATH}          ${EXECDIR}/robot/assets/cmpv2/k8s-ves-client.yaml
 ${VES_INPUTS}                            deployment/VesTlsCmpv2Inputs.jinja
 ${pnf_ves_integration_request}           ves/pnf_registration_request.jinja
 ${NEXUS3}                                ${GLOBAL_INJECTED_NEXUS_DOCKER_REPO}
 &{initial entry}                              correlation_id=dummy    PNF_IPv4_address=11.11.11.1    PNF_IPv6_address=2001:0db8:0:0:0:0:1428:57ab
-${PNF_SIMULATOR_ERROR_GREP_COMMAND_CERT}      kubectl logs $(kubectl get pods -n onap | grep pnf-simulator | awk '{print $1}' | grep -v NAME) -n onap --tail=2 --since=20s | grep 'Error sending message to ves: Received fatal alert: certificate_unknown'
-${PNF_SIMULATOR_ERROR_GREP_COMMAND_SANS}      kubectl logs $(kubectl get pods -n onap | grep pnf-simulator | awk '{print $1}' | grep -v NAME) -n onap --tail=2 --since=20s | egrep  "Error(.)*dcae-ves-collector-cmpv2-cert-wrong-sans(.)*wrong-sans(.)*"
 
 
 *** Test Cases ***
 
-Deploying PNF Simulator
+Deploying VES Client
     [Documentation]
-     ...  This test case deploys PNF simulator with "enable_tls": set to false and "external_cert_use_external_tls" (CMPv2) set to true as DCAE applictaion
+     ...  This test case deploys VES Client with "enable_tls": set to false and "external_cert_use_external_tls" (CMPv2) set to true as DCAE applictaion
     [Tags]                              CMPv2
-    ${serviceTypeIdMongo}               Load Blueprint To Inventory        ${MONGO_BLUEPRINT_PATH}              mongo
-    ${serviceTypeIdPnfSimulator}        Load Blueprint To Inventory        ${PNF_SIMULATOR_BLUEPRINT_PATH}      pnf-simulator
+    ${rand}                             Generate Random String             5                                   [NUMBERS][LOWER]
+    Set Suite Variable                  ${ves_client_hostname}             ves-client-${rand}
+    ${serviceTypeIdMongo}               Load Blueprint To Inventory        ${MONGO_BLUEPRINT_PATH}              mongo-${rand}
+    ${serviceTypeIdPnfSimulator}        Load Blueprint To Inventory        ${PNF_SIMULATOR_BLUEPRINT_PATH}      ves-client-${rand}
     Set Suite Variable                  ${serviceTypeIdMongo}
     Set Suite Variable                  ${serviceTypeIdPnfSimulator}
-    ${deployment_data}=                 Set Variable                       {"serviceTypeId": "${serviceTypeIdMongo}"}
-    Deploy Service                      ${deployment_data}                 mongo-dep                            2 minutes
-    ${resp}=                            Get Blueprint From Inventory       pnf-simulator
+    ${deployment_data}=                 Set Variable                       {"serviceTypeId":"${serviceTypeIdMongo}", "inputs":{"service_component_name_override":"mongo-${ves_client_hostname}","service_component_type":"mongo-${ves_client_hostname}"}}
+    Set Suite Variable                  ${mongo-dep}                       mongo-dep-${rand}
+    Deploy Service                      ${deployment_data}                 ${mongo-dep}                            2 minutes
+    ${resp}=                            Get Blueprint From Inventory       ves-client-${rand}
     ${json}=                            Set Variable                       ${resp.json()}
     ${image}                            Get Regexp Matches                 ${json['items'][0]['blueprintTemplate']}               nexus3(.)*?(?=\')
     ${image}                            Replace String                     ${image}[0]      nexus3.onap.org:10001                 ${NEXUS3}
-    ${deployment_data}=                 Set Variable                       {"serviceTypeId": "${serviceTypeIdPnfSimulator}", "inputs": {"tag_version": "${image}"}}
-    Deploy Service                      ${deployment_data}                 pnf-simulator-dep                    4 minutes
+    ${deployment_data}=                 Set Variable                       {"serviceTypeId":"${serviceTypeIdPnfSimulator}", "inputs":{"tag_version": "${image}", "service_component_name_override":"${ves_client_hostname}"}}
+    Set Suite Variable                  ${ves-client-dep}                  ves-client-dep-${rand}
+    Deploy Service                      ${deployment_data}                 ${ves-client-dep}                    4 minutes
+
 
 Deploying VES collector with CMPv2
     [Documentation]
@@ -87,7 +90,7 @@ Deploying VES collector with CMPv2 and wrong SANs
 
 Send registration request to CMPv2 VES
     [Documentation]
-    ...  This test case triggers registration request from PNF Simulator(where is present only CMPv2 certificate) to VES collector
+    ...  This test case triggers registration request from VES Client (where is present only CMPv2 certificate) to VES collector
     ...  with enabled CMPv2 (both CMPv2 and AAF certificates are present).
     ...  Test expects successful registration
      [Tags]                                      CMPv2
@@ -97,33 +100,30 @@ Send registration request to CMPv2 VES
      Create PNF initial entry in A&AI           ${PNF_entry_dict}
      Templating.Create Environment              ves                                 ${GLOBAL_TEMPLATE_FOLDER}
      ${template}=                               Templating.Apply Template           ves                                     ${pnf_ves_integration_request}   ${PNF_entry_dict}
-     Pnf simulator send single VES event        ${template}                         dcae-ves-collector-cmpv2-cert           8443                             pnf-simulator              5000
+     Pnf simulator send single VES event        ${template}                         dcae-ves-collector-cmpv2-cert           8443                             ${ves_client_hostname}              5000
      Verify PNF Integration Request in A&AI     ${PNF_entry_dict}
 
 Send registration request to CMPv2 VES with wrong SAN-s
     [Documentation]
-    ...  This test case triggers registration request from PNF Simulator (where is present only CMPv2 certificate)  to VES collector
+    ...  This test case triggers registration request from VES Client (where is present only CMPv2 certificate)  to VES collector
     ...  ith enabled CMPv2 (both CMPv2 and AAF certificates are present). CMPv2 certificate has wrong SANs.
-    ...  Test expects exception in PNF Simulator logs due to wrong subject alternatives
     [Tags]                                     CMPv2
     ${pnf_correlation_id}=                      Generate Random String              20                                      [LETTERS][NUMBERS]
     ${PNF_entry_dict}=                         Create Dictionary                   correlation_id=${pnf_correlation_id}    PNF_IPv4_address=14.14.14.14    PNF_IPv6_address=2001:0db8:0:0:0:0:1428:57ab
     Templating.Create Environment              ves                                 ${GLOBAL_TEMPLATE_FOLDER}
     ${template}=                               Templating.Apply Template           ves                                     ${pnf_ves_integration_request}   ${PNF_entry_dict}
-    Pnf simulator send single VES event        ${template}                         dcae-ves-collector-cmpv2-cert-wrong-sans      8443                             pnf-simulator              5000     421
-    ${rc} =                                    Run and Return RC                   ${PNF_SIMULATOR_ERROR_GREP_COMMAND_SANS}
-    Should Be Equal As Integers                ${rc}                               0
+    ${resp}=                                   Pnf simulator send single VES event        ${template}                         dcae-ves-collector-cmpv2-cert-wrong-sans      8443                             ${ves_client_hostname}              5000     421
+    Should Contain                             ${resp.json().get('message')}                               wrong-sans
 
 Send registration request to VES without CMPv2 certificate
     [Documentation]
-    ...  This test case triggers registration request from PNF Simulator (where is present only CMPv2 certificate)  to VES collector
+    ...  This test case triggers registration request from VES Client (where is present only CMPv2 certificate)  to VES collector
     ...  with disabled CMPv2 (only AAF certificate is present - VES collector deployed during whole ONAP deploy).
-    ...  Test expects exception in PNF Simulator logs due to wrong certificate
     [Tags]                                     CMPv2
     ${pnf_correlation_id}=                      Generate Random String              20                                      [LETTERS][NUMBERS]
     ${PNF_entry_dict}=                         Create Dictionary                   correlation_id=${pnf_correlation_id}    PNF_IPv4_address=14.14.14.14    PNF_IPv6_address=2001:0db8:0:0:0:0:1428:57ab
     Templating.Create Environment              ves                                 ${GLOBAL_TEMPLATE_FOLDER}
     ${template}=                               Templating.Apply Template           ves                                     ${pnf_ves_integration_request}   ${PNF_entry_dict}
-    Pnf simulator send single VES event        ${template}                         dcae-ves-collector           8443                             pnf-simulator              5000     421
-    ${rc} =                                    Run and Return RC                   ${PNF_SIMULATOR_ERROR_GREP_COMMAND_CERT}
-    Should Be Equal As Integers                ${rc}                               0
+    ${resp}=                                   Pnf simulator send single VES event        ${template}                         dcae-ves-collector           8443                             ${ves_client_hostname}              5000     421
+    Should Contain                              ${resp.json().get('message')}                               certificate_unknown
+