How telecominfraproject/wlan-cloud-ucentralgw works
Project Type and Purpose
• This is a full-blown C++ microservice (“OpenWiFi Gateway” or OWGW) in the TIP OpenWiFi CloudSDK.
• It mediates between Access Points (APs) speaking the uCentral protocol over WebSockets and northbound clients via a REST/OpenAPI interface.
• It also integrates with Kafka (telemetry/events) and a backing database (MySQL/PostgreSQL via CMake-detected drivers) for persistence.
File Structure
• Top-level “src/” contains:
• AP_WS_* modules → manage uCentral WebSocket sessions and message processing.
• RESTAPI/ & RESTObjects/ → HTTP handlers generated from the OpenAPI spec (openapi/owgw.yaml).
• framework/ → generic microservice base, REST servers, WebSocket servers, Kafka manager, event bus, config validator.
• storage/ → CRUD modules for each domain object (devices, firmware, stats, scripts).
• TelemetryClient/KafkaEvents → event publication to Kafka topics defined in KAFKA.md.
• rttys/ & rtty_ui/ → optional CLI Web UI for diagnostics (RTTY).
• Non-code directories:
• Dockerfile, helm/ → container and Kubernetes deployment.
• CMakeLists.txt & cmake/ → cross-platform build and dependency detection (MySQL, PostgreSQL, RdKafka).
• openapi/ & PROTOCOL.md → formal definitions driving codegen.
• cert_scripts/ & certificates/ → TLS artifacts for device‐gateway and REST security.
• test_scripts/ → example CURL and Python automation demonstrating API usage.
Insights from README
• OWGW is defined as a microservice with an OpenAPI spec, uses uCentral protocol for device communication, and publishes/consumes Kafka messages.
• It supports two main network interfaces:
a. Southbound: secure WebSocket (wss) on port 15002 to APs.
b. Northbound: HTTPS REST API on port 16002.
• Data flows into internal processors (telemetry, health check, logs, etc.), where domain logic and storage calls happen.
Key Components
a. Southbound WebSocket Endpoint (AP_WS_Server)
• Protocol: WSS (port configurable, default 15002)
b. REST/OpenAPI Server
• Protocol: HTTPS (default 16002)
c. Core Processing Modules
• Message Router / Reactor Pool
• CommandManager / ScriptManager
• TelemetryClient & GenericScheduler
• EventBusManager & KafkaManager
d. Storage Layer
• “StorageService” calling SQL backends (MySQL/PostgreSQL)
• Domain stores (devices, configs, scripts, logs, stats)
e. Kafka Cluster
• Topics for telemetry, events, commands
f. RTTY UI (optional)
• Local Web interface served by RTTYS_WebServer
g. Auxiliary
• Configuration files (owgw.properties)
• TLS Certificates (server, REST, client CAs)
• Helm / Docker / systemd for deployment
Relationships & Data Flows
• APs → (WSS) → AP_WS_Server → ReactorPool → Domain Processors → StorageService & KafkaManager → Kafka
• REST Clients → (HTTPS) → RESTAPI Server → REST Handlers → StorageService / CommandManager
• ScriptManager publishes scripts to AP via AP_WS_Connection
• TelemetryClient consumes AP events, publishes to Kafka
• RTTY UI ← WebSocket ← UI_GW_WebSocketNotifications
• All modules retrieve config from CentralConfig via ConfigurationCache
Architectural Patterns & Design Principles
• Microservice base class enforces consistent startup, health checks, metrics.
• Event‐driven: EventBusManager decouples producers and consumers.
• Modular layering: framework → core processors → storage → external systems.
• Codegen for REST/Objects ensures schema‐driven consistency.