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. 【转】Spring Boot 日志配置(超详细)

    更新日志: 20170810 更新通过 application.yml传递参数到 logback 中. [toc] 简书不支持目录,截图一张. image.png 默认日志 Logback: 默认情况 ...

  2. Python 面向对象进阶(二)

    1. 垃圾回收 小整数对象池 Python对小整数的定义是 [-5, 257),这些整数对象是提前建立好的; 在一个Python程序中,所有位于这个范围内的整数,使用的都是同一个对象; 单个字符共用对 ...

  3. Apache mahout 源码阅读笔记--协同过滤, PearsonCorrelationSimilarity

    协同过滤源码路径: ~/project/javaproject/mahout-0.9/core/src $tree main/java/org/apache/mahout/cf/taste/ -L 2 ...

  4. linux下的时间管理概述

    2017/6/21 时间这一概念在生活中至关重要,而在操作系统中也同样重要,其在系统中的功能绝不仅仅是给用户提供时间这么简单,内核的许多机制都依赖于时间子系统.但凡是要在某个精确的时间执行某个事件,必 ...

  5. Linux IPC之管道通信

    2017-04-07 管道通信在linux中使用较为频繁的进程通信机制.基于unix一切皆文件的传统,管道也是一种文件.所以可以使用一般的VFS接口对管道进行读写操作,如read.write.具体管道 ...

  6. WebRtc(网页即时通讯技术)知识点总结

    前言 WebRTC,名称源自网页实时通信(Web Real-Time Communication)的缩写,简而言之它是一个支持网页浏览器进行实时语音对话或视频对话的技术.并且还支持跨平台:window ...

  7. 详解C++中命名空间的意义和用法

    看过鸡啄米的C++编程入门系列教程的朋友,应该能注意到,在其中的很多实例中,都有这么一条语句:using namespace std;,即使用命名空间std,其作用就是规定该文件中使用的标准库函数都是 ...

  8. Jmeter(六)文件上传和下载文件

    一.Jmeter上传文件 编写脚本:               首先添加一个线程组,然后在线程组里面添加一个http请求,因为是发送数据,所有是post请求,写好上传的地址,然后写好文件路径     ...

  9. Android上传 apk格式文件下载

  10. SQL Server 2008数据库手动提交的设置

    有时候我们需要对SQL Server 2008数据库手动提交的方法进行设置,使用Oracle的朋友会注意到Oracle中的手工提交的,如果修改错了数据还可以Rollback.但在SQL Server ...