kdarapu | b26b450 | 2019-10-05 03:02:33 +0530 | [diff] [blame] | 1 | /* |
| 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. |
| 18 | package mocks |
| 19 | |
| 20 | import ( |
Scott Baker | 5129015 | 2019-10-24 14:23:20 -0700 | [diff] [blame] | 21 | "github.com/opencord/voltha-lib-go/v2/pkg/db/model" |
| 22 | "github.com/opencord/voltha-lib-go/v2/pkg/log" |
| 23 | tp "github.com/opencord/voltha-lib-go/v2/pkg/techprofile" |
kdarapu | b26b450 | 2019-10-05 03:02:33 +0530 | [diff] [blame] | 24 | tp_pb "github.com/opencord/voltha-protos/go/tech_profile" |
| 25 | ) |
| 26 | |
| 27 | // MockTechProfile mock struct for OpenoltClient. |
| 28 | type MockTechProfile struct { |
| 29 | TpID uint32 |
| 30 | } |
| 31 | |
| 32 | // SetKVClient to mock tefhprofile SetKVClient method |
| 33 | func (m MockTechProfile) SetKVClient() *model.Backend { |
| 34 | return &model.Backend{Client: &MockKVClient{}} |
| 35 | } |
| 36 | |
| 37 | // GetTechProfileInstanceKVPath to mock tefhprofile GetTechProfileInstanceKVPath method |
| 38 | func (m MockTechProfile) GetTechProfileInstanceKVPath(techProfiletblID uint32, uniPortName string) string { |
| 39 | return "" |
| 40 | |
| 41 | } |
| 42 | |
| 43 | // GetTPInstanceFromKVStore to mock tefhprofile GetTPInstanceFromKVStore method |
| 44 | func (m MockTechProfile) GetTPInstanceFromKVStore(techProfiletblID uint32, path string) (*tp.TechProfile, error) { |
| 45 | log.Debug("Warning Warning Warning: GetTPInstanceFromKVStore") |
| 46 | return nil, nil |
| 47 | |
| 48 | } |
| 49 | |
| 50 | // CreateTechProfInstance to mock tefhprofile CreateTechProfInstance method |
| 51 | func (m MockTechProfile) CreateTechProfInstance(techProfiletblID uint32, uniPortName string, intfID uint32) *tp.TechProfile { |
| 52 | |
| 53 | return &tp.TechProfile{ |
| 54 | Name: "mock-tech-profile", |
| 55 | SubscriberIdentifier: "257", |
| 56 | ProfileType: "mock", |
| 57 | Version: 0, |
| 58 | NumGemPorts: 2, |
| 59 | NumTconts: 1, |
| 60 | UpstreamGemPortAttributeList: nil, |
| 61 | DownstreamGemPortAttributeList: nil, |
| 62 | } |
| 63 | |
| 64 | } |
| 65 | |
| 66 | // DeleteTechProfileInstance to mock tefhprofile DeleteTechProfileInstance method |
| 67 | func (m MockTechProfile) DeleteTechProfileInstance(techProfiletblID uint32, uniPortName string) error { |
| 68 | return nil |
| 69 | } |
| 70 | |
| 71 | // GetprotoBufParamValue to mock tefhprofile GetprotoBufParamValue method |
| 72 | func (m MockTechProfile) GetprotoBufParamValue(paramType string, paramKey string) int32 { |
| 73 | return 0 |
| 74 | |
| 75 | } |
| 76 | |
| 77 | // GetUsScheduler to mock tefhprofile GetUsScheduler method |
| 78 | func (m MockTechProfile) GetUsScheduler(tpInstance *tp.TechProfile) *tp_pb.SchedulerConfig { |
| 79 | return &tp_pb.SchedulerConfig{} |
| 80 | |
| 81 | } |
| 82 | |
| 83 | // GetDsScheduler to mock tefhprofile GetDsScheduler method |
| 84 | func (m MockTechProfile) GetDsScheduler(tpInstance *tp.TechProfile) *tp_pb.SchedulerConfig { |
| 85 | return &tp_pb.SchedulerConfig{} |
| 86 | } |
| 87 | |
| 88 | // GetTrafficScheduler to mock tefhprofile GetTrafficScheduler method |
| 89 | func (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 | |
| 95 | // GetTrafficQueues to mock tefhprofile GetTrafficQueues method |
| 96 | func (m MockTechProfile) GetTrafficQueues(tp *tp.TechProfile, Dir tp_pb.Direction) []*tp_pb.TrafficQueue { |
| 97 | return []*tp_pb.TrafficQueue{{}} |
| 98 | } |
| 99 | |
| 100 | // GetGemportIDForPbit to mock tefhprofile GetGemportIDForPbit method |
| 101 | func (m MockTechProfile) GetGemportIDForPbit(tp *tp.TechProfile, Dir tp_pb.Direction, pbit uint32) uint32 { |
| 102 | return 0 |
| 103 | } |