hs-test: shortened interface names to avoid character limit

Type: test

Change-Id: I09df597ccb8a3c4af47b8a36010afb81df533236
Signed-off-by: adrianvillin <avillin@cisco.com>
This commit is contained in:
adrianvillin
2024-02-13 03:26:25 -05:00
committed by Florin Coras
parent 0ded4890be
commit fbf5f2b030
13 changed files with 47 additions and 43 deletions

View File

@ -2,7 +2,7 @@ package main
func (s *VethsSuite) TestEchoBuiltin() {
serverVpp := s.getContainerByName("server-vpp").vppInstance
serverVeth := s.netInterfaces["vppsrv"]
serverVeth := s.netInterfaces[serverInterfaceName]
serverVpp.vppctl("test echo server " +
" uri tcp://" + serverVeth.ip4AddressString() + "/1234")
@ -33,7 +33,7 @@ func (s *VethsSuite) TestTcpWithLoss() {
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-vppcln")
clientVpp.vppctl("nsim output-feature enable-disable " + s.netInterfaces[clientInterfaceName].name)
// Do echo test from client-vpp container
output := clientVpp.vppctl("test echo client uri tcp://%s/20022 verbose echo-bytes mbytes 50",

View File

@ -11,13 +11,14 @@ func (s *NsSuite) TestHttpTps() {
client_ip := iface.ip4AddressString()
port := "8080"
finished := make(chan error, 1)
clientNetns := "cln"
container := s.getContainerByName("vpp")
// configure vpp in the container
container.vppInstance.vppctl("http tps uri tcp://0.0.0.0/8080")
go s.startWget(finished, client_ip, port, "test_file_10M", "client")
go s.startWget(finished, client_ip, port, "test_file_10M", clientNetns)
// wait for client
err := <-finished
s.assertNil(err, err)
@ -107,7 +108,7 @@ func runNginxPerf(s *NoTopoSuite, mode, ab_or_wrk string) error {
vpp := s.getContainerByName("vpp").vppInstance
nginxCont := s.getContainerByName("nginx")
nginxCont := s.getContainerByName(singleTopoContainerNginx)
s.assertNil(nginxCont.run())
vpp.waitForApp("nginx-", 5)

View File

@ -9,18 +9,21 @@ import (
func testProxyHttpTcp(s *NsSuite, proto string) error {
const outputFile = "test.data"
const srcFile = "10M"
const srcFile = "httpTestFile"
const fileSize = "10M"
stopServer := make(chan struct{}, 1)
serverRunning := make(chan struct{}, 1)
serverNetns := "srv"
clientNetns := "cln"
// create test file
err := exechelper.Run(fmt.Sprintf("ip netns exec server truncate -s %s %s", srcFile, srcFile))
err := exechelper.Run(fmt.Sprintf("ip netns exec %s truncate -s %s %s", serverNetns, fileSize, srcFile))
s.assertNil(err, "failed to run truncate command: " + fmt.Sprint(err))
defer func() { os.Remove(srcFile) }()
s.log("test file created...")
go s.startHttpServer(serverRunning, stopServer, ":666", "server")
go s.startHttpServer(serverRunning, stopServer, ":666", serverNetns)
// TODO better error handling and recovery
<-serverRunning
@ -31,19 +34,20 @@ func testProxyHttpTcp(s *NsSuite, proto string) error {
s.log("http server started...")
clientVeth := s.netInterfaces[clientInterface]
c := fmt.Sprintf("ip netns exec client wget --no-proxy --retry-connrefused"+
" --retry-on-http-error=503 --tries=10 -O %s ", outputFile)
c := fmt.Sprintf("ip netns exec %s wget --no-proxy --retry-connrefused"+
" --retry-on-http-error=503 --tries=10 -O %s ", clientNetns, outputFile)
if proto == "tls" {
c += " --secure-protocol=TLSv1_3 --no-check-certificate https://"
}
c += fmt.Sprintf("%s:555/%s", clientVeth.ip4AddressString(), srcFile)
s.log(c)
_, err = exechelper.CombinedOutput(c)
s.assertNil(err, "failed to run wget: '%s', cmd: %s", err, c)
stopServer <- struct{}{}
defer func() { os.Remove(outputFile) }()
s.assertNil(err, "failed to run wget: '%s', cmd: %s", err, c)
stopServer <- struct{}{}
s.assertNil(assertFileSize(outputFile, srcFile))
return nil
}

View File

@ -14,7 +14,7 @@ func (s *VethsSuite) TestVppEchoTcp() {
}
func (s *VethsSuite) testVppEcho(proto string) {
serverVethAddress := s.netInterfaces["vppsrv"].ip4AddressString()
serverVethAddress := s.netInterfaces[serverInterfaceName].ip4AddressString()
uri := proto + "://" + serverVethAddress + "/12344"
echoSrvContainer := s.getContainerByName("server-app")

View File

@ -2,11 +2,11 @@ package main
const (
// These correspond to names used in yaml config
mirroringClientInterfaceName = "hst_client"
mirroringServerInterfaceName = "hst_server"
vppProxyContainerName = "vpp-proxy"
nginxProxyContainerName = "nginx-proxy"
nginxServerContainerName = "nginx-server"
mirroringClientInterfaceName = "hstcln"
mirroringServerInterfaceName = "hstsrv"
vppProxyContainerName = "vpp-proxy"
nginxProxyContainerName = "nginx-proxy"
nginxServerContainerName = "nginx-server"
)
type NginxSuite struct {

View File

@ -1,10 +1,9 @@
package main
const (
singleTopoContainerVpp = "vpp"
singleTopoContainerVpp = "vpp"
singleTopoContainerNginx = "nginx"
tapInterfaceName = "hst_tap_host"
tapInterfaceName = "htaphost"
)
type NoTopoSuite struct {

View File

@ -2,8 +2,8 @@ package main
const (
// These correspond to names used in yaml config
clientInterface = "hst_client_vpp"
serverInterface = "hst_server_vpp"
clientInterface = "hclnvpp"
serverInterface = "hsrvvpp"
)
type NsSuite struct {

View File

@ -6,8 +6,8 @@ import (
const (
// These correspond to names used in yaml config
serverInterfaceName = "vppsrv"
clientInterfaceName = "vppcln"
serverInterfaceName = "srv"
clientInterfaceName = "cln"
)
type VethsSuite struct {

View File

@ -13,8 +13,8 @@ func main() {
os.Exit(1)
}
http.HandleFunc("/10M", func(w http.ResponseWriter, r *http.Request) {
file, _ := os.Open("10M")
http.HandleFunc("/httpTestFile", func(w http.ResponseWriter, r *http.Request) {
file, _ := os.Open("httpTestFile")
defer file.Close()
io.Copy(w, file)
})

View File

@ -3,23 +3,23 @@ devices:
- name: "hsns"
type: "netns"
- name: "vppsrv"
- name: "srv"
type: "veth"
preset-hw-address: "00:00:5e:00:53:01"
peer:
name: "vppsrv_veth"
name: "srv_veth"
netns: "hsns"
- name: "vppcln"
- name: "cln"
type: "veth"
peer:
name: "vppcln_veth"
name: "cln_veth"
netns: "hsns"
- name: "br"
type: "bridge"
netns: "hsns"
interfaces:
- vppsrv_veth
- vppcln_veth
- srv_veth
- cln_veth

View File

@ -1,6 +1,6 @@
---
devices:
- name: "hst_client"
- name: "hstcln"
type: "tap"
ip4:
network: 1
@ -8,7 +8,7 @@ devices:
name: ""
ip4:
network: 1
- name: "hst_server"
- name: "hstsrv"
type: "tap"
ip4:
network: 2

View File

@ -1,23 +1,23 @@
---
devices:
- name: "client"
- name: "cln"
type: "netns"
- name: "server"
- name: "srv"
type: "netns"
- name: "hst_client_vpp"
- name: "hclnvpp"
type: "veth"
peer:
name: "client"
netns: "client"
name: "cln"
netns: "cln"
ip4:
network: 1
- name: "hst_server_vpp"
- name: "hsrvvpp"
type: "veth"
peer:
name: "server"
netns: "server"
name: "srv"
netns: "srv"
ip4:
network: 2

View File

@ -1,6 +1,6 @@
---
devices:
- name: "hst_tap_host"
- name: "htaphost"
type: "tap"
ip4:
network: 1