Traffic drainage method based on network element detection mechanism and related components
By adopting a traffic drainage method based on the network element detection mechanism in the OVN network architecture, the problem that OVN cannot monitor the network element status is solved, and the deep monitoring and real-time perception of the network element status is realized, and the drainage configuration is dynamically adjusted to ensure the traffic drainage Stability and business continuity.
Patent Information
- Application Number
- CN202411227994.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-09-03
AI Technical Summary
The existing OVN network architecture cannot effectively monitor the status of the network element, resulting in defects in traffic drainage functions, and the failure to sense network element failure in time, resulting in business interruption.
Using the traffic drainage method based on the network element detection mechanism, by receiving and verifying configuration information, encapsulating the detection packet and sending it to the target network element, determining the forwarding status of the network element based on the returned detection packet, dynamically adjusting the drainage configuration to ensure the traffic drainage stability.
It realizes in-depth monitoring and real-time perception of network element status, can promptly perceive network element failures, avoid business interruptions, and ensure the stability and business continuity of traffic drainage.
Smart Images

Figure CN119030855A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security technology, and in particular to a traffic diversion method based on a network element detection mechanism and related components. Background Art
[0002] The traffic diversion function will divert specific traffic to one or more network elements to filter and analyze the traffic. During the diversion process, the network architecture of OVN (Open Virtual Network, a software system that supports virtual network abstraction) cannot identify the status of the network element. When one or more network elements go down for some reason, it will cause traffic loss and business interruption. The network element may have only analyzed the business data, but the business was affected by the abnormality of the network element, so it is necessary to monitor the forwarding status of the network element during the application process. The mainstream network status monitoring is to send Ping (Internet Packet Explorer) packets to the network element regularly for detection, but this method can only monitor whether the network status of the network element network card is normal, and cannot detect whether the internal message analysis and forwarding business of the network element is normal. Therefore, this solution cannot meet the needs of network element status detection. Now OVN cannot monitor the status of specified network elements, resulting in certain defects in the traffic diversion function. Summary of the invention
[0003] Based on this, it is necessary to provide a traffic diversion method and related components based on a network element detection mechanism that can solve the problem of service interruption caused by the inability to perceive the failure of a third-party network element and continuing to divert traffic to the faulty network element, in response to the above technical problems.
[0004] In a first aspect, a traffic diversion method based on a network element detection mechanism is provided, the method comprising:
[0005] Receive and verify configuration information, where the configuration information includes at least network element detection configuration parameters and network element identification information;
[0006] In response to detecting that the configuration information verification is successful and a network element detection request is detected, encapsulating a detection packet based on the configuration information and sending the detection packet to a target network element;
[0007] Determine 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 a traffic diversion configuration of the target network element and diverting 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 traffic diversion configuration of the target network element.
[0010] Optionally, receiving and verifying configuration information includes:
[0011] Based on the target network service process, receiving configuration information;
[0012] Detecting whether a target network element exists based on the network element identification information, and detecting whether the network element detection configuration parameters meet preset standards;
[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, it is determined that the configuration information verification fails, and a prompt message is returned to the user.
[0015] Optionally, the method further includes:
[0016] Check whether there is a drainage data table in the network service database;
[0017] In response to detecting that there is a traffic diversion data table in the network service database, the configuration information is written into the traffic diversion data table, and a column is added to the traffic diversion data table to record whether traffic diversion is performed according to the network element forwarding state;
[0018] In response to detecting that the traffic diversion data table does not exist in the network service database, creating the traffic diversion data table when the target network service process is started;
[0019] In response to detecting that the diversion data table is successfully created, the configuration information is written into the diversion data table, and a column is added to the diversion data table to record whether diversion is performed according to the network element forwarding status.
[0020] Optionally, encapsulating a detection packet based on the configuration information, and sending the detection packet to a target network element includes:
[0021] Get the data information in the drainage data table;
[0022] Detect whether a first target data table exists in the first database;
[0023] In response to detecting that a 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;
[0024] Detecting whether a second target data table exists in the second database;
[0025] 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 the user state process of the third database based on the target service process;
[0026] In response to detecting that the data information has been translated, synchronizing the translated data information into the second data table;
[0027] In response to detecting that the data information has completed synchronization, encapsulating the detection packet based on the data information in the second data table;
[0028] In response to detecting that the encapsulation of the detection packet is completed, the detection packet is sent to a logical port of the target network element.
[0029] Optionally, the method further includes:
[0030] Synchronously adding a logical flow table to the logical process based on the target service process, wherein the logical flow table is used to identify the detection packet;
[0031] In response to identifying the returned detection packet, the returned detection packet is sent to the flow table corresponding to the target controller based on the logical process and then generated into the physical flow table to send the returned detection packet to the target controller.
[0032] Optionally, the method for determining the forwarding state of the target network element includes:
[0033] In response to detecting that there is newly added data in the second data table, inserting a piece of data into 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;
[0034] 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 the waiting state, and setting the time for sending the next detection packet to the current time plus the first preset time interval;
[0035] In response to detecting that the current state of the state machine is a waiting state and the waiting time exceeds a preset time, the current state of the state machine is adjusted to an offline state, the cumulative number of failures is +1, and the next time to send a detection packet is set to the current time plus a second preset time interval, and the waiting time is used to describe the waiting time for receiving a return packet;
[0036] In response to detecting that the current state of the state machine is a waiting state and a reply packet is received within a preset time length, the current state of the state machine is adjusted to an online state, the cumulative number of successes is increased by 1, and the time for sending the next detection packet is set to the current time plus a second preset time interval;
[0037] In response to detecting that the current time is the detection packet sending time, sending the detection packet and adjusting the current state of the state machine to a waiting state;
[0038] In response to receiving a reply packet at any time, the current state of the state machine is adjusted to an online state, and the number of successes is accumulated +1.
[0039] Optionally, the method further includes:
[0040] In response to detecting that the cumulative number of successes is greater than a first preset threshold, adjusting the forwarding state of the target network element to a normal state and clearing the cumulative number of successes;
[0041] In response to detecting that the cumulative number of failures is greater than a second preset threshold, the forwarding state of the target network element is adjusted to an abnormal state, and the cumulative number of failures is cleared.
[0042] In a second aspect, a traffic diversion device based on a network element detection mechanism is provided, the device comprising:
[0043] A configuration information processing module, used to receive and verify configuration information, wherein the configuration information at least includes network element detection configuration parameters and network element identification information;
[0044] A detection packet sending module, configured to encapsulate a detection packet based on the configuration information and send the detection packet to a target network element when detecting that the configuration information verification is successful and a network element detection request is detected;
[0045] A forwarding state determination module, used to determine the forwarding state of the target network element according to the detection packet returned by the target network element;
[0046] A traffic diversion module, configured to, when detecting that the forwarding state of the target network element is normal, issue a traffic diversion configuration of the target network element and divert traffic to the target network element;
[0047] The deleting module is used to delete the traffic diversion configuration of the target network element when it is detected that the forwarding state of the target network element is in an abnormal state.
[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 when the processor executes the computer program, the following steps are implemented:
[0049] Receive and verify configuration information, where the configuration information includes at least network element detection configuration parameters and network element identification information;
[0050] In response to detecting that the configuration information verification is successful and a network element detection request is detected, encapsulating a detection packet based on the configuration information and sending the detection packet to a target network element;
[0051] Determine the forwarding state of the target network element according to the detection 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 a traffic diversion configuration of the target network element and diverting traffic to the target network element;
[0053] In response to detecting that the forwarding state of the target network element is an abnormal state, deleting the traffic diversion configuration of the target network element.
[0054] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0055] Receive and verify configuration information, where the configuration information includes at least network element detection configuration parameters and network element identification information;
[0056] In response to detecting that the configuration information verification is successful and a network element detection request is detected, encapsulating a detection packet based on the configuration information and sending the detection packet to a target network element;
[0057] Determine the forwarding state of the target network element according to the detection 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 a traffic diversion configuration of the target network element and diverting traffic to the target network element;
[0059] In response to detecting that the forwarding state of the target network element is an abnormal state, deleting the traffic diversion configuration of the target network element.
[0060] In a fifth aspect, a computer program product is provided, the computer program product comprising a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0061] Receive and verify configuration information, where the configuration information includes at least network element detection configuration parameters and network element identification information;
[0062] In response to detecting that the configuration information verification is successful and a network element detection request is detected, encapsulating a detection packet based on the configuration information and sending the detection packet to a target network element;
[0063] Determine the forwarding state of the target network element according to the detection 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 a traffic diversion configuration of the target network element and diverting traffic to the target network element;
[0065] In response to detecting that the forwarding state of the target network element is an abnormal state, deleting the traffic diversion configuration of the target network element.
[0066] The above-mentioned traffic diversion method based on network element detection mechanism and related components, 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 a network element detection request is detected, based on the configuration information, encapsulating a detection packet, and sending the detection packet to the 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 in a normal state, issuing the diversion configuration of the target network element and diverting the traffic to the target network element; in response to detecting that the forwarding state of the target network element is in an abnormal state, deleting the diversion configuration of the target network element. The present application monitors the network element status, and while diverting the traffic, it can also timely perceive the network element status and dynamically adjust the traffic diversion strategy, thereby achieving traffic escape and ensuring the stability of the business. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 FIG. 1 is an application environment diagram of a traffic diversion method based on a network element detection mechanism in an embodiment;
[0068] Figure 2 A flow chart of a traffic diversion method based on a network element detection mechanism in one embodiment;
[0069] Figure 3 Another schematic diagram of a flow chart of a traffic diversion method based on a network element detection mechanism in an embodiment;
[0070] Figure 4 A schematic diagram of the state machine operation logic of a traffic diversion method based on a network element detection mechanism in one embodiment;
[0071] Figure 5 is a structural block diagram of a traffic diversion device based on a network element detection mechanism in an embodiment;
[0072] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0073] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0074] It should be understood that in the description of the present application, unless the context clearly requires otherwise, words such as "include", "comprises", and the like throughout the specification should be interpreted as including rather than being exclusive or exhaustive; that is, as including but not limited to.
[0075] It should also be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.
[0076] It should be noted that the terms "S1", "S2", etc. are only used for the purpose of describing the steps, and do not specifically refer to the order or sequence, nor are they used to limit the present application. They are 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 between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present application.
[0077] Currently, a mature implementation solution for virtualized networks in the openstack (open source cloud computing management platform project) community is OVN (Open Virtual Network, a software system that supports virtual network abstraction). This solution has a natural distributed advantage. Compared with the traditional use of Linux bridges (connecting two LANs with the same protocol), namespaces, iptables (IP-Internet Protocol packet filtering system) to implement routing, NAT (Network Address Translation), and QoS (Quality of Service) functions, it saves system resource overhead, reduces network path overhead, and improves network forwarding efficiency.
[0078] The OVN virtualized network solution also provides a policy routing function, which can redirect the third-layer traffic to a specific destination. Based on this function, the traffic can be directed to the specified service network element through the configuration of policy routing to achieve traffic monitoring, analysis, and filtering.
[0079] According to the background technology, the existing OVN is unable to monitor the status of a specified network element, resulting in certain defects in the traffic diversion function.
[0080] In order to solve the above technical problems, the present application provides a traffic diversion method and related components based on a network element detection mechanism. The method of deep detection of a specified network element based on the OVN architecture can not only detect the network status of the network card, but also detect the forwarding function of the network element application layer after traffic analysis. It can monitor in real time whether the traffic diverted to the network element can be transferred out normally. When a network element is abnormal, the behavior of diverting traffic to it can be quickly terminated as needed, and this network element can be temporarily skipped, giving priority to ensuring that the business is not interrupted to achieve safe service diversion traffic escape.
[0081] The traffic diversion method based on network element detection mechanism provided in this application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the data processing platform set on the server 104 through the network, wherein the terminal 102 can be but not limited to various personal computers, laptops, 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, Figure 2-Figure 3 As shown, a traffic diversion method based on network element detection mechanism is provided, and the method is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0083] S1: Receive and verify configuration information, where the configuration information at least includes network element detection configuration parameters and network element identification information.
[0084] It should be noted that this application is mainly used in the OVN distributed network environment of the openstack open source project, among which neutron is one of the core projects of openstack, providing virtual network functions in the cloud computing environment. The openstack network (neutron) manages the access layer of all virtual network infrastructure (VNI) and physical network infrastructure (PNI) in the openstack environment. It is a bridge for tenant virtual machines to interact with Internet information. It can meet richer network control by expanding plugins and drivers. Neutron-server is the process name of this network service; OVN: OpenVirtualNetwork is a distributed controller, which mainly includes ovn-controller, ovn-northd and other processes for translation, as well as ovn-nb -db, ovn-sb-db and other processes that provide db-server (database server) services. Each process can exist in the form of a cluster to provide high availability. OVS: OpenVirtualSwitch is a software-defined Layer 2 switch, mainly including processes such as ovs-vswithd and ovs-db. A network element is a network device that analyzes and filters traffic. It can count and intercept received packets, and packets allowed to pass will be forwarded from the network element again. The network element detection configuration parameters may include packet sending interval, timeout, number of successes, number of failures, detection packet source IP (Internet Protocol), detection packet destination IP, detection packet source port, detection packet destination port, detection packet source MAC (Media Access Control), number of tolerated failures, number of waiting successes, timeout and detection interval, etc. The network element identification information may include network element network card id (identification) and other information.
[0085] In some specific implementations, receiving and verifying configuration information includes:
[0086] Receive configuration information based on the target network service process, where the target network service process refers to neutron_server and the configuration information is issued by the user according to actual needs;
[0087] Based on the network element identification information, detect whether the target network element exists, and at the same time, detect whether the network element detection configuration parameters meet the preset standards, that is, the neutron_server process needs to verify the configuration sent by the user after receiving the configuration information;
[0088] 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, wherein the preset standard refers to whether the network element detection configuration parameter is legal;
[0089] 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, it is determined that the configuration information verification has failed, and a prompt message is returned to the user. That is, if the conditions such as the network element network card already exists and the detection configuration parameters are legal are not met, a failure message is returned to inform the user.
[0090] In some embodiments, the method further comprises:
[0091] Check whether there is a traffic diversion data table in the network service database. The network service database refers to the neutron database, that is, the MySQL database. The traffic diversion data table refers to the network_elements_health_check table, which is stored in the neutron database.
[0092] In response to detecting that there is a traffic diversion data table in the network service database, the configuration information is written into the traffic diversion data table, and a column is added to the traffic diversion data table to record whether traffic diversion is performed according to the network element forwarding state;
[0093] In response to detecting that the traffic diversion data table does not exist in the network service database, creating the traffic diversion data table when the target network service process is started;
[0094] In response to detecting that the diversion data table is successfully created, the configuration information is written into the diversion data table, and a column is added to the diversion data table to record whether diversion is performed according to the network element forwarding status.
[0095] The data format of the neutron database is shown in Table 1.
[0096] Table 1: Neutron database data format table.
[0097] In the above implementation, whether the network element status needs to be detected is determined by the configuration information sent by the user, thereby improving the flexibility of detection, and the corresponding detection packet is subsequently generated based on the configuration information to effectively detect the network element status.
[0098] S2: In response to detecting that the configuration information verification is successful and a network element detection request is detected, encapsulating a detection packet based on the configuration information, and sending the detection packet to a target network element.
[0099] It should be noted that the detection packet is a data packet used for network diagnosis and testing. The target network element refers to the network element that needs to be detected. The network element detection request refers to whether the user configures the network element status detection according to the actual situation when configuring the diversion strategy. If network element status detection is required, a network element detection request is generated. If network element status detection is not required, the diversion policy route is written to the OVN northbound database and translated into the diversion logical flow table and written to ovn-sb-db. At the same time, a new logistics flow table is added to divert the specified traffic.
[0100] In some specific implementations, encapsulating a detection packet based on the configuration information and sending the detection packet to a target network element includes:
[0101] Get the data information in the drainage data table;
[0102] Detect whether a 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 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 newly added table and data format of the ovn northbound database are as follows:
[0104] Detect whether a second target data table exists in a second database, wherein the second database refers to ovn-sb-db, and the second target data table refers to the Network_Element_Monitor table;
[0105] In response to detecting the existence of the second target data table 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 data changes in the ovn northbound database and translating corresponding information to the southbound database. It is necessary to add monitoring and translation functions for the Network_Element_Health_Check table to synchronize the data to the Network_Element_Monitor table of ovn-sb-db;
[0106] In response to detecting that the data information has been translated, the translated data information is synchronized to 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, encapsulating the detection packet based on the data information in the second data table, wherein the detection packet is encapsulated based on the Network_Element_Monitor data of ovn-sb-db by the target controller ovn-controller;
[0109] In response to detecting that the encapsulation of the detection packet is completed, the detection 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] Synchronously add a logical flow table to the logical process based on the target service process, the logical flow table is used to identify the detection packet, wherein the logical process refers to logical_flows, that is, synchronously add a logical flow table for detecting the detection packet to logical_flows based on ovn-northd, and send the detection packet forwarded by the target network element back to ovn-controller;
[0112] In response to identifying a returned probe packet, the returned probe packet is sent to the target controller based on the logical process, and the corresponding flow table is generated in the physical flow table to send the returned probe packet to the target controller, that is, the flow table in logical_flows used to send the probe packet forwarded back by the network element back to ovn-controller is generated into the physical flow table of ovs. In addition, ovn-controller monitors the update of the southbound database and then adds the corresponding flow table to the physical flow table of ovs, which are used to upload the returned probe packet and the updated data respectively.
[0113] In the above implementation, a corresponding detection packet is generated based on the configuration information that has been successfully verified to detect the status of the network element, thereby improving the accuracy of the network element status detection.
[0114] S3: Determine the forwarding state of the target network element according to the detection packet returned by the target network element.
[0115] It should be noted that the forwarding status of the target network element can include normal status (online) and abnormal status (offline). The forwarding status of the target network element can be determined based on the sending and receiving of the detection packet. The ovn-controller needs to start a state machine to determine the network element status based on the sending and receiving of the detection packet.
[0116] In some specific embodiments, Figure 4 As shown, 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, insert a data in the linked list 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 to the initial state, that is, when ovn-controller finds that there is new data in the Network_Element_Monitor table of ovn-sb-db, it will insert a data in the linked list of the state machine and set its state to init (initial state). State is the current state of the state machine of this network element, and each network element is independent of each other;
[0118] In response to detecting that the current state of the state machine is the initial state, a detection packet is sent, and the current state of the state machine is adjusted to the waiting state, and the time for sending the next detection packet is set to the current time plus the first preset time interval, wherein the first preset time interval refers to timeout (timeout time), which is preset by the user according to actual needs when issuing the configuration, that is, when the state of the state machine is init during operation, a detection packet is sent, and the state is updated to waiting (waiting state), and the next running time is set to the current time plus the timeout time, that is, when the state machine is in the waiting state, the packet sending interval is the above-mentioned timeout time;
[0119] In response to detecting that the current state of the state machine is a waiting state and the waiting time exceeds a preset time, the current state of the state machine is adjusted to an offline state, the cumulative number of failures is +1, and the time for sending the next detection packet is set to the current time plus the second preset time interval, and the waiting time is used to describe the waiting time for receiving the return packet, wherein the preset time is the maximum waiting time set by the user, and the second preset time interval is interval, which is pre-set by the user according to actual needs when issuing the configuration, that is, when the state of the state machine is waiting during operation, if the current time is greater than the recorded maximum waiting time, it indicates that it has timed out, and the state is updated to offline (offline state), the cumulative number of failures is +1, if the current time has not arrived, continue to wait, and when the state machine is in an offline state, the packet sending interval is the above-mentioned second preset time interval;
[0120] In response to detecting that the current state of the state machine is a waiting state and a return packet is received within a preset time length, that is, when a returned detection packet is successfully received within the waiting time, the current state of the state machine is adjusted to an online state (online), the cumulative number of successes is +1, and the time for sending the next detection packet is set to the current time plus a second preset time interval;
[0121] In response to detecting that the current time is the detection packet sending time, the detection packet is sent, and the current state of the state machine is adjusted to the waiting state, that is, no matter what state the state machine is currently in, when the packet sending time corresponding to each state is reached, the detection packet is sent;
[0122] In response to receiving a reply packet at any time, the current state of the state machine is adjusted to the online state, and the cumulative number of successes is +1. That is, when ovn-controller receives the reply packet, it immediately updates the state machine state to online, and the cumulative number of successes is +1.
[0123] In some embodiments, the method further comprises:
[0124] In response to detecting that the cumulative number of successes is greater than a first preset threshold, adjusting the forwarding state of the target network element to a normal state and clearing the cumulative number of successes;
[0125] In response to detecting that the cumulative number of failures is greater than a second preset threshold, the forwarding state of the target network element is adjusted to an abnormal state, and the cumulative number of failures is cleared.
[0126] Among them, the first preset threshold and the second preset threshold can be set according to actual needs. Adjusting the forwarding status of the target network element to an abnormal state is to update the status of the ovs-sb-db network element to offline, and adjusting the forwarding status of the target network element to a normal state is to update the status of the ovs-sb-db network element to online. At the same time, the network element status judgment result will be synchronized to the Network_Element_Monitor table, so that the neutron_server can determine whether to send down the policy routing configuration for diversion based on the changes in the network element status (status) monitored in the Network_Element_Monitor table.
[0127] In the above implementation, the network element status detection mechanism and the dynamic diversion configuration mechanism are used to achieve traffic escape and ensure the stability of the service.
[0128] S4: In response to detecting that the forwarding state of the target network element is in a normal state, issuing a traffic diversion configuration of the target network element, and diverting traffic to the target network element.
[0129] It should be noted that the specific steps are as follows: when the state machine is running in the online state, if the cumulative number of successes is greater than the set number of successes (success_count), it means that the network element forwarding state is normal, and the status of the ovs-sb-db network element is updated to online, and the cumulative number of successes is cleared. At this time, the diversion policy routing (ie, diversion configuration) is written into the OVN northbound database, and translated into the diversion logic flow table and written into ovn-sb-db. At the same time, a new logistics flow table is added to divert the specified traffic, thereby diverting 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 diversion configuration of the target network element.
[0131] It should be noted that the specific steps are as follows: when the state of the state machine is offline, if the cumulative number of failures is greater than the set number of failures (failure_count), it means that the forwarding state of the network element is abnormal, and the status of the ovs-sb-db network element is updated to offline, and the cumulative number of failures is cleared. At this time, the diversion policy routing of the OVN northbound database is deleted, the logical flow table and physical flow table of the diversion are deleted, and the diversion is stopped.
[0132] In the above implementation, when the forwarding state of a network element changes, a decision is dynamically made whether to issue a diversion policy route based on the actual forwarding state of the network element. When the forwarding state of the network element is normal, the diversion configuration configured by the user is issued to divert specific traffic to the network element for traffic analysis. When the forwarding state of the network element is abnormal, the diversion policy route is deleted, and diversion to the network element is stopped, allowing the traffic to skip the faulty network element without affecting normal business, thereby achieving traffic escape and ensuring business stability.
[0133] In some specific implementations, after detecting that the forwarding state of the target network element is an abnormal state, the method further includes:
[0134] Record the number of times 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, obtaining a time point value at which the target network element is in an abnormal state, wherein the preset time period can be set according to actual needs, such as 24 hours, and the third preset threshold can be set according to actual needs, such as 10 times;
[0136] Based on the time point value, determine the target time period, where the target time period can be generated according to the interval before and after the time point value. For example, if the time point is 3:15 and the time interval is 5 minutes, then the target time period is 3:10 to 3:20;
[0137] In response to detecting that within a preset time period, the number of times that the target network element is in an abnormal state within a target time period is greater than a fourth preset threshold, marking the target network element based on the 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 a week, etc.;
[0138] If the current time is in the target time period, delete the policy route for diversion and stop diverting traffic to the target network element until the next update cycle, when it is recalculated and whether to remove the mark from the target network element is determined. The update cycle can be set according to actual needs, such as one month.
[0139] In the above implementation, by predicting the time when the target network element fails, the flow to the target network element can be stopped in advance, allowing the traffic to skip the network element that may fail, without affecting normal business, achieving traffic escape, saving computing resources, and further ensuring business stability.
[0140] In the above-mentioned traffic diversion 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 a network element detection request is detected, 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 in a normal state, issuing the diversion configuration of the target network element and diverting the traffic to the target network element; in response to detecting that the forwarding state of the target network element is In an abnormal state, the diversion configuration of the target network element is deleted. When using the network environment of the openstack open source project OVN, this application does not change the original traffic architecture design. By adding network element status detection technology to ovn-controller and dynamic diversion configuration technology to neutron-server, the traffic escape function is realized. It not only maintains the OVN architecture design concept, but also enriches the functions of the open source project, so that the network element status can be monitored, and the network element status can be perceived in time while diverting traffic to dynamically adjust the traffic diversion strategy, so as to achieve traffic escape and ensure the stability of the business.
[0141] It should be understood that although Figure 2-Figure 4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-Figure 4At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0142] In one embodiment, Figure 5 As shown, a traffic diversion device based on a network element detection mechanism is provided, comprising: a configuration information processing module, a detection packet sending module, a forwarding state determination module, a traffic diversion module and a deletion module, wherein:
[0143] A configuration information processing module, used to receive and verify configuration information, wherein the configuration information at least includes network element detection configuration parameters and network element identification information;
[0144] A detection packet sending module, configured to encapsulate a detection packet based on the configuration information and send the detection packet to a target network element when detecting that the configuration information verification is successful and a network element detection request is detected;
[0145] A forwarding state determination module, used to determine the forwarding state of the target network element according to the detection packet returned by the target network element;
[0146] A traffic diversion module, configured to, when detecting that the forwarding state of the target network element is normal, issue a traffic diversion configuration of the target network element and divert traffic to the target network element;
[0147] The deleting module is used to delete the traffic diversion configuration of the target network element when it is detected that the forwarding state of the target network element is in an abnormal state.
[0148] As a preferred implementation, in the embodiment of the present invention, the configuration information processing module is specifically used for:
[0149] Based on the target network service process, receiving configuration information;
[0150] Detecting whether a target network element exists based on the network element identification information, and detecting 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 parameter meets the preset standard, determining 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 parameter does not meet the preset standard, it is determined that the configuration information verification fails, and a prompt message is returned to the user.
[0153] As a preferred implementation manner, in the embodiment of the present invention, the configuration information processing module is further specifically used for:
[0154] Check whether there is a drainage data table in the network service database;
[0155] In response to detecting that there is a traffic diversion data table in the network service database, the configuration information is written into the traffic diversion data table, and a column is added to the traffic diversion data table to record whether traffic diversion is performed according to the network element forwarding state;
[0156] In response to detecting that the traffic diversion data table does not exist in the network service database, creating the traffic diversion data table when the target network service process is started;
[0157] In response to detecting that the diversion data table is successfully created, the configuration information is written into the diversion data table, and a column is added to the diversion data table to record whether diversion is performed according to the network element forwarding status.
[0158] As a preferred implementation, in the embodiment of the present invention, the detection packet sending module is specifically used for:
[0159] Get the data information in the drainage data table;
[0160] Detect whether a first target data table exists in the first database;
[0161] In response to detecting that a first target data table exists in the first database, writing data information in the traffic diversion data table into the first target data table based on an open source switch database management protocol;
[0162] Detecting whether a second target data table exists in the second database;
[0163] 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 the user state process of the third database based on the target service process;
[0164] In response to detecting that the data information has been translated, synchronizing the translated data information into the second data table;
[0165] In response to detecting that the data information has completed synchronization, encapsulating the detection packet based on the data information in the second data table;
[0166] In response to detecting that the encapsulation of the detection packet is completed, the detection packet is sent to a logical port of the target network element.
[0167] As a preferred implementation, in the embodiment of the present invention, the detection packet sending module is further used for:
[0168] Synchronously adding a logical flow table to the logical process based on the target service process, wherein the logical flow table is used to identify the detection packet;
[0169] In response to identifying the returned detection packet, the returned detection packet is sent to the flow table corresponding to the target controller based on the logical process and then generated into the physical flow table to send the returned detection packet to the target controller.
[0170] As a preferred implementation manner, in the embodiment of the present invention, the forwarding state determination module is specifically used for:
[0171] In response to detecting that there is newly added data in the second data table, inserting a piece of data into 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;
[0172] 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 the waiting state, and setting the time for sending the next detection packet to the current time plus the first preset time interval;
[0173] In response to detecting that the current state of the state machine is a waiting state and the waiting time exceeds a preset time, the current state of the state machine is adjusted to an offline state, the cumulative number of failures is +1, and the next time to send a detection packet is set to the current time plus a second preset time interval, and the waiting time is used to describe the waiting time for receiving a return packet;
[0174] In response to detecting that the current state of the state machine is a waiting state and a reply packet is received within a preset time length, the current state of the state machine is adjusted to an online state, the cumulative number of successes is increased by 1, and the time for sending the next detection packet is set to the current time plus a second preset time interval;
[0175] In response to detecting that the current time is the detection packet sending time, sending the detection packet and adjusting the current state of the state machine to a waiting state;
[0176] In response to receiving a reply packet at any time, the current state of the state machine is adjusted to an online state, and the number of successes is accumulated +1.
[0177] As a preferred implementation manner, in the embodiment of the present invention, the forwarding state determination module is further specifically used for:
[0178] In response to detecting that the cumulative number of successes is greater than a first preset threshold, adjusting the forwarding state of the target network element to a normal state and clearing the cumulative number of successes;
[0179] In response to detecting that the cumulative number of failures is greater than a second preset threshold, the forwarding state of the target network element is adjusted to an abnormal state, and the cumulative number of failures is cleared.
[0180] For the specific definition of the traffic diversion device based on the network element detection mechanism, please refer to the definition of the traffic diversion method based on the network element detection mechanism above, which will not be repeated here. Each module in the above-mentioned traffic diversion device based on the network element detection mechanism can be implemented in whole or in part through software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0181] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used 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 the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a traffic diversion method based on a network element detection mechanism is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0182] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0183] In one embodiment, a computer device is provided, including 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:
[0184] S1: Receive and verify configuration information, where the configuration information at least includes network element detection configuration parameters and network element identification information;
[0185] S2: In response to detecting that the configuration information verification is successful and a network element detection request is detected, encapsulating a detection packet based on the configuration information, and sending the detection packet to a target network element;
[0186] S3: Determine the forwarding state of the target network element according to the detection packet returned by the target network element;
[0187] S4: in response to detecting that the forwarding state of the target network element is in a normal state, issuing a traffic diversion configuration of the target network element and diverting the traffic to 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 traffic diversion configuration of the target network element.
[0189] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0190] Based on the target network service process, receiving configuration information;
[0191] Detecting whether a target network element exists based on the network element identification information, and detecting whether the network element detection configuration parameters meet preset standards;
[0192] 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;
[0193] 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 determined that the configuration information verification fails, and a prompt message is returned to the user.
[0194] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0195] Check whether there is a drainage data table in the network service database;
[0196] In response to detecting that there is a traffic diversion data table in the network service database, the configuration information is written into the traffic diversion data table, and a column is added to the traffic diversion data table to record whether traffic diversion is performed according to the network element forwarding state;
[0197] In response to detecting that the traffic diversion data table does not exist in the network service database, creating the traffic diversion data table when the target network service process is started;
[0198] In response to detecting that the diversion data table is successfully created, the configuration information is written into the diversion data table, and a column is added to the diversion data table to record whether diversion is performed according to the network element forwarding status.
[0199] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0200] Get the data information in the drainage data table;
[0201] Detect whether a first target data table exists in the first database;
[0202] In response to detecting that a 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 the second database;
[0204] 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 the user state process of the third database based on the target service process;
[0205] In response to detecting that the data information has been translated, synchronizing the translated data information into the second data table;
[0206] In response to detecting that the data information has completed synchronization, encapsulating the detection packet based on the data information in the second data table;
[0207] In response to detecting that the encapsulation of the detection packet is completed, the detection packet is sent to a logical port of the target network element.
[0208] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0209] Synchronously adding a logical flow table to the logical process based on the target service process, wherein the logical flow table is used to identify the detection packet;
[0210] In response to identifying the returned detection packet, the returned detection packet is sent to the flow table corresponding to the target controller based on the logical process and is generated into a physical flow table to send the returned detection packet to the target controller.
[0211] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0212] In response to detecting that there is newly added data in the second data table, inserting a piece of data into 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;
[0213] 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 the waiting state, and setting the time for sending the next detection packet to the current time plus the first preset time interval;
[0214] In response to detecting that the current state of the state machine is a waiting state and the waiting time exceeds a preset time, the current state of the state machine is adjusted to an offline state, the cumulative number of failures is +1, and the next time to send a detection packet is set to the current time plus a second preset time interval, and the waiting time is used to describe the waiting time for receiving a return packet;
[0215] In response to detecting that the current state of the state machine is a waiting state and a reply packet is received within a preset time length, the current state of the state machine is adjusted to an online state, the cumulative number of successes is increased by 1, and the time for sending the next detection packet is set to the current time plus a second preset time interval;
[0216] In response to detecting that the current time is the detection packet sending time, sending the detection packet and adjusting the current state of the state machine to a waiting state;
[0217] In response to receiving a reply packet at any time, the current state of the state machine is adjusted to an online state, and the number of successes is accumulated +1.
[0218] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0219] In response to detecting that the cumulative number of successes is greater than a first preset threshold, adjusting the forwarding state of the target network element to a normal state and clearing the cumulative number of successes;
[0220] In response to detecting that the cumulative number of failures is greater than a second preset threshold, the forwarding state of the target network element is adjusted to an abnormal state, and the cumulative number of failures is cleared.
[0221] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0222] S1: Receive and verify configuration information, where the configuration information at least includes network element detection configuration parameters and network element identification information;
[0223] S2: In response to detecting that the configuration information verification is successful and a network element detection request is detected, encapsulating a detection packet based on the configuration information, and sending the detection packet to a target network element;
[0224] S3: Determine the forwarding state of the target network element according to the detection packet returned by the target network element;
[0225] S4: in response to detecting that the forwarding state of the target network element is in a normal state, issuing a traffic diversion configuration of the target network element and diverting the traffic to the target network element;
[0226] S5: In response to detecting that the forwarding state of the target network element is an abnormal state, deleting the traffic diversion configuration of the target network element.
[0227] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0228] Based on the target network service process, receiving configuration information;
[0229] Detecting whether a target network element exists based on the network element identification information, and detecting whether the network element detection configuration parameters meet preset standards;
[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, it is determined that the configuration information verification fails, and a prompt message is returned to the user.
[0232] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0233] Check whether there is a drainage data table in the network service database;
[0234] In response to detecting that there is a traffic diversion data table in the network service database, the configuration information is written into the traffic diversion data table, and a column is added to the traffic diversion data table to record whether traffic diversion is performed according to the network element forwarding state;
[0235] In response to detecting that the traffic diversion data table does not exist in the network service database, creating the traffic diversion data table when the target network service process is started;
[0236] In response to detecting that the diversion data table is successfully created, the configuration information is written into the diversion data table, and a column is added to the diversion data table to record whether diversion is performed according to the network element forwarding status.
[0237] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0238] Get the data information in the drainage data table;
[0239] Detect whether a first target data table exists in the first database;
[0240] In response to detecting that a first target data table exists in the first database, writing data information in the traffic 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 the second database;
[0242] 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 the user state process of the third database based on the target service process;
[0243] In response to detecting that the data information has been translated, synchronizing the translated data information into the second data table;
[0244] In response to detecting that the data information has completed synchronization, encapsulating the detection packet based on the data information in the second data table;
[0245] In response to detecting that the encapsulation of the detection packet is completed, the detection packet is sent to a logical port of the target network element.
[0246] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0247] Synchronously adding a logical flow table to the logical process based on the target service process, wherein the logical flow table is used to identify the detection packet;
[0248] In response to identifying the returned detection packet, the returned detection packet is sent to the flow table corresponding to the target controller based on the logical process and then generated into the physical flow table to send the returned detection packet to the target controller.
[0249] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0250] In response to detecting that there is newly added data in the second data table, inserting a piece of data into 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;
[0251] 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 the waiting state, and setting the time for sending the next detection packet to the current time plus the first preset time interval;
[0252] In response to detecting that the current state of the state machine is a waiting state and the waiting time exceeds a preset time, the current state of the state machine is adjusted to an offline state, the cumulative number of failures is +1, and the next time to send a detection packet is set to the current time plus a second preset time interval, and the waiting time is used to describe the waiting time for receiving a return packet;
[0253] In response to detecting that the current state of the state machine is a waiting state and a reply packet is received within a preset time length, the current state of the state machine is adjusted to an online state, the cumulative number of successes is increased by 1, and the time for sending the next detection packet is set to the current time plus a second preset time interval;
[0254] In response to detecting that the current time is the detection packet sending time, sending the detection packet and adjusting the current state of the state machine to a waiting state;
[0255] In response to receiving a reply packet at any time, the current state of the state machine is adjusted to an online state, and the number of successes is accumulated +1.
[0256] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0257] In response to detecting that the cumulative number of successes is greater than a first preset threshold, adjusting the forwarding state of the target network element to a normal state and clearing the cumulative number of successes;
[0258] In response to detecting that the cumulative number of failures is greater than a second preset threshold, the forwarding state of the target network element is adjusted to an abnormal state, and the cumulative number of failures is cleared.
[0259] In one embodiment, a computer program product is provided, the computer program product comprising a computer program, the computer program when executed by a processor implements the following steps:
[0260] S1: Receive and verify configuration information, where the configuration information at least includes network element detection configuration parameters and network element identification information;
[0261] S2: In response to detecting that the configuration information verification is successful and a network element detection request is detected, encapsulating a detection packet based on the configuration information, and sending the detection packet to a target network element;
[0262] S3: Determine the forwarding state of the target network element according to the detection packet returned by the target network element;
[0263] S4: in response to detecting that the forwarding state of the target network element is in a normal state, issuing a traffic diversion configuration of the target network element and diverting the traffic to the target network element;
[0264] S5: In response to detecting that the forwarding state of the target network element is an abnormal state, deleting the traffic diversion configuration of the target network element.
[0265] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0266] Based on the target network service process, receiving configuration information;
[0267] Detecting whether a target network element exists based on the network element identification information, and detecting whether the network element detection configuration parameters meet preset standards;
[0268] 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;
[0269] 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 determined that the configuration information verification fails, and a prompt message is returned to the user.
[0270] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0271] Check whether there is a drainage data table in the network service database;
[0272] In response to detecting that there is a traffic diversion data table in the network service database, the configuration information is written into the traffic diversion data table, and a column is added to the traffic diversion data table to record whether traffic diversion is performed according to the network element forwarding state;
[0273] In response to detecting that the traffic diversion data table does not exist in the network service database, creating the traffic diversion data table when the target network service process is started;
[0274] In response to detecting that the diversion data table is successfully created, the configuration information is written into the diversion data table, and a column is added to the diversion data table to record whether diversion is performed according to the network element forwarding status.
[0275] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0276] Get the data information in the drainage data table;
[0277] Detect whether a first target data table exists in the first database;
[0278] In response to detecting that a 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;
[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 the user state process of the third database based on the target service process;
[0281] In response to detecting that the data information has been translated, synchronizing the translated data information into the second data table;
[0282] In response to detecting that the data information has completed synchronization, encapsulating the detection packet based on the data information in the second data table;
[0283] In response to detecting that the encapsulation of the detection packet is completed, the detection packet is sent to a logical port of the target network element.
[0284] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0285] Synchronously adding a logical flow table to the logical process based on the target service process, wherein the logical flow table is used to identify the detection packet;
[0286] In response to identifying the returned detection packet, the returned detection packet is sent to the flow table corresponding to the target controller based on the logical process and is generated into a physical flow table to send the returned detection packet to the target controller.
[0287] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0288] In response to detecting that there is newly added data in the second data table, inserting a piece of data into 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;
[0289] 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 the waiting state, and setting the time for sending the next detection packet to the current time plus the first preset time interval;
[0290] In response to detecting that the current state of the state machine is a waiting state and the waiting time exceeds a preset time, the current state of the state machine is adjusted to an offline state, the cumulative number of failures is +1, and the next time to send a detection packet is set to the current time plus a second preset time interval, and the waiting time is used to describe the waiting time for receiving a return packet;
[0291] In response to detecting that the current state of the state machine is a waiting state and a reply packet is received within a preset time length, the current state of the state machine is adjusted to an online state, the cumulative number of successes is increased by 1, and the time for sending the next detection packet is set to the current time plus a second preset time interval;
[0292] In response to detecting that the current time is the detection packet sending time, sending the detection packet and adjusting the current state of the state machine to a waiting state;
[0293] In response to receiving a reply packet at any time, the current state of the state machine is adjusted to an online state, and the number of successes is accumulated +1.
[0294] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0295] In response to detecting that the cumulative number of successes is greater than a first preset threshold, adjusting the forwarding state of the target network element to a normal state and clearing the cumulative number of successes;
[0296] In response to detecting that the cumulative number of failures is greater than a second preset threshold, the forwarding state of the target network element is adjusted to an abnormal state, and the cumulative number of failures is cleared.
[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 instructing the relevant hardware through a computer program, 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 embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this 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 and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), 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).
[0298] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0299] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. A traffic diversion method based on network element detection mechanism, characterized in that: The method comprises: Receive and verify configuration information, where the configuration information 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 a network element detection request is detected, encapsulating a detection packet based on the configuration information and sending the detection packet to a target network element; Determine 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 a traffic 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 traffic diversion configuration of the target network element.
2. The method for diverting traffic based on a network element detection mechanism according to claim 1, characterized in that: Receiving and verifying configuration information includes: Based on the target network service process, receiving configuration information; Detecting whether a target network element exists based on the network element identification information, and detecting whether the network element detection configuration parameters meet preset standards; 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; 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 determined that the configuration information verification fails, and a prompt message is returned to the user.
3. The method for diverting traffic based on network element detection mechanism according to claim 1, characterized in that: The method further comprises: Check whether there is a drainage data table in the network service database; In response to detecting that there is a traffic diversion data table in the network service database, the configuration information is written into the traffic diversion data table, and a column is added to the traffic diversion data table to record whether traffic diversion is performed according to the network element forwarding state; In response to detecting that the traffic diversion data table does not exist in the network service database, creating the traffic diversion data table when the target network service process is started; In response to detecting that the diversion data table is successfully created, the configuration information is written into the diversion data table, and a column is added to the diversion data table to record whether diversion is performed according to the network element forwarding status.
4. The method for diverting traffic based on network element detection mechanism according to claim 3 is characterized in that: Encapsulating a detection packet based on the configuration information and sending the detection packet to a target network element includes: Get the data information in the drainage data table; Detect whether a first target data table exists in the first database; In response to detecting that a first target data table exists in the first database, writing data information in the traffic diversion data table into the first target data table based on an open source switch database management protocol; 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, translating the data information in the first target data table to the user state process of the third database based on the target service process; In response to detecting that the data information has been translated, synchronizing the translated data information into the second data table; In response to detecting that the data information has completed synchronization, encapsulating the detection packet based on the data information in the second data table; In response to detecting that the encapsulation of the detection packet is completed, the detection packet is sent to a logical port of the target network element.
5. The method for diverting traffic based on network element detection mechanism according to claim 4, characterized in that: The method further comprises: Synchronously adding a logical flow table to the logical process based on the target service process, wherein the logical flow table is used to identify the detection packet; In response to identifying the returned detection packet, the returned detection packet is sent to the flow table corresponding to the target controller based on the logical process and then generated into the physical flow table to send the returned detection packet to the target controller.
6. The method for diverting traffic based on network element detection mechanism according to claim 1, characterized in that: The method for determining the forwarding state of the target network element includes: In response to detecting that there is newly added data in the second data table, inserting a piece of data into 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 the waiting state, and setting the time for sending the next detection packet to the current time plus the first preset time interval; In response to detecting that the current state of the state machine is a waiting state and the waiting time exceeds a preset time, the current state of the state machine is adjusted to an offline state, the cumulative number of failures is +1, and the next time to send a detection packet is set to the current time plus a second preset time interval, and 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 a waiting state and a reply packet is received within a preset time length, the current state of the state machine is adjusted to an online state, the cumulative number of successes is increased by 1, and the time for sending the next detection packet is set to the current time plus a second preset time interval; In response to detecting that the current time is the detection packet sending time, sending the detection packet and adjusting the current state of the state machine to a waiting state; In response to receiving a reply packet at any time, the current state of the state machine is adjusted to an online state, and the number of successes is accumulated +1.
7. The method for diverting traffic based on network element detection mechanism according to claim 6, characterized in that: The method further comprises: In response to detecting that the cumulative number of successes is greater than a first preset threshold, adjusting the forwarding state of the target network element to a normal state and clearing the cumulative number of successes; In response to detecting that the cumulative number of failures is greater than a second preset threshold, the forwarding state of the target network element is adjusted to an abnormal state, and the cumulative number of failures is cleared.
8. A flow diversion device based on network element detection mechanism, characterized in that: The device comprises: A configuration information processing module, used to receive and verify configuration information, wherein the configuration information at least includes network element detection configuration parameters and network element identification information; A detection packet sending module, configured to encapsulate a detection packet based on the configuration information and send the detection packet to a target network element when detecting that the configuration information verification is successful and a network element detection request is detected; A forwarding state determination module, used to determine the forwarding state of the target network element according to the detection packet returned by the target network element; A traffic diversion module, configured to, when detecting that the forwarding state of the target network element is normal, issue a traffic diversion configuration of the target network element and divert traffic to the target network element; The deleting module is used to delete the traffic diversion configuration of the target network element when it is detected that the forwarding state of the target network element is in an abnormal state.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
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
Distributed drainage system and method based on cloud security resource pool
CN115484208A
Content distributing method, service redirecting method and system, node device
WO2009143686A1
Network configuration method, controller, and traffic guide system
WO2022121080A1
