forked from Mirror/frr

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>
50 lines
959 B
C
50 lines
959 B
C
// 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();
|
|
}
|