simple_ostinato.protocols package¶
-
class
simple_ostinato.protocols.
Mac
(source='00:00:00:00:00:00', destination='FF:FF:FF:FF:FF:FF', **kwargs)[source]¶ Represent the MAC layer. Since we make a distiction between the MAC layer and the Ethernet layer, this layer defines the source and destination MAC addresses.
-
from_dict
(dict_)¶ Set the Mac layer configuration from a dictionary. Keys must be the same as the attributes names, and values but by valid values for these attributes.
-
to_dict
()¶ Return the Mac layer configuration as a dictionnary.
-
destination
¶ destination MAC address
-
destination_count
¶ If
destination_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
destination_mode
¶
-
destination_step
¶ If
destination_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
source
¶ Source MAC address
-
source_count
¶ If
source_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
source_mode
¶
-
source_step
¶ If
source_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
-
class
simple_ostinato.protocols.
Ethernet
(ether_type='0x0800', **kwargs)[source]¶ Represent the ethernet layer. Since we make a distinction between the MAC layer and the Ethernet layer, this layer only defines the ethernet type
-
from_dict
(dict_)¶ Set the Ethernet layer configuration from a dictionary. Keys must be the same as the attributes names, and values but by valid values for these attributes.
-
to_dict
()¶ Return the Ethernet layer configuration as a dictionnary.
-
ether_type
¶ Ethernet type field. 0x800 is for IPv4 inner packets.. By default, this attribute is set automatically. Set
ether_type_override
toTrue
to override this field
-
ether_type_count
¶ If
ether_type_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
ether_type_mode
¶ By default,
ether_type_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
ether_type_override
¶
-
ether_type_step
¶ If
ether_type_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
-
class
simple_ostinato.protocols.
IPv4
(flag_unused=0, dscp=0, flag_mf=0, ttl=127, protocol=0, header_length=5, fragments_offset=0, tos=0, destination='127.0.0.1', source='127.0.0.1', version=4, identification=0, checksum=0, flag_df=0, total_length=0, **kwargs)[source]¶ Represent the IPv4 layer.
-
from_dict
(dict_)¶ Set the IPv4 layer configuration from a dictionary. Keys must be the same as the attributes names, and values but by valid values for these attributes.
-
to_dict
()¶ Return the IPv4 layer configuration as a dictionnary.
-
checksum
¶ Header checksum. By default, this attribute is set automatically. Set
checksum_override
toTrue
to override this field
-
checksum_count
¶ If
checksum_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
checksum_mode
¶ By default,
checksum_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
checksum_override
¶
-
checksum_step
¶ If
checksum_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
destination
¶
-
destination_count
¶ If
destination_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
destination_mode
¶ By default,
destination_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
destination_step
¶ If
destination_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
dscp
¶ Differentiated Services Code Point (DSCP) field (previously known as Type Of Service (TOS) field
-
dscp_count
¶ If
dscp_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
dscp_mode
¶ By default,
dscp_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
dscp_step
¶ If
dscp_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
flag_df
¶ The “Don’t Fragment” (DF) 1 bit flag
-
flag_df_count
¶ If
flag_df_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
flag_df_mode
¶ By default,
flag_df_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
flag_df_step
¶ If
flag_df_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
flag_mf
¶ The “More Fragments” (MF) 1 bit flag
-
flag_mf_count
¶ If
flag_mf_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
flag_mf_mode
¶ By default,
flag_mf_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
flag_mf_step
¶ If
flag_mf_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
flag_unused
¶ A 1 bit unused flag
-
flag_unused_count
¶ If
flag_unused_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
flag_unused_mode
¶ By default,
flag_unused_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
flag_unused_step
¶ If
flag_unused_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
fragments_offset
¶ The Fragment Offset field indicates the offset of a packet fragment in the original IP packet
-
fragments_offset_count
¶ If
fragments_offset_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
fragments_offset_mode
¶ By default,
fragments_offset_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
fragments_offset_step
¶ If
fragments_offset_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
header_length
¶ Internet Header Length (IHL) – number of 4 bytes words in the header. The minimum valid value is 5, and maximum valid value is 15.. By default, this attribute is set automatically. Set
header_length_override
toTrue
to override this field
-
header_length_count
¶ If
header_length_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
header_length_mode
¶ By default,
header_length_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
header_length_override
¶
-
header_length_step
¶ If
header_length_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
identification
¶ Identification field. This is used to identify packet fragments
-
identification_count
¶ If
identification_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
identification_mode
¶ By default,
identification_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
identification_step
¶ If
identification_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
protocol
¶ Indicates the protocol that is encapsulated in the IP packet.. By default, this attribute is set automatically. Set
protocol_override
toTrue
to override this field
-
protocol_count
¶ If
protocol_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
protocol_mode
¶ By default,
protocol_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
protocol_override
¶
-
protocol_step
¶ If
protocol_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
source
¶
-
source_count
¶ If
source_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
source_mode
¶ By default,
source_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
source_step
¶ If
source_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
tos
¶ Type Of Service (TOS) field. This field is now the Differentiated Services Code Point (DSCP) field.
-
tos_count
¶ If
tos_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
total_length
¶ Total length of the IP packet in bytes. The minimum valid value is 20, and the maxium is 65,535. By default, this attribute is set automatically. Set
total_length_override
toTrue
to override this field
-
total_length_count
¶ If
total_length_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
total_length_mode
¶ By default,
total_length_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
total_length_override
¶
-
total_length_step
¶ If
total_length_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
ttl
¶ Time To Live (TTL) field.
-
ttl_count
¶ If
ttl_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
version
¶ Version of the protocol (usually 4 or 6). By default, this attribute is set automatically. Set
version_override
toTrue
to override this field
-
version_count
¶ If
version_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
version_mode
¶ By default,
version_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
version_override
¶
-
version_step
¶ If
version_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
-
class
simple_ostinato.protocols.
Payload
(pattern='00 00 00 00', mode='FIXED_WORD', **kwargs)[source]¶ Base class for the actual protocols
-
mode
¶ The mode can be one of –
DECREMENT_BYTE
FIXED_WORD
INCREMENT_BYTE
RANDOM
-
pattern
¶ Payload initial word. Depending on the chosen mode, this word will be repeated unchanged, incremented/decremented, or randomized
-
-
class
simple_ostinato.protocols.
Tcp
(flag_ack=0, header_length=0, reserved=0, ack_num=0, flag_rst=0, window_size=0, destination=49153, flag_psh=0, urgent_pointer=0, source=49152, flag_ece=0, flag_urg=0, sequence_num=0, checksum=0, flag_syn=0, flag_cwr=0, flag_fin=0, flag_ns=0, **kwargs)[source]¶ Represent an TCP datagram
-
from_dict
(dict_)¶ Set the Tcp layer configuration from a dictionary. Keys must be the same as the attributes names, and values but by valid values for these attributes.
-
to_dict
()¶ Return the Tcp layer configuration as a dictionnary.
-
ack_num
¶ Acknowledgement number
-
ack_num_count
¶ If
ack_num_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
ack_num_mode
¶ By default,
ack_num_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
ack_num_step
¶ If
ack_num_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
checksum
¶ Checksum of the datagram, calculated based on the IP pseudo-header. Its meaning depends on the value og the
ack
flag.. By default, this attribute is set automatically. Setchecksum_override
toTrue
to override this field
-
checksum_count
¶ If
checksum_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
checksum_mode
¶ By default,
checksum_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
checksum_override
¶
-
checksum_step
¶ If
checksum_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
destination
¶ Destination port number. By default, this attribute is set automatically. Set
destination_override
toTrue
to override this field
-
destination_count
¶ If
destination_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
destination_mode
¶ By default,
destination_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
destination_override
¶
-
destination_step
¶ If
destination_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
flag_ack
¶ ACK flag
-
flag_ack_count
¶ If
flag_ack_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
flag_ack_mode
¶ By default,
flag_ack_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
flag_ack_step
¶ If
flag_ack_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
flag_cwr
¶ Congestion Window Reduced flag
-
flag_cwr_count
¶ If
flag_cwr_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
flag_cwr_mode
¶ By default,
flag_cwr_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
flag_cwr_step
¶ If
flag_cwr_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
flag_ece
¶ ECN-Echo flag. Its meaning depends on the
syn
field value.
-
flag_ece_count
¶ If
flag_ece_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
flag_ece_mode
¶ By default,
flag_ece_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
flag_ece_step
¶ If
flag_ece_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
flag_fin
¶ No more data from sender
-
flag_fin_count
¶ If
flag_fin_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
flag_fin_mode
¶ By default,
flag_fin_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
flag_fin_step
¶ If
flag_fin_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
flag_ns
¶ ECN-nonce concealment protection (experimental). By default, this attribute is set automatically. Set
flag_ns_override
toTrue
to override this field
-
flag_ns_count
¶ If
flag_ns_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
flag_ns_mode
¶ By default,
flag_ns_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
flag_ns_override
¶
-
flag_ns_step
¶ If
flag_ns_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
flag_psh
¶ Push function
-
flag_psh_count
¶ If
flag_psh_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
flag_psh_mode
¶ By default,
flag_psh_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
flag_psh_step
¶ If
flag_psh_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
flag_rst
¶ Reset the connection
-
flag_rst_count
¶ If
flag_rst_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
flag_rst_mode
¶ By default,
flag_rst_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
flag_rst_step
¶ If
flag_rst_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
flag_syn
¶ Synchronize sequence numbers
-
flag_syn_count
¶ If
flag_syn_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
flag_syn_mode
¶ By default,
flag_syn_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
flag_syn_step
¶ If
flag_syn_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
flag_urg
¶ Urgent pointer flag.
-
flag_urg_count
¶ If
flag_urg_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
flag_urg_mode
¶ By default,
flag_urg_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
flag_urg_step
¶ If
flag_urg_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
header_length
¶ Size of the TCP header in 4 bytes words. This field is also known as “Data offset”. By default, this attribute is set automatically. Set
header_length_override
toTrue
to override this field
-
header_length_count
¶ If
header_length_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
header_length_mode
¶ By default,
header_length_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
header_length_override
¶
-
header_length_step
¶ If
header_length_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
reserved
¶ Reserved for future use and must be set to 0. By default, this attribute is set automatically. Set
reserved_override
toTrue
to override this field
-
reserved_count
¶ If
reserved_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
reserved_mode
¶ By default,
reserved_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
reserved_override
¶
-
reserved_step
¶ If
reserved_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
sequence_num
¶ Sequence number of the datagram. Its meaning depends on the
syn
flag value.
-
sequence_num_count
¶ If
sequence_num_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
sequence_num_mode
¶ By default,
sequence_num_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
sequence_num_step
¶ If
sequence_num_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
source
¶ Source port number. By default, this attribute is set automatically. Set
source_override
toTrue
to override this field
-
source_count
¶ If
source_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
source_mode
¶ By default,
source_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
source_override
¶
-
source_step
¶ If
source_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
urgent_pointer
¶ Urgent pointer.
-
urgent_pointer_count
¶ If
urgent_pointer_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
urgent_pointer_mode
¶ By default,
urgent_pointer_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
urgent_pointer_step
¶ If
urgent_pointer_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
window_size
¶ Size of the receive window, which specifies the number of window size units that the sender of this segment is currently willing to receive
-
window_size_count
¶ If
window_size_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
window_size_mode
¶ By default,
window_size_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
window_size_step
¶ If
window_size_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
-
class
simple_ostinato.protocols.
Udp
(source=49152, length=0, destination=49153, checksum=0, **kwargs)[source]¶ Represent an UDP datagram
-
from_dict
(dict_)¶ Set the Udp layer configuration from a dictionary. Keys must be the same as the attributes names, and values but by valid values for these attributes.
-
to_dict
()¶ Return the Udp layer configuration as a dictionnary.
-
checksum
¶ Checksum of the datagram, calculated based on the IP pseudo-header.. By default, this attribute is set automatically. Set
checksum_override
toTrue
to override this field
-
checksum_count
¶ If
checksum_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
checksum_mode
¶ By default,
checksum_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
checksum_override
¶
-
checksum_step
¶ If
checksum_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
destination
¶ Destination port number. By default, this attribute is set automatically. Set
destination_override
toTrue
to override this field
-
destination_count
¶ If
destination_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
destination_mode
¶ By default,
destination_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
destination_override
¶
-
destination_step
¶ If
destination_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
length
¶ Length of the UDP datagram (header and payload).. By default, this attribute is set automatically. Set
length_override
toTrue
to override this field
-
length_count
¶ If
length_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
length_mode
¶ By default,
length_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
length_override
¶
-
length_step
¶ If
length_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-
source
¶ Source port number. By default, this attribute is set automatically. Set
source_override
toTrue
to override this field
-
source_count
¶ If
source_mode
isINCREMENT
,DECREMENT
, specifies the number of packets before resetting the field to its initial value.
-
source_mode
¶ By default,
source_mode
isFIXED
. Possible values are:INCREMENT
,DECREMENT
,RANDOM
,FIXED
.
-
source_override
¶
-
source_step
¶ If
source_mode
is set toINCREMENT
orDECREMENT
, specifies the increment or decrement step.
-