Skip to content

Commit

Permalink
cmgd: delete-config command
Browse files Browse the repository at this point in the history
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
  • Loading branch information
YashRanjanVMWare committed Aug 17, 2021
1 parent 11c68c7 commit b2369cd
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions cmgd/cmgd_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,19 +307,41 @@ DEFPY(cmgd_commit_abort,
}

DEFPY(cmgd_set_config_data,
cmgd_set_config_data_cmd,
"cmgd set-config xpath WORD$path value WORD$val",
CMGD_STR
"Set configuration data\n"
"XPath expression specifying the YANG data path\n"
"XPath string\n"
"Value of the data to set to\n"
"<value of the data>\n")
cmgd_set_config_data_cmd,
"cmgd set-config xpath WORD$path value WORD$val",
CMGD_STR
"Set configuration data\n"
"XPath expression specifying the YANG data path\n"
"XPath string\n"
"Value of the data to set to\n"
"<value of the data>\n")
{

strlcpy(vty->cfg_changes[0].xpath, path,
sizeof(vty->cfg_changes[0].xpath));
vty->cfg_changes[0].value = val;
vty->cfg_changes[0].operation = NB_OP_CREATE;
vty->num_cfg_changes = 1;

vty_cmgd_send_config_data(vty);
return CMD_SUCCESS;
}

DEFPY(cmgd_delete_config_data,
cmgd_delete_config_data_cmd,
"cmgd delete-config xpath WORD$path",
CMGD_STR
"Delete configuration data\n"
"XPath expression specifying the YANG data path\n"
"XPath string\n")
{

strlcpy(vty->cfg_changes[0].xpath, path,
sizeof(vty->cfg_changes[0].xpath));
vty->cfg_changes[0].value = NULL;
vty->cfg_changes[0].operation = NB_OP_DESTROY;
vty->num_cfg_changes = 1;

vty_cmgd_send_config_data(vty);
return CMD_SUCCESS;
}
Expand Down Expand Up @@ -444,6 +466,7 @@ void cmgd_vty_init(void)
install_element(CONFIG_NODE, &cmgd_lock_db_cand_cmd);
install_element(CONFIG_NODE, &cmgd_unlock_db_cand_cmd);
install_element(CONFIG_NODE, &cmgd_set_config_data_cmd);
install_element(CONFIG_NODE, &cmgd_delete_config_data_cmd);

/*
* TODO: Register and handlers for auto-completion here.
Expand Down

0 comments on commit b2369cd

Please sign in to comment.