A device restart method, apparatus, device and medium

By generating views and determining a list of candidate objects, the configuration information of the data plane and the control plane can be quickly adjusted to be consistent, which solves the problem of inconsistent status during device restart and improves the restart success rate and efficiency.

CN119473709BActive Publication Date: 2026-06-16INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INSPUR SUZHOU INTELLIGENT TECH CO LTD
Filing Date
2024-10-12
Publication Date
2026-06-16

AI Technical Summary

Technical Problem

Existing technologies struggle to quickly restore the data plane and control plane to a consistent state during device hot restarts or fast restarts, resulting in a low device restart success rate.

Method used

By generating views of the control plane and data plane, a list of candidate objects is determined, and objects of the same type and identical attributes except for filtering attributes are quickly filtered out. The configuration information of the data plane is then adjusted to be consistent with that of the control plane.

Benefits of technology

It reduces the data processing error rate, improves the success rate of device hot restart or fast restart, and achieves fast and reliable state recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473709B_ABST
    Figure CN119473709B_ABST
Patent Text Reader

Abstract

The application relates to the computer technical field, and mainly relates to a device restart method and device, equipment and medium, which comprises the following steps: after the control plane of a device is restarted, a first view is generated according to configuration information of the control plane; the first view comprises each first object configured by the control plane; a second view is generated according to configuration information of a data plane; the second view comprises each second object configured by the data plane; candidate objects corresponding to each first object are determined from the second view; a candidate object list of each first object is generated according to the candidate objects; and the configuration information of the data plane is configured to be consistent with the configuration information of the control plane according to the candidate object list. The application embodiment can reduce the data processing error rate, quickly configure the configuration information of the data plane to be consistent with the configuration information of the control plane, and improve the success rate of device hot restart / quick restart.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and mainly to a device restart method, apparatus, device and medium. Background Technology

[0002] SONiC (Software for Open Networking in the Cloud) is an open-source network operating system based on Linux. It offers rich network functionality and flexible configuration options, employing a distributed architecture that separates the control plane and data plane, improving system reliability and fault tolerance. Installing SONiC on a device enables hot / fast reboots: during a hot or fast reboot, only the control plane is restarted, without restarting the hardware (such as ASICs, application-specific integrated circuits), maintaining the data plane's state while reloading and updating the control plane software. During the new software loading process, SONiC ensures that the data plane's forwarding function is unaffected (the forwarding plane data remains unchanged), thus maintaining network service continuity. After the control plane reboots, a series of methods are used to maintain consistency between the control plane information and the information on the ASIC (the forwarding plane).

[0003] In related technologies, to ensure data consistency between the control plane and the forwarding plane after a control plane restart, a recursive query is used to check if there is a difference between a specific object in the control plane configuration information and its corresponding matching object in the forwarding plane. If no difference exists, the two objects are considered identical; if a difference exists, the matching object in the forwarding plane is adjusted to match the object in the control plane. However, when searching for a matching object, if there are many objects with identical content, a random selection is used. In scenarios where many objects have the same type and similar content, the randomly selected object may be incorrect, leading to a failure to maintain consistency. Furthermore, if the object's attribute is "object," the depth of the recursive query becomes uncontrollable, consuming a significant amount of time and resulting in a timeout, also leading to a failure to maintain consistency. Thus, the success rate of hot restarts / fast restarts of the device is low.

[0004] Therefore, how to process the data to quickly restore the data plane and control plane to a consistent state and improve the success rate of hot restart / fast restart of the device is an urgent problem to be solved. Summary of the Invention

[0005] One objective of this application is to provide a device restart method to solve, or at least partially solve, the problems in the related art. A second objective of this application is to provide a device restart apparatus. A third objective of this application is to provide a device. A fourth objective of this application is to provide a medium.

[0006] To achieve the above objectives, the technical solution of this application is as follows:

[0007] A device restart method, characterized in that the method includes:

[0008] After the device's control plane restarts, a first view is generated based on the configuration information of the control plane; the first view includes each first object configured in the control plane.

[0009] A second view is generated based on the configuration information of the data plane; the second view includes each of the second objects configured in the data plane.

[0010] From the second view, candidate objects corresponding to each of the first objects are determined; the candidate objects of the first objects are: second objects of the same type as the first objects, and whose attributes, except for the filtering attributes, are consistent with the attributes in the first objects; the filtering attributes include: attributes of type object, and attributes set only at creation time;

[0011] Based on the candidate objects, generate a candidate object list for each first object;

[0012] Based on the candidate object list, the configuration information of the data plane is configured to be consistent with the configuration information of the control plane.

[0013] Optionally, from the second view, determining the candidate objects corresponding to each of the first objects includes:

[0014] Extract second objects of the same type as the first object one by one from the second view, and compare their attributes with those of the first object;

[0015] If the attribute of the second object is the filtering attribute, skip comparing the attribute.

[0016] Determine whether all attributes in the second object, except for the filtering attribute, are the same as those in the first object;

