From 9f9cdde5325472a3e2b0b2810120145cbc650cfc Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Tue, 29 Jul 2025 11:26:24 -0400 Subject: [PATCH] hs-test: nsim loss rate test Type: test Change-Id: I592c755c7bdc5daf422655892b171c42f19e9a7c Signed-off-by: Matus Fabian --- extras/hs-test/nsim_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 extras/hs-test/nsim_test.go diff --git a/extras/hs-test/nsim_test.go b/extras/hs-test/nsim_test.go new file mode 100644 index 00000000000..c47e83455e7 --- /dev/null +++ b/extras/hs-test/nsim_test.go @@ -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") +} -- 2.16.6