CN114827018A - SDN routing method and device based on service classes and electronic equipment - Google Patents

SDN routing method and device based on service classes and electronic equipment Download PDF

Info

Publication number
CN114827018A
CN114827018A CN202110118171.4A CN202110118171A CN114827018A CN 114827018 A CN114827018 A CN 114827018A CN 202110118171 A CN202110118171 A CN 202110118171A CN 114827018 A CN114827018 A CN 114827018A
Authority
CN
China
Prior art keywords
forwarded
data packet
link
packet
source address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110118171.4A
Other languages
Chinese (zh)
Other versions
CN114827018B (en
Inventor
郑世慧
李保星
谷利泽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing University of Posts and Telecommunications
Original Assignee
Beijing University of Posts and Telecommunications
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing University of Posts and Telecommunications filed Critical Beijing University of Posts and Telecommunications
Priority to CN202110118171.4A priority Critical patent/CN114827018B/en
Publication of CN114827018A publication Critical patent/CN114827018A/en
Application granted granted Critical
Publication of CN114827018B publication Critical patent/CN114827018B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/302Route determination based on requested QoS
    • H04L45/306Route determination based on the nature of the carried application
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/12Shortest path evaluation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/30Routing of multiclass traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention provides a service class-based SDN routing method, a service class-based SDN routing device and electronic equipment, wherein the method comprises the following steps: determining a source address and a target address of the data packet to be forwarded and a service type corresponding to the data packet to be forwarded according to the received data packet to be forwarded; determining the link weight when selecting a routing path for forwarding the data packet to be forwarded according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight; the shortest routing path from the source address to the destination address is selected based on the link weights. Therefore, routing path selection can be performed by selecting different link weights according to different services.

Description

一种基于服务类别的SDN路由选择方法、装置及电子设备A service class-based SDN routing method, device and electronic device

技术领域technical field

本发明涉及通信技术领域,特别是涉及一种基于服务类别的SDN(SoftwareDefined Network,软件定义网络)路由选择方法、装置及电子设备。The present invention relates to the field of communication technologies, and in particular, to a service class-based SDN (Software Defined Network, software defined network) routing method, device and electronic device.

背景技术Background technique

SDN(Software Define Networking)是网络虚拟化的一种实现方式。其核心技术OpenFlow通过将网络设备的控制面与数据面分离开来,从而实现了网络流量的灵活控制,使网络作为管道变得更加智能,为核心网络及应用的创新提供了良好的平台。SDN通过解耦网络交换节点的控制层面和数据层面,将转发功能保留在交换节点,将控制功能分离并集中到一个控制器,控制器集中管理网络状态,将路由决策下发给交换节点,由交换节点根据路由决策进行数据包的转发。由于SDN具有较多的优点,因此,已经广泛的应用于不同的业务中,例如,视频会议、通话、文件传输等业务中。SDN (Software Define Networking) is an implementation of network virtualization. Its core technology, OpenFlow, separates the control plane and data plane of network devices, thereby realizing flexible control of network traffic, making the network more intelligent as a pipeline, and providing a good platform for the innovation of core networks and applications. SDN decouples the control plane and data plane of the network switching node, keeps the forwarding function in the switching node, separates and centralizes the control function to a controller, and the controller centrally manages the network state, and issues routing decisions to the switching node, which is controlled by The switching node forwards the data packet according to the routing decision. Because SDN has many advantages, it has been widely used in different services, such as video conference, call, file transfer and other services.

为了保证SDN中的服务质量,现有技术中通常会将影响服务质量的各个因素(例如,时延和丢包率)综合起来作为一个整体,然后基于这个整体进行路由选择以便基于选择的路由路径进行数据包传输。In order to ensure the quality of service in SDN, various factors that affect the quality of service (for example, delay and packet loss rate) are usually integrated as a whole in the prior art, and then route selection is performed based on this whole, so that the selected routing path is based on Carry out packet transmission.

然而不同业务的服务质量的侧重点不同,比如视频会议或者通话业务往往需要更低的传输时间,而文件传输等业务对传输时间关心程度较低,但更关心数据包从发送端到接收端的丢包率。因此,如何根据不同的业务选择不同的链路权重来进行路由路径以保证服务质量选择成为需要解决的问题。However, the focus of service quality of different services is different. For example, video conferencing or call services often require lower transmission time, while services such as file transmission are less concerned about transmission time, but are more concerned about the loss of data packets from the sender to the receiver. package rate. Therefore, how to select different link weights according to different services to perform routing paths to ensure service quality selection becomes a problem that needs to be solved.

发明内容SUMMARY OF THE INVENTION

本发明实施例的目的在于提供一种基于服务类别的SDN路由选择方法、装置及电子设备,以实现根据不同的业务选择不同的链路权重来进行路由路径选择。具体技术方案如下:The purpose of the embodiments of the present invention is to provide a service class-based SDN routing method, device and electronic device, so as to realize routing path selection by selecting different link weights according to different services. The specific technical solutions are as follows:

第一方面,本发明实施例提供了一种基于服务类别的SDN路由选择方法,该方法包括:In a first aspect, an embodiment of the present invention provides a service class-based SDN routing method, the method includes:

根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;Determine the source address and destination address of the data packet to be forwarded and the service category corresponding to the data packet to be forwarded according to the received data packet to be forwarded;

根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,其中,链路权重至少包括:时延和/或丢包率;According to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, the link weight when selecting the routing path for forwarding the data packet to be forwarded is determined, wherein the link weight at least includes: delay and/or packet loss rate;

根据链路权重,选择从源地址至目标地址之间的最短路由路径。Based on the link weight, select the shortest routing path from the source address to the destination address.

可选的,根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别,包括:Optionally, according to the received data packet to be forwarded, determine the source address and destination address of the data packet to be forwarded and the service category corresponding to the data packet to be forwarded, including:

对接收到的待转发数据包进行解析,获取待转发数据包中的源地址和目标地址;Parse the received data packet to be forwarded, and obtain the source address and destination address in the data packet to be forwarded;

判断待转发数据包的字节长度是否大于预设字节长度阈值;Determine whether the byte length of the data packet to be forwarded is greater than the preset byte length threshold;

如果是,获取待转发数据包的特征信息,并基于特征信息和预先建立的特征库,确定待转发数据包所采用的协议,其中,预先建立的特征库包括特征信息以及采用的协议的对应关系;If yes, obtain the feature information of the data packet to be forwarded, and determine the protocol adopted by the data packet to be forwarded based on the feature information and a pre-established feature library, wherein the pre-established feature library includes the feature information and the corresponding relationship of the adopted protocol ;

基于待转发数据包所采用的协议,确定待转发数据包所对应的服务类别。Based on the protocol adopted by the data packet to be forwarded, the service class corresponding to the data packet to be forwarded is determined.

可选的,该方法还包括:Optionally, the method further includes:

在基于特征信息和预先建立的特征库,未确定出待转发数据包所采用的协议时,获取接收待转发数据包的端口,并基于预先建立的应用层协议与传输层端口映射关系表,确定待转发数据包所采用的协议。When the protocol adopted by the data packet to be forwarded is not determined based on the feature information and the pre-established signature database, the port for receiving the data packet to be forwarded is obtained, and based on the pre-established application layer protocol and transport layer port mapping table, determine The protocol used by the packets to be forwarded.

可选的,当链路权重为丢包率时,根据链路权重,选择从源地址至目标地址之间的最短路由路径,包括:Optionally, when the link weight is the packet loss rate, the shortest routing path from the source address to the destination address is selected according to the link weight, including:

获取任一链路上的两个交换设备分别统计的发送历史数据包的数量Tx和接收历史数据包的数量Rx,通过以下公式:Obtain the number T x of historical data packets sent and the number R x of historical data packets received by the two switching devices on any link, respectively, through the following formula:

Li=1-Rx/Tx L i =1-R x /T x

计算该链路的丢包率;Calculate the packet loss rate of the link;

根据每个链路的丢包率,选择从源地址至目标地址之间的最短路由路径。According to the packet loss rate of each link, the shortest routing path from the source address to the destination address is selected.

可选的,当链路权重为丢包率时,根据链路权重,选择从源地址至目标地址之间的最短路由路径,包括:Optionally, when the link weight is the packet loss rate, the shortest routing path from the source address to the destination address is selected according to the link weight, including:

获取任一链路上记录的历史丢包率,通过以下公式:Obtain the historical packet loss rate recorded on any link using the following formula:

Figure BDA0002921507440000031
Figure BDA0002921507440000031

计算历史丢包率的平均值,并将历史丢包率的平均值作为该链路的丢包率Li,其中,L'i,k为第i条链路的第k个历史丢包率,N为历史丢包率的总数;Calculate the average value of the historical packet loss rate, and use the average value of the historical packet loss rate as the packet loss rate L i of the link, where L' i,k is the kth historical packet loss rate of the ith link , N is the total number of historical packet loss rates;

根据每个链路的丢包率,选择从源地址至目标地址之间的最短路由路径。According to the packet loss rate of each link, the shortest routing path from the source address to the destination address is selected.

可选的,根据每个链路的丢包率,选择从源地址至目标地址之间的最短路由路径,包括:Optionally, according to the packet loss rate of each link, select the shortest routing path from the source address to the destination address, including:

采用如下公式:Use the following formula:

Figure BDA0002921507440000032
Figure BDA0002921507440000032

对每个链路的丢包率Li进行预处理,得到每条链路预处理后的丢包率L'iThe packet loss rate Li of each link is preprocessed to obtain the preprocessed packet loss rate L' i of each link;

根据每个链路预处理后的丢包率,选择从源地址至目标地址之间的最短路由路径。According to the preprocessed packet loss rate of each link, the shortest route from the source address to the destination address is selected.

可选的,根据链路权重,选择从源地址至目标地址之间的最短路由路径,包括:Optionally, according to the link weight, select the shortest routing path from the source address to the destination address, including:

根据链路权重和Yen’s算法,确定从源地址至目标地址之间的K条最短路由路径;According to the link weight and Yen's algorithm, determine the K shortest routing paths from the source address to the destination address;

获取多个链路权重,并根据待转发数据包对应的服务类别,确定多个链路权重的排序;Obtain multiple link weights, and determine the order of multiple link weights according to the service category corresponding to the data packet to be forwarded;

基于K条最短路由路径和多个链路权重的排序,采用字典序排序算法对K条最短路由路径进行排序,得到排序后的K条最短路由路径;Based on the sorting of the K shortest routing paths and multiple link weights, the lexicographic sorting algorithm is used to sort the K shortest routing paths, and the sorted K shortest routing paths are obtained;

将排序后的K条最短路由路径中的第一条路由路径作为从源地址至目标地址之间的最短路由路径。The first routing path in the sorted K shortest routing paths is taken as the shortest routing path from the source address to the destination address.

第二方面,本发明实施例还提供了一种基于服务类别的SDN路由选择装置,该装置包括:In a second aspect, an embodiment of the present invention further provides a service class-based SDN routing device, the device comprising:

服务类别确定模块,用于根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;The service category determination module is used to determine the source address and destination address of the to-be-forwarded data packet and the service category corresponding to the to-be-forwarded data packet according to the received to-be-forwarded data packet;

链路权重确定模块,用于根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,其中,链路权重至少包括:时延和/或丢包率;The link weight determination module is configured to determine the link weight when selecting the routing path for forwarding the data packet to be forwarded according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, wherein , the link weight includes at least: delay and/or packet loss rate;

选择模块,用于根据链路权重,选择从源地址至目标地址之间的最短路由路径。The selection module is used to select the shortest routing path from the source address to the destination address according to the link weight.

可选的,服务类别确定模块,包括:Optional, service category determination module, including:

解析子模块,用于对接收到的待转发数据包进行解析,获取待转发数据包中的源地址和目标地址;The parsing submodule is used to parse the received data packet to be forwarded, and obtain the source address and destination address in the to-be-forwarded data packet;

判断子模块,用于判断待转发数据包的字节长度是否大于预设字节长度阈值;如果是,触发服务类别确定子模块,The judgment submodule is used to judge whether the byte length of the data packet to be forwarded is greater than the preset byte length threshold; if so, trigger the service category determination submodule,

服务类别确定子模块,用于获取待转发数据包的特征信息,并基于特征信息和预先建立的特征库,确定待转发数据包所采用的协议,基于待转发数据包所采用的协议,确定待转发数据包所对应的服务类别,其中,预先建立的特征库包括特征信息以及采用的协议的对应关系。The service category determination sub-module is used to obtain the characteristic information of the data packet to be forwarded, and based on the characteristic information and the pre-established characteristic database, determine the protocol adopted by the data packet to be forwarded, and determine the protocol adopted by the data packet to be forwarded based on the protocol adopted by the data packet to be forwarded. Forwarding the service category corresponding to the data packet, wherein the pre-established feature library includes feature information and the correspondence relationship of the adopted protocol.

可选的,服务类别确定子模块,还用于:Optionally, the service class determination submodule is also used to:

在基于特征信息和预先建立的特征库,未确定出待转发数据包所采用的协议时,获取接收待转发数据包的端口,并基于预先建立的应用层协议与传输层端口映射关系表,确定待转发数据包所采用的协议。When the protocol adopted by the data packet to be forwarded is not determined based on the feature information and the pre-established signature database, the port for receiving the data packet to be forwarded is obtained, and based on the pre-established application layer protocol and transport layer port mapping table, determine The protocol used by the packets to be forwarded.

可选的,当链路权重为丢包率时,选择模块,具体用于:Optionally, when the link weight is the packet loss rate, select the module, which is specifically used for:

获取任一链路上的两个交换设备分别统计的发送历史数据包的数量Tx和接收历史数据包的数量Rx,通过以下公式:Obtain the number T x of historical data packets sent and the number R x of historical data packets received by the two switching devices on any link, respectively, through the following formula:

Li=1-Rx/Tx Li = 1 - Rx /Tx

计算该链路的丢包率;Calculate the packet loss rate of the link;

根据每个链路的丢包率,选择从源地址至目标地址之间的最短路由路径。According to the packet loss rate of each link, the shortest routing path from the source address to the destination address is selected.

可选的,当链路权重为丢包率时,选择模块,具体用于:Optionally, when the link weight is the packet loss rate, select the module, which is specifically used for:

获取任一链路上记录的历史丢包率,通过以下公式:Obtain the historical packet loss rate recorded on any link using the following formula:

Figure BDA0002921507440000051
Figure BDA0002921507440000051

计算历史丢包率的平均值,并将历史丢包率的平均值作为该链路的丢包率Li,其中,L'i,k为第i条链路的第k个历史丢包率,N为历史丢包率的总数;Calculate the average value of the historical packet loss rate, and use the average value of the historical packet loss rate as the packet loss rate L i of the link, where L' i,k is the kth historical packet loss rate of the ith link , N is the total number of historical packet loss rates;

根据每个链路的丢包率,选择从源地址至目标地址之间的最短路由路径。According to the packet loss rate of each link, the shortest routing path from the source address to the destination address is selected.

可选的,选择模块,具体用于:Optionally, select modules, specifically for:

采用如下公式:Use the following formula:

Figure BDA0002921507440000052
Figure BDA0002921507440000052

对每个链路的丢包率Li进行预处理,得到每条链路预处理后的丢包率L'i;根据每个链路预处理后的丢包率,选择从源地址至目标地址之间的最短路由路径。Perform preprocessing on the packet loss rate Li of each link to obtain the preprocessed packet loss rate L' i of each link; according to the preprocessed packet loss rate of each link, select from the source address to the destination The shortest routing path between addresses.

可选的,选择模块,包括:Optionally, select modules, including:

K条路径确定子模块,用于根据链路权重和Yen’s算法,确定从源地址至目标地址之间的K条最短路由路径;The K path determination sub-module is used to determine the K shortest routing paths from the source address to the destination address according to the link weight and Yen's algorithm;

链路权重排序子模块,用于获取多个链路权重,并根据待转发数据包对应的服务类别,确定多个链路权重的排序;The link weight sorting sub-module is used to obtain multiple link weights, and determine the sorting of multiple link weights according to the service category corresponding to the data packet to be forwarded;

路由路径排序子模块,用于基于K条最短路由路径和多个链路权重的排序,采用字典序排序算法对K条最短路由路径进行排序,得到排序后的K条最短路由路径;The routing path sorting sub-module is used to sort the K shortest routing paths based on the K shortest routing paths and the weights of multiple links, using the lexicographic sorting algorithm to sort the K shortest routing paths, and obtain the sorted K shortest routing paths;

最短路由路径确定子模块,用于将排序后的K条最短路由路径中的第一条路由路径作为从源地址至目标地址之间的最短路由路径。The shortest routing path determination sub-module is configured to use the first routing path in the sorted K shortest routing paths as the shortest routing path from the source address to the target address.

第三方面,本发明实施例还提供了一种电子设备,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;In a third aspect, an embodiment of the present invention also provides an electronic device, characterized in that it includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

存储器,用于存放计算机程序;memory for storing computer programs;

处理器,用于执行存储器上所存放的程序时,实现上述任一所述的基于服务类别的SDN路由选择方法。The processor is configured to implement any of the above-mentioned service class-based SDN routing methods when executing the program stored in the memory.

第四方面,本发明实施例还提供了一种计算机可读存储介质,计算机可读存储介质内存储有计算机程序,计算机程序被处理器执行时实现上述任一所述的基于服务类别的SDN路由选择方法。In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any one of the above-mentioned service class-based SDN routing is implemented Method of choosing.

第五方面,本发明实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述任一所述的基于服务类别的SDN路由选择方法。In a fifth aspect, an embodiment of the present invention further provides a computer program product containing instructions, which, when executed on a computer, cause the computer to execute any of the above-described service class-based SDN routing methods.

本发明实施例有益效果:Beneficial effects of the embodiment of the present invention:

本发明实施例提供的一种基于服务类别的SDN路由选择方法、装置及电子设备,可以在接收到待转发数据时,先根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;然后可以根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,最后根据链路权重,选择从源地址至目标地址之间的最短路由路径。从而可以实现根据不同的业务选择不同的链路权重来进行路由路径选择。当然,实施本发明的任一产品或方法并不一定需要同时达到以上所述的所有优点。A service class-based SDN routing method, device, and electronic device provided by the embodiments of the present invention can, when receiving data to be forwarded, first determine the source address and the source address of the data packet to be forwarded according to the received data packet to be forwarded. The destination address and the service class corresponding to the data packet to be forwarded; then, according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, it is determined when the routing path for forwarding the data packet to be forwarded is selected. Finally, according to the link weight, the shortest routing path from the source address to the destination address is selected. Therefore, it is possible to select different link weights according to different services to perform routing path selection. Of course, it is not necessary for any product or method of the present invention to achieve all of the advantages described above at the same time.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的实施例。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those of ordinary skill in the art, other embodiments can also be obtained according to these drawings without creative efforts.

图1为本发明实施例的一种基于服务类别的SDN路由选择方法第一种实施方式的流程图;1 is a flowchart of a first implementation manner of a service class-based SDN routing method according to an embodiment of the present invention;

图2为本发明实施例的一种基于服务类别的SDN路由选择方法第二种实施方式的流程图;2 is a flowchart of a second implementation manner of a service class-based SDN routing method according to an embodiment of the present invention;

图3为本发明实施例的一种基于服务类别的SDN路由选择方法第三种实施方式的流程图;3 is a flowchart of a third implementation manner of a service class-based SDN routing method according to an embodiment of the present invention;

图4为本发明实施例的一种基于服务类别的SDN路由选择装置的结构示意图;FIG. 4 is a schematic structural diagram of a service class-based SDN routing device according to an embodiment of the present invention;

图5为本发明实施例的一种电子设备的结构示意图。FIG. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

为了解决现有技术存在的问题,本发明实施例提供了一种基于服务类别的SDN路由选择方法、装置及电子设备,以实现根据不同的业务选择不同的链路权重来进行路由路径选择。In order to solve the problems existing in the prior art, embodiments of the present invention provide a service class-based SDN routing method, device, and electronic device, so as to select different link weights according to different services to perform routing path selection.

下面,首先对本发明实施例的一种基于服务类别的SDN路由选择方法进行介绍,如图1所示,为本发明实施例的一种基于服务类别的SDN路由选择方法第一种实施方式的流程图,该方法可以包括:In the following, a service class-based SDN routing method according to an embodiment of the present invention is first introduced. As shown in FIG. 1 , it is a flow of the first implementation manner of a service class-based SDN routing method according to an embodiment of the present invention. Figure, the method may include:

S110,根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;S110, according to the received data packet to be forwarded, determine the source address and destination address of the data packet to be forwarded and the service category corresponding to the data packet to be forwarded;

在一些示例中,在SDN中,通常是由控制器向网络拓扑中的各个交换节点下发流表,然后由各个交换节点根据下发的流表中的流表项对接收到的数据包进行转发。因此,当该网络拓扑接收到数据包后,可以将接收到的数据包作为待转发数据包。In some examples, in SDN, the controller usually issues a flow table to each switching node in the network topology, and then each switching node performs processing on the received data packets according to the flow table entries in the delivered flow table. Forward. Therefore, after the network topology receives the data packet, the received data packet can be regarded as the data packet to be forwarded.

在又一些示例中,该待转发数据包可能是视频会议业务的数据包,也可能是通话业务的数据包,还可能是文件传输业务的数据包,而由于不同的业务有不同的服务质量要求,因此,需要针对不同的业务,选择不同的路由路径。In still other examples, the data packet to be forwarded may be a data packet of a video conference service, a data packet of a call service, or a data packet of a file transfer service, since different services have different QoS requirements , therefore, different routing paths need to be selected for different services.

对此,在接收到待转发数据包后,可以先根据接收到的待转发数据包,确定该待转发数据包对应的服务类别,以及该待转发数据包的源地址和目标地址。In this regard, after receiving the data packet to be forwarded, the service category corresponding to the data packet to be forwarded, and the source address and destination address of the data packet to be forwarded may be determined according to the received data packet to be forwarded.

S120,根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,其中,链路权重至少包括:时延和/或丢包率;S120: Determine a link weight when selecting a routing path for forwarding the data packet to be forwarded according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, where the link weight at least includes : delay and/or packet loss rate;

S130,根据链路权重,选择从源地址至目标地址之间的最短路由路径。S130, according to the link weight, select the shortest routing path from the source address to the destination address.

在一些示例中,在确定出待转发数据包对应的服务类别后,为了确定出从源地址至目标地址之间的最短路径,可以根据待转发数据包对应的服务类别,以及预先建立的服务类别与链路权重之间的对应关系,来确定选择转发该待转发数据包的路由路径时的链路权重,然后根据选择的链路权重,选择从源地址至目标地址之间的最短路由路径。In some examples, after the service class corresponding to the data packet to be forwarded is determined, in order to determine the shortest path from the source address to the destination address, the service class corresponding to the data packet to be forwarded and the pre-established service class can be determined The corresponding relationship between the link weight and the link weight is used to determine the link weight when selecting the routing path for forwarding the data packet to be forwarded, and then according to the selected link weight, the shortest routing path from the source address to the destination address is selected.

在一些示例中,每个服务类别可以对应多个链路权重,该多个链路权重可以具有不同的优先级,例如,视频、通话、实时交互类业务,对应的链路权重为时延和丢包率,而此类业务所对应的链路权重中,时延的优先级大于丢包率的优先级。又例如,Web浏览、交易数据、文件传输等业务,对应的链路权重也可以为时延和丢包率,而此类业务所对应的链路权重中丢包率的优先级大于时延的优先级。In some examples, each service class may correspond to multiple link weights, and the multiple link weights may have different priorities. For example, for video, call, and real-time interactive services, the corresponding link weights are delay and The packet loss rate, and among the link weights corresponding to such services, the priority of the delay is higher than the priority of the packet loss rate. For another example, for services such as web browsing, transaction data, and file transfer, the corresponding link weights can also be delay and packet loss rate, and the priority of packet loss rate in the link weight corresponding to such services is greater than that of delay priority.

对此,在根据待转发数据包对应的服务类别,以及预先建立的服务类别与链路权重之间的对应关系,确定选择转发该待转发数据包的路由路径时的链路权重时,可以根据该待转发数据包对应的服务类别,以及预先建立的服务类别与链路权重之间的对应关系,确定选择优先级最高的链路权重为转发该待转发数据包的路由路径时的链路权重。In this regard, when determining the link weight when selecting the routing path for forwarding the data packet to be forwarded according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, the link weight can be determined according to the The service class corresponding to the data packet to be forwarded, and the pre-established correspondence between the service class and the link weight, determine that the link weight with the highest priority is selected as the link weight when forwarding the routing path of the to-be-forwarded data packet .

本发明实施例提供的一种基于服务类别的SDN路由选择方法,可以在接收到待转发数据时,先根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;然后可以根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,最后根据链路权重,选择从源地址至目标地址之间的最短路由路径。从而可以实现根据不同的业务选择不同的链路权重来进行路由路径选择。A service class-based SDN routing method provided by the embodiment of the present invention can, when receiving data to be forwarded, first determine the source address and destination address of the data packet to be forwarded and the data packet to be forwarded according to the received data packet to be forwarded The service class corresponding to the data packet; then the link weight when selecting the routing path for forwarding the data packet to be forwarded can be determined according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, Finally, according to the link weight, the shortest routing path from the source address to the destination address is selected. Therefore, it is possible to select different link weights according to different services to perform routing path selection.

在图1所示的基于服务类别的SDN路由选择方法的基础上,本发明实施例还提供了一种可能的实现方式,如图2所示,为本发明实施例的一种基于服务类别的SDN路由选择方法第二种实施方式的流程图,该方法可以包括:On the basis of the service class-based SDN routing method shown in FIG. 1 , an embodiment of the present invention also provides a possible implementation manner, as shown in FIG. 2 , which is a service class-based The flowchart of the second implementation manner of the SDN routing method, the method may include:

S210,对接收到的待转发数据包进行解析,获取待转发数据包中的源地址和目标地址;S210, parse the received data packet to be forwarded, and obtain a source address and a destination address in the data packet to be forwarded;

S220,判断待转发数据包的字节长度是否大于预设字节长度阈值;如果是,执行步骤S230;S220, determine whether the byte length of the data packet to be forwarded is greater than the preset byte length threshold; if so, perform step S230;

S230,获取待转发数据包的特征信息,并基于特征信息和预先建立的特征库,确定待转发数据包所采用的协议,其中,预先建立的特征库包括特征信息以及采用的协议的对应关系;S230, obtain characteristic information of the data packet to be forwarded, and determine the protocol adopted by the data packet to be forwarded based on the characteristic information and a pre-established characteristic library, wherein the pre-established characteristic library includes the corresponding relationship between the characteristic information and the adopted protocol;

S240,基于待转发数据包所采用的协议,确定待转发数据包所对应的服务类别;S240, based on the protocol adopted by the data packet to be forwarded, determine the service category corresponding to the data packet to be forwarded;

S250,根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,其中,链路权重至少包括:时延和/或丢包率;S250, according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, determine a link weight when selecting a routing path for forwarding the data packet to be forwarded, wherein the link weight at least includes : delay and/or packet loss rate;

S260,根据链路权重,选择从源地址至目标地址之间的最短路由路径。S260, according to the link weight, select the shortest routing path from the source address to the destination address.

在一些示例中,一些数据包是可以判断出服务类别的,而一些数据包无法判断出服务类别,为了避免对无法判断出服务类别的数据包进行服务类别的判别,可以在判断待转发数据包所对应的服务类别之前,判断是否能够判断出该待转发数据包所对应的服务类别。In some examples, some data packets can determine the service type, while some data packets cannot determine the service type. Before the corresponding service class, it is judged whether the service class corresponding to the data packet to be forwarded can be judged.

具体的,可以通过判断待转发数据包的字节长度是否大于预设字节长度阈值来判断是否能够判断出该待转发数据包所对应的服务类别。当该待转发数据包的字节长度大于预设字节长度阈值时,则可以说明具有较大的概率可以判断出该待转发数据包所对应的服务类别,当该待转发数据的字节长度小于预设字节长度阈值时,则可以说明不能判断出该待转发数据包所对应的服务类别,从而可以不进行服务类别判别。Specifically, it can be determined whether the service class corresponding to the data packet to be forwarded can be determined by judging whether the byte length of the data packet to be forwarded is greater than a preset byte length threshold. When the byte length of the data packet to be forwarded is greater than the preset byte length threshold, it can be shown that there is a high probability that the service category corresponding to the data packet to be forwarded can be determined. When it is less than the preset byte length threshold, it can be indicated that the service class corresponding to the data packet to be forwarded cannot be determined, so that the service class determination may not be performed.

在确定可以判断出该待转发数据包所对应的服务类别后,则可以判断该待转发数据包所对应的服务类别。在一些示例中,可以对应用层的数据包进行服务类别判别。After it is determined that the service class corresponding to the data packet to be forwarded can be determined, the service class corresponding to the data packet to be forwarded can be determined. In some examples, class-of-service discrimination may be performed on packets at the application layer.

在又一些示例中,应用层存在各种各样的协议来规范数据格式,每种协议定义都规定了如何传递报文或数据包,包括报文类型或数据包类型、字段含义、字段长度。而这些协议通常都包含在要转发的数据包中,因此,可以通过对待转发数据包中应用层协议头部字段位置和内容的判断,来确定服务类别。In still other examples, various protocols exist at the application layer to standardize data formats, and each protocol definition specifies how to transmit a message or data packet, including the message type or data packet type, field meaning, and field length. These protocols are usually included in the data packet to be forwarded. Therefore, the service class can be determined by judging the position and content of the header field of the application layer protocol in the data packet to be forwarded.

具体的,可以先获取待转发数据包的特征信息,并基于特征信息和预先建立的特征库,确定待转发数据包所采用的协议,然后基于待转发数据包所采用的协议,确定待转发数据包所对应的服务类别。Specifically, the characteristic information of the data packet to be forwarded can be obtained first, and the protocol adopted by the data packet to be forwarded can be determined based on the characteristic information and the pre-established characteristic database, and then the data packet to be forwarded can be determined based on the protocol adopted by the data packet to be forwarded. The class of service to which the package corresponds.

在一些示例中,各种应用层协议的字段内容具有一些特定的特征,如特定的字符串或者特定的比特序列,因此,可以将这些特定的字符串或者特定的比特序列作为数据包的特征信息,然后预先建立特征库。In some examples, the field contents of various application layer protocols have some specific characteristics, such as a specific string or a specific bit sequence. Therefore, these specific strings or specific bit sequences can be used as the characteristic information of the data packet , and then pre-establish the feature library.

例如,以多媒体流类应用层协议为例,其应用层协议是RTP(Real-time TransportProtocol,实时传输协议)。RTP协议头的版本号是固定值2,大部分情况下前8比特内只有Padding值取0或1,其余标识位都是0,因此,RTP协议常以数字“0x80”或者“0xa0”开头。其中,0x是16进制数字的开始符号,后续0xa0、0x21等以0x开头的数字含义与0x80相同。For example, taking a multimedia stream application layer protocol as an example, the application layer protocol is RTP (Real-time Transport Protocol, real-time transport protocol). The version number of the RTP protocol header is a fixed value of 2. In most cases, only the Padding value in the first 8 bits is 0 or 1, and the rest of the identification bits are 0. Therefore, the RTP protocol often starts with the number "0x80" or "0xa0". Among them, 0x is the start symbol of the hexadecimal number, and the subsequent 0xa0, 0x21 and other numbers starting with 0x have the same meaning as 0x80.

当RTP以0x80或者0xa0开头时,RTP的头部长度是12字节。RTP的第二个字节是负载类型,数值范围在0~127,它代表RTP承载的负载类型,如MPEG2 TS(Moving PictureExperts Group Transport Stream,动态图像专家组传输流标准)对应的负载值为0x21,即第33号负载,又例如PCMA(Pulse Code Modulation Audio,原始数字音频信号流标准)、动态图像专家组高度压缩数字视频编解码器标准(简称H.264)等应用层协议。基于TCP(Transmission Control Protocol,传输控制协议)的RTP协议和基于UDP(User DatagramProtocol,用户数据报协议)的RTP协议有细微区别,基于TCP的RTP会在协议头部前面再加上一定RTP标识位,格式为:“0x24”+媒体传输通道ID(1byte)+RTP包长度(2byte)。因此,可以基于RTP协议的开头信息和负载类型信息作为携带该RTP协议的数据包的特征信息,同样,可以通过对其他应用层协议进行分析而选择相应的信息作为携带对应应用层协议的数据包的特征信息,来建立特征库。When RTP starts with 0x80 or 0xa0, the length of the RTP header is 12 bytes. The second byte of RTP is the payload type, which ranges from 0 to 127. It represents the payload type carried by RTP. For example, the payload value corresponding to MPEG2 TS (Moving Picture Experts Group Transport Stream) is 0x21. , namely the load No. 33, and for example, application layer protocols such as PCMA (Pulse Code Modulation Audio, original digital audio signal stream standard), Moving Picture Experts Group highly compressed digital video codec standard (H.264 for short). There are subtle differences between the RTP protocol based on TCP (Transmission Control Protocol, Transmission Control Protocol) and the RTP protocol based on UDP (User Datagram Protocol, User Datagram Protocol). , the format is: "0x24" + media transmission channel ID (1byte) + RTP packet length (2byte). Therefore, the header information and load type information of the RTP protocol can be used as the characteristic information of the data packet carrying the RTP protocol. Similarly, the corresponding information can be selected as the data packet carrying the corresponding application layer protocol by analyzing other application layer protocols. feature information to build a feature library.

在一些示例中,该特征库可以是正则特征库,则该正则特征库中的特征信息为正则特征信息。该正则特征信息可以表示为P=F0,F1,…,Fi,…,Fn,其中,Fi为协议P的第i个规范字段,n为协议P的字段数量,Fi=(val,len),val表示协议P的第i个规范字段的数值,len表示协议P的第i个规范字段的数值的长度(单位:bit)。In some examples, the feature library may be a regular feature library, and the feature information in the regular feature library is regular feature information. The regular feature information can be expressed as P=F 0 , F 1 ,...,F i ,...,F n , where F i is the ith canonical field of the protocol P, n is the number of fields of the protocol P, F i = (val, len), val represents the value of the ith canonical field of the protocol P, and len represents the length (unit: bit) of the value of the ith canonical field of the protocol P.

如果该正则特征信息中存在一组字段是固定数值并且能够唯一表征协议P,则将该组字段称为协议P的关键特征,可以将该协议P的关键特征作为该协议P的特征信息。If there is a set of fields in the regular feature information that are fixed values and can uniquely characterize the protocol P, the set of fields is called the key feature of the protocol P, and the key feature of the protocol P can be used as the feature information of the protocol P.

在预先建立好特征库后,可以对该待转发数据包进行分析,提取该待转发数据的特征信息,然后基于该待转发数据包的特征信息和预先建立的特征库,来确定该待转发数据包所采用的协议。After the feature database is pre-established, the data packet to be forwarded can be analyzed, the feature information of the data to be forwarded can be extracted, and then the data to be forwarded can be determined based on the feature information of the data packet to be forwarded and the pre-established feature database The protocol used by the package.

在一些示例中,该预先建立的特征库可能会存在不完善的情况,因此,也会存在确定不出待转发数据包所采用的协议的可能,对此,当基于特征信息和预先建立的特征库,未确定出待转发数据包所采用的协议时,则可以获取接收待转发数据包的端口,然后基于预先建立的应用层协议与传输层端口映射关系表,确定待转发数据包所采用的协议。In some examples, the pre-established signature library may be imperfect, and therefore, there may be a possibility that the protocol adopted by the data packet to be forwarded cannot be determined. library, when the protocol used for the data packet to be forwarded is not determined, the port that receives the data packet to be forwarded can be obtained, and then based on the pre-established application layer protocol and transport layer port mapping relationship table, the data packet to be forwarded is determined. protocol.

在一些示例中,该预先建立的应用层协议与传输层端口映射关系表可以是基于IANA(Internet Assigned Numbers Authority,互联网号码分配机构)公布的传输层端口与应用层协议的映射关系来建立的。In some examples, the pre-established application layer protocol and transport layer port mapping relationship table may be established based on the mapping relationship between transport layer ports and application layer protocols published by IANA (Internet Assigned Numbers Authority, Internet Assigned Numbers Authority).

例如,应用层协议HTTP((HyperText Transfer Protocol,超文本传输协议,)所对应的传输层协议TCP协议的端口为80端口,应用层协议FTP(File Transfer Protocol,文件传输协议)所对应的传输层协议TCP协议的端口为21端口,应用层协议SMTP(Simple MailTransfer Protocol,简单邮件传输协议)所对应的传输层协议TCP协议的端口为25端口,应用层协议POP3(Post Office Protocol-Version3,邮局协议版本3)所对应的传输层协议TCP协议的端口为110端口,应用层协议HTTPS(Hyper Text Transfer Protocol overSecureSocket Layer,超文本传输安全协议)所对应的传输层协议TCP协议的端口为443端口,应用层协议DNS(Domain Name System,域名系统)所对应的传输层协议UDP协议的端口为53端口,应用层协议RDP(Remote Desktop Protocol,远程桌面协议)所对应的传输层协议TCP协议的端口为3389端口,应用层协议Telnet(远程终端协议)所对应的传输层协议TCP协议的端口为23端口等。For example, the port of the transport layer protocol TCP protocol corresponding to the application layer protocol HTTP ((HyperText Transfer Protocol,) is port 80, and the transport layer protocol corresponding to the application layer protocol FTP (File Transfer Protocol, file transfer protocol) The port is port 80. The port of the protocol TCP protocol is port 21, the port of the transport layer protocol TCP protocol corresponding to the application layer protocol SMTP (Simple MailTransfer Protocol, Simple Mail Transfer Protocol) is port 25, the application layer protocol POP3 (Post Office Protocol-Version3, Post Office Protocol) The port of the corresponding transport layer protocol TCP protocol of version 3) is port 110, and the port of the transport layer protocol TCP protocol corresponding to the application layer protocol HTTPS (Hyper Text Transfer Protocol over SecureSocket Layer, Hypertext Transfer Security Protocol) is port 443, and the application The port of the transport layer protocol UDP protocol corresponding to the layer protocol DNS (Domain Name System, Domain Name System) is port 53, and the port of the transport layer protocol TCP protocol corresponding to the application layer protocol RDP (Remote Desktop Protocol, Remote Desktop Protocol) The port is 3389 Port, the port of the transport layer protocol TCP protocol corresponding to the application layer protocol Telnet (Remote Terminal Protocol) is port 23, etc.

在确定出该待转发数据包所采用的协议后,由于不同类别的业务,通常会采用不同的协议来发送数据包,例如,网站业务通常采用HTTPS或者HTTP协议来发送数据包,而文件传输业务则通常使用FTP协议来发送数据包,因此,则可以基于该待转发数据包所采用的协议,来确定待转发数据包所对应的服务类别。After determining the protocol used by the data packet to be forwarded, different protocols are usually used to send data packets due to different types of services. For example, website services usually use HTTPS or HTTP protocol to send data packets, while file transfer services The FTP protocol is usually used to send the data packet. Therefore, the service class corresponding to the to-be-forwarded data packet can be determined based on the protocol adopted by the to-be-forwarded data packet.

在确定出待转发数据包所对应的服务类别后,则可以根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,并根据链路权重,选择从源地址至目标地址之间的最短路由路径。After the service class corresponding to the data packet to be forwarded is determined, the route for forwarding the data packet to be forwarded can be determined and selected according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight The link weight of the path, and according to the link weight, the shortest route from the source address to the destination address is selected.

在一些示例中,通过上述步骤,可以确定出选择转发待转发数据包的路由路径时的链路权重,该链路权重可能是时延也有可能是丢包率。In some examples, through the above steps, a link weight when selecting a routing path for forwarding a data packet to be forwarded can be determined, and the link weight may be a delay or a packet loss rate.

当该链路权重是时延时,则可以根据各个链路的时延,选择从源地址至目标地址之间的最短路由路径,该最短路由路径可以是时延最小的路由路径。When the link weight is the delay, the shortest routing path from the source address to the destination address can be selected according to the delay of each link, and the shortest routing path can be the routing path with the smallest delay.

当该链路权重是丢包率时,则可以根据各个链路的丢包率,选择从源地址至目标地址之间的最短路由路径。When the link weight is the packet loss rate, the shortest routing path from the source address to the destination address can be selected according to the packet loss rate of each link.

在一些示例中,在根据各个链路的丢包率,选择从源地址至目标地址之间的最短路由路径时,可以先获取任一链路上的两个交换设备分别统计的发送历史数据包的数量Tx和接收历史数据包的数量Rx,然后通过以下公式:In some examples, when selecting the shortest routing path from the source address to the destination address according to the packet loss rate of each link, the number of historical data packets sent by the two switching devices on any link may be obtained first. T x and the number of received historical packets R x , then pass the following formula:

Li=1-Rx/Tx L i =1-R x /T x

计算该链路的丢包率;Calculate the packet loss rate of the link;

再根据每个链路的丢包率,选择从源地址至目标地址之间的最短路由路径。Then, according to the packet loss rate of each link, the shortest routing path from the source address to the destination address is selected.

可以理解的是,对于网络拓扑中的交换机而言,通常会先接收数据包,然后再进行转发,因此,各个交换机可以既作为数据包的发送端,也可以数据包的接收端,当交换机在接收数据包时,通常会统计接收到的数据包数量,在发送数据包时,也会统计发送的数据包的数量。而对于一个链路而言,通常是由两个交换机来构成的,该两个交换机中,一个是发送端交换机,一个是接收端交换机。因此,可以通过每个链路上的两个交换设备分别统计的发送历史数据包的数量和接收历史数据包的数量,来计算该链路的丢包率。It is understandable that for switches in a network topology, data packets are usually received first and then forwarded. Therefore, each switch can serve as both the sender and the receiver of data packets. When data packets are received, the number of received data packets is usually counted, and when data packets are sent, the number of sent data packets is also counted. For a link, it is usually composed of two switches, one of which is a sending end switch and the other is a receiving end switch. Therefore, the packet loss rate of each link can be calculated by the number of historical data packets sent and the number of historical data packets received by the two switching devices on each link, respectively.

最后,再根据每个链路的丢包率,选择从源地址至目标地址之间的最短路由路径。Finally, according to the packet loss rate of each link, the shortest routing path from the source address to the destination address is selected.

在又一些示例中,由于交换设备中的流表项会存在生存时间,当该流表项的生存时间过期之后,则可能会清除交换设备中存储的发送数据包的数量和接收数据包的数量,对此,可以对每条链路维护一个队列,该队列可以用于统计该链路的历史丢包率。在通过上述步骤计算出每条链路的丢包率后,可以将每条链路的丢包率存储在各自对应的队列中。In still other examples, since the flow entry in the switching device has a time-to-live, when the time-to-live of the flow entry expires, the number of sent data packets and the number of received data packets stored in the switching device may be cleared. , for this, a queue can be maintained for each link, and the queue can be used to count the historical packet loss rate of the link. After the packet loss rate of each link is calculated through the above steps, the packet loss rate of each link can be stored in its corresponding queue.

然后在根据各个链路的丢包率,选择从源地址至目标地址之间的最短路由路径时,可以获取任一链路上记录的历史丢包率,通过以下公式:Then, when selecting the shortest routing path from the source address to the destination address according to the packet loss rate of each link, the historical packet loss rate recorded on any link can be obtained by the following formula:

Figure BDA0002921507440000131
Figure BDA0002921507440000131

计算历史丢包率的平均值,其中,L'i,k为第i条链路的第k个历史丢包率,N为历史丢包率的总数;Calculate the average value of the historical packet loss rate, where L' i,k is the kth historical packet loss rate of the ith link, and N is the total number of historical packet loss rates;

然后将历史丢包率的平均值作为该链路的丢包率Li;最后根据每个链路的丢包率,选择从源地址至目标地址之间的最短路由路径。Then the average value of the historical packet loss rate is taken as the packet loss rate Li of the link ; finally, according to the packet loss rate of each link, the shortest routing path from the source address to the destination address is selected.

在一些示例中,当链路权重为时延时,可以通过对链路的时延的相加,来得到不同路径的时延,也即不同路径的时延,为组成该路径的各个链路的时延之和;而当链路权重为丢包率时,则需要对链路的丢包率进行相乘,来得到不同路径的丢包率,也即不同路径的丢包率,为组成该路径的各个链路的丢包率的乘积。In some examples, when the link weight is the delay, the delays of different paths can be obtained by adding the delays of the links, that is, the delays of different paths, which are the respective links constituting the path. When the link weight is the packet loss rate, the packet loss rate of the link needs to be multiplied to obtain the packet loss rate of different paths, that is, the packet loss rate of different paths, which is composed of The product of the packet loss rate of each link of the path.

对此,可以对链路的丢包率进行预处理,以便采用与计算路径时延时的计算方式相同的计算方式来计算路径的丢包率,也即对链路的丢包率进行相加,来得到不同路径的丢包率。In this regard, the packet loss rate of the link can be preprocessed, so that the packet loss rate of the path can be calculated by the same calculation method as the calculation method of the delay when calculating the path, that is, the packet loss rate of the link is added. , to get the packet loss rate of different paths.

具体的,可以采用如下公式:Specifically, the following formula can be used:

Figure BDA0002921507440000141
Figure BDA0002921507440000141

对每个链路的丢包率Li进行预处理,得到每条链路预处理后的丢包率L'iThe packet loss rate Li of each link is preprocessed to obtain the preprocessed packet loss rate L' i of each link;

然后根据每个链路预处理后的丢包率,选择从源地址至目标地址之间的最短路由路径。Then, according to the preprocessed packet loss rate of each link, the shortest routing path from the source address to the destination address is selected.

这样可以使得在选择最短路由路径时,对不同的路径,将组成该路径的各个链路的预处理后的丢包率进行相加,便可以得到该路径的丢包率。进而可以确定出最短路由路径。In this way, when the shortest routing path is selected, the packet loss rate of the path can be obtained by adding up the preprocessed packet loss rates of each link constituting the path for different paths. Then, the shortest routing path can be determined.

在图2所示的基于服务类别的SDN路由选择方法的基础上,本发明实施例还提供了一种可能的实现方式,如图3所示,为本发明实施例的一种基于服务类别的SDN路由选择方法第三种实施方式的流程图,该方法可以包括:On the basis of the service class-based SDN routing method shown in FIG. 2 , an embodiment of the present invention also provides a possible implementation manner, as shown in FIG. 3 , which is a service class-based The flow chart of the third embodiment of the SDN routing method, the method may include:

S310,对接收到的待转发数据包进行解析,获取待转发数据包中的源地址和目标地址;S310, analyze the received data packet to be forwarded, and obtain the source address and the destination address in the data packet to be forwarded;

S320,判断待转发数据包的字节长度是否大于预设字节长度阈值;如果是,执行步骤S330;S320, determine whether the byte length of the data packet to be forwarded is greater than the preset byte length threshold; if so, perform step S330;

S330,获取待转发数据包的特征信息,并基于特征信息和预先建立的特征库,确定待转发数据包所采用的协议,其中,预先建立的特征库包括特征信息以及采用的协议的对应关系;S330, obtain characteristic information of the data packet to be forwarded, and determine the protocol adopted by the data packet to be forwarded based on the characteristic information and a pre-established characteristic library, wherein the pre-established characteristic library includes the corresponding relationship between the characteristic information and the adopted protocol;

S340,基于待转发数据包所采用的协议,确定待转发数据包所对应的服务类别;S340, based on the protocol adopted by the data packet to be forwarded, determine the service category corresponding to the data packet to be forwarded;

S350,根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,其中,链路权重至少包括:时延和/或丢包率;S350, according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, determine the link weight when selecting the routing path for forwarding the data packet to be forwarded, wherein the link weight at least includes : delay and/or packet loss rate;

S360,根据链路权重和Yen’s算法,确定从源地址至目标地址之间的K条最短路由路径;S360, according to the link weight and Yen's algorithm, determine the K shortest routing paths from the source address to the destination address;

S370,获取多个链路权重,并根据待转发数据包对应的服务类别,确定多个链路权重的排序;S370, obtain multiple link weights, and determine the ordering of multiple link weights according to the service category corresponding to the data packet to be forwarded;

S380,基于K条最短路由路径和多个链路权重的排序,采用字典序排序算法对K条最短路由路径进行排序,得到排序后的K条最短路由路径;S380, based on the sorting of the K shortest routing paths and the weights of the multiple links, using a lexicographic sorting algorithm to sort the K shortest routing paths, to obtain the sorted K shortest routing paths;

S390,将排序后的K条最短路由路径中的第一条路由路径作为从源地址至目标地址之间的最短路由路径。S390, taking the first routing path in the sorted K shortest routing paths as the shortest routing path from the source address to the target address.

在一些示例中,在根据链路权重,选择从源地址至目标地址之间的最短路由路径时,可以根据单一链路权重,选择从源地址至目标地址之间的最短路由路径。然而,对于一些业务而言,在选择最短路由路径时,可能具有多个链路权重的要求,该多个链路权重通常可以具有不同的优先级,该不同优先级的链路权重可以具有一定的排序,例如,按照优先级从高到低的顺序进行排序或者按照优先级从低到高的顺序进行排序。In some examples, when selecting the shortest routing path from the source address to the destination address based on the link weight, the shortest routing path from the source address to the destination address may be selected based on a single link weight. However, for some services, when selecting the shortest routing path, there may be requirements for multiple link weights, and the multiple link weights may usually have different priorities, and the link weights with different priorities may have certain , for example, in order of priority from high to low or in order of priority from low to high.

对此,在本发明实施例中,可以先基于最高优先级的链路权重,采用Yen’s算法,确定从源地址至目标地址之间的K条最短路由路径;In this regard, in this embodiment of the present invention, the Yen's algorithm may be used to determine the K shortest routing paths from the source address to the destination address based on the link weight of the highest priority;

然后,基于次高优先级的链路权重和该K条最短路由路径,采用字典序排序算法对K条最短路由路径进行排序,得到排序后的K条最短路由路径;最后将排序后的K条最短路由路径中的第一条路由路径作为从源地址至目标地址之间的最短路由路径。Then, based on the link weight of the next highest priority and the K shortest routing paths, the K shortest routing paths are sorted by the lexicographical sorting algorithm, and the sorted K shortest routing paths are obtained; finally, the sorted K shortest routing paths are obtained. The first routing path in the shortest routing path serves as the shortest routing path from the source address to the destination address.

这样,可以使得在选择从源地址至目标地址之间的最短路由路径时,可以优先考虑最重要的链路权重,然后再考虑其他不是最重要的链路权重,并且使得选择出的最短路由路径可以优先满足最重要的服务质量要求,再满足次重要的服务质量要求,并且可以满足多个服务质量要求。In this way, when selecting the shortest routing path from the source address to the destination address, the most important link weight can be given priority, and then other less important link weights can be considered, and the selected shortest routing path can be The most important service quality requirements can be satisfied first, followed by the second most important service quality requirements, and multiple service quality requirements can be satisfied.

可以理解的是,本实施例中的步骤S310~S350与本发明的第二种实施方式中的步骤S210~S250相同或相似。It can be understood that, steps S310 to S350 in this embodiment are the same as or similar to steps S210 to S250 in the second embodiment of the present invention.

相应于上述的方法实施例,本发明实施例还提供了一种基于服务类别的SDN路由选择装置,如图4所示,为本发明实施例的一种基于服务类别的SDN路由选择装置的结构示意图,该装置可以包括:Corresponding to the above method embodiments, an embodiment of the present invention further provides a service class-based SDN routing device, as shown in FIG. 4 , which is the structure of a service class-based SDN routing device according to an embodiment of the present invention Schematically, the device may include:

服务类别确定模块410,用于根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;The service class determination module 410 is configured to determine the source address and destination address of the data packet to be forwarded and the service class corresponding to the data packet to be forwarded according to the received data packet to be forwarded;

链路权重确定模块420,用于根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,其中,链路权重至少包括:时延和/或丢包率;The link weight determination module 420 is configured to determine the link weight when selecting the routing path for forwarding the data packet to be forwarded according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, Wherein, the link weight includes at least: delay and/or packet loss rate;

选择模块430,用于根据链路权重,选择从源地址至目标地址之间的最短路由路径。The selection module 430 is configured to select the shortest routing path from the source address to the destination address according to the link weight.

本发明实施例提供的一种基于服务类别的SDN路由选择装置,可以在接收到待转发数据时,先根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;然后可以根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,最后根据链路权重,选择从源地址至目标地址之间的最短路由路径。从而可以实现根据不同的业务选择不同的链路权重来进行路由路径选择。An SDN routing device based on a service class provided by an embodiment of the present invention can, when receiving data to be forwarded, first determine the source address and destination address of the data packet to be forwarded and the source address and destination address of the data packet to be forwarded according to the received data packet to be forwarded. The service class corresponding to the data packet; then the link weight when selecting the routing path for forwarding the data packet to be forwarded can be determined according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, Finally, according to the link weight, the shortest routing path from the source address to the destination address is selected. Therefore, it is possible to select different link weights according to different services to perform routing path selection.

在一些示例中,服务类别确定模块410,包括:In some examples, service class determination module 410 includes:

解析子模块,用于对接收到的待转发数据包进行解析,获取待转发数据包中的源地址和目标地址;The parsing submodule is used to parse the received data packet to be forwarded, and obtain the source address and destination address in the to-be-forwarded data packet;

判断子模块,用于判断待转发数据包的字节长度是否大于预设字节长度阈值;如果是,触发服务类别确定子模块,The judgment submodule is used to judge whether the byte length of the data packet to be forwarded is greater than the preset byte length threshold; if so, trigger the service category determination submodule,

服务类别确定子模块,用于获取待转发数据包的特征信息,并基于特征信息和预先建立的特征库,确定待转发数据包所采用的协议,基于待转发数据包所采用的协议,确定待转发数据包所对应的服务类别,其中,预先建立的特征库包括特征信息以及采用的协议的对应关系。The service category determination sub-module is used to obtain the characteristic information of the data packet to be forwarded, and based on the characteristic information and the pre-established characteristic database, determine the protocol adopted by the data packet to be forwarded, and determine the protocol adopted by the data packet to be forwarded based on the protocol adopted by the data packet to be forwarded. Forwarding the service category corresponding to the data packet, wherein the pre-established feature library includes feature information and the correspondence relationship of the adopted protocol.

在一些示例中,服务类别确定子模块,还用于:In some examples, service classes determine submodules, which are also used to:

在基于特征信息和预先建立的特征库,未确定出待转发数据包所采用的协议时,获取接收待转发数据包的端口,并基于预先建立的应用层协议与传输层端口映射关系表,确定待转发数据包所采用的协议。When the protocol adopted by the data packet to be forwarded is not determined based on the feature information and the pre-established signature database, the port for receiving the data packet to be forwarded is obtained, and based on the pre-established application layer protocol and transport layer port mapping table, determine The protocol used by the packets to be forwarded.

在一些示例中,当链路权重为丢包率时,选择模块430,具体用于:In some examples, when the link weight is the packet loss rate, the selection module 430 is specifically configured to:

获取任一链路上的两个交换设备分别统计的发送历史数据包的数量Tx和接收历史数据包的数量Rx,通过以下公式:Obtain the number T x of historical data packets sent and the number R x of historical data packets received by the two switching devices on any link, respectively, through the following formula:

Li=1-Rx/Tx Li = 1 - Rx /Tx

计算该链路的丢包率;Calculate the packet loss rate of the link;

根据每个链路的丢包率,选择从源地址至目标地址之间的最短路由路径。According to the packet loss rate of each link, the shortest routing path from the source address to the destination address is selected.

在一些示例中,当链路权重为丢包率时,选择模块430,具体用于:In some examples, when the link weight is the packet loss rate, the selection module 430 is specifically configured to:

获取任一链路上记录的历史丢包率,通过以下公式:Obtain the historical packet loss rate recorded on any link using the following formula:

Figure BDA0002921507440000171
Figure BDA0002921507440000171

计算历史丢包率的平均值,并将历史丢包率的平均值作为该链路的丢包率Li,其中,L'i,k为第i条链路的第k个历史丢包率,N为历史丢包率的总数;Calculate the average value of the historical packet loss rate, and use the average value of the historical packet loss rate as the packet loss rate L i of the link, where L' i,k is the kth historical packet loss rate of the ith link , N is the total number of historical packet loss rates;

根据每个链路的丢包率,选择从源地址至目标地址之间的最短路由路径。According to the packet loss rate of each link, the shortest routing path from the source address to the destination address is selected.

在一些示例中,选择模块430,具体用于:In some examples, the selection module 430 is specifically used to:

采用如下公式:Use the following formula:

Figure BDA0002921507440000172
Figure BDA0002921507440000172

对每个链路的丢包率Li进行预处理,得到每条链路预处理后的丢包率L'i;根据每个链路预处理后的丢包率,选择从源地址至目标地址之间的最短路由路径。Perform preprocessing on the packet loss rate Li of each link to obtain the preprocessed packet loss rate L' i of each link; according to the preprocessed packet loss rate of each link, select from the source address to the destination The shortest routing path between addresses.

在一些示例中,选择模块430,包括:In some examples, selection module 430 includes:

K条路径确定子模块,用于根据链路权重和Yen’s算法,确定从源地址至目标地址之间的K条最短路由路径;The K path determination sub-module is used to determine the K shortest routing paths from the source address to the destination address according to the link weight and Yen's algorithm;

链路权重排序子模块,用于获取多个链路权重,并根据待转发数据包对应的服务类别,确定多个链路权重的排序;The link weight sorting sub-module is used to obtain multiple link weights, and determine the sorting of multiple link weights according to the service category corresponding to the data packet to be forwarded;

路由路径排序子模块,用于基于K条最短路由路径和多个链路权重的排序,采用字典序排序算法对K条最短路由路径进行排序,得到排序后的K条最短路由路径;The routing path sorting sub-module is used to sort the K shortest routing paths based on the K shortest routing paths and the weights of multiple links, using the lexicographic sorting algorithm to sort the K shortest routing paths, and obtain the sorted K shortest routing paths;

最短路由路径确定子模块,用于将排序后的K条最短路由路径中的第一条路由路径作为从源地址至目标地址之间的最短路由路径。The shortest routing path determination sub-module is configured to use the first routing path in the sorted K shortest routing paths as the shortest routing path from the source address to the target address.

本发明实施例还提供了一种电子设备,如图5所示,包括处理器501、通信接口502、存储器503和通信总线504,其中,处理器501,通信接口502,存储器503通过通信总线504完成相互间的通信,An embodiment of the present invention further provides an electronic device, as shown in FIG. 5 , including a processor 501 , a communication interface 502 , a memory 503 and a communication bus 504 , wherein the processor 501 , the communication interface 502 , and the memory 503 pass through the communication bus 504 complete communication with each other,

存储器503,用于存放计算机程序;a memory 503 for storing computer programs;

处理器501,用于执行存储器503上所存放的程序时,实现上述任一实施例所示的一种基于服务类别的SDN路由选择方法的步骤,例如,可以实现如下步骤:The processor 501 is configured to implement the steps of a service class-based SDN routing method shown in any of the foregoing embodiments when executing the program stored in the memory 503. For example, the following steps may be implemented:

根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;Determine the source address and destination address of the data packet to be forwarded and the service category corresponding to the data packet to be forwarded according to the received data packet to be forwarded;

根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,其中,链路权重至少包括:时延和/或丢包率;According to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, the link weight when selecting the routing path for forwarding the data packet to be forwarded is determined, wherein the link weight at least includes: delay and/or packet loss rate;

根据链路权重,选择从源地址至目标地址之间的最短路由路径。Based on the link weight, select the shortest routing path from the source address to the destination address.

本发明实施例提供的一种电子设备,可以在接收到待转发数据时,先根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;然后可以根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,最后根据链路权重,选择从源地址至目标地址之间的最短路由路径。从而可以实现根据不同的业务选择不同的链路权重来进行路由路径选择。An electronic device provided by an embodiment of the present invention can, when receiving data to be forwarded, first determine the source address and destination address of the data packet to be forwarded and the service class corresponding to the data packet to be forwarded according to the received data packet to be forwarded ; Then, according to the corresponding service class of the data packet to be forwarded and the corresponding relationship between the pre-established service class and the link weight, the link weight when selecting the routing path for forwarding the data packet to be forwarded can be determined, and finally according to the link weight, Choose the shortest routing path from the source address to the destination address. Therefore, it is possible to select different link weights according to different services to perform routing path selection.

上述电子设备提到的通信总线可以是外设部件互连标准(Peripheral ComponentInterconnect,PCI)总线或扩展工业标准结构(Extended Industry StandardArchitecture,EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus mentioned in the above electronic device may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

通信接口用于上述电子设备与其他设备之间的通信。The communication interface is used for communication between the above electronic device and other devices.

存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。在一些示例中,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory may include random access memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory. In some examples, the memory may also be at least one storage device located remotely from the aforementioned processor.

上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital SignalProcessor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

在本发明提供的又一实施例中,本发明实施例还提供了一种计算机可读存储介质,该计算机可读存储介质内存储有计算机程序,计算机程序被处理器执行时实现上述任一实施例所示的一种基于服务类别的SDN路由选择方法的步骤,例如,可以实现如下步骤:In yet another embodiment provided by the present invention, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any of the foregoing implementations is implemented The steps of a service class-based SDN routing method shown in the example, for example, the following steps can be implemented:

根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;Determine the source address and destination address of the data packet to be forwarded and the service category corresponding to the data packet to be forwarded according to the received data packet to be forwarded;

根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,其中,链路权重至少包括:时延和/或丢包率;According to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, the link weight when selecting the routing path for forwarding the data packet to be forwarded is determined, wherein the link weight at least includes: delay and/or packet loss rate;

根据链路权重,选择从源地址至目标地址之间的最短路由路径。Based on the link weight, select the shortest routing path from the source address to the destination address.

本发明实施例提供的一种计算机可读存储介质,可以在接收到待转发数据时,先根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;然后可以根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,最后根据链路权重,选择从源地址至目标地址之间的最短路由路径。从而可以实现根据不同的业务选择不同的链路权重来进行路由路径选择。A computer-readable storage medium provided by an embodiment of the present invention can, when receiving data to be forwarded, first determine the source address and destination address of the data packet to be forwarded and the correspondence of the data packet to be forwarded according to the received data packet to be forwarded Then, according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, determine the link weight when selecting the routing path for forwarding the data packet to be forwarded, and finally according to the link weight The route weight is used to select the shortest route from the source address to the destination address. Therefore, it is possible to select different link weights according to different services to perform routing path selection.

在本发明提供的又一实施例中,本发明实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述任一实施例所示的一种基于服务类别的SDN路由选择方法的步骤,例如,可以执行如下步骤:In yet another embodiment provided by the present invention, the embodiment of the present invention also provides a computer program product containing instructions, which, when running on a computer, enables the computer to execute a service-based product shown in any of the above embodiments The steps of a class of SDN routing methods, for example, can be performed as follows:

根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;Determine the source address and destination address of the data packet to be forwarded and the service category corresponding to the data packet to be forwarded according to the received data packet to be forwarded;

根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,其中,链路权重至少包括:时延和/或丢包率;According to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, the link weight when selecting the routing path for forwarding the data packet to be forwarded is determined, wherein the link weight at least includes: delay and/or packet loss rate;

根据链路权重,选择从源地址至目标地址之间的最短路由路径。Based on the link weight, select the shortest routing path from the source address to the destination address.

本发明实施例提供的一种包含指令的计算机程序产品,可以在接收到待转发数据时,先根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;然后可以根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,最后根据链路权重,选择从源地址至目标地址之间的最短路由路径。从而可以实现根据不同的业务选择不同的链路权重来进行路由路径选择。A computer program product including an instruction provided by an embodiment of the present invention can, when receiving data to be forwarded, first determine the source address and destination address of the data packet to be forwarded and the data packet to be forwarded according to the received data packet to be forwarded Corresponding service class; then, according to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, determine the link weight when selecting the routing path for forwarding the data packet to be forwarded, and finally according to Link weight, selects the shortest routing path from the source address to the destination address. Therefore, it is possible to select different link weights according to different services to perform routing path selection.

在本发明提供的又一实施例中,本发明实施例还提供了一种计算机程序,当其在计算机上运行时,使得计算机执行上述任一实施例所示的一种基于服务类别的SDN路由选择方法的步骤,例如,可以执行如下步骤:In another embodiment provided by the present invention, the embodiment of the present invention further provides a computer program, which, when running on a computer, causes the computer to execute the service class-based SDN routing shown in any of the above embodiments Select the steps of the method, for example, you can perform the following steps:

根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;Determine the source address and destination address of the data packet to be forwarded and the service category corresponding to the data packet to be forwarded according to the received data packet to be forwarded;

根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,其中,链路权重至少包括:时延和/或丢包率;According to the service class corresponding to the data packet to be forwarded and the pre-established correspondence between the service class and the link weight, the link weight when selecting the routing path for forwarding the data packet to be forwarded is determined, wherein the link weight at least includes: delay and/or packet loss rate;

根据链路权重,选择从源地址至目标地址之间的最短路由路径。Based on the link weight, select the shortest routing path from the source address to the destination address.

本发明实施例提供的一种计算机程序,可以在接收到待转发数据时,先根据接收到的待转发数据包,确定待转发数据包的源地址和目标地址以及待转发数据包对应的服务类别;然后可以根据待转发数据包对应的服务类别和预先建立的服务类别与链路权重之间的对应关系,确定选择转发待转发数据包的路由路径时的链路权重,最后根据链路权重,选择从源地址至目标地址之间的最短路由路径。从而可以实现根据不同的业务选择不同的链路权重来进行路由路径选择。A computer program provided by an embodiment of the present invention can, when receiving data to be forwarded, first determine the source address and destination address of the data packet to be forwarded and the service class corresponding to the data packet to be forwarded according to the received data packet to be forwarded ; Then, according to the corresponding service class of the data packet to be forwarded and the corresponding relationship between the pre-established service class and the link weight, the link weight when selecting the routing path for forwarding the data packet to be forwarded can be determined, and finally according to the link weight, Choose the shortest routing path from the source address to the destination address. Therefore, it is possible to select different link weights according to different services to perform routing path selection.

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in accordance with the embodiments of the present invention are generated in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device. Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server, or data center over a wire (e.g. coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.) to another website site, computer, server, or data center. A computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that includes an integration of one or more available media. Useful media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), among others.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any relationship between these entities or operations. any such actual relationship or sequence exists. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device comprising a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置、电子设备、计算机可读存储介质等实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner, and the same and similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for embodiments such as apparatuses, electronic devices, and computer-readable storage media, since they are basically similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for related parts.

以上所述仅为本发明的较佳实施例,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本发明的保护范围内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (10)

1. A Software Defined Network (SDN) routing method based on service classes, the method comprising:
determining a source address and a target address of a data packet to be forwarded and a service type corresponding to the data packet to be forwarded according to the received data packet to be forwarded;
determining a link weight when a routing path for forwarding the data packet to be forwarded is selected according to the service class corresponding to the data packet to be forwarded and a correspondence between the service class and the link weight, wherein the link weight at least comprises: time delay and/or packet loss rate;
and selecting the shortest routing path from the source address to the target address according to the link weight.
2. The method according to claim 1, wherein the determining, according to the received packet to be forwarded, a source address and a destination address of the packet to be forwarded and a service class corresponding to the packet to be forwarded includes:
analyzing the received data packet to be forwarded to obtain a source address and a target address in the data packet to be forwarded;
judging whether the byte length of the data packet to be forwarded is larger than a preset byte length threshold value or not;
if so, acquiring the characteristic information of the data packet to be forwarded, and determining a protocol adopted by the data packet to be forwarded based on the characteristic information and a pre-established characteristic library, wherein the pre-established characteristic library comprises the corresponding relation between the characteristic information and the adopted protocol;
and determining the service class corresponding to the data packet to be forwarded based on the protocol adopted by the data packet to be forwarded.
3. The method of claim 2, further comprising:
and when the protocol adopted by the data packet to be forwarded is not determined based on the characteristic information and the pre-established characteristic library, acquiring a port for receiving the data packet to be forwarded, and determining the protocol adopted by the data packet to be forwarded based on a pre-established mapping relation table of an application layer protocol and a transmission layer port.
4. The method of claim 1, wherein when the link weight is the packet loss ratio, the selecting the shortest routing path from the source address to the destination address according to the link weight comprises:
obtaining the quantity T of the sending historical data packets respectively counted by two exchange devices on any link x And the number R of received history data packets x By the following formula:
L i =1-R x /T x
calculating the packet loss rate of the link;
and selecting the shortest routing path from the source address to the target address according to the packet loss rate of each link.
5. The method of claim 1, wherein when the link weight is the packet loss ratio, the selecting the shortest routing path from the source address to the destination address according to the link weight comprises:
obtaining the historical packet loss rate recorded on any link, and according to the following formula:
Figure FDA0002921507430000021
calculating the average value of the historical packet loss rates, and taking the average value of the historical packet loss rates as the packet loss rate L of the link i Wherein, L' i,k The kth historical packet loss rate of the ith link is obtained, and N is the total number of the historical packet loss rates;
and selecting the shortest routing path from the source address to the target address according to the packet loss rate of each link.
6. The method according to claim 4 or 5, wherein the selecting the shortest routing path from the source address to the destination address according to the packet loss rate of each link comprises:
the following formula is adopted:
Figure FDA0002921507430000022
packet loss rate L for each link i Preprocessing is carried out to obtain the packet loss rate L 'after each link is preprocessed' i
And selecting the shortest routing path from the source address to the target address according to the packet loss rate after the preprocessing of each link.
7. The method of claim 1, wherein selecting the shortest routing path from the source address to the destination address based on the link weights comprises:
determining K shortest routing paths from the source address to the target address according to the link weight and a Yen's algorithm;
acquiring a plurality of link weights, and determining the sequence of the plurality of link weights according to the service class corresponding to the data packet to be forwarded;
based on the sequencing of the K shortest routing paths and the plurality of link weights, sequencing the K shortest routing paths by adopting a lexicographic ordering algorithm to obtain the sequenced K shortest routing paths;
and taking the first routing path in the ordered K shortest routing paths as the shortest routing path from the source address to the target address.
8. An SDN routing apparatus based on service class, the apparatus comprising:
the service type determining module is used for determining a source address and a target address of the data packet to be forwarded and a service type corresponding to the data packet to be forwarded according to the received data packet to be forwarded;
a link weight determining module, configured to determine, according to a service category corresponding to the packet to be forwarded and a correspondence between a service category and a link weight that are established in advance, a link weight when a routing path for forwarding the packet to be forwarded is selected, where the link weight at least includes: delay and/or packet loss rate;
and the selection module is used for selecting the shortest routing path from the source address to the target address according to the link weight.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 7 when executing a program stored in the memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 7.
CN202110118171.4A 2021-01-28 2021-01-28 A service category-based SDN routing method, device and electronic equipment Expired - Fee Related CN114827018B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110118171.4A CN114827018B (en) 2021-01-28 2021-01-28 A service category-based SDN routing method, device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110118171.4A CN114827018B (en) 2021-01-28 2021-01-28 A service category-based SDN routing method, device and electronic equipment

Publications (2)

Publication Number Publication Date
CN114827018A true CN114827018A (en) 2022-07-29
CN114827018B CN114827018B (en) 2023-09-08

Family

ID=82525828

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110118171.4A Expired - Fee Related CN114827018B (en) 2021-01-28 2021-01-28 A service category-based SDN routing method, device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114827018B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106656847A (en) * 2017-03-10 2017-05-10 重庆邮电大学 Software defined network (SDN) load balancing method with highest network utility
CN107370676A (en) * 2017-08-03 2017-11-21 中山大学 Fusion QoS and load balancing demand a kind of route selection method
FR3062976A1 (en) * 2017-02-13 2018-08-17 Commissariat A L'energie Atomique Et Aux Energies Alternatives METHOD AND DEVICE FOR DETERMINING ENERGY-EFFICIENT ROUTING PATH
CN109274589A (en) * 2018-08-01 2019-01-25 中国联合网络通信集团有限公司 The method and apparatus of business transmission

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR3062976A1 (en) * 2017-02-13 2018-08-17 Commissariat A L'energie Atomique Et Aux Energies Alternatives METHOD AND DEVICE FOR DETERMINING ENERGY-EFFICIENT ROUTING PATH
CN106656847A (en) * 2017-03-10 2017-05-10 重庆邮电大学 Software defined network (SDN) load balancing method with highest network utility
CN107370676A (en) * 2017-08-03 2017-11-21 中山大学 Fusion QoS and load balancing demand a kind of route selection method
CN109274589A (en) * 2018-08-01 2019-01-25 中国联合网络通信集团有限公司 The method and apparatus of business transmission

Also Published As

Publication number Publication date
CN114827018B (en) 2023-09-08

Similar Documents

Publication Publication Date Title
CN111193666B (en) Applying quality of experience metrics using adaptive machine learning sounding prediction
US7321591B2 (en) Methods and systems for providing differentiated quality of service in a communications system
US9614755B2 (en) Combined hardware/software forwarding mechanism and method
US7430169B2 (en) Retro flow control for arriving traffic in computer networks
EP1705845B1 (en) Load distributing method
KR100757872B1 (en) Congestion occurrence system and method in the network
KR100454502B1 (en) Apparatus for providing QoS on IP router and method for forwarding VoIP traffic
US20060176894A1 (en) Routing method and apparatus for reducing loss of IP packets
US8050259B2 (en) Method and apparatus of precedence identification for real time services
BR112015004565B1 (en) METHOD FOR CLASSIFICATION OF TRAFFIC IN STAGES BETWEEN TERMINAL AND AGGREGATION NODES OF A BROADBAND COMMUNICATIONS SYSTEM AND APPARATUS FOR CLASSIFICATION OF TRAFFIC IN STAGES BETWEEN TERMINAL AND AGGREGATION NODES OF A BROADBAND COMMUNICATIONS SYSTEM
US8306015B2 (en) Technique for identifying RTP based traffic in core routing switches
JP2006506845A (en) How to select a logical link for a packet in a router
JP2013034164A (en) Relay device, and relay method
CN101692657A (en) Differentiated service core router and data forwarding method thereof
US20110022721A1 (en) Method and system for packetizing data for servicing traffic end-to-end
JP2018500851A (en) Method and network node for traffic management in a network node in a packet switched network
JP2018500851A5 (en)
EP1481330A2 (en) Container transport for packets in connection oriented protocols
US6950429B2 (en) IP data transmission network using a route selection based on level 4/5 protocol information
CN114827018B (en) A service category-based SDN routing method, device and electronic equipment
US7804773B2 (en) System and method of managing data flow in a network
WO2021101610A1 (en) Latency guarantee for data packets in a network
Mohammed et al. Comparison of Schecduling Schemes in IPV4 and IPV6 to Achieve High QoS
US11025519B2 (en) Systems, methods and computer-readable media for external non-intrusive packet delay measurement
JP2003298638A (en) Apparatus and method for transmitting packet

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20230908

CF01 Termination of patent right due to non-payment of annual fee