Unverified Commit 133af607 authored by Kevin Di Lallo's avatar Kevin Di Lallo Committed by GitHub
Browse files

Merge pull request #162 from pastorsx/sp_dev_loc_serv_v1_6_fix

ZonalStatus fix, generic errors in mec services for missing mandatory properties, updated rnis rab_info query params
parents b5cfb3e7 355fe02b
Loading
Loading
Loading
Loading
+143 −86
Original line number Diff line number Diff line
@@ -51,9 +51,6 @@ const typeZonalSubscription = "zonalsubs"
const typeUserSubscription = "usersubs"
const typeZoneStatusSubscription = "zonestatus"

const USER_TRACKING_AND_ZONAL_TRAFFIC = 1
const ZONE_STATUS = 2

type UeUserData struct {
	queryZoneId  []string
	queryApId    []string
@@ -87,8 +84,8 @@ type ZoneStatusCheck struct {
	Serviceable            bool
	Unserviceable          bool
	Unknown                bool
	NbUsersInZoneThreshold int
	NbUsersInAPThreshold   int
	NbUsersInZoneThreshold int32
	NbUsersInAPThreshold   int32
}

var LOC_SERV_DB = 0
@@ -224,8 +221,8 @@ func registerZoneStatus(zoneId string, nbOfUsersZoneThreshold int32, nbOfUsersAP
			}
		}
	}
	zoneStatus.NbUsersInZoneThreshold = (int)(nbOfUsersZoneThreshold)
	zoneStatus.NbUsersInAPThreshold = (int)(nbOfUsersAPThreshold)
	zoneStatus.NbUsersInZoneThreshold = nbOfUsersZoneThreshold
	zoneStatus.NbUsersInAPThreshold = nbOfUsersAPThreshold
	zoneStatus.ZoneId = zoneId
	mutex.Lock()
	defer mutex.Unlock()
@@ -318,21 +315,7 @@ func registerUser(userAddress string, event []UserEventType, subsIdStr string) {
	userSubscriptionMap[subsId] = userAddress
}

func checkNotificationRegistrations(checkType int, param1 string, param2 string, param3 string, param4 string, param5 string) {

	switch checkType {
	case USER_TRACKING_AND_ZONAL_TRAFFIC:
		//params are the following => newZoneId:oldZoneId:newAccessPointId:oldAccessPointId:userAddress
		checkNotificationRegisteredUsers(param1, param2, param3, param4, param5)
		checkNotificationRegisteredZones(param1, param2, param3, param4, param5)
	case ZONE_STATUS:
		//params are the following => zoneId:accessPointId:nbUsersInAP:nbUsersInZone
		checkNotificationRegisteredZoneStatus(param1, param2, param3, param4)
	default:
	}
}

