From 3228db3097a9942b362119ebc24868478d7e534a Mon Sep 17 00:00:00 2001 From: Jake Kasper Date: Thu, 23 Apr 2026 13:50:31 -0500 Subject: [PATCH] Initial commit from Martins Github --- Dockerfile | 18 + Dockerfile.ueransim | 21 + README.md | 325 ++++++++++++++- ai-slides.html | 348 ++++++++++++++++ app/__init__.py | 0 app/config.py | 26 ++ app/main.py | 57 +++ app/routers/__init__.py | 0 app/routers/actions.py | 16 + app/routers/alerts.py | 11 + app/routers/emulated_session.py | 20 + app/routers/network.py | 12 + app/routers/query.py | 24 ++ app/services/__init__.py | 0 app/services/ai.py | 207 ++++++++++ app/services/alertmanager.py | 29 ++ app/services/log_analyzer.py | 338 ++++++++++++++++ app/services/prometheus.py | 41 ++ app/services/ueransim.py | 92 +++++ app/ui/actions.html | 663 ++++++++++++++++++++++++++++++ app/ui/index.html | 337 ++++++++++++++++ app/ui/overview.html | 693 ++++++++++++++++++++++++++++++++ app/ui/tasks.html | 534 ++++++++++++++++++++++++ build-ueransim.sh | 19 + config/run-test.sh | 225 +++++++++++ config/ueransim.env | 30 ++ deploy.sh | 95 +++++ patch-ncm.py | 108 +++++ requirements.txt | 3 + traefik-marvis.yml | 86 ++++ 30 files changed, 4377 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 Dockerfile.ueransim create mode 100644 ai-slides.html create mode 100644 app/__init__.py create mode 100644 app/config.py create mode 100644 app/main.py create mode 100644 app/routers/__init__.py create mode 100644 app/routers/actions.py create mode 100644 app/routers/alerts.py create mode 100644 app/routers/emulated_session.py create mode 100644 app/routers/network.py create mode 100644 app/routers/query.py create mode 100644 app/services/__init__.py create mode 100644 app/services/ai.py create mode 100644 app/services/alertmanager.py create mode 100644 app/services/log_analyzer.py create mode 100644 app/services/prometheus.py create mode 100644 app/services/ueransim.py create mode 100644 app/ui/actions.html create mode 100644 app/ui/index.html create mode 100644 app/ui/overview.html create mode 100644 app/ui/tasks.html create mode 100644 build-ueransim.sh create mode 100644 config/run-test.sh create mode 100644 config/ueransim.env create mode 100755 deploy.sh create mode 100644 patch-ncm.py create mode 100644 requirements.txt create mode 100644 traefik-marvis.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eb4e1c4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM python:3.12-slim + +WORKDIR /app +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt +COPY app/ ./app/ + +EXPOSE 8095 + +# When running standalone, override these to point at your Prometheus/Alertmanager +ENV MARVIS_PROMETHEUS_URL=http://127.0.0.1:9090 +ENV MARVIS_PROMETHEUS_PREFIX=/prometheus +ENV MARVIS_ALERTMANAGER_URL=http://127.0.0.1:9093 +ENV MARVIS_AI_MODE=rule +# MARVIS_AI_MODE=openai → set MARVIS_OPENAI_API_KEY +# MARVIS_AI_MODE=ollama → set MARVIS_OLLAMA_URL + MARVIS_OLLAMA_MODEL + +CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8095"] diff --git a/Dockerfile.ueransim b/Dockerfile.ueransim new file mode 100644 index 0000000..71d25fd --- /dev/null +++ b/Dockerfile.ueransim @@ -0,0 +1,21 @@ +FROM ubuntu:22.04 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential cmake git \ + libsctp-dev lksctp-tools \ + iproute2 iputils-ping \ + && rm -rf /var/lib/apt/lists/* + +RUN git config --global http.sslVerify false \ + && git clone --depth 1 https://github.com/aligungr/UERANSIM /ueransim \ + && cmake -S /ueransim -B /ueransim/build -DCMAKE_BUILD_TYPE=Release \ + && cmake --build /ueransim/build --parallel $(nproc) \ + && cp /ueransim/build/nr-gnb /usr/local/bin/ \ + && cp /ueransim/build/nr-ue /usr/local/bin/ \ + && rm -rf /ueransim + +COPY config/run-test.sh /run-test.sh +RUN chmod +x /run-test.sh + +ENTRYPOINT ["/bin/bash", "/run-test.sh"] diff --git a/README.md b/README.md index 5163648..885c29e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,325 @@ -# p5g-marvis +# P5G Marvis — Full Setup Guide +This document describes the complete architecture and deployment procedure for the +**P5G Marvis** sidebar extension that injects custom pages into the Athonet NCM UI. + +--- + +## Architecture Overview + +``` +Browser → Traefik (HTTPS :443) + ├── /core/marvis/* → strip prefix → http://127.0.0.1:8100 (p5g-marvis FastAPI) + └── /core/radio/* → strip prefix → http://127.0.0.1:4000 (rm-ui, if present) + +NCM UI (React SPA) + └── index-Cw8Irsq8.js (patched by patch-ncm.py) + ├── Sidebar: P5G Marvis (Insights, Actions, Minis, AI) + P5G Radio + ├── Router: /marvis/* and /radio/* →