blob: 522fb4fc5699b80dc4ce703e4ffa6587088e42ea [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"
25 ic "github.com/opencord/voltha-protos/v5/go/inter_container"
26 "github.com/opencord/voltha-protos/v5/go/voltha"
27 "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
42func (mos MockOnuInterAdapterService) GetHealthStatus(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*voltha.HealthStatus, error) {
43 return &voltha.HealthStatus{State: voltha.HealthStatus_HEALTHY}, nil
44}
45
46// OnuIndication implements mock OnuIndication
47func (mos *MockOnuInterAdapterService) OnuIndication(ctx context.Context, in *ic.OnuIndicationMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
48 return &empty.Empty{}, nil
49}
50
51// OmciResponse implements mock OmciResponse
52func (mos *MockOnuInterAdapterService) OmciResponse(ctx context.Context, in *ic.OmciMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
53 return &empty.Empty{}, nil
54}
55
56// DownloadTechProfile implements mock DownloadTechProfile
57func (mos *MockOnuInterAdapterService) DownloadTechProfile(ctx context.Context, in *ic.TechProfileDownloadMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
58 return &empty.Empty{}, nil
59}
60
61// DeleteGemPort implements mock DeleteGemPort
62func (mos *MockOnuInterAdapterService) DeleteGemPort(ctx context.Context, in *ic.DeleteGemPortMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
63 return &empty.Empty{}, nil
64}
65
66// DeleteTCont implements mock DeleteTCont
67func (mos *MockOnuInterAdapterService) DeleteTCont(ctx context.Context, in *ic.DeleteTcontMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
68 return &empty.Empty{}, nil
69}