2、 Network programming

Bachuan Xiaoxiaosheng 2022-06-23 18:32:43 阅读数:267


Network programming

In this section , We first define the concept of network programmability and related terms . Then the control plane programmability and data plane programming are discussed , The data plane programming model is described in detail , The advantages of data plane programming are pointed out .

A term is used to explain

We define programmability as the ability of software or hardware to execute externally defined processing algorithms . This capability transforms programmable entities from flexible ( Or configurable ) Separate from the entity ; The latter only allows you to change the different parameters of the internally defined algorithm , These parameters remain unchanged .

therefore , The term network programmability means the ability to define processing algorithms that are executed in a network , In particular, processing algorithms executed in a single processing node , Such as switch 、 Router 、 Load balancer, etc . It is generally assumed that no special processing occurs in the link connecting the network nodes . If necessary , This processing can be described as taking place on a node that is the endpoint of the link , Or by adding a with one input and one output “ Bumpy route ” node .

Traditionally , Algorithms executed by telecommunication devices are divided into three different classes : Data plane 、 Control plane and management plane . Among these three kinds of algorithms , The management plane algorithm has the least impact on the whole packet processing and network behavior . Besides , They have been programmable for decades , for example ,SNMPv1 stay 1988 Standardization in , Even before that . therefore , This section does not discuss the management plane algorithm further .

True network programmability means the ability to specify and change control plane and data plane algorithms . In practice , This means that network operators ( user ) Be able to define data and control plane algorithms by yourself , Without involving the original designer of the network equipment . For network equipment suppliers ( They usually design their own control plane ) Come on , Network programmability mainly means the ability to define data plane algorithms , There is no need to deal with application specific integrated circuits involving the selected package (ASIC) The original designer of .

Network programmability is a powerful concept , It allows network equipment suppliers and users to build networks that best suit their needs . Besides , They can be faster than ever 、 Cheaper , And it will not affect the performance and quality of the equipment .

For various technical reasons , Different layers are programmable at different points in time . The management plane is in 20 century 80 In the s, it realized programmability , The control plane is programmable until 21 The end of the century to 21 Only at the beginning of the century , Programmable switching asic until 21 Only at the end of the century

therefore , Although we are concerned about the programmability of the data plane , But we will start by discussing the programmability of the control plane and its most famous implementation ( It is called software defined network (SDN)) Start . This discussion will also give us a better understanding of the importance of data plane programmability .

Control plane programmability and SDN

Router 、 Traditional network devices such as switches have complex data plane and control plane algorithms . They are built in , Users usually cannot replace them . therefore , The function of the equipment is defined by its supplier , They are the only ones who can change it . In industry terms , Suppliers are often referred to as OEMs (OEMs).

Software Defined Network (SDN) This is the first attempt in history to make the device , In particular, their control planes are programmable . On the selected system , Device manufacturers allow users to bypass the built-in control plane algorithm , So that users can introduce their own control plane algorithm . These algorithms can directly provide the necessary forwarding information to the data plane , The data plane is still irreplaceable , And still under the control of the equipment supplier or the silicon supplier of their choice .

For various technical reasons , Decide to provide a that can be called remotely api, This is it. SDN The birth of . chart 2 It describes SDN Comparison with traditional network . Not only the control plane is programmable , And the algorithm of the whole network control plane can be realized in a centralized controller . In some important use cases , For example, the strictly controlled mass data center , These centralized 、 The whole network algorithm is proved to be better than the traditional algorithm designed for decentralized control of many autonomous networks ( Such as border gateway protocol (BGP)) It's simpler 、 More efficient .

 Insert picture description here

chart 2: Traditional networking and data plane with fixed functions SDN The difference between .

Efforts to standardize this approach have led to OpenFlow (of)[21] Development of . Hope once OF Standardized messaging API To control the data plane function ,SDN Applications will be able to take advantage of this API Provide functions to realize network control . There is a great deal of literature on of[13, 14, 15] and SDN[6, 7, 8, 9, 11, 10, 12] It is summarized .

However , Obviously ,OF Assume a specific data plane function , But no formal designation . and , As OF The specific data plane of the foundation cannot be changed . It is executed by OF The only one defined by the specification ( Although relatively flexible ) Algorithm .

In a way , It is this understanding that led to the development of modern data plane programming, which we will discuss in the next section .

Data plane programming

