]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
client: display port administrative status with "show interfaces"
authorVincent Bernat <vincent@bernat.ch>
Sun, 28 Feb 2021 15:29:41 +0000 (16:29 +0100)
committerVincent Bernat <vincent@bernat.ch>
Mon, 1 Mar 2021 08:50:04 +0000 (09:50 +0100)
Fix #432.

NEWS
src/client/display.c
tests/integration/test_basic.py

diff --git a/NEWS b/NEWS
index 5587209272b793a5f4e260580d67e2e8b3eef578..14d7893403e0727da21158a8f5e93df1156e6154 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 lldpd (1.0.9)
   * Fix:
     + Do not use interface alias if we set it ourselves.
+  * Changes:
+    + Display port status with "show interfaces".
 
 lldpd (1.0.8)
   * Fix:
index c6011809f4e132090ea85001c6a427bf99e538cc..ab2061404c364b613ed9ece12244d10fe5ea4aea 100644 (file)
@@ -726,6 +726,10 @@ display_interface(lldpctl_conn_t *conn, struct writer *w, int hidden,
                tag_attr(w, "age" , "Time",
                    display_age(lldpctl_atom_get_int(port, lldpctl_k_port_age)));
        }
+       if (local) {
+               tag_datatag(w, "status", "Administrative status",
+                   lldpctl_atom_get_str(port, lldpctl_k_port_status));
+       }
 
        display_chassis(w, chassis, details);
        display_port(w, port, details);
@@ -818,7 +822,7 @@ display_local_interfaces(lldpctl_conn_t *conn, struct writer *w,
        tag_start(w, "lldp", "LLDP interfaces");
        while ((iface = cmd_iterate_on_interfaces(conn, env))) {
                lldpctl_atom_t *port;
-               port      = lldpctl_get_port(iface);
+               port = lldpctl_get_port(iface);
                display_interface(conn, w, hidden, iface, port, details, protocol);
                lldpctl_atom_dec_ref(port);
        }
index c89c1dbee10de9cbd895814a7f5bc8d509b28bf5..a470c7f632fadacad567ddb42b64da1d629040fe 100644 (file)
@@ -62,7 +62,7 @@ def test_one_interface(lldpd1, lldpd, lldpcli, namespaces):
         del out['lldp.eth0.chassis.descr']
         del out['lldp.eth0.chassis.Router.enabled']
         del out['lldp.eth0.chassis.Station.enabled']
-        assert out == {"lldp.eth0.via": "unknown",
+        assert out == {"lldp.eth0.status": "RX and TX",
                        "lldp.eth0.chassis.mac": "00:00:00:00:00:01",
                        "lldp.eth0.chassis.name": "ns-1.example.com",
                        "lldp.eth0.chassis.mgmt-ip": "fe80::200:ff:fe00:1",