Skip to content

Commit

Permalink
Update Architecture.md [ci skip]
Browse files Browse the repository at this point in the history
Update pipeLine in Architecture.md
  • Loading branch information
eggqq007 authored Oct 17, 2019
1 parent 2cc9aea commit bf76399
Showing 1 changed file with 53 additions and 55 deletions.
108 changes: 53 additions & 55 deletions Architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TupleNet的dataplane使用的是openvswitch(版本大于等于2.8.0)来实

## Implementation of control-plane

### python and pyDatalog
### Python and pyDatalog
TupleNet的绝大部分代码是python书写的,因为python灵活,易于排查问题的特点,非常适合开发控制平面,能快速迭代出新的网络功能。虽然control-plane使用解析性动态语言后性能不如编译型程序快,但是control-plane并不会影响datapath的效率,不会引入数据包的转发耗时。所以我们认为使用python 动态语言来实现control-plane是非常合适的。

在虚拟网络中,网络报文的行为需要实时根据目前的虚拟网络网络拓扑和物理网络拓扑来决定,而虚拟网络拓扑在实际使用中是易变的,且变化是频繁的。我们需要一种方便的工具能快速帮我们解析实时网络状态的迁移,因为这种状态的变更是完全stateless的,所以我们采用Datalog这种古老的语言帮助我们屏蔽网络拓扑变化带来的编程复杂性。PyDatalog是Datalog在python的一种实现,它语法形式类似Datalog。我们编写好地pyDatalog规则后输入网络拓扑数据就可以用pyDatalog 引擎动态计算出目前需要插入和删除的ovs-flow。pyDatalog是一个python lib库,可以有机地和python结合起来,使得python既有命令式编程能能力,同时也具备声明式编程能力。
Expand All @@ -70,62 +70,61 @@ TupleNet 没有使用ovs python库来直接和ovsdb来进行通信,也没有
为了灵活处理各种类型的数据报文,我们为virtualswitch,virtualrouter建立了相应的数据报文处理pipeline,所有数据报文都需要经过pipeline的处理。
```
PORT +--------------------------------------------------------------------------------------------------------------------------+
PORT +----------------------------------------------------------------------------------------------------------------------<---+
+ | |
| | +----------------------------------------------------+ |
| | | | |
+---------------v----------v----+ | | |
| LSP_TRACE_INGRESS_IN | PORT | +---------------v---------------+ +-------------------------------+
+-------------------------------+ ^ | | LRP_TRACE_INGRESS_IN | | LRP_TRACE_EGRESS_OUT |
| | | +-------------------------------+ +-------------------------------+
v | | | ^
| | v |
+-------------------------------+ +-------------------------------+ |
| LSP_INGRESS_ARP_CONTROLLER | | LSP_EGRESS_PUSHOUT | +-------------------------------+ +-------------------------------+
+-------------------------------+ +-------------------------------+ | LRP_INGRESS_PKT_RESPONSE | | LRP_EGRESS_FORWARD_PACKET |
| ^ +-------------------------------+ +-------------------------------+
v | | ^
| v |
+-------------------------------+ +-------------------------------+ |
| LSP_INGRESS_ARP_RESPONSE | | LSP_EGRESS_PUSHOUT | +-------------------------------+ +-------------------------------+
+-------------------------------+ +-------------------------------+ | LRP_INGRESS_DROP_UNEXPECT | | LRP_EGRESS_UPDATE_ETH_DST |
| ^ +-------------------------------+ +-------------------------------+
v | | ^
| v |
| | +---------------------------------------------------+ |
| | | | |
+---------------v----------v----+ | | |
| LSP_TRACE_INGRESS_IN | PORT | +---------------v---------------+ +-------------------------------+
+-------------------------------+ ^ | | LRP_TRACE_INGRESS_IN | | LRP_TRACE_EGRESS_OUT |
| | | +-------------------------------+ +-------------------------------+
v | | | ^
| | v |
+-------------------------------+ | | |
| LSP_INGRESS_ARP_CONTROLLER | | | +-------------------------------+ +-------------------------------+
+-------------------------------+ | | | LRP_INGRESS_PKT_RESPONSE | | LRP_EGRESS_FORWARD_PACKET |
| | | +-------------------------------+ +-------------------------------+
v | | | ^
| | v |
+-------------------------------+ +-------------------------------+ |
| LSP_INGRESS_LOOKUP_DST_PORT | | LSP_EGRESS_FORWARD_PACKET | +-------------------------------+ +-------------------------------+
+-------------------------------+ +-------------------------------+ | LRP_INGRESS_UNSNAT_STAGE1 | | LRP_EGRESS_SNAT_STAGE2 |
| ^ +-------------------------------+ +-------------------------------+
v | | ^
| v |
+-------------------------------+ +-------------------------------+ |
| LSP_INGRESS_OUTPUT_DST_PORT | | LSP_EGRESS_JUDGE_LOOPBACK | +-------------------------------+ +-------------------------------+
+-------------------------------+ +-------------------------------+ | LRP_INGRESS_UNSNAT_STAGE2 | | LRP_EGRESS_SNAT_STAGE1 |
| ^ +-------------------------------+ +-------------------------------+
v | | ^
| v |
+-------------------------------+ +-------------------------------+ |
| LSP_TRACE_INGRESS_OUT | | LSP_TRACE_EGRESS_IN | +-------------------------------+ +-------------------------------+
+-------------------------------+ +-------------------------------+ | LRP_INGRESS_DNAT_STAGE1 | | LRP_EGRESS_UNDNAT_STAGE2 |
| ^ +-------------------------------+ +-------------------------------+
| | | ^
| | v |
| | |
| | +-------------------------------+ +-------------------------------+
| | | LRP_INGRESS_DNAT_STAGE2 | | LRP_EGRESS_UNDNAT_STAGE1 |
+--------------------------------------------+ +-------------------------------+ +-------------------------------+
| ^
| LSP_INGRESS_ARP_RESPONSE | | LSP_PUSHOUT_PACKET | +-------------------------------+ +-------------------------------+
+-------------------------------+ +-------------------------------+ | LRP_INGRESS_DROP_UNEXPECT | |TABLE_LRP_EGRESS_HANDLE_UNK_PKT|
| ^ +-------------------------------+ +---------------^---------------+
v | | |
+-------------------------------+ | v |
| LSP_UNTUNNEL_DELIVER | +-------------------------------+ +-------------------------------+
+-------------------------------+ | LSP_EGRESS_FORWARD_PACKET | +-------------------------------+ | LRP_EGRESS_UPDATE_ETH_DST |
| +-------------------------------+ | LRP_INGRESS_UNSNAT_STAGE1 | +-------------------------------+
v ^ +-------------------------------+ ^
+-------------------------------+ | | |
| LSP_INGRESS_LOOKUP_DST_PORT | | v |
+-------------------------------+ +-------------------------------+ +-------------------------------+
| | LSP_EGRESS_JUDGE_LOOPBACK | +-------------------------------+ | LRP_EGRESS_SNAT_STAGE2 |
v +-------------------------------+ | LRP_INGRESS_UNSNAT_STAGE2 | +-------------------------------+
^ +-------------------------------+ ^
+-------------------------------+ | | |
| LSP_INGRESS_OUTPUT_DST_PORT | | v |
+-------------------------------+ +-------------------------------+ +-------------------------------+
| | LSP_TRACE_EGRESS_IN | +-------------------------------+ | LRP_EGRESS_SNAT_STAGE1 |
v +-------------------------------+ | LRP_INGRESS_DNAT_STAGE1 | +-------------------------------+
| ^ +-------------------------------+ ^
+-------------------------------+ | | |
| LSP_TRACE_INGRESS_OUT | | v |
+-------------------------------+ | +-------------------------------+
| | +-------------------------------+ | LRP_EGRESS_UNDNAT_STAGE2 |
| | | LRP_INGRESS_DNAT_STAGE2 | +-------------------------------+
+--------------------------------------------+ +-------------------------------+ ^
| |
v |
|
+-------------------------------+ +-------------------------------+
| LRP_INGRESS_IP_ROUTE | | LRP_TRACE_EGRESS_IN |
+-------------------------------+ +-------------------------------+
| ^
+-------------------------------+
+-------------------------------+ | LRP_EGRESS_UNDNAT_STAGE1 |
| LRP_INGRESS_IP_ROUTE | +-------------------------------+
+-------------------------------+ ^
| |
v |
|
+-------------------------------+ |
| LRP_INGRESS_ECMP | |
+-------------------------------+
+-------------------------------+ | LRP_TRACE_EGRESS_IN |
| LRP_INGRESS_ECMP | +-------------------------------+
+-------------------------------+ |
| |
v |
Expand All @@ -139,10 +138,9 @@ TupleNet 没有使用ovs python库来直接和ovsdb来进行通信,也没有
+------------------------------------+
```

### traffic redirecting
### Traffic redirecting
Traffic redirecting是TupleNet的一个重要特性。TupleNet默认启动时候会使用ondemand方式来生成ovs-flow,也就是说当TupleNet收到traffic中的第一个网络报文时候才会生成相应的ovs-flow。这样做的好处是能最大节约TupleNet所在机器的CPU,只计算真正需要的ovs-flow,但是这种方式同时也会带来traffic中首包被丢弃或产生严重延迟的问题。但是如果采用全量计算ovs-flow就会占用大量的CPU资源生成无用的ovs-flow,而且每次网络拓扑的微小变化都要通过pyDatalog来计算。为了解决这个问题,我们引入了redirecting功能。

Redirecting主要功能场景有两块:
Expand Down

0 comments on commit bf76399

Please sign in to comment.