Change GetGemPortId() for unsupported GEMPortNetworkCTP
Change-Id: I0c9ef4ca454c16c854179da08120e0f1b080d4cf
diff --git a/omci_state.go b/omci_state.go
index 09b300e..23b0121 100644
--- a/omci_state.go
+++ b/omci_state.go
@@ -63,6 +63,10 @@
func GetGemPortId(intfId uint32, onuId uint32) (uint16, error) {
key := OnuKey{intfId, onuId}
if OnuOmciState, ok := OnuOmciStateMap[key]; ok {
+ if OnuOmciState.state != DONE {
+ errmsg := fmt.Sprintf("ONU {intfid:%d, onuid:%d} - Not DONE (GemportID is not set)", intfId, onuId)
+ return 0, errors.New(errmsg)
+ }
return OnuOmciState.gemPortId, nil
}
errmsg := fmt.Sprintf("ONU {intfid:%d, onuid:%d} - Failed to find a key in OnuOmciStateMap", intfId, onuId)