[VOL-3623] Reporting the correct SerialNumber as part of the ONUG request
Change-Id: If6140e96657a2ed38bcc83170131ae95c02bb4b6
diff --git a/go.mod b/go.mod
index 75a24e8..63e9eb3 100644
--- a/go.mod
+++ b/go.mod
@@ -19,7 +19,7 @@
github.com/olekukonko/tablewriter v0.0.4
github.com/opencord/cordctl v0.0.0-20190909161711-01e9c1f04bf4
github.com/opencord/device-management-interface v0.9.1-0.20200930105820-188a84f483b3
- github.com/opencord/omci-sim v0.0.4
+ github.com/opencord/omci-sim v0.0.5
github.com/opencord/voltha-protos/v4 v4.0.2
github.com/pkg/errors v0.8.1 // indirect
github.com/sirupsen/logrus v1.4.2
diff --git a/go.sum b/go.sum
index 9b8bf25..6adc8a6 100644
--- a/go.sum
+++ b/go.sum
@@ -92,8 +92,8 @@
github.com/opencord/cordctl v0.0.0-20190909161711-01e9c1f04bf4/go.mod h1:/+3S0pwQUy7HeKnH0KfKp5W6hmh/LdZzuZTNT/m7vA4=
github.com/opencord/device-management-interface v0.9.1-0.20200930105820-188a84f483b3 h1:B5mxBmXaNWbiqvD5BRssHvUhJFUc8GMcf/Sa/u7ECls=
github.com/opencord/device-management-interface v0.9.1-0.20200930105820-188a84f483b3/go.mod h1:G1owSqGBGaqllrwtjxfLTsy9EDsGhdhmqkJM3XOnPD0=
-github.com/opencord/omci-sim v0.0.4 h1:kN8zi/8gkcHOkXPk27Wp6Wwp8ggUylXcD/egW7PUXmc=
-github.com/opencord/omci-sim v0.0.4/go.mod h1:ToOkj7hkHgoet9XQDadKMhYqgA7qItZsi2j1Pk/mX6Y=
+github.com/opencord/omci-sim v0.0.5 h1:vC6EsdOrPj6w/lRiwCR+Rcx9JRfrKJDR9YwNvfZdvzQ=
+github.com/opencord/omci-sim v0.0.5/go.mod h1:ToOkj7hkHgoet9XQDadKMhYqgA7qItZsi2j1Pk/mX6Y=
github.com/opencord/voltha-protos/v4 v4.0.2 h1:SI25ljqftc8Tc28CgfqSE4IGCLJ5MgCmBQlE96hl9X8=
github.com/opencord/voltha-protos/v4 v4.0.2/go.mod h1:W/OIFIyvFh/C0vchRUuarIsMylEhzCRM9pNxLvkPtKc=
github.com/pierrec/lz4 v2.4.1+incompatible h1:mFe7ttWaflA46Mhqh+jUfjp2qTbPYxLB2/OyBppH9dg=
diff --git a/internal/bbsim/devices/onu.go b/internal/bbsim/devices/onu.go
index 42c48bb..b85c804 100644
--- a/internal/bbsim/devices/onu.go
+++ b/internal/bbsim/devices/onu.go
@@ -532,7 +532,7 @@
o.publishOmciEvent(msg)
var omciInd openolt.OmciIndication
- respPkt, err := omcisim.OmciSim(o.PonPortID, o.ID, HexDecode(msg.omciMsg.Pkt))
+ respPkt, err := omcisim.OmciSim(o.PonPort.Olt.ID, o.PonPortID, o.ID, HexDecode(msg.omciMsg.Pkt))
if err != nil {
onuLogger.WithFields(log.Fields{
"IntfId": o.PonPortID,
diff --git a/internal/bbsim/responders/eapol/eapol_test.go b/internal/bbsim/responders/eapol/eapol_test.go
index 936a02d..248fd3d 100644
--- a/internal/bbsim/responders/eapol/eapol_test.go
+++ b/internal/bbsim/responders/eapol/eapol_test.go
@@ -98,7 +98,7 @@
old := GetGemPortId
defer func() { GetGemPortId = old }()
- GetGemPortId = func(intfId uint32, onuId uint32) (uint16, error) {
+ GetGemPortId = func(oltId int, intfId uint32, onuId uint32) (uint16, error) {
return 1, nil
}
diff --git a/vendor/github.com/opencord/omci-sim/VERSION b/vendor/github.com/opencord/omci-sim/VERSION
index 81340c7..bbdeab6 100644
--- a/vendor/github.com/opencord/omci-sim/VERSION
+++ b/vendor/github.com/opencord/omci-sim/VERSION
@@ -1 +1 @@
-0.0.4
+0.0.5
diff --git a/vendor/github.com/opencord/omci-sim/omci_common.go b/vendor/github.com/opencord/omci-sim/omci_common.go
index a140141..3fa4408 100644
--- a/vendor/github.com/opencord/omci-sim/omci_common.go
+++ b/vendor/github.com/opencord/omci-sim/omci_common.go
@@ -30,6 +30,7 @@
}
type OnuKey struct {
+ OltId int
IntfId, OnuId uint32
}
@@ -56,7 +57,7 @@
case ONUG:
pos := uint(11)
- pkt, _ = GetOnuGAttributes(&pos, pkt, content)
+ pkt, _ = GetOnuGAttributes(&pos, pkt, content, key)
return pkt
case ONU2G:
diff --git a/vendor/github.com/opencord/omci-sim/omci_onug.go b/vendor/github.com/opencord/omci-sim/omci_onug.go
index 1cf6b0d..4a6d6f1 100644
--- a/vendor/github.com/opencord/omci-sim/omci_onug.go
+++ b/vendor/github.com/opencord/omci-sim/omci_onug.go
@@ -35,7 +35,7 @@
ExtendedTcLayerOptions OnuGAttributes = 0x0008
)
-type OnuGAttributeHandler func(*uint, []byte) ([]byte, error)
+type OnuGAttributeHandler func(*uint, []byte, OnuKey) ([]byte, error)
var OnuGAttributeHandlers = map[OnuGAttributes]OnuGAttributeHandler{
VendorID: GetVendorID,
@@ -53,7 +53,7 @@
ExtendedTcLayerOptions: GetExtendedTcLayerOptions,
}
-func GetOnuGAttributes(pos *uint, pkt []byte, content OmciContent) ([]byte, error) {
+func GetOnuGAttributes(pos *uint, pkt []byte, content OmciContent, key OnuKey) ([]byte, error) {
AttributesMask := getAttributeMask(content)
for index := uint(16); index >= 1; index-- {
@@ -61,7 +61,7 @@
reqAttribute := Attribute & AttributesMask
if reqAttribute != 0 {
- pkt, _ = OnuGAttributeHandlers[OnuGAttributes(reqAttribute)](pos, pkt)
+ pkt, _ = OnuGAttributeHandlers[OnuGAttributes(reqAttribute)](pos, pkt, key)
}
}
@@ -73,7 +73,7 @@
}
-func GetVendorID(pos *uint, pkt []byte) ([]byte, error) {
+func GetVendorID(pos *uint, pkt []byte, _ OnuKey) ([]byte, error) {
// 4 bytes
vendorid := []byte("BBSM")
for _, ch := range vendorid {
@@ -83,7 +83,7 @@
return pkt, nil
}
-func GetVersion(pos *uint, pkt []byte) ([]byte, error) {
+func GetVersion(pos *uint, pkt []byte, _ OnuKey) ([]byte, error) {
// 14 bytes
for i := 1; i <= 14; i++ {
b := byte(' ')
@@ -93,10 +93,10 @@
return pkt, nil
}
-func GetSerialNumber(pos *uint, pkt []byte) ([]byte, error) {
+func GetSerialNumber(pos *uint, pkt []byte, key OnuKey) ([]byte, error) {
// 8 bytes
vendorid := []byte("BBSM")
- serialhex := []byte{0x00, 0x00, 0x00, 0x01}
+ serialhex := []byte{0x00, byte(key.OltId % 256), byte(key.IntfId), byte(key.OnuId)}
serialnumber := append(vendorid, serialhex...)
for _, ch := range serialnumber {
pkt[*pos] = ch
@@ -105,49 +105,49 @@
return pkt, nil
}
-func GetTrafficManagementOptions(pos *uint, pkt []byte) ([]byte, error) {
+func GetTrafficManagementOptions(pos *uint, pkt []byte, _ OnuKey) ([]byte, error) {
// 1 byte
pkt[*pos] = 0x00
*pos++
return pkt, nil
}
-func GetVpVcCrossConnectOptions(pos *uint, pkt []byte) ([]byte, error) {
+func GetVpVcCrossConnectOptions(pos *uint, pkt []byte, _ OnuKey) ([]byte, error) {
// 1 byte
pkt[*pos] = 0x00
*pos++
return pkt, nil
}
-func GetBatteryBackup(pos *uint, pkt []byte) ([]byte, error) {
+func GetBatteryBackup(pos *uint, pkt []byte, _ OnuKey) ([]byte, error) {
// 1 byte
pkt[*pos] = 0x00
*pos++
return pkt, nil
}
-func GetAdministrativeState(pos *uint, pkt []byte) ([]byte, error) {
+func GetAdministrativeState(pos *uint, pkt []byte, _ OnuKey) ([]byte, error) {
// 1 byte
pkt[*pos] = 0x00
*pos++
return pkt, nil
}
-func GetOperationalState(pos *uint, pkt []byte) ([]byte, error) {
+func GetOperationalState(pos *uint, pkt []byte, _ OnuKey) ([]byte, error) {
// 1 byte
pkt[*pos] = 0x00
*pos++
return pkt, nil
}
-func GetOntSurvivalTime(pos *uint, pkt []byte) ([]byte, error) {
+func GetOntSurvivalTime(pos *uint, pkt []byte, _ OnuKey) ([]byte, error) {
// 1 byte
pkt[*pos] = 0x00
*pos++
return pkt, nil
}
-func GetLogicalOnuID(pos *uint, pkt []byte) ([]byte, error) {
+func GetLogicalOnuID(pos *uint, pkt []byte, _ OnuKey) ([]byte, error) {
// 24 bytes
for i := 1; i <= 24; i++ {
b := byte(' ')
@@ -157,7 +157,7 @@
return pkt, nil
}
-func GetLogicalPassword(pos *uint, pkt []byte) ([]byte, error) {
+func GetLogicalPassword(pos *uint, pkt []byte, _ OnuKey) ([]byte, error) {
// 24 bytes
for i := 1; i <= 24; i++ {
b := byte(' ')
@@ -167,14 +167,14 @@
return pkt, nil
}
-func GetCredentialsStatus(pos *uint, pkt []byte) ([]byte, error) {
+func GetCredentialsStatus(pos *uint, pkt []byte, _ OnuKey) ([]byte, error) {
// 1 byte
pkt[*pos] = 0x00
*pos++
return pkt, nil
}
-func GetExtendedTcLayerOptions(pos *uint, pkt []byte) ([]byte, error) {
+func GetExtendedTcLayerOptions(pos *uint, pkt []byte, _ OnuKey) ([]byte, error) {
// 2 bytes
tcbits := []byte{0x00, 0x00}
for _, ch := range tcbits {
diff --git a/vendor/github.com/opencord/omci-sim/omci_sim.go b/vendor/github.com/opencord/omci-sim/omci_sim.go
index 6195168..e1ea77f 100644
--- a/vendor/github.com/opencord/omci-sim/omci_sim.go
+++ b/vendor/github.com/opencord/omci-sim/omci_sim.go
@@ -27,7 +27,7 @@
return omciCh
}
-func OmciSim(intfId uint32, onuId uint32, request []byte) ([]byte, error) {
+func OmciSim(oltId int, intfId uint32, onuId uint32, request []byte) ([]byte, error) {
var resp []byte
transactionId, deviceId, msgType, class, instance, content, err := ParsePkt(request)
@@ -50,7 +50,7 @@
"omciMsg": fmt.Sprintf("%x", content),
}).Tracef("Processing OMCI packet")
- key := OnuKey{intfId, onuId}
+ key := OnuKey{OltId: oltId, IntfId: intfId, OnuId: onuId}
OnuOmciStateMapLock.Lock()
if _, ok := OnuOmciStateMap[key]; !ok {
OnuOmciStateMap[key] = NewOnuOmciState()
diff --git a/vendor/github.com/opencord/omci-sim/omci_state.go b/vendor/github.com/opencord/omci-sim/omci_state.go
index ddb9921..d1b4332 100644
--- a/vendor/github.com/opencord/omci-sim/omci_state.go
+++ b/vendor/github.com/opencord/omci-sim/omci_state.go
@@ -19,7 +19,6 @@
"errors"
"fmt"
"sync"
- log "github.com/sirupsen/logrus"
)
type OnuOmciState struct {
@@ -61,8 +60,8 @@
s.tcontPointer = 0
s.priorQPriority = 0
}
-func GetOnuOmciState(intfId uint32, onuId uint32) istate {
- key := OnuKey{intfId, onuId}
+func GetOnuOmciState(oltId int, intfId uint32, onuId uint32) istate {
+ key := OnuKey{oltId,intfId, onuId}
OnuOmciStateMapLock.RLock()
defer OnuOmciStateMapLock.RUnlock()
if onu, ok := OnuOmciStateMap[key]; ok {
@@ -72,8 +71,8 @@
}
}
-func GetGemPortId(intfId uint32, onuId uint32) (uint16, error) {
- key := OnuKey{intfId, onuId}
+func GetGemPortId(oltId int, intfId uint32, onuId uint32) (uint16, error) {
+ key := OnuKey{oltId, intfId, onuId}
OnuOmciStateMapLock.RLock()
defer OnuOmciStateMapLock.RUnlock()
if OnuOmciState, ok := OnuOmciStateMap[key]; ok {
@@ -86,8 +85,3 @@
errmsg := fmt.Sprintf("ONU {intfid:%d, onuid:%d} - Failed to find a key in OnuOmciStateMap", intfId, onuId)
return 0, errors.New(errmsg)
}
-
-func CheckIsTeo() string {
- log.Warn("It's TEO!")
- return "It's TEO!"
-}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 545e32f..4e63d72 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -77,7 +77,7 @@
github.com/opencord/cordctl/pkg/format
# github.com/opencord/device-management-interface v0.9.1-0.20200930105820-188a84f483b3
github.com/opencord/device-management-interface/go/dmi
-# github.com/opencord/omci-sim v0.0.4
+# github.com/opencord/omci-sim v0.0.5
github.com/opencord/omci-sim
# github.com/opencord/voltha-protos/v4 v4.0.2
github.com/opencord/voltha-protos/v4/go/common