mbox series

[ovs-dev,v9,0/3] lldp: Add ovs-appctl lldp/neighbor command.

Message ID 20250715083320.3747342-1-changliang.wu@smartx.com
Headers show
Series lldp: Add ovs-appctl lldp/neighbor command. | expand

Message

Changliang Wu July 15, 2025, 8:33 a.m. UTC
New appctl 'lldp/neighbor' displays lldp neighbor information.
Support json output with --format json --pretty
Supoort dot1 and dot3 tlv

Example outputs would be:
$ ovs-appctl lldp/neighbor
LLDP neighbor:
Interface: p1
  Chassis:
    Chassis ID:         aa:aa:aa:aa:aa:aa
    SysName:            FakeSystemName
    SysDescr:           FakeSystemDesc
    MgmtIP:             192.168.0.1
    MgmtIface:          635
    Capability:         Bridge, on
    Capability:         Router, on
  Port:
    PortID:             GigabitEthernet1/0/15
    PortDescr:          GigabitEthernet1/0/15 Interface
    TTL:                121
    MFS:                10240
    PMD autoneg: supported: yes, enabled: yes
      Adv:              10Base-T, HD: yes, FD: yes
      Adv:              100Base-TX, HD: yes, FD: yes
      Adv:              1000Base-T, HD: no, FD: yes
      MAU oper type:    30
    MDI Power: supported: yes, enabled: no, pair control: no
  VLAN:               1, pvid: yes, VLAN 0001
  PPVID:              supported: yes,enabled no

$ ovs-appctl --format json --pretty lldp/neighbor
{
  "lldp": {
    "interface": {
      "p1": {
        "chassis": {
          "FakeSystemName": {
            "capability": [
              {
                "enabled": true,
                "type": "Bridge"},
              {
                "enabled": true,
                "type": "Router"}],
            "descr": "FakeSystemDesc",
            "id": {
              "type": "mac",
              "value": "aa:aa:aa:aa:aa:aa"},
            "mgmt-iface": [
              635],
            "mgmt-ip": [
              "192.168.0.1"]}},
        "port": {
          "auto-negotiation": {
            "current": 30,
            "enabled": true,
            "supported": true},
          "desc": "GigabitEthernet1/0/15 Interface",
          "id": {
            "type": "ifname",
            "value": "GigabitEthernet1/0/15"},
          "mfs": 10240,
          "power": {
            "enabled": false,
            "paircontrol": false,
            "supported": true},
          "ttl": 121},
        "ppvid": {
          "enabled": false,
          "supported": true},
        "vlan": {
          "pvid": true,
          "value": "VLAN 0001",
          "vlan-id": 1}}}}}

 v2: fix code lint and build warn
 v3: fix more static analyze error
 v4: fix build error
 v5: add json output, add NEWS
 v6: add dot1 and dot3, fix review problems
 v7: split patch to patch set
 v8: refactor dot1 and dot3 from lldpd, fix review problems
 v9: clean dot1,dot3 list, fix review problems

Changliang Wu (3):
  lldp: Add ovs-appctl lldp/neighbor command.
  lldp: Decode dot1,3 tlv and display in lldp/neighbor.
  tests: lldp: Add testcases for lldp/neighbor.

 NEWS                       |   3 +
 lib/lldp/lldp-const.h      |   5 +
 lib/lldp/lldp.c            | 164 ++++++++-
 lib/lldp/lldpd-structs.c   |  31 ++
 lib/lldp/lldpd-structs.h   |  69 ++++
 lib/ovs-lldp.c             | 678 +++++++++++++++++++++++++++++++++++++
 tests/automake.mk          |   1 +
 tests/ovs-lldp.at          | 227 +++++++++++++
 tests/testsuite.at         |   1 +
 vswitchd/ovs-vswitchd.8.in |   4 +
 10 files changed, 1181 insertions(+), 2 deletions(-)
 create mode 100644 tests/ovs-lldp.at

Comments

Eelco Chaudron July 16, 2025, 1:22 p.m. UTC | #1
On 15 Jul 2025, at 10:33, Changliang Wu wrote:

> New appctl 'lldp/neighbor' displays lldp neighbor information.
> Support json output with --format json --pretty
> Supoort dot1 and dot3 tlv
Hi Changliang,

Unfortunately, I haven’t had time to do a proper review of the patch, as I’m about to go on PTO for a couple of weeks.

One thing I personally don’t like is the current CLI and JSON output format. I understand they are structured around lldpd’s format, but I find them confusing, especially the JSON, which may not be straightforward to parse. Please see my earlier comments on the v5 version of this patch for more details.

