WO2017219775A1 - 一种配置状态回退方法、装置和计算机存储介质 - Google Patents

一种配置状态回退方法、装置和计算机存储介质 Download PDF

Info

Publication number
WO2017219775A1
WO2017219775A1 PCT/CN2017/083729 CN2017083729W WO2017219775A1 WO 2017219775 A1 WO2017219775 A1 WO 2017219775A1 CN 2017083729 W CN2017083729 W CN 2017083729W WO 2017219775 A1 WO2017219775 A1 WO 2017219775A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
subtask
reverse
sub
network device
Prior art date
Application number
PCT/CN2017/083729
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 WO2017219775A1 publication Critical patent/WO2017219775A1/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
    • H04L41/085Retrieval of network configuration; Tracking network configuration history
    • H04L41/0859Retrieval of network configuration; Tracking network configuration history by keeping history of different configuration generations or by rolling back to previous configuration versions
    • H04L41/0863Retrieval of network configuration; Tracking network configuration history by keeping history of different configuration generations or by rolling back to previous configuration versions by rolling back to previous configuration versions
    • 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
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • 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 field of communications, and in particular, to a configuration state fallback method, apparatus, and computer storage medium.
  • SDN Software Defined Network
  • the embodiment of the present invention is to provide a configuration state fallback method, a device, and a computer storage medium.
  • the operation and maintenance personnel Restore the successfully configured network devices one by one to the pre-configuration status State, costing manpower, time, and low efficiency of operation and maintenance.
  • the embodiment of the invention provides a configuration state fallback method, including:
  • the task is configured to configure at least one network device, where the reverse task is used to roll back a network device that is successfully configured according to the task, so that the network device is Roll back to the pre-configuration state;
  • the reverse task is executed to roll back all the network devices corresponding to the task to the pre-configuration state.
  • the embodiment of the invention further provides a configuration state fallback device, including:
  • the acquiring module is configured to acquire a task and a reverse task corresponding to the task, where the task is configured to perform configuration on at least one network device, where the reverse task is used to roll back a network device that is successfully configured according to the task. Reversing the network device to a pre-configuration state;
  • the processing module is configured to perform a reverse task if the task is not fully executed, so that all network devices corresponding to the task fall back to the pre-configuration state.
  • the embodiment of the present invention further provides a computer storage medium.
  • the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the configuration state fallback method of the embodiment of the present invention.
  • the configuration state fallback method, device, and computer storage medium provided by the embodiment of the present invention obtain the task and the reverse task corresponding to the task; the task is used to configure at least one network device, and the reverse task Resetting the network device that is successfully configured according to the task to be rolled back, causing the network device to fall back to the pre-configuration state; if the task is not completely executed successfully, performing the reverse task, so that the task corresponds to All the network devices are rolled back to the pre-configuration state.
  • some network devices may be successfully configured, some network devices may fail to be configured, and reverse tasks are used.
  • a successful network device is rolled back to the pre-configuration state to ensure that all network devices are in the pre-configuration state, ensuring the atomicity of the configuration of at least one network device.
  • the consistency and the reverse task are automatically performed.
  • the operation and maintenance personnel do not need to operate the network device one by one, which improves the operation and maintenance efficiency, ensures the operation and maintenance work is simplified, and improves the efficiency and flexibility of service deployment.
  • FIG. 1 is a flowchart of a configuration state fallback method according to Embodiment 1 of the present invention
  • FIG. 2 is a schematic structural diagram of a storage structure of a transaction according to Embodiment 1 of the present invention.
  • FIG. 3 is a schematic diagram of changes between states of a task according to Embodiment 1 of the present invention.
  • FIG. 5 is a schematic structural diagram of a network according to Embodiment 1 of the present invention.
  • FIG. 6 is a schematic structural diagram of a configuration state back-off device according to Embodiment 2 of the present invention.
  • this embodiment provides a configuration state rollback method, as shown in FIG. Includes the following steps:
  • S101 Obtain a task and a reverse task corresponding to the task, where the task is used to configure a network device, and the reverse task is used to roll back a network device that is successfully configured according to the task, so that the network is The device rolls back to the pre-configuration state.
  • the SDN controller is used to simultaneously deliver the configuration to the at least one network device, and the SDN controller acquires the task and the reverse task corresponding to the task; the task is used for at least one network.
  • the device is configured. After obtaining the task delivered by the scheduling layer, the SDN controller creates a reverse task corresponding to the task, and the reverse task is used according to the task. If the network device is configured to be rolled back, the configured at least one network device is in the pre-configuration state. When at least one network device is configured according to the task, some network devices may be successfully configured. If the device configuration fails, the reverse task is used to roll back the configured network device and roll it back to the pre-configuration state.
  • the reverse task is performed to ensure that all network devices corresponding to the task are rolled back to the pre-configuration state, ensuring the atomicity and consistency of configuration of at least one network device.
  • the operation and maintenance efficiency ensures that the operation and maintenance work is simplified and the efficiency and flexibility of business deployment are improved.
  • the task includes at least one subtask, each subtask corresponding to a reverse subtask; one subtask is used to configure one network device, and one reverse subtask is used to return a network device that is successfully configured according to the subtask Retiring, the network device is rolled back to the pre-configuration state, for example, when the task includes three subtasks A, B, and C, and the subtasks A, B, and C are respectively configured to configure network devices X, Y, and Z, each subtask Corresponding to a reverse subtask, the reverse subtasks of subtasks A, B, and C are a, b, and c.
  • network device X may be configured successfully.
  • the sub-task a is used to roll back the network device X that has been successfully configured to roll back to the pre-configuration state.
  • performing the reverse task includes: if there is a sub-task execution failure in the at least one sub-task, determining a reverse sub-task corresponding to the sub-task, performing execution other than the reverse sub-task Other reverse subtasks.
  • the method further includes: executing all the subtasks, and after receiving the execution result of all the subtasks, determining whether the subtask execution fails.
  • the sub-task that failed to be executed indicates that the network device corresponding to the sub-task is not configured successfully.
  • the unconfigured network device does not need to roll back its configuration state, that is, it does not need to perform its corresponding reverse subtask. Therefore, it is only necessary to roll back the configuration state of the network device corresponding to the sub-task that is successfully executed, that is, only the network device with successful configuration is restored to the state before the configuration.
  • each network device is configured with a subtask and a corresponding reverse subtask.
  • the subtask is used to configure the network device.
  • the reverse subtask is used to roll back a successfully configured network device to its pre-configuration state. If at least one subtask fails to be executed, the corresponding reverse subtasks are determined, and all the reverse subtasks except the corresponding reverse subtasks are automatically executed, so that the successfully configured network device falls back to its pre-configuration state. If there are multiple network devices configured successfully, the reverse subtasks corresponding to the multiple network devices are automatically executed, and no manual operation is required, which improves the operation and maintenance efficiency, ensures the operation and maintenance work is simplified, and improves the efficiency of service deployment. flexibility.
  • the sub-task execution failure in the at least one sub-task includes: the execution time of the sub-task in the at least one sub-task exceeds a preset execution time threshold.
  • the subtask corresponding to each network device starts to be executed at the same time.
  • the subtask execution is considered to be unsuccessful.
  • the time point of performing the reverse subtask is: when all the subtasks are completed, the reverse subtask is started; or the execution time of any one of the at least one subtasks exceeds the pre If the execution time threshold is set, the reverse subtask corresponding to the subtask is started.
  • the task includes at least one subtask. If a subtask does not return the execution result for a long time due to network failure or other reasons, this will affect the execution status of the entire task, so it is a child. It is necessary to set a threshold for the execution duration of the task. When the preset execution time threshold is still not returned, the subtask execution is considered to have failed.
  • a task includes at least one subtask, and the state of the subtask can determine the state of the task.
  • the execution time of the subtask exceeds the preset execution time threshold, and the subtask also fails to execute. As long as one subtask fails to execute, the status of the task is execution failure; if all subtasks are executed successfully, the status of the task is successful.
  • the SDN controller reports the result of the task execution failure to the scheduling layer in time.
  • This embodiment provides a transaction mechanism for configuring at least one network device at the same time, that is, providing a task for configuring at least one network device at the same time.
  • the transaction consists of two attributes: atomicity and consistency.
  • Atomicity means that a transaction is an indivisible unit of work, and the operations included in the transaction are either done or not done.
  • Consistency means that the transaction must be to change the database from one consistent state to another. Consistency is closely related to atomicity.
  • the transaction mechanism provided in this embodiment can ensure that all the configurations of the transaction are successful or all configurations fail.
  • the SDN controller is used to simultaneously deliver the configuration to at least one network device.
  • the SDN controller can be divided into a client and a server.
  • the transaction mechanism is initiated by the scheduling layer, and the scheduling layer sends the request.
  • the task is given to the client, and the task carries an identifier, which is used to indicate a scheduled task, and listens to the execution result of the task through the identifier.
  • the client After the client receives the task, the client processes the task first, and obtains the execution result of the task, and notifies the task execution result and the identifier to the scheduling layer together.
  • the scheduling between the scheduling layer and the client is performed asynchronously, that is, the scheduling layer does not need to wait for the result of the client, but the client actively reports the result to the scheduling layer.
  • the request of the scheduling layer requires the cooperation between the client and the server to complete.
  • the client After receiving the task sent by the scheduling layer, the client parses the task and calculates the network to be configured. The number of devices is then sent to the server to request a corresponding number of sub-identifiers.
  • the server After receiving the request from the client, the server creates and stores the transaction structure shown in Figure 2, and returns an array of strings consisting of sub-identifiers to the client.
  • F indicates the identifier carried by the client to receive the task
  • S1, S2, S3, ..., Sn represent the sub-identifiers that the client applies to the server.
  • the server stores the task and the reverse task.
  • the task is used to configure multiple network devices.
  • the reverse task is used to roll back the network device successfully configured according to the task and roll it back to the pre-configuration state.
  • the client constructs a configured sub-task for each network device, each sub-task is identified by a sub-identifier, and the sub-identifier is used to track and monitor the execution result of the sub-task.
  • a reverse subtask corresponding to the subtask is also constructed, and the reverse subtask is used to roll back a network device that is successfully configured according to the subtask. Cause it to fall back to the pre-configuration state.
  • the client After obtaining the execution result of the subtask, the client notifies the execution result of the subtask to the server, but the client does not know the execution result of the entire task, and the client sends a request for querying the execution result of the entire task to the server, the server.
  • the terminal After receiving the execution result of the subtask, the terminal first sets the state of the corresponding subtask.
  • the server traverses the state of each subtask, updates the state of the task, and returns the status of the task to the client.
  • the status after the subtask is executed is divided into SUCCESS and FAIL.
  • the status of the task returned by the server to the client includes WAIT, SUCCESS, FAIL, and DISCARD.
  • WAIT indicates that some subtasks are successfully executed, other subtasks are still in the execution state, and when the status returned by the server is a wait state, indicating that the entire task has not been completed, it is necessary to continue waiting.
  • SUCCESS indicates that all subtasks have been successfully executed, and the server returns this status indicating that the entire task was successfully executed.
  • FAIL indicates that once one of the subtasks fails to be executed, the status of the entire task is set to failure, and the return of the status by the server indicates that the entire task failed to execute.
  • DISCARD indicates that the subtask has failed to execute before the end of the current subtask execution, and the server returns the status description. The task failed to execute and has been reported to the scheduling layer. The client receives the DISCARD and does nothing.
  • the status of the task returned by the server to the client is WAIT, SUCCESS, FAIL, and DISCARD.
  • the status of the task also includes START. After the server side creates and stores the transaction structure shown in Figure 2, it sets the status of the task to START and returns the sub-identifier to the client.
  • START to WAIT After entering START, the server waits for the client to announce the execution result of the subtask. When the execution result of the first subtask received by the server is successful, the status of the task is converted from START to WAIT.
  • WAIT to SUCCESS If the status of the task is WAIT, it indicates that some subtasks have been successfully executed, and there are no subtasks that failed to execute. When the notification received by the server is the execution result of the last subtask and the last subtask is executed successfully, the status of the task is from WAIT to SUCCESS.
  • WAIT to FAIL If the status of the task is WAIT, it indicates that some subtasks have been successfully executed, and there are no subtasks that failed to execute. When the execution result of the subtask received by the server is execution failure, the status of the task is from WAIT to FAIL.
  • FAIL to DISCARD If the status of the task is FAIL, it indicates that one subtask has failed to execute, and the entire task has failed. The execution result of the current subtask will not affect the status of the task, that is, a subtask has failed to execute. The execution result of a subtask after the subtask is success or failure, and the status of the task is from FAIL to DISCARD.
  • DISCARD to DISCARD If the status of the task is DISCARD, the entire task has failed. The execution result of the current subtask will not affect the status of the task, that is, regardless of whether the execution result of the current subtask is successful or not, then the status of the task is from DISCARD to DISCARD, That is still the DISCARD state.
  • the client processes the status according to the received task.
  • the principle is: WAIT indicates that the task is not executed, does not process, and is not reported to the scheduling layer; SUCCESS indicates that the execution is successful and is reported to the scheduling layer; FAIL indicates that the execution fails and is reported to the scheduling layer. ; DISCARD indicates that the task has failed to execute and no further processing is done.
  • the server tells the client that the task has timed out. If the client receives the timeout information sent by the server, the task fails to be reported to the scheduling layer. Release related resources.
  • the fallback mechanism is used to roll back the subtask that is successfully executed, so that the successfully configured network device falls back to Pre-configuration status. If at least one subtask fails to execute, the corresponding reverse subtasks are determined, and all reverse subtasks except the corresponding reverse subtasks are executed. The unsuccessful sub-task indicates that the network device corresponding to the sub-task is not configured successfully. To ensure the atomicity and consistency of the configuration of multiple network devices, the unconfigured network device does not need to roll back its state. That is, there is no need to perform its corresponding reverse subtask. Therefore, you only need to roll back the sub-tasks that have been successfully executed, that is, you only need to restore the successfully configured network devices to their pre-configuration state.
  • the configuration operation of the SDN controller to the network device is the lowest layer and the most basic operation, and the southbound channel used by the SDN controller needs to ensure that the atomicity of the configuration operation is processed in a transaction manner.
  • the SDN controller can use the NETCONF (Network Configuration Protocol) as the southbound channel.
  • the NETCONF itself can guarantee the atomicity of the NETCONF message interaction. Therefore, for the most basic configuration operation, if an error occurs, there is no need to roll back. . Therefore, if the entire task fails to execute, the part that needs to be rolled back is those sub-tasks that are successfully executed in the entire task.
  • the client is required to construct a positive configuration subtask while constructing a pair.
  • the reverse subtask should be handed over to the server side for management.
  • the reverse subtask will be called when a rollback is required.
  • the timing of the rollback is performed after all the subtasks are executed; or when the execution time of a subtask exceeds the preset execution time threshold on the server side, then the subtask execution failure is considered to be performed, and the subtask that has been successfully executed needs to be performed.
  • Rollback For sub-tasks that have not been executed in the timeout task, the default is execution failure and no rollback processing.
  • the server forwards the reverse subtask. After the server determines that the task meets the execution failure or timeout and the conditions of the rollback opportunity, the server can directly perform the rollback processing. The client and the scheduling layer do not need to detect the fallback processing. Process.
  • this embodiment also exemplifies a specific example, which is specifically as follows:
  • NETCONF uses NETCONF as the southbound channel of the SDN controller.
  • NETCONF uses XML (Extensible Markup Language) as the encoding method for configuration data and protocol messages.
  • XML can express complex, managed objects with inherent logical relationships, greatly improving Operational efficiency and object standardization. According to this advantage of XML, the dependencies between configurations can be expressed in XML, thus shielding the NETCONF operation layer from the perception of dependency.
  • the NETCONF device only needs to implement the error rewind capability urn:ietf:params:netconf:capability:rollback-on-error:1.0, see rfc6241, and configure the packet error-option (error option) when constructing configuration packets. Set to rollback-on-error, you can guarantee the atomicity of the configuration operation of each NETCONF message. 3. It is also very easy to construct the reverse message of the NETCONF message.
  • Figure 5 is a network that uses the SDN controller for centralized control. It is assumed that the scheduling layer sends a task to the SDN controller: create a tunnel from S1 to S7. The following describes in detail how the transaction mechanism is used to configure this configuration as a task on multiple network devices.
  • S201 The client sent by the scheduling layer to the SDN controller has a task: creating a tunnel from S1 to S7.
  • the task carries an identifier.
  • the client sent by the scheduling layer to the SDN controller has a task: create a tunnel from S1 to S7. Road.
  • the task carries an identifier create-tunnel-1 (create-tunnel-1) and information about creating a tunnel.
  • the scheduling layer invokes this task asynchronously, then adds create-tunnel-1 to the queue that listens for execution results and then returns.
  • S202 The client calculates that the four nodes S1, S2, S3, and S7 need to be configured at the same time, so the request for allocating four sub-identifiers is sent to the server.
  • the client of the SDN controller After receiving the task with the identifier of create-tunnel-1, the client of the SDN controller calculates the four nodes S1, S2, S3, and S7 to be configured in conjunction with the topology information on the SDN controller. Four subtasks complete the configuration, so a request to allocate four sub-identifiers is sent to the server.
  • S203 The server side allocates four sub-identifiers and returns them to the client.
  • the server After the server receives the request with the identifier of create-tunnel-1 and the number of sub-identifiers of 4, the server creates a storage architecture, including a task identifier and four sub-task sub-identifiers, and the four sub-tasks are respectively assigned to Create-tunnel-1-s1, create-tunnel-1-s2, create-tunnel-1-s3, create-tunnel-1-s7 as sub-identifiers, and return the sub-identifier to the client, while the task The status is set to START. Sub-identifiers are used to mark and track corresponding subtasks.
  • S204 The client constructs four subtasks and four corresponding reverse subtasks, and hosts the constructed reverse subtasks to the server.
  • Each subtask carries a sub-identifier.
  • the client After receiving four sub-identifiers, the client constructs four sub-tasks and four corresponding reverse sub-tasks.
  • the four sub-tasks are constructed in the form of messages.
  • the four sub-tasks constructed are also constructed in message form.
  • the built-in reverse subtask is hosted on the server side.
  • Each subtask carries a sub-identifier, which performs the sub-task in an asynchronous manner, and listens to the execution result of the sub-task through the sub-identifier.
  • S205 The client listens to the execution result of the subtask, and notifies the server end of the execution result of the subtask, and waits for the server to return the status of the task, and performs corresponding processing according to the status of the task. The client repeats the operation of S205 until all subtasks return the execution result.
  • the client receives the task status returned by the server as WAIT, it indicates that the task is not executed. The client does not process the packet and does not report it to the scheduling layer. If the client receives the task status returned by the server as SUCCESS, the execution succeeds. The client reports to the scheduling layer; if the client receives the task status returned by the server as FAIL, the execution fails, and the client reports to the scheduling layer; if the client receives the task status returned by the server, the DISCARD indicates that the task has failed to execute. The client no longer does any processing.
  • S206 The server side finds the stored corresponding subtask through the sub identifier, and sets its state. Then iterate through all the other subtasks, calculate the state of the task according to the state transition mechanism, and return the state of the task to the client. At the same time, the server determines whether all the subtasks are all executed. If yes, it further judges that the status of the task is SUCCESS, FAIL or DISCARD, and performs corresponding processing according to the status of the task.
  • the server After receiving the execution result of the subtask sent by the client and the request for querying the status of the task, the server finds the stored subtask through the sub identifier carried by the subtask and sets its state. Then iterate through all the other subtasks, calculate the state of the task according to the state transition mechanism, and return the state of the task to the client. At the same time, the server determines whether all the subtasks are all executed. If yes, it further determines whether the status of the task is SUCCESS, FAIL or DISCARD. If it is SUCCESS, deletes the task and the subtasks it contains, and releases the resources; if it is FAIL or The DISCARD triggers the rollback process and calls the reverse subtask corresponding to the subtask that has been successfully executed. After the execution of the reverse subtask is completed, the task and its contained subtasks are deleted, and the resources are released.
  • S207 The server detects that the execution time of the subtask exceeds the preset execution time threshold, notifies the client that the task fails, and triggers the rollback process, and invokes the reverse subtask corresponding to the subtask that has been successfully executed, and the reverse subtask is to be reversed. After the task is executed, delete the task and the subtasks it contains and release the resources.
  • the task is used to obtain a task and a corresponding reverse task; the task is used to configure at least one network device, and the reverse task is used to roll back the network device successfully configured according to the task.
  • the network device is rolled back to the pre-configuration state; if the task is not fully executed, the reverse task is performed, so that all the network devices corresponding to the task are rolled back to the pre-configuration state;
  • a network device is configured, some network devices may be configured successfully, and some network devices may fail to be configured.
  • the reverse task is used to roll back the network device that has been successfully configured and roll back to the pre-configuration state.
  • the network devices are in the state before the configuration, ensuring the atomicity and consistency of the configuration of multiple network devices, and the reverse tasks are automatically executed.
  • the operation and maintenance personnel do not need to operate the network devices one by one, which improves the operation and maintenance efficiency. It ensures the simplification of operation and maintenance and improves the efficiency and flexibility of business deployment.
  • this embodiment also provides a configuration state fallback device, as shown in FIG. ,include:
  • the obtaining module 601 is configured to acquire a task and a reverse task corresponding to the task, where the task is used to configure at least one network device, where the reverse task is used to roll back a network device that is successfully configured according to the task. , causing the network device to fall back to the pre-configuration state;
  • the processing module 602 is configured to perform a reverse task if the task is not completely executed, so that all network devices corresponding to the task fall back to the pre-configuration state.
  • the obtaining module 601 acquires a task and a reverse task corresponding to the task; the task is used to configure at least one network device, and the reverse task is used to configure according to the task.
  • a successful network device is rolled back, and the network device is rolled back to the pre-configuration state.
  • some network device configurations may be successful, and some network device configurations may fail.
  • Reverse task Used to roll back the network device with successful configuration and roll it back to the pre-configuration state.
  • the processing module 602 After the obtaining module 601 obtains the task delivered by the scheduling layer, the processing module 602 creates a reverse task corresponding to the task, and the reverse task is used to return the network device according to the task configuration successfully. Retreat, causing the network device to fall back to the pre-configuration state. If the task is not completely executed successfully, the processing module 602 performs a reverse task corresponding to the task, so that all the network devices corresponding to the task are rolled back to the pre-configuration state, and at least one is guaranteed.
  • the atomicity and consistency of the network device are configured, and the operation and maintenance efficiency is improved, the operation and maintenance work is simplified, and the efficiency and flexibility of service deployment are improved.
  • the task includes at least one subtask, each subtask corresponding to a reverse subtask; one subtask is used to configure one network device, and one reverse subtask is used to return a network device that is successfully configured according to the subtask Retiring, the network device is rolled back to the pre-configuration state, for example, when the task includes three subtasks A, B, and C, and the subtasks A, B, and C are respectively configured to configure network devices X, Y, and Z, each subtask Corresponding to a reverse subtask, the reverse subtasks of subtasks A, B, and C are a, b, and c.
  • network device X may be configured successfully.
  • the processing module 602 is configured to: if at least one subtask fails to execute, determine the corresponding reverse subtasks respectively, and execute all the reverse subtasks except the corresponding reverse subtasks.
  • the processing module 602 is configured to: if there is a sub-task execution failure in the at least one sub-task, determine a reverse sub-task corresponding to the sub-task, and perform other reverse sub-tasks other than the reverse sub-task.
  • the processing module 602 is further configured to: if the subtask execution fails in the at least one subtask, determine all the subtasks before determining the subtask corresponding to the subtask, and after receiving the execution result of all the subtasks , to determine whether there is a subtask execution failure.
  • the sub-task that failed to be executed indicates that the network device corresponding to the sub-task is not configured successfully.
  • the unconfigured network device does not need to roll back its configuration status. That is, there is no need to perform its corresponding reverse subtask. Therefore, you only need to roll back the sub-tasks that have been successfully executed, that is, you only need to restore the successfully configured network devices to their pre-configuration state.
  • At least one network device When at least one network device is configured at the same time, in order to maintain atomicity and consistency, if at least one network device fails to be configured, the state of all the network devices needs to be restored to the pre-configuration state.
  • Each network device is configured with a subtask and a corresponding reverse subtask.
  • the subtask is used to configure the network device.
  • the reverse subtask is used to roll back a successfully configured network device to its pre-configuration state. If the at least one subtask fails to be executed, the processing module 602 determines the corresponding reverse subtasks, and automatically performs all the reverse subtasks except the corresponding reverse subtasks, so that the successfully configured network device falls back.
  • At least one processing module 602 automatically performs the reverse sub-tasks corresponding to the multiple network devices, and does not require manual operation, thereby improving operation and maintenance efficiency and ensuring operation. Dimensional work is simplified.
  • the processing module is configured to: 602: determine whether the execution time of the subtask in the at least one subtask exceeds a preset execution time threshold; and determine that the execution time of the subtask in the at least one subtask exceeds a pre
  • the execution time threshold is set, the reverse subtask corresponding to the subtask is determined, and other reverse subtasks other than the reverse subtask are executed.
  • the at least one network device is configured at the same time, the sub-task corresponding to each network device starts to be executed at the same time.
  • the at least one sub-task exceeds the preset execution time threshold, the at least one sub-task is considered to be unsuccessful.
  • the processing module 602 is configured to start performing the reverse subtask after all the subtasks are executed, or to start when the execution time of any one of the at least one subtasks exceeds a preset execution time threshold. Perform the reverse subtask corresponding to the subtask.
  • the task includes at least one subtask. If a subtask does not return the execution result for a long time due to network failure or other reasons, this affects the execution status of the entire task, so it is necessary to set a threshold for the execution duration of the subtask. If the preset execution time threshold is still not returned, the subtask execution is considered to have failed.
  • a task includes at least one subtask, and the state of the subtask can determine the state of the task.
  • the execution time of the subtask exceeds the preset execution time threshold, and the subtask also fails to execute. As long as one subtask fails to execute, the status of the task is execution failure; if all subtasks are executed successfully, the status of the task is successful.
  • the processing module 602 reports the task execution failure to the scheduling layer in time.
  • This embodiment provides a transaction mechanism for configuring at least one network device at the same time, that is, providing a task for configuring at least one network device at the same time.
  • the transaction consists of two attributes: atomicity and consistency.
  • Atomicity means that a transaction is an indivisible unit of work, and the operations included in the transaction are either done or not done.
  • Consistency means that the transaction must be to change the database from one consistent state to another. Consistency is closely related to atomicity.
  • the transaction mechanism is initiated by the scheduling layer, and the obtaining module 601 acquires the task delivered by the task scheduling layer.
  • the task carries an identifier, which is used to indicate a scheduled task, and listens to the execution result of the task through the identifier. .
  • the obtaining module 601 processes the current task, and obtains the execution result of the current task, and notifies the task execution result and the identifier to the scheduling layer together.
  • the request of the scheduling layer needs to be completed by the obtaining module 601 and the processing module 602.
  • the processing module 602 After the obtaining module 601 receives the task sent by the scheduling layer, the processing module 602 first parses the task, calculates the number of network devices to be configured, and then allocates a corresponding number of sub-identifiers. The processing module 602 creates and stores a transaction structure as shown in FIG. 2. In the transaction structure, F indicates that the obtaining module 601 receives the identifier carried by the task, and S1, S2, S3, ..., Sn represent the assigned sub-identifier. The processing module 602 stores the task and the reverse task, and the task is used to configure multiple network devices, and the reverse task is used to roll back the network device that is successfully configured according to the task, and roll back to the pre-configuration state. .
  • the processing module 602 After being assigned to the sub-identifier, the processing module 602 constructs a configured sub-task for each network device, each sub-task is identified by a sub-identifier, and the sub-task is tracked and monitored by the sub-identifier. result.
  • the processing module 602 constructs a subtask for each network device it also constructs a reverse subtask corresponding to the subtask, and the reverse subtask is used to configure a network according to the subtask. The device rolls back and rolls it back to the pre-configuration state.
  • the processing module 602 After obtaining the execution result of the subtask, the processing module 602 first sets the state of the corresponding subtask. The processing module 602 traverses the status of each subtask and updates the status of the task. The status after the subtask is executed is divided into SUCCESS and FAIL. The status of the task includes WAIT, SUCCESS, FAIL, and DISCARD. Among them, WAIT indicates that some subtasks are successfully executed, other subtasks are still in the execution state, and when the status of the tasks is waiting, indicating that the entire task has not been completed, it is necessary to continue waiting. SUCCESS indicates that all subtasks have been successfully executed. The status of the task is SUCCESS, indicating that the entire task is executed successfully.
  • FAIL indicates that once one of the subtasks fails to be executed, the status of the entire task is set to failure, and the status of the task is FAIL indicating that the entire task has failed.
  • DISCARD indicates that the subtask has failed to execute before the end of the current subtask execution. The status of the task is DISCARD, indicating that the entire task failed to execute and has been reported to the scheduling layer.
  • the status of the task is four in addition to WAIT, SUCCESS, FAIL, and DISCARD, and the status is START.
  • the processing module 602 creates and stores the transaction structure as shown in FIG. 2, the status of the task is set to START.
  • START to WAIT After entering START, when the execution result of the first subtask received by the processing module 602 is successful, the status of the task is converted from START to WAIT.
  • WAIT to SUCCESS If the status of the task is WAIT, it indicates that some subtasks have been successfully executed, and there are no subtasks that failed to execute.
  • the notification received by the processing module 602 is the execution result of the last subtask and the last subtask is successfully executed, the status of the task is from WAIT to SUCCESS.
  • WAIT to FAIL If the status of the task is WAIT, it indicates that some subtasks have been successfully executed, and there are no subtasks that failed to execute. When the execution result of the subtask received by the processing module 602 is an execution failure, the status of the task is from WAIT to FAIL.
  • FAIL to DISCARD If the status of the task is FAIL, it indicates that one subtask has failed to execute, and the entire task has failed. The execution result of the current subtask will not affect the status of the task, that is, a subtask has failed to execute. The execution result of a subtask after the subtask is success or failure, and the status of the task is from FAIL to DISCARD.
  • DISCARD to DISCARD If the status of the task is DISCARD, the entire task has failed. The execution result of the current subtask will not affect the status of the task, that is, regardless of whether the execution result of the current subtask is successful or not, then the status of the task is from DISCARD to DISCARD, that is, the DISCARD state.
  • the processing module 602 performs processing according to the received task status.
  • the principle is: WAIT indicates that the task is not executed, and is not processed, and is not reported to the scheduling layer; SUCCESS indicates that the execution is successful and is reported to the scheduling layer; FAIL indicates that the execution fails and is reported. To the scheduling layer; DISCARD indicates that the task has failed to execute and no further processing is done.
  • a task When a task is stored in the processing module 602 for a period of time exceeding a preset execution time threshold, it indicates that the task execution fails, and is reported to the scheduling layer to release related resources.
  • the fallback mechanism is used to roll back the successfully executed sub-tasks, so that the successfully configured network device falls back to the pre-configuration state. If at least one subtask fails to execute, the corresponding reverse subtasks are determined, and all reverse subtasks except the corresponding reverse subtasks are executed. .
  • the unsuccessful sub-task indicates that the network device corresponding to the sub-task is not configured successfully.
  • the unconfigured network device does not need to roll back its state. That is, there is no need to perform its corresponding reverse subtask. Therefore, you only need to roll back the sub-tasks that have been successfully executed, that is, you only need to restore the successfully configured network devices to their pre-configuration state.
  • the configuration operation to the network device is the lowest layer and the most basic operation, and the southbound channel used needs to ensure that the atomicity of the configuration operation is processed in a transaction manner.
  • NETCONF can be used as a southbound channel.
  • NETCONF itself can guarantee the atomicity of NETCONF message interaction. Therefore, for the most basic configuration operation, if an error occurs, there is no need to roll back. Therefore, if the entire task fails to execute, the part that needs to be rolled back is those sub-tasks that are successfully executed in the entire task.
  • the forward configuration subtask when the forward configuration subtask is acquired, the corresponding reverse subtask is obtained, and the reverse subtask will be called when the backoff needs to be performed.
  • the timing of the rollback is performed after all the subtasks are executed; or when the processing module 602 determines that the execution time of a subtask exceeds the preset execution time threshold, it is considered that the subtask execution fails, and the execution must be performed successfully.
  • the subtasks are rolled back. For subtasks that have not been executed in the timeout task, the default is execution failure and no rollback processing.
  • the processing module 602 performs scheduling on the reverse subtask, and the processing module 602 determines that the task meets the execution failure or the timeout, and the condition of the fallback timing, the processing module 602 can directly perform the rollback processing, and the scheduling layer There is no need to sense the fallback processing flow.
  • This embodiment also exemplifies a specific example, which is as follows:
  • NETCONF uses XML as the encoding method for configuration data and protocol messages.
  • XML can express complex, managed objects with inherent logical relationships, greatly improving operational efficiency and object standardization. According to this advantage of XML, the dependencies between configurations can be expressed in XML, thus shielding the NETCONF operation layer from the perception of dependency.
  • the NETCONF device implements the error rewind capability urn:ietf:params:netconf:capability:rollback-on-error:1.0, see rfc6241, set the error-option of the configuration packet to rollback- when constructing configuration packets. On-error, the atomicity of the configuration operation of each NETCONF message can be guaranteed. 3. It is also very easy to construct the reverse message of the NETCONF message.
  • the obtaining module 601 acquires a task delivered by the scheduling layer: creating a tunnel of S1 to S7.
  • the following describes in detail how the transaction mechanism is used to configure this configuration as a task on multiple network devices.
  • the obtaining module 601 acquires a task delivered by the scheduling layer: creating a tunnel of S1 to S7.
  • the task carries an identifier.
  • the obtaining module 601 acquires a task delivered by the scheduling layer: creating a tunnel of S1 to S7.
  • the task carries an identifier create-tunnel-1 and information about creating a tunnel.
  • the scheduling layer invokes this task asynchronously, then adds create-tunnel-1 to the queue that listens for execution results and then returns.
  • the processing module 602 calculates that four nodes S1, S2, S3, and S7 need to be configured at the same time, so each node is assigned a sub-identifier.
  • the obtaining module 601 calculates the four nodes S1, S2, S3, and S7 to be configured in combination with the topology information on the SDN controller. Subtasks are used to complete this configuration, so each node is assigned a sub-identifier. And create a storage architecture, including a task identifier and four child task sub-identifiers, four sub-tasks are assigned to create-tunnel-1-s1, create-tunnel-1-s2 Create-tunnel-1-s3, create-tunnel-1-s7 as sub-identifiers, and set the status of the task to START. Sub-identifiers are used to mark and track corresponding subtasks.
  • the processing module 602 constructs four subtasks and four corresponding reverse subtasks, each of which carries a sub-identifier.
  • the four subtasks constructed are constructed in the form of messages, and the four reverse subtasks constructed are also constructed in the form of messages.
  • Each subtask carries a sub-identifier, which performs the sub-task in an asynchronous manner, and listens to the execution result of the sub-task through the sub-identifier.
  • the processing module 602 monitors the execution result of the subtask and performs corresponding processing according to the status of the task.
  • the processing module 602 does not process the report and does not report to the scheduling layer. If the task status is SUCCESS, the execution is successful, and the processing module 602 reports to the scheduling layer; if the task status is FAIL, If the execution fails, the processing module 602 reports to the scheduling layer; if the task status is DISCARD, the task has failed to execute, and the processing module 602 does not perform any processing.
  • the processing module 602 finds the stored corresponding subtask by the sub identifier and sets its state. It then traverses all other subtasks and calculates the state of the task based on the state transition mechanism. At the same time, the processing module 602 determines whether all the subtasks are all executed. If yes, it further determines that the status of the task is SUCCESS, FAIL or DISCARD, and performs corresponding processing according to the status of the task.
  • the processing module 602 finds the stored corresponding subtask through the sub identifier carried by the subtask, and sets its state. It then traverses all other subtasks and calculates the state of the task based on the state transition mechanism. At the same time, the processing module 602 determines whether all the subtasks are all executed, and if so, further determines whether the status of the task is SUCCESS, FAIL or DISCARD, and if SUCCESS, deletes the task and the subtasks it contains, and releases the resource; If it is FAIL or DISCARD, it triggers the rollback process, and calls the reverse subtask corresponding to the subtask that has been successfully executed. After the execution of the reverse subtask is completed, the task and its contained subtasks are deleted, and the resources are released.
  • the processing module 602 checks that the execution time of the subtask exceeds the preset execution time threshold, the entire task fails to execute, triggers the rollback process, and invokes the reverse subtask corresponding to the subtask that has been successfully executed, and the subtask to be reversed After the execution ends, delete the task and the subtasks it contains, and release the resources.
  • the acquisition module 601 and the processing module 602 in the device may be implemented by a CPU (Central Processing Unit) and a DSP (Digital Signal Processor) in the device. ), MCU (Microcontroller Unit) or FPGA (Field-Programmable Gate Array).
  • CPU Central Processing Unit
  • DSP Digital Signal Processor
  • MCU Microcontroller Unit
  • FPGA Field-Programmable Gate Array
  • the acquisition module 601 acquires a task and a reverse task corresponding to the task; the task is used to configure at least one network device, and the reverse task is used to perform the task according to the task. If the network device is configured to roll back to the pre-configuration state, the processing module 602 is configured to perform the reverse task if the task is not completely executed, so that all the network devices corresponding to the task fall back to the configuration. In the previous state, when the configuration is performed on at least one network device according to the task, some network devices may be successfully configured, some network devices may fail to be configured, and the reverse task is used to return the successfully configured network device.
  • a computer storage medium is stored, the computer storage medium storing computer executable instructions for performing the configuration state fallback method of any one of the first embodiments.
  • the disclosed method and apparatus may be implemented in other manners.
  • the device embodiments described above are merely illustrative, examples
  • the division of the module is only a logical function division, and the actual implementation may have another division manner, for example, multiple modules or components may be combined, or may be integrated into another system, or some features may be ignored. Or not.
  • the communication connections between the various components shown or discussed may be indirect coupling or communication connections through some interfaces, devices or modules, and may be electrical, mechanical or otherwise.
  • the modules described above as separate components may or may not be physically separated.
  • the components displayed as modules may or may not be physical modules, that is, may be located in one place or distributed to multiple network modules; Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may be separately used as one module, or two or more modules may be integrated into one module;
  • the module can be implemented in the form of hardware or in the form of hardware plus software function modules.
  • the foregoing program may be stored in a computer readable storage medium, and when executed, the program includes The foregoing steps of the method embodiment; and the foregoing storage medium includes: a removable storage device, a ROM (Read-Only Memory), a magnetic disk, or an optical disk, and the like, which can store program codes.
  • a ROM Read-Only Memory
  • the above-described integrated module of the embodiment of the present invention may be stored in a computer readable storage medium if it is implemented in the form of a software function module and sold or used as a stand-alone product.
  • the technical solution of the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product stored in a storage medium, including a plurality of instructions.
  • a computer device (which may be a personal computer, server, or network device, etc.) is caused to perform all or part of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a mobile storage device, a ROM, a disk, or a light.
  • a medium such as a disk that can store program code.
  • the network device When the network device is configured according to the task, the network device may be configured successfully, and the network device may fail to be configured.
  • the reverse task is used to roll back the successfully configured network device. It is rolled back to the pre-configuration state, thereby ensuring that all network devices are in the state before configuration, ensuring the atomicity and consistency of configuration of multiple network devices, and the reverse task is automatically executed without operation and maintenance.
  • the personnel operate the network devices one by one, which improves the operation and maintenance efficiency, ensures the operation and maintenance work is simplified, and improves the efficiency and flexibility of service deployment.

