Skip to content

Commit 1942d73

Browse files
[vslib] Allow host interface object ID to be "VLAN" type (sonic-net#804)
* [vslib] Allow host interface object ID to be "VLAN" type Signed-off-by: Volodymyr Samotiy <[email protected]>
1 parent 1906fdf commit 1942d73

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

vslib/src/SwitchStateBaseHostif.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,12 @@ sai_status_t SwitchStateBase::vs_create_hostif_tap_interface(
560560

561561
sai_object_type_t ot = objectTypeQuery(obj_id);
562562

563+
if (ot == SAI_OBJECT_TYPE_VLAN)
564+
{
565+
SWSS_LOG_DEBUG("Skipping tap creation for hostif with object type VLAN");
566+
return SAI_STATUS_SUCCESS;
567+
}
568+
563569
if (ot != SAI_OBJECT_TYPE_PORT)
564570
{
565571
SWSS_LOG_ERROR("SAI_HOSTIF_ATTR_OBJ_ID=%s expected to be PORT but is: %s",
@@ -743,6 +749,19 @@ sai_status_t SwitchStateBase::vs_remove_hostif_tap_interface(
743749
return SAI_STATUS_SUCCESS;
744750
}
745751

752+
attr.id = SAI_HOSTIF_ATTR_OBJ_ID;
753+
status = get(SAI_OBJECT_TYPE_HOSTIF, hostif_id, 1, &attr);
754+
if (status != SAI_STATUS_SUCCESS)
755+
{
756+
SWSS_LOG_ERROR("Failed to get object ID for hostif %s", sai_serialize_object_id(hostif_id).c_str());
757+
return status;
758+
}
759+
if (objectTypeQuery(attr.value.oid) == SAI_OBJECT_TYPE_VLAN)
760+
{
761+
SWSS_LOG_DEBUG("Skipping tap deletion for hostif with object type VLAN");
762+
return SAI_STATUS_SUCCESS;
763+
}
764+
746765
attr.id = SAI_HOSTIF_ATTR_NAME;
747766

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

0 commit comments

Comments
 (0)