Commit graph

768 commits

Author SHA1 Message Date
Donald Sharp 35bd38705f
Merge pull request #13101 from opensourcerouting/fix/bindir_for_frr-reload
tools: Set correct directory of vtysh for frr-reload.py
2023-03-26 08:20:33 -04:00
Donatas Abraitis c9bdc0c79e tools: Set correct directory of vtysh for frr-reload.py
Before it was setting SDIR, which is /usr/lib/frr, but the vtysh binary is put
under bindir (which is /usr/local by default). And running `/usr/lib/frr/frr reload`
failed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-03-24 19:38:46 +02:00
Donald Sharp 8c1186d38e *: Convert thread_execute to event_execute
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 907a2395f4 *: Convert thread_add_XXX functions to event_add_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Christian Hopps 1c84efe4fa mgmtd: Bringup MGMTD daemon and datastore module support
Features added in this commit:
1. Bringup/shutdown new management daemon 'mgmtd' along with FRR.
2. Support for Startup, Candidate and Running DBs.
3. Lock/Unlock DS feature using pthread lock.
4. Load config from a JSON file onto candidate DS.
5. Save config to a JSON file from running/candidate DS.
6. Dump candidate or running DS contents on the terminal or a file in
   JSON/XML format.
7. Maintaining commit history (Full rollback support to be added in
   future commits).
8. Addition of debug commands.

Co-authored-by: Yash Ranjan <ranjany@vmware.com>
Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com>
Co-authored-by: Ujwal P <ujwalp@vmware.com>
Signed-off-by: Pushpasis Sarkar <pushpasis@gmail.com>
2023-03-21 22:08:32 -04:00
Chirag Shah 1543f58b55 tools: frr-reload fix list value not present
Check for value present in list before removing
as in certain python3 ValueError traceback is observed.

Traceback (most recent call last):
  File "/usr/lib/frr/frr-reload.py",
		line 2278, in <module>
    (lines_to_add, lines_to_del, restart_frr)
	= compare_context_objects(newconf, running)
  File "/usr/lib/frr/frr-reload.py",
		line 1933, in compare_context_objects
    lines_to_add, lines_to_del
  File "/usr/lib/frr/frr-reload.py",
		line 1549, in ignore_delete_re_add_lines
    lines_to_del.remove((ctx_keys, line))
ValueError: list.remove(x): x not in list

Ticket:#3389979
Issue:3389979

