Maros Ondrejicka | db823ed | 2022-12-14 16:30:04 +0100 | [diff] [blame] | 1 | package main |
| 2 | |
adrianvillin | 28bd8f0 | 2024-02-13 06:00:02 -0500 | [diff] [blame^] | 3 | // These correspond to names used in yaml config |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 4 | const ( |
adrianvillin | fbf5f2b | 2024-02-13 03:26:25 -0500 | [diff] [blame] | 5 | clientInterface = "hclnvpp" |
| 6 | serverInterface = "hsrvvpp" |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 7 | ) |
| 8 | |
Maros Ondrejicka | db823ed | 2022-12-14 16:30:04 +0100 | [diff] [blame] | 9 | type NsSuite struct { |
| 10 | HstSuite |
| 11 | } |
| 12 | |
| 13 | func (s *NsSuite) SetupSuite() { |
Filip Tehlar | 608d006 | 2023-04-28 10:29:47 +0200 | [diff] [blame] | 14 | s.HstSuite.SetupSuite() |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 15 | s.configureNetworkTopology("ns") |
Maros Ondrejicka | db823ed | 2022-12-14 16:30:04 +0100 | [diff] [blame] | 16 | s.loadContainerTopology("ns") |
| 17 | } |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 18 | |
| 19 | func (s *NsSuite) SetupTest() { |
Filip Tehlar | 608d006 | 2023-04-28 10:29:47 +0200 | [diff] [blame] | 20 | s.HstSuite.SetupTest() |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 21 | |
| 22 | // Setup test conditions |
Filip Tehlar | 608d006 | 2023-04-28 10:29:47 +0200 | [diff] [blame] | 23 | var sessionConfig Stanza |
| 24 | sessionConfig. |
Maros Ondrejicka | e7625d0 | 2023-02-28 16:55:01 +0100 | [diff] [blame] | 25 | newStanza("session"). |
| 26 | append("enable"). |
| 27 | append("use-app-socket-api"). |
| 28 | append("evt_qs_memfd_seg"). |
| 29 | append("event-queue-length 100000").close() |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 30 | |
Filip Tehlar | 608d006 | 2023-04-28 10:29:47 +0200 | [diff] [blame] | 31 | cpus := s.AllocateCpus() |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 32 | container := s.getContainerByName("vpp") |
Filip Tehlar | 608d006 | 2023-04-28 10:29:47 +0200 | [diff] [blame] | 33 | vpp, _ := container.newVppInstance(cpus, sessionConfig) |
Filip Tehlar | 56e17cf | 2024-01-11 17:17:33 +0100 | [diff] [blame] | 34 | s.assertNil(vpp.start()) |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 35 | |
adrianvillin | 28bd8f0 | 2024-02-13 06:00:02 -0500 | [diff] [blame^] | 36 | idx, err := vpp.createAfPacket(s.getInterfaceByName(serverInterface)) |
adrianvillin | 7c67547 | 2024-02-12 02:44:53 -0500 | [diff] [blame] | 37 | s.assertNil(err, err) |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 38 | s.assertNotEqual(0, idx) |
| 39 | |
adrianvillin | 28bd8f0 | 2024-02-13 06:00:02 -0500 | [diff] [blame^] | 40 | idx, err = vpp.createAfPacket(s.getInterfaceByName(clientInterface)) |
adrianvillin | 7c67547 | 2024-02-12 02:44:53 -0500 | [diff] [blame] | 41 | s.assertNil(err, err) |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 42 | s.assertNotEqual(0, idx) |
| 43 | |
Maros Ondrejicka | e7625d0 | 2023-02-28 16:55:01 +0100 | [diff] [blame] | 44 | container.exec("chmod 777 -R %s", container.getContainerWorkDir()) |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 45 | } |