CN104767635A - Method for sharing mirror image by multiple devices based on dynamic command line replacement - Google Patents
Method for sharing mirror image by multiple devices based on dynamic command line replacement Download PDFInfo
- Publication number
- CN104767635A CN104767635A CN201510011820.5A CN201510011820A CN104767635A CN 104767635 A CN104767635 A CN 104767635A CN 201510011820 A CN201510011820 A CN 201510011820A CN 104767635 A CN104767635 A CN 104767635A
- Authority
- CN
- China
- Prior art keywords
- command
- command line
- line
- configuration parameters
- nodes
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 38
- 230000006870 function Effects 0.000 claims description 16
- 230000003287 optical effect Effects 0.000 claims description 7
- 239000002699 waste material Substances 0.000 abstract description 7
- 239000000463 material Substances 0.000 abstract description 6
- 238000004891 communication Methods 0.000 abstract description 2
- 230000008569 process Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 1
- 238000005111 flow chemistry technique Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
Landscapes
- Stored Programmes (AREA)
- Facsimiles In General (AREA)
Abstract
The invention belongs to the field of communication, and provides a method for supporting mirror image sharing by multiple devices based on dynamic command line replacement. The method includes the steps that according to keywords in a command line to be replaced, command nodes are searched for in a command set tree, and the command set tree provides multiple command nodes, so that the command line with various function options is combined by a command line interface CLI function through the combination of the command nodes; for the searched command nodes, configuration parameters which are actually supported by the current device are read through a software interface; according to the configuration parameters actually supported, the command nodes on the command set tree are adjusted. Therefore, the devices needing to provide different CLI mirror images can share one CLI mirror image file, the working efficiency of a developer can be effectively improved, and waste of manpower and material resources is reduced.
Description
Technical Field
The invention belongs to the field of communication, and particularly relates to a method for sharing a mirror image by multiple devices based on dynamic replacement of command lines.
Background
A Command Line Interface (CLI) is the most widely used user Interface before graphical user interfaces are popularized, and generally does not support a mouse, and a user inputs an instruction through a keyboard and a computer executes the instruction after receiving the instruction.
The command line interface saves resources of the computer system more than the graphical user interface. With the familiar mind of commands, the use of command line interfaces tends to operate faster than graphical user interfaces. Therefore, command line interfaces are typically maintained in current operating systems. Meanwhile, the method is widely applied to various switch devices.
Currently, there are such problems in practical engineering applications:
for devices such as a switch, a router, a firewall, a gateway device, an Optical Network Unit (ONU), an Optical Line Terminal (OLT), and the like that can support the CLI function, there may be a case where the bottom layer implementation processes are the same, but there is a difference in the CLI parameter ranges. Moreover, these differences are not limited to the same series of products in a particular facility. Due to the difference of the CLI parameter ranges of the equipment, developers need to develop and maintain multiple sets of codes and multiple CLI image files, which not only wastes much manpower, but also increases the working strength of the developers.
Disclosure of Invention
The embodiment of the invention aims to provide a method for dynamically replacing a common mirror image for multiple devices based on a command line, so as to solve the problem that developers need to develop and maintain multiple sets of codes and multiple mirror image files in the prior art.
The embodiment of the invention is realized in such a way that a method for sharing mirror images by multiple devices based on dynamic replacement of a command line comprises the following steps:
searching command nodes in a command set tree according to keywords of a command line to be replaced, wherein the command set tree provides a plurality of command nodes so that the CLI functions of the command line interface can be combined into a command line with various functional options through the combination of the command nodes; for the searched command node, reading the configuration parameters actually supported by the current equipment through a software interface; and adjusting the command nodes on the command set tree according to the actually supported configuration parameters.
The method for dynamically replacing the common mirror image of the multiple devices based on the command line has the advantages that: by processing the difference of the command line parameter ranges of the devices needing the common mirror image, the command line actually matched with the current device can be presented to the user, so that the devices needing to provide different CLI mirror images can share one CLI mirror image file, the working efficiency of developers can be effectively improved, and the waste of manpower and material resources is reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed for the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a flow chart of a method for dynamically replacing a common image for multiple devices based on a command line according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method for dynamically replacing a common image for multiple devices based on a command line according to an embodiment of the present invention;
FIG. 3 is a flow chart of a method for dynamically replacing a common image for multiple devices based on a command line according to an embodiment of the present invention;
FIG. 4 is a flowchart of a method for dynamically replacing a common image for multiple devices based on a command line according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a command set tree according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
Example one
Fig. 1 is a flowchart illustrating a method for dynamically replacing a common image for multiple devices based on a command line according to the present invention, wherein a device supporting a CLI function of a command line interface enters a startup initialization state. The device supporting the CLI function of the command line interface may be a switch, a router, a firewall, a gateway device, an optical network unit ONU, or an optical line terminal OLT.
In this embodiment, the starting initialization specifically includes: software platform initialization, protocol module initialization and network management initialization. And after the protocol module initialization and the network management initialization are finished, the operation of searching command nodes in the command set tree according to the keywords of the command line to be replaced is carried out. The method comprises the following steps:
in step 201, a command node is searched in a command set tree according to a keyword of a command line to be replaced, wherein the command set tree is used for providing the CLI function with command lines of various supported function options and parameters of the command lines after the CLI function is started.
And the command line with the parameter of the command line set as the default value is the command line to be replaced. Or, a list of command lines to be replaced is stored in the corresponding command set tree, so as to obtain the command lines to be replaced.
In step 202, for the searched command node, the configuration parameters actually supported by the current device are read through the software interface.
In step 203, the command nodes in the command set tree are adjusted according to the actually supported configuration parameters.
According to the embodiment of the invention, the command line actually matched with the current equipment can be presented to the user by processing the difference of the parameter ranges of the command lines of the equipment needing the common mirror image, so that the equipment needing the common mirror image can share one mirror image file, the working efficiency of developers can be effectively improved, and the waste of manpower and material resources is reduced.
With reference to this embodiment, there is a feasible scheme, where searching for a command node in a command set tree according to a keyword of a command line to be replaced specifically includes:
the command line is composed of a plurality of command nodes in a command set tree; and analyzing the command line to be replaced, and sequentially matching command nodes in the command set tree according to the analyzed keywords so as to search the command node for finally storing the parameter value.
With reference to this embodiment, there is a feasible scheme, where the adjusting the command nodes in the command set tree according to the actually supported configuration parameters specifically includes:
comparing the parameter values in the command node to the actual supported configuration parameters; when the comparison results are different, generating a new command line according to the actually supported configuration parameters; and replacing the command line registered in the command node with the newly generated command line. And when the comparison result is the same, continuing to search the key word of the next command line to be replaced.
With reference to this embodiment, there is a feasible scheme, where the adjusting the command nodes in the command set tree according to the actually supported configuration parameters specifically includes:
generating a new command node according to the actually supported configuration parameters; replacing the command nodes registered in the command set tree that store default configuration parameters with the newly generated command line.
With reference to the present embodiment, there is a feasible scheme, where for the searched command node, reading the configuration parameters actually supported by the current device through a software interface specifically includes:
and for the searched command node, acquiring the parameters which are contained in the command node and correspond to the command line. And calling a driving interface of the corresponding module according to the parameters of the command line, and acquiring the configuration parameters actually supported by the corresponding module by using the driving interface.
In connection with this embodiment, there is a feasible solution, in which after the startup initialization is completed, the updated command set tree is saved, so that at the next startup, there is no need to complete the replacement of the command line on the same terminal.
Example two
As shown in fig. 2, which is a flowchart of a method for dynamically replacing a common image for multiple devices based on a command line according to an embodiment of the present invention, it can be seen from fig. 2 that an embodiment of a method for dynamically replacing a common image for multiple devices based on a command line according to the present invention includes:
in step 201, a command node is searched in a command set tree according to a keyword of a command line to be replaced, wherein the command set tree is used for providing the CLI function with command lines of various supported function options and parameters of the command lines after the CLI function is started.
In step 202, for the searched command node, the configuration parameters actually supported by the current device are read through the software interface.
Wherein step 203 is specifically executed as:
in step 301, the parameter values in the command node are compared with the actual supported configuration parameters.
As in fig. 5, the node parameter value <0,1000> is commanded, while the actual supported configuration parameters are assumed to be <0,500 >.
In step 302, when the comparison result is different, a new command node is generated according to the actually supported configuration parameters.
Specifically, using FIG. 5 as an example, a command node with a parameter value <0,500> is generated.
In step 303, the command node storing the default configuration parameters registered in the command set tree is replaced with the newly generated command node, and the process returns to step 201 to perform a search for keywords of other command lines.
Specifically, taking fig. 5 as an example, the command node with the parameter value <0,1000> in the figure is replaced with a newly generated command node with the parameter value <0,500>, so that the command line "add page <0,1000 >" is adjusted to be the command line "add page <0,500 >".
In the embodiment of the invention, the difference of the parameter ranges of the command lines of the devices needing the common mirror image is processed, so that the command lines actually matched with the current devices can be presented to the user, the devices needing the common mirror image can share one mirror image file, the working efficiency of developers can be effectively improved, and the waste of manpower and material resources is reduced.
Preferably, when the determination result in step 302 is the same, the next command node is searched continuously.
EXAMPLE III
As shown in fig. 3, which is a flowchart of a method for dynamically replacing a common image for multiple devices based on a command line according to an embodiment of the present invention, it can be seen from fig. 3 that an embodiment of a method for dynamically replacing a common image for multiple devices based on a command line according to the present invention includes:
in step 201, a command node is searched in a command set tree according to a keyword of a command line to be replaced, wherein the command set tree is used for providing the CLI function with command lines of various supported function options and parameters of the command lines after the CLI function is started.
In step 202, for the searched command node, the configuration parameters actually supported by the current device are read through the software interface.
Wherein step 203 is specifically executed as:
in step 401, a new command node is generated according to the actually supported configuration parameters.
In step 402, the command node registered in the command set tree that stores default configuration parameters is replaced with the newly generated command node.
In the embodiment of the invention, the difference of the parameter ranges of the command lines of the devices needing the common mirror image is processed, so that the command lines actually matched with the current devices can be presented to the user, the devices needing the common mirror image can share one mirror image file, the working efficiency of developers can be effectively improved, and the waste of manpower and material resources is reduced.
Example four
As shown in fig. 4, which is a flowchart of a method for dynamically replacing a common image for multiple devices based on a command line according to an embodiment of the present invention, it can be seen from fig. 4 that an embodiment of a method for dynamically replacing a common image for multiple devices based on a command line according to the present invention includes:
in step S502, a power-on operation is performed on the devices (including the switch, the router, the firewall, the gateway device, the ONU, the OLT, and the like) supporting the CLI function.
After step S502, the flow advances to step S503.
In step S503, the device internally performs initialization operations on the memory file system, hardware, drivers, peripheral devices, boards, and the like.
After step S503, the flow advances to step S504.
In step S504, the network manager is initialized, and the configuration items opened by the network manager are initialized first, and then the CLI and the like are initialized. Wherein the range values for the same configuration items that differ are initialized to the maximum values supported by the device. After CLI initialization is completed, the command lines loaded by the device will be stored in the form of a command set tree.
After step S504, the flow advances to step S505.
In step S505, the software platform and the protocol module are initialized, and an interface function, i.e. the driving interface in the first embodiment, is provided for the command that the same CLI configuration parameter has a difference in parameter range, so as to obtain the configuration parameter actually supported by the device.
Preferably, it can be determined that the command lines are the same among the devices according to the types of devices supported by the CLI image, that is, the difference does not exist; it is determined that those command lines are not the same between the devices, i.e., the difference exists. The difference needs to be processed by the processing flow of the command node to be replaced in the first embodiment.
Wherein configuring the object comprises: various initialization parameters and protocol module configuration command parameter ranges of the network management specifically include: dynamic Host Configuration Protocol (DHCP) address pool range, physical port value range, etc.). Specifically, the method comprises the following steps:
and carrying out recursive analysis on the command set tree loaded by the equipment, and matching the command line keywords with different configuration ranges among the equipment with the command nodes on the command set tree one by one according to the analyzed keywords. And if the matching is successful, reading the configuration parameter range actually supported by the current equipment through an interface provided by a software platform or a protocol module.
After step S505, the flow advances to step S506.
In step S506, the obtained parameter range values are compared with the range values in the current command set tree one by one, and if the result is yes, the flow proceeds to step S508; otherwise, the process proceeds to step S507.
In step S508, the command progression line does not need to be dynamically replaced, and the command form remains unchanged.
After step S508, the flow advances to step S509.
In step S507, parameter ranges are obtained from the software platform or the protocol module, and a new command line form is constructed. And searching the command set tree according to the command node, the currently loaded command form and the newly constructed command form, and if the search is successful, replacing the command line registered under the node and presenting the new command form to the user.
After step S507, the flow advances to step S509.
In step S509, the flow processing ends
In the embodiment of the invention, the difference of the parameter ranges of the command lines of the devices needing the common mirror image is processed, so that the command lines actually matched with the current devices can be presented to the user, the devices needing the common mirror image can share one mirror image file, the working efficiency of developers can be effectively improved, and the waste of manpower and material resources is reduced.
It will be further understood by those skilled in the art that all or part of the steps in the method for implementing the above embodiments may be implemented by relevant hardware instructed by a program, and the program may be stored in a computer-readable storage medium, including ROM/RAM, magnetic disk, optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.
Claims (10)
1. A method for dynamic replacement of a shared image for multiple devices based on a command line, wherein a device supporting CLI functionality of a command line interface enters a startup initialization state, the method comprising:
searching command nodes in a command set tree according to keywords of a command line to be replaced, wherein the command set tree provides a plurality of command nodes so that the CLI functions of the command line interface can be combined into a command line with various functional options through the combination of the command nodes;
for the searched command node, reading the configuration parameters actually supported by the current equipment through a software interface;
and adjusting the command nodes on the command set tree according to the actually supported configuration parameters.
2. The method of claim 1, wherein searching for a command node in a command set tree according to a keyword of a command line to be replaced specifically comprises:
the command line is composed of a plurality of command nodes in a command set tree;
and analyzing the command line to be replaced, and sequentially matching command nodes in the command set tree according to the analyzed keywords so as to search the command node for finally storing the parameter value.
3. The method according to claim 1 or 2, wherein the command node to be replaced is specifically:
the command line with the parameter of the command line set as the default value is the command line to be replaced; or,
and storing a list of command lines to be replaced in the corresponding command set tree so as to obtain the command lines to be replaced.
4. The method according to any of claims 1-3, wherein said adjusting the command nodes in the command set tree according to the actual supported configuration parameters comprises:
comparing the parameter values in the command node to the actual supported configuration parameters;
when the comparison results are different, generating a new command line according to the actually supported configuration parameters;
and replacing the command line registered in the command node with the newly generated command line.
5. The method of claim 4,
and when the comparison result is the same, continuing to search the key word of the next command line to be replaced.
6. The method of claim 1, wherein the adjusting the command nodes in the command set tree according to the actually supported configuration parameters specifically comprises:
generating a new command node according to the actually supported configuration parameters;
and replacing the command node which is registered in the command set tree and stores default configuration parameters with the newly generated command node.
7. The method according to any one of claims 1 to 6, wherein, for the searched command node, reading the configuration parameters actually supported by the current device through a software interface specifically includes:
for the searched command node, acquiring the parameter corresponding to the command line contained in the command node;
and reading the configuration parameters actually supported by the current equipment in the command interface from the software interface according to the parameters of the command line.
8. The method according to claim 7, wherein reading, from the software interface according to the parameters of the command line, the configuration parameters actually supported by the current device in the command interface specifically includes:
and calling a driving interface of the corresponding module according to the parameters of the command line, and acquiring the configuration parameters actually supported by the corresponding module by using the driving interface.
9. The method of any one of claims 1-8, wherein the method further comprises:
and after the starting initialization is finished, the updated command set tree is stored, so that the command line replacement does not need to be finished on the same terminal at the next starting.
10. The method of any of claims 1-9, wherein the device that supports Command Line Interface (CLI) functionality comprises:
a switch, a router, a firewall, a gateway device, an optical network unit, ONU, or an optical line terminal, OLT.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510011820.5A CN104767635B (en) | 2015-01-12 | 2015-01-12 | A method of mirror image is total to for more equipment based on order line dynamic replacement |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510011820.5A CN104767635B (en) | 2015-01-12 | 2015-01-12 | A method of mirror image is total to for more equipment based on order line dynamic replacement |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104767635A true CN104767635A (en) | 2015-07-08 |
CN104767635B CN104767635B (en) | 2019-01-04 |
Family
ID=53649263
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510011820.5A Active CN104767635B (en) | 2015-01-12 | 2015-01-12 | A method of mirror image is total to for more equipment based on order line dynamic replacement |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104767635B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108880837A (en) * | 2017-05-10 | 2018-11-23 | 杭州达乎科技有限公司 | The method, apparatus and SDN controller architecture of network element configuration parameter are corrected in SDN network |
CN109062617A (en) * | 2018-06-26 | 2018-12-21 | 百富计算机技术(深圳)有限公司 | A kind of application method, the mobile terminal of platform that supporting polymorphic type equipment |
CN117194278A (en) * | 2023-11-08 | 2023-12-08 | 新华三网络信息安全软件有限公司 | Device command management method and device, storage medium and electronic device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1929396A (en) * | 2005-09-09 | 2007-03-14 | 中兴通讯股份有限公司 | Method for realizing data configuration of network element in network |
CN101924656A (en) * | 2010-08-26 | 2010-12-22 | 北京天融信科技有限公司 | Method and device for realizing network equipment CLI (Command Line Interface for batch scripti) based on dynamic configuration |
CN102761443A (en) * | 2012-07-20 | 2012-10-31 | 中兴通讯股份有限公司 | Collocation method and device of command lines |
-
2015
- 2015-01-12 CN CN201510011820.5A patent/CN104767635B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1929396A (en) * | 2005-09-09 | 2007-03-14 | 中兴通讯股份有限公司 | Method for realizing data configuration of network element in network |
CN101924656A (en) * | 2010-08-26 | 2010-12-22 | 北京天融信科技有限公司 | Method and device for realizing network equipment CLI (Command Line Interface for batch scripti) based on dynamic configuration |
CN102761443A (en) * | 2012-07-20 | 2012-10-31 | 中兴通讯股份有限公司 | Collocation method and device of command lines |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108880837A (en) * | 2017-05-10 | 2018-11-23 | 杭州达乎科技有限公司 | The method, apparatus and SDN controller architecture of network element configuration parameter are corrected in SDN network |
CN109062617A (en) * | 2018-06-26 | 2018-12-21 | 百富计算机技术(深圳)有限公司 | A kind of application method, the mobile terminal of platform that supporting polymorphic type equipment |
CN109062617B (en) * | 2018-06-26 | 2020-07-28 | 百富计算机技术(深圳)有限公司 | Application method of platform supporting multiple types of equipment and mobile terminal |
CN117194278A (en) * | 2023-11-08 | 2023-12-08 | 新华三网络信息安全软件有限公司 | Device command management method and device, storage medium and electronic device |
CN117194278B (en) * | 2023-11-08 | 2024-02-23 | 新华三网络信息安全软件有限公司 | Device command management method and device, storage medium and electronic device |
Also Published As
Publication number | Publication date |
---|---|
CN104767635B (en) | 2019-01-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110990008B (en) | Page updating method and device, storage medium and electronic equipment | |
US20210374110A1 (en) | Detection system and method, and related apparatus | |
CN112433788A (en) | Applet running method and device, electronic equipment and storage medium | |
CN113139660A (en) | Model reasoning method and device, electronic equipment and storage medium | |
CN104767635B (en) | A method of mirror image is total to for more equipment based on order line dynamic replacement | |
CN112100152A (en) | Service data processing method, system, server and readable storage medium | |
US20140258320A1 (en) | Integrating removable storage devices | |
CN107329802B (en) | Virtual machine creating method and electronic equipment | |
US20180324080A1 (en) | Routing method, routing apparatus, nfcc, and dh | |
CN110888672B (en) | Expression engine implementation method and system based on metadata architecture | |
CN113535262A (en) | Method, device, equipment and storage medium for controlling starting of proxy node | |
CN108536541B (en) | Process engine object processing method and device | |
CN113536767A (en) | Data processing method, device, equipment, medium and computer program product | |
KR101743731B1 (en) | Method and apparatus for processing quary based on ontology generated by collaborating distributed data | |
CN111090651A (en) | Data source processing method, device and equipment and readable storage medium | |
JP6310532B1 (en) | Generating device, generating method, and generating program | |
CN111381978A (en) | Method for accessing application program, storage medium and smart television | |
CN103455351A (en) | Method and device for quickly installing application | |
CN112000354A (en) | Version information updating method, version information updating device, version information updating equipment and storage medium | |
CN111090426A (en) | Method, system and equipment for processing http request | |
CN112883261B (en) | Configuration data pushing method and device, electronic equipment and medium | |
CN113010151B (en) | Method, system, equipment and medium for traversing dynamic options in HII database | |
CN112527290A (en) | Method and device for building page based on biological characteristic information | |
JP2015095035A (en) | Parameter setting support system, parameter setting support method, and parameter setting support program | |
CN116260860B (en) | Application deployment method and device, storage medium and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
EXSB | Decision made by sipo to initiate substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20190123 Address after: 430074 No. 6, High-tech Fourth Road, Donghu High-tech Development Zone, Wuhan City, Hubei Province Patentee after: Fenghuo Communication Science &. Technology Co., Ltd. Address before: 430074 3rd Floor, Optical Communication Building, 67 Guanggu Pioneer Street, Donghu Development Zone, Wuhan City, Hubei Province Patentee before: Wuhan Fenghuo Network Co., Ltd. |
|
TR01 | Transfer of patent right |