Lua-based ONU default configuration method
Patent Information
- Application Number
- CN202211407978.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-10
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2042-11-10
AI Technical Summary
During the development of ONU devices, the default configuration methods of different SDK platforms vary greatly, which requires developers to spend a lot of time and effort to manually modify the default configuration of the devices to meet the needs of operators. This is especially true when switching SDK platforms, where the configuration process is complex and inefficient.
Employing a Lua-based configuration translator, it automatically converts generic configurations into device-specific configurations using a unified Lua table file and translation template. This simplifies the default configuration process for different SDK platforms, allowing developers to edit the Lua file only once for use across all SDK platforms.
It unifies the default configuration methods for devices on different SDK platforms, simplifies the configuration steps for developers, improves development efficiency, reduces repetitive work, and enhances the flexibility and consistency of configuration.
Smart Images

Figure CN115718616B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ONU device technology, and specifically to a default ONU configuration method based on Lua. Background Technology
[0002] ONU devices often involve various chip solutions and SDKs (Software Development Kits). During software development, it is frequently necessary to modify the device's default configuration to meet the customization requirements of different operators. However, the default configuration settings vary depending on the chip solution and SDK used.
[0003] Taking a specific Realtek SDK as an example, Figure 1 This indicates that its default configuration is loaded. From Figure 1 As you can see, Realtek SDK's default configuration primarily relies on default values in the code and an additional XML file to determine the default settings. This additional XML file only contains the parts that differ from the default values in the code. For some special customizations, such as WAN configurations, because they involve issues like MAC address allocation (which requires the code to call the MAC address allocation algorithm), these configurations often require modifying the code to set the default settings.
[0004] Taking a certain ZXIC SDK as an example, the default configuration of this SDK is accomplished by loading an encrypted XML file. Unlike the Realtek SDK, this XML file directly contains the default configuration of all system parameters.
[0005] In addition to the loading method, the default configurations of the ZXIC SDK and Realtek SDK often have significantly different parameter names for the same function. Developers switching between SDKs frequently have to spend extra time looking up the corresponding parameter names to modify the default configuration.
[0006] Given the aforementioned background and the increasing number of SDKs being maintained, due to the differences in default configuration methods among different SDKs, developers often need to spend a lot of effort manually modifying the default configuration of the devices to meet the needs of different operators when developing customized solutions.
[0007] With the existing default configuration, developers still have to spend time editing a dedicated XML configuration file for each SDK platform they switch to, even when facing the same functional requirements. Summary of the Invention
[0008] In view of this, in order to solve the above-mentioned problems in the prior art, this invention proposes a Lua-based ONU default configuration method. By loading the default configuration through a configuration translator, the default configuration method of all SDK platform devices is unified. Developers only need to edit a Lua table file containing the default configuration to complete the default configuration settings of all SDK platform devices.
[0009] The present invention solves the above problems through the following technical means:
[0010] A default ONU configuration method based on Lua includes the following steps:
[0011] Connect the ONU device to a power source and power it on. After the ONU device completes the most basic initialization work, the configuration translator is activated by the Linux startup script.
[0012] After the configuration translator reads the 'General Configuration' file from the specified flash partition, it converts the read 'General Configuration' into 'Device Configuration', and finally the configuration translator loads the 'Device Configuration' into the system.
[0013] The system will use the newly loaded 'device configuration' to complete the subsequent system initialization work. After initialization is complete, the system will start up.
[0014] Preferably, in the general configuration, regardless of which SDK the device is developed under, their default configuration for the same functional requirements is exactly the same.
[0015] Preferably, in the device configuration, the original parameter names and parameter values of the device are used to describe the default configuration, that is, the parameter names and parameter values are consistent with the parameter names and parameter values in the default configuration XML file of the original method.
[0016] Preferably, the configuration translator reads the general configuration, converts the general configuration into a device-specific configuration based on the current device model or capability value, and completes the loading of the device configuration by calling the device-related C language interfaces or commands through the translator.
[0017] Preferably, both the general configuration and the device configuration are Lua files, each containing a Lua table containing specific configuration items.
[0018] Preferably, after the configuration translator reads the 'general configuration' file from the specified flash partition, it converts the read 'general configuration' into 'device configuration', and finally the configuration translator loads the 'device configuration' into the system. This process includes the following steps:
[0019] After the translator is started, it will load the Lua scripts used for translation work in the specified path. At the same time, it will import the C language interfaces required for the translation process into the Lua scripts as Lua modules.
[0020] After the script is loaded, it first checks whether a certain parameter in the flash parameter area is the default value. If it is, the parameter is modified to a different value before proceeding with the subsequent loading work; otherwise, the translation work ends.
[0021] During translation, the Lua script loads the general configuration from the specified path, then obtains the device model of the currently running device through some firmware information automatically generated during the compilation process; the Lua script obtains the translation template of the configuration through the device model; then, the Lua script traverses the Lua table of the general configuration, calls the specific method of the translation template according to the configuration type, and the method contains the specific mapping relationship between the general configuration and the device configuration, and converts the general configuration into the device configuration through a self-written expression parsing tool;
[0022] After the conversion is complete, the configuration translator first obtains all parameters of the current system through system instructions, generates a 'parameter type table' based on the information provided by the instructions, then iterates through the parameters in the device configuration, calls different instructions to set the parameters into the system according to the type of the parameter in the 'parameter type table', and finally calls the C language interface module to supplement the completed configuration as needed.
[0023] Preferably, parameters are divided into two types: chain type and table type. A table type parameter is a single parameter, while a chain type contains multiple parameters. During configuration, the table type does not require a parameter index, while the chain type requires an index value to specify which chain to configure. For adding parameters, the chain type also needs to call some instructions to add an empty chain parameter before performing a set operation. When the configuration translator is translating, it needs to look up the parameter type table to find the parameter type and then perform different operations based on the different parameter types.
[0024] Preferably, the translation template includes a mapping relationship between general configuration and device configuration parameter names and values, as well as a mapping conversion method.
[0025] Compared with the prior art, the beneficial effects of the present invention include at least the following:
[0026] This invention eliminates the need for developers to consider SDK platform differences when customizing default configurations. When facing different operator requirements, developers only need to edit a single Lua table file and insert it into the firmware of each SDK platform device to modify the default configuration. This standardizes the default configuration setting method, simplifies the steps for developers, and improves development efficiency. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a flowchart of the default configuration loading process for a certain Realtek SDK in existing technology;
[0029] Figure 2 This is a flowchart of the ONU default configuration method based on Lua according to the present invention;
[0030] Figure 3 This is a basic flowchart of the translator configuration process of the present invention;
[0031] Figure 4 This is a flowchart illustrating the practical application of the ONU default configuration method in Lua of this invention;
[0032] Figure 5 This is the device selection page in the embodiment;
[0033] Figure 6 This is the settings page of the default configuration in the embodiment. Detailed Implementation
[0034] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the technical solutions of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the described embodiments are merely some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0035] like Figure 2 As shown, this invention provides a default configuration method for an ONU based on Lua. The ONU device uses the Linux operating system and includes the following steps:
[0036] S1. Connect the ONU device to a power source and power it on. After the ONU device completes the most basic initialization tasks such as the file system and flash driver, the configuration translator is activated by the Linux startup script.
[0037] S2. After the configuration translator reads the 'General Configuration' file in the specified flash partition, it converts the read 'General Configuration' into 'Device Configuration', and finally the configuration translator loads the 'Device Configuration' into the system.
[0038] S3. After that, the system will use the newly loaded 'device configuration' to complete the subsequent system initialization work (such as WLAN, PON, etc.). After initialization is complete, the system will start up.
[0039] This invention introduces the following concepts:
[0040] 1. General (Default) Configuration: Regardless of the SDK used to develop the device, the general configuration is exactly the same for devices with the same functional requirements. Parameter names and values are written in easy-to-understand text, such as using 'enable' or 'disable' instead of 1 or 0 as parameter values.
[0041] 2. Device (Default) Configuration: The default configuration is described using the original parameter names and values of the device, that is, the parameter names and values are consistent with the parameter names and values in the default configuration XML file of the original method.
[0042] 3. Configuration Translator: Reads the general configuration, converts it into a device-specific configuration based on the current device model or capability value, and uses the translator to call the relevant C language interfaces or commands of the device to complete the loading of the device configuration.
[0043] Developers need to pre-edit a 'generic configuration' and compile it into the device firmware.
[0044] Both general configuration and device configuration are Lua files, which contain a Lua table containing specific configuration items.
[0045] like Figure 3 As shown, the basic workflow for configuring a translator is as follows:
[0046] S21. After the translator is started, it will load the Lua scripts used for translation work in the specified path. At the same time, it will import the C language interfaces required for the translation process into the Lua scripts as Lua modules.
[0047] S22. After the script is loaded, first check if a certain parameter in the flash parameter area is the default value. If it is, modify the parameter to a different value before proceeding with the subsequent loading work; otherwise, end the translation work.
[0048] S23. During translation, the Lua script loads the general configuration from the specified path and then obtains the device model of the currently running device through some firmware information automatically generated during compilation. The Lua script obtains the translation template of the configuration based on the device model. Next, the Lua script traverses the Lua table of the general configuration and calls the specific method of the translation template according to the configuration type (such as WAN type, LAN type, WLAN type, etc.). The method contains the specific mapping relationship between the general configuration and the device configuration, and the general configuration is converted into the device configuration through a self-written expression parsing tool.
[0049] S24. After the conversion is complete, the configuration translator first obtains all parameters of the current system through system commands, generates a 'parameter type table' based on the information provided by the commands, then iterates through the parameters in the device configuration, and calls different commands to set the parameters into the system according to the type corresponding to the parameter in the 'parameter type table'. Finally, it calls the C language interface module to supplement the completed configuration as needed.
[0050] On any SDK platform, there are basic parameters for acquisition and setting. Knowing only the device's parameter name, index, and value is sufficient to correctly set the required parameters into the system. The configuration translator begins translating and configuring parameters immediately after the system's file system and flash driver are initialized. This ensures that once the system has fully booted, it operates with the translated configuration.
[0051] 'Parameter Type Table' Explanation: Parameters are generally divided into two types: chain type and table type (unrelated to Lua tables). A table type parameter is a single parameter, while a chain type contains multiple parameters. During configuration, table types do not require parameter indexes, while chain types require index values to specify which chain to configure. For adding parameters, chain types also require calling some instructions to add an empty chain parameter before performing the set operation. In summary, a 'parameter type table' is needed to query parameter types and then perform different operations based on different parameter types.
[0052] 'Translation Template' Description: It mainly includes the mapping relationship between general configuration and device configuration parameter names and values, as well as the conversion method of the mapping.
[0053] The present invention will now be described in detail with specific embodiments.
[0054] To reduce the flash memory usage of the ONU device, in this embodiment, the translation step of converting 'general configuration' to 'device configuration' is implemented outside the device. That is, the developer only needs to put the converted 'device configuration' into the device, and the device's configuration translator will load the 'device configuration'.
[0055] In this embodiment, the translator is configured in two parts: one part is placed on a web server outside the ONU device, and the other part is placed on the ONU device.
[0056] The web server provides a configuration page for operators or developers. Users configure the desired default device settings on the web page. The web server backend converts the JSON data submitted by the frontend into a general configuration in Lua table format, and then calls the backend Lua translator to convert the general configuration into the device configuration based on the device type.
[0057] like Figure 4 As shown, the specific implementation steps are as follows:
[0058] S1. Open the Web configuration page. The Web server will retrieve a list of supported devices from the backend, containing detailed information about each device. Based on this device list, the Web server will generate the following... Figure 5 The device selection page. Each selection includes the device model name and capability values (number of 100Mbps ports, number of Gigabit ports, number of telephone ports, 5G support, 2.4G support, etc.).
[0059] S2. After selecting a specific device, the backend will record the device model currently being operated on. The frontend will retrieve the configured information (general configuration) for that device model from the backend and display it as follows: Figure 6 On the page, you can edit the default configuration as needed. The configured default configuration is displayed below; clicking on it will show the detailed configuration page.
[0060] S3. When configuration is required, the user selects according to their needs. Figure 6 The configuration is done for a specific sub-item. The frontend will pass the configuration to the backend in either URL-encoded or JSON format, and the backend will then pass the configuration, converted to a JSON string, along with the device type, to the configuration translator (Lua API).
[0061] S4. The configuration translator converts the JSON string into a Lua table and then reads it. Next, the configuration translator selects a translation template based on the input device type. In addition to the basic general configuration and device configuration mapping, the translation template includes specific configuration checks (format or numerical range checks, etc.) to ensure the accuracy of the configured information. After the checks pass, the configuration conversion is performed. Finally, the configuration translator updates the sub-item configuration in the general configuration and also updates its corresponding device configuration. After the Lua API returns, the frontend can retrieve the configured information again to see the new configuration.
[0062] After the S5 and Web operations are completed, the generated device configuration is compiled into the ONU device firmware. This firmware is burned into the device at the factory. Upon first power-on, after basic system initialization, the configuration translator runs. Once the configuration translator confirms it's the first system boot, it first obtains all current system parameters via system commands, categorizes the parameters by type based on the information provided by the commands, then iterates through the device configuration, calling different commands according to the parameter type to set the device configuration parameters into the system flash. The system then continues its initialization process based on the parameters in the flash until the system boots up completely.
[0063] This invention eliminates the need for developers to consider SDK platform differences when customizing default configurations. When facing different operator requirements, developers only need to edit a single Lua table file and insert it into the firmware of each SDK platform device to modify the default configuration. This standardizes the default configuration setting method, simplifies the steps for developers, and improves development efficiency.
[0064] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A default configuration method for ONU based on Lua, characterized in that, Includes the following steps: Connect the ONU device to a power source and power it on. After the ONU device completes the most basic initialization work, the configuration translator is activated by the Linux startup script. After the configuration translator reads the 'General Configuration' file from the specified flash partition, it converts the read 'General Configuration' into 'Device Configuration', and finally the configuration translator loads the 'Device Configuration' into the system. The system will use the newly loaded 'device configuration' to complete the subsequent system initialization work. After initialization is complete, the system will start up. Once the translator is started, it loads the Lua scripts used for translation work from the specified path. The translator will import the C language interfaces required for the translation process into the Lua scripts as Lua modules. After the script is loaded, it checks whether a certain parameter in the flash parameter area is a default value. If it is, the parameter is modified to a different value before proceeding with the subsequent loading work; otherwise, the translation work ends. During translation, the Lua script loads the general configuration from the specified path and obtains the device model of the currently running device by using some firmware information automatically generated during the compilation process. The Lua script then obtains the translation template of the configuration based on the device model. The Lua script traverses the Lua table of the general configuration and calls the specific method of the translation template according to the configuration type. The specific method of the translation template includes the mapping relationship between the general configuration and the device configuration parameter names and values, as well as the mapping conversion method. Finally, it uses an expression parsing tool to convert the general configuration into the device configuration. After the conversion is complete, the configuration translator first obtains all parameters of the current system through system instructions, generates a "parameter type table" based on the information provided by the instructions, then iterates through the parameters in the device configuration, calls different instructions to set the parameters into the system according to the type of the parameter in the "parameter type table", and then calls the C language interface module to supplement the completed configuration as needed. The parameters are divided into chain type and table type. A table type parameter is a single parameter, while a chain type contains multiple parameters. During configuration, the table type does not require a parameter index, while the chain type requires an index value to specify which chain to configure. For adding parameters, the chain type calls the instruction to add an empty chain parameter before performing the set operation.
2. The ONU default configuration method based on Lua according to claim 1, characterized in that, In the general configuration, regardless of which SDK the device is developed under, their default configuration for the same functional requirements is exactly the same.
3. The ONU default configuration method based on Lua according to claim 1, characterized in that, In the device configuration, the original parameter names and parameter values of the device are used to describe the default configuration, that is, the parameter names and parameter values are consistent with the parameter names and parameter values in the default configuration XML file of the original method.
4. The ONU default configuration method based on Lua according to claim 1, characterized in that, The configuration translator reads the general configuration and converts it into a device-specific configuration based on the current device's model or capability value. The translator then calls the relevant C language interfaces or commands to load the device configuration.
5. The ONU default configuration method based on Lua according to claim 1, characterized in that, Both the general configuration and the device configuration are Lua files, which contain a Lua table containing specific configuration items.
Citation Information
Patent Citations
Method and device for configuring ONU product factory setting according to different manufacturers
CN106648774A
