WO2021103948A1 - 一种执行配置指令的方法及装置 - Google Patents

一种执行配置指令的方法及装置 Download PDF

Info

Publication number
WO2021103948A1
WO2021103948A1 PCT/CN2020/125914 CN2020125914W WO2021103948A1 WO 2021103948 A1 WO2021103948 A1 WO 2021103948A1 CN 2020125914 W CN2020125914 W CN 2020125914W WO 2021103948 A1 WO2021103948 A1 WO 2021103948A1
Authority
WO
WIPO (PCT)
Prior art keywords
configuration
instruction
network device
data
library
Prior art date
Application number
PCT/CN2020/125914
Other languages
English (en)
French (fr)
Inventor
申毅
吴志强
吴一娜
严峻岭
袁航
祖立军
张翔
吴金坛
Original Assignee
中国银联股份有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 中国银联股份有限公司 filed Critical 中国银联股份有限公司
Publication of WO2021103948A1 publication Critical patent/WO2021103948A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0866Checking the configuration

Definitions

  • the present invention relates to the technical field of network operation and maintenance, in particular to a method and device for executing configuration instructions.
  • command lines to configure network devices is a common way of network operation and maintenance.
  • the technician enters the command through the keyboard and sends it to the device; after the device receives the command, it executes it; after the configuration takes effect, the technician can directly view the effect from the command line interface The command.
  • the disadvantage of this method is that it requires manual input of instructions, which is inefficient, and it is impossible to verify the accuracy of the configuration during the configuration process.
  • the present invention provides a method and device for executing configuration instructions, which are used to solve the problem of insufficient accuracy of execution of configuration instructions by a runtime library of a network device.
  • an embodiment of the present invention provides a method for executing a configuration instruction.
  • the method includes: issuing a first configuration instruction to a verification library of a network device, and the verification library has the same value as that in the runtime library of the network device.
  • the first configuration instruction in the verification library of the network device executes the first configuration instruction in the verification library of the network device, obtain the second configuration file after the instruction is executed, and compare the configuration file with the first configuration file to determine the different configuration data in the two files, If the second configuration command generated according to different configuration data matches the first configuration command, then any one of these two commands is issued to the runtime library. Since the verification library of the network device synchronizes the configuration data of the runtime library, after the verification library of the network device successfully executes the configuration instruction, the configuration instruction is issued to the runtime library, thereby improving the accuracy of the execution of the configuration instruction by the runtime library of the network device Sex.
  • the method before issuing the first configuration instruction to the verification library of the network device, the method further includes: issuing a synchronization instruction to the network device, where the synchronization instruction is used to instruct the network device Synchronizing the first configuration file of the runtime library to the verification library; after obtaining the second configuration file after the verification library executes the first configuration instruction, the method further includes: downloading to the network device Sending a clear instruction, the clear instruction being used to instruct the network device to clear the verification library.
  • the verification library can have the same general environment as the runtime library. Therefore, the verification library can be used to execute the first configuration instruction. Data to illustrate the effect of the runtime library running the first configuration instruction; the clear instruction is used to clear the file in the verification library.
  • after the issuing a synchronization instruction to the network device it further includes: after synchronization, issuing a lock instruction to the network device, where the lock instruction is used to instruct to lock the verification Library; after obtaining the second configuration file after the verification library executes the first configuration instruction, and before issuing a clear instruction to the network device, it further includes: issuing an unlock instruction to the network device, so The unlock instruction is used to instruct to unlock the verification library.
  • the generating of the second configuration instruction according to the different configuration data includes: determining, according to the first configuration file and the second configuration file, which configuration data corresponds to the different configuration data Operational attributes; obtain the dependent data of the different configuration data from the first configuration file or the second configuration file; the dependent data is data located in the same directory as the different configuration data; according to the The different configuration data, the dependent data, and the operation attribute are used to generate the second configuration instruction.
  • the different configuration data between the two and the corresponding operational attributes of the different configuration data can be determined; the dependent data of the different configuration data can be obtained, so that the The configuration data, dependent data, and operation attributes of the configuration data, generate a second configuration instruction.
  • the first configuration instruction is a Netconf command
  • the second configuration instruction is a command line
  • the first configuration file and the second configuration file are in XML format.
  • the generating the second configuration instruction according to the different configuration data, the dependent data, and the operation attribute includes: according to the different configuration data, the dependent data, and the dependent Data and the operational attributes to generate a configuration data structure, wherein the different configuration data and the dependent data are recorded in the configuration data structure in the form of key-value pairs; determine the configuration data structure Each key corresponds to a field in the command line format, and the key value corresponding to each key is determined as the value of each field; according to the operation attribute, each field, and the value of each field, the second command line format is generated Configuration instructions.
  • determining that the second configuration instruction matches the first configuration instruction in the following manner includes: combining a Netconf format Netconf command with the second configuration instruction in a command line format through a machine The way of learning determines whether it matches.
  • the machine learning method is used to determine whether the first configuration instruction matches the second configuration instruction, which greatly reduces the work of manual review and realizes the automatic review effect of the configuration instruction by the network device.
  • the present invention provides a device for executing configuration instructions.
  • the device includes: a first issuing unit configured to issue a first configuration instruction to a verification library of a network device, the verification library having a connection with the network A first configuration file with the same operating library of the device; an obtaining unit for obtaining a second configuration file after the verification library has executed the first configuration instruction; a determining unit for determining the first configuration file and the Different configuration data in the second configuration file; a generating unit, configured to generate a second configuration instruction according to the different configuration data; a second issuing unit, configured to compare the second configuration instruction with the first configuration instruction When matching, the first configuration instruction or the second configuration instruction is issued to the runtime library.
  • the first configuration instruction in the verification library of the network device executes the first configuration instruction in the verification library of the network device, obtain the second configuration file after the instruction is executed, and compare the configuration file with the first configuration file to determine the different configuration data in the two files, If the second configuration command generated according to different configuration data matches the first configuration command, then any one of these two commands is issued to the runtime library. Since the verification library of the network device synchronizes the configuration data of the runtime library, after the verification library of the network device successfully executes the configuration instruction, the configuration instruction is issued to the runtime library, thereby improving the accuracy of the execution of the configuration instruction by the runtime library of the network device Sex.
  • the first issuing unit before the first configuration instruction is issued to the verification library of the network device, the first issuing unit is specifically configured to issue a synchronization instruction to the network device, and the synchronization instruction Is used to instruct the network device to synchronize the first configuration file of the runtime library to the verification library; after obtaining the second configuration file after the verification library executes the first configuration instruction, the The first issuing unit is specifically configured to issue a clear instruction to the network device, where the clear instruction is used to instruct the network device to clear the verification library.
  • the verification library can have the same general environment as the runtime library. Therefore, the verification library can be used to execute the first configuration instruction. Data to illustrate the effect of the runtime library running the first configuration instruction; the clear instruction is used to clear the file in the verification library.
  • the first issuing unit is further configured to issue a lock instruction to the network device after synchronization; the lock instruction Used to instruct to lock the verification library; after the acquisition of the second configuration file after the verification library executes the first configuration instruction, and before issuing a clear instruction to the network device, the first issuing unit It is also used to issue an unlocking instruction to the network device; the unlocking instruction is used to instruct to unlock the verification library.
  • the second configuration instruction is generated according to the different configuration data
  • the determining unit is specifically configured to determine the difference according to the first configuration file and the second configuration file.
  • Operation attribute corresponding to the configuration data of the configuration data the obtaining unit is specifically configured to obtain the dependent data of the different configuration data from the first configuration file or the second configuration file; the dependent data is different from the The configuration data of is located in the same directory; the generating unit is specifically configured to generate the second configuration instruction according to the different configuration data, the dependent data, and the operation attribute.
  • the different configuration data between the two and the corresponding operational attributes of the different configuration data can be determined; the dependent data of the different configuration data can be obtained, so that the The configuration data, dependent data, and operation attributes of the configuration data, generate a second configuration instruction.
  • the first configuration instruction is a Netconf command
  • the second configuration instruction is a command line
  • the first configuration data and the second configuration data are in XML format.
  • the second configuration instruction is generated according to the different configuration data, the dependent data, and the operation attribute
  • the generating unit is specifically configured to follow the same structure, according to The different configuration data, the dependent data, and the operation attribute generate a configuration data structure, wherein the different configuration data and the dependent data are recorded in the configuration data structure in the form of key-value pairs
  • the determining unit is specifically configured to determine the command line format field corresponding to each key in the configuration data structure, and determine the key value corresponding to each key as the value of each field; the generating unit is also used to determine the value of each field according to The operation attributes, the fields, and the values of the fields generate the second configuration instruction in a command line format.
  • the determining unit is further configured to determine whether the Netconf command in the Netconf format and the second configuration instruction in the command line format match through machine learning.
  • the machine learning method is used to determine whether the first configuration instruction matches the second configuration instruction, which greatly reduces the work of manual review and realizes the automatic review effect of the configuration instruction by the network device.
  • an embodiment of the present invention provides a computing device, including:
  • Memory used to store program instructions
  • the processor is configured to call the program instructions stored in the memory, and execute the method according to any one of the first aspects according to the obtained program.
  • an embodiment of the present invention provides a computer-readable storage medium that stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute any of the operations described in the first aspect. method.
  • FIG. 1 is a method for executing configuration instructions provided by an embodiment of the present invention
  • FIG. 2 is a schematic diagram of modifying the IP of an interface according to an embodiment of the present invention.
  • FIG. 3 is an information diagram of a second configuration file provided by an embodiment of the present invention.
  • Figure 4 is a diagram of a synchronization instruction provided by an embodiment of the present invention.
  • FIG. 5 is a clear instruction diagram provided by an embodiment of the present invention.
  • FIG. 6 is a diagram of a lock instruction provided by an embodiment of the present invention.
  • Figure 7 is an unlocking instruction diagram provided by an embodiment of the present invention.
  • FIG. 8 is a process diagram of determining different configuration data according to an embodiment of the present invention.
  • FIG. 9 is a schematic diagram of a configuration data structure provided by an embodiment of the present invention.
  • FIG. 10 is a schematic diagram of a process of converting a configuration data structure to a command line according to an embodiment of the present invention
  • FIG. 11 is an optimized second configuration instruction provided by an embodiment of the present invention.
  • FIG. 12 is a device for executing configuration instructions provided by an embodiment of the present invention.
  • FIG. 1 it is a method for executing configuration instructions provided by an embodiment of the present invention.
  • the method includes the following steps:
  • Step 101 Issue a first configuration instruction to a verification library of a network device, the verification library having the same first configuration file as in the runtime library of the network device.
  • Step 102 Obtain a second configuration file after the verification library executes the first configuration instruction.
  • Step 103 Determine different configuration data in the first configuration file and the second configuration file.
  • Step 104 Generate a second configuration instruction according to the different configuration data.
  • Step 105 When the second configuration instruction matches the first configuration instruction, issue the first configuration instruction or the second configuration instruction to the runtime library.
  • the first configuration instruction in the verification library of the network device executes the first configuration instruction in the verification library of the network device, obtain the second configuration file after the instruction is executed, and compare the configuration file with the first configuration file to determine the different configuration data in the two files, If the second configuration command generated according to different configuration data matches the first configuration command, then any one of these two commands is issued to the runtime library. Since the verification library of the network device synchronizes the configuration data of the runtime library, after the verification library of the network device successfully executes the configuration instruction, the configuration instruction is issued to the runtime library, thereby improving the accuracy of the execution of the configuration instruction by the runtime library of the network device Sex.
  • the embodiment of the present invention can detect the accuracy of the configuration instruction in the verification library of the network device.
  • the first configuration instruction is issued to the verification library of the network device, and the verification library has the same first configuration file as in the runtime library of the network device.
  • Network operation and maintenance is different from system operation and maintenance. If there is a misoperation in the system operation and maintenance, it will affect the system to the greatest extent; but in the network operation and maintenance, if the command issued to a certain switch or router is wrong, it will cause the communication of the entire business area. The impact, even in some core nodes (such as cross-data center edge routers), may cause fluctuations or interruptions in the overall data center network transmission.
  • FIG. 2 is a schematic diagram of modifying the IP of an interface according to an embodiment of the present invention.
  • the network equipment operation and maintenance personnel fill in the form on the front page of the controller. For example, it is necessary to change the IP address of the G0/3/0 interface from 192.168.10.1/24 (corresponding to the part above the dotted line in Figure 2, and the IP address includes the mask (Mask ) Part, here 24) is modified to 192.168.10.2/24 (corresponding to the part below the dotted line in Figure 2, the IP address includes the mask part, here 24).
  • the system will generate the corresponding Netconf command according to this form information, that is, the first configuration command.
  • network equipment operation and maintenance personnel may fill in the wrong information in the form on the front page of the controller.
  • the operation that needs to be performed on the network device this time is to change the IP address of the G0/3/0 interface from 192.168.10.1/24 to 192.168.10.2/24, but in fact, the operation and maintenance personnel incorrectly filled in the IP address to be modified 192.168.10.3/24;
  • the system modifies the IP address of the G0/3/0 interface on the network device according to the generated Netconf command, an error may still occur.
  • the final effective configuration result is to modify the IP address of the G0/3/3 interface to 192.168.10.2/24.
  • the verification library has the same first configuration file as the operating library of the network device. That is, by allowing the verification library of the network device to simulate the large environment of the runtime library of the network device, when the first configuration instruction is issued to the verification library of the network device, the data obtained after the verification library executes the first configuration instruction, It can be used to illustrate the situation after the first configuration instruction is executed by the runtime library of the network device.
  • step 102 the second configuration file after the verification library executes the first configuration instruction is obtained.
  • a second configuration file after the verification library executes the first configuration instruction can be obtained.
  • the obtained second configuration file information is shown in Figure 3.
  • FIG. 3 is an information diagram of a second configuration file provided by an embodiment of the present invention
  • the second configuration file is a Netconf command line and is written in an XML format. As shown in the dotted line in Figure 3, it means that the IP address of the G0/3/0 interface is 192.168.10.2/24.
  • the method before issuing the first configuration instruction to the verification library of the network device, the method further includes: issuing a synchronization instruction to the network device, where the synchronization instruction is used to instruct the network device to use the runtime library The first configuration file is synchronized to the verification library; after obtaining the second configuration file after the verification library executes the first configuration instruction, the method further includes: issuing a clear instruction to the network device, so The clear instruction is used to instruct the network device to clear the verification library.
  • the configuration file of the network device that is, the first configuration file
  • the runtime library of the network device When you are not sure whether the result of the Netconf command issued and executed by the runtime is consistent with the intention of this operation, that is, you are not sure whether the Netconf command is accurately executed by the runtime. Therefore, it is necessary to pre-execute the Netconf command in the verification library of the network device.
  • a synchronization instruction can be issued to the network device, and the synchronization instruction is used to instruct the network device Synchronize the first configuration file of the runtime library to the verification library.
  • FIG. 4 it is a synchronization instruction diagram provided by an embodiment of the present invention.
  • the copy-config command in the Netconf command line is used to instruct to synchronize the data of the running library (running) to the verification library (candidate).
  • the verification library of the network device does not store the configuration file of the network device.
  • the data in the verification library needs to be cleared in time. That is, when the second configuration file after the first configuration instruction is executed by the verification library is obtained, a clear instruction can be issued to the network device, and the clear instruction is used to instruct the network device to clear the verification library.
  • FIG. 5 it is a clear instruction diagram provided by an embodiment of the present invention.
  • the clear command in the Netconf command line is used to instruct to clear the data in the candidate database.
  • the method further includes: after synchronization, issuing a lock instruction to the network device, where the lock instruction is used to instruct to lock the verification library; and the obtaining After the verification library executes the second configuration file after the first configuration instruction, and before issuing a clear instruction to the network device, the verification library further includes: issuing an unlock instruction to the network device, where the unlock instruction is used for Instruct to unlock the verification library.
  • the network device in order to ensure that the verification library is not interfered by other Netconf commands at the same time during the execution of the current Netconf command, it is possible to issue a lock command to the network device immediately after the synchronization command is issued to the network device.
  • the lock instruction is used to instruct to lock the verification library.
  • FIG. 6 it is a lock instruction diagram provided by an embodiment of the present invention.
  • the lock command in the Netconf command line is used to instruct the verification library (candidate) to be locked.
  • the network device cannot perform the operation of clearing the verification library data. Therefore, after obtaining the second configuration file in the verification library, and before issuing the clear instruction to the network device , An unlocking instruction can be issued to the network device, and the unlocking instruction is used to instruct to unlock the verification library.
  • FIG. 7 it is an unlocking instruction diagram provided by an embodiment of the present invention.
  • the unlock (unlock) command in the Netconf command line is used to instruct the locked verification library (candidate) to unlock.
  • step 103 it is determined that the configuration data in the first configuration file and the second configuration file are different.
  • FIG 8 is a process diagram for determining different configuration data provided by an embodiment of the present invention.
  • the Netconf command line is compared line by line: the first line of the second configuration file on the left and the first line of the first configuration file on the right.
  • the line information is compared.
  • the second line of the second configuration file on the left is compared with the second line of the first configuration file on the right.
  • the comparison process of the Netconf command lines of other lines is not repeated here.
  • a second configuration instruction is generated according to the different configuration data.
  • the first configuration instruction is a Netconf command
  • the second configuration instruction is a command line
  • the first configuration file and the second configuration file are in XML format.
  • the generating a second configuration instruction according to the different configuration data includes: determining an operation attribute corresponding to the different configuration data according to the first configuration file and the second configuration file;
  • the dependent data of the different configuration data is obtained in the first configuration file or the second configuration file;
  • the dependent data is data located in the same directory as the different configuration data; according to the different configuration data ,
  • the dependent data and the operation attribute generate the second configuration instruction.
  • the configuration data is "192.168.10.2", it can be determined that the operation corresponding to this different configuration data is to modify the IP address; because the IP address has a specific corresponding interface (interface), and the IP address usually carries its own mask. Code (can also be expressed as prefix-length), interface and mask these two pieces of information can be regarded as the dependent data of the IP address, these two pieces of dependent data are located in the same directory as the IP address.
  • the interface for example, 192.168.10.2
  • the mask of the IP address for example, 24
  • These dependent data can be obtained from the first configuration file on the right side of FIG. 8 or the second configuration file on the left side of FIG. 8.
  • a second configuration command can be generated.
  • the generating the second configuration instruction according to the different configuration data, the dependent data, and the operation attribute includes: according to the same structure, according to the different configuration data, the dependency Data and the operational attributes to generate a configuration data structure, wherein the different configuration data and the dependent data are recorded in the configuration data structure in the form of key-value pairs; determine the configuration data structure Each key corresponds to a field in the command line format, and the key value corresponding to each key is determined as the value of each field; according to the operation attribute, each field, and the value of each field, the second command line format is generated Configuration instructions.
  • FIG. 9 is a schematic diagram of a configuration data structure provided by an embodiment of the present invention.
  • the different configuration data "192.168.10.2/24" (its operation attribute is the modification of the interface IP) is located, it can be found by searching that there are two dependent data in the same directory as "192.168.10.2/24"
  • the items are interface and prefix-length respectively, so the configuration data structure shown in Figure 9 is generated.
  • different configuration data and dependent data are recorded in the configuration data structure in the form of key-value pairs.
  • interface is the key of GigabitEthernet0/3/0
  • GigabitEthernet0/3/0 is the value of interface
  • ip:address is The keys of 192.168.10.2 and prefix-length, 192.168.10.2 and prefix-length are the values of ip:address.
  • FIG. 10 it is a schematic diagram of a process of converting a configuration data structure to a command line according to an embodiment of the present invention, where the left side represents the configuration data structure, and the right side represents the command line.
  • the interface key in the configuration data structure it can be determined that the field in the command line is interface.
  • the ip:address key in the configuration data structure it can be determined that the field in the command line is ip:address; according to the configuration
  • the value of GigabitEthernet0/3/0 in the data structure can be determined to be GigabitEthernet0/3/0 in the interface field; according to the value of 192.168.10.2 in the configuration data structure, it can be determined that it is in ip:address
  • the value corresponding to the field is 192.168.10.2; according to the prefix-length value in the configuration data structure, it can be determined that the value corresponding to the field ip:address is 255.255.255.0, and the command line on the right side of Figure 10 is obtained. , Which is the second configuration instruction.
  • this configuration command is to modify the interface IP, that is, the operation attribute is modification.
  • the second configuration command can be optimized, and the optimized one can be obtained in the order of first deletion and then addition.
  • the second configuration instruction Refer to FIG. 11, which is an optimized second configuration command provided by an embodiment of the present invention. Compared with the command line on the right side of FIG. 10 (that is, the second configuration command), undo ip address 192.168 is added in FIG. 11 .10.1 255.255.255.0, that is, a command to delete the original IP address is added, and then to reset the IP address for G0/3/0, this command line is: ip address 192.168.10.2 255.255.255.0.
  • step 105 when the second configuration instruction matches the first configuration instruction, the first configuration instruction or the second configuration instruction is issued to the runtime library.
  • determining that the second configuration instruction matches the first configuration instruction in the following manner includes: comparing the Netconf command in Netconf format with the second configuration instruction in command line format, and determining whether or not by means of machine learning match.
  • the second configuration instruction After obtaining the second configuration instruction, that is, the second configuration instruction in the command line format, the second configuration instruction is input into the machine learning model for learning. During the learning process, the system will combine the data of the first configuration instruction to review the relevant syntax and parameters of the second configuration instruction. After the learning is over, when it is confirmed that the second configuration instruction matches the first configuration instruction, the technician can independently choose to issue the first configuration instruction or the second configuration instruction to the runtime library, and let the runtime library execute the review and pass Both the first configuration instruction or the second configuration instruction can achieve an ideal configuration effect without causing configuration errors.
  • an exception indication is returned. That is, if it is determined through machine learning that the second configuration instruction in the command line format does not match the Netconf command in the Netconf format, an abnormal indication will be returned on the display interface of the network device.
  • the purpose is to tell the technician that the first The configuration instruction or the second configuration instruction is issued to the runtime library of the network device, that is, once the first configuration instruction or the second configuration instruction that does not match this time is issued to the runtime library, it will bring unexpected results.
  • an embodiment of the present invention provides a device for executing configuration instructions. As shown in FIG. 12, the device includes:
  • the first issuing unit 1201 is configured to issue a first configuration instruction to a verification library of a network device, the verification library having the same first configuration file as the runtime library of the network device;
  • the obtaining unit 1202 is configured to obtain a second configuration file after the verification library executes the first configuration instruction
  • the determining unit 1203 is configured to determine different configuration data in the first configuration file and the second configuration file;
  • the generating unit 1204 is configured to generate a second configuration instruction according to the different configuration data
  • the second issuing unit 1205 is configured to issue the first configuration instruction or the second configuration instruction to the runtime library when the second configuration instruction matches the first configuration instruction.
  • the first issuing unit 1201 is specifically configured to issue a synchronization instruction to the network device, and the synchronization instruction is used to instruct the The network device synchronizes the first configuration file of the runtime library to the verification library; after acquiring the second configuration file after the verification library executes the first configuration instruction, the first issuing unit 1201 is specifically configured to issue a clear instruction to the network device, where the clear instruction is used to instruct the network device to clear the verification library.
  • the first issuing unit 1201 is further configured to issue a lock instruction to the network device after synchronization; the lock instruction is used to instruct to lock the network device.
  • the verification library after obtaining the second configuration file after the verification library executes the first configuration instruction, and before issuing a clear instruction to the network device, the first issuing unit 1201 is also used to The network device issues an unlocking instruction; the unlocking instruction is used to instruct to unlock the verification library.
  • the second configuration instruction is generated according to the different configuration data
  • the determining unit 1203 is specifically configured to determine the corresponding configuration data corresponding to the different configuration data according to the first configuration file and the second configuration file.
  • Operational attributes the obtaining unit 1202 is specifically configured to obtain dependent data of the different configuration data from the first configuration file or the second configuration file
  • the dependent data is the configuration data that is different from the configuration data located in the Data in the same directory
  • the generating unit 1204 is specifically configured to generate the second configuration instruction according to the different configuration data, the dependent data, and the operation attribute.
  • the first configuration instruction is a Netconf command
  • the second configuration instruction is a command line
  • the first configuration file and the second configuration file are in XML format.
  • the second configuration instruction is generated according to the different configuration data, the dependent data, and the operation attribute
  • the generating unit 1204 is specifically configured to perform according to the same structure and according to the different configuration Data, the dependent data, and the operation attribute to generate a configuration data structure, wherein the different configuration data and the dependent data are recorded in the configuration data structure in the form of key-value pairs
  • the determination The unit 1203 is specifically configured to determine the field of the command line format corresponding to each key in the configuration data structure, and determine the key value corresponding to each key as the value of each field
  • the generating unit 1204 is also used to determine the value of each field according to the operation
  • the attributes, the fields, and the values of the fields generate the second configuration instruction in a command line format.
  • the determining unit 1203 is further configured to determine whether the Netconf command in the Netconf format and the second configuration instruction in the command line format match through machine learning.
  • the embodiment of the present invention provides a computing device.
  • the computing device may specifically be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (Personal Digital Assistant, PDA), and the like.
  • the computing device may include a central processing unit (CPU), a memory, an input/output device, etc.
  • the input device may include a keyboard, a mouse, a touch screen, etc.
  • an output device may include a display device, such as a liquid crystal display (Liquid Crystal Display, LCD), Cathode Ray Tube (CRT), etc.
  • LCD liquid crystal display
  • CRT Cathode Ray Tube
  • the memory may include read-only memory (ROM) and random access memory (RAM), and provides the processor with program instructions and data stored in the memory.
  • the memory may be used to execute the program instructions of the configuration instruction method;
  • the processor is used to call the program instructions stored in the memory, and execute the configuration instruction method according to the obtained program.
  • the embodiment of the present invention provides a computer-readable storage medium, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to make a computer execute a configuration instruction method.
  • the embodiments of the present invention can be provided as a method or a computer program product. Therefore, the present invention may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
  • a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so that the computer or other programmable equipment is executed
  • the instructions provide steps for implementing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明提供一种执行配置指令的方法及装置,将第一配置指令下发至网络设备的验证库,验证库具有与网络设备的运行库中相同的第一配置文件;获取验证库执行第一配置指令后的第二配置文件;确定第一配置文件与第二配置文件中不同的配置数据;根据不同的配置数据生成第二配置指令;在第二配置指令与第一配置指令匹配时,将第一配置指令或第二配置指令下发至运行库。该方案由于网络设备的验证库同步了运行库的配置数据,从而在网络设备的验证库进行配置指令的验证,当网络设备的验证库成功执行下发的配置指令后,将该配置指令下发至运行库,从而提高了网络设备的运行库执行配置指令的准确性。

