summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
2024-02-08tools: fix frr-reload multiple no description cmdsChirag Shah
Ensure to change description for index 0 from the list. Ticket: #3628756 Testing Done: After fix: start with three interfaces description delete in lines_to_del: (Pdb) lines_to_del [(('interface swp1',), "description swp1 -> sp1's swp1"), (('interface swp2',), "description swp2 -> sp2's swp 1"), (('interface swp3',), "description swp3 -> sp3's swp1")] After first iteration swp1: (Pdb) index 0 (Pdb) lines_to_del [(('interface swp1',), 'description'), (('interface swp2',), "description swp2 -> sp2's swp1"), (('interface swp 1s2',), "description swp3 -> sp3's swp1")] After second iteration swp2: (Pdb) lines_to_del [(('interface swp1',), 'description'), (('interface swp2',), 'description'), (('interface swp3',), "description swp3 -> sp3's swp1")] After third iteration swp3 fix (Pdb) lines_to_del [(('interface swp1',), 'description'), (('interface swp2',), 'description'), (('interface swp3',), 'description' )] Signed-off-by: Chirag Shah <chirag@nvidia.com> (cherry picked from commit 8a5c6e4389a8f56c1a25941977a1f6acaf92f53e) (cherry picked from commit dfc0a168d32d6cd7800815de3c335a232c8482da)
2024-02-08tools: Use error log level when failing to execute commands via frr-reload.pyDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org> (cherry picked from commit 204508433dbc25c19af9fb7f62e0b90c507fd4e2) (cherry picked from commit b1bdb55053a0a9bf01f7c763e0895c535b81f990)
2024-02-08tools: Apply black formatting for tools/frr-reload.pyDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org> (cherry picked from commit 885613e45d382c6ac430f724c7de0d17cb64a5cf)
2023-12-13tools: fix frr-reload multiple no description cmdsChirag Shah
Ensure to change description for index 0 from the list. Ticket: #3628756 Testing Done: After fix: start with three interfaces description delete in lines_to_del: (Pdb) lines_to_del [(('interface swp1',), "description swp1 -> sp1's swp1"), (('interface swp2',), "description swp2 -> sp2's swp 1"), (('interface swp3',), "description swp3 -> sp3's swp1")] After first iteration swp1: (Pdb) index 0 (Pdb) lines_to_del [(('interface swp1',), 'description'), (('interface swp2',), "description swp2 -> sp2's swp1"), (('interface swp 1s2',), "description swp3 -> sp3's swp1")] After second iteration swp2: (Pdb) lines_to_del [(('interface swp1',), 'description'), (('interface swp2',), 'description'), (('interface swp3',), "description swp3 -> sp3's swp1")] After third iteration swp3 fix (Pdb) lines_to_del [(('interface swp1',), 'description'), (('interface swp2',), 'description'), (('interface swp3',), 'description' )] Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-11-30bgpd: lttng tp add evpn route eventsChirag Shah
Ticket:#3597393 Testing Done: 2023-09-08T22:53:03.532 frr_bgp:evpn_withdraw_type5 {'vrf_id': 42, 'ip': '53.1.1.0'} 2023-09-08T22:53:06.207 frr_bgp:evpn_advertise_type5 {'vrf_id': 42, 'ip': '53.1.1.0', 'rmac': '00:02:00:00:00:38', 'vtep': '27.0.0.15'} 2023-09-08T21:51:15.637 frr_bgp:evpn_mh_local_ead_es_evi_route_upd {'esi': '03:44:38:39:ff:ff:01:00:00:03', 'vni': 1000, 'route_type': 1, 'vtep': '27.0.0.15'} 2023-09-08T20:45:17.059 frr_bgp:evpn_mh_local_ead_es_evi_route_del {'esi': '03:44:38:39:ff:ff:01:00:00:01', 'vni': 0, 'route_type': 4, 'vtep': '27.0.0.15'} 2023-09-08T21:51:18.363 frr_bgp:evpn_mh_es_evi_vtep_add {'esi': '03:44:38:39:ff:ff:01:00:00:02', 'vni': 1000, 'vtep': '27.0.0.16', 'ead_es': 1} 2023-09-08T20:43:50.206 frr_bgp:evpn_mh_es_evi_vtep_del {'esi': '03:44:38:39:ff:ff:01:00:00:01', 'vni': 1002, 'vtep': '27.0.0.16', 'ead_es': 0} Signed-off-by: Chirag Shah <chirag@nvidia.com> (cherry picked from commit ac30911160c6dd5556dd42133760a0c60b897569)
2023-11-29tools: fix frr-reload interface desc cmdChirag Shah
Fix frr-reload script to only render 'no description' rather than 'no description blah' Ticket:#3628756 Testing Done: Before: 2023-11-29 02:38:55,758 INFO: Failed to execute interface hostbond_1 no description hostbond_1_to_host exit 2023-11-29 02:38:55,758 ERROR: "interface hostbond_1 -- no description hostbond_1_to_host -- exit" we failed to remove this command 2023-11-29 02:38:55,758 ERROR: % Unknown command: no description hostbond_1_to_host Signed-off-by: Chirag Shah <chirag@nvidia.com> (cherry picked from commit 00b96f70df4bfa40b0676b180b01df49d7546e33)
2023-11-02tools: fix frr-reload route-map desc cmdChirag Shah
Fix frr-reload script to only render 'no description' rather than 'no description blah' Ticket:#3650752 Testing: route-map TEST permit 140 description rule for PFIX_IPV6_7 match ipv6 address prefix-list PFIX_IPV6_7 exit ! end torc-11# confi t torc-11(config)# route-map TEST permit 140 torc-11(config-route-map)# no description rule for PFIX_IPV6_7 % Unknown command: no description rule for PFIX_IPV6_7 torc-11(config-route-map)# no description rule % There is no matched command. torc-11(config-route-map)# no description <cr> torc-11(config-route-map)# no description torc-11(config-route-map)# Using frr-reload failure log: 2023-10-31 00:30:31,972 INFO: Failed to execute route-map TEST permit 140 no description rule for PFIX_IPV6_7 exit 2023-10-31 00:30:31,972 ERROR: "route-map TEST permit 140 -- no description rule for PFIX_IPV6_7 -- exit" we failed to remove this command 2023-10-31 00:30:31,972 ERROR: % Unknown command: no description rule for PFIX_IPV6_7 With fix: 2023-11-02 06:10:30,024 INFO: Executed "route-map TEST permit 140 no description exit" Signed-off-by: Chirag Shah <chirag@nvidia.com> (cherry picked from commit 989991cf3cc24e673af627f4049e7e55077d31ec)
2023-09-14tools: make --quiet actually suppress outputJonas Gorski
When calling daemon_stop() with --quiet and e.g. the pidfile is empty, it won't return early since while "$fail" is set, "$2" is "--quiet", so the if condition isn't met and it will continue executing, resulting in error messages in the log: > Sep 14 14:48:33 localhost watchfrr[2085]: [YFT0P-5Q5YX] Forked background command [pid 2086]: /usr/lib/frr/watchfrr.sh restart all > Sep 14 14:48:33 localhost frrinit.sh[2075]: /usr/lib/frr/frrcommon.sh: line 216: kill: `': not a pid or valid job spec > Sep 14 14:48:33 localhost frrinit.sh[2075]: /usr/lib/frr/frrcommon.sh: line 216: kill: `': not a pid or valid job spec > Sep 14 14:48:33 localhost frrinit.sh[2075]: /usr/lib/frr/frrcommon.sh: line 216: kill: `': not a pid or valid job spec Fix this by moving the --quiet check into the block to log_failure_msg(), and also add the check to all other invocations of log_*_msg() to make --quiet properly suppress output. Fixes: 19a99d89f088 ("tools: suppress unuseful warnings during restarting frr") Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
2023-09-12mgmtd: support bundle commands for mgmt daemon.Manoj Naragund
Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2023-09-06Merge pull request #14344 from opensourcerouting/freebsd-printf-sync-20230903Donald Sharp
lib/printf: sync with FreeBSD for ISO C23 enhancements
2023-09-04tools/gcc-plugins: fix for GCC 13David Lamparter
As usual, new GCC version, new small random changes in the API. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-03tools/gcc-plugins: allow ISO C23 `%b`David Lamparter
It behaves exactly like `%x`, so adding it is a single byte diff. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-07-27tools: fix key chain reload removalRafael Zalamena
When deleting a key chain with frr-reload track if the whole root node is being removed or not. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2023-07-18Merge pull request #10136 from idryzhov/frr-reload-exitMark Stapp
tools: always append "exit" in frr-reload.py
2023-07-17tools: Add what FRR thinks as the fib routes for support_bundleDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-12Merge pull request #13891 from ↵Donald Sharp
opensourcerouting/fix/ignore_errors_from_frr-reload.py tools: Ignore errors for frr reload stuff
2023-07-09tools: fix ospf area stub summary in frr-reloadChirag Shah
OSPFv2 no area x stub no-summary only resets 'no-summary' config. From frr-reload if the config line 'area x stub no-summary' is removed then it needs to remove completely. Before this change it took two frr-roload to remove the config which is inconsistent behavior. Fix is to frr-reload to add extra line to delete 'no area x stub'. Ticket:#3514775 Testing Done: Running config: router ospf ospf router-id 6.6.6.6 area 0.0.0.1 stub no-summary area 0.0.0.2 stub exit ! router ospf vrf sym_1 area 0.0.1.1 range 24.1.1.0/24 area 0.0.1.2 stub no-summary exit changed frr.conf: router ospf ospf router-id 6.6.6.6 area 0.0.0.2 stub exit ! router ospf vrf sym_1 area 0.0.1.1 range 24.1.1.0/24 exit Lines To Delete =============== router ospf no area 0.0.0.1 stub <<<< newly added router ospf vrf sym_1 no area 0.0.1.2 stub <<<< newly added router ospf no area 0.0.0.1 stub no-summary router ospf vrf sym_1 no area 0.0.1.2 stub no-summary After fix new running-config post reload: i router ospf ospf router-id 6.6.6.6 area 0.0.0.2 stub exit ! router ospf vrf sym_1 area 0.0.1.1 range 24.1.1.0/24 exit Before fix running-config post 1st reload: router ospf ospf router-id 6.6.6.6 area 0.0.0.1 stub area 0.0.0.2 stub exit ! router ospf vrf sym_1 area 0.0.1.1 range 24.1.1.0/24 area 0.0.1.2 stub exit Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-07-04tools: always append "exit" in frr-reload.pyIgor Ryzhov
When reloading the following config: ``` router ospf6 area 0 range 2001:db8::/32 advertise exit ! interface eth0 ipv6 ospf6 area 0 exit ``` frr-reload.py doesn't execute "exit" commands. Because of that, it tries to execute "interface eth0" inside the "router ospf6" context and fails. To always execute all commands from the correct context, frr-reload.py should properly exit from every entered node. Fixes #10132. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-06-30tools: Ignore errors for frr reload stuffDonatas Abraitis
When we pass an unknown/wrong command and do `systemctl reload frr`, all processes are killed, and not started up. Like doing with frr-reload.py, all good: ``` $ /usr/lib/frr/frr-reload.py --reload /etc/frr/frr.conf vtysh failed to process new configuration: vtysh (mark file) exited with status 2: b'line 20: % Unknown command: neighbor 192.168.10.123 bfd 300 300\n\n' ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-06-29tools: fix pim interface config deletionChirag Shah
When no ip pim is performed subsequent pim related configs under the interface also implicitly deleted. When doing this via frr-reload requires to remove any explicit no ip pim <blah> lines so delete list. Testing Done: running-config: interface lo ip pim ip pim use-source 6.0.0.1 exit frr.conf: remove two pim config lines. interface lo exit Before fix: 2023-06-29 23:44:26,062 INFO: Failed to execute interface lo no ip pim use-source 6.0.0.1 2023-06-29 23:44:26,142 INFO: Failed to execute interface lo no ip pim use-source 2023-06-29 23:44:26,221 INFO: Executed "interface lo no ip pim" After fix: Only no ip pim executed and rest of the other lines removed from delete list. 2023-06-30 01:07:32,618 INFO: Executed "interface lo no ip pim" Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-06-20tools: checkpatch: FRR modifications to linux checkpatch.plChristian Hopps
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-20tools: unmodified import of scripts/checkpatch.pl from linuxChristian Hopps
0ee3e7b8893e * checkpatch: get default codespell dictionary path from package location Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-05tools: fix list value remove in frr-reloadChirag Shah
There might be a time element(s) from temporary list are removed more than once which leads to valueError in certain python3 version. commit-id 1543f58b5 did not handle valueError properly. This caused regression where prefix-list config leads to delete followed by add. The new fix should just pass the exception as value removal from list_to_add or list_to_del is best effort. This allows prefix-list config has no change then removes the lines from lines_to_del and lines_to_add properly. Ticket:#3490252 Testing: Configure prefix-list in frr.conf and perform multiple frr-reload. After first reload operatoin subsequent ones should not result in delete followed by add of the prefix-list but rather no-op operation. (Pdb) lines_to_add [(('ip prefix-list FOO permit 10.2.1.0/24',), None)] (Pdb) lines_to_del [(('ip prefix-list FOO seq 5 permit 10.2.1.0/24',), None), (('ip prefix-list FOO seq 10 permit 10.2.1.0/24',), None)] (Pdb) lines_to_del_to_del [(('ip prefix-list FOO seq 5 permit 10.2.1.0/24',), None), (('ip prefix-list FOO seq 10 permit 10.2.1.0/24',), None)] (Pdb) lines_to_add_to_del [(('ip prefix-list FOO permit 10.2.1.0/24',), None), (('ip prefix-list FOO permit 10.2.1.0/24',), None)] (Pdb) c > /usr/lib/frr/frr-reload.py(1562)ignore_delete_re_add_lines() -> return (lines_to_add, lines_to_del) (Pdb) lines_to_add [] (Pdb) lines_to_del [] Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-04-18style: add format checker config that matches FRR style standardsChristian Hopps
Also move .dir-locals.el to a sample file. This file should not be in the repository as it affects the user's ability to modify it. Signed-off-by: Christian Hopps <chopps@labn.net>
2023-04-15tools: Make check flag really work for reloadanlan_cs
The check flag of `found_pg_cmd` is already there, but not used. So, make it really work for reload. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-04-15tools: fix missing remote-as configuration when reloadanlan_cs
From commit `411d1a2`, `bgp_delete_nbr_remote_as_line()` is added to remove some specific bgp neighbors. But, when reloading the following configuration, it will wrongly remove some good ones: `neighbor 66.66.66.6 remote-as internal`: ``` router bgp 66 bgp router-id 172.16.204.6 neighbor ANLAN peer-group neighbor ANLAN remote-as internal neighbor 66.66.66.6 remote-as internal <- LOST neighbor 66.66.66.60 peer-group ANLAN ``` The reason is that "66.66.66.6" is included in "66.66.66.60" literally, then it is mistakenly thought to be a match. Just fix it with excat match. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-03-26Merge pull request #13101 from opensourcerouting/fix/bindir_for_frr-reloadDonald Sharp
tools: Set correct directory of vtysh for frr-reload.py
2023-03-24tools: Set correct directory of vtysh for frr-reload.pyDonatas Abraitis
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*: Convert thread_execute to event_executeDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_add_XXX functions to event_add_XXXDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-21mgmtd: Bringup MGMTD daemon and datastore module supportChristian Hopps
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-14tools: frr-reload fix list value not presentChirag Shah
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-02-10tools: allow // SPDX... in checkpatch.plDavid Lamparter
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-09*: auto-convert to SPDX License IDsDavid Lamparter
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*: manual SPDX License ID conversionsDavid Lamparter
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*: sort out & explain licenses used in FRRDavid Lamparter
New "introduction" note in `COPYING`, and all the licenses moved into `doc/licenses/`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-08tools: Fix missing pbrd in rsyslog.d 45-frr.conf fileDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-07Merge pull request #12707 from donaldsharp/missed_enumsDonatas Abraitis
Missed enums
2023-01-31tools: add GotoXref vim scriptDavid Lamparter
Let's make these unique IDs actually a bit useful. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-31tools: Add missing enums to switch statementDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-15tools: Add missing daemonsYuxiang Zhu
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>
2022-12-22tools: Ignore agentx command for frr-reload.pyDonatas Abraitis
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-06Revert "tools: stop zebra daemon last"Mark Stapp
This reverts commit 2000ac4075bbe1a9557ee30286309d3ade72b3a7. 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-11-23tools: Enable start of FRR for non-root userMichal Ruprich
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-15Merge pull request #11058 from opensourcerouting/fix/redhat_debian_logrotateJafar Al-Gharaibeh
packaging: Reuse frr.logrotate for Debian and Redhat builds
2022-11-11tools: remove backslash from declare check regexMarius Tomaschewski
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-08tools: Add pim6d support bundle commandsSai Gomathi N
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-08packaging: Reuse frr.logrotate for Debian and Redhat buildsDonatas Abraitis
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-03tools: Honor sysdir, confdir, bindir for frr-reload.py from "frr" wrapperDonatas Abraitis
Without this, those variables are not passed to frr-reload.py and uses default values. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-14tools: Do not try creating /proc with install commandDonatas Abraitis
Leftovers. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>