iftst

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package iftst provides tools and input data for unit testing of ifplugin. What remains to be defined are scenarios.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Memif100011Master is an example of a memory interface configuration. (Master=true)
	Memif100011Master = interfaces.Interfaces_Interface{
		Name:    "memif1",
		Type:    interfaces.InterfaceType_MEMORY_INTERFACE,
		Enabled: true,
		Memif: &interfaces.Interfaces_Interface_Memif{
			Master:         true,
			SocketFilename: "/tmp/memif1.sock",
		},
		Mtu:         1500,
		IpAddresses: []string{"10.0.0.11/24"},
	}

	// Memif100011Slave is an example of a memory interface configuration. It is
	// intentionally similar to Memif100011. The only difference is that Master=false.
	Memif100011Slave = interfaces.Interfaces_Interface{
		Name:    "memif1",
		Type:    interfaces.InterfaceType_MEMORY_INTERFACE,
		Enabled: true,
		Memif: &interfaces.Interfaces_Interface_Memif{
			Master:         false,
			SocketFilename: "/tmp/memif1.sock",
		},
		Mtu:         1500,
		IpAddresses: []string{"10.0.0.11/24"},
	}

	// Memif100012 is an example of a memory interface configuration.
	Memif100012 = interfaces.Interfaces_Interface{
		Name:    "memif100012",
		Type:    interfaces.InterfaceType_MEMORY_INTERFACE,
		Enabled: true,
		Memif: &interfaces.Interfaces_Interface_Memif{
			Master:         true,
			SocketFilename: "/tmp/memif1.sock",
		},
		Mtu:         1500,
		IpAddresses: []string{"10.0.0.12/24"},
	}

	// Memif100013 is an example of a memory interface configuration.
	Memif100013 = interfaces.Interfaces_Interface{
		Name:    "memif100013",
		Type:    interfaces.InterfaceType_MEMORY_INTERFACE,
		Enabled: true,
		Memif: &interfaces.Interfaces_Interface_Memif{
			Master:         true,
			SocketFilename: "/tmp/memif1.sock",
		},
		Mtu:         1500,
		IpAddresses: []string{"10.0.0.13/24"},
	}

	// VxlanVni5 is an example of a memory interface configuration.
	VxlanVni5 = interfaces.Interfaces_Interface{
		Name:    "VxlanVni5",
		Type:    interfaces.InterfaceType_VXLAN_TUNNEL,
		Enabled: true,
		Vxlan: &interfaces.Interfaces_Interface_Vxlan{
			SrcAddress: "192.168.1.1",
			DstAddress: "192.168.1.2",
			Vni:        5,
		},
	}

	// AfPacketVeth1 is an example of a memory interface configuration.
	AfPacketVeth1 = interfaces.Interfaces_Interface{
		Name:    "AfPacketVeth1",
		Type:    interfaces.InterfaceType_AF_PACKET_INTERFACE,
		Enabled: true,
		Afpacket: &interfaces.Interfaces_Interface_Afpacket{
			HostIfName: "veth1",
		},
	}

	// BDMemif100011ToMemif100012 is an example of a bridge domain configuration.
	BDMemif100011ToMemif100012 = l2.BridgeDomains_BridgeDomain{
		Name:                "aaa",
		Flood:               false,
		UnknownUnicastFlood: false,
		Forward:             true,
		Learn:               true,
		ArpTermination:      false,
		MacAge:              0,
	}
)

Functions

func BfdAuthKeyBuilder

func BfdAuthKeyBuilder(id uint32, authType bfd.SingleHopBFD_Key_AuthenticationType, secret string) bfd.SingleHopBFD_Key

BfdAuthKeyBuilder creates BFD authentication key.

func BfdAuthSessionBuilder

func BfdAuthSessionBuilder(iface string, srcAddr string, dstAddr string, desInt uint32, reqInt uint32, multiplier uint32) bfd.SingleHopBFD_Session

BfdAuthSessionBuilder creates BFD session including authentication.

func BfdEchoFunctionBuilder

func BfdEchoFunctionBuilder(iface string) bfd.SingleHopBFD_EchoFunction

BfdEchoFunctionBuilder builds BFD echo source.

func BfdSessionBuilder

func BfdSessionBuilder(iface string, srcAddr string, dstAddr string, desInt uint32, reqInt uint32, multiplier uint32) bfd.SingleHopBFD_Session

BfdSessionBuilder creates BFD session without authentication.

func LoopbackBuilder

func LoopbackBuilder(ifname string, ipAddr string) *interfaces.Interfaces_Interface

LoopbackBuilder creates a new instance for testing purposes.

func MemifBuilder

func MemifBuilder(ifname string, ipAddr string, master bool, id uint32) *interfaces.Interfaces_Interface

