Traffic steering method based on network element detection mechanism and related components
By introducing a network element detection mechanism into the OVN network architecture, configuration information is received and verified, detection packets are encapsulated and sent to the target network element, and its forwarding status is determined based on the response packet. The traffic redirection configuration is dynamically adjusted, which solves the problem that OVN cannot monitor the network element status and achieves stable traffic redirection and service continuity.
Patent Information
- Application Number
- CN202411227994.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2044-09-03
AI Technical Summary
The existing OVN network architecture cannot effectively monitor the status of network elements, resulting in defects in the traffic diversion function, failure to detect network element faults in a timely manner, and thus service interruption.
By receiving and verifying configuration information, encapsulating probe packets and sending them to the target network element, determining its forwarding status based on the response packets from the target network element, and dynamically adjusting the traffic diversion configuration to ensure the stability of traffic diversion, the system includes a configuration information processing module, a probe packet sending module, a forwarding status determination module, and a traffic diversion module.
It enables real-time monitoring and dynamic adjustment of network element status, ensuring that traffic can bypass the faulty network element in a timely manner when the network element fails, thus guaranteeing service stability and traffic escape.
Smart Images

Figure CN119030855B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of network security, in particular to a traffic steering method based on a network element detection mechanism and related components. BACKGROUND
[0002] The steering function steers specific traffic to one or more network elements to filter and analyze the traffic. In the process of steering, the network architecture of OVN (Open Virtual Network, a software system supporting virtual network abstraction) cannot identify the state of the network element. When one or more network elements are down due to some reasons, it will cause traffic loss and service interruption. The network element may only analyze business data, but the abnormal network element affects the business, so it is necessary to monitor the forwarding state of the network element in the application process. The mainstream network state monitoring is to periodically send Ping (Internet Packet Explorer) packets to the network element for detection. However, this method can only monitor whether the network state of the network card of the network element is normal, and cannot detect whether the internal message analysis and forwarding service of the network element are normal. Therefore, this scheme cannot meet the demand of network element state detection. At present, OVN cannot monitor the state of the specified network element, which causes certain defects in the steering function. SUMMARY
[0003] Therefore, it is necessary to provide a traffic steering method based on a network element detection mechanism and related components to solve the problem that the security service steering business cannot perceive the failure of the third-party network element and continues to steer to the failed network element, causing business interruption.
[0004] In a first aspect, a traffic steering method based on a network element detection mechanism is provided. The method comprises:
[0005] receiving and verifying configuration information, wherein the configuration information at least includes network element detection configuration parameters and network element identification information;
[0006] in response to detecting that the configuration information verification is successful and detecting a network element detection request, encapsulating a detection packet based on the configuration information, and sending the detection packet to a target network element;
[0007] determining the forwarding state of the target network element according to the detection packet returned by the target network element;
[0008] in response to detecting that the forwarding state of the target network element is a normal state, issuing the steering configuration of the target network element, and steering traffic to the target network element;
[0009] in response to detecting that the forwarding state of the target network element is an abnormal state, deleting the steering configuration of the target network element.
[0010] Optionally, the receiving and verifying the configuration information comprises:
[0011] receiving the configuration information based on the target network service process;
[0012] detecting whether the target network element exists based on the network element identification information, and detecting whether the network element detection configuration parameter meets the preset standard;
[0013] in response to detecting that the target network element exists and the network element detection configuration parameter meets the preset standard, determining that the configuration information verification is successful;
[0014] in response to detecting that the target network element does not exist and / or the network element detection configuration parameter does not meet the preset standard, determining that the configuration information verification fails, and returning prompt information to the user.
[0015] Optionally, the method further comprises:
[0016] detecting whether the flow guide data table exists in the network service database;
[0017] in response to detecting that the flow guide data table exists in the network service database, writing the configuration information into the flow guide data table, and adding a column in the flow guide data table to record whether flow guiding is performed according to the network element forwarding state;
[0018] in response to detecting that the flow guide data table does not exist in the network service database, creating the flow guide data table when the target network service process starts;
[0019] in response to detecting that the flow guide data table is created successfully, writing the configuration information into the flow guide data table, and adding a column in the flow guide data table to record whether flow guiding is performed according to the network element forwarding state.
[0020] Optionally, based on the configuration information, the method further comprises:
[0021] obtaining data information in the flow guide data table;
[0022] detecting whether the first target data table exists in the first database;
[0023] in response to detecting that the first target data table exists in the first database, writing the data information in the flow guide data table into the first target data table based on the open source switch database management protocol;
[0024] detecting whether the second target data table exists in the second database;
[0025] In response to the detection that a second target data table exists in the second database, the data information in the first target data table is translated to the user-space process of the third database based on the target service process;
[0026] In response to the detection that the data information has been translated, the translated data information is synchronized to the second data table;
[0027] In response to the detection that data synchronization has been completed, the probe packet is encapsulated based on the data information in the second data table;
[0028] In response to the detection that the probe packet encapsulation is complete, the probe packet is sent to the logical port of the target network element.
[0029] Optionally, the method further includes:
[0030] Logical flow tables are added to the logical process synchronously based on the target service process. These logical flow tables are used to identify probe packets.
[0031] In response to the detection of a returned probe packet, the returned probe packet is sent to the target controller via the logic process and generated in the physical flow table.
[0032] Optionally, the method for determining the forwarding status of the target network element includes:
[0033] When a new data is detected in the second data table, a data entry is inserted into the linked list of the state machine corresponding to the target network element, and the current state of the state machine corresponding to the target network element is set to the initial state.
[0034] In response to detecting that the current state of the state machine is the initial state, a probe packet is sent, the current state of the state machine is adjusted to the waiting state, and the time for the next probe packet to be sent is set to the current time plus a first preset time interval;
[0035] In response to detecting that the current state of the state machine is in a waiting state and the waiting time exceeds the preset time, the current state of the state machine is adjusted to an offline state, the cumulative number of failures is incremented by 1, and the time for sending the next probe packet is set to the current time plus the second preset time interval. The waiting time is used to describe the waiting time for receiving the return packet.
[0036] In response to detecting that the current state of the state machine is in a waiting state and receiving a response packet within a preset time, the current state of the state machine is adjusted to an online state, the cumulative number of successful attempts is incremented by 1, and the time for sending the next probe packet is set to the current time plus the second preset time interval.
[0037] in response to detecting that the current time is the probe packet sending time, sending the probe packet and adjusting the current state of the state machine to the waiting state;
[0038] in response to receiving the return packet at any time, adjusting the current state of the state machine to the online state and accumulating the success number + 1.
[0039] Optionally, the method further comprises:
[0040] in response to detecting that the accumulated success number is greater than the first preset threshold, adjusting the forwarding state of the target network element to the normal state and clearing the accumulated success number;
[0041] in response to detecting that the accumulated failure number is greater than the second preset threshold, adjusting the forwarding state of the target network element to the abnormal state and clearing the accumulated failure number.
[0042] In a second aspect, a traffic diversion device based on a network element detection mechanism is provided, and the device comprises:
[0043] a configuration information processing module, configured to receive and verify configuration information, wherein the configuration information at least comprises network element detection configuration parameters and network element identification information;
[0044] a probe packet sending module, configured to, in response to detecting that the configuration information verification is successful and detecting a network element detection request, encapsulate a probe packet based on the configuration information and send the probe packet to a target network element;
[0045] a forwarding state determination module, configured to determine the forwarding state of the target network element according to the probe packet returned by the target network element;
[0046] a traffic diversion module, configured to, in response to detecting that the forwarding state of the target network element is the normal state, issue a diversion configuration of the target network element and introduce traffic into the target network element;
[0047] a deletion module, configured to, in response to detecting that the forwarding state of the target network element is the abnormal state, delete the diversion configuration of the target network element.
[0048] In a third aspect, a computer device is provided, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0049] receiving and verifying configuration information, wherein the configuration information at least comprises network element detection configuration parameters and network element identification information;
[0050] in response to detecting that the configuration information verification is successful and detecting a network element detection request, encapsulating a probe packet based on the configuration information and sending the probe packet to a target network element;
[0051] determining the forwarding state of the target network element according to the probe packet returned by the target network element;
[0052] in response to detecting that the forwarding state of the target network element is a normal state, issuing the flow diversion configuration of the target network element and leading the traffic into the target network element;
[0053] in response to detecting that the forwarding state of the target network element is an abnormal state, deleting the flow diversion configuration of the target network element.
[0054] In a fourth aspect, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. When the computer program is executed by a processor, the following steps are implemented:
[0055] receiving and verifying configuration information, wherein the configuration information at least includes network element probe configuration parameters and network element identification information;
[0056] in response to detecting that the verification of the configuration information is successful and detecting a network element probe request, encapsulating a probe packet based on the configuration information and sending the probe packet to a target network element;
[0057] determining the forwarding state of the target network element according to the probe packet returned by the target network element;
[0058] in response to detecting that the forwarding state of the target network element is a normal state, issuing the flow diversion configuration of the target network element and leading the traffic into the target network element;
[0059] in response to detecting that the forwarding state of the target network element is an abnormal state, deleting the flow diversion configuration of the target network element.
[0060] In a fifth aspect, a computer program product is provided, and the computer program product includes a computer program. When the computer program is executed by a processor, the following steps are implemented:
[0061] receiving and verifying configuration information, wherein the configuration information at least includes network element probe configuration parameters and network element identification information;
[0062] in response to detecting that the verification of the configuration information is successful and detecting a network element probe request, encapsulating a probe packet based on the configuration information and sending the probe packet to a target network element;
[0063] determining the forwarding state of the target network element according to the probe packet returned by the target network element;
[0064] in response to detecting that the forwarding state of the target network element is a normal state, issuing the flow diversion configuration of the target network element and leading the traffic into the target network element;
[0065] In response to detecting that the forwarding state of the target network element is an abnormal state, deleting the flow diversion configuration of the target network element.
[0066] The flow diversion method based on the network element detection mechanism and the related components described above include: receiving and verifying configuration information, which includes at least network element detection configuration parameters and network element identification information; in response to detecting that the configuration information verification is successful and detecting a network element detection request, encapsulating a detection packet based on the configuration information and sending the detection packet to a target network element; determining the forwarding state of the target network element according to the detection packet returned by the target network element; in response to detecting that the forwarding state of the target network element is a normal state, issuing the flow diversion configuration of the target network element and introducing flow into the target network element; and in response to detecting that the forwarding state of the target network element is an abnormal state, deleting the flow diversion configuration of the target network element. The application monitors the network element state, dynamically adjusts the flow diversion strategy in a timely manner while diverting flow, realizes flow escape, and ensures the stability of the service. BRIEF DESCRIPTION OF DRAWINGS
[0067] Figure 1 An application environment diagram of the flow diversion method based on the network element detection mechanism in one embodiment;
[0068] Figure 2 A flowchart of the flow diversion method based on the network element detection mechanism in one embodiment;
[0069] Figure 3 Another flowchart of the flow diversion method based on the network element detection mechanism in one embodiment;
[0070] Figure 4 A state machine running logic diagram of the flow diversion method based on the network element detection mechanism in one embodiment;
[0071] Figure 5 A structural block diagram of the flow diversion device based on the network element detection mechanism in one embodiment;
[0072] Figure 6 An internal structure diagram of the computer device in one embodiment. DETAILED DESCRIPTION
[0073] To make the objectives, technical solutions, and advantages of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0074] It should be understood that in the description of the present application, unless the context clearly requires otherwise, the terms "comprise", "comprising", and the like are to be construed in an inclusive sense as opposed to an exclusive or exhaustive sense; that is to say, in the sense of "including, but not limited to".
[0075] It should also be understood that the terms "first", "second" and the like are used only for descriptive purposes and are not to be construed as indicating or implying relative importance. In addition, in the description of the present application, unless otherwise stated, the meaning of "a plurality" is two or more.
[0076] It should be noted that the terms "S1", "S2" and the like are only for the purpose of describing the steps, and are not specifically intended to indicate the order or sequence, nor to limit the present application, but only for the convenience of describing the method of the present application, and cannot be understood as indicating the order of the steps. In addition, the technical solutions of various embodiments can be combined with each other, but it must be based on the realization of ordinary skilled in the art, when the combination of technical solutions appears contradictory or unachievable, it should be considered that the combination of technical solutions does not exist, nor within the scope of protection required by the present application.
[0077] A mature implementation scheme of the current openstack (open source cloud computing management platform project) community virtualization network is OVN (Open Virtual Network, a software system supporting virtual network abstraction), which has natural distributed advantages. Compared with traditional use of linux bridge (connecting two local area networks with the same protocol), namespace, iptables (IP-Internet Protocol Packet Filtering System) to realize routing, NAT (Network Address Translation), QoS (Quality of Service), the scheme saves the system resource overhead, reduces the network path overhead, and improves the network forwarding efficiency.
[0078] The OVN virtualization network scheme also provides a policy routing function, which can redirect three-layer traffic to a specific destination. Based on this function, by configuring policy routing, the traffic is diverted to a specified service network element to realize monitoring, analysis and filtering of the traffic.
[0079] According to the background art, the existing OVN cannot realize the monitoring of the state of the specified network element, resulting in certain defects in the diversion function.
[0080] To solve the above technical problems, the application provides a traffic diversion method based on a network element detection mechanism and related components, a method for deep detection of a specified network element based on an OVN architecture, which can not only detect the network state of a network card, but also detect the forwarding function of the network element application layer after traffic analysis, can monitor whether the traffic diverted to the network element can be normally transferred out in real time, and when an abnormal network element occurs, can quickly terminate the diversion behavior to the network element according to the need, temporarily skip the network element, and preferentially ensure uninterrupted business to realize safe service diversion traffic escape.
[0081] The traffic diversion method based on the network element detection mechanism provided by the application can be applied to an application environment as shown in Figure 1 . The terminal 102 communicates with a data processing platform arranged on the server 104 through a network, wherein the terminal 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0082] In one embodiment, as shown in Figures 2-3 , a traffic diversion method based on a network element detection mechanism is provided. Taking the terminal in Figure 1 as an example, the method includes the following steps:
[0083] S1: receiving and verifying configuration information, wherein the configuration information at least includes network element detection configuration parameters and network element identification information.
[0084] It should be noted that the present application is mainly applied to the OVN distributed network environment of the openstack open source project. Neutron is one of the core projects of openstack, which provides virtual network functions in a cloud computing environment. Openstack network (neutron) manages the access layer of all virtual network infrastructures (VNI) and physical network infrastructures (PNI) in the openstack environment, and is a bridge for tenant virtual machines to interact with Internet information. It can meet more rich network control through the expansion of plugins and drivers. Neutron-server is the process name of this network service. OVN: OpenVirtualNetwork is a distributed controller, mainly including ovn-controller, ovn-northd and other processes for translation work, and ovn-nb-db, ovn-sb-db and other processes for providing db-server (database server) services. Each process can exist in the form of a cluster to provide high availability protection. OVS: OpenVirtualSwitch is a software-defined layer 2 switch, mainly including ovs-vswithd, ovs-db and other processes. A network element is a network device for traffic analysis and filtering, which can perform statistics and interception on received packets. The data packets allowed to pass through will be forwarded again from the network element. The network element detection configuration parameters can include packet sending interval, timeout time, success times, failure times, probe packet source IP (Internet Protocol), probe packet destination IP, probe packet source port, probe packet destination port, probe packet source MAC (Media Access Control), tolerance failure times, waiting success times, timeout time and detection interval, and the network element identification information can include network card id (identification) and other information.
[0085] In some embodiments, receiving and verifying the configuration information includes:
[0086] Based on the target network service process, receiving configuration information, wherein the target network service process refers to neutron_server, and the configuration information is issued by the user according to the actual demand;
[0087] Based on the network element identification information, detecting whether there is a target network element, and detecting whether the network element detection configuration parameters meet the preset standard, i.e. the neutron_server process needs to verify the configuration issued by the user after receiving the configuration information;
[0088] In response to detecting that there is a target network element and the network element detection configuration parameters meet the preset standard, it is judged that the configuration information verification is successful, wherein the preset standard refers to whether the network element detection configuration parameters are legal.
[0089] In response to detecting that the target network element does not exist and / or the network element detection configuration parameter does not meet the preset standard, it is judged that the configuration information verification fails, and prompt information is returned to the user, that is, if the conditions such as the network element network card already exists and the detection configuration parameter is legal are not met, the user is informed of the failure information.
[0090] In some embodiments, the method further comprises:
[0091] Detecting whether a flow data table exists in a network service database, wherein the network service database refers to a neutron database, that is, a mysql database, and the flow data table refers to a network_elements_health_check table, which is stored in the database of the neutron;
[0092] In response to detecting that the flow data table exists in the network service database, the configuration information is written into the flow data table, and a column is added in the flow data table to record whether flow is performed according to the network element forwarding state;
[0093] In response to detecting that the flow data table does not exist in the network service database, the flow data table is created when the target network service process starts;
[0094] In response to detecting that the flow data table is successfully created, the configuration information is written into the flow data table, and a column is added in the flow data table to record whether flow is performed according to the network element forwarding state.
[0095] The data format of the neutron database is shown in Table 1.
[0096] Table 1: Data format table of the neutron database.
[0097] In the above embodiments, the configuration information issued by the user is used to determine whether the network element state needs to be detected, which improves the flexibility of detection, and the configuration information is used to generate corresponding detection packets for subsequent effective detection of the network element state.
[0098] S2: In response to detecting that the configuration information verification is successful and detecting a network element detection request, a detection packet is encapsulated based on the configuration information, and the detection packet is sent to the target network element.
[0099] It should be noted that the probe packet is a kind of data packet for network diagnosis and test, the target network element refers to a network element that needs to be probed; the network element probe request refers to whether the network element state probe is configured according to the actual situation when the user configures the flow diversion strategy, if the network element state probe is needed, the network element probe request is generated, if the network element state probe is not needed, the flow diversion strategy route is written into the OVN northbound database, and the flow diversion logic flow table is translated and written into the ovn-sb-db, and a new logistics flow table is added to divert the specified traffic.
[0100] In some embodiments, based on the configuration information, the probe packet is encapsulated, and the probe packet is sent to the target network element, comprising:
[0101] Obtaining data information in the flow diversion data table;
[0102] Detecting whether the first target data table exists in the first database, wherein the first database refers to the ovn northbound database, and the first target data table refers to a specified data table in the ovn northbound database;
[0103] In response to detecting that the first target data table exists in the first database, based on the open source switch database management protocol, the data information in the flow diversion data table is written into the first target data table, wherein the open source switch database management protocol refers to the ovsdb protocol, and the ovn northbound database adds a table and data format as follows:
[0104] Detecting whether the second target data table exists in the second database, wherein the second database refers to the ovn-sb-db, and the second target data table refers to the Network_Element_Monitor table;
[0105] In response to detecting that the second target data table exists in the second database, based on the target service process, the data information in the first target data table is translated to the user state process of the third database, wherein the target service process refers to the ovn-north process, and the third database refers to the southbound database, that is, the ovn-north process is a user state process for monitoring the data change of the ovn northbound database and translating the corresponding information to the southbound database, and the monitoring and translation function of the Network_Element_Health_Check table needs to be added, and the data is synchronized to the Network_Element_Monitor table in the ovn-sb-db;
[0106] In response to detecting that the data information has been translated, the translated data information is synchronized into the second data table, wherein the table structure of the Network_Element_Monitor table is as follows:
[0107]
[0108] In response to detecting that the data information has been synchronized, the probe packet is encapsulated based on the data information in the second data table, wherein the probe packet is encapsulated by the target controller ovn-controller based on the Network_Element_Monitor data of the ovn-sb-db.
[0109] In response to detecting that the probe packet has been encapsulated, the probe packet is sent to the logical port of the target network element, wherein the logical port of the target network element refers to the logical_port of the network element.
[0110] In some embodiments, the method further comprises:
[0111] Based on the target service process, a logical flow table for identifying the probe packet is added to the logical process, wherein the logical process refers to the logical_flows, that is, the logical flow table for identifying the probe packet is added to the logical_flows based on the ovn-northd, and is used to send the probe packet returned by the target network element back to the ovn-controller.
[0112] In response to identifying the returned probe packet, the returned probe packet is sent to the corresponding flow table of the target controller based on the logical process to generate a physical flow table, so as to send the returned probe packet to the target controller, that is, the flow table in the logical_flows for sending the probe packet returned by the network element back to the ovn-controller is generated to the physical flow table of the ovs, in addition, the ovn-controller monitors the update of the southbound database and then adds the corresponding flow table to the physical flow table of the ovs, which are respectively used to upload the returned probe packet and the updated data.
[0113] In the above embodiments, the corresponding probe packet is generated based on the configuration information that passes the verification, so as to detect the state of the network element, thereby improving the accuracy of the network element state detection.
[0114] S3: Determine the forwarding state of the target network element according to the probe packet returned by the target network element.
[0115] It should be noted that the forwarding state of the target network element can include a normal state (online) and an abnormal state (offline), the forwarding state of the target network element can be determined according to the sending and receiving of the probe packet, and the ovn-controller needs to serve as a state machine to determine the state of the network element according to the sending and receiving of the probe packet.
[0116] In some embodiments, as shown in Figure 4 The method for determining the forwarding state of the target network element includes:
[0117] In response to detecting that there is new data in the second data table, a data record is inserted into the linked list of the state machine corresponding to the target network element, and the current state of the state machine corresponding to the target network element is set to an initial state, that is, when the ovn-controller finds that there is new data in the Network_Element_Monitor table of the ovn-sb-db, a data record is inserted into the linked list of the state machine, and the state of the data record is set to init (initial state), the state is the current state of the state machine of the network element, and the network elements are independent of each other;
[0118] In response to detecting that the current state of the state machine is the initial state, a probe packet is sent, the current state of the state machine is adjusted to a waiting state, and the time for sending the probe packet next time is set to the current time plus a first preset time interval, wherein the first preset time interval refers to a timeout (timeout), which is a value that is set by a user in advance according to actual needs when a configuration is issued, that is, when the state of the state machine in the running is init, a probe packet is sent, the state is updated to waitting (waiting state), and the time for running next time is set to the current time plus the timeout, that is, when the state machine is in the waiting state, the interval time for sending the probe packet is the timeout;
[0119] In response to detecting that the current state of the state machine is the waiting state and the waiting duration exceeds a preset duration, the current state of the state machine is adjusted to an offline state, the number of failures is accumulated by 1, and the time for sending the probe packet next time is set to the current time plus a second preset time interval, wherein the waiting duration is used to describe the waiting time for receiving the response packet, the preset duration is a maximum waiting time set by the user, and the second preset time interval is interval, which is set by the user in advance according to actual needs when the configuration is issued, that is, when the state of the state machine in the running is waitting, if the current time is greater than the recorded maximum waiting time, it means that the timeout has occurred, the state is updated to offline (offline state), and the number of failures is accumulated by 1, if the current time is not up, the waiting continues, and when the state machine is in the offline state, the interval time for sending the probe packet is the second preset time interval;
[0120] In response to detecting that the current state of the state machine is the waiting state and receiving the return packet within the preset time length, i.e., successfully receiving the returned probe packet within the waiting time, adjusting the current state of the state machine to the online state, accumulating the success number by 1, and setting the next sending time of the probe packet as the current time plus the second preset time interval;
[0121] In response to detecting that the current time is the sending time of the probe packet, sending the probe packet, and adjusting the current state of the state machine to the waiting state, i.e., sending the probe packet when reaching the sending time of the probe packet corresponding to each state regardless of the current state of the state machine;
[0122] In response to receiving the return packet at any time, adjusting the current state of the state machine to the online state, and accumulating the success number by 1, i.e., updating the state machine state to online and accumulating the success number by 1 when the ovn-controller receives the return packet.
[0123] In some embodiments, the method further comprises:
[0124] In response to detecting that the accumulated success number is greater than the first preset threshold, adjusting the forwarding state of the target network element to the normal state, and clearing the accumulated success number;
[0125] In response to detecting that the accumulated failure number is greater than the second preset threshold, adjusting the forwarding state of the target network element to the abnormal state, and clearing the accumulated failure number.
[0126] The first preset threshold and the second preset threshold can be set according to actual needs, adjusting the forwarding state of the target network element to the abnormal state means updating the status of the ovs-sb-db network element to offline, adjusting the forwarding state of the target network element to the normal state means updating the status of the ovs-sb-db network element to online, and the network element state judgment result is synchronized to the Network_Element_Monitor table, so as to determine whether to issue the policy routing configuration of the flow diversion according to the change (status) of the network element state in the Network_Element_Monitor table by the neutron_server.
[0127] In the above embodiments, the network element state detection mechanism and the dynamic flow diversion configuration mechanism are used to realize flow escape and ensure the stability of the service.
[0128] S4: In response to detecting that the forwarding state of the target network element is the normal state, issuing the flow diversion configuration of the target network element, and introducing the flow into the target network element.
[0129] It should be noted that the step is specifically: when the state machine running state is online, if the cumulative success number is greater than the set success number (success_count), it indicates that the forwarding state of the network element is normal, the status of the ovs-sb-db network element is updated to online, and the cumulative success number is cleared. At this time, the traffic steering policy route (i.e. traffic steering configuration) is written into the OVN northbound database, and translated into a traffic steering logical flow table and written into the ovs-sb-db, and a new logistics flow table is added to steer the specified traffic, thereby steering the specified traffic.
[0130] S5: In response to detecting that the forwarding state of the target network element is an abnormal state, deleting the traffic steering configuration of the target network element.
[0131] It should be noted that the step is specifically: when the state machine running state is offline, if the cumulative failure number is greater than the set failure number (failure_count), it indicates that the forwarding state of the network element is abnormal, the status of the ovs-sb-db network element is updated to offline, and the cumulative failure number is cleared. At this time, the traffic steering policy route of the OVN northbound database is deleted, the logical flow table and the physical flow table of the traffic steering are deleted, and the traffic steering is stopped.
[0132] In the above embodiment, when the forwarding state of the network element changes, it is dynamically determined whether to issue the traffic steering policy route according to the actual forwarding state of the network element. When the forwarding state of the network element is normal, the traffic steering configuration configured by the user is issued to steer specific traffic to the network element for traffic analysis. When the forwarding state of the network element is abnormal, the traffic steering policy route is deleted, and the traffic steering to the network element is stopped, so that the traffic jumps over the faulty network element without affecting the normal service, realizing traffic escape and ensuring the stability of the service.
[0133] In some specific embodiments, after detecting that the forwarding state of the target network element is an abnormal state, the method further includes:
[0134] Recording the number of times that the target network element is in an abnormal state;
[0135] If the number of times that the target network element is detected to be in an abnormal state within a preset time period is greater than a third preset threshold value, a time point value of the target network element being in an abnormal state is obtained, wherein the preset time period can be set according to actual needs, such as 24 hours, and the third preset threshold value can be set according to actual needs, such as 10 times.
[0136] Based on the time point value, a target time period is determined, wherein the target time period can be generated according to the interval time before and after the time point value, such as 3:15 for the time point and 5 minutes for the time interval, and the target time period is 3:10 to 3:20.
[0137] In response to detecting that the target network element is in an abnormal state for more than a fourth preset threshold number of times within a preset time period, the target network element is marked based on a target time period, wherein the fourth preset threshold can be set according to actual needs, such as 5 times, and the preset time period can be set according to actual needs, such as 7 days in a week.
[0138] If the current time is in the target time period, the policy route of the flow is deleted, and the flow is stopped from being introduced to the target network element until the next update period, and the flow is recalculated to determine whether the target network element is removed from the mark, wherein the update period can be set according to actual needs, such as a month.
[0139] In the above embodiment, by predicting the time when the target network element fails, the flow to the target network element can be stopped in advance, the flow can be skipped through the network element that may fail, the normal business is not affected, the flow escape is realized, the computing resources are saved, and the stability of the business is further ensured.
[0140] In the above flow introduction method based on the network element detection mechanism, the method includes: receiving and verifying configuration information, the configuration information at least including network element detection configuration parameters and network element identification information; in response to detecting that the configuration information verification is successful and detecting a network element detection request, based on the configuration information, a detection packet is encapsulated, and the detection packet is sent to a target network element; the forwarding state of the target network element is determined according to the detection packet returned by the target network element; in response to detecting that the forwarding state of the target network element is a normal state, the flow introduction configuration of the target network element is issued, and the flow is introduced into the target network element; in response to detecting that the forwarding state of the target network element is an abnormal state, the flow introduction configuration of the target network element is deleted. In the network environment of the openstack open source project OVN, the present application does not change the original flow architecture design, but adds network element state detection technology to the ovn-controller and adds dynamic flow introduction configuration technology to the neutron-server, realizes the flow escape function, maintains the OVN architecture design concept, and enriches the function of the open source project, so that the network element state is monitored, the flow is introduced at the same time, the flow introduction strategy is dynamically adjusted in time, the flow escape is realized, and the stability of the business is ensured.
[0141] It should be understood that, although Figures 2-4 The steps in the flowchart of the method are shown in sequence according to the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this article, the execution of these steps has no strict order limitation, and these steps can be executed in other orders. Moreover, Figures 2-4At least one of the steps in the method can comprise a plurality of sub-steps or stages, which are not necessarily performed at the same time, but can be performed at different times, and the order of the sub-steps or stages is not necessarily sequential, but can be performed alternately or in rotation with other steps or sub-steps or stages of other steps.
[0142] In one embodiment, as shown in Figure 5 A traffic steering device based on a network element detection mechanism is provided, comprising: a configuration information processing module, a detection packet sending module, a forwarding state determining module, a traffic steering module and a deleting module, wherein:
[0143] The configuration information processing module is configured to receive and verify configuration information, wherein the configuration information comprises at least network element detection configuration parameters and network element identification information;
[0144] The detection packet sending module is configured to, when detecting that the configuration information verification is successful and detecting a network element detection request, encapsulate a detection packet based on the configuration information, and send the detection packet to a target network element;
[0145] The forwarding state determining module is configured to determine the forwarding state of the target network element according to a detection packet returned by the target network element;
[0146] The traffic steering module is configured to, when detecting that the forwarding state of the target network element is a normal state, issue a steering configuration of the target network element, and introduce traffic into the target network element;
[0147] The deleting module is configured to, when detecting that the forwarding state of the target network element is an abnormal state, delete the steering configuration of the target network element.
[0148] As a more preferred embodiment, in the embodiment of the present application, the configuration information processing module is specifically configured to:
[0149] receive configuration information based on a target network service process;
[0150] detect whether a target network element exists based on the network element identification information, and detect whether the network element detection configuration parameters meet preset standards;
[0151] in response to detecting that the target network element exists and the network element detection configuration parameters meet the preset standards, determine that the configuration information verification is successful;
[0152] in response to detecting that the target network element does not exist and / or the network element detection configuration parameters do not meet the preset standards, determine that the configuration information verification fails, and return prompt information to a user.
[0153] As a preferred implementation, the configuration information processing module is further configured to:
[0154] detect whether a diversion data table exists in the network service database;
[0155] in response to detecting that the diversion data table exists in the network service database, write the configuration information into the diversion data table, and add a column in the diversion data table to record whether diversion is performed according to the forwarding state of the network element;
[0156] in response to detecting that the diversion data table does not exist in the network service database, create the diversion data table when the target network service process is started;
[0157] in response to detecting that the diversion data table is created successfully, write the configuration information into the diversion data table, and add a column in the diversion data table to record whether diversion is performed according to the forwarding state of the network element.
[0158] As a preferred implementation, the detection packet sending module is specifically configured to:
[0159] obtain data information in the diversion data table;
[0160] detect whether a first target data table exists in a first database;
[0161] in response to detecting that the first target data table exists in the first database, write the data information in the diversion data table into the first target data table based on an open source switch database management protocol;
[0162] detect whether a second target data table exists in a second database;
[0163] in response to detecting that the second target data table exists in the second database, translate the data information in the first target data table to a user mode process of a third database based on a target service process;
[0164] in response to detecting that the data information has been translated, synchronize the translated data information to the second data table;
[0165] in response to detecting that the data information has been synchronized, encapsulate the detection packet based on the data information in the second data table;
[0166] in response to detecting that the detection packet is encapsulated, send the detection packet to a logical port of a target network element.
[0167] As a preferred implementation, the detection packet sending module is further configured to:
[0168] Synchronize the logical flow table to the logical process based on the target service process, and the logical flow table is used for identifying the probe packet;
[0169] In response to identifying the returned probe packet, send the returned probe packet to the flow table corresponding to the target controller based on the logical process and generate the physical flow table to send the returned probe packet to the target controller.
[0170] As a preferred embodiment, the forwarding state determining module is specifically configured to:
[0171] In response to detecting that there is new data in the second data table, insert a data in the chain table of the state machine corresponding to the target network element, and set the current state of the state machine corresponding to the target network element as the initial state;
[0172] In response to detecting that the current state of the state machine is the initial state, send the probe packet, adjust the current state of the state machine to the waiting state, and set the next sending time of the probe packet as the current time plus the first preset time interval;
[0173] In response to detecting that the current state of the state machine is the waiting state and the waiting time exceeds the preset time, adjust the current state of the state machine to the offline state, accumulate the failure number by 1, and set the next sending time of the probe packet as the current time plus the second preset time interval, wherein the waiting time is used to describe the waiting time of receiving the return packet;
[0174] In response to detecting that the current state of the state machine is the waiting state and the return packet is received within the preset time, adjust the current state of the state machine to the online state, accumulate the success number by 1, and set the next sending time of the probe packet as the current time plus the second preset time interval;
[0175] In response to detecting that the current time is the sending time of the probe packet, send the probe packet, and adjust the current state of the state machine to the waiting state;
[0176] In response to receiving the return packet at any time, adjust the current state of the state machine to the online state, and accumulate the success number by 1.
[0177] As a preferred embodiment, the forwarding state determining module is specifically configured to:
[0178] In response to detecting that the accumulated success number is greater than the first preset threshold, adjust the forwarding state of the target network element to the normal state, and clear the accumulated success number;
[0179] In response to detecting that the accumulated failure number is greater than the second preset threshold, adjust the forwarding state of the target network element to the abnormal state, and clear the accumulated failure number.
[0180] The specific definition of the traffic steering device based on the network element detection mechanism can refer to the definition of the traffic steering method based on the network element detection mechanism in the foregoing, and will not be described here. Each module in the traffic steering device based on the network element detection mechanism can be implemented by software, hardware, or a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so that the processor calls and executes the operations corresponding to each module.
[0181] In one embodiment, a computer device, which can be a terminal, has an internal structure diagram as shown in Figure 6 The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is configured to communicate with external terminals through a network connection. The computer program is executed by the processor to implement a traffic steering method based on a network element detection mechanism. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball, or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0182] Those skilled in the art can understand that Figure 6 The structure shown in the foregoing is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the diagram, or combine certain components, or have a different arrangement of components.
[0183] In one embodiment, a computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor implements the following steps when executing the computer program:
[0184] S1: receiving and verifying configuration information, wherein the configuration information includes at least network element detection configuration parameters and network element identification information;
[0185] S2: in response to detecting that the configuration information verification is successful and detecting a network element detection request, encapsulating a detection packet based on the configuration information, and sending the detection packet to a target network element;
[0186] S3: determining the forwarding state of the target network element according to the probe packet returned by the target network element;
[0187] S4: in response to detecting that the forwarding state of the target network element is a normal state, issuing the flow diversion configuration of the target network element and leading the traffic into the target network element;
[0188] S5: in response to detecting that the forwarding state of the target network element is an abnormal state, deleting the flow diversion configuration of the target network element.
[0189] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0190] receiving configuration information based on a target network service process;
[0191] detecting whether there is a target network element based on the network element identification information, and detecting whether the network element probe configuration parameter meets a preset standard;
[0192] in response to detecting that there is a target network element and the network element probe configuration parameter meets the preset standard, judging that the configuration information verification is successful;
[0193] in response to detecting that there is no target network element and / or the network element probe configuration parameter does not meet the preset standard, judging that the configuration information verification fails, and returning prompt information to a user.
[0194] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0195] detecting whether there is a flow diversion data table in a network service database;
[0196] in response to detecting that there is a flow diversion data table in the network service database, writing the configuration information into the flow diversion data table, and adding a column in the flow diversion data table to record whether flow diversion is performed according to the network element forwarding state;
[0197] in response to detecting that there is no flow diversion data table in the network service database, creating the flow diversion data table when the target network service process starts;
[0198] in response to detecting that the flow diversion data table is created successfully, writing the configuration information into the flow diversion data table, and adding a column in the flow diversion data table to record whether flow diversion is performed according to the network element forwarding state.
[0199] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0200] obtaining data information in the flow diversion data table;
[0201] detecting whether a first target data table exists in a first database;
[0202] in response to detecting that the first target data table exists in the first database, writing data information in the diversion data table into the first target data table based on an open source switch database management protocol;
[0203] detecting whether a second target data table exists in a second database;
[0204] in response to detecting that the second target data table exists in the second database, translating data information in the first target data table to a user mode process of a third database based on a target service process;
[0205] in response to detecting that the data information has been completely translated, synchronizing the translated data information to the second data table;
[0206] in response to detecting that the data information has been completely synchronized, encapsulating the probe packet based on the data information in the second data table;
[0207] in response to detecting that the probe packet has been completely encapsulated, sending the probe packet to a logical port of a target network element.
[0208] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0209] synchronously adding a logical flow table based on a target service process to a logical process, the logical flow table being used for identifying a probe packet;
[0210] in response to identifying the returned probe packet, sending the returned probe packet to a flow table corresponding to a target controller based on the logical process to generate a physical flow table, so as to send the returned probe packet to the target controller.
[0211] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0212] in response to detecting that there is new data in the second data table, inserting a data item in a linked list of a state machine corresponding to a target network element, and setting a current state of the state machine corresponding to the target network element to an initial state;
[0213] in response to detecting that the current state of the state machine is the initial state, sending a probe packet, and adjusting the current state of the state machine to a waiting state, and setting a next sending time of the probe packet to a current time plus a first preset time interval;
[0214] adjusting the current state of the state machine to the offline state, incrementing the failure count by 1, and setting the next sending time of the probe packet to the current time plus the second preset time interval, in response to detecting that the current state of the state machine is the waiting state and the waiting time exceeds the preset time;
[0215] adjusting the current state of the state machine to the online state, incrementing the success count by 1, and setting the next sending time of the probe packet to the current time plus the second preset time interval, in response to detecting that the current state of the state machine is the waiting state and the probe packet is received within the preset time;
[0216] sending the probe packet and adjusting the current state of the state machine to the waiting state, in response to detecting that the current time is the sending time of the probe packet;
[0217] adjusting the current state of the state machine to the online state and incrementing the success count by 1, in response to receiving the probe packet at any time.
[0218] In one embodiment, the processor further implements the following steps when executing the computer program:
[0219] adjusting the forwarding state of the target network element to the normal state and clearing the success count, in response to detecting that the success count is greater than the first preset threshold;
[0220] adjusting the forwarding state of the target network element to the abnormal state and clearing the failure count, in response to detecting that the failure count is greater than the second preset threshold.
[0221] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the following steps:
[0222] S1: receiving and verifying configuration information, wherein the configuration information at least includes network element detection configuration parameters and network element identification information;
[0223] S2: encapsulating a probe packet based on the configuration information and sending the probe packet to a target network element, in response to detecting that the configuration information verification is successful and detecting a network element detection request;
[0224] S3: determining the forwarding state of the target network element according to the probe packet returned by the target network element;
[0225] S4: issuing a flow diversion configuration of the target network element and diverting traffic to the target network element, in response to detecting that the forwarding state of the target network element is the normal state;
[0226] S5: deleting the flow diversion configuration of the target network element, in response to detecting that the forwarding state of the target network element is the abnormal state.
[0227] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0228] receiving configuration information based on a target network service process;
[0229] detecting whether a target network element exists based on the network element identification information, and detecting whether the network element detection configuration parameter meets a preset standard;
[0230] in response to detecting that the target network element exists and the network element detection configuration parameter meets the preset standard, determining that the configuration information verification is successful;
[0231] in response to detecting that the target network element does not exist and / or the network element detection configuration parameter does not meet the preset standard, determining that the configuration information verification fails, and returning prompt information to a user.
[0232] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0233] detecting whether a flow diversion data table exists in a network service database;
[0234] in response to detecting that the flow diversion data table exists in the network service database, writing the configuration information into the flow diversion data table, and adding a column in the flow diversion data table to record whether flow diversion is performed according to a network element forwarding state;
[0235] in response to detecting that the flow diversion data table does not exist in the network service database, creating the flow diversion data table when the target network service process starts;
[0236] in response to detecting that the flow diversion data table is created successfully, writing the configuration information into the flow diversion data table, and adding a column in the flow diversion data table to record whether flow diversion is performed according to a network element forwarding state.
[0237] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0238] obtaining data information in the flow diversion data table;
[0239] detecting whether a first target data table exists in a first database;
[0240] in response to detecting that the first target data table exists in the first database, writing the data information in the flow diversion data table into the first target data table based on an open source switch database management protocol;
[0241] detecting whether a second target data table exists in a second database;
[0242] in response to detecting that the second target data table exists in the second database, translating data information in the first target data table to a user mode process of a third database based on a target service process;
[0243] in response to detecting that the data information has been translated, synchronizing the translated data information to the second data table;
[0244] in response to detecting that the data information has been synchronized, encapsulating the probe packet based on the data information in the second data table;
[0245] in response to detecting that the probe packet has been encapsulated, sending the probe packet to a logical port of a target network element.
[0246] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0247] synchronously adding a logical flow table to the logical process based on the target service process, the logical flow table being used for identifying the probe packet;
[0248] in response to identifying the returned probe packet, sending the returned probe packet to a flow table corresponding to the target controller in the physical flow table based on the logical process, so as to send the returned probe packet to the target controller.
[0249] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0250] in response to detecting that there is new data in the second data table, inserting a data item in a linked list of a state machine corresponding to the target network element, and setting a current state of the state machine corresponding to the target network element to an initial state;
[0251] in response to detecting that the current state of the state machine is the initial state, sending the probe packet, adjusting the current state of the state machine to a waiting state, and setting a next sending time of the probe packet to a current time plus a first preset time interval;
[0252] in response to detecting that the current state of the state machine is the waiting state and a waiting duration exceeds a preset duration, adjusting the current state of the state machine to an offline state, accumulating a failure number + 1, and setting the next sending time of the probe packet to the current time plus a second preset time interval, the waiting duration being used to describe a waiting time for receiving the returned packet;
[0253] in response to detecting that the current state of the state machine is the waiting state and the returned packet is received within the preset duration, adjusting the current state of the state machine to an online state, accumulating a success number + 1, and setting the next sending time of the probe packet to the current time plus the second preset time interval;
[0254] S1: receiving and verifying configuration information, wherein the configuration information at least includes network element detection configuration parameters and network element identification information;
[0255] S3: adjusting the current state of the state machine to the online state and accumulating the success number +1 in response to receiving the return packet at any time.
[0256] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0257] S2: adjusting the forwarding state of the target network element to the normal state and clearing the accumulated success number in response to detecting that the accumulated success number is greater than the first preset threshold.
[0258] S2: adjusting the forwarding state of the target network element to the normal state and clearing the accumulated success number in response to detecting that the accumulated success number is greater than the first preset threshold.
[0259] In one embodiment, a computer program product is provided, and the computer program product includes a computer program, which, when executed by the processor, implements the following steps:
[0260] S1: receiving and verifying configuration information, wherein the configuration information at least includes network element detection configuration parameters and network element identification information;
[0261] S2: encapsulating a detection packet based on the configuration information and sending the detection packet to a target network element in response to detecting that the configuration information verification is successful and detecting a network element detection request;
[0262] S3: determining the forwarding state of the target network element according to the detection packet returned by the target network element;
[0263] S4: issuing a flow diversion configuration of the target network element and introducing traffic into the target network element in response to detecting that the forwarding state of the target network element is a normal state.
[0264] S5: deleting the flow diversion configuration of the target network element in response to detecting that the forwarding state of the target network element is an abnormal state.
[0265] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0266] S1: receiving and verifying configuration information, wherein the configuration information at least includes network element detection configuration parameters and network element identification information;
[0267] S2: encapsulating a detection packet based on the configuration information and sending the detection packet to a target network element in response to detecting that the configuration information verification is successful and detecting a network element detection request;
[0268] S2: encapsulating a detection packet based on the configuration information and sending the detection packet to a target network element in response to detecting that the configuration information verification is successful and detecting a network element detection request;
[0269] In response to detecting that the target network element does not exist and / or the network element probe configuration parameter does not meet the preset standard, determining that the configuration information verification fails, and returning prompt information to the user.
[0270] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0271] Detecting whether a diversion data table exists in the network service database;
[0272] In response to detecting that the diversion data table exists in the network service database, writing the configuration information into the diversion data table, and adding a column in the diversion data table to record whether diversion is performed according to the network element forwarding state;
[0273] In response to detecting that the diversion data table does not exist in the network service database, creating the diversion data table when the target network service process is started;
[0274] In response to detecting that the diversion data table is created successfully, writing the configuration information into the diversion data table, and adding a column in the diversion data table to record whether diversion is performed according to the network element forwarding state.
[0275] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0276] Obtaining data information in the diversion data table;
[0277] Detecting whether a first target data table exists in the first database;
[0278] In response to detecting that the first target data table exists in the first database, writing the data information in the diversion data table into the first target data table based on an open source switch database management protocol;
[0279] Detecting whether a second target data table exists in the second database;
[0280] In response to detecting that the second target data table exists in the second database, translating the data information in the first target data table to a user mode process of the third database based on a target service process;
[0281] In response to detecting that the data information has been translated, synchronizing the translated data information to the second data table;
[0282] In response to detecting that the data information has been synchronized, encapsulating the probe packet based on the data information in the second data table;
[0283] In response to detecting that the probe packet encapsulation is completed, the probe packet is sent to a logical port of a target network element.
[0284] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0285] Based on the target service process synchronization, a logical flow table for identifying the probe packet is added into the logical process;
[0286] In response to identifying the returned probe packet, the returned probe packet is sent to a flow table corresponding to the target controller based on the logical process and generated into a physical flow table, so as to send the returned probe packet to the target controller.
[0287] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0288] In response to detecting that there is new data in the second data table, a data is inserted into a chain table of a state machine corresponding to the target network element, and a current state of the state machine corresponding to the target network element is set as an initial state;
[0289] In response to detecting that the current state of the state machine is the initial state, the probe packet is sent, the current state of the state machine is adjusted to a waiting state, and a next sending time of the probe packet is set as the current time plus a first preset time interval;
[0290] In response to detecting that the current state of the state machine is the waiting state and a waiting duration exceeds a preset duration, the current state of the state machine is adjusted to an offline state, a failure count is accumulated by 1, and the next sending time of the probe packet is set as the current time plus a second preset time interval, the waiting duration being used to describe a waiting time for receiving the returned packet;
[0291] In response to detecting that the current state of the state machine is the waiting state and the returned packet is received within the preset duration, the current state of the state machine is adjusted to an online state, a success count is accumulated by 1, and the next sending time of the probe packet is set as the current time plus the second preset time interval;
[0292] In response to detecting that the current time is the sending time of the probe packet, the probe packet is sent, and the current state of the state machine is adjusted to the waiting state;
[0293] In response to receiving the returned packet at any time, the current state of the state machine is adjusted to the online state, and the success count is accumulated by 1.
[0294] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0295] In response to detecting that the success count is greater than a first preset threshold, a forwarding state of the target network element is adjusted to a normal state, and the success count is cleared.
[0296] In response to detecting that the accumulated failure number is greater than the second preset threshold, adjusting the forwarding state of the target network element to an abnormal state, and clearing the accumulated failure number.
[0297] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware, and the computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments of each method. Any reference to memory, storage, database or other medium used in each embodiment provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0298] Each technical feature of the above embodiments can be combined arbitrarily. In order to make the description simple, each technical feature in the above embodiments is not described in all possible combinations, but as long as the combination of these technical features does not exist, it should be considered as the scope of the present application.
[0299] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are within the scope of the present application.
Claims
1. A traffic steering method based on a network element probing mechanism, characterized in that, The method comprises: receiving and verifying configuration information, wherein the configuration information comprises at least network element detection configuration parameters and network element identification information; in response to detecting that the configuration information verification is successful and detecting a network element detection request, encapsulating a detection packet based on the configuration information, and sending the detection packet to a target network element; determining the forwarding state of the target network element according to a detection packet returned by the target network element; in response to detecting that the forwarding state of the target network element is a normal state, issuing a flow diversion configuration of the target network element, and diverting traffic to the target network element; in response to detecting that the forwarding state of the target network element is an abnormal state, deleting the flow diversion configuration of the target network element; the method for determining the forwarding state of the target network element comprises: in response to detecting that there is new data in a second data table, inserting a data item in a linked list of a state machine corresponding to the target network element, and setting the current state of the state machine corresponding to the target network element to an initial state; in response to detecting that the current state of the state machine is the initial state, sending a detection packet, adjusting the current state of the state machine to a waiting state, and setting the time for sending the next detection packet to the current time plus a first preset time interval; in response to detecting that the current state of the state machine is the waiting state and the waiting time exceeds a preset time length, adjusting the current state of the state machine to an offline state, accumulating the number of failures by 1, and setting the time for sending the next detection packet to the current time plus a second preset time interval, wherein the waiting time is used to describe the waiting time for receiving a return packet; in response to detecting that the current state of the state machine is the waiting state and a return packet is received within the preset time length, adjusting the current state of the state machine to an online state, accumulating the number of successes by 1, and setting the time for sending the next detection packet to the current time plus the second preset time interval; in response to detecting that the current time is the detection packet sending time, sending a detection packet, and adjusting the current state of the state machine to the waiting state; in response to receiving a return packet at any time, adjusting the current state of the state machine to the online state, and accumulating the number of successes by 1.
2. The traffic steering method based on network element probing mechanism according to claim 1, characterized in that, The method further comprises: receiving and verifying configuration information comprises: receiving configuration information based on a target network service process; detecting whether there is a target network element based on the network element identification information, and detecting whether the network element detection configuration parameters meet preset standards; in response to detecting that there is a target network element and the network element detection configuration parameters meet the preset standards, determining that the configuration information verification is successful; 3.The traffic steering method based on the network element probing mechanism according to claim 1, characterized in that, in response to detecting that there is no target network element and / or the network element detection configuration parameters do not meet the preset standards, determining that the configuration information verification fails, and returning prompt information to the user. The method further comprises: detecting whether there is a flow diversion data table in a network service database; in response to detecting that there is a flow diversion data table in the network service database, writing the configuration information into the flow diversion data table, and adding a column in the flow diversion data table to record whether flow diversion is performed according to the network element forwarding state; in response to detecting that there is no flow diversion data table in the network service database, creating a flow diversion data table when the target network service process is started. In response to detecting that the data table creation is successful, the configuration information is written into the data table, and a column is added in the data table to record whether the data is forwarded according to the forwarding state of the network element.
4. The traffic steering method based on network element probing mechanism according to claim 3, characterized in that, Based on the configuration information, a probe packet is encapsulated, and the probe packet is sent to the target network element, including: Obtaining data information in the data table; Detecting whether a first target data table exists in the first database; In response to detecting that the first target data table exists in the first database, based on the open source switch database management protocol, the data information in the data table is written into the first target data table; Detecting whether a second target data table exists in the second database; In response to detecting that the second target data table exists in the second database, based on the target service process, the data information in the first target data table is translated to a user mode process of the third database; In response to detecting that the data information has been translated, the translated data information is synchronized to the second data table; In response to detecting that the data information has been synchronized, based on the data information in the second data table, the probe packet is encapsulated; In response to detecting that the probe packet is encapsulated, the probe packet is sent to a logical port of the target network element.
5. The traffic steering method based on network element probing mechanism according to claim 4, characterized in that, The method further includes: Based on the target service process, a logical flow table is added to the logical process, and the logical flow table is used to identify the probe packet; In response to identifying the returned probe packet, based on the logical process, the returned probe packet is sent to a logical flow table corresponding to the target controller to generate a physical flow table, so that the returned probe packet is sent to the target controller.
6. The traffic steering method based on network element probing mechanism according to claim 1, wherein, The method further includes: In response to detecting that the cumulative success number is greater than a first preset threshold, the forwarding state of the target network element is adjusted to a normal state, and the cumulative success number is cleared; In response to detecting that the cumulative failure number is greater than a second preset threshold, the forwarding state of the target network element is adjusted to an abnormal state, and the cumulative failure number is cleared.
7. A mechanism for implementing the traffic steering method based on network element probing mechanism as claimed in claim 1, characterized in that, The device includes: A configuration information processing module for receiving and verifying configuration information, the configuration information including at least network element probe configuration parameters and network element identification information; A probe packet sending module for, in response to detecting that the configuration information verification is successful and detecting a network element probe request, encapsulating a probe packet based on the configuration information, and sending the probe packet to a target network element; A forwarding state determination module for determining the forwarding state of the target network element according to the probe packet returned by the target network element; A traffic diversion module for, in response to detecting that the forwarding state of the target network element is a normal state, issuing a diversion configuration of the target network element, and diverting traffic to the target network element; A deletion module for, in response to detecting that the forwarding state of the target network element is an abnormal state, deleting the diversion configuration of the target network element.
8. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the method of any one of claims 1 to 6.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1 to 6.
Citation Information
Patent Citations
Flow lead method and device based on nonstandard open shortest path first (OSPF) routing protocol
CN103001880A
Drainage strategy configuration result test method, device and equipment
CN110673995A