[0017] If it is determined that all attributes of the second object, except for the filtering attribute, are the same as those of the first object, then the second object is determined to be a candidate object of the first object.

[0018] Optionally, the second attribute of the second object is a list, and determining whether all attributes in the second object, except for the filtering attribute, are the same as the attributes of the first object includes:

[0019] Determine the first attribute in the first object that corresponds to the second attribute; the first attribute is a list and has the same name as the second attribute.

[0020] Determine whether the list length of the second attribute is the same as the list length of the first attribute;

[0021] If the list length of the second attribute is the same as the list length of the first attribute, determine whether the type of each member in the second attribute is the same as the type of each member in the first attribute.

[0022] If the type of each member in the second attribute is the same as the type of each member in the first attribute, then the second attribute is determined to be the same as the first attribute.

[0023] Optionally, after the device's control plane restarts, a first view is generated based on the control plane's configuration information, including:

[0024] Determine whether the control plane has completed the restart;

[0025] If the control plane has completed its restart, obtain the current configuration information of the control plane.

[0026] The first view is generated by parsing the configuration information of the control plane and extracting each first object configured in the control plane.

[0027] Optionally, based on the data plane configuration information, a second view is generated, including:

[0028] The configuration information of the data plane is obtained from the target file; the target file is used to back up the configuration information of the data plane.

[0029] The second view is generated by parsing the configuration information of the data plane and extracting each second object configured in the data plane.

[0030] Optionally, configuring the configuration information of the data plane to be consistent with the configuration information of the control plane based on the candidate object list includes:

[0031] Obtain the first object and the candidate object list of the first object;

[0032] Detect whether a first target object corresponding to the first object exists in the candidate object list of each first object; the content of the first target object is completely consistent with the first object.

[0033] If the first target object corresponding to the first object does not exist in the candidate object list of the first object, a second target object is determined from each of the second objects in the second view; the second target object is the object with the highest similarity to the first object among the second objects in the second view;

[0034] Delete the second target object, and generate a reconstructed object corresponding to the first object in the second view according to the first object;

[0035] After all the first objects in the first view have been detected, the configuration information of the data plane is adjusted according to the second view.

[0036] Optionally, generating a candidate object list for each first object based on the candidate objects includes:

[0037] Based on the identifier of each first object, create a list of candidate objects corresponding to the identifier of each first object in the key-value database;

[0038] Add the candidate object of the first object to the candidate object list corresponding to the identifier of the first object.

[0039] A device restart apparatus, the apparatus comprising:

[0040] The first generation module is used to generate a first view based on the configuration information of the control plane after the control plane of the device is restarted; the first view includes each first object configured by the control plane.

[0041] The second generation module is used to generate a second view based on the configuration information of the data plane; the second view includes each of the second objects configured in the data plane.

[0042] The first determining module is used to determine candidate objects corresponding to each of the first objects from the second view; the candidate objects of the first objects are: second objects of the same type as the first objects, and whose attributes, except for the filtering attributes, are consistent with the attributes in the first objects; the filtering attributes include: attributes of type object, and attributes set only at creation time;

[0043] The third generation module is used to generate a candidate object list for each first object based on the candidate objects.

[0044] A configuration module is used to configure the configuration information of the data plane to be consistent with the configuration information of the control plane based on the candidate object list.

[0045] The second determining module is used to confirm that the device has completed the restart when the configuration information of the data plane is consistent with the configuration information of the control plane.

[0046] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the device restart method described above.

[0047] A non-volatile storage medium storing a computer program that, when executed by a processor, implements the device restart method described above.

[0048] The beneficial effects of this application are:

[0049] In this application, after the control plane of the device restarts, a first view is generated based on the configuration information of the control plane; the first view includes each first object configured by the control plane; a second view is generated based on the configuration information of the data plane; the second view includes each second object configured by the data plane; candidate objects corresponding to each first object are determined from the second view; the candidate objects of the first objects are: second objects of the same type as the first objects, and whose attributes, except for filtering attributes, are consistent with the attributes in the first objects; the filtering attributes include: attributes of object type and attributes set only at creation time; a candidate object list is generated for each first object based on the candidate objects; the configuration information of the data plane is configured to be consistent with the configuration information of the control plane based on the candidate object list; if the configuration information of the data plane is consistent with the configuration information of the control plane, the device restart is confirmed to be complete. In this way, during a device hot restart / fast restart, after the control plane restarts separately, it first obtains the candidate object list corresponding to each first object in the control plane. Since the candidate objects in the candidate object list are second objects of the same type as the first objects and whose attributes, except for the filtering attributes, are consistent with the attributes in the first objects, not only can the filtering attributes be skipped and candidate objects be quickly selected, but also, based on the candidate objects, it can quickly determine which objects in the data plane are already consistent with the control plane. In this way, the amount of data processing required to maintain data consistency between the control plane and the data plane during a device hot restart / fast restart is reduced, which effectively reduces the data processing error rate. At the same time, the configuration information of the data plane is quickly configured to be consistent with the configuration information of the control plane, improving the success rate of device hot restart / fast restart. Attached Figure Description

