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

rnis cc support for 4g, 5g, re/rr 4g -> 5g, wifi, loc-serv support all

parent e7936dc4
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -2899,7 +2899,6 @@ definitions:
    type: "object"
    required:
    - "appInsId"
    - "ecgi"
    properties:
      timeStamp:
        $ref: "#/definitions/TimeStamp"
@@ -2908,8 +2907,8 @@ definitions:
        format: "string"
        example: "01"
        description: "Unique identifier for the mobile edge application instance"
      ecgi:
        $ref: "#/definitions/Ecgi"
      plmn:
        $ref: "#/definitions/Plmn"
  RabInfo:
    type: "object"
    required:
+35 −16
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ type SbiCfg struct {
	RedisAddr      string
	PostgisHost    string
	PostgisPort    string
	UeDataCb       func(string, string, string, string, int32)
	UeDataCb       func(string, string, string, string, bool)
	AppEcgiInfoCb  func(string, string, string, string)
	ScenarioNameCb func(string)
	CleanUpCb      func()
@@ -46,7 +46,7 @@ type RnisSbi struct {
	handlerId            int
	activeModel          *mod.Model
	pc                   *postgis.Connector
	updateUeDataCB       func(string, string, string, string, int32)
	updateUeDataCB       func(string, string, string, string, bool)
	updateAppEcgiInfoCB  func(string, string, string, string)
	updateScenarioNameCB func(string)
	cleanUpCB            func()
@@ -196,18 +196,31 @@ func processActiveScenarioUpdate() {
					mnc := ""
					mcc := ""
					cellId := ""
					erabIdValid := false
					if domain.CellularDomainConfig != nil {
						mnc = domain.CellularDomainConfig.Mnc
						mcc = domain.CellularDomainConfig.Mcc
						cellId = domain.CellularDomainConfig.DefaultCellId
					}
					switch poa.Type_ {
					case mod.NodeTypePoa4G:
						if poa.Poa4GConfig != nil {
							if poa.Poa4GConfig.CellId != "" {
								cellId = poa.Poa4GConfig.CellId
						} else {
							cellId = domain.CellularDomainConfig.DefaultCellId
							}
						}
					sbi.updateUeDataCB(name, mnc, mcc, cellId, -1)
						erabIdValid = true
					case mod.NodeTypePoa5G:
						if poa.Poa5GConfig != nil {
							if poa.Poa5GConfig.CellId != "" {
								cellId = poa.Poa5GConfig.CellId
							}
						}
					case mod.NodeTypePoaWifi:
						cellId = ""
					}

					sbi.updateUeDataCB(name, mnc, mcc, cellId, erabIdValid)
				}
			}
		}
