diff --git a/meta/Meta.cpp b/meta/Meta.cpp index b844c6f7a..62d374fca 100644 --- a/meta/Meta.cpp +++ b/meta/Meta.cpp @@ -801,6 +801,13 @@ sai_status_t Meta::objectTypeGetAvailability( break; + case SAI_ATTR_VALUE_TYPE_OBJECT_ID: + { + sai_object_type_t ot = objectTypeQuery(attrList[idx].value.oid); + PARAMETER_CHECK_OBJECT_TYPE_VALID(ot); + PARAMETER_CHECK_OID_EXISTS(attrList[idx].value.oid, ot); + break; + } default: META_LOG_THROW(*mdp, "value type %s not supported yet, FIXME!", diff --git a/unittest/meta/TestMetaDash.cpp b/unittest/meta/TestMetaDash.cpp index 2a25c1b50..5fec7d475 100644 --- a/unittest/meta/TestMetaDash.cpp +++ b/unittest/meta/TestMetaDash.cpp @@ -138,6 +138,26 @@ static void remove_eni(Meta &m, sai_object_id_t eni) EXPECT_EQ(SAI_STATUS_SUCCESS, m.remove((sai_object_type_t)SAI_OBJECT_TYPE_ENI, eni)); } +TEST(Meta, dash_get_availability) +{ + Meta m(std::make_shared()); + + sai_object_id_t switchid = create_switch(m); + + sai_attribute_t attr; + attr.id = SAI_DASH_ACL_RULE_ATTR_DASH_ACL_GROUP_ID; + attr.value.oid = 0; + + uint64_t count = 0; + EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, m.objectTypeGetAvailability(switchid, (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE, 1, &attr, &count)); + + attr.id = SAI_DASH_ACL_RULE_ATTR_DASH_ACL_GROUP_ID; + attr.value.oid = 0xFFFFFFF; + + EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, m.objectTypeGetAvailability(switchid, (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE, 1, &attr, &count)); +} + + TEST(Meta, quad_dash_direction_lookup) { Meta m(std::make_shared()); @@ -714,6 +734,12 @@ TEST(Meta, quad_dash_acl_rule) attr.value.s32 = SAI_DASH_ACL_RULE_ACTION_DENY_AND_CONTINUE; EXPECT_EQ(SAI_STATUS_SUCCESS, m.set((sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE, acl, &attr)); + attr.id = SAI_DASH_ACL_RULE_ATTR_DASH_ACL_GROUP_ID; + attr.value.oid = acl; + uint64_t count = 0; + + EXPECT_EQ(SAI_STATUS_SUCCESS, m.objectTypeGetAvailability(switchid, (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE, 1, &attr, &count)); + EXPECT_EQ(SAI_STATUS_SUCCESS, m.remove((sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE, acl)); remove_counter(m, counter); EXPECT_EQ(SAI_STATUS_SUCCESS, m.remove((sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_GROUP, group)); diff --git a/vslib/VirtualSwitchSaiInterface.cpp b/vslib/VirtualSwitchSaiInterface.cpp index 99583b3db..050cb106e 100644 --- a/vslib/VirtualSwitchSaiInterface.cpp +++ b/vslib/VirtualSwitchSaiInterface.cpp @@ -847,6 +847,19 @@ sai_status_t VirtualSwitchSaiInterface::objectTypeGetAvailability( *count = 512; return SAI_STATUS_SUCCESS; } + else if ((objectType == (sai_object_type_t)SAI_OBJECT_TYPE_VNET) || + (objectType == (sai_object_type_t)SAI_OBJECT_TYPE_ENI) || + (objectType == (sai_object_type_t)SAI_OBJECT_TYPE_ENI_ETHER_ADDRESS_MAP_ENTRY) || + (objectType == (sai_object_type_t)SAI_OBJECT_TYPE_INBOUND_ROUTING_ENTRY) || + (objectType == (sai_object_type_t)SAI_OBJECT_TYPE_OUTBOUND_ROUTING_ENTRY) || + (objectType == (sai_object_type_t)SAI_OBJECT_TYPE_PA_VALIDATION_ENTRY) || + (objectType == (sai_object_type_t)SAI_OBJECT_TYPE_OUTBOUND_CA_TO_PA_ENTRY) || + (objectType == (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_GROUP) || + (objectType == (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE)) + { + *count = 100000; + return SAI_STATUS_SUCCESS; + } return SAI_STATUS_NOT_SUPPORTED; }