[0050] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0051] Figure 1 This is a schematic diagram of the system architecture described in one embodiment of this application;

[0052] Figure 2 This is a flowchart of a device restart method described in one embodiment of this application;

[0053] Figure 3 This is a partial logic diagram of the device restart method described in one embodiment of this application;

[0054] Figure 4 This is a partial logical diagram illustrating the determination of candidate objects in one embodiment of this application;

[0055] Figure 5 This is a schematic diagram of the device restart device described in one embodiment of this application.

[0056] Among them, 500-device restart device, 501-first generation module, 502-second generation module, 503-first determination module, 504-third generation module, 505-configuration module, and 506-second determination module. Detailed Implementation

[0057] The embodiments of this application will be described below with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be understood that the preferred embodiments are only for illustrating this application and are not intended to limit the scope of protection of this application.

[0058] Based on the above problems, this application proposes that during the hot restart / fast restart process of the device, candidate matching objects in the control plane are pre-screened, thereby quickly identifying which objects in the data plane are consistent with the objects in the control plane, thereby reducing the amount of data processing, lowering the error rate of matching objects, and improving the success rate of hot restart / fast restart of the device.

[0059] In this application, the equipment used in this solution is computer equipment such as switches and routers configured with SONiC systems. The basic function of a switch is to connect multiple network devices (such as computers, servers, printers, etc.). The switching chip is a core component in network communication equipment, an integrated circuit that realizes data exchange. It is mainly used in devices such as switches and routers in communication networks, and its main functions include receiving, storing, forwarding, and filtering data packets to enable communication between different network nodes. After installing SONiC on the switch, SONiC provides a Fast Reboot function, which ensures that the Data Plane interruption does not exceed 30 seconds during the upgrade process; the Warm Reboot function can control the Data Plane interruption to within one second, and on many existing general-purpose platforms, it can even achieve uninterrupted upgrades.

[0060] Warm-Reboot refers to a hot reboot, a method that can reload or update network device software without interrupting data forwarding. Fast-Reboot refers to a fast reboot.

[0061] Control Plane: Contains the necessary information to maintain data plane operations. This information is collected and computed through protocols and algorithms. Control planes between network nodes can exchange information. This processed information is used to create different tables to assist in data plane traffic management.

[0062] The data plane, also known as the forwarding plane, checks the destination address of received traffic and processes its direction according to the forwarding table. It may forward traffic to an outgoing interface, discard traffic, or send it to the control plane for further processing.

[0063] ASIC (Application Specific Integrated Circuit): A specialized integrated circuit / chip used in applications such as electronics. In a switch, the ASIC is a crucial hardware component. It is a dedicated integrated circuit chip that rapidly processes data packets, enabling high-speed data packet switching. The specific state of the ASIC is reflected in the data plane.

[0064] Reference Figure 1 , Figure 1This is a schematic diagram of the system architecture described in one embodiment of this application. In SONiC, the upper-layer user space includes orchagent (orchestration agent), Redis (key-value database), and syncd (synchronization agent), the middle layer is the driver ASICSDK (Software Development Kit), and the lower layer is the hardware ASIC.

[0065] Reference Figure 2 , Figure 2 This is a flowchart of a device restart method described in one embodiment of this application. Figure 2 As shown, in one embodiment of this application, the device restart method can be executed according to the following steps:

[0066] Step S201: After the control plane of the device is restarted, a first view is generated according to the configuration information of the control plane; the first view includes each first object configured by the control plane.

[0067] Specifically, to avoid disrupting normal business operations, a hot reboot / fast reboot is performed on the device when configuration updates or upgrades are required. This involves first rebooting the control plane via software, while the hardware remains unchanged, and the data plane remains the same. After the control plane reboots, the hardware configuration is modified from top to bottom to adjust the data in the data plane to match its state (restoring the ASIC state to be consistent with the control plane state). At this point, after the device's control plane reboots, a first view corresponding to the control plane is generated based on the control plane's configuration information. This first view includes all objects currently configured in the control plane. The first object is the object of the control plane.

[0068] Step S202: Generate a second view based on the configuration information of the data plane; the second view includes each of the second objects configured in the data plane.

[0069] Specifically, after obtaining the first view, a second view needs to be generated based on the data plane's configuration information. The second view includes all objects configured in the data plane. These second objects are, in essence, the objects within the data plane. To facilitate comparison between the control plane and the data plane, the first and second views use the same data format.

[0070] Step S203: From the second view, determine the candidate objects corresponding to each of the first objects; the candidate objects of the first objects are: second objects of the same type as the first objects, and whose attributes, except for the filtering attributes, are consistent with the attributes in the first objects; the filtering attributes include: attributes of type object, and attributes set only when created.

