diff options
author | Andrej Kozemcak <andrej.kozemcak@pantheon.tech> | 2019-02-14 11:53:05 +0100 |
---|---|---|
committer | Andrej Kozemcak <andrej.kozemcak@pantheon.tech> | 2019-02-27 18:11:59 +0100 |
commit | f9393a8c15fbd63b7a0938269afa8a35ddfc4738 (patch) | |
tree | 9748cbe8f618bc79a9f5ff2f709c897dd6c830d8 /src/plugins/openconfig | |
parent | cbe7f2d51006c91a73b9f593802abf5b6a2d5984 (diff) |
Move bapi to scvpp plugin.
Change-Id: I87be68ddad4827d6dfa04aad5ea725efae97157a
Signed-off-by: Andrej Kozemcak <andrej.kozemcak@pantheon.tech>
Diffstat (limited to 'src/plugins/openconfig')
-rw-r--r-- | src/plugins/openconfig/openconfig_interfaces.c | 28 | ||||
-rw-r--r-- | src/plugins/openconfig/openconfig_interfaces.h | 6 | ||||
-rw-r--r-- | src/plugins/openconfig/openconfig_local_routing.c | 26 | ||||
-rw-r--r-- | src/plugins/openconfig/openconfig_local_routing.h | 6 |
4 files changed, 34 insertions, 32 deletions
diff --git a/src/plugins/openconfig/openconfig_interfaces.c b/src/plugins/openconfig/openconfig_interfaces.c index df975b6..e401e07 100644 --- a/src/plugins/openconfig/openconfig_interfaces.c +++ b/src/plugins/openconfig/openconfig_interfaces.c @@ -17,10 +17,8 @@ #include "openconfig_interfaces.h" #include "sys_util.h" #include "sc_vpp_comm.h" - -#include "../bapi/bapi.h" -#include "../bapi/bapi_interface.h" -#include "../bapi/bapi_ip.h" +#include "sc_vpp_interface.h" +#include "sc_vpp_ip.h" #include <assert.h> #include <string.h> @@ -211,7 +209,7 @@ int openconfig_interface_mod_cb( __attribute__((unused)) sr_notif_event_t event, __attribute__((unused)) void *private_ctx) { - SRP_LOG_DBG("Inerafce module subscribe: %s", module_name); + SRP_LOG_INF("Module subscribe: %s", module_name); return SR_ERR_OK; } @@ -437,13 +435,13 @@ static vapi_error_e sysr_sw_interface_dump(sys_sw_interface_dump_ctx * dctx) { ARG_CHECK(VAPI_EINVAL, dctx); - vapi_msg_sw_interface_dump *dump = vapi_alloc_sw_interface_dump(g_vapi_ctx); + vapi_msg_sw_interface_dump *dump = vapi_alloc_sw_interface_dump(g_vapi_ctx_instance); vapi_error_e rv; dump->payload.name_filter_valid = true; strcpy((char*)dump->payload.name_filter, (const char *)dctx->sw_interface_details_query.sw_interface_details.interface_name); - VAPI_CALL(vapi_sw_interface_dump(g_vapi_ctx, dump, sw_interface_dump_vapi_cb, + VAPI_CALL(vapi_sw_interface_dump(g_vapi_ctx_instance, dump, sw_interface_dump_vapi_cb, dctx)); if (VAPI_OK != rv) { @@ -455,7 +453,9 @@ static vapi_error_e sysr_sw_interface_dump(sys_sw_interface_dump_ctx * dctx) int openconfig_interfaces_interfaces_interface_state_cb( const char *xpath, sr_val_t **values, - size_t *values_cnt, uint64_t request_id, + size_t *values_cnt, + __attribute__((unused)) uint64_t request_id, + __attribute__((unused)) const char *original_xpath, __attribute__((unused)) void *private_ctx) { sr_xpath_ctx_t state = {0}; @@ -515,7 +515,7 @@ int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_ return rc; } - char * address_ip = bapi_ntoa(reply->ip); + char * address_ip = sc_ntoa(reply->ip); sr_val_build_xpath(&vals[0], "%s/openconfig-if-ip:ip", sysr_values_ctx->xpath_root); @@ -556,7 +556,7 @@ ip_address_dump_cb (struct vapi_ctx_s *ctx, void *callback_ctx, printf ("ip address dump entry:" "\tsw_if_index[%u]" "\tip[%s/%u]\n" - , reply->sw_if_index, bapi_ntoa(reply->ip), + , reply->sw_if_index, sc_ntoa(reply->ip), reply->prefix_length); openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_ipv4_oc_ip_addresses_oc_ip_address_oc_ip_state_vapi_cb(reply, dctx); @@ -569,6 +569,7 @@ ip_address_dump_cb (struct vapi_ctx_s *ctx, void *callback_ctx, int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_ipv4_oc_ip_addresses_oc_ip_address_oc_ip_state_cb( const char *xpath, sr_val_t **values, size_t *values_cnt, __attribute__((unused)) uint64_t request_id, + __attribute__((unused)) const char *original_xpath, __attribute__((unused)) void *private_ctx) { sr_xpath_ctx_t state = {0}; @@ -619,11 +620,11 @@ int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_ return SR_ERR_INVAL_ARG; } - vapi_msg_ip_address_dump *mp = vapi_alloc_ip_address_dump (g_vapi_ctx); + vapi_msg_ip_address_dump *mp = vapi_alloc_ip_address_dump (g_vapi_ctx_instance); mp->payload.sw_if_index = query.sw_interface_details.sw_if_index; mp->payload.is_ipv6 = 0; - rv = vapi_ip_address_dump(g_vapi_ctx, mp, ip_address_dump_cb, &dctx); + rv = vapi_ip_address_dump(g_vapi_ctx_instance, mp, ip_address_dump_cb, &dctx); if (VAPI_OK != rv) { SRP_LOG_ERR_MSG("VAPI call failed"); @@ -640,6 +641,7 @@ int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_ int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_state_cb( const char *xpath, sr_val_t **values, size_t *values_cnt, __attribute__((unused)) uint64_t request_id, + __attribute__((unused)) const char *original_xpath, __attribute__((unused)) void *private_ctx) { sr_xpath_ctx_t state = {0}; @@ -692,7 +694,7 @@ int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_state_ return SR_ERR_OK; } -VAPI_RETVAL_CB(sw_interface_add_del_address); +// VAPI_RETVAL_CB(sw_interface_add_del_address); static int oi_int_ipv4_conf(const char *interface_name, const char *address_ip, u8 prefix_length, diff --git a/src/plugins/openconfig/openconfig_interfaces.h b/src/plugins/openconfig/openconfig_interfaces.h index e64b3e2..df5e31c 100644 --- a/src/plugins/openconfig/openconfig_interfaces.h +++ b/src/plugins/openconfig/openconfig_interfaces.h @@ -31,15 +31,15 @@ int openconfig_interfaces_interfaces_interface_config_cb( int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_ipv4_oc_ip_addresses_oc_ip_address_oc_ip_state_cb( const char *xpath, sr_val_t **values, size_t *values_cnt, - uint64_t request_id, void *private_ctx); + uint64_t request_id, const char *original_xpath, void *private_ctx); int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_state_cb( const char *xpath, sr_val_t **values, size_t *values_cnt, - uint64_t request_id, void *private_ctx); + uint64_t request_id, const char *original_xpath, void *private_ctx); int openconfig_interfaces_interfaces_interface_state_cb( const char *xpath, sr_val_t **values, size_t *values_cnt, - uint64_t request_id, void *private_ctx); + uint64_t request_id, const char *original_xpath, void *private_ctx); int openconfig_interfaces_interfaces_interface_subinterfaces_subinterface_oc_ip_ipv4_oc_ip_addresses_oc_ip_address_oc_ip_config_cb( sr_session_ctx_t *ds, const char *xpath, sr_notif_event_t event, diff --git a/src/plugins/openconfig/openconfig_local_routing.c b/src/plugins/openconfig/openconfig_local_routing.c index 4c3a0fd..daf39cc 100644 --- a/src/plugins/openconfig/openconfig_local_routing.c +++ b/src/plugins/openconfig/openconfig_local_routing.c @@ -17,10 +17,8 @@ #include "openconfig_local_routing.h" #include "sys_util.h" #include "sc_vpp_comm.h" - -#include "../bapi/bapi.h" -#include "../bapi/bapi_interface.h" -#include "../bapi/bapi_ip.h" +#include "sc_vpp_interface.h" +#include "sc_vpp_ip.h" #include <assert.h> #include <string.h> @@ -420,7 +418,8 @@ bool address_prefix_init(address_prefix_t* address_prefix, char* str_prefix) return false; } - return bapi_aton(str_prefix, address_prefix->address); + return sc_aton(str_prefix, address_prefix->address, + sizeof(address_prefix->address)); } // XPATH: /openconfig-local-routing:local-routes/static-routes/static/state @@ -443,7 +442,7 @@ int openconfig_local_routing_local_routes_static_routes_static_state_vapi_cb( //Filling the structure snprintf(address_prefix, sizeof(address_prefix), "%s/%u", - bapi_ntoa(reply->address), reply->address_length); + sc_ntoa(reply->address), reply->address_length); sr_val_build_xpath(&vals[0], "%s/prefix", sysr_ip_fib_details_ctx->sysr_values_ctx.xpath_root); @@ -482,6 +481,7 @@ ip_routing_dump_cb (struct vapi_ctx_s *ctx, void *callback_ctx, int openconfig_local_routing_local_routes_static_routes_static_state_cb( const char *xpath, sr_val_t **values, size_t *values_cnt, __attribute__((unused)) uint64_t request_id, + __attribute__((unused)) const char *original_xpath, __attribute__((unused)) void *private_ctx) { sr_xpath_ctx_t state = {0}; @@ -510,9 +510,9 @@ int openconfig_local_routing_local_routes_static_routes_static_state_cb( } - vapi_msg_ip_fib_dump *mp = vapi_alloc_ip_fib_dump (g_vapi_ctx); + vapi_msg_ip_fib_dump *mp = vapi_alloc_ip_fib_dump (g_vapi_ctx_instance); - VAPI_CALL(vapi_ip_fib_dump(g_vapi_ctx, mp, ip_routing_dump_cb, &dctx)); + VAPI_CALL(vapi_ip_fib_dump(g_vapi_ctx_instance, mp, ip_routing_dump_cb, &dctx)); if(VAPI_OK != rv) { SRP_LOG_ERR_MSG("VAPI call failed"); @@ -550,7 +550,7 @@ int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_ho sr_val_set_str_data(&vals[0], SR_STRING_T, sysr_ip_fib_details_ctx->next_hop_index); - strncpy(next_hop, bapi_ntoa(reply->next_hop), sizeof(next_hop)); + strncpy(next_hop, sc_ntoa(reply->next_hop), sizeof(next_hop)); sr_val_build_xpath(&vals[1], "%s/next-hop", sysr_ip_fib_details_ctx->sysr_values_ctx.xpath_root); sr_val_set_str_data(&vals[1], SR_STRING_T, next_hop); @@ -683,8 +683,8 @@ int next_hop_inner( return SR_ERR_INVAL_ARG; } - vapi_msg_ip_fib_dump *mp = vapi_alloc_ip_fib_dump (g_vapi_ctx); - VAPI_CALL(vapi_ip_fib_dump(g_vapi_ctx, mp, ip_routing_next_hop_dump_cb, &dctx)); + vapi_msg_ip_fib_dump *mp = vapi_alloc_ip_fib_dump (g_vapi_ctx_instance); + VAPI_CALL(vapi_ip_fib_dump(g_vapi_ctx_instance, mp, ip_routing_next_hop_dump_cb, &dctx)); if (VAPI_OK != rv) { SRP_LOG_ERR_MSG("VAPI call failed"); @@ -715,7 +715,7 @@ int next_hop_inner( int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_state_cb( const char *xpath, sr_val_t **values, size_t *values_cnt, - uint64_t request_id, void *private_ctx) + uint64_t request_id, const char *original_xpath, void *private_ctx) { return next_hop_inner(false, xpath, values, values_cnt, request_id, private_ctx); @@ -723,7 +723,7 @@ int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_ho int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_interface_ref_state_cb( const char *xpath, sr_val_t **values, size_t *values_cnt, - uint64_t request_id, void *private_ctx) + uint64_t request_id, const char *original_xpath, void *private_ctx) { return next_hop_inner(true, xpath, values, values_cnt, request_id, private_ctx); diff --git a/src/plugins/openconfig/openconfig_local_routing.h b/src/plugins/openconfig/openconfig_local_routing.h index 4cde542..4cd2966 100644 --- a/src/plugins/openconfig/openconfig_local_routing.h +++ b/src/plugins/openconfig/openconfig_local_routing.h @@ -34,14 +34,14 @@ int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_ho int openconfig_local_routing_local_routes_static_routes_static_state_cb( const char *xpath, sr_val_t **values, size_t *values_cnt, - uint64_t request_id, void *private_ctx); + uint64_t request_id, const char *original_xpath, void *private_ctx); int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_state_cb( const char *xpath, sr_val_t **values, size_t *values_cnt, - uint64_t request_id, void *private_ctx); + uint64_t request_id, const char *original_xpath, void *private_ctx); int openconfig_local_routing_local_routes_static_routes_static_next_hops_next_hop_interface_ref_state_cb( const char *xpath, sr_val_t **values, size_t *values_cnt, - uint64_t request_id, void *private_ctx); + uint64_t request_id, const char *original_xpath, void *private_ctx); #endif /* __OPENCONFIG_LOCAL_ROUTING_H__ */ |