Description

一种执行配置指令的方法及装置
相关申请的交叉引用
本申请要求在2019年11月26日提交中国专利局、申请号为201911173679.3、申请名称为“一种执行配置指令的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及网络运维技术领域,尤其涉及一种执行配置指令的方法及装置。
背景技术
目前,采用命令行的方式对网络设备进行配置,是网络运维的一种常用方式。一般情况下,在网络设备自带的命令行界面,技术人员通过键盘输入指令并发送至设备;设备接收到指令后,予以执行;待配置生效后,技术人员能够从命令行界面直接查看到生效的命令。但该方法的不足之处在于需人工输入指令,效率低下,且无法在配置过程中核验配置是否准确。
网络运维过程中,当对某个交换机或者路由器下发错误的命令后,会对整个业务区的通信造成影响,甚至在一些核心节点(如跨数据中心边缘路由器),可能会造成整体数据中心网络传输的波动或中断。因此,网络运维中对配置的准确性核验异常重要。
因此,现有技术中对网络设备进行自动化配置的方法无法保证配置的准确性。
发明内容
本发明提供一种执行配置指令的方法及装置,用以解决网络设备的运行库执行配置指令的准确性不足的问题。
第一方面,本发明实施例提供一种执行配置指令的方法,该方法包括:将第一配置指令下发至网络设备的验证库,所述验证库具有与所述网络设备的运行库中相同的第一配置文件;获取所述验证库执行所述第一配置指令后的第二配置文件;确定所述第一配置文件与所述第二配置文件中不同的配置数据;根据所述不同的配置数据生成第二配置指令;在所述第二配置指令与所述第一配置指令匹配时,将所述第一配置指令或所述第二配置指令下发至所述运行库。
基于该方案,在网络设备的验证库中执行第一配置指令,获取到该指令被执行后的第二配置文件,比较该配置文件与第一配置文件来确定两份文件中不同的配置数据,若依据不同的配置数据所生成的第二配置指令与第一配置指令匹配时,则将这两项指令中任一指令下发至运行库。由于网络设备的验证库同步了运行库的配置数据,从而在网络设备的验证库成功执行配置指令后,将该配置指令下发至运行库,从而提高了网络设备的运行库执行配置指令的准确性。
在一种可能的实现方法中,所述将第一配置指令下发至网络设备的验证库之前,还包括:向所述网络设备下发同步指令,所述同步指令用于指示所述网络设备将所述运行库的所述第一配置文件同步至所述验证库;所述获取所述验证库执行所述第一配置指令后的第二配置文件之后,还包括:向所述网络设备下发清除指令,所述清除指令用于指示所述网络设备清空所述验证库。
基于该方案,通过将网络设备的运行库的第一配置文件同步至网络设备的验证库,可以使验证库具有与运行库的相同的大环境,因此可以用验证库执行了第一配置指令后的数据来说明运行库运行该第一配置指令的效果;清除指令用于清除验证库的文件。
在一种可能的实现方法中,所述向所述网络设备下发同步指令之后,还包括:在同步之后,向所述网络设备下发锁定指令,所述锁定指令用于指示锁定所述验证库;所述获取所述验证库执行所述第一配置指令后的第二配置 文件之后,且向所述网络设备下发清除指令之前,还包括:向所述网络设备下发解锁指令,所述解锁指令用于指示解锁所述验证库。
基于该方案,在同步之后,通过锁定验证库,可以保证对网络设备执行配置指令的操作全部从当前建立的会话下发,避免同时段有其他配置指令在验证库中下发;以及解锁指令用于解锁验证库。
在一种可能的实现方法中,所述根据所述不同的配置数据生成第二配置指令,包括:根据所述第一配置文件和所述第二配置文件,确定所述不同的配置数据对应的操作属性;从所述第一配置文件或所述第二配置文件中获取所述不同的配置数据的依赖数据;所述依赖数据为与所述不同的配置数据位于同一目录下的数据;根据所述不同的配置数据、所述依赖数据和所述操作属性,生成所述第二配置指令。
基于该方案,根据第一配置文件和第二配置文件,可以确定两者之间的不同配置数据以及该不同的配置数据对应的操作属性;获取该不同的配置数据的依赖数据,从而可以根据不同的配置数据、依赖数据以及操作属性,生成第二配置指令。
在一种可能的实现方法中,所述第一配置指令为Netconf命令;所述第二配置指令为命令行;所述第一配置文件和所述第二配置文件为XML格式。
基于该方案,在验证库中实现了Netconf命令到命令行的转换,有助于直观地查看验证库所执行的配置指令。
在一种可能的实现方法中,所述根据所述不同的配置数据、所述依赖数据和所述操作属性,生成所述第二配置指令,包括:根据所述不同的配置数据、所述依赖数据和所述操作属性,生成配置数据结构体,其中,所述不同的配置数据和所述依赖数据以键值对的方式记载在所述配置数据结构体中;确定所述配置数据结构体中各键对应的命令行格式的字段,并将各键对应的键值确定为各字段的值;根据所述操作属性、所述各字段和各字段的值,生成命令行格式的所述第二配置指令。
基于该方案,详细说明了Netconf命令到命令行的转换过程,转换过程中 还体现了操作属性,极大程度上说明第一配置指令在网络设备上生效的过程,最终将生效后的配置信息用命令行格式的第一配置指令表示出来。
在一种可能的实现方法中,通过如下方式确定所述第二配置指令与所述第一配置指令匹配,包括:将Netconf格式的Netconf命令与命令行格式的所述第二配置指令,通过机器学习的方式确定是否匹配。
基于该方案,通过机器学习的方式确定第一配置指令与第二配置指令是否匹配,极大地减少了人工审核的工作,实现了网络设备对配置指令的自动审核效果。
在一种可能的实现方法中,在所述第二配置指令与所述第一配置指令不匹配时,返回异常指示。
基于该方案,当第二配置指令与第一配置指令的审核结果为不匹配时,会返回一个异常指示,告诫本次配置指令失败,不能下发至验证库。
第二方面,本发明提供一种执行配置指令的装置,该装置包括:第一下发单元,用于将第一配置指令下发至网络设备的验证库,所述验证库具有与所述网络设备的运行库相同的第一配置文件;获取单元,用于获取所述验证库执行所述第一配置指令后的第二配置文件;确定单元,用于确定所述第一配置文件与所述第二配置文件中不同的配置数据;生成单元,用于根据所述不同的配置数据生成第二配置指令;第二下发单元,用于在所述第二配置指令与所述第一配置指令匹配时,将所述第一配置指令或所述第二配置指令下发至所述运行库。
基于该方案,在网络设备的验证库中执行第一配置指令,获取到该指令被执行后的第二配置文件,比较该配置文件与第一配置文件来确定两份文件中不同的配置数据,若依据不同的配置数据所生成的第二配置指令与第一配置指令匹配时,则将这两项指令中任一指令下发至运行库。由于网络设备的验证库同步了运行库的配置数据,从而在网络设备的验证库成功执行配置指令后,将该配置指令下发至运行库,从而提高了网络设备的运行库执行配置指令的准确性。
在一种可能的实现方法中,所述将第一配置指令下发至网络设备的验证库之前,所述第一下发单元具体用于向所述网络设备下发同步指令,所述同步指令用于指示所述网络设备将所述运行库的所述第一配置文件同步至所述验证库;所述获取所述验证库执行所述第一配置指令后的第二配置文件之后,所述第一下发单元具体用于向所述网络设备下发清除指令,所述清除指令用于指示所述网络设备清空所述验证库。
基于该方案,通过将网络设备的运行库的第一配置文件同步至网络设备的验证库,可以使验证库具有与运行库的相同的大环境,因此可以用验证库执行了第一配置指令后的数据来说明运行库运行该第一配置指令的效果;清除指令用于清除验证库的文件。
在一种可能的实现方法中,所述向所述网络设备下发同步指令之后,所述第一下发单元还用于在同步之后,向所述网络设备下发锁定指令;所述锁定指令用于指示锁定所述验证库;所述获取所述验证库执行所述第一配置指令后的第二配置文件之后,且向所述网络设备下发清除指令之前,所述第一下发单元还用于向所述网络设备下发解锁指令;所述解锁指令用于指示解锁所述验证库。
基于该方案,在同步之后,通过锁定验证库,可以保证对网络设备执行配置指令的操作全部从当前建立的会话下发,避免同时段有其他配置指令在验证库中下发;以及解锁指令用于解锁验证库。
在一种可能的实现方法中,所述根据所述不同的配置数据生成第二配置指令,所述确定单元具体用于根据所述第一配置文件和所述第二配置文件,确定所述不同的配置数据对应的操作属性;所述获取单元具体用于从所述第一配置文件或所述第二配置文件中获取所述不同的配置数据的依赖数据;所述依赖数据为与所述不同的配置数据位于同一目录下的数据;所述生成单元具体用于根据所述不同的配置数据、所述依赖数据和所述操作属性,生成所述第二配置指令。
基于该方案,根据第一配置文件和第二配置文件,可以确定两者之间的 不同配置数据以及该不同的配置数据对应的操作属性;获取该不同的配置数据的依赖数据,从而可以根据不同的配置数据、依赖数据以及操作属性,生成第二配置指令。
在一种可能的实现方法中,所述第一配置指令为Netconf命令;所述第二配置指令为命令行;所述第一配置数据和所述第二配置数据为XML格式。
基于该方案,在验证库中实现了Netconf命令到命令行的转换,有助于直观地查看验证库所执行的配置指令。
在一种可能的实现方法中,所述根据所述不同的配置数据、所述依赖数据和所述操作属性,生成所述第二配置指令,所述生成单元具体用于按照同一结构体,根据所述不同的配置数据、所述依赖数据和所述操作属性,生成配置数据结构体,其中,所述不同的配置数据和所述依赖数据以键值对的方式记载在所述配置数据结构体中;所述确定单元具体用于确定所述配置数据结构体中各键对应的命令行格式的字段,并将各键对应的键值确定为各字段的值;所述生成单元还用于根据所述操作属性、所述各字段和各字段的值,生成命令行格式的所述第二配置指令。
基于该方案,详细说明了Netconf命令到命令行的转换过程,转换过程中还体现了操作属性,极大程度上说明第一配置指令在网络设备上生效的过程,最终将生效后的配置信息用命令行格式的第一配置指令表示出来。
在一种可能的实现方法中,所述确定单元还用于将Netconf格式的Netconf命令与命令行格式的所述第二配置指令,通过机器学习的方式确定是否匹配。
基于该方案,通过机器学习的方式确定第一配置指令与第二配置指令是否匹配,极大地减少了人工审核的工作,实现了网络设备对配置指令的自动审核效果。
在一种可能的实现方法中,在所述第二配置指令与所述第一配置指令不匹配时,返回异常指示。
基于该方案,基于该方案,当第二配置指令与第一配置指令的审核结果为不匹配时,会返回一个异常指示,告诫本次配置指令失败,不能下发至验 证库。
第三方面,本发明实施例提供了一种计算设备,包括:
存储器,用于存储程序指令;
处理器,用于调用所述存储器中存储的程序指令,按照获得的程序执行如第一方面任一所述的方法。
第四方面,本发明实施例提供了一种计算机可读存储介质,所述计算机存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行如第一方面任一所述的方法。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的一种执行配置指令的方法;
图2为本发明实施例提供的一种修改接口IP的示意图;
图3为本发明实施例提供的一种第二配置文件信息图;
图4为本发明实施例提供的一种同步指令图;
图5为本发明实施例提供的一种清除指令图;
图6为本发明实施例提供的一种锁定指令图;
图7为本发明实施例提供的一种解锁指令图;
图8为本发明实施例提供的一种确定不同配置数据的过程图;
图9为本发明实施例提供的一种配置数据结构体的示意图;
图10为本发明实施例提供的一种由配置数据结构体转命令行的过程示意图;
图11为本发明实施例提供的一种优化后的第二配置指令;
图12为本发明实施例提供的一种执行配置指令的装置。
具体实施方式
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。
如图1所示,为本发明实施例提供的一种执行配置指令的方法,该方法包括以下步骤:
步骤101,将第一配置指令下发至网络设备的验证库,所述验证库具有与所述网络设备的运行库中相同的第一配置文件。
步骤102,获取所述验证库执行所述第一配置指令后的第二配置文件。
步骤103,确定所述第一配置文件与所述第二配置文件中不同的配置数据。
步骤104,根据所述不同的配置数据生成第二配置指令。
步骤105,在所述第二配置指令与所述第一配置指令匹配时,将所述第一配置指令或所述第二配置指令下发至所述运行库。
基于该方案,在网络设备的验证库中执行第一配置指令,获取到该指令被执行后的第二配置文件,比较该配置文件与第一配置文件来确定两份文件中不同的配置数据,若依据不同的配置数据所生成的第二配置指令与第一配置指令匹配时,则将这两项指令中任一指令下发至运行库。由于网络设备的验证库同步了运行库的配置数据,从而在网络设备的验证库成功执行配置指令后,将该配置指令下发至运行库,从而提高了网络设备的运行库执行配置指令的准确性。
对于网络设备进行运维,可以利用网络设备自带的两个配置库。一个是运行库,在运行库中下发执行配置的指令,该指令会直接生效,也即网络设备的相关配置会发生更改;一个是验证库,在验证库中下发执行配置的指令,该指令不会生效,也即网络设备的相关配置不会发生更改。因此,本发明实施例可以在网络设备的验证库中对配置指令的准确性进行检测。
在上述步骤101中,将第一配置指令下发至网络设备的验证库,所述验证库具有与所述网络设备的运行库中相同的第一配置文件。
网络运维不同于系统运维。如果在系统运维中出现误操作,则最大程度上是对该系统造成影响;但是如果在网络运维中,对某个交换机或者路由器下发的命令错误后,会对整个业务区的通信造成影响,甚至在一些核心节点(如跨数据中心边缘路由器),可能会造成整体数据中心网络传输的波动或中断。
参考图2,为本发明实施例提供的一种修改接口IP的示意图。网络设备运维人员在控制器的前端页面填写表单,比如需要将G0/3/0接口的IP地址由192.168.10.1/24(对应于图2中虚线以上部分,IP地址中包括掩码(Mask)部分,此处为24)修改为192.168.10.2/24(对应于图2中虚线以下部分,IP地址中包括掩码(Mask)部分,此处为24)。系统会根据此条表单信息生成相应的Netconf命令,即第一配置指令。
对于上述根据表单信息生成第一配置指令的过程,通过会存在以下三方面的问题:
第一,网络设备运维人员在控制器前端页面可能会填错表单的信息。比如本次对网络设备需要执行的操作是将G0/3/0接口的IP地址由192.168.10.1/24修改为192.168.10.2/24,而事实上运维人员将待修改的IP错填成了192.168.10.3/24;
第二,系统在根据此条表单信息生成相应的Netconf命令时,可能会生成错误的Netconf命令,这是Netconf协议的固有属性;
第三,系统根据所生成的Netconf命令,对网络设备进行修改G0/3/0接口的IP地址的操作时,仍然可能会产生错误。比如系统根据生成的Netconf命令,最后生效的配置结果是将G0/3/3接口的IP地址修改为了192.168.10.2/24。
如果将此次Netconf命令直接下发至运行库,考虑到以上三方面的原因,最终可能会导致对网络设备进行了错误配置,会造成无法挽回的后果。因此,在Netconf命令直接下发至运行库之前,需要借助网络设备的验证库,对网络 设备进行Netconf命令的预下发。
为了达到将G0/3/0接口的IP地址由192.168.10.1/24修改为192.168.10.2/24的配置结果,所述验证库具有与所述网络设备的运行库中相同的第一配置文件。也即,通过让网络设备的验证库模拟网络设备的运行库的大环境,因而在对网络设备的验证库下发第一配置指令时,验证库执行该第一配置指令后所得到的数据,可以用于说明该第一配置指令被网络设备的运行库执行后的情形。
在上述步骤102中,获取所述验证库执行所述第一配置指令后的第二配置文件。
当网络设备的验证库接收并执行第一配置指令后,可以得到验证库执行第一配置指令后的第二配置文件。
以前述将G0/3/0接口的IP地址由192.168.10.1/24修改为192.168.10.2/24为例,获取的第二配置文件信息如图3所示。参考图3,为本发明实施例提供的一种第二配置文件信息图,所述第二配置文件为Netconf命令行,采用了XML格式进行编写。如图3中的虚线部分的内容所示,表示G0/3/0接口的IP地址为192.168.10.2/24。
可选地,所述将第一配置指令下发至网络设备的验证库之前,还包括:向所述网络设备下发同步指令,所述同步指令用于指示所述网络设备将所述运行库的所述第一配置文件同步至所述验证库;所述获取所述验证库执行所述第一配置指令后的第二配置文件之后,还包括:向所述网络设备下发清除指令,所述清除指令用于指示所述网络设备清空所述验证库。
通常意义上来讲,网络设备的运行库中存储有网络设备的配置文件,也即第一配置文件。当不确定Netconf命令下发并由运行库执行后的结果是否是符合本次操作意图,即不确定Netconf命令是否被运行库准确执行。因此,需要在网络设备的验证库中预执行一次Netconf命令。因此在将第一配置指令下发至网络设备的验证库之前,需要保证验证库的环境与运行库的环境一致,即可以向所述网络设备下发同步指令,该同步指令用于指示网络设备将运行 库的第一配置文件同步至验证库。
如图4所示,为本发明实施例提供的一种同步指令图。Netconf命令行中的copy-config命令,用于指示将运行库(running)的数据同步至验证库(candidate)。
通常意义上来讲,网络设备的验证库是不存储网络设备的配置文件的,当通过验证库得到了需要的配置文件后,需要及时清除验证库中的数据。也即当获取到第一配置指令被验证库执行后的第二配置文件,可以向网络设备下发清除指令,该清除指令用于指示网络设备清空验证库。
如图5所示,为本发明实施例提供的一种清除指令图。Netconf命令行中的清除(clear)命令,用于指示将验证库(candidate)中的数据进行清空。
可选地,所述向所述网络设备下发同步指令之后,还包括:在同步之后,向所述网络设备下发锁定指令,所述锁定指令用于指示锁定所述验证库;所述获取所述验证库执行所述第一配置指令后的第二配置文件之后,且向所述网络设备下发清除指令之前,还包括:向所述网络设备下发解锁指令,所述解锁指令用于指示解锁所述验证库。
通常意义上来讲,为了保证验证库在执行当前的Netconf命令过程中不被同时段其他的Netconf命令干扰,因此,可以在向网络设备下发同步指令之后,紧接着向网络设备下发锁定指令,该锁定指令用于指示锁定验证库。
如图6所示,为本发明实施例提供的一种锁定指令图。Netconf命令行中的锁定(lock)命令,用于指示将验证库(candidate)进行锁定。
通常意义上来讲,当验证库处于锁定状态时,网络设备是不能够执行清空验证库数据的操作的,因此,在获取到验证库中第二配置文件后,且向网络设备下发清除指令之前,可以向网络设备下发解锁指令,该解锁指令用于指示解锁验证库。
如图7所示,为本发明实施例提供的一种解锁指令图。Netconf命令行中的解锁(unlock)命令,用于指示将处于锁定状态的验证库(candidate)进行解除锁定。
在上述步骤103中,确定所述第一配置文件与所述第二配置文件中不同配置数据。
以前述将G0/3/0接口的IP地址由192.168.10.1/24修改为192.168.10.2/24为例,确定第一配置文件与第二配置文件这两者间不同的配置数据的过程如图8所示。参考图8,为本发明实施例提供的一种确定不同配置数据的过程图,通过逐行比较Netconf命令行:左图第二配置文件的第1行信息与右图第一配置文件的第1行信息进行比较,左图第二配置文件的第2行信息与右图第一配置文件的第2行信息进行比较,对于其他各行的Netconf命令行的比较过程在此不赘述。可以发现:仅左侧的第二配置文件的箭头所指的第5行信息“192.168.10.2”与右侧的第一配置文件的箭头所指的第5行信息“192.168.10.1”这一行信息不同,其余各行信息相同。因此,确定第一配置文件与第二配置文件这两者间不同的配置数据为“192.168.10.2”。
在上述步骤104中,根据所述不同的配置数据生成第二配置指令。
可选地,所述第一配置指令为Netconf命令;所述第二配置指令为命令行;所述第一配置文件和所述第二配置文件为XML格式。
以前述将G0/3/0接口的IP地址由192.168.10.1/24修改为192.168.10.2/24为例,根据不同的配置数据“192.168.10.2”,可以生成第二配置指令,该第二配置指令为命令行。
可选地,所述根据所述不同的配置数据生成第二配置指令,包括:根据所述第一配置文件和所述第二配置文件,确定所述不同的配置数据对应的操作属性;从所述第一配置文件或所述第二配置文件中获取所述不同的配置数据的依赖数据;所述依赖数据为与所述不同的配置数据位于同一目录下的数据;根据所述不同的配置数据、所述依赖数据和所述操作属性,生成所述第二配置指令。
以前述将G0/3/0接口的IP地址由192.168.10.1/24修改为192.168.10.2/24为例,参考图8,通过左侧第二配置文件和右侧第一配置文件确定出不同的配置数据为“192.168.10.2”,可以确定这个不同的配置数据所对应的操作为对IP 地址进行修改;由于IP地址有具体对应着的接口(interface),并且,IP地址通常携带有自己的掩码(还可以表示为prefix-length),接口以及掩码这两项信息可以视为IP地址的依赖数据,这两项依赖数据与IP地址位于同一目录。也即,接口、接口的IP地址(例如,192.168.10.2)以及IP地址的掩码(例如,24)这三者联合起来表示一组完整的接口IP地址的信息(例如,192.168.10.2/24)。这些依赖数据可以从图8右侧的第一配置文件或者图8左侧的第二配置文件中获取。最后,根据不同的配置数据:(“192.168.10.2/24”)、依赖数据(接口和掩码)、以及操作属性(对IP地址进行修改),可以生成第二配置指令。
可选地,所述根据所述不同的配置数据、所述依赖数据和所述操作属性,生成所述第二配置指令,包括:按照同一结构体,根据所述不同的配置数据、所述依赖数据和所述操作属性,生成配置数据结构体,其中,所述不同的配置数据和所述依赖数据以键值对的方式记载在所述配置数据结构体中;确定所述配置数据结构体中各键对应的命令行格式的字段,并将各键对应的键值确定为各字段的值;根据所述操作属性、所述各字段和各字段的值,生成命令行格式的所述第二配置指令。
以前述将G0/3/0接口的IP地址由192.168.10.1/24修改为192.168.10.2/24为例,参考图9,为本发明实施例提供的一种配置数据结构体的示意图。其中,以不同的配置数据“192.168.10.2/24”(其操作属性为接口IP的修改)所在的目录为基准,通过查找可以发现与“192.168.10.2/24”所在同一目录的依赖数据有两项,分别为interface和prefix-length,因此生成了如图9所示的配置数据结构体。另外,不同的配置数据和依赖数据以键值对的方式记载在配置数据结构体中,具体地,interface为GigabitEthernet0/3/0的键,GigabitEthernet0/3/0为interface的值;ip:address为192.168.10.2以及prefix-length的键,192.168.10.2以及prefix-length为ip:address的值。
如图10所示,为本发明实施例提供的一种由配置数据结构体转命令行的过程示意图,其中,左侧表示配置数据结构体,右侧表示命令行。根据配置 数据结构中的interface键,可以确定出其在命令行中的字段为interface,根据配置数据结构中的ip:address键,可以确定出其在命令行中的字段为ip:address;根据配置数据结构中的GigabitEthernet0/3/0值,可以确定出其在以interface为字段对应的值为GigabitEthernet0/3/0;根据配置数据结构中的192.168.10.2值,可以确定出其在以ip:address为字段对应的值为192.168.10.2;根据配置数据结构中的prefix-length值,可以确定出其在以ip:address为字段对应的值为255.255.255.0,即得到了图10右侧的命令行,也即第二配置指令。
考虑到本次配置指令是修改接口IP,也即本次操作属性为修改,为了体现出修改的特色,可以将第二配置指令进行优化处理,按照先删除、再增加的顺序,得到优化后的第二配置指令。参考图11,为本发明实施例提供的一种优化后的第二配置指令,其中,对比于图10右侧的命令行(也即第二配置指令),图11中增加了undo ip address 192.168.10.1 255.255.255.0,即增加了删除原先IP地址的命令,而后为G0/3/0重新设置IP地址,此命令行为:ip address 192.168.10.2 255.255.255.0。
在上述步骤105中,在所述第二配置指令与所述第一配置指令匹配时,将所述第一配置指令或所述第二配置指令下发至所述运行库。
可选地,通过如下方式确定所述第二配置指令与所述第一配置指令匹配,包括:将Netconf格式的Netconf命令与命令行格式的所述第二配置指令,通过机器学习的方式确定是否匹配。
在得到第二配置指令,也即命令行格式的第二配置指令后,将该第二配置指令输入机器学习的模型中进行学习。学习过程中,系统会结合第一配置指令的数据,对第二配置指令进行相关语法和参数的审核。待学习结束后,当确认第二配置指令与第一配置指令匹配后,则可以由技术人员自主选择将第一配置指令或是第二配置指令下发至运行库,让运行库去执行审核通过的第一配置指令或者第二配置指令,均可以达到理想的配置效果,而不会出现配置出错的结果。
可选地,在所述第二配置指令与所述第一配置指令不匹配时,返回异常 指示。也即如果通过机器学习的方式确定命令行格式的第二配置指令与Netconf格式的Netconf命令不匹配时,则会在网络设备的显示界面返回异常的指示,其目的在于告诉技术人员不能将第一配置指令或者第二配置指令下发至网络设备的运行库,也即一旦将本次不匹配的第一配置指令或者第二配置指令下发至运行库,则会带来预料之外的结果。
基于同样的构思,本发明实施例提供一种执行配置指令的装置,如图12所示,该装置包括:
第一下发单元1201,用于将第一配置指令下发至网络设备的验证库,所述验证库具有与所述网络设备的运行库相同的第一配置文件;
获取单元1202,用于获取所述验证库执行所述第一配置指令后的第二配置文件;
确定单元1203,用于确定所述第一配置文件与所述第二配置文件中不同的配置数据;
生成单元1204,用于根据所述不同的配置数据生成第二配置指令;
第二下发单元1205,用于在所述第二配置指令与所述第一配置指令匹配时,将所述第一配置指令或所述第二配置指令下发至所述运行库。
进一步地,所述将第一配置指令下发至网络设备的验证库之前,所述第一下发单元1201具体用于向所述网络设备下发同步指令,所述同步指令用于指示所述网络设备将所述运行库的所述第一配置文件同步至所述验证库;所述获取所述验证库执行所述第一配置指令后的第二配置文件之后,所述第一下发单元1201具体用于向所述网络设备下发清除指令,所述清除指令用于指示所述网络设备清空所述验证库。
进一步地,所述向所述网络设备下发同步指令之后,所述第一下发单元1201还用于在同步之后,向所述网络设备下发锁定指令;所述锁定指令用于指示锁定所述验证库;所述获取所述验证库执行所述第一配置指令后的第二配置文件之后,且向所述网络设备下发清除指令之前,所述第一下发单元1201还用于向所述网络设备下发解锁指令;所述解锁指令用于指示解锁所述验证 库。
进一步地,所述根据所述不同的配置数据生成第二配置指令,所述确定单元1203具体用于根据所述第一配置文件和所述第二配置文件,确定所述不同的配置数据对应的操作属性;所述获取单元1202具体用于从所述第一配置文件或所述第二配置文件中获取所述不同的配置数据的依赖数据;所述依赖数据为与所述不同的配置数据位于同一目录下的数据;所述生成单元1204具体用于根据所述不同的配置数据、所述依赖数据和所述操作属性,生成所述第二配置指令。
进一步地,所述第一配置指令为Netconf命令;所述第二配置指令为命令行;所述第一配置文件和所述第二配置文件为XML格式。
进一步地,所述根据所述不同的配置数据、所述依赖数据和所述操作属性,生成所述第二配置指令,所述生成单元1204具体用于按照同一结构体,根据所述不同的配置数据、所述依赖数据和所述操作属性,生成配置数据结构体,其中,所述不同的配置数据和所述依赖数据以键值对的方式记载在所述配置数据结构体中;所述确定单元1203具体用于确定所述配置数据结构体中各键对应的命令行格式的字段,并将各键对应的键值确定为各字段的值;所述生成单元1204还用于根据所述操作属性、所述各字段和各字段的值,生成命令行格式的所述第二配置指令。
进一步地,所述确定单元1203还用于将Netconf格式的Netconf命令与命令行格式的所述第二配置指令,通过机器学习的方式确定是否匹配。
进一步地,在所述第二配置指令与所述第一配置指令不匹配时,返回异常指示。
本发明实施例提供了一种计算设备,该计算设备具体可以为桌面计算机、便携式计算机、智能手机、平板电脑、个人数字助理(Personal Digital Assistant,PDA)等。该计算设备可以包括中央处理器(Center Processing Unit,CPU)、存储器、输入/输出设备等,输入设备可以包括键盘、鼠标、触摸屏等,输出设备可以包括显示设备,如液晶显示器(Liquid Crystal Display,LCD)、阴 极射线管(Cathode Ray Tube,CRT)等。
存储器,可以包括只读存储器(ROM)和随机存取存储器(RAM),并向处理器提供存储器中存储的程序指令和数据。在本发明实施例中,存储器可以用于执行配置指令方法的程序指令;
处理器,用于调用所述存储器中存储的程序指令,按照获得的程序执行配置指令方法。
本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行配置指令方法。
本领域内的技术人员应明白,本发明的实施例可提供为方法、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上, 使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (15)

  1. 一种执行配置指令的方法,其特征在于,包括:
    将第一配置指令下发至网络设备的验证库,所述验证库具有与所述网络设备的运行库中相同的第一配置文件;
    获取所述验证库执行所述第一配置指令后的第二配置文件;
    确定所述第一配置文件与所述第二配置文件中不同的配置数据;
    根据所述不同的配置数据生成第二配置指令;
    在所述第二配置指令与所述第一配置指令匹配时,将所述第一配置指令或所述第二配置指令下发至所述运行库。
  2. 如权利要求1所述的方法,其特征在于,所述将第一配置指令下发至网络设备的验证库之前,还包括:
    向所述网络设备下发同步指令,所述同步指令用于指示所述网络设备将所述运行库的所述第一配置文件同步至所述验证库;
    所述获取所述验证库执行所述第一配置指令后的第二配置文件之后,还包括:
    向所述网络设备下发清除指令,所述清除指令用于指示所述网络设备清空所述验证库。
  3. 如权利要求2所述的方法,其特征在于,所述向所述网络设备下发同步指令之后,还包括:
    在同步之后,向所述网络设备下发锁定指令,所述锁定指令用于指示锁定所述验证库;
    所述获取所述验证库执行所述第一配置指令后的第二配置文件之后,且向所述网络设备下发清除指令之前,还包括:
    向所述网络设备下发解锁指令,所述解锁指令用于指示解锁所述验证库。
  4. 如权利要求1所述的方法,其特征在于,所述根据所述不同的配置数据生成第二配置指令,包括:
    根据所述第一配置文件和所述第二配置文件,确定所述不同的配置数据对应的操作属性;
    从所述第一配置文件或所述第二配置文件中获取所述不同的配置数据的依赖数据;所述依赖数据为与所述不同的配置数据位于同一目录下的数据;
    根据所述不同的配置数据、所述依赖数据和所述操作属性,生成所述第二配置指令。
  5. 如权利要求1至4任一项所述的方法,其特征在于,所述第一配置指令为Netconf命令;所述第二配置指令为命令行;所述第一配置文件和所述第二配置文件为XML格式。
  6. 如权利要求5所述的方法,其特征在于,所述根据所述不同的配置数据、所述依赖数据和所述操作属性,生成所述第二配置指令,包括:
    根据所述不同的配置数据、所述依赖数据和所述操作属性,生成配置数据结构体,其中,所述不同的配置数据和所述依赖数据以键值对的方式记载在所述配置数据结构体中;
    确定所述配置数据结构体中各键对应的命令行格式的字段,并将各键对应的键值确定为各字段的值;
    根据所述操作属性、所述各字段和各字段的值,生成命令行格式的所述第二配置指令。
  7. 如权利要求5所述的方法,其特征在于,通过如下方式确定所述第二配置指令与所述第一配置指令匹配,包括:
    将Netconf格式的Netconf命令与命令行格式的所述第二配置指令,通过机器学习的方式确定是否匹配。
  8. 一种执行配置指令的装置,其特征在于,包括:
    第一下发单元,用于将第一配置指令下发至网络设备的验证库,所述验证库具有与所述网络设备的运行库相同的第一配置文件;
    获取单元,用于获取所述验证库执行所述第一配置指令后的第二配置文件;
    确定单元,用于确定所述第一配置文件与所述第二配置文件中不同的配置数据;
    生成单元,用于根据所述不同的配置数据生成第二配置指令;
    第二下发单元,用于在所述第二配置指令与所述第一配置指令匹配时,将所述第一配置指令或所述第二配置指令下发至所述运行库。
  9. 如权利要求8所述的装置,其特征在于,所述第一下发单元,还用于所述将第一配置指令下发至网络设备的验证库之前,向所述网络设备下发同步指令,所述同步指令用于指示所述网络设备将所述运行库的所述第一配置文件同步至所述验证库;
    所述第一下发单元,还用于所述获取单元获取所述验证库执行所述第一配置指令后的第二配置文件之后,向所述网络设备下发清除指令,所述清除指令用于指示所述网络设备清空所述验证库。
  10. 如权利要求9所述的装置,其特征在于,所述第一下发单元,还用于在同步之后,向所述网络设备下发锁定指令;所述锁定指令用于指示锁定所述验证库;
    所述第一下发单元,还用于在所述获取单元获取所述验证库执行所述第一配置指令后的第二配置文件之后,且向所述网络设备下发清除指令之前,向所述网络设备下发解锁指令;所述解锁指令用于指示解锁所述验证库。
  11. 如权利要求8所述的装置,其特征在于,
    所述确定单元,具体用于根据所述第一配置文件和所述第二配置文件,确定所述不同的配置数据对应的操作属性;从所述第一配置文件或所述第二配置文件中获取所述不同的配置数据的依赖数据;所述依赖数据为与所述不同的配置数据位于同一目录下的数据;
    所述生成单元,具体用于根据所述不同的配置数据、所述依赖数据和所述操作属性,生成所述第二配置指令。
  12. 如权利要求8-11任一项所述的装置,其特征在于,所述第一配置指令为Netconf命令;所述第二配置指令为命令行;所述第一配置文件和所述第 二配置文件为XML格式。
  13. 如权利要求12所述的装置,其特征在于,
    所述生成单元,具体用于根据所述不同的配置数据、所述依赖数据和所述操作属性,生成配置数据结构体,其中,所述不同的配置数据和所述依赖数据以键值对的方式记载在所述配置数据结构体中;确定所述配置数据结构体中各键对应的命令行格式的字段,并将各键对应的键值确定为各字段的值;根据所述操作属性、所述各字段和各字段的值,生成命令行格式的所述第二配置指令。
  14. 一种计算设备,其特征在于,包括:
    存储器,用于存储程序指令;
    处理器,用于调用所述存储器中存储的程序指令,按照获得的程序执行如权利要求1-7任一项所述的方法。
  15. 一种计算机可读存储介质,其特征在于,所述存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行如权利要求1-7任一项所述的方法。
