Equipment restarting method and device, equipment and medium
By generating respective views and determining a candidate object list after the device's control plane restarts, the problem of difficult to maintain data consistency between the control plane and the data plane in the device's hot restart/fast restart is solved, and the effect of improving the restart success rate is achieved.
Patent Information
- Application Number
- CN202411425874.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-10-12
AI Technical Summary
During the hot or fast restart of the device, data consistency between the control plane and the data plane is difficult to maintain, resulting in a low restart success rate.
After the control plane of the device is restarted, a view of the control plane and the data plane is generated, a list of candidate objects for each object is determined, and the configuration information of the data plane is configured to be consistent with the configuration information of the control plane according to the list.
This method quickly locks objects in the data plane that are consistent with the control plane by pre-filtering candidate objects, reducing data processing volume, reducing error rate, and improving the success rate of device hot restart/fast restart.
Smart Images

Figure CN119473709A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and mainly to a device restart method, apparatus, device and medium. Background Art
[0002] SONiC (Software for Open Networking in the Cloud) is an open source network operating system based on the Linux operating system. It provides rich network functions and flexible configuration options. It adopts a distributed architecture, separates the control plane and the data plane, and improves the reliability and fault tolerance of the system. After installing the SONiC system on the device, the hot / fast restart of the device can be realized: during the hot restart or fast restart process, only the control plane is restarted, and the hardware in the device (such as ASIC (Application Specific Integrated Circuit)) is not restarted, the state of the data plane remains unchanged, and the software of the control plane is reloaded and updated. During the loading of new software, SONiC ensures that the forwarding function of the data plane is not affected (the data of the forwarding plane remains unchanged at this time), thereby maintaining the continuity of network services. After the control plane is restarted, a series of means are used to keep the information of the control plane consistent with the information on the ASIC (the information on the forwarding plane).
[0003] In the related art, in order to keep the data of the control plane consistent with the forwarding plane after the control plane is restarted, a recursive query is performed to determine whether there is a difference between a certain object in the control plane configuration information and the corresponding matching object in the forwarding plane. If not, the two objects are considered to be completely consistent. If there is a difference, the matching object in the forwarding plane is adjusted to be consistent with the object in the control plane. However, when searching for a matching object corresponding to an object, if there are many objects with the same content, one is randomly selected as the matching object. At this time, in a scenario where an object has many objects of the same type and similar content, the randomly selected object may be wrong, resulting in a failure to maintain consistency; and when searching for a matching object corresponding to an object, if the attribute of the object is an object, the depth of the recursive query is uncontrollable, which takes a long time and thus times out, resulting in a failure to maintain consistency. In this way, the success rate of the hot restart / quick restart of the device is low.
[0004] Based on this, how to process data to quickly restore the data on the data plane and the 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 of the purposes of this application is to propose a device restart method to solve or at least partially solve the problems in the related art. The second purpose of this application is to provide a device restart apparatus, the third purpose of this application is to provide a device, and the fourth purpose of this application is to provide a medium.
[0006] In order to achieve the above purpose, the technical solution of this application is as follows: A device restart method, characterized in that the method comprises: After the control plane of the device is restarted, generating a first view according to the configuration information of the control plane; the first view includes each first object configured by the control plane; Generate a second view according to the configuration information of the data plane; the second view includes each second object configured by the data plane; Determine, from the second view, candidate objects corresponding to the first objects; the candidate objects of the first objects are: second objects of the same type as the first object, and each attribute except the filtering attribute is consistent with the attribute in the first object; the filtering attribute includes: an attribute of an object type and an attribute that is set only when creating; Generating a candidate object list for each first object according to the candidate objects; According to the candidate object list, the configuration information of the data plane is configured to be consistent with the configuration information of the control plane.
[0007] Optionally, determining, from the second view, candidate objects corresponding to the first objects respectively includes: Extracting second objects of the same type as the first object one by one from the second view, and performing attribute comparison with the first object; When the attribute of the second object is the filtering attribute, skip comparing the attribute; Determining whether all attributes of the second object except the filtering attribute are the same as the attributes of the first object; In the case where it is determined that all attributes of the second object except the filtering attribute are the same as the attributes of the first object, the second object is determined to be a candidate object of the first object.
[0008] Optionally, the second attribute of the second object is a list, and determining whether all attributes of the second object except the filtering attribute are the same as the attributes of the first object includes: Determine a 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; determining whether the length of the list of the second attribute is the same as the length of the list of the first attribute; In the case where the list length of the second attribute is the same as the list length of the first attribute, determining whether the type of each member in the second attribute is the same as the type of each member in the first attribute; In the case where the type of each member in the second attribute is the same as the type of each member in the first attribute, it is determined that the second attribute is the same as the first attribute.
[0009] Optionally, after the control plane of the device is restarted, generating a first view according to configuration information of the control plane includes: Determining whether the control plane has completed restarting; When it is determined that the control plane has completed restarting, obtaining configuration information of the current control plane; The first objects configured in the control plane are parsed from the configuration information of the control plane to generate the first view.
[0010] Optionally, generating a second view according to configuration information of the data plane includes: Acquire the configuration information of the data plane from a target file; the target file is used to back up the configuration information of the data plane; The second objects configured in the data plane are parsed from the configuration information of the data plane to generate the second view.
[0011] Optionally, 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: Acquire the first object and the candidate object list of the first object; Detecting 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 there is no first target object corresponding to the first object in the candidate object list of the first object, determining a second target object from 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 first objects in the first view are detected, the configuration information of the data plane is adjusted according to the second view.
[0012] Optionally, generating a candidate object list for each first object according to the candidate objects includes: According to the identifiers of the first objects, a candidate object list corresponding to the identifiers of the first objects is created in a key-value database; The candidate object of the first object is added to the candidate object list corresponding to the identifier of the first object.
[0013] A device restarting apparatus, the apparatus comprising: A first generating module, configured to generate a first view according to configuration information of the control plane after the control plane of the device is restarted; the first view includes various first objects configured in the control plane; A second generating module, configured to generate a second view according to the configuration information of the data plane; the second view includes each second object configured in the data plane; A first determination module is used to determine, from the second view, candidate objects corresponding to the first objects respectively; the candidate objects of the first object are: second objects of the same type as the first object, and each attribute of which, except for a filtering attribute, is consistent with an attribute in the first object; the filtering attribute includes: an attribute of an object type, and an attribute that is set only when the object is created; A third generating module, configured to generate a candidate object list for each first object according to the candidate objects; A configuration module, configured 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 second determination module is used to confirm that the device has completed restarting when the configuration information of the data plane is consistent with the configuration information of the control plane.
[0014] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned device restart method when executing the computer program.
[0015] A non-volatile storage medium stores a computer program, which, when executed by a processor, implements the above-mentioned device restart method.
[0016] Beneficial effects of this application: In the present application, 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 the various first objects configured by the control plane; a second view is generated according to the configuration information of the data plane; the second view includes the various second objects configured by the data plane; from the second view, candidate objects corresponding to each of the first objects are determined; the candidate objects of the first object are: a second object of the same type as the first object, and each attribute except the filtering attribute is consistent with the attribute in the first object; the filtering attribute includes: an attribute type of the object, an attribute set only during creation; based on the candidate objects, a candidate object list of each first object is generated; 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; when the configuration information of the data plane is consistent with the configuration information of the control plane, it is confirmed that the device has completed the restart. In this way, when the device is hot restarted / quickly restarted, after the control plane is restarted separately, a list of candidate objects corresponding to each first object of the control plane is first obtained. Since the candidate objects in the candidate object list are: second objects of the same type as the first object and each attribute except the filter attribute is consistent with the attribute in the first object, not only can the filter attribute be skipped and the candidate objects can be quickly screened out, but based on the candidate objects, it is also possible to quickly determine which objects in the data plane are already consistent with the control plane. In this way, the amount of data processing to maintain the consistency of control plane and data plane data when the device is hot restarted / quickly restarted is reduced, and the data processing error rate is effectively reduced. 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, thereby improving the success rate of the device hot restart / quick restart. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 is a schematic diagram of the architecture of the system described in one embodiment of the present application; Figure 2 is a flow chart of a device restart method described in an embodiment of the present application; Figure 3 It is a partial logic diagram of the device restart method described in an embodiment of the present application; Figure 4 It is a partial logic schematic diagram of determining candidate objects in one embodiment of the present application; Figure 5It is a schematic diagram of the framework of the device restarting apparatus described in one embodiment of the present application.
[0019] Among them, 500-device restarting device, 501-first generating module, 502-second generating module, 503-first determining module, 504-third generating module, 505-configuration module, 506-second determining module. DETAILED DESCRIPTION
[0020] The following will describe the implementation methods of the present application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, not for limiting the scope of protection of the present application.
[0021] Based on the above problems, the present application proposes that during the hot restart / quick restart process of the device, candidate matching objects of objects in the control plane are pre-screened, so as to quickly lock which objects in the data plane are consistent with the objects in the control plane, thereby reducing the amount of data processing, reducing the error rate of matching objects, and improving the success rate of hot restart / quick restart of the device.
[0022] In this application, the devices used in this solution are computer devices such as switches and routers equipped with a SONiC system. The basic function of a switch is to connect multiple network devices (such as computers, servers, printers, etc.). The switching chip is the core component of network communication equipment and is an integrated circuit that realizes data exchange. It is mainly used in switches, routers and other devices in communication networks. Its main functions include receiving, storing, forwarding and filtering data packets to achieve communication between different network nodes. After SONiC is installed on the switch, SONiC provides a Fast Reboot function, which can ensure that the Data Plane interruption does not exceed 30 seconds during the upgrade process; the Warm Reboot function can control the Data Plane interruption within one second, and on many existing general platforms, it can even achieve interruption-free upgrades.
[0023] Among them, Warm-Reboot: refers to hot reboot, which is a method that can reload or update network device software without interrupting data forwarding. Fast-Reboot: refers to fast reboot.
[0024] Control Plane: The necessary information required to maintain the operation of the data plane. This information is collected and calculated through protocols and algorithms. The control planes between network nodes can exchange information with each other. This information is processed and used to build different tables to help the traffic operation of the data plane.
[0025] Data Plane: Also known as the forwarding plane, it checks the destination address of the received traffic and processes the traffic according to the forwarding table. It may forward the traffic to an outbound interface, discard the traffic, or send it to the control plane for further processing.
[0026] ASIC (Application Specific Integrated Circuit): A switch ASIC is an important hardware component on a switch. It is a special integrated circuit chip that processes data packets quickly and can switch data packets at high speed. The specific status of ASIC is reflected in the data plane.
[0027] Reference Figure 1 , Figure 1 This is a schematic diagram of the architecture of the system described in one embodiment of the present application. In SONiC, the upper user state includes orchagent (orchestration agent), Redis (key-value database), syncd (synchronization agent), the middle layer is the driver ASICSDK (Software Development Kit), and the bottom layer is the hardware ASIC.
[0028] Reference Figure 2 , Figure 2 FIG. 1 is a flow chart of a device restart method described in an embodiment of the present application. Figure 2 As shown, in one embodiment of the present application, the device restart method can be specifically performed according to the following steps: 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 various first objects configured in the control plane.
[0029] Specifically, in order not to affect the normal operation of the business, when the device needs to be updated or upgraded, the device is hot restarted / quickly restarted. That is, the control plane is restarted by software first, while the hardware is not restarted and the data plane remains unchanged; after the control plane is restarted, the hardware configuration is modified from the upper layer to the lower layer, and the data of the data plane is adjusted to be consistent with the data of the data plane (the ASIC state is restored to be consistent with the control plane state). At this time, after the control plane of the device is restarted, the first view corresponding to the control plane is generated according to the configuration information of the control plane, and the first view includes various objects currently configured in the control plane. The first object is the object of the control plane.
[0030] Step S202: Generate a second view according to the configuration information of the data plane; the second view includes each second object configured in the data plane.
[0031] Specifically, after obtaining the first view, a second view needs to be generated according to the configuration information of the data plane. The second view includes various objects configured in the data plane. The second object is each object of the data plane. In order to facilitate the comparison of the data of the control plane and the data plane, the data format of the first view and the second view is the same.
[0032] Step S203, determining, from the second view, candidate objects corresponding to each of the first objects; the candidate objects of the first object are: a second object of the same type as the first object, and each attribute except the filtering attribute is consistent with the attributes in the first object; the filtering attributes include: attributes of the attribute type being an object, and attributes that are set only during creation.
[0033] Specifically, in the related art, when the device is hot restarted / quickly restarted, in order to ensure that the information of the control plane is consistent with the information of the ASIC, the objects in the two are recursively compared one by one. If the contents of the two objects are exactly the same, it is assumed that the two are the same object. In the present application, before recursively comparing the objects in the two one by one, the candidate objects of the objects in the control plane are first determined. The candidate object is: a second object of the same type as the first object, and each attribute except the filter attribute is consistent with the attribute in the first object; the filter attribute includes: an attribute of the attribute type of the object, and an attribute set only when creating. When determining the candidate object, the second object of the same type as the first object is first screened out, and the next attribute comparison is performed only with these screened second objects. When comparing the attributes, only compare whether the attributes except the filter attribute are the same. The filter attribute includes: an attribute of the attribute type of the object, and an attribute set only when creating. That is, for the attribute of the attribute type of the object with a long matching time, no comparison is performed, and for the attribute set only when creating, it is limited to being set only when creating, and will not change before and after the hot restart, so it is not compared. After removing the filter attribute and comparing other attributes, if all are found to be successfully matched, they are determined as candidate objects. In this way, the time for object comparison can be saved.
[0034] Step S204: generating a candidate object list for each first object according to the candidate objects.
[0035] Specifically, there may be multiple candidate objects corresponding to the first object. To facilitate data extraction, these candidate objects are added to the candidate object list of the first object.
[0036] Step S205: According to the candidate object list, the configuration information of the data plane is configured to be consistent with the configuration information of the control plane.
[0037] Specifically, since the candidate objects in the candidate object list are of the same type as the first object, and each attribute except the filter attribute is consistent with the attribute in the first object, the candidate object list has filtered out most of the objects in the second view that are different from the first view. Therefore, according to the candidate object list of each first object, by matching the candidate objects in the candidate object list that have the same attributes as the first object, the second object that is the same as the first object can be quickly determined, thereby quickly determining which data in the data plane is the same as the control plane and which data in the data plane is different from the control plane.
[0038] For data on the data plane that is already the same as the control plane, there is no need to recursively query the differences one by one, which greatly reduces the amount of data processing when determining whether the control plane and data plane data are consistent. For objects that are different between the data plane and the control plane, adjustments can be made, and ultimately the configuration information of the data plane is configured to be consistent with the configuration information of the control plane.
[0039] Step S206: When the configuration information of the data plane is consistent with the configuration information of the control plane, confirm that the device has completed restarting.
[0040] Specifically, after determining that the configuration information of the data plane is consistent with the configuration information of the control plane, the restart of the device is completed without interruption, thereby achieving a fast restart / hot restart of the device.
[0041] In this embodiment, 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 the various first objects configured by the control plane; a second view is generated according to the configuration information of the data plane; the second view includes the various second objects configured by the data plane; from the second view, candidate objects corresponding to the various first objects are determined; the candidate objects of the first object are: a second object that is of the same type as the first object and whose attributes except for the filtering attributes are consistent with the attributes in the first object; the filtering attributes include: attributes whose attribute type is an object and attributes that are set only during creation; based on the candidate objects, a candidate object list of each first object is generated; 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; when the configuration information of the data plane is consistent with the configuration information of the control plane, it is confirmed that the device has completed the restart. In this way, when the device is hot restarted / quickly restarted, after the control plane is restarted separately, a list of candidate objects corresponding to each first object of the control plane is first obtained. Since the candidate objects in the candidate object list are: second objects of the same type as the first object and each attribute except the filter attribute is consistent with the attribute in the first object, not only can the filter attribute be skipped and the candidate objects can be quickly screened out, but based on the candidate objects, it is also possible to quickly determine which objects in the data plane are already consistent with the control plane. In this way, the amount of data processing to maintain the consistency of control plane and data plane data when the device is hot restarted / quickly restarted is reduced, and the data processing error rate is effectively reduced. 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, thereby improving the success rate of the device hot restart / quick restart.
[0042] In a feasible implementation manner, determining, from the second view, candidate objects corresponding to the first objects respectively, may specifically include: Extract second objects of the same type as the first object from the second view one by one, and compare attributes with the first object; when the attribute of the second object is the filtering attribute, skip comparing the attribute; determine whether all attributes of the second object except the filtering attribute are the same as the attributes of the first object; when 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 that the second object is a candidate object of the first object.
[0043] Specifically, when determining the candidate object corresponding to the first object, first filter out the second object of a different type from the first object, and perform attribute comparison on each second object of the same object type. When comparing the attributes, for some filterable attributes, the comparison of the next attribute can be skipped. Determine whether all attributes in the second object except the filtering attribute are the same as the attributes of the first object. If the remaining attributes in the second object except the filtering attribute have the same attributes as these remaining attributes in the first object, then determine that all attributes in the second object except the filtering attribute are the same as the attributes of the first object, and this second object is a candidate object for the first object.
[0044] In this implementation, the filtered attributes do not need to be matched, saving data processing time; and the remaining attributes will not be selected as candidate objects as long as they are different from the attributes of the first object; thus, based on the candidate objects, it is possible to quickly lock which objects in the control plane and the data plane are matched in parallel. Reducing the amount of matching data, quickly determining which objects have not changed, and detecting whether they are consistent with the control plane is conducive to improving the efficiency of hot restart / fast restart.
[0045] Continuing with the above implementation, in a feasible implementation, the second attribute of the second object is a list, and determining whether all attributes of the second object except the filtering attribute are the same as the attributes of the first object includes: Determine a 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.
[0046] Specifically, when determining whether the attributes of two objects are the same, if the attribute is a list, the length of the attribute list and the type of each member of the list are detected to see if they are the same, so as to avoid the long time spent on field-by-field comparison when there is a lot of data in the list. In this embodiment, for the scenario where the attribute is a list, the consistency of the two attributes is determined by the length of the list and the type of the member, and the lists can be matched in a targeted manner, reducing the time spent on matching through all fields, and further improving the efficiency of attribute matching.
[0047] In a feasible implementation manner, after the control plane of the device is restarted, generating the first view according to the configuration information of the control plane includes: Determine whether the control plane has completed restarting; if it is determined that the control plane has completed restarting, obtain the current configuration information of the control plane; parse each first object configured by the control plane from the configuration information of the control plane, and generate the first view.
[0048] Specifically, the system detects whether the control plane has completed restarting; when it is determined that the control plane has completed restarting, the configuration information of the current control plane is obtained for parsing, and each first object configured by the parsed control plane is added to the view corresponding to the control plane to generate a first view. In this embodiment, by generating the first view, each first object configured by the control plane is stored in a standardized manner, so as to facilitate the subsequent comparison of the control plane data with the data plane data.
[0049] Optionally, when determining whether the control plane has completed restarting, it can be determined based on the state of the restart thread of the control plane. For example, after the user modifies the configuration information of the control plane through the management software, the device sends a restart instruction to the control plane and calls the restart thread of the control plane to restart. If the state of the restart thread of the control plane is idle, it is determined that the control plane has completed restarting. In this way, when the device is hot restarted / quickly restarted, the configuration information of the control plane can be determined in time to improve the state recovery speed.
[0050] Reference Figure 3 and Figure 4 , Figure 3 It is a partial logic diagram of the device restart method described in one embodiment of the present application. Figure 4 This is a partial logic diagram of determining candidate objects in an embodiment of the present application. Figure 3As shown, in one embodiment of the present 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 the 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 ASIC SDK, and sends it to ASIC through ASIC driver; the state change of ASIC will also be synchronized back to ASIC_DB through syncd; before restarting the control plane, back up the data in ASIC_DB to generate asic_view (i.e., the second view); after restarting, orchagent regenerates a copy of data based on the current configuration information of the control plane, called temp_view (i.e., the first view).
[0051] In the related art, apply view is performed at this time: recursively compare the objects in the two one by one. If the contents of the two objects are exactly the same, it is assumed that the two are the same object and the data is consistent; if the content of an object is different, try to delete it on the asic and then rebuild it; if it cannot be deleted and rebuilt, apply view fails; if apply view succeeds, it can ensure that the data in the ASIC_DB of the control plane is consistent with the status on the chip.
[0052] 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 when applying the view, a query is first performed from the list of corresponding candidate objects. Specifically, Figure 4 As shown, illustratively, the process of generating a list of candidate objects corresponding to each object of the control plane can refer to the following steps: Step s1. Create a function createPreMatchForGeneric to support the execution of s2-s13; Step s2. Create a dictionary preMatchMap, where the key is the object id and the value is the candidate object list of this object; Step s3. Traverse the objects in temp_view, obtain a tempObj, and obtain the type of tempObj; Step s4. Traverse all objects in asic_view, obtain an asicObj, and obtain the type of asicObj; Step s5. If the type in step s3 is inconsistent with the type in step s4, return to step s2 to continue; otherwise, continue; Step s6. Traverse all attributes of tempObj and obtain a tempAttr (one of the attributes); obtain the attrId of tempAttr, and obtain asicAttr (an attribute of the object in the data plane) from asic_view according to the attrId; Step s7. If the isObjectAttr attribute of tempAttr is true (the attribute type is object), return to step s5; otherwise continue; Step s8. If the isCreateOnly attribute of tempAttr is true (this attribute is set only when creating), return to step s5; otherwise continue; Step s9. Define a variable, hasNotEqualAttr, to record whether there are unequal attributes. The default value is False. Step s10. If the isList attribute of tempAttr is true (the attribute is a list), use getSize to obtain the list length of tempAttr and asicAttr. If they are not equal, hasNotEqualAttr=True; if they are equal, check whether the types of all members are the same. If they are different, hasNotEqualAttr=True; 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; Step s12. After traversing all attributes of tempObj, if hasNotEqualAttr is False, add asicObj to the candidate object list of asicObj into tempObj and record it in preMatchMap of step s2; Step s13. Repeat steps s3 to s12 to obtain candidate objects for all objects in the control plane and return preMatchMap.
[0053] After the above steps, a candidate object list corresponding to each first object is obtained.
[0054] When applying view, the createPreMatchForGeneric function in step s1 is first called to obtain preMatchMap, and the candidate objects of the object are preferentially used for matching; all objects are matched, the state of the switch control plane is consistent with the state of ASIC, and the state recovery of fast startup is completed.
[0055] By applying the technical solution of this embodiment, invalid matches can be reduced during the state recovery of quick startup, making the state recovery faster; and after a series of screening, the matching efficiency is higher and the possibility of random matching is reduced, thereby improving the success rate of quick startup.
[0056] In a feasible implementation manner, generating the second view according to the configuration information of the data plane includes: The configuration information of the data plane is obtained from a target file; the target file is used to back up the configuration information of the data plane; and each second object configured by the data plane is parsed from the configuration information of the data plane to generate the second view.
[0057] Specifically, referring to the above embodiment, orchagent is responsible for processing and sending all the configuration information of the control plane, and finally pushing it to ASIC_DB; syncd subscribes to ASIC_DB, calls the interface of ASIC SDK, and sends it to ASIC through ASIC driver; the state change of ASIC will also be synchronized back to ASIC_DB through syncd; before restarting the control plane, back up the data in ASIC_DB and generate the target file. After the control plane is restarted separately, the configuration information of the data plane can be obtained from the target file for parsing, and each second object of the parsed data plane configuration is added to the view corresponding to the data plane to generate the second view.
[0058] In this implementation, by generating the first view, each second object configured in the data plane is stored in a standardized manner, so as to facilitate subsequent comparison of the control plane data with the data plane data.
[0059] In a feasible implementation manner, 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: Acquire the first object and the candidate object list of the first object; Detecting 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 there is no first target object corresponding to the first object in the candidate object list of the first object, determining a second target object from 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 first objects in the first view are detected, the configuration information of the data plane is adjusted according to the second view.
[0060] Specifically, after obtaining the first object and the candidate object list of the first object; detect whether there is a first target object corresponding to the first object in the candidate object list of each of the first objects; the content of the first target object is exactly the same as the first object. Then for this part of the data, the control plane and the data plane are the same. In the case that there is no first target object corresponding to the first object in the candidate object list of the first object, determine the second target object from each second object of the second view; the second target object is the object with the highest similarity to the first object among each second object of 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 the matching objects with high similarity to the first object for deletion and reconstruction. After all the first objects of the first view are detected, the second view is now consistent with the first view. Figure 1 According to the second view, adjust the configuration information of the data plane.
[0061] In this embodiment, objects are compared one by one according to the candidate object list to determine which objects of the data plane and the control plane are exactly the same. 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 is achieved during hot restart / quick restart of the device.
[0062] In a feasible implementation manner, generating a candidate object list of each first object according to the candidate objects includes: According to the identifiers of the first objects, a candidate object list corresponding to the identifiers of the first objects is created in a key-value database; and the candidate objects of the first objects are added to the candidate object list corresponding to the identifiers of the first objects.
[0063] Specifically, referring to the above embodiment, according to the identifiers (such as name, number, etc.) of each first object, a candidate object list corresponding to the identifier of each first object is created in a key-value database (Redis): a new dictionary is created, the key is the object identifier, and the value is the candidate object list of this object. Determine each candidate object of the first object and add it to the candidate object list corresponding to the identifier of the first object.
[0064] In this embodiment, by generating a candidate object list for the first object, the matching objects (same type and highly similar content) corresponding to the subsequent search objects are improved, thereby improving data processing efficiency.
[0065] Reference Figure 5 , Figure 5 Schematic diagram of the framework of the device restarting device in one embodiment of the present application. Figure 5 As shown, in one embodiment of the present application, based on the same or similar technical concept as the above method embodiment, a device restarting apparatus 500 is proposed, the apparatus comprising: A first generating module 501 is used to generate a first view according to 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; A second generating module 502, configured to generate a second view according to the configuration information of the data plane; the second view includes each second object configured in the data plane; A first determination module 503 is used to determine, from the second view, candidate objects corresponding to the first objects respectively; the candidate objects of the first object are: second objects of the same type as the first object, and each attribute except the filtering attribute is consistent with the attribute in the first object; the filtering attribute includes: an attribute of an object type and an attribute that is set only when creating; A third generating module 504 is used to generate a candidate object list of each first object according to the candidate objects; A configuration module 505, configured 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 second determining module 506 is configured to confirm that the device has completed restarting when the configuration information of the data plane is consistent with the configuration information of the control plane.
[0066] In this embodiment, 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 the various first objects configured by the control plane; a second view is generated according to the configuration information of the data plane; the second view includes the various second objects configured by the data plane; from the second view, candidate objects corresponding to the various first objects are determined; the candidate objects of the first object are: a second object that is of the same type as the first object and whose attributes except for the filtering attributes are consistent with the attributes in the first object; the filtering attributes include: attributes whose attribute type is an object and attributes that are set only during creation; based on the candidate objects, a candidate object list of each first object is generated; 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; when the configuration information of the data plane is consistent with the configuration information of the control plane, it is confirmed that the device has completed the restart. In this way, when the device is hot restarted / quickly restarted, after the control plane is restarted separately, a list of candidate objects corresponding to each first object of the control plane is first obtained. Since the candidate objects in the candidate object list are: second objects of the same type as the first object and each attribute except the filter attribute is consistent with the attribute in the first object, not only can the filter attribute be skipped and the candidate objects can be quickly screened out, but based on the candidate objects, it is also possible to quickly determine which objects in the data plane are already consistent with the control plane. In this way, the amount of data processing to maintain the consistency of control plane and data plane data when the device is hot restarted / quickly restarted is reduced, and the data processing error rate is effectively reduced. 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, thereby improving the success rate of the device hot restart / quick restart.
[0067] In a feasible implementation manner, the determination module 503 includes: an extraction module, configured to extract second objects of the same type as the first object from the second view one by one, and perform attribute comparison with the first object; a skipping module, configured to skip comparing the attribute when the attribute of the second object is the filtering attribute; a first determining submodule, configured to determine whether all attributes of the second object except the filtering attribute are the same as the attributes of the first object; The second determining submodule is configured to determine that the second object is a candidate object of the first object when it is determined that all attributes of the second object except the filtering attribute are the same as the attributes of the first object.
[0068] In a feasible implementation manner, the second attribute of the second object is a list, and the first determining submodule includes: A first determining submodule is configured to determine a 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; A first determining second submodule, configured to determine whether the list length of the second attribute is the same as the list length of the first attribute; a first determining third submodule, configured 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; The first determining fourth submodule is configured to determine that the second attribute is the same as the first attribute when the type of each member in the second attribute is the same as the type of each member in the first attribute.
[0069] In the present application, the description of the device embodiment is relatively short, and specific details can be referred to the above method embodiment, which will not be repeated here.
[0070] In one embodiment of the present application, an electronic 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 above-mentioned device restart method when executing the computer program.
[0071] In one embodiment of the present application, a non-volatile storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the device restart method as described in the above embodiment is implemented.
[0072] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0073] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present application may take the form of a computer program product 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 codes.
[0074] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0075] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0076] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0077] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0078] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0079] The above is a detailed introduction to a device restart method, apparatus, electronic device and medium provided. Specific examples are used in this article to illustrate the principles and embodiments of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific embodiments and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A device restart method, characterized in that: The method comprises: After the control plane of the device is restarted, generating a first view according to the configuration information of the control plane; the first view includes each first object configured by the control plane; Generate a second view according to the configuration information of the data plane; the second view includes each second object configured by the data plane; Determine, from the second view, candidate objects corresponding to the first objects; the candidate objects of the first objects are: second objects of the same type as the first object, and each attribute except the filtering attribute is consistent with the attribute in the first object; the filtering attribute includes: an attribute of an object type and an attribute that is set only when creating; Generating a candidate object list for each first object according to the candidate objects; According to the candidate object list, configuring the configuration information of the data plane to be consistent with the configuration information of the control plane; When the configuration information of the data plane is consistent with the configuration information of the control plane, confirm that the device has completed restarting.
2. The method according to claim 1, characterized in that Determining, from the second view, candidate objects corresponding to the first objects, respectively, includes: Extracting second objects of the same type as the first object one by one from the second view, and performing attribute comparison with the first object; When the attribute of the second object is the filtering attribute, skip comparing the attribute; Determining whether all attributes of the second object except the filtering attribute are the same as the attributes of the first object; In the case where it is determined that all attributes of the second object except the filtering attribute are the same as the attributes of the first object, 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 of the second object except the filtering attribute are the same as the attributes of the first object includes: Determine a 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; determining whether the length of the list of the second attribute is the same as the length of the list of the first attribute; In the case where the list length of the second attribute is the same as the list length of the first attribute, determining whether the type of each member in the second attribute is the same as the type of each member in the first attribute; In the case where the type of each member in the second attribute is the same as the type of each member in the first attribute, it is determined that the second attribute is the same as the first attribute.
4. The method according to claim 1, characterized in that: After the control plane of the device is restarted, generating a first view according to the configuration information of the control plane includes: Determining whether the control plane has completed restarting; When it is determined that the control plane has completed restarting, obtaining configuration information of the current control plane; The first objects configured in the control plane are parsed from the configuration information of the control plane to generate the first view.
5. The method according to claim 1, characterized in that Generate a second view according to the configuration information of the data plane, including: Acquire the configuration information of the data plane from a target file; the target file is used to back up the configuration information of the data plane; The second objects configured in the data plane are parsed from the configuration information of the data plane to generate the second view.
6. The method according to claim 1, characterized in that The 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: Acquire the first object and the candidate object list of the first object; Detecting 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 there is no first target object corresponding to the first object in the candidate object list of the first object, determining a second target object from 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 first objects in the first view are detected, the configuration information of the data plane is adjusted according to the second view.
7. The method according to claim 1, characterized in that The step of generating a candidate object list for each first object according to the candidate objects includes: According to the identifiers of the first objects, a candidate object list corresponding to the identifiers of the first objects is created in a key-value database; The candidate object of the first object is added to the candidate object list corresponding to the identifier of the first object.
8. A device restarting apparatus, characterized in that: The device comprises: A first generating module, configured to generate a first view according to configuration information of the control plane after the control plane of the device is restarted; the first view includes various first objects configured in the control plane; A second generating module, configured to generate a second view according to the configuration information of the data plane; the second view includes each second object configured in the data plane; A first determination module is used to determine, from the second view, candidate objects corresponding to the first objects respectively; the candidate objects of the first object are: second objects of the same type as the first object, and each attribute of which, except for a filtering attribute, is consistent with an attribute in the first object; the filtering attribute includes: an attribute of an object type, and an attribute that is set only when the object is created; A third generating module, configured to generate a candidate object list for each first object according to the candidate objects; A configuration module, configured 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 second determination module is used to confirm that the device has completed restarting when the configuration information of the data plane is consistent with the configuration information of the control plane.
9. 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, the device restart method according to any one of claims 1 to 7 is implemented.
10. A non-volatile storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the device restart method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Warm restart method and device thereof
CN104978208A
Firmware updating method and device, electronic equipment and storage medium
CN111488163A
Software upgrading method and device, electronic equipment and readable storage medium
CN112181469A
Control plane recovery method and device, control node and storage medium
CN114500289A
Switch restarting method and device, storage medium and electronic device
CN117459482A