Commit graph

74 commits

Author SHA1 Message Date
Christian Hopps d54ab3b112 mgmtd: testc: add listen for datastore notifications
Signed-off-by: Christian Hopps <chopps@labn.net>
2025-01-18 16:14:29 +00:00
Christian Hopps 5f2a927d7b lib: northbound/mgmtd: add backend model support
Signed-off-by: Christian Hopps <chopps@labn.net>
2025-01-14 18:48:59 +00:00
Christian Hopps 255026c2ce mgmtd: add notify selectors to filter datastore notifications
- Additionally push the selectors down to the backends

Signed-off-by: Christian Hopps <chopps@labn.net>
2025-01-13 23:40:52 -05:00
anlan_cs b5b8c9d3ec mgmtd: fix compile error
Compile error with `--disable-ripd`:
```
mgmtd/mgmt_be_adapter.c:86:5: error: "HAVE_RIPD" is not defined, evaluates to 0 [-Werror=undef]
   86 | #if HAVE_RIPD
      |     ^~~~~~~~~
```
I have searched the code, there is only three places need to be fixed.

Signed-off-by: anlan_cs <anlan_cs@126.com>
2024-12-21 19:32:47 +08:00
Donald Sharp 43508d3c67 mgmtd: Ensure map is NULL
Build is complaining:
build	27-Aug-2024 05:46:38	mgmtd/mgmt_be_adapter.c: In function ‘mgmt_register_client_xpath’:
build	27-Aug-2024 05:46:38	mgmtd/mgmt_be_adapter.c:274:27: warning: ‘maps’ may be used uninitialized [-Wmaybe-uninitialized]
build	27-Aug-2024 05:46:38	  274 |         map = darr_append(*maps);
build	27-Aug-2024 05:46:38	      |                           ^
build	27-Aug-2024 05:46:38	mgmtd/mgmt_be_adapter.c:250:36: note: ‘maps’ was declared here
build	27-Aug-2024 05:46:38	  250 |         struct mgmt_be_xpath_map **maps, *map;
build	27-Aug-2024 05:46:38	      |                                    ^~~~

Let's make the compiler happy, even though there is no problem.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-28 10:09:52 -04:00
Donald Sharp baa0a1df5b *: Fix spelling errors found
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-15 09:19:37 -04:00
Christian Hopps a1dd57b649 mgmtd: add empty notif xpath map for completeness
New back-end clients may need to add notification static allocations so
we should have it available for those users, rather than requiring the
new user delve into the mgmtd infra and modify it themselves.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-07 05:50:10 -04:00
Christian Hopps a8f20f504c mgmtd: add missing diagnostic show cmd output (notify maps)
- also add missing rpc client accounting bug in same diagnostic command.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-05-09 00:15:58 -04:00
Igor Ryzhov 6e0e84491b ripngd: convert RPC commands to mgmtd
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22 16:36:23 +03:00
Igor Ryzhov dbaf05ae3d ripd: convert RPC commands to mgmtd
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22 16:36:23 +03:00
Igor Ryzhov cb6c182852 mgmtd: add native RPC processing
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22 16:36:22 +03:00
Igor Ryzhov 5b219644ae mgmtd: add backend xpath map for RPC
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22 16:36:22 +03:00
Christian Hopps 4caffbda8e lib: add keychain northbound support
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-03-04 20:00:15 -05: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
Igor Ryzhov 745a2bd8b3 mgmtd: fix be_is_client_interested
Backend "subscribe" API allows daemons to dynamically register xpaths
they are interested in. Such xpaths are not stored in hardcoded
config/oper xpath arrays so this function fails to understand that a
backend daemon is interested in them. Fix by using dynamic xpath maps
instead which store both hardcoded and dynamic xpaths.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-12 20:55:34 +02:00
Igor Ryzhov d94f80fbc4 lib, mgmtd: fix processing of yang notifications
Current code assumes that notification is always sent in stripped JSON
format and therefore notification xpath starts at the third symbol of
notification data. Assuming JSON is more or less fine, because this
representation is internal to FRR, but the assumption about the xpath is
wrong, because it won't work for not top-level notifications. YANG
allows to define notification as a child for some data node deep into
the tree and in this case notification data contains not only the
notification node itself, but also all its parents.

