Closed chenxiang2019 closed 7 years ago
I am confused by why you are using p4factory for this. p4factory is pretty much deprecated at this stage for the bmv2 workflow, which is what you are using here. You actually seem to be following what the examples in the tutorials repo are doing (https://github.com/p4lang/tutorials).
Could you give the output of sudo /home/wasdns/p4factory/targets/demo/behavioral-model demo.json
? Based on the information you are giving, I am a little scared you are are trying to compile and run bmv1, as if it were bmv2...
@antoninbas
The output showed below:
root@ubuntu:/home/wasdns/p4factory/targets/demo# sudo ./behavioral-model demo.json
No PD RPC server address specified, using 127.0.0.1:9090
No listener specified, switch will run in standalone mode
P4 Program: demo
Starting RPC server on port 9090
I'm using the p4factory because it showed me the same excepetion when I used bmv2 before. When I saw the error information, I think it should be some problem with the software switch. In fact, the demo.p4 is the same with the l2_switch.p4 . I didn't change it yet. The target I used before was l2_switch.
@antoninbas
My demo ran well with the target simple_switch, and I opened the runtime CLI successfully by using thrift port 22222. But another problem occured. When I using the command mc_mgrp_create 1
, it showed that:
RuntimeCmd: mc_mgrp_create 1
Creating multicast group 1
Traceback (most recent call last):
File "./runtime_CLI.py", line 2216, in <module>
main()
File "./runtime_CLI.py", line 2213, in main
RuntimeAPI(args.pre, standard_client, mc_client).cmdloop()
File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
return func(arg)
File "./runtime_CLI.py", line 587, in handle
return f(*args, **kwargs)
File "./runtime_CLI.py", line 1452, in do_mc_mgrp_create
mgrp_hdl = self.mc_client.bm_mc_mgrp_create(0, mgrp)
File "/usr/local/lib/python2.7/dist-packages/bm_runtime/simple_pre/SimplePre.py", line 103, in bm_mc_mgrp_create
return self.recv_bm_mc_mgrp_create()
File "/usr/local/lib/python2.7/dist-packages/bm_runtime/simple_pre/SimplePre.py", line 121, in recv_bm_mc_mgrp_create
raise x
thrift.Thrift.TApplicationException: TMultiplexedProcessor: Unknown service: simple_pre
and cmd exit unexcepted.
Is there something wrong with my steps?
When running simple_switch, prefer the simple_switch CLI (https://github.com/p4lang/behavioral-model/blob/master/targets/simple_switch/sswitch_CLI). It gets installed as simple_switch_CLI
when you run make install
.
Alternatively, you can keep using the basic runtime CLI here, but you need to pass --pre SimplePreLAG
when starting it.
@antoninbas
Thank you very much! But I still have a question.
As far as I know, the control plane in the target "l2_switch" using learn_client to receive the digest from the data plane, then generate flow entries to deploy to the switches in the data plane. Reference: How learn_client work with l2_switch in mininet?
But how can I use the learning engine for the switches in my specific virtual topo logic? In the other words, is there something like learn_client in simple_switch?
It should not be too hard to adapt the learn_client to work with your own P4 program (running in simple_switch), providing you are not doing anything to advanced. You will have to adapt the struct representing the learning sample and modify the table names if needed. You also need to provide the correct notification socket (https://github.com/p4lang/behavioral-model/blob/master/targets/l2_switch/learn_client/learn_client.cpp#L87) for each switch instance, so you may want to make it a command line argument for the learn_client executable and start a learn_client process for every switch in the topology. You could also modify learn_client in such a way that a unique instance can manage N switches, so whatever you prefer.
Note that the learn_client is an example which is not tied to a specific bmv2 architecture (i.e. it can work with simple_switch) but is tied to a specific P4 program (in this case l2_switch.p4). It therefore needs to be adapted to the P4 program you are running.
@antoninbas
I see. Thanks a lot and happy Chinese new year!
@Wasdns 你好,请问一下问题解决了吗,用的什么办法,我也遇到了同样的问题
Hi all.
Recently, I created a new target in p4factory, using
p4factory/tools/newtarget.py
, and I wanted to run my own P4 code in software switch integrated with specific topo.py by using mininet.Firstly, I implemented the command
sudo make bm
to generate the behavioral-model. And I used the scriptveth_setup.sh
to creat virtual port.Then, I run the script
run_demo.sh
, the content are showed below:And it created virtual network successfully,
but when I run
./runtime_CLI.py --thrift-port 22222
, it reported error:My thrift version is
0.9.2
, and it worked successfully when I tried the l2_switch target and the Tutorials.How can I solved this problem? Thanks a lot for your kindness!