Commit Graph

484 Commits

Author SHA1 Message Date
Donatas Abraitis
293b8b9529
Merge pull request #8214 from chiragshah6/mdev
tools: frr-reload refine error handling
2021-03-16 09:28:03 +02:00
Jafar Al-Gharaibeh
fe67f1f929 tools: add explicit licence phrase
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2021-03-10 11:31:25 -06:00
Joe Maimon
f725df0fae tools: example bash script client for the nhrpd event sock
Signed-off-by: Joe Maimon <jmaimon@jmaimon.com>
2021-03-10 11:31:25 -06:00
Chirag Shah
641b032e23 tools: frr-reload capture vtysh msg upon failure
Log vtysh message for a failed command.

Ticket:2556706
Reviewed By:
Testing Done:

frr reload fails to delete default bgp instance in presence of bgp vrf
instance(s), it captures vtysh message and logs in frr-reload.log

logs backend
2021-03-05 05:16:45,623  INFO: Failed to execute no router bgp 5544
2021-03-05 05:16:45,735  INFO: Failed to execute no router bgp
2021-03-05 05:16:45,846  INFO: Failed to execute no router
2021-03-05 05:16:45,846 ERROR: "no router" we failed to remove this
command
2021-03-05 05:16:45,847 ERROR: % Cannot delete default BGP instance.
Dependent VRF instances exist

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-03-08 12:02:08 -08:00
Chirag Shah
f26070fc07 tools: Mark reload failure when no form cli fails
if no form of the cli fails to execute, mark frr-reload
as failure so return code can be nonzero.
The similar approach is done for non no-form (add case) of the cli.

Ticket:CM-33345
Reviewed By:CCR-11287
Testing Done:

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-03-08 11:58:29 -08:00
Donatas Abraitis
82451d0cc7
Merge pull request #7942 from donaldsharp/rpki_reload_fix
frr-reload: rpki context exiting uses exit and not end
2021-02-18 09:34:27 +02:00
Mark Stapp
70b99f2fff tests: make generate support bundle python3 only
Make the generate-support-bundle script and interactions more
python3-friendly, and use python3 explicitly.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-02-15 08:13:06 -05:00
Runar Borge
7cfb307943 frr-reload: rpki context exiting uses exit and not end
Issue:
The rpki subcontext uses exit instead of end to exit.
This makes issues with frr-reload in the way that frr-reload never exits
rpki context until it reaches the next end statement. this also happens when
parsing the configuration from vtysh.

Fixes: #7887
Signed-off-by: Runar Borge <runar@borge.nu>
2021-02-04 17:26:12 -05:00
David Lamparter
acbf5146a9 tools/checkpatch: downgrade string concat warning
This is the best I can make the asm blocks in lib/xref.h look, so just
mute the warning.  (It shouldn't come in relevant for other code.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-01 17:33:03 +01:00
Donald Sharp
6df6d7bdf1
Merge pull request #7368 from eololab/add-pidfile-in-frr.service
tools: add PIDFile option in frr.service
2021-01-26 13:29:26 -05:00
Rafael Zalamena
c42dfbb505 tools: fix frr-reload BFD profile support
Fix the handling of multiple BFD profiles by adding the appropriated
code to push/pop contexts inside BFD configuration node.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-01-20 11:42:59 -03:00
Don Slice
7ac6afbd36 tools: ignore missing seq nums in prefix and access lists in frr-reload.py
If frr.conf contains a prefix-list or access-list without a seq number,
frr-reload needs to be aware that it should not delete/add if the running
config contains a seq number.

Ticket: CM-32623
Signed-off-by: Don Slice <dslice@nvidia.com>
2021-01-13 05:04:07 -08:00
Don Slice
d82c5d61e6 tools: apply black formatting changes to frr-reload.py
Since new workflow instructions state to run black against
python change and it found formatting changes required that
were not part of my change set, committing those changes
separately.

Signed-off-by: Don Slice <dslice@nvidia.com>
2021-01-13 05:04:07 -08:00
Emanuele Di Pascale
0e11b1e2ba tools: fix pce-config removal
make sure that the order in which the pcep-related commands are
removed by frr-reload.py is the correct one, i.e., pce followed
by pce-config followed by pcc.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2021-01-09 15:50:17 +01:00
Emanuele Di Pascale
2f1406fc86 pathd, tools: fix peer preference config
on one hand, the default value for a peer preference was always being
displayed, and on the other there was some code in frr-reload.py which
was attempting to add a default value to match this behavior, and which
was incorrectly overriding a specified preference. Fix this by removing
this code and making pathd behave like other daemons in this respect,
i.e. not displaying the default value.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2021-01-09 15:50:17 +01:00
Emanuele Di Pascale
ee96c52a28 tools: add bfdd to frr-reload.py daemons list
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2021-01-09 15:50:17 +01:00
Donald Sharp
39bda68b1e tools: Cleanup some zebra section of the support bundle
a) Add some useful commands
b) Remove `show error all` this just dumps the error codes.  If
we know the version we don't need this.  Additionally this is
rather large.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-08 20:54:43 -05:00
Donald Sharp
5e67b0f345 tools: Cleanup bgp commands in the support bundle
Add some missing commands ( I am sure that there are more useful ones to )
Cleanup to use the modern non-deprecated syntax in case anyone runs across
this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-08 20:54:43 -05:00
Mark Stapp
700ff41ed3
Merge pull request #7472 from opensourcerouting/fpm-fixes
fpm: frr-reload, IPv6 and an improvement
2020-12-22 11:37:58 -05:00
Sebastien Merle
efba0985fc pathd: Add optional support for PCEP to pathd
This new dynamic module makes pathd behave as a PCC for dynamic candidate path
using the external library pcpelib https://github.com/volta-networks/pceplib .

