SAI Metadata
Loading...
Searching...
No Matches
SAI - Metadata Utilities Definitions

Functions

bool sai_metadata_is_allowed_object_type (_In_ const sai_attr_metadata_t *metadata, _In_ sai_object_type_t object_type)
 Is allowed object type.
 
bool sai_metadata_is_allowed_enum_value (_In_ const sai_attr_metadata_t *metadata, _In_ int value)
 Is allowed enum value.
 
const sai_attr_metadata_tsai_metadata_get_attr_metadata (_In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id)
 Gets attribute metadata based on object type and attribute id.
 
const sai_attr_metadata_tsai_metadata_get_attr_metadata_by_attr_id_name (_In_ const char *attr_id_name)
 Gets attribute metadata based on attribute id name.
 
const sai_attr_metadata_tsai_metadata_get_attr_metadata_by_attr_id_name_ext (_In_ const char *attr_id_name)
 Gets attribute metadata based on attribute id name, supporting case of attribute id name is in deserialized buffer and terminated by characters listed in function sai_serialize_is_char_allowed.
 
const sai_attr_metadata_tsai_metadata_get_ignored_attr_metadata_by_attr_id_name (_In_ const char *attr_id_name)
 Gets ignored attribute metadata based on attribute id name.
 
const char * sai_metadata_get_enum_value_name (_In_ const sai_enum_metadata_t *metadata, _In_ int value)
 Gets string representation of enum value.
 
const sai_attribute_tsai_metadata_get_attr_by_id (_In_ sai_attr_id_t id, _In_ uint32_t attr_count, _In_ const sai_attribute_t *attr_list)
 Gets attribute from attribute list by attribute id.
 
const sai_object_type_info_tsai_metadata_get_object_type_info (_In_ sai_object_type_t object_type)
 Gets object type info.
 
bool sai_metadata_is_object_type_valid (_In_ sai_object_type_t object_type)
 Checks if object type is valid.
 
bool sai_metadata_is_object_type_oid (_In_ sai_object_type_t object_type)
 Checks whether object type is OID object type.
 
bool sai_metadata_is_condition_met (_In_ const sai_attr_metadata_t *metadata, _In_ uint32_t attr_count, _In_ const sai_attribute_t *attr_list)
 Check if condition met.
 
bool sai_metadata_is_validonly_met (_In_ const sai_attr_metadata_t *metadata, _In_ uint32_t attr_count, _In_ const sai_attribute_t *attr_list)
 Check if valid only condition is met.
 
sai_api_version_t sai_metadata_query_api_version (void)
 Metadata query API version.
 

Detailed Description

Function Documentation

◆ sai_metadata_get_attr_by_id()

const sai_attribute_t * sai_metadata_get_attr_by_id ( _In_ sai_attr_id_t  id,
_In_ uint32_t  attr_count,
_In_ const sai_attribute_t attr_list 
)

Gets attribute from attribute list by attribute id.

Parameters
[in]idAttribute id to be found.
[in]attr_countTotal number of attributes.
[in]attr_listList of attributes to search.
Returns
Attribute pointer with requested ID or NULL if not found. When multiple attributes with the same id are passed, only first attribute is returned.

◆ sai_metadata_get_attr_metadata()

const sai_attr_metadata_t * sai_metadata_get_attr_metadata ( _In_ sai_object_type_t  object_type,
_In_ sai_attr_id_t  attr_id 
)

Gets attribute metadata based on object type and attribute id.

Parameters
[in]object_typeObject type
[in]attr_idAttribute Id
Returns
Pointer to object metadata or NULL in case of failure

◆ sai_metadata_get_attr_metadata_by_attr_id_name()

const sai_attr_metadata_t * sai_metadata_get_attr_metadata_by_attr_id_name ( _In_ const char *  attr_id_name)

Gets attribute metadata based on attribute id name.

Parameters
[in]attr_id_nameAttribute id name
Returns
Pointer to object metadata or NULL in case of failure

◆ sai_metadata_get_attr_metadata_by_attr_id_name_ext()

const sai_attr_metadata_t * sai_metadata_get_attr_metadata_by_attr_id_name_ext ( _In_ const char *  attr_id_name)

Gets attribute metadata based on attribute id name, supporting case of attribute id name is in deserialized buffer and terminated by characters listed in function sai_serialize_is_char_allowed.

