mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 21:47:15 +02:00
lib: convert affinity-map to mgmtd
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
fe76036002
commit
dc6ff4c0de
|
@ -58,6 +58,7 @@ struct affinity_maps {
|
||||||
DECLARE_QOBJ_TYPE(affinity_maps);
|
DECLARE_QOBJ_TYPE(affinity_maps);
|
||||||
|
|
||||||
extern const struct frr_yang_module_info frr_affinity_map_info;
|
extern const struct frr_yang_module_info frr_affinity_map_info;
|
||||||
|
extern const struct frr_yang_module_info frr_affinity_map_cli_info;
|
||||||
|
|
||||||
void affinity_map_set(const char *name, int pos);
|
void affinity_map_set(const char *name, int pos);
|
||||||
void affinity_map_unset(const char *name);
|
void affinity_map_unset(const char *name);
|
||||||
|
@ -69,9 +70,6 @@ void affinity_map_set_update_hook(void (*func)(const char *affmap_name,
|
||||||
uint16_t old_pos,
|
uint16_t old_pos,
|
||||||
uint16_t new_pos));
|
uint16_t new_pos));
|
||||||
|
|
||||||
void cli_show_affinity_map(struct vty *vty, const struct lyd_node *dnode,
|
|
||||||
bool show_defaults);
|
|
||||||
|
|
||||||
void affinity_map_init(void);
|
void affinity_map_init(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,15 +30,6 @@
|
||||||
#include "lib/affinitymap.h"
|
#include "lib/affinitymap.h"
|
||||||
#include "lib/affinitymap_cli_clippy.c"
|
#include "lib/affinitymap_cli_clippy.c"
|
||||||
|
|
||||||
/* Route map node structure. */
|
|
||||||
static int affinity_map_config_write(struct vty *vty);
|
|
||||||
static struct cmd_node affinitymap_node = {
|
|
||||||
.name = "affinity-map",
|
|
||||||
.node = AFFMAP_NODE,
|
|
||||||
.prompt = "",
|
|
||||||
.config_write = affinity_map_config_write,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* max value is EXT_ADMIN_GROUP_MAX_POSITIONS - 1 */
|
/* max value is EXT_ADMIN_GROUP_MAX_POSITIONS - 1 */
|
||||||
DEFPY_YANG_NOSH(affinity_map, affinity_map_cmd,
|
DEFPY_YANG_NOSH(affinity_map, affinity_map_cmd,
|
||||||
"affinity-map NAME$name bit-position (0-1023)$position",
|
"affinity-map NAME$name bit-position (0-1023)$position",
|
||||||
|
@ -75,21 +66,7 @@ DEFPY_YANG_NOSH(no_affinity_map, no_affinity_map_cmd,
|
||||||
return nb_cli_apply_changes(vty, NULL);
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int affinity_map_config_write(struct vty *vty)
|
static void cli_show_affinity_map(struct vty *vty, const struct lyd_node *dnode,
|
||||||
{
|
|
||||||
const struct lyd_node *dnode;
|
|
||||||
int written = 0;
|
|
||||||
|
|
||||||
dnode = yang_dnode_get(running_config->dnode, "/frr-affinity-map:lib");
|
|
||||||
if (dnode) {
|
|
||||||
nb_cli_show_dnode_cmds(vty, dnode, false);
|
|
||||||
written = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return written;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cli_show_affinity_map(struct vty *vty, const struct lyd_node *dnode,
|
|
||||||
bool show_defaults __attribute__((__unused__)))
|
bool show_defaults __attribute__((__unused__)))
|
||||||
{
|
{
|
||||||
vty_out(vty, "affinity-map %s bit-position %u\n",
|
vty_out(vty, "affinity-map %s bit-position %u\n",
|
||||||
|
@ -97,11 +74,24 @@ void cli_show_affinity_map(struct vty *vty, const struct lyd_node *dnode,
|
||||||
yang_dnode_get_uint16(dnode, "value"));
|
yang_dnode_get_uint16(dnode, "value"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const struct frr_yang_module_info frr_affinity_map_cli_info = {
|
||||||
|
.name = "frr-affinity-map",
|
||||||
|
.ignore_cfg_cbs = true,
|
||||||
|
.nodes = {
|
||||||
|
{
|
||||||
|
.xpath = "/frr-affinity-map:lib/affinity-maps/affinity-map",
|
||||||
|
.cbs.cli_show = cli_show_affinity_map,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.xpath = NULL,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* Initialization of affinity map vector. */
|
/* Initialization of affinity map vector. */
|
||||||
void affinity_map_init(void)
|
void affinity_map_init(void)
|
||||||
{
|
{
|
||||||
/* CLI commands. */
|
/* CLI commands. */
|
||||||
install_node(&affinitymap_node);
|
|
||||||
install_element(CONFIG_NODE, &affinity_map_cmd);
|
install_element(CONFIG_NODE, &affinity_map_cmd);
|
||||||
install_element(CONFIG_NODE, &no_affinity_map_cmd);
|
install_element(CONFIG_NODE, &no_affinity_map_cmd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,6 @@ const struct frr_yang_module_info frr_affinity_map_info = {
|
||||||
.cbs = {
|
.cbs = {
|
||||||
.create = lib_affinity_map_create,
|
.create = lib_affinity_map_create,
|
||||||
.destroy = lib_affinity_map_destroy,
|
.destroy = lib_affinity_map_destroy,
|
||||||
.cli_show = cli_show_affinity_map,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "ripd/rip_nb.h"
|
#include "ripd/rip_nb.h"
|
||||||
#include "ripngd/ripng_nb.h"
|
#include "ripngd/ripng_nb.h"
|
||||||
#include "routing_nb.h"
|
#include "routing_nb.h"
|
||||||
|
#include "affinitymap.h"
|
||||||
|
|
||||||
/* mgmt options, we use GNU getopt library. */
|
/* mgmt options, we use GNU getopt library. */
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
|
@ -169,12 +169,6 @@ const struct frr_yang_module_info zebra_info = {
|
||||||
.nodes = { { .xpath = NULL } },
|
.nodes = { { .xpath = NULL } },
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct frr_yang_module_info affinity_map_info = {
|
|
||||||
.name = "frr-affinity-map",
|
|
||||||
.ignore_cfg_cbs = true,
|
|
||||||
.nodes = { { .xpath = NULL } },
|
|
||||||
};
|
|
||||||
|
|
||||||
const struct frr_yang_module_info zebra_route_map_info = {
|
const struct frr_yang_module_info zebra_route_map_info = {
|
||||||
.name = "frr-zebra-route-map",
|
.name = "frr-zebra-route-map",
|
||||||
.ignore_cfg_cbs = true,
|
.ignore_cfg_cbs = true,
|
||||||
|
@ -191,13 +185,13 @@ static const struct frr_yang_module_info *const mgmt_yang_modules[] = {
|
||||||
&frr_route_map_cli_info,
|
&frr_route_map_cli_info,
|
||||||
&frr_routing_info,
|
&frr_routing_info,
|
||||||
&frr_vrf_info,
|
&frr_vrf_info,
|
||||||
|
&frr_affinity_map_cli_info,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* YANG module info used by backend clients get added here.
|
* YANG module info used by backend clients get added here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
&zebra_info,
|
&zebra_info,
|
||||||
&affinity_map_info,
|
|
||||||
&zebra_route_map_info,
|
&zebra_route_map_info,
|
||||||
|
|
||||||
#ifdef HAVE_RIPD
|
#ifdef HAVE_RIPD
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <zebra.h>
|
#include <zebra.h>
|
||||||
|
|
||||||
|
#include "affinitymap.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
#include "json.h"
|
#include "json.h"
|
||||||
|
@ -570,6 +571,7 @@ void mgmt_vty_init(void)
|
||||||
*/
|
*/
|
||||||
filter_cli_init();
|
filter_cli_init();
|
||||||
route_map_cli_init();
|
route_map_cli_init();
|
||||||
|
affinity_map_init();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize command handling from VTYSH connection.
|
* Initialize command handling from VTYSH connection.
|
||||||
|
|
|
@ -18,6 +18,7 @@ lib_LTLIBRARIES += mgmtd/libmgmt_be_nb.la
|
||||||
mgmtd_libmgmt_be_nb_la_SOURCES = \
|
mgmtd_libmgmt_be_nb_la_SOURCES = \
|
||||||
# end
|
# end
|
||||||
nodist_mgmtd_libmgmt_be_nb_la_SOURCES = \
|
nodist_mgmtd_libmgmt_be_nb_la_SOURCES = \
|
||||||
|
lib/affinitymap_cli.c \
|
||||||
# end
|
# end
|
||||||
mgmtd_libmgmt_be_nb_la_CFLAGS = $(AM_CFLAGS) -DINCLUDE_MGMTD_CMDDEFS_ONLY
|
mgmtd_libmgmt_be_nb_la_CFLAGS = $(AM_CFLAGS) -DINCLUDE_MGMTD_CMDDEFS_ONLY
|
||||||
mgmtd_libmgmt_be_nb_la_CPPFLAGS = $(AM_CPPFLAGS) -DINCLUDE_MGMTD_CMDDEFS_ONLY
|
mgmtd_libmgmt_be_nb_la_CPPFLAGS = $(AM_CPPFLAGS) -DINCLUDE_MGMTD_CMDDEFS_ONLY
|
||||||
|
|
|
@ -60,7 +60,7 @@ extern struct event_loop *master;
|
||||||
VTYSH_OSPFD | VTYSH_PBRD | VTYSH_PIMD | VTYSH_PIM6D | \
|
VTYSH_OSPFD | VTYSH_PBRD | VTYSH_PIMD | VTYSH_PIM6D | \
|
||||||
VTYSH_RIPD | VTYSH_RIPNGD | VTYSH_VRRPD | VTYSH_ZEBRA
|
VTYSH_RIPD | VTYSH_RIPNGD | VTYSH_VRRPD | VTYSH_ZEBRA
|
||||||
|
|
||||||
#define VTYSH_AFFMAP VTYSH_ZEBRA | VTYSH_ISISD
|
#define VTYSH_AFFMAP VTYSH_ZEBRA | VTYSH_ISISD | VTYSH_MGMTD
|
||||||
#define VTYSH_RMAP_CONFIG \
|
#define VTYSH_RMAP_CONFIG \
|
||||||
VTYSH_ZEBRA | VTYSH_OSPFD | VTYSH_OSPF6D | VTYSH_BGPD | VTYSH_ISISD | \
|
VTYSH_ZEBRA | VTYSH_OSPFD | VTYSH_OSPF6D | VTYSH_BGPD | VTYSH_ISISD | \
|
||||||
VTYSH_PIMD | VTYSH_EIGRPD | VTYSH_FABRICD | VTYSH_MGMTD
|
VTYSH_PIMD | VTYSH_EIGRPD | VTYSH_FABRICD | VTYSH_MGMTD
|
||||||
|
|
Loading…
Reference in a new issue