The candidate paths defined as dynamic will trigger computation requests to the
configured PCE, and the PCE response will be used to update the policy.

It supports multiple PCE. The one with smaller precedence will be elected
as the master PCE, and only if the connection repeatedly fails, the PCC will
switch to another PCE.

Example of configuration:

segment-routing
 traffic-eng
  pcep
   pce-config CONF
    source-address ip 10.10.10.10
    sr-draft07
   !
   pce PCE1
    config CONF
    address ip 1.1.1.1
   !
   pce PCE2
    config CONF
    address ip 2.2.2.2
   !
   pcc
    peer PCE1 precedence 10
    peer PCE2 precedence 20
   !
  !
 !
!

Co-authored-by: Brady Johnson <brady@voltanet.io>
Co-authored-by: Emanuele Di Pascale <emanuele@voltanet.io>
Co-authored-by: GalaxyGorilla <sascha@netdef.org>
Co-authored-by: Javier Garcia <javier.garcia@voltanet.io>
Co-authored-by: Renato Westphal <renato@opensourcerouting.org>
Co-authored-by: Sebastien Merle <sebastien@netdef.org>
Signed-off-by: Sebastien Merle <sebastien@netdef.org>
2020-12-18 16:47:52 +01:00
Sebastien Merle
4d7b695d3a pathd: New SR-TE policy management daemon
This new daemon manages Segment-Routing Traffic-Engineering
(SR-TE) Policies and installs them into zebra. It provides
the usual yang support and vtysh commands to define or change
SR-TE Policies.

In a nutshell SR-TE Policies provide the possibility to steer
traffic through a (possibly dynamic) list of Segment Routing
segments to the endpoint of the policy. This list of segments
is part of a Candidate Path which again belongs to the SR-TE
Policy. SR-TE Policies are uniquely identified by their color
and endpoint. The color can be used to e.g. match BGP
communities on incoming traffic.

There can be multiple Candidate Paths for a single
policy, the active Candidate Path is chosen according to
certain conditions of which the most important is its
preference. Candidate Paths can be explicit (fixed list of
segments) or dynamic (list of segment comes from e.g. PCEP, see
below).

Configuration example:

segment-routing
 traffic-eng
  segment-list SL
   index 10 mpls label 1111
   index 20 mpls label 2222
  !
  policy color 4 endpoint 10.10.10.4
   name POL4
   binding-sid 104
   candidate-path preference 100 name exp explicit segment-list SL
   candidate-path preference 200 name dyn dynamic
  !
 !
!

There is an important connection between dynamic Candidate
Paths and the overall topic of Path Computation. Later on for
pathd a dynamic module will be introduced that is capable
of communicating via the PCEP protocol with a PCE (Path
Computation Element) which again is capable of calculating
paths according to its local TED (Traffic Engineering Database).
This dynamic module will be able to inject the mentioned
dynamic Candidate Paths into pathd based on calculated paths
from a PCE.

https://tools.ietf.org/html/draft-ietf-spring-segment-routing-policy-06

Co-authored-by: Sebastien Merle <sebastien@netdef.org>
Co-authored-by: Renato Westphal <renato@opensourcerouting.org>
Co-authored-by: GalaxyGorilla <sascha@netdef.org>
Co-authored-by: Emanuele Di Pascale <emanuele@voltanet.io>
Signed-off-by: Sebastien Merle <sebastien@netdef.org>
2020-12-18 16:34:02 +01:00
Russ White
bd32345be3
Merge pull request #7582 from AnuradhaKaruppiah/frr-reload-cleanup
frr reload fixes for mac and ip normalization
2020-12-07 16:19:04 -05:00
Rafael Zalamena
2a437850fd tools: make frr-reload handle fpm commands
Instruct `frr-reload.py` to not use `fpm` commands as configuration
node.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-12-03 07:30:23 -03:00
Javier Garcia
d3a3e6253b tools: Fix run folder permissions
In the case of some linux distros the /var/run dir is mounted
with tmpfs so in every reboot it's removed.
Then the frrcommon.sh will recreate it without 'x' perm
So no pid file cannot be created in /var/run/frr

