A partial implementation of ETSI GS MEC 013 Location API specification. This API provides location services for Mobile Edge Computing applications.
This work was partially supported by the German Federal Ministry of Education and Research (BMBF) project 6G-ANNA, grant agreement number 16KISK100.
- Zone management and queries
- Access point information
- User location tracking
- Distance calculations
- Swagger documentation
- RESTful API endpoints
- Go 1.23.3 or higher
- MongoDB (v7.0)
- Docker (optional)
- Docker Compose (optional)
The easiest way to run the application is using Docker Compose:
docker compose up -dThis will start both the API service and MongoDB. The API will be available at:
- API: http://localhost:8080
- Ping Endpoint: http://localhost:8080/ping
- Swagger UI: http://localhost:8080/docs
Create a .env file in the project root:
MONGOURI=mongodb://localhost:27017/lapi
APIROOT=http://localhost:8080
APIVERSION=v3
PURGEDATABASE=1
INSERTMOCKDATA=1Using Docker:
docker run --name mongodb -p 27017:27017 -d mongodb/mongodb-community-server:latestOr using Podman:
podman run --name mongodb --privileged -p 27017:27017 -d docker.io/mongodb/mongodb-community-server:latestor if is was already initialized
docker start mongodbor
podman start mongodbgo run main.goThe API documentation is available through Swagger UI at /docs endpoint. You can also find the OpenAPI specification at /swagger/doc.json.
Note
Depending on your system, it might require to run podman with root privilleges (e.g., Fedora)
This is due to a requirement of MongoDB and the rights to access files in folders. Without the
sudo command, SElinux prevents the MondoDB container to write in the filesystem causing an error.
The integration tests assume the MongoDB instance is running an is accessible.
Please keep in mind that the database will be recreated and filled with mock data
(make sure that the options PURGEDATABASE and INSERTMOCKDATA are enabled in the .env file).
Change to the project directory and run the tests as following:
go test -vYou can test the API endpoints using:
- The provided REST Client file in
./tests/Requests.rest - Swagger UI at
/docs - Any HTTP client (like Postman or cURL)
swag init -g main.go --output docs/swagger.
├── configs/ # Utility functions to get configuration values
├── controllers # Controllers to receive and route the requests
├── docs/ # Swagger generated documentation files
├── domain/ # Entitites and data models
├── mock/ # Functions to insert mock data into database
├── responses/ # Definition of objects used in responses as JSON
├── routes/ # Route definitions
├── services/ # Coupling between domain entities (WIP!)
├── tests/ # Test files
├── utils/ # Utility functions
...
├── docker-compose.yml # Docker-related files
├── Dockerfile # Docker-related files
- Install Mininet-Wifi according to the official documentation available in GitHub
- Get the mobility.py and lapi.py files from this repository
- Create a folder in your home directory in the machine where Mininet-Wifi was installed
- Download the files
- Execute the Mininet-Wifi emulation scenarion
cd ~
mkdir lapi-integration
cd ~/lapi-integration
curl -XGET https://raw.githubusercontent.com/izacarias/lapi/refs/heads/main/utils/mininet/lapi.py -o lapi.py
curl -XGET https://raw.githubusercontent.com/izacarias/lapi/refs/heads/main/utils/mininet/mobility.py -o mobility.py
sudo mn -c && sudo ./mobility
Note
If you are using a Virtual Machine to run Mininet-Wifi, make sure that the machine can acccess the LAPI service (You can use the Ping Endpoint for testing http://LAPI_IP/:8080/ping)
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Iulisloi Zacarias
Project Link: https://github.com/izacarias/lapi