# ODF 光纤配线单元管理系统 本项目是一个 ODF(Optical Distribution Frame,光纤配线架)配线单元管理系统的 Python 示例工程。使用 FastAPI 构建,采用内存假数据存储,无需外部基础设施。 ## 功能特性 - 管理 ODF 机架(Rack):添加、查询、删除 - 管理配线单元(Unit):每个机架包含多个配线单元 - 管理光纤端口(Port):每个单元包含多个光纤端口 - 管理跳接连接(Connection):记录端口之间的跳纤关系 - 查询空闲端口、指定端口的连接路径 ## 安装依赖 ```bash pip install -r requirements.txt ``` ## 启动服务 ```bash cd codegen-runs/codegen_ff965d9f6029446ca6b6913dd1d7b45c uvicorn app.main:app --reload --port 8000 ``` 启动后访问 API 文档: - Swagger UI:http://127.0.0.1:8000/docs - ReDoc:http://127.0.0.1:8000/redoc ## 运行测试 ```bash cd codegen-runs/codegen_ff965d9f6029446ca6b6913dd1d7b45c python -m pytest tests/test_basic.py -v ``` ## 工程结构 ``` . ├── README.md ├── requirements.txt ├── app/ │ ├── __init__.py │ ├── main.py # FastAPI 应用入口,路由定义 │ ├── models.py # 数据模型(内存存储结构) │ ├── schemas.py # Pydantic 请求/响应模型 │ └── services.py # 业务逻辑层(内存假数据) └── tests/ └── test_basic.py # 基础测试 ```