If others believe that lldpd compatibility (particularly on the JSON side) is more important, I'm okay with proceeding. Perhaps we can revisit and improve the CLI output later to make it more user-friendly, rather than a strict replica of lldpd. After all, the JSON output is the one intended for parsing.

Cheers,

Eelco

> Example outputs would be:
> $ ovs-appctl lldp/neighbor
> LLDP neighbor:
> Interface: p1
>   Chassis:
>     Chassis ID:         aa:aa:aa:aa:aa:aa
>     SysName:            FakeSystemName
>     SysDescr:           FakeSystemDesc
>     MgmtIP:             192.168.0.1
>     MgmtIface:          635
>     Capability:         Bridge, on
>     Capability:         Router, on
>   Port:
>     PortID:             GigabitEthernet1/0/15
>     PortDescr:          GigabitEthernet1/0/15 Interface
>     TTL:                121
>     MFS:                10240
>     PMD autoneg: supported: yes, enabled: yes
>       Adv:              10Base-T, HD: yes, FD: yes
>       Adv:              100Base-TX, HD: yes, FD: yes
>       Adv:              1000Base-T, HD: no, FD: yes
>       MAU oper type:    30
>     MDI Power: supported: yes, enabled: no, pair control: no
>   VLAN:               1, pvid: yes, VLAN 0001
>   PPVID:              supported: yes,enabled no
>
> $ ovs-appctl --format json --pretty lldp/neighbor
> {
>   "lldp": {
>     "interface": {
>       "p1": {
>         "chassis": {
>           "FakeSystemName": {
>             "capability": [
>               {
>                 "enabled": true,
>                 "type": "Bridge"},
>               {
>                 "enabled": true,
>                 "type": "Router"}],
>             "descr": "FakeSystemDesc",
>             "id": {
>               "type": "mac",
>               "value": "aa:aa:aa:aa:aa:aa"},
>             "mgmt-iface": [
>               635],
>             "mgmt-ip": [
>               "192.168.0.1"]}},
>         "port": {
>           "auto-negotiation": {
>             "current": 30,
>             "enabled": true,
>             "supported": true},
>           "desc": "GigabitEthernet1/0/15 Interface",
>           "id": {
>             "type": "ifname",
>             "value": "GigabitEthernet1/0/15"},
>           "mfs": 10240,
>           "power": {
>             "enabled": false,
>             "paircontrol": false,
>             "supported": true},
>           "ttl": 121},
>         "ppvid": {
>           "enabled": false,
>           "supported": true},
>         "vlan": {
>           "pvid": true,
>           "value": "VLAN 0001",
>           "vlan-id": 1}}}}}
>
>  v2: fix code lint and build warn
>  v3: fix more static analyze error
>  v4: fix build error
>  v5: add json output, add NEWS
>  v6: add dot1 and dot3, fix review problems
>  v7: split patch to patch set
>  v8: refactor dot1 and dot3 from lldpd, fix review problems
>  v9: clean dot1,dot3 list, fix review problems
>
> Changliang Wu (3):
>   lldp: Add ovs-appctl lldp/neighbor command.
>   lldp: Decode dot1,3 tlv and display in lldp/neighbor.
>   tests: lldp: Add testcases for lldp/neighbor.
>
>  NEWS                       |   3 +
>  lib/lldp/lldp-const.h      |   5 +
>  lib/lldp/lldp.c            | 164 ++++++++-
>  lib/lldp/lldpd-structs.c   |  31 ++
>  lib/lldp/lldpd-structs.h   |  69 ++++
>  lib/ovs-lldp.c             | 678 +++++++++++++++++++++++++++++++++++++
>  tests/automake.mk          |   1 +
>  tests/ovs-lldp.at          | 227 +++++++++++++
>  tests/testsuite.at         |   1 +
>  vswitchd/ovs-vswitchd.8.in |   4 +
>  10 files changed, 1181 insertions(+), 2 deletions(-)
>  create mode 100644 tests/ovs-lldp.at
>
> -- 
> 2.43.5
Changliang Wu July 17, 2025, 1:34 a.m. UTC | #2
Hi Eelco,

