diff --git a/mocks/EvpnClient.go b/mocks/EvpnClient.go new file mode 100644 index 0000000..8284ba6 --- /dev/null +++ b/mocks/EvpnClient.go @@ -0,0 +1,552 @@ +// Code generated by mockery v2.32.4. DO NOT EDIT. + +package mocks + +import ( + context "context" + + _go "github.com/opiproject/opi-api/network/evpn-gw/v1alpha1/gen/go" + + emptypb "google.golang.org/protobuf/types/known/emptypb" + + mock "github.com/stretchr/testify/mock" +) + +// EvpnClient is an autogenerated mock type for the EvpnClient type +type EvpnClient struct { + mock.Mock +} + +// CreateBridgePort provides a mock function with given fields: ctx, name, mac, bridgePortType, logicalBridges +func (_m *EvpnClient) CreateBridgePort(ctx context.Context, name string, mac string, bridgePortType string, logicalBridges []string) (*_go.BridgePort, error) { + ret := _m.Called(ctx, name, mac, bridgePortType, logicalBridges) + + var r0 *_go.BridgePort + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, []string) (*_go.BridgePort, error)); ok { + return rf(ctx, name, mac, bridgePortType, logicalBridges) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, []string) *_go.BridgePort); ok { + r0 = rf(ctx, name, mac, bridgePortType, logicalBridges) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.BridgePort) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string, string, []string) error); ok { + r1 = rf(ctx, name, mac, bridgePortType, logicalBridges) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CreateLogicalBridge provides a mock function with given fields: ctx, name, vlanID, vni +func (_m *EvpnClient) CreateLogicalBridge(ctx context.Context, name string, vlanID uint32, vni uint32) (*_go.LogicalBridge, error) { + ret := _m.Called(ctx, name, vlanID, vni) + + var r0 *_go.LogicalBridge + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, uint32, uint32) (*_go.LogicalBridge, error)); ok { + return rf(ctx, name, vlanID, vni) + } + if rf, ok := ret.Get(0).(func(context.Context, string, uint32, uint32) *_go.LogicalBridge); ok { + r0 = rf(ctx, name, vlanID, vni) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.LogicalBridge) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, uint32, uint32) error); ok { + r1 = rf(ctx, name, vlanID, vni) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CreateSvi provides a mock function with given fields: ctx, name, vrf, logicalBridge, mac, gwIPs, ebgp, remoteAS +func (_m *EvpnClient) CreateSvi(ctx context.Context, name string, vrf string, logicalBridge string, mac string, gwIPs []string, ebgp bool, remoteAS uint32) (*_go.Svi, error) { + ret := _m.Called(ctx, name, vrf, logicalBridge, mac, gwIPs, ebgp, remoteAS) + + var r0 *_go.Svi + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, []string, bool, uint32) (*_go.Svi, error)); ok { + return rf(ctx, name, vrf, logicalBridge, mac, gwIPs, ebgp, remoteAS) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, []string, bool, uint32) *_go.Svi); ok { + r0 = rf(ctx, name, vrf, logicalBridge, mac, gwIPs, ebgp, remoteAS) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.Svi) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, []string, bool, uint32) error); ok { + r1 = rf(ctx, name, vrf, logicalBridge, mac, gwIPs, ebgp, remoteAS) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CreateVrf provides a mock function with given fields: ctx, name, vni, loopback, vtep +func (_m *EvpnClient) CreateVrf(ctx context.Context, name string, vni uint32, loopback string, vtep string) (*_go.Vrf, error) { + ret := _m.Called(ctx, name, vni, loopback, vtep) + + var r0 *_go.Vrf + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, uint32, string, string) (*_go.Vrf, error)); ok { + return rf(ctx, name, vni, loopback, vtep) + } + if rf, ok := ret.Get(0).(func(context.Context, string, uint32, string, string) *_go.Vrf); ok { + r0 = rf(ctx, name, vni, loopback, vtep) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.Vrf) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, uint32, string, string) error); ok { + r1 = rf(ctx, name, vni, loopback, vtep) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DeleteBridgePort provides a mock function with given fields: ctx, name, allowMissing +func (_m *EvpnClient) DeleteBridgePort(ctx context.Context, name string, allowMissing bool) (*emptypb.Empty, error) { + ret := _m.Called(ctx, name, allowMissing) + + var r0 *emptypb.Empty + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, bool) (*emptypb.Empty, error)); ok { + return rf(ctx, name, allowMissing) + } + if rf, ok := ret.Get(0).(func(context.Context, string, bool) *emptypb.Empty); ok { + r0 = rf(ctx, name, allowMissing) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*emptypb.Empty) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, bool) error); ok { + r1 = rf(ctx, name, allowMissing) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DeleteLogicalBridge provides a mock function with given fields: ctx, name, allowMissing +func (_m *EvpnClient) DeleteLogicalBridge(ctx context.Context, name string, allowMissing bool) (*emptypb.Empty, error) { + ret := _m.Called(ctx, name, allowMissing) + + var r0 *emptypb.Empty + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, bool) (*emptypb.Empty, error)); ok { + return rf(ctx, name, allowMissing) + } + if rf, ok := ret.Get(0).(func(context.Context, string, bool) *emptypb.Empty); ok { + r0 = rf(ctx, name, allowMissing) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*emptypb.Empty) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, bool) error); ok { + r1 = rf(ctx, name, allowMissing) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DeleteSvi provides a mock function with given fields: ctx, name, allowMissing +func (_m *EvpnClient) DeleteSvi(ctx context.Context, name string, allowMissing bool) (*emptypb.Empty, error) { + ret := _m.Called(ctx, name, allowMissing) + + var r0 *emptypb.Empty + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, bool) (*emptypb.Empty, error)); ok { + return rf(ctx, name, allowMissing) + } + if rf, ok := ret.Get(0).(func(context.Context, string, bool) *emptypb.Empty); ok { + r0 = rf(ctx, name, allowMissing) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*emptypb.Empty) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, bool) error); ok { + r1 = rf(ctx, name, allowMissing) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DeleteVrf provides a mock function with given fields: ctx, name, allowMissing +func (_m *EvpnClient) DeleteVrf(ctx context.Context, name string, allowMissing bool) (*emptypb.Empty, error) { + ret := _m.Called(ctx, name, allowMissing) + + var r0 *emptypb.Empty + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, bool) (*emptypb.Empty, error)); ok { + return rf(ctx, name, allowMissing) + } + if rf, ok := ret.Get(0).(func(context.Context, string, bool) *emptypb.Empty); ok { + r0 = rf(ctx, name, allowMissing) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*emptypb.Empty) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, bool) error); ok { + r1 = rf(ctx, name, allowMissing) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetBridgePort provides a mock function with given fields: ctx, name +func (_m *EvpnClient) GetBridgePort(ctx context.Context, name string) (*_go.BridgePort, error) { + ret := _m.Called(ctx, name) + + var r0 *_go.BridgePort + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*_go.BridgePort, error)); ok { + return rf(ctx, name) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *_go.BridgePort); ok { + r0 = rf(ctx, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.BridgePort) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetLogicalBridge provides a mock function with given fields: ctx, name +func (_m *EvpnClient) GetLogicalBridge(ctx context.Context, name string) (*_go.LogicalBridge, error) { + ret := _m.Called(ctx, name) + + var r0 *_go.LogicalBridge + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*_go.LogicalBridge, error)); ok { + return rf(ctx, name) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *_go.LogicalBridge); ok { + r0 = rf(ctx, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.LogicalBridge) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetSvi provides a mock function with given fields: ctx, name +func (_m *EvpnClient) GetSvi(ctx context.Context, name string) (*_go.Svi, error) { + ret := _m.Called(ctx, name) + + var r0 *_go.Svi + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*_go.Svi, error)); ok { + return rf(ctx, name) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *_go.Svi); ok { + r0 = rf(ctx, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.Svi) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetVrf provides a mock function with given fields: ctx, name +func (_m *EvpnClient) GetVrf(ctx context.Context, name string) (*_go.Vrf, error) { + ret := _m.Called(ctx, name) + + var r0 *_go.Vrf + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*_go.Vrf, error)); ok { + return rf(ctx, name) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *_go.Vrf); ok { + r0 = rf(ctx, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.Vrf) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListBridgePorts provides a mock function with given fields: ctx, pageSize, pageToken +func (_m *EvpnClient) ListBridgePorts(ctx context.Context, pageSize int32, pageToken string) (*_go.ListBridgePortsResponse, error) { + ret := _m.Called(ctx, pageSize, pageToken) + + var r0 *_go.ListBridgePortsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, int32, string) (*_go.ListBridgePortsResponse, error)); ok { + return rf(ctx, pageSize, pageToken) + } + if rf, ok := ret.Get(0).(func(context.Context, int32, string) *_go.ListBridgePortsResponse); ok { + r0 = rf(ctx, pageSize, pageToken) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.ListBridgePortsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, int32, string) error); ok { + r1 = rf(ctx, pageSize, pageToken) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListLogicalBridges provides a mock function with given fields: ctx, pageSize, pageToken +func (_m *EvpnClient) ListLogicalBridges(ctx context.Context, pageSize int32, pageToken string) (*_go.ListLogicalBridgesResponse, error) { + ret := _m.Called(ctx, pageSize, pageToken) + + var r0 *_go.ListLogicalBridgesResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, int32, string) (*_go.ListLogicalBridgesResponse, error)); ok { + return rf(ctx, pageSize, pageToken) + } + if rf, ok := ret.Get(0).(func(context.Context, int32, string) *_go.ListLogicalBridgesResponse); ok { + r0 = rf(ctx, pageSize, pageToken) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.ListLogicalBridgesResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, int32, string) error); ok { + r1 = rf(ctx, pageSize, pageToken) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListSvis provides a mock function with given fields: ctx, pageSize, pageToken +func (_m *EvpnClient) ListSvis(ctx context.Context, pageSize int32, pageToken string) (*_go.ListSvisResponse, error) { + ret := _m.Called(ctx, pageSize, pageToken) + + var r0 *_go.ListSvisResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, int32, string) (*_go.ListSvisResponse, error)); ok { + return rf(ctx, pageSize, pageToken) + } + if rf, ok := ret.Get(0).(func(context.Context, int32, string) *_go.ListSvisResponse); ok { + r0 = rf(ctx, pageSize, pageToken) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.ListSvisResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, int32, string) error); ok { + r1 = rf(ctx, pageSize, pageToken) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListVrfs provides a mock function with given fields: ctx, pageSize, pageToken +func (_m *EvpnClient) ListVrfs(ctx context.Context, pageSize int32, pageToken string) (*_go.ListVrfsResponse, error) { + ret := _m.Called(ctx, pageSize, pageToken) + + var r0 *_go.ListVrfsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, int32, string) (*_go.ListVrfsResponse, error)); ok { + return rf(ctx, pageSize, pageToken) + } + if rf, ok := ret.Get(0).(func(context.Context, int32, string) *_go.ListVrfsResponse); ok { + r0 = rf(ctx, pageSize, pageToken) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.ListVrfsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, int32, string) error); ok { + r1 = rf(ctx, pageSize, pageToken) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UpdateBridgePort provides a mock function with given fields: ctx, name, updateMask, allowMissing +func (_m *EvpnClient) UpdateBridgePort(ctx context.Context, name string, updateMask []string, allowMissing bool) (*_go.BridgePort, error) { + ret := _m.Called(ctx, name, updateMask, allowMissing) + + var r0 *_go.BridgePort + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, []string, bool) (*_go.BridgePort, error)); ok { + return rf(ctx, name, updateMask, allowMissing) + } + if rf, ok := ret.Get(0).(func(context.Context, string, []string, bool) *_go.BridgePort); ok { + r0 = rf(ctx, name, updateMask, allowMissing) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.BridgePort) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, []string, bool) error); ok { + r1 = rf(ctx, name, updateMask, allowMissing) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UpdateLogicalBridge provides a mock function with given fields: ctx, name, updateMask +func (_m *EvpnClient) UpdateLogicalBridge(ctx context.Context, name string, updateMask []string) (*_go.LogicalBridge, error) { + ret := _m.Called(ctx, name, updateMask) + + var r0 *_go.LogicalBridge + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, []string) (*_go.LogicalBridge, error)); ok { + return rf(ctx, name, updateMask) + } + if rf, ok := ret.Get(0).(func(context.Context, string, []string) *_go.LogicalBridge); ok { + r0 = rf(ctx, name, updateMask) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.LogicalBridge) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, []string) error); ok { + r1 = rf(ctx, name, updateMask) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UpdateSvi provides a mock function with given fields: ctx, name, updateMask, allowMissing +func (_m *EvpnClient) UpdateSvi(ctx context.Context, name string, updateMask []string, allowMissing bool) (*_go.Svi, error) { + ret := _m.Called(ctx, name, updateMask, allowMissing) + + var r0 *_go.Svi + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, []string, bool) (*_go.Svi, error)); ok { + return rf(ctx, name, updateMask, allowMissing) + } + if rf, ok := ret.Get(0).(func(context.Context, string, []string, bool) *_go.Svi); ok { + r0 = rf(ctx, name, updateMask, allowMissing) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.Svi) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, []string, bool) error); ok { + r1 = rf(ctx, name, updateMask, allowMissing) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UpdateVrf provides a mock function with given fields: ctx, name, updateMask, allowMissing +func (_m *EvpnClient) UpdateVrf(ctx context.Context, name string, updateMask []string, allowMissing bool) (*_go.Vrf, error) { + ret := _m.Called(ctx, name, updateMask, allowMissing) + + var r0 *_go.Vrf + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, []string, bool) (*_go.Vrf, error)); ok { + return rf(ctx, name, updateMask, allowMissing) + } + if rf, ok := ret.Get(0).(func(context.Context, string, []string, bool) *_go.Vrf); ok { + r0 = rf(ctx, name, updateMask, allowMissing) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*_go.Vrf) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, []string, bool) error); ok { + r1 = rf(ctx, name, updateMask, allowMissing) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// NewEvpnClient creates a new instance of EvpnClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewEvpnClient(t interface { + mock.TestingT + Cleanup(func()) +}) *EvpnClient { + mock := &EvpnClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}