Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map Styling + Frontend state & rendering optimizations #114

Merged
merged 6 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/demo1/src/demo-server/go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 0.0.1
- Build date: 2020-07-16T13:21:23.983-04:00
- Build date: 2020-08-07T09:19:41.906-04:00


### Running the server
Expand Down
2 changes: 1 addition & 1 deletion examples/demo1/src/iperf-proxy/go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 0.0.1
- Build date: 2020-07-16T13:21:25.297-04:00
- Build date: 2020-08-07T09:19:43.374-04:00


### Running the server
Expand Down
20 changes: 20 additions & 0 deletions go-apps/meep-gis-engine/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,16 @@ paths:
- "CLOUD"
x-exportParamName: "SubType"
x-optionalDataType: "String"
- name: "excludePath"
in: "query"
description: "Exclude UE paths in response (default: false)"
required: false
type: "string"
enum:
- "true"
- "false"
x-exportParamName: "ExcludePath"
x-optionalDataType: "String"
responses:
200:
description: "OK"
Expand All @@ -161,6 +171,16 @@ paths:
required: true
type: "string"
x-exportParamName: "AssetName"
- name: "excludePath"
in: "query"
description: "Exclude UE paths in response (default: false)"
required: false
type: "string"
enum:
- "true"
- "false"
x-exportParamName: "ExcludePath"
x-optionalDataType: "String"
responses:
200:
description: "OK"
Expand Down
2 changes: 1 addition & 1 deletion go-apps/meep-gis-engine/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 1.0.0
- Build date: 2020-07-16T13:21:18.296-04:00
- Build date: 2020-08-07T09:19:35.724-04:00


