aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test
diff options
context:
space:
mode:
Diffstat (limited to 'extras/hs-test')
-rw-r--r--extras/hs-test/Makefile1
-rw-r--r--extras/hs-test/container.go23
-rw-r--r--extras/hs-test/go.mod5
-rw-r--r--extras/hs-test/go.sum29
-rw-r--r--extras/hs-test/netconfig.go12
-rw-r--r--extras/hs-test/vppinstance.go35
6 files changed, 17 insertions, 88 deletions
diff --git a/extras/hs-test/Makefile b/extras/hs-test/Makefile
index cd3a284208f..2bb6db951cb 100644
--- a/extras/hs-test/Makefile
+++ b/extras/hs-test/Makefile
@@ -8,5 +8,6 @@ docker:
fixstyle:
@gofmt -w .
+ @go mod tidy
.PHONY: docker
diff --git a/extras/hs-test/container.go b/extras/hs-test/container.go
index 8ece8a8952b..4087d851945 100644
--- a/extras/hs-test/container.go
+++ b/extras/hs-test/container.go
@@ -130,7 +130,6 @@ func (c *Container) run() error {
return fmt.Errorf("run container failed: name is blank")
}
- exechelper.Run(fmt.Sprintf("mkdir -p /tmp/%s/sync", c.name))
cmd := c.getRunCommand()
err := exechelper.Run(cmd)
if err != nil {
@@ -148,10 +147,6 @@ func (c *Container) addVolume(hostDir string, containerDir string, isDefaultWork
c.volumes[hostDir] = volume
}
-func (c *Container) getVolumeByHostDir(hostDir string) Volume {
- return c.volumes[hostDir]
-}
-
func (c *Container) getVolumesAsCliOption() string {
cliOption := ""
@@ -164,13 +159,6 @@ func (c *Container) getVolumesAsCliOption() string {
return cliOption
}
-func (c *Container) getWorkDirAsCliOption() string {
- if _, ok := c.getWorkDirVolume(); ok {
- return fmt.Sprintf(" --workdir=\"%s\"", c.GetContainerWorkDir())
- }
- return ""
-}
-
func (c *Container) addEnvVar(name string, value string) {
c.envVars[name] = value
}
@@ -188,15 +176,12 @@ func (c *Container) getEnvVarsAsCliOption() string {
}
func (c *Container) newVppInstance(additionalConfig ...Stanza) (*VppInstance, error) {
- vppConfig := new(VppConfig)
- vppConfig.CliSocketFilePath = defaultCliSocketFilePath
- if len(additionalConfig) > 0 {
- vppConfig.additionalConfig = additionalConfig[0]
- }
-
vpp := new(VppInstance)
vpp.container = c
- vpp.config = vppConfig
+
+ if len(additionalConfig) > 0 {
+ vpp.additionalConfig = additionalConfig[0]
+ }
c.vppInstance = vpp
diff --git a/extras/hs-test/go.mod b/extras/hs-test/go.mod
index 0f6bffb28fc..8eb4e86ce67 100644
--- a/extras/hs-test/go.mod
+++ b/extras/hs-test/go.mod
@@ -3,10 +3,7 @@ module fd.io/hs-test
go 1.18
require (
- git.fd.io/govpp.git v0.4.0
github.com/edwarnicke/exechelper v1.0.2
- github.com/edwarnicke/govpp v0.0.0-20220311182453-f32f292e0e91
- github.com/edwarnicke/vpphelper v0.0.0-20210617172001-3e6797de32c3
github.com/stretchr/testify v1.7.0
go.fd.io/govpp v0.7.0
gopkg.in/yaml.v3 v3.0.1
@@ -14,7 +11,6 @@ require (
require (
github.com/davecgh/go-spew v1.1.1 // indirect
- github.com/edwarnicke/log v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/kr/text v0.2.0 // indirect
@@ -24,5 +20,4 @@ require (
github.com/sirupsen/logrus v1.8.1 // indirect
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
- gopkg.in/fsnotify.v1 v1.4.7 // indirect
)
diff --git a/extras/hs-test/go.sum b/extras/hs-test/go.sum
index 531153edd54..8df3ccef1a7 100644
--- a/extras/hs-test/go.sum
+++ b/extras/hs-test/go.sum
@@ -1,30 +1,13 @@
-git.fd.io/govpp.git v0.3.6-0.20210202134006-4c1cccf48cd1/go.mod h1:OCVd4W8SH+666KRQoMj6PM+oipLDZAHhqMz9B1TGbgI=
-git.fd.io/govpp.git v0.3.6-0.20210927044411-385ccc0d8ba9/go.mod h1:OCVd4W8SH+666KRQoMj6PM+oipLDZAHhqMz9B1TGbgI=
-git.fd.io/govpp.git v0.4.0 h1:u/hxo5rwTpwmR8ambm5Xtf1WXEeDyoYOrD2m8TKcD34=
-git.fd.io/govpp.git v0.4.0/go.mod h1:OCVd4W8SH+666KRQoMj6PM+oipLDZAHhqMz9B1TGbgI=
-github.com/bennyscetbun/jsongo v1.1.0/go.mod h1:suxbVmjBV8+A2BBAM5EYVh6Uj8j3rqJhzWf3hv7Ff8U=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/edwarnicke/exechelper v1.0.2 h1:dD49Ui2U0FBFxxhalnKw6vLS0P0TkgnXBRvKL/xmC5w=
github.com/edwarnicke/exechelper v1.0.2/go.mod h1:/T271jtNX/ND4De6pa2aRy2+8sNtyCDB1A2pp4M+fUs=
-github.com/edwarnicke/govpp v0.0.0-20220311182453-f32f292e0e91 h1:iDVzIaYZjTg+hQGcDeOLJZc+5VfKvW7ye54EFX3CRQA=
-github.com/edwarnicke/govpp v0.0.0-20220311182453-f32f292e0e91/go.mod h1:kHDnxA+SSNFeMEHz7xvhub1zvx4mOTRlWWRCay2n5NM=
-github.com/edwarnicke/log v1.0.0 h1:T6uRNCmR99GTt/CpRr2Gz8eGW8fm0HMThDNGdNxPaGk=
-github.com/edwarnicke/log v1.0.0/go.mod h1:eWsQQlQ0IU5wHlJvyXFH3dS8s2g9GzN7JnXodo6yaIY=
-github.com/edwarnicke/vpphelper v0.0.0-20210617172001-3e6797de32c3 h1:BGWyFzJ9QfXOd0jzTe08d98KOXus/3KS4aSgrZKTGx8=
-github.com/edwarnicke/vpphelper v0.0.0-20210617172001-3e6797de32c3/go.mod h1:2KXgJqOUUCh9S4Zs2jAycQLqAcRGge3q+GXV2rN55ZQ=
-github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
-github.com/ftrvxmtrx/fd v0.0.0-20150925145434-c6d800382fff/go.mod h1:yUhRXHewUVJ1k89wHKP68xfzk7kwXUx/DV1nx4EBMbw=
-github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
-github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
-github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
-github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@@ -33,41 +16,29 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lunixbochs/struc v0.0.0-20200521075829-a4cb8d33dbbe h1:ewr1srjRCmcQogPQ/NCx6XCk6LGVmsVCc9Y3vvPZj+Y=
github.com/lunixbochs/struc v0.0.0-20200521075829-a4cb8d33dbbe/go.mod h1:vy1vK6wD6j7xX6O6hXe621WabdtNkou2h7uRtTfRMyg=
-github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
-github.com/onsi/gomega v1.1.0/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
-github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
-github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
go.fd.io/govpp v0.7.0 h1:8qideC7G0xPeYz2sjwni8GKWWbNk45Ev73oR1igKDYY=
go.fd.io/govpp v0.7.0/go.mod h1:VxUPq8HGQH6/9IL9saMURL3UcHsUuN8XmETuao5HA7o=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
-golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200610111108-226ff32320da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
-gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
-gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
-gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/extras/hs-test/netconfig.go b/extras/hs-test/netconfig.go
index d94b3269889..5b199fd12a7 100644
--- a/extras/hs-test/netconfig.go
+++ b/extras/hs-test/netconfig.go
@@ -252,18 +252,6 @@ func DelBridge(brName, ns string) error {
return nil
}
-func configureBridge(dev NetDevConfig) error {
- var ifs []string
- for _, v := range dev["interfaces"].([]interface{}) {
- ifs = append(ifs, v.(string))
- }
- return AddBridge(dev["name"].(string), ifs, dev["netns"].(string))
-}
-
-func configureTap(dev NetDevConfig) error {
- return AddTap(dev["name"].(string), dev["ip4"].(string))
-}
-
func SetDevUp(dev, ns string) error {
return setDevUpDown(dev, ns, true)
}
diff --git a/extras/hs-test/vppinstance.go b/extras/hs-test/vppinstance.go
index b45ad6028fe..dfaf4052847 100644
--- a/extras/hs-test/vppinstance.go
+++ b/extras/hs-test/vppinstance.go
@@ -35,7 +35,7 @@ api-segment {
}
socksvr {
- socket-name %[1]s/var/run/vpp/api.sock
+ socket-name %[1]s%[3]s
}
statseg {
@@ -61,32 +61,17 @@ const (
type VppInstance struct {
container *Container
- config *VppConfig
- actionFuncName string
+ additionalConfig Stanza
connection *core.Connection
apiChannel api.Channel
}
-type VppConfig struct {
- Variant string
- CliSocketFilePath string
- additionalConfig Stanza
-}
-
-func (vc *VppConfig) getTemplate() string {
- return fmt.Sprintf(vppConfigTemplate, "%[1]s", vc.CliSocketFilePath)
-}
-
func (vpp *VppInstance) Suite() *HstSuite {
return vpp.container.suite
}
-func (vpp *VppInstance) setCliSocket(filePath string) {
- vpp.config.CliSocketFilePath = filePath
-}
-
func (vpp *VppInstance) getCliSocket() string {
- return fmt.Sprintf("%s%s", vpp.container.GetContainerWorkDir(), vpp.config.CliSocketFilePath)
+ return fmt.Sprintf("%s%s", vpp.container.GetContainerWorkDir(), defaultCliSocketFilePath)
}
func (vpp *VppInstance) getRunDir() string {
@@ -110,8 +95,13 @@ func (vpp *VppInstance) start() error {
vpp.container.exec("mkdir --mode=0700 -p " + vpp.getEtcDir())
// Create startup.conf inside the container
- configContent := fmt.Sprintf(vppConfigTemplate, containerWorkDir, vpp.config.CliSocketFilePath)
- configContent += vpp.config.additionalConfig.ToString()
+ configContent := fmt.Sprintf(
+ vppConfigTemplate,
+ containerWorkDir,
+ defaultCliSocketFilePath,
+ defaultApiSocketFilePath,
+ )
+ configContent += vpp.additionalConfig.ToString()
startupFileName := vpp.getEtcDir() + "/startup.conf"
vpp.container.createFile(startupFileName, configContent)
@@ -170,14 +160,13 @@ func (vpp *VppInstance) waitForApp(appName string, timeout int) error {
}
time.Sleep(1 * time.Second)
}
- return fmt.Errorf("Timeout while waiting for app '%s'", appName)
+ return fmt.Errorf("timeout while waiting for app '%s'", appName)
}
func (vpp *VppInstance) createAfPacket(
netInterface NetInterface,
) (interface_types.InterfaceIndex, error) {
- var veth *NetworkInterfaceVeth
- veth = netInterface.(*NetworkInterfaceVeth)
+ veth := netInterface.(*NetworkInterfaceVeth)
createReq := &af_packet.AfPacketCreateV2{
UseRandomHwAddr: true,