PTF

PTF is a Python based dataplane test framework. It is based on unittest, which is included in the standard Python distribution.

Longer Start

需要先安装的东西:

    Python 2.7
Scapy
pypcap (optional - VLAN tests will fail without this)
tcpdump (optional - Scapy will complain if it's missing)

请先安装scapy-vxlan

安装pypcap = 安装flex:the fast lexical analyser + 安装libpcap-1.7.4

Ubuntu安装Tcpdump

We recommend that you install your extension of Scapy, which you can obtain here. It adds support for additional header types: VXLAN, ERSPAN, GENEVE, MPLS and NVGRE.

注意:在执行命令的时候,应注意权限问题(sudo root)。

Install PTF

先fork下来目录:

git clone git@github.com:Wasdns/ptf.git

cd ptf

sudo python setup.py install

如何写ptf程序?

Take a look at the example directory. This is not a working example as it is (the switch is not included), but it will show you how to write tests. This directory contains the following:

    run_client.sh: a wrapper around ptf
switch_sai_thrift: empty directory, this is where the Python bindings to program the switch's control plane would be copied
mytests/sai_base_test.py: a wrapper Python class around PTF's BaseTest class. It is the base class for all the tests we added to mytests/switch.py
mytests/switch.py: some example tests

可以在example目录下找到答案。

在安装p4factory的前提下,跑个样例

请先安装p4factory。

First, you need to create the required veths: 先打开虚拟接口

cd $P4FACTORY/tools/
sudo ./veth_setup.sh

注意,这里的$P4FACTORY指的是p4factory的目录。

The next step is to compile the target switch and to run it: 编译一个目的交换机,运行它

cd $P4FACTORY/targets/switch/
make bm-switchsai
sudo ./behavioral-model

Finally, you can run the example tests: 最后可以跑个例子来测试

cd <ptf-dir>/example/
sudo ../ptf --test-dir mytests/ \
--pypath $P4FACTORY/targets/switch/tests/pd_thrift/
--interface 0@veth1 --interface 1@veth3 --interface 2@veth5 \
--interface 3@veth7 --interface 4@veth9 --interface 5@veth11 \
--interface 6@veth13 --interface 7@veth15 --interface 8@veth17

这里的指的是ptf的目录。

2016/11/27

PTF 安装及简单测试 Packet Testing Framework的更多相关文章

  1. kafka安装和简单测试

    kafka安装和简单测试 # 安装zookeeper(apache-zookeeper-3.5.6-bin)https://archive.apache.org/dist/zookeeper/zook ...

  2. NLTK的安装与简单测试

    1.NLTK简介 Natural Language Toolkit,自然语言处理工具包,在NLP领域中,最常使用的一个Python库.NLTK是一个开源的项目,包含:Python模块,数据集和教程,用 ...

  3. Redis、Redis+sentinel安装(Ubuntu 14.04下Redis安装及简单测试)

    Ubuntu下Redis安装两种安装方式: 1.apt-get方式 步骤: 以root权限登录,切换到/usr目录下. 接下来输入命令,apt-get install redis-server,如图: ...

  4. Avocado 安装和简单测试

    1.Avocado 安装 1.1 通过包安装 像Fedora可以通过rpm包进行安装,其他通过RPM管理的发行版需要自己制作相关包.Avocado同样支持DEP包的安装可以在contrib/packa ...

  5. scapy 安装及简单测试

    关于scapy Scapy的是一个强大的交互式数据包处理程序(使用python编写).它能够伪造或者解码大量的网络协议数据包,能够发送.捕捉.匹配请求和回复包等等.它可以很容易地处理一些典型操作,比如 ...

  6. Sqoop 安装与简单测试

    sqoop基于Hadoop与Hive Hadoop https://www.cnblogs.com/xibuhaohao/p/11772031.html Hive      https://www.c ...

  7. websphere8 从安装到部署 测试集群应用程序 安装j2ee程序(非常详细)

    目录1. 准备安装文件2. 安装Installation Manager3. 为Installation Manager指定安装资源库4. 创建部署管理器概要文件5. 创建定制概要文件并联合到部署管理 ...

  8. Docker安装canal、mysql进行简单测试与实现redis和mysql缓存一致性

    一.简介 canal [kə'næl],译意为水道/管道/沟渠,主要用途是基于 MySQL 数据库增量日志解析,提供增量数据订阅和消费. 早期阿里巴巴因为杭州和美国双机房部署,存在跨机房同步的业务需求 ...

  9. DbEntry.Net(Lephone Framework) Access ORM:安装和简单使用

    项目中用到Access数据库,之前用的普通Ado.Net 三层.遇到表字段叫多时,就比较费力.想要使用ORM,无奈EF不支持Access.虽然可以改写linq to sql为Linq to Acces ...

随机推荐

  1. 考前复习(codevs 2837)

    2837 考前复习  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 黄金 Gold 题解  查看运行结果     题目描述 Description Aiden马上要考试了,可他 ...

  2. NVelocity模板引擎的使用

    第一种使用方法直接赋值: VelocityEngine vltEngine = new VelocityEngine(); vltEngine.SetProperty(RuntimeConstants ...

  3. OracleDBConsoleorcl是具体管什么的服务(转)

    这个服务是oracle EM的就是oracle企业管理器这个工具可以通过网页的方式监控数据库,对数据库参数等做修改.里面还有oracle本身对于当前系统内存,SQL,参数等的建议.DBA可以根绝这些建 ...

  4. 怎么在手机上查看sqlite db

    在 从 百度应用 下载“SQLite编辑器(SQLite Editor)” 安装到手机上.前体是 手机已经Root(可以用360一键Root软件进行root).

  5. Kinect学习笔记(六)——深度数据测量技术及应用

    一.Kinect视角场 1.43°垂直方向和57°水平方向可视范围. 2.视角场常量值定义 属性 描述 Format 获取或设置深度图像格式 MaxDepth 获取最大深度值 MinDepth 获取最 ...

  6. Spotlight on MySQL监控MySQL服务器

    第一步: 下载并安装mysql-connector-3.5x Spotlight on MySQL 连接mysql必须使用mysql-connector-3.5x,5.3.2版本我试了下不行,有兴趣可 ...

  7. 参加 TiD 2015 是怎样一番体验?

    人生有很多第一次,(专程打飞的去帝都)参加软件大会,我也是第一次.   TiD   说到软件大会,QCon.PyCon 什么的早已如雷贯耳,没吃过猪肉还没见过猪跑?但对于 TiD,确实还是头一次听说. ...

  8. Xamarin环境搭建

    Xamarin的环境搭建 Xamarin在osx下面的环境搭建包括开发者帐号申请,下载安装Xamarin以及Xcode,以及Xamarin Studio上编写第一个应用程序.Xamarin是一个跨平台 ...

  9. Open Xml SDK 引文

    什么是Open Xml SDK? 什么是Open Xml? 首先,我们得知道,Open Xml为何物? 我们还是给她起个名字——就叫 “开放Xml”,以方便我们中文的阅读习惯.之所以起开放这个名字,因 ...

  10. BZOJ1807 : [Ioi2007]Pairs 彼此能听得见的动物对数

    一维的情况: 排序后维护一个单调指针即可,时间复杂度$O(n\log n)$. 二维的情况: 旋转坐标系后转化为二维数点问题,扫描线+树状数组维护即可,时间复杂度$O(n\log n)$. 三维的情况 ...