blob: 4e8f497076a90860c8a840fcfc4132be434ae988 [file] [log] [blame]
Maros Ondrejickadb823ed2022-12-14 16:30:04 +01001package main
2
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +01003const (
4 // These correspond to names used in yaml config
5 clientInterface = "hst_client_vpp"
6 serverInterface = "hst_server_vpp"
7)
8
Maros Ondrejickadb823ed2022-12-14 16:30:04 +01009type NsSuite struct {
10 HstSuite
11}
12
13func (s *NsSuite) SetupSuite() {
Filip Tehlar608d0062023-04-28 10:29:47 +020014 s.HstSuite.SetupSuite()
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +010015 s.configureNetworkTopology("ns")
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010016 s.loadContainerTopology("ns")
17}
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +010018
19func (s *NsSuite) SetupTest() {
Filip Tehlar608d0062023-04-28 10:29:47 +020020 s.HstSuite.SetupTest()
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +010021
22 // Setup test conditions
Filip Tehlar608d0062023-04-28 10:29:47 +020023 var sessionConfig Stanza
24 sessionConfig.
Maros Ondrejickae7625d02023-02-28 16:55:01 +010025 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 Ondrejicka2908f8c2023-02-02 08:58:04 +010030
Filip Tehlar608d0062023-04-28 10:29:47 +020031 cpus := s.AllocateCpus()
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +010032 container := s.getContainerByName("vpp")
Filip Tehlar608d0062023-04-28 10:29:47 +020033 vpp, _ := container.newVppInstance(cpus, sessionConfig)
Filip Tehlar56e17cf2024-01-11 17:17:33 +010034 s.assertNil(vpp.start())
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +010035
36 idx, err := vpp.createAfPacket(s.netInterfaces[serverInterface])
adrianvillin7c675472024-02-12 02:44:53 -050037 s.assertNil(err, err)
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +010038 s.assertNotEqual(0, idx)
39
40 idx, err = vpp.createAfPacket(s.netInterfaces[clientInterface])
adrianvillin7c675472024-02-12 02:44:53 -050041 s.assertNil(err, err)
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +010042 s.assertNotEqual(0, idx)
43
Maros Ondrejickae7625d02023-02-28 16:55:01 +010044 container.exec("chmod 777 -R %s", container.getContainerWorkDir())
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +010045}