[0071] Specifically, in related technologies, during device hot restart / fast restart, to ensure consistency between the information in the control plane and the ASIC, objects in both are recursively compared one by one. If the contents of two objects are completely identical, they are assumed to be the same object. In this application, before recursively comparing objects in both, candidate objects in the control plane are first determined. Candidate objects are: second objects of the same type as the first object, and whose attributes, except for filtering attributes, are consistent with those in the first object. Filtering attributes include: attributes of type object and attributes set only at creation time. When determining candidate objects, second objects of the same type as the first object are first filtered out, and the next attribute comparison is only performed with these filtered second objects. During attribute comparison, only the attributes other than filtering attributes are compared for similarity. Filtering attributes include: attributes of type object and attributes set only at creation time. That is, attributes of type object with long matching times are not compared, and attributes set only at creation time are restricted to being set only at creation time and do not change before or after hot restart, therefore, they are not compared either. After removing the filtering attributes and comparing other attributes, if all matches are found, then the object is identified as a candidate. This saves time in object comparison.

[0072] Step S204: Generate a candidate object list for each first object based on the candidate objects.

[0073] Specifically, there may be multiple candidate objects corresponding to the first object. In order to facilitate data extraction, these candidate objects are all added to the candidate object list of the first object.

[0074] Step S205: Based on the candidate object list, configure the configuration information of the data plane to be consistent with the configuration information of the control plane.

[0075] Specifically, since the candidate objects in the candidate object list are of the same type as the first object and have all attributes (except for the filtering attributes) that are consistent with those in the first object, the candidate object list has filtered out the vast majority of objects in the second view that differ from those in the first view. Therefore, based on the candidate object lists of each first object, by matching the candidate objects in the candidate object lists that have some attributes that are the same as those of the first object, the second objects that are the same as the first object can be quickly identified. This allows for the rapid determination of which data in the data plane is the same as that in the control plane and which data in the data plane differs from that in the control plane.

[0076] For data that is already identical to that in the control plane, there is no need to recursively query for differences one by one, greatly reducing the amount of data processing required to determine whether the data in the control plane and the data plane are consistent. For objects where there are differences between the data plane and the control plane, adjustments can be made to ultimately configure the data plane's configuration information to be consistent with the control plane's configuration information.

[0077] Step S206: If the configuration information of the data plane is consistent with the configuration information of the control plane, confirm that the device has completed the restart.

[0078] Specifically, after confirming that the configuration information of the data plane is consistent with the configuration information of the control plane, the device restart is completed without interruption, realizing the device's fast restart / warm restart.

[0079] In this embodiment, after the device's control plane restarts, a first view is generated based on the control plane's configuration information; the first view includes each first object configured by the control plane; a second view is generated based on the data plane's configuration information; the second view includes each second object configured by the data plane; candidate objects corresponding to each first object are determined from the second view; the candidate objects of the first objects are: second objects of the same type as the first objects, and whose attributes, except for filtering attributes, are consistent with the attributes in the first objects; the filtering attributes include: attributes of object type and attributes set only during creation; a candidate object list is generated for each first object based on the candidate objects; the configuration information of the data plane is configured to be consistent with the configuration information of the control plane based on the candidate object list; if the configuration information of the data plane is consistent with the configuration information of the control plane, the device restart is confirmed to be complete. In this way, during a device hot restart / fast restart, after the control plane restarts separately, it first obtains the candidate object list corresponding to each first object in the control plane. Since the candidate objects in the candidate object list are second objects of the same type as the first objects and whose attributes, except for the filtering attributes, are consistent with the attributes in the first objects, not only can the filtering attributes be skipped and candidate objects be quickly selected, but also, based on the candidate objects, it can quickly determine which objects in the data plane are already consistent with the control plane. In this way, the amount of data processing required to maintain data consistency between the control plane and the data plane during a device hot restart / fast restart is reduced, which effectively reduces the data processing error rate. At the same time, the configuration information of the data plane is quickly configured to be consistent with the configuration information of the control plane, improving the success rate of device hot restart / fast restart.

[0080] In one feasible implementation, determining the candidate objects corresponding to each of the first objects from the second view may specifically include:

[0081] Extract second objects of the same type as the first object one by one from the second view, and compare their attributes with the first object; if the attribute of the second object is the filtering attribute, skip the comparison of the attribute; determine whether all attributes of the second object except the filtering attribute are the same as the attributes of the first object; if it is determined that all attributes of the second object except the filtering attribute are the same as the attributes of the first object, determine the second object as a candidate object of the first object.

[0082] Specifically, when determining candidate objects corresponding to the first object, second objects of different types are first filtered out. For each second object of the same type, attribute comparison is performed. During attribute comparison, for some filterable attributes, the comparison of the next attribute can be skipped. It is determined whether all attributes in the second object, excluding the filtered attributes, are the same as those in the first object. If for all remaining attributes in the second object, excluding the filtered attributes, there are attributes in the first object that are identical to these remaining attributes, then it is determined that all attributes in the second object, excluding the filtered attributes, are identical to those in the first object, and this second object is a candidate object for the first object.

