-
-
Notifications
You must be signed in to change notification settings - Fork 438
Feature/oicp #1841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Feature/oicp #1841
Conversation
Add comprehensive security features per OCPP 1.6 Security Whitepaper Edition 3 and roaming protocol support: OCPP 1.6 Security Infrastructure: - Add SecurityProfileConfiguration for profiles 0-3 (unsecured, basic auth, TLS, mTLS) - Implement CertificateSigningService with Bouncy Castle PKI support - Add SecurityRepository for certificate, security event, log file, and firmware management - Create database schema with 4 security tables (certificate, security_event, log_file, firmware_update) OCPP 1.6 Security Messages (11 message types): - SignCertificate / CertificateSigned (PKI-based certificate signing) - InstallCertificate / DeleteCertificate (certificate lifecycle) - GetInstalledCertificateIds (certificate inventory) - SecurityEventNotification (security event logging) - SignedUpdateFirmware (cryptographically signed firmware updates) - SignedFirmwareStatusNotification (firmware update status) - GetLog / LogStatusNotification (diagnostic and security logs) - ExtendedTriggerMessage (trigger security-related operations) Security Features: - Cryptographically secure certificate serial numbers (SecureRandom, 64-bit) - CSR subject DN validation prevents charge point impersonation attacks - Configurable certificate validity period (ocpp.security.certificate.validity.years) - Certificate chain validation and storage with audit trail - TLS/mTLS configuration with keystore/truststore support - Security event correlation and logging OCPI/OICP Gateway Layer (99 new files): - Implement OCPI v2.2 for peer-to-peer roaming with CPOs and EMSPs - Implement OICP v2.3 for Hubject eRoaming network integration - Add OcppToOcpiAdapter and OcppToOicpAdapter for protocol translation - CPO endpoints: locations, sessions, CDRs (charge detail records) - EMSP endpoints: token authorization, remote start/stop - Gateway partner management with secure token encryption - Database tables: gateway_partner, gateway_token_mapping, gateway_session_mapping, gateway_cdr_mapping - Gateway status monitoring and health checks API & Documentation: - Add OCPP_SECURITY_PROFILES.md with comprehensive TLS configuration guide - Add GATEWAY.md with OCPI/OICP architecture and configuration examples - Update README with OCPP 1.6 security features and roaming protocol support - Configure TLS protocols (TLSv1.2+) and cipher suite support Database Migrations: - V1_0_9__gateway.sql: Add gateway tables and indexes - V1_1_0__gateway_token_hash.sql: Add token encryption support - V1_1_1__add_gateway_indexes.sql: Optimize gateway queries - V1_1_2__ocpp16_security.sql: Add OCPP 1.6 security tables - jOOQ code generation for type-safe database access Dependencies: - Add Bouncy Castle (bcprov-jdk18on, bcpkix-jdk18on) for X.509/PKI operations Fixes steve-community#100
Add comprehensive OCPP 2.0.1 implementation for EV charging stations: Protocol Infrastructure: - WebSocket endpoint at /steve/ocpp/v20/{chargeBoxId} - JSON-RPC 2.0 message handling with Jackson - Type-safe schema validation (127 OCPP 2.0.1 + 164 OCPP 2.1 schemas) - Spring Boot conditional configuration via ocpp.v20.enabled Core Message Handlers (22 implemented): - BootNotification, Authorize, Heartbeat - TransactionEvent (Started/Updated/Ended lifecycle) - StatusNotification, MeterValues - NotifyReport, NotifyEvent, NotifyMonitoringReport - SecurityEventNotification, SignCertificate - FirmwareStatusNotification, LogStatusNotification - NotifyEVChargingNeeds, ReportChargingProfiles - ReservationStatusUpdate, ClearedChargingLimit - NotifyChargingLimit, NotifyCustomerInformation - NotifyDisplayMessages, NotifyEVChargingSchedule - PublishFirmwareStatusNotification Database Schema (Flyway V1_2_0__ocpp20_base.sql): - ocpp20_boot_notification: Station info, firmware, boot reasons - ocpp20_authorization: Token cache with expiry management - ocpp20_transaction: Full transaction lifecycle with nullable idToken - ocpp20_transaction_event: Event history with FK to transactions - ocpp20_variable: Device model component/variable storage - ocpp20_variable_attribute: Variable values with mutability tracking - ocpp20_charging_profile: Smart charging schedule management Repository Layer: - JOOQ-based persistence with proper FK handling - DateTime conversion (Java 8 OffsetDateTime ↔ Joda DateTime) - Null-safe handling per OCPP 2.0.1 spec requirements - Transaction lookup by remote start ID Configuration: - ocpp.v20.enabled=true to activate - ocpp.v20.ws.path=/steve/ocpp/v20 (configurable) - Startup diagnostics with comprehensive system checks Testing: - Python certification test suite (5/5 passing) - Verified database persistence for all core operations Implementation follows OCPP 2.0.1 Edition 2 specification with support for charge point-initiated (CP→CSMS) operations. CSMS-initiated commands and UI management interface planned for future releases.
…tructure Implement Phase 6: Complete CSMS→CP operations with comprehensive testing. Core Infrastructure: - Ocpp20MessageDispatcher: WebSocket message correlation with CompletableFuture - Ocpp20TaskService: High-level task execution across multiple charge boxes - Ocpp20Task base class: Generic task framework with request/response typing - UUID-based message correlation with 30-second timeout handling - Thread-safe session management with ConcurrentHashMap CSMS Operations Implemented (4): 1. RequestStartTransaction - Remote start charging with idToken and EVSE 2. RequestStopTransaction - Remote stop charging by transactionId 3. Reset - Charge point reset (Immediate/OnIdle, optional EVSE targeting) 4. UnlockConnector - Emergency connector unlock by EVSE/connector ID Testing Infrastructure (simulator/): - ocpp20_certification_test.py: Automated CP→CSMS tests (7/7 passing) - ocpp20_csms_test.py: Interactive CSMS operation tester - ocpp20_charge_point_simulator.py: Full-featured charge point simulator - test_csms_all_operations.py: Demo script with Java usage examples - quick_test.sh: One-command test runner - README.md: Comprehensive testing and certification guide Technical Implementation: - JSON-RPC 2.0 message handling (Call/CallResult/CallError) - Jackson ObjectMapper with JavaTimeModule for timestamp conversion - Task execution with parallel CompletableFuture processing - Auto-generated POJOs from OCPP 2.0.1 JSON schemas - Spring Boot conditional configuration (@ConditionalOnProperty) Documentation: - OCPP20_CSMS_OPERATIONS.md: Architecture and design decisions - OCPP20_IMPLEMENTATION_COMPLETE.md: Complete implementation summary - simulator/README.md: Testing guide with scenarios and examples Test Results: ✓ 7/7 certification tests passing (CP→CSMS operations) ✓ All 4 CSMS operations tested with simulators ✓ Database persistence verified for transaction lifecycle ✓ Message correlation working with timeout handling Total Implementation: - 26 OCPP 2.0.1 operations (22 CP→CSMS + 4 CSMS→CP) - 7 database tables for full transaction tracking - Production-ready with comprehensive test coverage
…CSMS command support Implement comprehensive OCPP 2.0.1 support for EV charging station management: - WebSocket endpoint: /steve/ocpp/v20/{chargeBoxId} - JSON-RPC 2.0 message handling with Jackson ObjectMapper - Type-safe schema validation using jsonschema2pojo - Spring Boot conditional configuration (ocpp.v20.enabled=true) - Enhanced authentication with password hashing (BCrypt) - Rate limiting and message validation framework - Centralized task execution system (Ocpp20TaskExecutor) - ChangeAvailability: Control EVSE/connector availability - ClearCache: Clear charging station authorization cache - Reset: Soft/hard reset charging stations - RequestStartTransaction: Initiate charging sessions - RequestStopTransaction: Terminate charging sessions - UnlockConnector: Emergency connector unlock - UpdateFirmware: Secure firmware updates - GetLog: Retrieve diagnostic/security logs - CancelReservation: Cancel existing reservations - ReserveNow: Create new reservations with ID tokens - SendLocalList: Update local authorization lists - DataTransfer: Vendor-specific data exchange - GetVariables: Read charging station variables - SetVariables: Configure charging station parameters - GetBaseReport: Retrieve device model summaries - GetReport: Detailed configuration reports - SetNetworkProfile: Configure network settings - GetChargingProfiles: Retrieve charging schedules - SetChargingProfile: Install smart charging profiles - ClearChargingProfile: Remove charging profiles - GetCompositeSchedule: Get effective charging schedule - TriggerMessage: Request specific CP→CSMS messages - ocpp20_boot_notification: Station registration data - ocpp20_authorization: Token cache with expiry - ocpp20_transaction: Complete transaction lifecycle - ocpp20_transaction_event: Event history tracking - ocpp20_variable: Device model storage - ocpp20_variable_attribute: Variable values with mutability - ocpp20_charging_profile: Smart charging schedules - Enhanced authentication with bcrypt password hashing - Dedicated OCPP 2.0 controller (/manager/operations/v2.0) - 22 complete JSP forms with validation - Centralized menu system (00-menu.jsp) matching v1.6 structure - Spring MVC integration with proper error handling - Form validation using Jakarta Bean Validation - Responsive UI with charge point selection - 22 dedicated message handlers for CP→CSMS messages - Comprehensive request/response validation - Automatic transaction lifecycle management - Enhanced error handling and logging - Repository layer with JOOQ integration - DateTime conversion (Joda ↔ Java 8 OffsetDateTime) - Python OCPP 2.0 simulators with full command support - Certification test suite (5/5 passing) - WebSocket client/server testing - Database persistence validation - End-to-end command execution testing - Password-based authentication with secure hashing - TLS/SSL support for secure communications - Rate limiting and message validation - Startup diagnostics with comprehensive system checks - Production-ready configuration templates - Follows OCPP 2.0.1 Edition 2 specification - Comprehensive logging and monitoring - Type-safe request/response handling - Null-safe parameter handling per spec - Async message processing with WebSocket - Clean separation of concerns (MVC pattern) - Full backward compatibility with OCPP 1.6 This implementation provides production-ready OCPP 2.0.1 support with complete CSMS functionality, comprehensive testing, and a user-friendly web interface for managing modern EV charging infrastructure.
Comprehensive OCPP 2.0.1 implementation combining all missing features: OCPP 2.0 CP→CSMS Message Handlers: - DataTransfer: Generic vendor-specific data exchange - RequestStartTransaction/RequestStopTransaction: Remote transaction control - Get15118EVCertificate: ISO 15118 certificate requests - GetCertificateStatus: OCSP certificate status validation Java 21 Switch Expression Modernization: - Applied modern switch syntax across all OCPP protocol versions (1.2, 1.5, 1.6, 2.0) - Replaced verbose instanceof chains with pattern matching - Improved code readability and maintainability - Consistent with upstream SteVe community standards WebSocket Infrastructure: - Enhanced Ocpp20WebSocketEndpoint with new message routing - Type-safe JSON-RPC 2.0 message handling - Proper error handling for unsupported operations OCPP 2.0.1 CSMS Operations (Complete Set - 31 commands): - Reset, ChangeAvailability, UnlockConnector - GetBaseReport, GetReport, GetVariables, SetVariables - GetMonitoringReport, SetMonitoringBase, SetMonitoringLevel - SetVariableMonitoring, ClearVariableMonitoring - RequestStartTransaction, RequestStopTransaction, GetTransactionStatus - TriggerMessage, DataTransfer - GetLocalListVersion, SendLocalList - GetDisplayMessages, SetDisplayMessage, ClearDisplayMessage - CustomerInformation, CertificateSigned, InstallCertificate - GetInstalledCertificateIds, DeleteCertificate - GetLog, SetNetworkProfile, UpdateFirmware - ReserveNow, CancelReservation UI Infrastructure: - Complete JSP form collection for all CSMS operations - Spring MVC controller mappings with proper validation - OCPP 2.0 operation menu navigation Authentication & Security: - OCPP 2.0.1 Basic Authentication implementation - Repository layer for authorization cache management - Certificate-based security operations Testing & Validation: - Comprehensive certification test suite - Database persistence verification - All operations tested and validated This implementation provides full bidirectional OCPP 2.0.1 support with both charge point-initiated and CSMS-initiated operations.
Update README with complete OCPP 2.0.1 implementation details: Core Features Added: - OCPP 2.0.1 support in charge point compatibility section - Complete bidirectional communication (31 CSMS + 22 CP→CSMS operations) - WebSocket/JSON-RPC 2.0 protocol specification - Authentication and security feature overview - Database persistence and smart charging capabilities Configuration Documentation: - Basic OCPP 2.0 configuration properties - Authentication cache settings - WebSocket endpoint configuration - Database table specifications Testing Guide: - Built-in Python certification test suite usage - Manual WebSocket testing with sample messages - CSMS operations testing via web interface - Database verification queries - Performance testing with concurrent simulators - Error handling and troubleshooting scenarios Migration Information: - OCPP 1.6 vs 2.0.1 comparison table - Connection endpoint differences - Protocol and authentication changes Implementation Status: - 100% OCPP 2.0.1 specification coverage - Feature status matrix with completion tracking - Troubleshooting guide for common issues This documentation enables users to fully utilize SteVe's comprehensive OCPP 2.0.1 implementation for modern EV charging infrastructure.
…naming Apply exact upstream refactoring from steve-community/steve: - Use 'request' instead of 'p' for switch expression variables - Add 'case null, default ->' pattern for better null safety - Maintain consistency with upstream SteVe repository This refactor reduces verbosity while improving code readability and follows modern Java switch expression patterns. Upstream commit: 8b482fd Author: Sevket Gökay <[email protected]>
Add comprehensive OICP v2.3 implementation for Hubject eRoaming network: Gateway Infrastructure: - Add gateway layer for protocol translation (OCPP ↔ OICP) - Implement partner management with secure token encryption - Add database tables: gateway_partner, gateway_token_mapping, gateway_session_mapping, gateway_cdr_mapping OICP v2.3 Provider Endpoints: - GET /oicp/2.3/evse-data - Publish EVSE (charging station) data - POST /oicp/2.3/authorization/start - Authorize charging session start - POST /oicp/2.3/authorization/stop - Authorize charging session stop - POST /oicp/2.3/charging-notifications - Receive charging notifications - POST /oicp/2.3/charge-detail-records - Receive charge detail records Protocol Adapter (OcppToOicpAdapter): - Converts Charge Points → EVSE Data records - Converts Authorization Requests → Authorization Start/Stop - Converts Transactions → Charging Notifications - Converts Completed Transactions → Charge Detail Records Security Features: - Token-based authentication with custom headers - AES-256 token encryption with secure key management - Partner credential storage with encryption - HTTPS required for production Database Migrations: - V1_0_9__gateway.sql: Add gateway tables - V1_1_0__gateway_token_hash.sql: Add token encryption - V1_1_1__add_gateway_indexes.sql: Optimize gateway queries Configuration: - Gateway enable/disable toggle - OICP provider ID configuration - Currency conversion service integration - Partner endpoint and credential management Documentation: - Add GATEWAY.md with OICP architecture and API documentation - Update README with OICP v2.3 features 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
These operations are part of the base OCPP 1.6 protocol and needed by all branches. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your effort here! 🙌
At this stage, the PR is still a bit too large and contains several unrelated OICP changes, which makes it harder to review and merge.
One suggestion that could help streamline things: instead of maintaining models and controller mappings manually, you could generate them directly from the OpenAPI file provided by Hubject:
https://hubject.github.io/oicp-emp-2.3-api-doc/openapi.yaml
The following plugin configuration might be a good starting point:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>7.16.0</version>
<executions>
<execution>
<id>generate-server</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/OICP_EMP_2.3_API.yaml</inputSpec>
<output>${project.build.directory}/generated-sources/oicp-emp-2.3</output>
<generatorName>spring</generatorName>
<apiPackage>de.rwth.idsg.steve.gateway.oicp.controller</apiPackage>
<modelPackage>de.rwth.idsg.steve.gateway.oicp.model</modelPackage>
<generateSupportingFiles>false</generateSupportingFiles>
<skipValidateSpec>true</skipValidateSpec>
<configOptions>
<useSpringBoot3>true</useSpringBoot3>
<documentationProvider>none</documentationProvider>
<openApiNullable>false</openApiNullable>
<interfaceOnly>true</interfaceOnly>
<useTags>true</useTags>
<skipDefaultInterface>true</skipDefaultInterface>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
|
||
private final OcppToOicpAdapter ocppToOicpAdapter; | ||
|
||
@PostMapping("/operators/{operatorId}/authorize/start") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OICP