summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/vppinstance.go
diff options
context:
space:
mode:
authorMaros Ondrejicka <mondreji@cisco.com>2023-02-21 10:53:20 +0100
committerFlorin Coras <florin.coras@gmail.com>2023-02-21 18:40:49 +0000
commit300f70d3a3b09ed5d9371cb2936e72e1c01d042a (patch)
tree45a807706b009f800e4a8c4b6edd65fec8d99792 /extras/hs-test/vppinstance.go
parent7c06b5790d879c216ad27f8e281789b35858db43 (diff)
hs-test: clean-up ip address generation
Type: test Signed-off-by: Maros Ondrejicka <mondreji@cisco.com> Change-Id: I74c505920d1363d0ff2b3213fd831c181b70a173
Diffstat (limited to 'extras/hs-test/vppinstance.go')
-rw-r--r--extras/hs-test/vppinstance.go29
1 files changed, 11 insertions, 18 deletions
diff --git a/extras/hs-test/vppinstance.go b/extras/hs-test/vppinstance.go
index dfaf4052847..4bb72615cf9 100644
--- a/extras/hs-test/vppinstance.go
+++ b/extras/hs-test/vppinstance.go
@@ -60,10 +60,10 @@ const (
)
type VppInstance struct {
- container *Container
- additionalConfig Stanza
- connection *core.Connection
- apiChannel api.Channel
+ container *Container
+ additionalConfig Stanza
+ connection *core.Connection
+ apiChannel api.Channel
}
func (vpp *VppInstance) Suite() *HstSuite {
@@ -96,11 +96,11 @@ func (vpp *VppInstance) start() error {
// Create startup.conf inside the container
configContent := fmt.Sprintf(
- vppConfigTemplate,
- containerWorkDir,
- defaultCliSocketFilePath,
- defaultApiSocketFilePath,
- )
+ vppConfigTemplate,
+ containerWorkDir,
+ defaultCliSocketFilePath,
+ defaultApiSocketFilePath,
+ )
configContent += vpp.additionalConfig.ToString()
startupFileName := vpp.getEtcDir() + "/startup.conf"
vpp.container.createFile(startupFileName, configContent)
@@ -166,7 +166,7 @@ func (vpp *VppInstance) waitForApp(appName string, timeout int) error {
func (vpp *VppInstance) createAfPacket(
netInterface NetInterface,
) (interface_types.InterfaceIndex, error) {
- veth := netInterface.(*NetworkInterfaceVeth)
+ veth := netInterface.(*NetworkInterfaceVeth)
createReq := &af_packet.AfPacketCreateV2{
UseRandomHwAddr: true,
@@ -198,14 +198,7 @@ func (vpp *VppInstance) createAfPacket(
if veth.AddressWithPrefix() == (AddressWithPrefix{}) {
var err error
var ip4Address string
- if veth.peerNetworkNamespace != "" {
- ip4Address, err = veth.addresser.
- NewIp4AddressWithNamespace(veth.peerNetworkNamespace)
- } else {
- ip4Address, err = veth.addresser.
- NewIp4Address()
- }
- if err == nil {
+ if ip4Address, err = veth.addresser.NewIp4Address(veth.peerNetworkNumber); err == nil {
veth.SetAddress(ip4Address)
} else {
return 0, err