diff options
Diffstat (limited to 'hicn-plugin/src/hicn_api_test.c')
-rw-r--r-- | hicn-plugin/src/hicn_api_test.c | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/hicn-plugin/src/hicn_api_test.c b/hicn-plugin/src/hicn_api_test.c index af0f8af94..6a1657edd 100644 --- a/hicn-plugin/src/hicn_api_test.c +++ b/hicn-plugin/src/hicn_api_test.c @@ -224,7 +224,8 @@ hicn_test_main_t hicn_test_main; _(hicn_api_node_params_set_reply) \ _(hicn_api_route_nhops_add_reply) \ _(hicn_api_route_del_reply) \ -_(hicn_api_route_nhop_del_reply) +_(hicn_api_route_nhop_del_reply) \ +_(hicn_api_enable_disable_reply) #define _(n) \ static void vl_api_##n##_t_handler \ @@ -261,7 +262,8 @@ _(HICN_API_ROUTES_DETAILS, hicn_api_routes_details) \ _(HICN_API_ROUTE_DEL_REPLY, hicn_api_route_del_reply) \ _(HICN_API_ROUTE_NHOP_DEL_REPLY, hicn_api_route_nhop_del_reply) \ _(HICN_API_STRATEGIES_GET_REPLY, hicn_api_strategies_get_reply) \ -_(HICN_API_STRATEGY_GET_REPLY, hicn_api_strategy_get_reply) +_(HICN_API_STRATEGY_GET_REPLY, hicn_api_strategy_get_reply) \ +_(HICN_API_ENABLE_DISABLE_REPLY, hicn_api_enable_disable_reply) static int api_hicn_api_node_params_set (vat_main_t * vam) @@ -298,7 +300,7 @@ api_hicn_api_node_params_set (vat_main_t * vam) /* Construct the API message */ M (HICN_API_NODE_PARAMS_SET, mp); - mp->enable_disable = enable_disable; + mp->enable_disable = clib_host_to_net_u32(enable_disable); mp->pit_max_size = clib_host_to_net_i32 (pit_size); mp->cs_max_size = clib_host_to_net_i32 (cs_size); mp->pit_max_lifetime_sec = pit_max_lifetime_sec; @@ -1108,6 +1110,58 @@ static void } static int +api_hicn_api_enable_disable (vat_main_t * vam) +{ + unformat_input_t *input = vam->input; + vl_api_hicn_api_enable_disable_t *mp; + int ret; + + fib_prefix_t prefix; + vl_api_hicn_action_type_t en_dis = HICN_ENABLE; + + while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (input, "prefix %U/%d", unformat_ip46_address, + &prefix.fp_addr, IP46_TYPE_ANY, &prefix.fp_len)) + {; + } + else if (unformat (input, "disable")) + {; + en_dis = HICN_DISABLE; + } + else + { + break; + } + } + + /* Check parse */ + if (((prefix.fp_addr.as_u64[0] == 0) && (prefix.fp_addr.as_u64[1] == 0)) + || (prefix.fp_len == 0)) + { + clib_warning ("Please specify a valid prefix..."); + return 1; + } + + prefix.fp_proto = ip46_address_is_ip4 (&(prefix.fp_addr)) ? FIB_PROTOCOL_IP4 : + FIB_PROTOCOL_IP6; + + //Construct the API message + M (HICN_API_ENABLE_DISABLE, mp); + + ip_prefix_encode (&prefix, &mp->prefix); + mp->enable_disable = en_dis; + + //send it... + S (mp); + + //Wait for a reply... + W (ret); + + return ret; +} + +static int api_hicn_api_register_prod_app (vat_main_t * vam) { unformat_input_t *input = vam->input; @@ -1305,8 +1359,6 @@ static void format_ip46_address, IP46_TYPE_ANY, &src_addr4, format_ip46_address, IP46_TYPE_ANY, &src_addr6); } - - #include <hicn/hicn.api_test.c> /* |