Testing Done:
With fix perform frr-relaod on frr.conf config where earlier
traceback was seen.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-03-14 21:32:40 -07:00
David Lamparter a45b2bf4a4 tools: allow // SPDX... in checkpatch.pl
Using // style comments for the SPDX license identifier was kind of an
intentional choice to make it stand out as "directive-like" comment (and
also to constrain it to the one line.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-10 10:56:07 +01:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
David Lamparter 47a3a82770 *: manual SPDX License ID conversions
The files converted in this commit either had some random misspelling or
formatting weirdness that made them escape automated replacement, or
have a particularly "weird" licensing setup (e.g. dual-licensed.)

This also marks a bunch of "public domain" files as SPDX License "NONE".

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:07 +01:00
David Lamparter 47b6d5406f *: sort out & explain licenses used in FRR
New "introduction" note in `COPYING`, and all the licenses moved into
`doc/licenses/`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 12:46:13 +01:00
Donald Sharp 7386031781 tools: Fix missing pbrd in rsyslog.d 45-frr.conf file
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-08 13:04:01 -05:00
Donatas Abraitis 96475dfde9
Merge pull request #12707 from donaldsharp/missed_enums
Missed enums
2023-02-07 22:22:27 +02:00
David Lamparter 40e98aa8c8 tools: add GotoXref vim script
Let's make these unique IDs actually a bit useful.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-31 23:20:03 +01:00
Donald Sharp 0678d01a70 tools: Add missing enums to switch statement
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-31 15:15:59 -05:00
Yuxiang Zhu 559f208ea5 tools: Add missing daemons
Got `ERROR: Daemon babeld is not a valid option for 'show running-config'` when using `frr-reload.py --reload --daemon babeld`.

Adds `babeld` and `nhrpd` as valid daemons.

Signed-off-by: Yuxiang Zhu <vfreex@gmail.com>
2023-01-15 10:57:53 +08:00
Donatas Abraitis 4a9ea00a27 tools: Ignore agentx command for frr-reload.py
agentx can't be disabled once enabled, so we should ignore it for frr-reload.py.

```
$ /usr/lib/frr/frr-reload.py --reload /etc/frr/bgpd.conf --bindir /usr/local/bin
"no agentx" we failed to remove this command
SNMP AgentX support cannot be disabled once enabled
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-22 17:55:40 +02:00
Mark Stapp 828ac45474 Revert "tools: stop zebra daemon last"
This reverts commit 2000ac4075.

There were concerns that ensuring zebra stopped last led to
problems with zebra's "-r" flag, so we'll revert that for the
time being and reconsider this area.

Signed-off-by: Mark Stapp <mjs@labn.net>
2022-12-06 11:21:02 -05:00
Michal Ruprich 1d42fb941a tools: Enable start of FRR for non-root user
There might be use cases when this would make sense, for example
running FRR in a container as a designated user.

Signed-off-by: Michal Ruprich <mruprich@redhat.com>
2022-11-23 10:19:10 +01:00
Jafar Al-Gharaibeh a221745a40
Merge pull request #11058 from opensourcerouting/fix/redhat_debian_logrotate
packaging: Reuse frr.logrotate for Debian and Redhat builds
2022-11-15 22:15:45 -06:00
Marius Tomaschewski 5216a05b32 tools: remove backslash from declare check regex
The backslash in `grep -q '^declare \-a'` is not needed and
causes `grep: warning: stray \ before -` warning in grep-3.8.

Signed-off-by: Marius Tomaschewski <mt@suse.com>
2022-11-11 15:43:59 +01:00
Sai Gomathi N 358a7549dc tools: Add pim6d support bundle commands
PIMv6 Support Bundle commands are added in support_bundle_commands.conf file.
This will help in debugging PIMv6 test Failures.

Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2022-11-08 01:41:48 -08:00
Donatas Abraitis c4831d2864 packaging: Reuse frr.logrotate for Debian and Redhat builds
It will be easier to maintain a single file instead of two separate.

Also, fixes the issue when the file (/var/log/frr/frr.log) is not created
after logrotate.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-08 11:17:56 +02:00
Donatas Abraitis efe9529821 tools: Honor sysdir, confdir, bindir for frr-reload.py from "frr" wrapper
Without this, those variables are not passed to frr-reload.py and uses
default values.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-03 20:15:10 +02:00
Donatas Abraitis 6f26cc245c tools: Do not try creating /proc with install command
Leftovers.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-14 21:30:13 +03:00
Donald Sharp e3e3d729c4
Merge pull request #12066 from opensourcerouting/cleanup-cli-xref
*: clean up various CLI-related bits
2022-10-13 13:47:04 -04:00
Donatas Abraitis 972cdc560e tools: Use install instead of touch/chown combination
touch + chown can have a gap between the commands (or the second failed).

This could lead to unexpected permissions (root, instead of frr) for some
.conf files or directories.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-13 11:14:07 +03:00
Donatas Abraitis 63f99a91c8 tools: Apply black formatting for frr-reload.py
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-11 22:38:30 +03:00
Donatas Abraitis 8bcbee1999 tools: Handle sequence numbers for BGP community (large/ext) in frr-reload.py
If we add/modify community/large/ext lists without sequence numbers, and
doing frr-reload.py, then rules with sequence numbers (show running-config
always adds sequence numbers) will be deleted and new ones will be re-added.

This could lead to blackholing for some time.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-11 22:36:26 +03:00
David Lamparter 9eebf97e3d lib: make cmd_element->attr a bitmask & clarify
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>
2022-10-06 15:34:32 +02:00
Brian Rak d087003451 tools: Configure systemd to always restart FRR, regardless of exit code
The current service file configures restarts on-abnormal, which translates to "unclean signal", "timeout", or "watchdog". This patch updates it to always restart, as there's never really a time watchfrr should exit by itself at all.

Signed-off-by: Brian Rak <brak@vultr.com>
2022-09-26 11:23:29 -04:00
Donatas Abraitis fd283bd250 bgpd: Use route_map_result_t for route_map_apply() as return type
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-20 10:45:02 +03:00
Mark Stapp 2000ac4075 tools: stop zebra daemon last
When stopping the FRR daemons, stop zebra last, after trying
to stop the other daemons.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2022-08-15 16:40:08 -04:00
Donald Sharp 5651da2461 tools: Add pim6d to tools so that pim6d will work properly
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-06 08:35:59 -04:00
David Lamparter 3d3ed1afb2 tools/gcc-plugins: make GCC 12 compatible
check_function_arguments_recurse() has received a new function argument
in GCC 12.  Fill it in and add a compatibility wrapper.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-07-26 15:38:16 -04:00
Donatas Abraitis 9dedc9eb37 tools: Do not wrap the pidfile into double-quotes for frrcommon.sh
The problem is that when we run watchfrr.sh/frrinit.sh, we get something like:

```
cat: '"/var/run/frr/staticd.pid"': No such file or directory
cat: '"/var/run/frr/babeld.pid"': No such file or directory
cat: '"/var/run/frr/zebra.pid"': No such file or directory
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-11 14:47:09 +03:00
Donatas Abraitis 9763474278 tools: Add missing bfdd to logrotate config
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-07 11:05:00 +03:00
Christian Hopps 63b46c8fb4
tools: fix boot config load in watchfrr
2469a37f reversed the logic of the existence check for
/etc/frr/frr.conf breaking boot config loading, fix it.

Signed-off-by: Christian Hopps <chopps@labn.net>
2022-06-24 18:44:43 -04:00
Quentin Young e99126f0ac tools: document frr_global_options in daemons file
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-06-16 12:20:36 -04:00
Quentin Young da9601225f tools: apply various shellcheck recommendations
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-06-16 12:20:36 -04:00
Quentin Young 2469a37fd0 tools: print daemon start cmd, vtysh_b cmd
When starting a daemon, print the full command run by the init script to
start it. This gives more information and is especially helpful when
debugging wrap commands.

Also add some more logs to vtysh_b to print the command used there,
log when we exit early because frr.conf doesn't exist, and simplify the
code path for creating the command to use.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-06-16 12:00:23 -04:00
Quentin Young 66edf91772 tools: clean up whitespace in daemons file
Bit easier to read this way.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-06-16 12:00:23 -04:00
Quentin Young 88323f0f96 tools: improve explanation of watchfrr_options
The explanation block for watchfrr_options was split into two blocks,
one explaining the --netns option and one making a vague statement that
the init script provides the list of daemons to start. The former can be
merged with the latter and the latter is more useful when stated as a
caveat for what you should actually use watchfrr_options for.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-06-16 12:00:23 -04:00
Quentin Young 5e24868b15 tools: improve explanation of 'wrap' options
We support 'wrap' variables in /etc/frr/daemons, but the explanation
given there doesn't touch on some of the subtleties of using these
variables.

The variables were designed for use with Valgrind, which has special
behavior when run with programs that daemonize; Valgrind will intercept
the fork()'d child process and run itself instead of the child. This
behavior allows it to follow the same forking semantics as the target
program.

For virtually every other wrapper, the wrap variables do not work as
demonstrated because the wrapper programs do not daemonize. If the
wrappers do not daemonize, they will block the init script. The examples
given with "perf" for example simply do not work, because perf remains
in the foreground even as it tracks forked children.

This patch adds an explanation of the behavior expected by the init
script and offers a solution for getting that behavior.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-06-16 12:00:23 -04:00
Martin Buck c594796d0f tools: Really fix all daemon shutdown without complaining about PID files
Fix daemon shutdown broken by f0cccaa6bf. Now
we still don't complain about missing PID files but actually stop the
running daemons.

The previous fix was broken because it passed a new "--all" option to
daemon_stop which wasn't handled properly (it assumed $1 contains the
daemon name when at that time it acutally contained the "--all" option).
Plus, "--all" wasn't actually necessary, because we already passed
"--reallyall" from all_stop to daemon_stop after the daemon name.

