]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
client: rename max-neighbor command
authorVincent Bernat <vincent@bernat.ch>
Sat, 6 Apr 2019 11:20:51 +0000 (13:20 +0200)
committerVincent Bernat <vincent@bernat.ch>
Sat, 6 Apr 2019 11:22:35 +0000 (13:22 +0200)
NEWS
src/client/conf-lldp.c
src/client/conf-system.c
src/client/lldpcli.8.in
tests/integration/test_lldpcli.py
tests/lldpcli.conf

diff --git a/NEWS b/NEWS
index 41c44e6b387bb1fecf7f2d15dd86c5d411c93b90..4ce189e1a1dbc9c68207adb617dbb5bac7dcc555 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
 lldpd (1.0.4)
   * Changes:
-    + Add "set system lldp max-neighbors XX" command to modify maximum
+    + Add "configure system max-neighbors XX" command to modify maximum
       of neighbors accepted per port.
 
 lldpd (1.0.3)
index 94f397e4f80fa243b2dd67ee3648903396110a3b..8523f3cc5a405193edb5d95f2f56fb559bc0423b 100644 (file)
@@ -70,30 +70,6 @@ cmd_txhold(struct lldpctl_conn_t *conn, struct writer *w,
        return 1;
 }
 
-static int
-cmd_maxneighs(struct lldpctl_conn_t *conn, struct writer *w,
-    struct cmd_env *env, void *arg)
-{
-       log_debug("lldpctl", "set maximum neighbors");
-
-       lldpctl_atom_t *config = lldpctl_get_configuration(conn);
-       if (config == NULL) {
-               log_warnx("lldpctl", "unable to get configuration from lldpd. %s",
-                   lldpctl_last_strerror(conn));
-               return 0;
-       }
-       if (lldpctl_atom_set_str(config,
-               lldpctl_k_config_max_neighbors, cmdenv_get(env, "max-neighbors")) == NULL) {
-               log_warnx("lldpctl", "unable to set maximum of neighbors. %s",
-                   lldpctl_last_strerror(conn));
-               lldpctl_atom_dec_ref(config);
-               return 0;
-       }
-       log_info("lldpctl", "maximum neighbors set to new value %s", cmdenv_get(env, "max-neighbors"));
-       lldpctl_atom_dec_ref(config);
-       return 1;
-}
-
 static int
 cmd_status(struct lldpctl_conn_t *conn, struct writer *w,
     struct cmd_env *env, void *arg)
@@ -560,16 +536,6 @@ register_commands_configure_lldp(struct cmd_node *configure,
                NEWLINE, "Set LLDP transmit hold",
                NULL, cmd_txhold, NULL);
 
-        commands_new(
-               commands_new(
-                       commands_new(configure_lldp,
-                           "max-neighbors", "Set maximum number of neighbors per port",
-                           cmd_check_no_env, NULL, "ports"),
-                       NULL, "Maximum number of neighbors",
-                       NULL, cmd_store_env_value, "max-neighbors"),
-               NEWLINE, "Set maximum number of neighbors per port",
-               NULL, cmd_maxneighs, NULL);
-
        struct cmd_node *status = commands_new(configure_lldp,
            "status", "Set administrative status",
            NULL, NULL, NULL);
index f2ad664b2617912491ca14fc4410346f4e300f64..4bd7e752e3344798125d9394791c139a92818690 100644 (file)
@@ -298,6 +298,30 @@ cmd_bondslave_srcmac_type(struct lldpctl_conn_t *conn, struct writer *w,
        return 1;
 }
 
+static int
+cmd_maxneighs(struct lldpctl_conn_t *conn, struct writer *w,
+    struct cmd_env *env, void *arg)
+{
+       log_debug("lldpctl", "set maximum neighbors");
+
+       lldpctl_atom_t *config = lldpctl_get_configuration(conn);
+       if (config == NULL) {
+               log_warnx("lldpctl", "unable to get configuration from lldpd. %s",
+                   lldpctl_last_strerror(conn));
+               return 0;
+       }
+       if (lldpctl_atom_set_str(config,
+               lldpctl_k_config_max_neighbors, cmdenv_get(env, "max-neighbors")) == NULL) {
+               log_warnx("lldpctl", "unable to set maximum of neighbors. %s",
+                   lldpctl_last_strerror(conn));
+               lldpctl_atom_dec_ref(config);
+               return 0;
+       }
+       log_info("lldpctl", "maximum neighbors set to new value %s", cmdenv_get(env, "max-neighbors"));
+       lldpctl_atom_dec_ref(config);
+       return 1;
+}
+
 /**
  * Register `configure system bond-slave-src-mac-type`
  */
