[P4-dev] p4runtime (related to dev-day python code) error

Antonin Bas antonin at barefootnetworks.com
Tue Jan 30 16:39:30 EST 2018

My best guess: you are not providing a device_id to the
Bmv2SwitchConnection constructor which means it will default to 0 for both
instances (https://github.com/p4lang/tutorials/blob/master/P4D2_2017_
This means that for the second switch, the device_id will not match the
actual device_id used to start the bmv2 simple_switch_grpc process (
2017_Fall/utils/p4runtime_switch.py#L70). The tutorial VM uses an older
version of bmv2 so it doesn't matter but *more recent versions check that
both device ids match*.
If you provide the correct device_id arguments to Bmv2SwitchConnection (at
least for s2), it will hopefully solve the issue:
s1 = p4runtime_lib.bmv2.Bmv2SwitchConnection(‘s1', address=‘’,
s2 = p4runtime_lib.bmv2.Bmv2SwitchConnection(‘s2', address=‘’,

I would recommend opening an issue with the tutorials repository - you can
point to this email thread - so that this is fixed for the next Developers



On Tue, Jan 30, 2018 at 11:51 AM, Zeeshan Lakhani <zeeshan.lakhani at gmail.com
> wrote:

> We're working on a test harness with containernet/mininet to work along
> with the p4runtime to test our code. We ran into an very specific error
> that we'd love to get more explanation on. We've started with examples from
> the last Developer Day, specifically advanced_tunnel.p4. Everything works
> swell in the VM. However, in calling SetForwardingPipelineConfig for the
> second switch, e.g. below
> ``` s1 = p4runtime.bmv2.Bmv2SwitchConnection('s1', address='
>     s2 = p4runtime.bmv2.Bmv2SwitchConnection('s2', address='
>     # Install the P4 program on the switches
>     s1.SetForwardingPipelineConfig(p4info=p4info_helper.p4info,
>                                    bmv2_json_file_path=bmv2_file_path)
>     print ("Installed P4 Program using SetForwardingPipelineConfig on %s"
> % s1.name)
>     s2.SetForwardingPipelineConfig(p4info=p4info_helper.p4info,
>                                    bmv2_json_file_path=bmv2_file_path)
>     print ("Installed P4 Program using SetForwardingPipelineConfig on %s"
> % s2.name)```
> ... we get this grpc error traceback (*after s1 is correctly configured*):
> ```
> Installed P4 Program using SetForwardingPipelineConfig on s1
> Traceback (most recent call last):
>   File "test.py", line 203, in <module>
>     main(args.p4info, args.bmv2_json)
>   File "test.py", line 156, in main
>     bmv2_json_file_path=bmv2_file_path)
>   File "../p4runtime/switch.py", line 49, in SetForwardingPipelineConfig
>     self.client_stub.SetForwardingPipelineConfig(request)
>   File "/usr/local/lib/python2.7/site-packages/grpc/_channel.py", line
> 507, in __call__
>     return _end_unary_response_blocking(state, call, False, deadline)
>   File "/usr/local/lib/python2.7/site-packages/grpc/_channel.py", line
> 455, in _end_unary_response_blocking
>     raise _Rendezvous(state, None, None, deadline)
> grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with
> (StatusCode.UNKNOWN, Error when assigning device)>
> ```
> Looking at both requests (switch.py in p4runtime_lib) and configs,
> everything should work the same, but we're wondering if anyone has
> encountered this error, as what's given is a bit hard to interpret. Maybe
> there's a good place for us to look and debug as well.
> Thanks.
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20180130/3bae5660/attachment-0002.html>

More information about the P4-dev mailing list