p4lang quick start: p4-factory

阅读更多
注意:BMv2是最新的模型,请参考后面文章,这个仅供参考10/16/2016
==============================

p4lang官网p4.org上的视频比较老,不能简单执行成功,下面是根据p4factory的guide安装过程,运行成功,仅供参考:

#虚拟机安装ubuntu1404版本,升级到最新

#克隆p4factory mast分支
git clone https://github.com/p4lang/p4factory.git
cd p4factory
git submodule update --init --recursive
引用
# 用github 账号ssh clone应该不会看到以下问题
Cloning into 'submodules/bigcode'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Clone of '[email protected]:floodlight/bigcode' into submodule path 'submodules/bigcode' failed
Failed to recurse into submodule path 'submodules/p4ofagent/submodules/indigo'
Failed to recurse into submodule path 'submodules/p4ofagent'


vi submodules/p4ofagent/submodules/indigo/.gitmodules
替换所有git协议为https:
原来: url = [email protected]:floodlight/bigcode
改为: url = https://github.com/floodlight/bigcode.git
git submodule sync --recursive
git submodule update --init --recursive
还会看到一次类似错误,bigcode的子模块又出错:
vi submodules/p4ofagent/submodules/indigo/submodules/bigcode/.gitmodules
git submodule sync --recursive
git submodule update --init --recursive


# 安装编译依赖工具,虚拟机内存要大于512M
./install_deps.sh
#如果中间thrift出错,手工进去sudo make install; sudo ldconfig 然后修改脚本,跳过这段继续执行

sudo tools/veth_setup.sh

# prepare workspace
./autogen.sh
./configure

# Run first sample:
cd targets/basic_routing/
make bm
sudo ./behavioral-model
# To test the sample
sudo python run_tests.py --test-dir tests/ptf-tests/

# To run Mininet
./run_demo.bash
Mininet> h1 ping h2
# 新开窗口Add some entries, 这里应该看到前面窗口 ping成功
./run_add_demo_entries.bash

#########################
BMv2是新的switch模拟器,通过json文件动态加载生效,p4-factory这里的过程可以跑起来, 但是runtime_CLI.py调试工具跑不起来,请参照后面Behavioral-model文章。

Docker HUB上没看到现成image, TBD

你可能感兴趣的:(p4,p4lang,p4factory)