Skip to content

Commit

Permalink
[vslib] Allow host interface object ID to be "VLAN" type (#804)
Browse files Browse the repository at this point in the history
* [vslib] Allow host interface object ID to be "VLAN" type
Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
  • Loading branch information
volodymyrsamotiy authored Apr 2, 2021
1 parent 1906fdf commit 1942d73
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions vslib/src/SwitchStateBaseHostif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,12 @@ sai_status_t SwitchStateBase::vs_create_hostif_tap_interface(

sai_object_type_t ot = objectTypeQuery(obj_id);

if (ot == SAI_OBJECT_TYPE_VLAN)
{
SWSS_LOG_DEBUG("Skipping tap creation for hostif with object type VLAN");
return SAI_STATUS_SUCCESS;
}

if (ot != SAI_OBJECT_TYPE_PORT)
{
SWSS_LOG_ERROR("SAI_HOSTIF_ATTR_OBJ_ID=%s expected to be PORT but is: %s",
Expand Down Expand Up @@ -743,6 +749,19 @@ sai_status_t SwitchStateBase::vs_remove_hostif_tap_interface(
return SAI_STATUS_SUCCESS;
}

attr.id = SAI_HOSTIF_ATTR_OBJ_ID;
status = get(SAI_OBJECT_TYPE_HOSTIF, hostif_id, 1, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to get object ID for hostif %s", sai_serialize_object_id(hostif_id).c_str());
return status;
}
if (objectTypeQuery(attr.value.oid) == SAI_OBJECT_TYPE_VLAN)
{
SWSS_LOG_DEBUG("Skipping tap deletion for hostif with object type VLAN");
return SAI_STATUS_SUCCESS;
}

attr.id = SAI_HOSTIF_ATTR_NAME;

status = get(SAI_OBJECT_TYPE_HOSTIF, hostif_id, 1, &attr);
Expand Down

0 comments on commit 1942d73

Please sign in to comment.