From e7625d08566f6127acb351376797b4fdc75e3c6a Mon Sep 17 00:00:00 2001 From: Maros Ondrejicka Date: Tue, 28 Feb 2023 16:55:01 +0100 Subject: hs-test: use consistent naming convention Exported indentifiers in Go start with capital letters. Only few fields in hs-test, which are being unmarshaled from yaml are required to be exported. Every other field name or method name should start with lower-case letter, to be consistent with this naming convention. Type: test Signed-off-by: Maros Ondrejicka Change-Id: I7eab0eef9fd08a7890c77b6ce1aeb3fa4b80f3cd --- extras/hs-test/container.go | 50 ++++++++-------- extras/hs-test/echo_test.go | 4 +- extras/hs-test/hst_suite.go | 62 ++++++++++---------- extras/hs-test/http_test.go | 8 +-- extras/hs-test/ldp_test.go | 46 +++++++-------- extras/hs-test/linux_iperf_test.go | 6 +- extras/hs-test/mirroring_test.go | 2 +- extras/hs-test/netconfig.go | 108 +++++++++++++---------------------- extras/hs-test/proxy_test.go | 8 +-- extras/hs-test/suite_nginx_test.go | 14 ++--- extras/hs-test/suite_no_topo_test.go | 10 ++-- extras/hs-test/suite_ns_test.go | 16 +++--- extras/hs-test/suite_veth_test.go | 10 ++-- extras/hs-test/topo.go | 2 +- extras/hs-test/utils.go | 24 ++++---- extras/hs-test/vcl_test.go | 18 +++--- extras/hs-test/vppinstance.go | 55 +++++++++--------- 17 files changed, 205 insertions(+), 238 deletions(-) diff --git a/extras/hs-test/container.go b/extras/hs-test/container.go index 43e033999e5..1f600f9fe24 100644 --- a/extras/hs-test/container.go +++ b/extras/hs-test/container.go @@ -35,7 +35,7 @@ type Container struct { vppInstance *VppInstance } -func NewContainer(yamlInput ContainerConfig) (*Container, error) { +func newContainer(yamlInput ContainerConfig) (*Container, error) { containerName := yamlInput["name"].(string) if len(containerName) == 0 { err := fmt.Errorf("container name must not be blank") @@ -93,10 +93,6 @@ func NewContainer(yamlInput ContainerConfig) (*Container, error) { return container, nil } -func (c *Container) Suite() *HstSuite { - return c.suite -} - func (c *Container) getWorkDirVolume() (res Volume, exists bool) { for _, v := range c.volumes { if v.isDefaultWorkDir { @@ -108,14 +104,14 @@ func (c *Container) getWorkDirVolume() (res Volume, exists bool) { return } -func (c *Container) GetHostWorkDir() (res string) { +func (c *Container) getHostWorkDir() (res string) { if v, ok := c.getWorkDirVolume(); ok { res = v.hostDir } return } -func (c *Container) GetContainerWorkDir() (res string) { +func (c *Container) getContainerWorkDir() (res string) { if v, ok := c.getWorkDirVolume(); ok { res = v.containerDir } @@ -133,13 +129,13 @@ func (c *Container) getContainerArguments() string { func (c *Container) create() error { cmd := "docker create " + c.getContainerArguments() - c.Suite().log(cmd) + c.suite.log(cmd) return exechelper.Run(cmd) } func (c *Container) start() error { cmd := "docker start " + c.name - c.Suite().log(cmd) + c.suite.log(cmd) return exechelper.Run(cmd) } @@ -149,7 +145,7 @@ func (c *Container) run() error { } cmd := "docker run -d " + c.getContainerArguments() - c.Suite().log(cmd) + c.suite.log(cmd) err := exechelper.Run(cmd) if err != nil { return fmt.Errorf("container run failed: %s", err) @@ -237,30 +233,30 @@ func (c *Container) execServer(command string, arguments ...any) { serverCommand := fmt.Sprintf(command, arguments...) containerExecCommand := "docker exec -d" + c.getEnvVarsAsCliOption() + " " + c.name + " " + serverCommand - c.Suite().T().Helper() - c.Suite().log(containerExecCommand) - c.Suite().assertNil(exechelper.Run(containerExecCommand)) + c.suite.T().Helper() + c.suite.log(containerExecCommand) + c.suite.assertNil(exechelper.Run(containerExecCommand)) } func (c *Container) exec(command string, arguments ...any) string { cliCommand := fmt.Sprintf(command, arguments...) containerExecCommand := "docker exec" + c.getEnvVarsAsCliOption() + " " + c.name + " " + cliCommand - c.Suite().T().Helper() - c.Suite().log(containerExecCommand) + c.suite.T().Helper() + c.suite.log(containerExecCommand) byteOutput, err := exechelper.CombinedOutput(containerExecCommand) - c.Suite().assertNil(err) + c.suite.assertNil(err) return string(byteOutput) } func (c *Container) getLogDirPath() string { - testId := c.Suite().getTestId() - testName := c.Suite().T().Name() + testId := c.suite.getTestId() + testName := c.suite.T().Name() logDirPath := logDir + testName + "/" + testId + "/" cmd := exec.Command("mkdir", "-p", logDirPath) if err := cmd.Run(); err != nil { - c.Suite().T().Fatalf("mkdir error: %v", err) + c.suite.T().Fatalf("mkdir error: %v", err) } return logDirPath @@ -277,22 +273,22 @@ func (c *Container) saveLogs() { cmd = exec.Command("docker", "logs", "--details", "-t", c.name) output, err := cmd.CombinedOutput() if err != nil { - c.Suite().T().Fatalf("fetching logs error: %v", err) + c.suite.T().Fatalf("fetching logs error: %v", err) } f, err := os.Create(testLogFilePath) if err != nil { - c.Suite().T().Fatalf("file create error: %v", err) + c.suite.T().Fatalf("file create error: %v", err) } - fmt.Fprintf(f, string(output)) + fmt.Fprint(f, string(output)) f.Close() } func (c *Container) log() string { cmd := "docker logs " + c.name - c.Suite().log(cmd) + c.suite.log(cmd) o, err := exechelper.CombinedOutput(cmd) - c.Suite().assertNil(err) + c.suite.assertNil(err) return string(o) } @@ -310,14 +306,14 @@ func (c *Container) createConfig(targetConfigName string, templateName string, v template := template.Must(template.ParseFiles(templateName)) f, err := os.CreateTemp("/tmp/hs-test/", "hst-config") - c.Suite().assertNil(err) + c.suite.assertNil(err) defer os.Remove(f.Name()) err = template.Execute(f, values) - c.Suite().assertNil(err) + c.suite.assertNil(err) err = f.Close() - c.Suite().assertNil(err) + c.suite.assertNil(err) c.copy(f.Name(), targetConfigName) } diff --git a/extras/hs-test/echo_test.go b/extras/hs-test/echo_test.go index 70f9e4c31a1..a9391af8193 100644 --- a/extras/hs-test/echo_test.go +++ b/extras/hs-test/echo_test.go @@ -6,12 +6,12 @@ func (s *VethsSuite) TestEchoBuiltin() { serverVpp.vppctl("test echo server " + " private-segment-size 1g fifo-size 4 no-echo" + - " uri tcp://" + serverVeth.IP4AddressString() + "/1234") + " uri tcp://" + serverVeth.ip4AddressString() + "/1234") clientVpp := s.getContainerByName("client-vpp").vppInstance o := clientVpp.vppctl("test echo client nclients 10000 bytes 1" + " syn-timeout 100 test-timeout 100 no-return private-segment-size 1g" + - " fifo-size 4 uri tcp://" + serverVeth.IP4AddressString() + "/1234") + " fifo-size 4 uri tcp://" + serverVeth.ip4AddressString() + "/1234") s.log(o) } diff --git a/extras/hs-test/hst_suite.go b/extras/hs-test/hst_suite.go index 4e4b7d20b61..78d953b794d 100644 --- a/extras/hs-test/hst_suite.go +++ b/extras/hs-test/hst_suite.go @@ -17,10 +17,10 @@ const ( defaultNetworkNumber int = 1 ) -var IsPersistent = flag.Bool("persist", false, "persists topology config") -var IsVerbose = flag.Bool("verbose", false, "verbose test output") -var IsUnconfiguring = flag.Bool("unconfigure", false, "remove topology") -var IsVppDebug = flag.Bool("debug", false, "attach gdb to vpp") +var isPersistent = flag.Bool("persist", false, "persists topology config") +var isVerbose = flag.Bool("verbose", false, "verbose test output") +var isUnconfiguring = flag.Bool("unconfigure", false, "remove topology") +var isVppDebug = flag.Bool("debug", false, "attach gdb to vpp") type HstSuite struct { suite.Suite @@ -37,26 +37,26 @@ func (s *HstSuite) TearDownSuite() { } func (s *HstSuite) TearDownTest() { - if *IsPersistent { + if *isPersistent { return } - s.ResetContainers() - s.RemoveVolumes() + s.resetContainers() + s.removeVolumes() } func (s *HstSuite) skipIfUnconfiguring() { - if *IsUnconfiguring { + if *isUnconfiguring { s.skip("skipping to unconfigure") } } func (s *HstSuite) SetupTest() { s.skipIfUnconfiguring() - s.SetupVolumes() - s.SetupContainers() + s.setupVolumes() + s.setupContainers() } -func (s *HstSuite) SetupVolumes() { +func (s *HstSuite) setupVolumes() { for _, volume := range s.volumes { cmd := "docker volume create --name=" + volume s.log(cmd) @@ -64,7 +64,7 @@ func (s *HstSuite) SetupVolumes() { } } -func (s *HstSuite) SetupContainers() { +func (s *HstSuite) setupContainers() { for _, container := range s.containers { if container.isOptional == false { container.run() @@ -119,7 +119,7 @@ func (s *HstSuite) assertNotEmpty(object interface{}, msgAndArgs ...interface{}) } func (s *HstSuite) log(args ...any) { - if *IsVerbose { + if *isVerbose { s.T().Helper() s.T().Log(args...) } @@ -130,13 +130,13 @@ func (s *HstSuite) skip(args ...any) { s.T().SkipNow() } -func (s *HstSuite) ResetContainers() { +func (s *HstSuite) resetContainers() { for _, container := range s.containers { container.stop() } } -func (s *HstSuite) RemoveVolumes() { +func (s *HstSuite) removeVolumes() { for _, volumeName := range s.volumes { cmd := "docker volume rm " + volumeName exechelper.Run(cmd) @@ -158,7 +158,7 @@ func (s *HstSuite) getTransientContainerByName(name string) *Container { } func (s *HstSuite) loadContainerTopology(topologyName string) { - data, err := ioutil.ReadFile(ContainerTopologyDir + topologyName + ".yaml") + data, err := ioutil.ReadFile(containerTopologyDir + topologyName + ".yaml") if err != nil { s.T().Fatalf("read error: %v", err) } @@ -176,7 +176,7 @@ func (s *HstSuite) loadContainerTopology(topologyName string) { s.containers = make(map[string]*Container) for _, elem := range yamlTopo.Containers { - newContainer, err := NewContainer(elem) + newContainer, err := newContainer(elem) newContainer.suite = s if err != nil { s.T().Fatalf("container config error: %v", err) @@ -186,7 +186,7 @@ func (s *HstSuite) loadContainerTopology(topologyName string) { } func (s *HstSuite) loadNetworkTopology(topologyName string) { - data, err := ioutil.ReadFile(NetworkTopologyDir + topologyName + ".yaml") + data, err := ioutil.ReadFile(networkTopologyDir + topologyName + ".yaml") if err != nil { s.T().Fatalf("read error: %v", err) } @@ -196,13 +196,13 @@ func (s *HstSuite) loadNetworkTopology(topologyName string) { s.T().Fatalf("unmarshal error: %v", err) } - s.addresser = NewAddresser(s) + s.addresser = newAddresser(s) s.netInterfaces = make(map[string]*NetInterface) for _, elem := range yamlTopo.Devices { switch elem["type"].(string) { case NetNs: { - if namespace, err := NewNetNamespace(elem); err == nil { + if namespace, err := newNetNamespace(elem); err == nil { s.netConfigs = append(s.netConfigs, &namespace) } else { s.T().Fatalf("network config error: %v", err) @@ -210,7 +210,7 @@ func (s *HstSuite) loadNetworkTopology(topologyName string) { } case Veth, Tap: { - if netIf, err := NewNetworkInterface(elem, s.addresser); err == nil { + if netIf, err := newNetworkInterface(elem, s.addresser); err == nil { s.netConfigs = append(s.netConfigs, netIf) s.netInterfaces[netIf.Name()] = netIf } else { @@ -219,7 +219,7 @@ func (s *HstSuite) loadNetworkTopology(topologyName string) { } case Bridge: { - if bridge, err := NewBridge(elem); err == nil { + if bridge, err := newBridge(elem); err == nil { s.netConfigs = append(s.netConfigs, &bridge) } else { s.T().Fatalf("network config error: %v", err) @@ -232,23 +232,23 @@ func (s *HstSuite) loadNetworkTopology(topologyName string) { func (s *HstSuite) configureNetworkTopology(topologyName string) { s.loadNetworkTopology(topologyName) - if *IsUnconfiguring { + if *isUnconfiguring { return } for _, nc := range s.netConfigs { - if err := nc.Configure(); err != nil { + if err := nc.configure(); err != nil { s.T().Fatalf("network config error: %v", err) } } } func (s *HstSuite) unconfigureNetworkTopology() { - if *IsPersistent { + if *isPersistent { return } for _, nc := range s.netConfigs { - nc.Unconfigure() + nc.unconfigure() } } @@ -273,18 +273,18 @@ type Addresser struct { suite *HstSuite } -func (a *Addresser) AddNetwork(networkNumber int) { +func (a *Addresser) addNetwork(networkNumber int) { a.networks[networkNumber] = 1 } -func (a *Addresser) NewIp4Address(inputNetworkNumber ...int) (string, error) { +func (a *Addresser) newIp4Address(inputNetworkNumber ...int) (string, error) { var networkNumber int = 0 if len(inputNetworkNumber) > 0 { networkNumber = inputNetworkNumber[0] } if _, ok := a.networks[networkNumber]; !ok { - a.AddNetwork(networkNumber) + a.addNetwork(networkNumber) } numberOfAddresses := a.networks[networkNumber] @@ -299,10 +299,10 @@ func (a *Addresser) NewIp4Address(inputNetworkNumber ...int) (string, error) { return address, nil } -func NewAddresser(suite *HstSuite) *Addresser { +func newAddresser(suite *HstSuite) *Addresser { var addresser = new(Addresser) addresser.suite = suite addresser.networks = make(map[int]AddressCounter) - addresser.AddNetwork(0) + addresser.addNetwork(0) return addresser } diff --git a/extras/hs-test/http_test.go b/extras/hs-test/http_test.go index 3f1d303d422..87130b7e47c 100644 --- a/extras/hs-test/http_test.go +++ b/extras/hs-test/http_test.go @@ -8,7 +8,7 @@ import ( func (s *NsSuite) TestHttpTps() { iface := s.netInterfaces[clientInterface] - client_ip := iface.IP4AddressString() + client_ip := iface.ip4AddressString() port := "8080" finished := make(chan error, 1) @@ -31,7 +31,7 @@ func (s *VethsSuite) TestHttpCli() { serverContainer.vppInstance.vppctl("http cli server") - uri := "http://" + serverVeth.IP4AddressString() + "/80" + uri := "http://" + serverVeth.ip4AddressString() + "/80" o := clientContainer.vppInstance.vppctl("http cli client" + " uri " + uri + " query /show/version") @@ -50,7 +50,7 @@ func (s *NoTopoSuite) TestNginxAsServer() { vpp := s.getContainerByName("vpp").vppInstance vpp.waitForApp("nginx-", 5) - serverAddress := s.netInterfaces[tapInterfaceName].Peer().IP4AddressString() + serverAddress := s.netInterfaces[tapInterfaceName].peer.ip4AddressString() defer func() { os.Remove(query) }() go startWget(finished, serverAddress, "80", query, "") @@ -63,7 +63,7 @@ func runNginxPerf(s *NoTopoSuite, mode, ab_or_wrk string) error { var args []string var exeName string - serverAddress := s.netInterfaces[tapInterfaceName].Peer().IP4AddressString() + serverAddress := s.netInterfaces[tapInterfaceName].peer.ip4AddressString() if ab_or_wrk == "ab" { args = []string{"-n", fmt.Sprintf("%d", nRequests), "-c", diff --git a/extras/hs-test/ldp_test.go b/extras/hs-test/ldp_test.go index 59d31e13890..c2d6f33b714 100644 --- a/extras/hs-test/ldp_test.go +++ b/extras/hs-test/ldp_test.go @@ -9,10 +9,10 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() { var clnVclConf, srvVclConf Stanza serverContainer := s.getContainerByName("server-vpp") - serverVclFileName := serverContainer.GetHostWorkDir() + "/vcl_srv.conf" + serverVclFileName := serverContainer.getHostWorkDir() + "/vcl_srv.conf" clientContainer := s.getContainerByName("client-vpp") - clientVclFileName := clientContainer.GetHostWorkDir() + "/vcl_cln.conf" + clientVclFileName := clientContainer.getHostWorkDir() + "/vcl_cln.conf" ldpreload := os.Getenv("HST_LDPRELOAD") s.assertNotEqual("", ldpreload) @@ -26,35 +26,35 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() { s.log("starting VPPs") clientAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/2", - clientContainer.GetContainerWorkDir()) + clientContainer.getContainerWorkDir()) err := clnVclConf. - NewStanza("vcl"). - Append("rx-fifo-size 4000000"). - Append("tx-fifo-size 4000000"). - Append("app-scope-local"). - Append("app-scope-global"). - Append("use-mq-eventfd"). - Append(clientAppSocketApi).Close(). - SaveToFile(clientVclFileName) + newStanza("vcl"). + append("rx-fifo-size 4000000"). + append("tx-fifo-size 4000000"). + append("app-scope-local"). + append("app-scope-global"). + append("use-mq-eventfd"). + append(clientAppSocketApi).close(). + saveToFile(clientVclFileName) s.assertNil(err) serverAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/1", - serverContainer.GetContainerWorkDir()) + serverContainer.getContainerWorkDir()) err = srvVclConf. - NewStanza("vcl"). - Append("rx-fifo-size 4000000"). - Append("tx-fifo-size 4000000"). - Append("app-scope-local"). - Append("app-scope-global"). - Append("use-mq-eventfd"). - Append(serverAppSocketApi).Close(). - SaveToFile(serverVclFileName) + newStanza("vcl"). + append("rx-fifo-size 4000000"). + append("tx-fifo-size 4000000"). + append("app-scope-local"). + append("app-scope-global"). + append("use-mq-eventfd"). + append(serverAppSocketApi).close(). + saveToFile(serverVclFileName) s.assertNil(err) s.log("attaching server to vpp") srvEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+serverVclFileName) - go StartServerApp(srvCh, stopServerCh, srvEnv) + go startServerApp(srvCh, stopServerCh, srvEnv) err = <-srvCh s.assertNil(err) @@ -62,8 +62,8 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() { s.log("attaching client to vpp") var clnRes = make(chan string, 1) clnEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+clientVclFileName) - serverVethAddress := s.netInterfaces[serverInterfaceName].IP4AddressString() - go StartClientApp(serverVethAddress, clnEnv, clnCh, clnRes) + serverVethAddress := s.netInterfaces[serverInterfaceName].ip4AddressString() + go startClientApp(serverVethAddress, clnEnv, clnCh, clnRes) s.log(<-clnRes) // wait for client's result diff --git a/extras/hs-test/linux_iperf_test.go b/extras/hs-test/linux_iperf_test.go index 954b54e7e8a..04556a8fe45 100644 --- a/extras/hs-test/linux_iperf_test.go +++ b/extras/hs-test/linux_iperf_test.go @@ -9,13 +9,13 @@ func (s *TapSuite) TestLinuxIperf() { stopServerCh <- struct{}{} }() - go StartServerApp(srvCh, stopServerCh, nil) + go startServerApp(srvCh, stopServerCh, nil) err := <-srvCh s.assertNil(err) s.log("server running") - ipAddress := s.netInterfaces[tapInterfaceName].IP4AddressString() - go StartClientApp(ipAddress, nil, clnCh, clnRes) + ipAddress := s.netInterfaces[tapInterfaceName].ip4AddressString() + go startClientApp(ipAddress, nil, clnCh, clnRes) s.log("client running") s.log(<-clnRes) err = <-clnCh diff --git a/extras/hs-test/mirroring_test.go b/extras/hs-test/mirroring_test.go index 6c42fe8f126..96cb3484d75 100644 --- a/extras/hs-test/mirroring_test.go +++ b/extras/hs-test/mirroring_test.go @@ -5,7 +5,7 @@ import ( ) func (s *NginxSuite) TestMirroring() { - proxyAddress := s.netInterfaces[mirroringClientInterfaceName].Peer().IP4AddressString() + proxyAddress := s.netInterfaces[mirroringClientInterfaceName].peer.ip4AddressString() path := "/64B.json" diff --git a/extras/hs-test/netconfig.go b/extras/hs-test/netconfig.go index 5c8613c70a8..9e259ab1c06 100644 --- a/extras/hs-test/netconfig.go +++ b/extras/hs-test/netconfig.go @@ -19,8 +19,8 @@ type ( InterfaceIndex = interface_types.InterfaceIndex NetConfig interface { - Configure() error - Unconfigure() + configure() error + unconfigure() Name() string Type() string } @@ -72,7 +72,7 @@ var ( } ) -func NewNetworkInterface(cfg NetDevConfig, a *Addresser) (*NetInterface, error) { +func newNetworkInterface(cfg NetDevConfig, a *Addresser) (*NetInterface, error) { var newInterface *NetInterface = &NetInterface{} var err error newInterface.addresser = a @@ -98,7 +98,7 @@ func NewNetworkInterface(cfg NetDevConfig, a *Addresser) (*NetInterface, error) if n, ok := ip.(NetDevConfig)["network"]; ok { newInterface.networkNumber = n.(int) } - newInterface.ip4Address, err = newInterface.addresser.NewIp4Address( + newInterface.ip4Address, err = newInterface.addresser.newIp4Address( newInterface.networkNumber, ) if err != nil { @@ -112,24 +112,24 @@ func NewNetworkInterface(cfg NetDevConfig, a *Addresser) (*NetInterface, error) peer := cfg["peer"].(NetDevConfig) - if newInterface.peer, err = NewNetworkInterface(peer, a); err != nil { + if newInterface.peer, err = newNetworkInterface(peer, a); err != nil { return &NetInterface{}, err } return newInterface, nil } -func (n *NetInterface) ConfigureUpState() error { - err := SetDevUp(n.Name(), "") +func (n *NetInterface) configureUpState() error { + err := setDevUp(n.Name(), "") if err != nil { return fmt.Errorf("set link up failed: %v", err) } return nil } -func (n *NetInterface) ConfigureNetworkNamespace() error { +func (n *NetInterface) configureNetworkNamespace() error { if n.networkNamespace != "" { - err := LinkSetNetns(n.name, n.networkNamespace) + err := linkSetNetns(n.name, n.networkNamespace) if err != nil { return err } @@ -137,9 +137,9 @@ func (n *NetInterface) ConfigureNetworkNamespace() error { return nil } -func (n *NetInterface) ConfigureAddress() error { +func (n *NetInterface) configureAddress() error { if n.ip4Address != "" { - if err := AddAddress( + if err := addAddress( n.Name(), n.ip4Address, n.networkNamespace, @@ -151,35 +151,35 @@ func (n *NetInterface) ConfigureAddress() error { return nil } -func (n *NetInterface) Configure() error { +func (n *NetInterface) configure() error { cmd := ipCommandMap[n.Type()](n) _, err := cmd.CombinedOutput() if err != nil { return fmt.Errorf("creating interface '%v' failed: %v", n.Name(), err) } - if err := n.ConfigureUpState(); err != nil { + if err := n.configureUpState(); err != nil { return err } - if err := n.ConfigureNetworkNamespace(); err != nil { + if err := n.configureNetworkNamespace(); err != nil { return err } - if err := n.ConfigureAddress(); err != nil { + if err := n.configureAddress(); err != nil { return err } if n.peer != nil && n.peer.name != "" { - if err := n.Peer().ConfigureUpState(); err != nil { + if err := n.peer.configureUpState(); err != nil { return err } - if err := n.Peer().ConfigureNetworkNamespace(); err != nil { + if err := n.peer.configureNetworkNamespace(); err != nil { return err } - if err := n.Peer().ConfigureAddress(); err != nil { + if err := n.peer.configureAddress(); err != nil { return err } } @@ -187,8 +187,8 @@ func (n *NetInterface) Configure() error { return nil } -func (n *NetInterface) Unconfigure() { - DelLink(n.name) +func (n *NetInterface) unconfigure() { + delLink(n.name) } func (n *NetInterface) Name() string { @@ -199,41 +199,21 @@ func (n *NetInterface) Type() string { return n.category } -func (n *NetInterface) SetAddress(address string) { - n.ip4Address = address -} - -func (n *NetInterface) SetIndex(index InterfaceIndex) { - n.index = index -} - -func (n *NetInterface) Index() InterfaceIndex { - return n.index -} - -func (n *NetInterface) AddressWithPrefix() AddressWithPrefix { +func (n *NetInterface) addressWithPrefix() AddressWithPrefix { address, _ := ip_types.ParseAddressWithPrefix(n.ip4Address) return address } -func (n *NetInterface) IP4AddressWithPrefix() IP4AddressWithPrefix { +func (n *NetInterface) ip4AddressWithPrefix() IP4AddressWithPrefix { ip4Prefix, _ := ip_types.ParseIP4Prefix(n.ip4Address) ip4AddressWithPrefix := ip_types.IP4AddressWithPrefix(ip4Prefix) return ip4AddressWithPrefix } -func (n *NetInterface) IP4AddressString() string { +func (n *NetInterface) ip4AddressString() string { return strings.Split(n.ip4Address, "/")[0] } -func (n *NetInterface) HwAddress() MacAddress { - return n.hwAddress -} - -func (n *NetInterface) Peer() *NetInterface { - return n.peer -} - func (b *NetConfigBase) Name() string { return b.name } @@ -242,22 +222,22 @@ func (b *NetConfigBase) Type() string { return b.category } -func NewNetNamespace(cfg NetDevConfig) (NetworkNamespace, error) { +func newNetNamespace(cfg NetDevConfig) (NetworkNamespace, error) { var networkNamespace NetworkNamespace networkNamespace.name = cfg["name"].(string) networkNamespace.category = NetNs return networkNamespace, nil } -func (ns *NetworkNamespace) Configure() error { +func (ns *NetworkNamespace) configure() error { return addDelNetns(ns.name, true) } -func (ns *NetworkNamespace) Unconfigure() { +func (ns *NetworkNamespace) unconfigure() { addDelNetns(ns.name, false) } -func NewBridge(cfg NetDevConfig) (NetworkBridge, error) { +func newBridge(cfg NetDevConfig) (NetworkBridge, error) { var bridge NetworkBridge bridge.name = cfg["name"].(string) bridge.category = Bridge @@ -272,16 +252,16 @@ func NewBridge(cfg NetDevConfig) (NetworkBridge, error) { return bridge, nil } -func (b *NetworkBridge) Configure() error { - return AddBridge(b.name, b.interfaces, b.networkNamespace) +func (b *NetworkBridge) configure() error { + return addBridge(b.name, b.interfaces, b.networkNamespace) } -func (b *NetworkBridge) Unconfigure() { - DelBridge(b.name, b.networkNamespace) +func (b *NetworkBridge) unconfigure() { + delBridge(b.name, b.networkNamespace) } -func DelBridge(brName, ns string) error { - err := SetDevDown(brName, ns) +func delBridge(brName, ns string) error { + err := setDevDown(brName, ns) if err != nil { return err } @@ -294,15 +274,15 @@ func DelBridge(brName, ns string) error { return nil } -func SetDevUp(dev, ns string) error { +func setDevUp(dev, ns string) error { return setDevUpDown(dev, ns, true) } -func SetDevDown(dev, ns string) error { +func setDevDown(dev, ns string) error { return setDevUpDown(dev, ns, false) } -func DelLink(ifName string) { +func delLink(ifName string) { cmd := exec.Command("ip", "link", "del", ifName) cmd.Run() } @@ -339,15 +319,7 @@ func addDelNetns(name string, isAdd bool) error { return nil } -func AddNetns(nsName string) error { - return addDelNetns(nsName, true) -} - -func DelNetns(nsName string) error { - return addDelNetns(nsName, false) -} - -func LinkSetNetns(ifName, ns string) error { +func linkSetNetns(ifName, ns string) error { cmd := exec.Command("ip", "link", "set", "dev", ifName, "up", "netns", ns) err := cmd.Run() if err != nil { @@ -356,7 +328,7 @@ func LinkSetNetns(ifName, ns string) error { return nil } -func NewCommand(s []string, ns string) *exec.Cmd { +func newCommand(s []string, ns string) *exec.Cmd { return appendNetns(s, ns) } @@ -390,7 +362,7 @@ func addDelBridge(brName, ns string, isAdd bool) error { return nil } -func AddBridge(brName string, ifs []string, ns string) error { +func addBridge(brName string, ifs []string, ns string) error { err := addDelBridge(brName, ns, true) if err != nil { return err @@ -405,7 +377,7 @@ func AddBridge(brName string, ifs []string, ns string) error { return errors.New(s) } } - err = SetDevUp(brName, ns) + err = setDevUp(brName, ns) if err != nil { return err } diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go index 784e52768aa..a7a6509144b 100644 --- a/extras/hs-test/proxy_test.go +++ b/extras/hs-test/proxy_test.go @@ -35,7 +35,7 @@ func testProxyHttpTcp(s *NsSuite) error { " --retry-on-http-error=503 --tries=10"+ " -O %s %s:555/%s", outputFile, - clientVeth.IP4AddressString(), + clientVeth.ip4AddressString(), srcFile, ) s.log(c) @@ -56,8 +56,8 @@ func configureVppProxy(s *NsSuite) { testVppProxy := s.getContainerByName("vpp").vppInstance output := testVppProxy.vppctl( "test proxy server server-uri tcp://%s/555 client-uri tcp://%s/666", - clientVeth.IP4AddressString(), - serverVeth.Peer().IP4AddressString(), + clientVeth.ip4AddressString(), + serverVeth.peer.ip4AddressString(), ) s.log("proxy configured...", output) } @@ -76,7 +76,7 @@ func configureEnvoyProxy(s *NsSuite) { address := struct { Server string }{ - Server: serverVeth.Peer().IP4AddressString(), + Server: serverVeth.peer.ip4AddressString(), } envoyContainer.createConfig( "/etc/envoy/envoy.yaml", diff --git a/extras/hs-test/suite_nginx_test.go b/extras/hs-test/suite_nginx_test.go index d8115821000..b61ea6c8b0d 100644 --- a/extras/hs-test/suite_nginx_test.go +++ b/extras/hs-test/suite_nginx_test.go @@ -22,15 +22,15 @@ func (s *NginxSuite) SetupSuite() { func (s *NginxSuite) SetupTest() { s.skipIfUnconfiguring() - s.SetupVolumes() - s.SetupContainers() + s.setupVolumes() + s.setupContainers() // Setup test conditions var startupConfig Stanza startupConfig. - NewStanza("session"). - Append("enable"). - Append("use-app-socket-api").Close() + newStanza("session"). + append("enable"). + append("use-app-socket-api").close() // ... for proxy vppProxyContainer := s.getContainerByName(vppProxyContainerName) @@ -50,8 +50,8 @@ func (s *NginxSuite) SetupTest() { Proxy string Server string }{ - Proxy: clientInterface.Peer().IP4AddressString(), - Server: serverInterface.IP4AddressString(), + Proxy: clientInterface.peer.ip4AddressString(), + Server: serverInterface.ip4AddressString(), } nginxContainer.createConfig( "/nginx.conf", diff --git a/extras/hs-test/suite_no_topo_test.go b/extras/hs-test/suite_no_topo_test.go index 9051284c780..8ef56b24d8b 100644 --- a/extras/hs-test/suite_no_topo_test.go +++ b/extras/hs-test/suite_no_topo_test.go @@ -19,15 +19,15 @@ func (s *NoTopoSuite) SetupSuite() { func (s *NoTopoSuite) SetupTest() { s.skipIfUnconfiguring() - s.SetupVolumes() - s.SetupContainers() + s.setupVolumes() + s.setupContainers() // Setup test conditions var startupConfig Stanza startupConfig. - NewStanza("session"). - Append("enable"). - Append("use-app-socket-api").Close() + newStanza("session"). + append("enable"). + append("use-app-socket-api").close() container := s.getContainerByName(singleTopoContainerVpp) vpp, _ := container.newVppInstance(startupConfig) diff --git a/extras/hs-test/suite_ns_test.go b/extras/hs-test/suite_ns_test.go index c4a3f426648..34fc9ec9723 100644 --- a/extras/hs-test/suite_ns_test.go +++ b/extras/hs-test/suite_ns_test.go @@ -18,17 +18,17 @@ func (s *NsSuite) SetupSuite() { func (s *NsSuite) SetupTest() { s.skipIfUnconfiguring() - s.SetupVolumes() - s.SetupContainers() + s.setupVolumes() + s.setupContainers() // Setup test conditions var startupConfig Stanza startupConfig. - NewStanza("session"). - Append("enable"). - Append("use-app-socket-api"). - Append("evt_qs_memfd_seg"). - Append("event-queue-length 100000").Close() + newStanza("session"). + append("enable"). + append("use-app-socket-api"). + append("evt_qs_memfd_seg"). + append("event-queue-length 100000").close() container := s.getContainerByName("vpp") vpp, _ := container.newVppInstance(startupConfig) @@ -42,5 +42,5 @@ func (s *NsSuite) SetupTest() { s.assertNil(err) s.assertNotEqual(0, idx) - container.exec("chmod 777 -R %s", container.GetContainerWorkDir()) + container.exec("chmod 777 -R %s", container.getContainerWorkDir()) } diff --git a/extras/hs-test/suite_veth_test.go b/extras/hs-test/suite_veth_test.go index 96af40771a2..be79ce250fb 100644 --- a/extras/hs-test/suite_veth_test.go +++ b/extras/hs-test/suite_veth_test.go @@ -25,16 +25,16 @@ func (s *VethsSuite) SetupSuite() { func (s *VethsSuite) SetupTest() { s.skipIfUnconfiguring() - s.SetupVolumes() - s.SetupContainers() + s.setupVolumes() + s.setupContainers() // Setup test conditions var startupConfig Stanza startupConfig. - NewStanza("session"). - Append("enable"). - Append("use-app-socket-api").Close() + newStanza("session"). + append("enable"). + append("use-app-socket-api").close() // ... For server serverContainer := s.getContainerByName("server-vpp") diff --git a/extras/hs-test/topo.go b/extras/hs-test/topo.go index d77d2dab33f..6cb294511b3 100644 --- a/extras/hs-test/topo.go +++ b/extras/hs-test/topo.go @@ -14,7 +14,7 @@ type YamlTopology struct { Volumes []VolumeConfig `yaml:"volumes"` } -func AddAddress(device, address, ns string) error { +func addAddress(device, address, ns string) error { c := []string{"ip", "addr", "add", address, "dev", device} cmd := appendNetns(c, ns) err := cmd.Run() diff --git a/extras/hs-test/utils.go b/extras/hs-test/utils.go index f912880a78a..151567c3fed 100644 --- a/extras/hs-test/utils.go +++ b/extras/hs-test/utils.go @@ -20,8 +20,8 @@ const vclTemplate = `vcl { } ` -const NetworkTopologyDir string = "topo-network/" -const ContainerTopologyDir string = "topo-containers/" +const networkTopologyDir string = "topo-network/" +const containerTopologyDir string = "topo-containers/" type Stanza struct { content string @@ -42,7 +42,7 @@ type JsonResult struct { StdOutput string } -func StartServerApp(running chan error, done chan struct{}, env []string) { +func startServerApp(running chan error, done chan struct{}, env []string) { cmd := exec.Command("iperf3", "-4", "-s") if env != nil { cmd.Env = env @@ -58,7 +58,7 @@ func StartServerApp(running chan error, done chan struct{}, env []string) { cmd.Process.Kill() } -func StartClientApp(ipAddress string, env []string, clnCh chan error, clnRes chan string) { +func startClientApp(ipAddress string, env []string, clnCh chan error, clnRes chan string) { defer func() { clnCh <- nil }() @@ -104,7 +104,7 @@ func assertFileSize(f1, f2 string) error { } func startHttpServer(running chan struct{}, done chan struct{}, addressPort, netNs string) { - cmd := NewCommand([]string{"./http_server", addressPort}, netNs) + cmd := newCommand([]string{"./http_server", addressPort}, netNs) err := cmd.Start() if err != nil { fmt.Println("Failed to start http server") @@ -120,7 +120,7 @@ func startWget(finished chan error, server_ip, port, query, netNs string) { finished <- errors.New("wget error") }() - cmd := NewCommand([]string{"wget", "--timeout=10", "--no-proxy", "--tries=5", "-O", "/dev/null", server_ip + ":" + port + "/" + query}, + cmd := newCommand([]string{"wget", "--timeout=10", "--no-proxy", "--tries=5", "-O", "/dev/null", server_ip + ":" + port + "/" + query}, netNs) o, err := cmd.CombinedOutput() if err != nil { @@ -133,29 +133,29 @@ func startWget(finished chan error, server_ip, port, query, netNs string) { finished <- nil } -func (c *Stanza) NewStanza(name string) *Stanza { - c.Append("\n" + name + " {") +func (c *Stanza) newStanza(name string) *Stanza { + c.append("\n" + name + " {") c.pad += 2 return c } -func (c *Stanza) Append(name string) *Stanza { +func (c *Stanza) append(name string) *Stanza { c.content += strings.Repeat(" ", c.pad) c.content += name + "\n" return c } -func (c *Stanza) Close() *Stanza { +func (c *Stanza) close() *Stanza { c.content += "}\n" c.pad -= 2 return c } -func (s *Stanza) ToString() string { +func (s *Stanza) toString() string { return s.content } -func (s *Stanza) SaveToFile(fileName string) error { +func (s *Stanza) saveToFile(fileName string) error { fo, err := os.Create(fileName) if err != nil { return err diff --git a/extras/hs-test/vcl_test.go b/extras/hs-test/vcl_test.go index 7cf4ab75dfd..fe55af1866a 100644 --- a/extras/hs-test/vcl_test.go +++ b/extras/hs-test/vcl_test.go @@ -20,12 +20,12 @@ func (s *VethsSuite) TestVclEchoTcp() { } func (s *VethsSuite) testVclEcho(proto string) { - serverVethAddress := s.netInterfaces["vppsrv"].IP4AddressString() + serverVethAddress := s.netInterfaces["vppsrv"].ip4AddressString() uri := proto + "://" + serverVethAddress + "/12344" echoSrvContainer := s.getContainerByName("server-application") serverCommand := "vpp_echo server TX=RX" + - " socket-name " + echoSrvContainer.GetContainerWorkDir() + "/var/run/app_ns_sockets/1" + + " socket-name " + echoSrvContainer.getContainerWorkDir() + "/var/run/app_ns_sockets/1" + " use-app-socket-api" + " uri " + uri s.log(serverCommand) @@ -34,7 +34,7 @@ func (s *VethsSuite) testVclEcho(proto string) { echoClnContainer := s.getContainerByName("client-application") clientCommand := "vpp_echo client" + - " socket-name " + echoClnContainer.GetContainerWorkDir() + "/var/run/app_ns_sockets/2" + + " socket-name " + echoClnContainer.getContainerWorkDir() + "/var/run/app_ns_sockets/2" + " use-app-socket-api uri " + uri s.log(clientCommand) o := echoClnContainer.exec(clientCommand) @@ -52,7 +52,7 @@ func (s *VethsSuite) testRetryAttach(proto string) { echoSrvContainer := s.getContainerByName("server-application") - serverVclConfContent := fmt.Sprintf(vclTemplate, echoSrvContainer.GetContainerWorkDir(), "1") + serverVclConfContent := fmt.Sprintf(vclTemplate, echoSrvContainer.getContainerWorkDir(), "1") echoSrvContainer.createFile("/vcl.conf", serverVclConfContent) echoSrvContainer.addEnvVar("VCL_CONFIG", "/vcl.conf") @@ -62,10 +62,10 @@ func (s *VethsSuite) testRetryAttach(proto string) { s.log("... Running first echo client test, before disconnect.") serverVeth := s.netInterfaces[serverInterfaceName] - serverVethAddress := serverVeth.IP4AddressString() + serverVethAddress := serverVeth.ip4AddressString() echoClnContainer := s.getTransientContainerByName("client-application") - clientVclConfContent := fmt.Sprintf(vclTemplate, echoClnContainer.GetContainerWorkDir(), "2") + clientVclConfContent := fmt.Sprintf(vclTemplate, echoClnContainer.getContainerWorkDir(), "2") echoClnContainer.createFile("/vcl.conf", clientVclConfContent) testClientCommand := "vcl_test_client -U -p " + proto + " " + serverVethAddress + " 12346" @@ -95,13 +95,13 @@ func (s *VethsSuite) TestTcpWithLoss() { serverVeth := s.netInterfaces[serverInterfaceName] serverVpp.vppctl("test echo server uri tcp://%s/20022", - serverVeth.IP4AddressString()) + serverVeth.ip4AddressString()) clientVpp := s.getContainerByName("client-vpp").vppInstance // Ensure that VPP doesn't abort itself with NSIM enabled // Warning: Removing this ping will make the test fail! - clientVpp.vppctl("ping %s", serverVeth.IP4AddressString()) + clientVpp.vppctl("ping %s", serverVeth.ip4AddressString()) // Add loss of packets with Network Delay Simulator clientVpp.vppctl("set nsim poll-main-thread delay 0.01 ms bandwidth 40 gbit" + @@ -111,7 +111,7 @@ func (s *VethsSuite) TestTcpWithLoss() { // Do echo test from client-vpp container output := clientVpp.vppctl("test echo client uri tcp://%s/20022 mbytes 50", - serverVeth.IP4AddressString()) + serverVeth.ip4AddressString()) s.assertEqual(true, len(output) != 0) s.assertNotContains(output, "failed: timeout") s.log(output) diff --git a/extras/hs-test/vppinstance.go b/extras/hs-test/vppinstance.go index 89e67d0fac7..d35cf45f8f5 100644 --- a/extras/hs-test/vppinstance.go +++ b/extras/hs-test/vppinstance.go @@ -77,29 +77,29 @@ type VppInstance struct { apiChannel api.Channel } -func (vpp *VppInstance) Suite() *HstSuite { +func (vpp *VppInstance) getSuite() *HstSuite { return vpp.container.suite } func (vpp *VppInstance) getCliSocket() string { - return fmt.Sprintf("%s%s", vpp.container.GetContainerWorkDir(), defaultCliSocketFilePath) + return fmt.Sprintf("%s%s", vpp.container.getContainerWorkDir(), defaultCliSocketFilePath) } func (vpp *VppInstance) getRunDir() string { - return vpp.container.GetContainerWorkDir() + "/var/run/vpp" + return vpp.container.getContainerWorkDir() + "/var/run/vpp" } func (vpp *VppInstance) getLogDir() string { - return vpp.container.GetContainerWorkDir() + "/var/log/vpp" + return vpp.container.getContainerWorkDir() + "/var/log/vpp" } func (vpp *VppInstance) getEtcDir() string { - return vpp.container.GetContainerWorkDir() + "/etc/vpp" + return vpp.container.getContainerWorkDir() + "/etc/vpp" } func (vpp *VppInstance) start() error { // Create folders - containerWorkDir := vpp.container.GetContainerWorkDir() + containerWorkDir := vpp.container.getContainerWorkDir() vpp.container.exec("mkdir --mode=0700 -p " + vpp.getRunDir()) vpp.container.exec("mkdir --mode=0700 -p " + vpp.getLogDir()) @@ -113,7 +113,7 @@ func (vpp *VppInstance) start() error { defaultApiSocketFilePath, defaultLogFilePath, ) - configContent += vpp.additionalConfig.ToString() + configContent += vpp.additionalConfig.toString() startupFileName := vpp.getEtcDir() + "/startup.conf" vpp.container.createFile(startupFileName, configContent) @@ -123,7 +123,7 @@ func (vpp *VppInstance) start() error { vpp.container.createFile(vppcliFileName, cliContent) vpp.container.exec("chmod 0755 " + vppcliFileName) - if *IsVppDebug { + if *isVppDebug { sig := make(chan os.Signal, 1) signal.Notify(sig, syscall.SIGINT) cont := make(chan bool, 1) @@ -145,7 +145,7 @@ func (vpp *VppInstance) start() error { } // Connect to VPP and store the connection - sockAddress := vpp.container.GetHostWorkDir() + defaultApiSocketFilePath + sockAddress := vpp.container.getHostWorkDir() + defaultApiSocketFilePath conn, connEv, err := govpp.AsyncConnect( sockAddress, core.DefaultMaxReconnectAttempts, @@ -181,9 +181,9 @@ func (vpp *VppInstance) vppctl(command string, arguments ...any) string { vppCliCommand := fmt.Sprintf(command, arguments...) containerExecCommand := fmt.Sprintf("docker exec --detach=false %[1]s vppctl -s %[2]s %[3]s", vpp.container.name, vpp.getCliSocket(), vppCliCommand) - vpp.Suite().log(containerExecCommand) + vpp.getSuite().log(containerExecCommand) output, err := exechelper.CombinedOutput(containerExecCommand) - vpp.Suite().assertNil(err) + vpp.getSuite().assertNil(err) return string(output) } @@ -196,8 +196,7 @@ func (vpp *VppInstance) waitForApp(appName string, timeout int) { } time.Sleep(1 * time.Second) } - vpp.Suite().assertNil(1, "Timeout while waiting for app '%s'", appName) - return + vpp.getSuite().assertNil(1, "Timeout while waiting for app '%s'", appName) } func (vpp *VppInstance) createAfPacket( @@ -207,20 +206,20 @@ func (vpp *VppInstance) createAfPacket( UseRandomHwAddr: true, HostIfName: veth.Name(), } - if veth.HwAddress() != (MacAddress{}) { + if veth.hwAddress != (MacAddress{}) { createReq.UseRandomHwAddr = false - createReq.HwAddr = veth.HwAddress() + createReq.HwAddr = veth.hwAddress } createReply := &af_packet.AfPacketCreateV2Reply{} if err := vpp.apiChannel.SendRequest(createReq).ReceiveReply(createReply); err != nil { return 0, err } - veth.SetIndex(createReply.SwIfIndex) + veth.index = createReply.SwIfIndex // Set to up upReq := &interfaces.SwInterfaceSetFlags{ - SwIfIndex: veth.Index(), + SwIfIndex: veth.index, Flags: interface_types.IF_STATUS_API_FLAG_ADMIN_UP, } upReply := &interfaces.SwInterfaceSetFlagsReply{} @@ -230,19 +229,19 @@ func (vpp *VppInstance) createAfPacket( } // Add address - if veth.AddressWithPrefix() == (AddressWithPrefix{}) { + if veth.addressWithPrefix() == (AddressWithPrefix{}) { var err error var ip4Address string - if ip4Address, err = veth.addresser.NewIp4Address(veth.Peer().networkNumber); err == nil { - veth.SetAddress(ip4Address) + if ip4Address, err = veth.addresser.newIp4Address(veth.peer.networkNumber); err == nil { + veth.ip4Address = ip4Address } else { return 0, err } } addressReq := &interfaces.SwInterfaceAddDelAddress{ IsAdd: true, - SwIfIndex: veth.Index(), - Prefix: veth.AddressWithPrefix(), + SwIfIndex: veth.index, + Prefix: veth.addressWithPrefix(), } addressReply := &interfaces.SwInterfaceAddDelAddressReply{} @@ -250,7 +249,7 @@ func (vpp *VppInstance) createAfPacket( return 0, err } - return veth.Index(), nil + return veth.index, nil } func (vpp *VppInstance) addAppNamespace( @@ -294,7 +293,7 @@ func (vpp *VppInstance) createTap( HostIfNameSet: true, HostIfName: tap.Name(), HostIP4PrefixSet: true, - HostIP4Prefix: tap.IP4AddressWithPrefix(), + HostIP4Prefix: tap.ip4AddressWithPrefix(), } createTapReply := &tapv2.TapCreateV2Reply{} @@ -307,7 +306,7 @@ func (vpp *VppInstance) createTap( addAddressReq := &interfaces.SwInterfaceAddDelAddress{ IsAdd: true, SwIfIndex: createTapReply.SwIfIndex, - Prefix: tap.Peer().AddressWithPrefix(), + Prefix: tap.peer.addressWithPrefix(), } addAddressReply := &interfaces.SwInterfaceAddDelAddressReply{} @@ -331,10 +330,10 @@ func (vpp *VppInstance) createTap( func (vpp *VppInstance) saveLogs() { logTarget := vpp.container.getLogDirPath() + "vppinstance-" + vpp.container.name + ".log" - logSource := vpp.container.GetHostWorkDir() + defaultLogFilePath + logSource := vpp.container.getHostWorkDir() + defaultLogFilePath cmd := exec.Command("cp", logSource, logTarget) - vpp.Suite().T().Helper() - vpp.Suite().log(cmd.String()) + vpp.getSuite().T().Helper() + vpp.getSuite().log(cmd.String()) cmd.Run() } -- cgit 1.2.3-korg