diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2023-04-28 10:29:47 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2023-05-20 15:51:02 +0000 |
commit | 608d0069d98579b0635be978dea8e316f77a8841 (patch) | |
tree | da6d23516d9b86818b577e457661c2ae58f7c776 /extras/hs-test/vppinstance.go | |
parent | 47f352710824c373f8130ba632022b47cb27505b (diff) |
hs-test: support for multiple workers
Type: test
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: Ie90e4b02c268bc3ca40171b03829f5686fb83162
Diffstat (limited to 'extras/hs-test/vppinstance.go')
-rw-r--r-- | extras/hs-test/vppinstance.go | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/extras/hs-test/vppinstance.go b/extras/hs-test/vppinstance.go index c08514e22dc..a9b97bcaa0b 100644 --- a/extras/hs-test/vppinstance.go +++ b/extras/hs-test/vppinstance.go @@ -72,9 +72,10 @@ const ( type VppInstance struct { container *Container - additionalConfig Stanza + additionalConfig []Stanza connection *core.Connection apiChannel api.Channel + cpus []int } func (vpp *VppInstance) getSuite() *HstSuite { @@ -113,7 +114,10 @@ func (vpp *VppInstance) start() error { defaultApiSocketFilePath, defaultLogFilePath, ) - configContent += vpp.additionalConfig.toString() + configContent += vpp.generateCpuConfig() + for _, c := range vpp.additionalConfig { + configContent += c.toString() + } startupFileName := vpp.getEtcDir() + "/startup.conf" vpp.container.createFile(startupFileName, configContent) @@ -341,3 +345,25 @@ func (vpp *VppInstance) disconnect() { vpp.connection.Disconnect() vpp.apiChannel.Close() } + +func (vpp *VppInstance) generateCpuConfig() string { + var c Stanza + var s string + if len(vpp.cpus) < 1 { + return "" + } + c.newStanza("cpu"). + append(fmt.Sprintf("main-core %d", vpp.cpus[0])) + workers := vpp.cpus[1:] + + if len(workers) > 0 { + for i := 0; i < len(workers); i++ { + if i != 0 { + s = s + ", " + } + s = s + fmt.Sprintf("%d", workers[i]) + } + c.append(fmt.Sprintf("corelist-workers %s", s)) + } + return c.close().toString() +} |