Commit Graph

34898 Commits

Author SHA1 Message Date
sri-mohan1
46a8c4e9be zebra: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-02-22 12:06:47 +05:30
Donald Sharp
e7f2e2c78c tests: bgp_evpn_mh timing issue fix
This test is failing locally for me 100% of the time
since zebra was converted to mgmtd usage.  The failed
command is:

torm11# show evpn mac vni 1000 mac 00:00:00:00:00:11 json
{
  "00:00:00:00:00:11":{
    "type":"auto",
    "uptime":"00:02:01",
    "localSequence":0,
    "remoteSequence":0,
    "detectionCount":0,
    "isDuplicate":false,
    "syncNeighCount":0,
    "neighbors":{
      "active":[
      ],
      "inactive":[
        "45.0.0.11"
      ]
    }
  }
}

The test is expecting an esi as a key in the output.  Re-arranging
the startup of the tor's before the hosts fixes the issue.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-21 18:12:00 -05:00
Louis Scalbert
44e6e3868d zebra: fix crash if macvlan link in another netns
A macvlan interface can have its underlying link-interface in another
namespace (aka. netns). However, by default, zebra does not know the
interface from the other namespaces. It results in a crash the pointer
to the link interface is NULL.

> 6  0x0000559d77a329d3 in zebra_vxlan_macvlan_up (ifp=0x559d798b8e00) at /root/frr/zebra/zebra_vxlan.c:4676
> 4676		link_zif = link_ifp->info;
> (gdb) list
> 4671		struct interface *link_ifp, *link_if;
> 4672
> 4673		zif = ifp->info;
> 4674		assert(zif);
> 4675		link_ifp = zif->link;
> 4676		link_zif = link_ifp->info;
> 4677		assert(link_zif);
> 4678
> (gdb) p zif->link
> $2 = (struct interface *) 0x0
> (gdb) p zif->link_ifindex
> $3 = 15

Fix the crash by returning when the macvlan link-interface is in another
namespace. No need to go further because any vxlan under the macvlan
interface would not be accessible by zebra.

Link: https://github.com/FRRouting/frr/issues/15370
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-21 15:44:58 +01:00
Christian Hopps
06be54630c tests: use more standard name for python3
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-02-21 08:05:31 -05:00
Christian Hopps
37588ece04
Merge pull request #15401 from idryzhov/fix-nb-crash
Fix order of NB callbacks (and a crash)
2024-02-21 00:16:47 -05:00
Igor Ryzhov
01f371a677 lib: fix order of northbound callbacks
When ordering the NB callbacks according to their priorities, if the
operation is "destroy" we should reverse the order, to destroy the
dependants before the dependencies.

This fixes the crash, that can be reproduced with the following steps:
```
frr# conf term file-lock
frr(config)# affinity-map map bit-position 10
frr(config)# interface test
frr(config-if)# link-params
frr(config-link-params)# affinity map
frr(config-link-params)# exit
frr(config-if)# exit
frr(config)# mgmt commit apply
frr(config)# no affinity-map map
frr(config)# interface test
frr(config-if)# link-params
frr(config-link-params)# no affinity map
frr(config-link-params)# exit
frr(config-if)# exit
frr(config)# mgmt commit apply
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-20 22:32:52 +02:00
Igor Ryzhov
323caf1d70 lib: add missing priority for affinity map callbacks
Other objects depend on affinity-maps being created before them by using
leafref with require-instance true. Set the priority to ensure that.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-20 22:27:29 +02:00
Donald Sharp
605009d729
Merge pull request #15393 from idryzhov/fix-base64
lib: fix base64 encoding
2024-02-20 10:20:28 -05:00
Russ White
8dbfc57ec6
Merge pull request #15377 from opensourcerouting/fix/bgpd_evpn_route_map
lib: Do not convert EVPN prefixes into IPv4/IPv6 if not needed
2024-02-20 10:17:46 -05:00
Russ White
5362d43456
Merge pull request #15367 from rampxxxx/ldp_sync_cleanup
ospfd: fix cli shown in running config when turning off ldp-sync
2024-02-20 10:15:39 -05:00
Russ White
c478ea709a
Merge pull request #15366 from cscarpitta/feature/srv6-fpm-pb-extension
fpm: Add support for SRv6 to FPM protobuf
2024-02-20 10:14:56 -05:00
Russ White
ab40199f00
Merge pull request #15351 from louis-6wind/fix-leak-vrf-interface
bgpd: update route leak after vrf interface changes
2024-02-20 10:14:20 -05:00
Donald Sharp
c38ef653f3 zebra: Remove deprecated items
Both zebra_evpn.c and zebra_vxlan.c have items that
were deprecated a year ago.  Let's remove them.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-20 07:21:08 -05:00
Donald Sharp
b02d946db1
Merge pull request #15394 from sri-mohan1/srib-24-babel
babeld: changes for code maintainability
2024-02-20 07:02:59 -05:00
sri-mohan1
c8287d97db babeld: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-02-20 00:25:27 +05:30
Igor Ryzhov
5332e447d9
Merge pull request #15381 from LabNConsulting/chopps/nb-notif
lib: mgmtd: add xpath arg to YANG notification message
2024-02-19 16:52:47 +02:00
Igor Ryzhov
77149fabaa lib: fix base64 encoding
Remove adding of line feeds when encondig. We're using these functions
only for encoding binary data for storing in YANG data tree.

According to RFC 7950, section 9.8.2:
```
9.8.2.  Lexical Representation

   Binary values are encoded with the base64 encoding scheme (see
   Section 4 in [RFC4648]).
