A coordination method and component of SNMP protocol and RESTful protocol
Patent Information
- Application Number
- CN202310156231.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-20
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2043-02-20
AI Technical Summary
SNMP的按重要性高低,一般分为多个级别,且SNMP就如其他网络协议一样,存在消息风暴的可能,一旦多个SNMP设备产生并发风暴,作为更上一级级别汇聚的RESTful接口层,可能产生指数级的消息风暴,冲击IIot系统的稳定性
[0030] It can be seen from this that the present application discloses a SNMP protocol and RESTful protocol coordination method, which is applied to a preset protocol coordination gateway, including: setting an online switch on the SMNP interface to shield the concurrent message storm of multiple SNMP devices using the online switch; communicating with the SNMP device through the SNMP proxy module, and determining the corresponding target field operation of the RESTful protocol based on the preset field mapping relationship and the SNMP proxy module for the first field operation of the SNMP device; determining the corresponding target alarm operation of the RESTful protocol based on the preset alarm level mapping rules and the SNMP proxy module for the first alarm operation of the SNMP device. It can be seen that by setting online switches on the SNMP interface, the SNMP storm can be blocked online, and then through the field mapping, alarm level mapping and other mapping relationships between the SNMP protocol and the Restful protocol, the communication between SNMP and SNMP devices is converted into communication between Restful and SNMP devices, that is, the request for the interchange of SNMP and Restful interfaces is realized.
Smart Images

