Commit 83138dd3 authored by Kostas Chartsias's avatar Kostas Chartsias
Browse files

refactor: removed legacy code and doc: minor fixes

parent 6a4c2e93
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -46,3 +46,7 @@ docker-compose.proxy*
*.crt
certs/*.crt

.patch*
patch*

ai2_proxy*
+2 −2
Original line number Diff line number Diff line
@@ -6,11 +6,11 @@ images:
  mcp:
    repository: labs.etsi.org:5050/oop/code/ai2/mcp_module
    tag: latest
    pullPolicy: IfNotPresent
    pullPolicy: Always
  aiAgent:
    repository: labs.etsi.org:5050/oop/code/ai2/ai_agent
    tag: latest
    pullPolicy: IfNotPresent
    pullPolicy: Always

config:
  mcp:
+4 −6
Original line number Diff line number Diff line
@@ -18,9 +18,9 @@ mcp_module/
├── json_templates/          # CAMARA API request/response templates (interpolated by user input)
├── models/                  # Pydantic models for CAMARA API compliance or custom types
├── tools/                   # MCP tools registered as callable endpoints
    ├── qod.py               # Quality of Demand (QoD) related tools leveraging OOP OEG
── qod_legacy.py        # Quality of Demand (QoD) related tools leveraging dummy backend
└── edge_application.py  # Discovery of edge applications
   ├── qod.py               # Quality of Demand (QoD) related tools leveraging OOP OEG
── edge_application.py  # Discovery of edge applications leveraging OOP OEG

├── app.py
├── requirements.txt
└── Dockerfile
@@ -58,10 +58,8 @@ source venv/bin/activate # (on Linux/macOS) venv\Scripts\activate # (on Win
pip install -r requirements.txt

Create a `.env` file in the project root (if not already present) and set your API configuration:
```
OEG_SERVICE_URL=http://your-oeg-host/oeg/1.0.0
```

OEG_SERVICE_URL=http://your-oeg-host/oeg/1.0.0

```

+0 −22
Original line number Diff line number Diff line
# Use an official Python runtime as a parent image
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Copy requirements first (for efficient caching)
COPY requirements.txt .

# Install dependencies
RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org --no-cache-dir -r requirements.txt

# Copy the rest of the application
COPY . .

# Use environment variables for configuration
# (Defaults can be overridden via docker run or compose)
ENV API_HOST=0.0.0.0
ENV API_PORT=8081
# Command to run the API
CMD ["python", "app.py"]
+0 −125
Original line number Diff line number Diff line
# Dummy CAMARA Backend


##  Overview

This repository contains a **dummy backend** implementation of  **CAMARA API endpoints**, used for testing, experimentation or integration demos.

---

* Uses **Connexion** framework to automatically handle routing based on the provided **OpenAPI spec (`openapi.yaml`)**.
* Organizes logic into a modular **`controllers/`** directory for clean separation of API endpoints.
* Provides automatic Swagger UI documentation for easy testing of API endpoints.
* Loads configuration parameters from `.env` file.

## 📁 Project Structure

```
dummy_backend/

├── controllers/
|   |   experimental/ 
│   │   └── qod_controller.py
│   │   └── ....
│   ├── v1/
│   │   └── example_controller.py
│   ├── v2/
│   │   └── example_controller.py
|   |   └── example_controller.py
├── openapi.yaml
├── app.py
├── .env
├── requirements.txt
└── Dockerfile

```

---

## ⚙️ Installation

### Option 1 - Local(venv)

Follow these steps to set up and run the API locally.


```
git clone https://labs.etsi.org/rep/oop/code/ai2.git
cd mcp_module/dummy_backend
python3 -m venv venv (Tested with python versions 3.10x and 3.12x)
source venv/bin/activate    # On Windows: venv\Scripts\activate
pip install -r requirements.txt

Create a `.env` file in the project root (if not already present) and set your API configuration:
API_HOST=
API_PORT=
```
### Option 2 - Containerized
Build the Docker Image

Run this inside the project root (same folder as Dockerfile):
```
docker build -t dummy_backend .
```
## 🚀 Usage

### Option 1 - Local(venv)
```
python app.py
```


Once the server is running, open your browser and visit:

* **Swagger UI:** [http://127.0.0.1:8081/ui/](http://127.0.0.1:8081/ui/)
  to explore and test the endpoints interactively. 
  * The url may very in case of the corresponding environment variables

### Option 2 - Containerized
Run the container:

The Dockerfile sets these defaults:
```
ENV API_HOST=0.0.0.0
ENV API_PORT=8081
```
To start the backend with these defaults:
```
docker run -p 8081:8081 dummy-backend
```
You can override the defaults at runtime.
Example change port:
```
docker run \
  -e API_PORT=9000 \
  -p 9000:9000 \
  dummy-backend
```

---
## 🤝 Contributing

To contribute:

1. **Fork** the repository.
2. **Create a new branch** for your feature or fix:

   ```
   git checkout -b feature/my-feature
   ```
3. **Commit** your changes:

   ```
   git commit -m "Add new endpoint for dummy CAMARA data"
   ```
4. **Push** your branch and open a **Pull Request**.

Please make sure to:

* Update or add OpenAPI definitions in `openapi.yaml` with additional API end-points.
* Create a new folder under `controllers/` (e.g., controllers/v3/).  
* Point each `operationId` to the new controller module.

---

Loading