PCT/CN2020/125914 2019-11-26 2020-11-02 一种执行配置指令的方法及装置 WO2021103948A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911173679.3 2019-11-26
CN201911173679.3A CN110912743B (zh) 2019-11-26 2019-11-26 一种执行配置指令的方法及装置

Publications (1)

Publication Number Publication Date
WO2021103948A1 true WO2021103948A1 (zh) 2021-06-03

Family

ID=69819595

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/125914 WO2021103948A1 (zh) 2019-11-26 2020-11-02 一种执行配置指令的方法及装置

Country Status (2)

Country Link
CN (1) CN110912743B (zh)
WO (1) WO2021103948A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110912743B (zh) * 2019-11-26 2021-11-16 中国银联股份有限公司 一种执行配置指令的方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090259993A1 (en) * 2008-04-11 2009-10-15 Oracle International Corporation Sandbox Support for Metadata in Running Applications
CN102006183A (zh) * 2010-11-12 2011-04-06 百度在线网络技术(北京)有限公司 一种用于基于配置参数配置网络设备的方法与配置设备
CN107357717A (zh) * 2017-06-07 2017-11-17 阿里巴巴集团控股有限公司 检测配置错误的方法、装置及设备
CN110391949A (zh) * 2019-09-19 2019-10-29 华为技术有限公司 一种配置变更的方法及相关装置
CN110912743A (zh) * 2019-11-26 2020-03-24 中国银联股份有限公司 一种执行配置指令的方法及装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101827078A (zh) * 2009-12-30 2010-09-08 华为技术有限公司 一种配置数据差异的查询方法、服务器和通信系统
CN102148817B (zh) * 2010-12-08 2014-04-16 华为技术有限公司 配置网络设备的方法、客户端、服务器端及网络系统
CN102752138A (zh) * 2012-06-30 2012-10-24 华为技术有限公司 异步配置管理方法和网络设备
CN104883266B (zh) * 2014-02-28 2018-10-12 新华三技术有限公司 网络配置访问方法及装置
CN109977097B (zh) * 2019-03-07 2020-12-29 烽火通信科技股份有限公司 一种基于数据库的网络配置管理方法及系统
CN110377356B (zh) * 2019-06-14 2022-09-20 北京奇艺世纪科技有限公司 任务处理方法、装置、系统及计算机可读存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090259993A1 (en) * 2008-04-11 2009-10-15 Oracle International Corporation Sandbox Support for Metadata in Running Applications
CN102006183A (zh) * 2010-11-12 2011-04-06 百度在线网络技术(北京)有限公司 一种用于基于配置参数配置网络设备的方法与配置设备
CN107357717A (zh) * 2017-06-07 2017-11-17 阿里巴巴集团控股有限公司 检测配置错误的方法、装置及设备
CN110391949A (zh) * 2019-09-19 2019-10-29 华为技术有限公司 一种配置变更的方法及相关装置
CN110912743A (zh) * 2019-11-26 2020-03-24 中国银联股份有限公司 一种执行配置指令的方法及装置