On Wed, Jul 16, 2025 at 9:22 PM Eelco Chaudron <echaudro@redhat.com> wrote:
>
>
>
> On 15 Jul 2025, at 10:33, Changliang Wu wrote:
>
> > New appctl 'lldp/neighbor' displays lldp neighbor information.
> > Support json output with --format json --pretty
> > Supoort dot1 and dot3 tlv
> Hi Changliang,
>
> Unfortunately, I haven’t had time to do a proper review of the patch, as I’m about to go on PTO for a couple of weeks.
Thanks for letting me know. Enjoy your time off!
>
> One thing I personally don’t like is the current CLI and JSON output format. I understand they are structured around lldpd’s format, but I find them confusing, especially the JSON, which may not be straightforward to parse. Please see my earlier comments on the v5 version of this patch for more details.
>
> If others believe that lldpd compatibility (particularly on the JSON side) is more important, I'm okay with proceeding. Perhaps we can revisit and improve the CLI output later to make it more user-friendly, rather than a strict replica of lldpd. After all, the JSON output is the one intended for parsing.
This seems a good suggestion, and Aaron also has some issues with the
CLI output format, maybe we can continue with this approach?
>
> Cheers,
>
> Eelco
>
> > Example outputs would be:
> > $ ovs-appctl lldp/neighbor
> > LLDP neighbor:
> > Interface: p1
> >   Chassis:
> >     Chassis ID:         aa:aa:aa:aa:aa:aa
> >     SysName:            FakeSystemName
> >     SysDescr:           FakeSystemDesc
> >     MgmtIP:             192.168.0.1
> >     MgmtIface:          635
> >     Capability:         Bridge, on
> >     Capability:         Router, on
> >   Port:
> >     PortID:             GigabitEthernet1/0/15
> >     PortDescr:          GigabitEthernet1/0/15 Interface
> >     TTL:                121
> >     MFS:                10240
> >     PMD autoneg: supported: yes, enabled: yes
> >       Adv:              10Base-T, HD: yes, FD: yes
> >       Adv:              100Base-TX, HD: yes, FD: yes
> >       Adv:              1000Base-T, HD: no, FD: yes
> >       MAU oper type:    30
> >     MDI Power: supported: yes, enabled: no, pair control: no
> >   VLAN:               1, pvid: yes, VLAN 0001
> >   PPVID:              supported: yes,enabled no
> >
> > $ ovs-appctl --format json --pretty lldp/neighbor
> > {
> >   "lldp": {
> >     "interface": {
> >       "p1": {
> >         "chassis": {
> >           "FakeSystemName": {
> >             "capability": [
> >               {
> >                 "enabled": true,
> >                 "type": "Bridge"},
> >               {
> >                 "enabled": true,
> >                 "type": "Router"}],
> >             "descr": "FakeSystemDesc",
> >             "id": {
> >               "type": "mac",
> >               "value": "aa:aa:aa:aa:aa:aa"},
> >             "mgmt-iface": [
> >               635],
> >             "mgmt-ip": [
> >               "192.168.0.1"]}},
> >         "port": {
> >           "auto-negotiation": {
> >             "current": 30,
> >             "enabled": true,
> >             "supported": true},
> >           "desc": "GigabitEthernet1/0/15 Interface",
> >           "id": {
> >             "type": "ifname",
> >             "value": "GigabitEthernet1/0/15"},
> >           "mfs": 10240,
> >           "power": {
> >             "enabled": false,
> >             "paircontrol": false,
> >             "supported": true},
> >           "ttl": 121},
> >         "ppvid": {
> >           "enabled": false,
> >           "supported": true},
> >         "vlan": {
> >           "pvid": true,
> >           "value": "VLAN 0001",
> >           "vlan-id": 1}}}}}
> >
> >  v2: fix code lint and build warn
> >  v3: fix more static analyze error
> >  v4: fix build error
> >  v5: add json output, add NEWS
> >  v6: add dot1 and dot3, fix review problems
> >  v7: split patch to patch set
> >  v8: refactor dot1 and dot3 from lldpd, fix review problems
> >  v9: clean dot1,dot3 list, fix review problems
> >
> > Changliang Wu (3):
> >   lldp: Add ovs-appctl lldp/neighbor command.
> >   lldp: Decode dot1,3 tlv and display in lldp/neighbor.
> >   tests: lldp: Add testcases for lldp/neighbor.
> >
> >  NEWS                       |   3 +
> >  lib/lldp/lldp-const.h      |   5 +
> >  lib/lldp/lldp.c            | 164 ++++++++-
> >  lib/lldp/lldpd-structs.c   |  31 ++
> >  lib/lldp/lldpd-structs.h   |  69 ++++
> >  lib/ovs-lldp.c             | 678 +++++++++++++++++++++++++++++++++++++
> >  tests/automake.mk          |   1 +
> >  tests/ovs-lldp.at          | 227 +++++++++++++
> >  tests/testsuite.at         |   1 +
> >  vswitchd/ovs-vswitchd.8.in |   4 +
> >  10 files changed, 1181 insertions(+), 2 deletions(-)
> >  create mode 100644 tests/ovs-lldp.at
> >
> > --
> > 2.43.5
>