Commit c56f66e0 authored by Kevin Di Lallo's avatar Kevin Di Lallo
Browse files

REST query params to mimimize active scenario & exclude UE paths + loc-serv fix

parent 253720a0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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
+20 −0
Original line number Diff line number Diff line
@@ -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"
@@ -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"
+1 −1
Original line number Diff line number Diff line
@@ -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
+19 −3
Original line number Diff line number Diff line
@@ -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
@@ -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

@@ -837,7 +838,13 @@ func geGetAssetData(w http.ResponseWriter, r *http.Request) {
			asset.AssetName = ue.Name
			asset.AssetType = AssetTypeUe
			asset.SubType = mod.NodeTypeUE

			// 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)
@@ -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")
@@ -957,7 +968,12 @@ func geGetGeoDataByName(w http.ResponseWriter, r *http.Request) {
			http.Error(w, err.Error(), http.StatusNotFound)
			return
		}
		// 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)
Loading