Abstract

本发明实施例公开了一种任务回退方法、装置和计算机存储介质,所述方法包括:获取任务和所述任务对应的反向任务;所述任务用于对至少一台网络设备进行配置,所述反向任务用于将根据所述任务配置成功的网络设备进行回退,使所述网络设备回退到配置前状态;若所述任务未完全执行成功,则执行反向任务,使所述任务对应的所有网络设备回退到配置前的状态。

Description

一种配置状态回退方法、装置和计算机存储介质
相关申请的交叉引用
本申请基于申请号为201610457995.3、申请日为2016年06月22日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本发明涉及通信领域,尤其涉及一种配置状态回退方法、装置和计算机存储介质。
背景技术
随着通信技术的发展,网络中的设备越来越多,由于网络结构的复杂性,导致对网络设备的管理特别困难,实现业务的部署也特别困难。为了实现对网络设备的集中控制,在采用SDN(Software Defined Network,软件定义网络)控制器实现同时向多台网络设备下发配置时,为了保证对多台网络设备进行配置的原子性和一致性,若某个网络设备配置失败,那么所有的网络设备都应该恢复到原来状态,而为了将配置成功的网络设备恢复到配置前状态,需要运维人员逐个进行恢复配置,耗费人力、时间,运维效率很低。
发明内容
本发明实施例期望提供一种配置状态回退方法、装置和计算机存储介质,解决现有技术中,在实现同时对多台网络设备进行配置时,若某个网络设备配置失败,由运维人员逐个将配置成功的网络设备恢复到配置前状 态,耗费人力、时间,运维效率低下的问题。
本发明实施例提供一种配置状态回退方法,包括:
获取任务和所述任务对应的反向任务;所述任务用于对至少一台网络设备进行配置,所述反向任务用于将根据任务配置成功的网络设备进行回退,使所述网络设备回退到配置前状态;
若任务未完全执行成功,则执行反向任务,使任务对应的所有网络设备回退到配置前的状态。
本发明实施例还提供一种配置状态回退装置,包括:
获取模块,配置为获取任务和所述任务对应的反向任务;所述任务用于对至少一台网络设备进行配置,所述反向任务用于将根据任务配置成功的网络设备进行回退,使所述网络设备回退到配置前状态;
处理模块,配置为若任务未完全执行成功,则执行反向任务,使任务对应的所有网络设备回退到配置前的状态。
本发明实施例还提供一种计算机存储介质,计算机存储介质中存储有计算机可执行指令,计算机可执行指令用于执行本发明实施例的配置状态回退方法。
本发明实施例提供的配置状态回退方法、装置和计算机存储介质,通过获取任务和所述任务对应的反向任务;所述任务用于对至少一台网络设备进行配置,所述反向任务用于将根据所述任务配置成功的网络设备进行回退,使所述网络设备回退到配置前状态;若所述任务未完全执行成功,则执行所述反向任务,使所述任务对应的所有网络设备回退到配置前的状态;采用上述方案,在根据任务对多台网络设备进行配置时,可能出现部分网络设备配置成功,部分网络设备配置失败的情况,反向任务用于将配置成功的网络设备进行回退,使其回退到配置前状态,由此保证所有的网络设备均处于配置之前的状态,保证了对至少一台网络设备配置的原子性 和一致性,且反向任务是自动执行的,无需运维人员逐个对网络设备进行操作,提高了运维效率,保证了运维工作得到简化,提高业务部署的效率和灵活性。
附图说明
图1为本发明实施例一提供的一种配置状态回退方法的流程图;
图2为本发明实施例一提供的transaction(事务)的存储架构的结构示意图;
图3为本发明实施例一提供的任务各状态之间变更的示意图;
图4为本发明实施例一提供的一种配置状态回退方法的流程图;
图5为本发明实施例一提供的一种网络结构示意图;
图6为本发明实施例二提供的一种配置状态回退装置的结构示意图。
具体实施方式
下面通过具体实施方式结合附图对本发明实施例作进一步详细说明。
实施例一
为了保证对多台网络设备进行配置的原子性和一致性,且为了提高了运维效率,提高业务部署的效率和灵活性,本实施例提供一种配置状态回退方法,请参见图1,包括以下步骤:
S101:获取任务和所述任务对应的反向任务,所述任务用于对多台网络设备进行配置,所述反向任务用于将根据任务配置成功的网络设备进行回退,使所述网络设备回退到配置前状态。
为了实现对网络设备的集中控制,采用SDN控制器实现同时向至少一台网络设备下发配置,SDN控制器获取任务和所述任务对应的反向任务;所述任务用于对至少一台网络设备进行配置。SDN控制器在获取到由调度层下发的任务后,创建与该任务对应的反向任务,反向任务用于将根据任 务配置成功的网络设备进行回退,使得配置的至少一台网络设备都处于配置前的状态,在根据所述任务对至少一台网络设备进行配置时,可能出现部分网络设备配置成功,部分网络设备配置失败的情况,反向任务用于将配置成功的网络设备进行回退,使其回退到配置前状态。
S102:若任务未完全执行成功,则执行反向任务,使所述任务对应的所有网络设备回退到配置前的状态。
在任务未完全执行成功的情况下,则执行反向任务,使任务对应的所有网络设备回退到配置前的状态,保证了对至少一台网络设备进行配置的原子性和一致性,且提高了运维效率,保证了运维工作得到简化,提高业务部署的效率和灵活性。
其中,任务包括至少一个子任务,每个子任务对应一个反向子任务;一个子任务用于配置一台网络设备,一个反向子任务用于将根据子任务配置成功的一台网络设备进行回退,使所述网络设备回退到配置前状态,例如当任务包括A、B、C这3个子任务,子任务A、B、C分别用于配置网络设备X、Y、Z,每个子任务对应一个反向子任务,子任务A、B、C的反向子任务分别为a、b、c,在根据子任务A对网络设备X进行配置时,可能出现网络设备X配置成功,也可能出现网络设备X配置失败的情况,若子任务B、C至少一个失败、且子任务A成功,反向子任务a用于将配置成功的网络设备X进行回退,使其回退到配置前状态。
若任务未完全执行成功,则执行反向任务包括:若所述至少一个子任务中存在子任务执行失败,确定所述子任务对应的反向子任务,执行除所述反向子任务外的其他反向子任务。
在确定所述子任务对应的反向子任务之前,还包括:执行所有子任务,并在接收所有子任务的执行结果后,判断是否存在子任务执行失败。
由于执行失败的子任务表明该子任务对应的网络设备未配置成功,为 了保证对至少一台网络设备进行配置的原子性和一致性,所以配置未成功的网络设备则不用将其配置状态进行回退,也即不用执行其对应的反向子任务。所以只需将执行成功的子任务所对应的网络设备的配置状态进行回退即可,也即只需将配置成功的网络设备恢复到其配置前的状态即可。
当同时对至少一台网络设备进行配置时,为了保持原子性和一致性,若至少一台网络设备配置失败,则所有的网络设备的状态都需要恢复到配置前的状态,采用上述方案,为每台网络设备都设置一个子任务和一个对应的反向子任务,子任务用于对网络设备进行配置,反向子任务用于使一台配置成功的网络设备回退到其配置前的状态,若至少一个子任务执行失败,确定其分别对应的反向子任务,自动执行除对应的反向子任务外的所有反向子任务,使得配置成功的网络设备回退到其配置前的状态,若配置成功的网络设备有多台,则自动执行这多台网络设备对应的反向子任务,无需人工操作,提高了运维效率,保证了运维工作得到简化,提高业务部署的效率和灵活性。
其中,所述至少一个子任务中存在子任务执行失败包括:所述至少一个子任务中存在子任务的执行时间超过预设的执行时间阈值。在同时对至少一台网络设备进行配置时,每台网络设备对应的子任务同时开始执行,当存在子任务的执行时间超过预设的执行时间阈值时,则认为该子任务执行失败。
本实施例中,执行反向子任务的时间点为:待所有的子任务执行完成,则开始执行反向子任务;或者,待所述至少一个子任务中任一子任务的执行时间超过预设的执行时间阈值,则开始执行所述子任务对应的反向子任务。
任务包括至少一个子任务,如果某个子任务因为网络故障或其他原因长时间没有返回执行结果,这就会影响到整个任务的执行状态,所以为子 任务的执行时长设置一个阈值是必要的,当达到预设的执行时间阈值仍然没有返回,就认为子任务执行失败。
任务包括至少一个子任务,子任务的状态可以决定出任务的状态。子任务的执行时间超过预设的执行时间阈值,该子任务也是执行失败。只要有一个子任务执行失败,则任务的状态为执行失败;若全部子任务执行成功,任务的状态才为执行成功。
当任务中出现第一个子任务执行失败,或者出现子任务执行时间超过预设的执行时间阈值时,则SDN控制器及时将任务执行失败的结果上报给调度层。
本实施例提供了一种同时对至少一台网络设备进行配置的transaction机制,也即提供一种同时对至少一台网络设备进行配置的一个任务。transaction包括两个属性:原子性和一致性。原子性是指一个transaction是一个不可分割的工作单位,transaction中包括的操作要么都做,要么都不做。一致性是指transaction必须是使数据库从一个一致性状态变到另一个一致性状态。一致性与原子性是密切相关的。本实施例提供的transaction机制可以保证这个transaction要么全部配置成功,要么全部配置失败。
为了实现对网络设备的集中控制,采用SDN控制器实现同时向至少一台网络设备下发配置,SDN控制器可以分为客户端和服务器端,transaction机制由调度层发起,调度层下发此次任务给客户端,任务中携带一个标识符,用来表示一次调度的任务,并通过该标识符监听该次任务的执行结果。客户端收到任务后,客户端先处理本次任务,并获取本次任务的执行结果,将任务执行结果以及标识符一起通告给调度层。调度层与客户端之间的调度是异步执行的,即调度层不需要等待客户端的结果,而是客户端主动将结果上报给调度层。调度层的请求需要客户端与服务器端协作共同完成。
客户端收到由调度层发来的任务后,先解析任务,计算要配置的网络 设备数目,然后向服务器端发送申请分配对应数目的子标识符的请求。服务器端收到客户端发来的请求后,服务器端创建并存储如图2所示的transaction结构,并将各子标识符组成的字符串数组返回给客户端。transaction结构中,F表示客户端收到任务所携带的标识符,S1、S2、S3…Sn表示客户端向服务器端申请到的子标识符。服务器端将任务和反向任务进行存储,任务用于对多台网络设备进行配置,反向任务用于将根据任务配置成功的网络设备进行回退,使其回退到配置前状态。
申请到子标识符后,客户端为每一台网络设备构建一个进行配置的子任务,每个子任务用一个子标识符进行标识,并通过该子标识符跟踪并监听子任务的执行结果。在为每一台网络设备构建一个子任务时,还会同时构建一个与该子任务对应的反向子任务,反向子任务用于将根据子任务配置成功的一台网络设备进行回退,使其回退到配置前状态。
客户端获得子任务的执行结果后,将子任务的执行结果通告给服务器端,但是客户端并不知道整个任务的执行结果,客户端向服务器端发送申请查询整个任务的执行结果的请求,服务器端在收到子任务的执行结果后,先设置对应子任务的状态。服务器端遍历各子任务的状态,更新任务的状态,并将任务的状态返回给客户端。子任务执行后的状态分为SUCCESS(成功)和FAIL(失败)。服务器端返回给客户端的任务的状态包含WAIT(等待)、SUCCESS、FAIL和DISCARD(丢弃)。其中,WAIT表示部分子任务执行成功,其他子任务仍然在执行的状态,当服务器端返回的状态是等待状态,说明整个任务还没有完成,要继续等待。SUCCESS表示所有的子任务都已经执行成功,服务器端返回该状态说明整个任务执行成功。FAIL表示一旦发现其中的某一个子任务执行失败,则将整个任务的状态设置为失败,服务器端返回该状态说明整个任务执行失败。DISCARD表示在当前子任务执行结束前,已经有子任务执行失败,服务器端返回该状态说明整 个任务执行失败,并且已经上报给调度层,客户端收到DISCARD不再做任何处理。
由于客户端是在获得子任务的执行结果后,才向服务器端发送申请查询整个任务的执行结果的请求,所以服务器端返回给客户端的任务的状态是WAIT、SUCCESS、FAIL和DISCARD这四种中的一种。而任务的状态还包括START(启动),服务器端在创建并存储如图2所示的transaction结构后,将任务的状态置为START,并将子标识符返回给客户端。
参见图3,任务的各状态之间的变更具体如下:
START到WAIT:进入START后,服务器端就随时等着客户端通告子任务的执行结果,当服务器端收到的第一个子任务的执行结果是执行成功时,任务的状态就从START转化到WAIT。
WAIT到SUCCESS:若任务的状态是WAIT,说明已有部分子任务执行成功,尚未出现执行失败的子任务。当服务器端收到的通告是最后一个子任务的执行结果、且最后一个子任务执行成功时,任务的状态便从WAIT到SUCCESS。
WAIT到FAIL:若任务的状态是WAIT,说明已有部分子任务执行成功,尚未出现执行失败的子任务。当服务器端收到的子任务的执行结果是执行失败时,任务的状态便从WAIT到FAIL。
FAIL到DISCARD:若任务的状态是FAIL,说明已有一个子任务执行失败,整个任务已经失败,当前子任务的执行结果不会影响任务的状态,即一个子任务已经执行失败,不用管在这个子任务之后的一个子任务的执行结果是成功还是失败,此时任务的状态便从FAIL到DISCARD。
DISCARD到DISCARD:若任务的状态是DISCARD,整个任务已经失败,当前子任务的执行结果不会影响任务的状态,即不用管当前子任务的执行结果是成功还是失败,此时任务的状态便从DISCARD到DISCARD, 即还是DISCARD状态。
客户端根据收到的任务状态进行处理,原则是:WAIT表示任务没有执行结束,不处理,不会上报给调度层;SUCCESS表示执行成功,上报给调度层;FAIL表示执行失败,上报给调度层;DISCARD表示任务已经执行失败,不再做任何处理。
当一个任务在服务器端存储时间超过预设的执行时间阈值,服务器端告诉客户端任务超时,客户端如果收到服务器端发来的任务超时的信息,则表示任务执行失败,上报给调度层同时释放相关资源。
其中,当由于某个子任务执行失败而导致整个任务执行失败时,为了保证任务的原子性和一致性,采用回退机制将执行成功的子任务进行回退,使得配置成功的网络设备回退到配置前状态。若至少一个子任务执行失败,则确定其分别对应的反向子任务,执行除对应的反向子任务外的所有反向子任务。由于执行失败的子任务表明该子任务对应的网络设备未配置成功,为了保证对多台网络设备进行配置的原子性和一致性,所以配置未成功的网络设备则不用将其状态进行回退,也即不用执行其对应的反向子任务。所以只需将执行成功的子任务进行回退即可,也即只需将配置成功的网络设备恢复到其配置前的状态即可。
在本实施例中,SDN控制器到网络设备的配置操作是最底层、最基础的操作,SDN控制器使用的南向通道需保证这个配置操作的原子性、是按transaction方式进行处理的。例如SDN控制器可使用NETCONF(Network Configuration Protocol,网络配置协议)作为南向通道,NETCONF本身可以保证一次NETCONF报文交互的原子性,所以对于最基础配置操作,如果产生错误,也不需要回退。故如果整个任务执行失败,需要回退的部分是整个任务中执行成功的那些子任务。
本实施例中要求客户端在构建正向的配置子任务的同时,构建与之对 应的反向子任务,并将该反向子任务交由服务器端管理,该反向子任务将在需要回退时调用。回退的时机在所有子任务均执行完以后;或者在服务器端判断某个子任务的执行时间超过预设的执行时间阈值,这时认为该子任务执行失败,需要将已经执行成功的子任务进行回退,对于超时任务中还没有执行结束的子任务,默认为执行失败,不做回退处理。
由服务器端对反向子任务进行调度,服务器端判断出任务满足执行失败或超时,以及回退时机的条件后,服务器端可直接进行回退处理,客户端和调度层不需要感知回退处理流程。
参见图4,本实施例还例举一个具体的例子进行说明,具体如下:
本实施例使用NETCONF作为SDN控制器的南向通道。原因有下面几点:1、NETCONF使用XML(Extensible Markup Language,可扩展标记语言)作为配置数据和协议消息的编码方式,XML可以表达复杂的、具有内在逻辑关系的模型化的管理对象,大大提高了操作效率和对象标准化。根据XML的这一优势,配置之间的依赖关系可以利用XML表达出来,从而屏蔽掉NETCONF操作层面对依赖关系的感知。2、NETCONF设备只要实现了错误回退能力urn:ietf:params:netconf:capability:rollback-on-error:1.0,参见rfc6241,在构建配置报文时将配置报文的error-option(出错选项)设置为rollback-on-error(回退错误),就能保证每一个NETCONF报文的配置操作的原子性。3、构建NETCONF报文的反向报文也很容易。
图5是一个使用SDN控制器进行集中控制的网络,假设调度层下发给SDN控制器一个任务:创建一条S1到S7的隧道。下面详细描述采用transaction机制是如何使这次配置作为一个任务配置到多台网络设备上的。
S201:调度层下发给SDN控制器的客户端一个任务:创建一条S1到S7的隧道。任务中携带一个标识符。
调度层下发给SDN控制器的客户端一个任务:创建一条S1到S7的隧 道。任务中携带一个标识符create-tunnel-1(创建-隧道-1)和创建隧道的相关信息。调度层通过异步方式调用这个任务,然后将create-tunnel-1添加到监听执行结果的队列中,然后返回。
S202:客户端计算出配置该隧道需要同时配置S1、S2、S3、S7这四个节点,故向服务器端发送申请分配四个子标识符的请求。
SDN控制器的客户端收到标识符为create-tunnel-1的任务后,结合SDN控制器上的拓扑信息计算出配置该隧道需要同时配置S1、S2、S3、S7这四个节点,一共需要四个子任务来完成本次配置,故向服务器端发送申请分配四个子标识符的请求。
S203:服务器端分配四个子标识符,并返回给客户端。
服务器端收到标识符为create-tunnel-1和子标识符个数为4的请求后,服务器端创建存储架构,包含一个任务的标识符和四个子任务的子标识符,四个子任务分别分配到create-tunnel-1-s1、create-tunnel-1-s2、create-tunnel-1-s3、create-tunnel-1-s7作为子标识符,并将子标识符返回给客户端,同时将任务的状态设置为START。子标识符用来标记和跟踪对应的子任务。
S204:客户端构建四个子任务和四个对应的反向子任务,将构建出来的反向子任务托管到服务器端。每个子任务都携带一个子标识符。
客户端收到四个子标识符后,构建四个子任务和四个对应的反向子任务,构建的四个子任务均以报文形式构建,构建的四个反向子任务也以报文形式构建,将构建出来的反向子任务托管到服务器端。每个子任务都携带一个子标识符,按异步方式执行子任务,通过子标识符监听子任务的执行结果。
S205:客户端监听子任务的执行结果,将子任务的执行结果告知服务器端,并等待服务器端返回任务的状态,根据任务的状态进行相应处理。 客户端一直重复S205的操作,直到所有子任务都返回执行结果。
若客户端收到服务器端返回的任务状态为WAIT,表示任务没有执行结束,客户端不处理,不会上报给调度层;若客户端收到服务器端返回的任务状态为SUCCESS,表示执行成功,客户端上报给调度层;若客户端收到服务器端返回的任务状态为FAIL,表示执行失败,客户端上报给调度层;若客户端收到服务器端返回的任务状态为DISCARD表示任务已经执行失败,客户端不再做任何处理。
S206:服务器端通过子标识符找到存储的对应的子任务,并设置其状态。然后遍历另外所有的子任务,根据状态转换机制计算出任务的状态,并将任务的该状态返回给客户端。同时服务器端判断所有的子任务是否全部执行结束,若是则进一步判断计算出任务的状态是SUCCESS、FAIL或DISCARD,根据任务的状态做相应处理。
服务器端收到客户端发送的子任务的执行结果,以及查询任务状态的请求后,通过子任务携带的子标识符找到存储的对应的子任务,并设置其状态。然后遍历另外所有的子任务,根据状态转换机制计算出任务的状态,并将任务的该状态返回给客户端。同时服务器端判断所有的子任务是否全部执行结束,若是则进一步判断计算出任务的状态是SUCCESS、FAIL或DISCARD,如果是SUCCESS,则删除任务及其包含的子任务,释放资源;如果是FAIL或DISCARD,则触发回退流程,调用已经执行成功的子任务对应的反向子任务,待反向子任务执行结束后,删除任务及其包含的子任务,释放资源。
S207:服务器端检查到子任务的执行时间超过预设的执行时间阈值,则通知客户端任务失败,并且触发回退流程,调用已经执行成功的子任务对应的反向子任务,待反向子任务执行结束后,删除任务及其包含的子任务,释放资源。
根据本实施例提供的配置状态回退方法,通过获取任务和对应的反向任务;任务用于对至少一台网络设备进行配置,反向任务用于将根据任务配置成功的网络设备进行回退,使网络设备回退到配置前状态;若任务未完全执行成功,则执行反向任务,使任务对应的所有网络设备回退到配置前的状态;采用上述方案,在根据任务对至少一台网络设备进行配置时,可能出现部分网络设备配置成功,部分网络设备配置失败的情况,反向任务用于将配置成功的网络设备进行回退,使其回退到配置前状态,由此保证所有的网络设备均处于配置之前的状态,保证了对多台网络设备配置的原子性和一致性,且反向任务是自动执行的,无需运维人员逐个对网络设备进行操作,提高了运维效率,保证了运维工作得到简化,提高业务部署的效率和灵活性。
实施例二
为了保证对多台网络设备进行配置的原子性和一致性,且为了提高了运维效率,提高业务部署的效率和灵活性,本实施例还提供一种配置状态回退装置,请参见图6,包括:
获取模块601,配置为获取任务和所述任务对应的反向任务,所述任务用于对至少一台网络设备进行配置,所述反向任务用于将根据任务配置成功的网络设备进行回退,使所述网络设备回退到配置前状态;
处理模块602,配置为若任务未完全执行成功,则执行反向任务,使任务对应的所有网络设备回退到配置前的状态。
为了实现对网络设备的集中控制,采用获取模块601获取任务和所述任务对应的反向任务;所述任务用于对至少一台网络设备进行配置,所述反向任务用于将根据任务配置成功的网络设备进行回退,使所述网络设备回退到配置前状态,在根据任务对至少一台网络设备进行配置时,可能出现部分网络设备配置成功,部分网络设备配置失败的情况,所述反向任务 用于将配置成功的网络设备进行回退,使其回退到配置前状态。
所述获取模块601在获取到由调度层下发的任务后,由所述处理模块602创建与该任务对应的反向任务,所述反向任务用于将根据任务配置成功的网络设备进行回退,使所述网络设备回退到配置前状态。在所述任务未完全执行成功的情况下,所述处理模块602执行所述任务对应的反向任务,使所述任务对应的所有网络设备回退到配置前的状态,保证了对至少一台网络设备进行配置的原子性和一致性,且提高了运维效率,保证了运维工作得到简化,提高业务部署的效率和灵活性。
其中,任务包括至少一个子任务,每个子任务对应一个反向子任务;一个子任务用于配置一台网络设备,一个反向子任务用于将根据子任务配置成功的一台网络设备进行回退,使所述网络设备回退到配置前状态,例如当任务包括A、B、C这3个子任务,子任务A、B、C分别用于配置网络设备X、Y、Z,每个子任务对应一个反向子任务,子任务A、B、C的反向子任务分别为a、b、c,在根据子任务A对网络设备X进行配置时,可能出现网络设备X配置成功,也可能出现网络设备X配置失败的情况,若子任务B、C至少一个失败、且子任务A成功,反向子任务a用于将配置成功的网络设备X进行回退,使其回退到配置前状态。处理模块602用于:若至少一个子任务执行失败,确定其分别对应的反向子任务,执行除对应的反向子任务外的所有反向子任务。
所述处理模块602配置为:若所述至少一个子任务中存在子任务执行失败,确定所述子任务对应的反向子任务,执行除所述反向子任务外的其他反向子任务。
所述处理模块602还配置为若所述至少一个子任务中存在子任务执行失败,确定所述子任务对应的反向子任务之前,执行所有子任务,并在接收所有子任务的执行结果后,判断是否存在子任务执行失败。
由于执行失败的子任务表明该子任务对应的网络设备未配置成功,为了保证对至少一个网络设备进行配置的原子性和一致性,所以配置未成功的网络设备则不用将其配置状态进行回退,也即不用执行其对应的反向子任务。所以只需将执行成功的子任务进行回退即可,也即只需将配置成功的网络设备恢复到其配置前的状态即可。
当同时对至少一台网络设备进行配置时,为了保持原子性和一致性,若至少一台网络设备配置失败,则所有的网络设备的状态都需要恢复到配置前的状态,采用上述方案,为每台网络设备都设置一个子任务和一个对应的反向子任务,子任务用于对网络设备进行配置,反向子任务用于使一台配置成功的网络设备回退到其配置前的状态,若至少一个子任务执行失败,则所述处理模块602确定其分别对应的反向子任务,自动执行除对应的反向子任务外的所有反向子任务,使得配置成功的网络设备回退到其配置前的状态,若配置成功的网络设备有多台,则至少一处理模块602自动执行这多台网络设备对应的反向子任务,无需人工操作,提高了运维效率,保证了运维工作得到简化。
其中,所述处理模块配置为602:判断所述至少一个子任务中是否存在子任务的执行时间超过预设的执行时间阈值;当判定所述至少一个子任务中存在子任务的执行时间超过预设的执行时间阈值时,确定所述子任务对应的反向子任务,执行除所述反向子任务外的其他反向子任务。在同时对至少一台网络设备进行配置时,每台网络设备对应的子任务同时开始执行,当至少一个子任务的执行时间超过预设的执行时间阈值时,则认为至少一个子任务执行失败。
所述处理模块602配置为,待所有的子任务执行完成,开始执行反向子任务;或者,待所述至少一个子任务中任一子任务的执行时间超过预设的执行时间阈值时,开始执行所述子任务对应的反向子任务。
任务包括至少一个子任务,如果某个子任务因为网络故障或其他原因长时间没有返回执行结果,这就会影响到整个任务的执行状态,所以为子任务的执行时长设置一个阈值是必要的,当达到预设的执行时间阈值仍然没有返回,就认为子任务执行失败。
任务包括至少一个子任务,子任务的状态可以决定出任务的状态。子任务的执行时间超过预设的执行时间阈值,该子任务也是执行失败。只要有一个子任务执行失败,则任务的状态为执行失败;若全部子任务执行成功,则任务的状态才为执行成功。
当任务中出现第一个子任务执行失败,或者出现子任务执行时间超过预设的执行时间阈值时,则所述处理模块602及时将任务执行失败上报给调度层。
本实施例提供了一种同时对至少一台网络设备进行配置的transaction机制,也即提供一种同时对至少一台网络设备进行配置的一个任务。transaction包括两个属性:原子性和一致性。原子性是指一个transaction是一个不可分割的工作单位,transaction中包括的操作要么都做,要么都不做。一致性是指transaction必须是使数据库从一个一致性状态变到另一个一致性状态。一致性与原子性是密切相关的。
transaction机制由调度层发起,所述获取模块601获取任务调度层下发的此次任务,任务中携带一个标识符,用来表示一次调度的任务,并通过该标识符监听该次任务的执行结果。所述获取模块601收到任务后,先处理本次任务,并获取本次任务的执行结果,将任务执行结果以及标识符一起通告给调度层。调度层的请求需要所述获取模块601与所述处理模块602协作共同完成。
所述获取模块601收到由调度层发来的任务后,由所述处理模块602先解析任务,计算要配置的网络设备数目,然后分配对应数目的子标识符。 所述处理模块602创建并存储如图2所示的transaction结构。transaction结构中,F表示所述获取模块601收到任务所携带的标识符,S1、S2、S3…Sn表示分配到的子标识符。所述处理模块602将任务和反向任务进行存储,任务用于对多台网络设备进行配置,反向任务用于将根据任务配置成功的网络设备进行回退,使其回退到配置前状态。
分配到子标识符后,所述处理模块602为每一台网络设备构建一个进行配置的子任务,每个子任务用一个子标识符进行标识,并通过该子标识符跟踪并监听子任务的执行结果。所述处理模块602在为每一台网络设备构建一个子任务时,还会同时构建一个与该子任务对应的反向子任务,反向子任务用于将根据子任务配置成功的一台网络设备进行回退,使其回退到配置前状态。
所述处理模块602获得子任务的执行结果后,先设置对应子任务的状态。所述处理模块602遍历各子任务的状态,更新任务的状态。子任务执行后的状态分为SUCCESS和FAIL。任务的状态包含WAIT、SUCCESS、FAIL和DISCARD。其中,WAIT表示部分子任务执行成功,其他子任务仍然在执行的状态,当任务的状态是等待状态,说明整个任务还没有完成,要继续等待。SUCCESS表示所有的子任务都已经执行成功,任务的状态为SUCCESS说明整个任务执行成功。FAIL表示一旦发现其中的某一个子任务执行失败,则将整个任务的状态设置为失败,任务的状态为FAIL说明整个任务执行失败。DISCARD表示在当前子任务执行结束前,已经有子任务执行失败,任务的状态为DISCARD说明整个任务执行失败,并且已经上报给调度层。
任务的状态除了WAIT、SUCCESS、FAIL和DISCARD这四种,还有一种状态是START,所述处理模块602在创建并存储如图2所示的transaction结构后,将任务的状态置为START。
参见图3,任务的各状态之间的变更具体如下:
START到WAIT:进入START后,当所述处理模块602收到的第一个子任务的执行结果是执行成功时,任务的状态就从START转化到WAIT。
WAIT到SUCCESS:若任务的状态是WAIT,说明已有部分子任务执行成功,尚未出现执行失败的子任务。当所述处理模块602收到的通告是最后一个子任务的执行结果、且最后一个子任务执行成功时,任务的状态便从WAIT到SUCCESS。
WAIT到FAIL:若任务的状态是WAIT,说明已有部分子任务执行成功,尚未出现执行失败的子任务。当所述处理模块602收到的子任务的执行结果是执行失败时,任务的状态便从WAIT到FAIL。
FAIL到DISCARD:若任务的状态是FAIL,说明已有一个子任务执行失败,整个任务已经失败,当前子任务的执行结果不会影响任务的状态,即一个子任务已经执行失败,不用管在这个子任务之后的一个子任务的执行结果是成功还是失败,此时任务的状态便从FAIL到DISCARD。
DISCARD到DISCARD:若任务的状态是DISCARD,整个任务已经失败,当前子任务的执行结果不会影响任务的状态,即不用管当前子任务的执行结果是成功还是失败,此时任务的状态便从DISCARD到DISCARD,即还是DISCARD状态。
所述处理模块602根据收到的任务状态进行处理,原则是:WAIT表示任务没有执行结束,不处理,不会上报给调度层;SUCCESS表示执行成功,上报给调度层;FAIL表示执行失败,上报给调度层;DISCARD表示任务已经执行失败,不再做任何处理。
当一个任务在所述处理模块602存储时间超过预设的执行时间阈值,则表示任务执行失败,上报给调度层同时释放相关资源。
其中,当由于某个子任务执行失败而导致整个任务执行失败时,为了 保证任务的原子性和一致性,采用回退机制将执行成功的子任务进行回退,使得配置成功的网络设备回退到配置前状态。若至少一个子任务执行失败,则确定其分别对应的反向子任务,执行除对应的反向子任务外的所有反向子任务。。由于执行失败的子任务表明该子任务对应的网络设备未配置成功,为了保证对多台网络设备进行配置的原子性和一致性,所以配置未成功的网络设备则不用将其状态进行回退,也即不用执行其对应的反向子任务。所以只需将执行成功的子任务进行回退即可,也即只需将配置成功的网络设备恢复到其配置前的状态即可。
在本实施例中,到网络设备的配置操作是最底层、最基础的操作,所使用的南向通道需保证这个配置操作的原子性、是按transaction方式进行处理的。例如可使用NETCONF作为南向通道,NETCONF本身可以保证一次NETCONF报文交互的原子性,所以对于最基础配置操作,如果产生错误,也不需要回退。故如果整个任务执行失败,需要回退的部分是整个任务中执行成功的那些子任务。
本实施例中要求在获取正向的配置子任务的同时,并获取与之对应的反向子任务,该反向子任务将在需要回退时调用。回退的时机在所有子任务均执行完以后;或者在所述处理模块602判断出某个子任务的执行时间超过预设的执行时间阈值,这时认为该子任务执行失败,需要将已经执行成功的子任务进行回退,对于超时任务中还没有执行结束的子任务,默认为执行失败,不做回退处理。
由所述处理模块602对反向子任务进行调度,所述处理模块602判断出任务满足执行失败或超时,以及回退时机的条件后,所述处理模块602可直接进行回退处理,调度层不需要感知回退处理流程。
本实施例还例举一个具体的例子进行说明,具体如下:
本实施例使用NETCONF作为南向通道。原因有下面几点:1、 NETCONF使用XML作为配置数据和协议消息的编码方式,XML可以表达复杂的、具有内在逻辑关系的模型化的管理对象,大大提高了操作效率和对象标准化。根据XML的这一优势,配置之间的依赖关系可以利用XML表达出来,从而屏蔽掉NETCONF操作层面对依赖关系的感知。2、NETCONF设备只要实现了错误回退能力urn:ietf:params:netconf:capability:rollback-on-error:1.0,参见rfc6241,在构建配置报文时将配置报文的error-option设置为rollback-on-error,就能保证每一个NETCONF报文的配置操作的原子性。3、构建NETCONF报文的反向报文也很容易。
假设所述获取模块601获取由调度层下发的一个任务:创建一条S1到S7的隧道。下面详细描述采用transaction机制是如何使这次配置作为一个任务配置到多台网络设备上的。
所述获取模块601获取由调度层下发的一个任务:创建一条S1到S7的隧道。任务中携带一个标识符。
所述获取模块601获取由调度层下发的一个任务:创建一条S1到S7的隧道。任务中携带一个标识符create-tunnel-1和创建隧道的相关信息。调度层通过异步方式调用这个任务,然后将create-tunnel-1添加到监听执行结果的队列中,然后返回。
所述处理模块602计算出配置该隧道需要同时配置S1、S2、S3、S7这四个节点,故给每个节点均分配一个子标识符。
所述获取模块601获取到标识符为create-tunnel-1的任务后,结合SDN控制器上的拓扑信息计算出配置该隧道需要同时配置S1、S2、S3、S7这四个节点,一共需要四个子任务来完成本次配置,故给每个节点均分配一个子标识符。并创建存储架构,包含一个任务的标识符和四个子任务的子标识符,四个子任务分别分配到create-tunnel-1-s1、create-tunnel-1-s2、 create-tunnel-1-s3、create-tunnel-1-s7作为子标识符,同时将任务的状态设置为START。子标识符用来标记和跟踪对应的子任务。
所述处理模块602构建四个子任务和四个对应的反向子任务,每个子任务都携带一个子标识符。构建的四个子任务均以报文形式构建,构建的四个反向子任务也以报文形式构建。每个子任务都携带一个子标识符,按异步方式执行子任务,通过子标识符监听子任务的执行结果。
所述处理模块602监听子任务的执行结果,并根据任务的状态进行相应处理。
若任务状态为WAIT,表示任务没有执行结束,处理模块602不处理,不会上报给调度层;若任务状态为SUCCESS,表示执行成功,处理模块602上报给调度层;若任务状态为FAIL,表示执行失败,处理模块602上报给调度层;若任务状态为DISCARD,表示任务已经执行失败,处理模块602不再做任何处理。
所述处理模块602通过子标识符找到存储的对应的子任务,并设置其状态。然后遍历另外所有的子任务,根据状态转换机制计算出任务的状态。同时所述处理模块602判断所有的子任务是否全部执行结束,若是则进一步判断计算出任务的状态是SUCCESS、FAIL或DISCARD,根据任务的状态做相应处理。
所述处理模块602通过子任务携带的子标识符找到存储的对应的子任务,并设置其状态。然后遍历另外所有的子任务,根据状态转换机制计算出任务的状态。同时所述处理模块602判断所有的子任务是否全部执行结束,若是则进一步判断计算出任务的状态是SUCCESS、FAIL或DISCARD,如果是SUCCESS,则删除任务及其包含的子任务,释放资源;如果是FAIL或DISCARD,则触发回退流程,调用已经执行成功的子任务对应的反向子任务,待反向子任务执行结束后,删除任务及其包含的子任务,释放资源。
所述处理模块602检查到子任务的执行时间超过预设的执行时间阈值,,整个任务执行失败,触发回退流程,调用已经执行成功的子任务对应的反向子任务,待反向子任务执行结束后,删除任务及其包含的子任务,释放资源。
本实施例中,所述装置中的获取模块601和处理模块602,在实际应用中均可由所述装置中的CPU(Central Processing Unit,中央处理器)、DSP(Digital Signal Processor,数字信号处理器)、MCU(Microcontroller Unit,微控制单元)或FPGA(Field-Programmable Gate Array,可编程门阵列)实现。
根据本实施例提供的配置状态回退装置,通过所述获取模块601获取任务和所述任务对应的反向任务;任务用于对至少一台网络设备进行配置,反向任务用于将根据任务配置成功的网络设备进行回退,使网络设备回退到配置前状态;所述处理模块602配置为若任务未完全执行成功,则执行反向任务,使任务对应的所有网络设备回退到配置前的状态;采用上述方案,在根据任务对至少一台网络设备进行配置时,可能出现部分网络设备配置成功,部分网络设备配置失败的情况,反向任务用于将配置成功的网络设备进行回退,使其回退到配置前状态,由此保证所有的网络设备均处于配置之前的状态,保证了对多台网络设备配置的原子性和一致性,且反向任务是自动执行的,无需运维人员逐个对网络设备进行操作,提高了运维效率,保证了运维工作得到简化,提高业务部署的效率和灵活性。
在另一实施例中还提供一种计算机存储介质,计算机存储介质中存储有计算机可执行指令,计算机可执行指令用于执行实施例一中任一项的配置状态回退方法。
在本发明所提供的几个实施例中,应该理解到,所揭露的方法及装置,可以通过其他的方式实现。以上所描述的装置实施例仅仅是示意性的,例 如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个模块或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的通信连接可以是通过一些接口,设备或模块的间接耦合或通信连接,可以是电性的、机械的或其他形式的。
上述作为分离部件说明的模块可以是、或也可以不是物理上分开的,作为模块显示的部件可以是、或也可以不是物理模块,即可以位于一个地方,也可以分布到多个网络模块上;可以根据实际的需要选择其中的部分或全部模块来实现本实施例方案的目的。
另外,在本发明各实施例中的各功能模块可以全部集成在一个处理模块中,也可以是各模块分别单独作为一个模块,也可以两个或两个以上模块集成在一个模块中;上述集成的模块既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、ROM(Read-Only Memory,只读存储器)、磁碟或者光盘等各种可以存储程序代码的介质。
或者,本发明实施例上述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、磁碟或者光 盘等各种可以存储程序代码的介质。
本发明实施例中记载的存储器切换方法、装置只以上述实施例为例,但不仅限于此,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。
以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。
工业实用性
本发明实施例的技术方案在根据任务对多台网络设备进行配置时,可能出现部分网络设备配置成功,部分网络设备配置失败的情况,反向任务用于将配置成功的网络设备进行回退,使其回退到配置前状态,由此保证所有的网络设备均处于配置之前的状态,保证了对多台网络设备配置的原子性和一致性,且反向任务是自动执行的,无需运维人员逐个对网络设备进行操作,提高了运维效率,保证了运维工作得到简化,提高业务部署的效率和灵活性。

