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. linux下php安装

    nginx中配置php:  http://www.111cn.net/sys/nginx/64044.htm

  2. navigater导航

    1.css的hover事件2.url事件(或者click事件),激活当前项3.第一导航与第二导航的移入移出事件(可以通过left,top值来显示,也可以变化宽度,高宽来显示)4.有二级导航的另外给cl ...

  3. java设计模式----外观模式(门面模式)

    外观模式主要应用场景在于为复杂的子系统提供一个简单的接口,提高子系统的独立性. 创建DrawerOne类: package facade; public class DrawerOne { publi ...

  4. 微信小程序 --- 设置app.js/page.js参数的方法

    设置 app.js 文件: //app.js App({ globalData: { is_login:false, userInfo:{} } }) 设置gloabalData的方法: // 定义a ...

  5. PHP新版本变化

    世界变化真快,突然听闻 PHP 都到 7.3 版本了,7.2 还没仔细了解过呢.看到我司面试时会问到php新版本有什么特性,美名其曰考察其学习新技术的能力,我有点汗颜,自己都没有主动去了解过,实在不应 ...

  6. C/C++ 开放库

    C/C++ 开放库 1.Best C/C++ Network Library 2.A list of open source C++ libraries

  7. java 获取当前进程id 线程id

    java  获取当前进程id  线程id RuntimeMXBean (Java Platform SE 8 ) https://docs.oracle.com/javase/8/docs/api/j ...

  8. HTML---初识HTML

    版权声明:本文为博主原创文章.不经博主同意注明链接就可以转载. https://blog.csdn.net/Senior_lee/article/details/33723573          H ...

  9. Linux内核之vmlinux与vmlinuz

    因为是初次系统的学习Linux内核,过程中遇到了一些常常出现的名词.似曾相识,但对他们的含义又不是非常清楚.因此,将搜索到的内容进行一下汇总. 1.vmlinux   vmlinux是一个包括linu ...

  10. Tdrag

    Tdrag属于拖拽类的一款插件,基于jquery而成,兼容1.4以上版本的jquery,兼容浏览器:chrome.firfox.IE7等以上主流浏览器 插件加载 <script type=&qu ...