[VOL-4688] openonuAdapterGo: OMCI extended message set - derive the capability from the OMCC version
Do not merge before https://gerrit.opencord.org/c/bbsim/+/32128
Change-Id: I800f1bae3b696f320c63c80336a22f187b9c947c
diff --git a/VERSION b/VERSION
index baa9d04..6b4d157 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.2.3-dev279
+2.2.3
\ No newline at end of file
diff --git a/internal/pkg/common/omci_cc.go b/internal/pkg/common/omci_cc.go
index e1115d3..c7bda8b 100755
--- a/internal/pkg/common/omci_cc.go
+++ b/internal/pkg/common/omci_cc.go
@@ -53,6 +53,7 @@
// UnusedTcontAllocID - TODO: add comment
const UnusedTcontAllocID = uint16(0xFFFF) //common unused AllocId for G.984 and G.987 systems
+const cOmciDeviceIdentifierPos = 3
const cOmciBaseMessageTrailerLen = 40
// tOmciReceiveError - enum type for detected problems/errors in the received OMCI message (format)
@@ -282,41 +283,65 @@
// ReceiveMessage - Rx handler for onu messages
// e.g. would call ReceiveOnuMessage() in case of TID=0 or Action=test ...
+// nolint: gocyclo
func (oo *OmciCC) ReceiveMessage(ctx context.Context, rxMsg []byte) error {
//logger.Debugw(ctx,"cc-receive-omci-message", log.Fields{"RxOmciMessage-x2s": hex.EncodeToString(rxMsg)})
- if len(rxMsg) >= 44 { // then it should normally include the BaseFormat trailer Len
- // NOTE: autocorrection only valid for OmciBaseFormat, which is not specifically verified here!!!
- // (an extendedFormat message could be destroyed this way!)
- trailerLenData := rxMsg[42:44]
- trailerLen := binary.BigEndian.Uint16(trailerLenData)
- //logger.Debugw(ctx,"omci-received-trailer-len", log.Fields{"Length": trailerLen})
- if trailerLen != cOmciBaseMessageTrailerLen { // invalid base Format entry -> autocorrect
- binary.BigEndian.PutUint16(rxMsg[42:44], cOmciBaseMessageTrailerLen)
- if oo.rxOmciFrameError != cOmciMessageReceiveErrorTrailerLen {
- //do just one error log, expectation is: if seen once it should appear regularly - avoid to many log entries
- logger.Errorw(ctx, "wrong omci-message trailer length: trailer len auto-corrected",
- log.Fields{"trailer-length": trailerLen, "device-id": oo.deviceID})
- oo.rxOmciFrameError = cOmciMessageReceiveErrorTrailerLen
- }
+
+ if len(rxMsg) < 10 {
+ logger.Errorw(ctx, "rxOmciMessage has wrong length in general - abort",
+ log.Fields{"Length": len(rxMsg), "device-id": oo.deviceID})
+ if len(rxMsg) > 0 {
+ oo.printRxMessage(ctx, rxMsg)
}
- } else if len(rxMsg) >= cOmciBaseMessageTrailerLen { // workaround for Adtran OLT Sim, which currently does not send trailer bytes at all!
- // NOTE: autocorrection only valid for OmciBaseFormat, which is not specifically verified here!!!
- // (an extendedFormat message could be destroyed this way!)
- // extend/overwrite with trailer
- trailer := make([]byte, 8)
- binary.BigEndian.PutUint16(trailer[2:], cOmciBaseMessageTrailerLen) //set the defined baseline length
- rxMsg = append(rxMsg[:cOmciBaseMessageTrailerLen], trailer...)
- if oo.rxOmciFrameError != cOmciMessageReceiveErrorMissTrailer {
- //do just one error log, expectation is: if seen once it should appear regularly - avoid to many log entries
- logger.Errorw(ctx, "omci-message to short to include trailer len: trailer auto-corrected (added)",
- log.Fields{"message-length": len(rxMsg), "device-id": oo.deviceID})
- oo.rxOmciFrameError = cOmciMessageReceiveErrorMissTrailer
+ return fmt.Errorf("rxOmciMessage has wrong length in general - abort %s", oo.deviceID)
+ }
+ if rxMsg[cOmciDeviceIdentifierPos] == byte(omci.BaselineIdent) {
+ if len(rxMsg) >= 44 { // then it should normally include the BaseFormat trailer Len
+ // NOTE: autocorrection only valid for OmciBaseFormat, which is not specifically verified here!!!
+ // (an extendedFormat message could be destroyed this way!)
+ trailerLenData := rxMsg[42:44]
+ trailerLen := binary.BigEndian.Uint16(trailerLenData)
+ //logger.Debugw(ctx,"omci-received-trailer-len", log.Fields{"Length": trailerLen})
+ if trailerLen != cOmciBaseMessageTrailerLen { // invalid base Format entry -> autocorrect
+ binary.BigEndian.PutUint16(rxMsg[42:44], cOmciBaseMessageTrailerLen)
+ if oo.rxOmciFrameError != cOmciMessageReceiveErrorTrailerLen {
+ //do just one error log, expectation is: if seen once it should appear regularly - avoid to many log entries
+ logger.Errorw(ctx, "wrong omci-message trailer length: trailer len auto-corrected",
+ log.Fields{"trailer-length": trailerLen, "device-id": oo.deviceID})
+ oo.rxOmciFrameError = cOmciMessageReceiveErrorTrailerLen
+ }
+ }
+ } else if len(rxMsg) >= cOmciBaseMessageTrailerLen { // workaround for Adtran OLT Sim, which currently does not send trailer bytes at all!
+ // NOTE: autocorrection only valid for OmciBaseFormat, which is not specifically verified here!!!
+ // (an extendedFormat message could be destroyed this way!)
+ // extend/overwrite with trailer
+ trailer := make([]byte, 8)
+ binary.BigEndian.PutUint16(trailer[2:], cOmciBaseMessageTrailerLen) //set the defined baseline length
+ rxMsg = append(rxMsg[:cOmciBaseMessageTrailerLen], trailer...)
+ if oo.rxOmciFrameError != cOmciMessageReceiveErrorMissTrailer {
+ //do just one error log, expectation is: if seen once it should appear regularly - avoid to many log entries
+ logger.Errorw(ctx, "omci-message to short to include trailer len: trailer auto-corrected (added)",
+ log.Fields{"message-length": len(rxMsg), "device-id": oo.deviceID})
+ oo.rxOmciFrameError = cOmciMessageReceiveErrorMissTrailer
+ }
+ } else {
+ logger.Errorw(ctx, "received omci-message too small for OmciBaseFormat - abort",
+ log.Fields{"Length": len(rxMsg), "device-id": oo.deviceID})
+ oo.printRxMessage(ctx, rxMsg)
+ return fmt.Errorf("rxOmciMessage too small for BaseFormat %s", oo.deviceID)
+ }
+ } else if rxMsg[cOmciDeviceIdentifierPos] == byte(omci.ExtendedIdent) {
+ if len(rxMsg) > 1980 {
+ logger.Errorw(ctx, "rxOmciMessage has wrong length for OmciExtendedFormat - abort",
+ log.Fields{"Length": len(rxMsg), "device-id": oo.deviceID})
+ oo.printRxMessage(ctx, rxMsg)
+ return fmt.Errorf("rxOmciMessage has wrong length for OmciExtendedFormat %s", oo.deviceID)
}
} else {
- logger.Errorw(ctx, "received omci-message too small for OmciBaseFormat - abort",
+ logger.Errorw(ctx, "rxOmciMessage has wrong Device Identifier - abort",
log.Fields{"Length": len(rxMsg), "device-id": oo.deviceID})
oo.printRxMessage(ctx, rxMsg)
- return fmt.Errorf("rxOmciMessage too small for BaseFormat %s", oo.deviceID)
+ return fmt.Errorf("rxOmciMessage has wrong Device Identifier %s", oo.deviceID)
}
decodeOptions := gopacket.DecodeOptions{
Lazy: true,
@@ -530,7 +555,7 @@
receiveCallbackPair CallbackPair) error {
if timeout != 0 {
- logger.Debugw(ctx, "register-response-callback:", log.Fields{"for TansCorrId": receiveCallbackPair.CbKey})
+ logger.Debugw(ctx, "register-response-callback:", log.Fields{"for TransCorrId": receiveCallbackPair.CbKey})
oo.mutexRxSchedMap.Lock()
// it could be checked, if the callback key is already registered - but simply overwrite may be acceptable ...
oo.rxSchedulerMap[receiveCallbackPair.CbKey] = receiveCallbackPair.CbEntry
@@ -587,6 +612,11 @@
for oo.highPrioTxQueue.Len() > 0 {
queueElement := oo.highPrioTxQueue.Front() // First element
if err := oo.sendOMCIRequest(ctx, queueElement.Value.(OmciTransferStructure)); err != nil {
+ // Element will be removed from the queue regardless of the send success, to prevent
+ // an accumulation of send requests for the same message in the event of an error.
+ // In this case, resend attempts for the message are ensured by our retry
+ // mechanism after omci-timeout.
+ oo.highPrioTxQueue.Remove(queueElement) // Dequeue
return err
}
oo.highPrioTxQueue.Remove(queueElement) // Dequeue
@@ -602,12 +632,22 @@
aOmciTxReq := queueElement.Value.(OmciTransferStructure)
if aOmciTxReq.OnuSwWindow != nil {
if err := oo.sendOnuSwSectionsOfWindow(ctx, aOmciTxReq); err != nil {
+ // Element will be removed from the queue regardless of the send success, to prevent
+ // an accumulation of send requests for the same message in the event of an error.
+ // In this case, resend attempts for the message are ensured by our retry
+ // mechanism after omci-timeout.
+ oo.lowPrioTxQueue.Remove(queueElement) // Dequeue
oo.mutexLowPrioTxQueue.Unlock()
return err
}
} else {
err := oo.sendOMCIRequest(ctx, queueElement.Value.(OmciTransferStructure))
if err != nil {
+ // Element will be removed from the queue regardless of the send success, to prevent
+ // an accumulation of send requests for the same message in the event of an error.
+ // In this case, resend attempts for the message are ensured by our retry
+ // mechanism after omci-timeout.
+ oo.lowPrioTxQueue.Remove(queueElement) // Dequeue
oo.mutexLowPrioTxQueue.Unlock()
return err
}
@@ -712,10 +752,11 @@
TransactionID: tid,
MessageType: msgType,
}
- return serializeOmciLayer(ctx, omciLayer, request)
+ return SerializeOmciLayer(ctx, omciLayer, request)
}
-func serializeOmciLayer(ctx context.Context, aOmciLayer *omci.OMCI, aRequest gopacket.SerializableLayer) ([]byte, error) {
+// SerializeOmciLayer - TODO: add comment
+func SerializeOmciLayer(ctx context.Context, aOmciLayer *omci.OMCI, aRequest gopacket.SerializableLayer) ([]byte, error) {
var options gopacket.SerializeOptions
options.FixLengths = true
@@ -960,7 +1001,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize GalEnetProfile create", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1009,7 +1050,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize ONU2-G set", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1064,7 +1105,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize MBSP create", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1122,7 +1163,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize MBPCD create", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1182,7 +1223,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize EVTOCD create", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1228,7 +1269,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize ONU-G set", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1274,7 +1315,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize PPTPEthUni-Set", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1368,7 +1409,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VEIP-Set", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1413,7 +1454,7 @@
logger.Errorf(ctx, "Cannot encode instance for get-request", log.Fields{"meClassIDName": meClassIDName, "Err": err, "device-id": oo.deviceID})
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize get-request", log.Fields{"meClassIDName": meClassIDName, "Err": err, "device-id": oo.deviceID})
return nil, err
@@ -1501,7 +1542,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize .1pMapper create", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1545,7 +1586,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize MBPCD create", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1589,7 +1630,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize GemNCTP create", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1632,7 +1673,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize GemNCTP set", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1676,7 +1717,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize GemIwTp create", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1718,7 +1759,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize TCont set", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1760,7 +1801,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize PrioQueue set", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1802,7 +1843,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize 1PMapper set", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1849,7 +1890,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VTFD create", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1895,7 +1936,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VTFD set", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1939,7 +1980,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize EVTOCD create", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -1981,7 +2022,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize EVTOCD set", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -2023,7 +2064,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize EVTOCD delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -2070,7 +2111,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VTFD delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -2108,7 +2149,7 @@
logger.Errorw(ctx, "Cannot encode TD for create", log.Fields{"Err": err, "device-id": oo.deviceID})
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize TD create", log.Fields{"Err": err, "device-id": oo.deviceID})
return nil, err
@@ -2144,7 +2185,7 @@
logger.Errorw(ctx, "Cannot encode TD for set", log.Fields{"Err": err, "device-id": oo.deviceID})
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize TD set", log.Fields{"Err": err, "device-id": oo.deviceID})
return nil, err
@@ -2182,7 +2223,7 @@
logger.Errorw(ctx, "Cannot encode TD for delete", log.Fields{"Err": err, "device-id": oo.deviceID})
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize TD delete", log.Fields{"Err": err, "device-id": oo.deviceID})
return nil, err
@@ -2226,7 +2267,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize GemIwTp delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -2273,7 +2314,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize GemNCtp delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -2320,7 +2361,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize .1pMapper delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -2367,7 +2408,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize MBPCD delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -2409,7 +2450,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize MulticastGEMIWTP create", log.Fields{"Err": err, "device-id": oo.deviceID})
return nil, err
@@ -2448,7 +2489,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize MulticastGEMIWTP create", log.Fields{"Err": err, "device-id": oo.deviceID})
return nil, err
@@ -2488,7 +2529,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize MulticastOperationProfile create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -2530,7 +2571,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize MulticastOperationProfile create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -2572,7 +2613,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize MulticastSubConfigInfo create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -2614,7 +2655,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VoipVoiceCTP create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -2656,7 +2697,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VoipVoiceCTP set", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -2702,7 +2743,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VoipVoiceCTP delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -2745,7 +2786,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VoipMediaProfile create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -2787,7 +2828,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VoipMediaProfile set", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -2830,7 +2871,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VoipMediaProfile delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -2873,7 +2914,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VoiceServiceProfile create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -2915,7 +2956,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VoiceServiceProfile set", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -2958,7 +2999,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VoiceServiceProfile delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -3001,7 +3042,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize SIPUserData create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3043,7 +3084,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize SIPUserData set", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3086,7 +3127,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize SIPUserData delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -3129,7 +3170,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VoipApplicationServiceProfile create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3171,7 +3212,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize VoipApplicationServiceProfile set", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3214,7 +3255,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize SIPVoipApplicationServiceProfile delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -3257,7 +3298,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize SIPAgentConfigData create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3299,7 +3340,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize SIPAgentConfigData set", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3342,7 +3383,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize SIPAgentConfigData delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -3385,7 +3426,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize TCPUDPConfigData create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3427,7 +3468,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize TCPUDPConfigData set", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3470,7 +3511,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize TCPUDPConfigData delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -3513,7 +3554,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize IPHostConfigData create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3555,7 +3596,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize IPHostConfigData set", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3598,7 +3639,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize IPHostConfigData delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -3641,7 +3682,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize RTPProfileData create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3683,7 +3724,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize RTPProfileData set", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3726,7 +3767,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize RTPProfileData delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -3769,7 +3810,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize NetworkDialPlanTable create", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3811,7 +3852,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize NetworkDialPlanTable set", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3854,7 +3895,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize NetworkDialPlanTable delete", log.Fields{
"Err": err, "device-id": oo.deviceID})
@@ -3905,7 +3946,7 @@
Second: uint8(utcTime.Second()),
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, request)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, request)
if err != nil {
logger.Errorw(ctx, "Cannot serialize synchronize time request", log.Fields{"Err": err,
"device-id": oo.deviceID})
@@ -3956,7 +3997,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize ethernet frame performance monitoring history data ME",
log.Fields{"Err": err, "device-id": oo.deviceID, "upstream": upstream, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)})
@@ -4009,7 +4050,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize ethernet uni history data ME",
log.Fields{"Err": err, "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)})
@@ -4062,7 +4103,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize fec history data ME",
log.Fields{"Err": err, "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)})
@@ -4115,7 +4156,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "Cannot serialize gemport history data ME",
log.Fields{"Err": err, "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)})
@@ -4847,7 +4888,7 @@
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "cannot-serialize-ethernet-frame-extended-pm-me",
log.Fields{"err": err, "device-id": oo.deviceID, "upstream": upstream, "create": create, "inst-id": strconv.FormatInt(int64(entityID), 16)})
@@ -4918,7 +4959,7 @@
log.Fields{"err": err, "device-id": oo.deviceID, "inst-id": strconv.FormatInt(int64(entityID), 16)})
return nil, err
}
- pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer)
+ pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)
if err != nil {
logger.Errorw(ctx, "cannot-serialize-ethernet-frame-extended-pm-me-set-msg",
log.Fields{"err": err, "device-id": oo.deviceID, "inst-id": strconv.FormatInt(int64(entityID), 16)})
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 5b67345..b05cd10 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -2004,7 +2004,7 @@
/* this might be a good time for Omci Verify message? */
verifyExec := make(chan bool)
omciVerify := otst.NewOmciTestRequest(log.WithSpanFromContext(context.TODO(), ctx),
- dh.device.Id, pDevEntry.PDevOmciCC,
+ dh.device.Id, pDevEntry.PDevOmciCC, false,
true, true) //exclusive and allowFailure (anyway not yet checked)
omciVerify.PerformOmciTest(log.WithSpanFromContext(context.TODO(), ctx), verifyExec)
@@ -2012,7 +2012,7 @@
after Timeout start and try MibUpload FSM anyway
(to prevent stopping on just not supported OMCI verification from ONU) */
select {
- case <-time.After(pDevEntry.PDevOmciCC.GetMaxOmciTimeoutWithRetries() * time.Second):
+ case <-time.After(((cmn.CDefaultRetries+1)*otst.CTestRequestOmciTimeout + 1) * time.Second):
logger.Warnw(ctx, "omci start-verification timed out (continue normal)", log.Fields{"device-id": dh.DeviceID})
case testresult := <-verifyExec:
logger.Infow(ctx, "Omci start verification done", log.Fields{"device-id": dh.DeviceID, "result": testresult})
diff --git a/internal/pkg/mib/mib_sync.go b/internal/pkg/mib/mib_sync.go
index ea91efb..dc1f35d 100755
--- a/internal/pkg/mib/mib_sync.go
+++ b/internal/pkg/mib/mib_sync.go
@@ -37,6 +37,7 @@
"github.com/opencord/voltha-lib-go/v7/pkg/log"
cmn "github.com/opencord/voltha-openonu-adapter-go/internal/pkg/common"
devdb "github.com/opencord/voltha-openonu-adapter-go/internal/pkg/devdb"
+ otst "github.com/opencord/voltha-openonu-adapter-go/internal/pkg/omcitst"
"github.com/opencord/voltha-protos/v5/go/inter_adapter"
)
@@ -68,6 +69,26 @@
// 347 // definitions for ME "IPv6 host config data" are currently missing in omci-lib-go!
}
+var omccVersionSupportsExtendedOmciFormat = map[uint8]bool{
+ 0x80: false,
+ 0x81: false,
+ 0x82: false,
+ 0x83: false,
+ 0x84: false,
+ 0x85: false,
+ 0x86: false,
+ 0xA0: false,
+ 0xA1: false,
+ 0xA2: false,
+ 0xA3: false,
+ 0x96: true,
+ 0xB0: true,
+ 0xB1: true,
+ 0xB2: true,
+ 0xB3: true,
+ 0xB4: true,
+}
+
var fsmMsg cmn.TestMessageType
func (oo *OnuDeviceEntry) enterStartingState(ctx context.Context, e *fsm.Event) {
@@ -99,7 +120,8 @@
logger.Debugw(ctx, "MibSync FSM", log.Fields{"Start getting VendorId and SerialNumber in State": e.FSM.Current(), "device-id": oo.deviceID})
requestedAttributes := me.AttributeValueMap{me.OnuG_VendorId: "", me.OnuG_SerialNumber: 0}
oo.mutexLastTxParamStruct.Lock()
- meInstance, err := oo.PDevOmciCC.SendGetMe(log.WithSpanFromContext(context.TODO(), ctx), me.OnuGClassID, cmn.OnugMeID, requestedAttributes, oo.baseDeviceHandler.GetOmciTimeout(), true, oo.PMibUploadFsm.CommChan)
+ meInstance, err := oo.PDevOmciCC.SendGetMe(log.WithSpanFromContext(context.TODO(), ctx), me.OnuGClassID, cmn.OnugMeID, requestedAttributes,
+ oo.baseDeviceHandler.GetOmciTimeout(), true, oo.PMibUploadFsm.CommChan)
//accept also nil as (error) return value for writing to LastTx
// - this avoids misinterpretation of new received OMCI messages
if err != nil {
@@ -118,11 +140,12 @@
oo.mutexLastTxParamStruct.Unlock()
}
-func (oo *OnuDeviceEntry) enterGettingEquipmentIDState(ctx context.Context, e *fsm.Event) {
- logger.Debugw(ctx, "MibSync FSM", log.Fields{"Start getting EquipmentId in State": e.FSM.Current(), "device-id": oo.deviceID})
- requestedAttributes := me.AttributeValueMap{me.Onu2G_EquipmentId: ""}
+func (oo *OnuDeviceEntry) enterGettingEquipIDAndOmccVersState(ctx context.Context, e *fsm.Event) {
+ logger.Debugw(ctx, "MibSync FSM", log.Fields{"Start getting EquipmentId and OMCC version in State": e.FSM.Current(), "device-id": oo.deviceID})
+ requestedAttributes := me.AttributeValueMap{me.Onu2G_EquipmentId: "", me.Onu2G_OpticalNetworkUnitManagementAndControlChannelOmccVersion: 0}
oo.mutexLastTxParamStruct.Lock()
- meInstance, err := oo.PDevOmciCC.SendGetMe(log.WithSpanFromContext(context.TODO(), ctx), me.Onu2GClassID, cmn.Onu2gMeID, requestedAttributes, oo.baseDeviceHandler.GetOmciTimeout(), true, oo.PMibUploadFsm.CommChan)
+ meInstance, err := oo.PDevOmciCC.SendGetMe(log.WithSpanFromContext(context.TODO(), ctx), me.Onu2GClassID, cmn.Onu2gMeID, requestedAttributes,
+ oo.baseDeviceHandler.GetOmciTimeout(), true, oo.PMibUploadFsm.CommChan)
//accept also nil as (error) return value for writing to LastTx
// - this avoids misinterpretation of new received OMCI messages
if err != nil {
@@ -141,11 +164,44 @@
oo.mutexLastTxParamStruct.Unlock()
}
+func (oo *OnuDeviceEntry) enterTestingExtOmciSupportState(ctx context.Context, e *fsm.Event) {
+ logger.Debugw(ctx, "MibSync FSM", log.Fields{"Start testing extended OMCI msg in State": e.FSM.Current(), "device-id": oo.deviceID})
+ omciVerify := otst.NewOmciTestRequest(log.WithSpanFromContext(context.TODO(), ctx),
+ oo.deviceID, oo.PDevOmciCC, true, true, true)
+ verifyExec := make(chan bool)
+ omciVerify.PerformOmciTest(log.WithSpanFromContext(context.TODO(), ctx), verifyExec)
+
+ // If verification of test message in extended OMCI format fails, reset ONU capability to OMCI baseline format
+ select {
+ case <-time.After(((cmn.CDefaultRetries+1)*otst.CTestRequestOmciTimeout + 1) * time.Second):
+ logger.Warnw(ctx, "testing extended OMCI msg format timed out - reset to baseline format", log.Fields{"device-id": oo.deviceID})
+ oo.MutexPersOnuConfig.Lock()
+ oo.SOnuPersistentData.PersIsExtOmciSupported = false
+ oo.MutexPersOnuConfig.Unlock()
+ case success := <-verifyExec:
+ if success {
+ logger.Debugw(ctx, "testing extended OMCI msg format succeeded", log.Fields{"device-id": oo.deviceID})
+ } else {
+ logger.Warnw(ctx, "testing extended OMCI msg format failed - reset to baseline format", log.Fields{"device-id": oo.deviceID, "result": success})
+ oo.MutexPersOnuConfig.Lock()
+ oo.SOnuPersistentData.PersIsExtOmciSupported = false
+ oo.MutexPersOnuConfig.Unlock()
+ }
+ }
+ pMibUlFsm := oo.PMibUploadFsm
+ if pMibUlFsm != nil {
+ go func(a_pAFsm *cmn.AdapterFsm) {
+ _ = oo.PMibUploadFsm.PFsm.Event(UlEvGetFirstSwVersion)
+ }(pMibUlFsm)
+ }
+}
+
func (oo *OnuDeviceEntry) enterGettingFirstSwVersionState(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "MibSync FSM", log.Fields{"Start getting IsActive and Version of first SW-image in State": e.FSM.Current(), "device-id": oo.deviceID})
requestedAttributes := me.AttributeValueMap{me.SoftwareImage_IsCommitted: 0, me.SoftwareImage_IsActive: 0, me.SoftwareImage_Version: ""}
oo.mutexLastTxParamStruct.Lock()
- meInstance, err := oo.PDevOmciCC.SendGetMe(log.WithSpanFromContext(context.TODO(), ctx), me.SoftwareImageClassID, cmn.FirstSwImageMeID, requestedAttributes, oo.baseDeviceHandler.GetOmciTimeout(), true, oo.PMibUploadFsm.CommChan)
+ meInstance, err := oo.PDevOmciCC.SendGetMe(log.WithSpanFromContext(context.TODO(), ctx), me.SoftwareImageClassID, cmn.FirstSwImageMeID, requestedAttributes,
+ oo.baseDeviceHandler.GetOmciTimeout(), true, oo.PMibUploadFsm.CommChan)
//accept also nil as (error) return value for writing to LastTx
// - this avoids misinterpretation of new received OMCI messages
if err != nil {
@@ -168,7 +224,8 @@
logger.Debugw(ctx, "MibSync FSM", log.Fields{"Start getting IsActive and Version of second SW-image in State": e.FSM.Current(), "device-id": oo.deviceID})
requestedAttributes := me.AttributeValueMap{me.SoftwareImage_IsCommitted: 0, me.SoftwareImage_IsActive: 0, me.SoftwareImage_Version: ""}
oo.mutexLastTxParamStruct.Lock()
- meInstance, err := oo.PDevOmciCC.SendGetMe(log.WithSpanFromContext(context.TODO(), ctx), me.SoftwareImageClassID, cmn.SecondSwImageMeID, requestedAttributes, oo.baseDeviceHandler.GetOmciTimeout(), true, oo.PMibUploadFsm.CommChan)
+ meInstance, err := oo.PDevOmciCC.SendGetMe(log.WithSpanFromContext(context.TODO(), ctx), me.SoftwareImageClassID, cmn.SecondSwImageMeID, requestedAttributes,
+ oo.baseDeviceHandler.GetOmciTimeout(), true, oo.PMibUploadFsm.CommChan)
//accept also nil as (error) return value for writing to LastTx
// - this avoids misinterpretation of new received OMCI messages
if err != nil {
@@ -191,7 +248,8 @@
logger.Debugw(ctx, "MibSync FSM", log.Fields{"Start getting MacAddress in State": e.FSM.Current(), "device-id": oo.deviceID})
requestedAttributes := me.AttributeValueMap{me.IpHostConfigData_MacAddress: ""}
oo.mutexLastTxParamStruct.Lock()
- meInstance, err := oo.PDevOmciCC.SendGetMe(log.WithSpanFromContext(context.TODO(), ctx), me.IpHostConfigDataClassID, cmn.IPHostConfigDataMeID, requestedAttributes, oo.baseDeviceHandler.GetOmciTimeout(), true, oo.PMibUploadFsm.CommChan)
+ meInstance, err := oo.PDevOmciCC.SendGetMe(log.WithSpanFromContext(context.TODO(), ctx), me.IpHostConfigDataClassID, cmn.IPHostConfigDataMeID, requestedAttributes,
+ oo.baseDeviceHandler.GetOmciTimeout(), true, oo.PMibUploadFsm.CommChan)
//accept also nil as (error) return value for writing to LastTx
// - this avoids misinterpretation of new received OMCI messages
if err != nil {
@@ -605,7 +663,8 @@
logger.Warnw(ctx, "unknown attributes detected for", log.Fields{"device-id": oo.deviceID,
"Me-ClassId": unknownAttrClassID, "Me-InstId": unknownAttrInst, "unknown mask": unknownAttrMask,
"unknown attributes": unknownAttrBlob})
- oo.pOnuDB.PutUnknownMeOrAttrib(ctx, devdb.CUnknownAttributesManagedEntity, unknown.EntityClass, unknown.EntityInstance, unknown.AttributeMask, unknown.AttributeData)
+ oo.pOnuDB.PutUnknownMeOrAttrib(ctx, devdb.CUnknownAttributesManagedEntity, unknown.EntityClass, unknown.EntityInstance,
+ unknown.AttributeMask, unknown.AttributeData)
} // for all included ME's with unknown attributes
} else {
logger.Errorw(ctx, "unknownAttrLayer could not be decoded", log.Fields{"device-id": oo.deviceID})
@@ -729,7 +788,7 @@
return fmt.Errorf("mibSync FSM - mandatory attribute SerialNumber not present in OnuG instance - handling of MibSyncChan stopped: %s", oo.deviceID)
}
// trigger retrieval of EquipmentId
- _ = oo.PMibUploadFsm.PFsm.Event(UlEvGetEquipmentID)
+ _ = oo.PMibUploadFsm.PFsm.Event(UlEvGetEquipIDAndOmcc)
return nil
case "Onu2G":
oo.mutexLastTxParamStruct.RUnlock()
@@ -750,6 +809,34 @@
"onuDeviceEntry.equipmentID": oo.SOnuPersistentData.PersEquipmentID})
oo.MutexPersOnuConfig.Unlock()
+ var omccVersion uint8
+ if onu2GOmccVersion, ok := meAttributes[me.Onu2G_OpticalNetworkUnitManagementAndControlChannelOmccVersion]; ok {
+ oo.MutexPersOnuConfig.Lock()
+ omccVersion = onu2GOmccVersion.(uint8)
+ if _, ok := omccVersionSupportsExtendedOmciFormat[omccVersion]; ok {
+ oo.SOnuPersistentData.PersIsExtOmciSupported = omccVersionSupportsExtendedOmciFormat[omccVersion]
+ } else {
+ logger.Infow(ctx, "MibSync FSM - unknown OMCC version in Onu2G instance - disable extended OMCI support",
+ log.Fields{"device-id": oo.deviceID})
+ oo.SOnuPersistentData.PersIsExtOmciSupported = false
+ }
+ logger.Debugw(ctx, "MibSync FSM - GetResponse Data for Onu2-G - OMCC version", log.Fields{"device-id": oo.deviceID,
+ "omccVersion": omccVersion, "isExtOmciSupported": oo.SOnuPersistentData.PersIsExtOmciSupported})
+ oo.MutexPersOnuConfig.Unlock()
+ } else {
+ logger.Errorw(ctx, "MibSync FSM - mandatory attribute OMCC version not present in Onu2G instance - handling of MibSyncChan stopped!",
+ log.Fields{"device-id": oo.deviceID})
+ _ = oo.PMibUploadFsm.PFsm.Event(UlEvStop)
+ return fmt.Errorf("mibSync FSM - mandatory attribute OMCC version not present in Onu2G instance - handling of MibSyncChan stopped: %s", oo.deviceID)
+ }
+ oo.MutexPersOnuConfig.RLock()
+ if oo.SOnuPersistentData.PersIsExtOmciSupported {
+ oo.MutexPersOnuConfig.RUnlock()
+ // trigger test of OMCI extended msg format
+ _ = oo.PMibUploadFsm.PFsm.Event(UlEvTestExtOmciSupport)
+ return nil
+ }
+ oo.MutexPersOnuConfig.RUnlock()
// trigger retrieval of 1st SW-image info
_ = oo.PMibUploadFsm.PFsm.Event(UlEvGetFirstSwVersion)
return nil
diff --git a/internal/pkg/mib/onu_device_entry.go b/internal/pkg/mib/onu_device_entry.go
index 9014283..51f1cd3 100755
--- a/internal/pkg/mib/onu_device_entry.go
+++ b/internal/pkg/mib/onu_device_entry.go
@@ -48,7 +48,8 @@
UlEvStart = "UlEvStart"
UlEvResetMib = "UlEvResetMib"
UlEvGetVendorAndSerial = "UlEvGetVendorAndSerial"
- UlEvGetEquipmentID = "UlEvGetEquipmentId"
+ UlEvGetEquipIDAndOmcc = "UlEvGetEquipIDAndOmcc"
+ UlEvTestExtOmciSupport = "UlEvTestExtOmciSupport"
UlEvGetFirstSwVersion = "UlEvGetFirstSwVersion"
UlEvGetSecondSwVersion = "UlEvGetSecondSwVersion"
UlEvGetMacAddress = "UlEvGetMacAddress"
@@ -71,7 +72,8 @@
UlStStarting = "UlStStarting"
UlStResettingMib = "UlStResettingMib"
UlStGettingVendorAndSerial = "UlStGettingVendorAndSerial"
- UlStGettingEquipmentID = "UlStGettingEquipmentID"
+ UlStGettingEquipIDAndOmcc = "UlStGettingEquipIDAndOmcc"
+ UlStTestingExtOmciSupport = "UlStTestingExtOmciSupport"
UlStGettingFirstSwVersion = "UlStGettingFirstSwVersion"
UlStGettingSecondSwVersion = "UlStGettingSecondSwVersion"
UlStGettingMacAddress = "UlStGettingMacAddress"
@@ -143,6 +145,7 @@
PersMacAddress string `json:"mac_address"`
PersVendorID string `json:"vendor_id"`
PersEquipmentID string `json:"equipment_id"`
+ PersIsExtOmciSupported bool `json:"is_ext_omci_supported"`
PersActiveSwVersion string `json:"active_sw_version"`
PersAdminState string `json:"admin_state"`
PersOperState string `json:"oper_state"`
@@ -292,8 +295,9 @@
{Name: UlEvResetMib, Src: []string{UlStStarting}, Dst: UlStResettingMib},
{Name: UlEvGetVendorAndSerial, Src: []string{UlStResettingMib}, Dst: UlStGettingVendorAndSerial},
- {Name: UlEvGetEquipmentID, Src: []string{UlStGettingVendorAndSerial}, Dst: UlStGettingEquipmentID},
- {Name: UlEvGetFirstSwVersion, Src: []string{UlStGettingEquipmentID}, Dst: UlStGettingFirstSwVersion},
+ {Name: UlEvGetEquipIDAndOmcc, Src: []string{UlStGettingVendorAndSerial}, Dst: UlStGettingEquipIDAndOmcc},
+ {Name: UlEvTestExtOmciSupport, Src: []string{UlStGettingEquipIDAndOmcc}, Dst: UlStTestingExtOmciSupport},
+ {Name: UlEvGetFirstSwVersion, Src: []string{UlStGettingEquipIDAndOmcc, UlStTestingExtOmciSupport}, Dst: UlStGettingFirstSwVersion},
{Name: UlEvGetSecondSwVersion, Src: []string{UlStGettingFirstSwVersion}, Dst: UlStGettingSecondSwVersion},
{Name: UlEvGetMacAddress, Src: []string{UlStGettingSecondSwVersion}, Dst: UlStGettingMacAddress},
{Name: UlEvGetMibTemplate, Src: []string{UlStGettingMacAddress}, Dst: UlStGettingMibTemplate},
@@ -333,13 +337,13 @@
{Name: UlEvSuccess, Src: []string{UlStResynchronizing}, Dst: UlStInSync},
{Name: UlEvDiffsFound, Src: []string{UlStResynchronizing}, Dst: UlStOutOfSync},
- {Name: UlEvTimeout, Src: []string{UlStResettingMib, UlStGettingVendorAndSerial, UlStGettingEquipmentID, UlStGettingFirstSwVersion,
- UlStGettingSecondSwVersion, UlStGettingMacAddress, UlStGettingMibTemplate, UlStUploading, UlStResynchronizing, UlStVerifyingAndStoringTPs,
- UlStExaminingMds, UlStUploadDone, UlStInSync, UlStOutOfSync, UlStAuditing, UlStReAuditing}, Dst: UlStStarting},
+ {Name: UlEvTimeout, Src: []string{UlStResettingMib, UlStGettingVendorAndSerial, UlStGettingEquipIDAndOmcc, UlStTestingExtOmciSupport,
+ UlStGettingFirstSwVersion, UlStGettingSecondSwVersion, UlStGettingMacAddress, UlStGettingMibTemplate, UlStUploading, UlStResynchronizing,
+ UlStVerifyingAndStoringTPs, UlStExaminingMds, UlStUploadDone, UlStInSync, UlStOutOfSync, UlStAuditing, UlStReAuditing}, Dst: UlStStarting},
- {Name: UlEvStop, Src: []string{UlStStarting, UlStResettingMib, UlStGettingVendorAndSerial, UlStGettingEquipmentID, UlStGettingFirstSwVersion,
- UlStGettingSecondSwVersion, UlStGettingMacAddress, UlStGettingMibTemplate, UlStUploading, UlStResynchronizing, UlStVerifyingAndStoringTPs,
- UlStExaminingMds, UlStUploadDone, UlStInSync, UlStOutOfSync, UlStAuditing, UlStReAuditing}, Dst: UlStDisabled},
+ {Name: UlEvStop, Src: []string{UlStStarting, UlStResettingMib, UlStGettingVendorAndSerial, UlStGettingEquipIDAndOmcc, UlStTestingExtOmciSupport,
+ UlStGettingFirstSwVersion, UlStGettingSecondSwVersion, UlStGettingMacAddress, UlStGettingMibTemplate, UlStUploading, UlStResynchronizing,
+ UlStVerifyingAndStoringTPs, UlStExaminingMds, UlStUploadDone, UlStInSync, UlStOutOfSync, UlStAuditing, UlStReAuditing}, Dst: UlStDisabled},
},
fsm.Callbacks{
@@ -347,7 +351,8 @@
"enter_" + UlStStarting: func(e *fsm.Event) { onuDeviceEntry.enterStartingState(ctx, e) },
"enter_" + UlStResettingMib: func(e *fsm.Event) { onuDeviceEntry.enterResettingMibState(ctx, e) },
"enter_" + UlStGettingVendorAndSerial: func(e *fsm.Event) { onuDeviceEntry.enterGettingVendorAndSerialState(ctx, e) },
- "enter_" + UlStGettingEquipmentID: func(e *fsm.Event) { onuDeviceEntry.enterGettingEquipmentIDState(ctx, e) },
+ "enter_" + UlStGettingEquipIDAndOmcc: func(e *fsm.Event) { onuDeviceEntry.enterGettingEquipIDAndOmccVersState(ctx, e) },
+ "enter_" + UlStTestingExtOmciSupport: func(e *fsm.Event) { onuDeviceEntry.enterTestingExtOmciSupportState(ctx, e) },
"enter_" + UlStGettingFirstSwVersion: func(e *fsm.Event) { onuDeviceEntry.enterGettingFirstSwVersionState(ctx, e) },
"enter_" + UlStGettingSecondSwVersion: func(e *fsm.Event) { onuDeviceEntry.enterGettingSecondSwVersionState(ctx, e) },
"enter_" + UlStGettingMacAddress: func(e *fsm.Event) { onuDeviceEntry.enterGettingMacAddressState(ctx, e) },
@@ -533,7 +538,7 @@
oo.MutexPersOnuConfig.Lock()
defer oo.MutexPersOnuConfig.Unlock()
oo.SOnuPersistentData =
- onuPersistentData{0, 0, "", "", "", "", "", "", "", false, false, oo.mibAuditInterval, 0, 0, make([]uniPersConfig, 0), oo.alarmAuditInterval, make(map[uint16]uint16)}
+ onuPersistentData{0, 0, "", "", "", "", false, "", "", "", false, false, oo.mibAuditInterval, 0, 0, make([]uniPersConfig, 0), oo.alarmAuditInterval, make(map[uint16]uint16)}
oo.mutexOnuKVStore.RLock()
Value, err := oo.onuKVStore.Get(ctx, oo.onuKVStorePath)
oo.mutexOnuKVStore.RUnlock()
@@ -588,7 +593,7 @@
oo.SOnuPersistentData.PersUniConfig = nil //releasing all UniConfig entries to garbage collector default entry
oo.SOnuPersistentData =
- onuPersistentData{0, 0, "", "", "", "", "", "", "", false, false, oo.mibAuditInterval, 0, 0, make([]uniPersConfig, 0), oo.alarmAuditInterval, make(map[uint16]uint16)}
+ onuPersistentData{0, 0, "", "", "", "", false, "", "", "", false, false, oo.mibAuditInterval, 0, 0, make([]uniPersConfig, 0), oo.alarmAuditInterval, make(map[uint16]uint16)}
logger.Debugw(ctx, "delete ONU-data from KVStore", log.Fields{"device-id": oo.deviceID})
oo.mutexOnuKVStore.Lock()
err := oo.onuKVStore.Delete(ctx, oo.onuKVStorePath)
diff --git a/internal/pkg/omcitst/omci_test_request.go b/internal/pkg/omcitst/omci_test_request.go
index 9f802a4..9dac298 100755
--- a/internal/pkg/omcitst/omci_test_request.go
+++ b/internal/pkg/omcitst/omci_test_request.go
@@ -19,20 +19,23 @@
import (
"context"
+ "encoding/hex"
"fmt"
gp "github.com/google/gopacket"
"github.com/opencord/omci-lib-go/v2"
me "github.com/opencord/omci-lib-go/v2/generated"
- cmn "github.com/opencord/voltha-openonu-adapter-go/internal/pkg/common"
-
+ "github.com/opencord/omci-lib-go/v2/meframe"
+ oframe "github.com/opencord/omci-lib-go/v2/meframe"
"github.com/opencord/voltha-lib-go/v7/pkg/log"
+ cmn "github.com/opencord/voltha-openonu-adapter-go/internal/pkg/common"
)
//OmciTestRequest structure holds the information for the OMCI test
type OmciTestRequest struct {
deviceID string
pDevOmciCC *cmn.OmciCC
+ extended bool
started bool
result bool
exclusiveCc bool
@@ -41,14 +44,18 @@
verifyDone chan<- bool
}
+// CTestRequestOmciTimeout - Special OMCI timeout for low prio test request
+const CTestRequestOmciTimeout = 5
+
//NewOmciTestRequest returns a new instance of OmciTestRequest
func NewOmciTestRequest(ctx context.Context,
- deviceID string, omciCc *cmn.OmciCC,
+ deviceID string, omciCc *cmn.OmciCC, extended bool,
exclusive bool, allowFailure bool) *OmciTestRequest {
logger.Debug(ctx, "OmciTestRequest-init")
var OmciTestRequest OmciTestRequest
OmciTestRequest.deviceID = deviceID
OmciTestRequest.pDevOmciCC = omciCc
+ OmciTestRequest.extended = extended
OmciTestRequest.started = false
OmciTestRequest.result = false
OmciTestRequest.exclusiveCc = exclusive
@@ -66,7 +73,7 @@
// test functionality is limited to ONU-2G get request for the moment
// without yet checking the received response automatically here (might be improved ??)
tid := oo.pDevOmciCC.GetNextTid(false)
- onu2gBaseGet, _ := oo.createOnu2gBaseGet(ctx, tid)
+ onu2gGet, _ := oo.createOnu2gGet(ctx, tid)
omciRxCallbackPair := cmn.CallbackPair{
CbKey: tid,
CbEntry: cmn.CallbackPairEntry{
@@ -75,11 +82,10 @@
FramePrint: true,
},
}
-
- logger.Debugw(ctx, "performOmciTest-start sending frame", log.Fields{"for device-id": oo.deviceID})
+ logger.Debugw(ctx, "performOmciTest-start sending frame", log.Fields{"for device-id": oo.deviceID, "onu2gGet": hex.EncodeToString(onu2gGet)})
// send with default timeout and normal prio
// Note: No reference to fetch the OMCI timeout value from configuration, so hardcode it to 10s
- go oo.pDevOmciCC.Send(ctx, onu2gBaseGet, 10, cmn.CDefaultRetries, false, omciRxCallbackPair)
+ go oo.pDevOmciCC.Send(ctx, onu2gGet, CTestRequestOmciTimeout, cmn.CDefaultRetries, false, omciRxCallbackPair)
} else {
logger.Errorw(ctx, "performOmciTest: Device does not exist", log.Fields{"for device-id": oo.deviceID})
@@ -89,26 +95,40 @@
// these are OMCI related functions, could/should be collected in a separate file? TODO!!!
// for a simple start just included in here
//basic approach copied from bbsim, cmp /devices/onu.go and /internal/common/omci/mibpackets.go
-func (oo *OmciTestRequest) createOnu2gBaseGet(ctx context.Context, tid uint16) ([]byte, error) {
+func (oo *OmciTestRequest) createOnu2gGet(ctx context.Context, tid uint16) ([]byte, error) {
- request := &omci.GetRequest{
- MeBasePacket: omci.MeBasePacket{
- EntityClass: me.Onu2GClassID,
- EntityInstance: 0, //there is only the 0 instance of ONU2-G (still hard-coded - TODO!!!)
- },
- AttributeMask: 0xE000, //example hardcoded (TODO!!!) request EquId, OmccVersion, VendorCode
+ meParams := me.ParamData{
+ EntityID: 0,
+ Attributes: me.AttributeValueMap{
+ me.Onu2G_EquipmentId: "",
+ me.Onu2G_OpticalNetworkUnitManagementAndControlChannelOmccVersion: 0},
}
+ meInstance, omciErr := me.NewOnu2G(meParams)
+ if omciErr.GetError() == nil {
+ var messageSet omci.DeviceIdent = omci.BaselineIdent
+ if oo.extended {
+ messageSet = omci.ExtendedIdent
+ }
+ omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.GetRequestType, oframe.TransactionID(tid),
+ meframe.FrameFormat(messageSet))
+ if err != nil {
+ logger.Errorw(ctx, "Cannot encode ONU2-G instance for get", log.Fields{
+ "Err": err, "device-id": oo.deviceID})
+ return nil, err
+ }
+ oo.txSeqNo = tid
- oo.txSeqNo = tid
- pkt, err := cmn.Serialize(ctx, omci.GetRequestType, request, tid)
- if err != nil {
- //omciLogger.WithFields(log.Fields{ ...
- logger.Errorw(ctx, "Cannot serialize Onu2-G GetRequest", log.Fields{"device-id": oo.deviceID, "Err": err})
- return nil, err
+ pkt, err := cmn.SerializeOmciLayer(ctx, omciLayer, msgLayer)
+ if err != nil {
+ logger.Errorw(ctx, "Cannot serialize ONU2-G get", log.Fields{
+ "Err": err, "device-id": oo.deviceID})
+ return nil, err
+ }
+ return pkt, nil
}
- // hexEncode would probably work as well, but not needed and leads to wrong logs on OltAdapter frame
- // return hexEncode(pkt)
- return pkt, nil
+ logger.Errorw(ctx, "Cannot generate ONU2-G", log.Fields{
+ "Err": omciErr.GetError(), "device-id": oo.deviceID})
+ return nil, omciErr.GetError()
}
//ReceiveOmciVerifyResponse supply a response handler - in this testobject the message is evaluated directly, no response channel used
@@ -133,6 +153,16 @@
oo.verifyDone <- false
return fmt.Errorf("unexpected MessageType %s", oo.deviceID)
}
+ if oo.extended {
+ if omciMsg.DeviceIdentifier == omci.ExtendedIdent {
+ logger.Debugw(ctx, "verify-omci-message-response", log.Fields{"correct DeviceIdentifier": omciMsg.DeviceIdentifier})
+ } else {
+ logger.Debugw(ctx, "verify-omci-message-response error", log.Fields{"incorrect DeviceIdentifier": omciMsg.DeviceIdentifier,
+ "expected": omci.ExtendedIdent})
+ oo.verifyDone <- false
+ return fmt.Errorf("unexpected DeviceIdentifier %s", oo.deviceID)
+ }
+ }
//TODO!!! further tests on the payload should be done here ...