Parameters
[in]attr_id_nameAttribute id name
Returns
Pointer to object metadata or NULL in case of failure

◆ sai_metadata_get_enum_value_name()

const char * sai_metadata_get_enum_value_name ( _In_ const sai_enum_metadata_t metadata,
_In_ int  value 
)

Gets string representation of enum value.

Parameters
[in]metadataEnum metadata
[in]valueEnum value to be converted to string
Returns
String representation of enum value or NULL if value was not found

◆ sai_metadata_get_ignored_attr_metadata_by_attr_id_name()

const sai_attr_metadata_t * sai_metadata_get_ignored_attr_metadata_by_attr_id_name ( _In_ const char *  attr_id_name)

Gets ignored attribute metadata based on attribute id name.

Parameters
[in]attr_id_nameAttribute id name
Returns
Pointer to object metadata or NULL in case of failure

◆ sai_metadata_get_object_type_info()

const sai_object_type_info_t * sai_metadata_get_object_type_info ( _In_ sai_object_type_t  object_type)

Gets object type info.

Parameters
[in]object_typeObject type
Returns
Object type info structure or NULL if not found

◆ sai_metadata_is_allowed_enum_value()

bool sai_metadata_is_allowed_enum_value ( _In_ const sai_attr_metadata_t metadata,
_In_ int  value 
)

Is allowed enum value.

Parameters
[in]metadataAttribute metadata
[in]valueEnum value to be checked
Returns
True if enum value is allowed on this attribute, false otherwise

◆ sai_metadata_is_allowed_object_type()

bool sai_metadata_is_allowed_object_type ( _In_ const sai_attr_metadata_t metadata,
_In_ sai_object_type_t  object_type 
)

Is allowed object type.

Parameters
[in]metadataAttribute metadata
[in]object_typeObject type to be checked
Returns
True if object is allowed on this attribute, false otherwise

◆ sai_metadata_is_condition_met()

bool sai_metadata_is_condition_met ( _In_ const sai_attr_metadata_t metadata,
_In_ uint32_t  attr_count,
_In_ const sai_attribute_t attr_list 
)

Check if condition met.

List of attributes will be examined in terms of conditions. This is convenient since user can pass list when calling create API. If condition attribute is not on the list, then default value will be examined.

NOTE: When multiple attributes with the same ID are passed, sai_metadata_get_attr_by_id will select only first one. Function will not be able to handle duplicated attributes.

Parameters
[in]metadataMetadata of attribute that we need to check.
[in]attr_countNumber of attributes.
[in]attr_listAttribute list to check. All attributes must belong to the same object type as metadata parameter.
Returns
True if condition is in force, false otherwise. False will be also returned if any of input pointers is NULL or attribute is not conditional.

◆ sai_metadata_is_object_type_oid()

bool sai_metadata_is_object_type_oid ( _In_ sai_object_type_t  object_type)

Checks whether object type is OID object type.

Parameters
[in]object_typeObject type to be checked.
Returns
True if object type is OID type, false otherwise.

◆ sai_metadata_is_object_type_valid()

bool sai_metadata_is_object_type_valid ( _In_ sai_object_type_t  object_type)

Checks if object type is valid.

Parameters
[in]object_typeObject type
Returns
True if object type is valid, false otherwise

◆ sai_metadata_is_validonly_met()

bool sai_metadata_is_validonly_met ( _In_ const sai_attr_metadata_t metadata,
_In_ uint32_t  attr_count,
_In_ const sai_attribute_t attr_list 
)

Check if valid only condition is met.

List of attributes will be examined in terms of valid only conditions. This is convenient since user can pass list when calling create API. If valid only condition attribute is not on the list, then default value will be examined.

NOTE: When multiple attributes with the same ID are passed, sai_metadata_get_attr_by_id will select only first one. Function will not be able to handle duplicated attributes.

Parameters
[in]metadataMetadata of attribute that we need to check.
[in]attr_countNumber of attributes.
[in]attr_listAttribute list to check. All attributes must belong to the same object type as metadata parameter.
Returns
True if valid only condition is in force, false otherwise. False will be also returned if any of input pointers is NULL or attribute is not valid only conditional.

◆ sai_metadata_query_api_version()

sai_api_version_t sai_metadata_query_api_version ( void  )

Metadata query API version.

Will return SAI version which was used to generate metadata.