summaryrefslogtreecommitdiffstats
path: root/python (follow)
Commit message (Collapse)AuthorAgeFilesLines
* tools: Fix syntax raw parsing for make-foobar helperDonatas Abraitis2024-11-181-1/+1
| | | | | | | | 96 38.93 config.status: creating Makefile 96 39.48 /src/python/makefile.py:55: SyntaxWarning: invalid escape sequence '\s' 96 39.48 "^#\s*include.*_clippy.c", Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* vtysh: fix `find` and `list` commandsDavid Lamparter2024-10-221-1/+3
| | | | | | | | | | I simply missed that `node->cmd_vector` is needed for `find` and `list` to work correctly. Fixes: #17043 Fixes: 4bc41193e810 ("vtysh, lib: preprocess CLI graphs") Reported-by: Donald Sharp <sharpd@nvidia.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* vtysh, lib: preprocess CLI graphsDavid Lamparter2024-07-312-13/+171
| | | | | | | | | | | | | | | | | Store a parsed and built graph of the CLI nodes in vtysh, rather than parsing and building that graph every time vtysh starts up. This provides a 3x to 5x reduction in vtysh startup overhead: `vtysh -c 'configure' -c 'interface lo' -c 'do show version'` - before: 92.9M cycles, 1114 samples - after: 16.5M cycles, 330 samples This improvement is particularly visible for users scripting `vtysh -c` calls, which notably includes topotests. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: fix a few python string escape warningsDavid Lamparter2024-07-232-2/+2
| | | | | | | | | When using a regex (or anything that uses `\?` escapes) in python, raw strings (`r"content"`) should be used so python doesn't consume the escapes itself. Otherwise we get either broken behavior and/or `SyntaxWarning: invalid escape sequence '\['` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge pull request #15980 from donaldsharp/agentx_updateDonatas Abraitis2024-05-201-1/+1
|\ | | | | *: Modify agentx to be allowed to be called
| * *: Modify agentx to be allowed to be calledDonald Sharp2024-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | If you had a situation where an operator turned on ospfd with snmp but not ospf6d and agentx was configured then you get into a situation where ospf6d would complain that the config for agentx did not exist. Let's modify the code to allow this situation to happen. Fixes: #15896 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | Merge pull request #15876 from opensourcerouting/typesafe-expandMark Stapp2024-05-141-0/+131
|\ \ | |/ |/| python: add tool to expand typesafe definitions
| * python: add tool to expand typesafe definitionsDavid Lamparter2024-04-291-0/+131
| | | | | | | | | | | | | | This can be used to get less cryptic error/warnings from GCC when dealing with something typesafe container related. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | build: hppa is weirdDavid Lamparter2024-05-021-1/+10
| | | | | | | | | | | | | | | | | | | | hppa (yes, HP PA-RISC) apparently creates relocations that refer to ".init+0x12345" for everything, referencing way past the end of the .init section. While this is only fallback code hit when XREF_SETUP() is missing (i.e. the FRRouting.XREF ELF note is absent), try to make it work anyway. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | build: warn/fail on missing `XREF_SETUP()`David Lamparter2024-05-022-1/+15
|/ | | | | | | | | | While clippy tries really, really hard to work under adverse conditions, and this catches missing XREF_SETUP() on almost all CPU architectures, this doesn't quite work on hppa. So, make it a warning on *all* platforms (or error for --enable-dev-build) in order to catch it before shipping off to Debian's buildd and blowing up there... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: add keychain northbound supportChristian Hopps2024-03-051-1/+1
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* build: remove mgmtd exception from xref2vtyshIgor Ryzhov2024-01-281-10/+0
| | | | | | | | | | We may actually need to send CLI commands to mgmtd and another daemon at the same time, for example, if this daemon is not mgmtd-converted. The only daemon this exception protects is staticd. But we don't actually need any configuration commands in staticd, so just remove the exception and don't install unnecessary commands to staticd. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* ripngd: convert ripngd to mgmtdChristian Hopps2024-01-261-4/+1
| | | | | | - a couple small fixes for ripd conversion as well. Signed-off-by: Christian Hopps <chopps@labn.net>
* ripd: ripd convert to mgmtdChristian Hopps2024-01-261-1/+1
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* lib: convert filters to mgmtdChristian Hopps2024-01-261-2/+2
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* lib: convert route-map to mgmtdChristian Hopps2024-01-261-4/+4
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* zebra: add zebra to mgmtd oper-stateChristian Hopps2023-12-281-1/+1
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* [ospfd]: add support for RFC 5709 HMAC-SHA AuthMahdi Varasteh2023-09-161-1/+1
| | | | | | | | | | | | This patch includes: * Implementation of RFC 5709 support in OSPF. Using openssl library and FRR key-chain, one can use SHA1, SHA256, SHA384, SHA512 and keyed-MD5( backward compatibility with RFC 2328) HMAC algs. * Updating documentation of OSPF * add topotests for new HMAC algorithms Signed-off-by: Mahdi Varasteh <varasteh@amnesh.ir>
* mgmtd: fully implement debug flags for mgmtd and clientsChristian Hopps2023-05-011-0/+2
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* lib: convert xref_threadsched to xref_eventschedDonald Sharp2023-03-241-2/+2
| | | | 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>
* mgmtd: nb library for client front-end codeChristian Hopps2023-03-221-0/+10
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* Merge pull request #12248 from pguibert6WIND/bgpasdotRuss White2023-02-211-0/+7
|\ | | | | lib, bgp: add initial support for asdot format
| * lib, bgp: add initial support for asdot formatPhilippe Guibert2023-02-101-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AS number can be defined as an unsigned long number, or two uint16 values separated by a period (.). The possible valus are: - usual 32 bit values : [1;2^32 -1] - <1.65535>.<0.65535> for dot notation - <0.65535>.<0.65535> for dot+ notation. The 0.0 value is forbidden when configuring BGP instances or peer configurations. A new ASN type is added for parsing in the vty. The following commands use that new identifier: - router bgp .. - bgp confederation .. - neighbor <> remote-as <> - neighbor <> local-as <> - clear ip bgp <> - route-map / set as-path <> An asn library is available in lib/ and provides some services: - convert an as string into an as number. - parse an as path list string and extract a number. - convert an as number into a string. Also, the bgp tests forge an as_zero_path, and to do that, an API to relax the possibility to have a 0 as value is specifically called from the tests. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | *: auto-convert to SPDX License IDsDavid Lamparter2023-02-0910-140/+10
|/ | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* python: hide inet_ntoa from frrbotDavid Lamparter2022-10-281-2/+3
| | | | | | These are not the inet_ntoa you are looking for ;) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* python: fix a bunch of pylint warnings in clippyDavid Lamparter2022-10-281-0/+14
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* python: apply black formattingDavid Lamparter2022-10-289-299/+491
| | | | | | | The python/ directory hasn't been shoved into black yet (unlike topotests, where most FRR python code is.) Run black over it. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: exclude a few more things from frr.xrefDavid Lamparter2022-10-261-1/+6
| | | | | | ... this might need some better approach long-term. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* python: fix for old (< 3.6) Python versionsDavid Lamparter2022-10-261-21/+24
| | | | | | Sigh. No type annotations, no f-strings. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build, vtysh: extract vtysh commands from .xrefDavid Lamparter2022-10-263-72/+396
| | | | | | | | | | | | | | | | | | | Rather than running selected source files through the preprocessor and a bunch of perl regex'ing to get the list of all DEFUNs, use the data collected in frr.xref. This not only eliminates issues we've been having with preprocessor failures due to nonexistent header files, but is also much faster. Where extract.pl would take 5s, this now finishes in 0.2s. And since this is a non-parallelizable build step towards the end of the build (dependent on a lot of other things being done already), the speedup is actually noticeable. Also files containing CLI no longer need to be listed in `vtysh_scan` since the .xref data covers everything. `#ifndef VTYSH_EXTRACT_PL` checks are equally obsolete. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* python: use ujson if availableDavid Lamparter2022-10-061-3/+12
| | | | | | It's noticeably faster. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: don't include vtysh.xref in frr.xrefDavid Lamparter2022-10-061-0/+3
| | | | | | | | vtysh.xref only contains a rather-useless duplicate of every single CLI command incorporated into vtysh... and including it prevents frr.xref from becoming the source for vtysh_cmd.c. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: add CMD_ATTR_NOSHDavid Lamparter2022-10-061-0/+2
| | | | | | To propagate into .xref so extract.pl can be handled there. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: make cmd_element->attr a bitmask & clarifyDavid Lamparter2022-10-062-7/+29
| | | | | | | | | It already "looks" like a bitmask, but we currently can't flag a command both YANG and HIDDEN at the same time. It really should be a bitmask. Also clarify DEPRECATED behaviour (or the absence thereof.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* python: Remove redundant import of subprocessDonald Sharp2022-06-161-1/+0
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* build: reformat makefile.pyDavid Lamparter2022-05-261-8/+18
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: add a bunch of comments to makefile.pyDavid Lamparter2022-05-261-0/+16
| | | | | | ... to (maybe?) make understandable what it's doing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: fix LLVM bitcode per-target CFLAGSDavid Lamparter2022-05-261-1/+10
| | | | | | | When automake decides to customize CFLAGS, use those for building LLVM bitcode files too. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* python: improve clippy/clidef macro processingDavid Lamparter2022-02-281-15/+47
| | | | | | | Process macros from the current file, and warn if something is redefined (to a different value). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* python: pass conditionals through clippy for DEFPYDavid Lamparter2022-01-131-2/+22
| | | | | | | | Track what conditionals apply when a DEFPY is encountered, and stack them around the autogenerated clippy wrapper. Otherwise conditional DEFPYs result in undefined function warnings. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* isisd: fix redistribute CLIIgor Ryzhov2021-10-051-0/+2
| | | | | | | | | | | | | | | | | | | | | Currently, it is possible to configure IPv6 protocols for IPv4 redistribution and vice versa in CLI. The YANG model doesn't allow this so the user receives the following error: ``` nfware(config-router)# redistribute ipv4 ospf6 level-1 % Failed to edit configuration. YANG error(s): Invalid enumeration value "ospf6". Invalid enumeration value "ospf6". Invalid enumeration value "ospf6". YANG path: Schema location /frr-isisd:isis/instance/redistribute/ipv4/protocol. ``` Let's make CLI more user-friendly and allow only supported protocols in redistribution commands. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* build: add `-Werror` to xrelfo log format warningsDavid Lamparter2021-06-241-1/+5
| | | | | | | | | Adding a `\n' should now produce a warning. Controlled by `-Werror` so if you're doing a dev build and it's warning about some `prefix2str` that should be converted to `%pFX`, you can turn off `-Werror` to fix it later like with all other warnings. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: make sure `config.h` or `zebra.h` is firstDavid Lamparter2021-04-231-16/+76
| | | | | | | | | | | | `config.h` has all the defines from autoconf, which may include things that switch behavior of other included headers (e.g. _GNU_SOURCE enabling prototypes for additional functions.) So, the first include in any `.c` file must be either `config.h` (with the appropriate guard) or `zebra.h` (which includes `config.h` first thing.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* python: add demo checker tool using frr.xrefDavid Lamparter2021-04-151-0/+72
| | | | | | | More of a demo on what to do with the frr.xref file, but also slightly useful in finding vtysh SNAFUs :) Signed-off-by: David Lamparter <equinox@diac24.net>
* python: fix 32-bit pointers in xrelfo container_ofDavid Lamparter2021-04-081-1/+4
| | | | | | | This was mistakenly using the host platform's pointer size rather than the ELF file's. Only noticeable when cross compiling... Signed-off-by: David Lamparter <equinox@diac24.net>
* python/xrelfo: cross-platform xrefstructs.jsonDavid Lamparter2021-02-232-67/+19
| | | | | | | | | | Just get names, types and order from pahole; ditch offset & size since they're different on 32/64 bit. None of the structs has padding currently; if we really need that it can be implemented in the future. (Padding will raise an exception, so it won't break silently.) Signed-off-by: David Lamparter <equinox@diac24.net>
* lib/xref: record log message format argsDavid Lamparter2021-02-232-16/+49
| | | | | | | | | | | Apparently you can do `#__VA_ARGS__` and it actually does something sensible, so here we go recording the format parameters for log messages into the xref. This allows some more checking in xrelfo.py, e.g. hints to use `%pFX` and co. Signed-off-by: David Lamparter <equinox@diac24.net>
* build: extract xrefsDavid Lamparter2021-02-231-0/+12
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* python/xrelfo: the ELF xref extractorDavid Lamparter2021-02-238-0/+1508
| | | | | | This creates JSON dumps of all the xref structs littered around FRR. Signed-off-by: David Lamparter <equinox@diac24.net>