summaryrefslogtreecommitdiff
path: root/mgmtd/mgmt_ds.h
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2023-03-08 17:26:38 -0500
committerChristian Hopps <chopps@labn.net>2023-03-21 22:08:32 -0400
commitef43a6329b063f0fa4acc0c3d9ae3e3875b65da6 (patch)
tree6cb59bf2bd086f0099394da337fa638dbf6b3613 /mgmtd/mgmt_ds.h
parent1c84efe4fa8585df58a9b53459f94c47934f0786 (diff)
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>
Diffstat (limited to 'mgmtd/mgmt_ds.h')
-rw-r--r--mgmtd/mgmt_ds.h23
1 files changed, 6 insertions, 17 deletions
diff --git a/mgmtd/mgmt_ds.h b/mgmtd/mgmt_ds.h
index 61fb7dd4fd..7a6737cd2f 100644
--- a/mgmtd/mgmt_ds.h
+++ b/mgmtd/mgmt_ds.h
@@ -9,6 +9,7 @@
#ifndef _FRR_MGMTD_DS_H_
#define _FRR_MGMTD_DS_H_
+#include "mgmt_fe_client.h"
#include "northbound.h"
#include "mgmtd/mgmt_defines.h"
@@ -40,18 +41,6 @@ extern struct nb_config *running_config;
struct mgmt_ds_ctx;
-/*
- * Datastore-Id: For now defined here. Eventually will be
- * defined as part of MGMTD Front-End interface.
- */
-enum mgmt_datastore_id {
- MGMTD_DS_NONE = 0,
- MGMTD_DS_RUNNING,
- MGMTD_DS_CANDIDATE,
- MGMTD_DS_OPERATIONAL,
- MGMTD_DS_MAX_ID
-};
-
typedef void (*mgmt_ds_node_iter_fn)(uint64_t ds_hndl, char *xpath,
struct lyd_node *node,
struct nb_node *nb_node, void *ctx);
@@ -71,7 +60,7 @@ extern const char *mgmt_ds_names[MGMTD_DS_MAX_ID + 1];
* Returns:
* Datastore name.
*/
-static inline const char *mgmt_ds_id2name(enum mgmt_datastore_id id)
+static inline const char *mgmt_ds_id2name(Mgmtd__DatastoreId id)
{
if (id > MGMTD_DS_MAX_ID)
id = MGMTD_DS_MAX_ID;
@@ -87,9 +76,9 @@ static inline const char *mgmt_ds_id2name(enum mgmt_datastore_id id)
* Returns:
* Datastore ID.
*/
-static inline enum mgmt_datastore_id mgmt_ds_name2id(const char *name)
+static inline Mgmtd__DatastoreId mgmt_ds_name2id(const char *name)
{
- enum mgmt_datastore_id id;
+ Mgmtd__DatastoreId id;
FOREACH_MGMTD_DS_ID (id) {
if (!strncmp(mgmt_ds_names[id], name, MGMTD_DS_NAME_MAX_LEN))
@@ -104,7 +93,7 @@ static inline enum mgmt_datastore_id mgmt_ds_name2id(const char *name)
*
* similar to above funtion.
*/
-static inline enum mgmt_datastore_id mgmt_get_ds_id_by_name(const char *ds_name)
+static inline Mgmtd__DatastoreId mgmt_get_ds_id_by_name(const char *ds_name)
{
if (!strncmp(ds_name, "candidate", sizeof("candidate")))
return MGMTD_DS_CANDIDATE;
@@ -191,7 +180,7 @@ extern void mgmt_ds_destroy(void);
* Datastore context (Holds info about ID, lock, root node etc).
*/
extern struct mgmt_ds_ctx *mgmt_ds_get_ctx_by_id(struct mgmt_master *mm,
- enum mgmt_datastore_id ds_id);
+ Mgmtd__DatastoreId ds_id);
/*
* Check if a given datastore is config ds