summaryrefslogtreecommitdiffstats
path: root/tests/lib/cli (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: Convert event.h to frrevent.hDonald Sharp2023-03-241-1/+1
| | | | | | | We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert `struct event_master` to `struct event_loop`Donald Sharp2023-03-243-3/+3
| | | | | | Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_master_XXX functions to event_master_XXXDonald Sharp2023-03-241-2/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert struct thread_master to struct event_master and it's ilkDonald Sharp2023-03-243-3/+3
| | | | | | | Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_fetch and thread_call to event_fetch and event_callDonald Sharp2023-03-241-2/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename `struct thread` to `struct event`Donald Sharp2023-03-241-1/+1
| | | | | | | | | Effectively a massive search and replace of `struct thread` to `struct event`. Using the term `thread` gives people the thought that this event system is a pthread when it is not Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename thread.[ch] to event.[ch]Donald Sharp2023-03-241-1/+1
| | | | | | | | | | | This is a first in a series of commits, whose goal is to rename the thread system in FRR to an event system. There is a continual problem where people are confusing `struct thread` with a true pthread. In reality, our entire thread.c is an event system. In this commit rename the thread.[ch] files to event.[ch]. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-094-56/+4
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: allow common_cli.c with logging enabledDavid Lamparter2021-11-082-1/+4
| | | | | | | | common_cli.c disables logging by default so stdio is usable as vty without log messages getting strewn inbetween. This the right thing for most tests, but not all; sometimes we do want log messages. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: cleanup number-named access-lists in CLIIgor Ryzhov2021-10-081-12/+12
| | | | | | | There's no more difference between number-named and word-named access-lists. This commit removes separate arguments for number-named ACLs from CLI. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* Merge pull request #9497 from opensourcerouting/cli-better-noQuentin Young2021-09-093-1/+116
|\
| * lib: add `![...]` syntax for easy "no" formsDavid Lamparter2021-08-263-1/+116
| | | | | | | | | | | | | | | | | | | | This allows defining a CLI command like this: `[no] some setting ![VALUE]` with VALUE being optional for the "no" form, but required for the positive form. It's just a `[...]` where the empty branch can only be taken for commands starting with `no`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | *: explicitly print "exit" at the end of every node configIgor Ryzhov2021-08-231-2/+0
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a possibility that the same line can be matched as a command in some node and its parent node. In this case, when reading the config, this line is always executed as a command of the child node. For example, with the following config: ``` router ospf network 193.168.0.0/16 area 0 ! mpls ldp discovery hello interval 111 ! ``` Line `mpls ldp` is processed as command `mpls ldp-sync` inside the `router ospf` node. This leads to a complete loss of `mpls ldp` node configuration. To eliminate this issue and all possible similar issues, let's print an explicit "exit" at the end of every node config. This commit also changes indentation for a couple of existing exit commands so that all existing commands are on the same level as their corresponding node-entering commands. Fixes #9206. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* tests/lib/cli: allow using YANG modulesDavid Lamparter2021-07-062-1/+11
| | | | | | | Since the common CLI code calls nb_init, allow specifying some modules to load by overriding test_yang_models. Signed-off-by: David Lamparter <equinox@diac24.net>
* lib: adapt to version 2 of libyangChristian Hopps2021-05-132-2/+0
| | | | | | | | | Compile with v2.0.0 tag of `libyang2` branch of: https://github.com/CESNET/libyang staticd init load time of 10k routes now 6s vs ly1 time of 150s Signed-off-by: Christian Hopps <chopps@labn.net>
* :* Convert prefix2str to %pFXDonatas Abraitis2020-10-221-4/+2
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: reformat python fileswhitespace2020-10-072-4/+7
| | | | | | We are now using black. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* *: record transaction based on control flagChirag Shah2020-08-202-2/+2
| | | | | | | | | | | In case of config rollback is enabled, record northbound transaction based on a control flag. The actual frr daemons would set the flag to true via nb_init from frr_init. This will allow test daemon to bypass recording transacation to db. Signed-off-by: Chirag Shah <chirag@nvidia.com>
* Merge pull request #6135 from opensourcerouting/cli-node-cleanupDonald Sharp2020-04-171-39/+105
|\ | | | | *: clean up the mess that is CLI command nodes
| * *: move CLI node names to cmd_node->nameDavid Lamparter2020-04-161-0/+16
| | | | | | | | | | | | | | And again for the name. Why on earth would we centralize this, just so people can forget to update it? Signed-off-by: David Lamparter <equinox@diac24.net>
| * *: move CLI parent data to cmd_node->parent_nodeDavid Lamparter2020-04-161-0/+16
| | | | | | | | | | | | | | Same as before, instead of shoving this into a big central list we can just put the parent node in cmd_node. Signed-off-by: David Lamparter <equinox@diac24.net>
| * *: remove second parameter on install_node()David Lamparter2020-04-161-17/+17
| | | | | | | | | | | | | | | | | | | | There is really no reason to not put this in the cmd_node. And while we're add it, rename from pointless ".func" to ".config_write". [v2: fix forgotten ldpd config_write] Signed-off-by: David Lamparter <equinox@diac24.net>
| * *: clean up cmd_node initializersDavid Lamparter2020-04-161-22/+56
| | | | | | | | | | | | ... and use named assignments everywhere (so I can change the struct.) Signed-off-by: David Lamparter <equinox@diac24.net>
* | Merge pull request #5451 from opensourcerouting/rcu-logSantosh P K2020-04-161-6/+1
|\ \ | |/ |/| logging subsystem rewrite
| * lib: rewrite zlog lock-free & TLS-bufferedDavid Lamparter2020-04-011-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a full rewrite of the "back end" logging code. It now uses a lock-free list to iterate over logging targets, and the targets themselves are as lock-free as possible. (syslog() may have a hidden internal mutex in the C library; the file/fd targets use a single write() call which should ensure atomicity kernel-side.) Note that some functionality is lost in this patch: - Solaris printstack() backtraces are ditched (unlikely to come back) - the `log-filter` machinery is gone (re-added in followup commit) - `terminal monitor` is temporarily stubbed out. The old code had a race condition with VTYs going away. It'll likely come back rewritten and with vtysh support. - The `zebra_ext_log` hook is gone. Instead, it's now much easier to add a "proper" logging target. v2: TLS buffer to get some actual performance Signed-off-by: David Lamparter <equinox@diac24.net>
* | lib, tools: silence harmless warnings in the northbound toolsRenato Westphal2020-04-042-2/+2
|/ | | | | | | | | | | | | | | Our two northbound tools don't have embedded YANG modules like the other FRR binaries. As such, ly_ctx_set_module_imp_clb() shouldn't be called when the YANG subsystem it being initialized by a northbound tool. To make that possible, add a new "embedded_modules" parameter to the yang_init() function to control whether libyang should look for embedded modules or not. With this fix, "gen_northbound_callbacks" and "gen_yang_deviations" won't emit "YANG model X not embedded, trying external file" warnings anymore. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: rename memory_vty.c to lib_vty.cDavid Lamparter2019-12-061-2/+2
| | | | | | And memory_init() to lib_cmd_init(). Signed-off-by: David Lamparter <equinox@diac24.net>
* *: fix ctype (isalpha & co.) castsDavid Lamparter2019-08-061-1/+2
| | | | | | | | | The correct cast for these is (unsigned char), because "char" could be signed and thus have some negative value. isalpha & co. expect an int arg that is positive, i.e. 0-255. So we need to cast to (unsigned char) when calling any of these. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: Add '--command-log-always` to all daemons startupDonald Sharp2019-05-311-1/+1
| | | | | | | | | | | Add 'no log commands' cli and at the same time add a --command-log-always to the daemon startup cli. If --command-log-always is specified then all commands are auto-logged and the 'no log commands' form of the command is now ignored. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge pull request #3452 from opensourcerouting/reprobuild-masterDonald Sharp2018-12-092-0/+3
|\ | | | | [master] build reproducibility
| * tests: fix domainname dependencyDavid Lamparter2018-12-072-0/+3
| | | | | | | | | | | | | | | | These are causing random test failures when the host's domainname is actually set to something (as opposed to empty/unset, which it is 99% of times.) Signed-off-by: David Lamparter <equinox@diac24.net>
* | lib: add support for confirmed commitsRenato Westphal2018-12-072-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Confirmed commits allow the user to request an automatic rollback to the previous configuration if the commit operation is not confirmed within a number of minutes. This is particularly useful when the user is accessing the CLI through the network (e.g. using SSH) and any configuration change might cause an unexpected loss of connectivity between the user and the managed device (e.g. misconfiguration of a routing protocol). By using a confirmed commit, the user can rest assured the connectivity will be restored after the given timeout expires, avoiding the need to access the router physically to fix the problem. When "commit confirmed TIMEOUT" is used, a new "commit" command is expected to confirm the previous commit before the given timeout expires. If "commit confirmed TIMEOUT" is used while there's already a confirmed-commit in progress, the confirmed-commit timeout is reset to the new value. In the current implementation, if other users perform commits while there's a confirmed-commit in progress, all commits are rolled back when the confirmed-commit timeout expires. It's recommended to use the "configure exclusive" configuration mode to prevent unexpected outcomes when using confirmed commits. When an user exits from the configuration mode while there's a confirmed-commit in progress, the commit is automatically rolled back and the user is notified about it. In the future we might want to prompt the user if he or she really wants to exit from the configuration mode when there's a pending confirmed commit. Needless to say, confirmed commit only work for configuration commands converted to the new northbound model. vtysh support will be implemented at a later time. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: introduce new northbound APIRenato Westphal2018-10-273-0/+10
| | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* bgpd lib ospf6d pbrd tests zebra: shadowing fixesF. Aragon2018-09-131-3/+3
| | | | | | This fixes all remaining local variable shadowing cases Signed-off-by: F. Aragon <paco@voltanet.io>
* tests: properly locate files in builddirDavid Lamparter2018-09-081-0/+1
| | | | | | | test_cli.refout is written by configure into the build directory, thus we need a little special glue to find it correctly. Signed-off-by: David Lamparter <equinox@diac24.net>
* build: non-recursive testsDavid Lamparter2018-09-081-1/+1
| | | | | | May SUBDIRS rest in pieces... er, peace. Signed-off-by: David Lamparter <equinox@diac24.net>
* lib: add string utilitiesQuentin Young2018-06-061-2/+2
| | | | | | | | I see lots of the same code being copy-pasted and slightly tweaked for string processing all over the codebase. Time to start aggregating these pieces into something consistent and correct. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* tests: fix & run ZeroMQ testDavid Lamparter2017-08-281-1/+1
| | | | | | add reference output & run the test with proper libs and such. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: centralized memstats-at-exitDavid Lamparter2017-08-241-1/+1
| | | | | | | | | adds a new all-daemon "debug memstats-at-exit" command. Also saves memstats to a file in /tmp, useful if a long-running daemon is having weird issues (e.g. in a user install). Fixes: #437 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: fix clippy include paths / double-buildDavid Lamparter2017-08-151-1/+1
| | | | | | | | | A mismatch between the make rule and the include path causes dependency tracking to try to build the clippy.c file twice (at the same time), which results in spurious build failures. Fixes: #971 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: vty_stdio signal handlingDavid Lamparter2017-08-021-2/+3
| | | | | | | | - SIGTSTP appropriately suspends the foreground terminal - SIGINT causes the daemon to exit, regardless of -d - SIGQUIT causes the daemon to daemonize, regardless of -d Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Revert "*: reindent pt. 2"David Lamparter2017-07-221-8/+4
| | | | | | | | | This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: reindent pt. 2whitespace / reindent2017-07-171-4/+8
| | | | | | | | w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
* *: reindentreindent-master-afterwhitespace / reindent2017-07-174-414/+353
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge remote-tracking branch 'frr/master' into table-hash-ospf6-lsdb-refactorDavid Lamparter2017-07-142-6/+6
|\ | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * *: ditch vty_outln(), part 1 of 2David Lamparter2017-07-132-6/+6
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | tests: fix pytest API "surprise" in skipping testsDavid Lamparter2017-07-111-2/+5
|/ | | | | | | | | | | | | | pytest.mark.skipif apparently iterates through a class's methods, applying itself onto the various methods. Now, since we're deriving from a parent class, the method is actually the same object inherited from the parent, so the decorator will apply itself on the parent's testrunning method (test_refout). The result is that any TestRefout tests after "test_commands.py" will be skipped... This only became apparent after adding ospf6d/test_lsdb.py; before, test_commands.py was the last test in the list so it didn't matter... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: more `show thread cpu`Quentin Young2017-06-301-1/+1
| | | | | | | Add support for naming pthreads. Also, note that we don't have any records yet if that's the case. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: rebase vty_outln() -> masterQuentin Young2017-06-291-4/+4
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: use vty_outlnQuentin Young2017-06-291-2/+2
| | | | | | Saves 400 lines Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>