Skip to content

Commit

Permalink
🗃️ Change the way that the CSMS URL is specified
Browse files Browse the repository at this point in the history
Now that the device model DB is overridden on startup,
we cannot configure the CSMS URL by copying over the database
any more (b613ba6,
EVerest#78 (comment)).

Instead we have to edit the `InternalCtrlr.json` file before the server starts up so that it is configured properly in the device model DB that is created at startup. We do this by using `sed` to replace `localhost` with the correct CSMS URL.

But the CSMS URL is different based on the the profile (SP1,
SP2, SP3) and the CSMS (Maeve vs CitrineOS).

So we make the following changes:
- remove all the DB override files since they are not
  relevant any more
- instead, define the SP and CSMS specific enviroment
  variables in the CSMS-specific apply-patches file
    - we may want to change this to a separate file later if
      there are other environment variables we want to
      specify
    - specifying this in CSMS-specific files means that we
      can easily support other CSMSes without modifying the
      demo file
- change the demo script to run separate sed commands that
  modify the `InternalCtrlr.json` with the correct URL for the service profile and CSMS

Signed-off-by: Shankari <[email protected]>
  • Loading branch information
shankari committed Nov 15, 2024
1 parent 88e6151 commit 9590cee
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
4 changes: 3 additions & 1 deletion citrineos/apply-patches.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

echo "No patches to apply"
CSMS_SP1_URL="ws://host.docker.internal:8082/cp001"
CSMS_SP2_URL="wss://host.docker.internal:8443/cp001"
CSMS_SP3_URL="wss://host.docker.internal:8444/cp001"
28 changes: 11 additions & 17 deletions demo-iso15118-2-ocpp-201.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ where:
DEMO_VERSION=
DEMO_COMPOSE_FILE_NAME=
DEMO_CSMS=maeve
DEMO_CSMS_REPO=$MAEVE_REPO
DEMO_CSMS_BRANCH=$MAEVE_BRANCH

# loop through positional options/arguments
while getopts ':r:b:123chm' option; do
Expand All @@ -41,9 +39,7 @@ while getopts ':r:b:123chm' option; do
DEMO_COMPOSE_FILE_NAME="docker-compose.ocpp201.yml" ;;
3) DEMO_VERSION="v2.0.1-sp3"
DEMO_COMPOSE_FILE_NAME="docker-compose.ocpp201.yml" ;;
c) DEMO_CSMS="citrineos"
DEMO_CSMS_REPO=$CITRINEOS_REPO
DEMO_CSMS_BRANCH=$CITRINEOS_BRANCH ;;
c) DEMO_CSMS="citrineos" ;;
m) START_OPTION="manual" ;;
h) echo -e "$usage"; exit ;;
\?) echo -e "illegal option: -$OPTARG\n" >&2
Expand Down Expand Up @@ -80,6 +76,9 @@ echo "DEMO VERSION: $DEMO_VERSION"
echo "DEMO CONFIG: $DEMO_COMPOSE_FILE_NAME"
echo "DEMO DIR: $DEMO_DIR"
echo "DEMO CSMS: $DEMO_CSMS"
echo "CSMS_SP1_URL: $CSMS_SP1_URL"
echo "CSMS_SP2_URL: $CSMS_SP2_URL"
echo "CSMS_SP3_URL: $CSMS_SP3_URL"


cd "${DEMO_DIR}" || exit 1
Expand Down Expand Up @@ -149,7 +148,6 @@ echo "Now applying the patches"
docker cp manager/enable_evcc_logging.cfg everest-ac-demo-manager-1:/ext/dist/etc/everest/default_logging.cfg
docker exec everest-ac-demo-manager-1 /bin/bash -c "cd /ext && patch -p0 -i /tmp/enable_payment_method_in_python.patch"
docker exec everest-ac-demo-manager-1 /bin/bash -c "cd /ext/dist/libexec/everest && patch -p1 -i /tmp/support_payment_in_jsevmanager.patch"
docker exec everest-ac-demo-manager-1 /bin/bash -c "sed -i 's#ws://localhost:9000#ws://host.docker.internal/ws/cp001#' /ext/dist/share/everest/modules/OCPP201/component_config/standardized/InternalCtrlr.json"

