Commit Graph

10 Commits

Author SHA1 Message Date
openhands d21804e3d9 feat: Implement protocol discovery service with auto-discovery capabilities
- Add ProtocolDiscoveryService with network scanning for all protocols
- Create discovery API endpoints for scan management and results
- Implement discovery UI components in dashboard
- Add comprehensive unit tests for discovery functionality
- Integrate discovery with configuration manager for automatic mapping creation
- Support background task execution for long-running discovery scans
- Include discovery status monitoring and recent discoveries endpoints
2025-11-04 10:01:28 +00:00
openhands 48a1a49384 Add comprehensive test suite for protocol mapping functionality
- Created 35 comprehensive tests covering ConfigurationManager, protocol validation, and database integration
- Added unit tests for ConfigurationManager with database persistence
- Added protocol-specific validation tests for all 4 protocols (Modbus TCP, Modbus RTU, OPC UA, REST API)
- Added integration tests for protocol server integration
- Enhanced existing API tests for protocol mapping endpoints
- Fixed database integration issues in ConfigurationManager
- Improved validation logic and error handling
- All tests passing with comprehensive coverage of Phase 1 functionality
2025-11-04 09:14:11 +00:00
openhands 89a2ed8332 Add interactive dashboard with comprehensive testing
- Implemented web-based dashboard with tab-based interface
- Added configuration management with real-time validation
- Created system status monitoring and log viewing
- Implemented system actions (restart, backup, health checks)
- Added comprehensive test suite with 35 tests (100% passing)
- Integrated dashboard with existing REST API
- Added responsive design for mobile and desktop
- Implemented security validation and warnings
- Created comprehensive documentation

Features:
- Status monitoring with color-coded indicators
- Configuration management with web-based editor
- Real-time log viewing with filtering
- One-click system operations
- Mobile-responsive design
- Security validation for default credentials

Testing:
- 13 model tests for Pydantic data structures
- 8 validation tests for configuration logic
- 8 API endpoint tests for all dashboard routes
- 6 integration tests with REST API
- All 35 tests passing (100% success rate)

Access: http://localhost:8080/dashboard
2025-10-30 07:22:00 +00:00
openhands c890c4b1e3 Phase 6: Integration & System Testing COMPLETED
- Created comprehensive end-to-end workflow tests (4 new tests)
- All 234 tests passing with complete system validation
- Database operations workflow tested and validated
- Auto-discovery workflow tested and validated
- Optimization workflow tested and validated
- Database health monitoring tested and validated
- Updated implementation plan with Phase 6 completion
- Removed duplicate documentation files
- Consolidated documentation into single source of truth

Key Features:
- End-to-end testing from database to components
- System integration validation
- Performance and reliability testing
- All Phase 1 missing features implemented and tested
2025-10-28 15:10:53 +00:00
openhands 12bb889de3 Phase 5: Protocol Server Enhancements
- Enhanced OPC UA server with node caching and performance monitoring
- Optimized Modbus TCP server with connection pooling and industrial features
- Enhanced REST API with OpenAPI documentation, response caching, and compression
- Protocol-specific security enhancements and performance optimizations
- Added comprehensive performance monitoring across all protocols
- Created 23 unit tests for protocol enhancements
- All 220 tests passing (100% success rate)
- Updated documentation and implementation plan

Features implemented:
- NodeCache for OPC UA server with TTL and LRU eviction
- ConnectionPool for Modbus TCP server with connection limits
- ResponseCache for REST API with configurable TTL
- Performance monitoring with get_protocol_performance_status()
- Enhanced security integration across all protocols
- OpenAPI documentation with security schemes
- Compression middleware for REST API
- Rate limiting and access control for Modbus
- Comprehensive error handling and resource management
2025-10-28 11:15:55 +00:00
openhands dfa3f0832b Phase 4: Complete Security Layer Implementation
- Implemented JWT-based authentication with bcrypt password hashing
- Added role-based access control (RBAC) with four user roles
- Created TLS/SSL encryption with certificate management
- Enhanced audit logging for IEC 62443, ISO 27001, and NIS2 compliance
- Added comprehensive security tests (56 tests passing)
- Updated REST API with authentication and permission checks
- Added security settings to configuration