@@ -440,6 +464,16 @@ register_commands_configure_system(struct cmd_node *configure,
                NEWLINE, "Don't override system name",
                NULL, cmd_hostname, NULL);
 
+        commands_new(
+               commands_new(
+                       commands_new(configure_system,
+                           "max-neighbors", "Set maximum number of neighbors per port",
+                           cmd_check_no_env, NULL, "ports"),
+                       NULL, "Maximum number of neighbors",
+                       NULL, cmd_store_env_value, "max-neighbors"),
+               NEWLINE, "Set maximum number of neighbors per port",
+               NULL, cmd_maxneighs, NULL);
+
        commands_new(
                commands_new(
                        commands_new(
index 68de74e6d3c8f80cfce84473a97538b6c4e68276..bf902b0d61fdac31394ab0d9538d1e3d3bac3580 100644 (file)
@@ -433,6 +433,14 @@ might lead to a duplicate MAC address on the network (but this is
 quite unlikely).
 .Ed
 
+.Cd configure
+.Cd system max-neighbors Ar neighbors
+.Bd -ragged -offset XXXXXX
+Change the maximum number of neighbors accepted (for each protocol) on
+an interface. This is a global value. The default is 32. This setting
+only applies to future neighbors.
+.Ed
+
 .Cd configure
 .Cd lldp agent-type
 .Cd nearest-bridge | nearest-non-tpmr-bridge | nearest-customer-bridge
@@ -506,14 +514,6 @@ value and of the transmit delay. The default value is 4 and therefore
 the default TTL is 120 seconds.
 .Ed
 
-.Cd configure
-.Cd lldp max-neighbors Ar neighbors
-.Bd -ragged -offset XXXXXX
-Change the maximum number of neighbors accepted (for each protocol) on
-an interface. This is a global value. The default is 32. This setting
-only applies to future neighbors.
-.Ed
-
 .Cd configure
 .Op ports Ar ethX Op ,...
 .Cd lldp
index 8530c63ada043928b5584dc17b77b54c20130e10..5502da27e3941bf759bc8ec2635f556eb3505470 100644 (file)
@@ -550,9 +550,9 @@ def test_return_code(lldpd1, lldpcli, namespaces):
 
 
 @pytest.mark.parametrize("command, name, expected", [
+    ("configure system max-neighbors 10", "max-neighbors", 10),
     ("configure lldp tx-interval 20", "tx-delay", 20),
     ("configure lldp tx-hold 5", "tx-hold", 5),
-    ("configure lldp max-neighbors 10", "max-neighbors", 10),
     ("configure lldp portidsubtype ifname", "lldp-portid-type", "ifname"),
     pytest.param("unconfigure med fast-start",
                  "lldpmed-faststart", "no",
index 30aacc1cfcb18ac4b2c7a020a142d0851f4d984a..8a5ab296c47dd657dba48fb8940b5eecc1f92a26 100644 (file)
@@ -23,13 +23,13 @@ configure system interface promiscuous
 unconfigure system interface promiscuous
 configure system ip management pattern *
 unconfigure system ip management pattern
+configure system max-neighbors 16
 configure lldp portidsubtype ifname
 configure lldp portidsubtype macaddress
 configure lldp portidsubtype local Batman
 configure lldp portidsubtype local Batman description Batman
 configure lldp tx-interval 30
 configure lldp tx-hold 4
-configure lldp max-neighbors 16
 configure lldp ports eth0 status tx-only
 configure lldp status rx-and-tx
 configure lldp custom-tlv oui 33,44,55 subtype 44