A lightweight API for running optical network simulations with Flex Net Sim C++.
The Flex Net Sim Backend API provides:
- Hands-on demonstration of optical network simulation capabilities
- Simplified access to core Flex Net Sim features
- Quick experimentation with pre-configured network topologies and parameters
This API serves as an introduction to the full Flex Net Sim library, allowing users to explore basic network simulation concepts through simple HTTP requests.
This API is intentionally designed as a limited demonstration platform:
- Not intended for complex simulations or algorithm customization
- Provides access to basic functionalities only
- For advanced simulation tasks, users should explore the full library
For comprehensive resources, see the Flex Net Sim documentation.
For development and deployment instructions for this API, refer to README_DEV.md.
Runs a network simulation with the provided parameters and returns complete results.
Parameter | Type | Description | Allowed Values & Constraints | Default |
---|---|---|---|---|
algorithm |
string |
RSA algorithm | FirstFit , BestFit |
FirstFit |
networkType |
integer |
Network type | Only 1 (EON) supported |
1 |
goalConnections |
integer |
Target connection requests | Must be > 0 and < 10,000,000 | 100000 |
confidence |
float |
Confidence level | Must be > 0 and < 1.0 | 0.05 |
lambdaParam |
float |
Arrival rate | Must be > 0 | 1.0 |
mu |
float |
Service rate | Must be > 0 | 10.0 |
network |
string |
Network topology | NSFNet , Cost239 , EuroCore , GermanNet , UKNet |
NSFNet |
bitrate |
string |
Bitrate type | fixed-rate , flex-rate |
fixed-rate |
K |
integer |
Path count | Must be > 0 and ≤ 6 | 3 |
curl -X POST -H "Content-Type: application/json" -d '{}' \
https://fns-api-cloud-run-787143541358.us-central1.run.app/run_simulation
curl -X POST -H "Content-Type: application/json" \
-d '{
"algorithm": "FirstFit",
"networkType": 1,
"goalConnections": 100000,
"confidence": 0.05,
"lambdaParam": 120,
"mu": 1,
"network": "NSFNet",
"bitrate": "fixed-rate"
}' \
https://fns-api-cloud-run-787143541358.us-central1.run.app/run_simulation
{
"status": "success",
"data": "simulation results as text..."
}
200 OK
: Success400 Bad Request
: Invalid parameters500 Internal Server Error
: Server-side error
Runs a network simulation with the provided parameters and streams results in real-time using Server-Sent Events (SSE).
Same parameters as /run_simulation
endpoint.
curl -N -X POST -H "Content-Type: application/json" -d '{}' \
https://fns-api-cloud-run-787143541358.us-central1.run.app/run_simulation_stream
curl -N -X POST -H "Content-Type: application/json" \
-d '{
"algorithm": "FirstFit",
"networkType": 1,
"goalConnections": 5000000,
"confidence": 0.05,
"lambdaParam": 120,
"mu": 1,
"network": "NSFNet",
"bitrate": "fixed-rate"
}' \
https://fns-api-cloud-run-787143541358.us-central1.run.app/run_simulation_stream
The endpoint returns a stream of Server-Sent Events with the following event types:
-
Start Event:
event: start data: {"status": "started", "message": "Simulation started"}
-
Data Events (multiple events, one per line of output):
event: data data: {"status": "running", "message": "Line of simulation output"}
-
End Event:
event: end data: {"status": "completed", "message": "Simulation completed"}
-
Error Event (only if an error occurs):
event: error data: {"status": "error", "message": "Error description", "error": "Detailed error"}
200 OK
: Success (stream starts)400 Bad Request
: Invalid parameters500 Internal Server Error
: Server-side error
Returns detailed API documentation.
curl https://fns-api-cloud-run-787143541358.us-central1.run.app/help