Figure CN116155676B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of communication protocols, and in particular to a coordination method and component of SNMP protocol and RESTful protocol. Background Art
[0002] SNMP (Simple Network Management Protocol) is a standard protocol designed specifically for managing network nodes (servers, workstations, routers, switches, HUBS, etc.) on IP networks. The TCP / IP-based SNMP network management framework is the current standard in the industry. RESTful (Representational State Transfer) is an emerging IT interface specification, while SNMP is a traditional network management communication interface specification. In today's emerging IIoT, there is a need for the integration of RESTful and SNMP. SNMP is generally divided into multiple levels according to its importance, and SNMP, like other network protocols, has the possibility of message storms. Once multiple SNMP devices generate concurrent storms, the RESTful interface layer, which is a higher-level convergence, may generate exponential message storms, impacting the stability of the IIoT system. That is, there is a need for the interface conversion between SNMP and RESTful, and at the same time, there is a need for shielding the underlying SNMP message storm. Traditionally, these two requirements often belong to different software or hardware products.
[0003] In summary, how to achieve online defense against message storms to ensure the stability of the IIoT system, and at the same time realize the conversion between SNMP and RESTful interfaces to avoid the use of different hardware or software is a technical problem to be solved in this field. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a coordination method and component of SNMP protocol and RESTful protocol, which can realize online defense against message storm to ensure the stability of IIoT system, and realize the conversion between SNMP and RESTful interfaces at the same time, avoiding the use of different hardware or software. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a method for coordinating the SNMP protocol and the RESTful protocol, which is applied to a preset protocol coordination gateway, including:
[0006] An online switch is set at the SMNP interface so as to shield concurrent message storms of multiple SNMP devices by using the online switch;
[0007] Communicate with the SNMP device through an SNMP agent module, and determine a corresponding target field operation of the RESTful protocol based on a preset field mapping relationship and a first field operation of the SNMP agent module on the SNMP device;
[0008] Based on a preset alarm level mapping rule and a first alarm operation of the SNMP agent module on the SNMP device, a corresponding target alarm operation of the RESTful protocol is determined.
[0009] Optionally, before communicating with the SNMP device through the SNMP agent module, the method further includes:
[0010] Performing relationship mapping between the first field operation of the SNMP protocol and the second field operation of the RESTful protocol to obtain a preset field mapping relationship between the SNMP protocol and the RESTful protocol;
[0011] A relationship mapping is performed between the first alarm operation of the SNMP protocol and the second alarm field operation of the RESTful protocol to obtain a preset alarm level mapping rule between the SNMP protocol and the RESTful protocol.
[0012] Optionally, the performing relationship mapping on the first field operation of the SNMP protocol and the second field operation of the RESTful protocol to obtain a preset field mapping relationship between the SNMP protocol and the RESTful protocol includes:
[0013] Perform relationship mapping between the Get operation and the GetNext operation of the SNMP protocol and the Get operation of the RESTful protocol; perform relationship mapping between the Trap operation of the SNMP protocol and the Put operation and the Post operation of the RESTful protocol; perform relationship mapping between the Set operation of the SNMP protocol and the Post operation and the Delete operation of the RESTful protocol to obtain the preset field mapping relationship between the SNMP protocol and the RESTful protocol.
[0014] Optionally, the process of setting an online switch in the SMNP interface further includes:
[0015] A flow threshold and a synchronization threshold are configured in the SMNP interface so that when the amount of communication data of the SNMP device obtained is greater than the synchronization threshold, the communication data exceeding the synchronization threshold is discarded.
[0016] Optionally, the determining the corresponding target alarm operation of the RESTful protocol based on the preset alarm level mapping rule and the first alarm operation of the SNMP agent module on the SNMP device includes:
[0017] When the alarm flow of the SNMP device sent by the SNMP agent module is greater than the flow threshold, REST alarm information is generated for the alarm flow based on a preset alarm level mapping rule.
[0018] Optionally, after generating REST alarm information for the alarm traffic based on a preset alarm level mapping rule, the method further includes:
[0019] The target alarm flow with the highest alarm level is screened out from the alarm flow corresponding to the REST alarm information, and the target alarm flow is stored in the RESTful push thread pool, so that the RESTful push thread pool submits the target alarm flow to the RESTful server in a preset order.
[0020] Optionally, the SNMP protocol and RESTful protocol coordination method further includes:
[0021] A RESTful push thread pool for decoupling the RESTful protocol push and the SNMP protocol reception is set in the preset protocol coordination gateway.
[0022] In a second aspect, the present application discloses a SNMP protocol and RESTful protocol coordination device, which is applied to a preset protocol coordination gateway, including:
[0023] A storm shielding module, used to set an online switch on the SMNP interface so as to shield concurrent message storms of multiple SNMP devices by using the online switch;
[0024] A field operation determination module, configured to communicate with the SNMP device through an SNMP agent module, and determine a corresponding target field operation of the RESTful protocol based on a preset field mapping relationship and a first field operation of the SNMP agent module on the SNMP device;
[0025] The alarm operation determination module is used to determine the corresponding target alarm operation of the RESTful protocol based on a preset alarm level mapping rule and the first alarm operation of the SNMP agent module on the SNMP device.
[0026] In a third aspect, the present application discloses an electronic device, comprising:
[0027] Memory, used to store computer programs;
[0028] The processor is used to execute the computer program to implement the steps of the aforementioned disclosed method for coordinating the SNMP protocol and the RESTful protocol.
[0029] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed SNMP protocol and RESTful protocol coordination method are implemented.
[0030] It can be seen that the present application discloses a method for coordinating the SNMP protocol and the RESTful protocol, which is applied to a preset protocol coordination gateway, including: setting an online switch at the SMNP interface so as to use the online switch to shield concurrent message storms of multiple SNMP devices; communicating with the SNMP device through the SNMP agent module, and determining the corresponding target field operation of the RESTful protocol based on the preset field mapping relationship and the first field operation of the SNMP agent module on the SNMP device; determining the corresponding target alarm operation of the RESTful protocol based on the preset alarm level mapping rule and the first alarm operation of the SNMP agent module on the SNMP device. It can be seen that by setting an online switch at the SNMP interface, the SNMP storm can be shielded online, and then through the mapping relationship between the SNMP protocol and the Restful protocol, such as field mapping, alarm level mapping, etc., the communication between SNMP and SNMP devices is converted into the communication between Restful and SNMP devices, that is, the request for the interface conversion between SNMP and Restful is realized. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0032] Figure 1 A flow chart of a method for coordinating the SNMP protocol and the RESTful protocol disclosed in this application;
[0033] Figure 2 A flow chart of a SNMP data acquisition method disclosed in this application;
[0034] Figure 3 This is a SNMP message structure diagram disclosed in this application;
[0035] Figure 4 A flow chart of a gateway and coordination method for coordinating SNMP and RESTful disclosed in this application;
[0036] Figure 5 A flow chart of a specific SNMP protocol and RESTful protocol coordination method disclosed in this application;
[0037] Figure 6 A schematic diagram of the structure of a SNMP protocol and RESTful protocol coordination device disclosed in this application;
[0038] Figure 7 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0040] SNMP is a standard protocol designed specifically for managing network nodes (servers, workstations, routers, switches, HUBS, etc.) on IP networks. The TCP / IP-based SNMP network management framework is the current standard in the industry.
[0041] RESTful is an emerging IT interface specification, while SNMP is a traditional network management communication interface specification. In today's emerging IIoT era, there is a need to integrate RESTful and SNMP. SNMP is generally divided into multiple levels according to their importance, and SNMP, like other network protocols, is subject to the possibility of message storms. Once multiple SNMP devices generate concurrent storms, the RESTful interface layer, which is a higher-level convergence layer, may generate exponential message storms, impacting the stability of the IIoT system. In other words, there is a need for interconversion between SNMP and RESTful interfaces, and at the same time, there is a need for shielding the underlying SNMP message storm. Traditionally, these two requirements often belong to different software or hardware products.
[0042] To this end, the present application provides a coordination solution for the SNMP protocol and the RESTful protocol, which can achieve online defense against message storms to ensure the stability of the IIoT system, and at the same time realize the conversion between the SNMP and RESTful interfaces to avoid the use of different hardware or software.
[0043] Reference Figure 1 As shown, an embodiment of the present invention discloses a method for coordinating SNMP protocol and RESTful protocol, which is applied to a preset protocol coordination gateway, including:
[0044] Step S11: An online switch is set at the SMNP interface so as to utilize the online switch to shield concurrent message storms of multiple SNMP devices.
[0045] In this embodiment, a corresponding online switch is set in the SNMP interface to shield the SNMP message storm online. It can be understood that since there are multiple SNMP devices, there may be concurrent messages generated by multiple SNMP devices at the same time. As the upper Restful interface layer, when receiving concurrent messages from multiple SNMP devices, an exponential message storm may be generated, which has an impact on the stability of the IIOT system. Therefore, in the SNMP interface between the SNMP device layer and the SNMP protocol, a corresponding online switch for shielding the SNMP message storm is set.
[0046] Step S12: communicating with the SNMP device through an SNMP agent module, and determining a corresponding target field operation of the RESTful protocol based on a preset field mapping relationship and the first field operation of the SNMP agent module on the SNMP device.
[0047] In this embodiment, communication with the SNMP device is performed through the SNMP agent module. It can be understood that the SNMP protocol is mainly composed of the SNMP management program and the SNMP agent module. The SNMP agent module runs on each managed SNMP device and is responsible for counting various information of the SNMP device, interacting with the SNMP management program, receiving and executing commands of the SNMP management program, and uploading various local network information. The SNMP management program and the SNMP agent module are loosely coupled, and communication between the two is completed through the UDP protocol. In general, the SNMP management program sends various commands to the SNMP agent module through the UDP protocol. When the SNMP agent module receives the instructions, it returns the parameters required by the SNMP management program. However, when the SNMP agent module detects an abnormality in a network element, it can also actively send a message to the SNMP management program to notify the current abnormal condition. For example Figure 2As shown, the SNMP data acquisition process, that is, the process of communication between the SNMP management program and the SNMP agent program through the UDP protocol, the SNMP management program sends corresponding instructions to, that is, obtains the communication data of the SNMP device. When the corresponding target field operation of the RESTful protocol is determined based on the preset field mapping relationship and the first field operation of the SNMP agent module on the SNMP device. It can be understood that when communicating with the SNMP device through the SNMP agent module, in a specific embodiment, when the RESTful protocol issues certain field operation instructions to the SNMP device, it is necessary to convert the target field operation of the RESTful protocol based on the preset field mapping relationship, that is, obtain the first field operation, so that the SNMP agent module can use the first field operation to issue instructions to the SNMP device. In another specific embodiment, if the SNMP agent module actively detects that the SNMP device has an abnormality, that is, actively reports abnormal data, it is still necessary to convert the first field operation of SNMP into the second field operation of RESTful based on the preset field operation instruction. Figure 3 The figure shows the message structure of the SNMP protocol, which specifically includes an IP header and a UDP datagram; the UDP datagram includes a UDP header and an SNMP message, and the SNMP message specifically includes a version number, a community, a PDU type, a request identifier, an error status, an error index, and a variable name-value pair. In SNMPv1, it specifically includes a PDU type, a trap header, and a variable binding part, where the trap header includes: the IP address of the enterprise and agent, the trap type, a specific code, and a timestamp. The variable binding is a variable name-value pair.
[0048] In this embodiment, before communicating with the SNMP device through the SNMP agent module, it also includes: mapping the first field operation of the SNMP protocol with the second field operation of the RESTful protocol to obtain the preset field mapping relationship between the SNMP protocol and the RESTful protocol; mapping the first alarm operation of the SNMP protocol with the second alarm field operation of the RESTful protocol to obtain the preset alarm level mapping rules between the SNMP protocol and the RESTful protocol. It can be understood that in order to realize the interface conversion between the SNMP protocol and the RESTful protocol, it is necessary to map and configure the field operation of the SNMP protocol with the field operation of the RESTful protocol, and map and configure the alarm category of the SNMP protocol with the alarm level of the RESTful protocol; specifically, the SNMP protocol and the RESTful protocol mapping fields are configured one by one, and multiple mapping fields of the SNMP protocol can also be merged into one RESTful field. The field mapping representation is shown in Table 1:
[0049] Table 1
[0050]
[0051] The alarm levels in SNMP, such as normal, minor, important, and severe, are mapped with RESTful alarm level mapping rules, and the first field operation of the SNMP protocol is relationally mapped with the second field operation of the RESTful protocol to obtain the preset field mapping relationship between the SNMP protocol and the RESTful protocol, including: relationally mapping the Get operation and the GetNext operation of the SNMP protocol with the Get operation of the RESTful protocol; relationally mapping the Trap operation of the SNMP protocol with the Put operation and the Post operation of the RESTful protocol; relationally mapping the Set operation of the SNMP protocol with the Post operation and the Delete operation of the RESTful protocol to obtain the preset field mapping relationship between the SNMP protocol and the RESTful protocol.
[0052] Step S13: Determine a corresponding target alarm operation of the RESTful protocol based on a preset alarm level mapping rule and the first alarm operation of the SNMP agent module on the SNMP device.
[0053] In this embodiment, when communicating with the SNMP device through the SNMP agent module, when the SNMP device uploads traffic data, it is necessary to convert the alarm operation of the SNMP interface on the current traffic data into the target alarm operation of the RESTful protocol based on the preset alarm level mapping rule, that is, to obtain the target alarm operation, so as to make corresponding processing of the current traffic data through the RESTful service module.
[0054] Reference Figure 4As shown, the interface conversion between the RESTful protocol and the SNMP protocol is coordinated through a preset protocol coordination gateway. Specifically, the preset protocol coordination gateway includes: a RESTful agent, a RESTful message encoding and decoding module, a RESTful / SNMP protocol conversion module, an SNMP message encoding and decoding module, and an SNMP agent module; when various SNMP devices in the SNMP device layer communicate with the SNMP agent module, in order to allow the RESTful interface layer to perform command control on the SNMP device or process the traffic data sent by the SNMP, the SNMP message encoding and decoding module in the SNMP / RESTful gateway is used for encoding and decoding, and then the SNMP / RESTful message conversion is performed when it reaches the protocol conversion module, and then the message is encoded and decoded by the RESTful message encoding and decoding module, and then reaches the RESTful agent module, and finally communicates with the RESTful service module through the RESTful agent module to realize the control of the SNMP device by the RESTful service module.
[0055] It can be seen that the present application discloses a method for coordinating the SNMP protocol and the RESTful protocol, which is applied to a preset protocol coordination gateway, including: setting an online switch at the SMNP interface so as to use the online switch to shield concurrent message storms of multiple SNMP devices; communicating with the SNMP device through the SNMP agent module, and determining the corresponding target field operation of the RESTful protocol based on the preset field mapping relationship and the first field operation of the SNMP agent module on the SNMP device; determining the corresponding target alarm operation of the RESTful protocol based on the preset alarm level mapping rule and the first alarm operation of the SNMP agent module on the SNMP device. It can be seen that by setting an online switch at the SNMP interface, the SNMP storm can be shielded online, and then through the mapping relationship between the SNMP protocol and the Restful protocol, such as field mapping, alarm level mapping, etc., the communication between SNMP and SNMP devices is converted into the communication between Restful and SNMP devices, that is, the request for the interface conversion between SNMP and Restful is realized.
[0056] Reference Figure 5 As shown, the embodiment of the present invention discloses a specific SNMP protocol and RESTful protocol coordination method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically:
[0057] Step S21: configuring a flow threshold and a synchronization threshold in the SMNP interface, so that when the amount of communication data of the acquired SNMP device is greater than the synchronization threshold, the communication data exceeding the synchronization threshold is discarded.
[0058] In this embodiment, two switches, flow threshold A and synchronization threshold B, are configured in each SNMP interface. When the communication data is synchronized, the communication data exceeding the synchronization threshold B is discarded. At the same time, SNMP alarm information (such as trap information) is dynamically received to detect whether the alarm flow reaches the flow threshold.
[0059] Step S22: when the alarm flow of the SNMP device sent by the SNMP agent module is greater than the flow threshold, REST alarm information is generated for the alarm flow based on a preset alarm level mapping rule.
[0060] In this embodiment, if the alarm traffic exceeds the traffic threshold A, a REST alarm message about the SNMP interface is generated internally to indicate that the SNMP traffic is abnormal, and a corresponding alarm traffic processing solution is provided for the SNMP interface, for example: all subsequent SNMP messages whose alarm traffic exceeds the traffic threshold A are discarded.
[0061] Step S23: Filter out the target alarm traffic with the highest alarm level from the alarm traffic corresponding to the REST alarm information, and store the target alarm traffic in the RESTful push thread pool, so that the RESTful push thread pool submits the target alarm traffic to the RESTful server in a preset order.
[0062] In this embodiment, for all the information about alarm traffic exceeding the traffic threshold A, only the alarms with the highest alarm level are screened out, and the screened alarm traffic with the highest alarm level accounts for less than 30% of the total alarm traffic, and at the same time, the screened target alarm traffic with the highest alarm level does not exceed the traffic threshold A, and the remaining alarm traffic is discarded on the spot. The screened alarm traffic with the highest alarm level that meets the above conditions is put into the local REST buffer pool and submitted to the RESTServer end in sequence by the REST thread pool; the SNMP alarm traffic of the SNMP interface is continuously monitored, and only when the traffic is lower than k·A, it returns to normal, where k∈[0.5,1).
[0063] In this embodiment, a RESTful push thread pool for decoupling the RESTful protocol push and the SNMP protocol reception is set in the preset protocol coordination gateway. It can be understood that the preset protocol coordination gateway sets up a RESTful push thread pool locally, implements the front-end and back-end with SNMP, and realizes the decoupling of REST push and SNMP reception; and configures dynamic screening of SNMP alarm levels on each SNMP interface to realize dynamic REST conversion of different SNMP alarms without modifying the configuration.
[0064] It can be seen that the SNMP and RESTful inter-conversion function provided by the preset protocol coordination gateway, while also providing the recent storm shielding function for the underlying SNMP messages, is a highly elastic SNMP and RESTful adaptive gateway that is simple and easy to understand, does not rely on high-performance software and hardware, and can be applied to any software / hardware platform.
[0065] Reference Figure 6 As shown, the present application also discloses a SNMP protocol and RESTful protocol coordination device, which is applied to a preset protocol coordination gateway, including:
[0066] A storm shielding module 11 is used to set an online switch on the SMNP interface so as to shield concurrent message storms of multiple SNMP devices by using the online switch;
[0067] A field operation determination module 12, configured to communicate with the SNMP device through an SNMP agent module, and determine a corresponding target field operation of the RESTful protocol based on a preset field mapping relationship and a first field operation of the SNMP agent module on the SNMP device;
[0068] The alarm operation determination module 13 is used to determine the corresponding target alarm operation of the RESTful protocol based on a preset alarm level mapping rule and the first alarm operation of the SNMP agent module on the SNMP device.
[0069] It can be seen that the present application discloses setting an online switch in the SMNP interface so as to use the online switch to shield concurrent message storms of multiple SNMP devices; communicating with the SNMP device through the SNMP agent module, and determining the corresponding target field operation of the RESTful protocol based on the preset field mapping relationship and the first field operation of the SNMP agent module on the SNMP device; determining the corresponding target alarm operation of the RESTful protocol based on the preset alarm level mapping rule and the first alarm operation of the SNMP agent module on the SNMP device. It can be seen that by setting an online switch in the SNMP interface, the SNMP storm can be shielded online, and then through the mapping relationship between the SNMP protocol and the Restful protocol, such as field mapping, alarm level mapping, etc., the communication between SNMP and SNMP devices is converted into the communication between Restful and SNMP devices, that is, the request for the interface conversion between SNMP and Restful is realized.
[0070] Furthermore, the present application also discloses an electronic device. Figure 7 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0071] Figure 7 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the SNMP protocol and RESTful protocol coordination method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0072] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0073] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0074] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0075] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to realize the operation and processing of the processor 21 on the massive data 223 in the memory 22, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the SNMP protocol and RESTful protocol coordination method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to data transmitted from an external device received by the electronic device, the data 223 can also include data collected by its own input and output interface 25, etc.
[0076] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned disclosed SNMP protocol and RESTful protocol coordination method is implemented. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.
[0077] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0078] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. The steps of the method or algorithm described in conjunction with the embodiments disclosed herein can be directly implemented with a software module executed by a hardware or processor, or a combination of the two. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0079] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0080] The above is a detailed introduction to the SNMP protocol and RESTful protocol coordination method and components provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for coordinating SNMP protocol and RESTful protocol, characterized in that: Applied to preset protocol coordination gateway, including: An online switch is set at the SMNP interface so as to use the online switch to shield concurrent message storms of multiple SNMP devices; wherein the SMNP interface is located between the SNMP device layer and the SNMP protocol, the SNMP protocol includes an SNMP management program and an SNMP agent module, the SNMP agent module runs on each managed SNMP device, the SNMP agent module communicates and interacts with the SNMP management program through the UDP protocol, and receives and executes commands of the SNMP management program; Communicate with the SNMP device through an SNMP agent module, and determine a corresponding target field operation of the RESTful protocol based on a preset field mapping relationship and a first field operation of the SNMP agent module on the SNMP device; Determine the corresponding target alarm operation of the RESTful protocol based on a preset alarm level mapping rule and the first alarm operation of the SNMP agent module on the SNMP device; Before communicating with the SNMP device through the SNMP agent module, the method further includes: Configure a first mapping relationship between a single trap information field of the alarm level in the SNMP protocol and a single trap information field of the RESTful alarm level, and configure a second mapping relationship between multiple trap information fields of the alarm level in the SNMP protocol and a single trap information field of the RESTful alarm level; wherein the alarm levels in the SNMP protocol include: normal level, minor level, important level, and severe level; Performing relationship mapping between the first field operation of the SNMP protocol and the second field operation of the RESTful protocol to obtain a preset field mapping relationship between the SNMP protocol and the RESTful protocol; Performing relationship mapping between the first alarm operation of the SNMP protocol and the second alarm field operation of the RESTful protocol to obtain a preset alarm level mapping rule between the SNMP protocol and the RESTful protocol; The process of setting the online switch in the SMNP interface also includes: A flow threshold and a synchronization threshold are configured in the SMNP interface so that when the amount of communication data of the SNMP device obtained is greater than the synchronization threshold, the communication data exceeding the synchronization threshold is discarded.
2. The SNMP protocol and RESTful protocol coordination method according to claim 1, characterized in that: The mapping of the first field operation of the SNMP protocol with the second field operation of the RESTful protocol to obtain a preset field mapping relationship between the SNMP protocol and the RESTful protocol includes: Perform relationship mapping between the Get operation and the GetNext operation of the SNMP protocol and the Get operation of the RESTful protocol; perform relationship mapping between the Trap operation of the SNMP protocol and the Put operation and the Post operation of the RESTful protocol; perform relationship mapping between the Set operation of the SNMP protocol and the Post operation and the Delete operation of the RESTful protocol to obtain the preset field mapping relationship between the SNMP protocol and the RESTful protocol.
3. The SNMP protocol and RESTful protocol coordination method according to claim 1, characterized in that: The determining the corresponding target alarm operation of the RESTful protocol based on the preset alarm level mapping rule and the first alarm operation of the SNMP agent module on the SNMP device includes: When the alarm flow of the SNMP device sent by the SNMP agent module is greater than the flow threshold, REST alarm information is generated for the alarm flow based on a preset alarm level mapping rule.
4. The SNMP protocol and RESTful protocol coordination method according to claim 3, characterized in that: After generating REST alarm information for the alarm traffic based on the preset alarm level mapping rule, the method further includes: The target alarm flow with the highest alarm level is screened out from the alarm flow corresponding to the REST alarm information, and the target alarm flow is stored in the RESTful push thread pool, so that the RESTful push thread pool submits the target alarm flow to the RESTful server in a preset order.
5. The SNMP protocol and RESTful protocol coordination method according to any one of claims 1 to 4, characterized in that: Also includes: A RESTful push thread pool for decoupling the RESTful protocol push and the SNMP protocol reception is set in the preset protocol coordination gateway.
6. A SNMP protocol and RESTful protocol coordination device, characterized in that: Applied to preset protocol coordination gateway, including: A storm shielding module, used to set an online switch on the SMNP interface so as to use the online switch to shield concurrent message storms of multiple SNMP devices; wherein the SMNP interface is located between the SNMP device layer and the SNMP protocol, the SNMP protocol includes an SNMP management program and an SNMP agent module, the SNMP agent module runs on each managed SNMP device, the SNMP agent module communicates and interacts with the SNMP management program through the UDP protocol, and receives and executes commands of the SNMP management program; A field operation determination module, configured to communicate with the SNMP device through an SNMP agent module, and determine a corresponding target field operation of the RESTful protocol based on a preset field mapping relationship and a first field operation of the SNMP agent module on the SNMP device; An alarm operation determination module, configured to determine a corresponding target alarm operation of the RESTful protocol based on a preset alarm level mapping rule and a first alarm operation of the SNMP agent module on the SNMP device; The SNMP protocol and RESTful protocol coordination device is specifically used to configure a first mapping relationship between a single trap information field of an alarm level in the SNMP protocol and a single trap information field of the RESTful alarm level, and to configure a second mapping relationship between multiple trap information fields of an alarm level in the SNMP protocol and a single trap information field of the RESTful alarm level; wherein the alarm levels in the SNMP protocol include: ordinary level, minor level, important level, and severe level; a first field operation of the SNMP protocol is relationally mapped with a second field operation of the RESTful protocol to obtain a preset field mapping relationship between the SNMP protocol and the RESTful protocol; a first alarm operation of the SNMP protocol is relationally mapped with a second alarm field operation of the RESTful protocol to obtain a preset alarm level mapping rule between the SNMP protocol and the RESTful protocol; The storm shielding module is specifically used to configure the flow threshold and the synchronization threshold in the SMNP interface, so that when the amount of communication data of the SNMP device obtained is greater than the synchronization threshold, the communication data exceeding the synchronization threshold is discarded.
7. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the SNMP and RESTful coordination method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the SNMP and RESTful coordination method as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method and equipment for managing network equipment
CN103684822A
Trap message processing method and data synchronization management device
CN111726822A