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. JSP自定义标签开发入门《转》

    JSP自定义标签开发入门 一般情况下开发jsp自定义标签需要引用以下两个包 import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; ...

  2. Egret P2 ( 一) 掉落的小球

    实际效果(蛋疼这个gif制作软件,帧率太低....): 一 Egret和P2的坐标系 首先了解下P2和Egret的坐标系. 某人链接:http://blog.csdn.net/qilei2010/ar ...

  3. 【BZOJ3203】[Sdoi2013]保护出题人 二分+凸包

    [BZOJ3203][Sdoi2013]保护出题人 Description Input 第一行两个空格隔开的正整数n和d,分别表示关数和相邻僵尸间的距离.接下来n行每行两个空格隔开的正整数,第i + ...

  4. Eclipse常用快捷键 及 不格式化注释

    eclipse不格式化注释 - [自写] 2007-08-15   刚才在Eclipse3.2上写东西,我写好的注释,整整齐齐的,我一格式化代码,就变得七七八八的了.   试着在Perferences ...

  5. 【Android】eclipse打不开的解决办法和“Jar mismatch! Fix your dependencies”的解决

    JDK1.7能用,cmd下输入java,javac,java -version,javaw配置和环境都没问题的话,有可能是工作空间的问题,就是一般在D盘下的workspace..那个文件夹,删除了,再 ...

  6. log4net类库配置、WebService配置

    一.类库配置 结构如下图 1.LogUtility类 public class LogUtility { private static readonly log4net.ILog log = log4 ...

  7. javascript飞机大战-----004创建子弹对象

    /* 创建子弹:因为子弹不是只创建一个所以要用构造函数 注意一点:子弹发射的位置应该是英雄机的正中央的位置,所以需要传点东西进来 */ function Bullet(l,t){ this.l = l ...

  8. 利用Dockerfile构建一个基于CentOS 7镜像

    利用Dockerfile构建一个基于CentOS 7,包括java 8, tomcat 7,php ,mysql+mycat的镜像. Dockerfile内容如下: FROM centosMAINTA ...

  9. 使用Navicat连接Mysql报错:can not get hostname for your address

    以管理员的身份使用cmd命令运行netsh winsock reset即可!

  10. 301-React Ext-React创建组件的三种方式及其区别

    一.概述 React推出后,出于不同的原因先后出现三种定义react组件的方式,殊途同归:具体的三种方式: 函数式定义的无状态组件 es5原生方式React.createClass定义的组件 es6形 ...