feat: add l2 l3 simulator patch panel skeleton

This commit is contained in:
HWLAB Code Queue
2026-05-21 14:40:12 +00:00
parent b1d31380cb
commit 77f70ff4ad
11 changed files with 757 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env node
import { createGatewayState, createHealth } from "../../internal/sim/model.mjs";
import { createJsonServer, listen, parsePort } from "../../internal/sim/http.mjs";
const gatewayId = process.env.HWLAB_GATEWAY_ID ?? "gwsimu_east";
const port = parsePort(process.env.PORT, 7101);
const endpoint = `http://127.0.0.1:${port}`;
const boxes = (process.env.HWLAB_BOX_RESOURCES ?? "res_boxsim_alpha")
.split(",")
.map((item) => item.trim())
.filter(Boolean);
const state = createGatewayState({ gatewayId, endpoint, boxes });
const routes = new Map();
routes.set("GET /health/live", () =>
createHealth({ serviceId: "hwlab-gateway-simu", name: gatewayId })
);
routes.set("GET /status", () => state);
routes.set("GET /boxes", () => ({
gatewayId,
boxes: state.boxes
}));
listen(createJsonServer({ routes }), port);