Also Published As

Publication number Publication date
CN110912743B (zh) 2021-11-16
CN110912743A (zh) 2020-03-24

Similar Documents

Publication Publication Date Title
US11620277B2 (en) Transaction processing at non-relational databases
US9830372B2 (en) Scalable coordination aware static partitioning for database replication
JP2023546249A (ja) トランザクション処理方法、装置、コンピュータ機器及びコンピュータプログラム
WO2018201895A1 (zh) 接口代码生成方法、装置、终端设备及介质
CN109766330B (zh) 数据分片方法、装置、电子设备及存储介质
US20200104404A1 (en) Seamless migration of distributed systems
US10048978B2 (en) Apparatus and method for identifying a virtual machine having changeable settings
US8417669B2 (en) Auto-correction in database replication
US20200356383A1 (en) Configuration management task derivation
US11989540B2 (en) Systems and methods for non-disruptive continuous software delivery
US20220269568A1 (en) Blockchain-based data snapshot method and apparatus, and computer-readable storage medium
CN111143470A (zh) 跨平台数据库数据同步比对方法及装置
US11386078B2 (en) Distributed trust data storage system
CN111930850A (zh) 数据校验方法、装置、计算机设备和存储介质
US20190235846A1 (en) Continuous delivery pipeline segment models
WO2021103948A1 (zh) 一种执行配置指令的方法及装置
US20240097919A1 (en) Consensus trusted cluster changing method, computer device and computer-readable storage medium
US20160140197A1 (en) Cross-system synchronization of hierarchical applications
CN111061740A (zh) 一种数据同步方法、设备和存储介质
CN111190884A (zh) 数据校验方法、装置和计算机可读存储介质
US10678774B2 (en) Generating source code for creating database triggers
US11960369B2 (en) Efficient creation of a secondary database system
CN111241047B (zh) 一种文件同步方法及装置
CN114443356A (zh) 一种容器集群的处理方法及系统
US11010279B2 (en) Method and system for implementing a build validation engine

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20891727

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20891727

Country of ref document: EP

Kind code of ref document: A1