repo:Github PI

P4Runtime - a control plane framework and tools for the P4 programming language

这个是P4社区目前正在开发的一个repo,根据它给的介绍,是一个控制平面的架构,提供了管理P4交换机的工具。接下来持续跟进它。

首先要安装相关依赖:

sudo apt-get install libjudy-dev libreadline-dev

git submodule update --init --recursive

配置:

./autogen.sh
./configure [--with-bmv2] [--with-proto]

如果安装了bmv2,加上--with-bmv2;如果要使用p4runtime.proto 则需要安装Google的protobuf。

使用bmv2参数配置信息如下:

Features recap ......................................
Compile for bmv2 ............................. : yes
simple_switch found ........................ : yes
Compile C++ frontend ......................... : no
Compile p4runtime.proto and associated fe .... : no
Compile internal RPC ......................... : yes
Compile PI C CLI ............................. : yes
make

make不报错则证明安装成功了。

实验

Terminal A:

simple_switch tests/testdata/simple_router.json

启动交换机;

Terminal B:

./CLI/pi_CLI_bmv2 -c tests/testdata/simple_router.json

启动CLI;

在CLI中可以对交换机进行相关配置:

PI CLI> assign_device 0 -- port=9090
Device assigned successfully.
Selecting device.
PI CLI> table_add ipv4_lpm 10.0.0.1/24 => set_nhop 10.0.0.1 1
Entry was successfully added with handle 0.
PI CLI> table_dump ipv4_lpm
Successfully retrieved 1 entrie(s).
==========
TABLE ENTRIES
**********
Dumping entry 0
Match key:
* ipv4.dstAddr : LPM 0a000001/24
Action entry: set_nhop - 0a000001, 0001
==========
Dumping default entry
EMPTY
==========
PI CLI> table_delete ipv4_lpm 0
Entry with handle 0 was successfully removed.
PI CLI>
PI CLI> help
commands description quit Exits CLI
help Print this message
add_p4 Add a P4 configuration and receive an ID for it, default config type is bmv2: add_p4 <path_to_config> [bmv2|native]*
assign_device Assign a specific device, if no device selected currently, it will select the newly device: assign_device <device_id> [p4_config_id] [-- [key=v;]*]
select_device Select a specific device by id, the device must have been assigned previously: select_device <device_id>
remove_device Remove a specific device: remove_device <device_id>
show_devices Show known devices, with available information: show_devices
update_device_start Update the P4 config on the selected device, update_device_start <p4_config_id> <device_data_path>
update_device_end End the P4 config update sequence on the selected device, update_device_start
table_add Add entry to a match table: table_add <table name> <match fields> [priority] => [<action name> <action parameters> | <indirect handle>]
table_delete Delete entry from a match table: table_delete <table name> <entry handle>
table_delete_wkey Delete entry from a match table using the match key: table_delete_wkey <table name> <match fields> [priority]
table_modify Modify entry in a match table: table_modify <table name> <entry_handle> => [<action name> <action parameters> | <indirect handle>]
table_modify_wkey Modify entry in a match table using the match key: table_modify_wkey <table name> <match fields> [priority] => [<action name> <action parameters> | <indirect handle>]
table_set_default Set default entry in a match table: table_set_default <table name> [<action name> <action parameters> | <indirect handle>]
table_dump Dump all entries in a match table: table_dump <table name>
act_prof_create_member Add a member to an action profile: act_prof_create_member <act_prof_name> <action_name> [action parameters]
act_prof_create_group Add group to an action profile: act_prof_create_group <act_prof_name> [grp_size = 120]
act_prof_add_member_to_group Add member to a group in an action profile: act_prof_add_member_to_group <act_prof_name> <mbr_h> <grp_h>
act_prof_dump Dump entries of action profile: act_prof_dump <act_prof_name>
counter_read Read value(s) from counter: counter_read <counter name> <index | entry handle>
counter_write Write value(s) to counter: counter_write <counter name> <index | entry handle> [packets=<N>] [bytes=<N>]
counter_reset Reset values for counter to 0: counter_reset <counter name> <index | entry handle>
meter_read_spec Read meter spec: meter_read_spec <meter name> <index | entry handle>
meter_set Set meter spec: meter_set <meter name> <index | entry handle> <rate_1>:<burst_1> <rate_2>:<burst_2>
direct_res_reset Remove direct resource configs which are kept ready for next table_add: direct_res_reset

2017.4.5

