Skip to content

Commit eb3e105

Browse files
committed
Initial commit
0 parents  commit eb3e105

302 files changed

Lines changed: 40625 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 4
10+
11+
[*.{yml,yaml,json,md,toml}]
12+
indent_size = 2
13+
14+
[Makefile]
15+
indent_style = tab
16+
17+
[*.{sh,bash}]
18+
indent_size = 2

.env.example

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# =============================================================================
2+
# NetOpsBench Environment Configuration
3+
# Copy this file to .env and update the values for your environment.
4+
# Do not commit .env to git.
5+
# =============================================================================
6+
7+
# --- LLM API Keys (for benchmark agents) ---
8+
MINIMAX_API_KEY=your-minimax-api-key
9+
OPENAI_API_KEY=your-openai-compatible-api-key
10+
# ZHIPU_API_KEY=your-zhipu-api-key
11+
# DEEPSEEK_API_KEY=your-deepseek-api-key
12+
# KIMI_API_KEY=your-kimi-api-key
13+
# OPENAI_BASE_URL=https://api.openai.com/v1
14+
15+
# --- LangSmith Tracing (optional) ---
16+
LANGSMITH_API_KEY=your-langsmith-api-key
17+
LANGSMITH_TRACING=true
18+
LANGSMITH_PROJECT=NetOpsBench
19+
20+
# --- InfluxDB ---
21+
NETOPSBENCH_INFLUXDB_URL=http://localhost:8086
22+
NETOPSBENCH_INFLUXDB_TOKEN=replace-me # REQUIRED: set a real token before deployment
23+
NETOPSBENCH_INFLUXDB_ORG=netopsbench
24+
NETOPSBENCH_INFLUXDB_BUCKET=netopsbench
25+
26+
# --- Grafana ---
27+
# NETOPSBENCH_GRAFANA_URL=http://localhost:3000
28+
# NETOPSBENCH_GRAFANA_PASSWORD=admin
29+
# NETOPSBENCH_GRAFANA_INFLUXDB_URL=http://influxdb:8086
30+
# NETOPSBENCH_GRAFANA_DEFAULT_BUCKET=netopsbench
31+
32+
# --- Topology ---
33+
# NETOPSBENCH_TOPOLOGY_DIR=lab-topology/generated_topology_xs
34+
# NETOPSBENCH_TOPOLOGY_ID=dcn
35+
# NETOPSBENCH_LAB_NAME=dcn
36+
# NETOPSBENCH_MGMT_SUBNET= # Override management subnet (e.g. 172.20.20.0/24)
37+
# NETOPSBENCH_MGMT_NETWORK= # Override Docker management network name
38+
39+
# --- SONiC / gNMI Telemetry ---
40+
# SONIC_GNMI_PORT=50051
41+
# SONIC_GNMI_USERNAME=admin
42+
# SONIC_GNMI_PASSWORD= # Set the SONiC gNMI password for telemetry collection
43+
# SONIC_GNMI_ENCODING=json_ietf
44+
# SONIC_GNMI_TARGET=COUNTERS_DB
45+
# SONIC_GNMI_SUBSCRIPTION_MODE=on_change # on_change | sample | target_defined
46+
# SONIC_GNMI_SAMPLE_INTERVAL=10s # Only used when subscription_mode=sample
47+
48+
# --- Telemetry collectors (sFlow / syslog) ---
49+
# NETOPSBENCH_SFLOW_COLLECTOR= # sFlow collector IP (defaults to management IP)
50+
# NETOPSBENCH_SYSLOG_COLLECTOR= # Syslog collector IP (defaults to management IP)
51+
# NETOPSBENCH_SFLOW_PORT=6343
52+
# NETOPSBENCH_SFLOW_POLLING_INTERVAL=20
53+
# NETOPSBENCH_SFLOW_SAMPLE_RATE=1000
54+
# NETOPSBENCH_SFLOW_SAMPLE_DIRECTION=ingress
55+
56+
# --- Pingmesh ---
57+
# PINGMESH_CYCLE_INTERVAL=5 # Probe cycle interval in seconds
58+
59+
# --- Runtime / debug ---
60+
# NETOPSBENCH_LOG_LEVEL=INFO # DEBUG | INFO | WARNING | ERROR
61+
# NETOPSBENCH_NO_SUDO=0 # Set to 1 in CI/test environments without sudo
62+
63+
# --- Worker Pool ---
64+
# NETOPSBENCH_WORKER_DEPLOY_JOBS= # Parallel worker deploy jobs (default: num_workers)
65+
# NETOPSBENCH_SONIC_WAIT_TRIES=180 # Max SONiC readiness retries (5s each, default: 15 min)
66+
# NETOPSBENCH_AGENT_TIMEOUT_SECONDS=300
67+
# NETOPSBENCH_WORKER_AGENT_TIMEOUT_SECONDS=600
68+
# NETOPSBENCH_WORKER_DISABLE_LANGSMITH=false