@@ -258,17 +271,23 @@ func processActiveScenarioUpdate() {
						if domain.CellularDomainConfig != nil {
							mnc = domain.CellularDomainConfig.Mnc
							mcc = domain.CellularDomainConfig.Mcc
							cellId = domain.CellularDomainConfig.DefaultCellId
						}
						switch nl.Type_ {
						case mod.NodeTypePoa4G:
							if nl.Poa4GConfig != nil {
								if nl.Poa4GConfig.CellId != "" {
									cellId = nl.Poa4GConfig.CellId
							} else {
								cellId = domain.CellularDomainConfig.DefaultCellId
								}
						} else {
							if domain.CellularDomainConfig != nil {
								cellId = domain.CellularDomainConfig.DefaultCellId
							}
						case mod.NodeTypePoa5G:
							if nl.Poa5GConfig != nil {
								if nl.Poa5GConfig.CellId != "" {
									cellId = nl.Poa5GConfig.CellId
								}
							}
						case mod.NodeTypePoaWifi:
							cellId = ""
						}

						sbi.updateAppEcgiInfoCB(appName, mnc, mcc, cellId)
+1 −1
Original line number Diff line number Diff line
@@ -29,5 +29,5 @@ type PlmnInfo struct {
	// Unique identifier for the mobile edge application instance
	AppInsId string `json:"appInsId"`

	Ecgi *Ecgi `json:"ecgi"`
	Plmn *Plmn `json:"plmn,omitempty"`
}
+23 −17
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ func Stop() (err error) {
	return sbi.Stop()
}

func updateUeData(name string, mnc string, mcc string, cellId string, erabId int32) {
func updateUeData(name string, mnc string, mcc string, cellId string, erabIdValid bool) {

	var plmn Plmn
	var newEcgi Ecgi
@@ -230,13 +230,13 @@ func updateUeData(name string, mnc string, mcc string, cellId string, erabId int
	//updateDB if changes occur
	if newEcgi.Plmn.Mnc != oldPlmnMnc || newEcgi.Plmn.Mcc != oldPlmnMcc || newEcgi.CellId != oldCellId {

		//allocating a new erabId if entering a 3GPP environment
		if oldCellId == "" && cellId != "" {
		//allocating a new erabId if entering a 4G environment (existence of an erabId)
		if oldErabId == -1 && erabIdValid {
			//rab establishment case
			ueData.ErabId = int32(nextAvailableErabId)
			nextAvailableErabId++
		} else {
			if oldCellId != "" && cellId == "" {
			if oldErabId != -1 && !erabIdValid {
				//rab release case
				ueData.ErabId = -1
			} else {
@@ -253,9 +253,15 @@ func updateUeData(name string, mnc string, mcc string, cellId string, erabId int
		//log to model for all apps on that UE
		checkCcNotificationRegisteredSubscriptions("", assocId, &plmn, oldPlmn, "", cellId, oldCellId)
		//ueData contains newErabId
		log.Info("TEST SIMON")
		if oldErabId == -1 && ueData.ErabId != -1 {
			log.Info("SIMON")
			checkReNotificationRegisteredSubscriptions("", assocId, &plmn, oldPlmn, -1, cellId, oldCellId, ueData.ErabId)
		checkRrNotificationRegisteredSubscriptions("", assocId, &plmn, oldPlmn, -1, cellId, oldCellId, oldErabId)

		}
		if oldErabId != -1 && ueData.ErabId == -1 {
			log.Info("SIMON2")
			checkRrNotificationRegisteredSubscriptions("", assocId, &plmn, oldPlmn, -1, cellId, oldCellId, ueData.ErabId)
		}
	}
}

@@ -546,9 +552,9 @@ 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
	}
	//	if oldCellId != "" || newCellId == "" {
	//		return
	//	}

	//check all that applies
	for subsId, sub := range reSubscriptionMap {
@@ -568,7 +574,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))) && (oldPlmn == nil || oldCellId == "" || erabId != -1)) {
				match = true
			} else {
				match = false
@@ -643,9 +649,9 @@ 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
	}
	//	if newCellId != "" || oldCellId == "" {
	//		return
	//	}

	//check all that applies
	for subsId, sub := range rrSubscriptionMap {
@@ -665,7 +671,7 @@ func checkRrNotificationRegisteredSubscriptions(appId string, assocId *Associate
				match = false
			}

			if match && (((sub.FilterCriteria.Plmn == nil) || (sub.FilterCriteria.Plmn != nil && (oldPlmn != nil && oldPlmn.Mnc == sub.FilterCriteria.Plmn.Mnc && oldPlmn.Mcc == sub.FilterCriteria.Plmn.Mcc))) && (newPlmn == nil || newCellId == "")) {
			if match && (((sub.FilterCriteria.Plmn == nil) || (sub.FilterCriteria.Plmn != nil && (oldPlmn != nil && oldPlmn.Mnc == sub.FilterCriteria.Plmn.Mnc && oldPlmn.Mcc == sub.FilterCriteria.Plmn.Mcc))) && (newPlmn == nil || newCellId == "" || erabId == -1)) {
				match = true
			} else {
				match = false
@@ -1381,9 +1387,9 @@ func plmnInfoGET(w http.ResponseWriter, r *http.Request) {

			ecgi := convertJsonToEcgi(jsonAppEcgiInfo)
			if ecgi != nil {
				if ecgi.Plmn.Mnc != "" && ecgi.Plmn.Mcc != "" && ecgi.CellId != "" {
				if ecgi.Plmn.Mnc != "" && ecgi.Plmn.Mcc != "" {
					var plmnInfo PlmnInfo
					plmnInfo.Ecgi = ecgi
					plmnInfo.Plmn = ecgi.Plmn
					plmnInfo.AppInsId = meAppName
					plmnInfo.TimeStamp = &timeStamp
					response.PlmnInfo = append(response.PlmnInfo, plmnInfo)
+2 −11
Original line number Diff line number Diff line
@@ -2268,11 +2268,8 @@ func TestPlmnInfoGet(t *testing.T) {
	 * expected response section
	 ******************************/
	var expectedMcc [2]string
	var expectedCellId [2]string
	expectedMcc[INITIAL] = "123"
	expectedMcc[UPDATED] = "123"
	expectedCellId[INITIAL] = "2345678"
	expectedCellId[UPDATED] = "1234567"

	/******************************
	 * request vars section
@@ -2305,10 +2302,7 @@ func TestPlmnInfoGet(t *testing.T) {
	}

	if respBody.PlmnInfo != nil {
		if respBody.PlmnInfo[0].Ecgi.Plmn.Mcc != expectedMcc[INITIAL] {
			t.Fatalf("Failed to get expected response")
		}
		if respBody.PlmnInfo[0].Ecgi.CellId != expectedCellId[INITIAL] {
		if respBody.PlmnInfo[0].Plmn.Mcc != expectedMcc[INITIAL] {
			t.Fatalf("Failed to get expected response")
		}
	} else {
@@ -2326,10 +2320,7 @@ func TestPlmnInfoGet(t *testing.T) {
		t.Fatalf("Failed to get expected response")
	}
	if respBody.PlmnInfo != nil {
		if respBody.PlmnInfo[0].Ecgi.Plmn.Mcc != expectedMcc[UPDATED] {
			t.Fatalf("Failed to get expected response")
		}
		if respBody.PlmnInfo[0].Ecgi.CellId != expectedCellId[UPDATED] {
		if respBody.PlmnInfo[0].Plmn.Mcc != expectedMcc[UPDATED] {
			t.Fatalf("Failed to get expected response")
		}
	} else {
Loading