
- replaced s.GetContainerByName("xyz") with s.Containers.Xyz in tests and suites - same thing for interfaces - each suite has its own structs with containers/interfaces - structs are initialized in SetupSuite Type: test Change-Id: I5bd99605b40921b7b8c844e8650f6fb0915e9e99 Signed-off-by: Adrian Villin <avillin@cisco.com>
54 lines
1.6 KiB
Go
54 lines
1.6 KiB
Go
package main
|
|
|
|
import (
|
|
. "fd.io/hs-test/infra"
|
|
)
|
|
|
|
func init() {
|
|
RegisterVethTests(EchoBuiltinTest)
|
|
RegisterSoloVethTests(TcpWithLossTest)
|
|
}
|
|
|
|
func EchoBuiltinTest(s *VethsSuite) {
|
|
serverVpp := s.Containers.ServerVpp.VppInstance
|
|
|
|
serverVpp.Vppctl("test echo server " +
|
|
" uri tcp://" + s.Interfaces.Server.Ip4AddressString() + "/1234")
|
|
|
|
clientVpp := s.Containers.ClientVpp.VppInstance
|
|
|
|
o := clientVpp.Vppctl("test echo client nclients 100 bytes 1 verbose" +
|
|
" syn-timeout 100 test-timeout 100" +
|
|
" uri tcp://" + s.Interfaces.Server.Ip4AddressString() + "/1234")
|
|
s.Log(o)
|
|
s.AssertNotContains(o, "failed:")
|
|
}
|
|
|
|
// unstable with multiple workers
|
|
func TcpWithLossTest(s *VethsSuite) {
|
|
s.SkipIfMultiWorker()
|
|
serverVpp := s.Containers.ServerVpp.VppInstance
|
|
|
|
serverVpp.Vppctl("test echo server uri tcp://%s/20022",
|
|
s.Interfaces.Server.Ip4AddressString())
|
|
|
|
clientVpp := s.Containers.ClientVpp.VppInstance
|
|
|
|
// Ensure that VPP doesn't abort itself with NSIM enabled
|
|
// Warning: Removing this ping will make VPP crash!
|
|
clientVpp.Vppctl("ping %s", s.Interfaces.Server.Ip4AddressString())
|
|
|
|
// Add loss of packets with Network Delay Simulator
|
|
clientVpp.Vppctl("set nsim poll-main-thread delay 0.01 ms bandwidth 40 gbit" +
|
|
" packet-size 1400 packets-per-drop 1000")
|
|
|
|
clientVpp.Vppctl("nsim output-feature enable-disable host-" + s.Interfaces.Server.Name())
|
|
|
|
// Do echo test from client-vpp container
|
|
output := clientVpp.Vppctl("test echo client uri tcp://%s/20022 verbose echo-bytes mbytes 50",
|
|
s.Interfaces.Server.Ip4AddressString())
|
|
s.Log(output)
|
|
s.AssertNotEqual(len(output), 0)
|
|
s.AssertNotContains(output, "failed", output)
|
|
}
|