Equipment control method and device based on FTTR
By using the network driver layer and kernel process in the FTTR network system to process debugging and monitoring data and directly transmit response data, the problem of low control efficiency in the existing technology is solved, and more efficient equipment control and operation convenience are achieved.
Patent Information
- Application Number
- CN202410968961.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-19
AI Technical Summary
Existing equipment control technology has low control efficiency in FTTR network systems, mainly due to its reliance on serial communication connections, resulting in inconvenient operation and low efficiency.
By establishing a data transmission path between the network driver layer of the network device and the kernel process, the network driver layer is used to receive and process the data to be processed, and generate response data, which is directly transmitted to the target control device, thus avoiding the direct communication connection of the serial port driver device. .
It improves the efficiency and operational convenience of equipment control, reduces the physical operations on the network equipment structure, and enhances the reliability and efficiency of control.
Smart Images

Figure CN118509746B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network communication technology, and in particular to a method and apparatus for controlling equipment based on FTTR. Background Art
[0002] FTTR (Fiber to The Room) is a fiber access architecture in the field of communication technology, which aims to lay optical fiber directly to each room. Among them, the network system based on FTTR includes network devices such as gateways. In order to ensure the reliable operation of the network system, the network equipment will be debugged and monitored accordingly as needed. However, the inventors have found that in the existing equipment control technology, debugging and monitoring are generally based on the serial port in the network device (such as establishing a communication connection through the serial port, etc.), which results in a relatively low control efficiency. Summary of the invention
[0003] In view of this, the purpose of the present application is to provide a device control method and apparatus based on FTTR, so as to improve the problem of relatively low control efficiency existing in the existing device control technology.
[0004] To achieve the above purpose, the embodiment of the present application adopts the following technical solution:
[0005] A device control method based on FTTR is applied to a network device, wherein a target operating system is deployed on the network device, and a system kernel of the target operating system has a kernel process and a network driver layer. The device control method based on FTTR includes:
[0006] Receiving the data to be processed sent by the target control device through the network driver layer, wherein a communication connection is established between the target control device and the network device based on the network hardware device corresponding to the network driver layer;
[0007] When the data to be processed is debugging monitoring data, the data to be processed is transmitted to the kernel process through the network driver layer, and the data to be processed is processed through the kernel process, and when corresponding debugging monitoring response data is generated based on the processing, the debugging monitoring response data is transmitted to the network driver layer;
[0008] The debugging monitoring response data is transmitted to the target control device through the network driver layer.
[0009] In a preferred embodiment of the present application, in the above-mentioned FTTR-based device control method, when the data to be processed belongs to debugging monitoring data, the step of transmitting the data to be processed to the kernel process through the network driver layer, and the step of processing the data to be processed through the kernel process and transmitting the debugging monitoring response data to the network driver layer when corresponding debugging monitoring response data is generated based on the processing includes:
[0010] When the data to be processed belongs to debugging monitoring data, the data to be processed is transmitted to the serial port driver device in the system kernel through the data transmission interface pre-created on the network driver layer, and the data to be processed is transmitted to the kernel process through the serial port driver device, wherein, after the data transmission interface is created on the network driver layer, the data transmission interface is also mounted on the serial port driver device, so that the data transmission interface is used to construct a data transmission path between the network driver layer and the serial port driver device;
[0011] The data to be processed is processed by the kernel process, and when corresponding debugging monitoring response data is generated based on the processing, the debugging monitoring response data is transmitted to the network driver layer.
[0012] In a preferred embodiment of the present application, in the above-mentioned FTTR-based device control method, when the data to be processed belongs to debugging monitoring data, the data to be processed is transmitted to the serial port driver device in the system kernel through the data transmission interface pre-created on the network driver layer, and the step of transmitting the data to be processed to the kernel process through the serial port driver device includes:
[0013] After receiving the data to be processed, the network driver layer parses the data to be processed to determine whether the data to be processed belongs to debugging monitoring data, and determines whether the data transmission interface pre-created on the network driver layer is in an open state;
[0014] When the data to be processed belongs to debugging monitoring data and the data transmission interface is in an open state, the data to be processed is transmitted to a serial port driver device in the system kernel through the data transmission interface, and the data to be processed is transmitted to the kernel process through the serial port driver device;
[0015] When the data to be processed belongs to debugging monitoring data and the data transmission interface is not in an open state, the data transmission interface is opened, and the data to be processed is transmitted to a serial port driver device in the system kernel through the opened data transmission interface, and the data to be processed is transmitted to the kernel process through the serial port driver device;
[0016] When the data to be processed does not belong to debugging monitoring data and the data transmission interface is in an open state, the data to be processed is not transmitted to the serial port driver device in the system kernel, and the data transmission interface is closed so that the data transmission interface is not in an open state;
[0017] When the data to be processed does not belong to debugging monitoring data and the data transmission interface is not in an open state, the data to be processed is not transmitted to the serial port driver device in the system kernel.
[0018] In a preferred embodiment of the present application, in the above-mentioned FTTR-based device control method, when the data to be processed belongs to debugging monitoring data and the data transmission interface is in an open state, the data to be processed is transmitted to the serial port driver device in the system kernel through the data transmission interface, and the step of transmitting the data to be processed to the kernel process through the serial port driver device includes:
[0019] When the data to be processed belongs to debugging monitoring data and the data transmission interface is in an open state, the data to be processed stored in the input data buffer of the network driver layer is transmitted to the input data buffer of the serial port driver device in the system kernel through the data transmission interface;
[0020] After the data to be processed is transferred to the input data buffer of the serial port driver device in the system kernel, the data reading mode of the kernel process is triggered, so that the kernel process entering the data reading mode reads the data to be processed from the input data buffer of the serial port driver device.
[0021] In a preferred embodiment of the present application, in the above-mentioned FTTR-based device control method, the step of processing the data to be processed by the kernel process, and when corresponding debugging monitoring response data is generated based on the processing, transmitting the debugging monitoring response data to the network driver layer includes:
[0022] Processing the data to be processed by the kernel process, and determining whether corresponding debugging monitoring response data is generated based on the processing;
[0023] When the kernel process processes the data to be processed and generates corresponding debugging monitoring response data, the debugging monitoring response data is transmitted to the output data buffer of the network driver layer; or
[0024] When the kernel process processes the data to be processed and generates corresponding debugging monitoring response data, it is determined whether the output data buffer of the network driver layer is full, and when the output data buffer of the network driver layer is not full, the debugging monitoring response data is transmitted to the output data buffer of the network driver layer, or, when the output data buffer of the network driver layer is full, the debugging monitoring response data is discarded, or the kernel process is blocked and waits until the output data buffer of the network driver layer is not full, and then the debugging monitoring response data is transmitted to the output data buffer of the network driver layer.
[0025] In a preferred embodiment of the present application, in the above-mentioned FTTR-based device control method, the step of receiving the data to be processed sent by the target control device through the network driver layer includes:
[0026] Receiving the data to be processed sent by the target control device through the Ethernet driver layer included in the network driver layer, wherein the network device establishes a communication connection with the target control device based on the Ethernet hardware device corresponding to the Ethernet driver layer; and / or,
[0027] The optical fiber receiving and transmitting packet driver layer included in the network driver layer receives the data to be processed sent by the target control device, wherein the network device establishes a communication connection with the target control device based on the optical fiber network hardware device corresponding to the optical fiber receiving and transmitting packet driver layer.
[0028] In a preferred embodiment of the present application, in the above-mentioned FTTR-based device control method, the step of receiving the data to be processed sent by the target control device through the network driver layer includes:
[0029] Communicate and interact with other network devices through the network driver layer to determine the private multicast group of the network device and each of the other network devices, and determine a public multicast group including the network device and each of the other network devices, wherein the addresses of the private multicast groups of the network device and each of the other network devices are determined based on at least the MAC addresses of the network device and each of the other network devices;
[0030] Receiving, through the network driver layer, device online query request information sent by the target control device, wherein the device online query request information belongs to a multicast packet, and the target control device transmits the device online query request information to the public multicast group based on the multicast technology;
[0031] Generate corresponding device related information in response to the device online query request information, wherein the device related information at least includes the private multicast group of the network device, and each other network device is used to generate corresponding device related information in response to the device online query request information;
[0032] The device-related information is transmitted to the target control device through the network driver layer, wherein the device-related information belongs to a multicast packet, and the network driver layer transmits the device-related information to the public multicast group based on the multicast technology, and each other network device transmits the corresponding device-related information to the target control device through its own network driver layer;
[0033] The data to be processed sent by the target regulation device is received through the network driver layer, wherein the target regulation device is used to transmit the data to be processed to a private multicast group corresponding to the device related information of the device after determining the device that needs to be regulated.
[0034] In a preferred embodiment of the present application, in the above-mentioned FTTR-based device control method, the step of receiving the data to be processed sent by the target control device through the network driver layer includes:
[0035] Receiving, through the network driver layer, device online query request information sent by the target control device, wherein the target control device remotely sends the device online query request information to the network driver layer based on unicast technology;
[0036] Performing multicast conversion processing on the device online query request information to obtain converted device online query request information, wherein the device online query request information belongs to a unicast packet and the converted device online query request information belongs to a multicast packet;
[0037] The online query request information of the conversion device is transmitted to the target multicast group through the network driver layer, and the device related information sent by each multicast network device in the target multicast group in response to the online query request information of the conversion device is received, wherein the network driver layer transmits the online query request information of the conversion device based on the multicast technology, and the multicast network device transmits the device related information based on the multicast technology;
[0038] Performing unicast conversion processing on the device related information to obtain converted device related information, wherein the device related information belongs to a multicast packet and the converted device related information belongs to a unicast packet;
[0039] The conversion device related information is sent to the target control device through the network driver layer, wherein the target control device is used to generate corresponding to-be-processed data based on the conversion device related information corresponding to the device after determining the device to be regulated;
[0040] The network driver layer receives the data to be processed sent by the target control device, wherein the target control device remotely sends the data to be processed to the network driver layer based on unicast technology, and the network driver layer is also used to transmit the data to be processed converted into multicast packets to the target multicast group based on multicast technology, and the multicast network devices in the target multicast group are used to perform corresponding control operations based on the received data to be processed.
[0041] In a preferred embodiment of the present application, in the above-mentioned FTTR-based device control method, before the step of receiving the data to be processed sent by the target control device through the network driver layer, the FTTR-based device control method further includes:
[0042] Determine whether the system kernel has a serial port driver device;
[0043] When the system kernel does not have a serial port driver device, based on a pseudo terminal registration mechanism or a virtual serial port registration mechanism provided by the target operating system, a virtual serial port is registered in the system kernel, and the virtual serial port is used as a serial port driver device of the system kernel, wherein the serial port driver device is used to form a data transmission path between the network driver layer and the kernel process.
[0044] The embodiment of the present application further provides a device control apparatus based on FTTR, which is applied to a network device, wherein a target operating system is deployed on the network device, and a system kernel of the target operating system has a kernel process and a network driver layer, and the device control apparatus based on FTTR includes:
[0045] A data receiving module, used for receiving the to-be-processed data sent by the target control device through the network driver layer, wherein a communication connection is established between the target control device and the network device based on the network hardware device corresponding to the network driver layer;
[0046] a data processing module, configured to, when the data to be processed is debugging monitoring data, transmit the data to be processed to the kernel process through the network driver layer, and, when the data to be processed is debugging monitoring data, transmit the debugging monitoring response data to the network driver layer, processing the data to be processed through the kernel process, and when corresponding debugging monitoring response data is generated based on the processing;
[0047] The data transmission module is used to transmit the debugging monitoring response data to the target control device through the network driver layer.
[0048] On the basis of the above, the embodiment of the present application further provides a network device, including:
[0049] Memory for storing computer programs;
[0050] The processor connected to the memory is used to execute the computer program stored in the memory to implement the above-mentioned FTTR-based device control method.
[0051] On the basis of the above, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is run, each step of the above-mentioned FTTR-based device control method is executed.
[0052] The device control method and apparatus based on FTTR provided in the present application can, firstly, receive the data to be processed sent by the target control device through the network driver layer; secondly, when the data to be processed belongs to the debugging monitoring data, the data to be processed can be transmitted to the kernel process through the network driver layer, and the data to be processed can be processed by the kernel process, and when the corresponding debugging monitoring response data is generated based on the processing, the debugging monitoring response data can be transmitted to the network driver layer; then, the debugging monitoring response data can be transmitted to the target control device through the network driver layer. Based on the above content, since the corresponding device control is performed through the network driver layer, it is only necessary to establish a communication connection between the target control device and the network device based on the network hardware device corresponding to the network driver layer, and it is not necessary to establish a communication connection between the target control device and the network device based on the serial port hardware device corresponding to the serial port driver device, that is, it is not necessary to operate the structure such as the housing of the network device (such as opening the housing, turning off the power, etc.), therefore, due to the improvement of the convenience of operation, the corresponding control efficiency can be improved, thereby improving the problem of relatively low control efficiency existing in the existing device control technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings.
[0054] Figure 1 A structural block diagram of a network device provided in an embodiment of the present application.
[0055] Figure 2 A schematic diagram of the process of the FTTR-based device control method provided in an embodiment of the present application.
[0056] Figure 3 A schematic diagram of a multi-device network system of master-slave gateways provided in an embodiment of the present application.
[0057] Figure 4 A schematic diagram of access via Ethernet provided in an embodiment of the present application.
[0058] Figure 5 A schematic diagram of the encapsulation of a data packet provided in an embodiment of the present application.
[0059] Figure 6 A schematic diagram of access via optical fiber provided in an embodiment of the present application.
[0060] Figure 7 A schematic diagram of data interaction provided in an embodiment of the present application.
[0061] Figure 8 A schematic diagram of data input provided for an embodiment of the present application.
[0062] Fig. 9 A schematic diagram of data output provided in an embodiment of the present application.
[0063] Fig.10 A schematic diagram of an FTTR-based equipment control device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0065] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0066] like Figure 1As shown, an embodiment of the present application provides a network device, wherein the network device may include a memory, a processor, and a device control device based on FTTR.
[0067] In detail, in an alternative embodiment, the FTTR-based device control apparatus includes at least one software function module stored in a memory in the form of software or firmware. The processor is used to execute an executable computer program stored in the memory, for example, the software function module and computer program included in the FTTR-based device control apparatus, so as to implement the FTTR-based device control method provided in the embodiment of the present application.
[0068] It is understood that in an alternative implementation, the network device may be a gateway or other device. In addition, a target operating system (such as a Linux operating system, etc.) may be deployed on the network device, and the system kernel of the target operating system may have a kernel process and a network driver layer (such as an Ethernet driver layer, an optical fiber transceiver packet driver layer, etc.).
[0069] Combination Figure 2 The embodiment of the present application also provides a device control method based on FTTR that can be applied to the above network device. The method steps defined in the process related to the device control method based on FTTR can be implemented by the network device.
[0070] The following will Figure 2 The specific process shown is explained in detail.
[0071] Step S110: receiving the data to be processed sent by the target control device through the network driver layer.
[0072] In an embodiment of the present application, the network device can receive the data to be processed sent by the target control device through the network driver layer. Wherein, a communication connection is established between the target control device and the network device based on the network hardware device corresponding to the network driver layer. Exemplarily, the target control device can be a terminal device, such as a computer.
[0073] Step S120, when the data to be processed belongs to debugging monitoring data, the data to be processed is transmitted to the kernel process through the network driver layer, and the data to be processed is processed by the kernel process, and when corresponding debugging monitoring response data is generated based on the processing, the debugging monitoring response data is transmitted to the network driver layer.
[0074] In an embodiment of the present application, when the data to be processed belongs to debugging monitoring data, the network device can transmit the data to be processed to the kernel process through the network driver layer, and process the data to be processed through the kernel process, such as the kernel process can execute the debugging instructions or monitoring instructions represented by the data to be processed, and when the corresponding debugging monitoring response data is generated based on the processing, the debugging monitoring response data is transmitted to the network driver layer. Exemplarily, the data to be processed can be used to query data such as the running status, and the debugging monitoring response data can be the queried running status data; or, the data to be processed can be a configuration command, and the debugging monitoring response data can be used to represent the result of executing the configuration command, such as success or failure.
[0075] Step S130: transmitting the debugging monitoring response data to the target control device through the network driver layer.
[0076] In the embodiment of the present application, the network device can transmit the debugging monitoring response data to the target control device through the network driver layer. In this way, the target control device can obtain the debugging monitoring response data, thereby completing the debugging or monitoring of the network device.
[0077] Based on the above content, since the corresponding device control is performed through the network driver layer, it is only necessary to establish a communication connection between the target control device and the network device based on the network hardware device corresponding to the network driver layer, without establishing a communication connection between the target control device and the network device based on the serial port hardware device corresponding to the serial port driver device (the serial port hardware device is generally configured inside the network device), that is, there is no need to operate the casing and other structures of the network device (such as opening the casing, turning off the power, etc.). Therefore, due to the improvement in operational convenience, the corresponding control efficiency can be improved, thereby improving the problem of relatively low control efficiency in existing equipment control technologies.
[0078] On the basis of the above content, it is also necessary to point out that the above-mentioned FTTR-based device control method is very useful in FTTR applications, especially for multi-device network systems with master-slave gateways (such as Figure 3As shown in the figure, since the network device interacts with the target control device through the network driver layer (such as the target control device sends the pending data for debugging to the network device), the target control device can actually transmit the pending data to the network device based on the multicast technology. In the multicast technology, the target control device does not need to determine the address of each device in the master-slave gateway (such as IP address, etc.), but only needs a multicast address. In this way, the debugging of multiple devices including the master-slave gateway can be realized, that is, the debugging of multiple network devices through one target control device can be realized, which can greatly improve the efficiency and convenience of device control. This is obviously difficult to achieve based on the existing technology of using serial port for control. Especially in the multi-device application of FTTR including master-slave gateway, it can produce better application effect.
[0079] First, it should be noted that for step S110, the specific method of receiving the to-be-processed data sent by the target control device through the network driver layer is not limited and can be configured according to requirements.
[0080] For example, in an alternative embodiment, the network driver layer includes an Ethernet driver layer (such as Figure 4As shown, when data is sent and received based on the Ethernet driver layer), the Ethernet driver layer (an Ethernet driver program) included in the network driver layer can receive the data to be processed sent by the target control device, wherein the network device establishes a communication connection with the target control device based on the Ethernet hardware device corresponding to the Ethernet driver layer. Exemplarily, the Ethernet hardware device can be an Ethernet physical interface, and the Ethernet driver layer can be used to manage the Ethernet physical interface. Exemplarily, the Ethernet driver layer can call the corresponding interface function to obtain the data to be processed, for example, the interface function can be intethInput (char * data, int len), char * data can represent the data to be processed, and int len can represent the data length of the data to be processed. In addition, the target control device can send the data to be processed to the network device through a socket. Among them, the PC (target control device) can use multicast technology to transmit the data to be processed. The advantage of using multicast destination IP packet sending is that the PC does not need to know the IP and MAC of the device (network device), and the IP of the PC and the IP of the device do not need to be in the same subnet, and there is no need to consider whether routing is required. Similarly, when the device sends packets to the PC, it can also use multicast IP and MAC, and there is no need to know or sniff the IP and MAC of the PC. According to multicast-related protocols, there is a strict correspondence between multicast IP and MAC, and both communicating parties only need to strictly follow these protocols. The use of multicast greatly simplifies the monitoring and debugging process and improves communication efficiency. This is especially important for the implementation of the debugged monitoring side, because the device side needs to modify the Ethernet driver code to implement the processing of sending and receiving packets. There is no need to implement the complete TCP / IP protocol stack, and only simple processing is required to send and receive IP packets. The device side only needs to send multicast packets to the Ethernet port that receives the ETHD packet. This avoids sending multicast packets to other network ports. The encapsulation structure of the data packets exchanged between the PC and the device is as follows: Figure 5 shown.
[0081] For example, in another alternative implementation, the network driver layer includes an optical fiber transceiver packet driver layer (such as Figure 6 As shown, when data is sent and received based on the optical fiber transceiver packet driver layer, the optical fiber transceiver packet driver layer (an optical fiber transceiver packet driver program) included in the network driver layer can receive the to-be-processed data sent by the target control device, wherein the network device establishes a communication connection with the target control device based on the optical fiber network hardware device corresponding to the optical fiber transceiver packet driver layer. Exemplarily, the optical fiber network hardware device can be an optical fiber transceiver, and the optical fiber transceiver packet driver layer can be used to manage the optical fiber transceiver.
[0082] For another example, in another alternative implementation, the network driver layer may also include an Ethernet driver layer and an optical fiber transceiver driver layer. In this way, the debugging and monitoring data of different control devices may be received through the Ethernet driver layer and the optical fiber transceiver driver layer respectively.
[0083] It should be noted that, in order to further improve the convenience of debugging and monitoring, in an alternative implementation, the above step S110 may further include the following contents:
[0084] In the first step, the network driver layer can communicate and interact with other network devices to determine the private multicast groups of the network device and each of the other network devices, and determine the public multicast group including the network device and each of the other network devices (such as the address corresponding to the public multicast group is 239.255.255.1), wherein the addresses of the private multicast groups of the network device and each of the other network devices are determined based on at least the MAC addresses of the network device and each of the other network devices; illustratively, the device private multicast group can be fitted using the last three bytes of its own MAC address, for example, the MAC address of a device is 02:02:02:08:09:0a, which can be mapped to the multicast group address 239.8.9.10; because the probability of the last three bytes of the MAC address of any device in the FTTR network being exactly the same is small, the addresses of the multicast groups are generally not the same. If they are the same, because both can receive the information of the multicast group, conflicts can be detected with each other, and the backoff negotiation algorithm commonly used in the communication field is adopted, and the two conflicting devices will negotiate different private multicast group addresses;
[0085] In the second step, the device online query request information sent by the target control device can be received through the network driver layer, wherein the device online query request information belongs to a multicast packet (exemplarily, an ETHD packet with a query online flag), and the target control device transmits the device online query request information to the public multicast group based on the multicast technology, so that the network devices belonging to the public multicast group can receive the device online query request information;
[0086] In a third step, corresponding device-related information may be generated in response to the device online query request information, wherein the device-related information at least includes a private multicast group of the network device (exemplarily, may also include a listening port, etc.), and each other network device is used to generate corresponding device-related information in response to the device online query request information;
[0087] In the fourth step, the device related information may be transmitted to the target control device through the network driver layer, wherein the device related information belongs to a multicast packet, and the network driver layer transmits the device related information to the public multicast group based on the multicast technology, and each other network device transmits the corresponding device related information to the target control device through its own network driver layer, such as by transmitting to the public multicast group, so that the target control device can obtain it;
[0088] In the fifth step, the network driver layer may receive the data to be processed sent by the target control device, wherein the target control device is used to transmit the data to be processed to the private multicast group corresponding to the device-related information of the device after determining the device to be regulated; illustratively, in some applications, in order to enable the data to be processed to be processed reliably, the target control device may also send a request, such as a request to open Figure 4 and Figure 6 The interface function of the ETHD module (a network module) shown enables data to be transmitted reliably.
[0089] Based on the above content, the target control device (such as a PC) can send a request to open the ETHD function to the device corresponding to the private multicast group of interest, so that a PC can monitor and debug one network device, multiple network devices, or all network devices. In this way, compared with the serial port, no matter the complexity of the physical connection, the communication rate, and the flexibility are huge improvements.
[0090] In addition, since a PC can easily monitor multiple network devices at the same time with high speed and real-time performance, it can realize some functions that cannot be realized or are difficult to realize through serial ports. For example, to monitor the output of one or several network devices, you can use scripts to match the output of feature strings or data, and then execute input commands on one or several network devices according to pre-defined rules, thereby realizing automated monitoring or debugging.
[0091] It should be noted that, in order to further improve the convenience of debugging and monitoring, in an alternative implementation, the above step S110 may further include the following contents:
[0092] In the first step, the network driver layer can receive the device online query request information sent by the target control device, wherein the target control device remotely sends the device online query request information to the network driver layer based on the unicast technology, that is, the target control device can send the device online query request information to the network device based on the unicast technology, and the target control device can send information to the network device remotely based on optical fiber or Ethernet, so that the convenience of debugging and monitoring the network device can be greatly improved;
[0093] In the second step, the device online query request information may be multicast converted to obtain converted device online query request information, wherein the device online query request information belongs to a unicast packet, and the converted device online query request information belongs to a multicast packet, that is, the multicast packet may be converted to a unicast packet, and a corresponding proxy module may be provided in the network device, and the module may obtain the device online query request information, and then perform multicast conversion on the device online query request information, thereby obtaining converted device online query request information;
[0094] In the third step, the online query request information of the conversion device can be transmitted to the target multicast group through the network driver layer, and the device-related information sent by each multicast network device in the target multicast group in response to the online query request information of the conversion device can be received, wherein the network driver layer transmits the online query request information of the conversion device based on the multicast technology, and the multicast network device transmits the device-related information based on the multicast technology. Exemplarily, the target multicast group can be the public multicast group as mentioned above, and the multicast network devices in the target multicast group can include the network device, or can exclude the network device and only include other network devices. In this way, the proxy of other network devices based on the network device can be realized. In addition, the device-related information at least includes the address of the private multicast group of the corresponding multicast network device, so that the network device and the target control device can distinguish the multicast network device based on the address; for example, the address of the private multicast group of the multicast network device can be filled in the session id field of the ETHD packet header;
[0095] In a fourth step, the device-related information may be subjected to unicast conversion processing to obtain converted device-related information, wherein the device-related information belongs to a multicast packet, and the converted device-related information belongs to a unicast packet; illustratively, the device-related information may also be subjected to unicast conversion processing by the proxy module as described above to convert the multicast packet into a unicast packet;
[0096] In a fifth step, the conversion device related information may be sent to the target control device through the network driver layer, wherein the target control device is used to generate corresponding to-be-processed data based on the conversion device related information corresponding to the device after determining the device to be regulated;
[0097] In the sixth step, the data to be processed sent by the target control device can be received through the network driver layer, wherein the target control device remotely sends the data to be processed to the network driver layer based on the unicast technology, and the network driver layer is also used to transmit the data to be processed converted into multicast packets to the target multicast group based on the multicast technology, and the multicast network devices in the target multicast group are used to perform corresponding control operations based on the received data to be processed; that is, when the data to be processed is transmitted to the network device, the aforementioned steps S120 and S130 can be executed based on the data to be processed; when the data to be processed is transmitted to other network devices, the data to be processed can be forwarded to other network devices (such as through multicast technology) first, so that other network devices can perform corresponding processing according to the methods of the aforementioned steps S110, S120 and S130.
[0098] Based on this, the above network devices can be the main gateway, and other network devices can be sub-gateways. On the one hand, the target debugging device can directly debug and monitor the main gateway, and on the other hand, the target debugging device can also debug and monitor the sub-gateway through the proxy function of the main gateway. For example, the PC (target debugging device) remotely unicasts to the main gateway to query online device requests (set the ETHD packet related FLAG flag), and the proxy module converts the unicast into multicast (including IP and MAC), and the multicast address is the address of the public multicast group mentioned above, and is sent to the FTTR network. All main gateways and sub-gateways in the FTTR network will receive and respond to the reply request. After the proxy module of the main gateway receives the reply, the multicast packet of the reply is converted into a unicast packet. The destination IP of the unicast is the IP of the PC, and the destination port of the UDP (User Datagram Protocol) is the source port of the request packet initiated by the PC. In order to distinguish which device is responding, the address of the device's private multicast group can be filled in the session id field of the ETHD packet header. If the PC wants to debug a device later, fill in the session id of the device in the subsequent packet, send it to the main gateway in unicast, and the proxy module of the main gateway converts the unicast packet into a multicast packet (the multicast IP and MAC are taken from the session id). The role of the proxy module is to maintain the conversion between unicast and multicast. The other functional modules and interfaces remain unchanged, so that the PC can remotely debug any device in the FTTR network. In addition, the proxy module can be located in the driver layer of the main gateway's packet sending and receiving, such as the network driver layer mentioned above.
[0099] Secondly, it should be noted that for step S120, the specific method of transmitting and processing the data to be processed through the network driver layer and the kernel process is not limited and can be selected according to actual needs.
[0100] For example, in an alternative implementation, in order to make the transmission and processing of the data to be processed more efficient, and to debug and monitor the TCP / IP network protocol stack, and to reduce the device resource consumption of the network device, when the data to be processed is debugging and monitoring data, the data to be processed can be directly transmitted to the kernel process through the network driver layer, and then the data to be processed is processed by the kernel process, and when corresponding debugging and monitoring response data is generated based on the processing, the debugging and monitoring response data is directly transmitted to the network driver layer.
[0101] For another example, in another alternative implementation, the inventors of the present application have conducted research and found that when there is a serial port driver device in the system kernel (the serial port driver device is a serial port driver program), the serial port driver device will take over the input and output of the kernel process in the system kernel. Therefore, in order to reduce the modification range of the system kernel (excessive modification range may cause the normal operation of the system kernel, etc.), the above-mentioned step S120 may further include step S121 and step S122, and the specific content of each step is described as follows.
[0102] Step S121, when the data to be processed belongs to debugging monitoring data, the data to be processed is transmitted to the serial port driver device in the system kernel through the data transmission interface pre-created on the network driver layer, and the data to be processed is transmitted to the kernel process through the serial port driver device.
[0103] In the embodiment of the present application, after receiving the data to be processed, and when the data to be processed is debugging monitoring data, the data transmission interface (a program interface, such as Figure 7 The input / output interface of the ETHD module shown in FIG. 1 , where PC may refer to the target control device), transmits the data to be processed to the serial port driver device in the system kernel (such as Figure 7 In addition, for the serial devices shown Figure 7The regular sent and received data may refer to data other than the debugging monitoring data and the debugging monitoring response data, such as data formed by operations other than the debugging monitoring operation, and for processes in the user space, such as process 1, process 2, process N, etc., it can also be switched to kernel state, that is, as a new kernel process), and the data to be processed is transmitted to the kernel process through the serial port driver device. Among them, after creating the data transmission interface on the network driver layer, it is also necessary to hang the data transmission interface on the serial port driver device, so that the data transmission interface is used to construct a data transmission path between the network driver layer and the serial port driver device. In other words, without making other changes to the system kernel of the target operating system, a data transmission interface can be created only on the network driver layer, so that the data to be processed can be transmitted to the serial port driver device.
[0104] Step S122: Process the data to be processed by the kernel process, and when corresponding debugging monitoring response data is generated based on the processing, transmit the debugging monitoring response data to the network driver layer.
[0105] In an embodiment of the present application, after the data to be processed is transferred to the kernel process, the data to be processed can be processed by the kernel process (the specific processing method can be determined according to the specific content of the data to be processed), and when corresponding debugging monitoring response data is generated based on the processing, the debugging monitoring response data is transmitted to the network driver layer.
[0106] It can be understood that, in the above step S121, the specific method of transmitting the to-be-processed data to the serial port driver device through the data transmission interface is not limited and can be selected according to actual needs.
[0107] For example, in an alternative implementation, it can be assumed that the data to be processed belongs to debugging monitoring data, and the data transmission interface can be in an open state by default. In this way, when the data to be processed is received, the data to be processed can be directly transmitted to the serial port driver device through the data transmission interface, making the transmission efficiency of the data to be processed higher.
[0108] For example, in another alternative implementation, in order to improve the management and control effect of the processed data and ensure the regulation reliability of the network equipment, the above-mentioned step S121 may further include step S121a, step S121b, step S121c, step S121d and step S121e, and the specific content of each step is described as follows.
[0109] Step S121a, after receiving the data to be processed, the network driver layer parses the data to be processed to determine whether the data to be processed belongs to debugging monitoring data, and determines whether the data transmission interface pre-created on the network driver layer is in an open state.
[0110] In an embodiment of the present application, after receiving the data to be processed, the data to be processed can be parsed and processed by the network driver layer, and then, based on the result of the parsing and processing, it can be determined whether the data to be processed belongs to debugging monitoring data, and whether the data transmission interface pre-created on the network driver layer is in an open state. Exemplarily, for debugging monitoring data, some characteristic information can be provided, so that after the parsing and processing, if the data to be processed has the characteristic information, the data to be processed can be used as debugging monitoring data. Exemplarily, the data to be processed can have a specified header, such as an ETHD header, where ETHD stands for ethernet debug. The ETHD header may include: a 4-byte magic number (a characteristic string used to quickly identify a service), a 4-byte session ID (a unique ID generated by a network device or generated by other methods), a 4-byte device serial number (generated by a network device, with an initial value of 0, and the serial number increases by 1 for each packet sent [except for retransmission packets], and this serial number design can also be used for retransmission in complex environments), a 4-byte PC serial number (generated by a target control device, with an initial value of 0, and the serial number increases by 1 for each packet sent, and this serial number design can also be used for retransmission in complex environments), where the serial number is used by the receiving device to confirm whether there is packet loss, a 4-byte process ID (if the process ID is not concerned, it can be filled with 0), a 2-byte payload length, and a 2-byte FLAG flag. The format of the data to be processed, including the ETHD header and the data payload, is shown in Table 1.
[0111] Table 1
[0112]
[0113] Among them, the meaning of the FLAG flag in the ETHD packet header can be shown in Table 2.
[0114] Table 2
[0115]
[0116] Step S121b, when the data to be processed belongs to debugging monitoring data and the data transmission interface is in an open state, the data to be processed is transmitted to the serial port driver device in the system kernel through the data transmission interface, and the data to be processed is transmitted to the kernel process through the serial port driver device.
[0117] In an embodiment of the present application, after the data to be processed and the data transmission interface are correspondingly determined and processed, and when the data to be processed belongs to debugging monitoring data and the data transmission interface is in an open state, the data to be processed can be transmitted to the serial port driver device in the system kernel through the data transmission interface, and the data to be processed can be transmitted to the kernel process through the serial port driver device.
[0118] Step S121c, when the data to be processed belongs to debugging monitoring data and the data transmission interface is not in an open state, the data transmission interface is opened and processed, and, through the opened data transmission interface, the data to be processed is transmitted to the serial port driver device in the system kernel, and the data to be processed is transmitted to the kernel process through the serial port driver device.
[0119] In an embodiment of the present application, after the data to be processed and the data transmission interface are correspondingly determined and processed, and when the data to be processed belongs to debugging monitoring data and the data transmission interface is not in an open state, the data transmission interface is opened and processed, and, through the opened data transmission interface, the data to be processed is transmitted to the serial port driver device in the system kernel, and the data to be processed is transmitted to the kernel process through the serial port driver device.
[0120] Step S121d, when the data to be processed does not belong to debugging monitoring data and the data transmission interface is in an open state, the data to be processed is not transmitted to the serial port driver device in the system kernel, and the data transmission interface is closed so that the data transmission interface is not in an open state.
[0121] In an embodiment of the present application, after the data to be processed and the data transmission interface are correspondingly determined and processed, and when the data to be processed does not belong to debugging monitoring data and the data transmission interface is in an open state, the data to be processed is not transmitted to the serial port driver device in the system kernel, and the data transmission interface is closed so that the data transmission interface is not in an open state.
[0122] Step S121e: when the data to be processed does not belong to debugging monitoring data and the data transmission interface is not in an open state, the data to be processed is not transmitted to the serial port driver device in the system kernel.
[0123] In an embodiment of the present application, after the data to be processed and the data transmission interface are correspondingly determined and processed, and when the data to be processed does not belong to debugging monitoring data and the data transmission interface is not in an open state, the data to be processed is not transmitted to the serial port driver device in the system kernel, and the data transmission interface can be maintained in an open state.
[0124] Alternatively, in the above step S121a, the data to be processed is transmitted to a serial port driver in the system kernel, and the specific method of transmitting the data to be processed to the kernel process through the serial port driver is not limited and can be selected according to needs.
[0125] For example, in an alternative implementation, in order to ensure that the transmission of the data to be processed has higher reliability, data loss problems will inevitably occur during the transmission process, and the above-mentioned step S121a may further include the following specific implementation contents:
[0126] First, when the data to be processed belongs to debugging monitoring data and the data transmission interface is in an open state, the data transmission interface can be used to transmit the data to be processed stored in the input data buffer of the network driver layer to the input data buffer of the serial port driver device in the system kernel; that is, after receiving the data to be processed, the network driver layer can first store the data to be processed in the input data buffer of the network driver layer, so that when data transmission is required, the data to be processed can be read from the input data buffer first, and then the data to be processed can be transmitted to the input data buffer of the serial port driver device (such as Figure 8 As shown); illustratively, functions such as tty_insert_flip_string and tty_flip_buffer_push can be called to transfer the data to be processed from the input data buffer of the network driver layer to (store in) the input data buffer of the serial port driver device; in addition, by configuring the input data buffer of the network driver layer and the serial port driver device separately, that is, not sharing the input data buffer, it is also possible to perform differentiated control of data transmission between the network driver layer and the serial port driver device, and to achieve the purpose of data retransmission when data is lost, so that the reliability of data transmission can be further improved and the risk of data loss can be reduced;
[0127] Secondly, after the data to be processed is transferred to the input data buffer of the serial port driver device in the system kernel, the data reading mode of the kernel process can be triggered, so that the kernel process entering the data reading mode reads the data to be processed from the input data buffer of the serial port driver device. In this way, the data to be processed can be reliably transferred to the corresponding kernel process.
[0128] It is understandable that, in the above step S122, the specific method of transmitting the debugging monitoring response data to the network driver layer is not limited and can be selected according to actual needs.
[0129] For example, in an alternative implementation, the debug monitoring response data may be first transmitted to a serial port driver device (such as stored in an output data buffer corresponding to the serial port driver device), and then the debug monitoring response data may be transmitted to a network driver layer (such as stored in an output data buffer corresponding to the network driver layer) through a data transmission interface.
[0130] For example, in another alternative implementation, in order to improve the transmission efficiency of the debugging monitoring response data so that the corresponding equipment control efficiency can be further improved, the above-mentioned step S122 can further include step S122a, step S122b and step S122c, and the specific content of each step is described as follows.
[0131] Step S122a: Process the data to be processed by the kernel process, and determine whether corresponding debugging monitoring response data is generated based on the processing.
[0132] In an embodiment of the present application, after the data to be processed is transmitted to the kernel process, the data to be processed can be processed by the kernel process, and it is determined whether corresponding debugging monitoring response data is generated based on the processing.
[0133] Step S122b: when the kernel process processes the data to be processed and generates corresponding debugging monitoring response data, the debugging monitoring response data is transmitted to the output data buffer of the network driver layer.
[0134] In the embodiment of the present application, when the kernel process processes the data to be processed and generates corresponding debugging monitoring response data, on the one hand, the debugging monitoring response data can be directly transmitted to the output data buffer of the network driver layer.
[0135] Step S122c, when the kernel process processes the data to be processed and generates corresponding debugging monitoring response data, determines whether the output data buffer of the network driver layer is full, and when the output data buffer of the network driver layer is not full, transmits the debugging monitoring response data to the output data buffer of the network driver layer, or, when the output data buffer of the network driver layer is full, discards the debugging monitoring response data, or blocks the kernel process and waits until the output data buffer of the network driver layer is not full, and then transmits the debugging monitoring response data to the output data buffer of the network driver layer.
[0136] In the embodiment of the present application, when the kernel process processes the data to be processed and generates corresponding debugging monitoring response data, on the other hand, it can first determine whether the output data buffer of the network driver layer is full, and when the output data buffer of the network driver layer is not full, directly transfer the debugging monitoring response data to the output data buffer of the network driver layer, or, when the output data buffer of the network driver layer is full, directly discard the debugging monitoring response data, or block the kernel process (i.e., stop the data processing or data output of the kernel process), and wait until the output data buffer of the network driver layer is not full, and then transfer the debugging monitoring response data to the output data buffer of the network driver layer, so that data loss can be avoided, so that the transmission of the debugging monitoring response data has high reliability. It should be noted that since the communication rate of the network driver layer is generally much higher than the communication rate of the serial port driver device, even if the serial port driver device is not used for corresponding buffering, data conflicts and loss problems generally do not occur.
[0137] It should be noted that when executing step S122c, that is, when the debugging monitoring response data is directly transmitted to the network driver layer, the debugging monitoring response data can also be synchronously transmitted to the serial port driver device (such as Fig. 9 As shown), in this way, the configuration between the serial port driver device and the kernel process does not need to be changed, so that the change to the system kernel of the target operating system is as small as possible, thereby improving to a certain extent the problem that the operation of the system kernel is prone to failure due to large changes to the system kernel (for the target operating system, it generally has this configuration: the kernel process will transmit the debugging monitoring response data to the serial port driver device. The reason is that in the prior art, it is all based on the serial port driver device for regulation. Therefore, the inherent configuration must include transmitting the debugging monitoring response data to the serial port driver device).
[0138] It should be noted that when executing step S122c, that is, when the debugging monitoring response data is directly transmitted to the network driver layer, the debugging monitoring response data may not be transmitted to the serial port driver device, such as to reduce resource consumption caused by data transmission (copying) in the system kernel.
[0139] It should be noted that when the debug monitoring response data is directly transmitted to the network driver layer, it is not necessary to pass through the TCP / IP protocol stack in the system kernel. In other words, the copied debug monitoring response data can be directly stored in the output data buffer corresponding to the network driver layer. In this way, on the one hand, the communication rate of the debug monitoring response data can be improved. On the other hand, it can avoid the problem of an infinite loop caused by various calling operations after the debug monitoring response data enters the TCP / IP protocol stack. For example, the TCP / IP protocol stack itself may also have debug monitoring response data to output. In this way, the reliable operation of device control can be further guaranteed.
[0140] On the basis of the above content, it is necessary to further explain that, through the research of the inventor of this application, it is found that the serial port driver device completes initialization very quickly after the system is powered on and can output immediately, that is, the initialization completion time may be earlier than the initialization completion time of the network driver layer. During this period, the serial port can transmit some environmental parameters and initialization information and other output information (such as CPU, memory, flash and other initialization information) to the target control device, while the network driver layer cannot transmit these output information to the target control device. Therefore, for these output information, they can be first stored in the output buffer corresponding to the serial port driver device for caching, and then, after the network driver layer is initialized, these output information are transmitted to the network driver layer, so that these output information can be transmitted to the target control device through the network driver layer, thereby ensuring that the target control device can perform reliable device control based on these output information in the subsequent process, that is, it can avoid the problem of losing the output information of the system in the first few seconds after startup due to the failure of the network driver layer to initialize. Exemplarily, when caching these output information, corresponding timestamps can also be added, so that the target control device can determine the time of these output information based on the timestamp, so that more reliable processing can be performed in the subsequent process based on the time.
[0141] Thirdly, it should be noted that for step S130, the specific method of transmitting the debugging monitoring response data to the target control device through the network driver layer is not limited and can be selected accordingly according to actual needs.
[0142] For example, in an alternative implementation, when the network driver layer includes an Ethernet driver layer, the debug monitoring response data can be transmitted to the target control device through the Ethernet driver layer (an Ethernet driver) included in the network driver layer. Exemplarily, the Ethernet driver layer can call the corresponding interface function to transmit the debug monitoring response data to the target control device. For example, the interface function can be int ethOutput (char * data, int len), where the first parameter is a pointer to the beginning of the data and the second parameter is the data length. In addition, when outputting data, an Ethernet frame header, an IP packet header, a UDP packet header, a special service packet header, etc. can be added, and the output can be output using a broadcast destination address or a multicast destination address (including a destination IP address and a destination MAC, both of which are multicast addresses). If the data output at one time exceeds the length of the Ethernet frame limit, typically 1500 bytes, the data can be fragmented into multiple packets.
[0143] For example, in another alternative implementation, when the network driver layer includes a fiber optic transceiver packet driver layer, the debugging monitoring response data can be transmitted to the target control device through the fiber optic transceiver packet driver layer (a fiber optic transceiver packet driver program) included in the network driver layer.
[0144] For another example, in another alternative implementation, the network driver layer may also include an Ethernet driver layer and an optical fiber transceiver driver layer. Thus, the debugging monitoring response data may be transmitted to the target control device through the Ethernet driver layer and the optical fiber transceiver driver layer respectively.
[0145] Fourthly, it should be noted that for step S110, in order to ensure the reliable execution of the above-mentioned steps S110, S120 and S130, that is, to ensure the reliable regulation of the network device by the target regulation device, before step S110, the FTTR-based device regulation method may also include steps S101 and S102, and the specific contents of each step are described as follows.
[0146] Step S101, determining whether the system kernel has a serial port driver device.
[0147] In the embodiment of the present application, the network device can first determine whether the system kernel has a serial port driver device. Generally, the system kernel of the target operating system will be deployed with a serial port driver device, but considering the occurrence of some abnormal situations, the target operating system may not be deployed with a serial port driver device, so the corresponding confirmation can be performed first.
[0148] Step S102, when the system kernel does not have a serial port driver device, based on a pseudo terminal registration mechanism or a virtual serial port registration mechanism provided by the target operating system, register a virtual serial port in the system kernel and use the virtual serial port as a serial port driver device of the system kernel.
[0149] In an embodiment of the present application, when it is determined that the system kernel does not have a serial port driver device, in order to ensure reliable device control, the network device can register a virtual serial port in the system kernel based on a pseudo terminal registration mechanism or a virtual serial port registration mechanism provided by the target operating system, and use the virtual serial port as the serial port driver device of the system kernel. Among them, the serial port driver device is used to form a data transmission path between the network driver layer and the kernel process. Exemplarily, after the data transmission interface of the network driver layer is created, the data transmission interface can be attached to the virtual serial port (serial port driver device) to realize data transmission.
[0150] Exemplarily, the target operating system may be a Linux system, wherein the Linux system provides some tools and interfaces to manage and use the mechanism of registering pseudo terminals, for example, including:
[0151] / dev / ptmx and / dev / pts / X: / dev / ptmx is the master device, / dev / pts / X is the slave device, where X is the number of the slave device. User programs can open / dev / ptmx to obtain a new pseudo-terminal pair and communicate with it; ptmx_open() system call: This is a system call used to open the master device and obtain a new pseudo-terminal pair. In user space, you can use library functions such as open() to call this system call; forkpty() function: This is a library function used to create a child process on a new pseudo-terminal pair and run the specified program in the child process. It returns the file descriptor of the master device, allowing the parent process to communicate with the child process. ioctl() system call: Used to control the behavior of the pseudo-terminal, for example, setting terminal parameters and sending control characters.
[0152] Exemplarily, when the network device belongs to the master gateway, after receiving the data to be processed for regulating the slave gateway, the master gateway can forward the data to be processed to the corresponding slave gateway, and the slave gateway can have the configuration of the network device as described above, so that the data to be processed can be processed as described above in steps S110-S130 to achieve regulation of the slave gateway. In this way, in an application scenario where a master gateway is configured with multiple slave gateways, the regulation of the master gateway and each slave gateway can be achieved by only establishing a communication connection with the master gateway, so that the efficiency and convenience of regulation are also high.
[0153] Exemplarily, when the network device sends the debugging monitoring response data to the target control device, it can adopt the data packet form of ETHD as mentioned above. Among them, after sending the data packet, the network device will not release the cache of the data packet immediately, but will put the data packet into a queue of data to be confirmed (need to be released after the other party, such as the target control device, confirms or timeouts without confirmation), waiting for the target control device to confirm, and the confirmation can be confirmed according to the corresponding sequence number, that is, the network device and the target control device will carry their own and the other party's ETHD packet sequence number (as described above) in the process of sending and receiving data packets. In this way, it is convenient to perform efficient confirmation and retransmission, and avoid problems such as data packet loss. Among them, after the target control device receives the data packet sent by the network device, if the target control device has corresponding data to be fed back to the network device, the sequence number in the data packet sent by the network device and the data of the target control device can be sent to the network device as a payload. If the target control device does not have corresponding data to be fed back to the network device, it can only send a confirmation ETHD packet to the network device. Among them, the confirmation ETHD packet is an ETHD packet without a payload, and the payload length field is filled with 0.
[0154] Exemplarily, when the network device is receiving a data packet (such as data to be processed, etc.) sent by the target control device, if it is found that the sequence number of the data packet of the target control device is discontinuous, this indicates that packet loss has occurred, and it is necessary to initiate a retransmission request packet, fill in the sequence number of the lost packet in the retransmission request packet, and configure the FLAG flag requiring retransmission. After receiving the data packet requested to be retransmitted by the network device, the target control device can search for a packet matching the sequence number of the retransmission in the queue to be confirmed. If there is a matching packet, it will be sent out, and the sequence number will be filled in as the retransmission sequence number. If there is no matching packet, respond with an ETHD packet without a payload, a payload length of 0, and a FLAG flag of permanent loss. In addition, when the target control device receives a data packet sent by the network device (such as debugging monitoring response data, etc.), it can also perform corresponding processing.
[0155] Exemplarily, in order to ensure the security of data interaction between the network device and the target control device, the network device can also authenticate the target control device first. For example, when the target control device sends the first data packet, the authentication identification bit can be filled in the FLAG flag field in the ETHD header of the data packet, and then the password is filled in the payload. If the network device determines that the password in the data packet is consistent with the password configured on the network device after receiving the data packet, subsequent interaction is allowed, otherwise it will not respond to any request for the ETHD function of the target control device. This is just a simple authentication mechanism. Based on certain requirements, RSA (Rivest-Shamir-Adleman, an asymmetric encryption algorithm) public key (Public Key) private key (Private Key), random number (RandomNumber), challenge (challenge is a method in the authentication process to verify the identity of the other party. Usually, the server will send a randomly generated challenge to the client. The client needs to respond to this challenge with its key or other credentials, and the server verifies its identity based on the client's response), etc., which will not be repeated here.
[0156] For example, since in an embodiment of the present application, the device control between the target control device and the network device is implemented based on the network driver layer, during the startup process of the network device, the network driver layer needs to be initialized as early as possible, otherwise, the data sent by the target control device may be easily lost.
[0157] Combination Fig.10 The embodiment of the present application also provides a FTTR-based device control device applicable to the above network device. The FTTR-based device control device may include a data receiving module, a data processing module and a data transmission module.
[0158] The data receiving module is used to receive the to-be-processed data sent by the target control device through the network driver layer, wherein a communication connection is established between the target control device and the network device based on the network hardware device corresponding to the network driver layer. Figure 2 As shown in step S110, the relevant contents of the data receiving module can refer to the above description of step S110.
[0159] The data processing module is used to transmit the data to be processed to the kernel process through the network driver layer when the data to be processed is debugging monitoring data, and to process the data to be processed through the kernel process, and when corresponding debugging monitoring response data is generated based on the processing, transmit the debugging monitoring response data to the network driver layer. Figure 2 As shown in step S120, the relevant contents of the data processing module can refer to the above description of step S120.
[0160] The data transmission module is used to transmit the debugging monitoring response data to the target control device through the network driver layer. In the embodiment of the present application, the data transmission module can be used to execute Figure 2 As shown in step S130, the relevant contents of the data transmission module can refer to the above description of step S130.
[0161] For example, in an alternative implementation, the FTTR-based equipment control device may further include other modules, which may be used to:
[0162] Determine whether the system kernel has a serial port driver device;
[0163] When the system kernel does not have a serial port driver device, based on a pseudo terminal registration mechanism or a virtual serial port registration mechanism provided by the target operating system, a virtual serial port is registered in the system kernel, and the virtual serial port is used as a serial port driver device of the system kernel, wherein the serial port driver device is used to form a data transmission path between the network driver layer and the kernel process.
[0164] In an embodiment of the present application, corresponding to the above-mentioned FTTR-based device control method applied to the network device, a computer-readable storage medium is also provided, in which a computer program is stored, and when the computer program is run, each step of the FTTR-based device control method is executed.
[0165] Among them, the steps executed when the aforementioned computer program is running will not be described one by one here, and reference can be made to the explanation of the FTTR-based device control method in the previous article.
[0166] In summary, the FTTR-based device control method and device provided by the present application can, firstly, receive the data to be processed sent by the target control device through the network driver layer; secondly, when the data to be processed belongs to the debugging monitoring data, the data to be processed can be transmitted to the kernel process through the network driver layer, and the data to be processed can be processed by the kernel process, and when the corresponding debugging monitoring response data is generated based on the processing, the debugging monitoring response data is transmitted to the network driver layer; then, the debugging monitoring response data can be transmitted to the target control device through the network driver layer. Based on the above content, since the corresponding device control is performed through the network driver layer, it is only necessary to establish a communication connection between the target control device and the network device based on the network hardware device corresponding to the network driver layer, and it is not necessary to establish a communication connection between the target control device and the network device based on the serial port hardware device corresponding to the serial port driver device (the serial port hardware device is generally configured inside the network device), that is, it is not necessary to operate the structure such as the housing of the network device (such as opening the housing, turning off the power, etc.), therefore, due to the improvement of the convenience of operation, the corresponding control efficiency can be improved, thereby improving the problem of relatively low control efficiency existing in the existing device control technology.
[0167] In several embodiments provided in the embodiments of the present application, it should be understood that the disclosed device and method can also be implemented in other ways. The device and method embodiments described above are merely schematic, for example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the device, method and computer program product according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0168] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0169] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, electronic device, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code. It should be noted that in this article, the term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such process, method, article or device. Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.
[0170] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A device control method based on FTTR, characterized in that: Applied to a network device, a target operating system is deployed on the network device, and a system kernel of the target operating system has a kernel process and a network driver layer. The FTTR-based device control method includes: Receiving the data to be processed sent by the target control device through the network driver layer, wherein a communication connection is established between the target control device and the network device based on the network hardware device corresponding to the network driver layer; When the data to be processed is debugging monitoring data, the data to be processed is transmitted to the kernel process through the network driver layer, and the data to be processed is processed through the kernel process, and when corresponding debugging monitoring response data is generated based on the processing, the debugging monitoring response data is transmitted to the network driver layer; Transmitting the debugging monitoring response data to the target control device through the network driver layer; The step of receiving the data to be processed sent by the target control device through the network driver layer includes: Communicate and interact with other network devices through the network driver layer to determine the private multicast group of the network device and each of the other network devices, and determine a public multicast group including the network device and each of the other network devices, wherein the addresses of the private multicast groups of the network device and each of the other network devices are determined based on at least the MAC addresses of the network device and each of the other network devices; Receiving, through the network driver layer, device online query request information sent by the target control device, wherein the device online query request information belongs to a multicast packet, and the target control device transmits the device online query request information to the public multicast group based on the multicast technology; Generate corresponding device related information in response to the device online query request information, wherein the device related information at least includes the private multicast group of the network device, and each other network device is used to generate corresponding device related information in response to the device online query request information; The device-related information is transmitted to the target control device through the network driver layer, wherein the device-related information belongs to a multicast packet, and the network driver layer transmits the device-related information to the public multicast group based on the multicast technology, and each other network device transmits the corresponding device-related information to the target control device through its own network driver layer; The data to be processed sent by the target regulation device is received through the network driver layer, wherein the target regulation device is used to transmit the data to be processed to a private multicast group corresponding to the device related information of the device after determining the device that needs to be regulated.
2. The FTTR-based device control method according to claim 1, characterized in that: When the data to be processed is debugging monitoring data, the steps of transmitting the data to be processed to the kernel process through the network driver layer, and processing the data to be processed through the kernel process, and when corresponding debugging monitoring response data is generated based on the processing, transmitting the debugging monitoring response data to the network driver layer include: When the data to be processed belongs to debugging monitoring data, the data to be processed is transmitted to the serial port driver device in the system kernel through the data transmission interface pre-created on the network driver layer, and the data to be processed is transmitted to the kernel process through the serial port driver device, wherein, after the data transmission interface is created on the network driver layer, the data transmission interface is also mounted on the serial port driver device, so that the data transmission interface is used to construct a data transmission path between the network driver layer and the serial port driver device; The data to be processed is processed by the kernel process, and when corresponding debugging monitoring response data is generated based on the processing, the debugging monitoring response data is transmitted to the network driver layer.
3. The FTTR-based device control method according to claim 2, characterized in that: When the data to be processed is debugging monitoring data, the step of transmitting the data to be processed to a serial port driver device in the system kernel through a data transmission interface pre-created on the network driver layer, and transmitting the data to be processed to the kernel process through the serial port driver device includes: After receiving the data to be processed, the network driver layer parses the data to be processed to determine whether the data to be processed belongs to debugging monitoring data, and determines whether the data transmission interface pre-created on the network driver layer is in an open state; When the data to be processed belongs to debugging monitoring data and the data transmission interface is in an open state, the data to be processed is transmitted to a serial port driver device in the system kernel through the data transmission interface, and the data to be processed is transmitted to the kernel process through the serial port driver device; When the data to be processed belongs to debugging monitoring data and the data transmission interface is not in an open state, the data transmission interface is opened, and the data to be processed is transmitted to a serial port driver device in the system kernel through the opened data transmission interface, and the data to be processed is transmitted to the kernel process through the serial port driver device; When the data to be processed does not belong to debugging monitoring data and the data transmission interface is in an open state, the data to be processed is not transmitted to the serial port driver device in the system kernel, and the data transmission interface is closed so that the data transmission interface is not in an open state; When the data to be processed does not belong to debugging monitoring data and the data transmission interface is not in an open state, the data to be processed is not transmitted to the serial port driver device in the system kernel.
4. The FTTR-based device control method according to claim 3, characterized in that: When the data to be processed belongs to debugging monitoring data and the data transmission interface is in an open state, the step of transmitting the data to be processed to a serial port driver device in the system kernel through the data transmission interface, and transmitting the data to be processed to the kernel process through the serial port driver device includes: When the data to be processed belongs to debugging monitoring data and the data transmission interface is in an open state, the data to be processed stored in the input data buffer of the network driver layer is transmitted to the input data buffer of the serial port driver device in the system kernel through the data transmission interface; After the data to be processed is transferred to the input data buffer of the serial port driver device in the system kernel, the data reading mode of the kernel process is triggered, so that the kernel process entering the data reading mode reads the data to be processed from the input data buffer of the serial port driver device.
5. The FTTR-based equipment control method according to claim 2, characterized in that: The step of processing the data to be processed by the kernel process and transmitting the debugging monitoring response data to the network driver layer when corresponding debugging monitoring response data is generated based on the processing includes: Processing the data to be processed by the kernel process, and determining whether corresponding debugging monitoring response data is generated based on the processing; When the kernel process processes the data to be processed and generates corresponding debugging monitoring response data, the debugging monitoring response data is transmitted to the output data buffer of the network driver layer; or When the kernel process processes the data to be processed and generates corresponding debugging monitoring response data, it is determined whether the output data buffer of the network driver layer is full, and when the output data buffer of the network driver layer is not full, the debugging monitoring response data is transmitted to the output data buffer of the network driver layer, or, when the output data buffer of the network driver layer is full, the debugging monitoring response data is discarded, or the kernel process is blocked and waits until the output data buffer of the network driver layer is not full, and then the debugging monitoring response data is transmitted to the output data buffer of the network driver layer.
6. The FTTR-based device control method according to claim 1, characterized in that: The step of receiving the data to be processed sent by the target control device through the network driver layer includes: Receiving the data to be processed sent by the target control device through the Ethernet driver layer included in the network driver layer, wherein the network device establishes a communication connection with the target control device based on the Ethernet hardware device corresponding to the Ethernet driver layer; and / or, The optical fiber receiving and transmitting packet driver layer included in the network driver layer receives the data to be processed sent by the target control device, wherein the network device establishes a communication connection with the target control device based on the optical fiber network hardware device corresponding to the optical fiber receiving and transmitting packet driver layer.
7. The FTTR-based device control method according to claim 1, characterized in that: The step of receiving the data to be processed sent by the target control device through the network driver layer includes: Receiving, through the network driver layer, device online query request information sent by the target control device, wherein the target control device remotely sends the device online query request information to the network driver layer based on unicast technology; Performing multicast conversion processing on the device online query request information to obtain converted device online query request information, wherein the device online query request information belongs to a unicast packet and the converted device online query request information belongs to a multicast packet; The online query request information of the conversion device is transmitted to the target multicast group through the network driver layer, and the device related information sent by each multicast network device in the target multicast group in response to the online query request information of the conversion device is received, wherein the network driver layer transmits the online query request information of the conversion device based on the multicast technology, and the multicast network device transmits the device related information based on the multicast technology; Performing unicast conversion processing on the device related information to obtain converted device related information, wherein the device related information belongs to a multicast packet and the converted device related information belongs to a unicast packet; The conversion device related information is sent to the target control device through the network driver layer, wherein the target control device is used to generate corresponding to-be-processed data based on the conversion device related information corresponding to the device after determining the device to be regulated; The network driver layer receives the data to be processed sent by the target control device, wherein the target control device remotely sends the data to be processed to the network driver layer based on unicast technology, and the network driver layer is also used to transmit the data to be processed converted into multicast packets to the target multicast group based on multicast technology, and the multicast network devices in the target multicast group are used to perform corresponding control operations based on the received data to be processed.
8. The FTTR-based device control method according to any one of claims 1 to 7, characterized in that: Before the step of receiving the data to be processed sent by the target control device through the network driver layer, the FTTR-based device control method further includes: Determine whether the system kernel has a serial port driver device; When the system kernel does not have a serial port driver device, based on a pseudo terminal registration mechanism or a virtual serial port registration mechanism provided by the target operating system, a virtual serial port is registered in the system kernel, and the virtual serial port is used as a serial port driver device of the system kernel, wherein the serial port driver device is used to form a data transmission path between the network driver layer and the kernel process.
9. A device control device based on FTTR, characterized in that: Applied to a network device, a target operating system is deployed on the network device, a system kernel of the target operating system has a kernel process and a network driver layer, and the FTTR-based device control device includes: A data receiving module, used for receiving the to-be-processed data sent by the target control device through the network driver layer, wherein a communication connection is established between the target control device and the network device based on the network hardware device corresponding to the network driver layer; a data processing module, configured to, when the data to be processed is debugging monitoring data, transmit the data to be processed to the kernel process through the network driver layer, and, when the data to be processed is debugging monitoring data, transmit the debugging monitoring response data to the network driver layer, processing the data to be processed through the kernel process, and when corresponding debugging monitoring response data is generated based on the processing; A data transmission module, used for transmitting the debugging monitoring response data to the target control device through the network driver layer; The receiving of the to-be-processed data sent by the target control device through the network driver layer includes: Communicate and interact with other network devices through the network driver layer to determine the private multicast group of the network device and each of the other network devices, and determine a public multicast group including the network device and each of the other network devices, wherein the addresses of the private multicast groups of the network device and each of the other network devices are determined based on at least the MAC addresses of the network device and each of the other network devices; Receiving, through the network driver layer, device online query request information sent by the target control device, wherein the device online query request information belongs to a multicast packet, and the target control device transmits the device online query request information to the public multicast group based on the multicast technology; Generate corresponding device related information in response to the device online query request information, wherein the device related information at least includes the private multicast group of the network device, and each other network device is used to generate corresponding device related information in response to the device online query request information; The device-related information is transmitted to the target control device through the network driver layer, wherein the device-related information belongs to a multicast packet, and the network driver layer transmits the device-related information to the public multicast group based on the multicast technology, and each other network device transmits the corresponding device-related information to the target control device through its own network driver layer; The data to be processed sent by the target regulation device is received through the network driver layer, wherein the target regulation device is used to transmit the data to be processed to a private multicast group corresponding to the device related information of the device after determining the device that needs to be regulated.
Citation Information
Patent Citations
Remote program debugging method, device and server
CN108804313A
Serial port and Ethernet drive flow control method, drive layer, serial port server and system
CN115550435A
