lldp: support multiple vlans

Previously we exported the contents of VLAN Name TLV in the 'vid'
(uint32) and 'vlan-name' (string) attributes. This is not entirely
correct as the TLV can appear multiple times.

We need a way to export all the VLAN IDs and names for the
neighbor. Add a new 'vlans' attribute which obsoletes the other two
and is an array of dictionaries, where each dictionary contains the
'vid' and 'name' keys.
This commit is contained in:
Beniamino Galvani
2018-12-20 18:31:45 +01:00
parent 6c52d946fc
commit c4be4ea298
4 changed files with 53 additions and 29 deletions

View File

@@ -741,7 +741,17 @@ class Device(ExportedObj):
'system-name': dbus.String('test2.example.com'),
'system-description': dbus.String('Test system #2'),
'system-capabilities': dbus.UInt32(2047),
'destination': dbus.String('nearest-non-tpmr-bridge')
'destination': dbus.String('nearest-non-tpmr-bridge'),
'ieee-802-1-vlans': dbus.Array([
dbus.Dictionary({
'vid': dbus.UInt32(80),
'name': dbus.String('vlan80'),
}, signature = 'sv'),
dbus.Dictionary({
'vid': dbus.UInt32(4000),
'name': dbus.String('My VLAN'),
}, signature = 'sv'),
]),
}),
dbus.Dictionary({
'chassis-id-type': dbus.UInt32(6),