Commit aac10688 authored by Simon Pastor's avatar Simon Pastor
Browse files

cell change only in HO, assoc Id to all RNIS notifications, rnis rab_est,...

cell change only in HO, assoc Id to all RNIS notifications, rnis rab_est, rab_rel notifications opon changing poa type, cell_change notification upon same poa type
parent f82d535b
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -263,8 +263,18 @@ func getNetworkLocation(name string) (zone string, netLoc string, err error) {
		err = errors.New("Error casting context for: " + name)
		return
	}
	if sbi.activeModel.GetNodeType(name) == mod.NodeTypeUE {
		if sbi.activeModel.GetNodeType(nodeCtx.Parents[mod.NetLoc]) == mod.NodeTypePoaCell { 
			zone = nodeCtx.Parents[mod.Zone]
			netLoc = nodeCtx.Parents[mod.NetLoc]
		} else {
			zone = ""
			netLoc = ""
		}
	} else {
		zone = nodeCtx.Parents[mod.Zone]
                netLoc = nodeCtx.Parents[mod.NetLoc]
	}
	return zone, netLoc, nil
}

+25 −18
Original line number Diff line number Diff line
@@ -336,20 +336,24 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn
					zoneStatusNotif.NumberOfUsersInZone = (int32)(nbUsersInZone)
				}
				zoneStatusNotif.Timestamp = time.Now()
				go sendStatusNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zoneStatusNotif)
				sendStatusNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zoneStatusNotif)
				if apWarning {
					log.Info("Zone Status Notification" + "(" + subsIdStr + "): " + "For event in zone " + zoneId + " which has " + nbUsersInAPStr + " users in AP " + apId)
				} else {
					log.Info("Zone Status Notification" + "(" + subsIdStr + "): " + "For event in zone " + zoneId + " which has " + nbUsersInZoneStr + " users in total")
				}
			}

		}
	}
}

func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApId string, newApId string, userId string) {

	//if a zone is null, means going in/out of the 3gpp network, so no notification
	if newZoneId == "" || oldZoneId == "" {
		return
	}

	//check all that applies
	for subsId, value := range userSubscriptionMap {
		if value == userId {
@@ -369,26 +373,24 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI
			zonal.CallbackData = subscription.ClientCorrelator

			if newZoneId != oldZoneId {
				if userSubscriptionEnteringMap[subsId] != "" && newZoneId != "" {
				if userSubscriptionEnteringMap[subsId] != "" {
					zonal.ZoneId = newZoneId
					zonal.CurrentAccessPointId = newApId
					event := new(clientNotifOMA.UserEventType)
					*event = clientNotifOMA.ENTERING_UserEventType
					zonal.UserEventType = event
					go sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal)
					sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal)
					log.Info("User Notification" + "(" + subsIdStr + "): " + "Entering event in zone " + newZoneId + " for user " + userId)
				}
				if oldZoneId != "" {
				if userSubscriptionLeavingMap[subsId] != "" {
					zonal.ZoneId = oldZoneId
					zonal.CurrentAccessPointId = oldApId
					event := new(clientNotifOMA.UserEventType)
					*event = clientNotifOMA.LEAVING_UserEventType
					zonal.UserEventType = event
						go sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal)
					sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal)
					log.Info("User Notification" + "(" + subsIdStr + "): " + "Leaving event in zone " + oldZoneId + " for user " + userId)
				}
				}
			} else {
				if newApId != oldApId {
					if userSubscriptionTransferringMap[subsId] != "" {
@@ -398,7 +400,7 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI
						event := new(clientNotifOMA.UserEventType)
						*event = clientNotifOMA.TRANSFERRING_UserEventType
						zonal.UserEventType = event
						go sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal)
						sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal)
						log.Info("User Notification" + "(" + subsIdStr + "): " + " Transferring event within zone " + newZoneId + " for user " + userId + " from Ap " + oldApId + " to " + newApId)
					}
				}
@@ -455,6 +457,11 @@ func sendStatusNotification(notifyUrl string, ctx context.Context, subscriptionI

func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApId string, newApId string, userId string) {

	//if a zone is null, means going in/out of the 3gpp network, so no notification
	if newZoneId == "" || oldZoneId == "" {
		return
	}

	//check all that applies
	for subsId, value := range zonalSubscriptionMap {

@@ -478,7 +485,7 @@ func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApI
						zonal.UserEventType = event
						zonal.Timestamp = time.Now()
						zonal.CallbackData = subscription.ClientCorrelator
						go sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal)
						sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal)
						log.Info("Zonal Notify Entering event in zone " + newZoneId + " for user " + userId)
					}
				}