[0083] In this implementation, filtered attributes do not require matching, saving data processing time. Among the remaining attributes, those differing from the attributes of the first object are not selected as candidate objects. Thus, based on candidate objects, it is possible to quickly identify which objects in the control plane and data plane are matched concurrently. Reducing the amount of matching data and quickly determining which objects have not changed, and detecting their consistency with the control plane, helps improve the efficiency of hot restarts / fast restarts.

[0084] Following the above implementation method, in one feasible implementation, the second attribute of the second object is a list, and determining whether all attributes of the second object, except for the filtering attribute, are the same as the attributes of the first object includes:

[0085] Determine the first attribute in the first object corresponding to the second attribute; the first attribute is a list and has the same name as the second attribute; determine whether the list length of the second attribute is the same as the list length of the first attribute; if the list length of the second attribute is the same as the list length of the first attribute, determine whether the type of each member in the second attribute is the same as the type of each member in the first attribute; if the type of each member in the second attribute is the same as the type of each member in the first attribute, determine that the second attribute is the same as the first attribute.

[0086] Specifically, when determining whether the attributes of two objects are the same, if the attribute is a list, the system checks whether the list length and the type of each member are the same. This avoids the time-consuming field-by-field comparison when the list contains a large amount of data. In this implementation, for scenarios where the attribute is a list, determining whether two attributes are consistent by checking the list length and the type of the members allows for targeted matching of the list, reducing the time spent on matching all fields and further improving attribute matching efficiency.

[0087] In one feasible implementation, the step of generating a first view based on the configuration information of the control plane after the device's control plane restarts includes:

[0088] Determine whether the control plane has completed a restart; if the control plane has completed a restart, obtain the current configuration information of the control plane; parse out each first object configured in the control plane from the configuration information of the control plane, and generate the first view.

[0089] Specifically, the system detects whether the control plane has completed its restart. Upon confirming a restart, it retrieves and parses the current control plane's configuration information, extracts the first objects configured in the control plane, adds them to the corresponding view of the control plane, and generates a first view. In this embodiment, by generating the first view, the various first objects configured in the control plane are stored in a standardized manner to facilitate subsequent comparison of data between the control plane and the data plane.

[0090] Optionally, the determination of whether the control plane has completed restarting can be based on the status of the control plane's restart thread. For example, after a user modifies the control plane's configuration information through management software, the device issues a restart command to the control plane, invoking the control plane's restart thread to restart. If the restart thread of the control plane is in an idle state, then the control plane is determined to have completed restarting. In this way, the control plane's configuration information can be determined promptly during device hot restarts / fast restarts, improving the speed of state recovery.

[0091] Reference Figure 3 and Figure 4 , Figure 3 This is a partial logic diagram of the device restart method described in one embodiment of this application. Figure 4 This is a partial logical diagram illustrating the determination of candidate objects in one embodiment of this application. For example... Figure 3As shown, in one embodiment of this application, the system ensures that the information of the control plane is consistent with the information of the ASIC through the following steps: orchagent is responsible for processing and sending all configuration information of the control plane, and finally pushing it to ASIC_DB (i.e., the target file); syncd subscribes to ASIC_DB, calls the interface of the ASIC SDK, and sends it to the ASIC through the ASIC driver; the state changes of the ASIC are also synchronized back to ASIC_DB through syncd; before restarting the control plane, the data in ASIC_DB is backed up, and asic_view (i.e., the second view) can be generated; after restarting, orchagent regenerates a copy of the data according to the current configuration information of the control plane, called temp_view (i.e., the first view).

[0092] In related technologies, applying a view at this point involves recursively comparing objects in both systems. If the contents of two objects are identical, they are assumed to be the same object, and the data is consistent. If the contents of one object are different, an attempt is made to delete it on the ASIC and then rebuild it. If deletion and rebuilding are not possible, the apply view fails. If the apply view succeeds, it ensures that the data in the ASIC_DB of the control plane is consistent with the state on the chip.

[0093] This application proposes that, before applying the view, a list of candidate objects corresponding to each object in the control plane is obtained in advance, and during the application view, a query is first performed from the corresponding candidate object list. Specifically, as follows... Figure 4 As shown, the process of generating candidate object lists for each object in the control plane can be exemplified by the following steps:

[0094] Step s1. Create a function createPreMatchForGeneric, which supports execution of s2-s13;

[0095] Step s2. Create a dictionary preMatchMap with the key being the object ID and the value being a list of candidate objects for this object;

[0096] Step s3. Iterate through the objects in temp_view, get a tempObj, and get the type of tempObj;

[0097] Step s4. Iterate through all objects in asic_view, get an asicObj, and get the type of asicObj;

[0098] Step s5. If the type in step s3 and the type in step s4 are inconsistent, return to step s2 to continue; otherwise, continue.

[0099] Step s6. Iterate through all the attributes of tempObj and get a tempAttr (one of the attributes); get the attrId of tempAttr, and get asicAttr (an attribute of an object in the data plane) from asic_view based on this attrId;

[0100] Step s7. If the isObjectAttr property of tempAttr is true (the property type is object), return to step s5; otherwise, continue.

