Documentation
¶
Overview ¶
Package packettestutil contains a set of routines used to test the processing of packet headers and fields.
Index ¶
- func ErrTest(err error, str string) string
- func FieldQueries(t *testing.T, name string, id int, packet fwdpacket.Packet, ...)
- func FieldUpdates(t *testing.T, name string, id int, packet fwdpacket.Packet, ...)
- func TestPacketFields(name string, t *testing.T, tests []PacketFieldTest)
- func TestPacketHeaders(name string, t *testing.T, tests []PacketHeaderTest)
- type FieldQuery
- type FieldUpdate
- type HeaderUpdate
- type PacketFieldTest
- type PacketHeaderTest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldQueries ¶
FieldQueries performs a series of queries to check their succeess or failure.
func FieldUpdates ¶
func FieldUpdates(t *testing.T, name string, id int, packet fwdpacket.Packet, updates []FieldUpdate)
FieldUpdates applies a series of updates and checks its succeess or failure.
func TestPacketFields ¶
func TestPacketFields(name string, t *testing.T, tests []PacketFieldTest)
TestPacketFields performs a series of packet field tests.
func TestPacketHeaders ¶
func TestPacketHeaders(name string, t *testing.T, tests []PacketHeaderTest)
TestPacketHeaders performs a series of packet header tests.
Types ¶
type FieldQuery ¶
type FieldQuery struct {
ID fwdpacket.FieldID // Field identifier
Result []byte // Expected value of the field
Err string // Expected error
}
A FieldQuery describes a query of a packet's field and its expected result.
type FieldUpdate ¶
type FieldUpdate struct {
ID fwdpacket.FieldID // Field identifier
Arg []byte // Value to use for the update
Op int // The type of update described by fwdpacket.OpXyz
Err string // Expected error
}
A FieldUpdate describes an update to a packet field.
type HeaderUpdate ¶
type HeaderUpdate struct {
ID fwdpb.PacketHeaderId // Header being operated
Encap bool // Encap if true, decap otherwise
Err string // Expected error
Updates []FieldUpdate // Series of updates applied after an encap
Result [][]byte // Expected frame after the update
}
A HeaderUpdate describes an update to the packet header via an encap or decap operation.
type PacketFieldTest ¶
type PacketFieldTest struct {
StartHeader fwdpb.PacketHeaderId // First packet header in the frame
Orig [][]byte // Set of headers in the original frame
Final [][]byte // Set of headers in the final frame
Queries []FieldQuery
Updates []FieldUpdate
}
A PacketFieldTest describes a set of tests on a packet's fields. Each test describes the following: - An original packet frame as a series of byte slices. - A set of queries performed on the original frame. - A set of updates performed on the original frame. - A resultant frame as a series of byte slices.
type PacketHeaderTest ¶
type PacketHeaderTest struct {
StartHeader fwdpb.PacketHeaderId // First packet header in the frame
Orig [][]byte // Original frame
Updates []HeaderUpdate // Series of operations on the header
}
A PacketHeaderTest describes a set of tests on a packet's headers. Each test describes the following: - An original packet frame as a series of byte slices. - A set of header operations performed on the original frame.