Github

Switch

Introduction

Structure:

    +-----+   +-----+   +-----+   +-----+
|App a| |App j| |App n| |App z|
| |...| |...| |...| |
+-----+ +-----+ +-----+ +-----+
| | | |
| | +----| |
+------------+ | |
| Switchlink | | |
| |<-----------------------------+
+------------------+ | |
| SAI | | |
| | | |
+-----------------------+ |
| Switch API | |
| | |
+-----------------------+---------+ |
| Resource Mgmt. API | |
| (auto-gen. from switch.p4) | | Netlink events
+---------------------------------+ |
| Soft Switch | |
| (compiled from switch.p4) | |
+---------------------------------+ |
|
|
+----------------------------------------------------------------+
| Kernel |
| |
+----------------------------------------------------------------+

Directory Sturcture:

p4src - P4 sources

switchsai - SAI library

switchapi - SwitchAPI

switchlink - Linux netlink listener

tests/ptf-tests - P4 dependent(PD), SAI and API tests

tests/of-tests - Openflow tests

Install

1.git clone bmv2、p4c-bm、p4ofagent、PTF and switch repositories.

bmv2:

> ./configure --with-pdfixed
> make
> make install

PTF:

> sudo python setup.py install

2.cd switch

> git submodule update --init --recursive

> ./autogen.sh
> ./configure --with-bmv2 --with-switchsai
> make

Run Tests

1.In terminal 1, start the software switch:

> sudo ./bmv2/run_bm.sh

2.In terminal 2, start the drivers:

> sudo ./bmv2/run_drivers.sh

3.In terminal 3, start tests.

> sudo ./bmv2/run_tests.sh

Tests Result

WARNING: No route found for IPv6 destination :: (no default route?)
switch.L2Test ... Cleaning state
Sending packet port 1 -> port 2 on vlan 10 (192.168.0.1 -> 10.0.0.1 [id = 101])
ok ----------------------------------------------------------------------
Ran 1 test in 1.509s OK
switch.L2FloodTest.runTest ... Cleaning state
ok ----------------------------------------------------------------------
Ran 1 test in 0.981s OK
switch.L3Ipv6Test ...
Cleaning state
Sending packet port 1 -> port 2 (10.10.10.1 -> 20.20.20.1 [id = 101])
ok ----------------------------------------------------------------------
Ran 1 test in 1.109s OK
switch.L2QinQTest ...
Cleaning state
Sending packet port 1 (QinQ) -> port 2 (Untagged)
Sending packet port 2 (Untagged) -> port 2 (QinQ)
ok ----------------------------------------------------------------------
Ran 1 test in 2.131s OK
switch.L2LearningTest ... Cleaning state
new mac learnt [0, 34, 34, 34, 34, 34] on port 1
ok ----------------------------------------------------------------------
Ran 1 test in 7.108s OK
switch.L3VxlanTunnelTest ...
Cleaning state
Sending packet port 1 -> port 2 - Vxlan tunnel encap
Inner packet (10.168.10.1 -> 10.168.11.1 [id = 101])
Outer packet (10.10.10.1 -> 10.10.10.2 [vnid = 0x1234, id = 101])
Sending packet port 2 -> port 1 - Vxlan tunnel decap
Inner packet (10.168.11.1 -> 10.168.10.1 [id = 101])
Outer packet (10.10.10.2 -> 10.10.10.1 [vnid = 0x1234, id = 101])
ok ----------------------------------------------------------------------
Ran 1 test in 2.166s OK
switch.L3Ipv4Test ...
Cleaning state
Sending packet port 1 -> port 2 (10.10.10.1 -> 20.20.20.1 [id = 101])
ok ----------------------------------------------------------------------
Ran 1 test in 1.133s OK
switch.L2VxlanTunnelTest ...
Cleaning state
Sending packet port 1 -> port 2 - Vxlan tunnel encap
Inner packet (192.168.10.1 -> 192.168.20.2 [id = 101])
Outer packet (10.10.10.1 -> 10.10.10.2 [vnid = 0x1234, id = 101])
Sending packet port 2 -> port 1 - Vxlan tunnel decap
Inner packet (192.168.10.2 -> 192.168.20.1 [id = 101])
Outer packet (10.10.10.2 -> 10.10.10.1 [vnid = 0x1234, id = 101])
ok ----------------------------------------------------------------------
Ran 1 test in 2.152s OK

