mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00

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>
66 lines
1.3 KiB
C
66 lines
1.3 KiB
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_fe_server.h"
|
|
#include "mgmtd/mgmt_fe_adapter.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)
|
|
{
|
|
|
|
/*
|
|
* Allocates some vital data structures used by peer commands in
|
|
* vty_init
|
|
*/
|
|
vty_init_mgmt_fe();
|
|
|
|
/* Initialize datastores */
|
|
mgmt_ds_init(mm);
|
|
|
|
/* Initialize the MGMTD Frontend Adapter Module */
|
|
mgmt_fe_adapter_init(mm->master, mm);
|
|
|
|
/* Start the MGMTD Frontend Server for clients to connect */
|
|
mgmt_fe_server_init(mm->master);
|
|
|
|
/* MGMTD VTY commands installation. */
|
|
mgmt_vty_init();
|
|
}
|
|
|
|
void mgmt_terminate(void)
|
|
{
|
|
mgmt_fe_server_destroy();
|
|
mgmt_fe_adapter_destroy();
|
|
mgmt_ds_destroy();
|
|
}
|