if [[ "$DEMO_VERSION" =~ sp2 || "$DEMO_VERSION" =~ sp3 ]]; then
docker cp manager/cached_certs_correct_name_emaid.tar.gz everest-ac-demo-manager-1:/ext/source/build
Expand All @@ -160,21 +158,17 @@ if [[ "$DEMO_VERSION" =~ sp2 || "$DEMO_VERSION" =~ sp3 ]]; then
fi

if [[ "$DEMO_VERSION" =~ sp1 ]]; then
echo "Copying device DB, configured to SecurityProfile: 1"
docker cp manager/device_model_storage_${DEMO_CSMS}_sp1.db \
everest-ac-demo-manager-1:/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db
echo "Configured to SecurityProfile: 1, disabling TLS and configuring server to ${CSMS_SP1_URL}"
docker exec everest-ac-demo-manager-1 /bin/bash -c "sed -i 's#ws://localhost:9000#${CSMS_SP1_URL}#' /ext/dist/share/everest/modules/OCPP201/component_config/standardized/InternalCtrlr.json"
docker cp manager/disable_iso_tls.patch everest-ac-demo-manager-1:/tmp/
docker exec everest-ac-demo-manager-1 /bin/bash -c "pushd /ext/source && patch -p0 -i /tmp/disable_iso_tls.patch"
elif [[ "$DEMO_VERSION" =~ sp2 ]]; then
echo "Copying device DB, configured to SecurityProfile: 2"
docker cp manager/device_model_storage_${DEMO_CSMS}_sp2.db \
everest-ac-demo-manager-1:/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db
docker cp manager/disable_iso_tls.patch everest-ac-demo-manager-1:/tmp/
docker exec everest-ac-demo-manager-1 /bin/bash -c "pushd /ext/source && patch -p0 -i /tmp/disable_iso_tls.patch"
echo "Configured to SecurityProfile: 2, configuring server to ${CSMS_SP2_URL}"
docker exec everest-ac-demo-manager-1 /bin/bash -c "sed -i 's#ws://localhost:9000#${CSMS_SP2_URL}#' /ext/dist/share/everest/modules/OCPP201/component_config/standardized/InternalCtrlr.json"
elif [[ "$DEMO_VERSION" =~ sp3 ]]; then
echo "Copying device DB, configured to SecurityProfile: 3"
docker cp manager/device_model_storage_${DEMO_CSMS}_sp3.db \
everest-ac-demo-manager-1:/ext/source/build/dist/share/everest/modules/OCPP201/device_model_storage.db
echo "Running with SP3, TLS should be enabled"
echo "Configured to SecurityProfile: 2, configuring server to ${CSMS_SP3_URL}"
docker exec everest-ac-demo-manager-1 /bin/bash -c "sed -i 's#ws://localhost:9000#${CSMS_SP3_URL}#' /ext/dist/share/everest/modules/OCPP201/component_config/standardized/InternalCtrlr.json"
fi

if [[ "$START_OPTION" == "auto" ]]; then
Expand Down
4 changes: 4 additions & 0 deletions maeve/apply-runtime-patches.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env bash

CSMS_SP1_URL="ws://host.docker.internal/ws/cp001"
CSMS_SP2_URL="wss://host.docker.internal/ws/cp001"
CSMS_SP3_URL="wss://host.docker.internal/ws/cp001"

if [[ "$DEMO_VERSION" =~ sp2 || "$DEMO_VERSION" =~ sp3 ]]; then
echo "Patching the CSMS to enable EVerest organization"
patch -p1 -i maeve-csms-everest-org.patch
Expand Down
Binary file removed manager/device_model_storage_citrineos_sp1.db
Binary file not shown.
Binary file removed manager/device_model_storage_citrineos_sp2.db
Binary file not shown.
Binary file removed manager/device_model_storage_citrineos_sp3.db
Binary file not shown.
Binary file removed manager/device_model_storage_maeve_sp1.db
Binary file not shown.
Binary file removed manager/device_model_storage_maeve_sp2.db
Binary file not shown.
Binary file removed manager/device_model_storage_maeve_sp3.db
Binary file not shown.

0 comments on commit 9590cee

Please sign in to comment.