ixweb

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Overview

Package ixweb provides a connection to the Ixia Web Platform.

Index

Constants

View Source
const (

	// EgressStatsCaption is the name of the egress statistics view.
	EgressStatsCaption = "EgressStatView"
	// TrafficItemStatsCaption is the name of the trafic item statics view.
	TrafficItemStatsCaption = "Traffic Item Statistics"
)
View Source
const (

	// RetryLimit is the maximum number of times an HTTP request will be retried.
	RetryLimit = 4
	// RetryDelay is the time to wait between retrying HTTP requests.
	RetryDelay = 15 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chassis

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

Chassis represents the chassis management application on Ixia Web Platform.

func (*Chassis) Delete

func (c *Chassis) Delete(ctx context.Context, path string) error

Delete submits a DELETE request, at a relative path to the chassis API.

func (*Chassis) Get

func (c *Chassis) Get(ctx context.Context, path string, out any) error

Get submits a GET request, at a relative path to the chassis API.

func (*Chassis) Patch

func (c *Chassis) Patch(ctx context.Context, path string, in any) error

Patch submits a PATCH request, at a relative path to the chassis API.

func (*Chassis) Post

func (c *Chassis) Post(ctx context.Context, path string, in, out any) error

Post submits a POST request, at a relative path to the chassis API.

type Config

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

Config represents the IxNetwork config API.

func (*Config) Export

func (c *Config) Export(ctx context.Context) (string, error)

Export exports the current full configuration of the IxNetwork session.

func (*Config) Import

func (c *Config) Import(ctx context.Context, cfg string, overwrite bool) error

Import imports the specified config into the IxNetwork session. If overwrite is 'true', the existing config is completely replaced with the specified config; otherwise the config is updated at or below the node represented by the specified config. For values that are a list of nodes, only the nodes that are specified are updated. (E.g. you cannot remove a config node from a list with overwrite set to 'false'.)

func (*Config) QueryIDs

func (c *Config) QueryIDs(ctx context.Context, xpaths ...string) (map[string]string, error)

QueryIDs resolves the specified XPaths to config node IDs, returning a map from xpath to ID. For better performance, callers prefer to group multiple xpaths into one call rather than multiple calls with fewer XPaths per call.

type Error

type Error struct {
	ID                  int      `json:"id"`
	Level               string   `json:"errorLevel"`
	Code                int      `json:"errorCode"`
	Description         string   `json:"description"`
	Name                string   `json:"name"`
	LastModified        string   `json:"lastModified"`
	Provider            string   `json:"provider"`
	InstanceColumnNames []string `json:"sourceColumnsDisplayName"`
	InstanceRowValues   []map[string]string
}

Error represents an error reported by an IxNetwork session.

type Files

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

Files represents the IxNetwork files API.

func (*Files) Delete

func (f *Files) Delete(ctx context.Context, filename string) error

Delete deletes a file with the specified name.

func (*Files) Download

func (f *Files) Download(ctx context.Context, filename string) ([]byte, error)

DownloadFile downloads a file with the specified name and returns the content.

func (*Files) List

func (f *Files) List(ctx context.Context, pattern string) ([]string, error)

List returns a slice of the files that match the specified glob pattern.

func (*Files) Upload

func (f *Files) Upload(ctx context.Context, filename string, content []byte) error

UploadFile uploads a file with the specified name and content to the session.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient makes HTTP requests.

type IxNetwork

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

IxNetwork represents the IxNetwork application on Ixia Web Platform.

func (*IxNetwork) DeleteSession

func (n *IxNetwork) DeleteSession(ctx context.Context, id int) error

DeleteSession deletes the IxNetwork session with the specified ID. This is a noop if the session is already deleted.

func (*IxNetwork) FetchSession

func (n *IxNetwork) FetchSession(ctx context.Context, id int) (*Session, error)

FetchSession fetches the IxNetwork session with the specified ID.

func (*IxNetwork) FetchSessions

func (n *IxNetwork) FetchSessions(ctx context.Context) (map[int]*Session, error)

FetchSessions fetches all current IxNetwork sessions.

func (*IxNetwork) NewSession

func (n *IxNetwork) NewSession(ctx context.Context, name string) (*Session, error)

NewSession creates a new IxNetwork session with the specified name.

type IxWeb

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

IxWeb is a connection to the Ixia Web Platform.

func Connect

func Connect(ctx context.Context, hostname string, opts ...Option) (*IxWeb, error)

Connect creates a connection to Ixia Web Platform on the specified hostname. Unless the given options specify otherwise, IxWeb is configured as follows:

  • login: Ixia's default admin/admin login
  • http client: http.DefaultClient

func (*IxWeb) Chassis

func (ix *IxWeb) Chassis() *Chassis

Chassis returns a handle to the Chassis application.

func (*IxWeb) IxNetwork

func (ix *IxWeb) IxNetwork() *IxNetwork

IxNetwork returns a handle to the IxNetwork application.

type OpArgs

type OpArgs []any

OpArgs is a list of arguments for an operation to use as input to a POST request.

func (OpArgs) MarshalJSON

func (a OpArgs) MarshalJSON() ([]byte, error)

MarshalJSON marshals the operation arguments to JSON.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option for connecting to IxNetwork.

func WithHTTPClient

func WithHTTPClient(client HTTPClient) Option

WithHTTPClient configures IxWeb to use a custom HTTP client.

func WithLogin

func WithLogin(username, password string) Option

WithLogin configures the IxWeb to use a custom username/password.

type Session

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

Session represents an IxNetwork session.

func (*Session) AbsPath

func (s *Session) AbsPath(relPath string) string

AbsPath returns an absolute path, given a path relative to the IxNetwork session. If relPath is already an absolute path, this method returns the input string.

func (*Session) Config

func (s *Session) Config() *Config

Config returns the config API for this session.

func (*Session) Delete

func (s *Session) Delete(ctx context.Context, path string) error

Delete submits a JSON DELETE request, at a path relative to the IxNetwork session.

func (*Session) Errors

func (s *Session) Errors(ctx context.Context) ([]*Error, error)

Errors returns the current errors/warnings for this session.

func (*Session) Files

func (s *Session) Files() *Files

Files returns the file API for this session.

func (*Session) Get

func (s *Session) Get(ctx context.Context, path string, out any) error

Get submits a JSON GET request, at a path relative to the IxNetwork session.

func (*Session) ID

func (s *Session) ID() int

ID returns the unique ID of the session.

func (*Session) Name

func (s *Session) Name() string

Name returns the descriptive name of the session.

func (*Session) Patch

func (s *Session) Patch(ctx context.Context, path string, in any) error

Patch submits a JSON PATCH request, at a path relative to the IxNetwork session.

func (*Session) Post

func (s *Session) Post(ctx context.Context, path string, in, out any) error

Post submits a JSON POST request, at a path relative to the IxNetwork session.

func (*Session) Stats

func (s *Session) Stats() *Stats

Stats returns the statistics API for this session.

func (*Session) String

func (s *Session) String() string

type StatRow

type StatRow map[string]string

StatRow is an individual row of statistics in an IxNetwork statistics view. The key of the map is the column name and the value is the statistic value. IxNetwork always provides the value of statistics as strings.

type StatTable

type StatTable []StatRow

StatTable is a list of StatRows in an IxNetwork statistics view.

type StatView

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

StatView is an IxNetwork statistics view.

func (*StatView) Caption

func (v *StatView) Caption() string

Caption returns the caption of the view.

func (*StatView) FetchTable

func (v *StatView) FetchTable(ctx context.Context, drilldowns ...string) (StatTable, error)

FetchTable fetches a table of statistic values from the view. If drilldowns are specified, the results of each drilldown on each row of the target table are also returned.

func (*StatView) String

func (v *StatView) String() string

type Stats

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

Stats represents the statistics API for an IxNetwork session.

func (*Stats) ConfigEgressView

func (s *Stats) ConfigEgressView(ctx context.Context, trafficItems []string, egressPageSize int) (*StatView, error)

ConfigEgressView will create a statistics views for the specified traffic item names, broken down by their egress-tracked values. If an egress stat view already exists, it will be deleted first before the new one is created. The egressPageSize is the number of unique values that will be tracked.

func (*Stats) Views

func (s *Stats) Views(ctx context.Context) (map[string]*StatView, error)

Views fetches the statistics views for the session and returns them as a map from the view caption to a representation of the view.

Jump to

Keyboard shortcuts

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