Thanks  Mohsin for the help. I earlier tried  IF_STATUS_API_FLAG_ADMIN_UP
but it didn' work too. clib_host_to_net_u32 made the difference and it
worked fine with this.

Regards,
Subrata


On Tue, Nov 2, 2021 at 10:42 PM Mohsin Kazmi (sykazmi) <syka...@cisco.com>
wrote:

> You are setting the “*mp->flags = 0;*” as (IF_STATUS_API_FLAG_LINK_UP &
> IF_STATUS_API_FLAG_ADMIN_UP == 0)
>
>
>
> To ‘UP’ the interface:
>
> u32 flags = IF_STATUS_API_FLAG_ADMIN_UP;
>
>  mp->flags = clib_host_to_net_u32 (flags);
>
>
>
> To ‘DOWN’ the interface:
>
>   u32 flags = 0;
>
>   mp->flags = clib_host_to_net_u32 (flags);
>
>
>
>
>
> -br
>
> Mohsin
>
> *From: *<vpp-dev@lists.fd.io> on behalf of Subrata Nath <
> subratanat...@gmail.com>
> *Date: *Tuesday, November 2, 2021 at 4:09 PM
> *To: *"vpp-dev@lists.fd.io" <vpp-dev@lists.fd.io>
> *Subject: *[vpp-dev] VPP binary API to make interface state up
>
>
>
> HI,
>
>
>
> I am trying to implement the following vppctl command through C API. vpp
> version 20.09.
>
>
>
>
> *vppctl set int ip addr host-eth3 10.22.6.20/24 <http://10.22.6.20/24>
> vppctl set int state host-eth3 up*
>
>
>
> First command i.e. to plumb the IP works fine through the program attached
> but to make the interface up, i am using vl_api_sw_interface_set_flags_t
> message.
>
>
>
>      vl_api_sw_interface_set_flags_t *mp;
>
>         mp = vl_msg_api_alloc (sizeof (*mp));
>         clib_memset (mp, 0, sizeof (*mp));
>
>         mp->_vl_msg_id = clib_host_to_net_u16
>  (VL_API_SW_INTERFACE_SET_FLAGS);
>         mp->client_index = api_client_index;
>         mp->context = vpp_client_context;
>         mp->sw_if_index = clib_host_to_net_u32  (ifindex);
>         //mp->flags = IF_STATUS_API_FLAG_ADMIN_UP;
>         mp->flags = IF_STATUS_API_FLAG_LINK_UP &
> IF_STATUS_API_FLAG_ADMIN_UP;
>         vl_msg_api_send_shmem (api_vl_input_queue, (u8 *) & mp);
>
>
>
> reply handler says retval is success but i don't see interface state is up
> through vppctl. vppctl command shows IP is plumbed fine. Can anyone suggest
> what's the issue?
>
>
>
> Also, In this version, vl_api_sw_interface_set_flags_t  flag parameter is
> a enum with IF_STATUS_API_FLAG_ADMIN_UP , IF_STATUS_API_FLAG_LINK_UP. So I
> am not sure how to make the interface state down.
>
>
>
> Thanks in advance.
>
>
>
> Regards,
>
> Subrata
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#20412): https://lists.fd.io/g/vpp-dev/message/20412
Mute This Topic: https://lists.fd.io/mt/86769737/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to