blob: 2708592cc09638337530f4f68fc7806828275e60 [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 (
sbarbaria8910ba2019-11-05 10:12:23 -050021 "github.com/opencord/voltha-lib-go/v2/pkg/db"
Scott Baker51290152019-10-24 14:23:20 -070022 "github.com/opencord/voltha-lib-go/v2/pkg/log"
23 tp "github.com/opencord/voltha-lib-go/v2/pkg/techprofile"
Scott Bakerc6e54cb2019-11-04 09:31:25 -080024 tp_pb "github.com/opencord/voltha-protos/v2/go/tech_profile"
kdarapub26b4502019-10-05 03:02:33 +053025)
26
27// MockTechProfile mock struct for OpenoltClient.
28type MockTechProfile struct {
29 TpID uint32
30}
31
Girish Gowdra54934262019-11-13 14:19:55 +053032// SetKVClient to mock techprofile SetKVClient method
sbarbaria8910ba2019-11-05 10:12:23 -050033func (m MockTechProfile) SetKVClient() *db.Backend {
34 return &db.Backend{Client: &MockKVClient{}}
kdarapub26b4502019-10-05 03:02:33 +053035}
36
Girish Gowdra54934262019-11-13 14:19:55 +053037// GetTechProfileInstanceKVPath to mock techprofile GetTechProfileInstanceKVPath method
kdarapub26b4502019-10-05 03:02:33 +053038func (m MockTechProfile) GetTechProfileInstanceKVPath(techProfiletblID uint32, uniPortName string) string {
39 return ""
40
41}
42
Girish Gowdra54934262019-11-13 14:19:55 +053043// GetTPInstanceFromKVStore to mock techprofile GetTPInstanceFromKVStore method
kdarapub26b4502019-10-05 03:02:33 +053044func (m MockTechProfile) GetTPInstanceFromKVStore(techProfiletblID uint32, path string) (*tp.TechProfile, error) {
45 log.Debug("Warning Warning Warning: GetTPInstanceFromKVStore")
46 return nil, nil
47
48}
49
Girish Gowdra54934262019-11-13 14:19:55 +053050// CreateTechProfInstance to mock techprofile CreateTechProfInstance method
Girish Kumar8f73fe02019-12-09 13:19:37 +000051func (m MockTechProfile) CreateTechProfInstance(techProfiletblID uint32, uniPortName string, intfID uint32) (*tp.TechProfile, error) {
kdarapub26b4502019-10-05 03:02:33 +053052
53 return &tp.TechProfile{
54 Name: "mock-tech-profile",
55 SubscriberIdentifier: "257",
56 ProfileType: "mock",
57 Version: 0,
58 NumGemPorts: 2,
kdarapub26b4502019-10-05 03:02:33 +053059 UpstreamGemPortAttributeList: nil,
60 DownstreamGemPortAttributeList: nil,
Girish Kumar8f73fe02019-12-09 13:19:37 +000061 }, nil
kdarapub26b4502019-10-05 03:02:33 +053062
63}
64
Girish Gowdra54934262019-11-13 14:19:55 +053065// DeleteTechProfileInstance to mock techprofile DeleteTechProfileInstance method
kdarapub26b4502019-10-05 03:02:33 +053066func (m MockTechProfile) DeleteTechProfileInstance(techProfiletblID uint32, uniPortName string) error {
67 return nil
68}
69
Girish Gowdra54934262019-11-13 14:19:55 +053070// GetprotoBufParamValue to mock techprofile GetprotoBufParamValue method
kdarapub26b4502019-10-05 03:02:33 +053071func (m MockTechProfile) GetprotoBufParamValue(paramType string, paramKey string) int32 {
72 return 0
73
74}
75
Girish Gowdra54934262019-11-13 14:19:55 +053076// GetUsScheduler to mock techprofile GetUsScheduler method
Girish Kumar8f73fe02019-12-09 13:19:37 +000077func (m MockTechProfile) GetUsScheduler(tpInstance *tp.TechProfile) (*tp_pb.SchedulerConfig, error) {
78 return &tp_pb.SchedulerConfig{}, nil
kdarapub26b4502019-10-05 03:02:33 +053079
80}
81
Girish Gowdra54934262019-11-13 14:19:55 +053082// GetDsScheduler to mock techprofile GetDsScheduler method
Girish Kumar8f73fe02019-12-09 13:19:37 +000083func (m MockTechProfile) GetDsScheduler(tpInstance *tp.TechProfile) (*tp_pb.SchedulerConfig, error) {
84 return &tp_pb.SchedulerConfig{}, nil
kdarapub26b4502019-10-05 03:02:33 +053085}
86
Girish Gowdra54934262019-11-13 14:19:55 +053087// GetTrafficScheduler to mock techprofile GetTrafficScheduler method
kdarapub26b4502019-10-05 03:02:33 +053088func (m MockTechProfile) GetTrafficScheduler(tpInstance *tp.TechProfile, SchedCfg *tp_pb.SchedulerConfig,
89 ShapingCfg *tp_pb.TrafficShapingInfo) *tp_pb.TrafficScheduler {
90 return &tp_pb.TrafficScheduler{}
91
92}
93
Girish Gowdra54934262019-11-13 14:19:55 +053094// GetTrafficQueues to mock techprofile GetTrafficQueues method
Girish Kumar8f73fe02019-12-09 13:19:37 +000095func (m MockTechProfile) GetTrafficQueues(tp *tp.TechProfile, Dir tp_pb.Direction) ([]*tp_pb.TrafficQueue, error) {
96 return []*tp_pb.TrafficQueue{{}}, nil
kdarapub26b4502019-10-05 03:02:33 +053097}
98
Girish Gowdra54934262019-11-13 14:19:55 +053099// GetGemportIDForPbit to mock techprofile GetGemportIDForPbit method
kdarapub26b4502019-10-05 03:02:33 +0530100func (m MockTechProfile) GetGemportIDForPbit(tp *tp.TechProfile, Dir tp_pb.Direction, pbit uint32) uint32 {
101 return 0
102}
Girish Gowdra54934262019-11-13 14:19:55 +0530103
104// FindAllTpInstances to mock techprofile FindAllTpInstances method
105func (m MockTechProfile) FindAllTpInstances(techProfiletblID uint32, ponIntf uint32, onuID uint32) []tp.TechProfile {
106 return []tp.TechProfile{}
107}