Commit Graph

35617 Commits

Author SHA1 Message Date
Igor Ryzhov
83a3b0f10f bgpd, yang: fix missing mandatory/default statements on some leafs
The code expects these leafs to always exist. If they are not set, the
daemon would crash. CLI always sets them, but we should properly mark
them as mandatory/default to prevent them from being missed when using
the API.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-26 01:03:27 +02:00
Christian Hopps
2aa6a67ec3
Merge pull request #15423 from idryzhov/fix-nb-choice
lib: fix processing of choices in northbound
2024-02-25 16:54:16 -05:00
Christian Hopps
e5acf6797c tests: add test for required choice/np-container callbacks
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-02-25 13:48:57 +02:00
Christian Hopps
a37f5f9153 tests: add test for northbound ordering fix
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-02-25 13:48:57 +02:00
Igor Ryzhov
0b905f7404 lib: fix nb callbacks for containers inside choice case
Containers inside a choice's case must be treated as presence containers
as they can be explicitly created and deleted. They must have `create`
and `destroy` callbacks, otherwise the internal data they represent may
never be deleted.

The issue can be reproduced with the following steps:
- create an access-list with destination-network params
  ```
  # access-list test seq 1 permit ip any 10.10.10.0 0.0.0.255
  ```
- delete the `destination-network` container
  ```
  # mgmt delete-config /frr-filter:lib/access-list[name='test'][type='ipv4']/entry[sequence='1']/destination-network
  # mgmt commit apply
  MGMTD: No changes found to be committed!
  ```

As the `destination-network` container is non-presence, and all its
leafs are mandatory, mgmtd doesn't see any changes to be commited and
simply updates its YANG data tree without passing any updates to backend
daemons.

This commit fixes the issue by requiring `create` and `destroy`
callbacks for containers inside choice's cases.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-24 01:39:18 +02:00
Igor Ryzhov
38b85e0c2b lib: fix order of northbound operations
When ordering operations, destroys must always come before other
operations, to correctly cover the change of a "case" in a "choice".

The problem can be reproduced with the following commands:
```
access-list test seq 1 permit 10.0.0.0/8
access-list test seq 1 permit host 10.0.0.1
access-list test seq 1 permit 10.0.0.0/8
```

Before this commit, the order of changes would be the following:
- `access-list test seq 1 permit 10.0.0.0/8`
  - `modify` for `ipv4-prefix`
- `access-list test seq 1 permit host 10.0.0.1`
  - `destroy` for `ipv4-prefix`
  - `modify` for `host`
- `access-list test seq 1 permit 10.0.0.0/8`
  - `modify` for `ipv4-prefix`
  - `destroy` for `host`

As `destroy` for `host` is called last, it rewrites the fields that were
filled by `modify` callback of `ipv4-prefix`. This commit fixes this
problem by always calling `destroy` callbacks first.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-24 01:39:18 +02:00
Christian Hopps
81db16976c
Merge pull request #15421 from idryzhov/fix-fe-client-notify
lib: fix processing of notifications on mgmt fe client
2024-02-23 16:29:25 -05:00
Igor Ryzhov
13359c5cc9 lib: fix processing of notifications on mgmt fe client
Notifications are sent by mgmtd for each session of a client, so they
should be processed once per each session.

Also, add session_id parameter to an async_notification callback as all
other callbacks have this parameter.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-23 18:53:46 +02:00
Donald Sharp
eae228c52d
Merge pull request #15405 from LabNConsulting/chopps/fix-fe-client
tests: use more standard name for python3
2024-02-23 09:47:46 -05:00
Donatas Abraitis
a32d76e8c6
Merge pull request #15410 from louis-6wind/optim-nhflags
bgpd: move mp_nexthop_prefer_global boolean attribute to nh_flags
2024-02-23 10:18:15 +02:00
Donatas Abraitis
3b8c98916a
Merge pull request #15406 from donaldsharp/evpn_mh_fix
tests: bgp_evpn_mh timing issue fix
2024-02-23 10:04:50 +02:00
Donatas Abraitis
30330e6c37
Merge pull request #15384 from louis-6wind/isis-show-all-algos
isisd: display all the algorithms at the same time
2024-02-23 09:51:13 +02:00
Donatas Abraitis
5833261e77
Merge pull request #15383 from donaldsharp/cpp_evpn_data
zebra: Remove deprecated items
2024-02-23 09:49:15 +02:00
Donald Sharp
d8916aace9
Merge pull request #15409 from sri-mohan1/srib-24-zebra-dpdk-dp
zebra: changes for code maintainability
2024-02-22 13:47:30 -05:00
Louis Scalbert
58c1206112 bgpd: move mp_nexthop_prefer_global boolean attribute to nh_flags
Move mp_nexthop_prefer_global boolean attribute to nh_flags. It does
not currently save memory because of the packing.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-22 18:20:34 +01:00
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
Igor Ryzhov
af8c6b5b56 zebra: implement zif-type oper state leaf
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-20 18:06:49 +02:00
Igor Ryzhov
7a7bb6bc78 zebra: add interface's bond to oper state
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-20 17:37:25 +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