Hello,
I want to send digest message from bmv2 to controller through p4runtime, but I can’t make it work.
I tried different environments, but none of them will work. Maybe I missed something.
To my understanding, I have to send WriteRequest to insert a DigestEntry, so the switch will start to send digest messages to controller through StreamChannel.
With stratum_bmv2
, I can insert the entry, but I didn’t receive any digest message. I can still get PacketIn messages meanwhile.
With simple_switch_grpc
, I can’t insert the entry. I received a helpless message as below
Traceback (most recent call last):
File "./p4runtime_test.py", line 152, in <module>
main2(stub)
File "./p4runtime_test.py", line 141, in main2
insert_digest(stub, 401776493)
File "./p4runtime_test.py", line 117, in insert_digest
response = stub.Write(req)
File "/home/doraeric/venv/lib/python3.8/site-packages/grpc/_channel.py", line 946, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/home/doraeric/venv/lib/python3.8/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = ""
debug_error_string = "{"created":"@1654597469.924974618","description":"Error received from peer ipv6:[::1]:50051","file":"src/core/lib/surface/call.cc"
,"file_line":952,"grpc_message":"","grpc_status":2}"
The server didn’t response any details about the error. I can receive PacketIn in the setup, too.
I tried both using p4runtime-shell and writing grpc client by myself, neither of them have received digest messages.
The P4 program with digest call can be compiled and upload to switch through SetForwardingPipelineConfig
without error, but it didn’t send any digest message.
How can I send digest messages?
Did I miss some steps?
Is there any working example or tool I can try?
This is the python I used to insert digest entry:
def insert_digest(stub, digest_id):
req = p4runtime_pb2.WriteRequest()
req.device_id = device_id
req.election_id.high = 0
req.election_id.low = 1
req.role_id = 0
update = req.updates.add()
update.type = p4runtime_pb2.Update.INSERT
digest_entry = update.entity.digest_entry
digest_entry.digest_id = digest_id
digest_entry.config.max_timeout_ns = 0
response = stub.Write(req)
print('digest added')
Here are some environment information. I truncated some less important output.
# stratum
$ stratum_bmv2 --version
stratum_bmv2 version e00eac942a877e22e3927ef8ec0818685622039d
$ ps aux | grep '[s]tratum_bmv2'
root 73 1.6 0.2 1089148 53272 ? Ssl 09:37 2:41 stratum_bmv2 -device_id=1 -chassis_config_file=/tmp/s1/chassis-config.txt -forwarding_pipeline_configs_file=/tmp/s1/pipe.txt -persistent_config_dir=/tmp/s1 -initial_pipeline=/root/dummy.json -cpu_port=255 -external_stratum_urls=0.0.0.0:50001 -local_stratum_url=localhost:55361 -max_num_controllers_per_node=10 -write_req_log_file=/tmp/s1/write-reqs.txt -bmv2_log_level=warn
# simple_switch_grpc
$ simple_switch_grpc --version
1.14.0-2de095c7
$ ps aux | grep '[s]imple_switch'
root 57014 0.7 1.1 1267316 45252 pts/7 Sl+ 16:48 1:34 simple_switch_grpc -i 1@s1-eth1 -i 2@s1-eth2 -i 3@s1-eth3 -i 4@s1-eth4 --pcap /home/doraeric/tutorials/exercises/basic/pcaps --nanolog ipc:///tmp/bm-0-log.ipc --device-id 0 build/basic.json --log-console --thrift-port 9090 -- --grpc-server-addr 0.0.0.0:50051 --cpu-port 255