p4rtclient

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 19 Imported by: 3

Documentation

Overview

Package p4rtclient ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	io.Closer
	StreamClient
	ClientConn() *grpc.ClientConn
	Write(ctx context.Context, in *p4api.WriteRequest, opts ...grpc.CallOption) (*p4api.WriteResponse, error)
	// Read one or more P4 entities from the target.
	Read(ctx context.Context, in *p4api.ReadRequest, opts ...grpc.CallOption) (p4api.P4Runtime_ReadClient, error)

	// SetForwardingPipelineConfig Sets the P4 forwarding-pipeline config.
	SetForwardingPipelineConfig(ctx context.Context, in *p4api.SetForwardingPipelineConfigRequest, opts ...grpc.CallOption) (*p4api.SetForwardingPipelineConfigResponse, error)

	// GetForwardingPipelineConfig Gets the current P4 forwarding-pipeline config
	GetForwardingPipelineConfig(ctx context.Context, in *p4api.GetForwardingPipelineConfigRequest, opts ...grpc.CallOption) (*p4api.GetForwardingPipelineConfigResponse, error)
	StreamChannel(ctx context.Context, opts ...grpc.CallOption) (p4api.P4Runtime_StreamChannelClient, error)
	Capabilities(ctx context.Context, request *p4api.CapabilitiesRequest, opts ...grpc.CallOption) (*p4api.CapabilitiesResponse, error)
}

Client P4runtime client interface

type Conn

type Conn interface {
	Client
	ID() ConnID
	TargetID() topoapi.ID
	DeviceID() uint64
	RoleName() string
}

Conn connection interface

type ConnID

type ConnID string

ConnID connection ID

type ConnManager

type ConnManager interface {
	Get(ctx context.Context, connID ConnID) (Conn, bool)
	GetByTarget(ctx context.Context, targetID topoapi.ID) (Client, error)
	Connect(ctx context.Context, destination *Destination) (Client, error)
	Disconnect(ctx context.Context, targetID topoapi.ID) error
	Watch(ctx context.Context, ch chan<- Conn) error
}

ConnManager p4rt connection manager

func NewConnManager

func NewConnManager() ConnManager

NewConnManager creates a new p4rt connection manager

type Destination

type Destination struct {
	// Endpoint P4runtime server endpoint address
	Endpoint *topoapi.Endpoint
	// TargetID is the topology target entity ID
	TargetID topoapi.ID
	// Timeout is the connection timeout
	Timeout time.Duration
	// TLS config to use when connecting to target.
	TLS *topoapi.TLSOptions
	// DeviceID is the numerical ID to be used for p4runtime API interactions
	DeviceID uint64
	// RoleName a name given to a connection role
	RoleName string
}

Destination contains data used to connect to a server

type StreamClient added in v1.1.4

type StreamClient interface {
	PerformMasterArbitration(ctx context.Context, role *p4api.Role) (*p4api.StreamMessageResponse_Arbitration, error)
}

StreamClient p4runtime master stream client

Jump to

Keyboard shortcuts

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