Documentation ¶
Overview ¶
Package p4utils contains various utilities for working with P4Info and P4RT entities
Index ¶
- func CreateMastershipArbitration(electionID *p4api.Uint128, role *p4api.Role) *p4api.StreamMessageRequest
- func DecodeValueAsUint32(value []byte) uint32
- func FindAction(info *p4info.P4Info, actionName string) *p4info.Action
- func FindActionParam(action *p4info.Action, paramName string) *p4info.Action_Param
- func FindTable(info *p4info.P4Info, tableName string) *p4info.Table
- func FindTableMatchField(table *p4info.Table, fieldName string) *p4info.MatchField
- func LoadP4Info(path string) (*p4info.P4Info, error)
- func NewStratumRole(roleName string, roleAgentIDMetaDataID uint32, roleAgentID []byte, ...) *p4api.Role
- func P4InfoBytes(info *p4info.P4Info) []byte
- func TimeBasedElectionID() *p4api.Uint128
- func TrimToBitwidth(b []byte, bits int32) []byte
- type ControllerMetadataCodec
- func (c *ControllerMetadataCodec) DecodePacketInMetadata(md []*p4api.PacketMetadata) *PacketInMetadata
- func (c *ControllerMetadataCodec) DecodePacketOutMetadata(md []*p4api.PacketMetadata) *PacketOutMetadata
- func (c *ControllerMetadataCodec) EgressPortMetadataID() uint32
- func (c *ControllerMetadataCodec) EncodePacketInMetadata(pim *PacketInMetadata) []*p4api.PacketMetadata
- func (c *ControllerMetadataCodec) EncodePacketOutMetadata(pom *PacketOutMetadata) []*p4api.PacketMetadata
- func (c *ControllerMetadataCodec) InressPortMetadataID() uint32
- func (c *ControllerMetadataCodec) RoleAgentIDMetadataID() uint32
- type PacketInMetadata
- type PacketOutMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMastershipArbitration ¶
func CreateMastershipArbitration(electionID *p4api.Uint128, role *p4api.Role) *p4api.StreamMessageRequest
CreateMastershipArbitration returns stream message request with the specified election ID components
func DecodeValueAsUint32 ¶
DecodeValueAsUint32 decodes the specified bytes as uint32 value
func FindAction ¶ added in v0.1.6
FindAction returns the named action from the specified P4Info; nil if not found
func FindActionParam ¶ added in v0.1.6
func FindActionParam(action *p4info.Action, paramName string) *p4info.Action_Param
FindActionParam returns the named action parameter from the specified action; nil if not found
func FindTable ¶ added in v0.1.6
FindTable returns the named table from the specified P4Info; nil if not found
func FindTableMatchField ¶ added in v0.1.7
func FindTableMatchField(table *p4info.Table, fieldName string) *p4info.MatchField
FindTableMatchField returns the named match field from the specified table; nil if not found
func LoadP4Info ¶
LoadP4Info loads the specified file containing protoJSON representation of a P4Info and returns its descriptor
func NewStratumRole ¶ added in v0.1.4
func NewStratumRole(roleName string, roleAgentIDMetaDataID uint32, roleAgentID []byte, receivesPacketIns bool, canPushPipeline bool) *p4api.Role
NewStratumRole produces a P4 Role with stratum.P4RoleConfig, and configured using the supplied parameters.
func P4InfoBytes ¶
P4InfoBytes serializes the given P4 info structure into prototext bytes
func TimeBasedElectionID ¶ added in v0.1.3
TimeBasedElectionID returns election ID generated from the UnixNano timestamp High contains seconds, Low contains remaining nanos
func TrimToBitwidth ¶
TrimToBitwidth trims the specified bytes to the specified width
Types ¶
type ControllerMetadataCodec ¶
type ControllerMetadataCodec struct {
// contains filtered or unexported fields
}
ControllerMetadataCodec allows basic encoding and decoding of packet out/in metadata
func NewControllerMetadataCodec ¶
func NewControllerMetadataCodec(info *p4info.P4Info) *ControllerMetadataCodec
NewControllerMetadataCodec creates a new codec from the supplied P4 info
func (*ControllerMetadataCodec) DecodePacketInMetadata ¶
func (c *ControllerMetadataCodec) DecodePacketInMetadata(md []*p4api.PacketMetadata) *PacketInMetadata
DecodePacketInMetadata decodes the received metadata into an internal structure
func (*ControllerMetadataCodec) DecodePacketOutMetadata ¶
func (c *ControllerMetadataCodec) DecodePacketOutMetadata(md []*p4api.PacketMetadata) *PacketOutMetadata
DecodePacketOutMetadata decodes the received metadata into an internal structure
func (*ControllerMetadataCodec) EgressPortMetadataID ¶ added in v0.1.3
func (c *ControllerMetadataCodec) EgressPortMetadataID() uint32
EgressPortMetadataID returns egress port metadata ID
func (*ControllerMetadataCodec) EncodePacketInMetadata ¶
func (c *ControllerMetadataCodec) EncodePacketInMetadata(pim *PacketInMetadata) []*p4api.PacketMetadata
EncodePacketInMetadata encodes the metadata into an external representation
func (*ControllerMetadataCodec) EncodePacketOutMetadata ¶
func (c *ControllerMetadataCodec) EncodePacketOutMetadata(pom *PacketOutMetadata) []*p4api.PacketMetadata
EncodePacketOutMetadata encodes the metadata into an external representation
func (*ControllerMetadataCodec) InressPortMetadataID ¶ added in v0.1.3
func (c *ControllerMetadataCodec) InressPortMetadataID() uint32
InressPortMetadataID returns ingress port metadata ID
func (*ControllerMetadataCodec) RoleAgentIDMetadataID ¶ added in v0.1.5
func (c *ControllerMetadataCodec) RoleAgentIDMetadataID() uint32
RoleAgentIDMetadataID returns role agent ID metadata ID
type PacketInMetadata ¶
PacketInMetadata carries basic packet-in metadata contents
type PacketOutMetadata ¶
type PacketOutMetadata struct {
EgressPort uint32
}
PacketOutMetadata carries basic packet-out metadata contents