debug

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

README

gNOI Debug Streaming RPC Design

Contributors: hines@google.com, robjs@google.com Last Updated: 2023-11-04

Background

For all legacy devices that provided a CLI on box, providers have leveraged this CLI through services to provide users with the ability to interact with device CLI's to both get information as well as set operational state on devices. This interaction is very vendor specific and requires significant overhead to maintain the vendor specific bindings throughout the operational life cycle of a device.

With the introduction of g* services, the goal has been to remove vendor specific data formats from the view operators. This lets operators have standard models for interacting with any number of vendor devices consistently. There however are gaps between those endpoints versioning and the ability to troubleshoot specific data on a device before API's can be updated. This proposal is to enable a lightweight interface via gRPC to still access shell level interactions on the device in a secure, maintainable way.

Architecture

The service will run on a specified port. This service upon recieving a command the server will validate the user has access to the service via Authz check. If user has access the server will then parse the request and check if the user has both the acccess to run the command and if provided act as the role user. If the user is allowed the device will then open "shell" in the mode requested and execute the command in that mode.

User Experience

User needs to get custom state from device

User Request -> Stream of data returned

Example requests are CLI ‘show’ commands. Ie:

show proc cpu | json

User needs to be able to shell to subcomponent (linecard / backup supervisor) to get data

shell <linecard>; show memory

User needs to tail a process to get output

tail -f /var/log/foo

User needs to capture a trace of process

strace <cmd>

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DebugRequest_Mode_name = map[int32]string{
		0: "MODE_UNSPECIFIED",
		1: "MODE_SHELL",
		2: "MODE_CLI",
	}
	DebugRequest_Mode_value = map[string]int32{
		"MODE_UNSPECIFIED": 0,
		"MODE_SHELL":       1,
		"MODE_CLI":         2,
	}
)

Enum value maps for DebugRequest_Mode.

View Source
var File_debug_debug_proto protoreflect.FileDescriptor

Functions

func RegisterDebugServer

func RegisterDebugServer(s *grpc.Server, srv DebugServer)

Types

type DebugClient

type DebugClient interface {
	Debug(ctx context.Context, in *DebugRequest, opts ...grpc.CallOption) (Debug_DebugClient, error)
}

DebugClient is the client API for Debug service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewDebugClient

func NewDebugClient(cc grpc.ClientConnInterface) DebugClient

type DebugRequest

type DebugRequest struct {
	Mode        DebugRequest_Mode `protobuf:"varint,1,opt,name=mode,proto3,enum=gnoi.debug.DebugRequest_Mode" json:"mode,omitempty"`
	Command     []byte            `protobuf:"bytes,2,opt,name=command,proto3" json:"command,omitempty"`
	ByteLimit   int64             `protobuf:"varint,3,opt,name=byte_limit,json=byteLimit,proto3" json:"byte_limit,omitempty"`
	Timeout     int64             `protobuf:"varint,4,opt,name=timeout,proto3" json:"timeout,omitempty"`
	RoleAccount string            `protobuf:"bytes,5,opt,name=role_account,json=roleAccount,proto3" json:"role_account,omitempty"`
	// contains filtered or unexported fields
}

func (*DebugRequest) Descriptor deprecated

func (*DebugRequest) Descriptor() ([]byte, []int)

Deprecated: Use DebugRequest.ProtoReflect.Descriptor instead.

func (*DebugRequest) GetByteLimit

func (x *DebugRequest) GetByteLimit() int64

func (*DebugRequest) GetCommand

func (x *DebugRequest) GetCommand() []byte

func (*DebugRequest) GetMode

func (x *DebugRequest) GetMode() DebugRequest_Mode

func (*DebugRequest) GetRoleAccount

func (x *DebugRequest) GetRoleAccount() string

func (*DebugRequest) GetTimeout

func (x *DebugRequest) GetTimeout() int64

func (*DebugRequest) ProtoMessage

func (*DebugRequest) ProtoMessage()

func (*DebugRequest) ProtoReflect

func (x *DebugRequest) ProtoReflect() protoreflect.Message

func (*DebugRequest) Reset

func (x *DebugRequest) Reset()

func (*DebugRequest) String

func (x *DebugRequest) String() string