So remove "--all" again and simply check for "--reallyall" in $2. This
should *really* fix #11317.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2022-06-01 11:58:52 +02:00
Donatas Abraitis 134890bf13
Merge pull request #11315 from gromit1811/fix_init_stop_msgs
tools: Don't complain about missing PID files when stopping all damons
2022-06-01 11:24:13 +03:00
Donald Sharp da49af8cda
Merge pull request #11293 from opensourcerouting/feature/update_workflow_dates
doc, tools: Update release dates in workflow.rst
2022-05-31 13:20:47 -04:00
Martin Buck f0cccaa6bf tools: Don't complain about missing PID files when stopping all damons
Since 1686b1d486, we try to stop all daemons,
even those which are not (no longer) enabled in /etc/frr/daemons. But we
shouldn't complain about missing PID files for daemons which have never been
started and just silently ignore those.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2022-05-31 14:16:34 +02:00
Christian Poessinger 93ced41342 tools: add eigrp support on frr-reload
Signed-off-by: Christian Poessinger <christian@poessinger.com>
2022-05-30 15:03:45 +02:00
Donatas Abraitis bfb8639395 doc, tools: Update release dates in workflow.rst
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-27 08:25:12 +03:00
Russ White 53f681fc22
Merge pull request #11282 from donaldsharp/pim_v2_v3
pimd: Disable handling v3 igmp packets on an interface config'ed for v2
2022-05-26 15:59:39 -04:00
David Lamparter 76ea392900 tools: fix unused variable in callgraph tool
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-26 16:11:12 +02:00
Donald Sharp 8d65864d7a tools: Add show ip igmp statistics to support bundle gathering
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-25 20:06:22 -04:00
Donald Sharp f205a2309c
Merge pull request #11177 from opensourcerouting/fix/memset_memcpy
*: memcpy/memset zeroing
2022-05-13 07:40:58 -04:00
Donatas Abraitis ededfdb4d1 tools: Catch more argv_find() when not checked properly
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-12 10:09:42 +03:00
Donatas Abraitis ab2c896a97 tools: Add coccinelle script to catch memset/memcpy wrong usage
Wrong: memset(&a, 0, sizeof(struct ...));
Good:  memset(&a, 0, sizeof(a));

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-11 13:12:22 +03:00
Chirag Shah 2a502f07a8 tools: string literals -> comments
Convert string literals to comment.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2022-04-24 11:56:47 -07:00
Chirag Shah 411d1a2950 tools: frr-reload fix bgp nbr delete
When a bgp neighbor removed from associated to peer-group,
the neighbor is fully deleted, subsequent deletion of any
configuration related to the neighbor leads to failure
in frr-reload.

Fix: In frr-reload lines to delete check if any neighbor with
peer-group removal line is present, if so then remove any
further config deletion associated the neighbor needs to removed
from the lines to delete.

Ticket:#3032234
Reviewed By:
Testing Done:

BEFORE FIX:
-----------
2022-04-08 20:03:32,734  INFO: Executed "router bgp 4200000005  no neighbor swp5 interface peer-group UNDERLAY"
2022-04-08 20:03:32,892  INFO: Failed to execute router bgp 4200000005  no neighbor swp5 password SSSS
2022-04-08 20:03:33,050  INFO: Failed to execute router bgp 4200000005  no neighbor swp5 password
2022-04-08 20:03:33,218  INFO: Failed to execute router bgp 4200000005  no neighbor swp5
2022-04-08 20:03:33,354  INFO: Failed to execute router bgp 4200000005  no neighbor
2022-04-08 20:03:33,520  INFO: Failed to execute router bgp 4200000005  no
2022-04-08 20:03:33,521 ERROR: "router bgp 4200000005 --  no" we failed to remove this command
2022-04-08 20:03:33,521 ERROR: % Specify remote-as or peer-group commands first

2022-04-08 20:03:33,691  INFO: Failed to execute router bgp 4200000005  no neighbor swp5 advertisement-interval 0
2022-04-08 20:03:33,853  INFO: Failed to execute router bgp 4200000005  no neighbor swp5 advertisement-interval
2022-04-08 20:03:34,015  INFO: Failed to execute router bgp 4200000005  no neighbor swp5
2022-04-08 20:03:34,145  INFO: Failed to execute router bgp 4200000005  no neighbor
2022-04-08 20:03:34,326  INFO: Failed to execute router bgp 4200000005  no
2022-04-08 20:03:34,327 ERROR: "router bgp 4200000005 --  no" we failed to remove this command
2022-04-08 20:03:34,327 ERROR: % Specify remote-as or peer-group commands first

AFTER FIX:
----------

delete of numbered neighbor:

2022-04-08 19:52:17,204  INFO: Executed "router bgp 4200000005  no
neighbor 1.2.3.4 peer-group UNDERLAY"
2022-04-08 19:52:17,205  INFO: /var/run/frr/reload-GRFX1M.txt content

delete of unnumbered neighbor:
2022-04-08 20:00:02,952  INFO: Executed "router bgp 4200000005  no
neighbor swp5 interface peer-group UNDERLAY"
2022-04-08 20:00:02,953  INFO: /var/run/frr/reload-722C3P.txt content

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2022-04-23 12:49:47 -07:00
Chirag Shah d2acc328bd tools: fix bgp instances deletion in frr-reload
BGPd does not allow default instance deletion
in presence of bgp vrf instance;
frr-reload script fails if delete list contains
default instance followed by vrf instance.

Fix:
frr-reload scans lines_to_delete to look for
'router bgp' and 'router bgp vrf ...' line.
If both are present switch the order to delete
bgp vrf instance(s) than default instance at the end.

Testing Done:

Before:

  INFO: Loading Config object from file /etc/frr/frr.conf
  INFO: Loading Config object from vtysh show running
  INFO: Failed to execute no router bgp 40201 <-- Failed to delete
  INFO: Failed to execute no router bgp
  INFO: Failed to execute no router
 ERROR: "no router" we failed to remove this command
 ERROR: % Cannot delete default BGP instance. Dependent VRF instances exist

  INFO: Executed "no router bgp 40201 vrf bgp-test" <-- vrf instance deleted
  INFO: Loading Config object from vtysh show running

After:
  order of deletion switched

  INFO: Loading Config object from file /etc/frr/frr.conf
  INFO: Loading Config object from vtysh show running
  INFO: Executed "no router bgp 40201 vrf bgp-test"
  INFO: Executed "no router bgp 40201"
  INFO: Loading Config object from vtysh show running

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2022-04-23 12:49:47 -07:00
Donald Sharp c27892b24d
Merge pull request #11064 from opensourcerouting/fix/allow_only_euid_0_running_frrinit
tools: Allow running frrinit.sh only for EUID=0
2022-04-21 19:49:47 -04:00
Donatas Abraitis 0f65c5602c tools: Allow running frrinit.sh only for EUID=0
watchfrr and staticd do not require <1024 ports to be running, thus they can
start, but others fail.

