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. 转:java高并发学习记录-死锁,活锁,饥饿

    死锁 两个或两个以上的进程在执行过程中,因争夺资源而造成的一种互相等待的现象,若无外力作用,它们都将无法推进下去. 为什么会产生死锁: ① 因为系统资源不足. ② 进程运行推进的顺序不合适.    ③ ...

  2. python - 2 8 16进制/颜色/字符编码

    1.二进制 八进制 十六进制 二进制: bin() 0b10010八进制: oct() 0o10十进制: 1-100十六进制: hex() 0X53 BH 十进制转2, 8,16进制: >> ...

  3. 荣誉墙项目day28 django常用函数

    1.在网页上渲染字符串from django.http import HttpResponsereturn HttpResponse(u"hello world") 2.渲染网页f ...

  4. javafx 表格某一列设置未复选框

    1.表格要设置成可编辑.2.对列进行如下设置.列定义: @FXMLprivate TableColumn<Hole, Boolean> id_colCheck; 列设置id_colChec ...

  5. 目标检测-Faster R-CNN

    [目标检测]Faster RCNN算法详解 Ren, Shaoqing, et al. “Faster R-CNN: Towards real-time object detection with r ...

  6. layer插件的常用实例

    layer.msg(提示信息, {time:1000, icon:5, shift:6}, 回调方法); layer.alert(提示信息, function(index){ // 回调方法 laye ...

  7. .globl分析

    Uboot中常看到.globl .globl _start _start: b reset .align .globl _TEXT_BASE _TEXT_BASE: .globl _start  /* ...

  8. 理解java动态代理

    java动态代理是java语言的一项高级特性.在平时的项目开发中,可能很难遇到动态代理的案例.但是动态代理在很多框架中起着不可替代的作用,例如Spring的AOP.今天我们就聊一聊java动态代理的实 ...

  9. UVA10905: Children's Game(排序)

    题目:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=68990#problem/A 题目需求:,给n个数字,将它们重新排序得到一个最大的数 ...

  10. django 用户注册功能实现

    增加views的类 class RegisterView(View): def get(self, request): return render(request, 'register.html', ...