Merge "Update certs for pmmapper in Bulkpm usecase"
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>
Tue, 3 Mar 2020 14:22:22 +0000 (14:22 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 3 Mar 2020 14:22:22 +0000 (14:22 +0000)
42 files changed:
plans/aaf/certservice/docker-compose.yml [new file with mode: 0644]
plans/aaf/certservice/scripts/ejbca-configuration.sh [new file with mode: 0755]
plans/aaf/certservice/setup.sh
plans/aaf/certservice/teardown.sh
plans/dcaegen2-services-bbs-event-processor/bbs-testsuites/setup.sh
plans/dcaegen2-services-bbs-event-processor/bbs-testsuites/testplan.txt
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/__init__.robot [moved from tests/dcaegen2/bbs-testcases/__init__.robot with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/aai_records/aai_pnf_not_found.json [moved from tests/dcaegen2/bbs-testcases/assets/aai_records/aai_pnf_not_found.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/aai_records/aai_pnfs.json [moved from tests/dcaegen2/bbs-testcases/assets/aai_records/aai_pnfs.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/aai_records/aai_services.json [moved from tests/dcaegen2/bbs-testcases/assets/aai_records/aai_services.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_event_with_all_fields.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_all_fields.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_event_with_missing_new_old_state.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_new_old_state.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_event_with_missing_rgmac.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_rgmac.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_event_with_missing_sourceName.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_sourceName.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_event_with_wrong_sourceName.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_wrong_sourceName.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_event_without_swversion.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_without_swversion.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_not_json_format.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/auth_not_json_format.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_policy_with_all_fields.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/auth_policy_with_all_fields.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/update_event_with_all_fields.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_all_fields.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/update_event_with_missing_attachment.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_missing_attachment.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/update_event_with_missing_correlation.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_missing_correlation.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/update_event_with_wrong_correlation.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_wrong_correlation.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/update_not_json_format.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/update_not_json_format.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/update_policy_with_all_fields.json [moved from tests/dcaegen2/bbs-testcases/assets/json_events/update_policy_with_all_fields.json with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/bbs_tests.robot [moved from tests/dcaegen2/bbs-testcases/bbs_tests.robot with 74% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/BbsLibrary.py [moved from tests/dcaegen2/bbs-testcases/resources/BbsLibrary.py with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/bbs_library.robot [moved from tests/dcaegen2/bbs-testcases/resources/bbs_library.robot with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/docker-compose.yml [moved from tests/dcaegen2/bbs-testcases/resources/docker-compose.yml with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/AAI.py [moved from tests/dcaegen2/bbs-testcases/resources/simulator/AAI.py with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/AAI_simulator [moved from tests/dcaegen2/bbs-testcases/resources/simulator/AAI_simulator with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/DMaaP.py [moved from tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP.py with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/DMaaP_simulator [moved from tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP_simulator with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/certs/aai_aai.onap.org.cer [moved from tests/dcaegen2/bbs-testcases/resources/simulator/certs/aai_aai.onap.org.cer with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/certs/ca_local_0.cer [moved from tests/dcaegen2/bbs-testcases/resources/simulator/certs/ca_local_0.cer with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/certs/dmaap_bc_topic_mgr_dmaap_bc.onap.org.cer [moved from tests/dcaegen2/bbs-testcases/resources/simulator/certs/dmaap_bc_topic_mgr_dmaap_bc.onap.org.cer with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/certs/keystore.password [moved from tests/dcaegen2/bbs-testcases/resources/simulator/certs/keystore.password with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/certs/org.onap.aai.key [moved from tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.aai.key with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/certs/org.onap.dcae.jks [moved from tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.jks with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/certs/org.onap.dcae.trust.jks [moved from tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.trust.jks with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/certs/org.onap.dmaap-bc.key [moved from tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dmaap-bc.key with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/certs/truststore.password [moved from tests/dcaegen2/bbs-testcases/resources/simulator/certs/truststore.password with 100% similarity]
tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/simulator/httpServerLib.py [moved from tests/dcaegen2/bbs-testcases/resources/simulator/httpServerLib.py with 100% similarity]

diff --git a/plans/aaf/certservice/docker-compose.yml b/plans/aaf/certservice/docker-compose.yml
new file mode 100644 (file)
index 0000000..84da735
--- /dev/null
@@ -0,0 +1,33 @@
+version: "2.1"
+
+services:
+  ejbca:
+    image: primekey/ejbca-ce
+    hostname: cahostname
+    container_name: aafcert-ejbca
+    ports:
+        - "80:8080"
+        - "443:8443"
+    volumes:
+        - $SCRIPTS_PATH:/opt/primekey/scripts
+    command: bash -c "
+      ./scripts/ejbca-configuration.sh &
+      /opt/primekey/bin/start.sh
+      "
+    healthcheck:
+      test: ["CMD-SHELL", "curl -kI https://localhost:8443/ejbca/publicweb/healthcheck/ejbcahealth"]
+      interval: 10s
+      timeout: 3s
+      retries: 9
+
+  certservice:
+    image: nexus3.onap.org:10001/onap/org.onap.aaf.certservice.aaf-certservice-api:latest
+    volumes:
+      - $CONFIGURATION_PATH:/etc/onap/aaf/certservice/cmpServers.json
+    container_name: aafcert
+    ports:
+      - "8080:8080"
+    depends_on:
+      ejbca:
+        condition: service_healthy
+
diff --git a/plans/aaf/certservice/scripts/ejbca-configuration.sh b/plans/aaf/certservice/scripts/ejbca-configuration.sh
new file mode 100755 (executable)
index 0000000..cdff77d
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+waitForEjbcaStartUp() {
+    sleep $1
+}
+
+configureEjbca() {
+    ejbca.sh config cmp addalias --alias cmpRA
+    ejbca.sh config cmp updatealias --alias cmpRA --key operationmode --value ra
+    ejbca.sh ca editca --caname ManagementCA --field cmpRaAuthSecret --value mypassword
+    ejbca.sh config cmp dumpalias --alias cmpRA
+    ejbca.sh config cmp addalias --alias cmp
+    ejbca.sh config cmp updatealias --alias cmp --key allowautomatickeyupdate --value true
+    ejbca.sh ra addendentity --username Node123 --dn "CN=Node123" --caname ManagementCA --password mypassword --type 1 --token USERGENERATED
+    ejbca.sh ra setclearpwd --username Node123 --password mypassword
+    ejbca.sh config cmp updatealias --alias cmp --key extractusernamecomponent --value CN
+    ejbca.sh config cmp dumpalias --alias cmp
+    ejbca.sh ca getcacert --caname ManagementCA -f /dev/stdout > cacert.pem
+}
+
+waitForEjbcaStartUp 30
+configureEjbca
index 1bf5747..4911e47 100644 (file)
 # limitations under the License.
 #
 
-AAFCERT_IMAGE=nexus3.onap.org:10001/onap/org.onap.aaf.certservice.aaf-certservice-api:latest
-
-echo AAFCERT_IMAGE=${AAFCERT_IMAGE}
-
 # ------------------------------------
-# Resolve path to cmp servers configuration
+# Resolve path to script's folder and cmp servers configuration
 
 SCRIPT=`realpath $0`
 CURRENT_WORKDIR_PATH=`dirname $SCRIPT`
 
+SCRIPTS_DIRECTORY="scripts"
+if test -d "$CURRENT_WORKDIR_PATH/plans/aaf/certservice/$SCRIPTS_DIRECTORY"; then
+    SCRIPTS_PATH="$CURRENT_WORKDIR_PATH/plans/aaf/certservice/$SCRIPTS_DIRECTORY"
+else test -f "$CURRENT_WORKDIR_PATH/$SCRIPTS_DIRECTORY";
+    SCRIPTS_PATH=$CURRENT_WORKDIR_PATH/$SCRIPTS_DIRECTORY
+fi
+echo "Use scripts from: $SCRIPTS_PATH"
+
 CONFIGURATION_FILE="cmpServers.json"
 if test -f "$CURRENT_WORKDIR_PATH/plans/aaf/certservice/$CONFIGURATION_FILE"; then
     CONFIGURATION_PATH="$CURRENT_WORKDIR_PATH/plans/aaf/certservice/$CONFIGURATION_FILE"
@@ -32,14 +36,17 @@ else test -f "$CURRENT_WORKDIR_PATH/$CONFIGURATION_FILE";
     CONFIGURATION_PATH=$CURRENT_WORKDIR_PATH/$CONFIGURATION_FILE
 fi
 echo "Use configuration from: $CONFIGURATION_PATH"
+
 # -------------------------------------
 
-# Start AAF Cert Srevice
-docker run -p 8080:8080 -d --mount type=bind,source=${CONFIGURATION_PATH},target=/etc/onap/aaf/certservice/cmpServers.json --name aafcert ${AAFCERT_IMAGE}
+export CONFIGURATION_PATH=${CONFIGURATION_PATH}
+export SCRIPTS_PATH=${SCRIPTS_PATH}
+
+docker-compose up -d
 
 AAFCERT_IP=`get-instance-ip.sh aafcert`
 export AAFCERT_IP=${AAFCERT_IP}
 
 # Wait container ready
-sleep 5
+sleep 10
 
index a613944..3f10eae 100644 (file)
@@ -15,4 +15,5 @@
 # limitations under the License.
 #
 
-kill-instance.sh aafcert
\ No newline at end of file
+kill-instance.sh aafcert
+kill-instance.sh aafcert-ejbca
\ No newline at end of file
index 9551ce4..2d631cc 100644 (file)
@@ -7,7 +7,7 @@ export BBS_SERVICE="bbs"
 export DMAAP_SIMULATOR="dmaap_simulator"
 export AAI_SIMULATOR="aai_simulator"
 
-cd ${WORKSPACE}/tests/dcaegen2/bbs-testcases/resources/
+cd ${WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/resources/
 
 pip uninstall -y docker-py
 pip uninstall -y docker
index 9f1794b..2d774a6 100644 (file)
@@ -1,3 +1,3 @@
 # Test suites are relative paths under [integration/csit.git]/tests/.
 # Place the suites in run order.
-dcaegen2/bbs-testcases
+dcaegen2-services-bbs-event-processor/bbs-testcases
@@ -11,23 +11,23 @@ Test Teardown     Reset Simulators
 *** Variables ***
 ${DMAAP_SIMULATOR_SETUP_URL}    http://${DMAAP_SIMULATOR_SETUP}
 ${AAI_SIMULATOR_SETUP_URL}    http://${AAI_SIMULATOR_SETUP}
-${AUTH_EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_all_fields.json
-${AUTH_EVENT_WITH_WRONG_SOURCENAME}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_wrong_sourceName.json
-${AUTH_EVENT_WITHOUT_SWVERSION}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_without_swversion.json
-${AUTH_EVENT_WITH_MISSING_RGMAC}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_rgmac.json
-${AUTH_EVENT_WITH_MISSING_STATE}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_new_old_state.json
-${AUTH_EVENT_WITH_MISSING_SOURCENAME}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_sourceName.json
-${AUTH_NOT_JSON_FORMAT}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_not_json_format.json
-${AUTH_POLICY}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_policy_with_all_fields.json
-${UPDATE_EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_all_fields.json
-${UPDATE_EVENT_WITH_WRONG_CORRELATION}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_wrong_correlation.json
-${UPDATE_EVENT_WITH_MISSING_ATTACHMENT}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_missing_attachment.json
-${UPDATE_EVENT_WITH_MISSING_CORRELATION}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_missing_correlation.json
-${UPDATE_NOT_JSON_FORMAT}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/update_not_json_format.json
-${UPDATE_POLICY}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/update_policy_with_all_fields.json
-${AAI_PNFS}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_pnfs.json
-${AAI_SERVICES}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_services.json
-${AAI_PNF_NOT_FOUND}    %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_pnf_not_found.json
+${AUTH_EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_event_with_all_fields.json
+${AUTH_EVENT_WITH_WRONG_SOURCENAME}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_event_with_wrong_sourceName.json
+${AUTH_EVENT_WITHOUT_SWVERSION}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_event_without_swversion.json
+${AUTH_EVENT_WITH_MISSING_RGMAC}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_event_with_missing_rgmac.json
+${AUTH_EVENT_WITH_MISSING_STATE}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_event_with_missing_new_old_state.json
+${AUTH_EVENT_WITH_MISSING_SOURCENAME}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_event_with_missing_sourceName.json
+${AUTH_NOT_JSON_FORMAT}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_not_json_format.json
+${AUTH_POLICY}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/auth_policy_with_all_fields.json
+${UPDATE_EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/update_event_with_all_fields.json
+${UPDATE_EVENT_WITH_WRONG_CORRELATION}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/update_event_with_wrong_correlation.json
+${UPDATE_EVENT_WITH_MISSING_ATTACHMENT}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/update_event_with_missing_attachment.json
+${UPDATE_EVENT_WITH_MISSING_CORRELATION}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/update_event_with_missing_correlation.json
+${UPDATE_NOT_JSON_FORMAT}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/update_not_json_format.json
+${UPDATE_POLICY}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/json_events/update_policy_with_all_fields.json
+${AAI_PNFS}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/aai_records/aai_pnfs.json
+${AAI_SERVICES}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/aai_records/aai_services.json
+${AAI_PNF_NOT_FOUND}    %{WORKSPACE}/tests/dcaegen2-services-bbs-event-processor/bbs-testcases/assets/aai_records/aai_pnf_not_found.json
 
 *** Test Cases ***
 Valid DMaaP CPE_AUTHENTICATION event can trigger Policy