We should allow only users with EUID=0 (sudo or root) running frrinit.sh.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-20 18:39:15 +03:00
Donatas Abraitis 1a8dd6f99b tools: Improve usage example for frrinit.sh
```
root@spine1-debian-11:~/frr# /usr/lib/frr/frrinit.sh
Usage:
    /usr/lib/frr/frrinit.sh <start|stop|restart|force-reload|reload|status> [namespace]
    /usr/lib/frr/frrinit.sh stop namespace1
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-20 18:08:51 +03:00
Donald Sharp 83bbdb5e14
Merge pull request #11052 from opensourcerouting/fix/log_dir_permissions
packaging: A couple of fixes for /var/log/frr
2022-04-20 07:45:08 -04:00
Donald Sharp 27a1680926
Merge pull request #11050 from opensourcerouting/fix/pathd_missing
packaging: Add pathd to logrotate
2022-04-19 14:57:46 -04:00
Donatas Abraitis 03ea2db724 packaging: Add pathd to logrotate
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-19 19:13:19 +03:00
Donatas Abraitis 9bf7cb0b74 packaging: Set default permissions for /var/log/frr to 0755
At the moment we set /var/log/frr permissions to 0750 (frr:frr), but the log
file is 0640 (root:adm) (unless logrotated) and that doesn't allow adm group
to even open the directory.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-19 16:54:10 +03:00
Donatas Abraitis 9c2f5943aa tools: Print usage for frrinit.sh when running without arguments
```
root@spine1-debian-11:~/frr# /usr/lib/frr/frrinit.sh
Usage:
    /usr/lib/frr/frrinit.sh (start|stop|restart|force-reload|reload|status)
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-19 14:21:21 +03:00
Donald Sharp 1686b1d486 tools: Modify all_stop to actually try to stop all daemons
If a user enters:
/usr/lib/frr/frrinit.sh start
<modifies daemons file to remove a daemon from being used>
then calls:
/usr/lib/frr/frrinit.sh stop

The daemon(s) that are removed from the file are not stopped.

Apparently in shell scripting naming the variables the same
as the callee does not work as one would think.  Just renaming
the variable to something else solved the problem.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-30 07:44:31 -04:00
Donatas Abraitis 3989029bc0 tools: Replace strings to tr for frrinit.sh
dc3bae68a2 added strings command, which is wrong.

It requires additional package to be installed on the system (binutils).

Let's just get use `tr`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-24 15:26:26 +02:00
Donatas Abraitis 25d7130380
Merge pull request #8967 from anlancs/fix-startup-error-info
tools: suppress unuseful warnings during restarting frr
2022-03-21 09:52:52 +02:00
Donald Sharp 7baebfb715
Merge pull request #10447 from ton31337/fix/json_with_whitespaces
*: Fix JSON keys with whitespaces and PascalCase
2022-03-13 18:19:33 -04:00
Donald Sharp 115335d3e3 tools: Add show thread timers to support bundle generation
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-28 06:39:07 -05:00
Igor Ryzhov 57692f125e tools: fix frr-reload context keywords
There are singline-line commands inside `router bgp` that start with
`vnc ` or `bmp `. Those commands are currently treated as node-entering
commands. We need to specify such commands more precisely.

Fixes #10548.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2022-02-10 02:51:49 +03:00
Donald Sharp 6d30246ef1
Merge pull request #10445 from ton31337/fix/frr-reload_stop_disabled_daemons
tools: Stop disabled daemons when doing reload
2022-02-08 14:15:05 -05:00
Jafar Al-Gharaibeh 89569a7684
Merge pull request #10471 from ton31337/fix/release_candidate_procedure
doc: Add a commands snippet to workflow about what to do in RC1 phase
2022-02-06 15:06:16 -06:00
Donatas Abraitis 5568f9d12b doc: Add a commands snippet to workflow about what to do in the 1st phase
What we should do when creating stabilization branch from the master.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-05 10:07:32 +02:00
Donatas Abraitis 1988854011 tools: Skip decorating commits with references (branch name, remote)
I think we don't care about this in release notes.

bgpd,pimd,isisd,nhrpd: Convert to vty_json() (origin/fix/vty_json)
ospf6d: Fix memory leak for `show ipv6 ospf6 zebra json` (origin/fix/zebra_ospf6d_json_leak)

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-04 23:24:03 +02:00
Donatas Abraitis bcd464bb34 tools: Check against capital first in JSON keys
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-03 10:48:06 +02:00
Donatas Abraitis 1ab60f2978 tools: Catch JSON keys with whitespaces
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-03 10:47:32 +02:00
Donatas Abraitis 1c862c2d9e tools: Handle new lines for json_object_to_json_string_ext()
Just to handle %s and %s\n.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-01-31 15:34:24 +02:00
Donatas Abraitis dc3bae68a2 tools: Stop disabled daemons when doing reload
After:
```
root@exit1-debian-11:~# grep ripngd= /etc/frr/daemons
ripngd=no
root@exit1-debian-11:~# pgrep -f ripngd -c
0
root@exit1-debian-11:~# sed -i 's/ripngd=no/ripngd=yes/' /etc/frr/daemons
root@exit1-debian-11:~# /usr/lib/frr/frrinit.sh reload
Stopped watchfrr.
Started watchfrr.
root@exit1-debian-11:~# pgrep -f ripngd -c
2
root@exit1-debian-11:~# grep ripngd= /etc/frr/daemons
ripngd=yes
root@exit1-debian-11:~# sed -i 's/ripngd=yes/ripngd=no/' /etc/frr/daemons
root@exit1-debian-11:~# /usr/lib/frr/frrinit.sh reload
Stopped watchfrr.
Started watchfrr.
Stopped ripngd.
root@exit1-debian-11:~# pgrep -f ripngd -c
0
```

