ONU Fiber Router Authorization System

An automated system for authorizing new ONU (Optical Network Unit) fiber routers. The system validates device information, assigns IP addresses based on mainboard types, and integrates with billing systems.

Features

  • Device Registration: Collect MAC address, geo data, and mainboard information
  • Automatic IP Assignment: Assign IP addresses based on mainboard type
  • Billing Integration: Upload device data to external billing systems
  • Validation: Verify MAC address format and geo coordinates
  • Admin Dashboard: View and manage registered devices

Project Structure

├── backend/
│   ├── database/
│   │   ├── migrations.ts    # Database schema
│   │   └── queries.ts       # Database operations
│   ├── routes/
│   │   ├── devices.ts       # Device management API
│   │   └── static.ts        # Static file serving
│   └── index.ts             # Main Hono server
├── frontend/
│   ├── components/
│   │   ├── App.tsx          # Main application
│   │   ├── DeviceForm.tsx   # Device registration form
│   │   └── DeviceList.tsx   # Device management dashboard
│   ├── index.html           # Main HTML template
│   └── index.tsx            # Frontend entry point
└── shared/
    └── types.ts             # Shared TypeScript types

Environment Variables

Set these in your Val Town environment:

  • BILLING_API_URL: URL of the external billing system
  • BILLING_API_KEY: API key for billing system authentication

API Endpoints

  • POST /api/devices - Register new device
  • GET /api/devices - List all devices
  • PUT /api/devices/:id - Update device
  • DELETE /api/devices/:id - Delete device

IP Assignment Rules

  • Huawei: 192.168.1.x range
  • ZTE: 192.168.2.x range
  • Nokia: 192.168.3.x range
  • Alcatel: 192.168.4.x range
  • Default: 192.168.100.x range