Documentation ¶
Index ¶
- Constants
- func DisableCanonicalBytestrings(options *ClientOptions)
- func ToCanonicalIf(v []byte, cond bool) []byte
- type Action
- type ActionParam
- type ActionProfileActionSet
- type Client
- func (c *Client) AckDigestList(ctx context.Context, digestList *p4_v1.DigestList) error
- func (c *Client) CommitFwdPipe(ctx context.Context) (*p4_v1.SetForwardingPipelineConfigResponse, error)
- func (c *Client) DeleteActionProfileGroup(ctx context.Context, entry *p4_v1.ActionProfileGroup) error
- func (c *Client) DeleteActionProfileMember(ctx context.Context, entry *p4_v1.ActionProfileMember) error
- func (c *Client) DeleteCloneSession(ctx context.Context, session_id uint32) error
- func (c *Client) DeleteMulticastGroup(ctx context.Context, mgid uint32) error
- func (c *Client) DeleteTableEntry(ctx context.Context, entry *p4_v1.TableEntry) error
- func (c *Client) DisableDigest(ctx context.Context, digest string) error
- func (c *Client) EnableDigest(ctx context.Context, digest string, config *p4_v1.DigestEntry_Config) error
- func (c *Client) GetFwdPipe(ctx context.Context, responseType GetFwdPipeResponseType) (*FwdPipeConfig, error)
- func (c *Client) InsertActionProfileGroup(ctx context.Context, entry *p4_v1.ActionProfileGroup) error
- func (c *Client) InsertActionProfileMember(ctx context.Context, entry *p4_v1.ActionProfileMember) error
- func (c *Client) InsertCloneSession(ctx context.Context, session_id uint32, packet_length int32, ports []uint32) error
- func (c *Client) InsertMulticastGroup(ctx context.Context, mgid uint32, ports []uint32) error
- func (c *Client) InsertTableEntry(ctx context.Context, entry *p4_v1.TableEntry) error
- func (c *Client) ModifyActionProfileGroup(ctx context.Context, entry *p4_v1.ActionProfileGroup) error
- func (c *Client) ModifyActionProfileMember(ctx context.Context, entry *p4_v1.ActionProfileMember) error
- func (c *Client) ModifyCloneSession(ctx context.Context, session_id uint32, packet_length int32, ports []uint32) error
- func (c *Client) ModifyCounterEntry(ctx context.Context, counter string, index int64, data *p4_v1.CounterData) error
- func (c *Client) ModifyDigest(ctx context.Context, digest string, config *p4_v1.DigestEntry_Config) error
- func (c *Client) ModifyManyCounterEntry(ctx context.Context, counter string, indexs []int64, data *p4_v1.CounterData) error
- func (c *Client) ModifyMulticastGroup(ctx context.Context, mgid uint32, ports []uint32) error
- func (c *Client) ModifyTableEntry(ctx context.Context, entry *p4_v1.TableEntry) error
- func (c *Client) NewActionProfileActionSet() *ActionProfileActionSet
- func (c *Client) NewActionProfileGroup(actionProfile string, groupID uint32, ...) *p4_v1.ActionProfileGroup
- func (c *Client) NewActionProfileMember(actionProfile string, memberID uint32, action string, params [][]byte) *p4_v1.ActionProfileMember
- func (c *Client) NewTableActionDirect(action string, params [][]byte) *p4_v1.TableAction
- func (c *Client) NewTableActionGroup(groupID uint32) *p4_v1.TableAction
- func (c *Client) NewTableActionMember(memberID uint32) *p4_v1.TableAction
- func (c *Client) NewTableEntry(table string, mfs map[string]MatchInterface, action *p4_v1.TableAction, ...) *p4_v1.TableEntry
- func (c *Client) ReadCloneSession(ctx context.Context, session_id uint32) (*p4_v1.CloneSessionEntry, error)
- func (c *Client) ReadCloneSessionWildcard(ctx context.Context) ([]*p4_v1.CloneSessionEntry, error)
- func (c *Client) ReadCounterEntry(ctx context.Context, counter string, index int64) (*p4_v1.CounterData, error)
- func (c *Client) ReadCounterEntryWildcard(ctx context.Context, counter string) ([]*p4_v1.CounterData, error)
- func (c *Client) ReadEntitySingle(ctx context.Context, entity *p4_v1.Entity) (*p4_v1.Entity, error)
- func (c *Client) ReadEntityWildcard(ctx context.Context, entity *p4_v1.Entity, readEntityCh chan<- *p4_v1.Entity) error
- func (c *Client) ReadMeterEntry(ctx context.Context, meter string, index int64) (*p4_v1.MeterConfig, error)
- func (c *Client) ReadMeterEntryWildcard(ctx context.Context, meter string) ([]*p4_v1.MeterEntry, error)
- func (c *Client) ReadMulticastGroup(ctx context.Context, mgid uint32) (*p4_v1.MulticastGroupEntry, error)
- func (c *Client) ReadMulticastGroupWildcard(ctx context.Context) ([]*p4_v1.MulticastGroupEntry, error)
- func (c *Client) ReadTableEntry(ctx context.Context, table string, mfs []MatchInterface) (*p4_v1.TableEntry, error)
- func (c *Client) ReadTableEntryWildcard(ctx context.Context, table string) ([]*p4_v1.TableEntry, error)
- func (c *Client) Run(stopCh <-chan struct{}, arbitrationCh chan<- bool, ...) error
- func (c *Client) SaveFwdPipeFromBytes(ctx context.Context, binBytes, p4infoBytes []byte, cookie uint64) (*FwdPipeConfig, error)
- func (c *Client) SetFwdPipe(ctx context.Context, binPath string, p4infoPath string, cookie uint64) (*FwdPipeConfig, error)
- func (c *Client) SetFwdPipeFromBytes(ctx context.Context, binBytes, p4infoBytes []byte, cookie uint64) (*FwdPipeConfig, error)
- func (c *Client) SetFwdPipeFromBytesWithAction(ctx context.Context, binBytes, p4infoBytes []byte, cookie uint64, ...) (*FwdPipeConfig, error)
- func (c *Client) TableEntryDecode(p4_table_entry *p4_v1.TableEntry) (table_entry *TableEntry, err error)
- func (c *Client) TableEntryEncode(table_entry *TableEntry) (p4_table_entry *p4_v1.TableEntry, err error)
- func (c *Client) WriteManyUpdate(ctx context.Context, updates []*p4_v1.Update) error
- func (c *Client) WriteUpdate(ctx context.Context, update *p4_v1.Update) error
- type ClientOptions
- type ExactMatch
- type FwdPipeConfig
- type GetFwdPipeResponseType
- type LpmMatch
- type MatchField
- type MatchInterface
- type MatchType
- type OptionalMatch
- type Port
- type RangeMatch
- type TableEntry
- type TableEntryOptions
- type TernaryMatch
Constants ¶
const ( GetFwdPipeAll = GetFwdPipeResponseType(p4_v1.GetForwardingPipelineConfigRequest_ALL) GetFwdPipeCookieOnly = GetFwdPipeResponseType(p4_v1.GetForwardingPipelineConfigRequest_COOKIE_ONLY) GetFwdPipeP4InfoAndCookie = GetFwdPipeResponseType(p4_v1.GetForwardingPipelineConfigRequest_P4INFO_AND_COOKIE) GetFwdPipeDeviceConfigAndCookie = GetFwdPipeResponseType(p4_v1.GetForwardingPipelineConfigRequest_DEVICE_CONFIG_AND_COOKIE) )
const (
P4RuntimePort = 9559
)
Variables ¶
This section is empty.
Functions ¶
func DisableCanonicalBytestrings ¶
func DisableCanonicalBytestrings(options *ClientOptions)
func ToCanonicalIf ¶
Types ¶
type Action ¶ added in v1.0.1
type Action struct { Name string `json:"action_name"` Params []*ActionParam `json:"table_params"` }
type ActionParam ¶ added in v1.0.1
func (*ActionParam) String ¶ added in v1.0.1
func (ap *ActionParam) String() string
type ActionProfileActionSet ¶
type ActionProfileActionSet struct {
// contains filtered or unexported fields
}
func (*ActionProfileActionSet) AddAction ¶
func (s *ActionProfileActionSet) AddAction( 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 // 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 (*Client) CommitFwdPipe ¶
func (*Client) DeleteActionProfileGroup ¶
func (*Client) DeleteActionProfileMember ¶
func (*Client) DeleteCloneSession ¶
func (*Client) DeleteMulticastGroup ¶
func (*Client) DeleteTableEntry ¶
func (*Client) DisableDigest ¶
func (*Client) EnableDigest ¶
func (*Client) GetFwdPipe ¶
func (c *Client) GetFwdPipe(ctx context.Context, responseType GetFwdPipeResponseType) (*FwdPipeConfig, error)
GetFwdPipe retrieves the current pipeline config used in the remote switch.
responseType is oneof:
GetFwdPipeAll, GetFwdPipeCookieOnly, GetFwdPipeP4InfoAndCookie, GetFwdPipeDeviceConfigAndCookie
See https://p4.org/p4runtime/spec/v1.3.0/P4Runtime-Spec.html#sec-getforwardingpipelineconfig-rpc
func (*Client) InsertActionProfileGroup ¶
func (*Client) InsertActionProfileMember ¶
func (*Client) InsertCloneSession ¶
func (*Client) InsertMulticastGroup ¶
func (*Client) InsertTableEntry ¶
func (*Client) ModifyActionProfileGroup ¶
func (*Client) ModifyActionProfileMember ¶
func (*Client) ModifyCloneSession ¶
func (c *Client) ModifyCloneSession(ctx context.Context, session_id uint32, packet_length int32, ports []uint32) error
modify multicast group
func (*Client) ModifyCounterEntry ¶
func (*Client) ModifyDigest ¶
func (*Client) ModifyManyCounterEntry ¶
func (c *Client) ModifyManyCounterEntry(ctx context.Context, counter string, indexs []int64, data *p4_v1.CounterData) error
可以一次性更新一个Counter的多个Index为相同数据,主要用于重置计数器为0的场景
func (*Client) ModifyMulticastGroup ¶
modify multicast group
func (*Client) ModifyTableEntry ¶
func (*Client) NewActionProfileActionSet ¶
func (c *Client) NewActionProfileActionSet() *ActionProfileActionSet
func (*Client) NewActionProfileGroup ¶
func (c *Client) NewActionProfileGroup( actionProfile string, groupID uint32, members []*p4_v1.ActionProfileGroup_Member, size int32, ) *p4_v1.ActionProfileGroup
func (*Client) NewActionProfileMember ¶
func (*Client) NewTableActionDirect ¶
func (c *Client) NewTableActionDirect( action string, params [][]byte, ) *p4_v1.TableAction
func (*Client) NewTableActionGroup ¶
func (c *Client) NewTableActionGroup( groupID uint32, ) *p4_v1.TableAction
func (*Client) NewTableActionMember ¶
func (c *Client) NewTableActionMember( memberID uint32, ) *p4_v1.TableAction
func (*Client) NewTableEntry ¶
func (c *Client) NewTableEntry( table string, mfs map[string]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) ReadCloneSession ¶
func (c *Client) ReadCloneSession(ctx context.Context, session_id uint32) (*p4_v1.CloneSessionEntry, error)
read one clone session entry
func (*Client) ReadCloneSessionWildcard ¶
read all clone session entry
func (*Client) ReadCounterEntry ¶
func (*Client) ReadCounterEntryWildcard ¶
func (*Client) ReadEntitySingle ¶
func (*Client) ReadEntityWildcard ¶
func (c *Client) ReadEntityWildcard(ctx context.Context, 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) ReadMeterEntry ¶
func (*Client) ReadMeterEntryWildcard ¶
func (*Client) ReadMulticastGroup ¶
func (c *Client) ReadMulticastGroup(ctx context.Context, mgid uint32) (*p4_v1.MulticastGroupEntry, error)
read one mutlicast group entry
func (*Client) ReadMulticastGroupWildcard ¶
func (c *Client) ReadMulticastGroupWildcard(ctx context.Context) ([]*p4_v1.MulticastGroupEntry, error)
read all mutlicast group entry
func (*Client) ReadTableEntry ¶
func (c *Client) ReadTableEntry(ctx context.Context, table string, mfs []MatchInterface) (*p4_v1.TableEntry, error)
func (*Client) ReadTableEntryWildcard ¶
func (*Client) Run ¶
func (c *Client) Run( stopCh <-chan struct{}, arbitrationCh chan<- bool, messageCh chan<- *p4_v1.StreamMessageResponse, ) error
func (*Client) SaveFwdPipeFromBytes ¶
func (*Client) SetFwdPipe ¶
func (*Client) SetFwdPipeFromBytes ¶
func (*Client) SetFwdPipeFromBytesWithAction ¶
func (c *Client) SetFwdPipeFromBytesWithAction(ctx context.Context, binBytes, p4infoBytes []byte, cookie uint64, action p4_v1.SetForwardingPipelineConfigRequest_Action) (*FwdPipeConfig, error)
func (*Client) TableEntryDecode ¶ added in v1.0.1
func (c *Client) TableEntryDecode(p4_table_entry *p4_v1.TableEntry) (table_entry *TableEntry, err error)
TableEntryDecode p4_v1.TableEntry to TableEntry
func (*Client) TableEntryEncode ¶ added in v1.0.1
func (c *Client) TableEntryEncode(table_entry *TableEntry) (p4_table_entry *p4_v1.TableEntry, err error)
TableEntryEncode convert TableEntry to p4_v1.TableEntry
func (*Client) WriteManyUpdate ¶
type ClientOptions ¶
type ClientOptions struct {
CanonicalBytestrings bool
}
type ExactMatch ¶
type ExactMatch struct {
Value []byte
}
type FwdPipeConfig ¶
type FwdPipeConfig struct { P4Info *p4_config_v1.P4Info P4DeviceConfig []byte Cookie uint64 }
type GetFwdPipeResponseType ¶
type GetFwdPipeResponseType int32
type MatchField ¶ added in v1.0.1
type MatchField struct { Name string `json:"field_name"` // field name Type MatchType `json:"match_type"` // match type Value []byte `json:"value,omitempty"` // match value for Mask []byte `json:"mask,omitempty"` // just for type Ternary PrefixLen int32 `json:"prefix_len,omitempty"` // just for type Lpm Low []byte `json:"low,omitempty"` // just for type Range High []byte `json:"high,omitempty"` // just for type Range }
func (*MatchField) String ¶ added in v1.0.1
func (mf *MatchField) String() string
type MatchInterface ¶
type MatchInterface interface {
// contains filtered or unexported methods
}
type OptionalMatch ¶
type OptionalMatch struct {
Value []byte
}
type RangeMatch ¶
type TableEntry ¶ added in v1.0.1
type TableEntry struct { Name string `json:"table_name"` Fields []*MatchField `json:"fields"` Action *Action `json:"action"` Priority int32 `json:"priority"` }
func (*TableEntry) String ¶ added in v1.0.1
func (table_entry *TableEntry) String() string