summaryrefslogtreecommitdiff
path: root/mgmtd/mgmt.c
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2023-03-08 17:22:09 -0500
committerChristian Hopps <chopps@labn.net>2023-03-21 22:08:32 -0400
commit1c84efe4fa8585df58a9b53459f94c47934f0786 (patch)
tree21609ad9048500a6b23c38ce373506d5d6aa6ac3 /mgmtd/mgmt.c
parented851381b578fda5c313ea0cb6a2e9d3fb017cce (diff)
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>
Diffstat (limited to 'mgmtd/mgmt.c')
-rw-r--r--mgmtd/mgmt.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/mgmtd/mgmt.c b/mgmtd/mgmt.c
new file mode 100644
index 0000000000..1901bde620
--- /dev/null
+++ b/mgmtd/mgmt.c
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * FRR Management Daemon (MGMTD) program
+ *
+ * Copyright (C) 2021 Vmware, Inc.
+ * Pushpasis Sarkar
+ */
+
+#include <zebra.h>
+#include "mgmtd/mgmt.h"
+#include "mgmtd/mgmt_ds.h"
+#include "mgmtd/mgmt_memory.h"
+
+bool mgmt_debug_be;
+bool mgmt_debug_fe;
+bool mgmt_debug_ds;
+bool mgmt_debug_txn;
+
+/* MGMTD process wide configuration. */
+static struct mgmt_master mgmt_master;
+
+/* MGMTD process wide configuration pointer to export. */
+struct mgmt_master *mm;
+
+void mgmt_master_init(struct thread_master *master, const int buffer_size)
+{
+ memset(&mgmt_master, 0, sizeof(struct mgmt_master));
+
+ mm = &mgmt_master;
+ mm->master = master;
+ mm->terminating = false;
+ mm->socket_buffer = buffer_size;
+ mm->perf_stats_en = true;
+}
+
+void mgmt_init(void)
+{
+
+ /* Initialize datastores */
+ mgmt_ds_init(mm);
+
+ /* MGMTD VTY commands installation. */
+ mgmt_vty_init();
+}
+
+void mgmt_terminate(void)
+{
+ mgmt_ds_destroy();
+}