Signed-off-by: Javier Garcia <rampxxxx@gmail.com>
2020-12-01 12:37:51 +01:00
Anuradha Karuppiah
8a63e80c6c frr-reload: ignore-case in the es-id and es-sys-mac config comparisons
MAC address can be configured as lower/upper hex characters but is
always rendered as lower case in "show run". Avoid incorrect "change
detection" by ignoring case.

Ticket: CM-32235

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2020-11-21 18:03:06 -08:00
Anuradha Karuppiah
ed37777f03 frr-reload: fixup ipv6 address normalization
The condition to normalize ipv6 addresses was accidentally broken via -
[
e238920df0 tools: Fix reload with 'ipv6 address...' in interface
]

The condition was supposed to be skipped only if "ipv6 add" was present
in the line.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-11-21 18:02:58 -08:00
Quentin Young
439be082d3 Revert "debian: Adjust tarsource.sh to use native debian/changelog"
This reverts commit 4ffb9a4c9d.
2020-11-19 17:12:41 -05:00
Quentin Young
1b8a899da3 Revert "debian: Update tools/build-debian-package.sh to use git-buildpackage"
This reverts commit 63c0c8ed89.
2020-11-19 17:12:40 -05:00
Quentin Young
fb0b3592ca Revert "debian: Remove the changelog-auto automation in favor of dch"
This reverts commit cace1d9bf1.
2020-11-19 17:12:40 -05:00
Quentin Young
2013e82a89 Revert "debian: Remove now obsolete tarsource.sh script"
This reverts commit bc304e08ea.
2020-11-19 17:12:38 -05:00
Quentin Young
5aa63f6aa6 Revert "debian: Update the tools/build-debian-package.sh to be example build script"
This reverts commit c950a7f214.
2020-11-19 17:12:27 -05:00
Ondřej Surý
c950a7f214 debian: Update the tools/build-debian-package.sh to be example build script
Signed-off-by: Ondřej Surý <ondrej@sury.org>
2020-11-19 21:30:11 +01:00
Ondřej Surý
bc304e08ea debian: Remove now obsolete tarsource.sh script 2020-11-19 21:30:08 +01:00
Ondřej Surý
cace1d9bf1 debian: Remove the changelog-auto automation in favor of dch
Signed-off-by: Ondřej Surý <ondrej@sury.org>
2020-11-19 21:30:06 +01:00
Ondřej Surý
63c0c8ed89 debian: Update tools/build-debian-package.sh to use git-buildpackage
Signed-off-by: Ondřej Surý <ondrej@sury.org>
2020-11-19 21:30:02 +01:00
Ondřej Surý
4ffb9a4c9d debian: Adjust tarsource.sh to use native debian/changelog
Signed-off-by: Ondřej Surý <ondrej@sury.org>
2020-11-19 21:29:59 +01:00
Emanuele Di Pascale
8239db83b0 tools: fix frr-reload l2vpn delete
when deleting a whole l2vpn context in ldpd which also had pseudowires
in it, we were first deleting the l2vpn with a 'no l2vpn XXX' command,
and then adding it again by running 'l2vpn XXX\n no member pseudowire YYY'
which obviously was not needed. As a result the l2vpn would be reinstated.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2020-11-18 11:44:39 +01:00
David Lamparter
cd67bcf99a tools/gcc-frr-format: fix ICE in gcc-10
gcc-10 has a more strict internal assert for type checks so the plugin
currently causes an Internal Compiler Error.  Fix.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-11-03 00:53:29 +01:00
Emanuele Bovisio
566397ba65 tools: add PIDFile option in frr.service
when type is forking, it is recommended to also use the PIDFile= option,
so that systemd can reliably identify the main process of the service.

Signed-off-by: Emanuele Bovisio <emanuele.bovisio@eolo.it>
2020-10-30 16:33:20 +01:00
Donald Sharp
65a58145a1
Merge pull request #7370 from eololab/add-missing-daemon-in-watchfrr-conf-file
tools: add staticd line in daemon config file
2020-10-27 11:29:26 -04:00
Emanuele Bovisio
78d0a253ea tools: add comment on staticd in daemon config file
staticd is always started, so no need to specify it explicitly

