Documentation ¶
Overview ¶
Package utils contains various utilities for working with P4Info and P4RT entities
Index ¶
- func ARPRequestPacket(theirIP []byte, ourMAC []byte, ourIP []byte) ([]byte, error)
- func ControllerLLDPPacket(chassisID string, egressPort uint32) ([]byte, error)
- func CreateMastershipArbitration(electionID *p4api.Uint128, role *p4api.Role) *p4api.StreamMessageRequest
- func DecodeValueAsUint32(value []byte) uint32
- func GenerateFieldMatch(mf *p4info.MatchField) *p4api.FieldMatch
- func GenerateFieldMatches(tableInfo *p4info.Table) []*p4api.FieldMatch
- func GenerateTableAction(tableInfo *p4info.Table) *p4api.TableAction
- func GenerateTableEntry(tableInfo *p4info.Table, priority int32, action *p4api.TableAction) *p4api.TableEntry
- func IP(addr string) []byte
- func IPString(addr []byte) string
- func JoinPath(segments []string) string
- func LoadP4Info(path string) (*p4info.P4Info, error)
- func MAC(addr string) []byte
- func MACString(addr []byte) string
- func NameKey(e string) (string, map[string]string, bool)
- func P4InfoBytes(info *p4info.P4Info) []byte
- func RandomBytes(bitwidth int32) []byte
- func SplitPath(path string) []string
- func Subpath(path string, name string, key map[string]string) string
- func ToPath(path string) *gnmi.Path
- func ToString(path *gnmi.Path) string
- 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) EncodePacketInMetadata(pim *PacketInMetadata) []*p4api.PacketMetadata
- func (c *ControllerMetadataCodec) EncodePacketOutMetadata(pom *PacketOutMetadata) []*p4api.PacketMetadata
- type PacketInMetadata
- type PacketOutMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ARPRequestPacket ¶
ARPRequestPacket returns packet bytes with an ARP request for the specified IP address
func ControllerLLDPPacket ¶
ControllerLLDPPacket returns packet bytes for an ONOS link discovery packet
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 ¶ added in v0.1.6
DecodeValueAsUint32 decodes the specified bytes as uint32 value
func GenerateFieldMatch ¶
func GenerateFieldMatch(mf *p4info.MatchField) *p4api.FieldMatch
GenerateFieldMatch generates field match compliant with the specified match schema
func GenerateFieldMatches ¶
func GenerateFieldMatches(tableInfo *p4info.Table) []*p4api.FieldMatch
GenerateFieldMatches generates field matches compliant with the specified table schema
func GenerateTableAction ¶
func GenerateTableAction(tableInfo *p4info.Table) *p4api.TableAction
GenerateTableAction generates a table action compliant with the specified table schema
func GenerateTableEntry ¶
func GenerateTableEntry(tableInfo *p4info.Table, priority int32, action *p4api.TableAction) *p4api.TableEntry
GenerateTableEntry generates a table entry compliant with the specified table schema
func LoadP4Info ¶
LoadP4Info loads the specified file containing protoJSON representation of a P4Info and returns its descriptor
func NameKey ¶
NameKey splits the string representation of the path segment into name and an optional key
func P4InfoBytes ¶
P4InfoBytes serializes the given P4 info structure into prototext bytes
func RandomBytes ¶
RandomBytes returns a buffer spanning at least the specified number of bits, filled with random content
func ToString ¶
ToString produces a deterministic string representation of the given gNMI path structure
func TrimToBitwidth ¶ added in v0.1.6
TrimToBitwidth trims the specified bytes to the specified width
Types ¶
type ControllerMetadataCodec ¶ added in v0.1.3
type ControllerMetadataCodec struct {
// contains filtered or unexported fields
}
ControllerMetadataCodec allows basic encoding and decoding of packet out/in metadata
func NewControllerMetadataCodec ¶ added in v0.1.3
func NewControllerMetadataCodec(info *p4info.P4Info) *ControllerMetadataCodec
NewControllerMetadataCodec creates a new codec from the supplied P4 info
func (*ControllerMetadataCodec) DecodePacketInMetadata ¶ added in v0.1.3
func (c *ControllerMetadataCodec) DecodePacketInMetadata(md []*p4api.PacketMetadata) *PacketInMetadata
DecodePacketInMetadata decodes the received metadata into an internal structure
func (*ControllerMetadataCodec) DecodePacketOutMetadata ¶ added in v0.1.3
func (c *ControllerMetadataCodec) DecodePacketOutMetadata(md []*p4api.PacketMetadata) *PacketOutMetadata
DecodePacketOutMetadata decodes the received metadata into an internal structure
func (*ControllerMetadataCodec) EncodePacketInMetadata ¶ added in v0.1.3
func (c *ControllerMetadataCodec) EncodePacketInMetadata(pim *PacketInMetadata) []*p4api.PacketMetadata
EncodePacketInMetadata encodes the metadata into an external representation
func (*ControllerMetadataCodec) EncodePacketOutMetadata ¶ added in v0.1.3
func (c *ControllerMetadataCodec) EncodePacketOutMetadata(pom *PacketOutMetadata) []*p4api.PacketMetadata
EncodePacketOutMetadata encodes the metadata into an external representation
type PacketInMetadata ¶ added in v0.1.3
PacketInMetadata carries basic packet-in metadata contents
type PacketOutMetadata ¶ added in v0.1.3
type PacketOutMetadata struct {
EgressPort uint32
}
PacketOutMetadata carries basic packet-out metadata contents