Loading go-apps/meep-gis-engine/server/gis-engine.go +30 −7 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ type GisEngine struct { sessionMgr *sm.SessionMgr pc *postgis.Connector assets map[string]*Asset uePoaInfo map[string]PoaInfo uePoaInfo map[string]*PoaInfo automation map[string]bool ticker *time.Ticker updateTime time.Time Loading @@ -101,7 +101,7 @@ var ge *GisEngine func Init() (err error) { ge = new(GisEngine) ge.assets = make(map[string]*Asset) ge.uePoaInfo = make(map[string]PoaInfo) ge.uePoaInfo = make(map[string]*PoaInfo) ge.automation = make(map[string]bool) resetAutomation() startAutomation() Loading Loading @@ -776,12 +776,22 @@ func runAutomation() { ueMap, err := ge.pc.GetAllUe() if err == nil { for _, ue := range ueMap { // Get last POA info // Get stored UE POA info or create new one newPoaInfo := false poaInfo, found := ge.uePoaInfo[ue.Name] if !found { poaInfo = new(PoaInfo) poaInfo.connected = false poaInfo.distance = 0 poaInfo.poaInRange = []string{} poaInfo.poa = "" ge.uePoaInfo[ue.Name] = poaInfo newPoaInfo = true } // Send mobility event if necessary if ge.automation[AutoTypeMobility] { if !found || (ue.Poa != "" && ue.Poa != poaInfo.poa) || (ue.Poa == "" && poaInfo.connected) { if newPoaInfo || (ue.Poa != "" && ue.Poa != poaInfo.poa) || (ue.Poa == "" && poaInfo.connected) { var event sbox.Event var mobilityEvent sbox.EventMobility event.Type_ = AutoTypeMobility Loading @@ -799,13 +809,18 @@ func runAutomation() { log.Error(err) } }() // Update sotred data poaInfo.poa = ue.Poa poaInfo.distance = ue.PoaDistance poaInfo.connected = ue.Connected } } // Send POA in range event if necessary if ge.automation[AutoTypePoaInRange] { updateRequired := false if len(poaInfo.poaInRange) != len(ue.PoaInRange) { if newPoaInfo || len(poaInfo.poaInRange) != len(ue.PoaInRange) { updateRequired = true } else { sort.Strings(poaInfo.poaInRange) Loading @@ -830,12 +845,20 @@ func runAutomation() { log.Error(err) } }() // Update sotred data poaInfo.poaInRange = ue.PoaInRange } } } // Update POA info ge.uePoaInfo[ue.Name] = PoaInfo{poa: ue.Poa, distance: ue.PoaDistance, poaInRange: ue.PoaInRange, connected: ue.Connected} // Remove UE Poa info if UEs no longer present for ueName := range ge.uePoaInfo { if _, found := ueMap[ueName]; !found { delete(ge.uePoaInfo, ueName) } } } else { log.Error(err.Error()) } Loading go-apps/meep-loc-serv/sbi/loc-serv-sbi.go +42 −6 Original line number Diff line number Diff line Loading @@ -155,7 +155,15 @@ func processActiveScenarioTerminate() { func processActiveScenarioUpdate() { log.Debug("processActiveScenarioUpdate") previousUeNameList := sbi.activeModel.GetNodeNames("UE") // Get previous list of connected UEs prevUeNames := []string{} prevUeNameList := sbi.activeModel.GetNodeNames("UE") for _, name := range prevUeNameList { if isUeConnected(name) { prevUeNames = append(prevUeNames, name) } } // Sync with active scenario store sbi.activeModel.UpdateScenario() Loading @@ -172,8 +180,15 @@ func processActiveScenarioUpdate() { poaMap, _ := sbi.pc.GetAllPoa() // Update UE info ueNames := []string{} ueNameList := sbi.activeModel.GetNodeNames("UE") for _, name := range ueNameList { // Ignore disconnected UEs if !isUeConnected(name) { continue } ueNames = append(ueNames, name) zone, netLoc, err := getNetworkLocation(name) if err != nil { log.Error(err.Error()) Loading @@ -192,17 +207,17 @@ func processActiveScenarioUpdate() { } // Update UEs that were removed for _, oldUe := range previousUeNameList { for _, prevUeName := range prevUeNames { found := false for _, newUe := range ueNameList { if newUe == oldUe { for _, ueName := range ueNames { if ueName == prevUeName { found = true break } } if !found { sbi.updateUserInfoCB(oldUe, "", "", nil, nil) log.Info("Ue removed : ", oldUe) sbi.updateUserInfoCB(prevUeName, "", "", nil, nil) log.Info("Ue removed : ", prevUeName) } } Loading Loading @@ -278,6 +293,11 @@ func parsePosition(position string) (longitude *float32, latitude *float32) { } func updateUserPosition(name string) { // Ignore disconnected UE if !isUeConnected(name) { return } // Get network location zone, netLoc, err := getNetworkLocation(name) if err != nil { Loading @@ -304,6 +324,11 @@ func updateAllUserPosition() { // Update info ueNameList := sbi.activeModel.GetNodeNames("UE") for _, name := range ueNameList { // Ignore disconnected UEs if !isUeConnected(name) { continue } // Get network location zone, netLoc, err := getNetworkLocation(name) if err != nil { Loading Loading @@ -371,3 +396,14 @@ func Stop() (err error) { sbi.mqLocal.UnregisterHandler(sbi.handlerId) return nil } func isUeConnected(name string) bool { node := sbi.activeModel.GetNode(name) if node != nil { pl := node.(*dataModel.PhysicalLocation) if pl.Connected { return true } } return false } go-packages/meep-model/model.go +1 −1 Original line number Diff line number Diff line Loading @@ -883,7 +883,7 @@ func (m *Model) UpdateScenario() { // An update was received - Update the object state and call the external Handler // Retrieve active scenario from DB j, err := m.rc.JSONGetEntry(m.activeKey, ".") log.Debug("Scenario Event:", j) log.Trace("Scenario Event:", j) if err != nil { log.Debug("Scenario was deleted") // Scenario was deleted Loading Loading
go-apps/meep-gis-engine/server/gis-engine.go +30 −7 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ type GisEngine struct { sessionMgr *sm.SessionMgr pc *postgis.Connector assets map[string]*Asset uePoaInfo map[string]PoaInfo uePoaInfo map[string]*PoaInfo automation map[string]bool ticker *time.Ticker updateTime time.Time Loading @@ -101,7 +101,7 @@ var ge *GisEngine func Init() (err error) { ge = new(GisEngine) ge.assets = make(map[string]*Asset) ge.uePoaInfo = make(map[string]PoaInfo) ge.uePoaInfo = make(map[string]*PoaInfo) ge.automation = make(map[string]bool) resetAutomation() startAutomation() Loading Loading @@ -776,12 +776,22 @@ func runAutomation() { ueMap, err := ge.pc.GetAllUe() if err == nil { for _, ue := range ueMap { // Get last POA info // Get stored UE POA info or create new one newPoaInfo := false poaInfo, found := ge.uePoaInfo[ue.Name] if !found { poaInfo = new(PoaInfo) poaInfo.connected = false poaInfo.distance = 0 poaInfo.poaInRange = []string{} poaInfo.poa = "" ge.uePoaInfo[ue.Name] = poaInfo newPoaInfo = true } // Send mobility event if necessary if ge.automation[AutoTypeMobility] { if !found || (ue.Poa != "" && ue.Poa != poaInfo.poa) || (ue.Poa == "" && poaInfo.connected) { if newPoaInfo || (ue.Poa != "" && ue.Poa != poaInfo.poa) || (ue.Poa == "" && poaInfo.connected) { var event sbox.Event var mobilityEvent sbox.EventMobility event.Type_ = AutoTypeMobility Loading @@ -799,13 +809,18 @@ func runAutomation() { log.Error(err) } }() // Update sotred data poaInfo.poa = ue.Poa poaInfo.distance = ue.PoaDistance poaInfo.connected = ue.Connected } } // Send POA in range event if necessary if ge.automation[AutoTypePoaInRange] { updateRequired := false if len(poaInfo.poaInRange) != len(ue.PoaInRange) { if newPoaInfo || len(poaInfo.poaInRange) != len(ue.PoaInRange) { updateRequired = true } else { sort.Strings(poaInfo.poaInRange) Loading @@ -830,12 +845,20 @@ func runAutomation() { log.Error(err) } }() // Update sotred data poaInfo.poaInRange = ue.PoaInRange } } } // Update POA info ge.uePoaInfo[ue.Name] = PoaInfo{poa: ue.Poa, distance: ue.PoaDistance, poaInRange: ue.PoaInRange, connected: ue.Connected} // Remove UE Poa info if UEs no longer present for ueName := range ge.uePoaInfo { if _, found := ueMap[ueName]; !found { delete(ge.uePoaInfo, ueName) } } } else { log.Error(err.Error()) } Loading
go-apps/meep-loc-serv/sbi/loc-serv-sbi.go +42 −6 Original line number Diff line number Diff line Loading @@ -155,7 +155,15 @@ func processActiveScenarioTerminate() { func processActiveScenarioUpdate() { log.Debug("processActiveScenarioUpdate") previousUeNameList := sbi.activeModel.GetNodeNames("UE") // Get previous list of connected UEs prevUeNames := []string{} prevUeNameList := sbi.activeModel.GetNodeNames("UE") for _, name := range prevUeNameList { if isUeConnected(name) { prevUeNames = append(prevUeNames, name) } } // Sync with active scenario store sbi.activeModel.UpdateScenario() Loading @@ -172,8 +180,15 @@ func processActiveScenarioUpdate() { poaMap, _ := sbi.pc.GetAllPoa() // Update UE info ueNames := []string{} ueNameList := sbi.activeModel.GetNodeNames("UE") for _, name := range ueNameList { // Ignore disconnected UEs if !isUeConnected(name) { continue } ueNames = append(ueNames, name) zone, netLoc, err := getNetworkLocation(name) if err != nil { log.Error(err.Error()) Loading @@ -192,17 +207,17 @@ func processActiveScenarioUpdate() { } // Update UEs that were removed for _, oldUe := range previousUeNameList { for _, prevUeName := range prevUeNames { found := false for _, newUe := range ueNameList { if newUe == oldUe { for _, ueName := range ueNames { if ueName == prevUeName { found = true break } } if !found { sbi.updateUserInfoCB(oldUe, "", "", nil, nil) log.Info("Ue removed : ", oldUe) sbi.updateUserInfoCB(prevUeName, "", "", nil, nil) log.Info("Ue removed : ", prevUeName) } } Loading Loading @@ -278,6 +293,11 @@ func parsePosition(position string) (longitude *float32, latitude *float32) { } func updateUserPosition(name string) { // Ignore disconnected UE if !isUeConnected(name) { return } // Get network location zone, netLoc, err := getNetworkLocation(name) if err != nil { Loading @@ -304,6 +324,11 @@ func updateAllUserPosition() { // Update info ueNameList := sbi.activeModel.GetNodeNames("UE") for _, name := range ueNameList { // Ignore disconnected UEs if !isUeConnected(name) { continue } // Get network location zone, netLoc, err := getNetworkLocation(name) if err != nil { Loading Loading @@ -371,3 +396,14 @@ func Stop() (err error) { sbi.mqLocal.UnregisterHandler(sbi.handlerId) return nil } func isUeConnected(name string) bool { node := sbi.activeModel.GetNode(name) if node != nil { pl := node.(*dataModel.PhysicalLocation) if pl.Connected { return true } } return false }
go-packages/meep-model/model.go +1 −1 Original line number Diff line number Diff line Loading @@ -883,7 +883,7 @@ func (m *Model) UpdateScenario() { // An update was received - Update the object state and call the external Handler // Retrieve active scenario from DB j, err := m.rc.JSONGetEntry(m.activeKey, ".") log.Debug("Scenario Event:", j) log.Trace("Scenario Event:", j) if err != nil { log.Debug("Scenario was deleted") // Scenario was deleted Loading