kdarapu | 891693b | 2019-09-16 12:33:49 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019-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 adaptercore provides the utility for olt devices, flows and statistics |
| 18 | package adaptercore |
| 19 | |
| 20 | import ( |
| 21 | "testing" |
| 22 | |
Scott Baker | 5129015 | 2019-10-24 14:23:20 -0700 | [diff] [blame] | 23 | "github.com/opencord/voltha-lib-go/v2/pkg/log" |
kdarapu | 891693b | 2019-09-16 12:33:49 +0530 | [diff] [blame] | 24 | "github.com/opencord/voltha-protos/go/openolt" |
| 25 | "github.com/opencord/voltha-protos/go/voltha" |
| 26 | ) |
| 27 | |
| 28 | func init() { |
| 29 | _, _ = log.AddPackage(log.JSON, log.DebugLevel, nil) |
| 30 | } |
| 31 | func TestOpenOltStatisticsMgr_PortStatisticsIndication(t *testing.T) { |
| 32 | device := &voltha.Device{ |
| 33 | Id: "olt", |
| 34 | Root: true, |
| 35 | ParentId: "logical_device", |
| 36 | Ports: []*voltha.Port{ |
| 37 | {PortNo: 1, Label: "pon", Type: voltha.Port_ETHERNET_UNI}, |
| 38 | {PortNo: 2, Label: "nni", Type: voltha.Port_ETHERNET_NNI}, |
| 39 | }, |
| 40 | ProxyAddress: &voltha.Device_ProxyAddress{ |
| 41 | DeviceId: "olt", |
| 42 | DeviceType: "onu", |
| 43 | ChannelId: 1, |
| 44 | ChannelGroupId: 1, |
| 45 | }, |
| 46 | ConnectStatus: 1, |
| 47 | } |
| 48 | dh := &DeviceHandler{} |
| 49 | dh.device = device |
| 50 | StatMgr := NewOpenOltStatsMgr(dh) |
| 51 | |
| 52 | type args struct { |
| 53 | PortStats *openolt.PortStatistics |
| 54 | } |
| 55 | tests := []struct { |
| 56 | name string |
| 57 | args args |
| 58 | }{ |
| 59 | // TODO: Add test cases. |
| 60 | {"PortStatisticsIndication", args{PortStats: &openolt.PortStatistics{}}}, |
| 61 | } |
| 62 | for _, tt := range tests { |
| 63 | t.Run(tt.name, func(t *testing.T) { |
| 64 | |
| 65 | StatMgr.PortStatisticsIndication(tt.args.PortStats) |
| 66 | }) |
| 67 | } |
| 68 | } |