Claims (11)

  1. 一种配置状态回退方法,包括:
    获取任务和所述任务对应的反向任务;所述任务用于对至少一台网络设备进行配置,所述反向任务用于将根据所述任务配置成功的所述网络设备进行回退,使所述网络设备回退到配置前状态;
    若所述任务未完全执行成功,则执行所述反向任务,使所述任务对应的所有网络设备回退到配置前的状态。
  2. 如权利要求1所述的配置状态回退方法,其中,所述任务包括至少一个子任务,每个所述子任务对应一个反向子任务;一个所述子任务用于配置一台所述网络设备,一个所述反向子任务用于将根据所述子任务配置成功的一台所述网络设备进行回退,使所述网络设备回退到配置前状态;
    所述若所述任务未完全执行成功,则执行所述反向任务包括:若所述至少一个子任务中存在子任务执行失败,确定所述子任务对应的反向子任务,执行除所述反向子任务外的其他反向子任务。
  3. 如权利要求2所述的配置状态回退方法,其中,所述至少一个子任务中存在子任务执行失败包括:所述至少一个子任务中存在子任务的执行时间超过预设的执行时间阈值。
  4. 如权利要求2或3所述的配置状态回退方法,其中,所述执行反向子任务包括:待所有的所述子任务执行完成,开始执行所述反向子任务;或者,待所述至少一个子任务中任一子任务的执行时间超过预设的执行时间阈值,开始执行所述子任务对应的反向子任务。
  5. 如权利要求2或3所述的配置状态回退方法,其中,若所述至少一个子任务中存在子任务执行失败,确定所述子任务对应的反向子任务之前,还包括:执行所述至少一个子任务中的所有子任务,并在接收到所有子任务的执行结果后,判断所述至少一个子任务中是否存在子任务执行失败。
  6. 一种配置状态回退装置,包括:
    获取模块,配置为获取任务和所述任务对应的反向任务;所述任务用于对至少一台网络设备进行配置,所述反向任务用于将根据所述任务配置成功的所述网络设备进行回退,使所述网络设备回退到配置前状态;
    处理模块,配置为若所述任务未完全执行成功,则执行所述反向任务,使所述任务对应的所有网络设备回退到配置前的状态。
  7. 如权利要求6所述的配置状态回退装置,其中,所述任务包括至少一个子任务,每个所述子任务对应一个反向子任务;一个所述子任务用于配置一台所述网络设备,一个所述反向子任务用于将根据所述子任务配置成功的一台所述网络设备进行回退,使所述网络设备回退到配置前状态;
    所述处理模块配置为:若所述至少一个子任务中存在子任务执行失败,确定所述子任务对应的反向子任务,执行除所述反向子任务外的其他反向子任务。
  8. 如权利要求7所述的配置状态回退装置,其中,所述处理模块配置为:判断所述至少一个子任务中是否存在子任务的执行时间超过预设的执行时间阈值;当判定所述至少一个子任务中存在子任务的执行时间超过预设的执行时间阈值时,确定所述子任务对应的反向子任务,执行除所述反向子任务外的其他反向子任务。
  9. 如权利要求7或8所述的配置状态回退装置,其中,所述处理模块配置为:待所有的所述子任务执行完成,开始执行所述反向子任务;或者,待所述至少一个子任务中任一子任务的执行时间超过预设的执行时间阈值,开始执行所述子任务对应的反向子任务。
  10. 如权利要求7或8所述的配置状态回退装置,其中,所述处理模块还配置为:执行所述至少一个子任务中的所有子任务,并在接收到所有子任务的执行结果后,判断所述至少一个子任务中是否存在子任务执行失败; 当判定所述至少一个子任务中存在子任务执行失败时,确定所述子任务对应的反向子任务。
  11. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1至5任一项所述的配置状态回退方法。