2017/2/13

P4Lang Repository: Switch的更多相关文章

  1. Lind.DDD.UoW工作单元的实现

    回到目录 工作单元UoW我们几乎在任务一个像样的框架里都可以找到它的足迹,是的,对于大型系统来说,他是很重要的,保持数据一致性,维持事务状态这都是它要为系统实现的功能,而在不同的框架里,实现UoW的机 ...

  2. Git - Tutorial [Lars Vogel]

    From: http://www.vogella.com/tutorials/Git/article.html Git - Tutorial Lars Vogel Version 5.6 Copyri ...

  3. Git - Tutorial官方【转】

    转自:http://www.vogella.com/tutorials/Git/article.html#git_rename_branch Lars Vogel Version 5.8 Copyri ...

  4. 使用git对unity3d项目进行版本控制

    http://stackoverflow.com/questions/18225126/how-to-use-git-for-unity-source-control The following is ...

  5. 使用Xmanager通过XDMCP连接远程Centos 7 (摘自xmanager官方博客)

    Using Xmanager to connect to remote CentOS 7 via XDMCP Gnome in CentOS 7 tries to use local hardware ...

  6. run kubernetes

    use kubeadm in lab only,,, do not use it in production      install docker 1.12.6 -..   please noted ...

  7. Using Xmanager to connect to remote CentOS 7 via XDMCP

    Gnome in CentOS 7 tries to use local hardware acceleration and this becomes a problem when trying to ...

  8. p4lang/switch make bm-switchsai 出现内存不足导致的Error

    报错如下: Compiling : bm::dc.cpp g++: internal compiler error: Killed (program cc1plus) Please submit a ...

  9. Android stadio Switch repository Android stadio切换仓库

    Android stadio 有时候,有很多module. 这些module 都有自己的仓库.也就是不在一块.那么,Android stadio 默认管理的就是根git. 如图,画对号的就是默认的. ...

随机推荐

  1. [译]关于JavaScript 作用域你想知道的一切

    原文连接 在学习js的过程对闭包什么的,理解不好,偶然搜到这篇文章.豁然开朗,随翻译. Javacript 中有一系列作用域的概念.对于新的JS的开发人员无法理解这些概念,甚至一些经验丰富的开发者也未 ...

  2. python基础-第十篇-10.1HTML基础

    htyper text markup language 即超文本标记语言 超文本:就是指页面内可以包含图片.链接,甚至音乐,程序等非文字元素 标记语言:标记(标签)构成的语言 网页==HTML文档,由 ...

  3. 利用AES算法加密数据

    准备工作: 模块安装问题: 首先在python中安装Crypto这个包 但是在安装模块后在使用过程中他会报错 下面是解决方法: pip3 install pycrypto 安装会报错 https:// ...

  4. Error-The content of element type "web-app" must match "(icon?,display-

    错误描述 The content of element type "web-app" must match "(icon?,display- name?,descript ...

  5. Mybatis框架学习总结-表的关联查询

    一对一关联 创建表和数据:创建一张教师表和班级表,这里假设一个老师只负责教一个班,那么老师和班级之间的关系就是一种一对一的关系. CREATE TABLE teacher( t_id INT PRIM ...

  6. error: https://packages.elastic.co/GPG-KEY-elasticsearch: import read failed(2).

    安装filebeat报错: curl: (35) SSL connect errorerror: https://packages.elastic.co/GPG-KEY-elasticsearch: ...

  7. vim中快速定位到某行以及快捷删除多行

    vim filename 在命令行中直接输入 numberG 比如 100G直接定位到100行 输入 :set number即显示行号 : i,.d删除从第i行到目前所在行内容

  8. PKU 3687 Labeling Balls(拓扑排序)

    题目大意:原题链接 给出N个未编号的质量各不相同的球,以及它们质量轻重的大小关系,给它们从1-N贴标签编号,无重复.问是否存在可行的编号方法,不存在输出-1, 如果存在则输出唯一一种方案,此方案是使得 ...

  9. Restful概念

    文章节选自: http://www.ruanyifeng.com/blog/2011/09/restful https://www.zhihu.com/question/28557115/answer ...

  10. The 15th UESTC Programming Contest Preliminary J - Jermutat1on cdoj1567

    地址:http://acm.uestc.edu.cn/#/problem/show/1567 题目: Jermutat1on Time Limit: 3000/1000MS (Java/Others) ...