.github/workflows/docs-pages.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: docs-pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: docs-pages
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
env:
22+
NEXT_PUBLIC_BASE_PATH: /${{ github.event.repository.name }}
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Node
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: '20'
31+
cache: npm
32+
cache-dependency-path: docs/package-lock.json
33+
34+
- name: Configure Pages
35+
uses: actions/configure-pages@v5
36+
with:
37+
enablement: true
38+
39+
- name: Install docs dependencies
40+
working-directory: docs
41+
run: npm ci
42+
43+
- name: Build docs site
44+
working-directory: docs
45+
run: npm run build
46+
47+
- name: Upload Pages artifact
48+
uses: actions/upload-pages-artifact@v3
49+
with:
50+
path: docs/out
51+
52+
deploy:
53+
needs: build
54+
runs-on: ubuntu-latest
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
steps:
59+
- name: Deploy to GitHub Pages
60+
id: deployment
61+
uses: actions/deploy-pages@v4

.github/workflows/test.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- feature/**
9+
pull_request:
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.11"
22+
23+
- name: Install lint dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -e ".[dev,agent]"
27+
28+
- name: Ruff (lint)
29+
run: ruff check netopsbench/ tests/
30+
31+
- name: Black (format check)
32+
run: black --check netopsbench/ tests/
33+
34+
- name: Mypy (type check)
35+
run: mypy --ignore-missing-imports
36+
37+
pytest:
38+
runs-on: ubuntu-latest
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
python-version: ["3.11", "3.12", "3.13"]
43+
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
48+
- name: Set up Python
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
53+
- name: Install dependencies
54+
run: |
55+
python -m pip install --upgrade pip
56+
pip install -e ".[dev,agent]"
57+
58+
- name: Generate benchmark assets (xs scale)
59+
run: netopsbench benchmark prepare --scales xs
60+
61+
- name: Run regression suite (no real-environment tests)
62+
run: |
63+
pytest -q -m "not real" tests/ \
64+
--cov=netopsbench --cov-fail-under=50

.gitignore

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
__pycache__/
2+
*.py[cod]
3+
*$py.class
4+
.venv/
5+
env/
6+
venv/
7+
*.clab.yml
8+
.clab-topology
9+
clab-topology/clab-*/
10+
*.log
11+
.DS_Store
12+
.idea/
13+
.vscode/
14+
deprecated/
15+
generated*
16+
swap-pane
17+
*.egg-info
18+
scenario_results/
19+
scenarios/xs
20+
scenarios/small/
21+
scenarios/medium/
22+
scenarios/large/
23+
.env
24+
.env.*
25+
!.env.example
26+
screenshots
27+
.venv*/
28+
large_tool_results/
29+
lab-topology/
30+
.worktrees/
31+
.agents/
32+
.pytest_cache/
33+
tmp/
34+
.netopsbench*/
35+
36+
# Generated telegraf config (use telegraf.conf.template instead)
37+
observability/telegraf.conf
38+
39+
.claude/
40+
.serena/
41+
.venv*
42+
.coverage
43+
plot_*
44+
45+
# Fumadocs / Next.js site artifacts
46+
docs/node_modules/
47+
docs/.next/
48+
docs/out/
49+
docs/.source/
50+
docs/.env.local
51+
docs/_legacy/
52+
.playwright-mcp/
53+
CLAUDE*

.pre-commit-config.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Pre-commit hooks for NetOpsBench.
2+
# Install: pip install pre-commit && pre-commit install
3+
# Run all: pre-commit run --all-files
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.6.0
7+
hooks:
8+
- id: trailing-whitespace
9+
- id: end-of-file-fixer
10+
- id: check-yaml
11+
args: [--allow-multiple-documents]
12+
- id: check-toml
13+
- id: check-added-large-files
14+
args: ["--maxkb=1024"]
15+
- id: check-merge-conflict
16+
- id: detect-private-key
17+
18+
- repo: https://github.com/astral-sh/ruff-pre-commit
19+
rev: v0.4.10
20+
hooks:
21+
- id: ruff
22+
args: [--fix]
23+
24+
- repo: https://github.com/psf/black
25+
rev: 24.4.2
26+
hooks:
27+
- id: black
28+
29+
- repo: https://github.com/pycqa/isort
30+
rev: 5.13.2
31+
hooks:
32+
- id: isort
33+
34+
- repo: https://github.com/gitleaks/gitleaks
35+
rev: v8.18.4
36+
hooks:
37+
- id: gitleaks

0 commit comments

Comments
 (0)