File synchronization method and related device
By negotiating and trimming description files between network management devices and network devices, the decoding failure problem caused by encoding incompatibility is solved, achieving efficient description file synchronization and high decoding success rate.
Patent Information
- Application Number
- CN202310198536.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2043-02-23
AI Technical Summary
Data decoding failures between network management devices and network devices are caused by incompatibility of binary encoding description files, and existing technologies require complex adaptation processes and a lot of manual intervention.
By sending a compatible description file through the management device, the network device generates a second description file compatible with its own YANG model. During the negotiation process between the two parties, the description files are trimmed or a new description file is generated to ensure that the description files of both parties are synchronized and reduce the adaptation complexity.
It increases the probability of the data receiver successfully decoding the data, reduces the resource consumption and adaptation complexity of network devices, and improves the synchronization efficiency of the description file.
Smart Images

Figure CN118540332B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of communication technology, and in particular to a file synchronization method and related equipment. BACKGROUND
[0002] Telemetry is a new generation of network monitoring technology for remotely and high-speed collecting data from network devices. The sampling data collected by the network devices in the Telemetry system is reported to the network management device after being encoded.
[0003] The sampling data reported by the network device is organized and defined by a yet another next generation (YANG) model, and the sampling data is output by organization, in which the name of each field and its namespace are also output completely. A large amount of content in the sampling data is repeated repetition of the field name and the namespace defined by the model. When the sampling data is encoded using a text encoding mode such as extensible markup language (XML) and JavaScript object notation (JSON), the amount of encoded data is relatively large. In order to reduce the size of the encoded sampling data, a binary encoding mode such as Google protocol buffers (GPB, or simply protobuf) and concise binary object representation (CBOR) is usually used to encode the sampling data. The binary encoding mode describes the data structure by a description file, and uses field numbers instead of field names in the description file to reduce the size of the encoded data. The network device transmits the binary encoded sampling data to the network management device.
[0004] After receiving the encoded data, the network management device needs to decode the data. If the binary encoding description files used by the two parties are incompatible, the network management device will not be able to decode the data. SUMMARY
[0005] The present application provides a file synchronization method and related equipment to reduce the complexity of description file adaptation when the description files of the two parties are inconsistent, and improve the probability of successful decoding of the data from the data sender by the data receiver.
[0006] The first aspect provides a file synchronization method. The method comprises: a management device sending a first description file of the management device to a network device; the management device receiving a second description file returned by the network device, the second description file being content of the first description file compatible with a YANG model of the network device; if the second description file meets a condition, the management device decoding data reported by the network device based on the second description file, the data reported by the network device being data organized based on the YANG model and encoded based on the second description file. The content of the first description file compatible with the YANG model of the network device is, for example, a field name or a node existing in both the first description file and the YANG model. Thus, the second description file obtained by the network device based on the first description file of the management device is compatible with not only the YANG model of the network device but also the description file of the management device, without the need of complex adaptation of the description file of each network device or manual development of adaptation logic, thereby improving the adaptation efficiency of the description file under the premise of ensuring synchronization of the description file of the network device and the management device.
[0007] In a possible implementation, before the management device sends the first description file of the management device to the network device, the method comprises: the management device receiving a third description file from the network device; the management device verifying whether the third description file is compatible with the first description file; and when the third description file is incompatible with the first description file, the management device performing the step of sending the first description file of the management device to the network device. The incompatibility between the third description file and the first description file may include, for example, that the third description file is a subset of the first description file, or that the same field name corresponds to different field encodings in the third description file and the first description file. In one scenario, the network device may initiate a description file synchronization process to the management device, and the management device may send the first description file to the network device after determining that the first description file and the third description file are incompatible, so that the network device may generate the second description file only when the description files are incompatible, thereby reducing consumption of resources of the network device.
[0008] In a possible implementation, before the management device receives the second description file returned by the network device, the method comprises: the management device receiving a verification result from the network device, the verification result indicating that the third description file is incompatible with the first description file; and the management device sending a difference negotiation request to the network device, the difference negotiation request instructing the network device to generate the second description file based on the first description file. In another scenario, the management device may initiate a description file synchronization process to the network device, and the management device may send a difference negotiation request to the network device to instruct the network device to generate the second description file based on the first description file after determining that the first description file and the third description file are incompatible, so that the network device may generate the second description file only when the description files are incompatible, thereby reducing consumption of resources of the network device.
[0009] In a possible implementation, before the management device sends the first description file of the management device to the network device, the management device sends a difference discovery request to the network device, the difference discovery request carries description file information, the description file information includes at least one description file name and a hash value, and the difference discovery request indicates that the network device compares whether the description file information is consistent with information of a description file of the network device; the management device receives a comparison result returned by the network device, the comparison result includes a name of a description file with an inconsistent hash value, and the name of the description file with the inconsistent hash value includes the name of the first description file; and the management device performs the step of sending the first description file of the management device to the network device. The consistency of the description files is compared through the description file information, the amount of data of the description file information is relatively small compared with the amount of data of the description file, the description file information can reduce the occupation of bandwidth resources in the transmission process, and the calculation amount of the network device when comparing whether the description files are consistent is reduced, and the consumption of resources of the network device is reduced.
[0010] The second aspect provides a file synchronization method. The method includes: a network device receiving a first description file of a management device sent by the management device; the network device obtaining a second description file according to the first description file, the second description file being part of content in the first description file compatible with a YANG model of the network device; and the network device sending the second description file to the management device, so that the management device decodes data reported by the network device based on the second description file when the second description file meets a condition, the data reported by the network device being data obtained by encoding data organized based on the second description file.
[0011] In a possible implementation, before the network device receives the first description file of the management device sent by the management device, the network device sends a third description file of the network device to the management device, so that the management device sends the first description file to the network device when the third description file is incompatible with the first description file.
[0012] In a possible implementation, before the network device obtains the second description file according to the first description file, the network device checks whether the first description file is compatible with the third description file, to obtain a checking result; the network device sends the checking result to the management device, so that the management device sends a difference negotiation request to the network device when the checking result indicates that the third description file is incompatible with the first description file; and the network device receives the negotiation difference request and performs the step of obtaining the second description file according to the first description file.
[0013] In a possible implementation, the network device stores the check result, so that the network device returns the stored check result to the management device when the management device sends a difference discovery request to the network device. The network device stores the check result, so that the consumption of resources of the network device can be reduced without comparing the compatibility of the description files each time the network device is connected to the management device.
[0014] In a possible implementation, before the network device receives the first description file of the management device sent by the management device, the network device receives a difference discovery request from the management device, the difference discovery request carrying description file information including at least one description file name and hash value, the difference discovery request indicating the network device to compare the description file information with the information of the description file of the network device; the network device compares the description file information with the information of the description file of the network device to obtain a comparison result, the comparison result including the name of the description file with the inconsistent hash value, the name of the description file with the inconsistent hash value including the name of the first description file; and the network device sends the comparison result to the management device, so that the management device sends the description file with the inconsistent hash value to the network device according to the comparison result.
[0015] The third aspect provides a file synchronization method. The method includes: a network device receiving a target description file; if the target description file is compatible with a YANG model of the network device, the network device encoding data reported to a management device based on the target description file. The data reported to the management device is data organized based on the second description file and encoded.
[0016] The fourth aspect provides a management device. The device includes a transceiver module and a processing module. The transceiver module is configured to send a first description file of the management device to a network device. The transceiver module is configured to receive a second description file returned by the network device, the second description file being part of the content of the first description file compatible with a YANG model of the network device. The processing module is configured to decode data reported by the network device based on the second description file when the second description file meets a condition, the data reported by the network device being data organized based on the second description file and encoded.
[0017] In a possible implementation, the transceiver module is configured to receive a third description file from the network device. The processing module is configured to check whether the third description file is compatible with the first description file. The transceiver module is configured to send the first description file of the management device to the network device when the third description file is not compatible with the first description file.
[0018] In a possible implementation, the transceiver module is configured to receive a verification result from the network device, the verification result indicating that the third description file is incompatible with the first description file. The transceiver module is configured to send a difference negotiation request to the network device, the difference negotiation request indicating that the network device generates the second description file according to the first description file.
[0019] In a possible implementation, the transceiver module is configured to send a difference discovery request to the network device, the difference discovery request carrying description file information, the description file information including at least one description file name and hash value, and the difference discovery request indicating that the network device compares the description file information with information of a description file of the network device. The transceiver module is configured to receive a comparison result returned by the network device, the comparison result including a name of a description file with an inconsistent hash value, and the name of the description file with the inconsistent hash value including the name of the first description file. The transceiver module is specifically configured to send the first description file to the network device when the name of the description file with the inconsistent hash value includes the name of the first description file.
[0020] A fifth aspect provides a network device. The device includes a transceiver module and a processing module. The transceiver module is configured to receive a first description file of a management device sent by a management device. The processing module is configured to obtain a second description file according to the first description file, the second description file being part of content in the first description file that is compatible with a YANG model of the network device. The transceiver module is configured to send the second description file to the management device, so that the management device decodes data reported by the network device based on the second description file when the second description file meets a condition, the data reported by the network device being data that is encoded based on the second description file and organized based on the YANG model.
[0021] In a possible implementation, the transceiver module is configured to send a third description file of the network device to the management device, so that the management device sends the first description file to the network device when the third description file is incompatible with the first description file.
[0022] In a possible implementation, the processing module is configured to check whether the first description file is compatible with a third description file, and obtain a checking result. The transceiver module is configured to send the checking result to the management device, so that the management device sends a difference negotiation request to the network device when the checking result indicates that the third description file is incompatible with the first description file. The transceiver module is configured to receive the difference negotiation request and perform the step of obtaining the second description file according to the first description file.
[0023] In a possible implementation, the network device further includes a storage module. The storage module is configured to store the checking result, so that the network device returns the stored checking result to the management device when the management device sends a difference discovery request to the network device.
[0024] In a possible implementation, the transceiver module is configured to receive a difference discovery request from the management device, the difference discovery request carrying description file information including at least one description file name and a hash value, and the difference discovery request indicating that the network device compares whether the description file information is consistent with information of a description file of the network device. The processing module is configured to compare whether the description file information is consistent with the information of the description file of the network device to obtain a comparison result, the comparison result including a name of a description file with an inconsistent hash value, and the name of the description file with the inconsistent hash value including the name of the first description file. The transceiver module is configured to send the comparison result to the management device, so that the management device sends the description file with the inconsistent hash value to the network device according to the comparison result.
[0025] The sixth aspect provides a network device. The device includes a transceiver module and a processing module. The transceiver module is configured to receive a target description file. The processing module is configured to, when the target description file is compatible with a YANG model of the network device, encode data reported to a management device based on the target description file. The data reported to the management device is obtained by encoding data organized based on the second description file based on the YANG model.
[0026] The seventh aspect provides an electronic device. The electronic device includes a processor and a memory, the processor being coupled to the memory, and the processor being configured to execute the file synchronization method in the first aspect or any possible implementation of the first aspect, or the file synchronization method in the second aspect or any possible implementation of the second aspect, or the file synchronization method in the third aspect based on instructions stored in the memory.
[0027] The eighth aspect provides a computer-readable storage medium. The computer-readable storage medium includes instructions, when the electronic device readable storage medium is run on a computer, causing the electronic device to execute the file synchronization method in the first aspect or any possible implementation of the first aspect, or the file synchronization method in the second aspect or any possible implementation of the second aspect, or the file synchronization method in the third aspect.
[0028] The ninth aspect provides a computer program product, including a program, when the program is run on a processor, executing the file synchronization method in the first aspect or any possible implementation of the first aspect, or the file synchronization method in the second aspect or any possible implementation of the second aspect, or the file synchronization method in the third aspect. BRIEF DESCRIPTION OF DRAWINGS
[0029] Figure 1 A structural schematic diagram of a communication system is provided for the present application;
[0030] Figure 2 A flowchart illustrating a file synchronization method is provided for the present application;
[0031] Figure 3 Another flowchart illustrating a file synchronization method is provided for the present application;
[0032] Figure 4 Still another flowchart illustrating a file synchronization method is provided for the present application;
[0033] Figure 5 A structural diagram of a management device is provided for the present application;
[0034] Figure 6 A structural diagram of a network device is provided for the present application;
[0035] Figure 7 A structural diagram of an electronic device is provided for the present application. DETAILED DESCRIPTION
[0036] The present application provides a file synchronization method and related devices to reduce the complexity of description file adaptation when the description files of the two parties are inconsistent, and improve the probability of successful decoding of data from the data sender by the data receiver.
[0037] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all the embodiments.
[0038] The terms "first", "second", "third", "fourth" and the like (if any) in the specification and claims of the present application and the above drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the terms used in this way can be interchanged under appropriate circumstances, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0039] It should be understood that the term "and / or" herein is only a description of the association relationship between the associated objects, which means that there can be three relationships, for example, A and / or B can represent the three cases of A alone, A and B together, and B alone. In addition, the character " / " herein generally represents an "or" relationship between the associated objects.
[0040] In the present application, "multiple" in "multiple" and the like indicates a quantity greater than or equal to 2.
[0041] The related terms appearing in the present application are explained as follows:
[0042] Telemetry is a network monitoring technology for remotely and high-speed collecting data from devices. Network devices periodically and actively upload the collected sampling data to the management device in a "push mode", thereby providing more real-time, high-speed and accurate network monitoring functions.
[0043] For the Telemetry network device side: Telemetry = raw data + data model + encoding format + transmission protocol. Specifically, Telemetry organizes raw data according to the YANG model, encodes using binary encoding formats such as GPB or CBOR, and transmits the binary encoded sampling data to the management device through transmission protocols such as Google Remote Procedure Call Protocol (gRPC) or User Datagram Protocol (UDP), so that the management device can obtain the sampling data more efficiently.
[0044] The raw data of Telemetry sampling can come from the forwarding plane, control plane and management plane of the network device, such as interface traffic statistics, CPU or memory data and other information of the network device.
[0045] YANG is a data modeling language, and various manufacturers use a unified syntax and standardization. In addition, it can clearly define business objects, attributes and data types, and is simple to parse. The YANG model defines a hierarchical structure of data, which can be used to model configuration data, state data, remote procedure calls and notifications used by network configuration management protocols. Network configuration management protocols include, for example, Network Configuration Protocol (NETCONF) or Representational State Transfer Configuration Protocol (RESTCONF).
[0046] A binary encoding description file, hereinafter referred to as a description file, is a file for describing a data structure, which can be generated according to a YANG model, and uses field numbers instead of field names in the YANG model, that is, the description file includes a mapping relationship between field names and field numbers of the YANG model and a hierarchical structure of the YANG model. The network device encodes the sampling data to be sent according to the data file to obtain encoded sampling data. In the encoded sampling data, the field names are replaced by the field numbers, which can save the data amount occupied by the field names and reduce the bandwidth occupied by the sampling data in the transmission process. When decoding, the management device needs to use a description file compatible with the network device to decode the encoded sampling data, so as to accurately decode the encoded sampling data. If the description files of the management device and the network device are incompatible, the sampling data from the network device cannot be decoded.
[0047] When transmitting data between the network device and the management device, the data transmitted in the GPB encoding format or the CBOR encoding format has higher information load capacity than the data in other encoding formats (JSON or XML), which guarantees the data throughput capacity of the Telemetry service and reduces the CPU occupancy and bandwidth.
[0048] GPB is a language-independent, platform-independent and extensible serialization structure data format for communication protocols and data storage. It provides a flexible, efficient and automatic serialization structure data mechanism, and GPB belongs to binary encoding, which has good performance and high efficiency. The description file of GPB has an extension of “.proto”, and each node in the YANG model is numbered in the description file of GPB, and the number is unique on each layer node. For example, the field number of the field name “interfaces” in the ifm.proto file is 1 (1 byte), which can save 8 bytes.
[0049] CBOR is a binary data exchange form that provides good compression and strong extensibility without version negotiation. The description file of CBOR has an extension of “.sid”, and each node in the YANG model is numbered in the description file of CBOR, and the number is unique in the file. For example, the field number of the field name “ / ifm / interfaces” in the ifm.sid file is 3003 (2 bytes), which can save 7 bytes.
[0050] The gRPC protocol is a high-performance and general-purpose RPC open source software framework based on the HTTP2 protocol. Both communication parties develop based on the framework, so that the communication parties focus on business and do not need to pay attention to the underlying communication implemented by the gRPC software framework. Telemetry reports the data encapsulated in the encoding format to the collector for receiving and storing through the gRPC protocol.
[0051] For the YANG model file defined by standard organizations such as the Internet Engineering Task Force (IETF) and the OpenConfig working group, various network equipment manufacturers implement according to the standard, that is, the YANG models of various manufacturers are compatible. However, the corresponding binary encoded description files do not have a standard, and the description files published by various manufacturers are not the same, for example, the same field name has different numbers in the description files of different manufacturers.
[0052] The network equipment in the network may come from multiple different manufacturers, and the management device receives the sampling data uploaded by the network equipment of different manufacturers and different models in the network through Telemetry. In order to reduce network bandwidth, different manufacturers and different models use GPB or CBOR to encode and transmit the sampling data. Because different manufacturers / models of network equipment use different description files, the network administrator needs to adapt the description files for each manufacturer / model of network equipment. When there are many types of network equipment in the network, the network administrator needs to develop a large amount of adaptation logic for different network equipment, and the adaptation process is slow and complex to implement.
[0053] To solve the above problems, the present application provides the following embodiments, which can quickly and effectively complete the synchronization of the description file between the network equipment and the network equipment, and can effectively reduce the workload of the network administrator.
[0054] In a possible implementation, the network administrator can uniformly specify a description file (target description file) for different network equipment, and issue (may be issued through a file transfer protocol, or may be issued through a management device) the target description file to each network equipment, indicating that the network equipment replaces the used description file with the target description file. After the network equipment checks the compatibility and legality of the target description file, if it is determined that the target description file is compatible with the YANG model of the network equipment, the network equipment replaces the used description file with the target description file. When the network equipment reports the sampling data to the management device in the subsequent, the target description file is used to encode the sampling data and transmit to the management device. The management device also decodes the sampling data reported by the network equipment using the target description file.
[0055] The target description file can be a binary-coded description file generated based on the YANG model. Alternatively, it can be a file obtained from a network device or its support website, modified as needed (e.g., trimmed or supplemented).
[0056] By uniformly replacing the description files of different network devices with the target description file, the workload of adapting description files for different network devices can be reduced, and the adaptation efficiency can be improved.
[0057] In another possible implementation, the network device and the management device can negotiate the description files. For description files that differ, the network device generates a new description file based on the management device's description file. This automatically adapts the description files between the network device and the management device, improving the efficiency of description file adaptation. It eliminates the need for network administrators to adapt description files from multiple vendors and versions of network devices, effectively reducing the workload of network administrators in adapting description files.
[0058] like Figure 1 As shown, Figure 1 This application provides a schematic diagram of the structure of a communication system. The communication system includes a management device and at least one network device. It is understood that... Figure 1 The number of network devices shown is for illustrative purposes only. In actual scenarios, the number of network devices can be more or less, and no limit is set here.
[0059] The management device and network devices can be connected via wired or wireless means. The management device can be a server, smartphone, or computer, among other devices. The management device receives and decodes sampled data reported by each network device. Network devices can be routers, switches, or firewalls, among other devices. The network devices collect data according to the management device's subscription requirements to obtain sampled data, encode the sampled data into a binary sequence, and then push it to the management device. Sampled data may include, for example, network device status information, and / or network performance information such as network congestion, packet loss, latency, or jitter.
[0060] In this embodiment, the management device sends a first description file to the network device. The network device modifies the first description file based on the first description file and its own YANG model to obtain a second description file, and then sends the second description file to the management device. The management device also checks whether the second description file meets certain conditions. If it does, the management device uses the second description file to decode the sampled data reported by the network device, which is also encoded using the second description file. If the management device does not meet the conditions, it disconnects from the network device.
[0061] Thus, the second description file obtained by the network device based on the first description file of the management device is compatible with not only the YANG model of the network device but also the description file of the management device, without the need of complex adaptation of the description files of the network devices or manual development of adaptation logic, and the adaptation efficiency of the description file is improved under the premise of ensuring the synchronization of the description files of the network device and the management device.
[0062] Based on the communication system, Figure 1 the application provides the following method embodiments. As shown in Figure 2 , Figure 2 a flowchart of a description file synchronization method provided by the application. The network device in the embodiment is any device in need of description file synchronization with the network device. The embodiment includes the following steps: Figure 1
[0063] S201: The management device establishes a communication connection with the network device.
[0064] The management device and the network device can establish a communication connection through a remote procedure call protocol (RPC), gRPC, a hyper text transfer protocol (HTTP), UDP, or the like. The communication connection between the management device and the network device can be initiated by the management device to the network device or initiated by the network device to the management device, which is not limited herein.
[0065] S202: The management device sends a first description file of the management device to the network device.
[0066] After the communication connection is established, the management device sends the first description file of the management device to the network device through the communication connection, so that the network device can generate a second description file according to the first description file.
[0067] S203: The network device obtains a second description file according to the first description file, and the second description file is part of the content compatible with the YANG model of the network device in the first description file.
[0068] After the network device receives the first description file sent by the management device, the network device generates the second description file according to the first description file and the YANG model of the network device.
[0069] Specifically, the network device can tailor the part in the first description file incompatible with the YANG model of the network device and take the part in the first description file compatible with the YANG model of the network device as the second description file. The part in the first description file incompatible with the YANG model of the network device includes, for example, a field name or a node existing in the first description file but not existing in the YANG model. The part in the first description file compatible with the YANG model of the network device includes, for example, a field name or a node existing in both the first description file and the YANG model.
[0070] The second description file is from the first description file, so the second description file is compatible with the description file of the management device and compatible with the YANG model of the network device. The network device can accurately encode the sampling data based on the second description file, and the management device can accurately decode the encoded sampling data based on the second description file.
[0071] Optionally, before obtaining the second description file according to the first description file, the network device can also check whether the first description file is compatible with a third description file of the network device. If incompatible, the second description file is obtained according to the first description file. If compatible, the management device can be notified that the first description file and the third description file are compatible, and the second description file can not be generated and transmitted to the management device. The first description file and the third description file are compatible means that the first description file is completely consistent with the third description file, or the first description file is a subset of the third description file. When the first description file is a subset of the third description file, it means that the fields required by the management device are all in the third description file, and the management device can decode the fields required in the data encoded based on the third description file. Therefore, in this case, the first description file and the third description file can be considered compatible.
[0072] The network device checks whether the first description file and the third description file are compatible, for example, according to the data organization hierarchy relationship and the fields of the first description file and the third description file, checking whether the first description file is a subset of the third description file, or checking whether the first description file and the third description file are completely consistent. Specifically, the management device generates two trees respectively according to the hierarchical structures of the first description file and the third description file, traverses the two trees to compare whether branches and nodes (container nodes, list nodes or leaf nodes) on the trees exist, and whether the field numbers corresponding to the field names of the existing branches and nodes are consistent. If the two trees are completely consistent, it is considered that the first description file and the third description file are consistent, and they are compatible. If some branches or nodes exist in the tree corresponding to the third description file but do not exist in the tree corresponding to the first description file, and the branches and nodes in the tree corresponding to the first description file have the same branches and nodes in the third description file, it is considered that the first description file is a subset of the third description file, and they are compatible. If some branches or nodes exist in the tree corresponding to the first description file but do not exist in the tree corresponding to the third description file, it is considered that the first description file and the third description file are not compatible. If the same field names in the first description file and the third description file are mapped to different field numbers, it is considered that the first description file and the third description file are not compatible.
[0073] Alternatively, it can also be determined whether the first description file and the third description file are consistent by calculating the hash values of the first description file and the third description file, and then comparing whether the hash values of the two are consistent. If the hash values of the two are consistent, it is considered that the first description file and the third description file are consistent. If the hash values of the two are not consistent, it can be further determined whether the first description file is a subset of the third description file.
[0074] S204: The network device sends the second description file to the management device.
[0075] Since the second description file is obtained by the network device clipping the first description file, some fields may be clipped, resulting in a possible missing of necessary fields. Therefore, after obtaining the second description file, the network device needs the management device to further check the second description file. Thus, after obtaining the second description file, the network device sends the second description file to the management device for checking.
[0076] S205: The management device checks whether the second description file meets the condition.
[0077] The management device checks whether the second description file meets the condition after receiving the second description file, and obtains a checking result. If the second description file meets the condition, S206 and S207 are executed. If the second description file does not meet the condition, since the management device cannot obtain the required information from the data reported by the network device based on the second description file, S209 is executed.
[0078] Specifically, the management device checks whether all fields in a necessary field set are included in the second description file. If all fields in the necessary field set exist in the second description file, it can be considered that the second description file meets the condition. If at least one field in the necessary field set does not exist in the second description file, it can be considered that the second description file does not meet the condition. The necessary field set includes, for example, general fields and / or service fields. The general fields include, for example, a sampling path or a timestamp. The service fields include, for example, an interface state or an interface flow. For example, the necessary field set includes a sampling path and a timestamp field. If the second description file includes the sampling path field and the timestamp field, it is considered that the second description file meets the condition. If the second description file does not include at least one of the sampling path field and the timestamp field, it is considered that the second description file does not meet the condition. The fields in the necessary field set are necessary for subsequent analysis of the sampling data reported by the network device.
[0079] S206: The management device configures the description file used to decode the sampling data pushed by the network device as the second description file.
[0080] Therefore, when the network device subsequently pushes the sampling data encoded using the second description file, the management device can successfully decode the sampling data pushed by the network device using the second description file.
[0081] S207: The management device sends the checking result to the network device.
[0082] The management device sends the checking result to the network device to inform that the description file used to encode the sampling data is configured as the second description file, and the synchronization of the description file between the management device and the network device is completed. Therefore, when the network device subsequently sends the sampling data to the management device, the sampling data organized by the YANG model of the network device is encoded based on the second description file, and then the encoded sampling data is sent to the management device.
[0083] It should be noted that S206 and S207 have no priority, and can be executed simultaneously, or S206 can be executed before S207, or S207 can be executed before S206, which is not limited herein.
[0084] In another possible implementation, after determining that the second description file meets the condition, the management device can also not send the checking result to the network device. For example, after the network device sends the second description file to the management device, the network device waits for a preset time period, the connection between the management device and the network device is not disconnected by the management device, and the management device does not notify the network device to disconnect the connection, the network device can consider that the second description file meets the requirement of the management device, and can perform S208.
[0085] S208: The network device configures the description file used for encoding the sampling data as the second description file.
[0086] Therefore, the network device encodes the sampling data based on the second description file, and the management device decodes the encoded sampling data reported by the network device based on the second description file.
[0087] Since the second description file is a description file compatible with both the management device and the network device and confirmed through negotiation, the management device can accurately decode the sampling data reported by the network device based on the second description file, and can obtain the required information therefrom.
[0088] S209: Disconnect the communication connection between the management device and the network device.
[0089] If the second description file does not meet the condition, the management device cannot correctly decode the sampling data reported by the network device using the second description file, or cannot obtain the required information therefrom. Therefore, the management device can directly disconnect the communication connection with the network device after determining that the second description file does not meet the condition. The management device can also notify the network device that the second description file does not meet the condition after determining that the second description file does not meet the condition, and disconnect the communication connection between the management device and the network device by the management device or the network device.
[0090] In this embodiment, the network device generates the second description file based on the first description file of the management device, and the management device further confirms whether the second description file meets the requirement, so that the second description file can meet the requirements of both the network device and the management device. In addition, the network device and the management device negotiate and adapt the description file by themselves, so that the adaptation efficiency is improved on the premise of ensuring the accuracy of adaptation.
[0091] Figure 2The description file synchronization method can also include various specific implementations. The description file synchronization process can include a description file difference negotiation process, where the network device obtains a second description file based on a first description file, and the management device checks the second description file. The description file synchronization process can also include a description file difference discovery process, where it is first determined that there are differences between the description files used by the network device and the management device, so that subsequent difference negotiation can only be performed on the description files with differences.
[0092] In one possible implementation, it can be assumed by default that there are differences in the description files between the management device and the network device. Instead of a difference discovery process, the difference negotiation of the description files can be performed directly, which can improve the efficiency of description file synchronization. Specifically, the management device can send a difference negotiation request to the network device, carrying the management device's first description file. In response to the difference negotiation request, the network device generates a second description file based on the first description file and its own YANG model, and sends the second description file to the management device. After confirming that the second description file meets its requirements, the management device notifies the network device that it can use the second description file to encode the sampled data. The management device subsequently uses the second description file to decode the network device's sampled data.
[0093] In one possible implementation, differences in the description files can be discovered first, followed by difference negotiation for the description files with discrepancies. The first description file can be sent to the network device by the management device during the difference discovery phase, or it can be sent to the network device by the management device during the difference negotiation phase. The difference discovery process can be initiated by either the network device or the management device.
[0094] The following describes several possible implementation methods for first discovering differences in the description files and then negotiating differences in the description files that have differences.
[0095] like Figure 3 As shown, Figure 3 This is a flowchart illustrating another description file synchronization method provided in this application. In this embodiment, the network device initiates a communication connection with the management device, and the network device sends a difference discovery request to the management device. Specifically, this embodiment includes the following steps:
[0096] S301: The management device establishes a communication connection with the network device.
[0097] The network device establishes a communication connection with the management device through an RPC, gRPC, HTTP, UDP, or the like. After the connection is established, the management device subscribes to sampling data of a sampling path from the network device. The sampling path is a sampling object and corresponds to a node in a YANG model. The sampling path is, for example, a CPU state, interface traffic, latency, packet loss, or memory resource, or the like. If the sampling path is specified to use a binary encoding mode, the sampling path corresponds to a description file used to encode the sampling data collected for the sampling path. Different sampling paths can correspond to the same description file or different description files. For example, the sampling paths huawei-ifm:ifm / interfaces / interface and huawei-ifm:ifm / interfaces / interface / mib-statistic use the same description file, for example, a huawei-ifm.proto file, and the sampling paths and huawei-debug:debug / cpu-infos / cpu-infos use different description files.
[0098] After the communication connection is successfully established, the network device can initiate a difference discovery process to the management device before sending the sampling data to the management device.
[0099] S302: The network device sends a difference discovery request to the management device, and the difference discovery request carries a third description file of the network device or a hash value of the third description file.
[0100] The third description file is a description file corresponding to a sampling path subscribed by the management device. Before the network device pushes the sampling data to the management device, the network device needs to synchronize the description file with the management device, so that the network device and the management device can use the same description file to encode and decode the sampling data, thereby ensuring that the sampling data pushed by the network device can be successfully decoded.
[0101] In a possible implementation, the difference discovery request carries the third description file of the network device. The difference discovery request is used to instruct the management device to verify whether the third description file is compatible with a first description file of the management device. The first description file is a description file corresponding to a sampling path subscribed by the management device. That is, the first description file and the third description file are description files corresponding to the same sampling path in the management device and the network device, respectively. The two description files can be the same or different and need to be verified.
[0102] In another possible implementation, the difference discovery request carries a hash value of the third description file of the network device, thereby reducing the occupation of bandwidth resources by the difference discovery request.
[0103] S303: The management device checks whether the third description file is compatible with the first description file of the management device.
[0104] The method of checking whether the third description file is compatible with the first description file can refer to the related description of S203, which will not be repeated here.
[0105] S304: If the third description file is incompatible with the first description file, the management device sends a difference negotiation request to the network device, and the difference negotiation request carries the first description file of the management device.
[0106] The difference negotiation request is used to instruct the network device to obtain the second description file according to the first description file.
[0107] S305: The network device obtains the second description file according to the first description file, and the second description file is the compatible part of the first description file with the YANG model of the network device.
[0108] The network device obtains the second description file according to the first description file can refer to the related content of S203, which will not be repeated here.
[0109] S306: The network device sends the second description file to the management device.
[0110] S307: The management device checks whether the second description file meets the condition.
[0111] If the second description file meets the condition, S308 and S309 are executed. If the second description file does not meet the condition, since the management device cannot obtain the required information from the data reported by the network device based on the second description file, S311 is executed.
[0112] S308: The management device configures the description file used to decode the sampling data pushed by the network device as the second description file.
[0113] This step is similar to S206, which will not be repeated here.
[0114] S309: The management device sends the checking result to the network device.
[0115] This step is similar to S207, which will not be repeated here.
[0116] S310: The network device configures the description file used to encode the sampling data as the second description file.
[0117] This step is similar to S208, which will not be repeated here.
[0118] S311: Disconnect the communication connection between the management device and the network device.
[0119] This step is similar to S209, so it will not be repeated here.
[0120] In this embodiment, before pushing sampling data to the management device, the network device initiates a difference discovery request to the management device regarding the description files corresponding to the subscribed sampling paths. This allows for further difference negotiation to ensure that, when the first and third description files are incompatible, sampling data for the same sampling path can be encoded and decoded using the same description files by both the management device and the network device. This difference discovery and negotiation between the network device and the management device enables automatic and rapid synchronization of the description files.
[0121] like Figure 4 As shown, Figure 4 This is a flowchart illustrating another description file synchronization method provided in this application. In this embodiment, the management device initiates a communication connection with the network device, and the management device sends a difference discovery request to the network device.
[0122] S401: Management devices establish communication connections with network devices.
[0123] The management device establishes a communication connection with the network device via protocols such as RPC, gRPC, HTTP, and UDP. After successfully establishing the communication connection, the management device can initiate a difference discovery process with the network device before subscribing to sampling data for the sampling path.
[0124] S402: The management device sends a difference discovery request to the network device, which carries the hash value of the management device's first description file.
[0125] The first description file is the description file corresponding to the sampling path that the management device will subscribe to. The difference discovery request is used to instruct the network device to verify whether the first description file is consistent with the third description file used by the network device for that sampling path. That is, the first description file and the third description file are the description files corresponding to the same sampling path on the management device and the network device, respectively. They may be the same or different, and verification is required.
[0126] The difference discovery request carries the hash value of the first description file of the management device, thereby reducing the bandwidth consumption of the difference discovery request.
[0127] S403: The network device compares the hash value of the first description file with the first description file of the management device to see if the third description file is consistent.
[0128] The network device can determine whether the third description file is consistent with the first description file by respectively obtaining hash values of the third description file and the first description file and comparing the hash values of the two description files. If the hash values of the third description file and the first description file are the same, it is considered that the third description file is consistent with the first description file, and no further difference negotiation process is needed. If the hash values of the third description file and the first description file are different, it is considered that the third description file is inconsistent with the first description file, and further compatibility check and difference negotiation of the first description file and the third description file are needed.
[0129] S404: If the third description file is inconsistent with the first description file, the network device sends a comparison result indicating that the third description file is inconsistent with the first description file to the management device.
[0130] S405: The management device sends the first description file to the network device.
[0131] S406: The network device checks whether the first description file is compatible with the third description file.
[0132] When the network device determines that the first description file is incompatible with the third description file, the network device sends a check result indicating that the first description file is incompatible with the third description file to the management device. When the network device determines that the first description file is compatible with the third description file, the network device sends a check result indicating that the first description file is compatible with the third description file to the management device. Then, no difference negotiation process of the description file is needed between the network device and the management device.
[0133] The method for checking whether the third description file is compatible with the first description file can refer to the related description of S203, which will not be repeated here.
[0134] S407: The network device sends a check result indicating that the first description file is incompatible with the third description file to the management device.
[0135] S408: The management device sends a difference negotiation request to the network device, and the difference negotiation request indicates that the network device generates a second description file according to the first description file.
[0136] After receiving the check result indicating that the first description file is incompatible with the third description file sent by the network device, the management device sends a difference negotiation request indicating that a second description file is generated according to the first description file to the network device.
[0137] S409: The network device generates a second description file according to the first description file, and the second description file is the compatible part of the first description file with the YANG model of the network device.
[0138] The network device obtains the second description file according to the first description file, which can refer to the related content of S203, and thus details are not repeated here.
[0139] S410: The network device sends the second description file to the management device.
[0140] S411: The management device checks whether the second description file meets the condition.
[0141] If the second description file meets the condition, S412 and S413 are executed. If the second description file does not meet the condition, since the management device cannot obtain the required information from the data reported by the network device based on the second description file, S415 is executed.
[0142] S412: The management device configures the description file used for decoding the sampling data pushed by the network device as the second description file.
[0143] This step is similar to S206, and thus details are not repeated here.
[0144] S413: The management device sends the checking result to the network device.
[0145] This step is similar to S207, and thus details are not repeated here.
[0146] S414: The network device configures the description file used for encoding the sampling data as the second description file.
[0147] This step is similar to S208, and thus details are not repeated here.
[0148] S415: The communication connection between the management device and the network device is disconnected.
[0149] This step is similar to S209, and thus details are not repeated here.
[0150] S402-S406 can reduce the bandwidth occupied by the transmission of the description file in the network. Of course, S402-S406 are optional steps. In a possible implementation manner, the first description file can be directly carried in the difference discovery request sent by the management device to the network device, and the network device performs the compatibility check according to the first description file. Alternatively, the management device can directly send a difference negotiation request to the network device without performing the difference discovery process, and the network device directly obtains the second description file according to the first description file.
[0151] In this embodiment, before the management device subscribes to the sampling data of the sampling path of the network device, the management device initiates a difference discovery request for the description file of the sampling path to the network device, so that when the first description file and the third description file are incompatible, the management device and the network device can further realize the sampling data of the same sampling path through difference negotiation, and the management device and the network device can use the same description file for coding and decoding. The difference discovery and difference negotiation of the description file between the network device and the management device can automatically and quickly realize the synchronization of the description file.
[0152] When the management device subscribes to the sampling data of multiple sampling paths of the network device, the management device and the network device can perform difference discovery and difference negotiation on the description files corresponding to the subscribed multiple sampling paths. For example, the management device can send a difference discovery request to the network device, and the difference discovery request carries a description file information list including multiple description file information. By using the description file information list with smaller data volume to filter the inconsistent description files, the network device can only send the inconsistent description files between the network device and the management device to the network device in the subsequent process, so as to reduce the occupation of bandwidth resources in the difference discovery and difference negotiation process.
[0153] The description file information list includes the name of each description file, the cyclic redundancy check (CRC) check value or hash value of the file content, etc. Of course, the description file information list can also include the size information corresponding to the description file. The network device takes the same description file name as the key, compares whether the file size, the CRC check value or the hash value of the file content of the files with the same description file name are consistent, and then returns the comparison result to the management device. The management device receives the comparison result returned by the network device, the comparison result includes the name of the inconsistent description file (at least one of the file size, the CRC check value and the hash value of the file content is inconsistent), and the management device sends the inconsistent description file (for example, including the first description file) to the network device. The network device verifies whether the description file from the management device and the description file with the same file name of itself are compatible, and returns the verification result to the management device after obtaining the verification result. For the incompatible description files, operations similar to S405-S411 are performed, which will not be described here. Therefore, the management device and the network device can batch complete the difference discovery and difference negotiation of multiple description files, and improve the synchronization efficiency of the description file.
[0154] The communication connection between the network device and the management device can be disconnected and reconnected. To avoid the network device and the management device performing the difference discovery and / or difference negotiation process again after each successful connection, the network device / management device can cache the previous verification result (difference discovery result) and / or difference negotiation result, thereby improving the synchronization efficiency of the description file. For example, in the case of initiating the communication connection between the network device and the management device by the management device, before subscribing to the sampling data of a certain sampling path of the network device, the management device can first query whether the description file corresponding to the sampling path has been negotiated with the network device before. If there is a related difference negotiation result, for example, a second description file corresponding to the sampling path, the second description file is sent to the network device, indicating the network device to use the second description file to encode the sampling data of the corresponding sampling path, so that the difference discovery and difference negotiation do not need to be performed again through multiple interactions, thereby improving the synchronization efficiency of the description file and the occupation of the bandwidth resource.
[0155] For example, in the case of initiating the communication connection between the network device and the management device by the network device, the network device can locally query whether the description file corresponding to the sampling path has been negotiated with the management device before. If there is a related difference negotiation result, for example, a second description file corresponding to the sampling path, the second description file is sent to the management device. The network device sets the description file used to encode the sampling data of the sampling path to the second description file, and the management device sets the description file used to decode the sampling data of the sampling path to the second description file. Or after the management device confirms that the second description file meets the conditions, the management device sets the description file used to decode the sampling data of the sampling path to the second description file, and notifies the network device to set the description file used to encode the sampling data of the sampling path to the second description file, thereby reducing the number of interactions between the network device and the management device, and improving the synchronization efficiency of the description file.
[0156] For example, when the network device receives the sending difference discovery request sent by the management device and carrying the first description file or the description file information (such as the name, size, hash value or CRC value of the description file) corresponding to the first description file, the network device queries the difference discovery result of the first description file cached locally, and then the network device can obtain the corresponding compatibility test result from the cache and send the test result to the management device. The network device does not need to perform the compatibility test between the first description file and the third description file again. When the network device receives the difference negotiation request of the management device, if the network device caches the difference negotiation result of the first description file, such as the second description file obtained based on the first description file, and the second description file meets the condition of the management device, the network device also does not need to generate the second description file based on the first description file sent by the management device, but obtains the cached second description file and sends it to the management device. Therefore, the workload of the network device can be reduced, the occupation of the computing resources of the network device can be reduced, and the description file synchronization efficiency can be improved.
[0157] Based on the same technical concept, the present application also provides the following embodiments. As shown in Figure 5 Figure 5 A structural schematic diagram of a management device is provided in the present application. In the embodiment, the management device 500 includes a transceiver module 501 and a processing module 502.
[0158] The transceiver module 501 is configured to send the first description file of the management device to the network device. The transceiver module 501 is configured to receive the second description file returned by the network device, and the second description file is the compatible part of the content in the first description file with the YANG model of the network device. The processing module 502 is configured to decode the data reported by the network device based on the second description file when the second description file meets the condition, and the data reported by the network device is obtained by encoding based on the second description file.
[0159] In a possible implementation, the transceiver module 501 is configured to receive the third description file from the network device. The processing module 502 is configured to test whether the third description file is compatible with the first description file. The transceiver module 501 is configured to send the first description file of the management device to the network device when the third description file is not compatible with the first description file.
[0160] In a possible implementation, the transceiver module 501 is configured to receive the test result from the network device, and the test result indicates that the third description file is not compatible with the first description file. The transceiver module 501 is configured to send the difference negotiation request to the network device, and the difference negotiation request indicates that the network device generates the second description file based on the first description file.
[0161] In a possible implementation, the transceiver 501 is configured to send a difference discovery request to the network device, the difference discovery request carrying description file information, the description file information including at least one description file name and a hash value, and the difference discovery request indicating that the network device compares whether the description file information is consistent with information of a description file of the network device. The transceiver 501 is configured to receive a comparison result returned by the network device, the comparison result including a name of a description file with an inconsistent hash value, and the name of the description file with the inconsistent hash value including the name of the first description file. The transceiver 501 is specifically configured to send the first description file to the network device when the name of the description file with the inconsistent hash value includes the name of the first description file.
[0162] As shown in Figure 6 The present application further provides a network device. The network device 600 includes a transceiver 601 and a processing module 602. The transceiver 601 is configured to receive a first description file of a management device sent by the management device. The processing module 602 is configured to obtain a second description file according to the first description file, the second description file being partial content of the first description file that is compatible with a YANG model of the network device. The transceiver 601 is configured to send the second description file to the management device, so that the management device decodes data reported by the network device based on the second description file when the second description file meets a condition, the data reported by the network device being obtained by encoding based on the second description file.
[0163] In a possible implementation, the transceiver 601 is configured to send a third description file of the network device to the management device, so that the management device sends the first description file to the network device when the third description file is incompatible with the first description file.
[0164] In a possible implementation, the processing module 602 is configured to check whether the first description file is compatible with the third description file, to obtain a checking result. The transceiver 601 is configured to send the checking result to the management device, so that the management device sends a difference negotiation request to the network device when the checking result indicates that the third description file is incompatible with the first description file. The transceiver 601 is configured to receive the negotiation difference request and perform the step of obtaining the second description file according to the first description file.
[0165] In a possible implementation, the network device further includes a storage module 603. The storage module 603 is configured to store the checking result, so that the network device returns the stored checking result to the management device when the management device sends a difference discovery request to the network device.
[0166] In a possible implementation, the transceiver 601 is configured to receive a difference discovery request from the management device, the difference discovery request carrying description file information including at least one description file name and a hash value, and the difference discovery request indicating that the network device compares whether the description file information is consistent with information of a description file of the network device. The processor 602 is configured to compare whether the description file information is consistent with the information of the description file of the network device to obtain a comparison result, the comparison result including a name of a description file with an inconsistent hash value, and the name of the description file with the inconsistent hash value including the name of the first description file. The transceiver 601 is configured to send the comparison result to the management device, so that the management device sends the description file with the inconsistent hash value to the network device according to the comparison result.
[0167] The present application also provides a network device. The device includes a transceiver and a processor. The transceiver is configured to receive a target description file. The processor is configured to encode data reported by a network device based on the target description file when the target description file is compatible with a YANG model of the network device.
[0168] As shown in Figure 7 The present application also provides an electronic device. The electronic device 700 includes a processor 701 and a memory 702, the processor 701 is coupled to the memory 702, and the processor 701 is configured to execute the file synchronization method of any of the above method embodiments based on instructions stored in the memory 702.
[0169] The present application also provides a computer readable storage medium having a computer program stored thereon, and the computer program is executed by a computer to implement the file synchronization method of any of the above method embodiments.
[0170] The present application also provides a computer program product, including a program, when the program is executed on a processor, the file synchronization method of any of the above method embodiments is executed.
[0171] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0172] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other manners. For example, the described device embodiments are merely illustrative. For example, the division of the units is only a logical function division. There can be another division manner for the actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different units, or the among different units, can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.
[0173] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments.
[0174] In addition, each functional unit in the embodiments of the present application can be integrated in a processing unit, or each unit can exist physically as a separate unit, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of a software functional unit.
[0175] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such an understanding, all or some of the technical solutions of the present application can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or some of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), magnetic disk or optical disk, and various other media that can store program codes.
Claims
1. A file synchronization method, characterized by, The method comprises: The management device sends a first description file of the management device to a network device; The management device receives a second description file returned by the network device, the second description file being part of the first description file compatible with a next-generation modeling language YANG model of the network device; If the second description file meets a condition, the management device decodes data reported by the network device based on the second description file, the data reported by the network device being data organized by the YANG model and encoded based on the second description file.
2. The method of claim 1, wherein, Before the management device sends the first description file of the management device to the network device, the method comprises: The management device receives a third description file from the network device; The management device checks whether the third description file is compatible with the first description file; When the third description file is incompatible with the first description file, the management device performs the step of sending the first description file of the management device to the network device.
3. The method of claim 2, wherein, Before the management device receives the second description file returned by the network device, the method comprises: The management device receives a checking result from the network device, the checking result indicating that the third description file of the network device is incompatible with the first description file; The management device sends a difference negotiation request to the network device, the difference negotiation request instructing the network device to generate the second description file according to the first description file.
4. The method according to claim 1 or 3, characterized in that, Before the management device sends the first description file of the management device to the network device, the method comprises: The management device sends a difference discovery request to the network device, the difference discovery request carrying description file information, the description file information comprising at least one description file name and hash value, the difference discovery request instructing the network device to compare whether the description file information is consistent with information of a description file of the network device; The management device receives a comparison result returned by the network device, the comparison result comprising a name of a description file with inconsistent hash value, the name of the description file with inconsistent hash value comprising a name of the first description file; The management device performs the step of sending the first description file of the management device to the network device.
5. A file synchronization method characterized by, The method comprises: The network device receives a first description file of a management device sent by the management device; The network device obtains a second description file according to the first description file, the second description file being part of the first description file compatible with a YANG model of the network device; The network device sends the second description file to the management device, so that the management device decodes data reported by the network device based on the second description file when it is determined that the second description file meets a condition, the data reported by the network device being data organized by the YANG model and encoded based on the second description file.
6. The method of claim 5, wherein, Before the network device receives the first description file of the management device sent by the management device, the method comprises: The network device sends a third description file of the network device to the management device, so that the management device sends the first description file to the network device when the third description file is incompatible with the first description file.
7. The method of claim 6, wherein, Before the network device obtains a second description file according to the first description file, the network device comprises: The network device checks whether the first description file is compatible with the third description file, and obtains a checking result; The network device sends the checking result to the management device, so that the management device sends a difference negotiation request to the network device when the checking result indicates that the third description file is incompatible with the first description file; The network device receives the negotiation difference request and performs the step of obtaining a second description file according to the first description file.
8. The method of claim 7, wherein, The network device stores the checking result, so that the network device returns the stored checking result to the management device when the management device sends a difference discovery request to the network device.
9. The method of any one of claims 5, 7-8, wherein, Before the network device receives the first description file of the management device sent by the management device, the network device comprises: The network device receives a difference discovery request from the management device, the difference discovery request carries description file information, the description file information comprises at least one description file name and a hash value, and the difference discovery request indicates that the network device compares whether the description file information is consistent with information of a description file of the network device; The network device compares whether the description file information is consistent with the information of the description file of the network device to obtain a comparison result, the comparison result comprises a name of a description file with an inconsistent hash value, and the name of the description file with the inconsistent hash value comprises the name of the first description file; The network device sends the comparison result to the management device, so that the management device sends a description file with an inconsistent hash value to the network device according to the comparison result.
10. A management device, characterized by comprising: The device comprises: The transceiver module is configured to send a first description file of the management device to the network device; The transceiver module is configured to receive a second description file returned by the network device, the second description file being part of the content of the first description file compatible with a YANG model of the network device; The processing module is configured to decode data reported by the network device based on the second description file when the second description file meets a condition, the data reported by the network device being data organized by the YANG model and encoded based on the second description file.
11. The device of claim 10, wherein: The transceiver module is configured to receive a third description file from the network device; The processing module is configured to check whether the third description file is compatible with the first description file; The transceiver module is configured to send the first description file of the management device to the network device when the third description file is incompatible with the first description file.
12. The device of claim 11, wherein: The transceiver module is configured to receive a verification result from the network device, where the verification result indicates that the third description file is incompatible with the first description file. The transceiver module is configured to send a difference negotiation request to the network device, where the difference negotiation request instructs the network device to generate the second description file according to the first description file.
13. The device of claim 10 or 12, wherein, The transceiver module is configured to send a difference discovery request to the network device, where the difference discovery request carries description file information, the description file information includes at least one description file name and a hash value, and the difference discovery request instructs the network device to compare whether the description file information is consistent with information of a description file of the network device. The transceiver module is configured to receive a comparison result returned by the network device, where the comparison result includes a name of a description file with an inconsistent hash value, and the name of the description file with the inconsistent hash value includes the name of the first description file. The transceiver module is specifically configured to send the first description file to the network device when the name of the description file with the inconsistent hash value includes the name of the first description file.
14. A network device, comprising: The device includes: The transceiver module is configured to receive a first description file of the management device sent by the management device. The processing module is configured to obtain a second description file according to the first description file, where the second description file is part of content in the first description file that is compatible with a YANG model of the network device. The transceiver module is configured to send the second description file to the management device, so that the management device decodes data reported by the network device based on the second description file when it is determined that the second description file meets a condition, where the data reported by the network device is obtained by encoding data organized according to the YANG model based on the second description file.
15. The device of claim 14, wherein, The transceiver module is configured to send a third description file of the network device to the management device, so that the management device sends the first description file to the network device when the third description file is incompatible with the first description file.
16. The device of claim 15, wherein, The processing module is configured to check whether the first description file is compatible with the third description file, to obtain a checking result. The transceiver module is configured to send the checking result to the management device, so that the management device sends a difference negotiation request to the network device when the checking result indicates that the third description file is incompatible with the first description file. The transceiver module is configured to receive the negotiation difference request and perform the step of obtaining a second description file according to the first description file.
17. The apparatus of claim 16, wherein, The network device further includes a storage module. The storage module is configured to store the checking result, so that the network device returns the stored checking result to the management device when the management device sends a difference discovery request to the network device.
18. The device of any of claims 14, 16-17, wherein the transceiver is configured to receive a difference discovery request from the management device, the difference discovery request carrying profile information including at least one profile name and hash value, the difference discovery request indicating that the network device is to compare the profile information to profile information of the network device. the processing module is configured to compare the profile information to profile information of the network device to obtain a comparison result, the comparison result including a name of a profile with an inconsistent hash value, the name of the profile with the inconsistent hash value including the first profile name. the transceiver is configured to send the comparison result to the management device to cause the management device to send the profile with the inconsistent hash value to the network device based on the comparison result. The device includes a processor and a memory, the processor coupled to the memory, the processor configured to perform the file synchronization method of any of claims 1-9 based on instructions stored in the memory.
19. An electronic device, comprising: An electronic device including instructions that, when executed on the electronic device, cause the electronic device to perform the file synchronization method of any of claims 1-9.
20. A computer-readable storage medium, characterized in that, A program including instructions that, when executed on a processor, perform the file synchronization method of any of claims 1-9.
21. A computer program product, characterised in that,
Citation Information
Patent Citations
Compiling method based on YANG model, and corresponding interface, module and system
CN106559251A
Method for automatic matching terminal devices in household network
CN1481118A