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. 与python的第一次邂逅

    python简介 一.什么是python python是一种面向对象.直译式的计算机程序语言,所以有了武老师的那句名言:一切皆为对象 python的设计哲学是:“优雅”,“明确”,“简单” pytho ...

  2. Sublime Text 配置成 C++ IDE

    在Windows中将Sublime Text配置成C++的IDE.首先,为了运行C++需要安装g++编译器,g++可直接在codeblocks中找到.codeblock的官网下载地址是http://w ...

  3. 使用python的logging模块(转)

    一.从一个使用场景开始 开发一个日志系统, 既要把日志输出到控制台, 还要写入日志文件 import logging # 创建一个logger logger = logging.getLogger(' ...

  4. Python 类型和对象(转)

    译文:http://wiki.woodpecker.org.cn/moin/PyTypesAndObjects 原文:http://www.cafepy.com/article/python_attr ...

  5. python 字符串的格式化

    python字符串的格式化分为两种:1)% 方式    2)str.format()  方式. str.format() 是比 % 较新的方式, 大多数的 Python 代码仍然使用 % 操作符.但最 ...

  6. python学习笔记(六)time、datetime、hashlib模块

    一.hashlib模块 python中的hashlib模块用来进行hash或者md5加密,而且这种加密是不可逆的,所以这种算法又被称为摘要算法.在python3的版本里,代替了md5和sha模块,主要 ...

  7. 记ambari启用kerberos添加kafka组件后yarn和hive出现Failure unspecified at GSS-API level (Mechanism level: Checksum failed)--403错误

    出现警告的过程是: 1.搭建ambari集群成功后,添加了hdfs和zk组件,然后启用了kerberos: 2.kerberos启用完毕后添加hbase和yarn.MapReduce.hive都没有出 ...

  8. 【基础算法】- 个人认为最快的 Fibonacci 程序

    public class Fibonacci { private static Map<Long,Long> map = new HashMap<Long,Long>(); s ...

  9. JQuery点击标题实现div的收缩

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  10. bootstrap常用知识点总结

    api地址:https://v3.bootcss.com/css/#forms 栅格参数: bootstrap 其实 是把 网页等 分为 了 12分,bootstrap把 根据屏 幕 大小 把屏 幕分 ...