summaryrefslogtreecommitdiffstats
path: root/tests/helpers (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>
* lib: mgmtd: add manual vty server start option and use itChristian Hopps2023-05-301-1/+1
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* *: 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-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp2023-03-241-1/+1
| | | | 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>
* *: Convert thread_add_XXX functions to event_add_XXXDonald Sharp2023-03-241-2/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename `struct thread` to `struct event`Donald Sharp2023-03-241-2/+2
| | | | | | | | | 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-096-90/+6
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-2/+1
| | | | | | | The int return value is never used. Modify the code base to just return a void instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* 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>
* tests: ignore Windows vs Unix style newlinesGalaxyGorilla2020-11-171-4/+9
| | | | | | | | | | | | Within unit tests the output of vtysh commands is compared to hand made reference files. For some reason the output of those vtysh commands contains Windows Style newlines which results in error outputs which make it hard to identify this problem. Since there seems to be no benefit in checking those newlines anyway this commit just normalizes them. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
* *: reformat python fileswhitespace2020-10-072-47/+74
| | | | | | We are now using black. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* *: 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>
* 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>
* Treewide: use ANSI function definitionsRuben Kerkhof2019-01-241-3/+3
| | | | Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
* 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-1/+3
| | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* tests: properly locate files in builddirDavid Lamparter2018-09-081-2/+8
| | | | | | | 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>
* *: Remove cvs control pointsDonald Sharp2017-12-051-2/+0
| | | | | | | | The $Id: lines would allow code kept in cvs to substitute the file version upon checkout. Since we are not using cvs there is no need to keep these lines anymore. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: reindentreindent-master-afterwhitespace / reindent2017-07-174-194/+173
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: update prng to return better pseudo random numbersChristian Franke2017-07-122-30/+14
| | | | Signed-off-by: Christian Franke <chris@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>
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-154-16/+12
| | | | | | | | | | | 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>
* *: remove THREAD_ON macros, add nullity checkQuentin Young2017-05-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way thread.c is written, a caller who wishes to be able to cancel a thread or avoid scheduling it twice must keep a reference to the thread. Typically this is done with a long lived pointer whose value is checked for null in order to know if the thread is currently scheduled. The check-and-schedule idiom is so common that several wrapper macros in thread.h existed solely to provide it. This patch removes those macros and adds a new parameter to all thread_add_* functions which is a pointer to the struct thread * to store the result of a scheduling call. If the value passed is non-null, the thread will only be scheduled if the value is null. This helps with consistency. A Coccinelle spatch has been used to transform code of the form: if (t == NULL) t = thread_add_* (...) to the form thread_add_* (..., &t) The THREAD_ON macros have also been transformed to the underlying thread.c calls. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* tests: allow to use exit_cleanly as test methodChristian Franke2017-05-081-1/+2
| | | | | | TestMultiOut can now also just check for clean exit Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* Rename: FreeRangeRouting FRRoutingLou Berger2017-03-301-1/+1
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* tests: format TestRefMismatch more readableChristian Franke2017-03-281-1/+13
| | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* tests: fix out-of-tree buildDavid Lamparter2017-02-131-2/+8
| | | | | | Fix pytest with $(top_srcdir) != "." Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: add pytest testrunnersChristian Franke2017-02-132-0/+257
| | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* tests: reorganize tests hierarchicallyChristian Franke2017-02-134-0/+402
Signed-off-by: Christian Franke <chris@opensourcerouting.org>