blob: 2a751d783ebab5f52ea0faf99f40f83b34ce313f [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"
khenaidoo27e7ac92021-12-08 14:43:09 -050025 "github.com/opencord/voltha-protos/v5/go/common"
khenaidoodc2116e2021-10-19 17:33:19 -040026 "github.com/opencord/voltha-protos/v5/go/health"
27 ia "github.com/opencord/voltha-protos/v5/go/inter_adapter"
khenaidoo106c61a2021-08-11 18:05:46 -040028 "google.golang.org/grpc"
29)
30
31// NewMockChildAdapterClient create a mock child adapter client
32func NewMockChildAdapterClient(srv *MockOnuInterAdapterService) *vgrpc.Client {
khenaidoo27e7ac92021-12-08 14:43:09 -050033 cc, _ := vgrpc.NewClient("mock-local-endpoint", "mock-remote-endpoint", nil)
khenaidoo106c61a2021-08-11 18:05:46 -040034 cc.SetService(srv)
35 return cc
36}
37
38// MockOnuInterAdapterService represents a child adapter mock service
39type MockOnuInterAdapterService struct {
40}
41
42// GetHealthStatus implements mock GetHealthStatus
khenaidoo27e7ac92021-12-08 14:43:09 -050043func (mos MockOnuInterAdapterService) GetHealthStatus(ctx context.Context, in *common.Connection, opts ...grpc.CallOption) (*health.HealthStatus, error) {
khenaidoodc2116e2021-10-19 17:33:19 -040044 return &health.HealthStatus{State: health.HealthStatus_HEALTHY}, nil
khenaidoo106c61a2021-08-11 18:05:46 -040045}
46
47// OnuIndication implements mock OnuIndication
khenaidoodc2116e2021-10-19 17:33:19 -040048func (mos *MockOnuInterAdapterService) OnuIndication(ctx context.Context, in *ia.OnuIndicationMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
khenaidoo106c61a2021-08-11 18:05:46 -040049 return &empty.Empty{}, nil
50}
51
52// OmciResponse implements mock OmciResponse
khenaidoodc2116e2021-10-19 17:33:19 -040053func (mos *MockOnuInterAdapterService) OmciResponse(ctx context.Context, in *ia.OmciMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
khenaidoo106c61a2021-08-11 18:05:46 -040054 return &empty.Empty{}, nil
55}
56
57// DownloadTechProfile implements mock DownloadTechProfile
khenaidoodc2116e2021-10-19 17:33:19 -040058func (mos *MockOnuInterAdapterService) DownloadTechProfile(ctx context.Context, in *ia.TechProfileDownloadMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
khenaidoo106c61a2021-08-11 18:05:46 -040059 return &empty.Empty{}, nil
60}
61
62// DeleteGemPort implements mock DeleteGemPort
khenaidoodc2116e2021-10-19 17:33:19 -040063func (mos *MockOnuInterAdapterService) DeleteGemPort(ctx context.Context, in *ia.DeleteGemPortMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
khenaidoo106c61a2021-08-11 18:05:46 -040064 return &empty.Empty{}, nil
65}
66
67// DeleteTCont implements mock DeleteTCont
khenaidoodc2116e2021-10-19 17:33:19 -040068func (mos *MockOnuInterAdapterService) DeleteTCont(ctx context.Context, in *ia.DeleteTcontMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
khenaidoo106c61a2021-08-11 18:05:46 -040069 return &empty.Empty{}, nil
70}