Skip to content
rnis_test.go 71.8 KiB
Newer Older
Simon Pastor's avatar
Simon Pastor committed
				return ("EutranNeighbourCellMeasInfo:Rsrp of notification not as expected: " + strconv.Itoa(int(notification.EutranNeighbourCellMeasInfo[0].Rsrp)) + " instead of " + strconv.Itoa(int(expectedEutranNeighbourCellMeasInfo.Rsrp)))
			}
			if notification.EutranNeighbourCellMeasInfo[0].Rsrq != expectedEutranNeighbourCellMeasInfo.Rsrq {
				return ("EutranNeighbourCellMeasInfo:Rsrq of notification not as expected: " + strconv.Itoa(int(notification.EutranNeighbourCellMeasInfo[0].Rsrq)) + " instead of " + strconv.Itoa(int(expectedEutranNeighbourCellMeasInfo.Rsrq)))
			}

			if len(notification.EutranNeighbourCellMeasInfo) > 1 {
				return ("EutranNeighbourCellMeasInfo of notification should have only one element")
			}
		} else {
			return ("EutranNeighbourCellMeasInfo of notification is expected")
		}
	}

	return ""
}

func validateNrMeasRepUeNotification(notification *rnisClient.NrMeasRepUeNotification, expectedAssocId *rnisClient.AssociateId, expectedServCellMeasInfo *rnisClient.NrMeasRepUeNotificationServCellMeasInfo, expectedNrNeighCellMeasInfo *rnisClient.NrMeasRepUeNotificationNrNeighCellMeasInfo, expectedEutraNeighCellMeasInfo *rnisClient.NrMeasRepUeNotificationEutraNeighCellMeasInfo) string {

	if notification.NotificationType != "NrMeasRepUeNotification" {
		return ("NotificationType of notification not as expected: " + notification.NotificationType + " instead of " + "NrMeasRepUeNotification")
	}
	if expectedAssocId != nil {
		if notification.AssociateId != nil || len(notification.AssociateId) > 0 {
			if notification.AssociateId[0].Type_ != expectedAssocId.Type_ {
				return ("AssocId:Type of notification not as expected: " + strconv.Itoa(int(notification.AssociateId[0].Type_)) + " instead of " + strconv.Itoa(int(expectedAssocId.Type_)))
			}
			if notification.AssociateId[0].Value != expectedAssocId.Value {
				return ("AssocId:Value of notification not as expected: " + notification.AssociateId[0].Value + " instead of " + expectedAssocId.Value)
			}
			if len(notification.AssociateId) > 1 {
				return ("AssocId of notification should have only one element")
			}
		} else {
			return ("AssocId of notification is expected")
		}
	}

Simon Pastor's avatar
Simon Pastor committed
	if expectedServCellMeasInfo != nil {
		if notification.ServCellMeasInfo != nil || len(notification.ServCellMeasInfo) > 0 {
			if notification.ServCellMeasInfo[0].Nrcgi.NrcellId != expectedServCellMeasInfo.Nrcgi.NrcellId {
				return ("ServCellMeasInfo:Nrcgi:NrcellId of notification not as expected: " + notification.ServCellMeasInfo[0].Nrcgi.NrcellId + " instead of " + expectedServCellMeasInfo.Nrcgi.NrcellId)
			}
			if notification.ServCellMeasInfo[0].Nrcgi.Plmn.Mcc != expectedServCellMeasInfo.Nrcgi.Plmn.Mcc {
				return ("ServCellMeasInfo:Nrcgi:Plmn.Mcc of notification not as expected: " + notification.ServCellMeasInfo[0].Nrcgi.Plmn.Mcc + " instead of " + expectedServCellMeasInfo.Nrcgi.Plmn.Mcc)
			}
			if notification.ServCellMeasInfo[0].Nrcgi.Plmn.Mnc != expectedServCellMeasInfo.Nrcgi.Plmn.Mnc {
				return ("ServCellMeasInfo:Nrcgi:Plmn.Mnc of notification not as expected: " + notification.ServCellMeasInfo[0].Nrcgi.Plmn.Mnc + " instead of " + expectedServCellMeasInfo.Nrcgi.Plmn.Mnc)
			}
			if notification.ServCellMeasInfo[0].SCell.MeasQuantityResultsSsbCell.Rsrp != expectedServCellMeasInfo.SCell.MeasQuantityResultsSsbCell.Rsrp {
				return ("ServCellMeasInfo:SCell:MeasQuantityResultsSsbCell.Rsrp of notification not as expected: " + strconv.Itoa(int(notification.ServCellMeasInfo[0].SCell.MeasQuantityResultsSsbCell.Rsrp)) + " instead of " + strconv.Itoa(int(expectedServCellMeasInfo.SCell.MeasQuantityResultsSsbCell.Rsrp)))
			}
			if notification.ServCellMeasInfo[0].SCell.MeasQuantityResultsSsbCell.Rsrq != expectedServCellMeasInfo.SCell.MeasQuantityResultsSsbCell.Rsrq {
				return ("ServCellMeasInfo:SCell:MeasQuantityResultsSsbCell.Rsrq of notification not as expected: " + strconv.Itoa(int(notification.ServCellMeasInfo[0].SCell.MeasQuantityResultsSsbCell.Rsrq)) + " instead of " + strconv.Itoa(int(expectedServCellMeasInfo.SCell.MeasQuantityResultsSsbCell.Rsrq)))
			}

			if len(notification.ServCellMeasInfo) > 1 {
				return ("ServCellMeasInfo of notification should have only one element")
			}
		} else {
			return ("ServCellMeasInfo of notification is expected")
		}
	}

	if expectedNrNeighCellMeasInfo != nil {
		if notification.NrNeighCellMeasInfo != nil || len(notification.NrNeighCellMeasInfo) > 0 {
			if notification.NrNeighCellMeasInfo[0].Nrcgi != expectedNrNeighCellMeasInfo.Nrcgi {
				return ("NrNeighCellMeasInfo:Nrcgi of notification not as expected: " + notification.NrNeighCellMeasInfo[0].Nrcgi + " instead of " + expectedNrNeighCellMeasInfo.Nrcgi)
			}
Simon Pastor's avatar
Simon Pastor committed
			if notification.NrNeighCellMeasInfo[0].MeasQuantityResultsSsbCell.Rsrp != expectedNrNeighCellMeasInfo.MeasQuantityResultsSsbCell.Rsrp {
				return ("NrNeighCellMeasInfo:MeasQuantityResultsSsbCell:Rsrp of notification not as expected: " + strconv.Itoa(int(notification.NrNeighCellMeasInfo[0].MeasQuantityResultsSsbCell.Rsrp)) + " instead of " + strconv.Itoa(int(expectedNrNeighCellMeasInfo.MeasQuantityResultsSsbCell.Rsrp)))
			}
			if notification.NrNeighCellMeasInfo[0].MeasQuantityResultsSsbCell.Rsrq != expectedNrNeighCellMeasInfo.MeasQuantityResultsSsbCell.Rsrq {
				return ("NrNeighCellMeasInfo:MeasQuantityResultsSsbCell:Rsrq of notification not as expected: " + strconv.Itoa(int(notification.NrNeighCellMeasInfo[0].MeasQuantityResultsSsbCell.Rsrq)) + " instead of " + strconv.Itoa(int(expectedNrNeighCellMeasInfo.MeasQuantityResultsSsbCell.Rsrq)))
			}

			if len(notification.NrNeighCellMeasInfo) > 1 {
				return ("NrNeighCellMeasInfo of notification should have only one element")
			}
		} else {
			return ("NrNeighCellMeasInfo of notification is expected")
		}
	}

Simon Pastor's avatar
Simon Pastor committed
	if expectedEutraNeighCellMeasInfo != nil {
		if notification.EutraNeighCellMeasInfo != nil || len(notification.EutraNeighCellMeasInfo) > 0 {
			if notification.EutraNeighCellMeasInfo[0].Ecgi.CellId != expectedEutraNeighCellMeasInfo.Ecgi.CellId {
				return ("EutraNeighCellMeasInfo:Ecgi:CellId of notification not as expected: " + notification.EutraNeighCellMeasInfo[0].Ecgi.CellId + " instead of " + expectedEutraNeighCellMeasInfo.Ecgi.CellId)
			}
			if notification.EutraNeighCellMeasInfo[0].Ecgi.Plmn.Mcc != expectedEutraNeighCellMeasInfo.Ecgi.Plmn.Mcc {
				return ("EutraNeighCellMeasInfo:Ecgi:Plmn:Mcc of notification not as expected: " + notification.EutraNeighCellMeasInfo[0].Ecgi.Plmn.Mcc + " instead of " + expectedEutraNeighCellMeasInfo.Ecgi.Plmn.Mcc)
			}
			if notification.EutraNeighCellMeasInfo[0].Ecgi.Plmn.Mnc != expectedEutraNeighCellMeasInfo.Ecgi.Plmn.Mnc {
				return ("EutraNeighCellMeasInfo:Ecgi:Plmn:Mnc of notification not as expected: " + notification.EutraNeighCellMeasInfo[0].Ecgi.Plmn.Mnc + " instead of " + expectedEutraNeighCellMeasInfo.Ecgi.Plmn.Mnc)
			}
			if notification.EutraNeighCellMeasInfo[0].Rsrp != expectedEutraNeighCellMeasInfo.Rsrp {
				return ("EutraNeighCellMeasInfo:Rsrp of notification not as expected: " + strconv.Itoa(int(notification.EutraNeighCellMeasInfo[0].Rsrp)) + " instead of " + strconv.Itoa(int(expectedEutraNeighCellMeasInfo.Rsrp)))
			}
			if notification.EutraNeighCellMeasInfo[0].Rsrq != expectedEutraNeighCellMeasInfo.Rsrq {
				return ("EutraNeighCellMeasInfo:Rsrq of notification not as expected: " + strconv.Itoa(int(notification.EutraNeighCellMeasInfo[0].Rsrq)) + " instead of " + strconv.Itoa(int(expectedEutraNeighCellMeasInfo.Rsrq)))
			}

			if len(notification.EutraNeighCellMeasInfo) > 1 {
				return ("EutraNeighCellMeasInfo of notification should have only one element")
			}
		} else {
			return ("EutraNeighCellMeasInfo of notification is expected")
		}
	}