P4 PI库安装的更多相关文章

  1. 树莓派 Learning 002 装机后的必要操作 --- 05 给树莓派搭建“x86 + pi”环境 -- 安装**32位运行库** -- 解决`E:未发现软件包 xxx` 问题

    树莓派 装机后的必要操作 - 给树莓派搭建"x86 + pi"环境 – 安装32位运行库 – 解决E:未发现软件包 xxx 问题 我的树莓派型号:Raspberry Pi 2 Mo ...

  2. P4语言环境安装(一)前端编译器p4c、后端编译器p4c-bm2-ss

    这个P4安装环境是在2020-2-8安装的,安装环境卡了我好几天,把遇到的问题记录下来,有需要的同学可以参考一下,要是说错了或者有问题的话,评论或mail:guidoahead@163.com联系我都 ...

  3. protocol buffer c++ python库安装

    c++库安装较简单,不要用源码,还得下载依赖,就被墙了 https://github.com/google/protobuf/releases  下载一个最新的release安装 #protoc -- ...

  4. [转]Snappy压缩库安装和使用之一

    Snappy压缩库安装和使用之一 原文地址:http://blog.csdn.net/luo6620378xu/article/details/8521223 近日需要在毕业设计中引入一个压缩库,要求 ...

  5. phpize 扩展GD库 安装 ! 环境--centos 7 +nginx 1.7.11+php 5.6.7

    使用phpize编译GD库安装,先安装前置库libjpeg libpng zlib  freetype等 都是下面php编译的几个选项 先看php编译的选项: --with-gd=DIR       ...

  6. DCMTK3.6.1(MD支持库)安装说明

    转载:http://qimo601.iteye.com/blog/1685135 [前言] 最近,因为需要开发DICOM网管模块,必须使用DCMTK的DcmNet模块.但是DCMTK3.6.0在Dcm ...

  7. laravel项目拉取下来安装,node.js库安装

    1.拉取项目 2.切换分支 圈圈里面是版本 composer 安装laravel组件其他库 安装node.js安装包  npm set registry=https://registry.npm.ta ...

  8. python 库安装笔记

    python 库安装笔记 zoerywzhou@163.com http://www.cnblogs.com/swje/ 作者:Zhouwan 2017-2-22 友情提示 安装python库的过程中 ...

  9. python库安装(numpy+scipy+matplotlib+scikit_learn)

    python安装好后,库安装走了很多弯路,查了很多资料,终于安装成功,并且保存了该文章的地址,分享给大家 本人电脑windows 7,64位系统,安装的Python是3.5的,因此下载的库也是对应版本 ...

随机推荐

  1. python的三个函数(eval、exec、complie)和python版RMI

    一.python的三个函数: 1.eval函数: 之前已经讲过了这个函数,该函数也类似于php的eval,例如下边这个例子 eval("os.system('id')") 但是有个 ...

  2. URL上的中文编码

    参考:http://www.chinaz.com/web/2013/0226/293639.shtml 一 URL上拼接中文会进行编码 在URL上拼接中文时,比如www.abc.com?season= ...

  3. [Window] .MUS 0x80070422 Error

    Window Update 服务没有开启.开启后可以执行如下命令: for /f %%i in ('dir D:\Hotfix\*.msu /S /B /ON') do wusa.exe %%i /q ...

  4. c++Template 的辨析

    1.在c++Template中很多地方都用到了typename与class这两个关键字,而且好像可以替换,是不是这两个关键字完全一样呢? 答:class用于定义类,在模板引入c++后,最初定义模板的方 ...

  5. 02Del.ashx(删除班级)

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using WebHelper ...

  6. 在唯一密钥属性“fileExtension”设置为“.log”时,无法添加类型为“mimeMap”的重复集合项

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAkoAAAFfCAIAAAA+snR7AAAgAElEQVR4nOzdZ1xT18PAcf+1VpZaW6

  7. 沈阳网络赛I-Lattice's basics in digital electronics【模拟】

    42.93% 1000ms 131072K LATTICE is learning Digital Electronic Technology. He is talented, so he under ...

  8. Java web项目配置相关

    引申 XML 命名空间(XML Namespaces) XML Schema 教程 XSD(XML Schema Definition) XML Schema 语言也称作 XML Schema 定义. ...

  9. PL/SQL编程基础(三):数据类型划分

    数据类型划分 在Oracle之中所提供的数据类型,一共分为四类: 标量类型(SCALAR,或称基本数据类型) 用于保存单个值,例如:字符串.数字.日期.布尔: 标量类型只是作为单一类型的数据存在,有的 ...

  10. Python高级编程技巧(转)

    译文:http://blog.jobbole.com/61171/ 本文展示一些高级的Python设计结构和它们的使用方法.在日常工作中,你可以根据需要选择合适的数据结构,例如对快速查找性的要求.对数 ...