Signed-off-by: Emanuele Bovisio <emanuele.bovisio@eolo.it>
2020-10-26 17:50:31 +01:00
Renato Westphal
8d869d378b lib: combine two YANG schema iteration functions into one
Combine yang_snodes_iterate_module() and yang_snodes_iterate_all()
into an unified yang_snodes_iterate() function, where the first
"module" parameter is optional. There's no point in having two
separate YANG schema iteration functions anymore now that they are
too similar.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-10-23 18:18:22 -03:00
Mark Stapp
70c583eb81 tools: add cocci patch for thread cancel api changes
Add Quentin's cocci patch to align code with the changes
to the event cancel api. Also added a README to explain what
this collection of cocci patches is for.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-23 12:16:52 -04:00
Emanuele Bovisio
371fe435ca tools: use function chownfrr
chownfrr applies correct owner and group

Signed-off-by: Emanuele Bovisio <emanuele.bovisio@eolo.it>
2020-10-13 09:46:42 +02:00
whitespace
701a01920e *: reformat python files
We are now using black.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-10-07 17:22:26 -04:00
Quentin Young
fdaee098f3 tools: fix vtysh failure error handling
Based on the current code, I think the intent was to gracefully handle
vtysh failures and print a useful error message. Barriers in the way of
that:

- Despite reading the results of subprocess.communicate(), there won't
  be anything there, because we aren't passing subprocess.PIPE as stdin
  and stderr when calling subprocess.Popen()
- Despite catching subprocess.TimeoutExpired, if we were to actually hit
  this case frr-reload.py would just crash because it's calling
  .communicate() on an unbound process variable, probably a copy-paste
  error
- Aside from that, building a kwargs dict to pass to a function that
  contains something if something else is not None and nothing if it is,
  is pointless when we could just pass the thing itself

Net result is that if vtysh fails to read an frr.conf due to syntax
errors, instead of crashing with a traceback, we actually handle the
error condition, log the problem and vtysh's output, and exit. Actually
we were printing the failed line just by chance because stderr wasn't
captured from the subprocess and I guess showed up as part of systemd's
error capturing or something, but the traceback did a good job of
obscuring that with useless noise.

Old:

frrinit.sh[32183]:  * Started watchfrr
frrinit.sh[32183]: line 20: % Unknown command: eee
frrinit.sh[32183]: Traceback (most recent call last):
frrinit.sh[32183]:   File "/usr/lib/frr/frr-reload.py", line 1316, in <module>
frrinit.sh[32183]:     newconf.load_from_file(args.filename)
frrinit.sh[32183]:   File "/usr/lib/frr/frr-reload.py", line 231, in load_from_file
frrinit.sh[32183]:     file_output = self.vtysh.mark_file(filename)
frrinit.sh[32183]:   File "/usr/lib/frr/frr-reload.py", line 146, in mark_file
frrinit.sh[32183]:     % (child.returncode, stderr))
frrinit.sh[32183]: __main__.VtyshException: vtysh (mark file) exited with status 2:
frrinit.sh[32183]: None

New:

frrinit.sh[30090]:  * Started watchfrr
frrinit.sh[30090]: vtysh failed to process new configuration: vtysh (mark file) exited with status 2:
frrinit.sh[30090]: line 20: % Unknown command: eee

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-09-17 15:53:42 -04:00
Alexander Chernavin
deb95b373f lib, tools: fix reloading of key sub-context in key chains
When you add a key chain in the RIP configuration file and reload the
configurations via the frr-reload.py script, the script will fail and
the key chain will not appear in the running configuration. The reason
is that frr-reload.py doesn't recognize key as a sub-context.

Before this change, keys were generated this way:

    key chain test
     key 2
      key-string 123
     key 3
      key-string 456

With this change, keys will be generated this way:

    key chain test
     key 2
      key-string 123
     exit
     key 3
      key-string 456
     exit

This will allow frr-reload.py to see the key sub-context and correctly
reload them.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
2020-08-24 09:54:55 -04:00
Rafael Zalamena
e99d81a374
Merge pull request #6738 from deastoe/frr-reload-log-level
tools: frr-reload: more detailed log level control
2020-08-20 13:42:34 +00:00
Sri Mohana Singamsetty
e11baa4c72
Merge pull request #6909 from donaldsharp/weird_dump_commands
tools: Remove zebra commands that have never existed
2020-08-12 20:42:34 -07:00
Donald Sharp
9057bd834a tools: Remove zebra commands that have never existed
The support bundle feature(tm) asks for some data
from zebra in the form of a command that has
never existed in FRR.  Looks like some
cruft snuck in remove.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-12 20:59:47 -04:00