@@ -501,7 +508,7 @@ func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApI
							zonal.UserEventType = event
							zonal.Timestamp = time.Now()
							zonal.CallbackData = subscription.ClientCorrelator
							go sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal)
							sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal)
							log.Info("Zonal Notify Transferring event in zone " + newZoneId + " for user " + userId + " from Ap " + oldApId + " to " + newApId)
						}
					}
@@ -526,7 +533,7 @@ func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApI
						zonal.UserEventType = event
						zonal.Timestamp = time.Now()
						zonal.CallbackData = subscription.ClientCorrelator
						go sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal)
						sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal)
						log.Info("Zonal Notify Leaving event in zone " + oldZoneId + " for user " + userId)
					}
				}
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ const testScenario string = `
			{
				"id": "4da82f2d-1f44-4945-8fe7-00c0431ef8c7",
				"name": "operator-cell1",
				"type": "OPERATOR-CELL",
				"type": "OPERATOR-CELLULAR",
				"interZoneLatency": 6,
				"interZoneLatencyVariation": 2,
				"interZoneThroughput": 1000,
+43 −12
Original line number Diff line number Diff line
@@ -228,7 +228,7 @@ func updateUeData(name string, mnc string, mcc string, cellId string, erabId int

		_ = rc.JSONSetEntry(baseKey+"UE:"+name, ".", convertUeDataToJson(&ueData))
		assocId := new(AssociateId)
		assocId.Type_ = "UE_IPv4_ADDRESS"
		assocId.Type_ = "UE_IPV4_ADDRESS"
		assocId.Value = name

		//log to model for all apps on that UE
@@ -312,7 +312,7 @@ func checkForExpiredSubscriptions() {
					notif.Timestamp = &timeStamp
					notif.ExpiryDeadline = &expiryTimeStamp

					go sendExpiryNotification(link.Self, context.TODO(), subsIdStr, notif)
					sendExpiryNotification(link.Self, context.TODO(), subsIdStr, notif)
					_ = delSubscription(baseKey+cellChangeSubscriptionType, subsIdStr)
				}
			}
@@ -410,6 +410,11 @@ func repopulateRrSubscriptionMap(key string, jsonInfo string, userData interface

func checkCcNotificationRegisteredSubscriptions(appId string, assocId *AssociateId, newPlmn *Plmn, oldPlmn *Plmn, hoStatus string, newCellId string, oldCellId string) {

	//no cell change if no cellIds present (cell change within 3gpp elements only)
	if newCellId == "" || oldCellId == "" {
		return
	}

	//check all that applies
	for subsId, sub := range ccSubscriptionMap {

@@ -497,6 +502,10 @@ func checkCcNotificationRegisteredSubscriptions(appId string, assocId *Associate
				oldEcgi.Plmn = &notifOldPlmn
				oldEcgi.CellId = []string{oldCellId}

				var notifAssociateId clientNotif.AssociateId
				notifAssociateId.Type_ = assocId.Type_
				notifAssociateId.Value = assocId.Value

				seconds := time.Now().Unix()
				var timeStamp clientNotif.TimeStamp
				timeStamp.Seconds = int32(seconds)
@@ -506,8 +515,9 @@ func checkCcNotificationRegisteredSubscriptions(appId string, assocId *Associate
				notif.HoStatus = &notifHoStatus
				notif.SrcEcgi = &oldEcgi
				notif.TrgEcgi = []clientNotif.Ecgi{newEcgi}
				notif.AssociateId = &notifAssociateId

				go sendCcNotification(subscription.CallbackReference, context.TODO(), subsIdStr, notif)
				sendCcNotification(subscription.CallbackReference, context.TODO(), subsIdStr, notif)
				log.Info("Cell_change Notification" + "(" + subsIdStr + ")")
			}
		}
@@ -516,6 +526,11 @@ func checkCcNotificationRegisteredSubscriptions(appId string, assocId *Associate

func checkReNotificationRegisteredSubscriptions(appId string, assocId *AssociateId, newPlmn *Plmn, oldPlmn *Plmn, qci int32, newCellId string, oldCellId string, erabId int32) {

	//only applies if coming from a non 3gpp element
	if oldCellId != "" || newCellId == "" {
		return
	}

	//check all that applies
	for subsId, sub := range reSubscriptionMap {

@@ -534,7 +549,7 @@ func checkReNotificationRegisteredSubscriptions(appId string, assocId *Associate
				match = false
			}

			if match && (((sub.FilterCriteria.Plmn == nil) || (sub.FilterCriteria.Plmn != nil && (newPlmn != nil && newPlmn.Mnc == sub.FilterCriteria.Plmn.Mnc && newPlmn.Mcc == sub.FilterCriteria.Plmn.Mcc))) && (oldPlmn == nil || oldCellId == "")) {
			if match && (((sub.FilterCriteria.Plmn == nil) || (sub.FilterCriteria.Plmn != nil && (newPlmn != nil && newPlmn.Mnc == sub.FilterCriteria.Plmn.Mnc && newPlmn.Mcc == sub.FilterCriteria.Plmn.Mcc)))) {
				match = true
			} else {
				match = false
@@ -585,6 +600,10 @@ func checkReNotificationRegisteredSubscriptions(appId string, assocId *Associate
				var erabQos clientNotif.ErabQosParameters
				erabQos.Qci = defaultSupportedQci

				var notifAssociateId clientNotif.AssociateId
				notifAssociateId.Type_ = assocId.Type_
				notifAssociateId.Value = assocId.Value

				seconds := time.Now().Unix()
				var timeStamp clientNotif.TimeStamp
				timeStamp.Seconds = int32(seconds)
@@ -593,8 +612,9 @@ func checkReNotificationRegisteredSubscriptions(appId string, assocId *Associate
				notif.ErabId = erabId
				notif.Ecgi = &newEcgi
				notif.ErabQosParameters = &erabQos
				notif.AssociateId = &notifAssociateId

				go sendReNotification(subscription.CallbackReference, context.TODO(), subsIdStr, notif)
				sendReNotification(subscription.CallbackReference, context.TODO(), subsIdStr, notif)
				log.Info("Rab_establishment Notification" + "(" + subsIdStr + ")")
			}
		}
@@ -603,6 +623,11 @@ func checkReNotificationRegisteredSubscriptions(appId string, assocId *Associate

func checkRrNotificationRegisteredSubscriptions(appId string, assocId *AssociateId, newPlmn *Plmn, oldPlmn *Plmn, qci int32, newCellId string, oldCellId string, erabId int32) {

        //only applies if going to a non 3gpp element
        if newCellId != "" || oldCellId == "" {
                return
        }

	//check all that applies
	for subsId, sub := range rrSubscriptionMap {

@@ -669,6 +694,10 @@ func checkRrNotificationRegisteredSubscriptions(appId string, assocId *Associate
				oldEcgi.Plmn = &notifOldPlmn
				oldEcgi.CellId = []string{oldCellId}

				var notifAssociateId clientNotif.AssociateId
				notifAssociateId.Type_ = assocId.Type_
				notifAssociateId.Value = assocId.Value

				seconds := time.Now().Unix()
				var timeStamp clientNotif.TimeStamp
				timeStamp.Seconds = int32(seconds)
@@ -678,8 +707,9 @@ func checkRrNotificationRegisteredSubscriptions(appId string, assocId *Associate
				notif.Timestamp = &timeStamp
				notif.Ecgi = &oldEcgi
				notif.ErabReleaseInfo = &erabRelInfo
				notif.AssociateId = &notifAssociateId

				go sendRrNotification(subscription.CallbackReference, context.TODO(), subsIdStr, notif)
				sendRrNotification(subscription.CallbackReference, context.TODO(), subsIdStr, notif)
				log.Info("Rab_release Notification" + "(" + subsIdStr + ")")
			}
		}
@@ -1382,7 +1412,6 @@ func rabInfoGET(w http.ResponseWriter, r *http.Request) {

	cellIdStr := q.Get("cell_id")
	cellIds := strings.Split(cellIdStr, ",")
	log.Info("SIMON cellIds", cellIds)

	rabInfoData.queryCellIds = cellIds

@@ -1451,12 +1480,14 @@ func populateRabInfo(key string, jsonInfo string, rabInfoData interface{}) error

	partOfFilter := true
	for _, cellId := range data.queryCellIds {
		if cellId != "" {
			partOfFilter = false
			if cellId == ueData.Ecgi.CellId {
				partOfFilter = true
				break
			}
		}
	}
	if !partOfFilter {
		return nil
	}
@@ -1464,7 +1495,7 @@ func populateRabInfo(key string, jsonInfo string, rabInfoData interface{}) error
	var ueInfo UeInfo

	assocId := new(AssociateId)
	assocId.Type_ = "UE_IPv4_ADDRESS"
	assocId.Type_ = "UE_IPV4_ADDRESS"
	subKeys := strings.Split(key, ":")
	assocId.Value = subKeys[len(subKeys)-1]

+2045 −646

File changed.

Preview size limit exceeded, changes collapsed.