hs-test: nsim loss rate test 97/43497/3
authorMatus Fabian <[email protected]>
Tue, 29 Jul 2025 15:26:24 +0000 (11:26 -0400)
committerFlorin Coras <[email protected]>
Wed, 30 Jul 2025 03:25:13 +0000 (03:25 +0000)
Type: test

Change-Id: I592c755c7bdc5daf422655892b171c42f19e9a7c
Signed-off-by: Matus Fabian <[email protected]>
extras/hs-test/nsim_test.go [new file with mode: 0644]

diff --git a/extras/hs-test/nsim_test.go b/extras/hs-test/nsim_test.go
new file mode 100644 (file)
index 0000000..c47e834
--- /dev/null
@@ -0,0 +1,24 @@
+package main
+
+import (
+       "strings"
+
+       . "fd.io/hs-test/infra"
+)
+
+func init() {
+       RegisterVethTests(NsimLossTest)
+}
+func NsimLossTest(s *VethsSuite) {
+       clientVpp := s.Containers.ClientVpp.VppInstance
+
+       s.Log(clientVpp.Vppctl("set nsim poll-main-thread delay 0.01 ms bandwidth 40 gbit packet-size 1400 drop-fraction 0.1"))
+       s.Log(clientVpp.Vppctl("nsim output-feature enable-disable host-" + s.Interfaces.Client.Name()))
+       o := clientVpp.Vppctl("show nsim")
+       s.AssertNotContains(o, "nsim not enabled")
+       o = clientVpp.Vppctl("ping " + s.Interfaces.Server.Ip4AddressString() + " repeat 10000 interval 0.0001")
+       lines := strings.Split(o, "\n")
+       stats := lines[len(lines)-2]
+       s.Log(stats)
+       s.AssertContains(stats, "10% packet loss")
+}