diff options
20 files changed, 619 insertions, 0 deletions
diff --git a/plans/aaf/certservice/setup.sh b/plans/aaf/certservice/setup.sh new file mode 100644 index 00000000..48bf00b9 --- /dev/null +++ b/plans/aaf/certservice/setup.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# Copyright 2017 ZTE Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +AAFCERT_IMAGE=nexus3.onap.org:10001/onap/org.onap.aaf.certservice.aaf-certservice-api:latest + +echo AAFCERT_IMAGE=${AAFCERT_IMAGE} + +# Start AAF Cert Srevice +docker run -p 8080:8080 -d --name aafcert ${AAFCERT_IMAGE} + +AAFCERT_IP=`get-instance-ip.sh aafcert` +export AAFCERT_IP=${AAFCERT_IP} + +# Wait container ready +sleep 5 + diff --git a/plans/aaf/certservice/teardown.sh b/plans/aaf/certservice/teardown.sh new file mode 100644 index 00000000..a613944d --- /dev/null +++ b/plans/aaf/certservice/teardown.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# Copyright 2017 ZTE, Inc. and others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +kill-instance.sh aafcert
\ No newline at end of file diff --git a/plans/aaf/certservice/testplan.txt b/plans/aaf/certservice/testplan.txt new file mode 100755 index 00000000..270fc6d4 --- /dev/null +++ b/plans/aaf/certservice/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +aaf/certservice diff --git a/plans/dcaegen2-services-pmsh/testsuite/assets/cert.pem b/plans/dcaegen2-services-pmsh/testsuite/assets/cert.pem new file mode 100644 index 00000000..1f789ba2 --- /dev/null +++ b/plans/dcaegen2-services-pmsh/testsuite/assets/cert.pem @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFbTCCA1WgAwIBAgIUWBWdddkqFoaTksLso+0fNNWSeKkwDQYJKoZIhvcNAQEL +BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM +GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAgFw0yMDAyMTcxNjM2NTdaGA8yMDUw +MDIwOTE2MzY1N1owRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx +ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDCCAiIwDQYJKoZIhvcN +AQEBBQADggIPADCCAgoCggIBAM8+IPmw6dYR1zgtpjiiXQS3Z1sYcnH0fx5N2mUw +nOENZu9OZxAcMzL+kPavcqTG3eF+0Ow9/vuzDqf15B+TuYFAbGw9iPUVl+k4SOeF +vgaeJCUEQSfrIcq1AR4/CApVMK2jwHJ2zSUHkXxaNtRCD+wj5n5E1ljJvh3YCJmW +MiS7DXxs/Mi0I85rRXcUOdmr14dqF0xlzWwAfoo43GSKnDIVRxzMtb6AqIZTMtk9 +0/0qkeju8eTMNEswtkOs4Q3vTqqkgeOaN4TXXO2x34waM2bCDDCBNzpYGSWs+pwo +i3qOZRP/kZZWI9SwU5RUygpA/i9PGD1Wfxx6HIGzfmVAaJR5YH4ow9hM5xGkiV// +BAb4C/3J3GTugfypsc+0/JRtlYoaNplHHqNRBcvqPq+G0Pfi9kYDrNw4iTGCxuHT +20CfrkxGdWQBPmtjcKNcVKP9e+u0YS47H29x5gDKxxwTmqNjyCz0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A== +-----END CERTIFICATE----- diff --git a/plans/dcaegen2-services-pmsh/testsuite/assets/initializerJson.json b/plans/dcaegen2-services-pmsh/testsuite/assets/initializerJson.json new file mode 100644 index 00000000..222aafd5 --- /dev/null +++ b/plans/dcaegen2-services-pmsh/testsuite/assets/initializerJson.json @@ -0,0 +1,185 @@ +[ + { + "httpRequest": { + "path": "/service_component_all/.*" + }, + "httpResponse": { + "statusCode": 200, + "headers": { + "content-type": [ + "application/json" + ] + }, + "body": { + "type": "JSON", + "json": { + "policy": { + "subscription": { + "subscriptionName": "ExtraPM-All-gNB-R2B", + "administrativeState": "UNLOCKED", + "fileBasedGP": 15, + "fileLocation": "/pm/pm.xml", + "nfTypeModelInvariantId": "2829292", + "nfFilter": { + "swVersions": [ + "1.0.0", + "1.0.1" + ], + "nfNames": [ + "^pnf.*", + "^vnf.*" + ] + }, + "measurementGroups": [ + { + "measurementGroup": { + "measurementTypes": [ + { + "measurementType": "countera" + }, + { + "measurementType": "counterb" + } + ], + "managedObjectDNsBasic": [ + { + "DN": "dna" + }, + { + "DN": "dnb" + } + ] + } + }, + { + "measurementGroup": { + "measurementTypes": [ + { + "measurementType": "counterc" + }, + { + "measurementType": "counterd" + } + ], + "managedObjectDNsBasic": [ + { + "DN": "dnc" + }, + { + "DN": "dnd" + } + ] + } + } + ] + } + }, + "config": { + "cert_path": "/opt/app/pmsh/etc/certs/cert.pem", + "streams_publishes": { + "policy_pm_publisher": { + "dmaap_info": { + "client_id": "1475976809466", + "client_role": "org.onap.dcae.pmPublisher", + "topic_url": "https://node:30226/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS", + "location": "san-francisco" + }, + "type": "message_router" + }, + "other_publisher": { + "dmaap_info": { + "location": "san-francisco", + "topic_url": "https://node:30226/events/org.onap.dmaap.mr.SOME_OTHER_TOPIC", + "client_role": "org.onap.dcae.pmControlPub", + "client_id": "1875976809466" + }, + "type": "message_router" + } + }, + "streams_subscribes": { + "aai_subscriber": { + "type": "message_router", + "dmaap_info": { + "client_id": "1575976809466", + "client_role": "org.onap.dcae.aaiSub", + "topic_url": "https://node:30226/events/AAI_EVENT", + "location": "san-francisco" + } + }, + "policy_pm_subscriber": { + "dmaap_info": { + "location": "san-francisco", + "topic_url": "https://node:30226/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS", + "client_role": "org.onap.dcae.pmSubscriber", + "client_id": "1575876809456" + }, + "type": "message_router" + } + }, + "key_path": "/opt/app/pmsh/etc/certs/key.pem", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "demo123456!" + } + } + } + } + }, + { + "httpRequest": { + "path": "/aai/v16/query.*" + }, + "httpResponse": { + "statusCode": 200, + "headers": { + "content-type": [ + "application/json" + ] + }, + "body": { + "type": "JSON", + "json": { + "results": [ + { + "id": "327736", + "node-type": "pnf", + "url": "/aai/v16/network/pnfs/pnf/pnf207", + "properties": { + "pnf-name": "pnf207", + "pnf-id": "55e57cd1-ab8b-40cd-97d5-cfc774fef616", + "equip-type": "val8", + "equip-vendor": "Nokia", + "equip-model": "val6", + "ipaddress-v4-oam": "10.10.10.26", + "sw-version": "val7", + "in-maint": false, + "serial-number": "6061ZW3", + "ipaddress-v6-oam": "2001:0db8:0:0:0:0:1428:57ab", + "resource-version": "1573066346347", + "nf-role": "gNB" + } + }, + { + "id": "241864", + "node-type": "generic-vnf", + "url": "/aai/v16/network/generic-vnfs/generic-vnf/1083ecbb-f3b3-49da-b5f5-b5962140ee99", + "properties": { + "vnf-id": "1083ecbb-f3b3-49da-b5f5-b5962140ee99", + "vnf-name": "vnf", + "vnf-type": "demoVCPEvBNG/vCPE_vbng 5eb5661a-0cb6 0", + "service-id": "2db01c96-4baa-4393-8d79-af8d7bf4698e", + "prov-status": "PREPROV", + "orchestration-status": "Inventoried", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1575541662410", + "model-invariant-id": "7129e420-d396-4efb-af02-6b83499b12f8", + "model-version-id": "e80a6ae3-cafd-4d24-850d-e14c084a5ca9", + "model-customization-id": "376dbe87-e9c5-4f2b-80e2-a420b373ee87" + } + } + ] + } + } + } + } +] diff --git a/plans/dcaegen2-services-pmsh/testsuite/assets/key.pem b/plans/dcaegen2-services-pmsh/testsuite/assets/key.pem new file mode 100644 index 00000000..eddafc1f --- /dev/null +++ b/plans/dcaegen2-services-pmsh/testsuite/assets/key.pem @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDPPiD5sOnWEdc4 +LaY4ol0Et2dbGHJx9H8eTdplMJzhDWbvTmcQHDMy/pD2r3Kkxt3hftDsPf77sw6n +9eQfk7mBQGxsPYj1FZfpOEjnhb4GniQlBEEn6yHKtQEePwgKVTCto8Byds0lB5F8 +WjbUQg/sI+Z+RNZYyb4d2AiZljIkuw18bPzItCPOa0V3FDnZq9eHahdMZc1sAH6K +ONxkipwyFUcczLW+gKiGUzLZPdP9KpHo7vHkzDRLMLZDrOEN706qpIHjmjeE11zt +sd+MGjNmwgwwgTc6WBklrPqcKIt6jmUT/5GWViPUsFOUVMoKQP4vTxg9Vn8cehyB +s35lQGiUeWB+KMPYTOcRpIlf/wQG+Av9ydxk7oH8qbHPtPyUbZWKGjaZRx6jUQXL +6j6vhtD34vZGA6zcOIkxgsbh09tAn65MRnVkAT5rY3CjXFSj/XvrtGEuOx9vceYA +ysccE5qjY8gs9F5r8hUCN4ntSyuzYVVdZZYdNrP+MDgcxLrUe4lXPciSuLZiducS +2BmVNTSYlAQIHiysJKN5BgcFRHnoek2nRJESt2OwcSZiL01bLvrBg1bYM2icmFtv +mXuqlXe/qmeo3iAa45zsy5v0f/IMHrj597CeTfqVOEegOTJuBSUMpABOH4HBy2Er +HeILJkoW4BfcOqxc2o0lv0JjxhOlSwIDAQABAoICAQCQm8eis2HXcAd/Ocs8xX6m +pdtG414oSfTRjn2QEkXFe/aRkWG1Chhnwt4gY/hZJjL4/+aEkhX0R9M4PAn8RrYw +jGWbeayxZ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5Qi +RRHSt9MfKBgN4OkPSBCkB+ySk/T9in4muUVSd+OwToCKKZv4rgpu+hDn7U3bbzTV +rX/cdAJnlkzAT4PsrnqoLr8jb2lGpXTm8xsW0wJWa6gzGC2kHHEsUbo0k3Vu1Uaz +6yBjLYXBP7txiHjkLmoPlXfzEh6ls5yFsg8Yb63NRS0T1Kvb3U1edrf78axK1JBD +hbGjpWWdg2ta42RD3MB/wgEAesncd+r4 +-----END PRIVATE KEY----- diff --git a/plans/dcaegen2-services-pmsh/testsuite/assets/mockserver.properties b/plans/dcaegen2-services-pmsh/testsuite/assets/mockserver.properties new file mode 100644 index 00000000..9c592303 --- /dev/null +++ b/plans/dcaegen2-services-pmsh/testsuite/assets/mockserver.properties @@ -0,0 +1,26 @@ +####################################### +# MockServer & Proxy Example Settings # +####################################### + +# Socket & Port Settings + +# socket timeout in milliseconds (default 120000) +mockserver.maxSocketTimeout=120000 + +# Certificate Generation + +# delete KeyStore file on JVM shutdown (default true) +mockserver.deleteGeneratedKeyStoreOnExit=true +# certificate domain name (default "localhost") +mockserver.sslCertificateDomainName=localhost +# comma separated list of domain names for Subject Alternative Name domain names (default empty list) +mockserver.sslSubjectAlternativeNameDomains=www.example.com,www.another.com +# comma separated list of ip addresses for Subject Alternative Name ips (default empty list) +mockserver.sslSubjectAlternativeNameIps=127.0.0.1 + +# CORS + +# enable CORS for MockServer REST API +mockserver.enableCORSForAPI=true +# enable CORS for all responses +mockserver.enableCORSForAllResponses=true diff --git a/plans/dcaegen2-services-pmsh/testsuite/docker-compose.yml b/plans/dcaegen2-services-pmsh/testsuite/docker-compose.yml new file mode 100644 index 00000000..4ea89dc4 --- /dev/null +++ b/plans/dcaegen2-services-pmsh/testsuite/docker-compose.yml @@ -0,0 +1,48 @@ +version: '3.3' + +services: + mockserver: + container_name: mockserver + image: mockserver/mockserver:mockserver-5.9.0 + environment: + MOCKSERVER_PROPERTY_FILE: /config/mockserver.properties + MOCKSERVER_INITIALIZATION_JSON_PATH: /config/initializerJson.json + volumes: + - ./assets/mockserver.properties:/config/mockserver.properties + - ./assets/initializerJson.json:/config/initializerJson.json + networks: + pmsh-network: + + db: + container_name: db + image: postgres + restart: always + environment: + POSTGRES_PASSWORD: $DB_PASSWORD + POSTGRES_USER: $DB_USER + networks: + pmsh-network: + + pmsh: + container_name: pmsh + image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pmsh + depends_on: + - db + volumes: + - ./assets/cert.pem:/opt/app/pmsh/etc/certs/cert.pem + - ./assets/key.pem:/opt/app/pmsh/etc/certs/key.pem + environment: + HOSTNAME: "dcae-pmsh" + CONFIG_BINDING_SERVICE_SERVICE_HOST: mockserver + CONFIG_BINDING_SERVICE_SERVICE_PORT: 1080 + PMSH_PG_URL: db + PMSH_PG_USERNAME: $DB_USER + PMSH_PG_PASSWORD: $DB_PASSWORD + AAI_SERVICE_HOST: mockserver + AAI_SERVICE_PORT_AAI_SSL: 1080 + networks: + pmsh-network: + +networks: + pmsh-network: + driver: bridge diff --git a/plans/dcaegen2-services-pmsh/testsuite/setup.sh b/plans/dcaegen2-services-pmsh/testsuite/setup.sh new file mode 100644 index 00000000..c70e02a1 --- /dev/null +++ b/plans/dcaegen2-services-pmsh/testsuite/setup.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# Place the scripts in run order: +source ${SCRIPTS}/common_functions.sh + +export DB_USER=pmsh +export DB_PASSWORD=pmsh + +docker login -u docker -p docker nexus3.onap.org:10001 + +TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-services-pmsh/testsuite + +docker-compose -f $TEST_PLANS_DIR/docker-compose.yml up -d mockserver db + +# Slow machine running CSITs can affect db coming up in time for PMSH +echo "Waiting for postgres db to come up..." +for i in {1..30}; do + docker exec -i db bash -c "PGPASSWORD=$DB_PASSWORD;psql -U $DB_USER -c '\q'" + db_response=$? + if [ "$db_response" = "0" ] + then + break + else + sleep 2 + fi +done +[ "$db_response" != "0" ] && echo "Error: postgres db not accessible" && exit 1 + +docker-compose -f $TEST_PLANS_DIR/docker-compose.yml up -d pmsh + +PMSH_IP=$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" pmsh) + +# Slow machine running CSITs can affect PMSH coming up before CSITs are run +echo "Waiting for PMSH to come up..." +for i in {1..30}; do + pmsh_response=$(curl -k -s -o /dev/null -w "%{http_code}" https://$PMSH_IP:8443/healthcheck) + if [ "$pmsh_response" = "200" ] + then + break + else + sleep 2 + fi +done +[ "$pmsh_response" != "200" ] && echo "Error: PMSH container state not healthy" && exit 1 + +# Wait for initialization of Docker containers +containers_ok=false +for i in {1..5}; do + if [ $(docker inspect --format '{{ .State.Running }}' mockserver) ] && \ + [ $(docker inspect --format '{{ .State.Running }}' db) ] && \ + [ $(docker inspect --format '{{ .State.Running }}' pmsh) ] + then + echo "All required docker containers are up." + containers_ok=true + break + else + sleep $i + fi +done +[ "$containers_ok" = "false" ] && echo "Error: required container not running." && exit 1 + +#Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v PMSH_IP:${PMSH_IP}" diff --git a/plans/dcaegen2-services-pmsh/testsuite/teardown.sh b/plans/dcaegen2-services-pmsh/testsuite/teardown.sh new file mode 100644 index 00000000..c5bac315 --- /dev/null +++ b/plans/dcaegen2-services-pmsh/testsuite/teardown.sh @@ -0,0 +1,8 @@ +#!/bin/bash +echo "Starting teardown script" +TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-services-pmsh/testsuite +mkdir -p $WORKSPACE/archives +docker exec pmsh /bin/sh -c "ls -l /var/log/ONAP/dcaegen2/services/pmsh/" +docker exec pmsh /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pmsh/*" +docker-compose -f $TEST_PLANS_DIR/docker-compose.yml logs --no-color > $WORKSPACE/archives/pmsh-docker-compose.log +docker-compose -f $TEST_PLANS_DIR/docker-compose.yml down -v diff --git a/plans/dcaegen2-services-pmsh/testsuite/testplan.txt b/plans/dcaegen2-services-pmsh/testsuite/testplan.txt new file mode 100644 index 00000000..3bf1dd6b --- /dev/null +++ b/plans/dcaegen2-services-pmsh/testsuite/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +dcaegen2-services-pmsh/testcases diff --git a/tests/aaf/certservice/assets/invalid.csr b/tests/aaf/certservice/assets/invalid.csr new file mode 100644 index 00000000..7284ab4d --- /dev/null +++ b/tests/aaf/certservice/assets/invalid.csr @@ -0,0 +1 @@ +aaaa
\ No newline at end of file diff --git a/tests/aaf/certservice/assets/invalid.key b/tests/aaf/certservice/assets/invalid.key new file mode 100644 index 00000000..6484fb6f --- /dev/null +++ b/tests/aaf/certservice/assets/invalid.key @@ -0,0 +1 @@ +bbbb
\ No newline at end of file diff --git a/tests/aaf/certservice/assets/valid.csr b/tests/aaf/certservice/assets/valid.csr new file mode 100644 index 00000000..aa9387bf --- /dev/null +++ b/tests/aaf/certservice/assets/valid.csr @@ -0,0 +1 @@ +LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJRExEQ0NBaFFDQVFBd2daQXhDekFKQmdOVkJBWVRBbEJNTVJZd0ZBWURWUVFJREExTWIzZGxjaTFUYVd4bGMybGhNUkF3RGdZRFZRUUhEQWRYY205amJHRjNNUTR3REFZRFZRUUtEQVZPYjJ0cFlURU5NQXNHQTFVRUN3d0VUMDVCVURFWE1CVUdBMVVFQXd3T2RHVnpkQzV1YjJ0cFlTNWpiMjB4SHpBZEJna3Foa2lHOXcwQkNRRVdFSFJsYzNSbGNrQnViMnRwWVM1amIyMHdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCRHdBd2dnRUtBb0lCQVFERzMwWUZKMDk3bS83dDJQV1pFbExBNmJ5bFc5Z1k0cDNod3NidC9paENqKzFqRG9YRFdpQk0wMXVGd1BqWmNiaXhwR3BQdXdVU3ZWREUzOUtwUDFHS3NCYVcrMHdLZG02Sit4YmN6ZTBEc0N6QUhCTnNYVXJEK3V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YmNuTzVCSHQvYTFmN3VoQmJoY2xQVFlPOTBSNGpLcUtGK2lVa2VDRHV0TmcrM09ncTdKaS9PWk5vajRSaUM1WWV4TWs5d1kxc3NVV0pqbDVoUURpd1BRQU5Zc09TSWxOT3Z2SWpydG81RnhNWVN5UndHamYrYnRSTzIyYz0KLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLQ==
\ No newline at end of file diff --git a/tests/aaf/certservice/cert-service-test.robot b/tests/aaf/certservice/cert-service-test.robot new file mode 100644 index 00000000..aa2691a7 --- /dev/null +++ b/tests/aaf/certservice/cert-service-test.robot @@ -0,0 +1,44 @@ +*** Settings *** + +Documentation Run healthcheck +Library RequestsLibrary +Resource ./resources/cert-service-keywords.robot + +Suite Setup Create sessions + +*** Test Cases *** + +AAF Cert Service API Health Check + [Tags] AAF-CERT-SERVICE + [Documentation] Run healthcheck + Run Healthcheck + +AAF Cert Service API Reload Configuration + [Tags] AAF-CERT-SERVICE + [Documentation] Reload configuration + Send Post Request And Validate Response /actuator/refresh 200 + +AAF Cert Service API Send Valid CSR and Valid PK + [Tags] AAF-CERT-SERVICE + [Documentation] Send request to /v1/certificate/test endpoint and expect 200 + Send Get Request with Header And Validate Response ${CERT_PATH} ${VALID_CSR_FILE} ${VALID_PK_FILE} 200 + +AAF Cert Service API Send Valid CSR and Valid PK to Wrong Path + [Tags] AAF-CERT-SERVICE + [Documentation] Send request to /v1/certificate/ endpoint and expect 404 + Send Get Request with Header And Validate Response /v1/certificate/ ${VALID_CSR_FILE} ${VALID_PK_FILE} 404 + +AAF Cert Service API Send Request without Header + [Tags] AAF-CERT-SERVICE + [Documentation] Send request to /v1/certificate/ endpoint and expect 400 + Send Get Request And Validate Response ${CERT_PATH} 400 + +AAF Cert Service API Send Invalid CSR and Valid PK + [Tags] AAF-CERT-SERVICE + [Documentation] Send request to /v1/certificate/test endpoint and expect 400 + Send Get Request with Header And Validate Response ${CERT_PATH} ${INVALID_CSR_FILE} ${VALID_PK_FILE} 400 + +AAF Cert Service API Send Valid CSR and Invalid PK + [Tags] AAF-CERT-SERVICE + [Documentation] Send request to /v1/certificate/test endpoint and expect 400 + Send Get Request with Header And Validate Response ${CERT_PATH} ${VALID_CSR_FILE} ${INVALID_PK_FILE} 400
\ No newline at end of file diff --git a/tests/aaf/certservice/resources/cert-service-keywords.robot b/tests/aaf/certservice/resources/cert-service-keywords.robot new file mode 100644 index 00000000..b40da524 --- /dev/null +++ b/tests/aaf/certservice/resources/cert-service-keywords.robot @@ -0,0 +1,55 @@ +*** Settings *** + +Library RequestsLibrary +Library HttpLibrary.HTTP +Library Collections +Resource ../../../common.robot +Resource ./cert-service-properties.robot + +*** Keywords *** + +Create sessions + [Documentation] Create all required sessions + Create Session aaf_cert_service_url ${AAFCERT_URL} + Set Suite Variable ${http_session} aaf_cert_service_url + +Run Healthcheck + [Documentation] Run Healthcheck + ${resp}= Get Request ${http_session} /actuator/health + Should Be Equal As Strings ${resp.status_code} 200 + Validate Recieved Response ${resp} status UP + +Validate Recieved Response + [Documentation] Validare message that has been received + [Arguments] ${resp} ${key} ${expected_value} + ${json}= Parse Json ${resp.content} + ${value}= Get From Dictionary ${json} ${key} + Should Be Equal As Strings ${value} ${expected_value} + +Send Get Request And Validate Response + [Documentation] Send request to passed url and validate received response + [Arguments] ${path} ${resp_code} + ${resp}= Get Request ${http_session} ${path} + Should Be Equal As Strings ${resp.status_code} ${resp_code} + +Send Get Request with Header And Validate Response + [Documentation] Send request to passed url and validate received response + [Arguments] ${path} ${csr_file} ${pk_file} ${resp_code} + ${headers}= Create Header with CSR and PK ${csr_file} ${pk_file} + ${resp}= Get Request ${http_session} ${path} headers=${headers} + Should Be Equal As Strings ${resp.status_code} ${resp_code} + +Create Header with CSR and PK + [Documentation] Create header with CSR and PK + [Arguments] ${csr_file} ${pk_file} + [Return] ${headers} + ${csr}= Get Data From File ${csr_file} + ${pk}= Get Data From File ${pk_file} + ${headers}= Create Dictionary CSR=${csr} PK=${pk} + +Send Post Request And Validate Response + [Documentation] Send request to passed url and validate received response + [Arguments] ${path} ${resp_code} + ${resp}= Post Request ${http_session} ${path} + Should Be Equal As Strings ${resp.status_code} ${resp_code} +
\ No newline at end of file diff --git a/tests/aaf/certservice/resources/cert-service-properties.robot b/tests/aaf/certservice/resources/cert-service-properties.robot new file mode 100644 index 00000000..e911133d --- /dev/null +++ b/tests/aaf/certservice/resources/cert-service-properties.robot @@ -0,0 +1,9 @@ +*** Variables *** + +${AAFCERT_URL} http://%{AAFCERT_IP}:8080 +${CAName} test +${CERT_PATH} /v1/certificate/${CAName} +${VALID_CSR_FILE} %{WORKSPACE}/tests/aaf/certservice/assets/valid.csr +${VALID_PK_FILE} %{WORKSPACE}/tests/aaf/certservice/assets/valid.key +${INVALID_CSR_FILE} %{WORKSPACE}/tests/aaf/certservice/assets/invalid.csr +${INVALID_PK_FILE} %{WORKSPACE}/tests/aaf/certservice/assets/invalid.key diff --git a/tests/dcaegen2-services-pmsh/testcases/__init__.robot b/tests/dcaegen2-services-pmsh/testcases/__init__.robot new file mode 100644 index 00000000..47abe8bb --- /dev/null +++ b/tests/dcaegen2-services-pmsh/testcases/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation PMSH Testcases diff --git a/tests/dcaegen2-services-pmsh/testcases/pmsh.robot b/tests/dcaegen2-services-pmsh/testcases/pmsh.robot new file mode 100644 index 00000000..74a575cd --- /dev/null +++ b/tests/dcaegen2-services-pmsh/testcases/pmsh.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Testing PMSH functionality +Library OperatingSystem +Library RequestsLibrary +Library String + +Test Setup Create Session pmsh_session ${PMSH_BASE_URL} +Test Teardown Delete All Sessions + + +*** Variables *** +${PMSH_BASE_URL} https://${PMSH_IP}:8443 +${HEALTHCHECK_ENDPOINT} /healthcheck + + +*** Test Cases *** +Verify Health Check returns 200 when a REST GET request to healthcheck url + [Tags] PMSH_01 + [Documentation] Verify Health Check returns 200 when a REST GET request to healthcheck url + [Timeout] 1 minute + ${resp}= Get Request pmsh_session ${HEALTHCHECK_ENDPOINT} + VerifyResponse ${resp.status_code} 200 + +Verify Health Check response includes healthy status + [Tags] PMSH_02 + [Documentation] Verify Health Check response includes healthy status + [Timeout] 1 minute + ${resp}= Get Request pmsh_session ${HEALTHCHECK_ENDPOINT} + VerifyResponseContains ${resp.text} healthy + +*** Keywords *** +VerifyResponse + [Arguments] ${actual_response_value} ${expected_response_value} + Should Be Equal As Strings ${actual_response_value} ${expected_response_value} + +VerifyResponseContains + [Arguments] ${response_content} ${string_to_check_for} + Should Contain ${response_content} ${string_to_check_for} |