From: Krzysztof Kuzmicki Date: Mon, 10 Aug 2020 17:52:38 +0000 (+0000) Subject: Merge "Add VES properties for stndDefined validation" X-Git-Tag: 7.0.1~60 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=73fc834188cb53f79c4bc1cb5ab397e1e774a297;hp=2cb7186ef6cdcfed3e7783794c9562121d1bd91f;p=integration%2Fcsit.git Merge "Add VES properties for stndDefined validation" --- diff --git a/plans/modeling-etsicatalog/sanity-check/setup.sh b/plans/modeling-etsicatalog/sanity-check/setup.sh index 9157c41d..e713af21 100644 --- a/plans/modeling-etsicatalog/sanity-check/setup.sh +++ b/plans/modeling-etsicatalog/sanity-check/setup.sh @@ -33,9 +33,9 @@ docker run -d -p 80:80 -e CONSUL_IP=$CONSUL_IP -e SDCLIENT_IP=$DISCOVERY_IP -e " MSB_IP==`get-instance-ip.sh msb_internal_apigateway` echo MSB_IP=${MSB_IP} -docker run -d -p 3306:3306 --name vfc-db -v /var/lib/mysql nexus3.onap.org:10001/onap/vfc/db -VFC_DB_IP=`get-instance-ip.sh vfc-db` -echo VFC_DB_IP=${VFC_DB_IP} +docker run -d -p 3306:3306 --name vfc-db -v /var/lib/mysql -e MYSQL_ROOT_PASSWORD=root nexus3.onap.org:10001/library/mariadb +DB_IP=`get-instance-ip.sh vfc-db` +echo DB_IP=${DB_IP} # Wait for initialization(8500 Consul, 10081 Service Registration & Discovery, 80 api gateway) for i in {1..10}; do @@ -46,7 +46,7 @@ done # Wait for initialization(3306 DB) for i in {1..3}; do - curl -sS -m 1 ${VFC_DB_IP}:3306 && break + curl -sS -m 1 ${DB_IP}:3306 && break echo sleep $i sleep $i done @@ -56,7 +56,7 @@ echo sleep 60 sleep 60 # start modeling-etsicatalog -docker run -d --name modeling-etsicatalog -v /var/lib/mysql -e MSB_ADDR=${DISCOVERY_IP}:10081 -e MYSQL_ADDR=${VFC_DB_IP}:3306 nexus3.onap.org:10001/onap/modeling/etsicatalog +docker run -d --name modeling-etsicatalog -v /var/lib/mysql -e MSB_ADDR=${DISCOVERY_IP}:10081 -e MYSQL_ADDR=${DB_IP}:3306 nexus3.onap.org:10001/onap/modeling/etsicatalog EtsiCatalog_IP=`get-instance-ip.sh modeling-etsicatalog` for i in {1..10}; do curl -sS -m 1 ${EtsiCatalog_IP}:8806 && break diff --git a/plans/sdnc/sdnc_netconf_tls_post_deploy/setup.sh b/plans/sdnc/sdnc_netconf_tls_post_deploy/setup.sh index 2a0451d1..a2020aee 100644 --- a/plans/sdnc/sdnc_netconf_tls_post_deploy/setup.sh +++ b/plans/sdnc/sdnc_netconf_tls_post_deploy/setup.sh @@ -30,7 +30,6 @@ chmod +x "${WORKSPACE}"/tests/sdnc/sdnc_netconf_tls_post_deploy/libraries/config export TEMP_DIR_PATH=${TEMP_DIR_PATH} # Create temp directory to bind with docker containers -mkdir -m 755 -p "${WORKSPACE}"/tests/sdnc/sdnc_netconf_tls_post_deploy/tmp mkdir -m 755 -p "${WORKSPACE}"/tests/sdnc/sdnc_netconf_tls_post_deploy/certs mkdir -m 755 -p "${WORKSPACE}"/tests/sdnc/sdnc_netconf_tls_post_deploy/cert-data @@ -54,6 +53,9 @@ echo "Reinstall pyOpenSSL library." pip uninstall pyopenssl -y pip install pyopenssl==17.5.0 +# Install PYJKS for .jks files management +pip install pyjks + # Disable Proxy - for local run unset http_proxy https_proxy diff --git a/plans/sdnc/sdnc_netconf_tls_post_deploy/teardown.sh b/plans/sdnc/sdnc_netconf_tls_post_deploy/teardown.sh index 2f451d50..b780ed49 100644 --- a/plans/sdnc/sdnc_netconf_tls_post_deploy/teardown.sh +++ b/plans/sdnc/sdnc_netconf_tls_post_deploy/teardown.sh @@ -21,6 +21,5 @@ docker-compose -f "${SCRIPTS}"/sdnc/netconf-pnp-simulator/docker-compose.yml dow make clear -C "${WORKSPACE}"/plans/sdnc/sdnc_netconf_tls_post_deploy/certs -rm -rf "${WORKSPACE}"/tests/sdnc/sdnc_netconf_tls_post_deploy/tmp rm -rf "${WORKSPACE}"/tests/sdnc/sdnc_netconf_tls_post_deploy/certs rm -rf "${WORKSPACE}"/tests/sdnc/sdnc_netconf_tls_post_deploy/cert-data \ No newline at end of file diff --git a/scripts/sdnc/netconf-pnp-simulator/docker-compose.yml b/scripts/sdnc/netconf-pnp-simulator/docker-compose.yml index 67a75c94..d8e723ba 100755 --- a/scripts/sdnc/netconf-pnp-simulator/docker-compose.yml +++ b/scripts/sdnc/netconf-pnp-simulator/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: netconf-pnp-simulator: - image: nexus3.onap.org:10001/onap/integration/simulators/netconf-pnp-simulator:2.8.5 + image: nexus3.onap.org:10001/onap/integration/simulators/netconf-pnp-simulator:2.8.6 container_name: netconf-simulator restart: always ports: diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml b/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml new file mode 100644 index 00000000..8d42d62c --- /dev/null +++ b/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + diff --git a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot index 0b18320f..cd6f265e 100644 --- a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot +++ b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot @@ -7,8 +7,7 @@ Library Process Library String Test Setup Create Session mapper_session ${PMMAPPER_BASE_URL} -Test Teardown Delete All Sessions - +Test Teardown CleanSessionsAndLogs *** Variables *** ${CLI_EXEC_CLI_CONFIG} { head -n 10 | tail -5;} < /tmp/pmmapper.log @@ -23,12 +22,14 @@ ${VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pm ${NR_VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/valid_metadata.json ${DIFF_VENDOR_METADATA} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json ${NON_XML_FILE} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json -${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "tail -15 /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" +${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" +${CLI_EXEC_CLI_PM_LOG_CLEAR} docker exec pmmapper /bin/sh -c "echo -n "" > /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" ${PUBLISH_NODE_URL} https://${DR_NODE_IP}:8443/publish/1 ${TYPE-A_PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml ${TYPE-C_PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/C20190328.0000-0015.xml ${NR-TYPE-A_PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/A20181004.0000-1000-0015-1000_5G.xml ${NR-TYPE-C_PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/C20190329.0000-0015.xml +${NR-TYPE-PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml ${CLI_EXEC_VENDOR_FILTER} curl 'http://${CONSUL_IP}:8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/^Con' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @$WORKSPACE/tests/dcaegen2-pmmapper/pmmapper/assets/vendor_filter_config.json ${CLI_EXEC_PM_FILTER} curl 'http://${CONSUL_IP}:8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/^Con' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @$WORKSPACE/tests/dcaegen2-pmmapper/pmmapper/assets/pm_filter_config.json ${CLI_EXEC_PM_FILTER_regex} curl 'http://${CONSUL_IP}:8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/^Con' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @$WORKSPACE/tests/dcaegen2-pmmapper/pmmapper/assets/pm_filter_regex_config.json @@ -53,43 +54,43 @@ Verify 3GPP PM Mapper responds appropriately when no metadata is provided [Tags] PM_MAPPER_03 [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Missing Metadata." when no metadata is provided [Timeout] 1 minute - ${headers}= Create Dictionary X-ONAP-RequestID=1 Content-Type=application/xml + ${headers}= Create Dictionary X-ONAP-RequestID=3 Content-Type=application/xml ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers} VerifyResponse ${resp.status_code} 400 VerifyResponse ${resp.content} Missing Metadata. - CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=1 + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=3 Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided [Tags] PM_MAPPER_04 [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Malformed Metadata." when invalid metadata is provided [Timeout] 1 minute - ${headers}= Create Dictionary X-ONAP-RequestID=2 X-DMAAP-DR-META='not metadata' Content-Type=application/xml + ${headers}= Create Dictionary X-ONAP-RequestID=4 X-DMAAP-DR-META='not metadata' Content-Type=application/xml ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers} VerifyResponse ${resp.status_code} 400 VerifyResponse ${resp.content} Malformed Metadata. - CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=2 + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=4 Verify that PM Mapper logs successful when a file that contains no measdata is provided [Tags] PM_MAPPER_05 [Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided [Timeout] 1 minute - SendToDatarouter ${NO_MEASDATA_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=3 + SendToDatarouter ${NO_MEASDATA_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=5 CheckLog ${CLI_EXEC_CLI_PM_LOG} MeasData is empty - CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=3 + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=5 Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided [Tags] PM_MAPPER_06 [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided [Timeout] 1 minute - SendToDatarouter ${NO_MANAGED_ELEMENT_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=4 + SendToDatarouter ${NO_MANAGED_ELEMENT_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=6 CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed - CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=4 + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=6 Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router [Tags] PM_MAPPER_07 [Documentation] Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router. [Timeout] 1 minute - SendToDatarouter ${TYPE-C_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=5 + SendToDatarouter ${TYPE-C_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=7 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter Verify 3GPP PM Mapper maps Type-A file based on counter filtering and publish 3gpp perf VES evnets to message router @@ -99,7 +100,7 @@ Verify 3GPP PM Mapper maps Type-A file based on counter filtering and publish 3g ${cli_cmd_output}= Run Process ${CLI_EXEC_PM_FILTER} shell=yes ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT} Sleep 5s - SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=6 + SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=8 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. @@ -110,17 +111,17 @@ Verify that PM Mapper correctly identifies a file that should not be mapped base Should Be Equal As Strings ${cli_cmd_output.rc} 0 ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT} Sleep 5s - SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${DIFF_VENDOR_METADATA} X-ONAP-RequestID=7 + SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${DIFF_VENDOR_METADATA} X-ONAP-RequestID=9 + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=9 CheckLog ${CLI_EXEC_CLI_PM_LOG} Metadata does not match any filters - CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=7 Verify that PM Mapper correctly identifies a non-xml file. [Tags] PM_MAPPER_10 [Documentation] Verify that PM Mapper correctly identifies a non-xml file. [Timeout] 1 minute - SendToDatarouter ${NON_XML_FILE} ${VALID_METADATA_PATH} X-ONAP-RequestID=8 + SendToDatarouter ${NON_XML_FILE} ${VALID_METADATA_PATH} X-ONAP-RequestID=10 CheckLog ${CLI_EXEC_CLI_PM_LOG} PM measurement file must have an extension of .xml - CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=8 + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=10 Verify that PM Mapper correctly maps an NR Type-A file based on counter filtering and publish 3gpp perf VES events to message router. [Tags] PM_MAPPER_11 @@ -129,15 +130,15 @@ Verify that PM Mapper correctly maps an NR Type-A file based on counter filterin ${cli_cmd_output}= Run Process ${CLI_EXEC_PM_FILTER} shell=yes ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT} Sleep 5s - SendToDatarouter ${NR-TYPE-A_PM_DATA_FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=11 + SendToDatarouter ${NR-TYPE-A_PM_DATA_FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=11 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter Verify that PM Mapper correctly maps an NR Type-C file based on counter filtering and publish 3gpp perf VES events to message router. [Tags] PM_MAPPER_12 [Documentation] Verify that PM Mapper maps an NR Type-C xml file and publish 3gpp perf VES evnets to message router. [Timeout] 1 minute - SendToDatarouter ${NR-TYPE-C_PM_DATA_FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=12 - CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter + SendToDatarouter ${NR-TYPE-C_PM_DATA_FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=12 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter Verify 3GPP PM Mapper maps Type-A file based on counter filtering with regexp [Tags] PM_MAPPER_13 @@ -146,7 +147,7 @@ Verify 3GPP PM Mapper maps Type-A file based on counter filtering with regexp ${cli_cmd_output}= Run Process ${CLI_EXEC_PM_FILTER_regex} shell=yes ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT} Sleep 5s - SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=6 + SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=13 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter Verify that password receive from CBS are successfully encrypted @@ -155,6 +156,14 @@ Verify that password receive from CBS are successfully encrypted CheckLog ${CLI_EXEC_CLI_CONFIG} "aaf_password": ***** CheckLog ${CLI_EXEC_CLI_CONFIG} "password": ***** +Verify that PM Mapper correctly maps an NR Type-PM file based on counter filtering and publish 3gpp perf VES events to message router. + [Tags] PM_MAPPER_15 + [Documentation] Verify that PM Mapper maps an NR Type-PM xml file and publish 3gpp perf VES evnets to message router. + [Timeout] 1 minute + SendToDatarouter ${NR-TYPE-PM_DATA_FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=15 + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=15 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter + *** Keywords *** SendToDatarouter @@ -182,3 +191,10 @@ CheckLog VerifyResponse [Arguments] ${actual_response_value} ${expected_response_value} Should Be Equal As Strings ${actual_response_value} ${expected_response_value} + +ClearLogs + Run Process ${CLI_EXEC_CLI_PM_LOG_CLEAR} shell=yes + +CleanSessionsAndLogs + Delete All Sessions + ClearLogs diff --git a/tests/policy/api/api-test.robot b/tests/policy/api/api-test.robot index 76c1bdc6..d3df9cc9 100644 --- a/tests/policy/api/api-test.robot +++ b/tests/policy/api/api-test.robot @@ -128,16 +128,43 @@ RetrievePoliciesOfType Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} onap.restart.tca Dictionary Should Contain Key ${expjsonobject['topology_template']['policies'][0]} onap.restart.tca -DeleteSpecificPolicyV1 - [Documentation] Delete the Monitoring Policy Version 1 of the TCA Policy Type +RetrieveAllPolicies + [Documentation] Retrieve all Policies + ${auth}= Create List healthcheck zb!XztG34 + ${expjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.v1.json + Log Creating session https://${POLICY_API_IP}:6969 + ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Get Request policy /policy/api/v1/policies headers=${headers} + Log Received response from policy ${resp.text} + ${expjsonobject} To Json ${expjson} + Should Be Equal As Strings ${resp.status_code} 200 + Should Contain ${expjsonobject['topology_template']['policies'][0]} onap.restart.tca + +RetrieveSpecificPolicy + [Documentation] Retrieve a specific Policy named 'onap.restart.tca' and version '1.0.0' + ${auth}= Create List healthcheck zb!XztG34 + ${expjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.v1.json + Log Creating session https://${POLICY_API_IP}:6969 + ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Get Request policy /policy/api/v1/policies/onap.restart.tca/versions/1.0.0/ headers=${headers} + Log Received response from policy ${resp.text} + ${expjsonobject} To Json ${expjson} + Should Be Equal As Strings ${resp.status_code} 200 + Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} onap.restart.tca + Dictionary Should Contain Key ${expjsonobject['topology_template']['policies'][0]} onap.restart.tca + +DeleteSpecificPolicy + [Documentation] Delete a specific Policy named 'onap.restart.tca' and version '1.0.0' ${auth}= Create List healthcheck zb!XztG34 Log Creating session https://${POLICY_API_IP}:6969 ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= Delete Request policy /policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca/versions/1.0.0 headers=${headers} + ${resp}= Delete Request policy /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 headers=${headers} Log Received response from policy ${resp.text} Should Be Equal As Strings ${resp.status_code} 200 - ${resp}= Delete Request policy /policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca/versions/1.0.0 headers=${headers} + ${resp}= Delete Request policy /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 headers=${headers} Should Be Equal As Strings ${resp.status_code} 404 DeleteSpecificPolicyV2 diff --git a/tests/sdnc/sdnc_netconf_tls_post_deploy/csr/netconf_pnp_simulator_csr.env b/tests/sdnc/sdnc_netconf_tls_post_deploy/csr/netconf_pnp_simulator_csr.env index 557860de..e85ab6cc 100644 --- a/tests/sdnc/sdnc_netconf_tls_post_deploy/csr/netconf_pnp_simulator_csr.env +++ b/tests/sdnc/sdnc_netconf_tls_post_deploy/csr/netconf_pnp_simulator_csr.env @@ -2,6 +2,7 @@ REQUEST_TIMEOUT=30000 OUTPUT_PATH=/var/certs CA_NAME=RA +OUTPUT_TYPE=P12 KEYSTORE_PATH=/etc/onap/aaf/certservice/certs/certServiceClient-keystore.jks KEYSTORE_PASSWORD=secret TRUSTSTORE_PATH=/etc/onap/aaf/certservice/certs/truststore.jks diff --git a/tests/sdnc/sdnc_netconf_tls_post_deploy/csr/sdnc_csr.env b/tests/sdnc/sdnc_netconf_tls_post_deploy/csr/sdnc_csr.env index 28411797..57894753 100644 --- a/tests/sdnc/sdnc_netconf_tls_post_deploy/csr/sdnc_csr.env +++ b/tests/sdnc/sdnc_netconf_tls_post_deploy/csr/sdnc_csr.env @@ -2,6 +2,7 @@ REQUEST_TIMEOUT=30000 OUTPUT_PATH=/var/certs CA_NAME=RA +OUTPUT_TYPE=JKS KEYSTORE_PATH=/etc/onap/aaf/certservice/certs/certServiceClient-keystore.jks KEYSTORE_PASSWORD=secret TRUSTSTORE_PATH=/etc/onap/aaf/certservice/certs/truststore.jks diff --git a/tests/sdnc/sdnc_netconf_tls_post_deploy/libraries/ClientManager.py b/tests/sdnc/sdnc_netconf_tls_post_deploy/libraries/ClientManager.py index ceff9742..b2399dfb 100644 --- a/tests/sdnc/sdnc_netconf_tls_post_deploy/libraries/ClientManager.py +++ b/tests/sdnc/sdnc_netconf_tls_post_deploy/libraries/ClientManager.py @@ -25,6 +25,7 @@ import shutil import subprocess import docker +import jks from OpenSSL import crypto from docker.types import Mount @@ -42,8 +43,10 @@ class ClientManager: self.serverKeyPem = mount_path + '/server_key.pem' self.serverCertPem = mount_path + '/server_cert.pem' self.keystoreJksPath = mount_path + '/keystore.jks' + self.keystoreP12Path = mount_path + '/keystore.p12' self.keystorePassPath = mount_path + '/keystore.pass' self.truststoreJksPath = mount_path + '/truststore.jks' + self.truststoreP12Path = mount_path + '/truststore.p12' self.truststorePassPath = mount_path + '/truststore.pass' # Function Create docker container. @@ -65,10 +68,27 @@ class ClientManager: exitcode = container.wait() return exitcode + # Function to validate keystore/truststore can be opened with generated pass-phrase. + def can_open_keystore_and_truststore_with_pass(self, container_name): + if container_name != NETCONF_PNP_SIM_CONTAINER_NAME: + return self.can_open_keystore_and_truststore_jks_files() + else: + return self.can_open_keystore_and_truststore_p12_files() + # Function to validate keystore.jks/truststore.jks can be opened with generated pass-phrase. - def can_open_keystore_and_truststore_with_pass(self): - can_open_keystore = self.can_open_jks_file_with_pass_file(self.keystorePassPath, self.keystoreJksPath) - can_open_truststore = self.can_open_jks_file_with_pass_file(self.truststorePassPath, self.truststoreJksPath) + def can_open_keystore_and_truststore_jks_files(self): + try: + jks.KeyStore.load(self.keystoreJksPath, open(self.keystorePassPath, 'rb').read()) + jks.KeyStore.load(self.truststoreJksPath, open(self.truststorePassPath, 'rb').read()) + return True + except Exception as e: + print("UnExpected Error in validating keystore.jks/truststore.jks: {0}".format(e)) + return False + + # Function to validate keystore.p12/truststore.p12 can be opened with generated pass-phrase. + def can_open_keystore_and_truststore_p12_files(self): + can_open_keystore = self.can_open_p12_file_with_pass_file(self.keystorePassPath, self.keystoreP12Path) + can_open_truststore = self.can_open_p12_file_with_pass_file(self.truststorePassPath, self.truststoreP12Path) return can_open_keystore & can_open_truststore # Method for Uploading Certificate in SDNC-Container. @@ -76,9 +96,9 @@ class ClientManager: def can_install_keystore_and_truststore_certs(self, cmd, container_name): continue_exec = True if container_name == NETCONF_PNP_SIM_CONTAINER_NAME: - print("Generating PEM files for {0} from JKS files".format(container_name)) - continue_exec = self.create_pem(self.keystorePassPath, self.keystoreJksPath, self.truststorePassPath, - self.truststoreJksPath) + print("Generating PEM files for {0} from P12 files".format(container_name)) + continue_exec = self.create_pem(self.keystorePassPath, self.keystoreP12Path, self.truststorePassPath, + self.truststoreP12Path) if continue_exec: print("Initiate Configuration Push for : {0}".format(container_name)) resp_code = self.execute_bash_config(cmd, container_name) @@ -89,19 +109,22 @@ class ClientManager: print("Execution Failed for: {0}".format(container_name)) return False - def create_pem(self, keystore_pass_file_path, keystore_jks_file_path, truststore_pass_file_path, - truststore_jks_file_path): + def create_pem(self, keystore_pass_path, keystore_p12_path, truststore_pass_path, truststore_p12_path): # Create [server_key.pem, server_cert.pem, ca.pem] files for Netconf-Pnp-Simulation/TLS Configuration. try: - keystore_p12 = self.get_pkcs12(keystore_pass_file_path, keystore_jks_file_path) - truststore_p12 = self.get_pkcs12(truststore_pass_file_path, truststore_jks_file_path) with open(self.serverKeyPem, "wb+") as key_file: - key_file.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, keystore_p12.get_privatekey())) + key_file.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, + self.get_pkcs12(keystore_pass_path, + keystore_p12_path).get_privatekey())) with open(self.serverCertPem, "wb+") as server_cert_file: - server_cert_file.write(crypto.dump_certificate(crypto.FILETYPE_PEM, keystore_p12.get_certificate())) + server_cert_file.write(crypto.dump_certificate(crypto.FILETYPE_PEM, + self.get_pkcs12(keystore_pass_path, + keystore_p12_path).get_certificate())) with open(self.caCertPem, "wb+") as ca_cert_file: ca_cert_file.write( - crypto.dump_certificate(crypto.FILETYPE_PEM, truststore_p12.get_ca_certificates()[0])) + crypto.dump_certificate(crypto.FILETYPE_PEM, + self.get_pkcs12(truststore_pass_path, + truststore_p12_path).get_ca_certificates()[0])) return True except IOError as err: print("I/O Error: {0}".format(err)) @@ -110,12 +133,12 @@ class ClientManager: print("UnExpected Error: {0}".format(e)) return False - def can_open_jks_file_with_pass_file(self, pass_file_path, jks_file_path): + def can_open_p12_file_with_pass_file(self, pass_file_path, p12_file_path): try: - if jks_file_path.split('/')[-1] == 'truststore.jks': - pkcs12 = self.get_pkcs12(pass_file_path, jks_file_path).get_ca_certificates()[0] + if p12_file_path.split('/')[-1] == 'truststore.p12': + pkcs12 = self.get_pkcs12(pass_file_path, p12_file_path).get_ca_certificates()[0] else: - pkcs12 = self.get_pkcs12(pass_file_path, jks_file_path).get_certificate() + pkcs12 = self.get_pkcs12(pass_file_path, p12_file_path).get_certificate() if pkcs12 is None: return False return True @@ -143,11 +166,10 @@ class ClientManager: shutil.rmtree(self.mount_path) @staticmethod - def get_pkcs12(pass_file_path, jks_file_path): + def get_pkcs12(pass_file_path, p12_file_path): # Load PKCS12 Object password = open(pass_file_path, 'rb').read() - p12 = crypto.load_pkcs12(open(jks_file_path, 'rb').read(), password) - return p12 + return crypto.load_pkcs12(open(p12_file_path, 'rb').read(), password) @staticmethod def execute_bash_config(cmd, container_name): diff --git a/tests/sdnc/sdnc_netconf_tls_post_deploy/resources/sdnc-keywords.robot b/tests/sdnc/sdnc_netconf_tls_post_deploy/resources/sdnc-keywords.robot index 8e36e65f..a7fbcccc 100644 --- a/tests/sdnc/sdnc_netconf_tls_post_deploy/resources/sdnc-keywords.robot +++ b/tests/sdnc/sdnc_netconf_tls_post_deploy/resources/sdnc-keywords.robot @@ -76,7 +76,7 @@ Run Cert Service Client And Validate JKS File Creation And Client Exit Code [Documentation] Run Cert Service Client Container And Validate Exit Code For SDNC [Arguments] ${env_file} ${CONTAINER_NAME} ${expected_exit_code} ${exit_code}= Run Client Container ${DOCKER_CLIENT_IMAGE} ${CLIENT_CONTAINER_NAME} ${env_file} ${CERT_SERVICE_ADDRESS}${CERT_SERVICE_ENDPOINT} ${CERT_SERVICE_NETWORK} - ${can_open}= Can Open Keystore And Truststore With Pass + ${can_open}= Can Open Keystore And Truststore With Pass ${CONTAINER_NAME} ${install_certs}= Can Install Keystore And Truststore Certs ${CONF_SCRIPT} ${CONTAINER_NAME} Remove Client Container And Save Logs ${CLIENT_CONTAINER_NAME} positive_path Should Be Equal As Strings ${exit_code} ${expected_exit_code} Client return: ${exitcode} exit code, but expected: ${expected_exit_code}