UCI Configuration Plugin

From OLSR.org Wiki
Jump to: navigation, search

The UCI Configuration Plugin allows OONF to directly read UCI files for OpenWrt. It uses the libuci library of OpenWrt.

OONF Configuration Sections, key/value pairs and lists are directly implemented with their equivalent of the UCI format. Named Sections expect the name key being used for defining the name of the Section. The reason for this is that UCI does not support multiple different sections with the same name.

The following example defines a configuration with section type domain and the section name 0.

config domain
  list   'name'        '0'
  option 'table'       '11'

Dealing with interface names

version 0.12.0 and later

The uci_loader plugin now contains code to read the OpenWRT network configuration. Each subsystem that deals with an interface name (not just the interface section) runs the configuration through a translation function that will automatically convert OpenWRT logical interface names into physical ones. The "ifname" parameter is not necessary anymore.

config interface
  list   'name'      'lan'

before version 0.12.0

There is a single difficulty that cannot be easily dealt with in this Plugin. Some OONF Configuration Sections except the physical interface as their name (especially the interface section), but OpenWRT normally defines a logical name which would require an additional lookup in a different OpenWrt configuration file.

Instead of hardcoding OpenWrt configuration details into this plugin, this conversion is dealt with a small conversion script that copies the configuration file, takes the OpenWrt interface name through the ifname key and creates a name key/value based on the content of the OpenWrt network configuration.

The following example defines a configuration with section type interface and a section name with the physical device name for the OpenWrt interface lan

config interface
  list   'ifname'      'lan'

See the olsrd2.init file in the /openwrt/oonf-olsrd2-git directory and the scripts in the /openwrt/oonf-init-scripts directory of the OONF Repository to learn how the conversion works.