PTF
Longer Start
需要先安装的东西:
Python 2.7
Scapy
pypcap (optional - VLAN tests will fail without this)
tcpdump (optional - Scapy will complain if it's missing)
Install PTF
git clone [email protected]:Wasdns/ptf.git
如何写ptf程序?
run_client.sh: a wrapper around ptf
switch_sai_thrift: empty directory, this is where the Python bindings to program the switch's control plane would be copied
mytests/sai_base_test.py: a wrapper Python class around PTF's BaseTest class. It is the base class for all the tests we added to mytests/switch.py
mytests/switch.py: some example tests
在安装p4factory的前提下,跑个样例
cd $P4FACTORY/tools/
sudo ./veth_setup.sh
cd $P4FACTORY/targets/switch/
make bm-switchsai
sudo ./behavioral-model
cd <ptf-dir>/example/
sudo ../ptf --test-dir mytests/ \
--pypath $P4FACTORY/targets/switch/tests/pd_thrift/
--interface 0@veth1 --interface 1@veth3 --interface 2@veth5 \
--interface 3@veth7 --interface 4@veth9 --interface 5@veth11 \
--interface 6@veth13 --interface 7@veth15 --interface 8@veth17