How pantheontech/lighty works
Project Type and Purpose
• lighty.io is an SDK/framework (not a monolithic app) for building Java-SE SDN controllers. It adapts core OpenDaylight components (MD-SAL, YANG Tools, clustering) to run in plain Java SE and provides a plugin architecture for SouthBound and NorthBound protocols, pluggable dependency-injection (Guice/Spring), example applications, YANG model artifacts, and resource assemblies.
Key Parts of the File Structure
• Top-level Maven aggregator (pom.xml) that pulls in:
· lighty-core (controller, clustering, codecs, DI extensions)
· lighty-modules (SouthBound plugins: NETCONF, gNMI; NorthBound plugins: RESTCONF, OpenAPI; AAA)
· lighty-examples (sample applications using the framework)
· lighty-models (YANG modules)
· lighty-applications (ready-to-run controller apps packaged with Docker/Helm)
· lighty-resources (configuration assemblies and startup scripts)
· tests and CI workflows
a. Java SE Runtime Layer
• Represents the plain-Java environment (JDK 21).
b. Core Controller (lighty-core)
• MD-SAL services: Datastores (config/operational), RPC framework, Notifications
• YANG Tools integration
• Clustering service (Akka/Kubernetes handler)
• Codec utilities (JSON/XML converters)
c. Dependency-Injection Layer
• Guice module loader or Spring context loader (choose one per app).
• Responsible for wiring Core + Modules.
d. Module Container
• AbstractLightyModule registry, lifecycle (start/stop/restart modules).
e. SouthBound Protocol Plugins (lighty-modules/netconf-sb, lighty-modules/gnmi-sb)
• NETCONF SB: establishes sessions to devices, call-home plugin, NMDA support
• gNMI SB: gNMI session manager, request builders, GNOI invokers (file, system, cert storage)
f. NorthBound Protocol Plugins (lighty-modules/restconf-nb-community, lighty-modules/openapi)
• RESTCONF community API with YANG-driven resources
• OpenAPI (REST + Swagger) endpoints
g. AAA Module
• Authentication/authorization service exposing HTTP endpoint on Jetty
h. Jetty Server Abstraction (lighty-modules/jetty-server)
• HTTP/2 & HTTPS server builder, security configuration
i. Applications (lighty-applications)
• Aggregator projects that bundle the Core + selected Modules + DI choice + resource configs
• Packaged into Docker images and Helm charts
j. External Systems
• SouthBound: real network devices speaking NETCONF or gNMI
• NorthBound: clients (CLI, Postman, external orchestrators) calling RESTCONF or OpenAPI
k. Examples and Tests
• Demonstrate usage and provide integration test suites
Component Interactions and Data Flow
• On startup, the application’s main() boots the DI layer (Guice or Spring).
• DI initializes the Core Controller services and Module Container.
• Module Container invokes each Module’s onModuleStart(), registering RPCs, listeners, datastore initializers.
• SB Plugins create and manage sessions to devices, push data into the operational datastore, trigger notifications.
• NB Plugins serve configuration and operational data from datastores via RESTCONF endpoints (Jetty), and handle RPCs (e.g., RPCs to initiate gNMI operations).
• AAA Module intercepts northbound requests for authentication/authorization.
• Clustering handler replicates datastores/notifications among controller instances if deployed in Kubernetes.
• Applications supply configuration files (YANG init data), resource assemblies, and start-up scripts.
Architectural Patterns and Principles
• Plugin Architecture: Modules conform to a LightyModule API and are loosely coupled
• Layered Architecture: Java SE → Core Services → DI Layer → Module Container → Protocol Plugins → Applications
• Dependency Injection: Guice or Spring choice isolates wiring logic
• Aggregator Pattern: Maven aggregator projects bundle only needed modules for a controller flavor
• YANG-driven Data Modeling: All north-/south-bound interactions use YANG schemas