Method, device, equipment and computer readable storage medium for transmitting data
Patent Information
- Application Number
- CN202111681674.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2041-12-29
AI Technical Summary
[0004]由于相关技术提供的监控管理方式中,无需按照OID采集数据,且网络设备所采集的数据为推送过程所需的格式,与SNMP中MIB定义的格式不同,因而网络设备不再使用SNMP,从而导致了SNMP的浪费
Smart Images

Figure CN116418646B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to methods, apparatus, devices and computer-readable storage media for transmitting data. Background Technology
[0002] With the development of communication technology, there are increasingly more methods for monitoring and managing network devices, and Simple Network Management Protocol (SNMP) is one of them. SNMP is a pull-mode monitoring and management method. Network devices, upon receiving a request, collect data according to object identifiers (OIDs) and transmit the data, and the collected data follows the format defined by the Management Information Base (MIB). SNMP suffers from problems such as high resource consumption and significant latency.
[0003] In response, the relevant technology provides a monitoring and management method that adopts push mode, in which network devices actively collect data and transmit it. The collected data is in the format required for the push process, which is different from the format defined by MIB.
[0004] Because the monitoring and management methods provided by related technologies do not require data collection according to OID, and the data collected by network devices is in the format required for the push process, which is different from the format defined by MIB in SNMP, network devices no longer use SNMP, resulting in a waste of SNMP. Summary of the Invention
[0005] This application provides a method, apparatus, device, and computer-readable storage medium for transmitting data to solve the problems existing in the monitoring and management methods provided by related technologies. The technical solution is as follows:
[0006] Firstly, a method for transmitting data is provided, the method comprising:
[0007] First, the first network device obtains the OID (Object Identifier) provided by SNMP for identifying objects. Then, the first network device collects first data corresponding to the object identified by the OID, which has a format defined by the MIB. Next, the first network device encapsulates the first data according to the format required for the push process to obtain second data, and then pushes the second data to the second network device.
[0008] In this application, the first network device collects first data according to the OID provided by SNMP, thus allowing the first network device to reuse SNMP and avoid wasting SNMP resources. Furthermore, for the collected first data, the first network device encapsulates the first data according to the format required for the push process to obtain second data, making it possible to push the second data to the second network device. The method by which the first network device pushes the second data to the second network device has the advantages of requiring fewer processing resources and having shorter latency.
[0009] The lower processing resource consumption is due to the fact that the second network device can receive the second data pushed by the first network device without sending a request to the first network device, thus saving the processing resources required for the second network device to send the request. Additionally, the lower latency is due to the reduced time consumed by the second network device in sending the request.
[0010] In one possible implementation, the format required for the push process is defined by another next-generation (Yang) model. The first network device encapsulates first data according to the required format to obtain second data, including: the first network device determining a data identifier based on an OID, the data identifier being used to identify the first data; and the first network device encapsulating the data identifier and the first data according to the format defined by the Yang model to obtain the second data. In this implementation, encapsulating the first data according to the format defined by the Yang model enables a telemetry mechanism.
[0011] In one possible implementation, the second data includes corresponding first and second fields. The first field carries a data identifier, and the second field carries the first data. Since the first and second fields correspond, the data identifier carried in the first field also corresponds to the first data carried in the second field. After this second data is pushed to the second network device, the second network device can determine that the first data is data indicated by the data identifier, thereby enabling the second network device to identify the object corresponding to the first data based on the data identifier.
[0012] In one possible implementation, the first data includes multiple sub-data items, and each data identifier corresponds to multiple sub-data identifiers. There is a one-to-one correspondence between the multiple sub-data items and the multiple sub-data identifiers. The second data includes corresponding first and second fields. The first field carries the data identifier, and the second field includes multiple sub-fields. For any given sub-data item, any two corresponding sub-fields carry that sub-data item and its corresponding sub-data identifier. After this second data is pushed to the second network device, the second network device can distinguish the various sub-data items included in the first data, and can determine that the sub-data item is indicated by the sub-data identifier. The second network device can then determine the object corresponding to the sub-data item based on the sub-data identifier.
[0013] In one possible implementation, the first network device determines the data identifier based on the OID, including: the first network device determining the OID as the data identifier; or, the first network device querying the MIB based on the OID to obtain the string corresponding to the OID, and determining the string corresponding to the OID as the data identifier. This implementation provides two different ways to determine the data identifier based on the OID, which is quite flexible.
[0014] In one possible implementation, before obtaining the second data, the method further includes: the first network device encapsulating the first data according to the format required for the push process; and the first network device obtaining the Yang model corresponding to the service attributes. This implementation obtains the corresponding Yang model based on the service attributes of the first data, and the method of obtaining the Yang model is relatively flexible.
[0015] In one possible implementation, the first network device collects the first data corresponding to the object identified by the OID, including: the first network device collecting the first data corresponding to the object identified by the OID locally from the first network device according to the OID; or, the first network device sending the OID to the third network device and receiving the first data returned by the third network device, wherein the first data is the data corresponding to the object identified by the OID collected by the third network device locally from the third network device according to the OID; or, the first network device sending the OID and alarm conditions to the third network device and receiving the first data returned by the third network device, wherein the first data is the data corresponding to the object identified by the OID collected by the third network device locally from the third network device according to the OID, and the first data satisfies the alarm conditions.
[0016] This implementation provides three different ways for the first network device to collect the first data, offering considerable flexibility. In the case where the third network device collects data corresponding to the object identified by the OID from its local storage, the first network device acts as a proxy, acting as an intermediary for the second network device to collect the first data from the third network device. It then encapsulates the collected first data into second data and pushes it to the second network device. Therefore, even if the third network device itself does not have push functionality, the second network device can still obtain the first data collected locally from the third network device, and can monitor and manage the third network device based on the acquired first data.
[0017] In one possible implementation, the first network device obtains the OID provided by SNMP, including: the first network device obtaining the OID provided by SNMP through a static configuration process or a dynamic configuration process; or, the first network device obtaining the sampling path through a static configuration process or a dynamic configuration process, and then obtaining the OID provided by SNMP through the sampling path. This implementation provides four different ways for the first network device to obtain the OID, offering greater flexibility.
[0018] Secondly, a method for transmitting data is provided, the method comprising: a second network device receiving second data pushed by a first network device, the second data being obtained by the first network device by encapsulating first data in a format required by the pushing process, the first data being data corresponding to an object identified by an OID collected by the first network device, the first data having a format defined by MIB, and the OID being provided by SNMP.
[0019] In one possible implementation, the format required for the push process is the format defined by the Yang model. The second data is obtained by the first network device by encapsulating the data identifier and the first data according to the format defined by the Yang model. The data identifier is determined based on OID and is used to identify the first data.
[0020] In one possible implementation, the second data includes a corresponding first field and a second field, where the first field carries a data identifier and the second field carries the first data.
[0021] In one possible implementation, the first data includes multiple sub-data, and the data identifier corresponds to multiple sub-data identifiers. The multiple sub-data and the multiple sub-data identifiers are in one-to-one correspondence. The second data includes a corresponding first field and a second field. The first field carries the data identifier, and the second field includes multiple sub-fields. For any sub-data, any two corresponding sub-fields among the multiple sub-fields carry any sub-data and the sub-data identifier corresponding to any sub-data.
[0022] In one possible implementation, the data is identified as an OID, or the data is identified as the string corresponding to the OID.
[0023] Thirdly, a data transmission apparatus is provided, the apparatus comprising:
[0024] The acquisition module is used to obtain the OID provided by SNMP. The OID is used to identify the object.
[0025] The acquisition module is used to acquire the first data corresponding to the object identified by the OID. The first data has a format defined by MIB.
[0026] The encapsulation module is used to encapsulate the first data according to the format required by the push process to obtain the second data;
[0027] The push module is used to push second data to the second network device.
[0028] In one possible implementation, the push process requires a format defined by the Yang model, an encapsulation module for determining a data identifier based on an OID, the data identifier for identifying the first data; and encapsulating the data identifier and the first data according to the format defined by the Yang model to obtain the second data.
[0029] In one possible implementation, the second data includes a corresponding first field and a second field, where the first field carries a data identifier and the second field carries the first data.
[0030] In one possible implementation, the first data includes multiple sub-data, and the data identifier corresponds to multiple sub-data identifiers. The multiple sub-data and the multiple sub-data identifiers are in one-to-one correspondence. The second data includes a corresponding first field and a second field. The first field carries the data identifier, and the second field includes multiple sub-fields. For any sub-data, any two corresponding sub-fields among the multiple sub-fields carry any sub-data and the sub-data identifier corresponding to any sub-data.
[0031] In one possible implementation, an encapsulation module is used to determine the OID as a data identifier; or, the MIB is queried based on the OID to obtain the string corresponding to the OID, and the string corresponding to the OID is determined as the data identifier.
[0032] In one possible implementation, the encapsulation module is also used to determine the business attributes of the first data and obtain the Yang model corresponding to the business attributes.
[0033] In one possible implementation, the acquisition module is used by the first network device to acquire first data corresponding to the object identified by the OID from the local data of the first network device according to the OID; or, to send the OID to the third network device and receive the first data returned by the third network device, wherein the first data is the data corresponding to the object identified by the OID acquired by the third network device from the local data of the third network device according to the OID; or, to send the OID and alarm conditions to the third network device and receive the first data returned by the third network device, wherein the first data is the data corresponding to the object identified by the OID acquired by the third network device from the local data of the third network device according to the OID, and the first data satisfies the alarm conditions.
[0034] In one possible implementation, the acquisition module is used to acquire the OID provided by SNMP through a static configuration process or a dynamic configuration process; or, it acquires the sampling path through a static configuration process or a dynamic configuration process, and then acquires the OID provided by SNMP through the sampling path.
[0035] Fourthly, a data transmission apparatus is provided, the apparatus comprising:
[0036] The receiving module is used to receive the second data pushed by the first network device. The second data is obtained by the first network device encapsulating the first data according to the format required by the pushing process. The first data is the data corresponding to the object identified by the OID collected by the first network device. The first data has the format defined by MIB, and the OID is provided by SNMP.
[0037] In one possible implementation, the format required for the push process is the format defined by the Yang model. The second data is obtained by the first network device by encapsulating the data identifier and the first data according to the format defined by the Yang model. The data identifier is determined based on OID and is used to identify the first data.
[0038] In one possible implementation, the second data includes a corresponding first field and a second field, where the first field carries a data identifier and the second field carries the first data.
[0039] In one possible implementation, the first data includes multiple sub-data, and the data identifier corresponds to multiple sub-data identifiers. The multiple sub-data and the multiple sub-data identifiers are in one-to-one correspondence. The second data includes a corresponding first field and a second field. The first field carries the data identifier, and the second field includes multiple sub-fields. For any sub-data, any two corresponding sub-fields among the multiple sub-fields carry any sub-data and the sub-data identifier corresponding to any sub-data.
[0040] In one possible implementation, the data is identified as an OID, or the data is identified as the string corresponding to the OID.
[0041] Fifthly, a data transmission device is provided, the device including a memory and a processor, the memory storing at least one instruction, the at least one instruction being loaded and executed by the processor to enable the data transmission device to implement the data transmission method provided in the first aspect or any possible implementation of the first aspect.
[0042] In a sixth aspect, a data transmission device is provided, the device including a memory and a processor, the memory storing at least one instruction, the at least one instruction being loaded and executed by the processor to cause the data transmission device to implement the data transmission method provided in the second aspect or any possible implementation of the second aspect.
[0043] Optionally, there may be one or more processors and one or more memories.
[0044] Alternatively, the memory can be integrated with the processor, or the memory can be set up separately from the processor.
[0045] In the specific implementation process, the memory can be a non-transitory memory, such as read-only memory (ROM), which can be integrated with the processor on the same chip or set on different chips. This application does not limit the type of memory or the way the memory and processor are set.
[0046] In a seventh aspect, a system for transmitting data is provided, the system comprising a first network device and a second network device connected in communication, the first network device being used to implement the method for transmitting data provided by the first aspect or any possible implementation thereof, and the second network device being used to implement the method for transmitting data provided by the second aspect or any possible implementation thereof.
[0047] Eighthly, a computer program (product) is provided, comprising: computer program code, which, when executed by a computer, causes the computer to perform the methods described in the above aspects.
[0048] Ninthly, a computer-readable storage medium is provided that stores a program or instructions, wherein when the program or instructions are run on a computer, the methods of the above aspects are performed.
[0049] In a tenth aspect, a chip is provided, including a processor for retrieving and executing instructions stored in a memory, causing a communication device on which the chip is mounted to perform the methods described in the foregoing aspects.
[0050] Eleventhly, another chip is provided, including: an input interface, an output interface, a processor, and a memory, wherein the input interface, the output interface, the processor, and the memory are connected by an internal connection path, the processor is used to execute code in the memory, and when the code is executed, the processor is used to execute the methods in the above aspects. Attached Figure Description
[0051] Figure 1 This is a schematic diagram of the structure of a data transmission system provided in an embodiment of this application;
[0052] Figure 2 A schematic diagram of another data transmission system provided in this application embodiment;
[0053] Figure 3 This is a schematic diagram of the structure of another data transmission system provided in the embodiments of this application;
[0054] Figure 4 A flowchart illustrating a method for transmitting data provided in an embodiment of this application;
[0055] Figure 5 This is a schematic diagram of the structure of a MIB provided in an embodiment of this application;
[0056] Figure 6 This is a schematic diagram of the structure of a data transmission device provided in an embodiment of this application;
[0057] Figure 7 A schematic diagram of another data transmission device provided in an embodiment of this application;
[0058] Figure 8 This is a schematic diagram of the structure of a data transmission device provided in an embodiment of this application. Detailed Implementation
[0059] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.
[0060] This application provides a method for transmitting data, which is applied to... Figure 1 The data transmission system shown includes a first network device 101 and a second network device 102 connected by communication. The first network device 101 obtains an OID provided by SNMP, collects first data corresponding to the object identified by the OID, and the first data has a format defined by MIB. The first network device 101 is also used to encapsulate the first data according to the format required for the push process to obtain second data, and pushes the second data to the second network device 102. The second network device 102 is used to receive the second data pushed by the first network device 101.
[0061] For example, the first network device 101 collects first data locally. In some embodiments, the first network device 101 deploys an SNMP module, and the first network device 101 provides an OID to the SNMP module, thereby enabling the SNMP module to perform the aforementioned first data collection, encapsulation, and push processes. For example, the second network device 102 is a network management device. In some embodiments, the push process is a telemetry-based push process, and the required format for the push process is the format defined by the Yang model. The first network device 101 pushes the second data to the second network device 102 via the Google Remote Procedure Call (gRPC) protocol.
[0062] In an exemplary embodiment, see Figure 2 The data transmission system provided in this application embodiment further includes a third network device 103. The first network device 101 is also communicatively connected to the third network device 103 to collect first data from the third network device 103, and after encapsulating the first data to obtain second data, pushes the second data to the second network device 102. In this case, the first network device 101 acts as an agent for the second network device 102 to collect the first data from the third network device 103.
[0063] For example, the first network device 101 is used to query first data from the third network device 103, or to receive first data alarmed by the third network device 103. For example, when an SNMP module is deployed in the first network device 101, the process of collecting the first data from the third network device 103 is executed by the SNMP module, and the first network device 101 collects the first data from the third network device 103 via the User Datagram Protocol (UDP). In some embodiments, the third network device 103 is an outdoor enclosure device, which includes, but is not limited to, at least one of a lightning protection system, a power supply system, a heat dissipation system, a temperature and humidity monitoring system, an access control system, and a smoke detection system.
[0064] See Figure 3 , Figure 3An exemplary data transmission system is illustrated, comprising a network management device, a first network device A, a first network device B, and an outdoor cabinet device. The network management device is communicatively connected to the first network device A via a communication network, and also to the first network device B via a communication network. The first network device B is further connected to the outdoor cabinet device via a communication network. Specifically, an SNMP module deployed in the first network device A collects first data locally from the first network device A, encapsulates the collected first data into second data, and pushes the second data to the network management device via the gRPC protocol. Similarly, an SNMP module deployed in the first network device B collects first data from the outdoor cabinet device via the UDP protocol, encapsulates the collected first data into second data, and pushes the second data to the network management device via the gRPC protocol. It should be noted that... Figure 3 The data transmission system shown is exemplified by two first network devices (i.e., first network device A and first network device B). Exemplarily, the functions of first network device A and first network device B can also be integrated into the same first network device.
[0065] based on Figure 1-3 The system for transmitting data shown in this application provides a method for transmitting data, which is applied to the interaction process between a first network device and a second network device. For example... Figure 4 As shown, the method includes the following steps 401-405.
[0066] Step 401: The first network device obtains the OID provided by SNMP. The OID is used to identify the object.
[0067] SNMP provides a MIB, which is a database used to define objects. The OIDs provided by SNMP are determined based on the MIB. See also Figure 5 The MIB (Management Information Base) uses a tree structure, consisting of a root and multiple branches. Each branch contains one or more nodes, each representing an object. Each object has a name and a number. For a given object, the MIB represents a complete path starting from the root and ending at the object itself. This complete path contains one or more objects, including the object itself. Arranging the numbers corresponding to each object along this complete path sequentially, separated by periods (.), yields the OID (Object Identifier). Thus, the OID used to identify an object is determined based on the MIB. For example, based on... Figure 5 The MIB shown can be identified by the OID 1.3.6.1.2.1.
[0068] exist Figure 5There are three branches connected to the root node. The first branch has the Consultative Committee on International Telegraph (CCIT) node with a number of 0, the second branch has the International Organization for Standardization (ISO) node with a number of 1, and the third branch has the joint ISO-CCIT node with a number of 2. The second branch, besides the ISO node, also includes an organization (org) node (number 3), a department of defense (DOD) node (number 6), an internet node (number 1), a management (MGMT) node (number 2), and a MIB node (number 1), etc. The nodes connected to the MIB node include, but are not limited to, system nodes (number 1), interface nodes (number 2), etc. Figure 5 The nodes shown are merely examples and are not intended to limit the number of nodes included in the MIB.
[0069] It should be noted that the object identified by an OID is a data source capable of generating data. For example, the object identified by an OID includes, but is not limited to, hardware, software, hardware parameters, and software parameters. For instance, hardware includes network interfaces, processors, memory, and disks; software includes the operating system. Taking network interfaces as an example, hardware parameters include, but are not limited to, the number of network interfaces, the type of network interface, and the number of data packets received by the network interface. Taking the operating system as an example, software parameters include, but are not limited to, the list of processes running in the operating system and the list of software installed in the operating system. It is understood that the objects identified by OIDs above are merely examples and are not intended to limit the scope of objects identified by OIDs.
[0070] In an exemplary embodiment, the first network device obtains the OID provided by SNMP, including the following two methods A1 and A2.
[0071] In method A1, the first network device obtains the OID provided by SNMP through a static configuration process or a dynamic configuration process.
[0072] During static configuration, the first network device obtains a command line and sends a connection request to the second network device based on the command line, thereby establishing a connection with the second network device. For example, obtaining the command line for the first network device includes: the first network device receiving a manually configured command line. Furthermore, the first network device also obtains an OID provided by SNMP based on the command line, thus completing the static configuration process. In subsequent processes, after obtaining the first data corresponding to the object identified by the OID, the first network device pushes second data encapsulated from the first data to the second network device through the established connection. The second network device can then manage based on the second data pushed by the first network device. The above-described static configuration process and subsequent processes are also known as static subscription, with the static configuration process being one of the processes within static subscription. For static subscription, if the connection established between the first and second network devices is broken, the first network device will resend a connection request to the second network device based on the command line, thereby re-establishing a connection and executing subsequent processes.
[0073] During dynamic configuration, the first network device receives a connection request from the second network device and establishes a connection with it. Then, the first network device obtains the OID provided by SNMP through the established connection, thus completing the dynamic configuration process. In subsequent processes, after obtaining the first data corresponding to the object identified by the OID, the first network device pushes second data, encapsulated from the first data, to the second network device through the established connection. The second network device can then manage based on the second data pushed by the first network device. This dynamic configuration process and subsequent processes are also known as dynamic subscription, with the dynamic configuration process being one part of the dynamic subscription process. For dynamic subscription, if the connection established between the first and second network devices is broken, the first network device will not re-establish a connection with the second network device, nor will it execute subsequent processes.
[0074] In method A2, the first network device obtains the sampling path through a static configuration process or a dynamic configuration process, and obtains the OID provided by SNMP through the sampling path.
[0075] The method by which the first network device obtains the sampling path through a static configuration process is the same as the method by which the first network device obtains the OID provided by SNMP through a static configuration process in Method A1 above. The method by which the first network device obtains the sampling path through a dynamic configuration process is the same as the method by which the first network device obtains the OID provided by SNMP through a dynamic configuration process in Method A1 above. These methods will not be repeated here.
[0076] For example, the first network device is configured with a mapping relationship between sampling paths and OIDs. The first network device obtains the OID based on this mapping relationship. Specifically, after obtaining the sampling path, the first network device queries the mapping relationship between the sampling path and OID to obtain the OID corresponding to the sampling path, thereby achieving OID acquisition.
[0077] In some implementations, the sampling path obtained by the first network device is the Yang model sampling path. An exemplary Yang model sampling path is: ifm:ifm / interfaces / interface / mib-statistic. Querying the correspondence between the sampling path and the OID yields the OID 1.3.6.1.4.1.2011.5.25.145.1.2.
[0078] Step 402: The first network device collects the first data corresponding to the object identified by the OID. The first data has the format defined by MIB.
[0079] As explained in step 401, the object identified by the OID is a data source capable of generating data; therefore, the first data corresponding to the object identified by the OID is the data generated by the object identified by the OID. Step 401 also explains that the object is defined by the MIB, and thus the first data corresponding to the object has a MIB-defined format. Since the first network device collects the first data corresponding to the object identified by the OID, and the OID is provided by SNMP, the first network device reuses SNMP during the first data collection process, thereby avoiding waste of SNMP resources on the first network device side.
[0080] In an exemplary embodiment, the first network device collects data corresponding to the object identified by the OID, including the following three methods B1-B3.
[0081] Method B1: The first network device collects the first data corresponding to the object identified by the OID from the local data of the first network device according to the OID.
[0082] In method B1, the first network device determines the object identified by the OID and collects the first data corresponding to the object identified by the OID locally on the first network device. For example, if the object identified by the OID is the number of network interfaces, then the first network device collects the number of network interfaces of the first network device locally on the first network device.
[0083] In method B2, the first network device sends an OID to the third network device and receives the first data returned by the third network device. The first data is the data corresponding to the object identified by the OID, which is collected locally by the third network device according to the OID.
[0084] In method B2, the first network device sends an OID to the third network device. After receiving the OID, the third network device determines the object identified by the OID, collects the first data corresponding to the object identified by the OID locally on the third network device, and returns the collected first data to the first network device, thereby enabling the first network device to receive the first data returned by the third network device.
[0085] For example, if the object identified by the OID sent by the first network device to the third network device is the type of the network interface, then the third network device collects the type of the network interface locally and returns the type of the network interface to the first network device, and the first network device receives the type of the network interface returned by the third network device.
[0086] In method B3, the first network device sends an OID and alarm conditions to the third network device and receives first data returned by the third network device. The first data is the data corresponding to the object identified by the OID collected locally by the third network device according to the OID, and the first data satisfies the alarm conditions.
[0087] In method B3, the first network device sends an OID and alarm conditions to the third network device. Upon receiving the OID, the third network device identifies the object identified by the OID and collects the first data corresponding to that object locally. In response to the collected first data satisfying the alarm conditions, the third network device returns the first data that satisfies the alarm conditions to the first network device. This ensures that the first network device receives the first data returned by the third network device, and since this first data satisfies the alarm conditions, the third network device sends an alarm to the first network device.
[0088] The alarm condition refers to an event that requires an alarm. If the first network device receives first data from the third network device that meets the alarm condition, it indicates that an event requiring an alarm has occurred on the third network device. For example, the object identified by the OID sent by the first network device to the third network device is memory usage, and the alarm condition is that the memory usage reaches a memory usage threshold. The third network device collects its memory usage locally. In response to the collected memory usage reaching the memory usage threshold, it considers the alarm condition met and therefore returns the memory usage reaching the threshold to the first network device, thereby issuing a memory usage-related alarm to the first network device.
[0089] Step 403: The first network device encapsulates the first data according to the format required for the push process to obtain the second data.
[0090] After the first network device acquires the first data, it encapsulates the acquired first data according to the format required for the push process to obtain the second data. This application embodiment does not limit the format required for the push process; the format required for the push process can be determined according to actual needs.
[0091] In an exemplary embodiment, when the push process is a telemetry-based push process, the format required by the push process is the format defined by the Yang model. In this case, before the first network device encapsulates the first data according to the format required by the push process, the first network device also needs to obtain the Yang model. Exemplarily, the first network device obtains the Yang model in two ways, C1 and C2.
[0092] Method C1: The first network device obtains the specified Yang model.
[0093] In method C1, the first network device stores one or more Yang models, and one of the Yang models is a specified Yang model. Therefore, regardless of what kind of first data the first network device obtains, it will default to obtaining the specified Yang model. For example, the specified Yang model can be updated according to actual needs.
[0094] In method C2, the first network device determines the service attributes of the first data and obtains the Yang model corresponding to the service attributes.
[0095] In method C2, the first network device stores multiple Yang models and also stores the correspondence between Yang models and service attributes. After the first network device obtains the first data, it determines the service attributes of the first data, and queries the correspondence between the Yang models and the service attributes based on the service attributes of the first data, thereby obtaining the Yang model corresponding to the service attributes of the data.
[0096] This application does not limit the service attributes of the first data in its embodiments. For example, the service attributes of the first data indicate its source; different sources result in different service attributes. For instance, if the first data originates from a first network device (corresponding to mode B1), its service attribute is a first service attribute. A Yang model is obtained by querying the correspondence between the Yang model and the service attribute based on the first service attribute. As another example, if the first data originates from a third network device (corresponding to modes B2 and B3), its service attribute is a second service attribute. A different Yang model is obtained by querying the correspondence between the Yang model and the service attribute based on the second service attribute.
[0097] Furthermore, if the format required for the push process is the format defined by the Yang model, the first network device encapsulates the first data according to the format required for the push process to obtain the second data, including the following steps 4031 and 4032.
[0098] Step 4031: The first network device determines the data identifier based on the OID. The data identifier is used to identify the first data.
[0099] In an exemplary embodiment, the first network device determines the data identifier based on the OID, including two methods, D1 and D2.
[0100] In method D1, the first network device queries the MIB to obtain the string corresponding to the OID, and uses the string corresponding to the OID as the data identifier.
[0101] In method D1, the OID consists of multiple numbers. Querying the MIB (Management Information Base) determines the name corresponding to each number. Replacing each number in the OID with its corresponding name yields the string representing the OID. For example, see... Figure 5 In the case of OID 1.3.6.1.2.1, the string corresponding to this OID is iso.org.dod.internet.mgmt.mib.
[0102] In method D2, the first network device determines the OID as the data identifier.
[0103] In mode D2, the first network device can directly determine the OID as the data identifier without querying the MIB.
[0104] Step 4032: The first network device encapsulates the data identifier and the first data according to the format defined by the Yang model to obtain the second data.
[0105] Next, we will first explain the Yang model to help you understand the process of encapsulating data identifiers and primary data according to the format defined by the Yang model.
[0106] Module: A module is the basic unit of the Yang model. A module has a tree structure and can include an unlimited number of container nodes, list nodes, and leaf nodes. Container nodes, list nodes, and leaf nodes are all data nodes of the Yang model.
[0107] Container nodes: Container nodes include child nodes but do not carry values. The child nodes of a container node include, but are not limited to, other container nodes, list nodes, and leaf nodes.
[0108] List node: A list node is a collection of one or more child nodes, including but not limited to container nodes and leaf nodes. Each node in a list node is uniquely identified by a primary key.
[0109] Leaf nodes: Leaf nodes no longer include other child nodes, but instead carry values. The values carried by leaf nodes have a certain type, including but not limited to string, bytes, binary, etc. This application does not limit the type.
[0110] For example, in this embodiment of the application, the data identifier and the first data are encapsulated according to the format defined by the Yang model, including: embedding the data identifier and the first data into the leaf nodes included in the Yang model. Then, the second data includes fields corresponding to the leaf nodes, and the fields carry the data identifier and the first data. For example, the second data includes the following two cases E1 and E2.
[0111] In case E1, the second data includes a corresponding first field and a second field. The first field carries a data identifier, and the second field carries the first data.
[0112] In case E1, the Yang model used is defined as follows.
[0113]
[0114] Based on the Yang model described above, the data identifier can be embedded in the mib-oid leaf nodes of rows (5)-(8), which correspond to the first field in the second data that carries the data identifier. In the mib-oid leaf node, snmp oid is the data identifier, which is an OID or the string corresponding to the OID. In addition, the first data is also embedded in the mib-value leaf nodes of rows (9)-(12), which correspond to the second field in the second data that carries the first data. Since the mib-value leaf node and the mib-oid leaf node mentioned above are leaf nodes at the same level in the mib list nodes of rows (3)-(13), the mib-value leaf node corresponds to the mib-oid leaf node, and the first field in the second data corresponds to the second field. Therefore, the first data carried by the second field is the first data corresponding to the object identified by the data identifier carried by the first field.
[0115] For example, the second data includes a first field carrying an OID of 1.3.6.1.4.1.2011.5.25.145.1.2, and a second field corresponding to the first field carrying data corresponding to the object identified by 1.3.6.1.4.1.2011.5.25.145.1.2.
[0116] It should be noted that in some implementations, the first data may include multiple sub-data, and the data identifier corresponds to multiple sub-data identifiers, with each sub-data corresponding to one of the multiple sub-data identifiers. Applying this implementation to case E1, the first field of the second data carries the data identifier, the second field of the second data carries each sub-data, and the second data does not carry the sub-data identifiers corresponding to each sub-data. That is, in case E1, even if the first data includes multiple sub-data, the sub-data will not be carried in different fields, but rather all sub-data will be carried in the same field.
[0117] For example, the first field of the second data carries an OID of 1.3.6.1.4.1.2011.5.25.145.1.2. The object identified by 1.3.6.1.4.1.2011.5.25.145.1.2 corresponds to the first data including sub-data X and sub-data Y. The sub-data identifier corresponding to sub-data X is 1.3.6.1.4.1.2011.5.25.145.1.2.1, and the sub-data identifier corresponding to sub-data Y is 1.3.6.1.4.1.2011.5.25.145.1.2.2. 1.3.6.1.4.1.2011.5.25.145.1.2.1 and 1.3.6.1.4.1.2011.5.25.145.1.2.2 are also the sub-data identifiers corresponding to the data identifiers. The second data includes a second field that carries sub-data X and sub-data Y, but does not carry 1.3.6.1.4.1.2011.5.25.145.1.2.1 and 1.3.6.1.4.1.2011.5.25.145.1.2.2.
[0118] In case E2, the first data includes multiple sub-data, and the data identifier corresponds to multiple sub-data identifiers. The multiple sub-data and the multiple sub-data identifiers are in one-to-one correspondence. The second data includes a corresponding first field and a second field. The first field carries the data identifier, and the second field includes multiple sub-fields. For any sub-data, any two corresponding sub-fields among the multiple sub-fields carry any sub-data and the sub-data identifier corresponding to any sub-data.
[0119] In case E2, the Yang model used is defined as follows.
[0120]
[0121] Based on the Yang model described above, the data identifier can be embedded in the mib-oid leaf nodes of rows (5)-(8). These mib-oid leaf nodes correspond to the first field in the second data that carries the data identifier. In the mib-oid leaf node, snmp oid is the data identifier, which is either an OID or the string corresponding to the OID. In addition, the mib-values container nodes of rows (9)-(21) correspond to the second field in the second data. Since the mib-oid leaf nodes and the mib-values container nodes are at the same level as the mib list nodes in rows (3)-(22), the mib-oid leaf nodes and the mib-values container nodes correspond to each other. Therefore, in the second data, the first field corresponds to the second field.
[0122] In the mib-values container node, the sub-data identifier is embedded in the node-name leaf node in rows (12)-(15). This node-name leaf node corresponds to the sub-field in the second data that carries the sub-data identifier. In the node-name leaf node, snmp mib node name is the sub-data identifier, and snmp mib node name is an OID or the string corresponding to the OID. In addition, the sub-data is embedded in the node-value leaf node in rows (16)-(19). This node-value leaf node corresponds to the sub-field in the second data that carries the sub-data. Since the node-name leaf node and the node-value leaf node are at the same level as the mib-value list nodes in rows (10)-(20), the node-name leaf node and the node-value leaf node correspond to each other. Therefore, in the second field included in the second data, there are two corresponding sub-fields. The corresponding sub-fields are used to carry the sub-data identifier and the sub-data, respectively. Therefore, in the two corresponding sub-fields, the sub-data carried by one sub-field is the sub-data corresponding to the object identified by the sub-data identifier carried by the other sub-field.
[0123] It should be noted that the one node-name leaf node and one node-value leaf node included in the Yang model above are merely examples and are not intended to limit the number of node-name leaf nodes and node-value leaf nodes in the Yang model. In the Yang model of this application embodiment, the number of node-name leaf nodes and the number of node-value leaf nodes are the same as the number of sub-data. Taking the first data as including two sub-data as an example, the Yang model includes two node-name leaf nodes and two node-value leaf nodes. The first node-name leaf node is used to carry the sub-data identifier corresponding to the first sub-data, and the first node-value leaf node is used to carry the first sub-data. The second node-name leaf node is used to carry the sub-data identifier corresponding to the second sub-data, and the second node-value leaf node is used to carry the second sub-data.
[0124] For example, the first field of the second data carries the OID 1.3.6.1.4.1.2011.5.25.145.1.2. The object identified by 1.3.6.1.4.1.2011.5.25.145.1.2 corresponds to data including sub-data X and sub-data Y. The sub-data identifier corresponding to sub-data X is 1.3.6.1.4.1.2011.5.25.145.1.2.1, and the sub-data identifier corresponding to sub-data Y is 1.3.6.1.4.1.2011.5.25.145.1.2.2. 1.3.6.1.4.1.2011.5.25.145.1.2.1 and 1.3.6.1.4.1.2011.5.25.145.1.2.2 are also the sub-data identifiers corresponding to the data identifiers. Therefore, the second data includes a second field with a total of four subfields. Two corresponding subfields carry subdata identifiers 1.3.6.1.4.1.2011.5.25.145.1.2.1 and subdata X, respectively. The other two corresponding subfields carry subdata identifiers 1.3.6.1.4.1.2011.5.25.145.1.2.2 and subdata Y, respectively.
[0125] It is understood that cases E1 and E2 above are merely examples and should not be construed as limiting the Yang model. Other Yang models can also be used in the embodiments of this application based on actual needs or experience.
[0126] Step 404: The first network device pushes the second data to the second network device.
[0127] Since the first network device has encapsulated the data according to the format required for the push process to obtain the second data, the first network device can push the second data to the second network device. In an exemplary embodiment, when the push process is a telemetry-based push process, the first network device pushes the second data to the second network device via the gRPC protocol.
[0128] It should be noted that in methods B2 and B3 above, the first network device receives the first data returned by the third network device. This first data is data collected locally by the third network device, which is then encapsulated into second data according to the format required for the push process. Therefore, even if the third network device itself does not support the push process, the first data collected from the third network device can still be pushed to the second network device through the first network device, with the first network device acting as a proxy in this process.
[0129] In an exemplary embodiment, in addition to pushing the second data to the second network device, the first network device also pushes the data collection count of the sampling interface to the second network device. The sampling interface is used by the first network device to collect the first data. Each time the first data is collected through the sampling interface according to the OID, the data collection count of the sampling interface is incremented by one.
[0130] Steps 401-404 above are performed by the first network device. Since the first network device pushes the second data to the second network device in step 404, the second network device also needs to receive the second data, as shown in step 405 below, which is performed by the second network device.
[0131] Step 405: The second network device receives the second data pushed by the first network device.
[0132] The second data received by the second network device is obtained by the first network device encapsulating the first data according to the format required for the push process. The first data is the data corresponding to the object identified by the OID collected by the first network device. The first data has a format defined by MIB, and the OID is provided by SNMP. For details related to OID, first data, and second data, please refer to the explanations in steps 401-404 above, which will not be repeated here. For example, if the first network device also pushes the data collection count of the sampling interface to the second network device, the second network device will also receive the data collection count of the sampling interface.
[0133] After receiving the second data, the second network device parses it to obtain the first data, which is the first data corresponding to the object identified by the OID. Then, the second network device decodes the first data, allowing for analysis to optimize either the first or third network device. For example, if the second network device receives data collection counts from the sampling interface, these counts are also used during optimization. Since the first data has a format defined by the MIB, and the MIB is provided by SNMP, the second network device needs to reuse its own SNMP during decoding, thus avoiding wasting its SNMP resources.
[0134] In summary, since the first network device in this embodiment collects the first data according to the OID provided by SNMP, the first network device can reuse SNMP, avoiding the waste of SNMP resources. Furthermore, for the collected first data, the first network device encapsulates the first data according to the format required for the push process to obtain the second data, making it possible to push the second data to the second network device. The method by which the first network device pushes the second data to the second network device has the advantages of requiring less processing resources and having shorter latency.
[0135] The above describes a method for transmitting data provided in the embodiments of this application. Corresponding to the above method, the embodiments of this application also provide an apparatus for transmitting data. This apparatus is applied to a first network device. The apparatus is used to transmit data via... Figure 6 Each module shown performs the above... Figure 4 The method of transmitting data performed by the first network device. For example... Figure 6 As shown in the embodiments of this application, the data transmission device includes the following modules.
[0136] The acquisition module 601 is used to acquire the OID provided by SNMP. The OID is used to identify the object.
[0137] The acquisition module 602 is used to acquire the first data corresponding to the object identified by the OID. The first data has a format defined by MIB.
[0138] The encapsulation module 603 is used to encapsulate the first data according to the format required by the push process to obtain the second data;
[0139] The push module 604 is used to push second data to the second network device.
[0140] In an exemplary embodiment, the format required for the push process is the format defined by the Yang model. The encapsulation module 603 is used to determine the data identifier based on the OID. The data identifier is used to identify the first data. The data identifier and the first data are encapsulated according to the format defined by the Yang model to obtain the second data.
[0141] In an exemplary embodiment, the second data includes a corresponding first field and a second field, wherein the first field carries a data identifier and the second field carries the first data.
[0142] In an exemplary embodiment, the first data includes multiple sub-data, and the data identifier corresponds to multiple sub-data identifiers. The multiple sub-data and the multiple sub-data identifiers are in one-to-one correspondence. The second data includes a corresponding first field and a second field. The first field carries the data identifier, and the second field includes multiple sub-fields. For any sub-data, any two corresponding sub-fields among the multiple sub-fields carry any sub-data and the sub-data identifier corresponding to any sub-data.
[0143] In an exemplary embodiment, the encapsulation module 603 is used to determine the OID as a data identifier; or, query the MIB based on the OID to obtain the string corresponding to the OID, and determine the string corresponding to the OID as a data identifier.
[0144] In an exemplary embodiment, the encapsulation module 603 is further configured to determine the business attributes of the first data and obtain the Yang model corresponding to the business attributes.
[0145] In an exemplary embodiment, the acquisition module 602 is configured to: ...
[0146] In an exemplary embodiment, the acquisition module 601 is used to acquire the OID provided by SNMP through a static configuration process or a dynamic configuration process; or, to acquire the sampling path through a static configuration process or a dynamic configuration process, and to acquire the OID provided by SNMP through the sampling path.
[0147] Figure 6 For a detailed explanation of the interaction between the data transmission device shown as the first network device and the second network device, please refer to the previous section. Figure 1-4The descriptions of the relevant embodiments will not be repeated here.
[0148] Corresponding to the above method, this application also provides another device for transmitting data. This device is applied to a second network device. This device is used to transmit data via... Figure 7 Each module shown performs the above... Figure 4 The method of transmitting data performed by the second network device. For example... Figure 7 As shown in the embodiments of this application, the data transmission device includes the following modules.
[0149] The receiving module 701 is used to receive the second data pushed by the first network device. The second data is obtained by the first network device encapsulating the first data according to the format required by the pushing process. The first data is the data corresponding to the object identified by the OID collected by the first network device. The first data has the format defined by MIB. The OID is provided by SNMP.
[0150] In an exemplary embodiment, the format required for the push process is the format defined by the Yang model. The second data is obtained by the first network device by encapsulating the data identifier and the first data according to the format defined by the Yang model. The data identifier is determined based on OID and is used to identify the first data.
[0151] In an exemplary embodiment, the second data includes a corresponding first field and a second field, wherein the first field carries a data identifier and the second field carries the first data.
[0152] In an exemplary embodiment, the first data includes multiple sub-data, and the data identifier corresponds to multiple sub-data identifiers. The multiple sub-data and the multiple sub-data identifiers are in one-to-one correspondence. The second data includes a corresponding first field and a second field. The first field carries the data identifier, and the second field includes multiple sub-fields. For any sub-data, any two corresponding sub-fields among the multiple sub-fields carry any sub-data and the sub-data identifier corresponding to any sub-data.
[0153] In an exemplary embodiment, the data identifier is an OID, or the data identifier is a string corresponding to the OID.
[0154] Figure 7 For details regarding the interaction between the data transmission device shown as the second network device and the first network device, please refer to the previous section. Figure 1-4 The descriptions of the relevant embodiments will not be repeated here.
[0155] In summary, since the first network device in this embodiment collects the first data according to the OID provided by SNMP, the first network device can reuse SNMP, avoiding the waste of SNMP resources. Furthermore, for the collected first data, the first network device encapsulates the first data according to the format required for the push process to obtain the second data, making it possible to push the second data to the second network device. The method by which the first network device pushes the second data to the second network device has the advantages of requiring less processing resources and having shorter latency.
[0156] It should be understood that the above Figure 6 and Figure 7 The provided device, in implementing its functions, is only illustrated by the division of the above-described functional modules. In practical applications, the functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the device and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation processes are detailed in the method embodiments, and will not be repeated here.
[0157] See Figure 8 , Figure 8 A schematic diagram of the structure of an exemplary data transmission device 800 of this application is shown. The data transmission device 800 includes at least one processor 801, a memory 802, and at least one network interface 803.
[0158] The processor 801 is, for example, a general-purpose CPU, a digital signal processor (DSP), a network processor (NP), a GPU, a neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor, or one or more integrated circuits or application-specific integrated circuits (ASICs) used to implement the scheme of this application, a programmable logic device (PLD), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. It can implement or execute the various logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0159] Memory 802 may be, for example, read-only memory (ROM) or other types of storage devices capable of storing static information and instructions; random access memory (RAM) or other types of dynamic storage devices capable of storing information and instructions; electrically erasable programmable read-only memory (EEPROM); compact disc read-only memory (CD-ROM) or other optical disc storage; optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile optical discs, Blu-ray discs, etc.); magnetic disk storage media or other magnetic storage devices; or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. Memory 802 may exist independently and be connected to processor 801 via bus 804. Memory 802 may also be integrated with processor 801.
[0160] Network interface 803 uses any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), or wireless local area network (WLAN). Network interface 803 can include wired network interfaces and wireless network interfaces. Specifically, network interface 803 can be an Ethernet interface, such as Fast Ethernet (FE), Gigabit Ethernet (GE), Asynchronous Transfer Mode (ATM), WLAN, cellular network, or combinations thereof. The Ethernet interface can be an optical interface, an electrical interface, or a combination thereof. In some embodiments of this application, network interface 803 can be used by data transmission device 800 to communicate with other devices.
[0161] Optionally, the data transmission device 800 also includes a bus 804. The bus 804 is used to transfer information between the components of the data transmission device 800. The bus 804 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus 804 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The symbol is represented by only one line, but this does not mean that there is only one bus or one type of bus.
[0162] In specific implementations, as some embodiments, processor 801 may include one or more CPUs, such as Figure 8 The CPU0 and CPU1 shown are examples of processors. Each of these processors can be a single-core processor or a multi-core processor. A processor here can refer to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).
[0163] In specific implementations, as some embodiments, the data transmission device 800 may include multiple processors, such as... Figure 8 The processors 801 and 805 are shown in the diagram. Each of these processors may be a single-core processor or a multi-core processor. Here, "processor" may refer to one or more devices, circuits, and / or processing cores used to process data (such as computer program instructions).
[0164] In some embodiments, memory 802 is used to store program instructions 806 for executing the present application's solution, and processor 801 can execute the program instructions 806 stored in memory 802. That is, the data transmission device 800 can implement the data transmission method provided in the method embodiment through processor 801 and the program instructions 806 in memory 802. The program instructions 806 may include one or more software modules. Optionally, processor 801 itself may also store program instructions for executing the present application's solution.
[0165] In specific implementation, the data transmission device 800 of this application can correspond to a first network device or a second network device for executing the above method. The processor 801 in the data transmission device 800 reads instructions from the memory 802, causing... Figure 8 The data transmission device 800 shown is capable of performing all or part of the steps in the method embodiments.
[0166] The data transmission device 800 can also correspond to the above. Figure 6 Or the device shown in Figure 7, Figure 6 Each functional module in the device shown in diagram 7 is implemented using software from the data transmission device 800. In other words, Figure 6 The device shown in 7 may include a functional module that is generated by the processor 801 of the data transmission device 800 after reading the program instructions 806 stored in the memory 802.
[0167] in, Figure 4 Each step of the data transmission method shown is implemented through integrated logic circuits in the hardware or software instructions in the processor of the data transmission device 800. The steps of the method embodiments disclosed in this application can be directly implemented by the hardware processor, or implemented by a combination of hardware and software modules in the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other storage media mature in the art. Since the storage medium is located in memory, the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method embodiments; to avoid repetition, they will not be described in detail here.
[0168] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. General-purpose processors can be microprocessors or any conventional processor. It is worth noting that the processor can be a processor supporting the Advanced Reduced Instruction Set Computing (RISC) machine (ARM) architecture.
[0169] Furthermore, in an alternative embodiment, the memory described above may include read-only memory and random access memory, and provide instructions and data to the processor. The memory may also include non-volatile random access memory. For example, the memory may also store device type information.
[0170] The memory can be volatile or non-volatile, or may include both. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which serves as an external cache. Many forms of RAM are available by way of example, but not limitation. Examples include static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0171] In an exemplary embodiment, this application provides a data transmission system, which includes a first network device and a second network device connected in communication. The first data transmission device is used to perform... Figure 4 The method executed by the first network device, and the method executed by the second network device. Figure 4 The method of transmitting data performed by the second network device.
[0172] In an exemplary embodiment, this application provides a computer-readable storage medium storing at least one instruction, which is loaded and executed by a processor to cause a computer to perform the above-described actions. Figure 4 The method of transmitting data performed by the first network device or the second network device.
[0173] In an exemplary embodiment, this application provides a computer program product, which includes a computer program or instructions. The computer program or instructions are executed by a processor to cause a computer to perform the above-described functions. Figure 4 The method of transmitting data performed by the first network device or the second network device.
[0174] In an exemplary embodiment, this application provides a chip, including a processor, for calling and executing instructions stored in a memory, causing a device equipped with the chip to perform the above-described... Figure 4 The method of transmitting data performed by the first network device or the second network device.
[0175] In an exemplary embodiment, this application provides another chip, including: an input interface, an output interface, a processor, and a memory. The input interface, output interface, processor, and memory are connected via internal interconnection paths. The processor is used to execute code in the memory. When the code is executed, the processor is used to perform the above-described... Figure 4 The method of transmitting data performed by the first network device or the second network device.
[0176] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive).
[0177] In this application, the terms "first," "second," etc., are used to distinguish identical or similar items with substantially the same function. It should be understood that there is no logical or temporal dependency between "first," "second," and "nth," nor does it limit the quantity or order of execution. It should also be understood that although the following description uses the terms "first," "second," etc., to describe various elements, these elements should not be limited by the terms. These terms are merely used to distinguish one element from another.
[0178] It should also be understood that, in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0179] In this application, the term "at least one" means one or more, and the term "multiple" means two or more. For example, multiple second devices means two or more second devices. The terms "system" and "network" are often used interchangeably herein.
[0180] It should be understood that the terminology used in the description of the various examples herein is for the purpose of describing particular examples only and is not intended to be limiting. As used in the description of the various examples and the appended claims, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0181] It should also be understood that the terms “if” and “if” can be interpreted as meaning “when” or “upon”, or “in response to determination” or “in response to detection”. Similarly, depending on the context, the phrases “if determination…” or “if detection [the stated condition or event]” can be interpreted as meaning “when determination…”, or “in response to determination…”, or “when detection [the stated condition or event]” or “in response to detection [the stated condition or event]”.
[0182] The above description is merely an embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for transmitting data, characterized in that, The method includes: The first network device obtains the Object Identifier (OID) provided by the Simple Network Management Protocol (SNMP), which is used to identify the object; The first network device collects the first data corresponding to the object locally from the first network device according to the OID, or the first network device sends the OID to the third network device and receives the first data returned by the third network device. The first data returned by the third network device is the data corresponding to the object collected locally by the third network device according to the OID. The first data has a format defined by the Management Information Base (MIB). The first network device determines the service attributes of the first data, and the service attributes indicate the source of the first data, which may be local to the first network device or local to the third network device. The first network device obtains another next-generation Yang model corresponding to the service attribute; The first network device encapsulates the first data according to the format defined by the Yang model to obtain the second data, and pushes the second data to the second network device.
2. The method according to claim 1, characterized in that, The first network device encapsulates the first data according to the format defined by the Yang model to obtain the second data, including: The first network device determines a data identifier based on the OID, and the data identifier is used to identify the first data; The first network device encapsulates the data identifier and the first data according to the format defined by the Yang model to obtain the second data.
3. The method according to claim 2, characterized in that, The second data includes a corresponding first field and a second field, wherein the first field carries the data identifier and the second field carries the first data.
4. The method according to claim 2, characterized in that, The first data includes multiple sub-data, and the data identifier corresponds to multiple sub-data identifiers. The multiple sub-data and the multiple sub-data identifiers correspond one-to-one. The second data includes a corresponding first field and a second field. The first field carries the data identifier, and the second field includes multiple subfields. For any subdata, any two corresponding subfields among the multiple subfields carry the subdata and the subdata identifier corresponding to the subdata.
5. The method according to any one of claims 2-4, characterized in that, The first network device determines the data identifier based on the OID, including: The first network device determines the OID as the data identifier; Alternatively, the first network device queries the MIB based on the OID to obtain the string corresponding to the OID, and determines the string corresponding to the OID as the data identifier.
6. The method according to any one of claims 1-4, characterized in that, When the first network device sends the OID to the third network device, the method further includes: The first network device sends an alarm condition to the third network device, and the first data returned by the third network device satisfies the alarm condition.
7. The method according to any one of claims 1-4, characterized in that, The first network device obtains the Object Identifier (OID) provided by the Simple Network Management Protocol (SNMP), including: The first network device obtains the OID provided by SNMP through a static configuration process or a dynamic configuration process; Alternatively, the first network device may obtain the sampling path through a static configuration process or a dynamic configuration process, and then obtain the OID provided by SNMP through the sampling path.
8. A method for transmitting data, characterized in that, The method includes: The second network device receives the second data pushed by the first network device. The second data is obtained by the first network device encapsulating the first data according to the format defined by another next-generation Yang model corresponding to the service attribute. The service attribute indicates the source of the first data. The source of the first data includes the local of the first network device or the local of the third network device. The first data has the format defined by the Management Information Base (MIB). Wherein, if the source of the first data includes the local area of the first network device, the first data is the data corresponding to the object collected by the first network device from the local area of the first network device according to the object identifier OID; or, if the source of the first data includes the local area of the third network device, the first data is the data corresponding to the object collected by the third network device from the local area of the third network device according to the OID. The OID is an identifier provided by the Simple Network Management Protocol (SNMP) obtained by the first network device, and the OID is used to identify the object.
9. The method according to claim 8, characterized in that, The second data is obtained by the first network device by encapsulating the data identifier and the first data in the format defined by the Yang model. The data identifier is determined based on the OID and is used to identify the first data.
10. The method according to claim 9, characterized in that, The second data includes a corresponding first field and a second field, wherein the first field carries the data identifier and the second field carries the first data.
11. The method according to claim 9, characterized in that, The first data includes multiple sub-data, and the data identifier corresponds to multiple sub-data identifiers. The multiple sub-data and the multiple sub-data identifiers correspond one-to-one. The second data includes a corresponding first field and a second field. The first field carries the data identifier, and the second field includes multiple subfields. For any subdata, any two corresponding subfields among the multiple subfields carry the subdata and the subdata identifier corresponding to the subdata.
12. The method according to any one of claims 9-11, characterized in that, The data identifier is the OID, or the data identifier is the string corresponding to the OID.
13. A device for transmitting data, characterized in that, The device includes: The acquisition module is used to acquire the Object Identifier (OID) provided by the Simple Network Management Protocol (SNMP), which is used to identify objects; The acquisition module is used to acquire first data corresponding to the object from the first network device according to the OID, or to send the OID to the third network device and receive the first data returned by the third network device. The first data returned by the third network device is the data corresponding to the object acquired by the third network device from the third network device according to the OID. The first data has a format defined by the Management Information Base (MIB). An encapsulation module is used to determine the service attributes of the first data, wherein the service attributes indicate the source of the first data, and the source of the first data includes the local location of the first network device or the local location of the third network device; obtain another next-generation Yang model corresponding to the service attributes, and encapsulate the first data according to the format defined by the Yang model to obtain the second data; The push module is used to push the second data to the second network device.
14. The apparatus according to claim 13, characterized in that, The encapsulation module is used to determine a data identifier based on the OID, the data identifier being used to identify the first data; and to encapsulate the data identifier and the first data according to the format defined by the Yang model to obtain the second data.
15. The apparatus according to claim 14, characterized in that, The second data includes a corresponding first field and a second field, wherein the first field carries the data identifier and the second field carries the first data.
16. The apparatus according to claim 14, characterized in that, The first data includes multiple sub-data, and the data identifier corresponds to multiple sub-data identifiers. The multiple sub-data and the multiple sub-data identifiers are in one-to-one correspondence. The second data includes a corresponding first field and a second field. The first field carries the data identifier, and the second field includes multiple sub-fields. For any sub-data, any two corresponding sub-fields among the multiple sub-fields carry the any sub-data and the sub-data identifier corresponding to the any sub-data.
17. The apparatus according to any one of claims 14-16, characterized in that, The encapsulation module is used to determine the OID as the data identifier; or, query the MIB based on the OID to obtain the string corresponding to the OID, and determine the string corresponding to the OID as the data identifier.
18. The apparatus according to any one of claims 13-16, characterized in that, The acquisition module is also used to send alarm conditions to the third network device, and the first data returned by the third network device satisfies the alarm conditions.
19. The apparatus according to any one of claims 13-16, characterized in that, The acquisition module is used to acquire the OID provided by SNMP through a static configuration process or a dynamic configuration process; or, to acquire the sampling path through a static configuration process or a dynamic configuration process, and then acquire the OID provided by SNMP through the sampling path.
20. A device for transmitting data, characterized in that, The device includes: The receiving module is used to receive second data pushed by the first network device. The second data is obtained by the first network device encapsulating the first data according to the format defined by another next-generation Yang model corresponding to the service attribute. The service attribute indicates the source of the first data. The source of the first data includes the local of the first network device or the local of the third network device. The first data has a format defined by the Management Information Base (MIB). Wherein, if the source of the first data includes the local area of the first network device, the first data is the data corresponding to the object collected by the first network device from the local area of the first network device according to the object identifier OID; or, if the source of the first data includes the local area of the third network device, the first data is the data corresponding to the object collected by the third network device from the local area of the third network device according to the OID. The OID is an identifier provided by the Simple Network Management Protocol (SNMP) obtained by the first network device, and the OID is used to identify the object.
21. The apparatus according to claim 20, characterized in that, The second data is obtained by the first network device by encapsulating the data identifier and the first data in the format defined by the Yang model. The data identifier is determined based on the OID and is used to identify the first data.
22. The apparatus according to claim 21, characterized in that, The second data includes a corresponding first field and a second field, wherein the first field carries the data identifier and the second field carries the first data.
23. The apparatus according to claim 21, characterized in that, The first data includes multiple sub-data, and the data identifier corresponds to multiple sub-data identifiers. The multiple sub-data and the multiple sub-data identifiers are in one-to-one correspondence. The second data includes a corresponding first field and a second field. The first field carries the data identifier, and the second field includes multiple sub-fields. For any sub-data, any two corresponding sub-fields among the multiple sub-fields carry the any sub-data and the sub-data identifier corresponding to the any sub-data.
24. The apparatus according to any one of claims 21-23, characterized in that, The data identifier is the OID, or the data identifier is the string corresponding to the OID.
25. A device for transmitting data, characterized in that, The device includes a memory and a processor; the memory stores at least one instruction, which is loaded and executed by the processor to enable the data transmission device to implement the data transmission method according to any one of claims 1-12.
26. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one instruction, which is loaded and executed by a processor to enable the computer to implement the method of transmitting data as described in any one of claims 1-12.
27. A computer program product, characterized in that, The computer program product includes a computer program or instructions that are executed by a processor to enable a computer to implement the method of transmitting data as described in any one of claims 1-12.
Citation Information
Patent Citations
Network element alarm processing method and device
CN112491593A