Building and Running a Target

Each P4 program (called a 'target') is set up in a directory under targets/. Inside the target directory is a Makefile with the instructions on how to build the behavioral model for that P4 program.

cd targets/project_name
make bm

This should result in an executable in the same directory called "behavioral_model"

大概意思:P4程序 也叫‘Target’,是在 target/.目录下建立的;在这个target目录下,是一个Makefile文件,和一个介绍如何为P4程序build一个行为模型的文件。

做了个测试:

cd /home/wasdns/p4factory/targets/switch

make bm

Integration with Mininet 和 Mininet 一起运行

Integration with Mininet provides a way to instantiate a network of nodes each running a data plane described in P4.

We provide a Mininet integration for one of our existing targets: simple_router

To run it, do the following:

cd p4factory/targets/simple_router/
make bm
./run_demo.bash

To install some table entries, run the following (in a different terminal):

./run_add_demo_entries.bash

跑的时候出现了错误:



好吧,解决方法说依赖关系重叠,我只好重新安装了下p4factory,解决问题。

You can then type commands in the Mininet CLI:

mininet> h1 ping h2

建立了一个简单拓扑,但是h1和h2并没有ping通。这让我很奇怪,h1 ping s1 还有 h2 ping s1 都没有问题。

Creating a New Target

To add a new target, cd to targets/ and run:

p4factory/tools/newtarget.py project_name

where project_name is the name of the P4 program (without the .p4 extension). This will create a new directory in targets/ called project_name/, set it up to build the behavioral model, and create a template for the P4 program there named project_name.p4. Then, edit that file or copy your P4 program to that file and make in that directory.

这个就是生成P4程序的命令了;可以用这个命令创建一个没有.p4后缀的P4程序,在targets/目录下,在该目录下创建一个文件 .p4,用vim编辑它或者直接把P4代码拷贝过去,make即可。

P4 Dependency Graph Generator

这个命令是用来辅助生成P4程序的依赖图表的:The relationships between tables of more complex P4 program can be difficult to comprehend. The p4-graphs utility parses through the the P4 program and generates a dependency graph using graphviz. The dependency graph can be generated with the following command:

p4-graphs <p4 code>

The resulting files can be viewed using xdot or with a PNG viewer.

Towards a better behavioral model: bmv2

新的P4行为模型,如果你在一个P4程序里面看到bmv2目录的话,那么就意味着它支持bmv2.

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.

跑支持bmv2的程序,你可以这样做:

For example, the l2_switch target supports bmv2. To run the code, you can do the following:

cd targets/l2_switch/bmv2/
make bm
./run_bm.sh # to start the data plane

然后新打开Terminal,执行下面这句,打开API:

sudo ./drivers    # in a second terminal, to start the PD APIs (RPC server)

打开第三个Terminal,跑这些例子:

sudo python run_tests.py --test-dir tests/ptf-tests/

2016/9/27

P4factory ReadMe 剩余部分的更多相关文章

  1. P4factory ReadMe Quickstart 安装p4factory

    操作系统: Ubuntu 14.04 前言 在之前,我直接从P4.org给的GitHub网址上下载了p4factory,但是在根据ReadMe的内容进行QuickStart的时候,发生了shell脚本 ...

  2. LibLinear(SVM包)使用说明之(一)README

    转自:http://blog.csdn.net/zouxy09/article/details/10947323/ LibLinear(SVM包)使用说明之(一)README zouxy09@qq.c ...

  3. android计算每个目录剩余空间丶总空间以及SD卡剩余空间

    ublic class MemorySpaceCheck { /** * 计算剩余空间 * @param path * @return */ public static String getAvail ...

  4. 二次剩余、三次剩余、k次剩余

    今天研究了一下这块内容...首先是板子 #include <iostream> #include <stdio.h> #include <math.h> #incl ...

  5. git推送文件至github缺少README文件

    一直报这个错! 主要是因为本地仓库中缺少README这个文件. 解决办法:第一步:git pull --rebase origin master 将github中的README文件下到本地仓库中. 第 ...

  6. JHChart 1.1.0 iOS图表工具库中文ReadMe

    JHChart(最新版本1.1.0) 好吧,的确当前的github上已经存有不少的iOS图表工具库,然而,当公司的项目需要图表时,几乎没有哪个第三方能够完全满足我的项目需求.无奈之下,本人不得不花费一 ...

  7. Windows - 性能监控之磁盘剩余空间大小警报

    开始 -> 运行 -> 键入命令 perfmon.msc 数据收集器(Data Collector Sets) -> 用户自定义(User Defined)

  8. 用字符流实现每个文件夹中创建包含所有文件信息的readme.txt

    package com.readme; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; i ...

  9. SQL Server自动化运维系列——监控磁盘剩余空间及SQL Server错误日志(Power Shell)

    需求描述 在我们的生产环境中,大部分情况下需要有自己的运维体制,包括自己健康状态的检测等.如果发生异常,需要提前预警的,通知形式一般为发邮件告知. 在所有的自检流程中最基础的一个就是磁盘剩余空间检测. ...

随机推荐

  1. 【黑金ZYNQ7000系列原创视频教程】05.FPGA和ARM的初次结合——LED实验

    黑金论坛地址: http://www.heijin.org/forum.php?mod=viewthread&tid=36639&extra=page%3D1 爱奇艺地址: http: ...

  2. 主流品牌服务器(Dell、HP、IBM)远程管理卡IP配置参考

    版权声明:个人网络收集整理,欢迎转载! https://blog.csdn.net/niufenger/article/details/80737878 ※Dell服务器iDRAC IP配置 ※HP服 ...

  3. Web和Native使用外部字体ttf方法

    论坛教程:http://bbs.egret.com/forum.php?mod=viewthread&tid=24879&extra=&highlight=%E5%AD%97% ...

  4. 【BZOJ4423】[AMPPZ2013]Bytehattan 对偶图+并查集

    [BZOJ4423][AMPPZ2013]Bytehattan Description 比特哈顿镇有n*n个格点,形成了一个网格图.一开始整张图是完整的.有k次操作,每次会删掉图中的一条边(u,v), ...

  5. ZoomIt v4.5

    https://technet.microsoft.com/en-us/sysinternals/bb897434.aspx zoomIt: 演示必备辅助软件 ZoomIt(主页|介绍)是一款非常实用 ...

  6. ios UIImage图片拉伸 resizableImageWithCapInsets:

    常见的按钮添加和背景设置如下: UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(80, 130, 160, 44)];[bu ...

  7. pandas将字段中的字符类型转化为时间类型,并设置为索引

    假设目前已经引入了 pandas,同时也拥有 pandas 的 DataFrame 类型数据. import pandas as pd 数据集如下 df.head(3) date open close ...

  8. JS将阿拉伯数字转为钱

     function DX(n) {         if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n))             return "数据非法" ...

  9. EasyUI之Layout布局和Tabs页签的使用

    1.JQuery EasyUI之LayOut布局 EasyUI是一款基于JQuery开发的前端框架,它集成很多漂亮的样式和相应的功能,大大方便了我们对前端开发的难度.对于web项目而言,主页面的一定是 ...

  10. vs 2015

    基于应用要求和要使用的语言选择所需工具. Xamarin for Visual Studio:针对所有设备的 C# 中的常用基本代码 Apache Cordova with Visual Studio ...