type DebugRequest_Mode

type DebugRequest_Mode int32
const (
	DebugRequest_MODE_UNSPECIFIED DebugRequest_Mode = 0
	DebugRequest_MODE_SHELL       DebugRequest_Mode = 1
	DebugRequest_MODE_CLI         DebugRequest_Mode = 2
)

func (DebugRequest_Mode) Descriptor

func (DebugRequest_Mode) Enum

func (DebugRequest_Mode) EnumDescriptor deprecated

func (DebugRequest_Mode) EnumDescriptor() ([]byte, []int)

Deprecated: Use DebugRequest_Mode.Descriptor instead.

func (DebugRequest_Mode) Number

func (DebugRequest_Mode) String

func (x DebugRequest_Mode) String() string

func (DebugRequest_Mode) Type

type DebugResponse

type DebugResponse struct {

	// Types that are assignable to Response:
	//
	//	*DebugResponse_Request
	//	*DebugResponse_Data
	//	*DebugResponse_Status
	Response isDebugResponse_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

func (*DebugResponse) Descriptor deprecated

func (*DebugResponse) Descriptor() ([]byte, []int)

Deprecated: Use DebugResponse.ProtoReflect.Descriptor instead.

func (*DebugResponse) GetData

func (x *DebugResponse) GetData() []byte

func (*DebugResponse) GetRequest

func (x *DebugResponse) GetRequest() *DebugRequest

func (*DebugResponse) GetResponse

func (m *DebugResponse) GetResponse() isDebugResponse_Response

func (*DebugResponse) GetStatus

func (x *DebugResponse) GetStatus() *DebugStatus

func (*DebugResponse) ProtoMessage

func (*DebugResponse) ProtoMessage()

func (*DebugResponse) ProtoReflect

func (x *DebugResponse) ProtoReflect() protoreflect.Message

func (*DebugResponse) Reset

func (x *DebugResponse) Reset()

func (*DebugResponse) String

func (x *DebugResponse) String() string

type DebugResponse_Data

type DebugResponse_Data struct {
	Data []byte `protobuf:"bytes,101,opt,name=data,proto3,oneof"`
}

type DebugResponse_Request

type DebugResponse_Request struct {
	Request *DebugRequest `protobuf:"bytes,100,opt,name=request,proto3,oneof"`
}

type DebugResponse_Status

type DebugResponse_Status struct {
	Status *DebugStatus `protobuf:"bytes,102,opt,name=status,proto3,oneof"`
}

type DebugServer

type DebugServer interface {
	Debug(*DebugRequest, Debug_DebugServer) error
}

DebugServer is the server API for Debug service.

type DebugStatus

type DebugStatus struct {
	Code    int32        `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string       `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Details []*anypb.Any `protobuf:"bytes,3,rep,name=details,proto3" json:"details,omitempty"`
	// contains filtered or unexported fields
}

func (*DebugStatus) Descriptor deprecated

func (*DebugStatus) Descriptor() ([]byte, []int)

Deprecated: Use DebugStatus.ProtoReflect.Descriptor instead.

func (*DebugStatus) GetCode

func (x *DebugStatus) GetCode() int32

func (*DebugStatus) GetDetails

func (x *DebugStatus) GetDetails() []*anypb.Any

func (*DebugStatus) GetMessage

func (x *DebugStatus) GetMessage() string

func (*DebugStatus) ProtoMessage

func (*DebugStatus) ProtoMessage()

func (*DebugStatus) ProtoReflect

func (x *DebugStatus) ProtoReflect() protoreflect.Message

func (*DebugStatus) Reset

func (x *DebugStatus) Reset()

func (*DebugStatus) String

func (x *DebugStatus) String() string

type Debug_DebugClient

type Debug_DebugClient interface {
	Recv() (*DebugResponse, error)
	grpc.ClientStream
}

type Debug_DebugServer

type Debug_DebugServer interface {
	Send(*DebugResponse) error
	grpc.ServerStream
}

type UnimplementedDebugServer

type UnimplementedDebugServer struct {
}

UnimplementedDebugServer can be embedded to have forward compatible implementations.

func (*UnimplementedDebugServer) Debug

Jump to

Keyboard shortcuts

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