Comments (6)
Yes it does.
You have to use the thrift API: https://github.com/nsg-ethz/p4-utils/blob/master/p4utils/utils/thrift_API.py#L1976
You can find examples in the p4-learning repo:
https://github.com/nsg-ethz/p4-learning/blob/master/examples/recirculate_and_add_header/fill_register.py
https://github.com/nsg-ethz/p4-learning/blob/master/exercises/11-Packet-Loss-Detection/solution/packet-loss-controller.py (here you can find reads and writes from the controller)
from p4-utils.
Hi @edgar-costa,
Thank you so much for your answer, I was able to get it to work.
I have another question if you can help I would appreciate that.
I need for each incoming packet to have the queue size of each egress port. Indeed, I know that in the ingress using the standard metadata we can have access to the queue size of the port that the packet enq and deq in it.
However, what I need is for each incoming packet to check the current queue size of each egress port so I wanna send on the least congested port. Is there any solution or tricks or resources that might help in this?
Again thank you so much for your help.
from p4-utils.
That is something related to specific P4 architectures not P4-utils.
Using the simple_switch
you can not know the queue depth at the ingress, you could know it once you are at the egress and write it into a register, since you can access registers globally you can then read it with a bit of delay for the next packet.
Otherwise, you can not know it beforehand.
With a real hardware architecture you will need them to support this. There is something similar in tofino2
I think.
By the way, this paper: https://dl.acm.org/doi/10.1145/3098822.3098839 is doing what you want to do, but its a pre-p4 paper.
from p4-utils.
Hello,
I just want to ask if P4-UTILS supports reading and writing to registers. I highly appreciate your help.
Thank you.
You can do so like:
register<int<32>,bit<8>>(32) test_reg;
bit<8> index1=0;
int<32> result;
conv_reg.read(result,index1);
from p4-utils.
I am writing the source ip address and destination ip address of the header to the register, why is the data read by the controller a set of numbers, how to translate the bit IP address
from p4-utils.
@huyongqingandczw That has nothing to do with P4. Addresses are 32-bit integers. When you read them, you need to translate them yourself. This code will do that
import socket
import struct
def int_to_ip(int_ip):
# Convert the integer to a binary string
packed_ip = struct.pack("!I", int_ip)
# Unpack the binary string into a readable IPv4 address
readable_ip = socket.inet_ntoa(packed_ip)
return readable_ip```
from p4-utils.
Related Issues (20)
- why is the preconfigured VMs not available now? HOT 6
- Bittorent recognition from packet payload HOT 1
- Problems encountered when using the p4run command HOT 5
- Is the preconfigured p4-utils-vm only has a tty shell when start it? HOT 2
- Bvm2 switch on p4util topo cannot ping between hosts HOT 1
- Hardware Interface
- Using @controller_header
- How to run multiple controllers HOT 6
- How to clone packets more than once back to back? HOT 2
- Tofino Example: no bf_swithcd for one of the switches HOT 3
- Why SimpleSwitchP4RuntimeAPI doesn't support reading and writing register? HOT 1
- Problem with the “sudo p4run --config p4app.json” command regarding ping between hosts HOT 3
- Installing issue HOT 6
- Username and password for pre-installed VM HOT 2
- Problem with switch_thrift_API.py file
- Graceful shutdown when stopping with Ctrl+C HOT 1
- Does P4Utils Support IPv6 ? HOT 3
- register cell size HOT 1
- p4run problem HOT 5
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-utils.