How vaibhavhd/flowguard works
Project type and purpose
• Flowguard is a network‐security plugin for the OpenDaylight (ODL) SDN controller.
• It consists of multiple Maven subprojects (API, implementation, CLI, features, Karaf assembly, integration tests) that together provide:
• A YANG‐defined northbound API for firewall‐rule management and conflict detection.
• An implementation that uses MD‐SAL (Model-Driven Service Abstraction Layer) to observe and resolve flow conflicts in OpenFlow switches.
• A CLI and REST interfaces for rule insertion and control operations.
• A visualizer bundle for DLUX (Web UI) to display topologies, flows, and conflicts.
File structure and map to high‐level components
• code/api → YANG models (flowguard.yang) + generated API stubs.
• code/impl → Java implementation:
• Registry data‐change listeners and callbacks
• Packet parsing and header‐space analysis
• Core engine (FlowguardImpl, FlowguardProvider)
• code/cli → Blueprint‐driven CLI bundle: RPC wiring, command definitions.
• code/features → Feature descriptors (features.xml) grouping API, impl, CLI, REST, UI.
• code/karaf → Karaf assembly: container configuration, deployable bundles.
• code/it → Integration tests exercising RPCs and end‐to‐end behavior.
• External scripts & data (results/scripts, data/) drive Mininet, invoke REST RPCs, collect logs.
README for runtime architecture
• Flowguard deploys into an ODL Karaf container alongside other features (e.g., openflow‐visualizer).
• Northbound RESTCONF calls invoke YANG RPCs (add‐fwrule, get‐conflicts, flowguard‐control).
• MD‐SAL datastore notifications trigger Flowguard’s data‐change listeners.
• Southbound: Flowguard issues flow‐modifications via MD‐SAL to OpenFlow plugin to push OpenFlow rules.
• DLUX UI modules display topology and conflict visualization.
a. Main components
• External systems:
• Operator CLI / REST client (scripts, curl)
• Mininet network of Open vSwitch (OVS) switches & hosts
• DLUX Web UI (Topology, OfVisualizer)
• ODL Karaf container:
• flowguard‐api bundle (YANG models, generated Java)
• flowguard‐impl bundle (core engine, packet parsing, data listeners)
• flowguard‐cli bundle (commands + Blueprint wiring)
• flowguard‐rest/UI bundles (if present)
• MD‐SAL datastore
• OpenFlow southbound plugin
• Other features (e.g., openflow‐visualizer)
b. Relationships & data flows
1. Operator issues RESTCONF RPC to /restconf/operations/flowguard:add-fwrule
2. RESTCONF subsystem routes to flowguard-api (YANG) → flowguard-cli if CLI RPCs
3. flowguard-api invokes flowguard-impl provider via MD‐SAL RPC callback
4. flowguard-impl registers new firewall rule in its registry and writes to MD‐SAL operational datastore
5. DataChangeListener in flowguard-impl picks up changes → triggers conflict detection via header‐space analysis
6. flowguard-impl issues MD‐SAL write to send flow‐mods southbound to OpenFlow plugin
7. OpenFlow plugin sends OFPT_FLOW_MOD to switches
8. DLUX UI & ofvisualizer bundle subscribe to topology & flow tables → render topology + conflicts
9. Integration tests & scripts interact via RESTCONF & verify logs
c. Key architectural patterns
• Model-Driven Service Abstraction Layer (MD-SAL)
• YANG‐based RPC API → Java API (generated stubs) → Implementation (Blueprint wiring)
• Event-driven listeners (DataChangeListenerFuture)
• Modular OSGi bundles in Karaf
d. Technologies & frameworks
• Java 8, Maven, OSGi
• ODL MD-SAL, YANG, RESTCONF, Blueprint
• OpenFlow southbound plugin
• DLUX (Angular, web UI)
• Mininet for test network
Summary of essential elements
• Components: REST client, Karaf container (with API, impl, CLI, features), MD-SAL, OpenFlow southbound, Mininet network, DLUX UI
• Interactions: YANG RPC → MD-SAL writes/reads → conflict detection → flow‐mod southbound → switch installs
• Patterns: MD-SAL event bus, OSGi modularity, YANG‐driven API
• Technologies: Java/Maven, ODL controller, OpenFlow, Mininet, RESTCONF, Blueprint, DLUX