As mentioned earlier , Data plane programmability means that the data plane and its algorithm can be defined by the user , Whether it is a network operator or a device designer using packet processing ASIC . in fact , Data plane programmability has existed for most of the history of the network industry , Because data plane algorithms are usually used in general cpu Performed on . Only with the advent of high-speed links , More than the CPU Handling capacity of , And subsequent grouping processing ( In exchange for )asic The introduction of , Programmability of data plane ( Or lack of ) To become a problem .

The data plane algorithm is responsible for processing all data packets passing through the telecommunication system . therefore , They ultimately define the functionality of such systems 、 Performance and scalability . Any attempt to implement the data plane functionality in the control plane usually results in significant performance degradation . When data plane programming is provided to the user , Essentially changed the user's capabilities . They can build custom network devices , Without the need for performance 、 Scalability 、 Make any compromises in terms of speed or energy consumption .

For custom networks , New control planes and SDN Applications , Users can design the most suitable data plane algorithm for them . Data plane programming does not necessarily mean providing users with any api, It doesn't need to be like of That supports the external control plane . The equipment supplier may still decide to develop a proprietary control plane , And use data plane programming only for your own benefit , Without necessarily making their systems more open ( Although many do now open their systems ). chart 3 These two options are shown .

 Insert picture description here

chart 3: Data plane programmability may be used by suppliers for more efficient development , Or used by users to provide their own data and control plane algorithms .

come from [10,9,16,17] The four surveys outlined data plane programming , But there's no particular focus on P4.

Data plane programming model

Data plane algorithms can and often are represented in standard programming languages . However , They don't map well to specialized hardware , Such as high speed asic. therefore , Several data plane models are proposed as hardware abstractions . The data plane programming language is tailored to these data plane models , It also provides a method to express the algorithm in an abstract way . Then compile the generated code , To execute on a specific packet processing node that supports the respective data plane programming model .

Data flow graph abstraction and protocol independent switching architecture (PISA) Is an example of a data plane model . We give an overview of the first question , And the second question is deeply expounded , because PISA yes P4 Data plane programming model .

Data flow graph abstraction

In these data plane programming models , Packet processing is described by a directed graph . The nodes in the diagram represent simple 、 Reusable primitives , Can be applied to packets , for example , Packet header modification . The directed edge of a graph represents a packet traversal , Perform traversal decisions in nodes on a per package basis . chart 4 Shows IPv4 and IPv6 Example diagram of packet forwarding

 Insert picture description here

chart 4: Data flow graph abstraction :IPv4 and IPv6 Example of forwarding

Examples of programming languages that implement this data plane programming model are :click[1]、 Vector packet processor (VPP)[2] and BESS[22].

Protocol independent switching architecture (PISA)

chart 5 It describes PISA. It is based on the concept of a programmable matching operation pipeline , Well matched with modern switching hardware . It is a reconfigurable matching action table (RMTs)[23] And decomposable and reconfigurable matching action table (dRMTs)[24] Promotion of .

 Insert picture description here

chart 5: Protocol independent switch architecture (PISA).

PISA By a programmable parser 、 A programmable department and a programmable matching consisting of multiple stages - The action pipeline consists of

  • Programmable parsers allow programmers to declare arbitrary headers with finite state machines , The finite state machine defines the order of headers in packets . It converts the serialized packet header into a well formed form .

  • The programmable matching operation pipeline is composed of multiple matching operation units . Each unit includes one or more matching operation tables (MATs), Used to match packets and perform match specific operations using the provided operation data . The batch of packet processing algorithm is based on this MATs The formal definition of . Every MAT Including and memory ( Static random access memory (SRAM) Or ternary content addressable memory (TCAM)) Coupled matching logic , To store the search key and the corresponding operation data . Action logic , Such as arithmetic operation or header modification , It is composed of arithmetic logic unit (alu) Realized . Additional operational logic can be implemented using stateful objects , for example , Counter , Meter , Or register , These are stored in SRAM in . The control plane passes through the MATs To affect runtime behavior , To manage the matching logic .

  • In the programmable Department , Programmers declare how to serialize packets .

from PISA The packets processed by the pipeline are composed of packet payload and packet metadata .PISA Only the package metadata transmitted from the parser to the Department is processed , Instead of handling separately transmitted packet loads .