PCT/CN2017/083729 2016-06-22 2017-05-10 一种配置状态回退方法、装置和计算机存储介质 WO2017219775A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610457995.3 2016-06-22
CN201610457995.3A CN107528709A (zh) 2016-06-22 2016-06-22 一种配置状态回退方法和装置

Publications (1)

Publication Number Publication Date
WO2017219775A1 true WO2017219775A1 (zh) 2017-12-28

Family

ID=60734148

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/083729 WO2017219775A1 (zh) 2016-06-22 2017-05-10 一种配置状态回退方法、装置和计算机存储介质

Country Status (2)

Country Link
CN (1) CN107528709A (zh)
WO (1) WO2017219775A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111478801A (zh) * 2020-03-27 2020-07-31 烽火通信科技股份有限公司 一种通信设备配置管理方法及系统
CN112965850A (zh) * 2021-03-23 2021-06-15 上海云轴信息科技有限公司 一种在中台系统中实现工作流的方法与设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101079755A (zh) * 2007-07-03 2007-11-28 中兴通讯股份有限公司 网元管理系统中的配置方法
CN101178665A (zh) * 2007-12-06 2008-05-14 华为技术有限公司 实现配置事务的方法及设备
WO2009089408A1 (en) * 2008-01-11 2009-07-16 International Business Machines Corporation System and method for restartable provisioning of software components
CN102193780A (zh) * 2010-03-08 2011-09-21 华为技术有限公司 事务实现方法以及事务实现设备
CN102271057A (zh) * 2011-08-02 2011-12-07 大唐移动通信设备有限公司 参数更新方法和设备

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104410517B (zh) * 2011-11-29 2018-12-14 华为技术有限公司 一种配置回退的方法和设备
CN102420703B (zh) * 2011-11-29 2015-04-08 华为技术有限公司 一种配置回退的方法和设备
US20140062875A1 (en) * 2012-09-06 2014-03-06 Panasonic Corporation Mobile device with an inertial measurement unit to adjust state of graphical user interface or a natural language processing unit, and including a hover sensing function

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101079755A (zh) * 2007-07-03 2007-11-28 中兴通讯股份有限公司 网元管理系统中的配置方法
CN101178665A (zh) * 2007-12-06 2008-05-14 华为技术有限公司 实现配置事务的方法及设备
WO2009089408A1 (en) * 2008-01-11 2009-07-16 International Business Machines Corporation System and method for restartable provisioning of software components
CN102193780A (zh) * 2010-03-08 2011-09-21 华为技术有限公司 事务实现方法以及事务实现设备
CN102271057A (zh) * 2011-08-02 2011-12-07 大唐移动通信设备有限公司 参数更新方法和设备

