Comments (3)
Hi @Nano5e
Can you show me how do you add it? Also, can you look at the switch logs and dump the table entries after you added it?
from p4-learning.
Sorry for not being able to get back to you in time.
A demo based on MPLS
I implement a demo based on MPLS to test range match in P4 language. but I fail, it seems that I can't add range match entries to the table via runtime_api.
main files:
network.py
: Building the network
basic.p4
: p4 file for switches other than s4
basic_digest.p4
: p4 file for switch s4, peform packet counting and sending count numbers to control plane.
controller.py
: runtime_api add entries to tables.
controller_get_digest.py
: get the number send to control plane.
Some details
mac_learn
counts packets coming into s4 and sends them to the control plane via digest
. The counter is cleared every 15 counts. mac_learn
and smac
table is in basic_digest.p4
:
key = {
standard_metadata.ingress_port : range;
}
actions = {
mac_learn;
NoAction;
}
size =256;
default_action = NoAction;
}
There are four ports: 1,2,3,4. Incoming packets are counted on every port of s4 switch. (This can be accomplished using exact match, but I want to test range match.)
I added range match entry to smac table via p4runtime_API in controller.py
controller.table_add('smac','mac_learn', ['0x0001..0x0004'])
However, this does not work.
However if I add const entries in P4 file (basic_digest.p4
)
table smac {
key = {
standard_metadata.ingress_port : range;
}
actions = {
mac_learn;
NoAction;
}
size =256;
default_action = NoAction;
const entries = { 0x0001..0x0004 : mac_learn(); }
}
It works.
from p4-learning.
Hi,
Sorry for the very late reply. I did not see this.
This is how the range entries are parsed:
https://github.com/nsg-ethz/p4-utils/blob/master/p4utils/utils/thrift_API.py#L639C28-L639C50
That means you have to do it as "start->end".
you could have checked the CLI output logs, probably it complained with the following message:
"Invalid range value {}, use '->' to separate range start "
"and range end"
from p4-learning.
Related Issues (20)
- did not find a p4 program for switch s1 HOT 2
- p4-learning/exercises/05-ECMP/solution/sw-commands/s6-commands.txt; line 5 is wrong HOT 1
- sniff in Multicast example HOT 1
- detecting congestion header HOT 1
- Queue length for priority queueing HOT 2
- About sswitch_runtime HOT 1
- sudo p4run error and how to fix it
- match-action table do not support negative number
- How Count-Min Sketch implement on bmv2?
- Priority queuing in Simple Switch HOT 4
- Issue in recirculate example HOT 2
- How to create a topology HOT 1
- Why the website https://adv-net.ethz.ch/ cannot be reached now? HOT 2
- How to use cli for resubmit_recirculate example? HOT 1
- Question about forwarding. HOT 2
- Priority and qid fields meaning HOT 3
- Fast reroute with LFA doesn't work HOT 3
- Switch debugger HOT 1
- In the 04-RSVP experiment, I found a problem HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p4-learning.