P4factory ReadMe 剩余部分
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 剩余部分的更多相关文章
- P4factory ReadMe Quickstart 安装p4factory
操作系统: Ubuntu 14.04 前言 在之前,我直接从P4.org给的GitHub网址上下载了p4factory,但是在根据ReadMe的内容进行QuickStart的时候,发生了shell脚本 ...
- LibLinear(SVM包)使用说明之(一)README
转自:http://blog.csdn.net/zouxy09/article/details/10947323/ LibLinear(SVM包)使用说明之(一)README zouxy09@qq.c ...
- android计算每个目录剩余空间丶总空间以及SD卡剩余空间
ublic class MemorySpaceCheck { /** * 计算剩余空间 * @param path * @return */ public static String getAvail ...
- 二次剩余、三次剩余、k次剩余
今天研究了一下这块内容...首先是板子 #include <iostream> #include <stdio.h> #include <math.h> #incl ...
- git推送文件至github缺少README文件
一直报这个错! 主要是因为本地仓库中缺少README这个文件. 解决办法:第一步:git pull --rebase origin master 将github中的README文件下到本地仓库中. 第 ...
- JHChart 1.1.0 iOS图表工具库中文ReadMe
JHChart(最新版本1.1.0) 好吧,的确当前的github上已经存有不少的iOS图表工具库,然而,当公司的项目需要图表时,几乎没有哪个第三方能够完全满足我的项目需求.无奈之下,本人不得不花费一 ...
- Windows - 性能监控之磁盘剩余空间大小警报
开始 -> 运行 -> 键入命令 perfmon.msc 数据收集器(Data Collector Sets) -> 用户自定义(User Defined)
- 用字符流实现每个文件夹中创建包含所有文件信息的readme.txt
package com.readme; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; i ...
- SQL Server自动化运维系列——监控磁盘剩余空间及SQL Server错误日志(Power Shell)
需求描述 在我们的生产环境中,大部分情况下需要有自己的运维体制,包括自己健康状态的检测等.如果发生异常,需要提前预警的,通知形式一般为发邮件告知. 在所有的自检流程中最基础的一个就是磁盘剩余空间检测. ...
随机推荐
- .net asp iis服务器如何让外部访问自己的网站
1.控制面板-防火墙-高级设置-入站规则-右侧的BranchCache内容检索,右键启用规则.
- Windows Phone 在读取网络图片之前先显示默认图片
1.新建一个控件WindowsPhoneControl1 WindowsPhoneControl1.xaml <UserControl x:Class="DefaultImage.Wi ...
- OC开发_Storyboard——Core Data
一 .NSManagedObjectContext 1.我们要想操作Core Data,首先需要一个NSManagedObjectContext2.那我们如何获得Context呢:创建一个UIMana ...
- linux对文件某列求和
对文件某列求和: -F,用,号分隔,求第3行的和 awk -F, '{sum += $3};END {print sum}' test
- MyBatis DAO层传递参数到mapping.xml 几种方式
Dao层传递参数到mapping.xml文件的几种方式:(Mybatis传值总结) 第一种:传递单个参数 Dao层Code片段: /** * 根据articleId查询XXXX详情. * * @par ...
- js常用的几个验证
/// <summary> ///1. 使用正则表达式验证 参数 是否 为数值 /// </summary> /// <param name="trNumber ...
- Linux下批量管理工具pssh使用记录
pssh是一款开源的软件,使用python实现,用于批量ssh操作大批量机器:pssh是一个可以在多台服务器上执行命令的工具,同时支持拷贝文件,是同类工具中很出色的:比起for循环的做法,我更推荐使用 ...
- java 并查集
并查集代码 并查集优化⼀ 并查集优化⼆ 实战题⽬目1. https://leetcode.com/problems/number-of-islands/2. https://leetcode.com/ ...
- 15.Git面试题
1.git常见命令作用 git init 在哪一目录下,就会在该目录下生成.git目录. 注意:git init命令会把当前目录当作库. git status 查看本地库的状态 git add . 将 ...
- Day27-28 基础加强
day28基础加强 今日内容 泛型 注解 Servlet3.0 动态代理 类加载器 泛型 回顾泛型类 泛型类:具有一个或多个泛型变量的类被称之为泛型类. public class A<T&g ...