Also Published As

Publication number Publication date
CN107528709A (zh) 2017-12-29

Similar Documents

Publication Publication Date Title
US10484265B2 (en) Dynamic update of virtual network topology
US10020980B2 (en) Arbitration processing method after cluster brain split, quorum storage apparatus, and system
JP6026705B2 (ja) 更新管理システムおよび更新管理方法
TW201944236A (zh) 任務處理方法、裝置及系統
WO2020024405A1 (zh) 基于分布式协调的测试方法、装置、服务器及存储介质
WO2019001421A1 (zh) 网络切片管理方法、装置及计算机可读存储介质
US10503636B2 (en) Concurrent hierarchical dead actor collection in a distributed system
US9634886B2 (en) Method and apparatus for providing tenant redundancy
CN113742031A (zh) 节点状态信息获取方法、装置、电子设备及可读存储介质
WO2017219775A1 (zh) 一种配置状态回退方法、装置和计算机存储介质
JP6304499B2 (ja) 相互接続ネットワークを管理する方法およびシステム
US9311073B2 (en) Upgrading nodes using leader node appointment
CN109657005A (zh) 一种分布式集群系统的数据缓存方法、装置及设备
CN114553867A (zh) 一种云原生的跨云网络监控方法、装置及存储介质
CN111740915B (zh) 邻居节点确定方法、装置、设备和存储介质
US9525607B2 (en) Connectivity notification
CN112600842A (zh) 集群shell方法、装置、电子设备及计算机可读存储介质
US9575865B2 (en) Information processing system and monitoring method
US20140295818A1 (en) Method, Base Station, and Network System for Automatic X2 Configuration Deletion
CN111200578A (zh) 一种通信方法、客户端设备及服务端设备
CN104580512B (zh) 数据处理方法和装置,及分布式文件系统
CN115391058A (zh) 一种基于sdn的资源事件处理方法、资源创建方法及系统
CN112583621B (zh) 一种自动退出试运行的方法、设备和系统
CN107679817B (zh) 工作流执行方法及相关设备
CN112714143A (zh) 分布式存储系统的服务协调方法、装置及电子设备

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: 17814513

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: 17814513

Country of ref document: EP

Kind code of ref document: A1