netjsonconfig icon indicating copy to clipboard operation
netjsonconfig copied to clipboard

[feature] Add support for BATMAN-adv and 802.11s mesh interfaces in O…

Open OliverKruecken opened this issue 2 months ago • 0 comments

Checklist

  • [x] I have read the OpenWISP Contributing Guidelines.
  • [x] I have manually tested the changes proposed in this pull request.
  • [x] I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • [x] I have updated the documentation.

Reference to Existing Issue

Closes #368

Description

This PR adds comprehensive support for BATMAN-adv (Better Approach To Mobile Ad-hoc Networking) mesh networking protocol and 802.11s wireless mesh interfaces to the OpenWrt backend.

Changes

New Interface Types

Implements three new interface types for the OpenWrt backend:

  • batadv: Main BATMAN-adv virtual mesh interface

    • Configurable routing algorithm (BATMAN_IV, BATMAN_V)
    • Bridge loop avoidance settings
    • Gateway mode (off, client, server)
    • Hop penalty, MTU, and fragmentation controls
  • batadv_hardif: Physical/hard interfaces for mesh participation

    • Device binding and master interface association
  • mesh: Convenience alias for 802.11s wireless mesh interfaces (equivalent to batadv_hardif)

Schema Extensions

  • Added JSON Schema definitions for all three interface types
  • Added mesh-specific wireless properties (mesh_fwding, mesh_rssi_threshold)
  • Added WPA3 Personal encryption support for mesh networks with CCMP cipher

Converter Implementation

  • Implemented bidirectional conversion (NetJSON ↔ OpenWrt UCI) in the Interfaces converter
  • Added forward conversion methods: _intermediate_batadv, _intermediate_batadv_hardif, _intermediate_mesh
  • Added backward conversion methods: _netjson_batadv, _netjson_batadv_hardif, _netjson_mesh
  • Updated WireguardPeers converter to properly filter blocks by type

Documentation

  • Added comprehensive documentation to docs/source/backends/openwrt.rst (197 lines)
  • Included configuration parameter reference tables
  • Provided multiple working examples (basic and complete mesh setups)

Files Changed

  • docs/source/backends/openwrt.rst (+197 lines)
  • netjsonconfig/backends/openwrt/converters/interfaces.py (+58 lines)
  • netjsonconfig/backends/openwrt/converters/wireguard_peers.py (+7 lines)
  • netjsonconfig/backends/openwrt/schema.py (+116 lines)
  • netjsonconfig/schema.py (+46 lines)

Total: 424 insertions, 1 deletion

Testing

  • [x] All existing tests pass
  • [x] New converter methods tested
  • [x] Schema validation tested
  • [x] Documentation examples verified

Backward Compatibility

  • Maintains full backward compatibility with existing configurations
  • No breaking changes to existing interface types
  • Follows established netjsonconfig converter patterns

OliverKruecken avatar Oct 18 '25 17:10 OliverKruecken