blob: 1ad57f172241407892ee417a47ae16e828a1364d [file] [log] [blame]
kdarapub26b4502019-10-05 03:02:33 +05301/*
2 * Copyright 2018-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 (
npujarec5762e2020-01-01 14:08:48 +053021 "context"
Esin Karamanccb714b2019-11-29 15:02:06 +000022 "github.com/opencord/voltha-lib-go/v3/pkg/db"
23 "github.com/opencord/voltha-lib-go/v3/pkg/log"
24 tp "github.com/opencord/voltha-lib-go/v3/pkg/techprofile"
25 tp_pb "github.com/opencord/voltha-protos/v3/go/tech_profile"
kdarapub26b4502019-10-05 03:02:33 +053026)
27
28// MockTechProfile mock struct for OpenoltClient.
29type MockTechProfile struct {
30 TpID uint32
31}
32
Girish Gowdra54934262019-11-13 14:19:55 +053033// SetKVClient to mock techprofile SetKVClient method
sbarbaria8910ba2019-11-05 10:12:23 -050034func (m MockTechProfile) SetKVClient() *db.Backend {
35 return &db.Backend{Client: &MockKVClient{}}
kdarapub26b4502019-10-05 03:02:33 +053036}
37
Girish Gowdra54934262019-11-13 14:19:55 +053038// GetTechProfileInstanceKVPath to mock techprofile GetTechProfileInstanceKVPath method
kdarapub26b4502019-10-05 03:02:33 +053039func (m MockTechProfile) GetTechProfileInstanceKVPath(techProfiletblID uint32, uniPortName string) string {
40 return ""
41
42}
43
Girish Gowdra54934262019-11-13 14:19:55 +053044// GetTPInstanceFromKVStore to mock techprofile GetTPInstanceFromKVStore method
npujarec5762e2020-01-01 14:08:48 +053045func (m MockTechProfile) GetTPInstanceFromKVStore(ctx context.Context, techProfiletblID uint32, path string) (*tp.TechProfile, error) {
kdarapub26b4502019-10-05 03:02:33 +053046 log.Debug("Warning Warning Warning: GetTPInstanceFromKVStore")
47 return nil, nil
48
49}
50
Girish Gowdra54934262019-11-13 14:19:55 +053051// CreateTechProfInstance to mock techprofile CreateTechProfInstance method
npujarec5762e2020-01-01 14:08:48 +053052func (m MockTechProfile) CreateTechProfInstance(ctx context.Context, techProfiletblID uint32, uniPortName string, intfID uint32) (*tp.TechProfile, error) {
kdarapub26b4502019-10-05 03:02:33 +053053
54 return &tp.TechProfile{
55 Name: "mock-tech-profile",
56 SubscriberIdentifier: "257",
57 ProfileType: "mock",
58 Version: 0,
59 NumGemPorts: 2,
kdarapub26b4502019-10-05 03:02:33 +053060 UpstreamGemPortAttributeList: nil,
61 DownstreamGemPortAttributeList: nil,
Girish Kumar8f73fe02019-12-09 13:19:37 +000062 }, nil
kdarapub26b4502019-10-05 03:02:33 +053063
64}
65
Girish Gowdra54934262019-11-13 14:19:55 +053066// DeleteTechProfileInstance to mock techprofile DeleteTechProfileInstance method
npujarec5762e2020-01-01 14:08:48 +053067func (m MockTechProfile) DeleteTechProfileInstance(ctx context.Context, techProfiletblID uint32, uniPortName string) error {
kdarapub26b4502019-10-05 03:02:33 +053068 return nil
69}
70
Girish Gowdra54934262019-11-13 14:19:55 +053071// GetprotoBufParamValue to mock techprofile GetprotoBufParamValue method
kdarapub26b4502019-10-05 03:02:33 +053072func (m MockTechProfile) GetprotoBufParamValue(paramType string, paramKey string) int32 {
73 return 0
74
75}
76
Girish Gowdra54934262019-11-13 14:19:55 +053077// GetUsScheduler to mock techprofile GetUsScheduler method
Girish Kumar8f73fe02019-12-09 13:19:37 +000078func (m MockTechProfile) GetUsScheduler(tpInstance *tp.TechProfile) (*tp_pb.SchedulerConfig, error) {
79 return &tp_pb.SchedulerConfig{}, nil
kdarapub26b4502019-10-05 03:02:33 +053080
81}
82
Girish Gowdra54934262019-11-13 14:19:55 +053083// GetDsScheduler to mock techprofile GetDsScheduler method
Girish Kumar8f73fe02019-12-09 13:19:37 +000084func (m MockTechProfile) GetDsScheduler(tpInstance *tp.TechProfile) (*tp_pb.SchedulerConfig, error) {
85 return &tp_pb.SchedulerConfig{}, nil
kdarapub26b4502019-10-05 03:02:33 +053086}
87
Girish Gowdra54934262019-11-13 14:19:55 +053088// GetTrafficScheduler to mock techprofile GetTrafficScheduler method
kdarapub26b4502019-10-05 03:02:33 +053089func (m MockTechProfile) GetTrafficScheduler(tpInstance *tp.TechProfile, SchedCfg *tp_pb.SchedulerConfig,
90 ShapingCfg *tp_pb.TrafficShapingInfo) *tp_pb.TrafficScheduler {
91 return &tp_pb.TrafficScheduler{}
92
93}
94
Girish Gowdra54934262019-11-13 14:19:55 +053095// GetTrafficQueues to mock techprofile GetTrafficQueues method
Girish Kumar8f73fe02019-12-09 13:19:37 +000096func (m MockTechProfile) GetTrafficQueues(tp *tp.TechProfile, Dir tp_pb.Direction) ([]*tp_pb.TrafficQueue, error) {
97 return []*tp_pb.TrafficQueue{{}}, nil
kdarapub26b4502019-10-05 03:02:33 +053098}
99
Scott Bakeree7c0a02020-01-07 11:12:26 -0800100// GetMulticastTrafficQueues to mock techprofile GetMulticastTrafficQueues method
101func (m MockTechProfile) GetMulticastTrafficQueues(tp *tp.TechProfile) []*tp_pb.TrafficQueue {
102 return []*tp_pb.TrafficQueue{{}}
103}
104
Girish Gowdra54934262019-11-13 14:19:55 +0530105// GetGemportIDForPbit to mock techprofile GetGemportIDForPbit method
kdarapub26b4502019-10-05 03:02:33 +0530106func (m MockTechProfile) GetGemportIDForPbit(tp *tp.TechProfile, Dir tp_pb.Direction, pbit uint32) uint32 {
107 return 0
108}
Girish Gowdra54934262019-11-13 14:19:55 +0530109
110// FindAllTpInstances to mock techprofile FindAllTpInstances method
npujarec5762e2020-01-01 14:08:48 +0530111func (m MockTechProfile) FindAllTpInstances(ctx context.Context, techProfiletblID uint32, ponIntf uint32, onuID uint32) []tp.TechProfile {
Girish Gowdra54934262019-11-13 14:19:55 +0530112 return []tp.TechProfile{}
113}