Before:
```
root@exit1-debian-11:~# grep ripngd= /etc/frr/daemons
ripngd=no
root@exit1-debian-11:~# pgrep -f ripngd -c
0
root@exit1-debian-11:~# sed -i 's/ripngd=no/ripngd=yes/' /etc/frr/daemons
root@exit1-debian-11:~# /usr/lib/frr/frrinit.sh reload
Stopped watchfrr.
Started watchfrr.
root@exit1-debian-11:~# pgrep -f ripngd -c
2
root@exit1-debian-11:~# grep ripngd= /etc/frr/daemons
ripngd=yes
root@exit1-debian-11:~# sed -i 's/ripngd=yes/ripngd=no/' /etc/frr/daemons
root@exit1-debian-11:~# /usr/lib/frr/frrinit.sh reload
Stopped watchfrr.
Started watchfrr.
Stopped ripngd.
root@exit1-debian-11:~# pgrep -f ripngd -c
1 <<<<<< ripngd is running, while watchfrr skips it
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-01-31 08:48:44 +02:00
anlan_cs 19a99d89f0 tools: suppress unuseful warnings during restarting frr
Problem:
During restarting frr.service, it throws annoying warnings:
Cannot stop bgpd(and others): pid file not found.

Root Cause:
During restarting process, systemd uses "stop", and watchfrr
uses "restart".
Yes, watchfrr using "restart" is to avoid systemd failing to stop.
But it should be quiet.

Fix:
During restarting service, suppress these warnings from watchfrr.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-01-21 21:23:22 -05:00
David Lamparter 176b254cb9 tools: disable printf ext checks in checkpatch
checkpatch.pl has a hardcoded list of printf extensions supported... by
the Linux kernel.  This happens to have covered the ones we have in FRR
so far, but `%pPA` isn't on the list and others may not be either.

Since we have the frr-format GCC plugin (and CI runs that on Debian 11)
we don't really need these checks in checkpatch.pl.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-14 09:18:25 +01:00
Igor Ryzhov 398f41c8bb
Merge pull request #10030 from anlancs/cleanup-reload-null0
tools: cleanup convertion of "Null0"
2022-01-09 17:17:00 +03:00
Jafar Al-Gharaibeh ca47cd1fb1
Merge pull request #9517 from anlancs/reload-add-str
tools: fix wrong get_contexts() of Config class.
2022-01-09 00:07:53 -06:00
Donald Sharp bcbc98b0b9
Merge pull request #10242 from anlancs/fix-service-time
build: add "--with-service-timeout" in configure.ac
2022-01-08 07:15:37 -05:00
Donald Sharp 667cfdc824 tools: Run formatter over generate_support_bundle.py
The generate_support_bundle.py script needs some
reformating to meet our standards

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-01-06 08:18:30 -05:00
anlan_cs fc539216ce build: add "--with-service-timeout" in configure.ac
On lower CPU with lots of static routes, it will cost more than 2
minutes.

2 minutes is the default timeout value, we can adjust it by configure:
./configure --with-service-timeout=<digit>

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2022-01-06 07:42:36 -05:00
anlan_cs 9dee14bdb8 tools: cleanup route convertion from null0/Null0 to blackhole
Signed-off-by: anlan_cs <anlan_cs@tom.com>
2021-12-31 00:59:22 -05:00
Jonas Gorski b321edc51b tools: fix backing up previous logs in generate_support_bundle.py
subprocess.check_call needs to be called with shell=True, else it will
interpret the string as a single path to execute instead of a command
with arguments:

Fixes the following error:

$ /usr/lib/frr/generate_support_bundle.py
Making backup of /var/log/frr/bgp_support_bundle.log
Traceback (most recent call last):
  File "/usr/lib/frr/generate_support_bundle.py", line 89, in <module>
    main()
  File "/usr/lib/frr/generate_support_bundle.py", line 80, in main
    stdout=open_with_backup(ofn),
  File "/usr/lib/frr/generate_support_bundle.py", line 32, in open_with_backup
    subprocess.check_call("mv {0} {0}.prev".format(path))
  File "/usr/lib/python3.8/subprocess.py", line 359, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'mv /var/log/frr/bgp_support_bundle.log /var/log/frr/bgp_support_bundle.log.prev'

Fixes: 5417cc2de ("tests: collect support bundle data in parallel, fix bugs")
Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
2021-12-15 10:41:49 +01:00
Quentin Young d64d20fcd4
Merge pull request #9937 from Jafaral/rel-script 2021-12-13 12:26:22 -05:00
Russ White 46507be0fe
Merge pull request #10187 from chiragshah6/freload
tools: exit when reload fails to parse config file
2021-12-07 11:40:36 -05:00
Chirag Shah 3a442b25ec tools: exit when reload fails to parse config file
frr-reload triggers restart of service in case
it fails to parse new config file and conjunction with
running config contains 'router bgp' (default bgp instnace).

When frr-reload fails to parse new config file, it fails
to build newconfig context (empty object).
Instead of bailing out it compares against the running config
context. If the running config contains default bgp instance
it thinks new config is removing default bgp instance so it
triggers frr restart.

Fix is to to bail out reload script when it fails to parse
config file.

Ticket:#2861989
Reviewed By: MR-83
Testing Done:

router bgp 102 vrf RED
bgp router-id 2.2.2.2
neighbor underlay peer-group
neighbor underlay remote-as <---- Partial config

Before fix:
2021-12-02 02:43:16,987 ERROR: vtysh failed to process new
configuration: vtysh (mark file) exited with status 4:
b'line 79: % Command incomplete: neighbor underlay remote-as\n\n'
2021-12-02 02:43:17,145  INFO: Loading Config object from vtysh show
running
2021-12-02 02:43:17,362  INFO: "frr version 7.5+cl5.0.0u0" cannot be
removed
2021-12-02 02:43:17,362  INFO: "frr defaults datacenter" cannot be
removed
2021-12-02 02:43:17,362  INFO: "service integrated-vtysh-config" cannot
be removed
2021-12-02 02:43:17,363  INFO: "line vty" cannot be removed
2021-12-02 02:43:17,522  INFO: EVPN is enabled and default instance del
needed
2021-12-02 02:43:17,522  INFO: Restarting FRR          <---- Restart frr

After fix:

Just throw Error and abort the script.

root@TORS1:mgmt:/home/cumulus# /usr/lib/frr/frr-reload.py --debug
--reload --stdout /etc/frr/frr.conf
2021-12-02 04:00:56,519  INFO: Called via "Namespace(bindir='/usr/bin',
confdir='/etc/frr', daemon='', debug=True, filename='/etc/frr/$
rr.conf', input=None, overwrite=False, pathspace=None, reload=True,
rundir='/var/run/frr', stdout=True, test=False, vty_socket=None)"
2021-12-02 04:00:56,520  INFO: Loading Config object from file
/etc/frr/frr.conf
2021-12-02 04:00:56,679   ERROR: vtysh failed to process new
configuration: vtysh (mark file) exited with status 4:
b'line 79: % Command incomplete: neighbor underlay remote-as\n\n'
root@TORS1:mgmt:/home/cumulus#

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-12-06 14:20:57 -08:00
Jafar Al-Gharaibeh 339bd66fde tools: add a script to generate draft release changelog
This utility script helps in generated formatted and consistent
change log including:
       1- group logs per daemon
       2- standarize daemon names (lowercase, end with d)
       3- capitalize all log lines
       4- no merge commits

caveat: comments are assumed to be in the form

   daemon-name : message

Sample Output:

```
sharpd
    Follow the practice on cli design for json output
    Install route supports nexthop-seg6 (step3)
    Install_routes_helper support zapi_route flags (step1)

