Comments (10)
Thank you Antonin! I implemented the workaround and it works as you mentioned. The dataplane stub can be retrieved when I pushed a barebones BMv2 JSON config in the command-line args
from behavioral-model.
Thank you for the platinum support, @antoninbas, highly appreciated! :)
from behavioral-model.
Based on the code, it seems that it is the intended behavior:
behavioral-model/targets/simple_switch_grpc/switch_runner.cpp
Lines 114 to 115 in c74c536
If you cannot order things "correctly", you could always start simple_switch_grpc with a placeholder pipeline that drops all packets (or any other default behavior you prefer).
I would also be open to a PR that modifies the behavior so that the PacketStream
implementation only returns an error if a packet is sent while there is no forwarding pipeline (as opposed to closing the stream right away which is the current behavior). I don't really see any downside to that.
I can't recall if other gRPC implementations (e.g. in Golang) have the same behavior as the C++ one, where the client only gets that error after the first call to Read
.
from behavioral-model.
Thanks, Antonin!
Providing some additional context on why opening a dataplane stream before pushing forwarding pipeline config is useful, in case that wasn't obvious.
We are working in a scenario where the 2 BMv2 grpc services (dataplane, P4RT) are used by different modules that we don't want to require to be synchronized. E.g., it makes sense for the dataplane sevice to be used by a "topology module" that implements connectivity between different switches, and for the P4RT service to be used by a "SDN controller module". In a physical network, the physical topology is oblivious to the SDN controller, and we want the same thing to be true in software.
from behavioral-model.
you could always start simple_switch_grpc with a placeholder pipeline that drops all packets (or any other default behavior you prefer)
Thanks for the suggestion. With this approach, we can decouple the topology module from the SDN controller module after this initialization step. But it has the downside that the SDN controller module will see the switch as already being configured, so the solution may require some special logic/awareness in the SDN controller module.
I would also be open to a PR that modifies the behavior so that the PacketStream implementation only returns an error if a packet is sent while there is no forwarding pipeline (as opposed to closing the stream right away which is the current behavior). I don't really see any downside to that.
Agreed. One nuance is that this will require terminating the stream in the error case, because AFAIK, that is the only way to communicate an error through the grpc bidirectional streaming API. I don't think there is a big problem with that.
from behavioral-model.
But it has the downside that the SDN controller module will see the switch as already being configured
Actually, I think that if you are providing a bmv2 JSON file when starting the simple_switch_grpc process, as a command-line argument, from a P4Runtime perspective it will show as an "unconfigured" switch. This can either be considered as a bug or as a feature depending on what your needs are :)
from behavioral-model.
How would I provide a bmv2 JSON file to the simple_switch_grpc process?
Would it just be removing the --no-p4 flag and then adding a file path like
simple_switch_grpc <JSON FILE> \ -i <PORT1>@<IFACE1> -i <PORT2>@<IFACE2> <more ports> \ -- --grpc-server-addr <IP>:<TCP PORT> --cpu-port <CPU_PORT>
from behavioral-model.
Yes
from behavioral-model.
I tried to run simple_switch_grpc process and passed a BMv2 JSON file to it. Afterwards, when trying to create a P4runtime stub, I end up timing out. I was wondering if you had any idea why this might be happening?
from behavioral-model.
The simple_switch_grpc logs (when using --log-console
) should tell you if the JSON was loaded successfully. As far as I know, providing a JSON file this way has no impact on whether the P4Runtime server is started.
from behavioral-model.
Related Issues (20)
- how to achieve a timer in bmv2 HOT 3
- Can BMv2 interfaces be bound to virtual network cards of two virtual machines? How should this be done specifically? HOT 2
- Can I get the index of a value in the register by custom_lib? HOT 4
- import thrift
- TCP packets seem not to be processed correctly by bmv2 HOT 2
- Problem using multicast in runtime HOT 2
- Empty action-parameter vector is always accessed in ActionFnEntry::execute HOT 7
- How to build behavioral-model on the MacOS(Apple M1 Pro(13.5)) HOT 2
- How to track fileds of metadata with p4dbg? HOT 2
- Approximate conversion of bmv2 p4 performance to hardware performance HOT 3
- Applying the same table twice HOT 2
- Update project to require C++17 HOT 9
- Race conditions when passing in a BMv2 JSON config HOT 12
- To Add PNA support into BMv2. HOT 5
- How to build simple_switch / simple_switch_grpc on Ubuntu 24.04 ? HOT 4
- Why bmi_port.c is a C code? HOT 2
- Race conditions when processing packet in the egress pipeline. HOT 6
- Heap Buffer Overflow when installing many table entries HOT 1
- CMake support HOT 4
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 behavioral-model.