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. sencha touch 扩展篇之将sencha touch打包成安装程序(上)- 使用sencha cmd打包安装程序

    由于最近一直忙着android原生的开发,很久没有更新博客了,官方的sencha cmd工具功能非常强大,创建项目,压缩项目,打包安装程序都能轻松实现,这讲我们就给大家介绍下如何使用sencha cm ...

  2. SpringData JPA查询分页demo

    SpringData JPA 的 PagingAndSortingRepository接口已经提供了对分页的支持,查询的时候我们只需要传入一个 org.springframework.data.dom ...

  3. Asp SqlDataSource将数据库数据绑定在 GridView

    1.首先认识一下GridView的几条属性 ☻AllowPaging  确定是否可以分页 ☻AllowSorting  确定是否可以进行排序 ☻AlternatingRowStyle  指定奇数行样式 ...

  4. thinkphp---数据表更新字段开发模式可更新生产模式不能更新!

    这里认为是坑的主要原因:这个问题我调试了一天,才发现是缓存的问题. 问题原因:在做一thinkphp的项目,在后期要进行修改.修改的时候,数据表里面添加了两个字段,然后前台修改模板,将添加的字段提交上 ...

  5. ThinkPHP如果表名有下划线需要用Model应该怎么做?

    最近遇到一个问题,在用TP做系统的时候,我建立的表是 “tp_admin_user” 但是要用到的模型是 “AdminUserModel.model.class.php”,应该如何做? 解决方法: & ...

  6. MVC认识

    1.ASP.NET两种开发模式的简单比较(WebForm和MVC) (1)WebForm开发模式 当用户输入网址https://i.cnblogs.com/EditPosts.aspx?opt=1进行 ...

  7. mendeley不能做中文批注的解决方案

    mendeley是一个很好用且免费的文献管理工具,但在ubuntu系统下,对文献进行批注无法切换中文输入法,实际上对ibus是支持的,但ibus实在是太难用,大部分ubuntu用户钟爱的还是fcitx ...

  8. vs 2015

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

  9. 信号(Django信号、Flask信号、Scrapy信号)

    简介 Django.Flask.scrapy都包含了一个“信号分配器”,使得当一些动作在框架的其他地方发生的时候,解耦的应用可以得到提醒. 通俗来讲,就是一些动作发生的时候,信号允许特定的发送者去提醒 ...

  10. python中读取配置文件的方式

    方式1:argparse argparse,是Python标准库中推荐使用的编写命令行程序的工具.也可以用于读取配置文件. 字典样式的配置文件*.conf 配置文件test1.conf { " ...