cmd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Overview

Package cmd contains implementation of the CLI commands.

Index

Constants

This section is empty.

Variables

View Source
var DefaultTraceOptions = TraceOptions{
	ResultDir:   filepath.Join(os.TempDir(), "vppprobe-traces"),
	TraceNodes:  tracer.DefaultNodes,
	NumPackets:  10000,
	PrintResult: false,
}

Functions

func Execute

func Execute()

Execute executes a root command using default behavior

func InitOptions

func InitOptions(cli Cli, opts GlobalOptions)

func NewDiscoverCmd

func NewDiscoverCmd(cli Cli) *cobra.Command

func NewExecCmd

func NewExecCmd(cli Cli) *cobra.Command

func NewInspectorCmd

func NewInspectorCmd(cli Cli) *cobra.Command

func NewInstancesCmd added in v0.2.0

func NewInstancesCmd(cli Cli) *cobra.Command

func NewRootCmd

func NewRootCmd(cli Cli) *cobra.Command

NewRootCmd returns new root command

func NewTopologyCmd

func NewTopologyCmd(cli Cli) *cobra.Command

func NewTraceCmd

func NewTraceCmd(cli Cli) *cobra.Command

func PrintCorrelatedIpSec

func PrintCorrelatedIpSec(out io.Writer, correlations *agent.IPSecCorrelations)

func PrintLinuxInterfacesTable

func PrintLinuxInterfacesTable(out io.Writer, instance *vpp.Instance)

func PrintVPPInterfacesTable

func PrintVPPInterfacesTable(out io.Writer, instance *vpp.Instance)

func RunDiscover

func RunDiscover(cli Cli, opts DiscoverOptions) error

func RunExec

func RunExec(cli Cli, opts ExecOptions) error

func RunInstances added in v0.2.0

func RunInstances(cli Cli, opts InstancesOptions) error

func RunTopology

func RunTopology(cli Cli, opts TopologyOptions) error

func RunTrace

func RunTrace(cli Cli, opts TraceOptions) error

Types

type Cli

type Cli interface {
	Initialize(opts ProbeOptions) error
	Client() client.API
	Queries() []map[string]string

	Out() *streams.Out
	Err() io.Writer
	In() *streams.In
	Apply(...CliOption) error
}

type CliOption

type CliOption func(cli *ProbeCli) error

func WithCombinedStreams

func WithCombinedStreams(combined io.Writer) CliOption

WithCombinedStreams uses the same stream for the output and error streams.

func WithErrorStream

func WithErrorStream(err io.Writer) CliOption

WithErrorStream sets a cli error stream.

func WithInputStream

func WithInputStream(in io.ReadCloser) CliOption

WithInputStream sets a cli input stream.

func WithOutputStream

func WithOutputStream(out io.Writer) CliOption

WithOutputStream sets a cli output stream.

func WithStandardStreams

func WithStandardStreams() CliOption

WithStandardStreams sets a cli in, out and err streams with the standard streams.

type Colorer

type Colorer interface {
	Code() string
}

type CommandOutput

type CommandOutput string

func (CommandOutput) MarshalJSON

func (e CommandOutput) MarshalJSON() ([]byte, error)

func (CommandOutput) String

func (e CommandOutput) String() string

func (*CommandOutput) UnmarshalJSON

func (e *CommandOutput) UnmarshalJSON(b []byte) error

type DiscoverOptions

type DiscoverOptions struct {
	Format   string
	IPsecAgg bool
}

type DockerOptions

type DockerOptions struct {
	Host string
}

type ExecInstance

type ExecInstance struct {
	Instance *vpp.Instance
	Commands []ExecutedCommand
}

type ExecOptions

type ExecOptions struct {
	Format string
	Args   []string
}

type ExecutedCommand

type ExecutedCommand struct {
	Command string
	Output  CommandOutput
	Started time.Time
	Took    time.Duration
}

type GlobalOptions

type GlobalOptions struct {
	Debug    bool
	LogLevel string
	Color    string
}

func (*GlobalOptions) InstallFlags

func (glob *GlobalOptions) InstallFlags(flags *pflag.FlagSet)

type InstancesOptions added in v0.2.0

type InstancesOptions struct {
	Format   string
	IPsecAgg bool
}

type KubeOptions

type KubeOptions struct {
	Kubeconfig string
	Context    string
}

type ProbeCli

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

func NewProbeCli

func NewProbeCli(opt ...CliOption) (*ProbeCli, error)

func (*ProbeCli) Apply

func (cli *ProbeCli) Apply(opt ...CliOption) error

func (*ProbeCli) Client

func (cli *ProbeCli) Client() client.API

func (*ProbeCli) Err

func (cli *ProbeCli) Err() io.Writer

func (*ProbeCli) In

func (cli *ProbeCli) In() *streams.In

func (*ProbeCli) Initialize

func (cli *ProbeCli) Initialize(opts ProbeOptions) (err error)

func (*ProbeCli) Out

func (cli *ProbeCli) Out() *streams.Out

func (*ProbeCli) Queries

func (cli *ProbeCli) Queries() []map[string]string

type ProbeOptions

type ProbeOptions struct {
	Env     string
	Queries []string

	CLISocket   string
	APISocket   string
	StatsSocket string

	Kube   KubeOptions
	Docker DockerOptions
}

func (*ProbeOptions) InstallFlags

func (f *ProbeOptions) InstallFlags(flags *pflag.FlagSet)

type TopologyOptions

type TopologyOptions struct {
	Format string
	Src    string
	Dst    string
}

type TraceOptions

type TraceOptions struct {
	TraceNodes  []string
	NumPackets  uint
	CustomCmd   string
	ResultDir   string
	PrintResult bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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