diff options
author | John Lo <loj@cisco.com> | 2016-10-24 20:20:11 -0400 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2016-10-25 13:45:07 +0000 |
commit | 06b14b914c407b33155f4bed532e6aa94b35c10a (patch) | |
tree | 0784c7484e00f2948cae5b8104b98f519c3c3efb | |
parent | 749294dfeb597687202fe525de64b55ab653eccd (diff) |
Add API call of sw_interface_set_mpls_enable to vpp_api_test
Change-Id: If0e98c111b3dfa38cb2c619dde4ddb3e52ee8dfa
Signed-off-by: John Lo <loj@cisco.com>
-rw-r--r-- | vpp-api-test/vat/api_format.c | 48 | ||||
-rw-r--r-- | vpp/vpp-api/custom_dump.c | 16 |
2 files changed, 64 insertions, 0 deletions
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index 0e55732341d..51beada2bd0 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -3475,6 +3475,7 @@ static void vl_api_flow_classify_details_t_handler_json _(sw_interface_set_flags_reply) \ _(sw_interface_add_del_address_reply) \ _(sw_interface_set_table_reply) \ +_(sw_interface_set_mpls_enable_reply) \ _(sw_interface_set_vpath_reply) \ _(sw_interface_set_l2_bridge_reply) \ _(sw_interface_set_dpdk_hqos_pipe_reply) \ @@ -3621,6 +3622,7 @@ _(CLI_INBAND_REPLY, cli_inband_reply) \ _(SW_INTERFACE_ADD_DEL_ADDRESS_REPLY, \ sw_interface_add_del_address_reply) \ _(SW_INTERFACE_SET_TABLE_REPLY, sw_interface_set_table_reply) \ +_(SW_INTERFACE_SET_MPLS_ENABLE_REPLY, sw_interface_set_mpls_enable_reply) \ _(SW_INTERFACE_SET_VPATH_REPLY, sw_interface_set_vpath_reply) \ _(SW_INTERFACE_SET_L2_XCONNECT_REPLY, \ sw_interface_set_l2_xconnect_reply) \ @@ -4905,6 +4907,50 @@ api_sw_interface_add_del_address (vat_main_t * vam) } static int +api_sw_interface_set_mpls_enable (vat_main_t * vam) +{ + unformat_input_t *i = vam->input; + vl_api_sw_interface_set_mpls_enable_t *mp; + f64 timeout; + u32 sw_if_index; + u8 sw_if_index_set = 0; + u8 enable = 1; + + /* Parse args required to build the message */ + while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) + { + if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index)) + sw_if_index_set = 1; + else if (unformat (i, "sw_if_index %d", &sw_if_index)) + sw_if_index_set = 1; + else if (unformat (i, "disable")) + enable = 0; + else if (unformat (i, "dis")) + enable = 0; + else + break; + } + + if (sw_if_index_set == 0) + { + errmsg ("missing interface name or sw_if_index\n"); + return -99; + } + + /* Construct the API message */ + M (SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable); + + mp->sw_if_index = ntohl (sw_if_index); + mp->enable = enable; + + /* send it... */ + S; + + /* Wait for a reply... */ + W; +} + +static int api_sw_interface_set_table (vat_main_t * vam) { unformat_input_t *i = vam->input; @@ -16155,6 +16201,8 @@ _(sw_interface_add_del_address, \ "<intfc> | sw_if_index <id> <ip4-address> | <ip6-address> [del] [del-all] ") \ _(sw_interface_set_table, \ "<intfc> | sw_if_index <id> vrf <table-id> [ipv6]") \ +_(sw_interface_set_mpls_enable, \ + "<intfc> | sw_if_index [disable | dis]") \ _(sw_interface_set_vpath, \ "<intfc> | sw_if_index <id> enable | disable") \ _(sw_interface_set_l2_xconnect, \ diff --git a/vpp/vpp-api/custom_dump.c b/vpp/vpp-api/custom_dump.c index 2eafac9ca97..6406cbad3f3 100644 --- a/vpp/vpp-api/custom_dump.c +++ b/vpp/vpp-api/custom_dump.c @@ -146,6 +146,21 @@ static void *vl_api_sw_interface_set_table_t_print FINISH; } +static void *vl_api_sw_interface_set_mpls_enable_t_print + (vl_api_sw_interface_set_mpls_enable_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: sw_interface_set_mpls_enable "); + + s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index)); + + if (mp->enable == 0) + s = format (s, "disable"); + + FINISH; +} + static void *vl_api_sw_interface_set_vpath_t_print (vl_api_sw_interface_set_vpath_t * mp, void *handle) { @@ -2810,6 +2825,7 @@ _(CREATE_LOOPBACK, create_loopback) \ _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \ _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address) \ _(SW_INTERFACE_SET_TABLE, sw_interface_set_table) \ +_(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \ _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) \ _(TAP_CONNECT, tap_connect) \ _(TAP_MODIFY, tap_modify) \ |