Commit graph

20 commits

Author SHA1 Message Date
Mark Stapp 7e1ed59d74 mgmtd: clean up -Wshadow warnings
Clean up various variable-shadow warnings in mgmtd.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Igor Ryzhov 61e8d5e0b9 mgmtd: don't add implicit state data when reading config from file
When mgmt reads configuration from file, it shouldn't add implicit state
data to the candidate datastore. Configuration datastores like candidate
should never store state, otherwise they fail validation.

Fixes #15814

Signed-off-by: Igor Ryzhov <idryzhov@gmail.com>
2024-08-08 00:45:13 +03:00
Christian Hopps ef305e8993 mgmtd: convert MGMT_DS_DBG() to __dbg()
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-31 20:19:23 -05:00
Igor Ryzhov a962f2949f mgmt: delete candidate scratch buffer
The code doesn't work at all. It tries to use libyang operation
metadata in a regular (not diff) data tree, and regular data trees
don't provide this data. Also, for destroy operations, it searches
for nodes in the running config, which may not have the deleted nodes
if we're not using implicit commits.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-10-06 21:18:33 +03:00
Christian Hopps 459848ded7 mgmtd: fix memleak
Use northbound functions for replace and merge when possible, rather
than duplicating the code.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-19 00:13:28 -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 96f9e7853b lib: mgmtd: improvements in logging and commentary
- log names of datastores not numbers
- improve logging for mgmt_msg_read
- Rather than use a bool, instead store the pending const string name of
the command being run that has postponed the CLI. This adds some nice
information to the logging when enabled.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-13 04:11:29 -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 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 0030b5825e mgmtd: fix uninit warning and cleanup history error messages
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-18 08:42:42 -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
Christian Hopps 9b96394d05
Merge pull request #13149 from pushpasis/mgmt_cleanup_zlog
mgmtd, lib: Cleanup zlog_err()
2023-04-24 11:00:08 -04:00
Pushpasis Sarkar 048e1e7be8 mgmtd, lib: Cleanup zlog_err()
Cleanup all zlog_err() that were meant for debug only.

Signed-off-by: Pushpasis Sarkar <pushpasis@gmail.com>
2023-04-11 22:48:52 -07: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
rgirada 93d4e355d8 mgmtd: Fixing code coverity issues in mgmtd
Description:
	the following list of coverity issues seen in mgmtd code.
	1. CID 1536832:  Memory - corruptions  (OVERLAPPING_COPY)
	   /mgmtd/mgmt_history.c: 85 in mgmt_history_create_cmt_rec()
	2. CID 1536831:  Error handling issues  (NEGATIVE_RETURNS)
	   /mgmtd/mgmt_be_server.c: 123 in mgmt_be_server_start()
	3. CID 1536830:  Resource leaks  (RESOURCE_LEAK)
	   /mgmtd/mgmt_history.c: 146 in mgmt_history_read_cmt_record_index()
	4. CID 1536829:  Error handling issues  (NEGATIVE_RETURNS)
	   /mgmtd/mgmt_fe_server.c: 123 in mgmt_fe_server_start()
	5. CID 1536828:  Possible Control flow issues  (DEADCODE)
	   /mgmtd/mgmt_txn.c: 1859 in mgmt_txn_get_config()
	6. CID 1536827:  Null pointer dereferences  (NULL_RETURNS)
           /mgmtd/mgmt_ds.c: 526 in mgmt_ds_delete_data_nodes()

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2023-04-05 10:29:14 +00:00
Christian Hopps 803829e41e mgmtd: remove startup config feature for now
The startup config and how it interacts with explicit commits,
commit databases and implicit commits needs to be worked out
in design first. For now remove the offending code.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-03-31 15:21:20 -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 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