byteblower_test_framework.factory module

Factory helper functions.

byteblower_test_framework.factory.create_frame(source_port: Port | Endpoint, length: int | None = None, udp_src: int | None = None, udp_dest: int | None = None, ip_ecn: int | None = None, ip_dscp: int | None = None, ip_traffic_class: int | None = None, latency_tag: bool = False) Frame | MobileFrame

Create a frame based on the (source) Port type.

Parameters:
  • source_port (Union[Port, Endpoint]) – Port which will be transmitting the Frame. Used to identify which Frame implementation we need (IPv4Frame or IPv6Frame)

  • length (Optional[int], optional) – Frame length. This is the layer 2 (Ethernet) frame length excluding Ethernet FCS and excluding VLAN tags, defaults to DEFAULT_FRAME_LENGTH

  • udp_src (Optional[int], optional) – UDP source port, defaults to UDP_DYNAMIC_PORT_START

  • udp_dest (Optional[int], optional) – UDP destination port, defaults to UDP_DYNAMIC_PORT_START

  • ip_dscp (Optional[int], optional) – IP Differentiated Services Code Point (DSCP), mutual exclusive with ip_traffic_class, defaults to DEFAULT_IP_DSCP

  • ip_ecn (Optional[int], optional) – IP Explicit Congestion Notification (ECN), mutual exclusive with ip_traffic_class, defaults to DEFAULT_IP_ECN

  • ip_traffic_class (Optional[int], optional) – The IP traffic class value is used to specify the exact value of either the IPv4 ToS field or the IPv6 Traffic Class field, mutual exclusive with ip_dscp and ip_ecn, defaults to field value composed from ip_dscp and ip_ecn.

  • latency_tag (bool, optional) – Enable latency tag generation in the Frame, defaults to False

Raises:
  • InvalidInput – When an unknown Port implementation is given.

  • InvalidInput – When invalid configuration values are given.

  • ConflictingInput – When invalid combination of configuration parameters is given

Returns:

New instance of an IPv4 or IPv6 Frame interface

Return type:

Union[Frame, MobileFrame]

Changed in version 1.2.0: Adding MobileFrame with ByteBlower Endpoint support.