### Running the server
Expand Down
22 changes: 19 additions & 3 deletions go-apps/meep-gis-engine/server/gis-engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,7 @@ func geGetAssetData(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
assetType := query.Get("assetType")
subType := query.Get("subType")
excludePath := query.Get("excludePath")
assetTypeStr := "*"
if assetType != "" {
assetTypeStr = assetType
Expand All @@ -815,7 +816,7 @@ func geGetAssetData(w http.ResponseWriter, r *http.Request) {
if subType != "" {
subTypeStr = subType
}
log.Debug("Get GeoData for assetType[", assetTypeStr, "] subType[", subTypeStr, "]")
log.Debug("Get GeoData for assetType[", assetTypeStr, "] subType[", subTypeStr, "] excludePath[", excludePath, "]")

var assetList GeoDataAssetList

Expand All @@ -837,7 +838,13 @@ func geGetAssetData(w http.ResponseWriter, r *http.Request) {
asset.AssetName = ue.Name
asset.AssetType = AssetTypeUe
asset.SubType = mod.NodeTypeUE
err = fillGeoDataAsset(&asset, ue.Position, 0, ue.Path, ue.PathMode, ue.PathVelocity)

// Exclude path if necessary
if excludePath == "true" {
err = fillGeoDataAsset(&asset, ue.Position, 0, "", ue.PathMode, ue.PathVelocity)
} else {
err = fillGeoDataAsset(&asset, ue.Position, 0, ue.Path, ue.PathMode, ue.PathVelocity)
}
if err != nil {
log.Error(err.Error())
http.Error(w, err.Error(), http.StatusInternalServerError)
Expand Down Expand Up @@ -923,6 +930,10 @@ func geGetGeoDataByName(w http.ResponseWriter, r *http.Request) {
assetName := vars["assetName"]
log.Debug("Get GeoData for asset: ", assetName)

// Retrieve query parameters
query := r.URL.Query()
excludePath := query.Get("excludePath")

// Make sure scenario is active
if ge.activeModel.GetScenarioName() == "" {
err := errors.New("No active scenario")
Expand Down Expand Up @@ -957,7 +968,12 @@ func geGetGeoDataByName(w http.ResponseWriter, r *http.Request) {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
err = fillGeoDataAsset(&asset, ue.Position, 0, ue.Path, ue.PathMode, ue.PathVelocity)
// Exclude path if necessary
if excludePath == "true" {
err = fillGeoDataAsset(&asset, ue.Position, 0, "", ue.PathMode, ue.PathVelocity)
} else {
err = fillGeoDataAsset(&asset, ue.Position, 0, ue.Path, ue.PathMode, ue.PathVelocity)
}
if err != nil {
log.Error(err.Error())
http.Error(w, err.Error(), http.StatusInternalServerError)
Expand Down
2 changes: 1 addition & 1 deletion go-apps/meep-loc-serv/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 1.1.1
- Build date: 2020-07-27T13:41:42.509-04:00
- Build date: 2020-08-07T09:19:36.498-04:00


### Running the server
Expand Down
5 changes: 4 additions & 1 deletion go-apps/meep-loc-serv/server/loc-serv.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,11 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn

//check all that applies
for subsId, zoneStatus := range zoneStatusSubscriptionMap {
if zoneStatus.ZoneId == zoneId {
if zoneStatus == nil {
continue
}

if zoneStatus.ZoneId == zoneId {
nbUsersInZone := 0
nbUsersInAP := -1
zoneWarning := false
Expand Down
2 changes: 1 addition & 1 deletion go-apps/meep-metrics-engine/server/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 1.0.0
- Build date: 2020-07-16T13:21:16.033-04:00
- Build date: 2020-08-07T09:19:33.441-04:00


### Running the server
Expand Down
2 changes: 1 addition & 1 deletion go-apps/meep-mg-manager/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 1.0.0
- Build date: 2020-07-16T13:21:12.289-04:00
- Build date: 2020-08-07T09:19:29.567-04:00


### Running the server
Expand Down
2 changes: 1 addition & 1 deletion go-apps/meep-mon-engine/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 1.0.0
- Build date: 2020-07-16T13:21:10.959-04:00
- Build date: 2020-08-07T09:19:28.071-04:00


### Running the server
Expand Down
2 changes: 0 additions & 2 deletions go-apps/meep-platform-ctrl/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ require (
github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store v0.0.0
github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions v0.0.0
github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-users v0.0.0
github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-watchdog v0.0.0
github.com/gorilla/handlers v1.4.0
github.com/gorilla/mux v1.7.3
)
Expand All @@ -29,5 +28,4 @@ replace (
github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store => ../../go-packages/meep-sandbox-store
github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions => ../../go-packages/meep-sessions
github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-users => ../../go-packages/meep-users
github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-watchdog => ../../go-packages/meep-watchdog
)
2 changes: 1 addition & 1 deletion go-apps/meep-platform-ctrl/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 1.0.0
- Build date: 2020-07-16T13:20:50.309-04:00
- Build date: 2020-08-07T09:19:07.332-04:00


### Running the server
Expand Down
18 changes: 0 additions & 18 deletions go-apps/meep-platform-ctrl/server/platform-ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
sbs "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store"
ss "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions"
users "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-users"
wd "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-watchdog"
)

type Scenario struct {
Expand All @@ -50,16 +49,13 @@ type PlatformCtrl struct {
sandboxStore *sbs.SandboxStore
sessionStore *ss.SessionStore
userStore *users.Connector
veWatchdog *wd.Watchdog
mqGlobal *mq.MsgQueue
}

const scenarioDBName = "scenarios"
const redisTable = 0
const moduleName = "meep-platform-ctrl"
const moduleNamespace = "default"
const moduleVirtEngineName = "meep-virt-engine"
const moduleVirtEngineNamespace = "default"
const postgisUser = "postgres"
const postgisPwd = "pwd"

Expand Down Expand Up @@ -160,26 +156,12 @@ func Init() (err error) {
_ = pfmCtrl.userStore.CreateTables()
log.Info("Connected to User Store")

// Setup for virt-engine monitoring
pfmCtrl.veWatchdog, err = wd.NewWatchdog(moduleName, moduleNamespace, moduleVirtEngineName, moduleVirtEngineNamespace, "")
if err != nil {
log.Error("Failed to initialize virt-engine wd. Error: ", err)
return err
}

return nil
}

// Run Starts the Platform Controller
func Run() (err error) {

// Start Virt Engine wd
err = pfmCtrl.veWatchdog.Start(time.Second, 3*time.Second)
if err != nil {
log.Error("Failed to start virt-engine wd. Error: ", err)
return err
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion go-apps/meep-rnis/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 1.1.1
- Build date: 2020-07-27T13:41:46.358-04:00
- Build date: 2020-08-07T09:19:39.047-04:00


### Running the server
Expand Down
12 changes: 11 additions & 1 deletion go-apps/meep-sandbox-ctrl/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ paths:
operationId: "getActiveScenario"
produces:
- "application/json"
parameters: []
parameters:
- name: "minimize"
in: "query"
description: "Return a minimized active scenario (default: false)"
required: false
type: "string"
enum:
- "true"
- "false"
x-exportParamName: "Minimize"
x-optionalDataType: "String"
responses:
200:
description: "OK"
Expand Down
2 changes: 1 addition & 1 deletion go-apps/meep-sandbox-ctrl/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 1.0.0
- Build date: 2020-07-27T13:41:26.754-04:00
- Build date: 2020-08-07T09:19:26.713-04:00


### Running the server
Expand Down
12 changes: 11 additions & 1 deletion go-apps/meep-sandbox-ctrl/server/sandbox-ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,17 @@ func ceGetActiveScenario(w http.ResponseWriter, r *http.Request) {
return
}

scenario, err := sbxCtrl.activeModel.GetScenario()
// Retrieve query parameters
query := r.URL.Query()
minimize := query.Get("minimize")

var scenario []byte
var err error
if minimize == "true" {
scenario, err = sbxCtrl.activeModel.GetScenarioMinimized()
} else {
scenario, err = sbxCtrl.activeModel.GetScenario()
}
if err != nil {
log.Error(err.Error())
http.Error(w, err.Error(), http.StatusInternalServerError)
Expand Down
62 changes: 62 additions & 0 deletions go-packages/meep-model/minimize.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright (c) 2019 InterDigital Communications, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package model

import (
dataModel "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-model"
)

// minimizeScenario - Minimizes scenario
func minimizeScenario(scenario *dataModel.Scenario) error {
if scenario != nil {
if scenario.Deployment != nil {
deployment := scenario.Deployment

// Domains
for iDomain := range deployment.Domains {
domain := &deployment.Domains[iDomain]

// Zones
for iZone := range domain.Zones {
zone := &domain.Zones[iZone]

// Network Locations
for iNL := range zone.NetworkLocations {
nl := &zone.NetworkLocations[iNL]

// Remove geodata
nl.GeoData = nil

// Physical Locations
for iPL := range nl.PhysicalLocations {
pl := &nl.PhysicalLocations[iPL]

// Remove geodata
pl.GeoData = nil

// // Processes
// for iProc := range pl.Processes {
// proc := &pl.Processes[iProc]
// }
}
}
}
}
}
}
return nil
}
25 changes: 24 additions & 1 deletion go-packages/meep-model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,32 @@ func (m *Model) SetScenario(j []byte) (err error) {
func (m *Model) GetScenario() (j []byte, err error) {
m.lock.RLock()
defer m.lock.RUnlock()
return json.Marshal(m.scenario)
}

// GetScenarioMinimized - Get Minimized Scenario JSON string
func (m *Model) GetScenarioMinimized() (j []byte, err error) {
m.lock.RLock()
defer m.lock.RUnlock()

// Marshal scenario
j, err = json.Marshal(m.scenario)
return j, err
if err != nil {
return j, err
}

// Unmarshal scenario in new variable to update
var scenario dataModel.Scenario
err = json.Unmarshal(j, &scenario)
if err != nil {
return nil, err
}
err = minimizeScenario(&scenario)
if err != nil {
return nil, err
}

return json.Marshal(scenario)
}

// Activate - Make scenario the active scenario
Expand Down
Loading