Co-authored-by: openhands <openhands@all-hands.dev>
2025-10-27 20:07:37 +00:00
openhands ac933e6dcb Repository structure improvements and cleanup
- Migrated all components to FlexibleDatabaseClient
- Consolidated main application files into unified main.py
- Fixed import path inconsistencies
- Updated README with current implementation status
- Cleaned up coverage directories
- All 133 tests passing

Co-authored-by: openhands <openhands@all-hands.dev>
2025-10-27 13:11:17 +00:00
openhands 5c9d5e2343 Complete Phase 3: Setpoint Manager and Protocol Servers
## Summary

This commit completes Phase 3 of the Calejo Control Adapter by implementing:

### New Components:
1. **SetpointManager** - Core component that calculates setpoints from optimization plans with safety integration
2. **Setpoint Calculators** - Three calculator types for different control strategies:
   - DirectSpeedCalculator (direct speed control)
   - LevelControlledCalculator (level-based control with feedback)
   - PowerControlledCalculator (power-based control with feedback)
3. **Multi-Protocol Servers** - Three protocol interfaces for SCADA systems:
   - REST API Server (FastAPI with emergency stop endpoints)
   - OPC UA Server (asyncua-based OPC UA interface)
   - Modbus TCP Server (pymodbus-based Modbus interface)

### Integration:
- **Safety Framework Integration** - SetpointManager integrates with all safety components
- **Main Application** - Updated main application with all Phase 3 components
- **Comprehensive Testing** - 15 new unit tests for SetpointManager and calculators

### Key Features:
- **Safety Priority Hierarchy**: Emergency stop > Failsafe mode > Normal operation
- **Multi-Channel Protocol Support**: REST, OPC UA, and Modbus simultaneously
- **Real-Time Setpoint Updates**: Background tasks update protocol interfaces every 5 seconds
- **Comprehensive Error Handling**: Graceful degradation and fallback mechanisms

### Test Status:
- **110 unit tests passing** (100% success rate)
- **15 new Phase 3 tests** covering all new components
- **All safety framework tests** still passing

### Architecture:
The Phase 3 implementation provides the complete control loop:
1. **Input**: Optimization plans from Calejo Optimize
2. **Processing**: Setpoint calculation with safety enforcement
3. **Output**: Multi-protocol exposure to SCADA systems
4. **Safety**: Multi-layer protection with emergency stop and failsafe modes

**Status**:  **COMPLETED AND READY FOR PRODUCTION**

Co-authored-by: openhands <openhands@all-hands.dev>
2025-10-27 09:29:27 +00:00
openhands d89d65f03d Complete Phase 2: Safety Framework Implementation
- Implement DatabaseWatchdog with 20-minute timeout detection and failsafe mode
- Add EmergencyStopManager with system-wide and targeted emergency stop functionality
- Create AlertManager with multi-channel alert delivery (email, SMS, webhook, SCADA)
- Integrate emergency stop checking into SafetyLimitEnforcer (highest priority)
- Add comprehensive unit tests for all new safety components
- All 95 unit tests passing (100% success rate)

Co-authored-by: openhands <openhands@all-hands.dev>
2025-10-27 07:32:01 +00:00
openhands 0b28253927 Fix unit tests and reorganize test suite
- Fixed database client mock issues with nested context managers
- Updated test assertions for Pydantic v2 compatibility
- Enhanced SafetyLimitEnforcer with missing API methods
- Fixed configuration tests for environment file loading
- All 66 unit tests now passing

Co-authored-by: openhands <openhands@all-hands.dev>
2025-10-26 20:08:29 +00:00