[0101] Step s8. If the isCreateOnly property of tempAttr is true (this property is only set on creation), return to step s5; otherwise, continue.

[0102] Step s9. Define a variable, hasNotEqualAttr, to record whether there are unequal attributes, the default value is False;

[0103] Step s10. If the isList property of tempAttr is true (this property is a list), use getSize to get the list lengths of tempAttr and asicAttr. If they are not equal, hasNotEqualAttr=True; if they are equal, check if the types of all members are the same. If they are different, hasNotEqualAttr=True.

[0104] Step s11. If the value of tempAttr is empty, use getDefaultValue to get its default value; compare the values ​​of tempAttr and asicAttr. If they are different, hasNotEqualAttr = True; if they are the same, return to step s5.

[0105] Step s12. After traversing all the attributes of tempObj, if hasNotEqualAttr is False, add asicObj to the candidate object list of asicObj and record it in preMatchMap in step s2.

[0106] Step s13. Repeat steps s3-s12 to obtain candidate objects for all objects in the control plane and return preMatchMap.

[0107] After the above steps, a list of candidate objects corresponding to each first object is obtained.

[0108] When applying the view, the createPreMatchForGeneric function in step s1 is called first to obtain the preMatchMap, and candidate objects of the object are used for matching first. After all objects are matched, the state of the switch control plane is consistent with the state of the ASIC, and the state recovery of the fast start is completed.

[0109] By applying the technical solution of this embodiment, invalid matching can be reduced during the state recovery of a fast startup, resulting in a faster state recovery speed; moreover, after a series of screenings, the matching efficiency is higher, reducing the possibility of random matching; thereby improving the success rate of fast startup.

[0110] In one feasible implementation, generating the second view based on the configuration information of the data plane includes:

[0111] The configuration information of the data plane is obtained from the target file; the target file is used to back up the configuration information of the data plane; each second object of the data plane configuration is parsed from the configuration information of the data plane to generate the second view.

[0112] Specifically, referring to the above embodiment, orchagent is responsible for processing and sending all configuration information of the control plane, and finally pushing it to ASIC_DB; syncd subscribes to ASIC_DB, calls the ASIC SDK interface, and distributes it to the ASIC through the ASIC driver; ASIC state changes are also synchronized back to ASIC_DB through syncd; before restarting the control plane, the data in ASIC_DB is backed up and a target file is generated. After the control plane restarts separately, the configuration information of the data plane can be obtained from the target file, parsed, and the various second objects of the data plane configuration are added to the corresponding view of the data plane to generate a second view.

[0113] In this embodiment, by generating a first view, each second object configured in the data plane is stored in a standardized manner so that the data of the control plane and the data plane can be compared later.

[0114] In one feasible implementation, configuring the configuration information of the data plane to be consistent with the configuration information of the control plane based on the candidate object list includes:

[0115] Obtain the first object and the candidate object list of the first object;

[0116] Detect whether a first target object corresponding to the first object exists in the candidate object list of each first object; the content of the first target object is completely consistent with the first object.

[0117] If the first target object corresponding to the first object does not exist in the candidate object list of the first object, a second target object is determined from each of the second objects in the second view; the second target object is the object with the highest similarity to the first object among the second objects in the second view;

[0118] Delete the second target object, and generate a reconstructed object corresponding to the first object in the second view according to the first object;

[0119] After all the first objects in the first view have been detected, the configuration information of the data plane is adjusted according to the second view.

[0120] Specifically, after obtaining the first object and its candidate object list, the system checks whether a first target object corresponding to the first object exists in the candidate object list of each first object; the content of the first target object is completely identical to the first object. For this part of the data, the control plane and data plane are the same. If the first target object corresponding to the first object does not exist in the candidate object list of the first object, a second target object is determined from each second object in the second view; the second target object is the object with the highest similarity to the first object among the second objects in the second view. For example, if the candidate object list of the first object is empty, the recursive query method of the original apply view is applied to query matching objects with high similarity to the first object for deletion and reconstruction. After all first objects in the first view have been detected, the second view and the first view are now identical. Figure 1 Accordingly, the configuration information of the data plane is adjusted based on the second view.

[0121] In this embodiment, each object is compared according to the candidate object list to determine which objects in the data plane and control plane are completely identical. For different objects, they are deleted and rebuilt, and the configuration information of the data plane is configured to be consistent with the configuration information of the control plane. In this way, the state recovery during device hot restart / fast restart is achieved.

[0122] In one feasible implementation, generating a candidate object list for each first object based on the candidate objects includes:

[0123] Based on the identifiers of each of the first objects, a list of candidate objects corresponding to the identifiers of each of the first objects is created in the key-value database; the candidate objects of the first objects are added to the list of candidate objects corresponding to the identifiers of the first objects.

[0124] Specifically, referring to the above embodiment, based on the identifiers (such as name, number, etc.) of each of the first objects, a candidate object list corresponding to each identifier of the first object is created in the key-value database (Redis): a new dictionary is created, with the object identifier as the key and the candidate object list for this object as the value. Each candidate object of the first object is then added to the candidate object list corresponding to the identifier of the first object.

