VOL-4059 If multicast gem configuring for one UNI, the already created Multicast GEM and its InterworkingTP shouldn’t be created again.
Change-Id: I9574fb0f08053e441e7a60157f078a1ad3287b2a
diff --git a/VERSION b/VERSION
index 1413d09..c737875 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.3.2-dev208
+1.3.2-dev209
diff --git a/internal/pkg/onuadaptercore/device_handler.go b/internal/pkg/onuadaptercore/device_handler.go
index 1a541c7..96e0ca7 100644
--- a/internal/pkg/onuadaptercore/device_handler.go
+++ b/internal/pkg/onuadaptercore/device_handler.go
@@ -3185,6 +3185,7 @@
}
// getUniPortMEEntityID takes uniPortNo as the input and returns the Entity ID corresponding to this UNI-G ME Instance
+// nolint: unused
func (dh *deviceHandler) getUniPortMEEntityID(uniPortNo uint32) (uint16, error) {
dh.lockDevice.RLock()
defer dh.lockDevice.RUnlock()
diff --git a/internal/pkg/onuadaptercore/omci_ani_config.go b/internal/pkg/onuadaptercore/omci_ani_config.go
index 5701985..b6ca5e4 100644
--- a/internal/pkg/onuadaptercore/omci_ani_config.go
+++ b/internal/pkg/onuadaptercore/omci_ani_config.go
@@ -1323,7 +1323,7 @@
{
oFsm.handleOmciAniConfigDeleteResponseMessage(ctx, msg)
- } //SetResponseType
+ } //DeleteResponseType
default:
{
logger.Errorw(ctx, "uniPonAniConfigFsm - Rx OMCI unhandled MsgType",
@@ -1384,6 +1384,15 @@
logger.Debugw(ctx, "GemNWCtp create loop finished", log.Fields{"device-id": oFsm.deviceID})
_ = oFsm.pAdaptFsm.pFsm.Event(aniEvRxGemntcpsResp)
}
+func (oFsm *uniPonAniConfigFsm) hasMulticastGem(ctx context.Context) bool {
+ for _, gemPortAttribs := range oFsm.gemPortAttribsSlice {
+ if gemPortAttribs.isMulticast {
+ logger.Debugw(ctx, "Found multicast gem", log.Fields{"device-id": oFsm.deviceID})
+ return true
+ }
+ }
+ return false
+}
func (oFsm *uniPonAniConfigFsm) performCreatingGemIWs(ctx context.Context) {
// for all GemPorts of this T-Cont as given by the size of set gemPortAttribsSlice
@@ -1405,6 +1414,10 @@
"GalProfilePointer": galEthernetEID,
},
}
+ if oFsm.pUniTechProf.multicastConfiguredForOtherUniTps(ctx, oFsm.uniTpKey) {
+ logger.Debugw(ctx, "MulticastGemInterworkingTP already exist", log.Fields{"device-id": oFsm.deviceID, "multicast-gem-id": gemPortAttribs.multicastGemID})
+ continue
+ }
oFsm.mutexPLastTxMeInstance.Lock()
meInstance, err := oFsm.pOmciCC.sendCreateMulticastGemIWTPVar(context.TODO(), oFsm.pDeviceHandler.pOpenOnuAc.omciTimeout,
true, oFsm.pAdaptFsm.commChan, meParams)
diff --git a/internal/pkg/onuadaptercore/omci_vlan_config.go b/internal/pkg/onuadaptercore/omci_vlan_config.go
index dcc0f05..5c2a0c9 100644
--- a/internal/pkg/onuadaptercore/omci_vlan_config.go
+++ b/internal/pkg/onuadaptercore/omci_vlan_config.go
@@ -2747,13 +2747,12 @@
}
func (oFsm *UniVlanConfigFsm) performCreatingMulticastOperationProfile(ctx context.Context) error {
- instID, err := oFsm.pDeviceHandler.getUniPortMEEntityID(oFsm.pOnuUniPort.portNo)
+ instID, err := generateUNISideMBPCDEID(uint16(oFsm.pOnuUniPort.macBpNo))
if err != nil {
- logger.Errorw(ctx, "error fetching uni port me instance",
- log.Fields{"device-id": oFsm.deviceID, "portNo": oFsm.pOnuUniPort.portNo})
+ logger.Errorw(ctx, "error generating me instance id",
+ log.Fields{"device-id": oFsm.deviceID, "error": err})
return err
}
- instID += macBridgePortAniBaseEID
logger.Debugw(ctx, "UniVlanConfigFsm create MulticastOperationProfile",
log.Fields{"device-id": oFsm.deviceID, "EntityId": instID})
meParams := me.ParamData{
@@ -2798,13 +2797,12 @@
}
func (oFsm *UniVlanConfigFsm) performSettingMulticastOperationProfile(ctx context.Context, multicastGemPortID uint16, vlanID uint32) error {
- instID, err := oFsm.pDeviceHandler.getUniPortMEEntityID(oFsm.pOnuUniPort.portNo)
+ instID, err := generateUNISideMBPCDEID(uint16(oFsm.pOnuUniPort.macBpNo))
if err != nil {
- logger.Errorw(ctx, "error fetching uni port me instance",
- log.Fields{"device-id": oFsm.deviceID, "portNo": oFsm.pOnuUniPort.portNo})
+ logger.Errorw(ctx, "error generating me instance id",
+ log.Fields{"device-id": oFsm.deviceID, "error": err})
return err
}
- instID += macBridgePortAniBaseEID
logger.Debugw(ctx, "UniVlanConfigFsm set MulticastOperationProfile",
log.Fields{"device-id": oFsm.deviceID, "EntityId": instID})
//TODO check that this is correct
diff --git a/internal/pkg/onuadaptercore/onu_uni_tp.go b/internal/pkg/onuadaptercore/onu_uni_tp.go
index af0fdbe..dff13d4 100644
--- a/internal/pkg/onuadaptercore/onu_uni_tp.go
+++ b/internal/pkg/onuadaptercore/onu_uni_tp.go
@@ -110,6 +110,18 @@
mapRemoveGemEntry map[uniTP]*gemPortParamStruct //per UNI: pointer to GemEntry to be removed
}
+func (onuTP *onuUniTechProf) multicastConfiguredForOtherUniTps(ctx context.Context, uniTpKey uniTP) bool {
+ for _, aniFsm := range onuTP.pAniConfigFsm {
+ if aniFsm.uniTpKey.uniID == uniTpKey.uniID && aniFsm.uniTpKey.tpID == uniTpKey.tpID {
+ continue
+ }
+ if aniFsm.hasMulticastGem(ctx) {
+ return true
+ }
+ }
+ return false
+}
+
//newOnuUniTechProf returns the instance of a OnuUniTechProf
//(one instance per ONU/deviceHandler for all possible UNI's)
func newOnuUniTechProf(ctx context.Context, aDeviceHandler *deviceHandler) *onuUniTechProf {