Skip to content

Commit 7d3d62b

Browse files
committed
added examples and p4sim section in the top level readme
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
1 parent 187572e commit 7d3d62b

File tree

4 files changed

+917
-15
lines changed

4 files changed

+917
-15
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* [Introduction](#introduction)
77
* [Presentation](#presentation)
88
* [P4 Documentation](#p4-documentation)
9+
* [P4Sim] (#p4sim)
910
* [Obtaining required software](#obtaining-required-software)
1011
* [To build the virtual machine](#to-build-the-virtual-machine)
1112
* [Accessing the VM](#accessing-the-vm)
@@ -83,6 +84,23 @@ All exercises in this repository use the v1model architecture, the documentation
8384
1. The BMv2 Simple Switch target document accessible [here](https://github.com/p4lang/behavioral-model/blob/master/docs/simple_switch.md) talks mainly about the v1model architecture.
8485
2. The include file `v1model.p4` has extensive comments and can be accessed [here](https://github.com/p4lang/p4c/blob/master/p4include/v1model.p4).
8586

87+
## P4sim – A Simple P4 Behavioral Simulator
88+
89+
**P4sim** is a lightweight, dependency-free P4 packet-processing simulator designed for learning and experimentation.
90+
Unlike BMv2 or P4-DPDK, P4sim does **not** emulate a full switch pipeline. Instead, it provides a minimal execution environment that evaluates P4 parser, control, and deparser logic on user-provided packets.
91+
92+
P4sim is intended for:
93+
94+
* Running P4 programs without installing large data plane frameworks
95+
* Quickly testing parser and control-flow behavior
96+
* Understanding how P4 programs process packets step-by-step
97+
98+
P4sim is **not** a performance model and does not aim to replicate full-featured switch behavior (such as multitable pipelines, extern objects, or architecture-specific metadata).
99+
It is mainly a **teaching and debugging tool**.
100+
101+
To learn more or try P4sim examples, see:
102+
[`P4sim/README.md`](./doc/P4sim/README.md)
103+
86104
## Obtaining required software
87105

88106
If you are starting this tutorial at one of the proctored tutorial events,
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
### Index
44

5-
- [Local Deployment (ns-3.39)](#local-deployment-ns339)
5+
- [Local Deployment (ns-3.39)](#local-deployment-ns339)
66
- Virtual Machine as Virtual Env
77
- [ns-3 Version 3.x – 3.35](#setup-ns335)
8-
- [ns-3 Version 3.36 – 3.39](#setup-ns339)
8+
- [ns-3 Version 3.36 – 3.39](#setup-ns339)
99
- [Appendix](#appendix)
1010

1111
## Installation & Usage Guide
1212

1313
It is recommended to use a **virtual machine** with Vagrant to simplify the installation and ensure compatibility.
1414

15-
## <a name="local-deployment-ns339"></a> Local Deployment (ns-3.39) [⤴️](#index)
15+
## <a name="local-deployment-ns339"></a> Local Deployment (ns-3.39)
1616

1717
This guide walks you through setting up a local environment to run the P4Sim integrated with `ns-3.39` on Ubuntu 24.04. The full setup includes installing the behavioral model (`bmv2`), setting up SSH for remote access, and building the ns-3 project with P4Sim support. This is tested with `Ubuntu 24.04 LTS Desktop`.
1818

19-
> ⚠️ Note: The bmv2 and P4 software installation step will take **~3 hours** and consume up to **15GB** of disk space.
19+
> Note: The bmv2 and P4 software installation step will take **~3 hours** and consume up to **15GB** of disk space.
2020
2121
---
2222

23-
## 📁 1. Initialize the Working Directory
23+
## 1. Initialize the Working Directory
2424

2525
Create a workspace and install basic development tools.
2626

@@ -33,7 +33,7 @@ sudo apt install git vim cmake
3333

3434
---
3535

36-
## 🛠️ 2. Install P4 Behavioral Model (bmv2) and Dependencies
36+
## 2. Install P4 Behavioral Model (bmv2) and Dependencies
3737

3838
> This installs all necessary libraries and tools for P4 development (via the official `p4lang/tutorials` repo).
3939
@@ -53,7 +53,7 @@ simple_switch
5353

5454
---
5555

56-
## 🧪 3. Clone and Build ns-3.39 with P4Simulator
56+
## 3. Clone and Build ns-3.39 with P4Simulator
5757

5858
### Step 3.1: Clone ns-3.39
5959

@@ -83,7 +83,7 @@ cd ../..
8383

8484
---
8585

86-
## ▶️ 4. Run an Example
86+
## 4. Run an Example
8787

8888
You can run a built-in example using:
8989

@@ -93,7 +93,7 @@ You can run a built-in example using:
9393

9494
---
9595

96-
## 🔧 5. Configure P4 Files in Your Simulation
96+
## 5. Configure P4 Files in Your Simulation
9797

9898
You may need to **manually update file paths** for P4 artifacts in your simulation code.
9999

@@ -110,17 +110,17 @@ Make sure these paths match your actual working directory and files.
110110

111111
---
112112

113-
## Done!
113+
## Done!
114114

115115
You now have a working ns-3.39 simulator with P4 integration ready for your experiments.
116116

117117
---
118118

119-
## 📬 Feedback or Issues?
119+
## Feedback or Issues?
120120

121121
If you encounter problems or have suggestions, feel free to open an issue or contact the maintainer.
122122

123-
✉️ **Contact:** mingyu.ma@tu-dresden.de
123+
**Contact:** mingyu.ma@tu-dresden.de
124124

125125

126126

@@ -141,7 +141,7 @@ Notes:
141141

142142
---
143143

144-
## <a name="setup-ns335"></a> Setup Instructions for ns-3 version 3.x - 3.35 (Build with `waf`) [⤴️](#index)
144+
## <a name="setup-ns335"></a> Setup Instructions for ns-3 version 3.x - 3.35 (Build with `waf`)
145145

146146
This has been tested with ns-3 repo Tag `ns-3.35`.
147147

@@ -214,7 +214,7 @@ git apply ./contrib/p4sim/doc/changes.patch
214214

215215
---
216216

217-
## <a name='setup-ns339'></a> Setup Instructions for ns-3 version 3.36 - 3.39 (Build with `Cmake`) [⤴️](#index)
217+
## <a name='setup-ns339'></a> Setup Instructions for ns-3 version 3.36 - 3.39 (Build with `Cmake`)
218218

219219
This has been tested with ns-3 repo Tag `ns-3.39`. Because the virtual machine will build BMv2 and libs with **C++17**, and ns-3 p4simulator using the external inlucde file and libs, therefore the ns-3 also need to build with **C++17**.
220220
The include file is: `/usr/local/include/bm`, the libs is `/usr/local/lib/libbmall.so`.
@@ -301,7 +301,7 @@ Not been tested yet.
301301

302302
[2] [P4Lang Tutorials repository](https://github.com/p4lang/tutorials/tree/master)
303303

304-
# <a name='appendix'></a> Appendix [⤴️](#index)
304+
# <a name='appendix'></a> Appendix
305305

306306
After `Install P4 Behavioral Model (bmv2) and Dependencies`, you should have that:
307307

0 commit comments

Comments
 (0)