Skip to content

Commit 0feea2d

Browse files
authored
Merge pull request #57 from US-JOET/fix_demo_issues_enable_two_payment_modes
Fix demo issues enable two payment modes
2 parents 0e908ee + bef53a4 commit 0feea2d

5 files changed

+2411
-9
lines changed

demo-iso15118-2-ac-plus-ocpp.sh

+11-3
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ cd "${DEMO_DIR}" || exit 1
9191

9292
echo "Cloning EVerest from ${DEMO_REPO} into ${DEMO_DIR}/everest-demo"
9393
git clone --branch "${DEMO_BRANCH}" "${DEMO_REPO}" everest-demo
94+
# cp -r "${DEMO_REPO}" everest-demo
9495

9596
if [[ "$DEMO_VERSION" != v1.6j ]]; then
9697
echo "Cloning ${CSMS} CSMS from ${CSMS_REPO} into ${DEMO_DIR}/${CSMS}-csms and starting it"
@@ -120,9 +121,6 @@ if [[ "$DEMO_VERSION" != v1.6j ]]; then
120121
fi
121122
else
122123
cp ../everest-demo/manager/cached_certs_correct_name_emaid.tar.gz .
123-
124-
echo "Patching the CSMS to disable load balancer"
125-
patch -p1 -i ../everest-demo/maeve/maeve-csms-no-lb.patch
126124
fi
127125

128126
# Set up certificates for SP2 and SP3
@@ -347,7 +345,17 @@ fi
347345

348346
pushd everest-demo || exit 1
349347
docker compose --project-name everest-ac-demo --file "${DEMO_COMPOSE_FILE_NAME}" up -d --wait
348+
349+
# Configure and restart nodered
350+
docker cp nodered/config/config-sil-iso15118-ac-flow.json everest-ac-demo-nodered-1:/config/config-sil-two-evse-flow.json
351+
docker restart everest-ac-demo-nodered-1
352+
353+
# Configure and restart EVerest
350354
docker cp config-sil-ocpp201-pnc.yaml everest-ac-demo-manager-1:/ext/source/config/config-sil-ocpp201-pnc.yaml
355+
docker cp manager/enable_payment_method.patch everest-ac-demo-manager-1:/tmp/
356+
docker cp manager/enable_evcc_logging.cfg everest-ac-demo-manager-1:/ext/source/build/dist/etc/everest/default_logging.cfg
357+
docker exec everest-ac-demo-manager-1 /bin/bash -c "apk add patch && cd /ext && patch -p0 -i /tmp/enable_payment_method.patch"
358+
351359
if [[ "$DEMO_VERSION" =~ sp2 || "$DEMO_VERSION" =~ sp3 ]]; then
352360
docker cp manager/cached_certs_correct_name_emaid.tar.gz everest-ac-demo-manager-1:/ext/source/build
353361
docker exec everest-ac-demo-manager-1 /bin/bash -c "pushd /ext/source/build && tar xf cached_certs_correct_name_emaid.tar.gz"

