diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-11-29 16:07:18 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2019-11-29 16:07:18 +0000 |
commit | cab84f5cff3487e9a53093d412b0ec9f09551ff2 (patch) | |
tree | 881d9c8eacf33fab0e51860ad14ade7c0b8b5875 /ctrl/sysrepo-plugins/hicn-light/plugin/model | |
parent | fbd866f9abc43217f7d214907d784f75f1db6175 (diff) | |
parent | 7981b901c43848d3b923ec49515b28a75ab984e3 (diff) |
Merge "[HICN-403] update vapi communication with vpp"
Diffstat (limited to 'ctrl/sysrepo-plugins/hicn-light/plugin/model')
-rw-r--r-- | ctrl/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c | 54 |
1 files changed, 23 insertions, 31 deletions
diff --git a/ctrl/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c b/ctrl/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c index 6f8ece08c..47e07d196 100644 --- a/ctrl/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c +++ b/ctrl/sysrepo-plugins/hicn-light/plugin/model/hicn_model.c @@ -28,11 +28,10 @@ /** * @brief API to add hicn face ip in hicn-light. */ -static int hicn_face_ip_add_cb(const char *xpath, const sr_val_t *input, - const size_t input_cnt, sr_val_t **output, - size_t *output_cnt, void *private_ctx) { +static int hicn_face_ip_add_cb(sr_session_ctx_t *session, const char *path, const sr_val_t *input, const size_t input_cnt, + sr_event_t event, uint32_t request_id, sr_val_t **output, size_t *output_cnt, void *private_data) { - SRP_LOG_DBG_MSG("hicn face ip add received successfully"); + SRP_LOG_DBGMSG("hicn face ip add received successfully"); hc_face_t face; if(strcmp(input[0].data.string_val,"-1")){ @@ -51,7 +50,7 @@ static int hicn_face_ip_add_cb(const char *xpath, const sr_val_t *input, face.face.local_addr.v6.as_in6addr = *dst; }else{ - SRP_LOG_DBG_MSG("Invalid local IP address"); + SRP_LOG_DBGMSG("Invalid local IP address"); return SR_ERR_OPERATION_FAILED; } @@ -72,12 +71,11 @@ static int hicn_face_ip_add_cb(const char *xpath, const sr_val_t *input, face.face.remote_addr.v6.as_in6addr = *dst; }else{ - SRP_LOG_DBG_MSG("Invalid local IP address"); + SRP_LOG_DBGMSG("Invalid local IP address"); return SR_ERR_OPERATION_FAILED; } - // strncpy(face.face.hicn.netdevice.name,"ens39"); // Can we work only with Idx number ? face.face.netdevice.index = input[4].data.uint32_val; // This is the idx number of interface @@ -88,34 +86,29 @@ static int hicn_face_ip_add_cb(const char *xpath, const sr_val_t *input, int rc; rc = hc_face_create(hsocket, &face); if (rc > 0) { - SRP_LOG_DBG_MSG("Face added successfully"); + SRP_LOG_DBGMSG("Face added successfully"); return SR_ERR_OK; } - SRP_LOG_DBG_MSG("Operation Failed"); + SRP_LOG_DBGMSG("Operation Failed"); return SR_ERR_OPERATION_FAILED; } /** * @brief API to del hicn face ip in vpp. */ -static int hicn_face_ip_del_cb(const char *xpath, const sr_val_t *input, - const size_t input_cnt, sr_val_t **output, - size_t *output_cnt, void *private_ctx) { +static int hicn_face_ip_del_cb(sr_session_ctx_t *session, const char *path, const sr_val_t *input, const size_t input_cnt, + sr_event_t event, uint32_t request_id, sr_val_t **output, size_t *output_cnt, void *private_data) { - SRP_LOG_DBG_MSG("hicn face ip del received successfully"); + SRP_LOG_DBGMSG("hicn face ip del received successfully"); face_t * face=NULL; - // msg->payload.faceid = input[0].data.uint16_val; - //lookup(face); + face_free(face); - // if(!resp->payload.retval){ - // SRP_LOG_DBG_MSG("Successfully Done"); - // return SR_ERR_OK; - // } - SRP_LOG_DBG_MSG("Operation Failed"); + + SRP_LOG_DBGMSG("Operation Failed"); return SR_ERR_OPERATION_FAILED; } @@ -124,9 +117,8 @@ static int hicn_face_ip_del_cb(const char *xpath, const sr_val_t *input, /** * @brief API to del hicn face ip in vpp. */ -static int hicn_route_add_cb(const char *xpath, const sr_val_t *input, - const size_t input_cnt, sr_val_t **output, - size_t *output_cnt, void *private_ctx) { +static int hicn_route_add_cb(sr_session_ctx_t *session, const char *path, const sr_val_t *input, const size_t input_cnt, + sr_event_t event, uint32_t request_id, sr_val_t **output, size_t *output_cnt, void *private_data) { /* @@ -169,34 +161,34 @@ int hicn_subscribe_events(sr_session_ctx_t *session, int rc; rc = sr_rpc_subscribe(session, "/hicn:face-ip-add", hicn_face_ip_add_cb, - session, SR_SUBSCR_CTX_REUSE, subscription); + session, 100,SR_SUBSCR_CTX_REUSE, subscription); if (rc != SR_ERR_OK) { - SRP_LOG_DBG_MSG("Problem in subscription stat-get\n"); + SRP_LOG_DBGMSG("Problem in subscription stat-get\n"); goto error; } rc = sr_rpc_subscribe(session, "/hicn:face-ip-del", hicn_face_ip_del_cb, - session, SR_SUBSCR_CTX_REUSE, subscription); + session, 100,SR_SUBSCR_CTX_REUSE, subscription); if (rc != SR_ERR_OK) { - SRP_LOG_DBG_MSG("Problem in subscription face-ip-del\n"); + SRP_LOG_DBGMSG("Problem in subscription face-ip-del\n"); goto error; } rc = sr_rpc_subscribe(session, "/hicn:route-nhops-add", - hicn_route_add_cb, session, SR_SUBSCR_CTX_REUSE, subscription); + hicn_route_add_cb, session, 100,SR_SUBSCR_CTX_REUSE, subscription); if (rc!= SR_ERR_OK) { - SRP_LOG_DBG_MSG("Problem in subscription route-nhops-add\n"); + SRP_LOG_DBGMSG("Problem in subscription route-nhops-add\n"); goto error; } - SRP_LOG_INF_MSG("hicn light initialized successfully."); + SRP_LOG_DBGMSG("hicn light initialized successfully."); return SR_ERR_OK; error: - SRP_LOG_ERR_MSG("Error by initialization of the hicn plugin."); + SRP_LOG_ERRMSG("Error by initialization of the hicn plugin."); sr_plugin_cleanup_cb(session, hsocket); return rc; |