diff --git a/meta/sai_meta.cpp b/meta/sai_meta.cpp index dd769bf3bd62..ba34ba446102 100644 --- a/meta/sai_meta.cpp +++ b/meta/sai_meta.cpp @@ -14,6 +14,16 @@ #include #include +#define META_LOG_STATUS(s)\ + if (s == SAI_STATUS_SUCCESS) \ + SWSS_LOG_DEBUG("get status: %s", sai_serialize_status(s).c_str()); \ + else if (s == SAI_STATUS_BUFFER_OVERFLOW \ + || SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED(s) \ + || SAI_STATUS_IS_ATTR_NOT_SUPPORTED(s)) \ + SWSS_LOG_INFO("get status: %s", sai_serialize_status(s).c_str()); \ + else \ + SWSS_LOG_ERROR("get status: %s", sai_serialize_status(s).c_str()); + static volatile bool unittests_enabled = false; static std::set meta_unittests_set_readonly_set; @@ -3698,16 +3708,6 @@ sai_status_t meta_sai_set_fdb_entry( return status; } -#define META_LOG_STATUS(s)\ - if (s == SAI_STATUS_SUCCESS) \ - SWSS_LOG_DEBUG("get status: %s", sai_serialize_status(s).c_str()); \ - else if (s == SAI_STATUS_BUFFER_OVERFLOW \ - || SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED(s) \ - || SAI_STATUS_IS_ATTR_NOT_SUPPORTED(s)) \ - SWSS_LOG_INFO("get status: %s", sai_serialize_status(s).c_str()); \ - else \ - SWSS_LOG_ERROR("get status: %s", sai_serialize_status(s).c_str()); - sai_status_t meta_sai_get_fdb_entry( _In_ const sai_fdb_entry_t* fdb_entry, _In_ uint32_t attr_count, @@ -3753,6 +3753,284 @@ sai_status_t meta_sai_get_fdb_entry( return status; } +// MCAST FDB ENTRY + +sai_status_t meta_sai_validate_mcast_fdb_entry( + _In_ const sai_mcast_fdb_entry_t* mcast_fdb_entry, + _In_ bool create, + _In_ bool get = false) +{ + SWSS_LOG_ENTER(); + + if (mcast_fdb_entry == NULL) + { + SWSS_LOG_ERROR("mcast_fdb_entry pointer is NULL"); + + return SAI_STATUS_INVALID_PARAMETER; + } + + sai_object_id_t bv_id = mcast_fdb_entry->bv_id; + + if (bv_id == SAI_NULL_OBJECT_ID) + { + SWSS_LOG_ERROR("bv_id set to null object id"); + + return SAI_STATUS_INVALID_PARAMETER; + } + + sai_object_type_t object_type = sai_object_type_query(bv_id); + + if (object_type == SAI_OBJECT_TYPE_NULL) + { + SWSS_LOG_ERROR("bv_id oid 0x%lx is not valid object type, returned null object type", bv_id); + + return SAI_STATUS_INVALID_PARAMETER; + } + + if (object_type != SAI_OBJECT_TYPE_BRIDGE && object_type != SAI_OBJECT_TYPE_VLAN) + { + SWSS_LOG_ERROR("bv_id oid 0x%lx type %d is wrong type, expected BRIDGE or VLAN", bv_id, object_type); + + return SAI_STATUS_INVALID_PARAMETER; + } + + // check if bv_id exists + + sai_object_meta_key_t meta_key_bv = { .objecttype = object_type, .objectkey = { .key = { .object_id = bv_id } } }; + + std::string key_bv = sai_serialize_object_meta_key(meta_key_bv); + + if (!object_exists(key_bv)) + { + SWSS_LOG_ERROR("object key %s doesn't exist", key_bv.c_str()); + + return SAI_STATUS_INVALID_PARAMETER; + } + + // check if fdb entry exists + + sai_object_meta_key_t meta_key_fdb = { .objecttype = SAI_OBJECT_TYPE_MCAST_FDB_ENTRY, .objectkey = { .key = { .mcast_fdb_entry = *mcast_fdb_entry } } }; + + std::string key_fdb = sai_serialize_object_meta_key(meta_key_fdb); + + if (create) + { + if (object_exists(key_fdb)) + { + SWSS_LOG_ERROR("object key %s already exists", key_fdb.c_str()); + + return SAI_STATUS_ITEM_ALREADY_EXISTS; + } + + return SAI_STATUS_SUCCESS; + } + + // set, get, remove + + if (!object_exists(key_fdb) && !get) + { + SWSS_LOG_ERROR("object key %s doesn't exist", key_fdb.c_str()); + + return SAI_STATUS_INVALID_PARAMETER; + } + + // fdb entry is valid + + return SAI_STATUS_SUCCESS; +} + +sai_status_t meta_sai_create_mcast_fdb_entry( + _In_ const sai_mcast_fdb_entry_t* mcast_fdb_entry, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list, + _In_ sai_create_mcast_fdb_entry_fn create) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_mcast_fdb_entry(mcast_fdb_entry, true); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_MCAST_FDB_ENTRY, .objectkey = { .key = { .mcast_fdb_entry = *mcast_fdb_entry } } }; + + status = meta_generic_validation_create(meta_key, mcast_fdb_entry->switch_id, attr_count, attr_list); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (create == NULL) + { + SWSS_LOG_ERROR("create function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = create(mcast_fdb_entry, attr_count, attr_list); + + if (status == SAI_STATUS_SUCCESS) + { + SWSS_LOG_DEBUG("create status: %s", sai_serialize_status(status).c_str()); + } + else + { + SWSS_LOG_ERROR("create status: %s", sai_serialize_status(status).c_str()); + } + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_create(meta_key, mcast_fdb_entry->switch_id, attr_count, attr_list); + } + + return status; +} + +sai_status_t meta_sai_remove_mcast_fdb_entry( + _In_ const sai_mcast_fdb_entry_t* mcast_fdb_entry, + _In_ sai_remove_mcast_fdb_entry_fn remove) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_mcast_fdb_entry(mcast_fdb_entry, false); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_MCAST_FDB_ENTRY, .objectkey = { .key = { .mcast_fdb_entry = *mcast_fdb_entry } } }; + + status = meta_generic_validation_remove(meta_key); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (remove == NULL) + { + SWSS_LOG_ERROR("remove function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = remove(mcast_fdb_entry); + + if (status == SAI_STATUS_SUCCESS) + { + SWSS_LOG_DEBUG("remove status: %s", sai_serialize_status(status).c_str()); + } + else + { + SWSS_LOG_ERROR("remove status: %s", sai_serialize_status(status).c_str()); + } + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_remove(meta_key); + } + + return status; +} + +sai_status_t meta_sai_set_mcast_fdb_entry( + _In_ const sai_mcast_fdb_entry_t* mcast_fdb_entry, + _In_ const sai_attribute_t *attr, + _In_ sai_set_mcast_fdb_entry_attribute_fn set) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_mcast_fdb_entry(mcast_fdb_entry, false); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_MCAST_FDB_ENTRY, .objectkey = { .key = { .mcast_fdb_entry = *mcast_fdb_entry } } }; + + status = meta_generic_validation_set(meta_key, attr); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (set == NULL) + { + SWSS_LOG_ERROR("set function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = set(mcast_fdb_entry, attr); + + if (status == SAI_STATUS_SUCCESS) + { + SWSS_LOG_DEBUG("set status: %s", sai_serialize_status(status).c_str()); + } + else + { + SWSS_LOG_ERROR("set status: %s", sai_serialize_status(status).c_str()); + } + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_set(meta_key, attr); + } + + return status; +} + +sai_status_t meta_sai_get_mcast_fdb_entry( + _In_ const sai_mcast_fdb_entry_t* mcast_fdb_entry, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list, + _In_ sai_get_mcast_fdb_entry_attribute_fn get) +{ + SWSS_LOG_ENTER(); + + // NOTE: when doing get, entry may not exist on metadata db + + sai_status_t status = meta_sai_validate_mcast_fdb_entry(mcast_fdb_entry, false, true); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_MCAST_FDB_ENTRY, .objectkey = { .key = { .mcast_fdb_entry = *mcast_fdb_entry } } }; + + status = meta_generic_validation_get(meta_key, attr_count, attr_list); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (get == NULL) + { + SWSS_LOG_ERROR("get function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = get(mcast_fdb_entry, attr_count, attr_list); + + META_LOG_STATUS(status); + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_get(meta_key, mcast_fdb_entry->switch_id, attr_count, attr_list); + } + + return status; +} + // NEIGHBOR ENTRY sai_status_t meta_sai_validate_neighbor_entry( @@ -4341,6 +4619,848 @@ sai_status_t meta_sai_get_route_entry( return status; } +// L2MC ENTRY + +sai_status_t meta_sai_validate_l2mc_entry( + _In_ const sai_l2mc_entry_t* l2mc_entry, + _In_ bool create) +{ + SWSS_LOG_ENTER(); + + if (l2mc_entry == NULL) + { + SWSS_LOG_ERROR("l2mc_entry pointer is NULL"); + + return SAI_STATUS_INVALID_PARAMETER; + } + + switch (l2mc_entry->type) + { + case SAI_L2MC_ENTRY_TYPE_SG: + case SAI_L2MC_ENTRY_TYPE_XG: + break; + + default: + + SWSS_LOG_ERROR("invalid l2mc_entry type: %d", l2mc_entry->type); + + return SAI_STATUS_INVALID_PARAMETER; + } + + auto family = l2mc_entry->destination.addr_family; + + switch (family) + { + case SAI_IP_ADDR_FAMILY_IPV4: + case SAI_IP_ADDR_FAMILY_IPV6: + break; + + default: + + SWSS_LOG_ERROR("invalid destination family: %d", family); + + return SAI_STATUS_INVALID_PARAMETER; + } + + family = l2mc_entry->source.addr_family; + + switch (family) + { + case SAI_IP_ADDR_FAMILY_IPV4: + case SAI_IP_ADDR_FAMILY_IPV6: + break; + + default: + + SWSS_LOG_ERROR("invalid source family: %d", family); + + return SAI_STATUS_INVALID_PARAMETER; + } + + sai_object_id_t bv_id = l2mc_entry->bv_id; + + if (bv_id == SAI_NULL_OBJECT_ID) + { + SWSS_LOG_ERROR("bv_id set to null object id"); + + return SAI_STATUS_INVALID_PARAMETER; + } + + sai_object_type_t object_type = sai_object_type_query(bv_id); + + if (object_type == SAI_OBJECT_TYPE_NULL) + { + SWSS_LOG_ERROR("bv_id oid 0x%lx is not valid object type, returned null object type", bv_id); + + return SAI_STATUS_INVALID_PARAMETER; + } + + if (object_type != SAI_OBJECT_TYPE_BRIDGE && object_type != SAI_OBJECT_TYPE_VLAN) + { + SWSS_LOG_ERROR("bv_id oid 0x%lx type %d is wrong type, expected BRIDGE or VLAN", bv_id, object_type); + + return SAI_STATUS_INVALID_PARAMETER; + } + + // check if bv_id exists + + sai_object_meta_key_t meta_key_bv = { .objecttype = object_type, .objectkey = { .key = { .object_id = bv_id } } }; + + std::string key_bv = sai_serialize_object_meta_key(meta_key_bv); + + if (!object_exists(key_bv)) + { + SWSS_LOG_ERROR("object key %s doesn't exist", key_bv.c_str()); + + return SAI_STATUS_INVALID_PARAMETER; + } + + // check if l2mc entry exists + + sai_object_meta_key_t meta_key_route = { .objecttype = SAI_OBJECT_TYPE_L2MC_ENTRY, .objectkey = { .key = { .l2mc_entry = *l2mc_entry } } }; + + std::string key_route = sai_serialize_object_meta_key(meta_key_route); + + if (create) + { + if (object_exists(key_route)) + { + SWSS_LOG_ERROR("object key %s already exists", key_route.c_str()); + + return SAI_STATUS_ITEM_ALREADY_EXISTS; + } + + return SAI_STATUS_SUCCESS; + } + + // set, get, remove + + if (!object_exists(key_route)) + { + SWSS_LOG_ERROR("object key %s doesn't exist", key_route.c_str()); + + return SAI_STATUS_INVALID_PARAMETER; + } + + return SAI_STATUS_SUCCESS; +} + +sai_status_t meta_sai_create_l2mc_entry( + _In_ const sai_l2mc_entry_t* l2mc_entry, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list, + _In_ sai_create_l2mc_entry_fn create) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_l2mc_entry(l2mc_entry, true); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_L2MC_ENTRY, .objectkey = { .key = { .l2mc_entry = *l2mc_entry } } }; + + status = meta_generic_validation_create(meta_key, l2mc_entry->switch_id, attr_count, attr_list); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (create == NULL) + { + SWSS_LOG_ERROR("create function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = create(l2mc_entry, attr_count, attr_list); + + if (status == SAI_STATUS_SUCCESS) + { + SWSS_LOG_DEBUG("create status: %s", sai_serialize_status(status).c_str()); + } + else + { + SWSS_LOG_ERROR("create status: %s", sai_serialize_status(status).c_str()); + } + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_create(meta_key, l2mc_entry->switch_id, attr_count, attr_list); + } + + return status; +} + +sai_status_t meta_sai_remove_l2mc_entry( + _In_ const sai_l2mc_entry_t* l2mc_entry, + _In_ sai_remove_l2mc_entry_fn remove) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_l2mc_entry(l2mc_entry, false); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_L2MC_ENTRY, .objectkey = { .key = { .l2mc_entry = *l2mc_entry } } }; + + status = meta_generic_validation_remove(meta_key); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (remove == NULL) + { + SWSS_LOG_ERROR("remove function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = remove(l2mc_entry); + + if (status == SAI_STATUS_SUCCESS) + { + SWSS_LOG_DEBUG("remove status: %s", sai_serialize_status(status).c_str()); + } + else + { + SWSS_LOG_ERROR("remove status: %s", sai_serialize_status(status).c_str()); + } + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_remove(meta_key); + } + + return status; +} + +sai_status_t meta_sai_set_l2mc_entry( + _In_ const sai_l2mc_entry_t* l2mc_entry, + _In_ const sai_attribute_t *attr, + _In_ sai_set_l2mc_entry_attribute_fn set) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_l2mc_entry(l2mc_entry, false); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_L2MC_ENTRY, .objectkey = { .key = { .l2mc_entry = *l2mc_entry } } }; + + status = meta_generic_validation_set(meta_key, attr); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (set == NULL) + { + SWSS_LOG_ERROR("set function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = set(l2mc_entry, attr); + + if (status == SAI_STATUS_SUCCESS) + { + SWSS_LOG_DEBUG("set status: %s", sai_serialize_status(status).c_str()); + } + else + { + SWSS_LOG_ERROR("set status: %s", sai_serialize_status(status).c_str()); + } + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_set(meta_key, attr); + } + + return status; +} + +sai_status_t meta_sai_get_l2mc_entry( + _In_ const sai_l2mc_entry_t* l2mc_entry, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list, + _In_ sai_get_l2mc_entry_attribute_fn get) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_l2mc_entry(l2mc_entry, false); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_L2MC_ENTRY, .objectkey = { .key = { .l2mc_entry = *l2mc_entry } } }; + + status = meta_generic_validation_get(meta_key, attr_count, attr_list); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (get == NULL) + { + SWSS_LOG_ERROR("get function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = get(l2mc_entry, attr_count, attr_list); + + META_LOG_STATUS(status); + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_get(meta_key, l2mc_entry->switch_id, attr_count, attr_list); + } + + return status; +} + +// IPMC ENTRY + +sai_status_t meta_sai_validate_ipmc_entry( + _In_ const sai_ipmc_entry_t* ipmc_entry, + _In_ bool create) +{ + SWSS_LOG_ENTER(); + + if (ipmc_entry == NULL) + { + SWSS_LOG_ERROR("ipmc_entry pointer is NULL"); + + return SAI_STATUS_INVALID_PARAMETER; + } + + switch (ipmc_entry->type) + { + case SAI_IPMC_ENTRY_TYPE_SG: + case SAI_IPMC_ENTRY_TYPE_XG: + break; + + default: + + SWSS_LOG_ERROR("invalid ipmc_entry type: %d", ipmc_entry->type); + + return SAI_STATUS_INVALID_PARAMETER; + } + + auto family = ipmc_entry->destination.addr_family; + + switch (family) + { + case SAI_IP_ADDR_FAMILY_IPV4: + case SAI_IP_ADDR_FAMILY_IPV6: + break; + + default: + + SWSS_LOG_ERROR("invalid destination family: %d", family); + + return SAI_STATUS_INVALID_PARAMETER; + } + + family = ipmc_entry->source.addr_family; + + switch (family) + { + case SAI_IP_ADDR_FAMILY_IPV4: + case SAI_IP_ADDR_FAMILY_IPV6: + break; + + default: + + SWSS_LOG_ERROR("invalid source family: %d", family); + + return SAI_STATUS_INVALID_PARAMETER; + } + + sai_object_id_t vr_id = ipmc_entry->vr_id; + + if (vr_id == SAI_NULL_OBJECT_ID) + { + SWSS_LOG_ERROR("vr_id set to null object id"); + + return SAI_STATUS_INVALID_PARAMETER; + } + + sai_object_type_t object_type = sai_object_type_query(vr_id); + + if (object_type == SAI_OBJECT_TYPE_NULL) + { + SWSS_LOG_ERROR("vr_id oid 0x%lx is not valid object type, returned null object type", vr_id); + + return SAI_STATUS_INVALID_PARAMETER; + } + + if (object_type != SAI_OBJECT_TYPE_VIRTUAL_ROUTER) + { + SWSS_LOG_ERROR("vr_id oid 0x%lx type %d is wrong type, expected VIRTUAL_ROUTER", vr_id, object_type); + + return SAI_STATUS_INVALID_PARAMETER; + } + + // check if vr_id exists + + sai_object_meta_key_t meta_key_bv = { .objecttype = object_type, .objectkey = { .key = { .object_id = vr_id } } }; + + std::string key_bv = sai_serialize_object_meta_key(meta_key_bv); + + if (!object_exists(key_bv)) + { + SWSS_LOG_ERROR("object key %s doesn't exist", key_bv.c_str()); + + return SAI_STATUS_INVALID_PARAMETER; + } + + // check if ipmc entry exists + + sai_object_meta_key_t meta_key_route = { .objecttype = SAI_OBJECT_TYPE_IPMC_ENTRY, .objectkey = { .key = { .ipmc_entry = *ipmc_entry } } }; + + std::string key_route = sai_serialize_object_meta_key(meta_key_route); + + if (create) + { + if (object_exists(key_route)) + { + SWSS_LOG_ERROR("object key %s already exists", key_route.c_str()); + + return SAI_STATUS_ITEM_ALREADY_EXISTS; + } + + return SAI_STATUS_SUCCESS; + } + + // set, get, remove + + if (!object_exists(key_route)) + { + SWSS_LOG_ERROR("object key %s doesn't exist", key_route.c_str()); + + return SAI_STATUS_INVALID_PARAMETER; + } + + return SAI_STATUS_SUCCESS; +} + +sai_status_t meta_sai_create_ipmc_entry( + _In_ const sai_ipmc_entry_t* ipmc_entry, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list, + _In_ sai_create_ipmc_entry_fn create) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_ipmc_entry(ipmc_entry, true); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_IPMC_ENTRY, .objectkey = { .key = { .ipmc_entry = *ipmc_entry } } }; + + status = meta_generic_validation_create(meta_key, ipmc_entry->switch_id, attr_count, attr_list); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (create == NULL) + { + SWSS_LOG_ERROR("create function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = create(ipmc_entry, attr_count, attr_list); + + if (status == SAI_STATUS_SUCCESS) + { + SWSS_LOG_DEBUG("create status: %s", sai_serialize_status(status).c_str()); + } + else + { + SWSS_LOG_ERROR("create status: %s", sai_serialize_status(status).c_str()); + } + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_create(meta_key, ipmc_entry->switch_id, attr_count, attr_list); + } + + return status; +} + +sai_status_t meta_sai_remove_ipmc_entry( + _In_ const sai_ipmc_entry_t* ipmc_entry, + _In_ sai_remove_ipmc_entry_fn remove) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_ipmc_entry(ipmc_entry, false); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_IPMC_ENTRY, .objectkey = { .key = { .ipmc_entry = *ipmc_entry } } }; + + status = meta_generic_validation_remove(meta_key); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (remove == NULL) + { + SWSS_LOG_ERROR("remove function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = remove(ipmc_entry); + + if (status == SAI_STATUS_SUCCESS) + { + SWSS_LOG_DEBUG("remove status: %s", sai_serialize_status(status).c_str()); + } + else + { + SWSS_LOG_ERROR("remove status: %s", sai_serialize_status(status).c_str()); + } + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_remove(meta_key); + } + + return status; +} + +sai_status_t meta_sai_set_ipmc_entry( + _In_ const sai_ipmc_entry_t* ipmc_entry, + _In_ const sai_attribute_t *attr, + _In_ sai_set_ipmc_entry_attribute_fn set) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_ipmc_entry(ipmc_entry, false); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_IPMC_ENTRY, .objectkey = { .key = { .ipmc_entry = *ipmc_entry } } }; + + status = meta_generic_validation_set(meta_key, attr); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (set == NULL) + { + SWSS_LOG_ERROR("set function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = set(ipmc_entry, attr); + + if (status == SAI_STATUS_SUCCESS) + { + SWSS_LOG_DEBUG("set status: %s", sai_serialize_status(status).c_str()); + } + else + { + SWSS_LOG_ERROR("set status: %s", sai_serialize_status(status).c_str()); + } + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_set(meta_key, attr); + } + + return status; +} + +sai_status_t meta_sai_get_ipmc_entry( + _In_ const sai_ipmc_entry_t* ipmc_entry, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list, + _In_ sai_get_ipmc_entry_attribute_fn get) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_ipmc_entry(ipmc_entry, false); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_IPMC_ENTRY, .objectkey = { .key = { .ipmc_entry = *ipmc_entry } } }; + + status = meta_generic_validation_get(meta_key, attr_count, attr_list); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (get == NULL) + { + SWSS_LOG_ERROR("get function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = get(ipmc_entry, attr_count, attr_list); + + META_LOG_STATUS(status); + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_get(meta_key, ipmc_entry->switch_id, attr_count, attr_list); + } + + return status; +} + +// INSEG ENTRY + +sai_status_t meta_sai_validate_inseg_entry( + _In_ const sai_inseg_entry_t* inseg_entry, + _In_ bool create) +{ + SWSS_LOG_ENTER(); + + if (inseg_entry == NULL) + { + SWSS_LOG_ERROR("inseg_entry pointer is NULL"); + + return SAI_STATUS_INVALID_PARAMETER; + } + + // validate mpls label + + return SAI_STATUS_SUCCESS; +} + +sai_status_t meta_sai_create_inseg_entry( + _In_ const sai_inseg_entry_t* inseg_entry, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list, + _In_ sai_create_inseg_entry_fn create) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_inseg_entry(inseg_entry, true); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_INSEG_ENTRY, .objectkey = { .key = { .inseg_entry = *inseg_entry } } }; + + status = meta_generic_validation_create(meta_key, inseg_entry->switch_id, attr_count, attr_list); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (create == NULL) + { + SWSS_LOG_ERROR("create function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = create(inseg_entry, attr_count, attr_list); + + if (status == SAI_STATUS_SUCCESS) + { + SWSS_LOG_DEBUG("create status: %s", sai_serialize_status(status).c_str()); + } + else + { + SWSS_LOG_ERROR("create status: %s", sai_serialize_status(status).c_str()); + } + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_create(meta_key, inseg_entry->switch_id, attr_count, attr_list); + } + + return status; +} + +sai_status_t meta_sai_remove_inseg_entry( + _In_ const sai_inseg_entry_t* inseg_entry, + _In_ sai_remove_inseg_entry_fn remove) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_inseg_entry(inseg_entry, false); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_INSEG_ENTRY, .objectkey = { .key = { .inseg_entry = *inseg_entry } } }; + + status = meta_generic_validation_remove(meta_key); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (remove == NULL) + { + SWSS_LOG_ERROR("remove function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = remove(inseg_entry); + + if (status == SAI_STATUS_SUCCESS) + { + SWSS_LOG_DEBUG("remove status: %s", sai_serialize_status(status).c_str()); + } + else + { + SWSS_LOG_ERROR("remove status: %s", sai_serialize_status(status).c_str()); + } + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_remove(meta_key); + } + + return status; +} + +sai_status_t meta_sai_set_inseg_entry( + _In_ const sai_inseg_entry_t* inseg_entry, + _In_ const sai_attribute_t *attr, + _In_ sai_set_inseg_entry_attribute_fn set) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_inseg_entry(inseg_entry, false); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_INSEG_ENTRY, .objectkey = { .key = { .inseg_entry = *inseg_entry } } }; + + status = meta_generic_validation_set(meta_key, attr); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (set == NULL) + { + SWSS_LOG_ERROR("set function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = set(inseg_entry, attr); + + if (status == SAI_STATUS_SUCCESS) + { + SWSS_LOG_DEBUG("set status: %s", sai_serialize_status(status).c_str()); + } + else + { + SWSS_LOG_ERROR("set status: %s", sai_serialize_status(status).c_str()); + } + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_set(meta_key, attr); + } + + return status; +} + +sai_status_t meta_sai_get_inseg_entry( + _In_ const sai_inseg_entry_t* inseg_entry, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list, + _In_ sai_get_inseg_entry_attribute_fn get) +{ + SWSS_LOG_ENTER(); + + sai_status_t status = meta_sai_validate_inseg_entry(inseg_entry, false); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + sai_object_meta_key_t meta_key = { .objecttype = SAI_OBJECT_TYPE_INSEG_ENTRY, .objectkey = { .key = { .inseg_entry = *inseg_entry } } }; + + status = meta_generic_validation_get(meta_key, attr_count, attr_list); + + if (status != SAI_STATUS_SUCCESS) + { + return status; + } + + if (get == NULL) + { + SWSS_LOG_ERROR("get function pointer is NULL"); + + return SAI_STATUS_FAILURE; + } + + status = get(inseg_entry, attr_count, attr_list); + + META_LOG_STATUS(status); + + if (status == SAI_STATUS_SUCCESS) + { + meta_generic_validation_post_get(meta_key, inseg_entry->switch_id, attr_count, attr_list); + } + + return status; +} + // GENERIC sai_status_t meta_sai_validate_oid( diff --git a/meta/sai_meta.h b/meta/sai_meta.h index fe2439aadd90..29edd8edab6f 100644 --- a/meta/sai_meta.h +++ b/meta/sai_meta.h @@ -84,74 +84,46 @@ extern sai_status_t meta_sai_get_stats_oid( _Inout_ uint64_t *counter_list, _In_ sai_get_generic_stats_fn get); -// META FDB - -extern sai_status_t meta_sai_create_fdb_entry( - _In_ const sai_fdb_entry_t* fdb_entry, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list, - _In_ sai_create_fdb_entry_fn create); - -extern sai_status_t meta_sai_remove_fdb_entry( - _In_ const sai_fdb_entry_t* fdb_entry, - _In_ sai_remove_fdb_entry_fn remove); - -extern sai_status_t meta_sai_set_fdb_entry( - _In_ const sai_fdb_entry_t* fdb_entry, - _In_ const sai_attribute_t *attr, - _In_ sai_set_fdb_entry_attribute_fn set); - -extern sai_status_t meta_sai_get_fdb_entry( - _In_ const sai_fdb_entry_t* fdb_entry, - _In_ uint32_t attr_count, - _Inout_ sai_attribute_t *attr_list, - _In_ sai_get_fdb_entry_attribute_fn get); - -// META NEIGHBOR - -extern sai_status_t meta_sai_create_neighbor_entry( - _In_ const sai_neighbor_entry_t* neighbor_entry, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list, - _In_ sai_create_neighbor_entry_fn create); - -extern sai_status_t meta_sai_remove_neighbor_entry( - _In_ const sai_neighbor_entry_t* neighbor_entry, - _In_ sai_remove_neighbor_entry_fn remove); - -extern sai_status_t meta_sai_set_neighbor_entry( - _In_ const sai_neighbor_entry_t* neighbor_entry, - _In_ const sai_attribute_t *attr, - _In_ sai_set_neighbor_entry_attribute_fn set); - -extern sai_status_t meta_sai_get_neighbor_entry( - _In_ const sai_neighbor_entry_t* neighbor_entry, - _In_ uint32_t attr_count, - _Inout_ sai_attribute_t *attr_list, - _In_ sai_get_neighbor_entry_attribute_fn get); - -// META ROUTE - -extern sai_status_t meta_sai_create_route_entry( - _In_ const sai_route_entry_t* route_entry, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list, - _In_ sai_create_route_entry_fn create); - -extern sai_status_t meta_sai_remove_route_entry( - _In_ const sai_route_entry_t* route_entry, - _In_ sai_remove_route_entry_fn remove); - -extern sai_status_t meta_sai_set_route_entry( - _In_ const sai_route_entry_t* route_entry, - _In_ const sai_attribute_t *attr, - _In_ sai_set_route_entry_attribute_fn set); - -extern sai_status_t meta_sai_get_route_entry( - _In_ const sai_route_entry_t* route_entry, - _In_ uint32_t attr_count, - _Inout_ sai_attribute_t *attr_list, - _In_ sai_get_route_entry_attribute_fn get); +// META ENTRY QUAD + +#define META_CREATE_ENTRY(ot) \ + extern sai_status_t meta_sai_create_ ## ot( \ + _In_ const sai_ ## ot ## _t* ot, \ + _In_ uint32_t attr_count, \ + _In_ const sai_attribute_t *attr_list, \ + _In_ sai_create_ ## ot ## _fn create); + +#define META_REMOVE_ENTRY(ot) \ + extern sai_status_t meta_sai_remove_ ## ot( \ + _In_ const sai_ ## ot ## _t* ot, \ + _In_ sai_remove_ ## ot ##_fn remove); + +#define META_SET_ENTRY(ot) \ + extern sai_status_t meta_sai_set_ ## ot( \ + _In_ const sai_ ## ot ## _t* ot, \ + _In_ const sai_attribute_t *attr, \ + _In_ sai_set_ ## ot ## _attribute_fn set); + +#define META_GET_ENTRY(ot) \ + extern sai_status_t meta_sai_get_ ## ot( \ + _In_ const sai_ ## ot ## _t* ot, \ + _In_ uint32_t attr_count, \ + _Inout_ sai_attribute_t *attr_list, \ + _In_ sai_get_ ## ot ## _attribute_fn get); + +#define META_QUAD_ENTRY(ot) \ + META_CREATE_ENTRY(ot); \ + META_REMOVE_ENTRY(ot); \ + META_SET_ENTRY(ot); \ + META_GET_ENTRY(ot) + +META_QUAD_ENTRY(fdb_entry); +META_QUAD_ENTRY(inseg_entry); +META_QUAD_ENTRY(ipmc_entry); +META_QUAD_ENTRY(l2mc_entry); +META_QUAD_ENTRY(mcast_fdb_entry); +META_QUAD_ENTRY(neighbor_entry); +META_QUAD_ENTRY(route_entry); // NOTIFICATIONS diff --git a/meta/sai_serialize.h b/meta/sai_serialize.h index 4a0ddb81ffd9..16b2bf159731 100644 --- a/meta/sai_serialize.h +++ b/meta/sai_serialize.h @@ -43,6 +43,18 @@ std::string sai_serialize_neighbor_entry( std::string sai_serialize_route_entry( _In_ const sai_route_entry_t &route_entry); +std::string sai_serialize_inseg_entry( + _In_ const sai_inseg_entry_t &inseg_entry); + +std::string sai_serialize_l2mc_entry( + _In_ const sai_l2mc_entry_t &l2mc_entry); + +std::string sai_serialize_ipmc_entry( + _In_ const sai_ipmc_entry_t &ipmc_entry); + +std::string sai_serialize_mcast_fdb_entry( + _In_ const sai_mcast_fdb_entry_t &mcast_fdb_entry); + std::string sai_serialize_fdb_entry( _In_ const sai_fdb_entry_t &fdb_entry); @@ -117,6 +129,12 @@ std::string sai_serialize_mac( std::string sai_serialize_port_oper_status( _In_ sai_port_oper_status_t status); +std::string sai_serialize_l2mc_entry_type( + _In_ const sai_l2mc_entry_type_t type); + +std::string sai_serialize_ipmc_entry_type( + _In_ const sai_ipmc_entry_type_t type); + // serialize ntf std::string sai_serialize_fdb_event_ntf( @@ -171,6 +189,22 @@ void sai_deserialize_route_entry( _In_ const std::string& s, _In_ sai_route_entry_t &route_entry); +void sai_deserialize_inseg_entry( + _In_ const std::string& s, + _In_ sai_inseg_entry_t &inseg_entry); + +void sai_deserialize_l2mc_entry( + _In_ const std::string& s, + _In_ sai_l2mc_entry_t &l2mc_entry); + +void sai_deserialize_ipmc_entry( + _In_ const std::string& s, + _In_ sai_ipmc_entry_t &ipmc_entry); + +void sai_deserialize_mcast_fdb_entry( + _In_ const std::string& s, + _In_ sai_mcast_fdb_entry_t &mcast_fdb_entry); + void sai_deserialize_vlan_id( _In_ const std::string& s, _In_ sai_vlan_id_t& vlan_id); diff --git a/meta/saiserialize.cpp b/meta/saiserialize.cpp index 17ea33712dca..916757fa4b0a 100644 --- a/meta/saiserialize.cpp +++ b/meta/saiserialize.cpp @@ -709,6 +709,65 @@ std::string sai_serialize_route_entry( return j.dump(); } +std::string sai_serialize_ipmc_entry( + _In_ const sai_ipmc_entry_t& ipmc_entry) +{ + SWSS_LOG_ENTER(); + + json j; + + j["switch_id"] = sai_serialize_object_id(ipmc_entry.switch_id); + j["vr_id"] = sai_serialize_object_id(ipmc_entry.vr_id); + j["type"] = sai_serialize_ipmc_entry_type(ipmc_entry.type); + j["destination"] = sai_serialize_ip_address(ipmc_entry.destination); + j["sourte"] = sai_serialize_ip_address(ipmc_entry.source); + + return j.dump(); +} + +std::string sai_serialize_l2mc_entry( + _In_ const sai_l2mc_entry_t& l2mc_entry) +{ + SWSS_LOG_ENTER(); + + json j; + + j["switch_id"] = sai_serialize_object_id(l2mc_entry.switch_id); + j["bv_id"] = sai_serialize_object_id(l2mc_entry.bv_id); + j["type"] = sai_serialize_l2mc_entry_type(l2mc_entry.type); + j["destination"] = sai_serialize_ip_address(l2mc_entry.destination); + j["sourte"] = sai_serialize_ip_address(l2mc_entry.source); + + return j.dump(); +} + +std::string sai_serialize_mcast_fdb_entry( + _In_ const sai_mcast_fdb_entry_t& mcast_fdb_entry) +{ + SWSS_LOG_ENTER(); + + json j; + + j["switch_id"] = sai_serialize_object_id(mcast_fdb_entry.switch_id); + j["bv_id"] = sai_serialize_object_id(mcast_fdb_entry.bv_id); + j["mac_address"] = sai_serialize_mac(mcast_fdb_entry.mac_address); + + return j.dump(); +} + +std::string sai_serialize_inseg_entry( + _In_ const sai_inseg_entry_t& inseg_entry) +{ + SWSS_LOG_ENTER(); + + json j; + + j["switch_id"] = sai_serialize_object_id(inseg_entry.switch_id); + j["label"] = sai_serialize_number(inseg_entry.label); + + return j.dump(); +} + std::string sai_serialize_fdb_entry( _In_ const sai_fdb_entry_t& fdb_entry) { @@ -723,6 +782,22 @@ std::string sai_serialize_fdb_entry( return j.dump(); } +std::string sai_serialize_l2mc_entry_type( + _In_ const sai_l2mc_entry_type_t type) +{ + SWSS_LOG_ENTER(); + + return sai_serialize_enum(type, &sai_metadata_enum_sai_l2mc_entry_type_t); +} + +std::string sai_serialize_ipmc_entry_type( + _In_ const sai_ipmc_entry_type_t type) +{ + SWSS_LOG_ENTER(); + + return sai_serialize_enum(type, &sai_metadata_enum_sai_ipmc_entry_type_t); +} + std::string sai_serialize_port_stat( _In_ const sai_port_stat_t counter) { diff --git a/vslib/inc/sai_vs.h b/vslib/inc/sai_vs.h index 31d65ea8f4f2..533d84dc7b9d 100644 --- a/vslib/inc/sai_vs.h +++ b/vslib/inc/sai_vs.h @@ -72,13 +72,21 @@ extern sai_vs_switch_type_t g_vs_switch_type; extern std::recursive_mutex g_recursive_mutex; extern const sai_acl_api_t vs_acl_api; +extern const sai_bfd_api_t vs_bfd_api; extern const sai_bridge_api_t vs_bridge_api; extern const sai_buffer_api_t vs_buffer_api; +extern const sai_dtel_api_t vs_dtel_api; extern const sai_fdb_api_t vs_fdb_api; extern const sai_hash_api_t vs_hash_api; extern const sai_hostif_api_t vs_hostif_api; +extern const sai_ipmc_api_t vs_ipmc_api; +extern const sai_ipmc_group_api_t vs_ipmc_group_api; +extern const sai_l2mc_api_t vs_l2mc_api; +extern const sai_l2mc_group_api_t vs_l2mc_group_api; extern const sai_lag_api_t vs_lag_api; +extern const sai_mcast_fdb_api_t vs_mcast_fdb_api; extern const sai_mirror_api_t vs_mirror_api; +extern const sai_mpls_api_t vs_mpls_api; extern const sai_neighbor_api_t vs_neighbor_api; extern const sai_next_hop_api_t vs_next_hop_api; extern const sai_next_hop_group_api_t vs_next_hop_group_api; @@ -88,19 +96,22 @@ extern const sai_qos_map_api_t vs_qos_map_api; extern const sai_queue_api_t vs_queue_api; extern const sai_route_api_t vs_route_api; extern const sai_router_interface_api_t vs_router_interface_api; +extern const sai_rpf_group_api_t vs_rpf_group_api; extern const sai_samplepacket_api_t vs_samplepacket_api; extern const sai_scheduler_api_t vs_scheduler_api; extern const sai_scheduler_group_api_t vs_scheduler_group_api; +extern const sai_segmentroute_api_t vs_segmentroute_api; extern const sai_stp_api_t vs_stp_api; extern const sai_switch_api_t vs_switch_api; +extern const sai_tam_api_t vs_tam_api; extern const sai_tunnel_api_t vs_tunnel_api; +extern const sai_uburst_api_t vs_uburst_api; extern const sai_udf_api_t vs_udf_api; extern const sai_virtual_router_api_t vs_virtual_router_api; extern const sai_vlan_api_t vs_vlan_api; extern const sai_wred_api_t vs_wred_api; -extern const sai_dtel_api_t vs_dtel_api; -// CREATE +// OID QUAD sai_status_t vs_generic_create( _In_ sai_object_type_t object_type, @@ -109,77 +120,57 @@ sai_status_t vs_generic_create( _In_ uint32_t attr_count, _In_ const sai_attribute_t *attr_list); -sai_status_t vs_generic_create_fdb_entry( - _In_ const sai_fdb_entry_t *fdb_entry, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list); - -sai_status_t vs_generic_create_neighbor_entry( - _In_ const sai_neighbor_entry_t *neighbor_entry, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list); - -sai_status_t vs_generic_create_route_entry( - _In_ const sai_route_entry_t *route_entry, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list); - -// REMOVE - sai_status_t vs_generic_remove( _In_ sai_object_type_t object_type, _In_ sai_object_id_t object_id); -sai_status_t vs_generic_remove_fdb_entry( - _In_ const sai_fdb_entry_t *fdb_entry); - -sai_status_t vs_generic_remove_neighbor_entry( - _In_ const sai_neighbor_entry_t *neighbor_entry); - -sai_status_t vs_generic_remove_route_entry( - _In_ const sai_route_entry_t *route_entry); - -// SET - sai_status_t vs_generic_set( _In_ sai_object_type_t object_type, _In_ sai_object_id_t object_id, _In_ const sai_attribute_t *attr); -sai_status_t vs_generic_set_fdb_entry( - _In_ const sai_fdb_entry_t *fdb_entry, - _In_ const sai_attribute_t *attr); - -sai_status_t vs_generic_set_neighbor_entry( - _In_ const sai_neighbor_entry_t *neighbor_entry, - _In_ const sai_attribute_t *attr); - -sai_status_t vs_generic_set_route_entry( - _In_ const sai_route_entry_t *route_entry, - _In_ const sai_attribute_t *attr); - -// GET - sai_status_t vs_generic_get( _In_ sai_object_type_t object_type, _In_ sai_object_id_t object_id, _In_ uint32_t attr_count, _Out_ sai_attribute_t *attr_list); -sai_status_t vs_generic_get_fdb_entry( - _In_ const sai_fdb_entry_t *fdb_entry, - _In_ uint32_t attr_count, - _Out_ sai_attribute_t *attr_list); - -sai_status_t vs_generic_get_neighbor_entry( - _In_ const sai_neighbor_entry_t *neighbor_entry, - _In_ uint32_t attr_count, - _Out_ sai_attribute_t *attr_list); - -sai_status_t vs_generic_get_route_entry( - _In_ const sai_route_entry_t *route_entry, - _In_ uint32_t attr_count, - _Out_ sai_attribute_t *attr_list); +// ENTRY QUAD + +#define VS_CREATE_ENTRY_DEF(ot) \ + sai_status_t vs_generic_create_ ## ot( \ + _In_ const sai_ ## ot ## _t * ot, \ + _In_ uint32_t attr_count, \ + _In_ const sai_attribute_t *attr_list); + +#define VS_REMOVE_ENTRY_DEF(ot) \ + sai_status_t vs_generic_remove_ ## ot( \ + _In_ const sai_ ## ot ## _t * ot); + +#define VS_SET_ENTRY_DEF(ot) \ + sai_status_t vs_generic_set_ ## ot( \ + _In_ const sai_ ## ot ## _t * ot, \ + _In_ const sai_attribute_t *attr); + +#define VS_GET_ENTRY_DEF(ot) \ + sai_status_t vs_generic_get_ ## ot( \ + _In_ const sai_ ## ot ## _t * ot, \ + _In_ uint32_t attr_count, \ + _Out_ sai_attribute_t *attr_list); + +#define VS_ENTRY_QUAD(ot) \ + VS_CREATE_ENTRY_DEF(ot) \ + VS_REMOVE_ENTRY_DEF(ot) \ + VS_SET_ENTRY_DEF(ot) \ + VS_GET_ENTRY_DEF(ot) + +VS_ENTRY_QUAD(fdb_entry); +VS_ENTRY_QUAD(inseg_entry); +VS_ENTRY_QUAD(ipmc_entry); +VS_ENTRY_QUAD(l2mc_entry); +VS_ENTRY_QUAD(mcast_fdb_entry); +VS_ENTRY_QUAD(neighbor_entry); +VS_ENTRY_QUAD(route_entry); // STATS diff --git a/vslib/src/Makefile.am b/vslib/src/Makefile.am index 0991d0f105be..2129175487fe 100644 --- a/vslib/src/Makefile.am +++ b/vslib/src/Makefile.am @@ -10,15 +10,22 @@ lib_LTLIBRARIES = libsaivs.la libsaivs_la_SOURCES = \ sai_vs_acl.cpp \ + sai_vs_bfd.cpp \ sai_vs_bridge.cpp \ sai_vs_buffer.cpp \ + sai_vs_dtel.cpp \ sai_vs_fdb.cpp \ sai_vs_hash.cpp \ sai_vs_hostintf.cpp \ - sai_vs_dtel.cpp \ sai_vs_interfacequery.cpp \ + sai_vs_ipmc.cpp \ + sai_vs_ipmc_group.cpp \ + sai_vs_l2mc.cpp \ + sai_vs_l2mcgroup.cpp \ sai_vs_lag.cpp \ + sai_vs_mcastfdb.cpp \ sai_vs_mirror.cpp \ + sai_vs_mpls.cpp \ sai_vs_neighbor.cpp \ sai_vs_nexthop.cpp \ sai_vs_nexthopgroup.cpp \ @@ -28,12 +35,16 @@ libsaivs_la_SOURCES = \ sai_vs_queue.cpp \ sai_vs_route.cpp \ sai_vs_router_interface.cpp \ + sai_vs_rpfgroup.cpp \ sai_vs_samplepacket.cpp \ sai_vs_scheduler.cpp \ sai_vs_schedulergroup.cpp \ + sai_vs_segmentroute.cpp \ sai_vs_stp.cpp \ sai_vs_switch.cpp \ + sai_vs_tam.cpp \ sai_vs_tunnel.cpp \ + sai_vs_uburst.cpp \ sai_vs_udf.cpp \ sai_vs_virtual_router.cpp \ sai_vs_vlan.cpp \ diff --git a/vslib/src/sai_vs_bfd.cpp b/vslib/src/sai_vs_bfd.cpp new file mode 100644 index 000000000000..3f60ae8c22f0 --- /dev/null +++ b/vslib/src/sai_vs_bfd.cpp @@ -0,0 +1,11 @@ +#include "sai_vs.h" +#include "sai_vs_internal.h" + +VS_GENERIC_QUAD(BFD_SESSION,bfd_session); +VS_GENERIC_STATS(BFD_SESSION,bfd_session); + +const sai_bfd_api_t vs_bfd_api = { + + VS_GENERIC_QUAD_API(bfd_session) + VS_GENERIC_STATS_API(bfd_session) +}; diff --git a/vslib/src/sai_vs_generic_create.cpp b/vslib/src/sai_vs_generic_create.cpp index e3e353c9e93b..946f1b4ec167 100644 --- a/vslib/src/sai_vs_generic_create.cpp +++ b/vslib/src/sai_vs_generic_create.cpp @@ -314,53 +314,26 @@ sai_status_t vs_generic_create( attr_list); } -sai_status_t vs_generic_create_fdb_entry( - _In_ const sai_fdb_entry_t *fdb_entry, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - std::string str_fdb_entry = sai_serialize_fdb_entry(*fdb_entry); - - return internal_vs_generic_create( - SAI_OBJECT_TYPE_FDB_ENTRY, - str_fdb_entry, - fdb_entry->switch_id, - attr_count, - attr_list); -} - -sai_status_t vs_generic_create_neighbor_entry( - _In_ const sai_neighbor_entry_t *neighbor_entry, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - std::string str_neighbor_entry = sai_serialize_neighbor_entry(*neighbor_entry); - - return internal_vs_generic_create( - SAI_OBJECT_TYPE_NEIGHBOR_ENTRY, - str_neighbor_entry, - neighbor_entry->switch_id, - attr_count, - attr_list); -} - -sai_status_t vs_generic_create_route_entry( - _In_ const sai_route_entry_t *route_entry, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - std::string str_route_entry = sai_serialize_route_entry(*route_entry); +#define VS_ENTRY_CREATE(OT,ot) \ + sai_status_t vs_generic_create_ ## ot( \ + _In_ const sai_ ## ot ## _t * entry, \ + _In_ uint32_t attr_count, \ + _In_ const sai_attribute_t *attr_list) \ + { \ + SWSS_LOG_ENTER(); \ + std::string str = sai_serialize_ ## ot(*entry); \ + return internal_vs_generic_create( \ + SAI_OBJECT_TYPE_ ## OT, \ + str, \ + entry->switch_id, \ + attr_count, \ + attr_list); \ + } - return internal_vs_generic_create( - SAI_OBJECT_TYPE_ROUTE_ENTRY, - str_route_entry, - route_entry->switch_id, - attr_count, - attr_list); -} +VS_ENTRY_CREATE(FDB_ENTRY,fdb_entry); +VS_ENTRY_CREATE(INSEG_ENTRY,inseg_entry); +VS_ENTRY_CREATE(IPMC_ENTRY,ipmc_entry); +VS_ENTRY_CREATE(L2MC_ENTRY,l2mc_entry); +VS_ENTRY_CREATE(MCAST_FDB_ENTRY,mcast_fdb_entry); +VS_ENTRY_CREATE(NEIGHBOR_ENTRY,neighbor_entry); +VS_ENTRY_CREATE(ROUTE_ENTRY,route_entry); diff --git a/vslib/src/sai_vs_generic_get.cpp b/vslib/src/sai_vs_generic_get.cpp index 85f3a4a3ac61..5a433e6f3a8d 100644 --- a/vslib/src/sai_vs_generic_get.cpp +++ b/vslib/src/sai_vs_generic_get.cpp @@ -179,54 +179,26 @@ sai_status_t vs_generic_get( attr_list); } -sai_status_t vs_generic_get_fdb_entry( - _In_ const sai_fdb_entry_t *fdb_entry, - _In_ uint32_t attr_count, - _Out_ sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - std::string str_fdb_entry = sai_serialize_fdb_entry(*fdb_entry); - - return internal_vs_generic_get( - SAI_OBJECT_TYPE_FDB_ENTRY, - str_fdb_entry, - fdb_entry->switch_id, - attr_count, - attr_list); -} - -sai_status_t vs_generic_get_neighbor_entry( - _In_ const sai_neighbor_entry_t *neighbor_entry, - _In_ uint32_t attr_count, - _Out_ sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - std::string str_neighbor_entry = sai_serialize_neighbor_entry(*neighbor_entry); - - return internal_vs_generic_get( - SAI_OBJECT_TYPE_NEIGHBOR_ENTRY, - str_neighbor_entry, - neighbor_entry->switch_id, - attr_count, - attr_list); -} - -sai_status_t vs_generic_get_route_entry( - _In_ const sai_route_entry_t *route_entry, - _In_ uint32_t attr_count, - _Out_ sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - std::string str_route_entry = sai_serialize_route_entry(*route_entry); - - return internal_vs_generic_get( - SAI_OBJECT_TYPE_ROUTE_ENTRY, - str_route_entry, - route_entry->switch_id, - attr_count, - attr_list); +#define VS_ENTRY_GET(OT,ot) \ +sai_status_t vs_generic_get_ ## ot( \ + _In_ const sai_ ## ot ## _t *entry, \ + _In_ uint32_t attr_count, \ + _Out_ sai_attribute_t *attr_list) \ +{ \ + SWSS_LOG_ENTER(); \ + std::string str = sai_serialize_ ## ot(*entry); \ + return internal_vs_generic_get( \ + SAI_OBJECT_TYPE_ ## OT, \ + str, \ + entry->switch_id, \ + attr_count, \ + attr_list); \ } +VS_ENTRY_GET(FDB_ENTRY,fdb_entry); +VS_ENTRY_GET(INSEG_ENTRY,inseg_entry); +VS_ENTRY_GET(IPMC_ENTRY,ipmc_entry); +VS_ENTRY_GET(L2MC_ENTRY,l2mc_entry); +VS_ENTRY_GET(MCAST_FDB_ENTRY,mcast_fdb_entry); +VS_ENTRY_GET(NEIGHBOR_ENTRY,neighbor_entry); +VS_ENTRY_GET(ROUTE_ENTRY,route_entry); diff --git a/vslib/src/sai_vs_generic_remove.cpp b/vslib/src/sai_vs_generic_remove.cpp index 3ed15e7cd83f..43ea111d19b1 100644 --- a/vslib/src/sai_vs_generic_remove.cpp +++ b/vslib/src/sai_vs_generic_remove.cpp @@ -69,41 +69,22 @@ sai_status_t vs_generic_remove( return status; } -sai_status_t vs_generic_remove_fdb_entry( - _In_ const sai_fdb_entry_t *fdb_entry) -{ - SWSS_LOG_ENTER(); - - std::string str_fdb_entry = sai_serialize_fdb_entry(*fdb_entry); - - return internal_vs_generic_remove( - SAI_OBJECT_TYPE_FDB_ENTRY, - str_fdb_entry, - fdb_entry->switch_id); -} - -sai_status_t vs_generic_remove_neighbor_entry( - _In_ const sai_neighbor_entry_t *neighbor_entry) -{ - SWSS_LOG_ENTER(); - - std::string str_neighbor_entry = sai_serialize_neighbor_entry(*neighbor_entry); - - return internal_vs_generic_remove( - SAI_OBJECT_TYPE_NEIGHBOR_ENTRY, - str_neighbor_entry, - neighbor_entry->switch_id); -} - -sai_status_t vs_generic_remove_route_entry( - _In_ const sai_route_entry_t *route_entry) -{ - SWSS_LOG_ENTER(); - - std::string str_route_entry = sai_serialize_route_entry(*route_entry); +#define VS_ENTRY_REMOVE(OT,ot) \ + sai_status_t vs_generic_remove_ ## ot( \ + _In_ const sai_ ## ot ## _t *entry) \ + { \ + SWSS_LOG_ENTER(); \ + std::string str = sai_serialize_ ## ot(*entry); \ + return internal_vs_generic_remove( \ + SAI_OBJECT_TYPE_ ## OT, \ + str, \ + entry->switch_id); \ + } - return internal_vs_generic_remove( - SAI_OBJECT_TYPE_ROUTE_ENTRY, - str_route_entry, - route_entry->switch_id); -} +VS_ENTRY_REMOVE(FDB_ENTRY,fdb_entry); +VS_ENTRY_REMOVE(INSEG_ENTRY,inseg_entry); +VS_ENTRY_REMOVE(IPMC_ENTRY,ipmc_entry); +VS_ENTRY_REMOVE(L2MC_ENTRY,l2mc_entry); +VS_ENTRY_REMOVE(MCAST_FDB_ENTRY,mcast_fdb_entry); +VS_ENTRY_REMOVE(NEIGHBOR_ENTRY,neighbor_entry); +VS_ENTRY_REMOVE(ROUTE_ENTRY,route_entry); diff --git a/vslib/src/sai_vs_generic_set.cpp b/vslib/src/sai_vs_generic_set.cpp index 3e5246ea6872..109b4c35b969 100644 --- a/vslib/src/sai_vs_generic_set.cpp +++ b/vslib/src/sai_vs_generic_set.cpp @@ -50,47 +50,24 @@ sai_status_t vs_generic_set( attr); } -sai_status_t vs_generic_set_fdb_entry( - _In_ const sai_fdb_entry_t *fdb_entry, - _In_ const sai_attribute_t *attr) -{ - SWSS_LOG_ENTER(); - - std::string str_fdb_entry = sai_serialize_fdb_entry(*fdb_entry); - - return internal_vs_generic_set( - SAI_OBJECT_TYPE_FDB_ENTRY, - str_fdb_entry, - fdb_entry->switch_id, - attr); -} - -sai_status_t vs_generic_set_neighbor_entry( - _In_ const sai_neighbor_entry_t *neighbor_entry, - _In_ const sai_attribute_t *attr) -{ - SWSS_LOG_ENTER(); - - std::string str_neighbor_entry = sai_serialize_neighbor_entry(*neighbor_entry); - - return internal_vs_generic_set( - SAI_OBJECT_TYPE_NEIGHBOR_ENTRY, - str_neighbor_entry, - neighbor_entry->switch_id, - attr); +#define VS_ENTRY_SET(OT,ot) \ +sai_status_t vs_generic_set_ ## ot( \ + _In_ const sai_ ## ot ## _t *entry, \ + _In_ const sai_attribute_t *attr) \ +{ \ + SWSS_LOG_ENTER(); \ + std::string str = sai_serialize_ ## ot(*entry); \ + return internal_vs_generic_set( \ + SAI_OBJECT_TYPE_ ## OT, \ + str, \ + entry->switch_id, \ + attr); \ } -sai_status_t vs_generic_set_route_entry( - _In_ const sai_route_entry_t *route_entry, - _In_ const sai_attribute_t *attr) -{ - SWSS_LOG_ENTER(); - - std::string str_route_entry = sai_serialize_route_entry(*route_entry); - - return internal_vs_generic_set( - SAI_OBJECT_TYPE_ROUTE_ENTRY, - str_route_entry, - route_entry->switch_id, - attr); -} +VS_ENTRY_SET(FDB_ENTRY,fdb_entry); +VS_ENTRY_SET(INSEG_ENTRY,inseg_entry); +VS_ENTRY_SET(IPMC_ENTRY,ipmc_entry); +VS_ENTRY_SET(L2MC_ENTRY,l2mc_entry); +VS_ENTRY_SET(MCAST_FDB_ENTRY,mcast_fdb_entry); +VS_ENTRY_SET(NEIGHBOR_ENTRY,neighbor_entry); +VS_ENTRY_SET(ROUTE_ENTRY,route_entry); diff --git a/vslib/src/sai_vs_interfacequery.cpp b/vslib/src/sai_vs_interfacequery.cpp index d1e7bd9b496b..b31b80965476 100644 --- a/vslib/src/sai_vs_interfacequery.cpp +++ b/vslib/src/sai_vs_interfacequery.cpp @@ -627,39 +627,45 @@ sai_status_t sai_api_query( switch (sai_api_id) { API_CASE(ACL,acl); + API_CASE(BFD,bfd); API_CASE(BRIDGE,bridge); API_CASE(BUFFER,buffer); + API_CASE(DTEL,dtel); API_CASE(FDB,fdb); API_CASE(HASH,hash); API_CASE(HOSTIF,hostif); - //API_CASE(IPMC,ipmc); - //API_CASE(IPMC_GROUP,ipmc_group); - //API_CASE(L2MC,l2mc); - //API_CASE(L2MC_GROUP,l2mc_group); + API_CASE(IPMC_GROUP,ipmc_group); + API_CASE(IPMC,ipmc); + //API_CASE(ISOLATION_GROUP,isolation_group); + API_CASE(L2MC_GROUP,l2mc_group); + API_CASE(L2MC,l2mc); API_CASE(LAG,lag); - //API_CASE(MCAST_FDB,mcast_fdb); + API_CASE(MCAST_FDB,mcast_fdb); API_CASE(MIRROR,mirror); + API_CASE(MPLS,mpls); API_CASE(NEIGHBOR,neighbor); - API_CASE(NEXT_HOP,next_hop); API_CASE(NEXT_HOP_GROUP,next_hop_group); + API_CASE(NEXT_HOP,next_hop); API_CASE(POLICER,policer); API_CASE(PORT,port); API_CASE(QOS_MAP,qos_map); API_CASE(QUEUE,queue); - API_CASE(ROUTE,route); API_CASE(ROUTER_INTERFACE,router_interface); - //API_CASE(RPF_GROUP,rpf_group); + API_CASE(ROUTE,route); + API_CASE(RPF_GROUP,rpf_group); API_CASE(SAMPLEPACKET,samplepacket); - API_CASE(SCHEDULER,scheduler); API_CASE(SCHEDULER_GROUP,scheduler_group); + API_CASE(SCHEDULER,scheduler); + API_CASE(SEGMENTROUTE,segmentroute); API_CASE(STP,stp); API_CASE(SWITCH,switch); + API_CASE(TAM,tam); API_CASE(TUNNEL,tunnel); + API_CASE(UBURST,uburst); API_CASE(UDF,udf); API_CASE(VIRTUAL_ROUTER,virtual_router); API_CASE(VLAN,vlan); API_CASE(WRED,wred); - API_CASE(DTEL,dtel); default: SWSS_LOG_ERROR("Invalid API type %d", sai_api_id); diff --git a/vslib/src/sai_vs_ipmc.cpp b/vslib/src/sai_vs_ipmc.cpp new file mode 100644 index 000000000000..5ead33a9927a --- /dev/null +++ b/vslib/src/sai_vs_ipmc.cpp @@ -0,0 +1,9 @@ +#include "sai_vs.h" +#include "sai_vs_internal.h" + +VS_GENERIC_QUAD_ENTRY(IPMC_ENTRY,ipmc_entry); + +const sai_ipmc_api_t vs_ipmc_api = { + + VS_GENERIC_QUAD_API(ipmc_entry) +}; diff --git a/vslib/src/sai_vs_ipmc_group.cpp b/vslib/src/sai_vs_ipmc_group.cpp new file mode 100644 index 000000000000..41630b4b094b --- /dev/null +++ b/vslib/src/sai_vs_ipmc_group.cpp @@ -0,0 +1,11 @@ +#include "sai_vs.h" +#include "sai_vs_internal.h" + +VS_GENERIC_QUAD(IPMC_GROUP,ipmc_group); +VS_GENERIC_QUAD(IPMC_GROUP_MEMBER,ipmc_group_member); + +const sai_ipmc_group_api_t vs_ipmc_group_api = { + + VS_GENERIC_QUAD_API(ipmc_group) + VS_GENERIC_QUAD_API(ipmc_group_member) +}; diff --git a/vslib/src/sai_vs_l2mc.cpp b/vslib/src/sai_vs_l2mc.cpp new file mode 100644 index 000000000000..11061fcefa66 --- /dev/null +++ b/vslib/src/sai_vs_l2mc.cpp @@ -0,0 +1,9 @@ +#include "sai_vs.h" +#include "sai_vs_internal.h" + +VS_GENERIC_QUAD_ENTRY(L2MC_ENTRY,l2mc_entry); + +const sai_l2mc_api_t vs_l2mc_api = { + + VS_GENERIC_QUAD_API(l2mc_entry) +}; diff --git a/vslib/src/sai_vs_l2mcgroup.cpp b/vslib/src/sai_vs_l2mcgroup.cpp new file mode 100644 index 000000000000..6a4c17c232bd --- /dev/null +++ b/vslib/src/sai_vs_l2mcgroup.cpp @@ -0,0 +1,11 @@ +#include "sai_vs.h" +#include "sai_vs_internal.h" + +VS_GENERIC_QUAD(L2MC_GROUP,l2mc_group); +VS_GENERIC_QUAD(L2MC_GROUP_MEMBER,l2mc_group_member); + +const sai_l2mc_group_api_t vs_l2mc_group_api = { + + VS_GENERIC_QUAD_API(l2mc_group) + VS_GENERIC_QUAD_API(l2mc_group_member) +}; diff --git a/vslib/src/sai_vs_mcastfdb.cpp b/vslib/src/sai_vs_mcastfdb.cpp new file mode 100644 index 000000000000..cf46fa89180f --- /dev/null +++ b/vslib/src/sai_vs_mcastfdb.cpp @@ -0,0 +1,9 @@ +#include "sai_vs.h" +#include "sai_vs_internal.h" + +VS_GENERIC_QUAD_ENTRY(MCAST_FDB_ENTRY,mcast_fdb_entry); + +const sai_mcast_fdb_api_t vs_mcast_fdb_api = { + + VS_GENERIC_QUAD_API(mcast_fdb_entry) +}; diff --git a/vslib/src/sai_vs_mpls.cpp b/vslib/src/sai_vs_mpls.cpp new file mode 100644 index 000000000000..b9605ef19cbf --- /dev/null +++ b/vslib/src/sai_vs_mpls.cpp @@ -0,0 +1,9 @@ +#include "sai_vs.h" +#include "sai_vs_internal.h" + +VS_GENERIC_QUAD_ENTRY(INSEG_ENTRY,inseg_entry); + +const sai_mpls_api_t vs_mpls_api = { + + VS_GENERIC_QUAD_API(inseg_entry) +}; diff --git a/vslib/src/sai_vs_rpfgroup.cpp b/vslib/src/sai_vs_rpfgroup.cpp new file mode 100644 index 000000000000..7a245bf5aa31 --- /dev/null +++ b/vslib/src/sai_vs_rpfgroup.cpp @@ -0,0 +1,11 @@ +#include "sai_vs.h" +#include "sai_vs_internal.h" + +VS_GENERIC_QUAD(RPF_GROUP,rpf_group); +VS_GENERIC_QUAD(RPF_GROUP_MEMBER,rpf_group_member); + +const sai_rpf_group_api_t vs_rpf_group_api = { + + VS_GENERIC_QUAD_API(rpf_group) + VS_GENERIC_QUAD_API(rpf_group_member) +}; diff --git a/vslib/src/sai_vs_segmentroute.cpp b/vslib/src/sai_vs_segmentroute.cpp new file mode 100644 index 000000000000..94a5f9795deb --- /dev/null +++ b/vslib/src/sai_vs_segmentroute.cpp @@ -0,0 +1,41 @@ +#include "sai_vs.h" +#include "sai_vs_internal.h" + +sai_status_t vs_create_segmentroute_sidlists( + _In_ sai_object_id_t switch_id, + _In_ uint32_t object_count, + _In_ const uint32_t *attr_count, + _In_ const sai_attribute_t **attrs, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_object_id_t *object_id, + _Out_ sai_status_t *object_statuses) +{ + MUTEX(); + + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t vs_remove_segmentroute_sidlists( + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + MUTEX(); + + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +VS_GENERIC_QUAD(SEGMENTROUTE_SIDLIST,segmentroute_sidlist); + +const sai_segmentroute_api_t vs_segmentroute_api = { + + VS_GENERIC_QUAD_API(segmentroute_sidlist) + + vs_create_segmentroute_sidlists, + vs_remove_segmentroute_sidlists, +}; diff --git a/vslib/src/sai_vs_tam.cpp b/vslib/src/sai_vs_tam.cpp new file mode 100644 index 000000000000..311fc5e1a216 --- /dev/null +++ b/vslib/src/sai_vs_tam.cpp @@ -0,0 +1,31 @@ +#include "sai_vs.h" +#include "sai_vs_internal.h" + +sai_status_t vs_get_tam_snapshot_stats( + _In_ sai_object_id_t tam_snapshot_id, + _Inout_ uint32_t *number_of_counters, + _Inout_ sai_tam_statistic_t *statistics) +{ + MUTEX(); + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +VS_GENERIC_QUAD(TAM,tam); +VS_GENERIC_QUAD(TAM_STAT,tam_stat); +VS_GENERIC_QUAD(TAM_THRESHOLD,tam_threshold); +VS_GENERIC_QUAD(TAM_SNAPSHOT,tam_snapshot); +VS_GENERIC_QUAD(TAM_TRANSPORTER,tam_transporter); + +const sai_tam_api_t vs_tam_api = { + + VS_GENERIC_QUAD_API(tam) + VS_GENERIC_QUAD_API(tam_stat) + VS_GENERIC_QUAD_API(tam_threshold) + VS_GENERIC_QUAD_API(tam_snapshot) + + vs_get_tam_snapshot_stats, + + VS_GENERIC_QUAD_API(tam_transporter) +}; diff --git a/vslib/src/sai_vs_uburst.cpp b/vslib/src/sai_vs_uburst.cpp new file mode 100644 index 000000000000..70de5bc7440a --- /dev/null +++ b/vslib/src/sai_vs_uburst.cpp @@ -0,0 +1,25 @@ +#include "sai_vs.h" +#include "sai_vs_internal.h" + +VS_GENERIC_QUAD(TAM_MICROBURST,tam_microburst); +VS_GENERIC_QUAD(TAM_HISTOGRAM,tam_histogram); + +sai_status_t vs_get_tam_histogram_stats( + _In_ sai_object_id_t tam_histogram_id, + _Inout_ uint32_t *number_of_counters, + _Out_ uint64_t *counters) +{ + MUTEX(); + + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +const sai_uburst_api_t vs_uburst_api = { + + VS_GENERIC_QUAD_API(tam_microburst) + VS_GENERIC_QUAD_API(tam_histogram) + + vs_get_tam_histogram_stats +};