From: Jérôme Benoit Date: Mon, 10 Jun 2024 19:14:18 +0000 (+0200) Subject: test: remove GetBaseReport ocpp server handler X-Git-Tag: v1.3.7~83 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;ds=sidebyside;h=3bacab7a1e81110d4c416570e13658d2c07ce888;p=e-mobility-charging-stations-simulator.git test: remove GetBaseReport ocpp server handler The CSMS is supposed to emit the request Signed-off-by: Jérôme Benoit --- diff --git a/tests/ocpp-server/server.py b/tests/ocpp-server/server.py index bf4ee538..f8a76569 100644 --- a/tests/ocpp-server/server.py +++ b/tests/ocpp-server/server.py @@ -14,7 +14,7 @@ logging.basicConfig(level=logging.DEBUG) # Define a ChargePoint class inheriting from the OCPP 2.0.1 ChargePoint class. class ChargePoint(cp): - # Define a handler for the BootNotification message. + # Message handlers to receive OCPP message. @on('BootNotification') async def on_boot_notification(self, charging_station, reason, **kwargs): logging.info("Received BootNotification") @@ -26,27 +26,7 @@ class ChargePoint(cp): status=RegistrationStatusType.accepted ) - # Define a handler for the GetBaseReport message. - @on('GetBaseReport') - async def on_get_base_report(self, request_id, report_base, **kwargs): - try: - logging.info( - f"Received GetBaseReport request with RequestId: {request_id} and ReportBase: {report_base}") - - # Create a mock response for demonstration purposes, indicating the report is accepted. - response = call_result.GetBaseReport( - status=GenericDeviceModelStatusType.accepted - ) - - logging.info(f"Sending GetBaseReport response: {response}") - return response - except Exception as e: - # Log any errors that occur while handling the GetBaseReport request. - logging.error(f"Error handling GetBaseReport request: {e}", exc_info=True) - # Return a rejected status in case of error. - return call_result.GetBaseReport( - status=GenericDeviceModelStatusType.rejected - ) + # Request handlers to emit OCPP messages. # Function to handle new WebSocket connections.