snapcraft
    Add missing dependency
    Add pathd to frr snap daemons
    Change base to ubuntu 18.04 and libyang 2.0.7

staticd
    Convert typedef to enum
    Fix distance processing
    Fix late initialization of blackhole type
    Output config using nb callbacks instead of operational data
```

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2021-12-06 13:44:57 -06:00
Chirag Shah 2134a5fe51 frr-reload: fix bgp nbr remote-as
Remove neighbor <> remote-as <> config line,
if the neighbor is part of the peer-group and
peer-group contains remote-as config.

Neighbors which are part of the peer-group
cannot override remote-as.

Fix:
Frr-reload needs to remote 'neighbor <> remote-as <>'
from lines_to_add if its already part of peer-group
and peer-group has remote-as config.

Testing Done:

Before:

Config snippet:
neighbor PEERS peer-group
neighbor PEERS remote-as external
neighbor PEERS timers 3 9
neighbor 10.2.1.1 remote-as external
neighbor 10.2.1.1 peer-group PEERS
neighbor 10.2.1.1 timers 3 9
neighbor 10.2.1.2 remote-as external
neighbor 10.2.1.2 peer-group PEERS

Frr-reload failure:
line 179: Failure to communicate[13] to bgpd, line:  neighbor 10.2.1.1
remote-as external
% Peer-group member cannot override remote-as of peer-group
line 179: Failure to communicate[13] to bgpd, line:  neighbor 10.2.1.2
remote-as external
% Peer-group member cannot override remote-as of peer-group

After:
frr-reload apply the config successfully.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-12-05 21:28:11 -08:00
Igor Ryzhov cb3fa0a612
Merge pull request #10124 from ton31337/feature/vty_json 2021-11-29 02:11:29 +03:00
Donatas Abraitis f615ecb96d tools: Convert vty_out to vty_json for JSON
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25 17:49:25 +02:00
Donatas Abraitis 15116b0069 tools: Replace prefix2str for JSON to %pFX
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25 17:26:26 +02:00
Donatas Abraitis 8b3c84254d tools: Add coccinelle script to replace inet_ntop inside JSON
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18 11:32:46 +02:00
Donald Sharp 8e653596c4 tools, vtysh: Remove final vestige of address-family evpn
This was deprecated over a year ago now.  Let's finally
remove it from the system.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-17 07:49:56 -05:00
Donald Sharp 23ee09601b tools: Add another valgrind suppression for libyang
More memory leaks from libyang that we can just ignore

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-15 15:06:58 -05:00
Quentin Young 6e09a5bfea tools: simplify excessively complex conditional
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-11-12 13:37:09 -05:00
Quentin Young d2863e4a6b tools: string literals -> comments
Convert all floating string literals being used as comments, to comments

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-11-12 13:18:52 -05:00
David Lamparter 7c1803d0a0 tools: remove Linux kernel bits from checkpatch
These aren't appropriate for use in FRR.  Among other things, this
enables running checkpatch by calling it in a git working tree with
`tools/checkpatch.pl -g origin/master..`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19 14:58:51 +02:00
David Lamparter 4d619e25ab tools: add iterators to checkpatch
For the purpose of allowing the space in `frr_each (`, copy the list of
iterators from .clang-format and wire it up appropriately.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19 14:58:51 +02:00
Anuradha Karuppiah 32dcd36d29 tools: upstream linter is recommending double quotes
Replaced single quotes with double quotes for strings in
the frr_babeltrace.py utility.

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2021-10-15 10:37:45 -07:00
Anuradha Karuppiah b9c3be8be2 tools: add frr_babeltrace.py to /usr/lib/frr
Make the script available as a part of the FRR package install for
ease of use.

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2021-10-15 10:37:02 -07:00
Anuradha Karuppiah a383bfc7c9 bgpd: lttng tracepoint for local events received from zebra
TPs -
=====
root@ibm-2410a1-01:mgmt:~# lttng list --userspace |grep frr_bgp:evpn.*recv
      frr_bgp:evpn_local_l3vni_del_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_local_l3vni_add_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_local_macip_del_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_local_macip_add_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_local_vni_del_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_local_vni_add_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_mh_local_es_evi_del_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_mh_local_es_evi_add_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_mh_local_es_del_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_mh_local_es_add_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
root@ibm-2410a1-01:mgmt:~#

Sample output -
===============
1. ES
frr_bgp:evpn_mh_local_es_add_zrecv {'esi': '03:44:38:39:ff:ff:01:00:00:01', 'vtep': '27.0.0.15', 'active': 0, 'bypass': 0, 'df_pref': 50000}
frr_bgp:evpn_mh_local_es_del_zrecv {'esi': '03:44:38:39:ff:ff:01:00:00:01'}

2. ES-EVI
frr_bgp:evpn_mh_local_es_evi_add_zrecv {'esi': '03:44:38:39:ff:ff:01:00:00:01', 'vni': 1004}
frr_bgp:evpn_mh_local_es_evi_del_zrecv {'esi': '03:44:38:39:ff:ff:01:00:00:01', 'vni': 1001}

3. L2-VNI
frr_bgp:evpn_local_vni_add_zrecv {'vni': 1004, 'vtep': '27.0.0.15', 'mc_grp': '239.1.1.104', 'vrf': 97}

4. L3-VNI
frr_bgp:evpn_local_l3vni_add_zrecv {'vni': 4001, 'vrf': 87, 'svi_rmac': '24:8a:07:cc:aa:5f', 'vrr_rmac': '24:8a:07:cc:aa:5f', 'vtep': '27.0.0.15', 'filter': 0, 'svi_ifindex': 95, 'anycast_mac': 'n'
frr_bgp:evpn_local_l3vni_del_zrecv {'vni': 4003, 'vrf': 107}

5. MAC-IP
frr_bgp:evpn_local_macip_add_zrecv {'vni': 1003, 'mac': '00:02:00:00:00:04', 'ip': 'fe80::202:ff:fe00:4', 'flags': 4, 'seq': 0, 'esi': '03:44:38:39:ff:ff:01:00:00:02'}
frr_bgp:evpn_local_macip_del_zrecv {'vni': 1000, 'mac': '00:02:00:00:00:04', 'ip': '2001:fee1::4', 'state': 1}

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2021-10-15 10:37:02 -07:00
anlan_cs 1bdffcf01c tools: fix wrong get_contexts() of Config class.
Calling get_contexts() can't display as expected, it wrongly displays:
<__main__.Context object at 0x7fdee1d5ad50>

So make it display correct data by add __str__ in Context class.

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2021-10-09 04:15:55 -04:00
Donatas Abraitis c08050d6d1 tools: Catch double pointer of struct thread towards thread_add_*
```
% spatch --sp-file tools/coccinelle/struct_thread_double_pointer.cocci --macro-file tools/cocci.h ./ 2>/dev/null
./lib/northbound_confd.c:429:65-66: Passed double 'struct thread' pointer
./lib/northbound_confd.c:1174:61-62: Passed double 'struct thread' pointer
./lib/northbound_sysrepo.c:543:69-70: Passed double 'struct thread' pointer
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-07 16:25:03 +03:00
Russ White 334d9d259f
Merge pull request #9731 from ton31337/fix/thread_null_set
cleanup: struct thread = NULL
2021-10-05 19:27:23 -04:00
Donatas Abraitis 83e66fdfd6 tools: Add coccinelle script to catch thread to NULL assignments
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-04 19:29:06 +03:00
Anuradha Karuppiah 23aa35ade5 bgpd: initial batch of evpn lttng tracepoints
Low overhead bgp-evpn TPs have been added which push data out in a binary
format -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@switch:~# lttng list --userspace |grep "frr_bgp:evpn"
      frr_bgp:evpn_mh_nh_rmac_zsend (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint)
      frr_bgp:evpn_mh_nh_zsend (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_mh_nhg_zsend (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_mh_vtep_zsend (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_bum_vtep_zsend (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_mac_ip_zsend (loglevel: TRACE_INFO (6)) (type: tracepoint)
root@switch:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

In addition to the tracepoints a babeltrace python plugin for pretty
printing (binary data is converted into grepable strings). Sample usage -
frr_babeltrace.py trace_path

Sample tracepoint output -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1. frr_bgp: evpn_mac_ip_zsend
frr_bgp:evpn_mac_ip_zsend {'action': 'add', 'vni': 1007, 'mac': '00:02:00:00:00:04', 'ip': 'fe80::202:ff:fe00:4', 'vtep': '27.0.0.15', 'esi': '03:44:38:39:ff:ff:01:00:00:02'}

2. frr_bgp: evpn_mh_vtep_zsend
frr_bgp:evpn_mh_vtep_zsend {'action': 'add', 'esi': '03:44:38:39:ff:ff:01:00:00:02', 'vtep': '27.0.0.16'}

3. frr_bgp: evpn_mh_nhg_zsend
frr_bgp:evpn_mh_nhg_zsend {'action': 'add', 'type': 'v4', 'nhg': 74999998, 'esi': '03:44:38:39:ff:ff:01:00:00:02', 'vrf': 85}

4. frr_bgp: evpn_mh_nh_zsend
frr_bgp:evpn_mh_nh_zsend {'nhg': 74999998, 'vtep': '27.0.0.16', 'svi': 93}

5. frr_bgp: evpn_mh_nh_rmac_zsend
frr_bgp:evpn_mh_nh_rmac_zsend {'action': 'add', 'vrf': 85, 'nh': '::ffff:1b00:12', 'rmac': '00:02:00:00:00:50'}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2021-10-01 09:02:25 -07:00
Donatas Abraitis 94ca37e0a9 tools: Add coccinelle script to catch \n or \r at the end of zlog_*
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-09-27 15:21:52 +03:00
Donald Sharp cd8aaf076e tools: Add some new suppressions
Bunch of new stuff came in w/ the libyang2 upgrade that needs
to be suppressed.  Make it so.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-21 07:54:54 -04:00
Quentin Young 32acb4a7ad
Merge pull request #9497 from opensourcerouting/cli-better-no 2021-09-09 12:22:53 -04:00
Christian Hopps a53c08bc13 tests: cleanup: rerun changed files through black
Signed-off-by: Christian Hopps <chopps@labn.net>
2021-09-04 09:04:47 -04:00
Christian Hopps 4953ca977f tests: cleanup - remove unused imports
Signed-off-by: Christian Hopps <chopps@labn.net>
2021-09-04 09:04:47 -04:00
Christian Hopps 77a7a87cdd tools: move frr-reload.py to python3 explicitly
We already, reasonably, require python3 elsewhere. Do so here, and reap some
benefit.

Signed-off-by: Christian Hopps <chopps@labn.net>
2021-09-04 09:04:47 -04:00
David Lamparter b8f9523597
Merge pull request #9340 from stefreak/patch-1
tools: fix frr pathspace folder permissions
2021-09-02 13:24:44 +02:00
David Lamparter 90c8406c20 lib: add ![...] syntax for easy "no" forms
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>
2021-08-26 21:03:44 +02:00
Igor Ryzhov fc43980f25 tools: significantly simplify frr-reload context processing
Currently, in frr-reload we:
- store a list of single-line context keywords which needs to be
  frequently updated,
- have a separate "if" clause for every node and subnode we have in FRR.

Instead, we can store the tree of all known FRR nodes. This tree needs
to be updated whenever we add a new node, which is not frequent. And,
most importantly, it allows us to write node-agnostic code and save more
than 250 LOC.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-23 22:08:20 +03:00
Igor Ryzhov 541af473f9
Merge pull request #9341 from LabNConsulting/chopps/ospf-support-bundle
tools: add ospfd support bundle commands
2021-08-18 14:40:08 +03:00
Donald Sharp 061bf350dd
Merge pull request #9271 from opensourcerouting/workflow-release-sched
workflow: document release scheduling discussed
2021-08-14 09:06:23 -04:00
David Lamparter dc1c0bc2b3 workflow: document release scheduling discussed
As discussed in the weekly meeting today, this is what we're trying to
work with for the time being.

(Date calculator included as a bonus goodie ;)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-11 16:37:46 +02:00
Christian Hopps 36cd3e81e8 tools: add ospfd support bundle commands
Signed-off-by: Christian Hopps <chopps@labn.net>
2021-08-10 07:39:18 +00:00
Christian Hopps cb04c8e906
Merge pull request #9219 from mobash-rasool/ospfv2-bug-fixes
tools: Add ospfv2 and ospfv3 commands in support bundle
2021-08-10 03:14:43 -04:00
Steffen Neubauer 0fc6a5f8ed tools: fix frr pathspace folder permissions
The pathspace folder in /var/run needs the x permission for the group too

Otherwise vtysh fails when running it with groups frrvty and frr:

    $ vtysh -N gateway
    % Can't open configuration file /etc/frr/gateway/vtysh.conf due to 'Permission denied'.
    vtysh_connect(/var/run/frr/gateway/zebra.vty): stat = Permission denied

Signed-off-by: Steffen Neubauer <s.neubauer@syseleven.de>
2021-08-09 13:54:58 +02:00
Donald Sharp a66413a53b
Merge pull request #8870 from anlancs/master-fix-reload-service
tools: add "vni" to oneline list
2021-08-08 07:21:10 -04:00
Mobashshera Rasool 54d8e033f3 tools: Add ospfv3 commands in the support bundle
Co-authored-by: Yash Ranjan <ranjyany@vmware.com>
Signed-off-by: Yash Ranjan <ranjyany@vmware.com>
Co-authored-by: Mobashshera Rasool <mrasool@vmware.com>
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-30 05:14:26 -07:00
Mobashshera Rasool 34e96abf2e tools: Add ospfd commands in support bundle
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-30 03:52:45 -07:00
Christian Hopps be4a9b0570 tools: improve frr-reload.py delta file creation
- Remove incorrect requirement for `service integrated-vtysh-config`
  when producing a delta.
- Add `--test-reset` option which suppresses non-parseable lines from the
  produced delta
- Use new features in common_config.py

Signed-off-by: Christian Hopps <chopps@labn.net>
2021-07-15 22:12:01 -04:00
Donatas Abraitis 107df351c6 tools: Add coccinelle script for hash compare functions NULL values
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-13 08:49:38 +03:00
Donald Sharp acb4c44ef8
Merge pull request #8942 from ton31337/fix/cleanups_2
Another round of cleanup
2021-07-06 09:47:41 -04:00
Donald Sharp 432bb280fb
Merge pull request #8939 from LabNConsulting/chopps/sup-bund-fixes
Speedup support bundles, fix bugs, add CLI timestamp
2021-07-06 07:58:19 -04:00
Igor Ryzhov c54e2a8144 tools: Simplify the script to build Debian binary package
Signed-off-by: Ondřej Surý <ondrej@sury.org>
2021-07-03 17:02:37 +02:00
Ondřej Surý dfbc6c046e debian: Add support for Debian bullseye to the packaging script
The Debian bullseye is frozen now, so this adds support to this
Debian release to the packaging script.

Signed-off-by: Ondřej Surý <ondrej@sury.org>
2021-07-03 17:02:37 +02:00
Ondřej Surý 9ea548cf3c debian: Fix the debian packaging script to build on non-default branch
The packaging script would fail to run on non-master branch, fix that
by pulling original branch name.

Signed-off-by: Ondřej Surý <ondrej@sury.org>
2021-07-03 17:02:37 +02:00
Ondřej Surý 223766ead4 debian: Update the tools/build-debian-package.sh to be example build script
Signed-off-by: Ondřej Surý <ondrej@sury.org>
2021-07-03 17:02:37 +02:00
Ondřej Surý aa1e17f5ca debian: Remove now obsolete tarsource.sh script
Signed-off-by: Ondřej Surý <ondrej@sury.org>
2021-07-03 17:02:37 +02:00
Ondřej Surý 06417e9f18 debian: Remove the changelog-auto automation in favor of dch
Signed-off-by: Ondřej Surý <ondrej@sury.org>
2021-07-03 17:02:37 +02:00
Ondřej Surý bcd053ee8d debian: Update tools/build-debian-package.sh to use git-buildpackage
Signed-off-by: Ondřej Surý <ondrej@sury.org>
2021-07-03 17:02:37 +02:00
Ondřej Surý 25785834af debian: Adjust tarsource.sh to use native debian/changelog
Signed-off-by: Ondřej Surý <ondrej@sury.org>
2021-07-03 17:02:37 +02:00
Christian Hopps 5417cc2de3 tests: collect support bundle data in parallel, fix bugs
Speedup (large topo): OLD: ~6 minutes NEW: ~1 second.
  (when paired with common_config.py changes)
- Collect each "proc" support in parallel
- For each "proc" only call vtysh once with all commands

Bug fixes:
- output was broken, a dump of python "repr" format of str.

Signed-off-by: Christian Hopps <chopps@labn.net>
2021-06-30 15:46:10 +00:00
anlancs 470d316e3e tools: add "vni" to oneline list
Add "vni" into oneline list.
Additionally, keep them in order in oneline list.

Signed-off-by: anlancs <anlan_cs@tom.com>
2021-06-30 16:28:37 +08:00
Donatas Abraitis 63f7a3b910 tools: Add coccinelle script for checking against XMALLOC/XCALLOC NULLs
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-06-29 22:27:50 +03:00
Donald Sharp 6293c2181a tools: limit bgp route-maps to direct changes only
When using frr-reload.py to modify a bgp neighbors route-map
the code was doing this:

a) deleting the previous route-map: `no neighbor XX route-map YY (in|out)`
b) Adding the new route-map back in `neighbor XX route-may ZZ (in|out)`

Now imagine that we have an outgoing route-map that we are changing
and the reload is large because of a large number of lines in frr.conf

Item (a) will happen.  BGP will immediately start sending all local
routes.  At some point in time in the future (b) will be applied.
This of course causes a withdraw but for a short amount of time we
are leaking unintended routes.  This is bad for several reasons
not 1) route churn upstream, 2) we might influence traffic to go the
wrong way. 3) if upstream has a maximum-prefix command the routes
being sent might trip its circuitry and shutdown the peer entirely
not even allowing you to get to (b).

Ticket: #2589685
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-06-23 10:19:00 -04:00
Patrick Ruddy fa855f8fa3
Merge pull request #6695 from adharkar/frr-master-gateway_ip
EVPN route type-5 gateway IP overlay Index
2021-06-23 09:23:54 +01:00
Mark Stapp a78dde0dcd
Merge pull request #8867 from wesleycoakley/pbr-table-range-single-line
tools: make frr-reload recognize `pbr table range` lines as single-line contexts
2021-06-22 09:12:02 -04:00
Don Slice 1443e23148 tools: add mac access-list context to frr-reload.py
Problem reported that frr-reload.py didn't handle the mac access-list
command correctly, causing reloads to fail.  This fix adds the
support for the command as a single line context.

Signed-off-by: Don Slice <dslice@nvidia.com>
2021-06-18 08:09:02 -07:00
Wesley Coakley cbfb52986f
tools: reload recognizes pbr table range as single-line ctx
The line `pbr table range ...` does not start a new context so treat it
like a single-line context

Signed-off-by: Wesley Coakley <w@wesleycoakley.com>
2021-06-16 20:34:30 -04:00