```

According to mentioned RFC 4648, section 3.1:
```
   Implementations MUST NOT add line feeds to base-encoded data unless
   the specification referring to this document explicitly directs base
   encoders to add line feeds after a specific number of characters.
```

Therefore, line feeds must not be added to the encoded data.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-19 15:35:22 +02:00
Christian Hopps
29a0c1c6c3
Merge pull request #15389 from opensourcerouting/fix/add_mgmtd_pytest_marker
doc: Add `mgmtd` pytest marker into documentation
2024-02-19 06:36:15 -05:00
Louis Scalbert
21e542e2c6 doc: show isis optional algorithm id
Set optional algorithm ID in the show isis commands.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-19 10:13:51 +01:00
Philippe Guibert
f93b08f4a0 isisd: make algorithm id optional in show isis commands
The following two isis commands have now the algorithm id
optional:

> # show isis segment-routing node algorithm
> # show isis topology algorithm

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-19 10:10:54 +01:00
Philippe Guibert
4d63d8cd62 isisd: show isis route .. json adds the algorithm value
When walking over all the flex-algorithm routes, it is
difficult to know which route is associated to which
algorithm: add "algorithm" attribute to the json object.

Output example:

> ubuntu2004(config-router)# do show isis route algorithm  json
> [
>   {
>     "area":"1",
>     "algorithm":128,
>     "level-1":{
>      ]
>    },
>    "level-2":{
>      "area":"1"
>    },
>    "vrf_id":0
>  },
>  {
>    "area":"1",
>    "algorithm":129,
>    "level-1":{
>      "area":"1",

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-19 10:10:54 +01:00
Philippe Guibert
88e368b4dc isisd: make optional algorithm id in 'show isis route'
To avoid calling for each algorithm the 'show isis route'
command, the algorithm id is optional. The below command
will dump the routes for all the algorithms:

> show isis route algorithm

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-19 10:10:54 +01:00
Christian Hopps
4a93d171c2 lib: mgmtd: add xpath arg to notification message
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-02-18 18:53:37 -05:00
Carmine Scarpitta
154bce3d9c fpm: Add func to encode SRv6 SIDs in protobuf
Add a bunch of helper functions to support encoding of SRv6 SIDs in
protobuf.

Specifically,
* `fpm_srv6_sid_format_create`: encode SID format information into a
protobuf `SRv6SIDFormat` structure
* `fpm_srv6_local_sid_*_behavior_create` functions: encode an SRv6 SID
behavior and associated attributes into a protobuf
`Fpm__SRv6LocalSID__*` structure

This is a preliminary commit to support sending SRv6 Local SIDs and VPN
SIDs via protobuf.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-02-18 18:31:13 +01:00
Carmine Scarpitta
b1f1cb9c23 fpm: Add functions to encode nexthop in protobuf
Add two helper functions to encode/decode nexthops in protobuf.

Specifically,
* `fpm_nexthop_create`: encode a `struct nexthop` in a protobuf nexthop
structure
* `fpm_nexthop_get`: decode a nexthop protobuf structure into a `struct
nexthop`

This is a preliminary commit to support sending SRv6 Local SIDs and VPN
SIDs via protobuf.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-02-18 18:31:13 +01:00
Carmine Scarpitta
4ec8ef5098 fpm: Add SRv6 VPN SIDs to fpm.proto
Add two optional fields to the AddRoute protobuf message to support
SRv6 VPN use cases:
* `srv6_vpn_sid`: used to associate an SRv6 VPN SID to a route; if
present, the router will steer the traffic that matches the prefix by
encapsulating the payload in an outer IPv6 header where the destination
address is the SRv6 VPN SID provided
* `srv6_encap_source_address`: source Address of outer encapsulating
IPv6 header

This is a preliminary commit to support sending SRv6 Local SIDs and VPN
SIDs via protobuf.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-02-18 18:31:13 +01:00
Carmine Scarpitta
7052c94ba3 fpm: Add SRv6 Local SIDs to fpm.proto
Add several protobuf messages to support the installation and removal
of SRv6 Local SIDs via FPM protobuf.

This is a preliminary commit to support sending SRv6 Local SIDs and VPN
SIDs via protobuf.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-02-18 18:31:13 +01:00
Donatas Abraitis
311eac53e8
Merge pull request #15357 from dpward/master
github: Replace issue template with issue form
2024-02-18 14:43:21 +02:00
Donatas Abraitis
ce334222ae doc: Add mgmtd pytest marker into documentation
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-17 11:24:29 +02:00
Donatas Abraitis
c872610f7d
Merge pull request #15376 from sri-mohan1/srib-24-babel
babeld: changes for code maintainability
2024-02-16 22:29:06 +02:00
Donald Sharp
9aec0d5a18
Merge pull request #15378 from idryzhov/ospf-suppress-fa
tests: fix ospf_suppress_fa timing issue
2024-02-16 07:26:24 -05:00
Igor Ryzhov
cb570d87d0
Merge pull request #15382 from donaldsharp/more_sa_failures
More sa failures
2024-02-16 13:55:35 +02:00
Donald Sharp
863e6ddf11 bgpd: Fix value stored to group never being read
SA Reports:

bgpd/bgp_rpki.c:1085:24: warning: Value stored to 'group' during its initialization is never read [deadcode.DeadStores]
        struct rtr_mgr_group *group = get_connected_group(rpki_vrf);
                              ^~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-15 23:28:18 -05:00
Donald Sharp
0f7b5fcffb ospfd: Fix assignment with never being used
SA finds this:

error	14-Feb-2024 14:52:24	ospfd/ospf_te.c:3962:2: warning: Value stored to 'sub' is never read [deadcode.DeadStores]
error	14-Feb-2024 14:52:24	        sub = 0;
error	14-Feb-2024 14:52:24	        ^     ~
error	14-Feb-2024 14:52:24	1 warning generated.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-15 23:27:38 -05:00
Christian Hopps
1d4ea437e4 lib: always call new notification hooks too
- call the new notification hooks when backends call the old notification
posting API.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-02-15 13:03:25 -05:00
Igor Ryzhov
fa67c0b91c
Merge pull request #15371 from LabNConsulting/chopps/mgmtd-fixes
Fixes for the northbound/mgmtd
2024-02-15 20:02:23 +02:00
Igor Ryzhov
829443fd83 tests: fix ospf_suppress_fa timing issue
Set static router-id for OSPF, because otherwise it depends on timing of
router-id updates received from zebra and may differ between test runs.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-15 15:38:26 +02:00
Christian Hopps
dff28248c3 lib: actually create the tree for the conversion
Before this fix would always return empty results b/c there was no
libyang tree to print to output format.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-02-15 06:13:08 -05:00
Christian Hopps
b8e07049a8 lib: fix memleak on success
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-02-15 06:13:08 -05:00
Donatas Abraitis
049a2c0c0a tests: Check if multiple route-map match clauses works for EVPN prefixes
Test prefix-list matching and some other EVPN stuff.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-15 12:19:43 +02:00
Donatas Abraitis
439b739495 lib: Do not convert EVPN prefixes into IPv4/IPv6 if not needed
Convert only when this is really needed, e.g. `match ip address prefix-list ...`.

Otherwise, we can't have mixed match clauses, like:

```
match ip address prefix-list p1
match evpn route-type prefix
```

This won't work, because the prefix is already converted, and we can't extract
route type, vni, etc. from the original EVPN prefix.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-15 12:07:43 +02:00
David Ward
16308917a2 github: Replace issue template with issue form
Signed-off-by: David Ward <david.ward@gatech.edu>
2024-02-15 03:16:54 -05:00
Louis Scalbert
1262ee66ad tests: check route leak update after vrf creation and deletion
Ensure that a locally leaked route is updated after a VRF (dis)appears.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-14 16:39:51 +01:00
Louis Scalbert
94d12dc490 bgpd: update route leak when vrf appears
If the VRF is not yet created and a BGP instance is created for the
VRF, dependent leaked routes are inactive, which is normal. However,
when the VRF interface appears, they remains inactive.

Update route leak when a VRF interface appears. Note that routes to a
deleted VRF are already removed by zebra.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-14 16:39:51 +01:00
Louis Scalbert
5709e89f6c tests: check route leak after changing vrf state
Check that local route leaks are set to "inactive" when the VRF
interface is shutdown and, conversely, that they are set to "active"
when the VRF interface is unshut.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-14 16:39:51 +01:00
Louis Scalbert
b45c5cd959 bgpd: update route leak when vrf state changes
Locally leaked routes remain active after the nexthop VRF interface goes
down.

Update route leaking when the loopback or a VRF interface state change is
received from zebra.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-14 16:39:51 +01:00
Louis Scalbert
c102adde30 tests: use check_ping in bgp_vrf_route_leak_basic
Use check_ping in bgp_vrf_route_leak_basic

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-14 16:39:10 +01:00
Louis Scalbert
71e74df14e tests: add source_addr in check_ping
Allow specifying a source_addr in check_ping library function.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-14 16:38:58 +01:00
Louis Scalbert
8b5f6ac982 tests: fix duplicates in bgp_vrf_route_leak_basic
Test functions were duplicated by mistakes. They were identical.

Fixes: 8af61c8a34 ("topotests: test leak from the default vrf")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-14 16:21:35 +01:00
Donatas Abraitis
2fd5e51d4c
Merge pull request #15332 from donaldsharp/nhg_stuffs
Nhg stuffs
2024-02-14 16:14:19 +02:00