From: Vincent Bernat Date: Tue, 14 Jun 2016 09:19:26 +0000 (+0200) Subject: lldpcli: fix manual page for port status X-Git-Tag: 0.9.4~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6934b73da82c4db3e10c4a372ee941d03e5774ef;p=thirdparty%2Flldpd.git lldpcli: fix manual page for port status Use rx-only, tx-only, rx-and-tx instead of rxOnly, txOnly, rxAndTx. Also add some tests. --- diff --git a/src/client/lldpcli.8.in b/src/client/lldpcli.8.in index b06e4b8c..01a8ab4d 100644 --- a/src/client/lldpcli.8.in +++ b/src/client/lldpcli.8.in @@ -415,12 +415,12 @@ the default TTL is 120 seconds. .Bd -ragged -offset XXXXXX Configure the administrative status of the given port. By default, all ports are configured to be in -.Ar rxAndTx +.Ar rx-and-tx mode. This means they can receive and transmit LLDP frames (as well as other protocols if needed). In -.Ar rxOnly +.Ar rx-only mode, they won't emit any frames and in -.Ar txOnly +.Ar tx-only mode, they won't receive any frames. In .Ar disabled mode, no frame will be sent and any incoming frame will be diff --git a/tests/integration/test_basic.py b/tests/integration/test_basic.py index 61ffaac8..3d74e98b 100644 --- a/tests/integration/test_basic.py +++ b/tests/integration/test_basic.py @@ -162,3 +162,69 @@ def test_portid_subtype_local_with_alias(lldpd1, lldpd, lldpcli, namespaces): out = lldpcli("-f", "keyvalue", "show", "neighbors") assert out["lldp.eth0.port.local"] == "localname" assert out["lldp.eth0.port.descr"] == "alias of eth1" + + +def test_port_status_txonly(lldpd, lldpcli, namespaces, links): + links(namespaces(1), namespaces(2)) + with namespaces(1): + lldpd() + lldpcli("configure", "lldp", "status", "tx-only") + with namespaces(2): + lldpd() + with namespaces(1): + out = lldpcli("-f", "keyvalue", "show", "neighbors") + assert out == {} + lldpcli("update") + with namespaces(2): + out = lldpcli("-f", "keyvalue", "show", "neighbors") + assert out["lldp.eth1.chassis.mac"] == "00:00:00:00:00:01" + + +def test_port_status_rxonly(lldpd, lldpcli, namespaces, links): + links(namespaces(1), namespaces(2)) + with namespaces(1): + lldpd() + lldpcli("configure", "lldp", "status", "rx-only") + with namespaces(2): + lldpd() + with namespaces(1): + out = lldpcli("-f", "keyvalue", "show", "neighbors") + assert out["lldp.eth0.chassis.mac"] == "00:00:00:00:00:02" + lldpcli("update") + with namespaces(2): + out = lldpcli("-f", "keyvalue", "show", "neighbors") + assert out == {} + + +def test_port_status_rxandtx(lldpd, lldpcli, namespaces, links): + links(namespaces(1), namespaces(2)) + with namespaces(1): + lldpd() + lldpcli("configure", "lldp", "status", "rx-and-tx") # noop + with namespaces(2): + lldpd() + with namespaces(1): + out = lldpcli("-f", "keyvalue", "show", "neighbors") + assert out["lldp.eth0.chassis.mac"] == "00:00:00:00:00:02" + lldpcli("update") + with namespaces(2): + out = lldpcli("-f", "keyvalue", "show", "neighbors") + assert out["lldp.eth1.chassis.mac"] == "00:00:00:00:00:01" + + +def test_port_status_disabled(lldpd, lldpcli, namespaces, links): + links(namespaces(1), namespaces(2)) + with namespaces(1): + lldpd() + lldpcli("configure", "lldp", "status", "disabled") + with namespaces(2): + lldpd() + with namespaces(1): + out = lldpcli("-f", "keyvalue", "show", "neighbors") + assert out == {} + lldpcli("update") + with namespaces(2): + out = lldpcli("-f", "keyvalue", "show", "neighbors") + assert out == {} + + diff --git a/tests/lldpcli.conf b/tests/lldpcli.conf index 4c048222..a74a4575 100644 --- a/tests/lldpcli.conf +++ b/tests/lldpcli.conf @@ -29,8 +29,8 @@ configure lldp portidsubtype local Batman configure lldp portidsubtype local Batman description Batman configure lldp tx-interval 30 configure lldp tx-hold 4 -configure lldp ports eth0 status txOnly -configure lldp status rxAndTx +configure lldp ports eth0 status tx-only +configure lldp status rx-and-tx configure lldp custom-tlv oui 33,44,55 subtype 44 configure lldp custom-tlv oui 33,44,55 subtype 44 oui-info 45,45,45,45,45 configure lldp custom-tlv add oui 33,44,55 subtype 44 oui-info 55,55,55,55,55