A configuration method, device, equipment and storage medium
The configuration files written in the general writing protocol automatically modify the parameters of Wi-Fi routers, solving the problem of inefficient configuration and testing routers of different brands in the existing technology, and achieving an efficient and easy-to-maintenance automated testing process.
Patent Information
- Application Number
- CN202111327762.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-10
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-11-10
AI Technical Summary
The methods of configuring and testing Wi-Fi routers of different brands or types in the prior art are inefficient and require special developers to maintain and update script programs. The threshold is high, which affects the popularity and efficiency of automated testing.
The configuration file written using a general writing protocol can obtain control instructions by parsing the configuration file, automatically modify router parameters, strip away the selection and parameter modification of complex function items, separate it from the software execution script program, and ordinary testers can also participate in the writing of automated use cases. and execute.
It reduces development costs, improves the efficiency of automated testing, simplifies router configuration and maintenance, reduces the adaptation threshold for different models of routers, and realizes configuration flexibility and easy maintenance.
Smart Images

Figure CN114090117B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of wireless communications and relates to a configuration method, device, equipment and storage medium. Background Art
[0002] Wi-Fi is a wireless local area network technology based on the IEEE 802.11 standard. Within the effective range of the radio wave coverage of the Wi-Fi router (also called a wireless router), various terminals can communicate through wireless connection. At present, there are various brands or types of Wi-Fi routers on the market. Various brands or types of Wi-Fi routers are widely used in Wi-Fi performance testing of various smart electronic products. In the prior art, there are usually two methods for configuring and completing performance testing of various brands or types of Wi-Fi routers:
[0003] 1. Manual operation: log in to the Wi-Fi router administrator interface through the browser, complete the configuration of each option, save and exit. Then, perform various Wi-Fi performance tests on smart electronic products through the Wi-Fi router. After completing a round of compatibility tests on one brand or type of Wi-Fi router, change to another brand or type of Wi-Fi router and repeat this operation.
[0004] 2. Automatic operation: execute the script program through the automatic control software developed in advance based on Selenium (a tool for Web application testing), automatically log in to the Wi-Fi router administrator interface, automatically configure and modify related parameters, save and exit after completing the configuration of various parameter options of the Wi-Fi router. Then, start the Wi-Fi performance test of smart electronic products. Similarly, after completing the compatibility test of a brand or type of Wi-Fi router, change to connect to another brand or type of Wi-Fi router. However, at this time, it is necessary to replace or call the new Wi-Fi router software to execute the script program, run the new script program to complete the configuration of different brands or types of Wi-Fi routers, and then repeat the product compatibility test operation.
[0005] There are many brands or types of Wi-Fi routers on the market. The manual configuration of Wi-Fi routers is inefficient. The above-mentioned automatic control software execution script program configures Wi-Fi routers. Different brands or types of Wi-Fi routers have different design schemes from different manufacturers. The maintenance and development workload of the software execution script program dedicated to the emerging new Wi-Fi routers is very large. Moreover, every time a new test requirement comes, a dedicated automation developer is required to update the adaptation script program of the Wi-Fi router. The threshold is high and it is not conducive to maintenance, which seriously affects the popularity and efficiency of automated testing. Summary of the invention
[0006] The purpose of the present invention is to provide a configuration method, device, equipment and storage medium, which can separate the configuration intentions such as the selection of various complex function items and parameter modification in the configuration of the router from the software execution script program, so as to ensure the stability of the adaptation script program of the router and the simple and convenient maintenance of the adaptation script, and at the same time enable ordinary testers to participate in the writing and execution of automated use cases, so as to give full play to the power of the team. The method, device, equipment and storage medium for configuring a router provided by the present invention can achieve the goal of not requiring specialized developers to modify the software execution script program, and ordinary testers can easily complete the configuration of each router, thereby improving the efficiency of the overall automated testing work and reducing development costs.
[0007] The purpose of the present invention and the solution to the technical problem are achieved by adopting the following technical solutions.
[0008] According to one aspect of the present invention, the method for configuring a router proposed in the present invention includes: obtaining a configuration file of a device to be configured, wherein the configuration file is written based on a general writing protocol; parsing the configuration file to obtain one or more control instructions; and modifying parameters of the device to be configured based on the one or more control instructions.
[0009] According to another aspect of the present invention, the device to be configured includes a router, and the configuration file includes definitions of multiple functional items for configuring the router, and the definition of each functional item is written based on a general writing protocol.
[0010] According to another aspect of the present invention, the universal writing protocol includes 6 standard fields and 1 optional field, wherein the standard fields are: field 1, field 2, field 3, field 4, field 5 and field 7; and the optional field is field 6.
[0011] Among them, the first field includes the start identifier, the second field includes the operation command, the third field includes the operation parameters, the fourth field includes the execution command, the fifth field includes the first delay time, the sixth field includes the second delay time and / or command parameters, and the seventh field includes the description of the function item.
[0012] The starting identifier of the first field includes the operation sequence number; the operation command of the second field includes a page element positioning command, a data selector data list construction command and a direct login to the target page command; the operation parameters of the third field include parameters related to the router configuration; the execution command of the fourth field is executed based on the instructions of the operation parameters; the first delay time of the fifth field is the preset time for the router to respond to the execution command and complete the execution of the execution command, preferably, the time unit is seconds.
[0013] According to another aspect of the present invention, a configuration file of a router is parsed and parameters of the router are configured in a loop, wherein the loop refers to parsing one function item in the configuration file each time to obtain a control instruction of the function item, and configuring the router parameters based on the control instruction, wherein the order of the loop parsing is determined / set based on the starting identifier of the function item.
[0014] According to another aspect of the present invention, the present invention also includes a configuration device, which includes: an acquisition module, used to obtain a configuration file of the device to be configured, wherein the configuration file is written based on a general writing protocol; a parsing module, used to parse the configuration file to obtain one or more control instructions; and a configuration module, used to modify the parameters of the device to be configured according to the one or more control instructions.
[0015] According to another aspect of the present invention, the present invention also includes a computer-readable storage medium, which stores executable instructions, and when the executable instructions are executed by the processor, the execution of the above-mentioned configuration method is caused. The readable storage medium can be a non-volatile memory, such as a hard disk or a disk, and can be applied to various terminals, such as computers, servers, etc.
[0016] According to another aspect of the present invention, the present invention also includes a configuration device, which includes: a processor; a storage device for storing executable instructions, and when the executable instructions are executed by the processor, the above-mentioned configuration method can be implemented.
[0017] In summary, the present invention abandons the development method of using one software execution script program for one router in the prior art, separates the configuration intentions such as the selection of various complex function items of the router and parameter changes from the software execution script program, separates and decouples to form ordinary testers rather than developers of software execution script programs that specialize in completing router configuration, and can maintain the modified txt text documents, thereby improving the utilization rate of human resources, saving time and effort, and greatly saving development costs. At the same time, the present invention abandons the traditional thinking method of using professional computer languages for all scenarios. In the present invention, the computer language is only responsible for the development and operation of the central unified operation decoding module, as well as the scheduling of related tasks, while the operation objects, actions and parameters executed by the software are all handed over to the external configuration file to complete. The configuration file is written according to a general writing protocol, which makes the method of configuring the router more flexible and convenient, and the configuration file generated according to the general writing protocol is easier to maintain. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a schematic diagram of an application scenario to which the configuration method of the present invention can be applied;
[0019] Figure 2It is a schematic diagram of an embodiment of the configuration method provided by the present invention;
[0020] Figure 3 It is a schematic diagram of the general writing protocol of the present invention;
[0021] Figure 4 It is a schematic diagram of an embodiment of the configuration device provided by the present invention;
[0022] Figure 5 is a schematic diagram of the module structure flow of the software management and control unit of the present invention; and
[0023] Figure 6 It is a software processing flow chart of the present invention. DETAILED DESCRIPTION
[0024] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a configuration method, device, equipment and storage medium proposed by the present invention, its specific implementation method, method, steps and effects, in combination with the accompanying drawings and preferred embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. It is known to those skilled in the art that with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.
[0025] Through the description of the specific implementation methods, a deeper and more specific understanding of the technical means and functional effects adopted by the present invention to achieve the predetermined purpose can be obtained. However, the attached drawings are only for reference and illustration purposes and are not used to limit the present invention.
[0026] The term "and / or" in the present invention can be a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present invention generally indicates that the associated objects before and after are in an "or" relationship.
[0027] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules that are clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products or devices. The naming or numbering of steps in the present invention does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The named or numbered process steps can change the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved. The division of modules in the present invention is a logical division. There may be other division methods when it is implemented in actual applications. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection between modules can be electrical or other similar forms, which are not limited in the present invention. In addition, the modules or submodules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed in multiple circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention.
[0028] First, the applicable application scenarios of the present invention are introduced.
[0029] See also Figure 1 The application scenario 100 includes a configuration device and one or more devices to be configured. Optionally, the application scenario 100 may also include a switching device connected to an external network (such as the Internet), and the switching device may be a switch 101 .
[0030] In an embodiment of the present invention, a configuration device can implement configuration of one or more devices to be configured. In the present invention, the configuration device can be wirelessly connected to the device to be configured, such as using the Wi-Fi 6 communication protocol, or it can be connected in a traditional wired manner. When using wireless communication, the same configuration device can selectively connect to one or more devices to be configured. The configuration device can be connected to one or more devices to be configured (such as routers 102a, 102b, and 102c), and access the Internet through the connection between the switching device and the device to be configured. Taking router 102a as an example, in Figure 1 In the application scenario shown, the configuration of the router 102a may be performed by a configuration device connected thereto.
[0031] In some optional embodiments, the configuration device may include one or more terminal devices. The terminal device may include a mobile station (MS), a subscriber unit, a cellular phone, a smart phone, a wireless data card, a personal digital assistant (PDA), a tablet computer, a wireless modem, a handheld device (handset), a laptop computer, a machine type communication (MTC) terminal, etc. In some other optional embodiments, the configuration device may also be other types of electronic devices, which are connected to the device to be configured (such as router 102a) as a dedicated device to configure it. The configuration device may include one physical device or multiple physical devices, which is not limited in the embodiments of the present invention. For example, the configuration device includes multiple terminal devices, and the configuration of one or more devices to be configured is jointly implemented by the multiple terminal devices. For example, the configuration device in the embodiment of the present invention may include Figure 1 At least one of the personal computer 103a, laptop computer 103b or smart phone 103c shown. The device to be configured is an electronic device connected to a switching device, and the device to be configured may be a router. Figure 1 In the application scenario shown, the one or more devices to be configured included in the system 100 may be electronic devices of the same type or of different types, and the present invention is not limited thereto. Figure 1 The system 100 shown may include three devices to be configured, which are router 102a, router 102b, and router 102c. The routers may be routers of the same brand and model, or routers of different brands or models. The router may be a Wi-Fi router, or other types of routers. In other embodiments, the devices to be configured may also be different types of electronic devices, including devices other than routers, such as switches, repeaters, and other electronic devices.
[0032] It should be understood that Figure 1 The types and quantities of the devices exemplified in the application scenarios shown should not be understood as limitations on the present invention.
[0033] based on Figure 1The following describes the configuration method provided by the embodiment of the present invention. Figure 2 shown.
[0034] Figure 2 A schematic diagram of an embodiment of a configuration method provided in an embodiment of the present invention.
[0035] An embodiment of the configuration method provided by the embodiment of the present invention may specifically include the following steps S1 to S3.
[0036] Step S1: The configuration device obtains a configuration file of the device to be configured, where the configuration file is written based on a general writing protocol.
[0037] In an embodiment of the present invention, the general writing protocol specifically refers to a guiding framework for writing a configuration file of a device to be configured. The general writing protocol contains a specific expression of each configuration item of a plurality of configuration items of the device to be configured. The configuration item may also be referred to as a function item of a router. Specifically, the general protocol specifically stipulates that the configuration file of the device to be configured includes a plurality of configuration items, and the plurality of configuration items may include one or more standard items. For example, a plurality of standard function items may include: operation method, operation parameter, execution command, delay time, remarks, etc. The plurality of configuration items may also include one or more optional items.
[0038] Exemplarily, it is assumed that the device to be configured in the embodiment of the present invention is a router device. The general writing protocol stipulates that the guiding framework / standard of the configuration file of the router is: it contains the description of the 7 functional items of the router, of which the first 6 are 6 standard items, which are respectively the start identifier, the operation command, the operation parameter, the execution command, the first delay time, and the description of the functional item; the last functional item is an optional item, which is the second delay time and / or the command parameter. Therefore, the configuration files of all routers in the system architecture contain the 7 functional items. When writing the configuration file according to the general writing protocol, the specific parameter values of the 7 functional items corresponding to each router are determined by the brand and model of the router itself.
[0039] It should be noted that the seven functional items are only examples. In actual application, the content and form of the configuration file specified by the general writing protocol can be set according to actual needs. This example should not be understood as a limitation of the present invention.
[0040] In the embodiment of the present invention, the configuration file of any device to be configured is written based on the above-mentioned general writing protocol. The configuration files of different devices to be configured can be pre-written by the tester through the configuration device based on the above-mentioned general writing protocol and stored in the configuration device. Optionally, the configuration file can be in the txt text document format, which is convenient for everyone to maintain.
[0041] In the embodiment of the present invention, when a router needs to be configured, the configuration device first obtains a configuration file corresponding to the router.
[0042] S2: The configuration device parses the configuration file to obtain one or more control instructions.
[0043] In an embodiment of the present invention, since the configuration file is written based on a general writing protocol, based on a protocol algorithm corresponding to the general writing protocol, after the configuration device obtains the configuration file corresponding to the device to be configured, the configuration device parses the configuration file to obtain one or more control instructions corresponding to the configuration file, and the one or more control instructions are used to instruct the device to be configured to modify parameters.
[0044] S3: The configuration device modifies the parameters of the device to be configured according to the one or more control instructions.
[0045] In the embodiment of the present invention, after the configuration device parses the configuration file to obtain one or more control instructions corresponding to the configuration file, the configuration device modifies the parameters of the device to be configured according to the one or more control instructions. Specifically, the configuration device may send the one or more control instructions to the device to be configured so that the device to be configured completes the update or modification of the parameter values of each function item corresponding to the aforementioned configuration file.
[0046] For example, the configuration file contains Figure 3 The 7 fields shown are field 1, field 2, field 3, field 4, field 5, field 6 (optional field) and field 7. Among them, field 1 includes a start identifier, field 2 includes an operation command, field 3 includes an operation parameter, field 4 includes an execution command, field 5 includes a first delay time, field 6 includes a second delay time and / or command parameters, and field 7 includes a description of a function item. The configuration device parses the configuration file to obtain one or more control instructions. The control instructions can be operations for corresponding fields in the configuration file. After receiving the control instruction, the device to be configured modifies / updates the parameter items of the device to be configured until all configurations corresponding to the 7 function items are modified / updated.
[0047] In the embodiment of the present invention, by adopting a universal writing protocol, configuration items such as different functional items and parameters of the device to be configured are separated from the software execution script program, so that the configuration file standards of devices to be configured of different brands or models under the same category are unified, which lowers the threshold of performance testing, facilitates maintenance, and improves the efficiency of automated testing.
[0048] based on Figure 2The configuration method in the embodiment of the present invention is described below, taking the device to be configured as a router as an example, the specific content of the general writing protocol definition configuration file in the embodiment of the present invention is introduced exemplarily.
[0049] like Figure 3 As shown, the configuration file of the general writing protocol definition router may include 6 standard fields and 1 optional field. The standard fields are: field 1, field 2, field 3, field 4, field 5, field 6 (optional field) and field 7. Among them, field 1 includes the start identifier, field 2 includes the operation command, field 3 includes the operation parameter, field 4 includes the execution command, field 5 includes the first delay time, field 6 includes the second delay time and / or command parameter, and field 7 includes the description of the function item.
[0050] The configuration file written based on the general writing protocol includes the definition of multiple lines of function items, each line of function items defines an operation router behavior, that is, a function item. Each line has 6 to 7 fields, and all lines of function items are accumulated to complete the automatic control of the router on demand. Preferably, the first field and the second field are separated by a Chinese colon, and from the second field, each field is separated by a Chinese comma.
[0051] Field 1: It is a fixed information field, used by the program to traverse, and is the starting keyword for program decoding line identification. Field 1 is the line start of each configuration item of the router control behavior. This field is written according to the regulations. Preferably, all letters are lowercase and end with a Chinese-style colon.
[0052] In the embodiment of the present invention, the fixed information field may be expressed as "--action x--", wherein, preferably, x is a natural integer.
[0053] Field 2: Specify the operation method for this line.
[0054] Preferably, the second field may include at least one of (2.1)-(2.7).
[0055] (2.1) To locate an element using the id method, you can use find_by-id to call selenium's find_element_by_id().
[0056] (2.2) Use xpath method to locate the element.
[0057] It can be expressed as find_by-xpath, calling selenium's find_element_by_xpath().
[0058] (2.3) Use the name method to locate the element.
[0059] You can use find_by-name to call selenium's find_element_by_name();
[0060] (2.4) Use the class_name method to locate the element.
[0061] It can be expressed as find_by-class_name, calling selenium's find_element_by_class_name().
[0062] (2.5) Call selenium's link_text method to locate the element.
[0063] It can be expressed using find_by-link_text.
[0064] (2.6) Construct a data selector data list, which can be represented by set_selector;
[0065] (2.7)direct_goto_submenu: directly log in to the target page, that is, the sub-page.
[0066] Field 3: Input parameter field.
[0067] Preferably, at least one of (3.1)-(3.5) may be included:
[0068] (3.1) Location parameters, which can be obtained through the Chrome+F12 tool, for example: loginbtn;
[0069] (3.2) Selector data list: starts and ends with Chinese parentheses, and the data in the parentheses directly copy the specific operation item option values of the router;
[0070] Each item is enclosed in double quotes and separated by commas, for example: ("802.11b / g / n","802.11b / g","802.11b","802.11g")
[0071] (3.3) Login target page URL path. For example: http: / / 192.168.5.1 / html / index.html# / more / deviceinfo
[0072] (3.4) Get the set value from the test case, which can be expressed as GET_AUTOTEST_CASE_VALUE;
[0073] (3.5) Locate the first half of the string: The second half is temporarily generated by the router each time a page is logged in.
[0074] Field 4: Requires the program to execute commands.
[0075] Preferably, at least one of (4.1)-(4.12) may be included:
[0076] (4.1) Enter the password directly into the positioning password box, which can be represented by INPUT_VALUE_PASSWORD;
[0077] (4.2) Click the left mouse button to locate the element, which can be represented by CLICK_MOUSE_LEFT_KEY;
[0078] (4.3) Click the JS code button for the located element, which can be represented by CLICK_USE_JS_KEY. For labels that report an error when clicking the left mouse button, try this method;
[0079] (4.4) To perform a menu slide down operation on a positioned element, you can use MENU_SLIDE_DOWN, which is equivalent to the scrolling effect of the mouse wheel;
[0080] (4.5) To perform a menu slide up operation on a positioned element, you can use MENU_SLIDE_UP, which is equivalent to the scrolling effect of the mouse wheel;
[0081] (4.6) Construct parameter selector; it can be represented by SELECTOR. SELECTOR is a data table transmitted to the program. Its data source is the router operation item parameter table. Its parameter selection is determined by the test case push. The test case push data is uniformly numbered from 0 in the order of 0, 1, 2, .... SELECTOR selects to extract data in this order. It is necessary to ensure that the data extraction order and push order on both sides are aligned. In other words, the input option data during test case configuration must correspond to the SELECTOR data push order.
[0082] (4.7) Select parameters according to the test case, and execute JavaScript method to confirm the selection. It can be represented by SELECT_ITEM_JS and applicable to li list tag;
[0083] (4.8) Select parameters according to the test case, and execute the click() method to confirm the selection. It can be represented by SELECT_ITEM_CLICK and is applicable to the li list tag;
[0084] (4.9) Select parameters according to the test case, and execute the click() method to confirm the selection. It can be represented by SELECT_OPTION_CLICK and is applicable to the option drop-down list label;
[0085] (4.10) Sending keyboard key data values or strings to the positioning element can be represented by SEND_KEYS;
[0086] (4.11) Clear the value of the positioning element VALUE, which can be represented by CLEAR;
[0087] (4.12) There is no command action required for this line of operation, which can be represented by NONE.
[0088] Field 5: The delay time required after the execution of the command in this line is completed. It is used to ensure that the operation information of the next line appears completely. It can be an integer or a floating point number with decimals. Preferably, the unit is seconds.
[0089] Field 6: Optional. Whether this command is required can be determined based on the actual router status. Preferably, it can include at least one of (6.1)-(6.5):
[0090] (6.1) Delay time 2: In some special cases, such as when a small pop-up menu needs to be clicked and waited for to disappear, this delay time needs to be filled in;
[0091] (6.2) SEND_KEYS command parameter: when the 4th field is the SEND_KEYS command, fixed data needs to be sent. For example, to send a carriage return: Keys.ENTER, the string Keys.ENTER can be written in this field. When the string to be sent by the SEND_KEYS command is taken from a test case, fill in NONE here; other commands that do not require this item do not need to fill in this field, and the same applies below.
[0092] (6.3) NEED_CLEAR_FIRST: If the fourth field is SEND_KEYS or INPUT_VALUE_PASSWORD and a string needs to be entered directly, add this parameter if you need to clear the original saved content of the router to avoid overlap, such as the password input command; this method can also be implemented using the CLEAR of the fourth field.
[0093] (6.4) Get the ID number that is temporarily generated by the router each time the router logs in to the page. This can be represented by GET_DYNAMIC_NUMBER.
[0094] (6.5) The program is required to automatically generate a location id parameter for this find element location, which can be represented by NEED_MAKE_DYNAMIC_ID. The generation rules are as follows:
[0095] Positioning id parameter = the second field + the ID number temporarily generated by the router each time the page is logged in.
[0096] Field 7: Fill in the bank's remarks and describe the functions completed by this bank.
[0097] Based on the above content, a Wi-Fi router is taken as an example to illustrate its configuration file, parsing process and router configuration method.
[0098] The corresponding configuration file of the Wi-Fi router can be as follows:
[0099] ===router 1===
[0100] Wi-Fi router model: A Wi-Fi router Mesh (the router is limited to a maximum of 28 bytes)
[0101] Test item category: Realtek
[0102] Wifi-Router-IP: 192.168.31.1
[0103] Wifi-Router_Admin_Password:88888888
[0104] Admin login method: By-Password
[0105] --action 0--: find_by-xpath, / / *[@id="password"], INPUT_VALUE_PASSWORD, 1, [Locate the password input box and enter the password]
[0106] --action 1--: find_by-xpath, / / *[@id="btnRtSubmit"], CLICK_MOUSE_LEFT_KEY, 5, [Click the OK button to complete the login]
[0107] --action 2--: find_by-xpath, / / *[@id="nav"] / ul / li[2] / a, CLICK_MOUSE_LEFT_KEY, 1, [Click on common settings]
[0108] --action 3--: find_by-xpath, / / *[@id="wifisetbsdtop"] / div[1] / span / input, CLEAR, 1, [clear WiFi name]
[0109] --action 4--: find_by-xpath, / / *[@id="wifisetbsdtop"] / div[1] / span / input, SEND_KEYS, 1, Mesh-Brand, [Enter a new name for WiFi name]
[0110] --action 5--: find_by-xpath, / / *[@id="wifisetbsdtop"] / div[2] / span / div, CLICK_USE_JS_KEY, 5, [Click on encryption method, a tag list pops up]
[0111] --action 6--: find_by-link_text, GET_AUTOTEST_CASE_VALUE, CLICK_USE_JS_KEY, 5, [Click the selection item to complete the encryption method selection, the data comes from the test case]
[0112] --action 7--: find_by-xpath, / / *[@id="wifisetbsdtop"] / div[3] / span / input, INPUT_VALUE_PASSWORD, 1, NEED_CLEAR_FIRST, [locate 2.4G Wi-Fi password input box and enter password]
[0113] --action 8--: find_by-class_name, ipt-text, MENU_SLIDE_DOWN, 2, [Locate the label slide down menu]
[0114] --action 9--: find_by-xpath, / html / body / div[1] / div[2] / div[1] / div[2] / form / div[2] / div[1] / span / div, CLICK_USE_JS_KEY, 2, [Click on the channel item to pop up the a tag list]
[0115] --action 10--: find_by-link_text, GET_AUTOTEST_CASE_VALUE, CLICK_USE_JS_KEY, 5, [Click the channel item to complete the channel selection, the data comes from the test case]
[0116] --action 11--: find_by-xpath, / / *[@id="wifiset24"] / div[2] / span / div, CLICK_USE_JS_KEY, 5, [Click the channel bandwidth item to pop up a tag list]
[0117] --action 12--: find_by-link_text, GET_AUTOTEST_CASE_VALUE, CLICK_USE_JS_KEY, 5, [Click the selection item to complete the channel bandwidth selection, the data comes from the test case]
[0118] --action 13--: find_by-xpath, / / *[@id="wifiset50"] / div[3] / button / span, CLICK_MOUSE_LEFT_KEY, 5, [Click the Save button to complete the save]
[0119] --action 14--: find_by-xpath, / html / body / div[1] / div / div[3] / div / a[1] / span, CLICK_MOUSE_LEFT_KEY, 35, [Click the Save button to complete the save]
[0120] ===router end 12===
[0121] The first line of function items
[0122] --action 0--: find_by-xpath, / / *[@id='password'], INPUT_VALUE_PASSWORD, 1, [Locate the password input box and enter the password]
[0123] It is used to set the function of "enter password in the positioning password input box", and the analysis is as follows:
[0124] "--action 0--" corresponds to the first field of the general writing protocol, indicating the starting identifier of each function item. The starting identifier usually indicates the configuration operation order of the function item in the configuration file.
[0125] "find_by-xpath" corresponds to the second field of the general writing protocol, that is, the operation command, which is a command to locate (find) a specific element.
[0126] “ / / *[@id='password']” corresponds to the third field of the general writing protocol, ie, the operation parameter, indicating positioning the password input box.
[0127] "INPUT_VALUE_PASSWORD" corresponds to the 4th field of the general writing protocol, that is, the execution command, which executes the command to enter the password.
[0128] "1" corresponds to the fifth field of the general writing protocol, that is, the first delay time is set, preferably in seconds. The delay time is set based on the estimated time for the Wi-Fi router to respond to the function item, so that the Wi-Fi router has enough time to complete the execution of the function item.
[0129] The sixth field is not set in this function item, and the sixth field is optional. In the configuration of some brands or types of routers, some operation interfaces require a second delay time or command parameters. For example, a function item is defined as a pop-up window, but when the window is clicked, another small window pops up. In this case, a second delay time needs to be defined to process the small window.
[0130] "
Locate the password input box and enter the password
[0131] Each of the above function items sets the parameter configuration operation behavior of a Wi-Fi router Mesh. Preferably, the configuration operation of 15 rows of function items needs to be traversed. The "action 0" function item is parsed by the script running center module calling the router configuration protocol algorithm module to generate the control instructions of the function item, and then the router parameter configuration module executes the operation of the function item. After the "action 0" function item operation is executed, the "action 1" function item is parsed by the script running center module calling the router configuration protocol algorithm module to generate the control instructions of the function item, and then the router parameter configuration module executes the operation of the function item. The cycle is repeated in sequence. When the configuration operations of the above 15 function items are all completed, the end mark "===router end 1===" is encountered, indicating that the configuration is complete.
[0132] The present invention also provides a configuration device embodiment, such as Figure 4 shown.
[0133] See also Figure 4 The configuration device 40 includes: an acquisition module 401, a parsing module 402 and a configuration module 403.
[0134] The acquisition module 401 is used to acquire a configuration file of the device to be configured, where the configuration file is written based on a general writing protocol;
[0135] A parsing module 402, configured to parse the configuration file obtained by the obtaining module 401 to obtain one or more control instructions; and
[0136] The configuration module 403 is used to modify the parameters of the device to be configured according to one or more control instructions parsed by the parsing module 402 .
[0137] The configuration device provided in the embodiment of the present invention can separate configuration items such as different functional items and parameters of the device to be configured from the software execution script program by adopting a universal writing protocol, so that the configuration file standards of the devices to be configured of different brands or models under the same category are unified, which lowers the threshold of performance testing, facilitates maintenance, and improves the efficiency of automated testing.
[0138] Optionally, in an optional embodiment, the configuration device 40 may further include a detection module, which is used to detect whether the modification of the parameters of the device to be configured is completely completed after the configuration module 403 modifies the parameters of the device to be configured based on the one or more control instructions. If all are completed, the configuration is terminated.
[0139] Optionally, in an optional embodiment, the configuration device 40 may further include a writing module, which is used to write one or more configuration files of the devices to be configured according to a universal writing protocol before the acquisition module 401 acquires the configuration files of the devices to be configured. For example, according to the unified configuration writing protocol of Wi-Fi routers (see Figure 3 ), write a configuration file in a unified format for the Wi-Fi router in the embodiment. The file format of the configuration file can be a txt text format. The configuration file contains the function items and parameters required for the configuration modification of the Wi-Fi router, and is responsible for the coordination and connection of the actions before and after each parameter operation;
[0140] Optionally, in an optional embodiment, the parsing module 402 is used to parse the operation instructions and various operation parameters contained in the configuration file acquired by the acquisition module 401 according to a preset software algorithm to generate one or more control instructions for executing the function defined by the function item;
[0141] Optionally, in an optional embodiment, the configuration module 403 may include a script execution unit, and the control parsing module 402 parses the configuration file to obtain one or more control instructions, and modifies or sets the parameters of the device to be configured according to the one or more control instructions. The control instruction may include an operation execution command to update the Wi-Fi router parameter item.
[0142] Specifically, the configuration file may include the formulation of function items and parameters required for the configuration modification of the device to be configured (such as a Wi-Fi router), and is responsible for the coordination and connection of actions before and after each parameter operation. The definition of each function item is based on a fixed rule. That is, the "unified configuration writing protocol" for various brands or types of Wi-Fi routers, that is, the universal writing protocol. The universal writing protocol includes 6 standard fields and 1 optional field. The standard fields are: field 1, field 2, field 3, field 4, field 5, field 6 (optional field) and field 7. Among them, field 1 includes a start identifier, field 2 includes an operation command, field 3 includes an operation parameter, field 4 includes an execution command, field 5 includes a first delay time, field 6 includes a second delay time and / or command parameters, and field 7 includes a description of the function item. Field 6 is selected based on the specific parameter configuration requirements of various brands or types of routers.
[0143] Specifically, when the writing module writes a unified configuration file for one or more devices to be configured based on the general writing protocol, the configuration file is usually in a txt text format. The configuration file written by the writing module can be input by the writing personnel and confirmed to be correct, and then the acquisition module 401 acquires the configuration file, and the parsing module 402 parses the function items written in each line of the configuration file according to the general writing protocol rules according to the preset algorithm to obtain the corresponding control instructions.
[0144] After the parsing module 402 completes the parsing, the configuration module 403 completes the setting or modification of the Wi-Fi router parameter configuration.
[0145] Optionally, after acquiring the configuration file of any Wi-Fi router, the acquisition module 401 can call the parsing S03 module to convert the function items in the configuration file into corresponding executable operation control instructions, and execute the command SELECTOR according to the 4th field in the function item, and push the corresponding router operation item parameter table. Its parameter selection is determined by the test case push, and the test case push data is uniformly numbered from 0: 0, 1, 2, .... SELECTOR selects to arrange and extract data in this order, and completes each group of parameter configurations respectively, so as to complete the automated testing of various Wi-Fi functions and performances of smart terminal products.
[0146] Figure 4 The modules described above can be hardware modules integrated into the configuration device, or software modules installed on the configuration device. Figure 4 The configuration devices of the modules are integrated Figure 5The configuration device of each module can be implemented by the same physical device, or by multiple physical devices, or by a logical function module in a physical device, which is not specifically limited in the embodiments of the present application. Figure 4 The modules included can be integrated into a configuration device for configuring the router. Figure 1 The computer terminal 103a shown in FIG. 103a or a dedicated configuration device. In addition, Figure 4 The modules included can also be installed in different devices to execute the operations corresponding to each module in a decentralized manner. For example, the writing module can be installed in one device to implement the initial writing of the router configuration file; while the parsing module and the configuration module can be installed in another device to implement the parsing and automatic configuration of the configuration file. The cooperation of each module can complete the unified configuration of Wi-Fi routers of various brands or types.
[0147] Figure 5 1 is a flow chart of a preferred configuration method in an embodiment of the present invention. The preferred configuration method includes steps S100-S106, which are:
[0148] S100: Write Wi-Fi router configuration files according to the general writing protocol rules. S100 is a key step in achieving automatic configuration of Wi-Fi routers;
[0149] S101: Starting automatic Wi-Fi router configuration based on the completed Wi-Fi router configuration file;
[0150] S102: Reading a Wi-Fi router configuration file written according to a general writing protocol rule;
[0151] S103: Parse the Wi-Fi router configuration file and generate a corresponding control instruction from a function item in the configuration file;
[0152] S104: Based on the control instruction generated in S103, the Wi-Fi router is operated for the function item;
[0153] S105: Determine whether all the function items in the configuration file are completed. If there are function items in the configuration file that are not completed, return to S103 and continue to parse the configuration file to generate corresponding control instructions.
[0154] S106: If all function items in the configuration file are completed, the Wi-Fi router configuration is terminated.
[0155] In this preferred embodiment, it is necessary to loop through all the function items in the configuration file, that is, parse one function item, execute the operation of the function item, then parse the next function item, and then execute the operation of the function item, and repeat the cycle until it is ensured that the operation of each function item is executed in the order defined by the start identifier. The processing method of the preferred embodiment is reasonable and the processing efficiency is high.
[0156] In another embodiment, all function items in the configuration file are parsed to generate all control instructions for configuring the Wi-Fi router, and then all parameter configurations of the Wi-Fi router are performed. In this embodiment, operation step cutting such as caching is required.
[0157] For Wi-Fi routers of different brands or types, due to different design schemes of different manufacturers, such as different login methods, parameter names and control options, the function definitions of the function items in the configuration files of each router are different, and the number of function items contained in the configuration files is also different. The above article gives an example of a configuration file parsing and automatic configuration method of a Wi-Fi router. The automatic configuration method of a router of the present invention is not limited to routers of a specific brand and model, but can also be applied to routers of other models.
[0158] By adopting the automatic configuration method of the router of the present invention, the configuration files of routers of different models can be automatically parsed only if the configuration files of the routers are configured according to the general configuration protocol, thereby obtaining the control instructions for the configuration of the parameters of the routers, and automatically setting each function item in the configuration file according to the control instructions, thereby realizing the automatic configuration of the router. This avoids the configuration method of using one software to execute a script program for one router in the prior art, greatly improves the configuration efficiency of the router, and solves the problem that different models of routers need to be configured separately by developers.
[0159] The present invention also provides a configuration device, such as Figure 6 The configuration device 60 includes: a network interface 601 , a processor 602 , a memory 603 and a bus system 604 .
[0160] Among them, the memory 603 is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory 603 may be a random access memory (RAM) or a non-volatile memory (non-volatile memory), such as at least one disk storage. Only one memory is shown in the figure, and of course, the memory can also be set to multiple as needed. Optionally, the memory 603 is a memory in the processor 602.
[0161] The memory 603 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof:
[0162] Operation instructions: include various operation instructions, used to implement various operations.
[0163] Operating system: includes various system programs used to implement various basic services or process hardware-based tasks.
[0164] The processor 602 controls the operation of the configuration device 60. Optionally, the processor 602 is a central processing unit (CPU). In a specific application, the various components of the configuration device 60 are coupled together through a bus system 604. In addition to the data bus, the bus system 604 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, various buses are labeled as bus system 604 in the figure. For ease of representation, Figure 6 The drawing is only schematic.
[0165] The configuration method provided in the embodiment of the present application introduced in the foregoing is applied to the processor 602 or implemented by the processor 602.
[0166] The processor 602 may be an integrated circuit chip with data processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 602. The above processor 602 may be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor to be executed. The software module may be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 603, and the processor 602 reads the information in the memory 603 and executes the method steps executed by the configuration device in the foregoing text in combination with its hardware.
[0167] In some implementations, the memory 603 is used to store computer-executable instructions for executing the solution of the present application, and the execution is controlled by the processor 602. The processor 602 is used to execute the computer-executable instructions stored in the memory 603, thereby implementing the configuration method provided in the embodiment of the present application.
[0168] The above combined as the preferred embodiment of the present invention introduces a configuration method, device, equipment and storage medium. The implementation process of the method is simple, and the necessary steps are completed by the various modules of the software system of the present invention in a coordinated manner, which is convenient and fast, and no manual intervention is required once the program is running.
[0169] It should be understood that the description of the above aspects is only illustrative and should not be interpreted in a limiting sense. For the purpose of explanation and to facilitate the understanding of the present invention, many clear implementation details are introduced in the above description. However, those familiar with the art understand that the present invention can still be implemented even without these clear implementation details. Further, the scope of the present invention is not limited to the embodiments or examples with reference to the accompanying drawings; but is only limited to the scope of the attached claims and their equivalents.
[0170] Another aspect of the present invention provides a computer-readable storage medium, which stores executable instructions, software programs and modules, and when the executable instructions are executed by a processor, the method for configuring a router is executed. The readable storage medium may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device or other non-volatile solid-state storage device, and may be applied to various terminals, such as computers, servers, etc.
[0171] Storage media also include, but are not limited to, any type of disk (including floppy disks, hard disks, optical disks, CD-ROMs, and magneto-optical disks), ROM (read-only memory), RAM (random access memory), EPROM (erasable programmable read-only memory), EEPROM (electrically erasable programmable read-only memory), flash memory, magnetic cards, or optical cards. In other words, storage media include any medium that can store or transmit information in a readable form by a device (e.g., a computer). Storage media can also be read-only memory, a disk, or an optical disk, etc.
[0172] An embodiment of the present invention further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the method for configuring a router in the above-mentioned embodiment.
[0173] In addition, an embodiment of the present invention further provides a device, which may be a chip, a component or a module, and the device may include a connected processor and a memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor may execute the computer-executable instructions stored in the memory, so that the chip executes the method for configuring a router in the above-mentioned method embodiments.
[0174] Among them, the device, computer storage medium, computer program product or chip provided by the present invention are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0175] The above are only preferred embodiments of the present invention, and do not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment, it is not intended to limit the present invention. Any technician familiar with the profession can make some changes or modifications to equivalent embodiments of equivalent changes by using the above disclosed technical content without departing from the scope of the technical solution of the present invention. For example, the above embodiments are mainly introduced in conjunction with Wi-Fi routers, but the present invention is not limited to the automatic configuration of Wi-Fi routers. In combination with the modules and steps of each example described in the embodiments disclosed herein, the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention. After understanding the creative concept of the present invention, ordinary technicians in this field can apply the method of the present invention to other types of routers without creative work. However, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present invention without departing from the content of the technical solution of the present invention still belongs to the scope of the technical solution of the present invention.
Claims
1. A configuration method, characterized in that: The method comprises: Obtain a configuration file of the device to be configured, the configuration file being compiled based on a general compilation protocol, the general compilation protocol including a definition of each function item of multiple function items of the device to be configured, the configuration file including multiple fields, the multiple fields including at least: an operation method field, an operation parameter field, an execution command field, and a delay time field; The operation method field is used to specify the operation method of this line; the operation parameter field is used to input parameters; the execution command field is used to require the program to execute commands; Parsing the configuration file to obtain one or more control instructions; The one or more control instructions are sent to the device to be configured, so that the device to be configured modifies the parameters corresponding to each of the function items.
2. The method according to claim 1, characterized in that The device to be configured includes a router, the configuration file includes a plurality of function item definitions configured for the router, and each of the function item definitions is written based on the general writing protocol.
3. The method according to claim 1 or 2, characterized in that: The general writing protocol includes 6 standard fields and 1 optional field, the standard fields are field 1, field 2, field 3, field 4, field 5 and field 7, and the optional field is field 6, wherein: The first field includes a start identifier, the second field includes an operation method, the third field includes an operation parameter, the fourth field includes an execution command, the fifth field includes a first delay time, the sixth field includes a second delay time and / or command parameters, and the seventh field includes a description of the function item.
4. The method according to claim 3, characterized in that The start identifier includes an operation sequence number.
5. The method according to claim 3, characterized in that: The operation method includes a page element positioning command, a data selector data list construction command and a target page direct login command.
6. The method according to claim 3, characterized in that The first delay time is a preset time for a router included in the device to be configured to respond to the execution command and complete the execution of the execution command.
7. The method according to claim 3, further comprising: The operation of parsing the configuration file of the router and configuring the parameters of the router is executed cyclically, wherein the loop refers to parsing one function item in the configuration file each time to obtain the control instruction of the function item, and configuring the router based on the control instruction, wherein the order of the cyclic parsing is determined / set based on the starting identifier of the function item.
8. A configuration device, characterized in that: The configuration device comprises: an acquisition module, configured to acquire a configuration file of a device to be configured, wherein the configuration file is written based on a general writing protocol, the general writing protocol includes a definition of each function item of multiple function items of the device to be configured, and the configuration file includes multiple fields, the multiple fields at least including: an operation method field, an operation parameter field, an execution command field, and a delay time field; The operation method field is used to specify the operation method of this line; the operation parameter field is used to input parameters; the execution command field is used to require the program to execute commands; a parsing module, configured to parse the configuration file to obtain one or more control instructions; and The configuration module is used to send the one or more control instructions to the device to be configured, so that the device to be configured modifies the parameters corresponding to each of the function items.
9. A computer-readable storage medium, characterized in that: The storage medium stores executable instructions, which, when executed by a processor, lead to the execution of the configuration method according to any one of claims 1 to 7.
10. A configuration device, characterized in that: include: processor; A storage device for storing executable instructions, When the executable instructions are executed by the processor, the configuration method according to any one of claims 1 to 7 is implemented.
