diff options
author | Krzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com> | 2020-08-12 09:29:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-08-12 09:29:06 +0000 |
commit | 7bf9d5c1e9c94d60b138c73a716bc10bce038992 (patch) | |
tree | 3d8e07ae614abb860a85a5f8aaaa52812539b3e6 /tests/oom-platform-cert-service/certservice | |
parent | 7ee6e129f29262b3c7828299bf457004abf28614 (diff) | |
parent | b7a057e8017b7899de26f977fa3841882035200b (diff) |
Merge "Move csits form aaf to oom"
Diffstat (limited to 'tests/oom-platform-cert-service/certservice')
21 files changed, 625 insertions, 0 deletions
diff --git a/tests/oom-platform-cert-service/certservice/assets/invalid.csr b/tests/oom-platform-cert-service/certservice/assets/invalid.csr new file mode 100644 index 00000000..7284ab4d --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/assets/invalid.csr @@ -0,0 +1 @@ +aaaa
\ No newline at end of file diff --git a/tests/oom-platform-cert-service/certservice/assets/invalid.key b/tests/oom-platform-cert-service/certservice/assets/invalid.key new file mode 100644 index 00000000..6484fb6f --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/assets/invalid.key @@ -0,0 +1 @@ +bbbb
\ No newline at end of file diff --git a/tests/oom-platform-cert-service/certservice/assets/invalid_client_docker.env b/tests/oom-platform-cert-service/certservice/assets/invalid_client_docker.env new file mode 100644 index 00000000..4f19a9e7 --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/assets/invalid_client_docker.env @@ -0,0 +1,16 @@ +#Client envs +REQUEST_TIMEOUT=5000 +OUTPUT_PATH=/var/certs +CA_NAME=Invalid +KEYSTORE_PATH=/etc/onap/oom-platform-cert-service/certservice/certs/certServiceClient-keystore.jks +KEYSTORE_PASSWORD=secret +TRUSTSTORE_PATH=/etc/onap/oom-platform-cert-service/certservice/certs/truststore.jks +TRUSTSTORE_PASSWORD=secret +#Csr config envs +COMMON_NAME=onap.org +ORGANIZATION=Linux-Foundation +ORGANIZATION_UNIT=ONAP +LOCATION=San-Francisco +STATE=California +COUNTRY=US +SANS=example.com:sample.com
\ No newline at end of file diff --git a/tests/oom-platform-cert-service/certservice/assets/invalid_client_docker_output_type.env b/tests/oom-platform-cert-service/certservice/assets/invalid_client_docker_output_type.env new file mode 100644 index 00000000..4cdcd9ed --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/assets/invalid_client_docker_output_type.env @@ -0,0 +1,17 @@ +#Client envs +REQUEST_TIMEOUT=30000 +OUTPUT_PATH=/var/certs +CA_NAME=RA +OUTPUT_TYPE=INV +KEYSTORE_PATH=/etc/onap/oom-platform-cert-service/certservice/certs/certServiceClient-keystore.jks +KEYSTORE_PASSWORD=secret +TRUSTSTORE_PATH=/etc/onap/oom-platform-cert-service/certservice/certs/truststore.jks +TRUSTSTORE_PASSWORD=secret +#Csr config envs +COMMON_NAME=onap.org +ORGANIZATION=Linux-Foundation +ORGANIZATION_UNIT=ONAP +LOCATION=San-Francisco +STATE=California +COUNTRY=US +SANS=example.com:sample.com diff --git a/tests/oom-platform-cert-service/certservice/assets/valid_client.csr b/tests/oom-platform-cert-service/certservice/assets/valid_client.csr new file mode 100644 index 00000000..59e5c6af --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/assets/valid_client.csr @@ -0,0 +1 @@ +LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJREVqQ0NBZm9DQVFBd2daZ3hDekFKQmdOVkJBWVRBbFZUTVJNd0VRWURWUVFJREFwRFlXeHBabTl5Ym1saApNUll3RkFZRFZRUUhEQTFUWVc0dFJuSmhibU5wYzJOdk1Sa3dGd1lEVlFRS0RCQk1hVzUxZUMxR2IzVnVaR0YwCmFXOXVNUTB3Q3dZRFZRUUxEQVJQVGtGUU1SQXdEZ1lEVlFRRERBZE9iMlJsTVRJek1TQXdIZ1lKS29aSWh2Y04KQVFrQkZoRkRiMjF0YjI1T1lXMWxRR051TG1OdmJUQ0NBU0l3RFFZSktvWklodmNOQ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VGIxUgo3WUoraG9ydzF0R1lIRFFFYXQ0NVlLOEdwRFJUeVE9PQotLS0tLUVORCBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0=
\ No newline at end of file diff --git a/tests/oom-platform-cert-service/certservice/assets/valid_client.pk b/tests/oom-platform-cert-service/certservice/assets/valid_client.pk new file mode 100644 index 00000000..c84908ff --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/assets/valid_client.pk @@ -0,0 +1 @@ +LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2Z0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktnd2dnU2tBZ0VBQW9JQkFRRFpCbjdyQ2U1d1FTc0wKWndyUm9wSTZTdGFLVEJrVnoyTHJKWnZjYUZDaTJ6VHQ4YUM2TUF2VUxUNTFvZ2xBL3VWUHZtWHdNWW9ZS3U2RQptb2M3b0pEZnFTWndzWm4rRlV0NGZJNHUydWVBQWNVWGlPNDNncjh3N09QZjFEUXU5OXU3SDRXK3VXN3E3aXdSCjI1YkhRQUc3d05aRW1jWjcxSEtPQ0NMT0czQVVBVkFoMDRXRkFtSzVLSWgzYis4TnRJdjJaMnBDSnRISUtTbWQKL1UwREk4bUx3cEhlREdSTnJpMnZPaGcwRXA0SXFLQ2djNmZxMmFGMmZ3ZTZSdVI0U2NLa25rMUJTb040TGRRYQp0c2FJT3RyOWtxT1hOcjYwNXR4KzNPRVM2UFpZZjNOU3lNRDBFR0VtbnRrelEyM2tiMzBVTExOWmtPV0pGRnJUClFzbTJUTTNqQWdNQkFBRUNnZ0VBRm53cnppSTdSL29ZZ1pmdGNRYk02Nmt4VFNiUk9vZEFFbWpWR3lMYnArUGEKT2dUY3lDMk9MQzk3MXlnd21VRlBkTkdmTWlHUDB5MHZoU0dWZlVJSGdJUy83TkVaeVU5ZmdGNDNSUGQ5SUxBTwpRWC80WGx2M2Z4UXNEOWFtaVc4NG5zeUhTTmxoZW9tdW16TUxEaDI5a0R4TWR0TVAwM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lFhNzhVCmgzZWRRdW5BcWtNdlZra1NWcVB0UmorNC90ZUFJRHpQaEIvbzIrWWV0VjBUT3Z3aEdsMWV4RENVMGdDcmZKZFQKcjJzZHY4ZEM0NnBrRXFFYjhjckV6Ui83cmhVZ1ExV1ErNUJ4OGwvTSt3S0JnQkJGMFJDVzZUaUJpQUkxY0NvTgo0NW1DbThuNnNrVS8vZ1kvb0ZueitUbExiZWN0U0lJcEgrbm1MWHFWamV4L1NPOGVNOE1Iekp5ZWRlWUxHck1LCnQwQ2t5a0h5cTQrOW5oSlB0aWQ2bzQra2o2MTRQQUVtYktKZytxYW90ckZmdWpDM3hEb00wQkdXYlcwRmR2WkwKR09tWXEwbnZ1TzY1UjJtWUlpREtiNm9GCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0=
\ No newline at end of file diff --git a/tests/oom-platform-cert-service/certservice/assets/valid_client_docker.env b/tests/oom-platform-cert-service/certservice/assets/valid_client_docker.env new file mode 100644 index 00000000..6fad6d21 --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/assets/valid_client_docker.env @@ -0,0 +1,16 @@ +#Client envs +REQUEST_TIMEOUT=30000 +OUTPUT_PATH=/var/certs +CA_NAME=RA +KEYSTORE_PATH=/etc/onap/oom-platform-cert-service/certservice/certs/certServiceClient-keystore.jks +KEYSTORE_PASSWORD=secret +TRUSTSTORE_PATH=/etc/onap/oom-platform-cert-service/certservice/certs/truststore.jks +TRUSTSTORE_PASSWORD=secret +#Csr config envs +COMMON_NAME=onap.org +ORGANIZATION=Linux-Foundation +ORGANIZATION_UNIT=ONAP +LOCATION=San-Francisco +STATE=California +COUNTRY=US +SANS=example.com:sample.com
\ No newline at end of file diff --git a/tests/oom-platform-cert-service/certservice/assets/valid_client_docker_jks.env b/tests/oom-platform-cert-service/certservice/assets/valid_client_docker_jks.env new file mode 100644 index 00000000..0e2d8367 --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/assets/valid_client_docker_jks.env @@ -0,0 +1,17 @@ +#Client envs +REQUEST_TIMEOUT=30000 +OUTPUT_PATH=/var/certs +CA_NAME=RA +OUTPUT_TYPE=JKS +KEYSTORE_PATH=/etc/onap/oom-platform-cert-service/certservice/certs/certServiceClient-keystore.jks +KEYSTORE_PASSWORD=secret +TRUSTSTORE_PATH=/etc/onap/oom-platform-cert-service/certservice/certs/truststore.jks +TRUSTSTORE_PASSWORD=secret +#Csr config envs +COMMON_NAME=onap.org +ORGANIZATION=Linux-Foundation +ORGANIZATION_UNIT=ONAP +LOCATION=San-Francisco +STATE=California +COUNTRY=US +SANS=example.com:sample.com diff --git a/tests/oom-platform-cert-service/certservice/assets/valid_client_docker_p12.env b/tests/oom-platform-cert-service/certservice/assets/valid_client_docker_p12.env new file mode 100644 index 00000000..c3ed729f --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/assets/valid_client_docker_p12.env @@ -0,0 +1,17 @@ +#Client envs +REQUEST_TIMEOUT=30000 +OUTPUT_PATH=/var/certs +CA_NAME=RA +OUTPUT_TYPE=P12 +KEYSTORE_PATH=/etc/onap/oom-platform-cert-service/certservice/certs/certServiceClient-keystore.jks +KEYSTORE_PASSWORD=secret +TRUSTSTORE_PATH=/etc/onap/oom-platform-cert-service/certservice/certs/truststore.jks +TRUSTSTORE_PASSWORD=secret +#Csr config envs +COMMON_NAME=onap.org +ORGANIZATION=Linux-Foundation +ORGANIZATION_UNIT=ONAP +LOCATION=San-Francisco +STATE=California +COUNTRY=US +SANS=example.com:sample.com diff --git a/tests/oom-platform-cert-service/certservice/assets/valid_client_docker_pem.env b/tests/oom-platform-cert-service/certservice/assets/valid_client_docker_pem.env new file mode 100644 index 00000000..aca2a54b --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/assets/valid_client_docker_pem.env @@ -0,0 +1,17 @@ +#Client envs +REQUEST_TIMEOUT=30000 +OUTPUT_PATH=/var/certs +CA_NAME=RA +OUTPUT_TYPE=PEM +KEYSTORE_PATH=/etc/onap/oom-platform-cert-service/certservice/certs/certServiceClient-keystore.jks +KEYSTORE_PASSWORD=secret +TRUSTSTORE_PATH=/etc/onap/oom-platform-cert-service/certservice/certs/truststore.jks +TRUSTSTORE_PASSWORD=secret +#Csr config envs +COMMON_NAME=onap.org +ORGANIZATION=Linux-Foundation +ORGANIZATION_UNIT=ONAP +LOCATION=San-Francisco +STATE=California +COUNTRY=US +SANS=example.com:sample.com diff --git a/tests/oom-platform-cert-service/certservice/assets/valid_ra.csr b/tests/oom-platform-cert-service/certservice/assets/valid_ra.csr new file mode 100644 index 00000000..5decd8ee --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/assets/valid_ra.csr @@ -0,0 +1 @@ +LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJRERqQ0NBZllDQVFBd2daWXhDekFKQmdOVkJBWVRBbFZUTVJNd0VRWURWUVFJREFwRFlXeHBabTl5Ym1saApNUll3RkFZRFZRUUhEQTFUWVc0dFJuSmhibU5wYzJOdk1Sa3dGd1lEVlFRS0RCQk1hVzUxZUMxR2IzVnVaR0YwCmFXOXVNUTB3Q3dZRFZRUUxEQVJQVGtGUU1RNHdEQVlEVlFRRERBVkRiREV5TXpFZ01CNEdDU3FHU0liM0RRRUoKQVJZUlEyOXRiVzl1VG1GdFpVQmpiaTVqYjIwd2dnRWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFSwpBb0lCQVFDL2VCWEprWi80UFdQV2F4Qy9veW9ybmNjdzNiVlM2QmRJbzJUaGh0SzU4OG9wczg4RG8zZkN3Tkk0Cm1aV0xhYUEzbi9lVzJ6SG1TVENzeE4yd1BCREJhWWNwNmxCN1B5bmJDd1ZmcU55ZWhNNWFXQjY4TXFWKzVEcTQKc1BhT0haandNYnlSMTA3dHh3dGtub3lZeHh3SzVCY21vUkNkTjhxYndpY2Q0ajd4bDVDeVBiV1hyYUc0bFY3SgpRU1hlYmRJVUkvaVVNY3dKVThFdEgxZnNUS01CVTNMTE5pSlJsMzBJSGZQSEhZVndWVGhOUC82cFo5WktOeHR5Cm5oK2ZJaUZpNm9mU2h1dXRFZ25xRXdxS2UyenRUV20xYTNGNVlIUk5Pb1FMODA0OXhhQWNhanVTaEZnejZOZzYKOWRha1hhdkd5ejlrOUJHMDh3TU9BejFNQlBoL0FnTUJBQUdnTWpBd0Jna3Foa2lHOXcwQkNRNHhJekFoTUI4RwpBMVVkRVFRWU1CYUNCVU5zTVRJemdnMTBaWE4wTG05dVlYQXViM0puTUEwR0NTcUdTSWIzRFFFQkN3VUFBNElCCkFRQ1kwaUxKQWpWS3FSc0dBdTJOVzBHaGdPbTAvdkF0RmNNTWJOTTRBUGFNS2hiWTd6SGdob2U5VHMxTlBaUXkKSnZFRHJzOFhsSWIxeFN4NXJ1dktlY0JzamVLbEIzaU13V0dDeGViQ0lCMEsvbTV0YWI4cGtYQU0wVmJ3QTVIOAprWGRJS0xwK2grTVRLRnBNczY0OHk3eFRtcGFmb05CWld2d1ArODRsR295RDROZWJiRTN1anY1R21Id1JuK0xQCkRRNmJjSWxoWGNSN0JEMnZYNFdqdmY1YmVwL00yeVd4SkJPaTRzYjQ1NWdtTVpvYUJGSjF2OWpybUd6aDk2THEKck9NTEhCK1VOS0o1Tm1aQXZZVkNaNFVvVFpXZ3VQZVlMaXR6U2F0L0l3RGdJb3NSYXQrUGdJSkJWbXgzY212LwpJU0tncmRxckpKVFlmWGZrRnE5RG5vWHAKLS0tLS1FTkQgQ0VSVElGSUNBVEUgUkVRVUVTVC0tLS0t
\ No newline at end of file diff --git a/tests/oom-platform-cert-service/certservice/assets/valid_ra.pk b/tests/oom-platform-cert-service/certservice/assets/valid_ra.pk new file mode 100644 index 00000000..b1ad633a --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/assets/valid_ra.pk @@ -0,0 +1 @@ +LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2Z0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktnd2dnU2tBZ0VBQW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VExcjBiU28KVnZCZE1zS0F1RXdiRS85aDlsbjFCRkNsCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0=
\ No newline at end of file diff --git a/tests/oom-platform-cert-service/certservice/cert-service-test.robot b/tests/oom-platform-cert-service/certservice/cert-service-test.robot new file mode 100644 index 00000000..58e8a7e3 --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/cert-service-test.robot @@ -0,0 +1,90 @@ +*** Settings *** + +Documentation OOM Cert Service API test case scenarios +Library RequestsLibrary +Resource ./resources/cert-service-keywords.robot + +Suite Setup Create sessions + +*** Test Cases *** + +Health Check + [Tags] OOM-CERT-SERVICE + [Documentation] Service is up and running + Run health check + +Reload Configuration + [Tags] OOM-CERT-SERVICE + [Documentation] Configuration was changed + Send Get Request And Validate Response /reload 200 + +Check if application is ready + [Tags] OOM-CERT-SERVICE + [Documentation] Send request to /ready endpoint and expect 200 + Send Get Request And Validate Response /ready 200 + +Generate Certificate In RA Mode For CA Name + [Tags] OOM-CERT-SERVICE + [Documentation] Send request to ${CERT_SERVICE_ENDPOINT}${RA_CA_NAME} endpoint and expect 200 + Send Get Request with Header And Expect Success ${CERT_SERVICE_ENDPOINT}${RA_CA_NAME} ${VALID_RA_CSR_FILE} ${VALID_RA_PK_FILE} + +Report Not Found Error When Path To Service Is Not Valid + [Tags] OOM-CERT-SERVICE + [Documentation] Send request to ${CERT_SERVICE_ENDPOINT} endpoint and expect 404 + Send Get Request with Header And Expect Error ${CERT_SERVICE_ENDPOINT} ${VALID_CLIENT_CSR_FILE} ${VALID_CLIENT_PK_FILE} 404 + +Report Bad Request Error When Header Is Missing In Request + [Tags] OOM-CERT-SERVICE + [Documentation] Send request without header to ${CERT_SERVICE_ENDPOINT}${CLIENT_CA_NAME} endpoint and expect 400 + Send Get Request And Validate Response ${CERT_SERVICE_ENDPOINT}${CLIENT_CA_NAME} 400 + +Report Bad Request Error When CSR Is Not Valid + [Tags] OOM-CERT-SERVICE + [Documentation] Send request to ${CERT_SERVICE_ENDPOINT}${CLIENT_CA_NAME} endpoint and expect 400 + Send Get Request with Header And Expect Error ${CERT_SERVICE_ENDPOINT}${CLIENT_CA_NAME} ${INVALID_CSR_FILE} ${VALID_CLIENT_PK_FILE} 400 + +Report Bad Request Error When PK Is Not Valid + [Tags] OOM-CERT-SERVICE + [Documentation] Send request to ${CERT_SERVICE_ENDPOINT}${CLIENT_CA_NAME} endpoint and expect 400 + Send Get Request with Header And Expect Error ${CERT_SERVICE_ENDPOINT}${CLIENT_CA_NAME} ${VALID_CLIENT_CSR_FILE} ${INVALID_PK_FILE} 400 + +Cert Service Client successfully creates keystore.p12 and truststore.p12 + [Tags] OOM-CERT-SERVICE + [Documentation] Run with correct env and expected exit code 0 + Run Cert Service Client And Validate PKCS12 File Creation And Client Exit Code ${VALID_ENV_FILE} 0 + +Cert Service Client successfully creates keystore.jks and truststore.jks + [Tags] OOM-CERT-SERVICE + [Documentation] Run with correct env and expected exit code 0 + Run Cert Service Client And Validate JKS File Creation And Client Exit Code ${VALID_ENV_FILE_JKS} 0 + +Cert Service Client successfully creates keystore and truststore with expected data with no OUTPUT_TYPE + [Tags] OOM-CERT-SERVICE + [Documentation] Run with correct env and PKCS12 files created with correct data + Run Cert Service Client And Validate PKCS12 Files Contain Expected Data ${VALID_ENV_FILE} 0 + +Cert Service Client successfully creates keystore and truststore with expected data with OUTPUT_TYPE=JKS + [Tags] OOM-CERT-SERVICE + [Documentation] Run with correct env and JKS files created with correct data + Run Cert Service Client And Validate JKS Files Contain Expected Data ${VALID_ENV_FILE_JKS} 0 + +Cert Service Client successfully creates keystore and truststore with expected data with OUTPUT_TYPE=P12 + [Tags] OOM-CERT-SERVICE + [Documentation] Run with correct env and PKCS12 files created with correct data + Run Cert Service Client And Validate PKCS12 Files Contain Expected Data ${VALID_ENV_FILE_P12} 0 + +Cert Service Client successfully creates keystore and truststore with expected data with OUTPUT_TYPE=PEM + [Tags] OOM-CERT-SERVICE + [Documentation] Run with correct env and PEM files created with correct data + Run Cert Service Client And Validate PEM Files Contain Expected Data ${VALID_ENV_FILE_PEM} 0 + +Cert Service Client reports error when OUTPUT_TYPE is invalid + [Tags] OOM-CERT-SERVICE + [Documentation] Run with invalid OUTPUT_TYPE env and expected exit code 1 + Run Cert Service Client And Validate Client Exit Code ${INVALID_ENV_FILE_OUTPUT_TYPE} 1 + +Run Cert Service Client Container And Validate Exit Code And API Response + [Tags] OOM-CERT-SERVICE + [Documentation] Run with invalid CaName env and expected exit code 5 + Run Cert Service Client And Validate Http Response Code And Client Exit Code ${INVALID_ENV_FILE} 404 5 + diff --git a/tests/oom-platform-cert-service/certservice/libraries/ArtifactParser.py b/tests/oom-platform-cert-service/certservice/libraries/ArtifactParser.py new file mode 100644 index 00000000..54e8d0ff --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/libraries/ArtifactParser.py @@ -0,0 +1,40 @@ +from cryptography.x509.oid import ExtensionOID +from cryptography import x509 + +class ArtifactParser: + + def __init__(self, mount_path, ext): + self.keystorePassPath = mount_path + '/keystore.pass' + self.keystorePath = mount_path + '/keystore.' + ext + self.truststorePassPath = mount_path + '/truststore.pass' + self.truststorePath = mount_path + '/truststore.' + ext + + def contains_expected_data(self, data): + expectedData = data.expectedData + actualData = data.actualData + return cmp(expectedData, actualData) == 0 + + def get_owner_data_from_certificate(self, certificate): + list = certificate.get_subject().get_components() + return dict((k, v) for k, v in list) + + def get_sans(self, cert): + extension = cert.to_cryptography().extensions.get_extension_for_oid(ExtensionOID.SUBJECT_ALTERNATIVE_NAME) + dnsList = extension.value.get_values_for_type(x509.DNSName) + return ':'.join(map(lambda dns: dns.encode('ascii','ignore'), dnsList)) + + def get_envs_as_dict(self, list): + envs = self.get_list_of_pairs_by_mappings(list) + return self.remove_nones_from_dict(envs) + + def remove_nones_from_dict(self, dictionary): + return dict((k, v) for k, v in dictionary.iteritems() if k is not None) + + def get_list_of_pairs_by_mappings(self, list): + mappings = self.get_mappings() + listOfEnvs = map(lambda k: k.split('='), list) + return dict((mappings.get(a[0]), a[1]) for a in listOfEnvs) + + def get_mappings(self): + return {'COMMON_NAME':'CN', 'ORGANIZATION':'O', 'ORGANIZATION_UNIT':'OU', 'LOCATION':'L', 'STATE':'ST', 'COUNTRY':'C', 'SANS':'SANS'} + diff --git a/tests/oom-platform-cert-service/certservice/libraries/CertClientManager.py b/tests/oom-platform-cert-service/certservice/libraries/CertClientManager.py new file mode 100644 index 00000000..46d69bb8 --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/libraries/CertClientManager.py @@ -0,0 +1,72 @@ +import docker +import os +import shutil +import re +from EnvsReader import EnvsReader +from docker.types import Mount + +ARCHIVES_PATH = os.getenv("WORKSPACE") + "/archives/" + +ERROR_API_REGEX = 'Error on API response.*[0-9]{3}' +RESPONSE_CODE_REGEX = '[0-9]{3}' + + +class CertClientManager: + + def __init__(self, mount_path, truststore_path): + self.mount_path = mount_path + self.truststore_path = truststore_path + + def run_client_container(self, client_image, container_name, path_to_env, request_url, network): + self.create_mount_dir() + client = docker.from_env() + environment = EnvsReader().read_env_list_from_file(path_to_env) + environment.append("REQUEST_URL=" + request_url) + container = client.containers.run( + image=client_image, + name=container_name, + environment=environment, + network=network, + user='root', # Run container as root to avoid permission issues with volume mount access + mounts=[Mount(target='/var/certs', source=self.mount_path, type='bind'), + Mount(target='/etc/onap/oom-platform-cert-service/certservice/certs/', source=self.truststore_path, type='bind')], + detach=True + ) + exitcode = container.wait() + return exitcode + + def remove_client_container_and_save_logs(self, container_name, log_file_name): + client = docker.from_env() + container = client.containers.get(container_name) + text_file = open(ARCHIVES_PATH + "client_container_" + log_file_name + ".log", "w") + text_file.write(container.logs()) + text_file.close() + container.remove() + self.remove_mount_dir() + + def create_mount_dir(self): + if not os.path.exists(self.mount_path): + os.makedirs(self.mount_path) + + def remove_mount_dir(self): + shutil.rmtree(self.mount_path) + + def can_find_api_response_in_logs(self, container_name): + logs = self.get_container_logs(container_name) + api_logs = re.findall(ERROR_API_REGEX, logs) + if api_logs: + return True + else: + return False + + def get_api_response_from_logs(self, container_name): + logs = self.get_container_logs(container_name) + error_api_message = re.findall(ERROR_API_REGEX, logs) + code = re.findall(RESPONSE_CODE_REGEX, error_api_message[0]) + return code[0] + + def get_container_logs(self, container_name): + client = docker.from_env() + container = client.containers.get(container_name) + logs = container.logs() + return logs diff --git a/tests/oom-platform-cert-service/certservice/libraries/EnvsReader.py b/tests/oom-platform-cert-service/certservice/libraries/EnvsReader.py new file mode 100644 index 00000000..cc60eed6 --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/libraries/EnvsReader.py @@ -0,0 +1,11 @@ + +class EnvsReader: + + def read_env_list_from_file(self, path): + f = open(path, "r") + r_list = [] + for line in f: + line = line.strip() + if line[0] != "#": + r_list.append(line) + return r_list diff --git a/tests/oom-platform-cert-service/certservice/libraries/JksArtifactsValidator.py b/tests/oom-platform-cert-service/certservice/libraries/JksArtifactsValidator.py new file mode 100644 index 00000000..e2fdde91 --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/libraries/JksArtifactsValidator.py @@ -0,0 +1,45 @@ +import jks +from OpenSSL import crypto +from cryptography import x509 +from cryptography.hazmat.backends import default_backend +from EnvsReader import EnvsReader +from ArtifactParser import ArtifactParser + +class JksArtifactsValidator: + + def __init__(self, mount_path): + self.parser = ArtifactParser(mount_path, "jks") + + def get_and_compare_data_jks(self, path_to_env): + data = self.get_data_jks(path_to_env) + return data, self.parser.contains_expected_data(data) + + def get_keystore(self): + keystore = jks.KeyStore.load(self.parser.keystorePath, open(self.parser.keystorePassPath, 'rb').read()) + return keystore.private_keys['certificate'].cert_chain[0][1] + + def get_truststore(self): + truststore = jks.KeyStore.load(self.parser.truststorePath, open(self.parser.truststorePassPath, 'rb').read()) + return truststore.certs + + def can_open_keystore_and_truststore_with_pass_jks(self): + try: + jks.KeyStore.load(self.parser.keystorePath, open(self.parser.keystorePassPath, 'rb').read()) + jks.KeyStore.load(self.parser.truststorePath, open(self.parser.truststorePassPath, 'rb').read()) + return True + except: + return False + + def get_data_jks(self, path_to_env): + envs = self.parser.get_envs_as_dict(EnvsReader().read_env_list_from_file(path_to_env)) + certificate = self.get_keystore_certificate() + data = self.parser.get_owner_data_from_certificate(certificate) + data['SANS'] = self.parser.get_sans(certificate) + return type('', (object,), {"expectedData": envs, "actualData": data}) + + def get_keystore_certificate(self): + return crypto.X509.from_cryptography(self.load_x509_certificate(self.get_keystore())) + + def load_x509_certificate(self, data): + cert = x509.load_der_x509_certificate(data, default_backend()) + return cert diff --git a/tests/oom-platform-cert-service/certservice/libraries/P12ArtifactsValidator.py b/tests/oom-platform-cert-service/certservice/libraries/P12ArtifactsValidator.py new file mode 100644 index 00000000..b0701718 --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/libraries/P12ArtifactsValidator.py @@ -0,0 +1,37 @@ +from OpenSSL import crypto +from EnvsReader import EnvsReader +from ArtifactParser import ArtifactParser + +class P12ArtifactsValidator: + + def __init__(self, mount_path): + self.parser = ArtifactParser(mount_path, "p12") + + def get_and_compare_data_p12(self, path_to_env): + data = self.get_data(path_to_env) + return data, self.parser.contains_expected_data(data) + + def can_open_keystore_and_truststore_with_pass(self): + can_open_keystore = self.can_open_store_file_with_pass_file(self.parser.keystorePassPath, self.parser.keystorePath) + can_open_truststore = self.can_open_store_file_with_pass_file(self.parser.truststorePassPath, self.parser.truststorePath) + + return can_open_keystore & can_open_truststore + + def can_open_store_file_with_pass_file(self, pass_file_path, store_file_path): + try: + self.get_certificate(pass_file_path, store_file_path) + return True + except: + return False + + def get_data(self, path_to_env): + envs = self.parser.get_envs_as_dict(EnvsReader().read_env_list_from_file(path_to_env)) + certificate = self.get_certificate(self.parser.keystorePassPath, self.parser.keystorePath) + data = self.parser.get_owner_data_from_certificate(certificate) + data['SANS'] = self.parser.get_sans(certificate) + return type('', (object,), {"expectedData": envs, "actualData": data}) + + def get_certificate(self, pass_file_path, store_file_path): + password = open(pass_file_path, 'rb').read() + crypto.load_pkcs12(open(store_file_path, 'rb').read(), password) + return crypto.load_pkcs12(open(store_file_path, 'rb').read(), password).get_certificate() diff --git a/tests/oom-platform-cert-service/certservice/libraries/PemArtifactsValidator.py b/tests/oom-platform-cert-service/certservice/libraries/PemArtifactsValidator.py new file mode 100644 index 00000000..46e0357e --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/libraries/PemArtifactsValidator.py @@ -0,0 +1,39 @@ +import os +from OpenSSL import crypto +from cryptography import x509 +from cryptography.hazmat.backends import default_backend +from EnvsReader import EnvsReader +from ArtifactParser import ArtifactParser + +class PemArtifactsValidator: + + def __init__(self, mount_path): + self.parser = ArtifactParser(mount_path, "pem") + self.key = mount_path + '/key.pem' + + def get_and_compare_data_pem(self, path_to_env): + data = self.get_data_pem(path_to_env) + return data, self.parser.contains_expected_data(data) + + def artifacts_exist_and_are_not_empty(self): + keystoreExists = self.file_exists_and_is_not_empty(self.parser.keystorePath) + truststoreExists = self.file_exists_and_is_not_empty(self.parser.truststorePath) + keyExists = self.file_exists_and_is_not_empty(self.key) + return keystoreExists and truststoreExists and keyExists + + def file_exists_and_is_not_empty(self, pathToFile): + return os.path.isfile(pathToFile) and os.path.getsize(pathToFile) > 0 + + def get_data_pem(self, path_to_env): + envs = self.parser.get_envs_as_dict(EnvsReader().read_env_list_from_file(path_to_env)) + certificate = self.get_keystore_certificate() + data = self.parser.get_owner_data_from_certificate(certificate) + data['SANS'] = self.parser.get_sans(certificate) + return type('', (object,), {"expectedData": envs, "actualData": data}) + + def get_keystore_certificate(self): + return crypto.X509.from_cryptography(self.load_x509_certificate()) + + def load_x509_certificate(self): + cert = x509.load_pem_x509_certificate(open(self.parser.keystorePath, 'rb').read(), default_backend()) + return cert diff --git a/tests/oom-platform-cert-service/certservice/resources/cert-service-keywords.robot b/tests/oom-platform-cert-service/certservice/resources/cert-service-keywords.robot new file mode 100644 index 00000000..fea210b5 --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/resources/cert-service-keywords.robot @@ -0,0 +1,154 @@ +*** Settings *** + +Resource ../../../common.robot +Resource ./cert-service-properties.robot +Library RequestsLibrary +Library HttpLibrary.HTTP +Library Collections +Library ../libraries/CertClientManager.py ${MOUNT_PATH} ${TRUSTSTORE_PATH} +Library ../libraries/P12ArtifactsValidator.py ${MOUNT_PATH} +Library ../libraries/JksArtifactsValidator.py ${MOUNT_PATH} +Library ../libraries/PemArtifactsValidator.py ${MOUNT_PATH} + +*** Keywords *** + +Create sessions + [Documentation] Create all required sessions + ${certs}= Create List ${CERTSERVICE_SERVER_CRT} ${CERTSERVICE_SERVER_KEY} + Create Client Cert Session alias ${OOMCERT_URL} client_certs=${certs} verify=${ROOTCA} + Set Suite Variable ${https_valid_cert_session} alias + +Run Healthcheck + [Documentation] Run Healthcheck + ${resp}= Get Request ${https_valid_cert_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 ${https_valid_cert_session} ${path} + Should Be Equal As Strings ${resp.status_code} ${resp_code} + +Send Get Request with Header + [Documentation] Send request to passed url + [Arguments] ${path} ${csr_file} ${pk_file} + [Return] ${resp} + ${headers}= Create Header with CSR and PK ${csr_file} ${pk_file} + ${resp}= Get Request ${https_valid_cert_session} ${path} headers=${headers} + +Send Get Request with Header And Expect Success + [Documentation] Send request to passed url and validate received response + [Arguments] ${path} ${csr_file} ${pk_file} + ${resp}= Send Get Request with Header ${path} ${csr_file} ${pk_file} + Should Be Equal As Strings ${resp.status_code} 200 + Check Message Recieved On Success ${resp.content} + +Check Message Recieved On Success + [Documentation] Check if correct messsage has been sent on successful request + [Arguments] ${content} + ${resp_content}= Parse Json ${content} + Dictionary Should Contain Key ${resp_content} certificateChain + @{list}= Get From Dictionary ${resp_content} certificateChain + List Should Contain Certificates @{list} + Dictionary Should Contain Key ${resp_content} trustedCertificates + +List Should Contain Certificates + [Documentation] Verify if list contains certificates + [Arguments] @{list} + :FOR ${content} IN @{list} + \ Should Contain ${content} BEGIN CERTIFICATE + \ Should Contain ${content} END CERTIFICATE + +Send Get Request with Header And Expect Error + [Documentation] Send request to passed url and validate received response + [Arguments] ${path} ${csr_file} ${pk_file} ${resp_code} + ${resp}= Send Get Request with Header ${path} ${csr_file} ${pk_file} + 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 ${https_valid_cert_session} ${path} + Should Be Equal As Strings ${resp.status_code} ${resp_code} + +Run Cert Service Client And Validate PKCS12 File Creation And Client Exit Code + [Documentation] Run Cert Service Client Container And Validate Exit Code + [Arguments] ${env_file} ${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 + 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} + Should Be True ${can_open} Cannot Open Keystore/TrustStore by passpshase + +Run Cert Service Client And Validate JKS File Creation And Client Exit Code + [Documentation] Run Cert Service Client Container And Validate Exit Code + [Arguments] ${env_file} ${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 Jks + 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} + Should Be True ${can_open} Cannot Open Keystore/TrustStore by passpshase + +Run Cert Service Client And Validate PKCS12 Files Contain Expected Data + [Documentation] Run Cert Service Client Container And Validate PKCS12 Files Contain Expected Data + [Arguments] ${env_file} ${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} + ${data} ${isEqual}= Get And Compare Data P12 ${env_file} + Remove Client Container And Save Logs ${CLIENT_CONTAINER_NAME} positive_path_with_data + Should Be Equal As Strings ${exit_code} ${expected_exit_code} Client return: ${exitcode} exit code, but expected: ${expected_exit_code} + Should Be True ${isEqual} Keystore doesn't contain ${data.expectedData}. Actual data is: ${data.actualData} + +Run Cert Service Client And Validate JKS Files Contain Expected Data + [Documentation] Run Cert Service Client Container And Validate JKS Files Contain Expected Data + [Arguments] ${env_file} ${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} + ${data} ${isEqual}= Get And Compare Data Jks ${env_file} + Remove Client Container And Save Logs ${CLIENT_CONTAINER_NAME} positive_path_with_data + Should Be Equal As Strings ${exit_code} ${expected_exit_code} Client return: ${exitcode} exit code, but expected: ${expected_exit_code} + Should Be True ${isEqual} Keystore doesn't contain ${data.expectedData}. Actual data is: ${data.actualData} + +Run Cert Service Client And Validate PEM Files Contain Expected Data + [Documentation] Run Cert Service Client Container And Validate PEM Files Contain Expected Data + [Arguments] ${env_file} ${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} + ${existNotEmpty}= Artifacts Exist And Are Not Empty + ${data} ${isEqual}= Get And Compare Data Pem ${env_file} + Remove Client Container And Save Logs ${CLIENT_CONTAINER_NAME} positive_path_with_data + Should Be Equal As Strings ${exit_code} ${expected_exit_code} Client return: ${exitcode} exit code, but expected: ${expected_exit_code} + Should Be True ${existNotEmpty} PEM artifacts not created properly + Should Be True ${isEqual} Keystore doesn't contain ${data.expectedData}. Actual data is: ${data.actualData} + +Run Cert Service Client And Validate Http Response Code And Client Exit Code + [Documentation] Run Cert Service Client Container And Validate Exit Code + [Arguments] ${env_file} ${expected_api_response_code} ${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_find_API_response}= Can Find Api Response In Logs ${CLIENT_CONTAINER_NAME} + ${api_response_code}= Get Api Response From Logs ${CLIENT_CONTAINER_NAME} + Remove Client Container And Save Logs ${CLIENT_CONTAINER_NAME} negative_path + Should Be True ${can_find_API_response} Cannot Find API response in logs + Should Be Equal As Strings ${api_response_code} ${expected_api_response_code} API return ${api_response_code} but expected: ${expected_api_response_code} + Should Be Equal As Strings ${exit_code} ${expected_exit_code} Client return unexpected exit code return: ${exitcode} , but expected: ${expected_exit_code} + +Run Cert Service Client And Validate Client Exit Code + [Documentation] Run Cert Service Client Container And Validate Exit Code + [Arguments] ${env_file} ${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} + Remove Client Container And Save Logs ${CLIENT_CONTAINER_NAME} negative_path + Should Be Equal As Strings ${exit_code} ${expected_exit_code} Client return unexpected exit code return: ${exitcode} , but expected: ${expected_exit_code} + diff --git a/tests/oom-platform-cert-service/certservice/resources/cert-service-properties.robot b/tests/oom-platform-cert-service/certservice/resources/cert-service-properties.robot new file mode 100644 index 00000000..ff0500a2 --- /dev/null +++ b/tests/oom-platform-cert-service/certservice/resources/cert-service-properties.robot @@ -0,0 +1,31 @@ +*** Variables *** + +${CERT_SERVICE_CONTAINER_NAME} oom-cert-service +${CERT_SERVICE_PORT} 8443 +${OOMCERT_URL} https://localhost:${cert_service_port} +${CLIENT_CA_NAME} Client +${RA_CA_NAME} RA +${CERT_SERVICE_ENDPOINT} /v1/certificate/ +${ROOTCA} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/certs/root.crt +${CERTSERVICE_SERVER_CRT} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/certs/certServiceServer.crt +${CERTSERVICE_SERVER_KEY} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/certs/certServiceServer.key +${VALID_CLIENT_CSR_FILE} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/valid_client.csr +${VALID_CLIENT_PK_FILE} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/valid_client.pk +${VALID_RA_CSR_FILE} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/valid_ra.csr +${VALID_RA_PK_FILE} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/valid_ra.pk +${INVALID_CSR_FILE} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/invalid.csr +${INVALID_PK_FILE} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/invalid.key + + +${CERT_SERVICE_ADDRESS} https://${CERT_SERVICE_CONTAINER_NAME}:${CERT_SERVICE_PORT} +${VALID_ENV_FILE} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/valid_client_docker.env +${VALID_ENV_FILE_JKS} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/valid_client_docker_jks.env +${VALID_ENV_FILE_P12} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/valid_client_docker_p12.env +${VALID_ENV_FILE_PEM} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/valid_client_docker_pem.env +${INVALID_ENV_FILE_OUTPUT_TYPE} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/invalid_client_docker_output_type.env +${INVALID_ENV_FILE} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/assets/invalid_client_docker.env +${DOCKER_CLIENT_IMAGE} nexus3.onap.org:10001/onap/org.onap.oom.platform.cert-service.oom-certservice-client:latest +${CLIENT_CONTAINER_NAME} %{ClientContainerName} +${CERT_SERVICE_NETWORK} certservice_certservice +${MOUNT_PATH} %{WORKSPACE}/tests/oom-platform-cert-service/certservice/tmp +${TRUSTSTORE_PATH} %{WORKSPACE}/plans/oom-platform-cert-service/certservice/certs |