diff options
author | Maros Ondrejicka <mondreji@cisco.com> | 2023-02-23 13:19:15 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2023-02-27 17:26:41 +0000 |
commit | 40cba405c5c06a3dc086a55143cb3ffd1094597e (patch) | |
tree | 0263e3834a316d73863b1a6cc2da9beac916ac45 /extras/hs-test/suite_no_topo_test.go | |
parent | 9cb3e15c9f5b0eed296c3517c6475bd17a33441e (diff) |
hs-test: refactor netconfig
This joins separate representations of veth and tap interfaces
into a single struct. It removes the need for type interface
and embedding which simplifies the code.
Type: test
Signed-off-by: Maros Ondrejicka <mondreji@cisco.com>
Change-Id: I1b2c368bfe90a5bdfaaa9a5129c27d7d96f8fe3b
Diffstat (limited to 'extras/hs-test/suite_no_topo_test.go')
-rw-r--r-- | extras/hs-test/suite_no_topo_test.go | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/extras/hs-test/suite_no_topo_test.go b/extras/hs-test/suite_no_topo_test.go index 01958b0a804..12b939e435f 100644 --- a/extras/hs-test/suite_no_topo_test.go +++ b/extras/hs-test/suite_no_topo_test.go @@ -4,8 +4,7 @@ const ( singleTopoContainerVpp = "vpp" singleTopoContainerNginx = "nginx" - tapNameVpp = "vppTap" - tapNameHost = "hostTap" + tapInterfaceName = "hst_tap_host" ) type NoTopoSuite struct { @@ -13,19 +12,9 @@ type NoTopoSuite struct { } func (s *NoTopoSuite) SetupSuite() { - s.loadContainerTopology("single") - - s.addresser = NewAddresser(&s.HstSuite) - - var vppTapDevConfig = NetDevConfig{"name": tapNameVpp} - vppTap, _ := NewTap(vppTapDevConfig, s.addresser) + s.loadNetworkTopology("tap") - var hostTapDevConfig = NetDevConfig{"name": tapNameHost} - hostTap, _ := NewTap(hostTapDevConfig, s.addresser) - - s.netInterfaces = make(map[string]NetInterface) - s.netInterfaces[vppTap.Name()] = &vppTap - s.netInterfaces[hostTap.Name()] = &hostTap + s.loadContainerTopology("single") } func (s *NoTopoSuite) SetupTest() { @@ -43,8 +32,7 @@ func (s *NoTopoSuite) SetupTest() { vpp, _ := container.newVppInstance(startupConfig) vpp.start() - vppTapAddress := s.netInterfaces[tapNameVpp].AddressWithPrefix() - hostTapAddress := s.netInterfaces[tapNameHost].IP4AddressWithPrefix() + tapInterface := s.netInterfaces[tapInterfaceName] - vpp.createTap("tap0", hostTapAddress, vppTapAddress) + vpp.createTap(1, tapInterface) } |