From 35cc2de4763b136806ebe66ace0f912511c4ef72 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Fri, 27 May 2016 14:05:30 +0200 Subject: [PATCH] lldpcli: display chassis TTL Fix #180. --- NEWS | 1 + src/client/display.c | 3 +++ tests/integration/test_basic.py | 1 + tests/integration/test_lldpcli.py | 3 +++ 4 files changed, 8 insertions(+) diff --git a/NEWS b/NEWS index 7b8fd070..1cbcad24 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ lldpd (0.9.4) * Change: + Make lldpd accepts a `-p` option to specify the PID file. + + lldpcli will now display chassis TTL when detailed view is enabled. lldpd (0.9.3) * Change: diff --git a/src/client/display.c b/src/client/display.c index 9817bade..b4da61ea 100644 --- a/src/client/display.c +++ b/src/client/display.c @@ -252,6 +252,9 @@ display_chassis(struct writer* w, lldpctl_atom_t* chassis, int details) } tag_datatag(w, "descr", "SysDescr", lldpctl_atom_get_str(chassis, lldpctl_k_chassis_descr)); + if (details) + tag_datatag(w, "ttl", "TTL", + lldpctl_atom_get_str(chassis, lldpctl_k_chassis_ttl)); /* Management addresses */ mgmts = lldpctl_atom_get(chassis, lldpctl_k_chassis_mgmt); diff --git a/tests/integration/test_basic.py b/tests/integration/test_basic.py index 3563c80e..f0043d85 100644 --- a/tests/integration/test_basic.py +++ b/tests/integration/test_basic.py @@ -21,6 +21,7 @@ def test_one_neighbor(lldpd1, lldpd, lldpcli, namespaces): "lldp.eth0.rid": "1", "lldp.eth0.chassis.mac": "00:00:00:00:00:02", "lldp.eth0.chassis.name": "ns-2.example.com", + "lldp.eth0.chassis.ttl": "120", "lldp.eth0.chassis.mgmt-ip": "fe80::200:ff:fe00:2", "lldp.eth0.chassis.Bridge.enabled": "off", "lldp.eth0.chassis.Wlan.enabled": "off", diff --git a/tests/integration/test_lldpcli.py b/tests/integration/test_lldpcli.py index 49e3b4b7..40a5e2c3 100644 --- a/tests/integration/test_lldpcli.py +++ b/tests/integration/test_lldpcli.py @@ -29,6 +29,7 @@ Interface: eth0, via: LLDP, RID: 1, Time: 0 day, 00:00:{seconds} ChassisID: mac 00:00:00:00:00:02 SysName: ns-2.example.com SysDescr: Spectacular GNU/Linux 2016 {uname} + TTL: 120 MgmtIP: fe80::200:ff:fe00:2 Capability: Bridge, off Capability: Router, {router} @@ -82,6 +83,7 @@ def test_json_output(lldpd1, lldpd, lldpcli, namespaces, uname): "value": "00:00:00:00:00:02" }, "descr": "Spectacular GNU/Linux 2016 {}".format(uname), + "ttl": "120", "mgmt-ip": "fe80::200:ff:fe00:2", "capability": [ {"type": "Bridge", "enabled": False}, @@ -125,6 +127,7 @@ def test_xml_output(lldpd1, lldpd, lldpcli, namespaces, uname): 00:00:00:00:00:02 ns-2.example.com Spectacular GNU/Linux 2016 {uname} + 120 fe80::200:ff:fe00:2 -- 2.39.5