aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2/testcases/resources
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dcaegen2/testcases/resources')
-rw-r--r--tests/dcaegen2/testcases/resources/CertsLibrary.py42
-rw-r--r--tests/dcaegen2/testcases/resources/dcae_keywords.robot3
-rw-r--r--tests/dcaegen2/testcases/resources/dcae_properties.robot8
-rwxr-xr-xtests/dcaegen2/testcases/resources/gen-certs.sh10
-rwxr-xr-xtests/dcaegen2/testcases/resources/rm-certs.sh6
5 files changed, 65 insertions, 4 deletions
diff --git a/tests/dcaegen2/testcases/resources/CertsLibrary.py b/tests/dcaegen2/testcases/resources/CertsLibrary.py
new file mode 100644
index 00000000..b8189422
--- /dev/null
+++ b/tests/dcaegen2/testcases/resources/CertsLibrary.py
@@ -0,0 +1,42 @@
+
+import os
+import subprocess
+import time
+
+from robot.api import logger
+
+
+class CertsLibrary(object):
+
+ def __init__(self):
+ pass
+
+
+
+ @staticmethod
+ def generate_certs():
+ ws = os.environ['WORKSPACE']
+ script2run = ws + "/tests/dcaegen2/testcases/resources/gen-certs.sh"
+ logger.info("Running script: " + script2run)
+ logger.console("Running script: " + script2run)
+ subprocess.call([script2run, ws])
+ time.sleep(5)
+ return
+
+ @staticmethod
+ def remove_certs():
+ ws = os.environ['WORKSPACE']
+ script2run = ws + "/tests/dcaegen2/testcases/resources/rm-certs.sh"
+ logger.info("Running script: " + script2run)
+ logger.console("Running script: " + script2run)
+ subprocess.call([script2run, ws])
+ time.sleep(5)
+ return
+
+
+
+
+
+
+
+
diff --git a/tests/dcaegen2/testcases/resources/dcae_keywords.robot b/tests/dcaegen2/testcases/resources/dcae_keywords.robot
index 16a8a8ae..0011ab88 100644
--- a/tests/dcaegen2/testcases/resources/dcae_keywords.robot
+++ b/tests/dcaegen2/testcases/resources/dcae_keywords.robot
@@ -4,6 +4,7 @@ Library RequestsLibrary
Library DcaeLibrary
Library OperatingSystem
Library Collections
+Library CertsLibrary
Variables ../resources/DcaeVariables.py
Resource ../../../common.robot
Resource ../resources/dcae_properties.robot
@@ -13,7 +14,7 @@ Create sessions
[Documentation] Create all required sessions
${auth}= Create List ${VESC_HTTPS_USER} ${VESC_HTTPS_PD}
${wrong_auth}= Create List ${VESC_HTTPS_WRONG_USER} ${VESC_HTTPS_WRONG_PD}
- ${certs}= Create List ${VESC_ROOTCA_CERT} ${VESC_ROOTCA_KEY}
+ ${certs}= Create List ${VESC_CERT} ${VESC_KEY}
${wrong_certs}= Create List ${VESC_WRONG_CERT} ${VESC_WRONG_KEY}
${outdated_certs}= Create List ${VESC_OUTDATED_CERT} ${VESC_OUTDATED_KEY}
Create Session dcae_vesc_url ${VESC_URL}
diff --git a/tests/dcaegen2/testcases/resources/dcae_properties.robot b/tests/dcaegen2/testcases/resources/dcae_properties.robot
index de5519ee..119ef236 100644
--- a/tests/dcaegen2/testcases/resources/dcae_properties.robot
+++ b/tests/dcaegen2/testcases/resources/dcae_properties.robot
@@ -4,6 +4,7 @@ Documentation store all properties that can change or are used in multipl
... make sure you prepend them with GLOBAL so that other files can easily see it is from this file.
*** Variables ***
+
${GLOBAL_APPLICATION_ID} robot-dcaegen2
${GLOBAL_DCAE_CONSUL_URL} http://135.205.228.129:8500
${GLOBAL_DCAE_CONSUL_URL1} http://135.205.228.170:8500
@@ -14,8 +15,8 @@ ${VESC_HTTPS_USER} sample1
${VESC_HTTPS_PD} sample1
${VESC_HTTPS_WRONG_PD} sample
${VESC_HTTPS_WRONG_USER} sample
-${VESC_ROOTCA_CERT} %{WORKSPACE}/tests/dcaegen2/testcases/assets/certs/rootCA.crt
-${VESC_ROOTCA_KEY} %{WORKSPACE}/tests/dcaegen2/testcases/assets/certs/rootCAdec.key
+${VESC_CERT} %{WORKSPACE}/tests/dcaegen2/testcases/assets/certs/temporary.crt
+${VESC_KEY} %{WORKSPACE}/tests/dcaegen2/testcases/assets/certs/temporary.key
${VESC_WRONG_CERT} %{WORKSPACE}/tests/dcaegen2/testcases/assets/certs/wrong.crt
${VESC_WRONG_KEY} %{WORKSPACE}/tests/dcaegen2/testcases/assets/certs/wrong.key
${VESC_OUTDATED_CERT} %{WORKSPACE}/tests/dcaegen2/testcases/assets/certs/outdated.crt
@@ -44,4 +45,5 @@ ${CONFIG_BINDING_URL} http://localhost:8443
${CB_HEALTHCHECK_PATH} /healthcheck
${CB_SERVICE_COMPONENT_PATH} /service_component/
${VES_Service_Name1} dcae-controller-ves-collector
-${VES_Service_Name2} ves-collector-not-exist \ No newline at end of file
+${VES_Service_Name2} ves-collector-not-exist
+
diff --git a/tests/dcaegen2/testcases/resources/gen-certs.sh b/tests/dcaegen2/testcases/resources/gen-certs.sh
new file mode 100755
index 00000000..f3f358f9
--- /dev/null
+++ b/tests/dcaegen2/testcases/resources/gen-certs.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+WS=$1
+dir=$WS/tests/dcaegen2/testcases/assets/certs
+
+openssl genrsa -out "$dir/temporary.key" 2048
+
+openssl req -new -key "$dir/temporary.key" -subj "/C=PL/ST=DL/O=Nokia/CN=dcaegen2" -out "$dir/temporary.csr"
+
+openssl x509 -req -in "$dir/temporary.csr" -CA "$dir/rootCA.crt" -CAkey "$dir/rootCA.key" -passin pass:collector -CAcreateserial -out "$dir/temporary.crt" -days 1 -sha256
diff --git a/tests/dcaegen2/testcases/resources/rm-certs.sh b/tests/dcaegen2/testcases/resources/rm-certs.sh
new file mode 100755
index 00000000..827849c7
--- /dev/null
+++ b/tests/dcaegen2/testcases/resources/rm-certs.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+WS=$1
+dir=$WS/tests/dcaegen2/testcases/assets/certs
+
+rm "$dir/temporary.crt" "$dir/temporary.csr" "$dir/temporary.key" "$dir/rootCA.srl" \ No newline at end of file