Commit 736b4873 authored by Yann Garcia's avatar Yann Garcia
Browse files

Update meep-gis-engine test scenario; Remove debug logs

parent d17cc7ee
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ const (
)

func resetAutomation() {
	log.Info(">>> Reset automation")

	// Stop automation if running
	_ = setAutomation(AutoTypeMovement, false)
@@ -60,7 +59,6 @@ func resetAutomation() {
}

func setAutomation(automationType string, state bool) (err error) {
	log.Info(">>> setAutomation: ", automationType)

	// Validate automation type
	if _, found := ge.automation[automationType]; !found {
@@ -102,7 +100,6 @@ func setAutomation(automationType string, state bool) (err error) {
}

func startAutomation() {
	log.Info(">>> startAutomation")
	if ge.automationTicker == nil {
		log.Info("Starting automation loop")
		ge.automationTicker = time.NewTicker(1000 * time.Millisecond)
@@ -115,7 +112,6 @@ func startAutomation() {
}

func stopAutomation() {
	log.Info(">>> stopAutomation")
	if ge.automationTicker != nil {
		ge.automationTicker.Stop()
		ge.automationTicker = nil
@@ -124,7 +120,6 @@ func stopAutomation() {
}

func runAutomation() {
	log.Info(">>> runAutomation: ")

	var ueMap map[string]*am.Ue
	var poaMap map[string]*am.Poa
@@ -195,7 +190,6 @@ func runAutoMovement() {
}

func runAutoMobility(ueMap map[string]*am.Ue) {
	log.Info(">>> runAutoMobility: updating UE positions: ", ueMap)

	for _, ue := range ueMap {
		// Get stored UE info
@@ -451,12 +445,9 @@ func geGetAutomationState(w http.ResponseWriter, r *http.Request) {
}

func geGetAutomationStateByName(w http.ResponseWriter, r *http.Request) {
	log.Info(">>> geGetAutomationStateByName: ", r)
	// Get automation type from request path parameters
	vars := mux.Vars(r)
	log.Info(">>> geGetAutomationStateByName: vars: ", vars)
	automationType := vars["type"]
	log.Info("***************** Get automation state for type: ", automationType)

	// Get automation state
	var automationState AutomationState
@@ -485,7 +476,6 @@ func geGetAutomationStateByName(w http.ResponseWriter, r *http.Request) {
}

func geSetAutomationStateByName(w http.ResponseWriter, r *http.Request) {
	log.Info(">>> geSetAutomationStateByName: ", *r)
	// Get automation type from request path parameters
	vars := mux.Vars(r) //returns map[] https://stackoverflow.com/questions/31371111/mux-vars-not-working
	log.Info("geSetAutomationStateByName: vars: ", vars)
+8 −23
Original line number Diff line number Diff line
@@ -298,19 +298,17 @@ func msgHandler(msg *mq.Msg, userData interface{}) {
}

func processScenarioActivate() {
	log.Info(">>> processScenarioActivate")

	// Sync with active scenario store
	ge.activeModel.UpdateScenario()

	// Retrieve & process POA and Compute Assets in active scenario
	assetList := ge.activeModel.GetNodeNames(mod.NodeTypePoa, mod.NodeTypePoa4G, mod.NodeTypePoa5G, mod.NodeTypePoaWifi, mod.NodeTypeEdge, mod.NodeTypeFog, mod.NodeTypeCloud)
	log.Info("processScenarioActivate: assetList (Poa): ", assetList)
	setAssets(assetList)

	// Retrieve & process UE assets in active scenario
	// NOTE: Required to make sure initial UE selection takes all POAs into account
	assetList = ge.activeModel.GetNodeNames(mod.NodeTypeUE)
	log.Info("processScenarioActivate: assetList (Ue): ", assetList)
	setAssets(assetList)

	// Update Gis cache
@@ -318,7 +316,6 @@ func processScenarioActivate() {

	// Start snapshot thread
	scenarioName := ge.activeModel.GetScenarioName()
	log.Info("processScenarioActivate: scenarioName: ", scenarioName)
	if scenarioName != "" {
		err := ge.StartSnapshotThread()

@@ -351,7 +348,7 @@ func processScenarioActivate() {
}

func processScenarioUpdate() {
	log.Info(">>> processScenarioUpdate")

	// Sync with active scenario store
	ge.activeModel.UpdateScenario()

@@ -371,7 +368,6 @@ func processScenarioUpdate() {
	}

	// Create, update & delete assets according to scenario update
	log.Info("processScenarioUpdate: assetList: ", assetList)
	setAssets(assetList)
	removeAssets(assetsToRemove)

@@ -380,7 +376,7 @@ func processScenarioUpdate() {
}

func processScenarioTerminate() {
	log.Info(">>> processScenarioTerminate")

	// Sync with active scenario store
	ge.activeModel.UpdateScenario()

@@ -404,7 +400,7 @@ func processScenarioTerminate() {
}

func setAssets(assetList []string) {
	log.Info(">>> setAssets")

	for _, assetName := range assetList {
		var geoData *AssetGeoData = nil
		var err error
@@ -496,7 +492,6 @@ func removeAssets(assetList []string) {
}

func setUe(asset *Asset, pl *dataModel.PhysicalLocation, geoData *AssetGeoData) error {
	log.Info(">>> setUe")
	// UE data map
	ueData := make(map[string]interface{})

@@ -576,7 +571,6 @@ func setUe(asset *Asset, pl *dataModel.PhysicalLocation, geoData *AssetGeoData)
}

func setPoa(asset *Asset, nl *dataModel.NetworkLocation, geoData *AssetGeoData) error {
	log.Info(">>> setUe")
	// Get POA Data
	poaData := make(map[string]interface{})

@@ -623,7 +617,6 @@ func setPoa(asset *Asset, nl *dataModel.NetworkLocation, geoData *AssetGeoData)
}

func setCompute(asset *Asset, pl *dataModel.PhysicalLocation, geoData *AssetGeoData) error {
	log.Info(">>> setUe")
	// Get Compute Data
	computeData := make(map[string]interface{})

@@ -1455,24 +1448,22 @@ func geGetWithinRangeGeoDataByName(w http.ResponseWriter, r *http.Request) {
}

func geGetGeoDataByName(w http.ResponseWriter, r *http.Request) {
	log.Info(">>> geGetGeoDataByName: ", *r)

	// Get asset name from request path parameters
	vars := mux.Vars(r)
	assetName := vars["assetName"]
	log.Info("Get GeoData for asset: ", assetName)
	//log.Info("Get GeoData for asset: ", assetName)

	// Retrieve query parameters
	query := r.URL.Query()
	log.Info("geGetGeoDataByName: query: ", query)
	//log.Info("geGetGeoDataByName: query: ", query)
	if assetName == "" {
		assetName = query.Get("assetName")
	}
	excludePath := query.Get("excludePath")
	log.Info("geGetGeoDataByName: excludePath: ", excludePath)
	//log.Info("geGetGeoDataByName: excludePath: ", excludePath)

	// Make sure scenario is active
	log.Info("geGetGeoDataByName: ge.activeModel.GetScenarioName: ", ge.activeModel.GetScenarioName())
	if ge.activeModel.GetScenarioName() == "" {
		err := errors.New("No active scenario")
		log.Error(err.Error())
@@ -1482,7 +1473,6 @@ func geGetGeoDataByName(w http.ResponseWriter, r *http.Request) {

	// Find asset in active scenario model
	node := ge.activeModel.GetNode(assetName)
	log.Info("geGetGeoDataByName: node: ", node)
	if node == nil {
		err := errors.New("Asset not found in active scenario")
		log.Error(err.Error())
@@ -1497,11 +1487,6 @@ func geGetGeoDataByName(w http.ResponseWriter, r *http.Request) {
	// Retrieve geodata from Asset Manager using asset name & type
	nodeType := ge.activeModel.GetNodeType(assetName)
	asset.SubType = nodeType
	log.Info("geGetGeoDataByName: nodeType: ", nodeType)
	log.Info("geGetGeoDataByName: isUe(nodeType): ", isUe(nodeType))

	ueMap, _ := ge.assetMgr.GetAllUe()
	log.Info("geGetGeoDataByName: All UEs: ", ueMap)

	if isUe(nodeType) {
		// Get UE information
+3909 −422

File changed.

Preview size limit exceeded, changes collapsed.

+0 −1
Original line number Diff line number Diff line
@@ -645,7 +645,6 @@ func initializeVars() {
}

func initialiseScenario(testScenario string) {
	log.Info(">>> initialiseScenario")

	//clear DB
	cleanUp()
+0 −1
Original line number Diff line number Diff line
@@ -433,7 +433,6 @@ func (am *AssetMgr) DeleteTable(tableName string) (err error) {

// CreateUe - Create new UE
func (am *AssetMgr) CreateUe(id string, name string, data map[string]interface{}) (err error) {
	log.Info(">>> CreateUe")
	if profiling {
		profilingTimers["CreateUe"] = time.Now()
	}