Skip to content

Commit

Permalink
Merge pull request #2395 from tssurya/fix-get-pod-addresses-hbo
Browse files Browse the repository at this point in the history
HBO: Make GetPortAddresses return portMAC even if portIP is nil
  • Loading branch information
dcbw committed Aug 3, 2021
2 parents a96572f + 1a6f9c9 commit e3bb7ca
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
3 changes: 0 additions & 3 deletions go-controller/pkg/util/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ func GetPortAddresses(portName string, ovnNBClient goovn.Client) (net.HardwareAd
return nil, nil, nil
}

if len(addresses) < 2 {
return nil, nil, fmt.Errorf("error while obtaining addresses for %s: %v", portName, addresses)
}
mac, err := net.ParseMAC(addresses[0])
if err != nil {
return nil, nil, fmt.Errorf("failed to parse logical switch port %q MAC %q: %v", portName, addresses[0], err)
Expand Down
3 changes: 1 addition & 2 deletions go-controller/pkg/util/net_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ func TestGetPortAddresses(t *testing.T) {
onRetArgsOvnNBClient: &ovntest.TestifyMockHelper{OnCallMethodName: "LSPGet", OnCallMethodArgType: []string{"string"}, RetArgList: []interface{}{&goovn.LogicalSwitchPort{DynamicAddresses: "06:c6:d4:fb:fb:ba 10.244.2.2"}, nil}},
},
{
desc: "test code path where addresses list count is less than 2",
desc: "test code path where port has MAC but no IPs",
inpPort: "TEST_PORT",
errMatch: fmt.Errorf("error while obtaining addresses for"),
onRetArgsOvnNBClient: &ovntest.TestifyMockHelper{OnCallMethodName: "LSPGet", OnCallMethodArgType: []string{"string"}, RetArgList: []interface{}{&goovn.LogicalSwitchPort{DynamicAddresses: "06:c6:d4:fb:fb:ba"}, nil}},
},
{
Expand Down

0 comments on commit e3bb7ca

Please sign in to comment.