knebind

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 38 Imported by: 1

README

KNE Binding

The KNE Binding is an implementation of the Ondatra binding interface that runs on a network topology created with openconfig/kne.

Flags

The KNE Binding requires a --topology flag be passed that specifies the path to a KNE topology text proto. It also accepts a number of optional flags, as shown in the following table.

Key Description
topology Path to a KNE topology text proto
kubeconfig Optional path to your kubeconfig file; defaults to ~/.kube/config
skip_reset If true, skip initial device reset during reservation; defaults to false
node_creds Repeated per-node credentials in the form "nodeName/username/password"
vendor_creds Repeated per-vendor credentials in the form "VENDOR/username/password"
default_creds Optional default credentials in the form "username/password"
Device Credentials

An example combination of credentials flags:

--node_creds=n1/user/pass --node_creds=root/root123 \
--vendor_creds=CISCO/admin/admin --default_creds=tester/hunter2

The per-node credentials take precedence over the per-vendor credentials, and they both take precedence over the default credentials. If the node does not match a provided per-node or per-vendor credential and no default credentials are provided, then no credentials will be used.

Running the Integration Test

To execute the test, you must create a local KNE topology with at least two linked nodes and pass both the testbed and topology as flags to the test:

go test -testbed=testbed.textproto -topology=topology.textproto

This repo includes an example integration test that uses the KNE binding, a testbed file for that test, and a KNE topology file that is matched by the testbed.

Documentation

Overview

Package knebind provides an Ondatra binding for KNE devices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bind

type Bind struct {
	binding.Binding
	// contains filtered or unexported fields
}

Bind implements the ondatra Binding interface for KNE

func New

func New(cfg *Config) (*Bind, error)

New returns a new KNE bind instance.

func (*Bind) Release

func (b *Bind) Release(context.Context) error

Release is a no-op because there's no need to reserve local VMs.

func (*Bind) Reserve

func (b *Bind) Reserve(ctx context.Context, tb *opb.Testbed, runTime time.Duration, waitTime time.Duration, partial map[string]string) (*binding.Reservation, error)

Reserve implements the binding Reserve method by finding nodes and links in the topology specified in the config file that match the requested testbed.

type Config

type Config struct {
	// TODO(team): Deprecate username and password fields.
	Username, Password string
	Credentials        *creds.Credentials `yaml:"credentials"`
	Topology           string             `yaml:"topology"`
	Kubeconfig         string             `yaml:"kubecfg"`
	SkipReset          bool               `yaml:"skip_reset"`
}

Config contains parameters to configure the KNE binding.

func ParseConfigFile

func ParseConfigFile(configFile string) (*Config, error)

ParseConfigFile parses a yaml file containing a serialized Config.

func (*Config) String

func (c *Config) String() string

Directories

Path Synopsis
Package creds contains logic for KNE credentials.
Package creds contains logic for KNE credentials.
Package init installs the Ondatra binding for testing with kne clusters.
Package init installs the Ondatra binding for testing with kne clusters.
Package solver creates solutions from devices and topologies.
Package solver creates solutions from devices and topologies.

Jump to

Keyboard shortcuts

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