From 1ceb9d397ef61faf03fc4b9c63f5cd8627035700 Mon Sep 17 00:00:00 2001 From: bobz965 Date: Tue, 28 Nov 2023 15:34:46 +0800 Subject: [PATCH] rename Signed-off-by: bobz965 --- mocks/pkg/ovs/interface.go | 24 ++++++++++++------------ pkg/ovs/interface.go | 2 +- pkg/ovs/ovn-nb-bfd.go | 10 +++++----- pkg/ovs/ovn-nb-bfd_test.go | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/mocks/pkg/ovs/interface.go b/mocks/pkg/ovs/interface.go index 8584ec42ff37..79732fb618ca 100644 --- a/mocks/pkg/ovs/interface.go +++ b/mocks/pkg/ovs/interface.go @@ -521,19 +521,19 @@ func (mr *MockBFDMockRecorder) DeleteBFD(lrpName, dstIP interface{}) *gomock.Cal return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteBFD", reflect.TypeOf((*MockBFD)(nil).DeleteBFD), lrpName, dstIP) } -// ListBFD mocks base method. -func (m *MockBFD) ListBFD(lrpName, dstIP string) ([]ovnnb.BFD, error) { +// ListBFDs mocks base method. +func (m *MockBFD) ListBFDs(lrpName, dstIP string) ([]ovnnb.BFD, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListBFD", lrpName, dstIP) + ret := m.ctrl.Call(m, "ListBFDs", lrpName, dstIP) ret0, _ := ret[0].([]ovnnb.BFD) ret1, _ := ret[1].(error) return ret0, ret1 } -// ListBFD indicates an expected call of ListBFD. -func (mr *MockBFDMockRecorder) ListBFD(lrpName, dstIP interface{}) *gomock.Call { +// ListBFDs indicates an expected call of ListBFDs. +func (mr *MockBFDMockRecorder) ListBFDs(lrpName, dstIP interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBFD", reflect.TypeOf((*MockBFD)(nil).ListBFD), lrpName, dstIP) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBFDs", reflect.TypeOf((*MockBFD)(nil).ListBFDs), lrpName, dstIP) } // ListDownBFDs mocks base method. @@ -3331,19 +3331,19 @@ func (mr *MockNbClientMockRecorder) ListAddressSets(externalIDs interface{}) *go return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAddressSets", reflect.TypeOf((*MockNbClient)(nil).ListAddressSets), externalIDs) } -// ListBFD mocks base method. -func (m *MockNbClient) ListBFD(lrpName, dstIP string) ([]ovnnb.BFD, error) { +// ListBFDs mocks base method. +func (m *MockNbClient) ListBFDs(lrpName, dstIP string) ([]ovnnb.BFD, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListBFD", lrpName, dstIP) + ret := m.ctrl.Call(m, "ListBFDs", lrpName, dstIP) ret0, _ := ret[0].([]ovnnb.BFD) ret1, _ := ret[1].(error) return ret0, ret1 } -// ListBFD indicates an expected call of ListBFD. -func (mr *MockNbClientMockRecorder) ListBFD(lrpName, dstIP interface{}) *gomock.Call { +// ListBFDs indicates an expected call of ListBFDs. +func (mr *MockNbClientMockRecorder) ListBFDs(lrpName, dstIP interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBFD", reflect.TypeOf((*MockNbClient)(nil).ListBFD), lrpName, dstIP) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBFDs", reflect.TypeOf((*MockNbClient)(nil).ListBFDs), lrpName, dstIP) } // ListDHCPOptions mocks base method. diff --git a/pkg/ovs/interface.go b/pkg/ovs/interface.go index b1cad66bec11..f288ad4d253a 100644 --- a/pkg/ovs/interface.go +++ b/pkg/ovs/interface.go @@ -50,7 +50,7 @@ type GatewayChassis interface { type BFD interface { CreateBFD(lrpName, dstIP string, minRx, minTx, detectMult int) (*ovnnb.BFD, error) DeleteBFD(lrpName, dstIP string) error - ListBFD(lrpName, dstIP string) ([]ovnnb.BFD, error) + ListBFDs(lrpName, dstIP string) ([]ovnnb.BFD, error) ListDownBFDs(dstIP string) ([]ovnnb.BFD, error) ListUpBFDs(dstIP string) ([]ovnnb.BFD, error) UpdateBFD(bfd *ovnnb.BFD, fields ...interface{}) error diff --git a/pkg/ovs/ovn-nb-bfd.go b/pkg/ovs/ovn-nb-bfd.go index 6d1b4da3fcb3..f647d38ab98d 100644 --- a/pkg/ovs/ovn-nb-bfd.go +++ b/pkg/ovs/ovn-nb-bfd.go @@ -14,7 +14,7 @@ import ( "github.com/ovn-org/libovsdb/model" ) -func (c *OVNNbClient) ListBFD(lrpName, dstIP string) ([]ovnnb.BFD, error) { +func (c *OVNNbClient) ListBFDs(lrpName, dstIP string) ([]ovnnb.BFD, error) { ctx, cancel := context.WithTimeout(context.Background(), c.Timeout) defer cancel() @@ -69,7 +69,7 @@ func (c *OVNNbClient) ListUpBFDs(dstIP string) ([]ovnnb.BFD, error) { } func (c *OVNNbClient) CreateBFD(lrpName, dstIP string, minRx, minTx, detectMult int) (*ovnnb.BFD, error) { - bfdList, err := c.ListBFD(lrpName, dstIP) + bfdList, err := c.ListBFDs(lrpName, dstIP) if err != nil { klog.Error(err) return nil, err @@ -97,7 +97,7 @@ func (c *OVNNbClient) CreateBFD(lrpName, dstIP string, minRx, minTx, detectMult return nil, err } - if bfdList, err = c.ListBFD(lrpName, dstIP); err != nil { + if bfdList, err = c.ListBFDs(lrpName, dstIP); err != nil { return nil, err } if len(bfdList) == 0 { @@ -123,7 +123,7 @@ func (c *OVNNbClient) UpdateBFD(bfd *ovnnb.BFD, fields ...interface{}) error { } func (c *OVNNbClient) DeleteBFD(lrpName, dstIP string) error { - bfdList, err := c.ListBFD(lrpName, dstIP) + bfdList, err := c.ListBFDs(lrpName, dstIP) if err != nil { klog.Error(err) return err @@ -167,7 +167,7 @@ func (c *OVNNbClient) MonitorBFD() { } func (c *OVNNbClient) isLrpBfdUp(lrpName, dstIP string) (bool, error) { - bfdList, err := c.ListBFD(lrpName, dstIP) + bfdList, err := c.ListBFDs(lrpName, dstIP) if err != nil { klog.Errorf("failed to list bfd for lrp %s, %v", lrpName, err) return false, err diff --git a/pkg/ovs/ovn-nb-bfd_test.go b/pkg/ovs/ovn-nb-bfd_test.go index 65475cc20dff..ef2eb9437bd4 100644 --- a/pkg/ovs/ovn-nb-bfd_test.go +++ b/pkg/ovs/ovn-nb-bfd_test.go @@ -55,17 +55,17 @@ func (suite *OvnClientTestSuite) testListBFD() { require.NoError(t, err) require.NotNil(t, bfd2) - bfdList, err := ovnClient.ListBFD(lrpName, dstIP1) + bfdList, err := ovnClient.ListBFDs(lrpName, dstIP1) require.NoError(t, err) require.Len(t, bfdList, 1) require.Equal(t, bfd1.UUID, bfdList[0].UUID) - bfdList, err = ovnClient.ListBFD(lrpName, dstIP2) + bfdList, err = ovnClient.ListBFDs(lrpName, dstIP2) require.NoError(t, err) require.Len(t, bfdList, 1) require.Equal(t, bfd2.UUID, bfdList[0].UUID) - bfdList, err = ovnClient.ListBFD(lrpName, "") + bfdList, err = ovnClient.ListBFDs(lrpName, "") require.NoError(t, err) require.Len(t, bfdList, 2) uuids := strset.NewWithSize(len(bfdList)) @@ -97,11 +97,11 @@ func (suite *OvnClientTestSuite) testDeleteBFD() { err = ovnClient.DeleteBFD(lrpName, dstIP1) require.NoError(t, err) - bfdList, err := ovnClient.ListBFD(lrpName, dstIP1) + bfdList, err := ovnClient.ListBFDs(lrpName, dstIP1) require.NoError(t, err) require.Len(t, bfdList, 0) - bfdList, err = ovnClient.ListBFD(lrpName, dstIP2) + bfdList, err = ovnClient.ListBFDs(lrpName, dstIP2) require.NoError(t, err) require.Len(t, bfdList, 1) require.Equal(t, bfd2.UUID, bfdList[0].UUID) @@ -111,7 +111,7 @@ func (suite *OvnClientTestSuite) testDeleteBFD() { err = ovnClient.DeleteBFD(lrpName, "") require.NoError(t, err) - bfdList, err := ovnClient.ListBFD(lrpName, "") + bfdList, err := ovnClient.ListBFDs(lrpName, "") require.NoError(t, err) require.Len(t, bfdList, 0) })