[SEBA-842] Doubletagging DHCP packets going to VOLTHA
Change-Id: I8e7d2af217228e96dcdc3bc94318b5e29b71f676
diff --git a/internal/bbsim/devices/olt_test.go b/internal/bbsim/devices/olt_test.go
index a022c7c..f83fc62 100644
--- a/internal/bbsim/devices/olt_test.go
+++ b/internal/bbsim/devices/olt_test.go
@@ -18,6 +18,7 @@
import (
"gotest.tools/assert"
+ "net"
"testing"
)
@@ -32,10 +33,12 @@
}
for j := 0; j < numOnu; j++ {
+ onuId := uint32(i + j)
onu := Onu{
- ID: uint32(i + j),
+ ID: onuId,
PonPort: pon,
- PonPortID: uint32(i),
+ PonPortID: pon.ID,
+ HwAddress: net.HardwareAddr{0x2e, 0x60, 0x70, 0x13, byte(pon.ID), byte(onuId)},
}
onu.SerialNumber = onu.NewSN(olt.ID, pon.ID, onu.ID)
pon.Onus = append(pon.Onus, onu)
@@ -45,14 +48,14 @@
return olt
}
-func Test_Olt_FindOnu_Success(t *testing.T) {
+func Test_Olt_FindOnuBySn_Success(t *testing.T) {
numPon := 4
numOnu := 4
olt := createMockOlt(numPon, numOnu)
- onu, err := olt.FindOnu("BBSM00000303")
+ onu, err := olt.FindOnuBySn("BBSM00000303")
assert.Equal(t, err, nil)
assert.Equal(t, onu.Sn(), "BBSM00000303")
@@ -60,14 +63,45 @@
assert.Equal(t, onu.PonPortID, uint32(3))
}
-func Test_Olt_FindOnu_Error(t *testing.T) {
+func Test_Olt_FindOnuBySn_Error(t *testing.T) {
numPon := 1
numOnu := 4
olt := createMockOlt(numPon, numOnu)
- _, err := olt.FindOnu("BBSM00000303")
+ _, err := olt.FindOnuBySn("BBSM00000303")
- assert.Equal(t, err.Error(), "cannot-find-onu-BBSM00000303")
+ assert.Equal(t, err.Error(), "cannot-find-onu-by-serial-number-BBSM00000303")
+}
+
+func Test_Olt_FindOnuByMacAddress_Success(t *testing.T) {
+
+ numPon := 4
+ numOnu := 4
+
+ olt := createMockOlt(numPon, numOnu)
+
+ mac := net.HardwareAddr{0x2e, 0x60, 0x70, 0x13, byte(3), byte(3)}
+
+ onu, err := olt.FindOnuByMacAddress(mac)
+
+ assert.Equal(t, err, nil)
+ assert.Equal(t, onu.Sn(), "BBSM00000303")
+ assert.Equal(t, onu.ID, uint32(3))
+ assert.Equal(t, onu.PonPortID, uint32(3))
+}
+
+func Test_Olt_FindOnuByMacAddress_Error(t *testing.T) {
+
+ numPon := 1
+ numOnu := 4
+
+ olt := createMockOlt(numPon, numOnu)
+
+ mac := net.HardwareAddr{0x2e, 0x60, 0x70, 0x13, byte(3), byte(3)}
+
+ _, err := olt.FindOnuByMacAddress(mac)
+
+ assert.Equal(t, err.Error(), "cannot-find-onu-by-mac-address-2e:60:70:13:03:03")
}