Loading go-apps/meep-ams/server/ams.go +22 −12 Original line number Diff line number Diff line Loading @@ -505,7 +505,7 @@ func registerService(appInstanceId string) error { //transportInfo var transportInfo smc.TransportInfo transportInfo.Id = "transport" transportInfo.Id = "sandboxTransport" transportInfo.Name = "REST" transportType := smc.REST_HTTP_TransportType transportInfo.Type_ = &transportType Loading Loading @@ -1020,18 +1020,18 @@ func checkMpNotificationRegisteredSubscriptions(appId string, assocId *Associate if err != nil || len(fields) == 0 { instanceFound = false } if instanceFound && fields["serviceLevel"] == string(AppMobilityServiceLevel_APP_MOBILITY_NOT_ALLOWED) { if instanceFound && fields["serviceLevel"] == strconv.Itoa(int(AppMobilityServiceLevel_APP_MOBILITY_NOT_ALLOWED)) { break } if !instanceFound { instanceFound = true key = baseKey + "mep:" + mepId + ":dev:" + assocId.Value key = baseKey + "mepId:" + mepId + ":dev:" + assocId.Value fields, err = rc.GetEntry(key) if err != nil || len(fields) == 0 { instanceFound = false } if instanceFound && fields["serviceLevel"] == string(AppMobilityServiceLevel_APP_MOBILITY_NOT_ALLOWED) { if instanceFound && fields["serviceLevel"] == strconv.Itoa(int(AppMobilityServiceLevel_APP_MOBILITY_NOT_ALLOWED)) { break } } Loading Loading @@ -1627,6 +1627,22 @@ func appMobilityServicePOST(w http.ResponseWriter, r *http.Request) { return } if registrationInfo.ServiceConsumerId.MepId != "" && mepName != registrationInfo.ServiceConsumerId.MepId { log.Error("This is not a possible value. Cannot track movements to other MEP.") http.Error(w, "MepId must match current MEP. Cannot track movements in other MEPs.", http.StatusBadRequest) return } //do a first pass to validate the content of deviceInfo for _, deviceInfo := range registrationInfo.DeviceInformation { //associateId is mandatory if deviceInfo is present if deviceInfo.AssociateId == nil { log.Error("AssociateId is a mandatory parameter if deviceInformation is present.") http.Error(w, "AssociateId is a mandatory parameter if deviceInformation is present.", http.StatusBadRequest) return } } //new service id newServId := nextServiceIdAvailable nextServiceIdAvailable++ Loading @@ -1634,12 +1650,6 @@ func appMobilityServicePOST(w http.ResponseWriter, r *http.Request) { registrationInfo.AppMobilityServiceId = servIdStr if registrationInfo.ServiceConsumerId.MepId != "" && mepName != registrationInfo.ServiceConsumerId.MepId { log.Error("This is not a possible value. Cannot track movements to other MEP.") http.Error(w, "MepId must match current MEP. Cannot track movements in other MEPs.", http.StatusBadRequest) return } key := baseKey + "services:" + servIdStr _ = rc.JSONSetEntry(key, ".", convertRegistrationInfoToJson(®istrationInfo)) Loading Loading @@ -1933,8 +1943,8 @@ func updateDeviceInfo(address string, zoneId string, procList []string) { // Update Device info in DB & Send notifications fields["zoneId"] = zoneId _ = rc.SetEntry(key, fields) //check 2 different MEPs are involved and destination is the current mep only (so entering) if mepZonesMap[oldZoneId] != mepZonesMap[zoneId] { // && mepZonesMap[zoneId] == mepName { //check 2 different MEPs are involved and destination is the current mep only (so leaving only) if mepZonesMap[oldZoneId] != mepZonesMap[zoneId] && mepZonesMap[oldZoneId] == mepName { //find all affected appIds var appInstanceIdsList AppInstanceIdsList Loading go-apps/meep-app-enablement/server/service-mgmt/service-mgmt.go +37 −21 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ var nextSubscriptionIdAvailable int type ServiceInfoList struct { Services []ServiceInfo ConsumedLocalOnlyPresent bool IsLocalPresent bool Filters *FilterParameters } Loading Loading @@ -801,12 +803,16 @@ func getServices(w http.ResponseWriter, r *http.Request, appInstanceId string) { serName := q["ser_name"] serCategoryId := q.Get("ser_category_id") consumedLocalOnly, err := strconv.ParseBool(q.Get("consumed_local_only")) consumedLocalOnlyPresent := true if err != nil { consumedLocalOnly = false consumedLocalOnlyPresent = false } isLocal, err := strconv.ParseBool(q.Get("is_local")) isLocalPresent := true if err != nil { isLocal = false isLocalPresent = false } scopeOfLocality := q.Get("scope_of_locality") Loading @@ -827,6 +833,8 @@ func getServices(w http.ResponseWriter, r *http.Request, appInstanceId string) { filterParameters.isLocal = isLocal filterParameters.scopeOfLocality = scopeOfLocality sInfoList.Filters = &filterParameters sInfoList.ConsumedLocalOnlyPresent = consumedLocalOnlyPresent sInfoList.IsLocalPresent = isLocalPresent var key string if appInstanceId == "" { Loading Loading @@ -913,6 +921,18 @@ func populateServiceInfoList(key string, jsonInfo string, sInfoList interface{}) // Get MEP Name mep := getMepNameFromKey(key) // Set IsLocal flag if *sInfo.ScopeOfLocality == MEC_SYSTEM || (mep != "" && mep == mepName) { sInfo.IsLocal = true } else { sInfo.IsLocal = false } // Filter out non-local services with "consumedLocalOnly" flag set to "true" if !sInfo.IsLocal && sInfo.ConsumedLocalOnly { return nil } // Filter services if data.Filters != nil { Loading Loading @@ -961,30 +981,26 @@ func populateServiceInfoList(key string, jsonInfo string, sInfoList interface{}) } // Service consumed local only if data.ConsumedLocalOnlyPresent { if data.Filters.consumedLocalOnly { if !sInfo.ConsumedLocalOnly { return nil } } else { //data.Filters.consumedLocalOnly is false if sInfo.ConsumedLocalOnly { return nil } } } // Is local service if data.IsLocalPresent { if data.Filters.isLocal { if mep == "" || mep != mepName { if !sInfo.IsLocal { return nil } } } // Set IsLocal flag if *sInfo.ScopeOfLocality == MEC_SYSTEM || (mep != "" && mep == mepName) { sInfo.IsLocal = true } else { sInfo.IsLocal = false } // Filter out non-local services with "consumedLocalOnly" flag set to "true" if !sInfo.IsLocal && sInfo.ConsumedLocalOnly { return nil } // Add service to list Loading Loading @@ -1268,7 +1284,7 @@ func transportsGET(w http.ResponseWriter, r *http.Request) { //transportInfo var transportInfo TransportInfo transportInfo.Id = "transport" transportInfo.Id = "sandboxTransport" transportInfo.Name = "REST" transportType := REST_HTTP transportInfo.Type_ = &transportType Loading go-apps/meep-loc-serv/server/loc-serv.go +1 −1 Original line number Diff line number Diff line Loading @@ -505,7 +505,7 @@ func registerService(appInstanceId string) error { //transportInfo var transportInfo smc.TransportInfo transportInfo.Id = "transport" transportInfo.Id = "sandboxTransport" transportInfo.Name = "REST" transportType := smc.REST_HTTP_TransportType transportInfo.Type_ = &transportType Loading go-apps/meep-rnis/server/rnis.go +1 −1 Original line number Diff line number Diff line Loading @@ -582,7 +582,7 @@ func registerService(appInstanceId string) error { //transportInfo var transportInfo smc.TransportInfo transportInfo.Id = "transport" transportInfo.Id = "sandboxTransport" transportInfo.Name = "REST" transportType := smc.REST_HTTP_TransportType transportInfo.Type_ = &transportType Loading go-apps/meep-wais/server/wais.go +1 −1 Original line number Diff line number Diff line Loading @@ -469,7 +469,7 @@ func registerService(appInstanceId string) error { //transportInfo var transportInfo smc.TransportInfo transportInfo.Id = "transport" transportInfo.Id = "sandboxTransport" transportInfo.Name = "REST" transportType := smc.REST_HTTP_TransportType transportInfo.Type_ = &transportType Loading Loading
go-apps/meep-ams/server/ams.go +22 −12 Original line number Diff line number Diff line Loading @@ -505,7 +505,7 @@ func registerService(appInstanceId string) error { //transportInfo var transportInfo smc.TransportInfo transportInfo.Id = "transport" transportInfo.Id = "sandboxTransport" transportInfo.Name = "REST" transportType := smc.REST_HTTP_TransportType transportInfo.Type_ = &transportType Loading Loading @@ -1020,18 +1020,18 @@ func checkMpNotificationRegisteredSubscriptions(appId string, assocId *Associate if err != nil || len(fields) == 0 { instanceFound = false } if instanceFound && fields["serviceLevel"] == string(AppMobilityServiceLevel_APP_MOBILITY_NOT_ALLOWED) { if instanceFound && fields["serviceLevel"] == strconv.Itoa(int(AppMobilityServiceLevel_APP_MOBILITY_NOT_ALLOWED)) { break } if !instanceFound { instanceFound = true key = baseKey + "mep:" + mepId + ":dev:" + assocId.Value key = baseKey + "mepId:" + mepId + ":dev:" + assocId.Value fields, err = rc.GetEntry(key) if err != nil || len(fields) == 0 { instanceFound = false } if instanceFound && fields["serviceLevel"] == string(AppMobilityServiceLevel_APP_MOBILITY_NOT_ALLOWED) { if instanceFound && fields["serviceLevel"] == strconv.Itoa(int(AppMobilityServiceLevel_APP_MOBILITY_NOT_ALLOWED)) { break } } Loading Loading @@ -1627,6 +1627,22 @@ func appMobilityServicePOST(w http.ResponseWriter, r *http.Request) { return } if registrationInfo.ServiceConsumerId.MepId != "" && mepName != registrationInfo.ServiceConsumerId.MepId { log.Error("This is not a possible value. Cannot track movements to other MEP.") http.Error(w, "MepId must match current MEP. Cannot track movements in other MEPs.", http.StatusBadRequest) return } //do a first pass to validate the content of deviceInfo for _, deviceInfo := range registrationInfo.DeviceInformation { //associateId is mandatory if deviceInfo is present if deviceInfo.AssociateId == nil { log.Error("AssociateId is a mandatory parameter if deviceInformation is present.") http.Error(w, "AssociateId is a mandatory parameter if deviceInformation is present.", http.StatusBadRequest) return } } //new service id newServId := nextServiceIdAvailable nextServiceIdAvailable++ Loading @@ -1634,12 +1650,6 @@ func appMobilityServicePOST(w http.ResponseWriter, r *http.Request) { registrationInfo.AppMobilityServiceId = servIdStr if registrationInfo.ServiceConsumerId.MepId != "" && mepName != registrationInfo.ServiceConsumerId.MepId { log.Error("This is not a possible value. Cannot track movements to other MEP.") http.Error(w, "MepId must match current MEP. Cannot track movements in other MEPs.", http.StatusBadRequest) return } key := baseKey + "services:" + servIdStr _ = rc.JSONSetEntry(key, ".", convertRegistrationInfoToJson(®istrationInfo)) Loading Loading @@ -1933,8 +1943,8 @@ func updateDeviceInfo(address string, zoneId string, procList []string) { // Update Device info in DB & Send notifications fields["zoneId"] = zoneId _ = rc.SetEntry(key, fields) //check 2 different MEPs are involved and destination is the current mep only (so entering) if mepZonesMap[oldZoneId] != mepZonesMap[zoneId] { // && mepZonesMap[zoneId] == mepName { //check 2 different MEPs are involved and destination is the current mep only (so leaving only) if mepZonesMap[oldZoneId] != mepZonesMap[zoneId] && mepZonesMap[oldZoneId] == mepName { //find all affected appIds var appInstanceIdsList AppInstanceIdsList Loading
go-apps/meep-app-enablement/server/service-mgmt/service-mgmt.go +37 −21 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ var nextSubscriptionIdAvailable int type ServiceInfoList struct { Services []ServiceInfo ConsumedLocalOnlyPresent bool IsLocalPresent bool Filters *FilterParameters } Loading Loading @@ -801,12 +803,16 @@ func getServices(w http.ResponseWriter, r *http.Request, appInstanceId string) { serName := q["ser_name"] serCategoryId := q.Get("ser_category_id") consumedLocalOnly, err := strconv.ParseBool(q.Get("consumed_local_only")) consumedLocalOnlyPresent := true if err != nil { consumedLocalOnly = false consumedLocalOnlyPresent = false } isLocal, err := strconv.ParseBool(q.Get("is_local")) isLocalPresent := true if err != nil { isLocal = false isLocalPresent = false } scopeOfLocality := q.Get("scope_of_locality") Loading @@ -827,6 +833,8 @@ func getServices(w http.ResponseWriter, r *http.Request, appInstanceId string) { filterParameters.isLocal = isLocal filterParameters.scopeOfLocality = scopeOfLocality sInfoList.Filters = &filterParameters sInfoList.ConsumedLocalOnlyPresent = consumedLocalOnlyPresent sInfoList.IsLocalPresent = isLocalPresent var key string if appInstanceId == "" { Loading Loading @@ -913,6 +921,18 @@ func populateServiceInfoList(key string, jsonInfo string, sInfoList interface{}) // Get MEP Name mep := getMepNameFromKey(key) // Set IsLocal flag if *sInfo.ScopeOfLocality == MEC_SYSTEM || (mep != "" && mep == mepName) { sInfo.IsLocal = true } else { sInfo.IsLocal = false } // Filter out non-local services with "consumedLocalOnly" flag set to "true" if !sInfo.IsLocal && sInfo.ConsumedLocalOnly { return nil } // Filter services if data.Filters != nil { Loading Loading @@ -961,30 +981,26 @@ func populateServiceInfoList(key string, jsonInfo string, sInfoList interface{}) } // Service consumed local only if data.ConsumedLocalOnlyPresent { if data.Filters.consumedLocalOnly { if !sInfo.ConsumedLocalOnly { return nil } } else { //data.Filters.consumedLocalOnly is false if sInfo.ConsumedLocalOnly { return nil } } } // Is local service if data.IsLocalPresent { if data.Filters.isLocal { if mep == "" || mep != mepName { if !sInfo.IsLocal { return nil } } } // Set IsLocal flag if *sInfo.ScopeOfLocality == MEC_SYSTEM || (mep != "" && mep == mepName) { sInfo.IsLocal = true } else { sInfo.IsLocal = false } // Filter out non-local services with "consumedLocalOnly" flag set to "true" if !sInfo.IsLocal && sInfo.ConsumedLocalOnly { return nil } // Add service to list Loading Loading @@ -1268,7 +1284,7 @@ func transportsGET(w http.ResponseWriter, r *http.Request) { //transportInfo var transportInfo TransportInfo transportInfo.Id = "transport" transportInfo.Id = "sandboxTransport" transportInfo.Name = "REST" transportType := REST_HTTP transportInfo.Type_ = &transportType Loading
go-apps/meep-loc-serv/server/loc-serv.go +1 −1 Original line number Diff line number Diff line Loading @@ -505,7 +505,7 @@ func registerService(appInstanceId string) error { //transportInfo var transportInfo smc.TransportInfo transportInfo.Id = "transport" transportInfo.Id = "sandboxTransport" transportInfo.Name = "REST" transportType := smc.REST_HTTP_TransportType transportInfo.Type_ = &transportType Loading
go-apps/meep-rnis/server/rnis.go +1 −1 Original line number Diff line number Diff line Loading @@ -582,7 +582,7 @@ func registerService(appInstanceId string) error { //transportInfo var transportInfo smc.TransportInfo transportInfo.Id = "transport" transportInfo.Id = "sandboxTransport" transportInfo.Name = "REST" transportType := smc.REST_HTTP_TransportType transportInfo.Type_ = &transportType Loading
go-apps/meep-wais/server/wais.go +1 −1 Original line number Diff line number Diff line Loading @@ -469,7 +469,7 @@ func registerService(appInstanceId string) error { //transportInfo var transportInfo smc.TransportInfo transportInfo.Id = "transport" transportInfo.Id = "sandboxTransport" transportInfo.Name = "REST" transportType := smc.REST_HTTP_TransportType transportInfo.Type_ = &transportType Loading