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. 11.事件驱动events

    事件驱动events ==> events.EventEmitter, EventEmitter 的核心就是事件发射与事件监听器功能的封装更详细的 API 文档参见 http://nodejs. ...

  2. Oracle下回滚rollback的使用

    oracle中可以设置一个回滚点进行回滚 设置回滚名称 savepoint pointa ; 进行回滚 rollback to pointa; 如果期间有删除的数据就回来了

  3. poj1722 SUBTRACT【线性DP】

    SUBTRACT Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2037   Accepted: 901   Special ...

  4. square-and-multiply algorithm

    https://en.wikipedia.org/wiki/Square-and-multiply_algorithm

  5. spring boot tomcat 线程数 修改初始线程数 统计性能 每百次请求耗时

    [root@f java]# tail -30 nohup.outsearchES-TimeMillisSpent:448P->1602@fT->http-nio-8080-exec-3t ...

  6. JSON_CONTAINS

    select * from tb    where info->'$.name' = '特价促销'  or JSON_CONTAINS(info->'$[*].name', '" ...

  7. HTTP cookies 详解(国外一位大牛的文章)

    原文:http://blog.csdn.net/lijing198997/article/details/9378047 HTTP cookies,通常又称作"cookies",已 ...

  8. HDU2426:Interesting Housing Problem(还没过,貌似入门题)

    #include <iostream> #include <queue> #include <stdio.h> #include <string.h> ...

  9. js判断浏览器的类型和获得浏览器的版本

    <!DOCTYPE html><html>    <head>        <meta charset="UTF-8">      ...

  10. html编码常见的有utf-8和gb2312编码等,应该如何判断选择?

    html如何选择编码,常见utf-8和gb2312编码如何判断选择 一.首先了解目前国内中文网页常用编码是utf-8 还是gb2313. 比如: 百度搜索 网页使用utf-8 腾讯新闻 网页使用utf ...