summaryrefslogtreecommitdiffstats
path: root/tests/lib/cli/common_cli.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* lib: add flag to have libyang load internal ietf-yang-library moduleChristian Hopps2024-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | Mgmtd makes use of libyang's internal ietf-yang-library module to add support for said module to FRR management. Previously, mgmtd was loading this module explicitly; however, that required that libyang's `ietf-yang-library.yang` module definition file be co-located with FRR's yang files so that it (and ietf-datastore.yang) would be found when searched for by libyang using FRRs search path. This isn't always the case depending on how the user compiles and installs libyang so mgmtd was failing to run in some cases. Instead of doing it the above way we simply tell libyang to load it's internal version of ietf-yang-library when we initialize the libyang context. This required adding a boolean to a couple of the init functions which is why so many files are touched (although all the changes are minimal). Signed-off-by: Christian Hopps <chopps@labn.net>
* lib: rework debug initIgor Ryzhov2024-08-271-0/+2
| | | | | | | | | | The debug library allows to register a `debug_set_all` callback which should enable all debugs in a daemon. This callback is implemented exactly the same in each daemon. Instead of duplicating the code, rework the lib to allow registration of each debug type, and implement the common code only once in the lib. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: remove sys/stat.h from zebra.hDonald Sharp2024-01-091-0/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: 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-241-1/+1
| | | | | | 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-241-1/+1
| | | | | | | 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-091-14/+1
| | | | | | 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-081-1/+2
| | | | | | | | 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>
* tests/lib/cli: allow using YANG modulesDavid Lamparter2021-07-061-1/+8
| | | | | | | 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-131-1/+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>
* *: record transaction based on control flagChirag Shah2020-08-201-1/+1
| | | | | | | | | | | 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 #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-041-1/+1
|/ | | | | | | | | | | | | | | 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>
* 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-091-0/+1
|\ | | | | [master] build reproducibility
| * tests: fix domainname dependencyDavid Lamparter2018-12-071-0/+1
| | | | | | | | | | | | | | | | 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-071-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-271-0/+4
| | | | Signed-off-by: Renato Westphal <renato@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>
* 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>
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-43/+41
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: ditch vty_outln(), part 1 of 2David Lamparter2017-07-131-2/+2
| | | | 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>
* *: use vty_outlnQuentin Young2017-06-291-2/+2
| | | | | | Saves 400 lines Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* tests: cli: unit test DEFPY() + clidef.pyDavid Lamparter2017-06-141-1/+1
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-4/+3
| | | | | | | | | | | The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: remove remaining struct zlog * argsDavid Lamparter2017-03-081-3/+3
| | | | | | These don't serve any purpose either. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: simplify protocol/log namingDavid Lamparter2017-03-081-3/+3
| | | | | | | The protocols enum serves no purpose other than adding potential for bugs and making it complicated to add a new protocol... nuke. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: add uninstall_element in testcliDavid Lamparter2017-02-101-1/+1
| | | | | | | | Test uninstall_element(). The commandline-specified counter allows isolating memleaks more closely, differentiating one-off vs. repeated leaks. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: reorganize tests hierarchicallyChristian Franke2017-02-081-0/+97
Signed-off-by: Christian Franke <chris@opensourcerouting.org>