hs-test: shortened interface names to avoid character limit 87/39987/4
authoradrianvillin <avillin@cisco.com>
Tue, 13 Feb 2024 08:26:25 +0000 (03:26 -0500)
committerFlorin Coras <florin.coras@gmail.com>
Thu, 15 Feb 2024 18:35:34 +0000 (18:35 +0000)
Type: test

Change-Id: I09df597ccb8a3c4af47b8a36010afb81df533236
Signed-off-by: adrianvillin <avillin@cisco.com>
13 files changed:
extras/hs-test/echo_test.go
extras/hs-test/http_test.go
extras/hs-test/proxy_test.go
extras/hs-test/raw_session_test.go
extras/hs-test/suite_nginx_test.go
extras/hs-test/suite_no_topo_test.go
extras/hs-test/suite_ns_test.go
extras/hs-test/suite_veth_test.go
extras/hs-test/tools/http_server/http_server.go
extras/hs-test/topo-network/2peerVeth.yaml
extras/hs-test/topo-network/2taps.yaml
extras/hs-test/topo-network/ns.yaml
extras/hs-test/topo-network/tap.yaml

index 1606137..8dd620a 100644 (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",
index e710f38..068d042 100644 (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)
 
index cdb516a..748e48b 100644 (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
 }
index 45c4278..386f9bc 100644 (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")
index 4fc0626..94fd010 100644 (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 {
index c6b3170..97e5ca4 100644 (file)
@@ -1,10 +1,9 @@
 package main
 
 const (
-       singleTopoContainerVpp   = "vpp"
+       singleTopoContainerVpp = "vpp"
        singleTopoContainerNginx = "nginx"
-
-       tapInterfaceName = "hst_tap_host"
+       tapInterfaceName = "htaphost"
 )
 
 type NoTopoSuite struct {
index 4e8f497..b32fec7 100644 (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 {
index 8593c88..4158c76 100644 (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 {
index 2b6512b..8edbb14 100644 (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)
        })
index 9a966dc..f991d8b 100644 (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
 
index 38f6fca..f5dd8e2 100644 (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
index cf77f7e..018c329 100644 (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
index 26481de..acf1495 100644 (file)
@@ -1,6 +1,6 @@
 ---
 devices:
-  - name: "hst_tap_host"
+  - name: "htaphost"
     type: "tap"
     ip4:
       network: 1