blob: 8a5ba0af8734feb5ade41327c744547e6fc7351f [file] [log] [blame]
Matteo Scandolo378b8c92020-04-16 14:34:22 -07001/*
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
17package devices
18
19import (
Matteo Scandolo378b8c92020-04-16 14:34:22 -070020 "testing"
Elia Battistonac63b112022-01-12 18:40:49 +010021
22 "github.com/stretchr/testify/assert"
Matteo Scandolo378b8c92020-04-16 14:34:22 -070023)
24
25func Test_Onu_CreateOnu(t *testing.T) {
Matteo Scandolo8a574812021-05-20 15:18:53 -070026 nextCtag := map[string]int{}
27 nextStag := map[string]int{}
Mahir Gunyela1753ae2021-06-23 00:24:56 -070028
Matteo Scandolo378b8c92020-04-16 14:34:22 -070029 olt := OltDevice{
Andrea Campanella6f5f3552022-03-10 17:14:25 +010030 ID: 0,
31 NumUni: 4,
32 NumPots: 1,
33 NniDhcpTrapVid: 60,
Matteo Scandolo378b8c92020-04-16 14:34:22 -070034 }
35 pon := PonPort{
36 ID: 1,
37 Olt: &olt,
38 }
39
Matteo Scandolo8a574812021-05-20 15:18:53 -070040 onu := CreateONU(&olt, &pon, 1, 0, nextCtag, nextStag, false)
Matteo Scandolo378b8c92020-04-16 14:34:22 -070041
Matteo Scandolo8a574812021-05-20 15:18:53 -070042 assert.Equal(t, "BBSM00000101", onu.Sn())
43 assert.Equal(t, 4, len(onu.UniPorts))
Elia Battistonac63b112022-01-12 18:40:49 +010044 assert.Equal(t, 1, len(onu.PotsPorts))
Andrea Campanella6f5f3552022-03-10 17:14:25 +010045 assert.Equal(t, 60, olt.NniDhcpTrapVid)
46
Matteo Scandolo5ff80082019-12-20 13:20:57 -080047}