From bf763995fe99c310fb44b42dfa3d87cf66da0e02 Mon Sep 17 00:00:00 2001 From: eggqq007 <32856938+eggqq007@users.noreply.github.com> Date: Thu, 17 Oct 2019 16:27:23 +0800 Subject: [PATCH] Update Architecture.md [ci skip] Update pipeLine in Architecture.md --- Architecture.md | 108 ++++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 55 deletions(-) diff --git a/Architecture.md b/Architecture.md index 4b4ed8b..656a87b 100644 --- a/Architecture.md +++ b/Architecture.md @@ -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既有命令式编程能能力,同时也具备声明式编程能力。 @@ -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 | @@ -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主要功能场景有两块: