Commit graph

46 commits

Author SHA1 Message Date
Igor Ryzhov 830972cab2 lib: common debug status output
Implement common code for debug status output and remove daemon-specific
code that is duplicated everywhere.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-08-27 09:53:02 -04:00
Igor Ryzhov 82e52e0f21 lib: common debug config output
Implement common code for debug config output and remove daemon-specific
code that is duplicated everywhere.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-08-27 09:53:02 -04:00
Igor Ryzhov a94f74bc2e lib: add native RPC processing to mgmt frontend client
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22 16:36:23 +03:00
Igor Ryzhov 1196d947d3 mgmtd: add support for native 'edit' operation
This operation basically implements support for RESTCONF operations. It
receives an xpath and a data tree in JSON/XML format, instead of a list
of (xpath, value) tuples as required by the current protobuf interface.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-26 17:00:15 +02:00
Donald Sharp 7e058c201a
Merge pull request #15469 from LabNConsulting/chopps/keychain-yang
add ietf-key-chain YANG module support
2024-03-08 08:15:02 -05: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
Vincent JARDIN 717b3350bb mgmtd: fix warning if ripngd disabled
./configure [...] --disable-ripngd

could lead to:

mgmtd/mgmt_vty.c:614:5: warning: "HAVE_RIPNGD" is not defined, evaluates to 0 [-Wundef]
  614 | #if HAVE_RIPNGD
      |     ^~~~~~~~~~~

