Overview

The lighty-netconf-device library is a fully programmable NETCONF communication stack that can be integrated with hardware to achieve interoperability with lighty.io NETCONF–RESTCONF controllers. It implements a server for RFC 6241 and provides related services like Datastore, RPC handling, and NETCONF protocol operations.

In this use case, we deploy it on a Raspberry Pi 3 (Broadcom ARM v7 BCM2835 SoC) to control physical I/O — LEDs, a temperature sensor, humidity sensor, and atmospheric pressure sensor — all through a custom YANG model.

The YANG Model

module rpi-device {
    yang-version 1.1;
    namespace "urn:tech.pantheon.netconfdevice.rpid";
    prefix "dc";
    organization "Pantheon Technologies";

    grouping led-data {
        leaf led-id {
            type int8 { range "0..3"; }
        }
        leaf led-status {
            type boolean;
            description "LED port status: true=high/on, false=low/off.";
        }
    }

    container RpiDevice {
        leaf device-name { type string; }
        leaf temperature {
            type decimal64 { fraction-digits 3; range "-200..200"; }
            config false;
            description "Ambient temperature in Celsius [C].";
        }
        leaf relative-humidity {
            type decimal64 { fraction-digits 3; range "0..100"; }
            config false;
            description "Ambient relative humidity [%].";
        }
        leaf atmospheric-pressure {
            type decimal64 { fraction-digits 3; range "0..1000000"; }
            config false;
            description "Atmospheric Pressure in pascals [Pa].";
        }
        list led-indicators {
            config false;
            key "led-id";
            uses led-data;
        }
    }

    rpc set-led {
        description "Set LED port status high/on or low/off.";
        input  { uses led-data; }
        output { uses led-data; }
    }
}

SDN Controller Setup

Use lighty-netconf-restconf-app as the SDN controller. It uses OpenDaylight core components, the NETCONF southbound plugin, and PANTHEON's RESTCONF RFC 8040 implementation as the northbound plugin.

Step 1: Connect the Raspberry Pi Device

POST https://localhost:8888/restconf/data/network-topology:network-topology/topology=topology-netconf

{
    "netconf-topology:node": [{
        "node-id": "rpi-device",
        "host": "192.68.0.102",
        "port": 17830,
        "username": "admin",
        "password": "admin",
        "tcp-only": false,
        "keepalive-delay": 0,
        "netconf-node-configuration:schemaless": false
    }]
}

→ reply 201 Created

Step 2: Read Device State

GET https://localhost:8888/restconf/data/network-topology:network-topology/topology=topology-netconf?content=nonconfig

This returns the operational state of the connected device, including current sensor readings.

Step 3: Toggle an LED via RPC

POST https://localhost:8888/restconf/operations/network-topology:network-topology/topology=topology-netconf/node=rpi-device/yang-ext:mount/rpi-device:set-led

{
    "input": {
        "led-id": 0,
        "led-status": true
    }
}

→ reply 200:
{
    "output": {
        "led-status": true,
        "led-id": 0
    }
}
Key insight: You don't need to write your own YANG models from scratch. You can search for open-source models from standard bodies like IETF or OpenConfig — or start with community models and adapt them for your hardware.

What the lighty-netconf-device Library Provides

Architecture Summary

The complete stack from hardware to management: