Summary of the invention
In view of this, the object of this invention is to provide a kind of implementation method and system of multiple network equipment intelligent operation logic, according to the logic needs of existing network operation, the operation logic of automation can be performed to multiple network equipment.
In order to achieve the above object, the invention provides a kind of implementation method of multiple network equipment intelligent operation logic, described method includes:
The operation logic file of step one, defining operation task, include parameter list and operation logic configures two parts, wherein operation logic is configured for the actual mechanical process describing whole operation task, be made up of several conversation element, described conversation element refers to the multiple logical operations combined for realizing specific objective;
Step 2, the multiple equipment selecting executable operations task or database;
Step 3, parse operation logical file, according to the conversation element in the configuration of precedence load operation logic successively, and by described conversation element content to selected multiple network equipment actuating logic operations,
Described logical operation can include:
Command-execution operation: for the command-execution operation to the network equipment, every bar command-execution operation at least includes command id cmdid, order body sendcmd, expects the information of response content ack, wherein sendcmd is sent to the operational order that the network equipment carries out performing, next step logical operation content that ack is after the network equipment performs corresponding operating, selects according to its response message returned.
In order to achieve the above object, present invention also offers a kind of system of multiple network equipment intelligent operation logic, include logical operation platform and several network equipments, described logical operation platform is connected by network with the network equipment, wherein:
Logical operation platform, for the operation logic file of defining operation task, select multiple equipment or the database of executable operations task, then several conversation element of operation logic configuration in load operation logical file successively sequentially, and by described conversation element content to selected multiple network equipment actuating logic operations
Described logical operation platform may further include:
Master control set, for read operation logical file, the multiple equipment select user or database carry out authentication, and several conversation element of operation logic configuration in load operation logical file successively sequentially, according to the action type in described conversation element belonging to logical operation, described logical operation is distributed to other device in platform and process;
Command-execution operation device, for receiving the command-execution operation that master control set sends, log in on the multiple network equipments corresponding to described conversation element, the order body of described command-execution operation is sent on described multiple network equipment, then multiple response nodes of the expectation response content of the response message returned after each network equipment executable operations and described command-execution operation are mated, the response node belonging to response matches condition that searching and described response message are consistent, finally the operation redirect direction of this response node is returned to master control set, instruction master control set continues next step logical operation of this network equipment.
Compared with prior art, the invention has the beneficial effects as follows: user can according to the demand of practical operation task, flexible defining operation logical file, thus make the operation logic that multiple network equipment can set according to user, simultaneously or sequentially the operation of batch actuating logic; Described logical operation includes command-execution operation, database manipulation, files passe or passes down all basic operational capabilities that operation etc. can meet existing network demand, and has expandability flexibly; The present invention can continue next step content of operation according to the practical operation executing state of equipment, the correlation that the operation such as support order, branch, circulation performs, thus there is the logic control ability of complete function, can greatly reduce manually-operated complexity and workload, solve the problem that in existing network operation, many, the hand-manipulated reliabilities of equipment are low, the various equipment operating occasions such as example inspection, malfunction elimination, upgrading can be widely used in.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly, below in conjunction with accompanying drawing, the present invention is described in further detail.
As shown in Figure 1, the implementation method of a kind of multiple network equipment intelligent operation logic of the present invention, includes:
The operation logic file of step one, defining operation task, described operation logic file adopts the coded system of XML, includes parameter list (PALALIST) and operation logic configuration (LOGIC_CONF) two parts.Wherein parameter list is for preserving the set of user's parameter to be entered, described parameter list can include multiple Parameter nodes, each Parameter nodes represents the input parameter of a user, and described Parameter nodes can include the information such as parameter name, parametric description information, parameter default; Described operation logic is configured for the actual mechanical process describing whole operation task, can be made up of several conversation element, and described conversation element refers to the multiple logical operations combined for realizing specific objective.Such as, described conversation element can be made up of multiple logical operations with same operation type;
Step 2, the multiple equipment host or database D Bserver selecting operation task to perform, wherein host is the network equipment name of actuating logic operation, and DBserver is the database name of actuating logic operation.Multiple conversation element in described operation logic configuration can correspond to identical equipment or database, also specific equipment or database can be corresponded to, that is, can simultaneously concurrence performance is identical on multiple network equipment logical operation, also on the different network equipments, order can perform different logical operation.The described network equipment can be computer, fire compartment wall, switch, router, signaling foreground etc., and is not limited thereto.
Step 3, parse operation logical file, according to the conversation element in the configuration of precedence load operation logic successively, and by described conversation element content to selected multiple network equipment actuating logic operations.
In the present invention, user according to the actual needs of operation task, can perform the logical operations such as order, database SQL operation, ftp file transmission such as telnet or ssh of batch to multiple network equipment or database simultaneously.Divide by action type, described logical operation can include:
(1), command-execution operation: such as, for the command operation to the network equipment, logon account.Every bar command-execution operation at least includes command id (cmdid), order body (sendcmd), expects the information such as response content (ack).Wherein sendcmd is sent to the operational order that the network equipment carries out performing, next step logical operation content that ack is after the network equipment performs corresponding operating, selects according to its response message returned.Described ack may further include multiple response node, each response Node configuration has the information such as response matches condition and operation redirect direction, the present invention can be mated according to the response matches condition of precedence by the response message of the network equipment and response node, when the response message of the described network equipment meets the response matches condition set by one of them response node, described operation task, according to the operation redirect direction of this response node, continues next step operation.Described operation redirect direction can be run succeeded and terminate this conversation element, perform unsuccessfully and terminate this conversation element or jump to another logical operation in this conversation element.
(2), database manipulation: for operating database.Every bar database manipulation at least can include SQL execute statement (sendsql) and alarm configuration information.Wherein sendsql is sent to the SQL statement that database carries out performing, and alarm configuration information is by the actual execution result of SQL execute statement compared with desired execution result, if the warning content that there are differences and produce.
(3), files passe or pass operation down: for the files passe between the network equipment and destination network device or down operation.Described files passe or down biography operation pass operation under can also being further subdivided into files passe operation and file.The described network equipment and destination network device can be many-to-one operative relationship, in other words: files passe operation is in FTP or SFTP mode, by the files passe on multiple network equipment in destination network device, the such as centralized backup of multiple network equipment file; File down biography operates in FTP or SFTP mode, by the file download on destination network device to multiple network equipment, and the concentrated derivation of such as destination network device file.
Every bar file upload operation at least can include the information such as local file path (localfiledir), local file (localfile), target device (remote-host), destination path (remotedir), wherein, localfiledir deposits path by upload file on the network equipment, localfile is by the title of upload file on the network equipment, remote-host is destination network device name, and remotedir is the path that destination network device file stores upload file; Every bar file down biography operation at least can include the information such as local path (localdir), target device (remote-host), file destination path (remotefiledir), file destination (remotefile), wherein, localdir is the path that the network equipment stores download file, remotefiledir be destination network device is downloaded file deposit path, remotefile is title destination network device being downloaded file.
Described step one, user can also be customized by graphic interface, generate corresponding operation logic file.Due to when defining operation logical file, may be comparatively complicated because of operating process, cause operation logic file dilatory, loaded down with trivial details, not readability, not easily the problem such as to write, because conventional in operating process, flow process is almost constant multiple logical operation set can be arranged to logical-tag by the present invention, logical-tag storehouse is formed again by all kinds of logical-tag, like this when defining operation logical file, only need directly to use specific logical-tag can complete the definition of specific a large amount of operation.
Described step 3, user can manually boot operation task, or the timing of setting operation task performs.
As shown in Figure 2, Fig. 1 step 3 can further include:
Step 31, the content of operation logic file is read in internal memory;
Step 32, to user select equipment or database authentication: for user select multiple equipment or database, check that whether user is to this equipment or database one by one, have the logical operation authority comprised in operation logic file? if had, then continue next step; If not, then from multiple equipment or database of user's selection, reject this equipment or database, and send information to user, continue next step;
Parameter name during step 33, parameter value replacement operation logic user inputted configure;
Each conversation element in the configuration of step 34, load operation logic successively, and perform corresponding operating.
In Fig. 2 step 34, when the logical operation comprised in conversation element belongs to different action types, its implementation is also different.Wherein:
A, when the logical operation that described conversation element comprises is command-execution operation, described step 34 includes further:
Steps A 1, to sign in on multiple network equipments corresponding to described conversation element, and press operation logic reading order executable operations;
The present invention can adopt telnet, ssh, su or their compound mode etc. to sign in on the corresponding network equipment.
Steps A 2, order body in described command-execution operation is sent on described multiple network equipment, then the response message returned after receiving each network equipment executable operations, the response matches condition of described response message and command-execution operation multiple response nodes that content to be answered defines mid-term is mated, the response node belonging to response matches condition that searching and response message are consistent, and according to the operation redirect direction of this response node, continue next step logical operation of each network equipment respectively, until each network equipment is finished in the logical operation content of this conversation element.
The response message returned due to each network equipment may be different, and therefore the operation redirect direction of each network equipment is also likely different, and that is, next step logical operation content of each network equipment also may be different.
B, when the logical operation that described conversation element comprises is database manipulation, described step 34 includes further:
Step B1, to sign in on multiple databases corresponding to described conversation element, and press the operation of operation logic reading database;
Step B2, the SQL execute statement in described database manipulation is sent on described multiple database, then by the actual execution result of SQL execute statement on each database compared with the execution result of expectation, if there are differences, alarm, and continue next step logical operation content performing this conversation element.
C, when the logical operation that described conversation element comprises be files passe operation time, described step 34 includes further:
Step C1, to sign in on multiple network equipment corresponding to described conversation element and destination network device in FTP or SFTP mode, and read the operation of described files passe by operation logic;
Step C2, the local file path (localfiledir) according to comprising in described files passe operation, local file (localfile), target device (remote-host), destination path (remotedir) information, specified file on described multiple network equipment is copied in system, then continue by the files passe that copies in system in destination network device, and continue next step logical operation content performing this conversation element.
D, when passing operation under the logical operation that described conversation element comprises is file, described step 34 includes further:
Step D1, to sign in on multiple network equipment corresponding to described conversation element and destination network device in FTP or SFTP mode, and pass operation by under operation logic file reading;
Step D2, according to described file pass down comprise in operation local path (localdir), target device (remote-host), file destination path (remotefiledir), file destination (remotefile) information, by the file copy on described destination network device in system, then continue by the file download that copies in system on described multiple network equipment, and continue next step logical operation content performing this conversation element.
As shown in Figure 3, the system of a kind of multiple network equipment intelligent operation logic of the present invention, include logical operation platform and several network equipments, described logical operation platform is connected by network with the network equipment, wherein:
Logical operation platform, for the operation logic file of defining operation task, select multiple equipment or the database of executable operations task, then several conversation element of operation logic configuration in load operation logical file successively sequentially, and by described conversation element content to selected multiple network equipment actuating logics operations.
Described logical operation platform can be connected with the network equipment by mobile network or the Internet.
As shown in Figure 4, described logical operation platform may further include:
Master control set, for read operation logical file, the multiple equipment select user or database carry out authentication, and several conversation element of operation logic configuration in load operation logical file successively sequentially, according to the action type in described conversation element belonging to logical operation, described logical operation is distributed to other device in platform and process;
Command-execution operation device, for receiving the command-execution operation that master control set sends, log in on the multiple network equipments corresponding to described conversation element, the order body of described command-execution operation is sent on described multiple network equipment, then multiple response nodes of the expectation response content of the response message returned after each network equipment executable operations and described command-execution operation are mated, the response node belonging to response matches condition that searching and described response message are consistent, finally the operation redirect direction of this response node is returned to master control set, instruction master control set continues next step logical operation of this network equipment,
Database manipulation device, for receiving the database manipulation that master control set sends, sign in on the multiple databases corresponding to described conversation element, the SQL execute statement of described database manipulation is sent on described multiple database, then by the actual execution result of SQL execute statement on each database compared with the execution result of expectation, if there are differences, alarm, and indicate master control set to continue next step logical operation;
Files passe operating means, for receiving the files passe operation that master control set sends, sign in on multiple network equipment corresponding to described conversation element and destination network device in FTP or SFTP mode, according to described files passe operate comprise local file path, local file, target device, destination path information, specified file on described multiple network equipment is copied in system, then continue by the files passe that copies in system in destination network device, and indicate master control set to continue next step logical operation;
Operating means is passed under file, for receiving the conversation element content that master control set sends, sign in on multiple network equipment corresponding to described conversation element and destination network device in FTP or SFTP mode, local path that operation comprises, target device, file destination path, file destination information is passed down according to described file, by the file copy on described destination network device in system, then continue by the file download that copies in system on described multiple network equipment, and indicate master control set to continue next step logical operation.