The message metadata is divided into message headers 、 User defined metadata and internal metadata .

  • The message header is the metadata corresponding to the network protocol header . They are usually extracted in the parser , Or in the department To send out , Or both .
  • Intrinsic metadata is metadata related to fixed functional components .p4 Programmable components can receive information from fixed functional components by reading the intrinsic metadata they generate , Or control their behavior by setting the intrinsic metadata they consume .
  • User defined metadata ( It is often called simple metadata ) It's a kind of temporary storage , Similar to local variables in other programming languages . It allows developers to add information to the package that can be used throughout the processing pipeline .

All the metadata , Whether Baotou 、 User defined metadata or intrinsic metadata , It's all temporary , This means that when the corresponding package leaves the processing pipeline , It will be discarded ( for example , Send or discard... From the exit port ).

PISA Provides an abstract model , You can create concrete buildings in various ways . for example , It allows you to specify pipelines that contain different combinations of programmable components , for example , A pipe without a parser or separator , A pipe with two parsers and separators , And the additional matching operation pipeline between them .PISA It also allows specialized components needed for advanced processing , for example , Hash / Check and calculate . except PISA Outside the programmable components of , Switch architectures usually also include configurable fixed functional components . for example , The entry to receive or send packets / Exit port block 、 Implement multicast or cloning / A package replication engine that mirrors packages , And responsible for packet buffering 、 Queued and scheduled traffic manager .

Fixed functional components through generation and / Or consume intrinsic metadata to communicate with programmable components . for example , The entry port block generates entry metadata that represents the entry port number that may be used in the matching operation unit . To output packets , The matching operation unit generates internal metadata representing the exit port number ; then , Traffic manager and / Or the exit port block uses this intrinsic metadata .

chart 6 A typical example based on PISA Switch architecture . It includes a programmable inlet and outlet piping and three fixed functional components : Entrance block 、 Outlet block 、 Package replication engine and traffic manager between inlet and outlet pipes .

 Insert picture description here

chart 6: Typically based on PISA Switch architecture .

P4[5] Is for description PISA The most extensive domain specific programming language for data plane algorithms . Its original idea and name was in 2013 year [25] To introduce the ,2014 year [5] Published as a research paper . since 2019 Since then ,P4 Language Alliance [26] Further development and standardization P4 Language , The alliance is the open network foundation (ONF) Part of .P4 The language alliance is managed by a Technical Steering Committee , There are five working groups (WGs).P414[27] Is the first standardized version of the language . The current specification is 2016 Introduced for the first time in P416[28].

Other for PISA Our data plane programming languages are FAST[29]、OpenState[30]、Domino[31]、FlowBlaze[32]、Protocol-Oblivious Forwarding[33] and NetKAT[34]. Besides ,Broadcom[3] and Xilinx[4] Provide vendor specific programmable data planes based on matching action tables .


The programmability of the data plane brings many benefits . Hereunder , We summarized the main benefits .

Data plane programming introduces sufficient flexibility for network packet processing , Algorithm 、 agreement 、 Features can be added by the user 、 Modify or delete . Besides , The programmable data plane can also be configured with a user-defined control plane API and SDN. To reduce complexity , The code may contain only the components required for a particular use case . Compared with multi-purpose equipment , This improves security and efficiency .

Combined with the appropriate hardware platform , Data plane programming allows network device designers and even users to experiment with new protocols and design unique applications ; Both no longer rely on specialized package processing ASIC vendors to implement custom algorithms . Compared with the long development cycle of new silicon-based solutions , The new algorithm can be programmed and deployed in a few days

Data plane programming is also beneficial to network device developers , Even if the same package is used to process ASIC , You can also easily create differentiated products . Besides , They can conserve their know-how , Not with ASIC Suppliers share details , And may disclose it to others who will use the same ASIC competitors .

up to now , Modern data plane programs and programming languages have not reached the level of portability achieved by general programming languages . However , Expressing the data plane algorithm in high-level language may make the telecommunication system significantly more independent of the target . Besides , Data plane programming does not require but encourages full transparency . If the source code is shared , Then all the definitions of protocols and behaviors can be viewed 、 Analysis and reasoning , In this way, the data plane program can benefit from community development and review . therefore , Users can choose cost-effective hardware , Very suitable for their purpose , And run their algorithms on it . This trend is caused by SDN Pushing , It is often called network decomposition .

版权声明:本文为[Bachuan Xiaoxiaosheng]所创,转载请带上原文链接,感谢。 https://javamana.com/2022/174/202206231737021562.html