client

package
v0.0.0-...-d7b3ba0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	P4RuntimePort = 9559
)

Variables

This section is empty.

Functions

func DisableCanonicalBytestrings

func DisableCanonicalBytestrings(options *ClientOptions)

func ToCanonicalIf

func ToCanonicalIf(v []byte, cond bool) []byte

Types

type ActionProfileActionSet

type ActionProfileActionSet struct {
	// contains filtered or unexported fields
}

func (*ActionProfileActionSet) AddAction

func (s *ActionProfileActionSet) AddAction(
	action string,
	params [][]byte,
	weight int32,
) *ActionProfileActionSet

func (*ActionProfileActionSet) AddActionWatchPort

func (s *ActionProfileActionSet) AddActionWatchPort(
	action string,
	params [][]byte,
	weight int32,
	port Port,
) *ActionProfileActionSet

func (*ActionProfileActionSet) TableAction

func (s *ActionProfileActionSet) TableAction() *p4_v1.TableAction

type Client

type Client struct {
	ClientOptions
	p4_v1.P4RuntimeClient

	Xp4info       *p4_config_v1.P4Info
	XstreamSendCh chan *p4_v1.StreamMessageRequest
	// contains filtered or unexported fields
}

func NewClient

func NewClient(
	p4RuntimeClient p4_v1.P4RuntimeClient,
	deviceID uint64,
	electionID p4_v1.Uint128,
	optionsModifierFns ...func(*ClientOptions),
) *Client

func (*Client) AckDigestList

func (c *Client) AckDigestList(digestList *p4_v1.DigestList) error

func (*Client) DeleteMulticastGroup

func (c *Client) DeleteMulticastGroup(mgid uint32) error

func (*Client) DeleteTableEntry

func (c *Client) DeleteTableEntry(entry *p4_v1.TableEntry) error

func (*Client) DisableDigest

func (c *Client) DisableDigest(digest string) error

func (*Client) DoActionProfileGroupEntry

func (c *Client) DoActionProfileGroupEntry(opType p4_v1.Update_Type, entry *p4_v1.ActionProfileGroup) error

func (*Client) DoActionProfileMemberEntry

func (c *Client) DoActionProfileMemberEntry(opType p4_v1.Update_Type, entry *p4_v1.ActionProfileMember) error

func (*Client) EnableDigest

func (c *Client) EnableDigest(digest string, config *p4_v1.DigestEntry_Config) error

func (*Client) GetFwdPipe

func (c *Client) GetFwdPipe(responseType GetFwdPipeResponseType) (*FwdPipeConfig, error)

GetFwdPipe retrieves the current pipeline config used in the remote switch.

responseType is oneof:

GetFwdPipeAll, GetFwdPipeCookieOnly, GetFwdPipeXp4infoAndCookie, GetFwdPipeDeviceConfigAndCookie

See https://p4.org/p4runtime/spec/v1.3.0/P4Runtime-Spec.html#sec-getforwardingpipelineconfig-rpc

func (*Client) InsertMulticastGroup

func (c *Client) InsertMulticastGroup(mgid uint32, ports []uint32) error

func (*Client) InsertMulticastGroupEntry

func (c *Client) InsertMulticastGroupEntry(mge *p4_v1.MulticastGroupEntry) error

func (*Client) InsertTableEntry

func (c *Client) InsertTableEntry(entry *p4_v1.TableEntry) error

func (*Client) ModifyCounterEntry

func (c *Client) ModifyCounterEntry(counter string, index int64, data *p4_v1.CounterData) error

func (*Client) ModifyDigest

func (c *Client) ModifyDigest(digest string, config *p4_v1.DigestEntry_Config) error

func (*Client) ModifyTableEntry

func (c *Client) ModifyTableEntry(entry *p4_v1.TableEntry) error

func (*Client) NewActionProfileActionSet

func (c *Client) NewActionProfileActionSet() *ActionProfileActionSet

func (*Client) NewActionProfileGroup

func (c *Client) NewActionProfileGroup(actionProfile string, groupId uint32, members []uint32) *p4_v1.ActionProfileGroup

func (*Client) NewActionProfileMember

func (c *Client) NewActionProfileMember(actionProfile, action string, memberId uint32, params [][]byte) *p4_v1.ActionProfileMember

func (*Client) NewTableActionDirect

func (c *Client) NewTableActionDirect(
	action string,
	params [][]byte,
) *p4_v1.TableAction

func (*Client) NewTableEntry

func (c *Client) NewTableEntry(
	table string,
	mfs []MatchInterface,
	action *p4_v1.TableAction,
	options *TableEntryOptions,
) *p4_v1.TableEntry

for default entries: to set use nil for mfs, to unset use nil for mfs and nil for action

func (*Client) NewTableEntryWithMatchFields

func (c *Client) NewTableEntryWithMatchFields(
	table string,
	fieldNames []string,
	mfs []MatchInterface,
	action *p4_v1.TableAction,
	options *TableEntryOptions,
) *p4_v1.TableEntry

func (*Client) PacketOut

func (c *Client) PacketOut(pkt []byte, md map[string][]byte) error

func (*Client) ReadCounterEntry

func (c *Client) ReadCounterEntry(counter string, index int64) (*p4_v1.CounterData, error)

func (*Client) ReadCounterEntryWildcard

func (c *Client) ReadCounterEntryWildcard(counter string) ([]*p4_v1.CounterData, error)

func (*Client) ReadEntitySingle

func (c *Client) ReadEntitySingle(entity *p4_v1.Entity) (*p4_v1.Entity, error)

func (*Client) ReadEntityWildcard

func (c *Client) ReadEntityWildcard(entity *p4_v1.Entity, readEntityCh chan<- *p4_v1.Entity) error

ReadEntityWildcard will block and send all read entities on readEntityCh. It will close the channel when the RPC completes and return any error that may have occurred.

func (*Client) ReadMulticastGroup

func (c *Client) ReadMulticastGroup(mgid uint32) (*p4_v1.Entity, error)

func (*Client) Run

func (c *Client) Run(
	stopCh <-chan struct{},
	arbitrationCh chan<- bool,
	messageCh chan<- *p4_v1.StreamMessageResponse,
) error

func (*Client) SetFwdPipe

func (c *Client) SetFwdPipe(binPath string, Xp4infoPath string, cookie uint64) (*FwdPipeConfig, error)

func (*Client) SetFwdPipeFromBytes

func (c *Client) SetFwdPipeFromBytes(binBytes, p4infoBytes []byte, cookie uint64) (*FwdPipeConfig, error)

func (*Client) WriteUpdate

func (c *Client) WriteUpdate(update *p4_v1.Update) error

type ClientOptions

type ClientOptions struct {
	CanonicalBytestrings bool
}

type ExactMatch

type ExactMatch struct {
	Value []byte
}

type FwdPipeConfig

type FwdPipeConfig struct {
	Xp4info        *p4_config_v1.P4Info
	P4DeviceConfig []byte
	Cookie         uint64
}

type GetFwdPipeResponseType

type GetFwdPipeResponseType int32

type LpmMatch

type LpmMatch struct {
	Value []byte
	PLen  int32
}

type MatchInterface

type MatchInterface interface {
	// contains filtered or unexported methods
}

type OptionalMatch

type OptionalMatch struct {
	Value []byte
}

type Port

type Port struct {
	// contains filtered or unexported fields
}

func NewPort

func NewPort(bytes []byte) Port

func NewPortFromInt

func NewPortFromInt(i uint32) Port

func (Port) AsBytes

func (p Port) AsBytes() []byte

type RangeMatch

type RangeMatch struct {
	Low  []byte
	High []byte
}

type TableEntryOptions

type TableEntryOptions struct {
	IdleTimeout time.Duration
}

type TernaryMatch

type TernaryMatch struct {
	Value []byte
	Mask  []byte
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL