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. 【Android】Android内存溢出问题---用自行开辟的空间进行对内存管理

    public static Bitmap readBitmap(String path) { BitmapFactory.Options options = new BitmapFactory.Opt ...

  2. 微信小程序 --- model弹框

    model弹框:在屏幕中间弹出,让你进行选择: 效果: 代码: <button type="primary" bindtap="btnclick"> ...

  3. Lucene.net之解决锁的问题

    public sealed class SearchIndexManager { private static readonly SearchIndexManager searchManager=ne ...

  4. 【转】B2C电子商务系统设计精选

    B2C电子商务系统研发——促销引擎设计(一)(Promotion Engine) B2C电子商务系统研发——商品SKU分析和设计(一) B2C电子商务系统研发——商品SKU分析和设计(二) 电商后台系 ...

  5. Oracle HA 之 基于活动数据库复制配置oracle 11.2 dataguard

    规划:主库:db_name=dbking               db_unique_name=dbkingpri               备库:db_name=dbking          ...

  6. rac库grid目录权限(6751)导致数据库宕机案例 此方法仅用于紧急救助

    问题: 我的rac环境不小心通过chown命令改变了/u01目录及其子目录的权限,导致rac节点2数据库宕掉,sqlplus下打开数据库报错如下: [oracle@node2 ~]$ sqlplus ...

  7. mrbs - 初识

    一.mrbs mrbs:(meeting room booking system)会议室预订系统 二.效果 三.models from django.db import models # Create ...

  8. 当IDENTITY_INSERT设置为OFF时不能向表插入显示值。(源:MSSQLServer,错误码:544)

    错误提示"事务和快照同步时提示:当IDENTITY_INSERT设置为OFF时不能向表插入显示值.(源:MSSQLServer,错误码:544)" 原因:在SQL2008同步时到S ...

  9. C# 反双曲余弦函数

    反双曲余弦函数的定义是: T1 = Math.Log(t + Math.Sqrt(t * t - 1)); 1. 叉乘(cross product),也叫向量的外积.向量积.顾名思义,求下来的结果是一 ...

  10. 记一次mysql启动不了的问题

    在linux上用的是xampp,mysql启动没有报任何错误,但就是查找不到进程,于是找mysql错误日志,日志在哪?在lampp/var/mysql 以.err结尾的文件里.里面内容如下; /opt ...