cmd

package
v0.0.0-...-afddf54 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractJsonIetfVal

func ExtractJsonIetfVal(tv *gnmi.TypedValue) ([]byte, error)

ExtractJsonIetfVal extracts the JSON IETF field of the supplied TypedValue.

func GetEntireConfig

func GetEntireConfig(ctx context.Context, client *gnmiclient.Client) ([]byte, error)

GetEntireConfig requests gNMI GetRequest and returns entire device config as.

func NewRootCmd

func NewRootCmd() *cobra.Command

func PostDeviceConfig

func PostDeviceConfig(ctx context.Context, cfg Config, data []byte) error

PostDeviceConfig sends HTTP POST with supplied device config.

func Run

func Run(cfg Config) error

func Subscribe

func Subscribe(ctx context.Context, c gclient.Impl, fn func() error) error

func Sync

func Sync(ctx context.Context, cfg Config, client *gnmiclient.Client) error

Types

type Config

type Config struct {
	Devel              bool
	Verbose            uint8
	Addr               string `validate:"required"`
	Username           string
	Password           string
	Device             string `validate:"required"`
	AggregatorURL      string `mapstructure:"aggregator-url" validate:"required"`
	NoTLS              bool   `mapstructure:"notls"`
	TLSSkipVerify      bool   `mapstructure:"skip-verify"`
	TLSKeyPath         string `mapstructure:"tls-key"`
	TLSCrtPath         string `mapstructure:"tls-crt"`
	TLSCACrtPath       string `mapstructure:"tls-ca"`
	TLSDeviceCACrtPath string `mapstructure:"tls-device-ca"`
}

func (*Config) DeviceTLSClientConfig

func (c *Config) DeviceTLSClientConfig() *credentials.TLSClientConfig

func (*Config) Mask

func (c *Config) Mask() *Config

Mask returns the copy whose sensitive data are masked.

func (*Config) TLSClientConfig

func (c *Config) TLSClientConfig() *credentials.TLSClientConfig

func (*Config) Validate

func (c *Config) Validate() error

Validate validates exposed fields according to the `validate` tag.

type SaveConfigRequest

type SaveConfigRequest struct {
	Device string `json:"device"`
	Config string `json:"config"`
}

Jump to

Keyboard shortcuts

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