func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersInAPStr string, nbUsersInZoneStr string) {
func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersInAP int32, nbUsersInZone int32, previousNbUsersInAP int32, previousNbUsersInZone int32) {

	mutex.Lock()
	defer mutex.Unlock()
@@ -344,27 +327,15 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn
		}

		if zoneStatus.ZoneId == zoneId {
			nbUsersInAP := -1
			zoneWarning := false
			apWarning := false
			if nbUsersInZoneStr != "" {
				nbUsersInZone, err := strconv.Atoi(nbUsersInZoneStr)
				if err != nil {
					log.Error(err)
					continue
				}

				if nbUsersInZone >= zoneStatus.NbUsersInZoneThreshold {
			if nbUsersInZone != -1 {
				if previousNbUsersInZone != nbUsersInZone && nbUsersInZone >= zoneStatus.NbUsersInZoneThreshold {
					zoneWarning = true
				}
				if nbUsersInAPStr != "" {
					nbUsersInAP, err = strconv.Atoi(nbUsersInAPStr)
					if err != nil {
						log.Error(err)
						continue
			}

					if nbUsersInAP >= zoneStatus.NbUsersInAPThreshold {
			if nbUsersInAP != -1 {
				if previousNbUsersInAP != nbUsersInAP && nbUsersInAP >= zoneStatus.NbUsersInAPThreshold {
					apWarning = true
				}
			}
@@ -382,10 +353,10 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn
				zoneStatusNotif.ZoneId = zoneId
				if apWarning {
					zoneStatusNotif.AccessPointId = apId
						zoneStatusNotif.NumberOfUsersInAP = (int32)(nbUsersInAP)
					zoneStatusNotif.NumberOfUsersInAP = nbUsersInAP
				}
				if zoneWarning {
						zoneStatusNotif.NumberOfUsersInZone = (int32)(nbUsersInZone)
					zoneStatusNotif.NumberOfUsersInZone = nbUsersInZone
				}
				seconds := time.Now().Unix()
				var timestamp TimeStamp
@@ -395,10 +366,9 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn
				inlineZoneStatusNotification.ZoneStatusNotification = &zoneStatusNotif
				sendStatusNotification(subscription.CallbackReference.NotifyURL, inlineZoneStatusNotification)
				if apWarning {
						log.Info("Zone Status Notification" + "(" + subsIdStr + "): " + "For event in zone " + zoneId + " which has " + nbUsersInAPStr + " users in AP " + apId)
					log.Info("Zone Status Notification" + "(" + subsIdStr + "): " + "For event in zone " + zoneId + " which has " + strconv.Itoa(int(nbUsersInAP)) + " users in AP " + apId)
				} else {
						log.Info("Zone Status Notification" + "(" + subsIdStr + "): " + "For event in zone " + zoneId + " which has " + nbUsersInZoneStr + " users in total")
					}
					log.Info("Zone Status Notification" + "(" + subsIdStr + "): " + "For event in zone " + zoneId + " which has " + strconv.Itoa(int(nbUsersInZone)) + " users in total")
				}
			}
		}
@@ -971,7 +941,20 @@ func userTrackingSubPost(w http.ResponseWriter, r *http.Request) {
	userTrackingSub := body.UserTrackingSubscription

	if userTrackingSub == nil {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("Body not present")
		http.Error(w, "Body not present", http.StatusBadRequest)
		return
	}

	//checking for mandatory properties
	if userTrackingSub.CallbackReference == nil || userTrackingSub.CallbackReference.NotifyURL == "" {
		log.Error("Mandatory CallbackReference parameter not present")
		http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
		return
	}
	if userTrackingSub.Address == "" {
		log.Error("Mandatory Address parameter not present")
		http.Error(w, "Mandatory Address parameter not present", http.StatusBadRequest)
		return
	}

@@ -1013,12 +996,25 @@ func userTrackingSubPut(w http.ResponseWriter, r *http.Request) {
	userTrackingSub := body.UserTrackingSubscription

	if userTrackingSub == nil {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("Body not present")
		http.Error(w, "Body not present", http.StatusBadRequest)
		return
	}

	//checking for mandatory properties
	if userTrackingSub.CallbackReference == nil || userTrackingSub.CallbackReference.NotifyURL == "" {
		log.Error("Mandatory CallbackReference parameter not present")
		http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
		return
	}
	if userTrackingSub.Address == "" {
		log.Error("Mandatory Address parameter not present")
		http.Error(w, "Mandatory Address parameter not present", http.StatusBadRequest)
		return
	}
	if userTrackingSub.ResourceURL == "" {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("Mandatory ResourceURL parameter not present")
		http.Error(w, "Mandatory ResourceURL parameter not present", http.StatusBadRequest)
		return
	}

@@ -1029,7 +1025,8 @@ func userTrackingSubPut(w http.ResponseWriter, r *http.Request) {

	//Body content not matching parameters
	if subsIdStr != subsIdParamStr {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("SubscriptionId in endpoint and in body not matching")
		http.Error(w, "SubscriptionId in endpoint and in body not matching", http.StatusBadRequest)
		return
	}

@@ -1164,7 +1161,20 @@ func zonalTrafficSubPost(w http.ResponseWriter, r *http.Request) {
	zonalTrafficSub := body.ZonalTrafficSubscription

	if zonalTrafficSub == nil {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("Body not present")
		http.Error(w, "Body not present", http.StatusBadRequest)
		return
	}

	//checking for mandatory properties
	if zonalTrafficSub.CallbackReference == nil || zonalTrafficSub.CallbackReference.NotifyURL == "" {
		log.Error("Mandatory CallbackReference parameter not present")
		http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
		return
	}
	if zonalTrafficSub.ZoneId == "" {
		log.Error("Mandatory ZoneId parameter not present")
		http.Error(w, "Mandatory ZoneId parameter not present", http.StatusBadRequest)
		return
	}

@@ -1218,12 +1228,25 @@ func zonalTrafficSubPut(w http.ResponseWriter, r *http.Request) {
	zonalTrafficSub := body.ZonalTrafficSubscription

	if zonalTrafficSub == nil {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("Body not present")
		http.Error(w, "Body not present", http.StatusBadRequest)
		return
	}

	//checking for mandatory properties
	if zonalTrafficSub.CallbackReference == nil || zonalTrafficSub.CallbackReference.NotifyURL == "" {
		log.Error("Mandatory CallbackReference parameter not present")
		http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
		return
	}
	if zonalTrafficSub.ZoneId == "" {
		log.Error("Mandatory ZoneId parameter not present")
		http.Error(w, "Mandatory ZoneId parameter not present", http.StatusBadRequest)
		return
	}
	if zonalTrafficSub.ResourceURL == "" {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("Mandatory ResourceURL parameter not present")
		http.Error(w, "Mandatory ResourceURL parameter not present", http.StatusBadRequest)
		return
	}

@@ -1234,7 +1257,8 @@ func zonalTrafficSubPut(w http.ResponseWriter, r *http.Request) {

	//body content not matching parameters
	if subsIdStr != subsIdParamStr {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("SubscriptionId in endpoint and in body not matching")
		http.Error(w, "SubscriptionId in endpoint and in body not matching", http.StatusBadRequest)
		return
	}

@@ -1370,7 +1394,20 @@ func zoneStatusSubPost(w http.ResponseWriter, r *http.Request) {
	zoneStatusSub := body.ZoneStatusSubscription

	if zoneStatusSub == nil {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("Body not present")
		http.Error(w, "Body not present", http.StatusBadRequest)
		return
	}

	//checking for mandatory properties
	if zoneStatusSub.CallbackReference == nil || zoneStatusSub.CallbackReference.NotifyURL == "" {
		log.Error("Mandatory CallbackReference parameter not present")
		http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
		return
	}
	if zoneStatusSub.ZoneId == "" {
		log.Error("Mandatory ZoneId parameter not present")
		http.Error(w, "Mandatory ZoneId parameter not present", http.StatusBadRequest)
		return
	}

@@ -1414,12 +1451,25 @@ func zoneStatusSubPut(w http.ResponseWriter, r *http.Request) {
	zoneStatusSub := body.ZoneStatusSubscription

	if zoneStatusSub == nil {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("Body not present")
		http.Error(w, "Body not present", http.StatusBadRequest)
		return
	}

	//checking for mandatory properties
	if zoneStatusSub.CallbackReference == nil || zoneStatusSub.CallbackReference.NotifyURL == "" {
		log.Error("Mandatory CallbackReference parameter not present")
		http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
		return
	}
	if zoneStatusSub.ZoneId == "" {
		log.Error("Mandatory ZoneId parameter not present")
		http.Error(w, "Mandatory ZoneId parameter not present", http.StatusBadRequest)
		return
	}
	if zoneStatusSub.ResourceURL == "" {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("Mandatory ResourceURL parameter not present")
		http.Error(w, "Mandatory ResourceURL parameter not present", http.StatusBadRequest)
		return
	}

@@ -1430,7 +1480,8 @@ func zoneStatusSubPut(w http.ResponseWriter, r *http.Request) {

	//body content not matching parameters
	if subsIdStr != subsIdParamStr {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("SubscriptionId in endpoint and in body not matching")
		http.Error(w, "SubscriptionId in endpoint and in body not matching", http.StatusBadRequest)
		return
	}

@@ -1555,7 +1606,9 @@ func updateUserInfo(address string, zoneId string, accessPointId string, longitu

	// Update User info in DB & Send notifications
	_ = rc.JSONSetEntry(baseKey+typeUser+":"+address, ".", convertUserInfoToJson(userInfo))
	checkNotificationRegistrations(USER_TRACKING_AND_ZONAL_TRAFFIC, oldZoneId, zoneId, oldApId, accessPointId, address)
	checkNotificationRegisteredUsers(oldZoneId, zoneId, oldApId, accessPointId, address)
	checkNotificationRegisteredZones(oldZoneId, zoneId, oldApId, accessPointId, address)

}

func updateZoneInfo(zoneId string, nbAccessPoints int, nbUnsrvAccessPoints int, nbUsers int) {
@@ -1570,6 +1623,8 @@ func updateZoneInfo(zoneId string, nbAccessPoints int, nbUnsrvAccessPoints int,
		zoneInfo.ResourceURL = hostUrl.String() + basePath + "queries/zones/" + zoneId
	}

	previousNbUsers := zoneInfo.NumberOfUsers

	// Update info
	if nbAccessPoints != -1 {
		zoneInfo.NumberOfAccessPoints = int32(nbAccessPoints)
@@ -1583,7 +1638,7 @@ func updateZoneInfo(zoneId string, nbAccessPoints int, nbUnsrvAccessPoints int,

	// Update Zone info in DB & Send notifications
	_ = rc.JSONSetEntry(baseKey+typeZone+":"+zoneId, ".", convertZoneInfoToJson(zoneInfo))
	checkNotificationRegistrations(ZONE_STATUS, zoneId, "", "", strconv.Itoa(nbUsers), "")
	checkNotificationRegisteredZoneStatus(zoneId, "", int32(-1), int32(nbUsers), int32(-1), previousNbUsers)
}

func updateAccessPointInfo(zoneId string, apId string, conTypeStr string, opStatusStr string, nbUsers int, longitude *float32, latitude *float32) {
@@ -1598,6 +1653,8 @@ func updateAccessPointInfo(zoneId string, apId string, conTypeStr string, opStat
		apInfo.ResourceURL = hostUrl.String() + basePath + "queries/zones/" + zoneId + "/accessPoints/" + apId
	}

	previousNbUsers := apInfo.NumberOfUsers

	// Update info
	if opStatusStr != "" {
		opStatus := convertStringToOperationStatus(opStatusStr)
@@ -1636,7 +1693,7 @@ func updateAccessPointInfo(zoneId string, apId string, conTypeStr string, opStat

	// Update AP info in DB & Send notifications
	_ = rc.JSONSetEntry(baseKey+typeZone+":"+zoneId+":"+typeAccessPoint+":"+apId, ".", convertAccessPointInfoToJson(apInfo))
	checkNotificationRegistrations(ZONE_STATUS, zoneId, apId, strconv.Itoa(nbUsers), "", "")
	checkNotificationRegisteredZoneStatus(zoneId, apId, int32(nbUsers), int32(-1), previousNbUsers, int32(-1))
}

func zoneStatusReInit() {
@@ -1674,8 +1731,8 @@ func zoneStatusReInit() {
					}
				}
			}
			zoneStatus.NbUsersInZoneThreshold = (int)(zone.NumberOfUsersZoneThreshold)
			zoneStatus.NbUsersInAPThreshold = (int)(zone.NumberOfUsersAPThreshold)
			zoneStatus.NbUsersInZoneThreshold = zone.NumberOfUsersZoneThreshold
			zoneStatus.NbUsersInAPThreshold = zone.NumberOfUsersAPThreshold
			zoneStatus.ZoneId = zone.ZoneId
			zoneStatusSubscriptionMap[subscriptionId] = &zoneStatus
		}
+63 −10
Original line number Diff line number Diff line
@@ -84,13 +84,17 @@ const defaultSupportedQci = 80

type RabInfoData struct {
	queryErabId        int32
	queryQci           int32
	queryCellIds       []string
	queryIpv4Addresses []string
	rabInfo            *RabInfo
}

type UeData struct {
	Name   string `json:"name"`
	ErabId int32  `json:"erabId"`
	Ecgi   *Ecgi  `json:"ecgi"`
	Qci    int32  `json:"qci"`
}

type DomainData struct {
@@ -219,6 +223,8 @@ func updateUeData(name string, mnc string, mcc string, cellId string, erabIdVali

	var ueData UeData
	ueData.Ecgi = &newEcgi
	ueData.Name = name
	ueData.Qci = defaultSupportedQci //only supporting one value

	oldPlmn := new(Plmn)
	oldPlmnMnc := ""
@@ -1100,6 +1106,13 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) {
	//extract common body part
	subscriptionType := subscriptionCommon.SubscriptionType

	//mandatory parameter
	if subscriptionCommon.CallbackReference == "" {
		log.Error("Mandatory CallbackReference parameter not present")
		http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
		return
	}

	//new subscription id
	newSubsId := nextSubscriptionIdAvailable
	nextSubscriptionIdAvailable++
@@ -1243,10 +1256,17 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) {
	//extract common body part
	subscriptionType := subscriptionCommon.SubscriptionType

	//mandatory parameter
	if subscriptionCommon.CallbackReference == "" {
		log.Error("Mandatory CallbackReference parameter not present")
		http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
		return
	}

	link := subscriptionCommon.Links
	if link == nil || link.Self == nil {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("Mandatory Link parameter not present")
		http.Error(w, "Mandatory Link parameter not present", http.StatusBadRequest)
		return
	}

@@ -1254,7 +1274,8 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) {
	subsIdStr := selfUrl[len(selfUrl)-1]

	if subsIdStr != subIdParamStr {
		http.Error(w, "Body content not matching parameter", http.StatusInternalServerError)
		log.Error("SubscriptionId in endpoint and in body not matching")
		http.Error(w, "SubscriptionId in endpoint and in body not matching", http.StatusBadRequest)
		return
	}

@@ -1273,7 +1294,7 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) {

		if subscription.FilterCriteriaAssocHo == nil {
			log.Error("FilterCriteriaAssocHo should not be null for this subscription type")
			http.Error(w, "FilterCriteriaAssocHo should not be null for this subscription type", http.StatusInternalServerError)
			http.Error(w, "FilterCriteriaAssocHo should not be null for this subscription type", http.StatusBadRequest)
			return
		}

@@ -1299,7 +1320,7 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) {

		if subscription.FilterCriteriaQci == nil {
			log.Error("FilterCriteriaQci should not be null for this subscription type")
			http.Error(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusInternalServerError)
			http.Error(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest)
			return
		}

@@ -1321,7 +1342,7 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) {

		if subscription.FilterCriteriaQci == nil {
			log.Error("FilterCriteriaQci should not be null for this subscription type")
			http.Error(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusInternalServerError)
			http.Error(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest)
			return
		}

@@ -1613,10 +1634,22 @@ func rabInfoGet(w http.ResponseWriter, r *http.Request) {
		rabInfoData.queryErabId = -1
	}

	qciStr := q.Get("qci")
	if qciStr != "" {
		tmpQci, _ := strconv.Atoi(qciStr)
		rabInfoData.queryQci = int32(tmpQci)
	} else {
		rabInfoData.queryQci = -1
	}

	/*comma separated list
	cellIdStr := q.Get("cell_id")
	cellIds := strings.Split(cellIdStr, ",")

	rabInfoData.queryCellIds = cellIds
	*/
	rabInfoData.queryCellIds = q["cell_id"]
	rabInfoData.queryIpv4Addresses = q["ue_ipv4_address"]

	//same for all plmnInfo
	seconds := time.Now().Unix()
@@ -1678,6 +1711,11 @@ func populateRabInfo(key string, jsonInfo string, rabInfoData interface{}) error
		return nil
	}

	// Filter using query params
	if data.queryQci != -1 && ueData.Qci != data.queryQci {
		return nil
	}

	partOfFilter := true
	for _, cellId := range data.queryCellIds {
		if cellId != "" {
@@ -1692,6 +1730,21 @@ func populateRabInfo(key string, jsonInfo string, rabInfoData interface{}) error
		return nil
	}

	//name of the element is used as the ipv4 address at the moment
	partOfFilter = true
	for _, address := range data.queryIpv4Addresses {
		if address != "" {
			partOfFilter = false
			if address == ueData.Name {
				partOfFilter = true
				break
			}
		}
	}
	if !partOfFilter {
		return nil
	}

	var ueInfo RabInfoUeInfo

	assocId := new(AssociateId)
+5 −6
Original line number Diff line number Diff line
@@ -1667,13 +1667,16 @@ func TestSbi(t *testing.T) {
		t.Fatalf("Error running test basic procedure")
	}

	ueName := "ue1"
	appName := "zone1-edge1-iperf"

	/******************************
	 * expected values section
	 ******************************/
	var expectedUeDataStr [2]string
	var expectedUeData [2]UeData
	expectedUeData[INITIAL] = UeData{1, &Ecgi{"2345678", &Plmn{"123", "456"}}}
	expectedUeData[UPDATED] = UeData{-1, &Ecgi{"", &Plmn{"123", "456"}}}
	expectedUeData[INITIAL] = UeData{ueName, 1, &Ecgi{"2345678", &Plmn{"123", "456"}}, 80}
	expectedUeData[UPDATED] = UeData{ueName, -1, &Ecgi{"", &Plmn{"123", "456"}}, 80}

	var expectedAppEcgiStr [2]string
	var expectedAppEcgi [2]Ecgi
@@ -1711,10 +1714,6 @@ func TestSbi(t *testing.T) {
	fmt.Println("Set a scenario")
	initialiseScenario(testScenario)

	//different tests
	ueName := "ue1"
	appName := "zone1-edge1-iperf"

	jsonEcgiInfo, _ := rc.JSONGetEntry(baseKey+"UE:"+ueName, ".")
	if string(jsonEcgiInfo) != expectedUeDataStr[INITIAL] {
		t.Fatalf("Failed to get expected response")
+17 −2
Original line number Diff line number Diff line
@@ -579,6 +579,13 @@ func subscriptionsPOST(w http.ResponseWriter, r *http.Request) {
	//extract common body part
	subscriptionType := subscriptionCommon.SubscriptionType

	//mandatory parameter
	if subscriptionCommon.CallbackReference == "" {
		log.Error("Mandatory CallbackReference parameter not present")
		http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
		return
	}

	//new subscription id
	newSubsId := nextSubscriptionIdAvailable
	nextSubscriptionIdAvailable++
@@ -640,10 +647,17 @@ func subscriptionsPUT(w http.ResponseWriter, r *http.Request) {
	//extract common body part
	subscriptionType := subscriptionCommon.SubscriptionType

	//mandatory parameter
	if subscriptionCommon.CallbackReference == "" {
		log.Error("Mandatory CallbackReference parameter not present")
		http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
		return
	}

	link := subscriptionCommon.Links
	if link == nil || link.Self == nil {
		w.WriteHeader(http.StatusBadRequest)
		log.Error("Mandatory Link parameter not present")
		http.Error(w, "Mandatory Link parameter not present", http.StatusBadRequest)
		return
	}

@@ -651,7 +665,8 @@ func subscriptionsPUT(w http.ResponseWriter, r *http.Request) {
	subsIdStr := selfUrl[len(selfUrl)-1]

	if subsIdStr != subIdParamStr {
		http.Error(w, "Body content not matching parameter", http.StatusInternalServerError)
		log.Error("SubscriptionId in endpoint and in body not matching")
		http.Error(w, "SubscriptionId in endpoint and in body not matching", http.StatusBadRequest)
		return
	}