maeve/maeve-csms-ignore-ocsp.patch

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@ diff --git a/manager/handlers/ocpp201/authorize.go b/manager/handlers/ocpp201/au
22
index 5df2305..0db9f79 100644
33
--- a/manager/handlers/ocpp201/authorize.go
44
+++ b/manager/handlers/ocpp201/authorize.go
5-
@@ -49,7 +49,12 @@ func (a AuthorizeHandler) HandleCall(ctx context.Context, chargeStationId string
5+
@@ -38,7 +38,12 @@ func (a AuthorizeHandler) HandleCall(ctx context.Context, chargeStationId string
66
if req.Certificate != nil {
77
_, err = a.CertificateValidationService.ValidatePEMCertificateChain(ctx, []byte(*req.Certificate), req.IdToken.IdToken)
8-
status, certificateStatus = handleCertificateValidationError(err)
8+
idTokenInfo.Status, certificateStatus = handleCertificateValidationError(err)
99
- if err != nil {
1010
+ if err.Error() == "failed to perform ocsp check after 1 attempts" {
1111
+ var tempStatus = types.AuthorizeCertificateStatusEnumTypeAccepted
1212
+ certificateStatus = &tempStatus
13-
+ status = types.AuthorizationStatusEnumTypeAccepted
13+
+ idTokenInfo.Status = types.AuthorizationStatusEnumTypeAccepted
1414
+ span.SetAttributes(attribute.String("authorize.cert_warn", "No OCSP, but ignoring for testing purpose."))
1515
+ } else if err != nil {
1616
span.SetAttributes(attribute.String("authorize.cert_error", err.Error()))
1717
}
1818
}
19-
@@ -57,7 +62,12 @@ func (a AuthorizeHandler) HandleCall(ctx context.Context, chargeStationId string
19+
@@ -46,7 +46,12 @@ func (a AuthorizeHandler) HandleCall(ctx context.Context, chargeStationId string
2020
if req.Iso15118CertificateHashData != nil {
2121
_, err := a.CertificateValidationService.ValidateHashedCertificateChain(ctx, *req.Iso15118CertificateHashData)
22-
status, certificateStatus = handleCertificateValidationError(err)
22+
idTokenInfo.Status, certificateStatus = handleCertificateValidationError(err)
2323
- if err != nil {
2424
+ if err.Error() == "failed to perform ocsp check after 1 attempts" {
2525
+ var tempStatus = types.AuthorizeCertificateStatusEnumTypeAccepted
2626
+ certificateStatus = &tempStatus
27-
+ status = types.AuthorizationStatusEnumTypeAccepted
27+
+ idTokenInfo.Status = types.AuthorizationStatusEnumTypeAccepted
2828
+ span.SetAttributes(attribute.String("authorize.cert_warn", "No OCSP, but ignoring for testing purpose."))
2929
+ } else if err != nil {
3030
span.SetAttributes(attribute.String("authorize.cert_error", err.Error()))

manager/enable_evcc_logging.cfg

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# for documentation on this file format see:
2+
# https://www.boost.org/doc/libs/1_54_0/libs/log/doc/html/log/detailed/utilities.html#log.detailed.utilities.setup.filter_formatter
3+
4+
[Core]
5+
DisableLogging=false
6+
7+
# To get debug logs of only one module, add the "%Process% contains" filter, e.g.:
8+
#
9+
# "(%Process% contains OCPP201 and %Severity% >= DEBG)"
10+
#
11+
# whereas "OCPP201" is the value of the field `active_modules.NAME.module` in the respective /config/config-*.yaml.
12+
Filter="%Severity% >= INFO or (%Process% contains iso15118_car and %Severity% >= DEBG)"
13+
14+
[Sinks.Console]
15+
Destination=Console
16+
# Filter="%Target% contains \"MySink1\""
17+
Format="%TimeStamp% [%Severity%] \033[1;32m%Process%\033[0m \033[1;36m%function%\033[0m \033[1;30m%file%:\033[0m\033[1;32m%line%\033[0m: %Message%"
18+
Asynchronous=false
19+
AutoFlush=true
20+
SeverityStringColorDebug="\033[1;30m"
21+
SeverityStringColorInfo="\033[1;37m"
22+
SeverityStringColorWarning="\033[1;33m"
23+
SeverityStringColorError="\033[1;31m"
24+
SeverityStringColorCritical="\033[1;35m"

manager/enable_payment_method.patch

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
--- ext-switchev-iso15118/iso15118/evcc/controller/interface.py
2+
+++ source/build/dist/libexec/everest/3rd_party/josev/iso15118/evcc/controller/interface.py
3+
@@ -109,6 +109,15 @@
4+
raise NotImplementedError
5+
6+
@abstractmethod
7+
+ async def get_selected_auth_option(
8+
+ self, protocol: Protocol
9+
+ ) -> AuthEnum:
10+
+ """
11+
+ Gets the auth transfer mode requested for the current charging session.
12+
+ """
13+
+ raise NotImplementedError
14+
+
15+
+ @abstractmethod
16+
async def get_energy_transfer_mode(
17+
self, protocol: Protocol
18+
) -> EnergyTransferModeEnum:
19+
--- ext-switchev-iso15118/iso15118/evcc/controller/simulator.py
20+
+++ source/build/dist/libexec/everest/3rd_party/josev/iso15118/evcc/controller/simulator.py
21+
@@ -53,6 +53,7 @@
22+
SAScheduleTupleEntry as SAScheduleTupleEntryDINSPEC,
23+
)
24+
from iso15118.shared.messages.enums import (
25+
+ AuthEnum,
26+
ControlMode,
27+
DCEVErrorCode,
28+
EnergyTransferModeEnum,
29+
@@ -233,11 +234,18 @@
30+
logger.error(f"Invalid protocol '{protocol}', can't determine EVCCID")
31+
raise InvalidProtocolError
32+
33+
+ async def get_selected_auth_option(
34+
+ self, protocol: Protocol
35+
+ ) -> AuthEnum:
36+
+ """Overrides EVControllerInterface.get_selected_auth_option()."""
37+
+ return AuthEnum(EVEREST_EV_STATE.PaymentOption)
38+
+
39+
async def get_energy_transfer_mode(
40+
self, protocol: Protocol
41+
) -> EnergyTransferModeEnum:
42+
"""Overrides EVControllerInterface.get_energy_transfer_mode()."""
43+
return EnergyTransferModeEnum(EVEREST_EV_STATE.EnergyTransferMode)
44+
+
45+
46+
async def get_supported_energy_services(self) -> List[ServiceV20]:
47+
"""Overrides EVControllerInterface.get_energy_transfer_service()."""
48+
--- ext-switchev-iso15118/iso15118/evcc/states/iso15118_2_states.py
49+
+++ source/build/dist/libexec/everest/3rd_party/josev/iso15118/evcc/states/iso15118_2_states.py
50+
@@ -193,8 +193,9 @@
51+
self.stop_state_machine("ChargeService not offered")
52+
return
53+
54+
- self.select_auth_mode(service_discovery_res.auth_option_list.auth_options)
55+
+ logger.warn("received auth options list %s" % service_discovery_res.auth_option_list.auth_options)
56+
await self.select_services(service_discovery_res)
57+
+ await self.select_auth_mode(service_discovery_res.auth_option_list.auth_options)
58+
await self.select_energy_transfer_mode()
59+
60+
charge_service: ChargeService = service_discovery_res.charge_service
61+
@@ -262,12 +263,13 @@
62+
self.comm_session.selected_energy_mode.value.startswith("AC")
63+
)
64+
65+
- def select_auth_mode(self, auth_option_list: List[AuthEnum]):
66+
+ async def select_auth_mode(self, auth_option_list: List[AuthEnum]):
67+
"""
68+
Check if an authorization mode (aka payment option in ISO 15118-2) was
69+
saved from a previously paused communication session and reuse for
70+
resumed session, otherwise request from EV controller.
71+
"""
72+
+ logger.warn("V2G_PAYMENT: in function received auth options list %s" % auth_option_list)
73+
if evcc_settings.ev_session_context.selected_auth_option:
74+
logger.debug(
75+
"Reusing authorization option "
76+
@@ -279,15 +281,30 @@
77+
)
78+
evcc_settings.ev_session_context.selected_auth_option = None
79+
else:
80+
- # Choose Plug & Charge (pnc) or External Identification Means (eim)
81+
- # as the selected authorization option. The car manufacturer might
82+
- # have a mechanism to determine a user-defined or default
83+
- # authorization option. This implementation favors pnc, but
84+
- # feel free to change if need be.
85+
- if AuthEnum.PNC_V2 in auth_option_list and self.comm_session.is_tls:
86+
- self.comm_session.selected_auth_option = AuthEnum.PNC_V2
87+
+ logger.warn("V2G_PAYMENT: about to read value from state")
88+
+ self.comm_session.selected_auth_option = (
89+
+ await self.comm_session.ev_controller.get_selected_auth_option(
90+
+ Protocol.ISO_15118_2
91+
+ )
92+
+ )
93+
+ logger.warn("V2G_PAYMENT: in function read value from state %s" % self.comm_session.selected_auth_option)
94+
+ if self.comm_session.selected_auth_option is not None:
95+
+ logger.debug(
96+
+ "V2G_PAYMENT: Found Payment Option %s passed in from the PyJoseV module, using it" % self.comm_session.selected_auth_option
97+
+ )
98+
else:
99+
- self.comm_session.selected_auth_option = AuthEnum.EIM_V2
100+
+ logger.debug(
101+
+ "V2G_PAYMENT: No previous paused session, no PaymentOption set, using TLS flag %s to decide auth method" % self.comm_session.is_tls
102+
+ )
103+
+ # Choose Plug & Charge (pnc) or External Identification Means (eim)
104+
+ # as the selected authorization option. The car manufacturer might
105+
+ # have a mechanism to determine a user-defined or default
106+
+ # authorization option. This implementation favors pnc, but
107+
+ # feel free to change if need be.
108+
+ if AuthEnum.PNC_V2 in auth_option_list and self.comm_session.is_tls:
109+
+ self.comm_session.selected_auth_option = AuthEnum.PNC_V2
110+
+ else:
111+
+ self.comm_session.selected_auth_option = AuthEnum.EIM_V2
112+
113+
async def select_services(self, service_discovery_res: ServiceDiscoveryRes):
114+
"""

0 commit comments

Comments
 (0)