mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 00:41:20 +00:00
Merge pull request #15246 from idryzhov/mgmt-get-data-improvements
mgmt get-data improvements
This commit is contained in:
commit
25d3086d83
@ -308,9 +308,10 @@ int mgmt_fe_send_regnotify_req(struct mgmt_fe_client *client,
|
||||
/*
|
||||
* Send get-data request.
|
||||
*/
|
||||
int mgmt_fe_send_get_data_req(struct mgmt_fe_client *client, uint64_t session_id,
|
||||
uint64_t req_id, LYD_FORMAT result_type,
|
||||
uint8_t flags, const char *xpath)
|
||||
int mgmt_fe_send_get_data_req(struct mgmt_fe_client *client,
|
||||
uint64_t session_id, uint64_t req_id,
|
||||
uint8_t datastore, LYD_FORMAT result_type,
|
||||
uint8_t flags, uint8_t defaults, const char *xpath)
|
||||
{
|
||||
struct mgmt_msg_get_data *msg;
|
||||
size_t xplen = strlen(xpath);
|
||||
@ -323,6 +324,8 @@ int mgmt_fe_send_get_data_req(struct mgmt_fe_client *client, uint64_t session_id
|
||||
msg->code = MGMT_MSG_CODE_GET_DATA;
|
||||
msg->result_type = result_type;
|
||||
msg->flags = flags;
|
||||
msg->defaults = defaults;
|
||||
msg->datastore = datastore;
|
||||
strlcpy(msg->xpath, xpath, xplen + 1);
|
||||
|
||||
MGMTD_FE_CLIENT_DBG("Sending GET_DATA_REQ session-id %" PRIu64
|
||||
|
@ -384,12 +384,18 @@ extern int mgmt_fe_send_regnotify_req(struct mgmt_fe_client *client,
|
||||
* req_id
|
||||
* Client request ID.
|
||||
*
|
||||
* datastore
|
||||
* Datastore for getting data.
|
||||
*
|
||||
* result_type
|
||||
* The LYD_FORMAT of the result.
|
||||
*
|
||||
* flags
|
||||
* Flags to control the behavior of the request.
|
||||
*
|
||||
* defaults
|
||||
* Options to control the reporting of default values.
|
||||
*
|
||||
* xpath
|
||||
* the xpath to get.
|
||||
*
|
||||
@ -398,7 +404,8 @@ extern int mgmt_fe_send_regnotify_req(struct mgmt_fe_client *client,
|
||||
*/
|
||||
extern int mgmt_fe_send_get_data_req(struct mgmt_fe_client *client,
|
||||
uint64_t session_id, uint64_t req_id,
|
||||
LYD_FORMAT result_type, uint8_t flags,
|
||||
uint8_t datastore, LYD_FORMAT result_type,
|
||||
uint8_t flags, uint8_t defaults,
|
||||
const char *xpath);
|
||||
|
||||
/*
|
||||
|
@ -154,6 +154,30 @@ DECLARE_MTYPE(MSG_NATIVE_NOTIFY);
|
||||
#define MGMT_MSG_CODE_GET_DATA 3
|
||||
#define MGMT_MSG_CODE_NOTIFY 4
|
||||
|
||||
/*
|
||||
* Datastores
|
||||
*/
|
||||
#define MGMT_MSG_DATASTORE_STARTUP 0
|
||||
#define MGMT_MSG_DATASTORE_CANDIDATE 1
|
||||
#define MGMT_MSG_DATASTORE_RUNNING 2
|
||||
#define MGMT_MSG_DATASTORE_OPERATIONAL 3
|
||||
|
||||
/*
|
||||
* Formats
|
||||
*/
|
||||
#define MGMT_MSG_FORMAT_XML 1
|
||||
#define MGMT_MSG_FORMAT_JSON 2
|
||||
#define MGMT_MSG_FORMAT_BINARY 3 /* non-standard libyang internal format */
|
||||
|
||||
/*
|
||||
* Now we're using LYD_FORMAT directly to avoid mapping code, but having our
|
||||
* own definitions allows us to create such a mapping in the future if libyang
|
||||
* makes a backwards incompatible change.
|
||||
*/
|
||||
_Static_assert(MGMT_MSG_FORMAT_XML == LYD_XML, "Format mismatch");
|
||||
_Static_assert(MGMT_MSG_FORMAT_JSON == LYD_JSON, "Format mismatch");
|
||||
_Static_assert(MGMT_MSG_FORMAT_BINARY == LYD_LYB, "Format mismatch");
|
||||
|
||||
/**
|
||||
* struct mgmt_msg_header - Header common to all native messages.
|
||||
*
|
||||
@ -236,22 +260,34 @@ _Static_assert(sizeof(struct mgmt_msg_tree_data) ==
|
||||
"Size mismatch");
|
||||
|
||||
/* Flags for get-data request */
|
||||
#define GET_DATA_FLAG_STATE 0x01 /* get only "config false" data */
|
||||
#define GET_DATA_FLAG_CONFIG 0x02 /* get only "config true" data */
|
||||
#define GET_DATA_FLAG_STATE 0x01 /* include "config false" data */
|
||||
#define GET_DATA_FLAG_CONFIG 0x02 /* include "config true" data */
|
||||
#define GET_DATA_FLAG_EXACT 0x04 /* get exact data node instead of the full tree */
|
||||
|
||||
/*
|
||||
* Modes of reporting default values. Non-default values are always reported.
|
||||
* These options reflect "with-defaults" modes as defined in RFC 6243.
|
||||
*/
|
||||
#define GET_DATA_DEFAULTS_EXPLICIT 0 /* "explicit" */
|
||||
#define GET_DATA_DEFAULTS_TRIM 1 /* "trim" */
|
||||
#define GET_DATA_DEFAULTS_ALL 2 /* "report-all" */
|
||||
#define GET_DATA_DEFAULTS_ALL_ADD_TAG 3 /* "report-all-tagged" */
|
||||
|
||||
/**
|
||||
* struct mgmt_msg_get_data - frontend get-data request.
|
||||
*
|
||||
* @result_type: ``LYD_FORMAT`` for the returned result.
|
||||
* @flags: combination of ``GET_DATA_FLAG_*`` flags.
|
||||
* @defaults: one of ``GET_DATA_DEFAULTS_*`` values.
|
||||
* @xpath: the query for the data to return.
|
||||
*/
|
||||
struct mgmt_msg_get_data {
|
||||
struct mgmt_msg_header;
|
||||
uint8_t result_type;
|
||||
uint8_t flags;
|
||||
uint8_t resv2[6];
|
||||
uint8_t defaults;
|
||||
uint8_t datastore;
|
||||
uint8_t resv2[4];
|
||||
|
||||
alignas(8) char xpath[];
|
||||
};
|
||||
|
@ -4101,16 +4101,17 @@ int vty_mgmt_send_get_req(struct vty *vty, bool is_config,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vty_mgmt_send_get_data_req(struct vty *vty, LYD_FORMAT result_type,
|
||||
uint8_t flags, const char *xpath)
|
||||
int vty_mgmt_send_get_data_req(struct vty *vty, uint8_t datastore,
|
||||
LYD_FORMAT result_type, uint8_t flags,
|
||||
uint8_t defaults, const char *xpath)
|
||||
{
|
||||
LYD_FORMAT intern_format = result_type;
|
||||
|
||||
vty->mgmt_req_id++;
|
||||
|
||||
if (mgmt_fe_send_get_data_req(mgmt_fe_client, vty->mgmt_session_id,
|
||||
vty->mgmt_req_id, intern_format, flags,
|
||||
xpath)) {
|
||||
vty->mgmt_req_id, datastore,
|
||||
intern_format, flags, defaults, xpath)) {
|
||||
zlog_err("Failed to send GET-DATA to MGMTD session-id: %" PRIu64
|
||||
" req-id %" PRIu64 ".",
|
||||
vty->mgmt_session_id, vty->mgmt_req_id);
|
||||
|
@ -420,8 +420,9 @@ extern int vty_mgmt_send_commit_config(struct vty *vty, bool validate_only,
|
||||
extern int vty_mgmt_send_get_req(struct vty *vty, bool is_config,
|
||||
Mgmtd__DatastoreId datastore,
|
||||
const char **xpath_list, int num_req);
|
||||
extern int vty_mgmt_send_get_data_req(struct vty *vty, LYD_FORMAT result_type,
|
||||
uint8_t flags, const char *xpath);
|
||||
extern int vty_mgmt_send_get_data_req(struct vty *vty, uint8_t datastore,
|
||||
LYD_FORMAT result_type, uint8_t flags,
|
||||
uint8_t defaults, const char *xpath);
|
||||
extern int vty_mgmt_send_lockds_req(struct vty *vty, Mgmtd__DatastoreId ds_id,
|
||||
bool lock, bool scok);
|
||||
extern void vty_mgmt_resume_response(struct vty *vty, int ret);
|
||||
|
@ -1080,13 +1080,12 @@ mgmt_fe_adapter_handle_msg(struct mgmt_fe_client_adapter *adapter,
|
||||
*/
|
||||
static int fe_adapter_send_tree_data(struct mgmt_fe_session_ctx *session,
|
||||
uint64_t req_id, bool short_circuit_ok,
|
||||
uint8_t result_type,
|
||||
uint8_t result_type, uint32_t wd_options,
|
||||
const struct lyd_node *tree,
|
||||
int partial_error)
|
||||
|
||||
{
|
||||
struct mgmt_msg_tree_data *msg;
|
||||
struct lyd_node *empty = NULL;
|
||||
uint8_t **darrp = NULL;
|
||||
int ret = 0;
|
||||
|
||||
@ -1098,15 +1097,9 @@ static int fe_adapter_send_tree_data(struct mgmt_fe_session_ctx *session,
|
||||
msg->partial_error = partial_error;
|
||||
msg->result_type = result_type;
|
||||
|
||||
if (!tree) {
|
||||
empty = yang_dnode_new(ly_native_ctx, false);
|
||||
tree = empty;
|
||||
}
|
||||
|
||||
darrp = mgmt_msg_native_get_darrp(msg);
|
||||
ret = yang_print_tree_append(darrp, tree, result_type,
|
||||
(LYD_PRINT_WD_EXPLICIT |
|
||||
LYD_PRINT_WITHSIBLINGS));
|
||||
(wd_options | LYD_PRINT_WITHSIBLINGS));
|
||||
if (ret != LY_SUCCESS) {
|
||||
MGMTD_FE_ADAPTER_ERR("Error building get-tree result for client %s session-id %" PRIu64
|
||||
" req-id %" PRIu64
|
||||
@ -1126,8 +1119,6 @@ static int fe_adapter_send_tree_data(struct mgmt_fe_session_ctx *session,
|
||||
mgmt_msg_native_get_msg_len(msg),
|
||||
short_circuit_ok);
|
||||
done:
|
||||
if (empty)
|
||||
yang_dnode_free(empty);
|
||||
mgmt_msg_native_free_msg(msg);
|
||||
|
||||
return ret;
|
||||
@ -1146,7 +1137,9 @@ static void fe_adapter_handle_get_data(struct mgmt_fe_session_ctx *session,
|
||||
struct lysc_node **snodes = NULL;
|
||||
char *xpath_resolved = NULL;
|
||||
uint64_t req_id = msg->req_id;
|
||||
Mgmtd__DatastoreId ds_id;
|
||||
uint64_t clients;
|
||||
uint32_t wd_options;
|
||||
bool simple_xpath;
|
||||
LY_ERR err;
|
||||
int ret;
|
||||
@ -1171,6 +1164,43 @@ static void fe_adapter_handle_get_data(struct mgmt_fe_session_ctx *session,
|
||||
goto done;
|
||||
}
|
||||
|
||||
switch (msg->defaults) {
|
||||
case GET_DATA_DEFAULTS_EXPLICIT:
|
||||
wd_options = LYD_PRINT_WD_EXPLICIT;
|
||||
break;
|
||||
case GET_DATA_DEFAULTS_TRIM:
|
||||
wd_options = LYD_PRINT_WD_TRIM;
|
||||
break;
|
||||
case GET_DATA_DEFAULTS_ALL:
|
||||
wd_options = LYD_PRINT_WD_ALL;
|
||||
break;
|
||||
case GET_DATA_DEFAULTS_ALL_ADD_TAG:
|
||||
wd_options = LYD_PRINT_WD_IMPL_TAG;
|
||||
break;
|
||||
default:
|
||||
fe_adapter_send_error(session, req_id, false, -EINVAL,
|
||||
"Invalid defaults value %u for session-id: %" PRIu64,
|
||||
msg->defaults, session->session_id);
|
||||
goto done;
|
||||
}
|
||||
|
||||
switch (msg->datastore) {
|
||||
case MGMT_MSG_DATASTORE_CANDIDATE:
|
||||
ds_id = MGMTD_DS_CANDIDATE;
|
||||
break;
|
||||
case MGMT_MSG_DATASTORE_RUNNING:
|
||||
ds_id = MGMTD_DS_RUNNING;
|
||||
break;
|
||||
case MGMT_MSG_DATASTORE_OPERATIONAL:
|
||||
ds_id = MGMTD_DS_OPERATIONAL;
|
||||
break;
|
||||
default:
|
||||
fe_adapter_send_error(session, req_id, false, -EINVAL,
|
||||
"Unsupported datastore %" PRIu8
|
||||
" requested from session-id: %" PRIu64,
|
||||
msg->datastore, session->session_id);
|
||||
goto done;
|
||||
}
|
||||
|
||||
err = yang_resolve_snode_xpath(ly_native_ctx, msg->xpath, &snodes,
|
||||
&simple_xpath);
|
||||
@ -1190,7 +1220,7 @@ static void fe_adapter_handle_get_data(struct mgmt_fe_session_ctx *session,
|
||||
session->session_id);
|
||||
|
||||
fe_adapter_send_tree_data(session, req_id, false,
|
||||
msg->result_type, NULL, 0);
|
||||
msg->result_type, wd_options, NULL, 0);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -1209,8 +1239,8 @@ static void fe_adapter_handle_get_data(struct mgmt_fe_session_ctx *session,
|
||||
|
||||
/* Create a GET-TREE request under the transaction */
|
||||
ret = mgmt_txn_send_get_tree_oper(session->txn_id, req_id, clients,
|
||||
msg->result_type, msg->flags,
|
||||
simple_xpath, msg->xpath);
|
||||
ds_id, msg->result_type, msg->flags,
|
||||
wd_options, simple_xpath, msg->xpath);
|
||||
if (ret) {
|
||||
/* destroy the just created txn */
|
||||
mgmt_destroy_txn(&session->txn_id);
|
||||
@ -1469,6 +1499,7 @@ int mgmt_fe_send_get_reply(uint64_t session_id, uint64_t txn_id,
|
||||
|
||||
int mgmt_fe_adapter_send_tree_data(uint64_t session_id, uint64_t txn_id,
|
||||
uint64_t req_id, LYD_FORMAT result_type,
|
||||
uint32_t wd_options,
|
||||
const struct lyd_node *tree,
|
||||
int partial_error, bool short_circuit_ok)
|
||||
{
|
||||
@ -1480,7 +1511,8 @@ int mgmt_fe_adapter_send_tree_data(uint64_t session_id, uint64_t txn_id,
|
||||
return -1;
|
||||
|
||||
ret = fe_adapter_send_tree_data(session, req_id, short_circuit_ok,
|
||||
result_type, tree, partial_error);
|
||||
result_type, wd_options, tree,
|
||||
partial_error);
|
||||
|
||||
mgmt_destroy_txn(&session->txn_id);
|
||||
|
||||
|
@ -148,6 +148,7 @@ extern int mgmt_fe_send_get_reply(uint64_t session_id, uint64_t txn_id,
|
||||
* txn_id: the txn_id this data pertains to
|
||||
* req_id: the req id for the get_tree message
|
||||
* result_type: the format of the result data.
|
||||
* wd_options: with-defaults options.
|
||||
* tree: the results.
|
||||
* partial_error: if there were errors while gather results.
|
||||
* short_circuit_ok: True if OK to short-circuit the call.
|
||||
@ -156,12 +157,11 @@ extern int mgmt_fe_send_get_reply(uint64_t session_id, uint64_t txn_id,
|
||||
* the return value from the underlying send function.
|
||||
*
|
||||
*/
|
||||
extern int mgmt_fe_adapter_send_tree_data(uint64_t session_id, uint64_t txn_id,
|
||||
uint64_t req_id,
|
||||
LYD_FORMAT result_type,
|
||||
const struct lyd_node *tree,
|
||||
int partial_error,
|
||||
bool short_circuit_ok);
|
||||
extern int
|
||||
mgmt_fe_adapter_send_tree_data(uint64_t session_id, uint64_t txn_id,
|
||||
uint64_t req_id, LYD_FORMAT result_type,
|
||||
uint32_t wd_options, const struct lyd_node *tree,
|
||||
int partial_error, bool short_circuit_ok);
|
||||
|
||||
/**
|
||||
* Send an error back to the FE client using native messaging.
|
||||
|
@ -144,6 +144,16 @@ static struct frr_signal_t mgmt_signals[] = {
|
||||
extern const struct frr_yang_module_info frr_staticd_cli_info;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These are modules that are only needed by mgmtd and hence not included into
|
||||
* the lib and backend daemons.
|
||||
*/
|
||||
const struct frr_yang_module_info ietf_netconf_with_defaults_info = {
|
||||
.name = "ietf-netconf-with-defaults",
|
||||
.ignore_cfg_cbs = true,
|
||||
.nodes = { { .xpath = NULL } },
|
||||
};
|
||||
|
||||
/*
|
||||
* These are stub info structs that are used to load the modules used by backend
|
||||
* clients into mgmtd. The modules are used by libyang in order to support
|
||||
@ -167,6 +177,9 @@ static const struct frr_yang_module_info *const mgmt_yang_modules[] = {
|
||||
&frr_vrf_info,
|
||||
&frr_affinity_map_cli_info,
|
||||
|
||||
/* mgmtd-only modules */
|
||||
&ietf_netconf_with_defaults_info,
|
||||
|
||||
/*
|
||||
* YANG module info used by backend clients get added here.
|
||||
*/
|
||||
|
@ -175,6 +175,7 @@ struct txn_req_get_tree {
|
||||
uint64_t recv_clients; /* Bitmask of clients recv reply from */
|
||||
int32_t partial_error; /* an error while gather results */
|
||||
uint8_t result_type; /* LYD_FORMAT for results */
|
||||
uint8_t wd_options; /* LYD_PRINT_WD_* flags for results */
|
||||
uint8_t exact; /* if exact node is requested */
|
||||
uint8_t simple_xpath; /* if xpath is simple */
|
||||
struct lyd_node *client_results; /* result tree from clients */
|
||||
@ -1282,6 +1283,7 @@ static int txn_get_tree_data_done(struct mgmt_txn_ctx *txn,
|
||||
txn->txn_id,
|
||||
txn_req->req_id,
|
||||
get_tree->result_type,
|
||||
get_tree->wd_options,
|
||||
result,
|
||||
get_tree->partial_error,
|
||||
false);
|
||||
@ -2339,8 +2341,9 @@ int mgmt_txn_send_get_req(uint64_t txn_id, uint64_t req_id,
|
||||
* has registered operational state that matches the given `xpath`
|
||||
*/
|
||||
int mgmt_txn_send_get_tree_oper(uint64_t txn_id, uint64_t req_id,
|
||||
uint64_t clients, LYD_FORMAT result_type,
|
||||
uint8_t flags, bool simple_xpath,
|
||||
uint64_t clients, Mgmtd__DatastoreId ds_id,
|
||||
LYD_FORMAT result_type, uint8_t flags,
|
||||
uint32_t wd_options, bool simple_xpath,
|
||||
const char *xpath)
|
||||
{
|
||||
struct mgmt_msg_get_tree *msg;
|
||||
@ -2359,13 +2362,20 @@ int mgmt_txn_send_get_tree_oper(uint64_t txn_id, uint64_t req_id,
|
||||
txn_req = mgmt_txn_req_alloc(txn, req_id, MGMTD_TXN_PROC_GETTREE);
|
||||
get_tree = txn_req->req.get_tree;
|
||||
get_tree->result_type = result_type;
|
||||
get_tree->wd_options = wd_options;
|
||||
get_tree->exact = CHECK_FLAG(flags, GET_DATA_FLAG_EXACT);
|
||||
get_tree->simple_xpath = simple_xpath;
|
||||
get_tree->xpath = XSTRDUP(MTYPE_MGMTD_XPATH, xpath);
|
||||
|
||||
if (CHECK_FLAG(flags, GET_DATA_FLAG_CONFIG)) {
|
||||
/*
|
||||
* If the requested datastore is operational, get the config
|
||||
* from running.
|
||||
*/
|
||||
struct mgmt_ds_ctx *ds =
|
||||
mgmt_ds_get_ctx_by_id(mm, MGMTD_DS_RUNNING);
|
||||
mgmt_ds_get_ctx_by_id(mm, ds_id == MGMTD_DS_OPERATIONAL
|
||||
? MGMTD_DS_RUNNING
|
||||
: ds_id);
|
||||
struct nb_config *config = mgmt_ds_get_nb_config(ds);
|
||||
|
||||
if (config) {
|
||||
@ -2411,7 +2421,8 @@ int mgmt_txn_send_get_tree_oper(uint64_t txn_id, uint64_t req_id,
|
||||
}
|
||||
state:
|
||||
/* If we are only getting config, we are done */
|
||||
if (!CHECK_FLAG(flags, GET_DATA_FLAG_STATE) || !clients)
|
||||
if (!CHECK_FLAG(flags, GET_DATA_FLAG_STATE) ||
|
||||
ds_id != MGMTD_DS_OPERATIONAL || !clients)
|
||||
return txn_get_tree_data_done(txn, txn_req);
|
||||
|
||||
msg = mgmt_msg_native_alloc_msg(struct mgmt_msg_get_tree, slen + 1,
|
||||
|
@ -202,8 +202,10 @@ extern int mgmt_txn_send_get_req(uint64_t txn_id, uint64_t req_id,
|
||||
* txn_id: Transaction identifier.
|
||||
* req_id: FE client request identifier.
|
||||
* clients: Bitmask of clients to send get-tree to.
|
||||
* ds_id: datastore ID.
|
||||
* result_type: LYD_FORMAT result format.
|
||||
* flags: option flags for the request.
|
||||
* wd_options: LYD_PRINT_WD_* flags for the result.
|
||||
* simple_xpath: true if xpath is simple (only key predicates).
|
||||
* xpath: The xpath to get the tree from.
|
||||
*
|
||||
@ -211,8 +213,10 @@ extern int mgmt_txn_send_get_req(uint64_t txn_id, uint64_t req_id,
|
||||
* 0 on success.
|
||||
*/
|
||||
extern int mgmt_txn_send_get_tree_oper(uint64_t txn_id, uint64_t req_id,
|
||||
uint64_t clients, LYD_FORMAT result_type,
|
||||
uint8_t flags, bool simple_xpath,
|
||||
uint64_t clients,
|
||||
Mgmtd__DatastoreId ds_id,
|
||||
LYD_FORMAT result_type, uint8_t flags,
|
||||
uint32_t wd_options, bool simple_xpath,
|
||||
const char *xpath);
|
||||
|
||||
/*
|
||||
|
@ -258,14 +258,22 @@ DEFPY(show_mgmt_get_config, show_mgmt_get_config_cmd,
|
||||
}
|
||||
|
||||
DEFPY(show_mgmt_get_data, show_mgmt_get_data_cmd,
|
||||
"show mgmt get-data WORD$path [with-config|only-config]$content [exact]$exact [json|xml]$fmt",
|
||||
"show mgmt get-data WORD$path [datastore <candidate|running|operational>$ds] [with-config|only-config]$content [exact]$exact [with-defaults <trim|all-tag|all>$wd] [json|xml]$fmt",
|
||||
SHOW_STR
|
||||
MGMTD_STR
|
||||
"Get a data from the operational datastore\n"
|
||||
"XPath expression specifying the YANG data root\n"
|
||||
"Specify datastore to get data from (operational by default)\n"
|
||||
"Candidate datastore\n"
|
||||
"Running datastore\n"
|
||||
"Operational datastore\n"
|
||||
"Include \"config true\" data\n"
|
||||
"Get only \"config true\" data\n"
|
||||
"Get exact node instead of the whole data tree\n"
|
||||
"Configure 'with-defaults' mode per RFC 6243 (\"explicit\" mode by default)\n"
|
||||
"Use \"trim\" mode\n"
|
||||
"Use \"report-all-tagged\" mode\n"
|
||||
"Use \"report-all\" mode\n"
|
||||
"JSON output format\n"
|
||||
"XML output format\n")
|
||||
{
|
||||
@ -273,6 +281,8 @@ DEFPY(show_mgmt_get_data, show_mgmt_get_data_cmd,
|
||||
int plen = strlen(path);
|
||||
char *xpath = NULL;
|
||||
uint8_t flags = content ? GET_DATA_FLAG_CONFIG : GET_DATA_FLAG_STATE;
|
||||
uint8_t defaults = GET_DATA_DEFAULTS_EXPLICIT;
|
||||
uint8_t datastore = MGMT_MSG_DATASTORE_OPERATIONAL;
|
||||
|
||||
if (content && content[0] == 'w')
|
||||
flags |= GET_DATA_FLAG_STATE;
|
||||
@ -280,6 +290,22 @@ DEFPY(show_mgmt_get_data, show_mgmt_get_data_cmd,
|
||||
if (exact)
|
||||
flags |= GET_DATA_FLAG_EXACT;
|
||||
|
||||
if (wd) {
|
||||
if (wd[0] == 't')
|
||||
defaults = GET_DATA_DEFAULTS_TRIM;
|
||||
else if (wd[3] == '-')
|
||||
defaults = GET_DATA_DEFAULTS_ALL_ADD_TAG;
|
||||
else
|
||||
defaults = GET_DATA_DEFAULTS_ALL;
|
||||
}
|
||||
|
||||
if (ds) {
|
||||
if (ds[0] == 'c')
|
||||
datastore = MGMT_MSG_DATASTORE_CANDIDATE;
|
||||
else if (ds[0] == 'r')
|
||||
datastore = MGMT_MSG_DATASTORE_RUNNING;
|
||||
}
|
||||
|
||||
/* get rid of extraneous trailing slash-* or single '/' unless root */
|
||||
if (plen > 2 && ((path[plen - 2] == '/' && path[plen - 1] == '*') ||
|
||||
(path[plen - 2] != '/' && path[plen - 1] == '/'))) {
|
||||
@ -289,7 +315,8 @@ DEFPY(show_mgmt_get_data, show_mgmt_get_data_cmd,
|
||||
path = xpath;
|
||||
}
|
||||
|
||||
vty_mgmt_send_get_data_req(vty, format, flags, path);
|
||||
vty_mgmt_send_get_data_req(vty, datastore, format, flags, defaults,
|
||||
path);
|
||||
|
||||
if (xpath)
|
||||
XFREE(MTYPE_TMP, xpath);
|
||||
|
@ -61,6 +61,9 @@ mgmtd_mgmtd_SOURCES = \
|
||||
# end
|
||||
nodist_mgmtd_mgmtd_SOURCES = \
|
||||
yang/frr-zebra.yang.c \
|
||||
yang/ietf/ietf-netconf-acm.yang.c \
|
||||
yang/ietf/ietf-netconf.yang.c \
|
||||
yang/ietf/ietf-netconf-with-defaults.yang.c \
|
||||
# nothing
|
||||
mgmtd_mgmtd_CFLAGS = $(AM_CFLAGS) -I ./
|
||||
mgmtd_mgmtd_LDADD = mgmtd/libmgmtd.a lib/libfrr.la $(LIBCAP) $(LIBM) $(LIBYANG_LIBS) $(UST_LIBS)
|
||||
|
@ -15,6 +15,7 @@ debug mgmt client backend
|
||||
interface r1-eth0
|
||||
ip address 1.1.1.1/24
|
||||
description r1-eth0-desc
|
||||
evpn mh es-df-pref 32767
|
||||
exit
|
||||
|
||||
interface r1-eth1 vrf red
|
||||
|
@ -10,7 +10,10 @@
|
||||
"ip": "1.1.1.1",
|
||||
"prefix-length": 24
|
||||
}
|
||||
]
|
||||
],
|
||||
"evpn-mh": {
|
||||
"df-preference": 32767
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"frr-zebra:evpn-mh": {
|
||||
"df-preference": 32767,
|
||||
"bypass": false,
|
||||
"@bypass": {
|
||||
"ietf-netconf-with-defaults:default": true
|
||||
},
|
||||
"uplink": false,
|
||||
"@uplink": {
|
||||
"ietf-netconf-with-defaults:default": true
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"frr-zebra:evpn-mh": {
|
||||
"df-preference": 32767,
|
||||
"bypass": false,
|
||||
"uplink": false
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"frr-zebra:evpn-mh": {
|
||||
"df-preference": 32767
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"frr-zebra:evpn-mh": {}
|
||||
}
|
@ -20,6 +20,9 @@
|
||||
"prefix-length": 24
|
||||
}
|
||||
],
|
||||
"evpn-mh": {
|
||||
"df-preference": 32767
|
||||
},
|
||||
"state": {
|
||||
"up-count": 0,
|
||||
"down-count": 0
|
||||
|
@ -146,6 +146,27 @@ def test_oper_simple(tgen):
|
||||
'/frr-interface:lib/interface[name="r1-eth0"]/state/mtu',
|
||||
"simple-results/result-intf-state-mtu.json",
|
||||
),
|
||||
# with-defaults
|
||||
(
|
||||
'/frr-interface:lib/interface[name="r1-eth0"]/frr-zebra:zebra/evpn-mh',
|
||||
"simple-results/result-intf-eth0-wd-explicit.json",
|
||||
"with-config exact",
|
||||
),
|
||||
(
|
||||
'/frr-interface:lib/interface[name="r1-eth0"]/frr-zebra:zebra/evpn-mh',
|
||||
"simple-results/result-intf-eth0-wd-trim.json",
|
||||
"with-config exact with-defaults trim",
|
||||
),
|
||||
(
|
||||
'/frr-interface:lib/interface[name="r1-eth0"]/frr-zebra:zebra/evpn-mh',
|
||||
"simple-results/result-intf-eth0-wd-all.json",
|
||||
"with-config exact with-defaults all",
|
||||
),
|
||||
(
|
||||
'/frr-interface:lib/interface[name="r1-eth0"]/frr-zebra:zebra/evpn-mh',
|
||||
"simple-results/result-intf-eth0-wd-all-tag.json",
|
||||
"with-config exact with-defaults all-tag",
|
||||
),
|
||||
]
|
||||
|
||||
r1 = tgen.gears["r1"].net
|
||||
|
464
yang/ietf/ietf-netconf-acm.yang
Normal file
464
yang/ietf/ietf-netconf-acm.yang
Normal file
@ -0,0 +1,464 @@
|
||||
module ietf-netconf-acm {
|
||||
|
||||
namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-acm";
|
||||
|
||||
prefix nacm;
|
||||
|
||||
import ietf-yang-types {
|
||||
prefix yang;
|
||||
}
|
||||
|
||||
organization
|
||||
"IETF NETCONF (Network Configuration) Working Group";
|
||||
|
||||
contact
|
||||
"WG Web: <https://datatracker.ietf.org/wg/netconf/>
|
||||
WG List: <mailto:netconf@ietf.org>
|
||||
|
||||
Author: Andy Bierman
|
||||
<mailto:andy@yumaworks.com>
|
||||
|
||||
Author: Martin Bjorklund
|
||||
<mailto:mbj@tail-f.com>";
|
||||
|
||||
description
|
||||
"Network Configuration Access Control Model.
|
||||
|
||||
Copyright (c) 2012 - 2018 IETF Trust and the persons
|
||||
identified as authors of the code. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, is permitted pursuant to, and subject
|
||||
to the license terms contained in, the Simplified BSD
|
||||
License set forth in Section 4.c of the IETF Trust's
|
||||
Legal Provisions Relating to IETF Documents
|
||||
(https://trustee.ietf.org/license-info).
|
||||
|
||||
This version of this YANG module is part of RFC 8341; see
|
||||
the RFC itself for full legal notices.";
|
||||
|
||||
revision 2018-02-14 {
|
||||
description
|
||||
"Added support for YANG 1.1 actions and notifications tied to
|
||||
data nodes. Clarified how NACM extensions can be used by
|
||||
other data models.";
|
||||
reference
|
||||
"RFC 8341: Network Configuration Access Control Model";
|
||||
}
|
||||
|
||||
revision 2012-02-22 {
|
||||
description
|
||||
"Initial version.";
|
||||
reference
|
||||
"RFC 6536: Network Configuration Protocol (NETCONF)
|
||||
Access Control Model";
|
||||
}
|
||||
|
||||
/*
|
||||
* Extension statements
|
||||
*/
|
||||
|
||||
extension default-deny-write {
|
||||
description
|
||||
"Used to indicate that the data model node
|
||||
represents a sensitive security system parameter.
|
||||
|
||||
If present, the NETCONF server will only allow the designated
|
||||
'recovery session' to have write access to the node. An
|
||||
explicit access control rule is required for all other users.
|
||||
|
||||
If the NACM module is used, then it must be enabled (i.e.,
|
||||
/nacm/enable-nacm object equals 'true'), or this extension
|
||||
is ignored.
|
||||
|
||||
The 'default-deny-write' extension MAY appear within a data
|
||||
definition statement. It is ignored otherwise.";
|
||||
}
|
||||
|
||||
extension default-deny-all {
|
||||
description
|
||||
"Used to indicate that the data model node
|
||||
controls a very sensitive security system parameter.
|
||||
|
||||
If present, the NETCONF server will only allow the designated
|
||||
'recovery session' to have read, write, or execute access to
|
||||
the node. An explicit access control rule is required for all
|
||||
other users.
|
||||
|
||||
If the NACM module is used, then it must be enabled (i.e.,
|
||||
/nacm/enable-nacm object equals 'true'), or this extension
|
||||
is ignored.
|
||||
|
||||
The 'default-deny-all' extension MAY appear within a data
|
||||
definition statement, 'rpc' statement, or 'notification'
|
||||
statement. It is ignored otherwise.";
|
||||
}
|
||||
|
||||
/*
|
||||
* Derived types
|
||||
*/
|
||||
|
||||
typedef user-name-type {
|
||||
type string {
|
||||
length "1..max";
|
||||
}
|
||||
description
|
||||
"General-purpose username string.";
|
||||
}
|
||||
|
||||
typedef matchall-string-type {
|
||||
type string {
|
||||
pattern '\*';
|
||||
}
|
||||
description
|
||||
"The string containing a single asterisk '*' is used
|
||||
to conceptually represent all possible values
|
||||
for the particular leaf using this data type.";
|
||||
}
|
||||
|
||||
typedef access-operations-type {
|
||||
type bits {
|
||||
bit create {
|
||||
description
|
||||
"Any protocol operation that creates a
|
||||
new data node.";
|
||||
}
|
||||
bit read {
|
||||
description
|
||||
"Any protocol operation or notification that
|
||||
returns the value of a data node.";
|
||||
}
|
||||
bit update {
|
||||
description
|
||||
"Any protocol operation that alters an existing
|
||||
data node.";
|
||||
}
|
||||
bit delete {
|
||||
description
|
||||
"Any protocol operation that removes a data node.";
|
||||
}
|
||||
bit exec {
|
||||
description
|
||||
"Execution access to the specified protocol operation.";
|
||||
}
|
||||
}
|
||||
description
|
||||
"Access operation.";
|
||||
}
|
||||
|
||||
typedef group-name-type {
|
||||
type string {
|
||||
length "1..max";
|
||||
pattern '[^\*].*';
|
||||
}
|
||||
description
|
||||
"Name of administrative group to which
|
||||
users can be assigned.";
|
||||
}
|
||||
|
||||
typedef action-type {
|
||||
type enumeration {
|
||||
enum permit {
|
||||
description
|
||||
"Requested action is permitted.";
|
||||
}
|
||||
enum deny {
|
||||
description
|
||||
"Requested action is denied.";
|
||||
}
|
||||
}
|
||||
description
|
||||
"Action taken by the server when a particular
|
||||
rule matches.";
|
||||
}
|
||||
|
||||
typedef node-instance-identifier {
|
||||
type yang:xpath1.0;
|
||||
description
|
||||
"Path expression used to represent a special
|
||||
data node, action, or notification instance-identifier
|
||||
string.
|
||||
|
||||
A node-instance-identifier value is an
|
||||
unrestricted YANG instance-identifier expression.
|
||||
All the same rules as an instance-identifier apply,
|
||||
except that predicates for keys are optional. If a key
|
||||
predicate is missing, then the node-instance-identifier
|
||||
represents all possible server instances for that key.
|
||||
|
||||
This XML Path Language (XPath) expression is evaluated in the
|
||||
following context:
|
||||
|
||||
o The set of namespace declarations are those in scope on
|
||||
the leaf element where this type is used.
|
||||
|
||||
o The set of variable bindings contains one variable,
|
||||
'USER', which contains the name of the user of the
|
||||
current session.
|
||||
|
||||
o The function library is the core function library, but
|
||||
note that due to the syntax restrictions of an
|
||||
instance-identifier, no functions are allowed.
|
||||
|
||||
o The context node is the root node in the data tree.
|
||||
|
||||
The accessible tree includes actions and notifications tied
|
||||
to data nodes.";
|
||||
}
|
||||
|
||||
/*
|
||||
* Data definition statements
|
||||
*/
|
||||
|
||||
container nacm {
|
||||
nacm:default-deny-all;
|
||||
|
||||
description
|
||||
"Parameters for NETCONF access control model.";
|
||||
|
||||
leaf enable-nacm {
|
||||
type boolean;
|
||||
default "true";
|
||||
description
|
||||
"Enables or disables all NETCONF access control
|
||||
enforcement. If 'true', then enforcement
|
||||
is enabled. If 'false', then enforcement
|
||||
is disabled.";
|
||||
}
|
||||
|
||||
leaf read-default {
|
||||
type action-type;
|
||||
default "permit";
|
||||
description
|
||||
"Controls whether read access is granted if
|
||||
no appropriate rule is found for a
|
||||
particular read request.";
|
||||
}
|
||||
|
||||
leaf write-default {
|
||||
type action-type;
|
||||
default "deny";
|
||||
description
|
||||
"Controls whether create, update, or delete access
|
||||
is granted if no appropriate rule is found for a
|
||||
particular write request.";
|
||||
}
|
||||
|
||||
leaf exec-default {
|
||||
type action-type;
|
||||
default "permit";
|
||||
description
|
||||
"Controls whether exec access is granted if no appropriate
|
||||
rule is found for a particular protocol operation request.";
|
||||
}
|
||||
|
||||
leaf enable-external-groups {
|
||||
type boolean;
|
||||
default "true";
|
||||
description
|
||||
"Controls whether the server uses the groups reported by the
|
||||
NETCONF transport layer when it assigns the user to a set of
|
||||
NACM groups. If this leaf has the value 'false', any group
|
||||
names reported by the transport layer are ignored by the
|
||||
server.";
|
||||
}
|
||||
|
||||
leaf denied-operations {
|
||||
type yang:zero-based-counter32;
|
||||
config false;
|
||||
mandatory true;
|
||||
description
|
||||
"Number of times since the server last restarted that a
|
||||
protocol operation request was denied.";
|
||||
}
|
||||
|
||||
leaf denied-data-writes {
|
||||
type yang:zero-based-counter32;
|
||||
config false;
|
||||
mandatory true;
|
||||
description
|
||||
"Number of times since the server last restarted that a
|
||||
protocol operation request to alter
|
||||
a configuration datastore was denied.";
|
||||
}
|
||||
|
||||
leaf denied-notifications {
|
||||
type yang:zero-based-counter32;
|
||||
config false;
|
||||
mandatory true;
|
||||
description
|
||||
"Number of times since the server last restarted that
|
||||
a notification was dropped for a subscription because
|
||||
access to the event type was denied.";
|
||||
}
|
||||
|
||||
container groups {
|
||||
description
|
||||
"NETCONF access control groups.";
|
||||
|
||||
list group {
|
||||
key name;
|
||||
|
||||
description
|
||||
"One NACM group entry. This list will only contain
|
||||
configured entries, not any entries learned from
|
||||
any transport protocols.";
|
||||
|
||||
leaf name {
|
||||
type group-name-type;
|
||||
description
|
||||
"Group name associated with this entry.";
|
||||
}
|
||||
|
||||
leaf-list user-name {
|
||||
type user-name-type;
|
||||
description
|
||||
"Each entry identifies the username of
|
||||
a member of the group associated with
|
||||
this entry.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list rule-list {
|
||||
key name;
|
||||
ordered-by user;
|
||||
description
|
||||
"An ordered collection of access control rules.";
|
||||
|
||||
leaf name {
|
||||
type string {
|
||||
length "1..max";
|
||||
}
|
||||
description
|
||||
"Arbitrary name assigned to the rule-list.";
|
||||
}
|
||||
leaf-list group {
|
||||
type union {
|
||||
type matchall-string-type;
|
||||
type group-name-type;
|
||||
}
|
||||
description
|
||||
"List of administrative groups that will be
|
||||
assigned the associated access rights
|
||||
defined by the 'rule' list.
|
||||
|
||||
The string '*' indicates that all groups apply to the
|
||||
entry.";
|
||||
}
|
||||
|
||||
list rule {
|
||||
key name;
|
||||
ordered-by user;
|
||||
description
|
||||
"One access control rule.
|
||||
|
||||
Rules are processed in user-defined order until a match is
|
||||
found. A rule matches if 'module-name', 'rule-type', and
|
||||
'access-operations' match the request. If a rule
|
||||
matches, the 'action' leaf determines whether or not
|
||||
access is granted.";
|
||||
|
||||
leaf name {
|
||||
type string {
|
||||
length "1..max";
|
||||
}
|
||||
description
|
||||
"Arbitrary name assigned to the rule.";
|
||||
}
|
||||
|
||||
leaf module-name {
|
||||
type union {
|
||||
type matchall-string-type;
|
||||
type string;
|
||||
}
|
||||
default "*";
|
||||
description
|
||||
"Name of the module associated with this rule.
|
||||
|
||||
This leaf matches if it has the value '*' or if the
|
||||
object being accessed is defined in the module with the
|
||||
specified module name.";
|
||||
}
|
||||
choice rule-type {
|
||||
description
|
||||
"This choice matches if all leafs present in the rule
|
||||
match the request. If no leafs are present, the
|
||||
choice matches all requests.";
|
||||
case protocol-operation {
|
||||
leaf rpc-name {
|
||||
type union {
|
||||
type matchall-string-type;
|
||||
type string;
|
||||
}
|
||||
description
|
||||
"This leaf matches if it has the value '*' or if
|
||||
its value equals the requested protocol operation
|
||||
name.";
|
||||
}
|
||||
}
|
||||
case notification {
|
||||
leaf notification-name {
|
||||
type union {
|
||||
type matchall-string-type;
|
||||
type string;
|
||||
}
|
||||
description
|
||||
"This leaf matches if it has the value '*' or if its
|
||||
value equals the requested notification name.";
|
||||
}
|
||||
}
|
||||
|
||||
case data-node {
|
||||
leaf path {
|
||||
type node-instance-identifier;
|
||||
mandatory true;
|
||||
description
|
||||
"Data node instance-identifier associated with the
|
||||
data node, action, or notification controlled by
|
||||
this rule.
|
||||
|
||||
Configuration data or state data
|
||||
instance-identifiers start with a top-level
|
||||
data node. A complete instance-identifier is
|
||||
required for this type of path value.
|
||||
|
||||
The special value '/' refers to all possible
|
||||
datastore contents.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
leaf access-operations {
|
||||
type union {
|
||||
type matchall-string-type;
|
||||
type access-operations-type;
|
||||
}
|
||||
default "*";
|
||||
description
|
||||
"Access operations associated with this rule.
|
||||
|
||||
This leaf matches if it has the value '*' or if the
|
||||
bit corresponding to the requested operation is set.";
|
||||
}
|
||||
|
||||
leaf action {
|
||||
type action-type;
|
||||
mandatory true;
|
||||
description
|
||||
"The access control action associated with the
|
||||
rule. If a rule has been determined to match a
|
||||
particular request, then this object is used
|
||||
to determine whether to permit or deny the
|
||||
request.";
|
||||
}
|
||||
|
||||
leaf comment {
|
||||
type string;
|
||||
description
|
||||
"A textual description of the access rule.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
139
yang/ietf/ietf-netconf-with-defaults.yang
Normal file
139
yang/ietf/ietf-netconf-with-defaults.yang
Normal file
@ -0,0 +1,139 @@
|
||||
module ietf-netconf-with-defaults {
|
||||
|
||||
namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults";
|
||||
|
||||
prefix ncwd;
|
||||
|
||||
import ietf-netconf { prefix nc; }
|
||||
|
||||
organization
|
||||
"IETF NETCONF (Network Configuration Protocol) Working Group";
|
||||
|
||||
contact
|
||||
"WG Web: <http://tools.ietf.org/wg/netconf/>
|
||||
|
||||
WG List: <netconf@ietf.org>
|
||||
|
||||
WG Chair: Bert Wijnen
|
||||
<bertietf@bwijnen.net>
|
||||
|
||||
WG Chair: Mehmet Ersue
|
||||
<mehmet.ersue@nsn.com>
|
||||
|
||||
Editor: Andy Bierman
|
||||
<andy.bierman@brocade.com>
|
||||
|
||||
Editor: Balazs Lengyel
|
||||
<balazs.lengyel@ericsson.com>";
|
||||
|
||||
description
|
||||
"This module defines an extension to the NETCONF protocol
|
||||
that allows the NETCONF client to control how default
|
||||
values are handled by the server in particular NETCONF
|
||||
operations.
|
||||
|
||||
Copyright (c) 2011 IETF Trust and the persons identified as
|
||||
the document authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, is permitted pursuant to, and subject
|
||||
to the license terms contained in, the Simplified BSD License
|
||||
set forth in Section 4.c of the IETF Trust's Legal Provisions
|
||||
Relating to IETF Documents
|
||||
(http://trustee.ietf.org/license-info).
|
||||
|
||||
This version of this YANG module is part of RFC 6243; see
|
||||
the RFC itself for full legal notices.";
|
||||
|
||||
revision 2011-06-01 {
|
||||
description
|
||||
"Initial version.";
|
||||
reference
|
||||
"RFC 6243: With-defaults Capability for NETCONF";
|
||||
}
|
||||
|
||||
typedef with-defaults-mode {
|
||||
description
|
||||
"Possible modes to report default data.";
|
||||
reference
|
||||
"RFC 6243; Section 3.";
|
||||
type enumeration {
|
||||
enum report-all {
|
||||
description
|
||||
"All default data is reported.";
|
||||
reference
|
||||
"RFC 6243; Section 3.1";
|
||||
}
|
||||
enum report-all-tagged {
|
||||
description
|
||||
"All default data is reported.
|
||||
Any nodes considered to be default data
|
||||
will contain a 'default' XML attribute,
|
||||
set to 'true' or '1'.";
|
||||
reference
|
||||
"RFC 6243; Section 3.4";
|
||||
}
|
||||
enum trim {
|
||||
description
|
||||
"Values are not reported if they contain the default.";
|
||||
reference
|
||||
"RFC 6243; Section 3.2";
|
||||
}
|
||||
enum explicit {
|
||||
description
|
||||
"Report values that contain the definition of
|
||||
explicitly set data.";
|
||||
reference
|
||||
"RFC 6243; Section 3.3";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
grouping with-defaults-parameters {
|
||||
description
|
||||
"Contains the <with-defaults> parameter for control
|
||||
of defaults in NETCONF retrieval operations.";
|
||||
|
||||
leaf with-defaults {
|
||||
description
|
||||
"The explicit defaults processing mode requested.";
|
||||
reference
|
||||
"RFC 6243; Section 4.5.1";
|
||||
|
||||
type with-defaults-mode;
|
||||
}
|
||||
}
|
||||
|
||||
// extending the get-config operation
|
||||
augment /nc:get-config/nc:input {
|
||||
description
|
||||
"Adds the <with-defaults> parameter to the
|
||||
input of the NETCONF <get-config> operation.";
|
||||
reference
|
||||
"RFC 6243; Section 4.5.1";
|
||||
|
||||
uses with-defaults-parameters;
|
||||
}
|
||||
|
||||
// extending the get operation
|
||||
augment /nc:get/nc:input {
|
||||
description
|
||||
"Adds the <with-defaults> parameter to
|
||||
the input of the NETCONF <get> operation.";
|
||||
reference
|
||||
"RFC 6243; Section 4.5.1";
|
||||
|
||||
uses with-defaults-parameters;
|
||||
}
|
||||
|
||||
// extending the copy-config operation
|
||||
augment /nc:copy-config/nc:input {
|
||||
description
|
||||
"Adds the <with-defaults> parameter to
|
||||
the input of the NETCONF <copy-config> operation.";
|
||||
reference
|
||||
"RFC 6243; Section 4.5.1";
|
||||
|
||||
uses with-defaults-parameters;
|
||||
}
|
||||
}
|
933
yang/ietf/ietf-netconf.yang
Normal file
933
yang/ietf/ietf-netconf.yang
Normal file
@ -0,0 +1,933 @@
|
||||
module ietf-netconf {
|
||||
|
||||
// the namespace for NETCONF XML definitions is unchanged
|
||||
// from RFC 4741, which this document replaces
|
||||
namespace "urn:ietf:params:xml:ns:netconf:base:1.0";
|
||||
|
||||
prefix nc;
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix inet;
|
||||
}
|
||||
|
||||
import ietf-netconf-acm { prefix nacm; }
|
||||
|
||||
organization
|
||||
"IETF NETCONF (Network Configuration) Working Group";
|
||||
|
||||
contact
|
||||
"WG Web: <http://tools.ietf.org/wg/netconf/>
|
||||
WG List: <netconf@ietf.org>
|
||||
|
||||
WG Chair: Bert Wijnen
|
||||
<bertietf@bwijnen.net>
|
||||
|
||||
WG Chair: Mehmet Ersue
|
||||
<mehmet.ersue@nsn.com>
|
||||
|
||||
Editor: Martin Bjorklund
|
||||
<mbj@tail-f.com>
|
||||
|
||||
Editor: Juergen Schoenwaelder
|
||||
<j.schoenwaelder@jacobs-university.de>
|
||||
|
||||
Editor: Andy Bierman
|
||||
<andy.bierman@brocade.com>";
|
||||
description
|
||||
"NETCONF Protocol Data Types and Protocol Operations.
|
||||
|
||||
Copyright (c) 2011 IETF Trust and the persons identified as
|
||||
the document authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, is permitted pursuant to, and subject
|
||||
to the license terms contained in, the Simplified BSD License
|
||||
set forth in Section 4.c of the IETF Trust's Legal Provisions
|
||||
Relating to IETF Documents
|
||||
(http://trustee.ietf.org/license-info).
|
||||
|
||||
This version of this YANG module is part of RFC 6241; see
|
||||
the RFC itself for full legal notices.";
|
||||
|
||||
revision 2011-06-01 {
|
||||
description
|
||||
"Initial revision;
|
||||
2013-09-29: Updated to include NACM attributes,
|
||||
as specified in RFC 6536: sec 3.2.5 and 3.2.8";
|
||||
reference
|
||||
"RFC 6241: Network Configuration Protocol";
|
||||
}
|
||||
|
||||
extension get-filter-element-attributes {
|
||||
description
|
||||
"If this extension is present within an 'anyxml'
|
||||
statement named 'filter', which must be conceptually
|
||||
defined within the RPC input section for the <get>
|
||||
and <get-config> protocol operations, then the
|
||||
following unqualified XML attribute is supported
|
||||
within the <filter> element, within a <get> or
|
||||
<get-config> protocol operation:
|
||||
|
||||
type : optional attribute with allowed
|
||||
value strings 'subtree' and 'xpath'.
|
||||
If missing, the default value is 'subtree'.
|
||||
|
||||
If the 'xpath' feature is supported, then the
|
||||
following unqualified XML attribute is
|
||||
also supported:
|
||||
|
||||
select: optional attribute containing a
|
||||
string representing an XPath expression.
|
||||
The 'type' attribute must be equal to 'xpath'
|
||||
if this attribute is present.";
|
||||
}
|
||||
|
||||
// NETCONF capabilities defined as features
|
||||
feature writable-running {
|
||||
description
|
||||
"NETCONF :writable-running capability;
|
||||
If the server advertises the :writable-running
|
||||
capability for a session, then this feature must
|
||||
also be enabled for that session. Otherwise,
|
||||
this feature must not be enabled.";
|
||||
reference "RFC 6241, Section 8.2";
|
||||
}
|
||||
|
||||
feature candidate {
|
||||
description
|
||||
"NETCONF :candidate capability;
|
||||
If the server advertises the :candidate
|
||||
capability for a session, then this feature must
|
||||
also be enabled for that session. Otherwise,
|
||||
this feature must not be enabled.";
|
||||
reference "RFC 6241, Section 8.3";
|
||||
}
|
||||
|
||||
feature confirmed-commit {
|
||||
if-feature candidate;
|
||||
description
|
||||
"NETCONF :confirmed-commit:1.1 capability;
|
||||
If the server advertises the :confirmed-commit:1.1
|
||||
capability for a session, then this feature must
|
||||
also be enabled for that session. Otherwise,
|
||||
this feature must not be enabled.";
|
||||
|
||||
reference "RFC 6241, Section 8.4";
|
||||
}
|
||||
|
||||
feature rollback-on-error {
|
||||
description
|
||||
"NETCONF :rollback-on-error capability;
|
||||
If the server advertises the :rollback-on-error
|
||||
capability for a session, then this feature must
|
||||
also be enabled for that session. Otherwise,
|
||||
this feature must not be enabled.";
|
||||
reference "RFC 6241, Section 8.5";
|
||||
}
|
||||
|
||||
feature validate {
|
||||
description
|
||||
"NETCONF :validate:1.1 capability;
|
||||
If the server advertises the :validate:1.1
|
||||
capability for a session, then this feature must
|
||||
also be enabled for that session. Otherwise,
|
||||
this feature must not be enabled.";
|
||||
reference "RFC 6241, Section 8.6";
|
||||
}
|
||||
|
||||
feature startup {
|
||||
description
|
||||
"NETCONF :startup capability;
|
||||
If the server advertises the :startup
|
||||
capability for a session, then this feature must
|
||||
also be enabled for that session. Otherwise,
|
||||
this feature must not be enabled.";
|
||||
reference "RFC 6241, Section 8.7";
|
||||
}
|
||||
|
||||
feature url {
|
||||
description
|
||||
"NETCONF :url capability;
|
||||
If the server advertises the :url
|
||||
capability for a session, then this feature must
|
||||
also be enabled for that session. Otherwise,
|
||||
this feature must not be enabled.";
|
||||
reference "RFC 6241, Section 8.8";
|
||||
}
|
||||
|
||||
feature xpath {
|
||||
description
|
||||
"NETCONF :xpath capability;
|
||||
If the server advertises the :xpath
|
||||
capability for a session, then this feature must
|
||||
also be enabled for that session. Otherwise,
|
||||
this feature must not be enabled.";
|
||||
reference "RFC 6241, Section 8.9";
|
||||
}
|
||||
|
||||
// NETCONF Simple Types
|
||||
|
||||
typedef session-id-type {
|
||||
type uint32 {
|
||||
range "1..max";
|
||||
}
|
||||
description
|
||||
"NETCONF Session Id";
|
||||
}
|
||||
|
||||
typedef session-id-or-zero-type {
|
||||
type uint32;
|
||||
description
|
||||
"NETCONF Session Id or Zero to indicate none";
|
||||
}
|
||||
typedef error-tag-type {
|
||||
type enumeration {
|
||||
enum in-use {
|
||||
description
|
||||
"The request requires a resource that
|
||||
already is in use.";
|
||||
}
|
||||
enum invalid-value {
|
||||
description
|
||||
"The request specifies an unacceptable value for one
|
||||
or more parameters.";
|
||||
}
|
||||
enum too-big {
|
||||
description
|
||||
"The request or response (that would be generated) is
|
||||
too large for the implementation to handle.";
|
||||
}
|
||||
enum missing-attribute {
|
||||
description
|
||||
"An expected attribute is missing.";
|
||||
}
|
||||
enum bad-attribute {
|
||||
description
|
||||
"An attribute value is not correct; e.g., wrong type,
|
||||
out of range, pattern mismatch.";
|
||||
}
|
||||
enum unknown-attribute {
|
||||
description
|
||||
"An unexpected attribute is present.";
|
||||
}
|
||||
enum missing-element {
|
||||
description
|
||||
"An expected element is missing.";
|
||||
}
|
||||
enum bad-element {
|
||||
description
|
||||
"An element value is not correct; e.g., wrong type,
|
||||
out of range, pattern mismatch.";
|
||||
}
|
||||
enum unknown-element {
|
||||
description
|
||||
"An unexpected element is present.";
|
||||
}
|
||||
enum unknown-namespace {
|
||||
description
|
||||
"An unexpected namespace is present.";
|
||||
}
|
||||
enum access-denied {
|
||||
description
|
||||
"Access to the requested protocol operation or
|
||||
data model is denied because authorization failed.";
|
||||
}
|
||||
enum lock-denied {
|
||||
description
|
||||
"Access to the requested lock is denied because the
|
||||
lock is currently held by another entity.";
|
||||
}
|
||||
enum resource-denied {
|
||||
description
|
||||
"Request could not be completed because of
|
||||
insufficient resources.";
|
||||
}
|
||||
enum rollback-failed {
|
||||
description
|
||||
"Request to roll back some configuration change (via
|
||||
rollback-on-error or <discard-changes> operations)
|
||||
was not completed for some reason.";
|
||||
|
||||
}
|
||||
enum data-exists {
|
||||
description
|
||||
"Request could not be completed because the relevant
|
||||
data model content already exists. For example,
|
||||
a 'create' operation was attempted on data that
|
||||
already exists.";
|
||||
}
|
||||
enum data-missing {
|
||||
description
|
||||
"Request could not be completed because the relevant
|
||||
data model content does not exist. For example,
|
||||
a 'delete' operation was attempted on
|
||||
data that does not exist.";
|
||||
}
|
||||
enum operation-not-supported {
|
||||
description
|
||||
"Request could not be completed because the requested
|
||||
operation is not supported by this implementation.";
|
||||
}
|
||||
enum operation-failed {
|
||||
description
|
||||
"Request could not be completed because the requested
|
||||
operation failed for some reason not covered by
|
||||
any other error condition.";
|
||||
}
|
||||
enum partial-operation {
|
||||
description
|
||||
"This error-tag is obsolete, and SHOULD NOT be sent
|
||||
by servers conforming to this document.";
|
||||
}
|
||||
enum malformed-message {
|
||||
description
|
||||
"A message could not be handled because it failed to
|
||||
be parsed correctly. For example, the message is not
|
||||
well-formed XML or it uses an invalid character set.";
|
||||
}
|
||||
}
|
||||
description "NETCONF Error Tag";
|
||||
reference "RFC 6241, Appendix A";
|
||||
}
|
||||
|
||||
typedef error-severity-type {
|
||||
type enumeration {
|
||||
enum error {
|
||||
description "Error severity";
|
||||
}
|
||||
enum warning {
|
||||
description "Warning severity";
|
||||
}
|
||||
}
|
||||
description "NETCONF Error Severity";
|
||||
reference "RFC 6241, Section 4.3";
|
||||
}
|
||||
|
||||
typedef edit-operation-type {
|
||||
type enumeration {
|
||||
enum merge {
|
||||
description
|
||||
"The configuration data identified by the
|
||||
element containing this attribute is merged
|
||||
with the configuration at the corresponding
|
||||
level in the configuration datastore identified
|
||||
by the target parameter.";
|
||||
}
|
||||
enum replace {
|
||||
description
|
||||
"The configuration data identified by the element
|
||||
containing this attribute replaces any related
|
||||
configuration in the configuration datastore
|
||||
identified by the target parameter. If no such
|
||||
configuration data exists in the configuration
|
||||
datastore, it is created. Unlike a
|
||||
<copy-config> operation, which replaces the
|
||||
entire target configuration, only the configuration
|
||||
actually present in the config parameter is affected.";
|
||||
}
|
||||
enum create {
|
||||
description
|
||||
"The configuration data identified by the element
|
||||
containing this attribute is added to the
|
||||
configuration if and only if the configuration
|
||||
data does not already exist in the configuration
|
||||
datastore. If the configuration data exists, an
|
||||
<rpc-error> element is returned with an
|
||||
<error-tag> value of 'data-exists'.";
|
||||
}
|
||||
enum delete {
|
||||
description
|
||||
"The configuration data identified by the element
|
||||
containing this attribute is deleted from the
|
||||
configuration if and only if the configuration
|
||||
data currently exists in the configuration
|
||||
datastore. If the configuration data does not
|
||||
exist, an <rpc-error> element is returned with
|
||||
an <error-tag> value of 'data-missing'.";
|
||||
}
|
||||
enum remove {
|
||||
description
|
||||
"The configuration data identified by the element
|
||||
containing this attribute is deleted from the
|
||||
configuration if the configuration
|
||||
data currently exists in the configuration
|
||||
datastore. If the configuration data does not
|
||||
exist, the 'remove' operation is silently ignored
|
||||
by the server.";
|
||||
}
|
||||
}
|
||||
default "merge";
|
||||
description "NETCONF 'operation' attribute values";
|
||||
reference "RFC 6241, Section 7.2";
|
||||
}
|
||||
|
||||
// NETCONF Standard Protocol Operations
|
||||
|
||||
rpc get-config {
|
||||
description
|
||||
"Retrieve all or part of a specified configuration.";
|
||||
|
||||
reference "RFC 6241, Section 7.1";
|
||||
|
||||
input {
|
||||
container source {
|
||||
description
|
||||
"Particular configuration to retrieve.";
|
||||
|
||||
choice config-source {
|
||||
mandatory true;
|
||||
description
|
||||
"The configuration to retrieve.";
|
||||
leaf candidate {
|
||||
if-feature candidate;
|
||||
type empty;
|
||||
description
|
||||
"The candidate configuration is the config source.";
|
||||
}
|
||||
leaf running {
|
||||
type empty;
|
||||
description
|
||||
"The running configuration is the config source.";
|
||||
}
|
||||
leaf startup {
|
||||
if-feature startup;
|
||||
type empty;
|
||||
description
|
||||
"The startup configuration is the config source.
|
||||
This is optional-to-implement on the server because
|
||||
not all servers will support filtering for this
|
||||
datastore.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
anyxml filter {
|
||||
description
|
||||
"Subtree or XPath filter to use.";
|
||||
nc:get-filter-element-attributes;
|
||||
}
|
||||
}
|
||||
|
||||
output {
|
||||
anyxml data {
|
||||
description
|
||||
"Copy of the source datastore subset that matched
|
||||
the filter criteria (if any). An empty data container
|
||||
indicates that the request did not produce any results.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rpc edit-config {
|
||||
description
|
||||
"The <edit-config> operation loads all or part of a specified
|
||||
configuration to the specified target configuration.";
|
||||
|
||||
reference "RFC 6241, Section 7.2";
|
||||
|
||||
input {
|
||||
container target {
|
||||
description
|
||||
"Particular configuration to edit.";
|
||||
|
||||
choice config-target {
|
||||
mandatory true;
|
||||
description
|
||||
"The configuration target.";
|
||||
|
||||
leaf candidate {
|
||||
if-feature candidate;
|
||||
type empty;
|
||||
description
|
||||
"The candidate configuration is the config target.";
|
||||
}
|
||||
leaf running {
|
||||
if-feature writable-running;
|
||||
type empty;
|
||||
description
|
||||
"The running configuration is the config source.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
leaf default-operation {
|
||||
type enumeration {
|
||||
enum merge {
|
||||
description
|
||||
"The default operation is merge.";
|
||||
}
|
||||
enum replace {
|
||||
description
|
||||
"The default operation is replace.";
|
||||
}
|
||||
enum none {
|
||||
description
|
||||
"There is no default operation.";
|
||||
}
|
||||
}
|
||||
default "merge";
|
||||
description
|
||||
"The default operation to use.";
|
||||
}
|
||||
|
||||
leaf test-option {
|
||||
if-feature validate;
|
||||
type enumeration {
|
||||
enum test-then-set {
|
||||
description
|
||||
"The server will test and then set if no errors.";
|
||||
}
|
||||
enum set {
|
||||
description
|
||||
"The server will set without a test first.";
|
||||
}
|
||||
|
||||
enum test-only {
|
||||
description
|
||||
"The server will only test and not set, even
|
||||
if there are no errors.";
|
||||
}
|
||||
}
|
||||
default "test-then-set";
|
||||
description
|
||||
"The test option to use.";
|
||||
}
|
||||
|
||||
leaf error-option {
|
||||
type enumeration {
|
||||
enum stop-on-error {
|
||||
description
|
||||
"The server will stop on errors.";
|
||||
}
|
||||
enum continue-on-error {
|
||||
description
|
||||
"The server may continue on errors.";
|
||||
}
|
||||
enum rollback-on-error {
|
||||
description
|
||||
"The server will roll back on errors.
|
||||
This value can only be used if the 'rollback-on-error'
|
||||
feature is supported.";
|
||||
}
|
||||
}
|
||||
default "stop-on-error";
|
||||
description
|
||||
"The error option to use.";
|
||||
}
|
||||
|
||||
choice edit-content {
|
||||
mandatory true;
|
||||
description
|
||||
"The content for the edit operation.";
|
||||
|
||||
anyxml config {
|
||||
description
|
||||
"Inline Config content.";
|
||||
}
|
||||
leaf url {
|
||||
if-feature url;
|
||||
type inet:uri;
|
||||
description
|
||||
"URL-based config content.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rpc copy-config {
|
||||
description
|
||||
"Create or replace an entire configuration datastore with the
|
||||
contents of another complete configuration datastore.";
|
||||
|
||||
reference "RFC 6241, Section 7.3";
|
||||
|
||||
input {
|
||||
container target {
|
||||
description
|
||||
"Particular configuration to copy to.";
|
||||
|
||||
choice config-target {
|
||||
mandatory true;
|
||||
description
|
||||
"The configuration target of the copy operation.";
|
||||
|
||||
leaf candidate {
|
||||
if-feature candidate;
|
||||
type empty;
|
||||
description
|
||||
"The candidate configuration is the config target.";
|
||||
}
|
||||
leaf running {
|
||||
if-feature writable-running;
|
||||
type empty;
|
||||
description
|
||||
"The running configuration is the config target.
|
||||
This is optional-to-implement on the server.";
|
||||
}
|
||||
leaf startup {
|
||||
if-feature startup;
|
||||
type empty;
|
||||
description
|
||||
"The startup configuration is the config target.";
|
||||
}
|
||||
leaf url {
|
||||
if-feature url;
|
||||
type inet:uri;
|
||||
description
|
||||
"The URL-based configuration is the config target.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
container source {
|
||||
description
|
||||
"Particular configuration to copy from.";
|
||||
|
||||
choice config-source {
|
||||
mandatory true;
|
||||
description
|
||||
"The configuration source for the copy operation.";
|
||||
|
||||
leaf candidate {
|
||||
if-feature candidate;
|
||||
type empty;
|
||||
description
|
||||
"The candidate configuration is the config source.";
|
||||
}
|
||||
leaf running {
|
||||
type empty;
|
||||
description
|
||||
"The running configuration is the config source.";
|
||||
}
|
||||
leaf startup {
|
||||
if-feature startup;
|
||||
type empty;
|
||||
description
|
||||
"The startup configuration is the config source.";
|
||||
}
|
||||
leaf url {
|
||||
if-feature url;
|
||||
type inet:uri;
|
||||
description
|
||||
"The URL-based configuration is the config source.";
|
||||
}
|
||||
anyxml config {
|
||||
description
|
||||
"Inline Config content: <config> element. Represents
|
||||
an entire configuration datastore, not
|
||||
a subset of the running datastore.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rpc delete-config {
|
||||
nacm:default-deny-all;
|
||||
description
|
||||
"Delete a configuration datastore.";
|
||||
|
||||
reference "RFC 6241, Section 7.4";
|
||||
|
||||
input {
|
||||
container target {
|
||||
description
|
||||
"Particular configuration to delete.";
|
||||
|
||||
choice config-target {
|
||||
mandatory true;
|
||||
description
|
||||
"The configuration target to delete.";
|
||||
|
||||
leaf startup {
|
||||
if-feature startup;
|
||||
type empty;
|
||||
description
|
||||
"The startup configuration is the config target.";
|
||||
}
|
||||
leaf url {
|
||||
if-feature url;
|
||||
type inet:uri;
|
||||
description
|
||||
"The URL-based configuration is the config target.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rpc lock {
|
||||
description
|
||||
"The lock operation allows the client to lock the configuration
|
||||
system of a device.";
|
||||
|
||||
reference "RFC 6241, Section 7.5";
|
||||
|
||||
input {
|
||||
container target {
|
||||
description
|
||||
"Particular configuration to lock.";
|
||||
|
||||
choice config-target {
|
||||
mandatory true;
|
||||
description
|
||||
"The configuration target to lock.";
|
||||
|
||||
leaf candidate {
|
||||
if-feature candidate;
|
||||
type empty;
|
||||
description
|
||||
"The candidate configuration is the config target.";
|
||||
}
|
||||
leaf running {
|
||||
type empty;
|
||||
description
|
||||
"The running configuration is the config target.";
|
||||
}
|
||||
leaf startup {
|
||||
if-feature startup;
|
||||
type empty;
|
||||
description
|
||||
"The startup configuration is the config target.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rpc unlock {
|
||||
description
|
||||
"The unlock operation is used to release a configuration lock,
|
||||
previously obtained with the 'lock' operation.";
|
||||
|
||||
reference "RFC 6241, Section 7.6";
|
||||
|
||||
input {
|
||||
container target {
|
||||
description
|
||||
"Particular configuration to unlock.";
|
||||
|
||||
choice config-target {
|
||||
mandatory true;
|
||||
description
|
||||
"The configuration target to unlock.";
|
||||
|
||||
leaf candidate {
|
||||
if-feature candidate;
|
||||
type empty;
|
||||
description
|
||||
"The candidate configuration is the config target.";
|
||||
}
|
||||
leaf running {
|
||||
type empty;
|
||||
description
|
||||
"The running configuration is the config target.";
|
||||
}
|
||||
leaf startup {
|
||||
if-feature startup;
|
||||
type empty;
|
||||
description
|
||||
"The startup configuration is the config target.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rpc get {
|
||||
description
|
||||
"Retrieve running configuration and device state information.";
|
||||
|
||||
reference "RFC 6241, Section 7.7";
|
||||
|
||||
input {
|
||||
anyxml filter {
|
||||
description
|
||||
"This parameter specifies the portion of the system
|
||||
configuration and state data to retrieve.";
|
||||
nc:get-filter-element-attributes;
|
||||
}
|
||||
}
|
||||
|
||||
output {
|
||||
anyxml data {
|
||||
description
|
||||
"Copy of the running datastore subset and/or state
|
||||
data that matched the filter criteria (if any).
|
||||
An empty data container indicates that the request did not
|
||||
produce any results.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rpc close-session {
|
||||
description
|
||||
"Request graceful termination of a NETCONF session.";
|
||||
|
||||
reference "RFC 6241, Section 7.8";
|
||||
}
|
||||
|
||||
rpc kill-session {
|
||||
nacm:default-deny-all;
|
||||
description
|
||||
"Force the termination of a NETCONF session.";
|
||||
|
||||
reference "RFC 6241, Section 7.9";
|
||||
|
||||
input {
|
||||
leaf session-id {
|
||||
type session-id-type;
|
||||
mandatory true;
|
||||
description
|
||||
"Particular session to kill.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rpc commit {
|
||||
if-feature candidate;
|
||||
|
||||
description
|
||||
"Commit the candidate configuration as the device's new
|
||||
current configuration.";
|
||||
|
||||
reference "RFC 6241, Section 8.3.4.1";
|
||||
|
||||
input {
|
||||
leaf confirmed {
|
||||
if-feature confirmed-commit;
|
||||
type empty;
|
||||
description
|
||||
"Requests a confirmed commit.";
|
||||
reference "RFC 6241, Section 8.3.4.1";
|
||||
}
|
||||
|
||||
leaf confirm-timeout {
|
||||
if-feature confirmed-commit;
|
||||
type uint32 {
|
||||
range "1..max";
|
||||
}
|
||||
units "seconds";
|
||||
default "600"; // 10 minutes
|
||||
description
|
||||
"The timeout interval for a confirmed commit.";
|
||||
reference "RFC 6241, Section 8.3.4.1";
|
||||
}
|
||||
|
||||
leaf persist {
|
||||
if-feature confirmed-commit;
|
||||
type string;
|
||||
description
|
||||
"This parameter is used to make a confirmed commit
|
||||
persistent. A persistent confirmed commit is not aborted
|
||||
if the NETCONF session terminates. The only way to abort
|
||||
a persistent confirmed commit is to let the timer expire,
|
||||
or to use the <cancel-commit> operation.
|
||||
|
||||
The value of this parameter is a token that must be given
|
||||
in the 'persist-id' parameter of <commit> or
|
||||
<cancel-commit> operations in order to confirm or cancel
|
||||
the persistent confirmed commit.
|
||||
|
||||
The token should be a random string.";
|
||||
reference "RFC 6241, Section 8.3.4.1";
|
||||
}
|
||||
|
||||
leaf persist-id {
|
||||
if-feature confirmed-commit;
|
||||
type string;
|
||||
description
|
||||
"This parameter is given in order to commit a persistent
|
||||
confirmed commit. The value must be equal to the value
|
||||
given in the 'persist' parameter to the <commit> operation.
|
||||
If it does not match, the operation fails with an
|
||||
'invalid-value' error.";
|
||||
reference "RFC 6241, Section 8.3.4.1";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
rpc discard-changes {
|
||||
if-feature candidate;
|
||||
|
||||
description
|
||||
"Revert the candidate configuration to the current
|
||||
running configuration.";
|
||||
reference "RFC 6241, Section 8.3.4.2";
|
||||
}
|
||||
|
||||
rpc cancel-commit {
|
||||
if-feature confirmed-commit;
|
||||
description
|
||||
"This operation is used to cancel an ongoing confirmed commit.
|
||||
If the confirmed commit is persistent, the parameter
|
||||
'persist-id' must be given, and it must match the value of the
|
||||
'persist' parameter.";
|
||||
reference "RFC 6241, Section 8.4.4.1";
|
||||
|
||||
input {
|
||||
leaf persist-id {
|
||||
type string;
|
||||
description
|
||||
"This parameter is given in order to cancel a persistent
|
||||
confirmed commit. The value must be equal to the value
|
||||
given in the 'persist' parameter to the <commit> operation.
|
||||
If it does not match, the operation fails with an
|
||||
'invalid-value' error.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rpc validate {
|
||||
if-feature validate;
|
||||
|
||||
description
|
||||
"Validates the contents of the specified configuration.";
|
||||
|
||||
reference "RFC 6241, Section 8.6.4.1";
|
||||
|
||||
input {
|
||||
container source {
|
||||
description
|
||||
"Particular configuration to validate.";
|
||||
|
||||
choice config-source {
|
||||
mandatory true;
|
||||
description
|
||||
"The configuration source to validate.";
|
||||
|
||||
leaf candidate {
|
||||
if-feature candidate;
|
||||
type empty;
|
||||
description
|
||||
"The candidate configuration is the config source.";
|
||||
}
|
||||
leaf running {
|
||||
type empty;
|
||||
description
|
||||
"The running configuration is the config source.";
|
||||
}
|
||||
leaf startup {
|
||||
if-feature startup;
|
||||
type empty;
|
||||
description
|
||||
"The startup configuration is the config source.";
|
||||
}
|
||||
leaf url {
|
||||
if-feature url;
|
||||
type inet:uri;
|
||||
description
|
||||
"The URL-based configuration is the config source.";
|
||||
}
|
||||
anyxml config {
|
||||
description
|
||||
"Inline Config content: <config> element. Represents
|
||||
an entire configuration datastore, not
|
||||
a subset of the running datastore.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -38,6 +38,9 @@ dist_yangmodels_DATA += yang/frr-routing.yang
|
||||
dist_yangmodels_DATA += yang/ietf/ietf-routing-types.yang
|
||||
dist_yangmodels_DATA += yang/ietf/ietf-interfaces.yang
|
||||
dist_yangmodels_DATA += yang/ietf/ietf-bgp-types.yang
|
||||
dist_yangmodels_DATA += yang/ietf/ietf-netconf-acm.yang
|
||||
dist_yangmodels_DATA += yang/ietf/ietf-netconf.yang
|
||||
dist_yangmodels_DATA += yang/ietf/ietf-netconf-with-defaults.yang
|
||||
|
||||
if BFDD
|
||||
dist_yangmodels_DATA += yang/frr-bfdd.yang
|
||||
|
Loading…
Reference in New Issue
Block a user