@@ -842,10 +842,16 @@ static void fe_session_handle_get_data(struct mgmt_fe_session_ctx *session, void
842842 "Error getting yang-library data, session-id: %" PRIu64
843843 " error: %s" ,
844844 session -> session_id , ly_last_errmsg ());
845+ goto done ;
845846 } else if (nb_oper_is_yang_lib_query (msg -> xpath )) {
847+ struct lyd_node * result ;
848+
846849 yang_lyd_trim_xpath (& ylib , msg -> xpath );
850+ result = ylib ;
851+ if (CHECK_FLAG (msg -> flags , GET_DATA_FLAG_EXACT ))
852+ result = yang_dnode_get (result , msg -> xpath );
847853 (void )fe_session_send_tree_data (session , req_id , false, msg -> result_type ,
848- wd_options , ylib , 0 );
854+ wd_options , result , 0 );
849855 goto done ;
850856 }
851857 }
@@ -1241,7 +1247,8 @@ static void fe_session_handle_notify_select(struct mgmt_fe_session_ctx *session,
12411247/* ----------- */
12421248
12431249static int fe_session_send_rpc_reply (struct mgmt_fe_session_ctx * session , uint64_t req_id ,
1244- uint8_t result_type , const struct lyd_node * result )
1250+ uint8_t result_type , bool restconf ,
1251+ const struct lyd_node * result )
12451252{
12461253 struct mgmt_msg_rpc_reply * msg ;
12471254 uint8_t * * darrp = NULL ;
@@ -1252,6 +1259,7 @@ static int fe_session_send_rpc_reply(struct mgmt_fe_session_ctx *session, uint64
12521259 msg -> req_id = req_id ;
12531260 msg -> code = MGMT_MSG_CODE_RPC_REPLY ;
12541261 msg -> result_type = result_type ;
1262+ msg -> restconf = restconf ;
12551263
12561264 if (result ) {
12571265 darrp = mgmt_msg_native_get_darrp (msg );
@@ -1276,7 +1284,8 @@ static int fe_session_send_rpc_reply(struct mgmt_fe_session_ctx *session, uint64
12761284}
12771285
12781286void mgmt_fe_adapter_send_rpc_reply (uint64_t session_id , uint64_t txn_id , uint64_t req_id ,
1279- LYD_FORMAT result_type , const struct lyd_node * result )
1287+ LYD_FORMAT result_type , bool restconf ,
1288+ const struct lyd_node * result )
12801289{
12811290 struct mgmt_fe_session_ctx * session ;
12821291
@@ -1287,7 +1296,7 @@ void mgmt_fe_adapter_send_rpc_reply(uint64_t session_id, uint64_t txn_id, uint64
12871296 /* XXXchopps why do we care about this? Why not allow multple? */
12881297 assert (session -> txn_id == txn_id );
12891298
1290- if (fe_session_send_rpc_reply (session , req_id , result_type , result ))
1299+ if (fe_session_send_rpc_reply (session , req_id , result_type , restconf , result ))
12911300 fe_session_send_error (session , req_id , false, - EIO , "Failed sending RPC reply" );
12921301
12931302 mgmt_destroy_txn (& session -> txn_id );
@@ -1354,8 +1363,8 @@ static void fe_session_handle_rpc(struct mgmt_fe_session_ctx *session, void *_ms
13541363 session -> session_id );
13551364
13561365 /* Create an RPC request under the transaction */
1357- mgmt_txn_send_rpc (session -> txn_id , req_id , clients , msg -> request_type , xpath , data ,
1358- mgmt_msg_native_data_len_decode (msg , msg_len ));
1366+ mgmt_txn_send_rpc (session -> txn_id , req_id , clients , msg -> request_type , msg -> restconf ,
1367+ xpath , data , mgmt_msg_native_data_len_decode (msg , msg_len ));
13591368}
13601369
13611370/* -------------------- */
0 commit comments