aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plans/aaf/certservice/setup.sh30
-rw-r--r--plans/aaf/certservice/teardown.sh18
-rwxr-xr-xplans/aaf/certservice/testplan.txt3
-rw-r--r--tests/aaf/certservice/assets/invalid.csr1
-rw-r--r--tests/aaf/certservice/assets/invalid.key1
-rw-r--r--tests/aaf/certservice/assets/valid.csr1
-rw-r--r--tests/aaf/certservice/assets/valid.key1
-rw-r--r--tests/aaf/certservice/cert-service-test.robot29
-rw-r--r--tests/aaf/certservice/resources/cert-service-keywords.robot36
-rw-r--r--tests/aaf/certservice/resources/cert-service-properties.robot9
10 files changed, 129 insertions, 0 deletions
diff --git a/plans/aaf/certservice/setup.sh b/plans/aaf/certservice/setup.sh
new file mode 100644
index 00000000..461472a3
--- /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:1.0.0
+
+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/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 @@
+LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJRExEQ0NBaFFDQVFBd2daQXhDekFKQmdOVkJBWVRBbEJNTVJZd0ZBWURWUVFJREExTWIzZGxjaTFUYVd4bGMybGhNUkF3RGdZRFZRUUhEQWRYY205amJHRjNNUTR3REFZRFZRUUtEQVZPYjJ0cFlURU5NQXNHQTFVRU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nRCVUhEQWZsUG5DTmhXU3hMREhTSkZhWHhERkpGbjhpT1FhdDkvUmNERHc2M0lrbWVaLzBWWDhVRjRsaWp2VWcxSGc4WUFrdXVOQnNwTmRDY2FFVFZFUHJwS3BjaFQxdDg1YnA2RnppSHczc3ZCVTM2cmhzUGNQVU5IM1NYT2tVcmZlOXp0RmJzUFB4dmJtZWx1MWEwS2FudmhDbEU0Z1dMT2tWb1k2Q0hlUktYeU0KLS0tLS1FTkQgQ0VSVElGSUNBVEUgUkVRVUVTVC0tLS0t \ No newline at end of file
diff --git a/tests/aaf/certservice/assets/valid.key b/tests/aaf/certservice/assets/valid.key
new file mode 100644
index 00000000..6783af52
--- /dev/null
+++ b/tests/aaf/certservice/assets/valid.key
@@ -0,0 +1 @@
+LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2UUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktjd2dnU2pBZ0VBQW9JQkFRREczMFlGSjA5N20vN3QyUFdaRWxMQTZieWxXOWdZNHAzaHdzYnQvaWhDaisxakRvWERXaUJNMDF1RndQalpjYml4cEdwUHV3VVN2VkRFMzlLcFAxR0tzQmFXKzB3S2RtNkoreGJjemUwRHNDekFIQk5zWFVyRCt1c2QvY1VMTlZuVHl0WWM2bm5BdVUrMEM4NFNZejhlZFRyeFFlZEpheDAwWkt2K3R5blZ2b1lLclVRbDJRa0wyOGxYYWlrMXViM3dRRnhTUHZ3RDNsbjFPNTdpNFpPYTh5TXFsdjZabE5MWWJ4NlBYbHNUampwVk5XT1JZTys3c3lnYnhGdGx2L2xIMjdQSEh2SU9wVFJrRndJVS80R1l1Nm5UNGwwamJJdFRBNG9nYVBUem94aHRuY2krS09VVXlWeDlpOHlnd3FQVG93eVBZMjRqUm9sU3d0QUFqQ2JCQWdNQkFBRUNnZ0VBTHdIcHFDQXhubk15SUFCdmxSNEtwNFRZVFhIWE01S2xaUTdJUE1zZHN4WVlNNWprTDFmbldLR0ErYTJ5Wk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VTlOcFlBSGxNYk5HSG1vbVlyRUpURVRoazNRS0JnR1FCRm5kNHY4M2tnNENpK3lhSFExRXZPVlNRZldBZ25wZ0todWVObHdvM2tXNnN2aTk3Zy9ORE5wWTNZRG8rRkV1OU1sd1N0c3FNUmRwejQ3eW9JTE8xSUc5MmpxekNTQnVHVUJDQUpPSVZQT0lmSGFNYklBQmZmQzZwK3QyeEFRMkRUbzFkaVVhbi8rVEgyR2ZyWm9OOW1xeGxRcFBycE84N1o5Tis1TGpsQW9HQVhFQXI5Vmo5WmF3bE5yV0VZYjgyN1J6NVNFZkFjSmFFeTVhVzFUVWNzZVc0bWgwYmNuTzVCSHQvYTFmN3VoQmJoY2xQVFlPOTBSNGpLcUtGK2lVa2VDRHV0TmcrM09ncTdKaS9PWk5vajRSaUM1WWV4TWs5d1kxc3NVV0pqbDVoUURpd1BRQU5Zc09TSWxOT3Z2SWpydG81RnhNWVN5UndHamYrYnRSTzIyYz0KLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLQ== \ 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..cc72eb66
--- /dev/null
+++ b/tests/aaf/certservice/cert-service-test.robot
@@ -0,0 +1,29 @@
+*** 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 Send Valid CSR and Valid PK
+ [Tags] AAF-CERT-SERVICE
+ [Documentation] Send request to /v1/certificate/test endpoint and expect 200
+ Send Request And Validate Response ${CERT_PATH} ${VALID_CSR_FILE} ${VALID_PK_FILE} 200
+
+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 Request 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 Request 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..caec55aa
--- /dev/null
+++ b/tests/aaf/certservice/resources/cert-service-keywords.robot
@@ -0,0 +1,36 @@
+*** 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
+
+Send Request And Validate Response
+ [Documentation] Send request to passed url and validate received response
+ [Arguments] ${path} ${csr_file} ${pk_file} ${resp_code}
+ ${csr}= Get Data From File ${csr_file}
+ ${pk}= Get Data From File ${pk_file}
+ ${headers}= Create Dictionary CSR=${csr} PK=${pk}
+ ${resp}= Get Request ${http_session} ${path} headers=${headers}
+ Should Be Equal As Strings ${resp.status_code} ${resp_code}
+
+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} \ 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