[0125] In this embodiment, by generating a candidate object list for the first object, the matching objects (of the same type and highly similar content) corresponding to the subsequent search objects are improved, thereby improving data processing efficiency.

[0126] Reference Figure 5 , Figure 5 This is a schematic diagram of the device restarting apparatus described in one embodiment of this application. Figure 5 As shown, in one embodiment of this application, based on the same or similar technical concept as the above method embodiments, a device restart device 500 is proposed, the device comprising:

[0127] The first generation module 501 is used to generate a first view based on the configuration information of the control plane after the control plane of the device is restarted; the first view includes each first object configured by the control plane.

[0128] The second generation module 502 is used to generate a second view based on the configuration information of the data plane; the second view includes each of the second objects configured in the data plane.

[0129] The first determining module 503 is used to determine candidate objects corresponding to each of the first objects from the second view; the candidate objects of the first objects are: second objects of the same type as the first objects, and whose attributes, except for the filtering attributes, are consistent with the attributes in the first objects; the filtering attributes include: attributes of type object, and attributes set only at creation time;

[0130] The third generation module 504 is used to generate a candidate object list for each first object based on the candidate objects.

[0131] The configuration module 505 is used to configure the configuration information of the data plane to be consistent with the configuration information of the control plane according to the candidate object list;

[0132] The second determining module 506 is used to confirm that the device has completed the restart when the configuration information of the data plane is consistent with the configuration information of the control plane.

[0133] In this embodiment, after the device's control plane restarts, a first view is generated based on the control plane's configuration information; the first view includes each first object configured by the control plane; a second view is generated based on the data plane's configuration information; the second view includes each second object configured by the data plane; candidate objects corresponding to each first object are determined from the second view; the candidate objects of the first objects are: second objects of the same type as the first objects, and whose attributes, except for filtering attributes, are consistent with the attributes in the first objects; the filtering attributes include: attributes of object type and attributes set only during creation; a candidate object list is generated for each first object based on the candidate objects; the configuration information of the data plane is configured to be consistent with the configuration information of the control plane based on the candidate object list; if the configuration information of the data plane is consistent with the configuration information of the control plane, the device restart is confirmed to be complete. In this way, during a device hot restart / fast restart, after the control plane restarts separately, it first obtains the candidate object list corresponding to each first object in the control plane. Since the candidate objects in the candidate object list are second objects of the same type as the first objects and whose attributes, except for the filtering attributes, are consistent with the attributes in the first objects, not only can the filtering attributes be skipped and candidate objects be quickly selected, but also, based on the candidate objects, it can quickly determine which objects in the data plane are already consistent with the control plane. In this way, the amount of data processing required to maintain data consistency between the control plane and the data plane during a device hot restart / fast restart is reduced, which effectively reduces the data processing error rate. At the same time, the configuration information of the data plane is quickly configured to be consistent with the configuration information of the control plane, improving the success rate of device hot restart / fast restart.

[0134] In one feasible implementation, the determining module 503 includes:

[0135] The extraction module is used to extract second objects of the same type as the first object from the second view one by one, and compare their attributes with those of the first object.

[0136] The skip module is used to skip comparing the attribute when the attribute of the second object is the filter attribute;

[0137] The first determining submodule is used to determine whether all attributes of the second object, except for the filtering attribute, are the same as the attributes of the first object;

[0138] The second determining submodule is used to determine the second object as a candidate object of the first object when it is determined that all attributes of the second object except for the filtering attribute are the same as those of the first object.

[0139] In one feasible implementation, the second attribute of the second object is a list, and the aforementioned first determining submodule includes:

[0140] The first submodule is used to determine the first attribute in the first object that corresponds to the second attribute; the first attribute is a list and has the same name as the second attribute.

[0141] The first submodule is used to determine whether the list length of the second attribute is the same as the list length of the first attribute.

[0142] The first determination of the third submodule is used to determine whether the type of each member in the second attribute is the same as the type of each member in the first attribute when the list length of the second attribute is the same as the list length of the first attribute.

[0143] The first determination of the fourth submodule is used to determine that the second attribute is the same as the first attribute when the types of each member in the second attribute are the same as the types of each member in the first attribute.

[0144] This application contains a limited description of the device embodiments; for details, please refer to the above method embodiments, which will not be repeated here.

[0145] In one embodiment of this application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the device restart method described above.

[0146] In one embodiment of this application, a non-volatile storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, it implements the device restart method as described in the above embodiments.

[0147] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0148] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0149] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0150] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0151] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0152] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.

