blob: 46d5bef92ad7674cccc7cfe83bb69f0ef1f228dd [file] [log] [blame]
Maros Ondrejickadb823ed2022-12-14 16:30:04 +01001package main
2
adrianvillin28bd8f02024-02-13 06:00:02 -05003// These correspond to names used in yaml config
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +01004const (
adrianvillinfbf5f2b2024-02-13 03:26:25 -05005 clientInterface = "hclnvpp"
6 serverInterface = "hsrvvpp"
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +01007)
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
adrianvillin28bd8f02024-02-13 06:00:02 -050036 idx, err := vpp.createAfPacket(s.getInterfaceByName(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
adrianvillin28bd8f02024-02-13 06:00:02 -050040 idx, err = vpp.createAfPacket(s.getInterfaceByName(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}