Loading charts/meep-loc-serv/templates/deployment.yaml +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ spec: env: {{- range $key, $value := .Values.image.env }} - name: {{ $key }} value: {{ $value }} value: {{ $value | quote }} {{- end }} {{- if .Values.codecov.enabled}} volumeMounts: Loading go-apps/meep-loc-serv/sbi/loc-serv-sbi.go +43 −6 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ const moduleName string = "meep-loc-serv-sbi" type SbiCfg struct { SandboxName string RedisAddr string Locality []string UserInfoCb func(string, string, string, *float32, *float32) ZoneInfoCb func(string, int, int, int) ApInfoCb func(string, string, string, string, int, *float32, *float32) Loading @@ -43,6 +44,7 @@ type SbiCfg struct { type LocServSbi struct { sandboxName string locality map[string]bool mqLocal *mq.MsgQueue handlerId int activeModel *mod.Model Loading Loading @@ -70,6 +72,12 @@ func Init(cfg SbiCfg) (err error) { sbi.updateScenarioNameCB = cfg.ScenarioNameCb sbi.cleanUpCB = cfg.CleanUpCb // Fill locality map sbi.locality = make(map[string]bool) for _, locality := range cfg.Locality { sbi.locality[locality] = true } // Create message queue sbi.mqLocal, err = mq.NewMsgQueue(mq.GetLocalName(sbi.sandboxName), moduleName, sbi.sandboxName, cfg.RedisAddr) if err != nil { Loading Loading @@ -215,14 +223,22 @@ func processActiveScenarioUpdate() { if !isUeConnected(name) { continue } ueNames = append(ueNames, name) // Get UE locality zone, netLoc, err := getNetworkLocation(name) if err != nil { log.Error(err.Error()) continue } // Ignore UEs in zones outside locality if !isInLocality(zone) { continue } // Add UE to list of valid UEs ueNames = append(ueNames, name) var longitude *float32 var latitude *float32 if position, found := uePositionMap[name]; found { Loading @@ -235,7 +251,7 @@ func processActiveScenarioUpdate() { uePerNetLocMap[netLoc]++ } // Update UEs that were removed // Update UEs that were removed (no longer in locality) for _, prevUeName := range prevUeNames { found := false for _, ueName := range ueNames { Loading @@ -257,12 +273,18 @@ func processActiveScenarioUpdate() { poaNameList := sbi.activeModel.GetNodeNames(poaType) for _, name := range poaNameList { // Get POA locality zone, netLoc, err := getNetworkLocation(name) if err != nil { log.Error(err.Error()) continue } // Ignore POAs in zones outside locality if !isInLocality(zone) { continue } var longitude *float32 var latitude *float32 if position, found := poaPositionMap[name]; found { Loading @@ -285,10 +307,10 @@ func processActiveScenarioUpdate() { } } // Update Zone info // Update Zone info (must be in locality) zoneNameList := sbi.activeModel.GetNodeNames("ZONE") for _, name := range zoneNameList { if name != "" && !strings.Contains(name, "-COMMON") { if name != "" && !strings.Contains(name, "-COMMON") && isInLocality(name) { sbi.updateZoneInfoCB(name, poaPerZoneMap[name], 0, uePerZoneMap[name]) } } Loading Loading @@ -319,13 +341,18 @@ func refreshPositions() { continue } // Get network location // Get UE locality zone, netLoc, err := getNetworkLocation(name) if err != nil { log.Error(err.Error()) return } // Ignore UEs in zones outside locality if !isInLocality(zone) { continue } // Get position var longitude *float32 var latitude *float32 Loading @@ -341,13 +368,18 @@ func refreshPositions() { poaPositionMap, _ := sbi.gisCache.GetAllPositions(gc.TypePoa) poaNameList := sbi.activeModel.GetNodeNames(mod.NodeTypePoa4G, mod.NodeTypePoa5G, mod.NodeTypePoaWifi, mod.NodeTypePoa) for _, name := range poaNameList { // Get network location // Get POA locality zone, netLoc, err := getNetworkLocation(name) if err != nil { log.Error(err.Error()) return } // Ignore POAs in zones outside locality if !isInLocality(zone) { continue } // Get position var longitude *float32 var latitude *float32 Loading @@ -370,3 +402,8 @@ func isUeConnected(name string) bool { } return false } func isInLocality(zone string) bool { _, found := sbi.locality[zone] return found } go-apps/meep-loc-serv/server/loc-serv.go +3 −2 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ var sandboxName string var mepName string = defaultMepName var scopeOfLocality string = defaultScopeOfLocality var consumedLocalOnly bool = defaultConsumedLocalOnly var locality []string = []string{} var locality []string var basePath string var baseKey string var mutex sync.Mutex Loading Loading @@ -221,7 +221,7 @@ func Init() (err error) { // Get local consumption consumedLocalOnlyEnv := strings.TrimSpace(os.Getenv("MEEP_CONSUMED_LOCAL_ONLY")) if consumedLocalOnlyEnv != "" { value, err := strconv.ParseBool("true") value, err := strconv.ParseBool(consumedLocalOnlyEnv) if err == nil { consumedLocalOnly = value } Loading Loading @@ -274,6 +274,7 @@ func Init() (err error) { sbiCfg := sbi.SbiCfg{ SandboxName: sandboxName, RedisAddr: redisAddr, Locality: locality, UserInfoCb: updateUserInfo, ZoneInfoCb: updateZoneInfo, ApInfoCb: updateAccessPointInfo, Loading Loading
charts/meep-loc-serv/templates/deployment.yaml +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ spec: env: {{- range $key, $value := .Values.image.env }} - name: {{ $key }} value: {{ $value }} value: {{ $value | quote }} {{- end }} {{- if .Values.codecov.enabled}} volumeMounts: Loading
go-apps/meep-loc-serv/sbi/loc-serv-sbi.go +43 −6 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ const moduleName string = "meep-loc-serv-sbi" type SbiCfg struct { SandboxName string RedisAddr string Locality []string UserInfoCb func(string, string, string, *float32, *float32) ZoneInfoCb func(string, int, int, int) ApInfoCb func(string, string, string, string, int, *float32, *float32) Loading @@ -43,6 +44,7 @@ type SbiCfg struct { type LocServSbi struct { sandboxName string locality map[string]bool mqLocal *mq.MsgQueue handlerId int activeModel *mod.Model Loading Loading @@ -70,6 +72,12 @@ func Init(cfg SbiCfg) (err error) { sbi.updateScenarioNameCB = cfg.ScenarioNameCb sbi.cleanUpCB = cfg.CleanUpCb // Fill locality map sbi.locality = make(map[string]bool) for _, locality := range cfg.Locality { sbi.locality[locality] = true } // Create message queue sbi.mqLocal, err = mq.NewMsgQueue(mq.GetLocalName(sbi.sandboxName), moduleName, sbi.sandboxName, cfg.RedisAddr) if err != nil { Loading Loading @@ -215,14 +223,22 @@ func processActiveScenarioUpdate() { if !isUeConnected(name) { continue } ueNames = append(ueNames, name) // Get UE locality zone, netLoc, err := getNetworkLocation(name) if err != nil { log.Error(err.Error()) continue } // Ignore UEs in zones outside locality if !isInLocality(zone) { continue } // Add UE to list of valid UEs ueNames = append(ueNames, name) var longitude *float32 var latitude *float32 if position, found := uePositionMap[name]; found { Loading @@ -235,7 +251,7 @@ func processActiveScenarioUpdate() { uePerNetLocMap[netLoc]++ } // Update UEs that were removed // Update UEs that were removed (no longer in locality) for _, prevUeName := range prevUeNames { found := false for _, ueName := range ueNames { Loading @@ -257,12 +273,18 @@ func processActiveScenarioUpdate() { poaNameList := sbi.activeModel.GetNodeNames(poaType) for _, name := range poaNameList { // Get POA locality zone, netLoc, err := getNetworkLocation(name) if err != nil { log.Error(err.Error()) continue } // Ignore POAs in zones outside locality if !isInLocality(zone) { continue } var longitude *float32 var latitude *float32 if position, found := poaPositionMap[name]; found { Loading @@ -285,10 +307,10 @@ func processActiveScenarioUpdate() { } } // Update Zone info // Update Zone info (must be in locality) zoneNameList := sbi.activeModel.GetNodeNames("ZONE") for _, name := range zoneNameList { if name != "" && !strings.Contains(name, "-COMMON") { if name != "" && !strings.Contains(name, "-COMMON") && isInLocality(name) { sbi.updateZoneInfoCB(name, poaPerZoneMap[name], 0, uePerZoneMap[name]) } } Loading Loading @@ -319,13 +341,18 @@ func refreshPositions() { continue } // Get network location // Get UE locality zone, netLoc, err := getNetworkLocation(name) if err != nil { log.Error(err.Error()) return } // Ignore UEs in zones outside locality if !isInLocality(zone) { continue } // Get position var longitude *float32 var latitude *float32 Loading @@ -341,13 +368,18 @@ func refreshPositions() { poaPositionMap, _ := sbi.gisCache.GetAllPositions(gc.TypePoa) poaNameList := sbi.activeModel.GetNodeNames(mod.NodeTypePoa4G, mod.NodeTypePoa5G, mod.NodeTypePoaWifi, mod.NodeTypePoa) for _, name := range poaNameList { // Get network location // Get POA locality zone, netLoc, err := getNetworkLocation(name) if err != nil { log.Error(err.Error()) return } // Ignore POAs in zones outside locality if !isInLocality(zone) { continue } // Get position var longitude *float32 var latitude *float32 Loading @@ -370,3 +402,8 @@ func isUeConnected(name string) bool { } return false } func isInLocality(zone string) bool { _, found := sbi.locality[zone] return found }
go-apps/meep-loc-serv/server/loc-serv.go +3 −2 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ var sandboxName string var mepName string = defaultMepName var scopeOfLocality string = defaultScopeOfLocality var consumedLocalOnly bool = defaultConsumedLocalOnly var locality []string = []string{} var locality []string var basePath string var baseKey string var mutex sync.Mutex Loading Loading @@ -221,7 +221,7 @@ func Init() (err error) { // Get local consumption consumedLocalOnlyEnv := strings.TrimSpace(os.Getenv("MEEP_CONSUMED_LOCAL_ONLY")) if consumedLocalOnlyEnv != "" { value, err := strconv.ParseBool("true") value, err := strconv.ParseBool(consumedLocalOnlyEnv) if err == nil { consumedLocalOnly = value } Loading Loading @@ -274,6 +274,7 @@ func Init() (err error) { sbiCfg := sbi.SbiCfg{ SandboxName: sandboxName, RedisAddr: redisAddr, Locality: locality, UserInfoCb: updateUserInfo, ZoneInfoCb: updateZoneInfo, ApInfoCb: updateAccessPointInfo, Loading