[0153] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0154] The above provides a detailed description of the device restart method, apparatus, electronic device, and medium. Specific examples have been used to illustrate the principles and embodiments of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in specific embodiments and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A device restart method, characterized in that, The method includes: After the device's control plane restarts, a first view is generated based on the configuration information of the control plane; the first view includes each first object configured in the control plane. A second view is generated based on the configuration information of the data plane; the second view includes each of the second objects configured in the data plane. From the second view, candidate objects corresponding to each of the first objects are determined; the candidate objects of the first objects are: second objects of the same type as the first objects, and whose attributes, except for the filtering attributes, are consistent with the attributes in the first objects; the filtering attributes include: attributes of type object, and attributes set only at creation time; Based on the candidate objects, generate a candidate object list for each first object; Based on the candidate object list, the configuration information of the data plane is configured to be consistent with the configuration information of the control plane; If the configuration information of the data plane is consistent with the configuration information of the control plane, confirm that the device has completed the restart; The step of configuring the configuration information of the data plane to be consistent with the configuration information of the control plane according to the candidate object list includes: Obtain the first object and the candidate object list of the first object; check whether there is a first target object corresponding to the first object in the candidate object list of each first object; the content of the first target object is completely consistent with the first object; If the first target object corresponding to the first object does not exist in the candidate object list of the first object, a second target object is determined from each of the second objects in the second view; the second target object is the object with the highest similarity to the first object among the second objects in the second view; The second target object is deleted, and a reconstructed object corresponding to the first object is generated in the second view according to the first object; after all the first objects in the first view have been detected, the configuration information of the data plane is adjusted according to the second view.

2. The method according to claim 1, characterized in that, From the second view, determine the candidate objects corresponding to each of the first objects, including: Extract second objects of the same type as the first object one by one from the second view, and compare their attributes with those of the first object; If the attribute of the second object is the filtering attribute, skip comparing the attribute. Determine whether all attributes in the second object, except for the filtering attribute, are the same as those in the first object; If it is determined that all attributes of the second object, except for the filtering attribute, are the same as those of the first object, then the second object is determined to be a candidate object of the first object.

3. The method according to claim 2, characterized in that, The second attribute of the second object is a list, and determining whether all attributes in the second object, except for the filtering attribute, are the same as the attributes of the first object includes: Determine the first attribute in the first object that corresponds to the second attribute; the first attribute is a list and has the same name as the second attribute. Determine whether the list length of the second attribute is the same as the list length of the first attribute; If the list length of the second attribute is the same as the list length of the first attribute, determine whether the type of each member in the second attribute is the same as the type of each member in the first attribute. If the type of each member in the second attribute is the same as the type of each member in the first attribute, then the second attribute is determined to be the same as the first attribute.

4. The method according to claim 1, characterized in that, After the device's control plane restarts, a first view is generated based on the control plane's configuration information, including: Determine whether the control plane has completed the restart; If the control plane has completed its restart, obtain the current configuration information of the control plane. The first view is generated by parsing the configuration information of the control plane and extracting each first object configured in the control plane.

5. The method according to claim 1, characterized in that, Based on the data plane configuration information, a second view is generated, including: The configuration information of the data plane is obtained from the target file; the target file is used to back up the configuration information of the data plane. The second view is generated by parsing the configuration information of the data plane and extracting each second object configured in the data plane.

6. The method according to claim 1, characterized in that, The step of generating a candidate object list for each first object based on the candidate objects includes: Based on the identifier of each first object, create a list of candidate objects corresponding to the identifier of each first object in the key-value database; Add the candidate object of the first object to the candidate object list corresponding to the identifier of the first object.

7. A device restarting apparatus, characterized in that, The device includes: The first generation module is used to generate a first view based on the configuration information of the control plane after the control plane of the device is restarted; the first view includes each first object configured by the control plane. The second generation module is used to generate a second view based on the configuration information of the data plane; the second view includes each of the second objects configured in the data plane. The first determining module is used to determine candidate objects corresponding to each of the first objects from the second view; the candidate objects of the first objects are: second objects of the same type as the first objects, and whose attributes, except for the filtering attributes, are consistent with the attributes in the first objects; the filtering attributes include: attributes of type object, and attributes set only at creation time; The third generation module is used to generate a candidate object list for each first object based on the candidate objects. A configuration module is used to configure the configuration information of the data plane to be consistent with the configuration information of the control plane according to the candidate object list. The step of configuring the configuration information of the data plane to be consistent with the configuration information of the control plane according to the candidate object list includes: obtaining the first object and the candidate object list of the first object; detecting whether a first target object corresponding to the first object exists in the candidate object list of each first object; the content of the first target object is completely consistent with the first object; if the first target object corresponding to the first object does not exist in the candidate object list of the first object, determining a second target object from each second object in the second view; the second target object is the object with the highest similarity to the first object among the second objects in the second view; deleting the second target object, and generating a reconstructed object corresponding to the first object in the second view according to the first object; after all first objects in the first view have been detected, adjusting the configuration information of the data plane according to the second view. The second determining module is used to confirm that the device has completed the restart when the configuration information of the data plane is consistent with the configuration information of the control plane.

8. An electronic 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, it implements the device restart method as described in any one of claims 1-6.

9. A non-volatile storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the device restart method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Control plane recovery method and device, control node and storage medium

    CN114500289A

  • Switch restarting method and device, storage medium and electronic device

    CN117459482A