ITeye博客

p4lang quick start: p4-factory

steeven · 2016-10-15 02:00 · p4 · 开源软件 · Markdown

注意: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应该不会看到以下问题

[size=small] 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 'git@github.com: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'[/size]

vi submodules/p4ofagent/submodules/indigo/.gitmodules 替换所有git协议为https: 原来: url = git@github.com: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

评论(2)

  1. #2 楼 · steeven · 2016-10-15 14:33

    命令行启动server: sudo behavioral-model --pd-server=127.0.0.1:22222

    在另外一个窗口导入数据 ./run_add_demo_entries.bash 可以看到server窗口的导入数据

    各种表操作命令: ./run_cli.bash

  2. #1 楼 · steeven · 2016-10-15 02:19

    Thrift是Apache跨语言调用框架,可以生成代码。

评论功能维护中,当前仅展示历史评论。