summaryrefslogtreecommitdiffstats
path: root/mgmtd/mgmt_txn.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:31 +0000
commitacb594b1d825c6e12369cebb941968ec08c840ce (patch)
treed544788908e7353a4f117e2991f15f4236a0c963 /mgmtd/mgmt_txn.h
parentAdding upstream version 9.1. (diff)
downloadfrr-acb594b1d825c6e12369cebb941968ec08c840ce.tar.xz
frr-acb594b1d825c6e12369cebb941968ec08c840ce.zip
Adding upstream version 10.0.upstream/10.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mgmtd/mgmt_txn.h')
-rw-r--r--mgmtd/mgmt_txn.h82
1 files changed, 70 insertions, 12 deletions
diff --git a/mgmtd/mgmt_txn.h b/mgmtd/mgmt_txn.h
index 068f07a..b719832 100644
--- a/mgmtd/mgmt_txn.h
+++ b/mgmtd/mgmt_txn.h
@@ -9,23 +9,23 @@
#ifndef _FRR_MGMTD_TXN_H_
#define _FRR_MGMTD_TXN_H_
+#include "lib/mgmt_msg_native.h"
#include "mgmtd/mgmt_be_adapter.h"
#include "mgmtd/mgmt.h"
#include "mgmtd/mgmt_ds.h"
-#define MGMTD_TXN_PROC_DELAY_MSEC 5
#define MGMTD_TXN_PROC_DELAY_USEC 10
#define MGMTD_TXN_MAX_NUM_SETCFG_PROC 128
#define MGMTD_TXN_MAX_NUM_GETCFG_PROC 128
#define MGMTD_TXN_MAX_NUM_GETDATA_PROC 128
-#define MGMTD_TXN_SEND_CFGVALIDATE_DELAY_MSEC 100
-#define MGMTD_TXN_SEND_CFGAPPLY_DELAY_MSEC 100
-#define MGMTD_TXN_CFG_COMMIT_MAX_DELAY_MSEC 30000 /* 30 seconds */
+#define MGMTD_TXN_CFG_COMMIT_MAX_DELAY_SEC 600
+#define MGMTD_TXN_GET_TREE_MAX_DELAY_SEC 600
-#define MGMTD_TXN_CLEANUP_DELAY_MSEC 100
#define MGMTD_TXN_CLEANUP_DELAY_USEC 10
+#define MGMTD_TXN_ID_NONE 0
+
/*
* The following definition enables local validation of config
* on the MGMTD process by loading client-defined NB callbacks
@@ -71,12 +71,18 @@ extern int mgmt_txn_init(struct mgmt_master *cm, struct event_loop *tm);
extern void mgmt_txn_destroy(void);
/*
- * Check if transaction is in progress.
+ * Check if configuration transaction is in progress.
*
* Returns:
- * session ID if in-progress, MGMTD_SESSION_ID_NONE otherwise.
+ * true if in-progress, false otherwise.
*/
-extern uint64_t mgmt_config_txn_in_progress(void);
+extern bool mgmt_config_txn_in_progress(void);
+
+/**
+ * Get the session ID associated with the given ``txn-id``.
+ *
+ */
+extern uint64_t mgmt_txn_get_session_id(uint64_t txn_id);
/*
* Create transaction.
@@ -188,6 +194,31 @@ extern int mgmt_txn_send_get_req(uint64_t txn_id, uint64_t req_id,
Mgmtd__YangGetDataReq **data_req,
size_t num_reqs);
+
+/**
+ * Send get-tree to the backend `clients`.
+ *
+ * Args:
+ * txn_id: Transaction identifier.
+ * req_id: FE client request identifier.
+ * clients: Bitmask of clients to send get-tree to.
+ * ds_id: datastore ID.
+ * result_type: LYD_FORMAT result format.
+ * flags: option flags for the request.
+ * wd_options: LYD_PRINT_WD_* flags for the result.
+ * simple_xpath: true if xpath is simple (only key predicates).
+ * xpath: The xpath to get the tree from.
+ *
+ * Return:
+ * 0 on success.
+ */
+extern int mgmt_txn_send_get_tree_oper(uint64_t txn_id, uint64_t req_id,
+ uint64_t clients,
+ Mgmtd__DatastoreId ds_id,
+ LYD_FORMAT result_type, uint8_t flags,
+ uint32_t wd_options, bool simple_xpath,
+ const char *xpath);
+
/*
* Notifiy backend adapter on connection.
*/
@@ -206,8 +237,8 @@ mgmt_txn_notify_be_txn_reply(uint64_t txn_id, bool create, bool success,
* Reply to backend adapater with config data create request.
*/
extern int
-mgmt_txn_notify_be_cfgdata_reply(uint64_t txn_id, uint64_t batch_id,
- bool success, char *error_if_any,
+mgmt_txn_notify_be_cfgdata_reply(uint64_t txn_id, bool success,
+ char *error_if_any,
struct mgmt_be_client_adapter *adapter);
/*
@@ -223,10 +254,37 @@ extern int mgmt_txn_notify_be_cfg_validate_reply(
*/
extern int
mgmt_txn_notify_be_cfg_apply_reply(uint64_t txn_id, bool success,
- uint64_t batch_ids[],
- size_t num_batch_ids, char *error_if_any,
+ char *error_if_any,
struct mgmt_be_client_adapter *adapter);
+
+/**
+ * Process a reply from a backend client to our get-tree request
+ *
+ * Args:
+ * adapter: The adapter that received the result.
+ * txn_id: The transaction for this get-tree request.
+ * req_id: The request ID for this transaction.
+ * error: the integer error value (negative)
+ * errstr: the string description of the error.
+ */
+int mgmt_txn_notify_error(struct mgmt_be_client_adapter *adapter,
+ uint64_t txn_id, uint64_t req_id, int error,
+ const char *errstr);
+
+/**
+ * Process a reply from a backend client to our get-tree request
+ *
+ * Args:
+ * adapter: The adapter that received the result.
+ * data_msg: The message from the backend.
+ * msg_len: Total length of the message.
+ */
+
+extern int mgmt_txn_notify_tree_data_reply(struct mgmt_be_client_adapter *adapter,
+ struct mgmt_msg_tree_data *data_msg,
+ size_t msg_len);
+
/*
* Dump transaction status to vty.
*/