P4factory <Towards a better behavioral model: bmv2>
尝试使用bmv2行为模型来跑p4实例。
原文说明:
We have released a new version of the behavioral model, written in C++. Some targets already support this new model -in addition to the original version, p4c-behavioral. If you see a target with a bmv2 directory, it means the new model is supported and you can try it out!
The new model splits the switch logic and the auto-generated PD API (drivers) into 2 different processes.
执行
打开三个终端,A,B,C。
A终端进入p4factory/targets/l2_switch/bmv2,模拟数据平面,执行如下命令:
make bm
./run_bm.sh #to start the data plane
结果:
Adding interface veth0 as port 0
Adding interface veth2 as port 1
Adding interface veth4 as port 2
Adding interface veth6 as port 3
Adding interface veth8 as port 4
Adding interface veth10 as port 5
Adding interface veth12 as port 6
Adding interface veth14 as port 7
Adding interface veth16 as port 8
Thrift server was started
B终端进入p4factory/targets/l2_switch/bmv2,打开PD APIs(RPC服务器),执行如下命令:
sudo ./drivers #in a second terminal, to start the PD APIs (RPC server)
结果:
Starting RPC server on port 9090
C终端进入l2_switch目录,跑实例:
sudo python run_tests.py --test-dir tests/ptf-tests/
结果:
WARNING: No route found for IPv6 destination :: (no default route?)
l2_switch.SimpleReplicationTest ... ok
----------------------------------------------------------------------
Ran 1 test in 0.813s
OK
返回终端B,得到结果:
Adding Thrift service for P4 program l2_switch to server
In client_init
In clean_all
In smac_set_default_action_mac_learn
In dmac_set_default_action_broadcast
In mcast_src_pruning_set_default_action__nop
In mc_mgrp_create
In mc_node_create
In mc_associate_node
In mcast_src_pruning_table_add_with__drop
Received learning notification
I received 1 samples
2016/10/14
To improve is to change, to be perfect is to change often.