Skip to content

Commit f962d54

Browse files
committed
update with Readme and docs
1 parent 1d3cc04 commit f962d54

2 files changed

Lines changed: 67 additions & 6 deletions

File tree

README.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,51 @@
1-
[Quick Note with Google Docs](https://docs.google.com/document/d/18QQqo4PK8ycuZovrbAacRtFtqWSIqS0v9hRiiUYgvU8/edit?usp=sharing)
1+
⭐ GSoC 2025 with P4Language: Check out the [project idea](https://github.com/p4lang/gsoc/blob/main/2025/ideas_list.md#project-5) and become a contributor to P4 through Google Summer of Code!
22

33
# P4sim module in ns-3 for Programmable Data Plane simulation
44

55
P4sim is a P4-driven network simulator aiming at combining P4, the state-of-the-art programmable data plane language and ns-3, one of the most popular network simulators. P4sim is an open-source project under Apache License 2.0.
66

7+
P4sim with reference to behavioral models: [behavioral-model](https://github.com/p4lang/behavioral-model).
8+
79
Our implementation was built upon the the P4-driven Network Simulator Module, as outlined in:
8-
> Bai, Jiasong, Jun Bi, Peng Kuang, Chengze Fan, Yu Zhou, and Cheng Zhang. **NS4: Enabling programmable data plane simulation.** In Proceedings of the Symposium on SDN Research, pp. 1-7. 2018. Available at [ACM DL](https://dl.acm.org/doi/abs/10.1145/3185467.3185470)
10+
> Bai, Jiasong, Jun Bi, Peng Kuang, Chengze Fan, Yu Zhou, and Cheng Zhang. **"NS4: Enabling programmable data plane simulation."** In Proceedings of the Symposium on SDN Research, pp. 1-7. 2018. Available at [ACM DL](https://dl.acm.org/doi/abs/10.1145/3185467.3185470)
11+
12+
> Fan, Chengze, Jun Bi, Yu Zhou, Cheng Zhang, and Haisu Yu. **"NS4: A P4-driven network simulator."** In Proceedings of the SIGCOMM Posters and Demos, pp. 105-107. 2017. Available at [ACM DL](https://dl.acm.org/doi/10.1145/3123878.3132002)
13+
14+
⭐ More detail check our paper submitted on 21 March 2025: [P4sim: Programming Protocol-independent Packet Processors in ns-3](https://arxiv.org/abs/2503.17554)
15+
16+
## P4Sim: NS-3-Based P4 Simulation Environment
17+
18+
See [here](doc/vm-env.md).
919

10-
# P4Sim: NS-3-Based P4 Simulation Environment
20+
## Simulation Parameters for P4 switch ##
1121

12-
See `vm-env.md`.
22+
In a P4 switch, the functionality is defined by the user's P4 program and the configuration of the flow table. But the following parameters can also be configured in ns-3 `ns3::P4SwitchNetDevice`.
1323

14-
## Simulation Parameters ##
24+
| Parameter | Description |
25+
|-----------------------|----------------------------------------------------------------------|
26+
| EnableTracing | Enable or disable tracing in the switch |
27+
| EnableSwap | Enable or disable swapping of the P4 configuration |
28+
| P4SwitchArch | Switch architecture: 0 for v1model, 1 for PSA, 2 for PNA |
29+
| JsonPath | Path to the compiled P4 JSON file (*.json) |
30+
| FlowTablePath | Path to the flow table configuration file |
31+
| InputBufferSizeLow | Input buffer size for low-priority packets (external packets) |
32+
| InputBufferSizeHigh | Input buffer size for high-priority packets (internal packets) |
33+
| QueueBufferSize | Total size of the queue buffer |
34+
| SwitchRate | Switch processing rate in packets per second (pps) |
35+
| ChannelType | Channel type: 0 for CSMA, 1 for point-to-point (P2P), default is CSMA|
1536

16-
## Simulation Script: ##
37+
Note: 1. When using a CSMA channel, make sure the ARP packets are correctly handled in the P4 scripts.
38+
2. Buffer configuration only useful if the P4SwitchArch include that buffer.
39+
3. EnableTracing: The implementation is not yet complete and currently only supports basic measurements such as throughput.
40+
41+
## Simulation Examples: ##
42+
43+
See [here](doc/examples.md).
1744

1845
## Results Subdirectory ##
1946

47+
48+
2049
## Doxygen Documents ##
2150

2251
```bash

doc/examples.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
**Contributions are welcome!** Feel free to submit additional examples to help expand this collection.
2+
3+
# Examples
4+
5+
The example consists of two parts:
6+
7+
* A simulation script in ns-3, which is used to build the simulation environment.
8+
9+
* A set of files in the `p4src` directory, including the network topology description (`topo.txt`), the P4 program(`*.p4, *.p4i, *.json`), and the corresponding flow table configuration (`flowtable_x.txt`).
10+
11+
12+
## Example List
13+
14+
| Example Name | Description | Architecture |
15+
|------------------|--------------------------------------------------|------------------|
16+
| basic_tunnel [1] | Tunnel with custom header | V1model |
17+
| firewall [2] | A basic stateful firewall | V1model |
18+
| ipv4_forward | Basic forwarding based on `ip_dst` | V1model |
19+
| load_balance [3] | Load balancing in spine-leaf network | V1model |
20+
| p4_basic [4] | Basic forwarding based on `ip_dst` | V1model |
21+
| qos | Forwarding with priority | V1model |
22+
| simple_pna | IPv4 forwarding with PNA architecture | PNA |
23+
| simple_psa | IPv4 forwarding with PSA architecture | PSA |
24+
| simple_v1model | IPv4 forwarding with V1model architecture | V1model |
25+
26+
27+
## References
28+
29+
[1] basic_tunnel in [p4lang/tutorials/baisc_tunnel](https://github.com/p4lang/tutorials/tree/master/exercises/basic_tunnel)
30+
[2] firewall in [p4lang/tutorials/firewall](https://github.com/p4lang/tutorials/tree/master/exercises/firewall)
31+
[3] load_balance in [p4lang/tutorials/load_balance](https://github.com/p4lang/tutorials/tree/master/exercises/load_balance)
32+
[4] p4_basic in [p4lang/tutorials/basic](https://github.com/p4lang/tutorials/tree/master/exercises/basic)

0 commit comments

Comments
 (0)