in ptf/saihash.py [0:0]
def hash_to_hash_fields(hash_dict):
"""
Creates hash fields list
Args:
hash_dict (dict): dictionary with variables that defines the list
of hash test fields and traffic header hashed fields
Returns:
list: hash fields list
"""
hash_fields = []
if ('hash_src_ip' in hash_dict) and \
(hash_dict['hash_src_ip'] is not None):
hash_fields.append(SAI_NATIVE_HASH_FIELD_SRC_IP)
if ('hash_dst_ip' in hash_dict) and (hash_dict['hash_dst_ip'] is not None):
hash_fields.append(SAI_NATIVE_HASH_FIELD_DST_IP)
if ('hash_dst_mac' in hash_dict) and \
(hash_dict['hash_dst_mac'] is not None):
hash_fields.append(SAI_NATIVE_HASH_FIELD_DST_MAC)
if ('hash_src_mac' in hash_dict) and \
(hash_dict['hash_src_mac'] is not None):
hash_fields.append(SAI_NATIVE_HASH_FIELD_SRC_MAC)
if ('hash_udp_dport' in hash_dict) and \
(hash_dict['hash_udp_dport'] is not None):
hash_fields.append(SAI_NATIVE_HASH_FIELD_L4_DST_PORT)
if ('hash_udp_sport' in hash_dict) and \
(hash_dict['hash_udp_sport'] is not None):
hash_fields.append(SAI_NATIVE_HASH_FIELD_L4_SRC_PORT)
if ('hash_ether_type' in hash_dict) and \
(hash_dict['hash_ether_type'] is not None):
hash_fields.append(SAI_NATIVE_HASH_FIELD_ETHERTYPE)
if ('hash_flow_label' in hash_dict) and \
(hash_dict['hash_flow_label'] is not None):
hash_fields.append(SAI_NATIVE_HASH_FIELD_IPV6_FLOW_LABEL)
return hash_fields