From 45ca2f3dbe44eacd3f2e574c4f0ad429a7d6607e Mon Sep 17 00:00:00 2001 From: "Bryan T. Richardson" Date: Wed, 20 Mar 2024 14:46:22 -0600 Subject: [PATCH] Add new single demo script for all ISO 15118-2 AC with OCPP demos This new script includes option flags for which demo to run. It also enables the option to test a user's local copy of this repo without having to edit the script or push commits up to GitHub first. Note that the OCPP v1.6j demo is currently not working with this new script (though it also wasn't working with the old script either). Signed-off-by: Bryan T. Richardson --- README.md | 8 +- demo-iso15118-2-ac-plus-ocpp.sh | 192 +++++++++++++++++++++++++ demo-iso15118-2-ac-plus-ocpp16j.sh | 34 ----- demo-iso15118-2-ac-plus-ocpp201.sh | 63 -------- demo-iso15118-2-ac-plus-ocpp201.sp1.sh | 96 ------------- demo-iso15118-2-ac-plus-ocpp201.sp2.sh | 99 ------------- demo-iso15118-2-ac-plus-ocpp201.sp3.sh | 101 ------------- docker-compose.ocpp201.sp2.yml | 37 ----- docker-compose.ocpp201.yml | 4 +- maeve/maeve-csms-everest-org.patch | 13 ++ maeve/maeve-csms-no-lb.patch | 63 ++++++++ maeve/maeve-csms-no-wss.patch | 29 ++++ maeve/maeve-csms.patch | 20 --- 13 files changed, 306 insertions(+), 453 deletions(-) create mode 100755 demo-iso15118-2-ac-plus-ocpp.sh delete mode 100755 demo-iso15118-2-ac-plus-ocpp16j.sh delete mode 100755 demo-iso15118-2-ac-plus-ocpp201.sh delete mode 100755 demo-iso15118-2-ac-plus-ocpp201.sp1.sh delete mode 100755 demo-iso15118-2-ac-plus-ocpp201.sp2.sh delete mode 100755 demo-iso15118-2-ac-plus-ocpp201.sp3.sh delete mode 100644 docker-compose.ocpp201.sp2.yml create mode 100644 maeve/maeve-csms-everest-org.patch create mode 100644 maeve/maeve-csms-no-lb.patch create mode 100644 maeve/maeve-csms-no-wss.patch delete mode 100644 maeve/maeve-csms.patch diff --git a/README.md b/README.md index 432d11dc..61e5f21e 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,12 @@ in your terminal before one of the one-liners presented in the next section. - 🚨 ISO 15118 DC Charging ⚡: `curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-iso15118-2-dc.sh | bash` - 🚨 Two EVSE Charging ⚡: `curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-two-evse.sh | bash` - 🚨 E2E Automated Tests ⚡: `curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-automated-testing.sh | bash` - - 🚨 Basic and ISO 15118-2 AC Charging with OCPP 1.6J CSMS (StEVe) ⚡: `curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-iso15118-2-ac-plus-ocpp16j.sh | bash` - - 🚨 Basic and ISO 15118-2 AC Charging with OCPP 201 CSMS (MaEVe) ⚡: `curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-iso15118-2-ac-plus-ocpp201.sh | bash` + - 🚨 Basic and ISO 15118-2 AC Charging with OCPP 1.6J CSMS (StEVe) ⚡: `curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-iso15118-2-ac-plus-ocpp.sh | bash -s -- -j` + - 🚨 Basic and ISO 15118-2 AC Charging with OCPP 2.0.1 CSMS (MaEVe Security Profile 1) ⚡: `curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-iso15118-2-ac-plus-ocpp.sh | bash -s -- -1` + - 🚨 Basic and ISO 15118-2 AC Charging with OCPP 2.0.1 CSMS (MaEVe Security Profile 2) ⚡: `curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-iso15118-2-ac-plus-ocpp.sh | bash -s -- -2` + - 🚨 Basic and ISO 15118-2 AC Charging with OCPP 2.0.1 CSMS (MaEVe Security Profile 3) ⚡: `curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-iso15118-2-ac-plus-ocpp.sh | bash -s -- -3` + +> NOTE: the `Basic and ISO 15118-2 AC Charging with OCPP 1.6J CSMS (StEVe)` demo is known to fail intermittently, and will not be fixed. ### STEP 2: Interact with the demo - Open the `nodered` flows to understand the module flows at http://127.0.0.1:1880 diff --git a/demo-iso15118-2-ac-plus-ocpp.sh b/demo-iso15118-2-ac-plus-ocpp.sh new file mode 100755 index 00000000..add0fa69 --- /dev/null +++ b/demo-iso15118-2-ac-plus-ocpp.sh @@ -0,0 +1,192 @@ +#!/usr/bin/env bash + + +DEMO_REPO="https://github.com/everest/everest-demo.git" +DEMO_BRANCH="main" + +MAEVE_REPO="https://github.com/thoughtworks/maeve-csms.git" +MAEVE_BRANCH="b990d0eddf2bf80be8d9524a7b08029fbb305c7d" # patch files are based on this commit + + +usage="usage: $(basename "$0") [-r ] [-b ] [-j|1|2|3] [-h] + +This script will run EVerest ISO 15118-2 AC charging with OCPP demos. + +Pro Tip: to use a local copy of this everest-demo repo, provide the current +directory to the -r option (e.g., '-r \$(pwd)'). + +where: + -r URL to everest-demo repo to use (default: $DEMO_REPO) + -b Branch of everest-demo repo to use (default: $DEMO_BRANCH) + -j OCPP v1.6j + -1 OCPP v2.0.1 Security Profile 1 + -2 OCPP v2.0.1 Security Profile 2 + -3 OCPP v2.0.1 Security Profile 3 + -h Show this message" + + +DEMO_VERSION= +DEMO_COMPOSE_FILE_NAME= + + +# loop through positional options/arguments +while getopts ':r:b:j123h' option; do + case "$option" in + r) DEMO_REPO="$OPTARG" ;; + b) DEMO_BRANCH="$OPTARG" ;; + j) DEMO_VERSION="v1.6j" + DEMO_COMPOSE_FILE_NAME="docker-compose.ocpp16j.yml" ;; + 1) DEMO_VERSION="v2.0.1-sp1" + DEMO_COMPOSE_FILE_NAME="docker-compose.ocpp201.yml" ;; + 2) DEMO_VERSION="v2.0.1-sp2" + DEMO_COMPOSE_FILE_NAME="docker-compose.ocpp201.yml" ;; + 3) DEMO_VERSION="v2.0.1-sp3" + DEMO_COMPOSE_FILE_NAME="docker-compose.ocpp201.yml" ;; + h) echo -e "$usage"; exit ;; + \?) echo -e "illegal option: -$OPTARG\n" >&2 + echo -e "$usage" >&2 + exit 1 ;; + esac +done + + +if [[ ! "${DEMO_VERSION}" ]]; then + echo 'Error: no demo version option provided.' + echo + echo -e "$usage" + + exit 1 +fi + + +DEMO_DIR="$(mktemp -d)" + + +if [[ ! "${DEMO_DIR}" || ! -d "${DEMO_DIR}" ]]; then + echo 'Error: Failed to create a temporary directory for the demo.' + exit 1 +fi + + +delete_temporary_directory() { rm -rf "${DEMO_DIR}"; } +trap delete_temporary_directory EXIT + + +echo "DEMO REPO: $DEMO_REPO" +echo "DEMO BRANCH: $DEMO_BRANCH" +echo "DEMO VERSION: $DEMO_VERSION" +echo "DEMO CONFIG: $DEMO_COMPOSE_FILE_NAME" +echo "DEMO DIR: $DEMO_DIR" + + +cd "${DEMO_DIR}" || exit 1 + + +echo "Cloning EVerest from ${DEMO_REPO} into ${DEMO_DIR}/everest-demo" +git clone --branch "${DEMO_BRANCH}" "${DEMO_REPO}" everest-demo + +if [[ "$DEMO_VERSION" != v1.6j ]]; then + echo "Cloning MaEVe CSMS from ${MAEVE_REPO} into ${DEMO_DIR}/maeve-csms and starting it" + git clone ${MAEVE_REPO} maeve-csms + + pushd maeve-csms || exit 1 + + git reset --hard ${MAEVE_BRANCH} + cp ../everest-demo/manager/cached_certs_correct_name.tar.gz . + + echo "Patching the CSMS to disable load balancer" + patch -p1 -i ../everest-demo/maeve/maeve-csms-no-lb.patch + + if [[ "$DEMO_VERSION" =~ sp2 || "$DEMO_VERSION" =~ sp3 ]]; then + echo "Copying certs into ${DEMO_DIR}/maeve-csms/config/certificates" + tar xf cached_certs_correct_name.tar.gz + cat dist/etc/everest/certs/client/csms/CSMS_LEAF.pem \ + dist/etc/everest/certs/ca/csms/CPO_SUB_CA2.pem \ + dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem \ + > config/certificates/csms.pem + cat dist/etc/everest/certs/ca/csms/CPO_SUB_CA2.pem \ + dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem \ + > config/certificates/trust.pem + cp dist/etc/everest/certs/client/csms/CSMS_LEAF.key config/certificates/csms.key + cp dist/etc/everest/certs/ca/v2g/V2G_ROOT_CA.pem config/certificates/root-V2G-cert.pem + + echo "Validating that the certificates are set up correctly" + openssl verify -show_chain \ + -CAfile config/certificates/root-V2G-cert.pem \ + -untrusted config/certificates/trust.pem \ + config/certificates/csms.pem + + echo "Patching the CSMS to enable EVerest organization" + patch -p1 -i ../everest-demo/maeve/maeve-csms-everest-org.patch + else + echo "Patching the CSMS to disable WSS" + patch -p1 -i ../everest-demo/maeve/maeve-csms-no-wss.patch + fi + + echo "Starting the CSMS" + docker compose up -d + + echo "Waiting 5s for CSMS to start..." + sleep 5 + + if [[ "$DEMO_VERSION" =~ sp1 ]]; then + echo "MaEVe CSMS started, adding charge station with Security Profile 1 (note: profiles in MaEVe start with 0 so SP-0 == OCPP SP-1)" + curl http://localhost:9410/api/v0/cs/cp001 -H 'content-type: application/json' \ + -d '{"securityProfile": 0, "base64SHA256Password": "3oGi4B5I+Y9iEkYtL7xvuUxrvGOXM/X2LQrsCwf/knA="}' + elif [[ "$DEMO_VERSION" =~ sp2 ]]; then + echo "MaEVe CSMS started, adding charge station with Security Profile 2 (note: profiles in MaEVe start with 0 so SP-1 == OCPP SP-2)" + curl http://localhost:9410/api/v0/cs/cp001 -H 'content-type: application/json' \ + -d '{"securityProfile": 1, "base64SHA256Password": "3oGi4B5I+Y9iEkYtL7xvuUxrvGOXM/X2LQrsCwf/knA="}' + elif [[ "$DEMO_VERSION" =~ sp3 ]]; then + echo "MaEVe CSMS started, adding charge station with Security Profile 3 (note: profiles in MaEVe start with 0 so SP-2 == OCPP SP-3)" + curl http://localhost:9410/api/v0/cs/cp001 -H 'content-type: application/json' -d '{"securityProfile": 2}' + fi + + echo "Charge station added, adding user token" + + curl http://localhost:9410/api/v0/token -H 'content-type: application/json' -d '{ + "countryCode": "GB", + "partyId": "TWK", + "type": "RFID", + "uid": "DEADBEEF", + "contractId": "GBTWK012345678V", + "issuer": "Thoughtworks", + "valid": true, + "cacheMode": "ALWAYS" + }' + + echo "User token added, starting EVerest..." + + popd || exit 1 +fi + + +pushd everest-demo || exit 1 +docker compose --project-name everest-ac-demo --file "${DEMO_COMPOSE_FILE_NAME}" up -d --wait + +if [[ "$DEMO_VERSION" =~ sp2 || "$DEMO_VERSION" =~ sp3 ]]; then + docker cp manager/cached_certs_correct_name.tar.gz everest-ac-demo-manager-1:/workspace/ + docker exec everest-ac-demo-manager-1 /bin/bash -c "tar xf cached_certs_correct_name.tar.gz" + + echo "Configured everest certs, validating that the chain is set up correctly" + docker exec everest-ac-demo-manager-1 /bin/bash -c "openssl verify -show_chain -CAfile dist/etc/everest/certs/ca/v2g/V2G_ROOT_CA.pem --untrusted dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem --untrusted dist/etc/everest/certs/ca/csms/CPO_SUB_CA2.pem dist/etc/everest/certs/client/csms/CSMS_LEAF.pem" +fi + +if [[ "$DEMO_VERSION" =~ sp1 ]]; then + echo "Copying device DB, configured to SecurityProfile: 1" + docker cp manager/device_model_storage_maeve_sp1.db \ + everest-ac-demo-manager-1:/workspace/dist/share/everest/modules/OCPP201/device_model_storage.db +elif [[ "$DEMO_VERSION" =~ sp2 ]]; then + echo "Copying device DB, configured to SecurityProfile: 2" + docker cp manager/device_model_storage_maeve_sp2.db \ + everest-ac-demo-manager-1:/workspace/dist/share/everest/modules/OCPP201/device_model_storage.db +elif [[ "$DEMO_VERSION" =~ sp3 ]]; then + echo "Copying device DB, configured to SecurityProfile: 3" + docker cp manager/device_model_storage_maeve_sp3.db \ + everest-ac-demo-manager-1:/workspace/dist/share/everest/modules/OCPP201/device_model_storage.db +fi + +if [[ "$DEMO_VERSION" =~ v2.0.1 ]]; then + echo "Starting software in the loop simulation" + docker exec everest-ac-demo-manager-1 sh /workspace/build/run-scripts/run-sil-ocpp201.sh +fi diff --git a/demo-iso15118-2-ac-plus-ocpp16j.sh b/demo-iso15118-2-ac-plus-ocpp16j.sh deleted file mode 100755 index 15d76db3..00000000 --- a/demo-iso15118-2-ac-plus-ocpp16j.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash - -DEMO_COMPOSE_FILE_NAME='docker-compose.ocpp16j.yml' -DEMO_DIR="$(mktemp -d)" - -delete_temporary_directory() { rm -rf "${DEMO_DIR}"; } -trap delete_temporary_directory EXIT - -if [[ ! "${DEMO_DIR}" || ! -d "${DEMO_DIR}" ]]; then - echo 'Error: Failed to create a temporary directory for the demo.' - exit 1 -fi - -download_demo_file() { - local -r repo_file_path="$1" - local -r repo_raw_url='https://raw.githubusercontent.com/everest/everest-demo/main' - local -r destination_path="${DEMO_DIR}/${repo_file_path}" - - mkdir -p "$(dirname ${destination_path})" - curl -s -o "${destination_path}" "${repo_raw_url}/${repo_file_path}" - if [[ "$?" != 0 ]]; then - echo "Error: Failed to retrieve \"${repo_file_path}\" from the demo" - echo 'repository. If this issue persists, please report this as an' - echo 'issue in the EVerest project:' - echo ' https://github.com/EVerest/EVerest/issues' - exit 1 - fi -} - -download_demo_file "${DEMO_COMPOSE_FILE_NAME}" -download_demo_file .env - -docker compose --project-name everest-ac-demo \ - --file "${DEMO_DIR}/${DEMO_COMPOSE_FILE_NAME}" up diff --git a/demo-iso15118-2-ac-plus-ocpp201.sh b/demo-iso15118-2-ac-plus-ocpp201.sh deleted file mode 100755 index be1698a3..00000000 --- a/demo-iso15118-2-ac-plus-ocpp201.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash - -DEMO_COMPOSE_FILE_NAME='docker-compose.ocpp201.yml' -DEMO_DIR="$(mktemp -d)" - -delete_temporary_directory() { rm -rf "${DEMO_DIR}"; } -trap delete_temporary_directory EXIT - -if [[ ! "${DEMO_DIR}" || ! -d "${DEMO_DIR}" ]]; then - echo 'Error: Failed to create a temporary directory for the demo.' - exit 1 -fi - -download_demo_file() { - local -r repo_file_path="$1" - local -r repo_raw_url='https://raw.githubusercontent.com/everest/everest-demo/main' - local -r destination_path="${DEMO_DIR}/${repo_file_path}" - - echo "Downloading ${repo_raw_url}/${repo_file_path} to ${destination_path}" - - mkdir -p "$(dirname ${destination_path})" - curl -s -o "${destination_path}" "${repo_raw_url}/${repo_file_path}" - if [[ "$?" != 0 ]]; then - echo "Error: Failed to retrieve \"${repo_file_path}\" from the demo" - echo 'repository. If this issue persists, please report this as an' - echo 'issue in the EVerest project:' - echo ' https://github.com/EVerest/EVerest/issues' - exit 1 - fi -} - -download_demo_file "${DEMO_COMPOSE_FILE_NAME}" -download_demo_file .env - -echo "Cloning MaEVe CSMS and starting it" -git clone https://github.com/thoughtworks/maeve-csms.git ${DEMO_DIR}/maeve-csms -pushd ${DEMO_DIR}/maeve-csms -download_demo_file "maeve/maeve-csms.patch" -mv ../maeve/maeve-csms.patch . -patch -p1 -i maeve-csms.patch -docker compose up -d -echo "MaEVe CSMS started, adding charge station" - -curl http://localhost:9410/api/v0/cs/cp001 -H 'content-type: application/json' \ - -d '{"securityProfile": 0, "base64SHA256Password": "3oGi4B5I+Y9iEkYtL7xvuUxrvGOXM/X2LQrsCwf/knA="}' - -echo "Charge station added, adding user token" - -curl http://localhost:9410/api/v0/token -H 'content-type: application/json' -d '{ - "countryCode": "GB", - "partyId": "TWK", - "type": "RFID", - "uid": "DEADBEEF", - "contractId": "GBTWK012345678V", - "issuer": "Thoughtworks", - "valid": true, - "cacheMode": "ALWAYS" -}' - -echo "User token added, starting EVerest..." - -docker compose --project-name everest-ac-demo \ - --file "${DEMO_DIR}/${DEMO_COMPOSE_FILE_NAME}" up diff --git a/demo-iso15118-2-ac-plus-ocpp201.sp1.sh b/demo-iso15118-2-ac-plus-ocpp201.sp1.sh deleted file mode 100755 index 11d5f889..00000000 --- a/demo-iso15118-2-ac-plus-ocpp201.sp1.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env bash - -DEMO_COMPOSE_FILE_NAME='docker-compose.ocpp201.sp2.yml' -DEMO_DIR="$(mktemp -d)" - -delete_temporary_directory() { rm -rf "${DEMO_DIR}"; } -trap delete_temporary_directory EXIT - -if [[ ! "${DEMO_DIR}" || ! -d "${DEMO_DIR}" ]]; then - echo 'Error: Failed to create a temporary directory for the demo.' - exit 1 -fi - -download_demo_file() { - local -r repo_file_path="$1" - local -r repo_raw_url='https://raw.githubusercontent.com/everest/everest-demo/main' - local -r destination_path="${DEMO_DIR}/${repo_file_path}" - - echo "Downloading ${repo_raw_url}/${repo_file_path} to ${destination_path}" - - mkdir -p "$(dirname ${destination_path})" - curl -s -o "${destination_path}" "${repo_raw_url}/${repo_file_path}" - if [[ "$?" != 0 ]]; then - echo "Error: Failed to retrieve \"${repo_file_path}\" from the demo" - echo 'repository. If this issue persists, please report this as an' - echo 'issue in the EVerest project:' - echo ' https://github.com/EVerest/EVerest/issues' - exit 1 - fi -} - -echo "Cloning EVerest into ${DEMO_DIR}/everest-demo" -cd ${DEMO_DIR} -git clone https://github.com/Everest/everest-demo.git everest-demo - -echo "Cloning MaEVe CSMS into ${DEMO_DIR}/maeve-csms and starting it" -git clone https://github.com/thoughtworks/maeve-csms.git maeve-csms -cp everest-demo/manager/cached_certs_correct_name.tar.gz maeve-csms -pushd maeve-csms - -echo "Copying certs into ${DEMO_DIR}/maeve-csms/config/certificates" -tar xf cached_certs_correct_name.tar.gz -cat dist/etc/everest/certs/client/csms/CSMS_LEAF.pem \ - dist/etc/everest/certs/ca/csms/CPO_SUB_CA2.pem \ - dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem \ - > config/certificates/csms.pem -cat dist/etc/everest/certs/ca/csms/CPO_SUB_CA2.pem \ - dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem \ - > config/certificates/trust.pem -cp dist/etc/everest/certs/client/csms/CSMS_LEAF.key config/certificates/csms.key -cp dist/etc/everest/certs/ca/v2g/V2G_ROOT_CA.pem config/certificates/root-V2G-cert.pem - -echo "Validating that the certificates are set up correctly" -openssl verify -show_chain \ - -CAfile config/certificates/root-V2G-cert.pem \ - -untrusted config/certificates/trust.pem \ - config/certificates/csms.pem - -echo "Starting the CSMS" -docker compose up -d - -echo "Waiting 10s for CSMS to start..." -sleep 10 - -echo "MaEVe CSMS started, adding charge station. Note that profiles in MaEVe start with 0 so SP 0 == OCPP SP 1" -curl http://localhost:9410/api/v0/cs/cp001 -H 'content-type: application/json' \ - -d '{"securityProfile": 0, "base64SHA256Password": "3oGi4B5I+Y9iEkYtL7xvuUxrvGOXM/X2LQrsCwf/knA="}' - -echo "Charge station added, adding user token" -curl http://localhost:9410/api/v0/token -H 'content-type: application/json' -d '{ - "countryCode": "GB", - "partyId": "TWK", - "type": "RFID", - "uid": "DEADBEEF", - "contractId": "GBTWK012345678V", - "issuer": "Thoughtworks", - "valid": true, - "cacheMode": "ALWAYS" -}' - -echo "User token added, starting EVerest..." -popd - -pushd everest-demo -docker compose --project-name everest-ac-demo \ - --file "${DEMO_COMPOSE_FILE_NAME}" up -d --wait - -ls -al manager - -echo "Copying device DB, configured to SecurityProfile: 1" -docker cp manager/device_model_storage_maeve_sp1.db everest-ac-demo-manager-1:/workspace/dist/share/everest/modules/OCPP201/device_model_storage.db - -echo "Starting software in the loop simulation" -docker exec -it everest-ac-demo-manager-1 sh /workspace/build/run-scripts/run-sil-ocpp201.sh - -# echo "All configuration done, please run 'docker exec -it everest-ac-demo-manager-1 /bin/bash' and then (in the container) 'sh ./build/run-scripts/run-sil-ocpp201.sh'" diff --git a/demo-iso15118-2-ac-plus-ocpp201.sp2.sh b/demo-iso15118-2-ac-plus-ocpp201.sp2.sh deleted file mode 100755 index 2e7ed18b..00000000 --- a/demo-iso15118-2-ac-plus-ocpp201.sp2.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env bash - -DEMO_COMPOSE_FILE_NAME='docker-compose.ocpp201.sp2.yml' -DEMO_DIR="$(mktemp -d)" - -delete_temporary_directory() { rm -rf "${DEMO_DIR}"; } -trap delete_temporary_directory EXIT - -if [[ ! "${DEMO_DIR}" || ! -d "${DEMO_DIR}" ]]; then - echo 'Error: Failed to create a temporary directory for the demo.' - exit 1 -fi - -download_demo_file() { - local -r repo_file_path="$1" - local -r repo_raw_url='https://raw.githubusercontent.com/everest/everest-demo/main' - local -r destination_path="${DEMO_DIR}/${repo_file_path}" - - echo "Downloading ${repo_raw_url}/${repo_file_path} to ${destination_path}" - - mkdir -p "$(dirname ${destination_path})" - curl -s -o "${destination_path}" "${repo_raw_url}/${repo_file_path}" - if [[ "$?" != 0 ]]; then - echo "Error: Failed to retrieve \"${repo_file_path}\" from the demo" - echo 'repository. If this issue persists, please report this as an' - echo 'issue in the EVerest project:' - echo ' https://github.com/EVerest/EVerest/issues' - exit 1 - fi -} - -echo "Cloning EVerest into ${DEMO_DIR}/everest-demo" -cd ${DEMO_DIR} -git clone https://github.com/everest/everest-demo.git everest-demo - -echo "Cloning MaEVe CSMS into ${DEMO_DIR}/maeve-csms and starting it" -git clone https://github.com/thoughtworks/maeve-csms.git maeve-csms -cp everest-demo/manager/cached_certs_correct_name.tar.gz maeve-csms -pushd maeve-csms - -echo "Copying certs into ${DEMO_DIR}/maeve-csms/config/certificates" -tar xf cached_certs_correct_name.tar.gz -cat dist/etc/everest/certs/client/csms/CSMS_LEAF.pem \ - dist/etc/everest/certs/ca/csms/CPO_SUB_CA2.pem \ - dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem \ - > config/certificates/csms.pem -cat dist/etc/everest/certs/ca/csms/CPO_SUB_CA2.pem \ - dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem \ - > config/certificates/trust.pem -cp dist/etc/everest/certs/client/csms/CSMS_LEAF.key config/certificates/csms.key -cp dist/etc/everest/certs/ca/v2g/V2G_ROOT_CA.pem config/certificates/root-V2G-cert.pem - -echo "Validating that the certificates are set up correctly" -openssl verify -show_chain \ - -CAfile config/certificates/root-V2G-cert.pem \ - -untrusted config/certificates/trust.pem \ - config/certificates/csms.pem - -echo "Starting the CSMS" -docker compose up -d - -echo "Waiting 10s for CSMS to start..." -sleep 10 - -echo "MaEVe CSMS started, adding charge station. Note that profiles in MaEVe start with 0 so SP 1 == OCPP SP 2" -curl http://localhost:9410/api/v0/cs/cp001 -H 'content-type: application/json' \ - -d '{"securityProfile": 1, "base64SHA256Password": "3oGi4B5I+Y9iEkYtL7xvuUxrvGOXM/X2LQrsCwf/knA="}' - -echo "Charge station added, adding user token" -curl http://localhost:9410/api/v0/token -H 'content-type: application/json' -d '{ - "countryCode": "GB", - "partyId": "TWK", - "type": "RFID", - "uid": "DEADBEEF", - "contractId": "GBTWK012345678V", - "issuer": "Thoughtworks", - "valid": true, - "cacheMode": "ALWAYS" -}' - -echo "User token added, starting EVerest..." -popd - -pushd everest-demo -docker compose --project-name everest-ac-demo --file "${DEMO_COMPOSE_FILE_NAME}" up -d --wait - -ls -al manager - -docker cp manager/cached_certs_correct_name.tar.gz everest-ac-demo-manager-1:/workspace/ -docker exec everest-ac-demo-manager-1 /bin/bash -c "tar xf cached_certs_correct_name.tar.gz" - -echo "Configured everest certs, validating that the chain is set up correctly" -docker exec everest-ac-demo-manager-1 /bin/bash -c "openssl verify -show_chain -CAfile dist/etc/everest/certs/ca/v2g/V2G_ROOT_CA.pem --untrusted dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem --untrusted dist/etc/everest/certs/ca/csms/CPO_SUB_CA2.pem dist/etc/everest/certs/client/csms/CSMS_LEAF.pem" - -echo "Copying device DB, configured to SecurityProfile: 2" -docker cp manager/device_model_storage_maeve_sp2.db everest-ac-demo-manager-1:/workspace/dist/share/everest/modules/OCPP201/device_model_storage.db - -echo "Starting software in the loop simulation" -docker exec -it everest-ac-demo-manager-1 sh /workspace/build/run-scripts/run-sil-ocpp201.sh diff --git a/demo-iso15118-2-ac-plus-ocpp201.sp3.sh b/demo-iso15118-2-ac-plus-ocpp201.sp3.sh deleted file mode 100755 index de80b76d..00000000 --- a/demo-iso15118-2-ac-plus-ocpp201.sp3.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env bash - -DEMO_COMPOSE_FILE_NAME='docker-compose.ocpp201.sp2.yml' -DEMO_DIR="$(mktemp -d)" - -delete_temporary_directory() { rm -rf "${DEMO_DIR}"; } -trap delete_temporary_directory EXIT - -if [[ ! "${DEMO_DIR}" || ! -d "${DEMO_DIR}" ]]; then - echo 'Error: Failed to create a temporary directory for the demo.' - exit 1 -fi - -download_demo_file() { - local -r repo_file_path="$1" - local -r repo_raw_url='https://raw.githubusercontent.com/everest/everest-demo/main' - local -r destination_path="${DEMO_DIR}/${repo_file_path}" - - echo "Downloading ${repo_raw_url}/${repo_file_path} to ${destination_path}" - - mkdir -p "$(dirname ${destination_path})" - curl -s -o "${destination_path}" "${repo_raw_url}/${repo_file_path}" - if [[ "$?" != 0 ]]; then - echo "Error: Failed to retrieve \"${repo_file_path}\" from the demo" - echo 'repository. If this issue persists, please report this as an' - echo 'issue in the EVerest project:' - echo ' https://github.com/EVerest/EVerest/issues' - exit 1 - fi -} - -echo "Cloning EVerest into ${DEMO_DIR}/everest-demo" -cd ${DEMO_DIR} -git clone https://github.com/Everest/everest-demo.git everest-demo - -echo "Cloning MaEVe CSMS into ${DEMO_DIR}/maeve-csms and starting it" -git clone https://github.com/thoughtworks/maeve-csms.git maeve-csms -cp everest-demo/manager/cached_certs_correct_name.tar.gz maeve-csms -pushd maeve-csms - -echo "Copying certs into ${DEMO_DIR}/maeve-csms/config/certificates" -tar xf cached_certs_correct_name.tar.gz -cat dist/etc/everest/certs/client/csms/CSMS_LEAF.pem \ - dist/etc/everest/certs/ca/csms/CPO_SUB_CA2.pem \ - dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem \ - > config/certificates/csms.pem -cat dist/etc/everest/certs/ca/csms/CPO_SUB_CA2.pem \ - dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem \ - > config/certificates/trust.pem -cp dist/etc/everest/certs/client/csms/CSMS_LEAF.key config/certificates/csms.key -cp dist/etc/everest/certs/ca/v2g/V2G_ROOT_CA.pem config/certificates/root-V2G-cert.pem - -echo "Validating that the certificates are set up correctly" -openssl verify -show_chain \ - -CAfile config/certificates/root-V2G-cert.pem \ - -untrusted config/certificates/trust.pem \ - config/certificates/csms.pem - -echo "Starting the CSMS" -docker compose up -d - -echo "Waiting 10s for CSMS to start..." -sleep 10 - -echo "MaEVe CSMS started, adding charge station. Note that profiles in MaEVe start with 0 so SP 2 == OCPP SP 3" -curl http://localhost:9410/api/v0/cs/cp001 -H 'content-type: application/json' -d '{"securityProfile": 2}' - -echo "Charge station added, adding user token" -curl http://localhost:9410/api/v0/token -H 'content-type: application/json' -d '{ - "countryCode": "GB", - "partyId": "TWK", - "type": "RFID", - "uid": "DEADBEEF", - "contractId": "GBTWK012345678V", - "issuer": "Thoughtworks", - "valid": true, - "cacheMode": "ALWAYS" -}' - -echo "User token added, starting EVerest..." -popd - -pushd everest-demo -docker compose --project-name everest-ac-demo \ - --file "${DEMO_COMPOSE_FILE_NAME}" up -d --wait - -ls -al manager - -docker cp manager/cached_certs_correct_name.tar.gz everest-ac-demo-manager-1:/workspace/ -docker exec everest-ac-demo-manager-1 /bin/bash -c "tar xf cached_certs_correct_name.tar.gz" - -echo "Configured everest certs, validating that the chain is set up correctly" -docker exec everest-ac-demo-manager-1 /bin/bash -c "openssl verify -show_chain -CAfile dist/etc/everest/certs/ca/v2g/V2G_ROOT_CA.pem --untrusted dist/etc/everest/certs/ca/csms/CPO_SUB_CA1.pem --untrusted dist/etc/everest/certs/ca/csms/CPO_SUB_CA2.pem dist/etc/everest/certs/client/csms/CSMS_LEAF.pem" - -echo "Copying device DB, configured to SecurityProfile: 3" -docker cp manager/device_model_storage_maeve_sp3.db everest-ac-demo-manager-1:/workspace/dist/share/everest/modules/OCPP201/device_model_storage.db - -echo "Starting software in the loop simulation" -docker exec -it everest-ac-demo-manager-1 sh /workspace/build/run-scripts/run-sil-ocpp201.sh - -# echo "All configuration done, please run 'docker exec -it everest-ac-demo-manager-1 /bin/bash' and then (in the container) 'sh ./build/run-scripts/run-sil-ocpp201.sh'" diff --git a/docker-compose.ocpp201.sp2.yml b/docker-compose.ocpp201.sp2.yml deleted file mode 100644 index c4670020..00000000 --- a/docker-compose.ocpp201.sp2.yml +++ /dev/null @@ -1,37 +0,0 @@ -version: "3.6" - -services: - mqtt-server: - image: ghcr.io/everest/everest-demo/mqtt-server:${TAG} - platform: linux/x86_64 - logging: - driver: none - - manager: - image: ghcr.io/everest/everest-demo/manager:${TAG} - platform: linux/x86_64 - deploy: - resources: - limits: - cpus: "${EVEREST_MANAGER_CPUS}" - memory: "${EVEREST_MANAGER_MEMORY}" - depends_on: - - mqtt-server - environment: - - MQTT_SERVER_ADDRESS=mqtt-server - # entrypoint: "sh ./build/run-scripts/run-sil-ocpp201.sh" - entrypoint: "tail -f /dev/null" - sysctls: - - net.ipv6.conf.all.disable_ipv6=0 - extra_hosts: - - "host.docker.internal:host-gateway" - - nodered: - image: ghcr.io/everest/everest-demo/nodered:${TAG} - depends_on: - - mqtt-server - ports: - - 1880:1880 - environment: - - MQTT_SERVER_ADDRESS=mqtt-server - - FLOWS=/config/config-sil-two-evse-flow.json diff --git a/docker-compose.ocpp201.yml b/docker-compose.ocpp201.yml index be9be861..ecdf5b4e 100644 --- a/docker-compose.ocpp201.yml +++ b/docker-compose.ocpp201.yml @@ -19,9 +19,11 @@ services: - mqtt-server environment: - MQTT_SERVER_ADDRESS=mqtt-server - entrypoint: "sh ./build/run-scripts/run-sil-ocpp201.sh" + entrypoint: "tail -f /dev/null" sysctls: - net.ipv6.conf.all.disable_ipv6=0 + extra_hosts: + - "host.docker.internal:host-gateway" nodered: image: ghcr.io/everest/everest-demo/nodered:${TAG} diff --git a/maeve/maeve-csms-everest-org.patch b/maeve/maeve-csms-everest-org.patch new file mode 100644 index 00000000..999e9ad4 --- /dev/null +++ b/maeve/maeve-csms-everest-org.patch @@ -0,0 +1,13 @@ +diff --git a/docker-compose.yml b/docker-compose.yml +index b2d93e6..fa3a1ff 100644 +--- a/docker-compose.yml ++++ b/docker-compose.yml +@@ -47,6 +47,8 @@ services: + - "/certificates/csms.key" + - "--tls-trust-cert" + - "/certificates/trust.pem" ++ - "--org-name" ++ - "EVerest" + - "--mqtt-addr" + - "mqtt://mqtt:1883" + - "--manager-api-addr" diff --git a/maeve/maeve-csms-no-lb.patch b/maeve/maeve-csms-no-lb.patch new file mode 100644 index 00000000..be579fcf --- /dev/null +++ b/maeve/maeve-csms-no-lb.patch @@ -0,0 +1,63 @@ +diff --git a/docker-compose.yml b/docker-compose.yml +index a2d88cd..b2d93e6 100644 +--- a/docker-compose.yml ++++ b/docker-compose.yml +@@ -25,25 +25,6 @@ services: + timeout: 10s + retries: 3 + +- lb: +- image: envoyproxy/envoy:v1.26-latest +- command: ["-c", "/config/envoy.yaml"] +- volumes: +- - type: bind +- source: ./config/envoy +- target: /config +- read_only: true +- depends_on: +- manager: +- condition: service_healthy +- gateway: +- condition: service_healthy +- ports: +- - "80:80" +- - "443:443" +- - "9410:9410" +- - "9411:9411" +- + gateway: + build: + context: gateway +@@ -71,9 +52,10 @@ services: + - "--manager-api-addr" + - "http://manager:9410" + expose: +- - "9310" +- - "9311" + - "9312" ++ ports: ++ - "80:9310" ++ - "443:9311" + volumes: + - type: bind + source: ./config/certificates +@@ -108,9 +90,9 @@ services: + source: ./config/manager + target: /config + read_only: true +- expose: +- - "9410" +- - "9411" ++ ports: ++ - "9410:9410" ++ - "9411:9411" + healthcheck: + test: ["CMD", "/usr/bin/curl", "-s", "--fail", "http://localhost:9410/health"] + interval: 10s +@@ -146,4 +128,4 @@ services: + volumes: + - ./prometheus:/etc/prometheus + command: +- - '--config.file=/etc/prometheus/prometheus.yml' +\ No newline at end of file ++ - '--config.file=/etc/prometheus/prometheus.yml' diff --git a/maeve/maeve-csms-no-wss.patch b/maeve/maeve-csms-no-wss.patch new file mode 100644 index 00000000..30e57a7f --- /dev/null +++ b/maeve/maeve-csms-no-wss.patch @@ -0,0 +1,29 @@ +diff --git a/docker-compose.yml b/docker-compose.yml +index b2d93e6..f0e675a 100644 +--- a/docker-compose.yml ++++ b/docker-compose.yml +@@ -37,16 +37,8 @@ services: + - "serve" + - "--ws-addr" + - ":9310" +- - "--wss-addr" +- - ":9311" + - "--status-addr" + - ":9312" +- - "--tls-server-cert" +- - "/certificates/csms.pem" +- - "--tls-server-key" +- - "/certificates/csms.key" +- - "--tls-trust-cert" +- - "/certificates/trust.pem" + - "--mqtt-addr" + - "mqtt://mqtt:1883" + - "--manager-api-addr" +@@ -55,7 +47,6 @@ services: + - "9312" + ports: + - "80:9310" +- - "443:9311" + volumes: + - type: bind + source: ./config/certificates diff --git a/maeve/maeve-csms.patch b/maeve/maeve-csms.patch deleted file mode 100644 index fe634528..00000000 --- a/maeve/maeve-csms.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/docker-compose.yml b/docker-compose.yml -index 11e927f..1c24691 100644 ---- a/docker-compose.yml -+++ b/docker-compose.yml -@@ -51,8 +51,6 @@ services: - - "serve" - - "--ws-addr" - - ":9310" -- - "--wss-addr" -- - ":9311" - - "--status-addr" - - ":9312" - - "--tls-server-cert" -@@ -141,4 +139,4 @@ services: - volumes: - - ./prometheus:/etc/prometheus - command: -- - '--config.file=/etc/prometheus/prometheus.yml' -\ No newline at end of file -+ - '--config.file=/etc/prometheus/prometheus.yml'