To fix the issue, parse the notification data and get its xpath from its
schema node.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-10 01:00:24 +02:00
Christian Hopps fb8dc955b1 mgmtd: convert MGMT_BE_ADAPTER_DBG() to __dbg()
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-31 20:19:23 -05:00
Christian Hopps 1e884ba12f mgmtd: backend subscriptions to notifications
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-30 15:41:26 -05:00
Christian Hopps 25bb8b203c lib: mgmtd: add YANG notification support
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-30 04:57:10 -05:00
Igor Ryzhov 3900813298 zebra: convert to mgmtd
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28 23:28:40 +02:00
Donald Sharp 259e3d4dac
Merge pull request #15243 from opensourcerouting/autoconf-dir-mess
*: fix a pile of directory and/or state retention related issues
2024-01-28 14:30:28 -05:00
Igor Ryzhov 8785a3ad87 mgmtd: fix ripngd oper-data xpaths
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28 01:24:02 +02:00
David Lamparter 0d5a2497ca lib, mgmtd: fix wrong mgmtd socket paths
These paths were ignoring the `-N` namespacing option.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:01:19 +01:00
Christian Hopps e6eec072ab ripngd: convert ripngd to mgmtd
- a couple small fixes for ripd conversion as well.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-26 17:40:55 -05:00
Christian Hopps 83abe9c3cb ripd: ripd convert to mgmtd
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-26 12:34:46 -05:00
Igor Ryzhov d79ca934eb mgmtd: fix commit request overwrite
There are places, where we can receive an existing commit transaction.
If we don't check that the request already exists, it gets overwritten
and we start having problems with transaction refcounters. Forbid having
multiple configuration sessions simultaneously.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-26 12:34:46 -05:00
Igor Ryzhov 7e27469337 mgmtd: fix log type
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-26 12:34:46 -05:00
Christian Hopps fa7ff16e2b mgmtd: remove heavy duplication in mgmtd config read
Previously each container created all it's decendents before descending into
the children and repeating the process.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-19 15:27:24 +00:00
Christian Hopps a9dc7e9cc0
doc: mgmtd: update mgmtd conversion doc to be current.
Also change `be_client_xpaths` to `be_client_config_xpaths` referred in the doc
to make much clearer it's use (since there's a separate `be_client_oper_xpaths`.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-13 14:26:55 +00:00
Christian Hopps 39e0f331d2 lib: mgmtd: increase soft-max msg size to 64K
- remove unused mgmt client/server constants

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-30 16:03:45 +00:00
Christian Hopps ef91d34f01 zebra: add zebra to mgmtd oper-state
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-28 17:53:40 +00:00
Christian Hopps 4e0147a05e lib: add dedicated API functions for native msgs
- reorg native message header

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-28 17:53:40 +00:00
Christian Hopps 9cd8693363 mgmtd: step 6: remove old unfinished get-data code
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-28 10:41:54 +00:00
Christian Hopps 8df542b219 mgmtd: step 5: add get-tree txn functionality
Adds the guts of the get-tree functionality that is called by or calls
the FE and BE code for get-tree processing.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-28 10:41:54 +00:00
Christian Hopps 33b9c2ef00 mgmtd: step 3: BE adapter native message handling
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-28 10:41:54 +00:00
Christian Hopps 71ede2db9e mgmtd: enable conn debug when user enables mgmtd debugs
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-05 13:39:40 -05:00
Igor Ryzhov b3b5951ee7 mgmtd, lib: remove batch ids from all messages
Batch IDs are only used to verify that all messages were received and
processed by a backend. It's not necessary to do that as we use reliable
stream transport - messages can't be dropped or received out of order.

This commit also fixes possible race condition that can happen if
one backend process messages slower than other backends.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-11-12 03:20:54 +02:00
Christian Hopps a65cda16b2 mgmtd: simplify xpath registries
- move from client id indexed array of uints for register info
  per client to a u64 bitmask.
- add bit walking FOREACH macro

Walk the client IDs whose bits are set in a mask.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-11-06 17:44:58 -05:00
Igor Ryzhov d2977d57c8 mgmtd, lib: remove batch ids from cfg apply reply
The config is always applied fully, all batches are included. There's no
need to pass a list of applied batches as it always contains all of
them.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-10-17 15:06:13 +03:00
Christian Hopps 5447d16b73 mgmtd: convert map to darr use allowing dynamic registrations
- move from the static allocated and initialize xpath map to using the
new darr (dynamic array) code.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-27 18:00:56 -04:00
Christian Hopps 70fb3910db mgmtd: remove unused "placeholder" code.
We don't need un-run/un-tested placeholder code we may never need.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-27 18:00:56 -04:00
Christian Hopps 04b4ede097 mgmtd: simplify locking, removing read locks
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-18 16:17:46 -04:00
Christian Hopps 79d40972fd lib: mgmtd: fix/stdize debug message macros
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-12 02:32:29 -04:00
Christian Hopps c6b8e95703 mgmtd: rm unused/unneeded code add couple comments
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-05 15:29:05 -04:00
Christian Hopps 51941c1916 mgmtd: address review comments
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:20 -04:00
Christian Hopps 0327be91d1 mgmtd: cleanup BE xpath subscription and matching code
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:20 -04:00
Christian Hopps acd7aea00e mgmtd: simplify early config build removing unused code
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:09:51 -04:00
Christian Hopps 218625aa43 mgmtd: lib: cleanup error and debug messages
- always use IDs not a mix of IDs and pointers.
- always use PRIu64 not a mix of hex and decimal for IDs

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps 42f4bb2b1a mgmtd: lib: move INIT to after client registers
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps 9405278ef2 mgmtd: send reply to SUBSCR_REQ with success or not
since we don't actually handle xpath subscriptions, reply with fail
if they are requested.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00