blob: c9cd57544aa4c144207b5954776187addca26b0c [file] [log] [blame]
khenaidoo106c61a2021-08-11 18:05:46 -04001/*
2 * Copyright 2021-present Open Networking Foundation
3
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 (
21 "context"
22
23 "github.com/golang/protobuf/ptypes/empty"
24 vgrpc "github.com/opencord/voltha-lib-go/v7/pkg/grpc"
khenaidoodc2116e2021-10-19 17:33:19 -040025 "github.com/opencord/voltha-protos/v5/go/health"
26 ia "github.com/opencord/voltha-protos/v5/go/inter_adapter"
khenaidoo106c61a2021-08-11 18:05:46 -040027 "google.golang.org/grpc"
28)
29
30// NewMockChildAdapterClient create a mock child adapter client
31func NewMockChildAdapterClient(srv *MockOnuInterAdapterService) *vgrpc.Client {
32 cc, _ := vgrpc.NewClient("mock-endpoint", nil)
33 cc.SetService(srv)
34 return cc
35}
36
37// MockOnuInterAdapterService represents a child adapter mock service
38type MockOnuInterAdapterService struct {
39}
40
41// GetHealthStatus implements mock GetHealthStatus
khenaidoodc2116e2021-10-19 17:33:19 -040042func (mos MockOnuInterAdapterService) GetHealthStatus(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*health.HealthStatus, error) {
43 return &health.HealthStatus{State: health.HealthStatus_HEALTHY}, nil
khenaidoo106c61a2021-08-11 18:05:46 -040044}
45
46// OnuIndication implements mock OnuIndication
khenaidoodc2116e2021-10-19 17:33:19 -040047func (mos *MockOnuInterAdapterService) OnuIndication(ctx context.Context, in *ia.OnuIndicationMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
khenaidoo106c61a2021-08-11 18:05:46 -040048 return &empty.Empty{}, nil
49}
50
51// OmciResponse implements mock OmciResponse
khenaidoodc2116e2021-10-19 17:33:19 -040052func (mos *MockOnuInterAdapterService) OmciResponse(ctx context.Context, in *ia.OmciMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
khenaidoo106c61a2021-08-11 18:05:46 -040053 return &empty.Empty{}, nil
54}
55
56// DownloadTechProfile implements mock DownloadTechProfile
khenaidoodc2116e2021-10-19 17:33:19 -040057func (mos *MockOnuInterAdapterService) DownloadTechProfile(ctx context.Context, in *ia.TechProfileDownloadMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
khenaidoo106c61a2021-08-11 18:05:46 -040058 return &empty.Empty{}, nil
59}
60
61// DeleteGemPort implements mock DeleteGemPort
khenaidoodc2116e2021-10-19 17:33:19 -040062func (mos *MockOnuInterAdapterService) DeleteGemPort(ctx context.Context, in *ia.DeleteGemPortMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
khenaidoo106c61a2021-08-11 18:05:46 -040063 return &empty.Empty{}, nil
64}
65
66// DeleteTCont implements mock DeleteTCont
khenaidoodc2116e2021-10-19 17:33:19 -040067func (mos *MockOnuInterAdapterService) DeleteTCont(ctx context.Context, in *ia.DeleteTcontMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
khenaidoo106c61a2021-08-11 18:05:46 -040068 return &empty.Empty{}, nil
69}