<div dir="ltr">My best guess: you are not providing a device_id to the Bmv2SwitchConnection constructor which means it will default to 0 for both instances (<a href="https://github.com/p4lang/tutorials/blob/master/P4D2_2017_Fall/exercises/p4runtime/p4runtime_lib/switch.py#L22" target="_blank">https://github.com/p4lang/tut<wbr>orials/blob/master/P4D2_2017_<wbr>Fall/exercises/p4runtime/p4run<wbr>time_lib/switch.py#L22</a>).<div>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 (<a href="https://github.com/p4lang/tutorials/blob/master/P4D2_2017_Fall/utils/p4runtime_switch.py#L70" target="_blank">https://github.com/p4lang/<wbr>tutorials/blob/master/P4D2_<wbr>2017_Fall/utils/p4runtime_<wbr>switch.py#L70</a>). The tutorial VM uses an older version of bmv2 so it doesn't matter but <i>more recent versions check that both device ids match</i>.</div><div>If you provide the correct device_id arguments to <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Bmv2SwitchConnection (at least for s2), it will hopefully solve the issue:</span></div><div>s1 = p4runtime_lib.bmv2.Bmv2SwitchConnection(‘s1', address=‘127.0.0.1:50051’, device_id=0)<br></div><div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">s2 = p4runtime_lib.bmv2.Bmv2SwitchConnection(‘s2', address=‘127.0.0.1:50052’, device_id=1)<br></div><br></div><div>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 Day.</div><div><br></div><div>Thanks,</div><div><br></div><div>Antonin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 30, 2018 at 11:51 AM, Zeeshan Lakhani <span dir="ltr"><<a href="mailto:zeeshan.lakhani@gmail.com" target="_blank">zeeshan.lakhani@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>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<br><br>``` s1 = p4runtime.bmv2.Bmv2SwitchConne<wbr>ction('s1', address='<a href="http://127.0.0.1:50051" target="_blank">127.0.0.1:50051</a>')<br>    s2 = p4runtime.bmv2.Bmv2SwitchConne<wbr>ction('s2', address='<a href="http://127.0.0.1:50052" target="_blank">127.0.0.1:50052</a>')<br><br>    # Install the P4 program on the switches<br>    s1.SetForwardingPipelineConfig<wbr>(p4info=p4info_helper.p4info,<br>                              <wbr>     bmv2_json_file_path=bmv2_file_<wbr>path)<br>    print ("Installed P4 Program using SetForwardingPipelineConfig on %s" % <a href="http://s1.name" target="_blank">s1.name</a>)<br><br>    s2.SetForwardingPipelineConfig<wbr>(p4info=p4info_helper.p4info,<br>                              <wbr>     bmv2_json_file_path=bmv2_file_<wbr>path)<br>    print ("Installed P4 Program using SetForwardingPipelineConfig on %s" % <a href="http://s2.name" target="_blank">s2.name</a>)```<br><br></div>... we get this grpc error traceback (<i><b>after s1 is correctly configured</b></i>):<br><br>```<br>Installed P4 Program using SetForwardingPipelineConfig on s1<br>Traceback (most recent call last):<br>  File "test.py", line 203, in <module><br>    main(args.p4info, args.bmv2_json)<br>  File "test.py", line 156, in main<br>    bmv2_json_file_path=bmv2_file_<wbr>path)<br>  File "../p4runtime/switch.py", line 49, in SetForwardingPipelineConfig<br>    self.client_stub.SetForwarding<wbr>PipelineConfig(request)<br>  File "/usr/local/lib/python2.7/site<wbr>-packages/grpc/_channel.py", line 507, in __call__<br>    return _end_unary_response_blocking(s<wbr>tate, call, False, deadline)<br>  File "/usr/local/lib/python2.7/site<wbr>-packages/grpc/_channel.py", line 455, in _end_unary_response_blocking<br>    raise _Rendezvous(state, None, None, deadline)<br>grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.UNKNOWN, Error when assigning device)><br>```<br><br></div>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.<br><br></div>Thanks.<br></div>
<br>______________________________<wbr>_________________<br>
P4-dev mailing list<br>
<a href="mailto:P4-dev@lists.p4.org">P4-dev@lists.p4.org</a><br>
<a href="http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org" rel="noreferrer" target="_blank">http://lists.p4.org/mailman/<wbr>listinfo/p4-dev_lists.p4.org</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Antonin<br></div></div>
</div>