blob: 0b9bb13aa86a3d97e5e7c65fd8120da529d386f3 [file] [log] [blame]
kdarapu891693b2019-09-16 12:33:49 +05301/*
Joey Armstronga6af1522023-01-17 16:06:16 -05002 * Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
kdarapu891693b2019-09-16 12:33:49 +05303
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//Package mocks provides the mocks for openolt-adapter.
18package mocks
19
20import (
Neha Sharma96b7bf22020-06-15 10:37:32 +000021 "context"
kdarapu891693b2019-09-16 12:33:49 +053022 "errors"
khenaidoo106c61a2021-08-11 18:05:46 -040023
kesavand0ef592c2022-03-16 12:34:24 +053024 "github.com/opencord/voltha-lib-go/v7/pkg/events/eventif"
khenaidoo106c61a2021-08-11 18:05:46 -040025 "github.com/opencord/voltha-protos/v5/go/voltha"
kdarapu891693b2019-09-16 12:33:49 +053026)
27
28// MockEventProxy for mocking EventProxyIntf
29type MockEventProxy struct {
30}
31
32// SendDeviceEvent mocks the SendDeviceEvent function
Neha Sharma96b7bf22020-06-15 10:37:32 +000033func (me *MockEventProxy) SendDeviceEvent(ctx context.Context, deviceEvent *voltha.DeviceEvent, category voltha.EventCategory_Types,
Esin Karamanccb714b2019-11-29 15:02:06 +000034 subCategory voltha.EventSubCategory_Types, raisedTs int64) error {
kdarapu891693b2019-09-16 12:33:49 +053035 if raisedTs == 0 {
36 return errors.New("raisedTS cannot be zero")
37 }
38 return nil
39}
Naga Manjunath7615e552019-10-11 22:35:47 +053040
41// SendKpiEvent mocks the SendKpiEvent function
Neha Sharma96b7bf22020-06-15 10:37:32 +000042func (me *MockEventProxy) SendKpiEvent(ctx context.Context, id string, deviceEvent *voltha.KpiEvent2, category voltha.EventCategory_Types,
Esin Karamanccb714b2019-11-29 15:02:06 +000043 subCategory voltha.EventSubCategory_Types, raisedTs int64) error {
Naga Manjunath7615e552019-10-11 22:35:47 +053044 if raisedTs == 0 {
45 return errors.New("raisedTS cannot be zero")
46 }
47 return nil
48}
Himani Chawlacd407802020-12-10 12:08:59 +053049
50// SendRPCEvent mocks the SendRPCEvent function
51func (me *MockEventProxy) SendRPCEvent(ctx context.Context, id string, deviceEvent *voltha.RPCEvent, category voltha.EventCategory_Types,
52 subCategory *voltha.EventSubCategory_Types, raisedTs int64) error {
53 if raisedTs == 0 {
54 return errors.New("raisedTS cannot be zero")
55 }
56 return nil
57}
Gamze Abaka7650be62021-02-26 10:50:36 +000058
59// EnableLivenessChannel mocks the EnableLivenessChannel function
60func (me *MockEventProxy) EnableLivenessChannel(ctx context.Context, enable bool) chan bool {
61 return nil
62}
63
64// SendLiveness mocks the SendLiveness function
65func (me *MockEventProxy) SendLiveness(ctx context.Context) error {
66 return nil
67}
khenaidoo106c61a2021-08-11 18:05:46 -040068
69// Start starts the proxy
70func (me *MockEventProxy) Start() error {
71 return nil
72}
73
74// Stop stops the proxy
75func (me *MockEventProxy) Stop() {
76}
kesavand0ef592c2022-03-16 12:34:24 +053077
78//SendDeviceEventWithKey mocks SendDeviceEventWithKey
79func (me *MockEventProxy) SendDeviceEventWithKey(ctx context.Context, deviceEvent *voltha.DeviceEvent, category eventif.EventCategory,
80 subCategory eventif.EventSubCategory, raisedTs int64, key string) error {
81 return nil
82}