Signed-off-by: Vincent Jardin <vjardin@free.fr>
2024-03-01 17:36:15 +01:00
Igor Ryzhov e13c590abe mgmtd: add ability to choose datastore to get data from
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-31 02:20:13 +02:00
Igor Ryzhov 4317c8ffa6 mgmtd: add support for with-defaults parameter to get-data
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-31 02:20:13 +02:00
Igor Ryzhov 3900813298 zebra: convert to mgmtd
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28 23:28:40 +02:00
Igor Ryzhov dc6ff4c0de lib: convert affinity-map to mgmtd
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28 23:28:40 +02: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
Christian Hopps 63ca751c11 lib: convert filters to mgmtd
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-26 12:34:23 -05:00
Christian Hopps dabc92de9e lib: convert route-map to mgmtd
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-26 12:34:23 -05:00
Igor Ryzhov 9859f308d2 lib, mgmtd: add ability to request the exact node in get-data request
RESTCONF expects to receive the exact node as a result, not the whole
data tree.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-15 10:27:33 +02:00
Igor Ryzhov e1cdb38ee6 lib, mgmtd: add ability to set content type in get-data request
Like in RESTCONF GET request and NETCONF get-data request, make it
possible to request state-only, config-only, or all data.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-15 10:27:33 +02:00
Igor Ryzhov 25d79af957 lib, mgmtd: add separate get-data request for the frontend
Currently it's the same as get-tree request for the backend, but it is
going to be expanded in the following commits.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-14 20:00:22 +02:00
Igor Ryzhov d726114790 mgmt, lib: implement REPLACE operation
Replace operation removes the current data node configuration and sets
the provided value. As current northbound code works only with one
xpath at a time, the operation only makes sense to clear the config of
a container without deleting it itself. However, the next step is to
allow passing JSON-encoded complex values to northbound operations which
will make replace operation much more useful.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-11 15:06:53 +02:00
Igor Ryzhov 3c2598a26f mgmt, lib: differentiate DELETE and REMOVE operations
Currently, there's a single operation type which doesn't return error
if the object doesn't exists. To be compatible with NETCONF/RESTCONF,
we should support differentiate between DELETE (fails when object
doesn't exist) and REMOVE (doesn't fail if the object doesn't exist).

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-11 15:06:53 +02:00
Igor Ryzhov 76e4eb84dd mgmtd, lib: implement CREATE_EXCL operation
Currently, there's no difference between CREATE and MODIFY operations.
To be compatible with NETCONF/RESTCONF, add new CREATE_EXCL operation
that throws an error if the configuration data already exists.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-11 15:06:53 +02: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 772f6c07c7 lib: step 1: mgmtd: add FE get-tree functionality
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 a22f5a5289 mgmtd: add node for writing configuration
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-11-21 13:13:05 +02:00
Donald Sharp c62c0181f0
Merge pull request #14768 from idryzhov/mgmtd-base-xpath
lib, mgmtd: respect base xpath in mgmtd
2023-11-13 09:19:07 -05:00
Igor Ryzhov b8a2efbf2f lib, mgmtd: respect base xpath in mgmtd
`nb_cli_apply_changes` can be called with base xpath which should be
prepended to xpaths of every change in a transaction. This base xpath is
respected by regular northbound CLI but not by mgmtd. This commit fixes
the problem.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-11-12 20:28:08 +02:00
Christian Hopps 59beac5013 lib: mgmtd: fix debug cli commands and memleaks
- Cannot have 2 cmd_node's with same .node number. Install the mgmtd
client library debug nodes (client frontend and client backend) using
new unique node numbers. Fixes memleaks.

- Fix "debug mgmt client backend" to generate correct config (and not
for frontend).

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-11-11 19:25:03 +01: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
Christian Hopps f560807158 mgmtd: clarify the startup dance in comments
Also retry the config read vs. aborting if we haven't got a FE
client connection yet.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-10-12 14:38:39 -04:00
Igor Ryzhov 7a8b1875c5 mgmtd: fix crash on "show mgmtd datastore-contents"
When the command is called without specifying the datastore, it crashes.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-09-27 13:22:01 +03:00
Christian Hopps dbb1bc6f35 mgmtd: consolidate getcfg and getdata msgs into "get"
eliminates tons of copy and paste code.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-27 18:00:56 -04:00
Christian Hopps 70ff6bb80b lib: mgmtd: simplify implicit commit code
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-12 07:22:30 -04:00
Christian Hopps 3744ad02d9 mgmtd: fix possible race btw read config and backend connection
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 11:52:19 -04:00
Christian Hopps a1d8c7a36e mgmtd: fix reading of config file[s]
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:09:44 -04:00
Christian Hopps 99564edc43 lib: mgmtd: add server-side connection code to mgmt_msg
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps cfa0facbf9 mgmtd: fully implement debug flags for mgmtd and clients
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-01 13:47:12 -04:00
rgirada 83b78f43f4 mgmtd: Fixing style warnings
Description:
	Fixing the style warnings in the mgmtd code.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2023-04-05 10:30:24 +00:00
Jafar Al-Gharaibeh 3b28a5ef6b
Merge pull request #13131 from LabNConsulting/chopps/no-startup-file
mgmtd: remove startup config feature for now
2023-04-04 08:42:04 -05:00
Christian Hopps 8033bf3976 mgmtd: lib: read transitioned daemons split config files in mgmtd
When daemons transition to mgmtd they should stop reading their split config
files, and let mgmtd do that, otherwise things can get out of sync.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-04-01 18:06:43 -04:00
Manoj Naragund 689e1d447a mgmtd: Fix for issue 13154.
The changes involve adding show debuggin command for MGMTd which resolves
command incomplete issue.

issue #13154

Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2023-03-31 03:47:17 -07:00
Christian Hopps d1e85e3600 mgmtd: Enroll Staticd as a backend client for MGMTD
This commmit introduces Staticd as a backend client for the MGMTd
framework. All the static commands will be diverted to the MGMT
daemon and will use the transactional model to make changes to the
internal state. Similar mechanism can be used by other daemons to use
the MGMT framework in the future.

This commit includes the following functionalities in the changeset:
1. Diverts all the staticd (config only) commands to MGMTd.
2. Enrolls staticd as a backend client to use the MGMT framework.
3. Modify the staticd NB config handlers so that they can be compiled
   into a library and loaded in the MGMTd process context.

Co-authored-by: Pushpasis Sarkar <pushpasis@gmail.com>
Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com>
Co-authored-by: Ujwal P <ujwalp@vmware.com>
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2023-03-21 22:09:07 -04:00
Yash Ranjan 74335ceb27 mgmtd: Add MGMT Transaction Framework
This commit introduces the MGMT Transaction framework that takes
management requests from one (or more) frontend client sessions,
translates them into transactions and drives them to completion
in co-oridination with one (or more) backend client daemons
involved in the request.

This commit includes the following functionalities in the changeset:
1. Introduces the actual Transaction module. Commands added related to
   transaction are:
   a. show mgmt transaction all
2. Adds support for commit rollback feature which stores upto the 10
   commit buffers. Each commit has a commit-id which can be used to
   rollback to the exact configuration state.
   Commands supported for this feature are:
   a. show mgmt commit-history
   b. mgmt rollback commit-id COMMIT_ID
3. Add hidden commands to enable record various performance metrics:
   a. mgmt performance-measurement
   b. mgmt reset-statistic

Co-authored-by: Pushpasis Sarkar <pushpasis@gmail.com>
Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com>
Co-authored-by: Ujwal P <ujwalp@vmware.com>
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2023-03-21 22:08:32 -04:00
Christian Hopps 7d65b7b7f4 mgmtd: Add MGMT Backend Interface Framework
This commit introduces the MGMT Backend Interface which can be used
by back-end management client daemons like BGPd, Staticd, Zebra to
connect with new FRR Management daemon (MGMTd) and utilize the new
FRR Management Framework to let any Frontend clients to retrieve any
operational data or manipulate any configuration data owned by the
individual Backend daemon component.

This commit includes the following functionalities in the changeset:
1. Add new Backend server for Backend daemons connect to.
2. Add a C-based Backend client library which can be used by daemons
   to communicate with MGMTd via the Backend interface.
3. Maintain a backend adapter for each connection from an appropriate
   Backend client to facilitate client requests and track one or more
   transactions initiated from Frontend client sessions that involves
   the backend client component.
4. Add the following commands to inspect various Backend client
   related information
	a. show mgmt backend-adapter all
	b. show mgmt backend-yang-xpath-registry
        c. show mgmt yang-xpath-subscription

Co-authored-by: Pushpasis Sarkar <pushpasis@gmail.com>
Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com>
Co-authored-by: Ujwal P <ujwalp@vmware.com>
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2023-03-21 22:08:32 -04:00
Christian Hopps ef43a6329b mgmtd: Add MGMT Frontend Interface Framework
This commit introduces the Frontend Interface which can be used
by front-end management clients like Netconf server, Restconf
Server and CLI to interact with new FRR Management daemon (MGMTd)
to access and sometimes modify FRR management data.

This commit includes the following functionalities in the changeset:
1. Add new Frontend server for clients connect to.
2. Add a C-based Frontend client library which can be used by Frontend
   clients to communicate with MGMTd via the Frontend interface.
3. Maintain a frontend adapter for each connection from an appropriate
   Frontend client to facilitate client requests and track one or more
   client sessions across it.
4. Define the protobuf message format for messages to be exchanged
   between MGMTd Frontend module and the Frontend client.
5. This changeset also introduces an instance of MGMT Frontend client
   embedded within the lib/vty module that can be leveraged by any FRR
   daemon to connect to MGMTd's Frontend interface. The same has been
   integrated with and initialized within the MGMTd daemon's process
   context to implement a bunch of 'set-config', 'commit-apply',
   'get-config' and 'get-data' commands via VTYSH

Co-authored-by: Pushpasis Sarkar <pushpasis@gmail.com>
Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com>
Co-authored-by: Ujwal P <ujwalp@vmware.com>
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2023-03-21 22:08:32 -04:00
Christian Hopps 1c84efe4fa mgmtd: Bringup MGMTD daemon and datastore module support
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-21 22:08:32 -04:00