Documentation ¶
Overview ¶
Package testing provides tools and input data for unit testing of ifplugin. What remains to be defined are scenarios.
Index ¶
- Variables
- func BfdAuthKeyBuilder(id uint32, authType bfd.SingleHopBFD_Key_AuthenticationType, secret string) bfd.SingleHopBFD_Key
- func BfdAuthSessionBuilder(iface string, srcAddr string, dstAddr string, desInt uint32, reqInt uint32, ...) bfd.SingleHopBFD_Session
- func BfdEchoFunctionBuilder(iface string) bfd.SingleHopBFD_EchoFunction
- func BfdSessionBuilder(iface string, srcAddr string, dstAddr string, desInt uint32, reqInt uint32, ...) bfd.SingleHopBFD_Session
- func LoopbackBuilder(ifname string, ipAddr string) *interfaces.Interfaces_Interface
- func MemifBuilder(ifname string, ipAddr string, master bool, id uint32) *interfaces.Interfaces_Interface
- func RepliesSuccess(vppMock *govppmock.VppAdapter)
- func TapInterfaceBuilder(name string, ip string) interfaces.Interfaces_Interface
- type BfdIndexesAssertions
- type SwIfIndexesAssertions
- type ThenIface
- type WhenIface
Constants ¶
This section is empty.
Variables ¶
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. Intentionaly similar to Memif100011. // Here is only one different 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 new instance for testing purposes
func MemifBuilder ¶
func MemifBuilder(ifname string, ipAddr string, master bool, id uint32) *interfaces.Interfaces_Interface
MemifBuilder 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 test interface
Types ¶
type BfdIndexesAssertions ¶
type BfdIndexesAssertions struct { }
BfdIndexesAssertions helper struct for fluent DSL in tests for bfd
func (*BfdIndexesAssertions) ContainsName ¶
func (a *BfdIndexesAssertions) ContainsName(mapping idx.NameToIdx, bfdIface string)
ContainsName it checks several times if bfd_index
func (*BfdIndexesAssertions) NotContainsName ¶
func (a *BfdIndexesAssertions) NotContainsName(mapping idx.NameToIdx, bfdInterface string)
NotContainsName it checks several times the bfd_index
type SwIfIndexesAssertions ¶
type SwIfIndexesAssertions struct {
VPP defaultpluginsAPI
}
SwIfIndexesAssertions helper struct for fluent DSL in tests for interfaces
func (*SwIfIndexesAssertions) ContainsName ¶
func (a *SwIfIndexesAssertions) ContainsName(ifName string)
ContainsName it checks several times if sw_if_index - ifName mapping ....
func (*SwIfIndexesAssertions) NotContainsName ¶
func (a *SwIfIndexesAssertions) NotContainsName(ifName string)
NotContainsName it checks several times the sw_if_index - ifName mapping ....
type ThenIface ¶
type ThenIface struct { NewChange func(name core.PluginName) vppclient.DataChangeDSL OperState ifstateGetter Log logging.Logger VPP defaultpluginsAPI }
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) 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 Log logging.Logger }
WhenIface is a collection of test step methods (see Behavior Driven Development) (methods that will be called from test scenarios)
func (*WhenIface) DelIf ¶
func (step *WhenIface) DelIf(data *intf.Interfaces_Interface)
DelIf removes configuration of a given interface from ETCD.
func (*WhenIface) StoreIf ¶
func (step *WhenIface) StoreIf(data *intf.Interfaces_Interface, opts ...interface{})
StoreIf stores configuration of a given interface into ETCD.