MemifBuilder creates a new instance for testing purposes.

func RepliesSuccess

func RepliesSuccess(vppMock *govppmock.VppAdapter)

RepliesSuccess replies with success binary API message.

func TapInterfaceBuilder

func TapInterfaceBuilder(name string, ip string) interfaces.Interfaces_Interface

TapInterfaceBuilder serves to create a test interface.

func VppMockHandler added in v1.4.0

func VppMockHandler(vppMock *govppmock.VppAdapter) govppmock.ReplyHandler

VppMockHandler returns reply handler for mock adapter

Types

type BfdIndexesAssertions

type BfdIndexesAssertions struct {
}

BfdIndexesAssertions is a helper struct for fluent DSL in tests for bfd.

func (*BfdIndexesAssertions) ContainsName

func (a *BfdIndexesAssertions) ContainsName(mapping idx.NameToIdx, bfdIface string)

ContainsName checks several times if there is an entry with the given name in bfd_index.

func (*BfdIndexesAssertions) NotContainsName

func (a *BfdIndexesAssertions) NotContainsName(mapping idx.NameToIdx, bfdInterface string)

NotContainsName checks several times if there is no entry with the given name in bfd_index.

type SwIfIndexesAssertions

type SwIfIndexesAssertions struct {
	VPP vpp.API
}

SwIfIndexesAssertions is a helper struct for fluent DSL in tests for interfaces.

func (*SwIfIndexesAssertions) ContainsName

func (a *SwIfIndexesAssertions) ContainsName(ifName string)

ContainsName checks several times if sw_if_index - ifName mapping exists.

func (*SwIfIndexesAssertions) NotContainsName

func (a *SwIfIndexesAssertions) NotContainsName(ifName string)

NotContainsName checks several times the sw_if_index - ifName mapping does not exist.

type ThenIface

type ThenIface struct {
	//NewChange func(name core.PluginName) vppclient.DataChangeDSL
	OperState ifstateGetter

	Log logging.Logger
	VPP vpp.API
}

ThenIface is a collection of test step methods (see Behavior Driven Development) (methods that will be called from test scenarios).

func (*ThenIface) BfdIndexes

func (step *ThenIface) BfdIndexes() *BfdIndexesAssertions

BfdIndexes is a constructor for interfaces.

func (*ThenIface) ContainsIPSecSA added in v1.4.0

func (step *ThenIface) ContainsIPSecSA(name string) bool

ContainsName checks several times if sw_if_index - ifName mapping exists.

func (*ThenIface) ContainsIPSecSPD added in v1.4.0

func (step *ThenIface) ContainsIPSecSPD(name string) bool

ContainsName checks several times if sw_if_index - ifName mapping exists.

func (*ThenIface) IfStateInDB

func (step *ThenIface) IfStateInDB(status intf.InterfacesState_Interface_Status, data *intf.Interfaces_Interface)

IfStateInDB asserts that there is InterfacesState_Interface_DOWN in ETCD for particular Interfaces_Interface.

func (*ThenIface) SwIfIndexes

func (step *ThenIface) SwIfIndexes() *SwIfIndexesAssertions

SwIfIndexes is a constructor for interfaces.

type WhenIface

type WhenIface struct {
	NewChange func(name core.PluginName) vppclient.DataChangeDSL
	NewResync func(name core.PluginName) vppclient.DataResyncDSL
	Log       logging.Logger
	VPP       vpp.API
	MockVpp   *govppmock.VppAdapter
}

WhenIface is a collection of test step methods (see Behavior Driven Development) (methods that will be called from test scenarios).

func (*WhenIface) DelIf

func (when *WhenIface) DelIf(data *intf.Interfaces_Interface)

DelIf removes configuration of a given interface from ETCD.

func (*WhenIface) Put added in v1.4.0

func (when *WhenIface) Put(fn func(dsl vppclient.PutDSL) vppclient.PutDSL)

StoreIf stores configuration of a given interface in ETCD.

func (*WhenIface) ResyncIf added in v1.4.0

func (when *WhenIface) ResyncIf(data1, data2 *intf.Interfaces_Interface)

ResyncIf stores configuration of a given interface in ETCD.

func (*WhenIface) StoreIf

func (when *WhenIface) StoreIf(data *intf.Interfaces_Interface, opts ...interface{})

StoreIf stores configuration of a given interface in ETCD.

func (*WhenIface) VppLinkDown added in v1.4.0

func (when *WhenIface) VppLinkDown(data *intf.Interfaces_Interface)

VppLinkDown sends interface event link down using VPP mock.

func (*WhenIface) VppLinkUp added in v1.4.0

func (when *WhenIface) VppLinkUp(data *intf.Interfaces_Interface)

VppLinkUp sends interface event link up using VPP mock.

Jump to

Keyboard shortcuts

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