Get Mtf Filter Module

class mtf.utils.eth_filters.get_mtf_filter.FilterProcessor

Creates an object from user dict

__init__(**kwargs)
mtf_class_name()
static get_tecmp_types(key, value)
static get_cmp_types(key, value)

Converts message types or payload types from string representation to enum values.

=== Arguments Description ===

*key * (str): The type of key to be converted.

*value * (str/list): The value(s) to be converted.

=== Returns ===

tuple: A tuple containing the key and the converted value(s).

static patch_types(key, value, filter_type: type | None = None) tuple

Converts message types or payload types from string representation to enum values.

=== Arguments Description ===

*key * (str): The type of key to be converted.

*value * (str/list): The value(s) to be converted.

*filter_type * (type, optional): The type of filter to be applied

=== Returns ===

tuple: A tuple containing the key and the converted value.

mtf.utils.eth_filters.get_mtf_filter.steps_to_create_mtf_filter(user_input: FilterProcessor)

Generate the corresponding class instance and update its attributes

class mtf.utils.eth_filters.get_mtf_filter.InputFilterToMtfWrapper

Get the corresponding mtf filter class name, create an instance from it and update its attribute’s values.

static create_filter_instance(name: str) mtf_eth_filter

Returns the corresponding mtf filter class instance using the imported class above from mtf_binder. The possible mtf filter classes are:

mtf_eth_basic_filter, mtf_ipv4_layer_filter, mtf_tecmp_msg_type, mtf_tecmp_data_type, mtf_data_link_layer_filter, mtf_vlan_filter, mtf_net_layer_filter, mtf_eth_filter_vlan_type, mtf_eth_protocol_type, mtf_eth_tp_layer_filter, mtf_udp_layer_filter, mtf_tcp_layer_filter, mtf_eth_app_layer_filter, mtf_someip_filter, mtf_someipsd_filter, mtf_eth_npdu_filter, mtf_tecmp_filter

Return:

mtf class instance

static set_filter_attributes(mtf_filter_instance: mtf_eth_filter, map_attributes_values: dict)

Set the filter attribute values Note: The network layer is a special case; it could be UDP or TCP

static create_multifilter(attributes) mtf_eth_filter
mtf.utils.eth_filters.get_mtf_filter.create_loaded_schema_name(file: str)

Return the file name without its extension It could be any one of : mtf_eth_app_layer_filter | mtf_eth_basic_filter | mtf_eth_npdu_filter | mtf_eth_protocol_type | mtf_eth_tp_layer_filter | mtf_filter_name | mtf_ipv4_layer_filter | mtf_ipv6_layer_filter | mtf_net_layer_filter | mtf_protocol_type_filter |mtf_someip_filter|mtf_tcp_layer_filter | mtf_eth_filter_vlan_type| mtf_tecmp_data_type | mtf_tecmp_msg_type | mtf_tecmp_filter | mtf_vlan_filter | mtf_data_link_layer_filter

class mtf.utils.eth_filters.get_mtf_filter.SchemaLoaderValidator

This class gets all the mtf filter schemas, load them, and validate the given user input for the filter

__init__()
read_schemas()

Read all the json files from the relative path

load_schemas()

Load the json schemas and save them

user_schema_dissector(user_input: FilterProcessor)

returns the corresponding schema for the user schema to be used for validation

validate_user_schema(user_input: FilterProcessor)

Validate the user input. The link between user_input and the loaded schema is the ‘filter_name’

mtf.utils.eth_filters.get_mtf_filter.create_ethernet_filter(user_input: FilterProcessor)

Giving the user dict having the ethernet filter values. Returns the mtf filter