- containers map[string]*Container
- volumes []string
- netConfigs []NetConfig
- netInterfaces map[string]*NetInterface
- addresser *Addresser
- testIds map[string]string
+ containers map[string]*Container
+ volumes []string
+ netConfigs []NetConfig
+ netInterfaces map[string]*NetInterface
+ ip4AddrAllocator *Ip4AddressAllocator
+ testIds map[string]string
+ cpuAllocator *CpuAllocatorT
+ cpuContexts []*CpuContext
+ cpuPerVpp int
+}
+
+func (s *HstSuite) SetupSuite() {
+ var err error
+ s.cpuAllocator, err = CpuAllocator()
+ if err != nil {
+ s.FailNow("failed to init cpu allocator: %v", err)
+ }
+ s.cpuPerVpp = *nConfiguredCpus
+}
+
+func (s *HstSuite) AllocateCpus() []int {
+ cpuCtx, err := s.cpuAllocator.Allocate(s.cpuPerVpp)
+ s.assertNil(err)
+ s.AddCpuContext(cpuCtx)
+ return cpuCtx.cpus
+}
+
+func (s *HstSuite) AddCpuContext(cpuCtx *CpuContext) {
+ s.cpuContexts = append(s.cpuContexts, cpuCtx)