hs-test: refactor netconfig
[vpp.git] / extras / hs-test / suite_no_topo_test.go
index 01958b0..12b939e 100644 (file)
@@ -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)
 }