Paul Donald 412c850f07
Some checks are pending
Build Kernel / Build all affected Kernels (push) Waiting to run
Build all core packages / Build all core packages for selected target (push) Waiting to run
lldpd: enable hardware inventory information (TLV) management
lldpd can send several hardware inventory TLV fields. Extend the init
script to provide these when the existing flag 'lldpmed_no_inventory' is
disabled. Five new methods provide default values for some of them,
taken from /etc/os-release and /etc/board.json.

There is no homogeneous method to determine the hardware serial number,
so it can be provided manually, as can asset ID.

Note: properties >= 32 characters are truncated at send time (by lldpd),
and some (Cisco) equipment displays junk after strings >= 32 characters.
So truncate to 31.

Tested on: 24.10.0 (known compatible with 22 and 23 also)

===
Example
===

The following lldpd config lines:

 configure inventory hardware-revision "v0"
 configure inventory software-revision "r28427-6df0e3d02a"
 configure inventory firmware-revision "OpenWrt 24.10.0"
 configure inventory serial-number "ABCDEF-123456"
 configure inventory manufacturer "glinet"
 configure inventory model "GL.iNet GL-MT6000"
 # 32 characters:
 configure inventory asset "abcdefghijklmnopqrstuvwxyz 12345"

Produce the following TLV (decoded by Wireshark):

Telecommunications Industry Association TR-41 Committee - Inventory - Hardware Revision
    1111 111. .... .... = TLV Type: Organization Specific (127)
    .... ...0 0000 0110 = TLV Length: 6
    Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee)
    Media Subtype: Inventory - Hardware Revision (0x05)
    Hardware Revision: v0
Telecommunications Industry Association TR-41 Committee - Inventory - Firmware Revision
    1111 111. .... .... = TLV Type: Organization Specific (127)
    .... ...0 0001 0011 = TLV Length: 19
    Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee)
    Media Subtype: Inventory - Firmware Revision (0x06)
    Firmware Revision: OpenWrt 24.10.0
Telecommunications Industry Association TR-41 Committee - Inventory - Software Revision
    1111 111. .... .... = TLV Type: Organization Specific (127)
    .... ...0 0001 0101 = TLV Length: 21
    Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee)
    Media Subtype: Inventory - Software Revision (0x07)
    Software Revision: r28427-6df0e3d02a
Telecommunications Industry Association TR-41 Committee - Inventory - Serial Number
    1111 111. .... .... = TLV Type: Organization Specific (127)
    .... ...0 0001 0100 = TLV Length: 20
    Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee)
    Media Subtype: Inventory - Serial Number (0x08)
    Serial Number: ABCDEF-123456
Telecommunications Industry Association TR-41 Committee - Inventory - Manufacturer Name
    1111 111. .... .... = TLV Type: Organization Specific (127)
    .... ...0 0000 1010 = TLV Length: 10
    Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee)
    Media Subtype: Inventory - Manufacturer Name (0x09)
    Manufacturer Name: glinet
Telecommunications Industry Association TR-41 Committee - Inventory - Model Name
    1111 111. .... .... = TLV Type: Organization Specific (127)
    .... ...0 0001 0101 = TLV Length: 21
    Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee)
    Media Subtype: Inventory - Model Name (0x0a)
    Model Name: GL.iNet GL-MT6000
Telecommunications Industry Association TR-41 Committee - Inventory - Asset ID
    1111 111. .... .... = TLV Type: Organization Specific (127)
    .... ...0 0010 0011 = TLV Length: 35
    Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee)
    Media Subtype: Inventory - Asset ID (0x0b)
    Asset ID: abcdefghijklmnopqrstuvwxyz 1234

The Cisco DUT displays:

Hardware Revision: 	v0
Firmware Revision: 	OpenWrt 24.10.0
Software Revision: 	r28427-6df0e3d02a
Serial Number:  ABCDEF-123456
Manufacturer Name: 	glinet
Model Name: 	GL.iNet GL-MT6000
Asset ID: 	abcdefghijklmnopqrstuvwxyz 1234

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/18354
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-04-11 22:51:06 +02:00
..
2025-04-05 01:46:47 -07:00