CN117459482B - Restarting method and device of switch, storage medium and electronic device - Google Patents

Restarting method and device of switch, storage medium and electronic device Download PDF

Info

Publication number
CN117459482B
CN117459482B CN202311803158.8A CN202311803158A CN117459482B CN 117459482 B CN117459482 B CN 117459482B CN 202311803158 A CN202311803158 A CN 202311803158A CN 117459482 B CN117459482 B CN 117459482B
Authority
CN
China
Prior art keywords
switch
target
target switch
port
link
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311803158.8A
Other languages
Chinese (zh)
Other versions
CN117459482A (en
Inventor
王文志
陈翔
郭巍松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Metabrain Intelligent Technology Co Ltd
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 Suzhou Metabrain Intelligent Technology Co Ltd filed Critical Suzhou Metabrain Intelligent Technology Co Ltd
Priority to CN202311803158.8A priority Critical patent/CN117459482B/en
Publication of CN117459482A publication Critical patent/CN117459482A/en
Application granted granted Critical
Publication of CN117459482B publication Critical patent/CN117459482B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/55Prevention, detection or correction of errors
    • H04L49/557Error correction, e.g. fault recovery or fault tolerance
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/65Re-configuration of fast packet switches

Abstract

The application discloses a restarting method and device of a switch, a storage medium and an electronic device, wherein the restarting method of the switch comprises the following steps: detecting a restarting operation triggered on the target switch; switching the operation state of the target switch from the current operation state to the target port state in response to the restarting operation; stopping the target switch to realize the port function of the message transmission port of the single switch in the target switch group under the condition that the target switch is restarted and is to be added to the target switch group where the target switch is located; according to the link configuration progress of the target switch added to the target switch unit, the target switch is controlled to realize the operation of the message transmission port of the single switch in the target switch unit.

Description

Restarting method and device of switch, storage medium and electronic device
Technical Field
The embodiment of the application relates to the field of computers, in particular to a restarting method and device of a switch, a storage medium and an electronic device.
Background
MC-LAG (MultiChassis Link Aggregation Group, cross-device link aggregation group) is a network technology for connecting multiple switches into one logically single switch, thereby improving reliability, fault tolerance, and scalability of the network. In the MC-LAG scheme, the main switch and the standby switch are independent and respectively forward, and protocol synchronization is carried out through links so as to achieve the purpose of logic unification. When the link is normal and the MC-LAG two devices work normally, the current protocol can realize information synchronization and double-end forwarding.
Currently, when the MC-LAG scheme is used for traffic transmission, if the main switch restarts to disconnect the link, the information synchronization between the main switch and the standby switch must be out of step, so in the process of restarting the main switch, at the moment when the physical port of the main switch is closed, and at the moment when the negotiation of the LACP (Link Aggregation Control Protocol ) is completed after the main switch restarts, abnormal packet loss must occur in traffic transmission. According to the current problem carding and the verification of the actual environment, the main switch in the MC-LAG environment can be restarted, and the reason for packet loss and the time node are mainly two parts: when the main switch is restarted to be shut down, all physical ports on the main switch are required to be shut down, however, because the closing modes of a plurality of physical ports on the main switch are sequentially closed, network equipment in a flow transmission network may misunderstand that the physical ports with the back closing order are not closed currently in the closing process, and send message data to the physical ports, however, actually, the plurality of physical ports which are sequentially closed are not closed yet to the physical ports, at this time, the sent message data may not be closed yet to the physical ports, but the physical ports are closed first, and the condition leads to the loss of the message data which is originally transmitted. After the restart of the part 2 and the main exchanger is completed, the software system application is restarted, and each dock (open source application container engine) and the process responsible for port configuration are started in sequence to complete the configuration and initialization of the ports. When the ICCP (Inter-Chassis Communication Protocol ) module process starts, the main switch will re-negotiate the LACP protocol with the standby switch and establish a connection. Because the LACP negotiation stage is earlier, the traffic forwarding of the MC-LAG member interface of the main switch can be performed after the LACP negotiation is completed, however, the port configuration of the MC-LAG is likely to not be completed after the LACP negotiation is completed, and packet loss can occur if traffic forwarding is performed.
Aiming at the problems of high loss rate of message data and the like in the restarting process of the switch in the related technology, no effective solution is proposed yet
Disclosure of Invention
The embodiment of the application provides a restarting method and device of a switch, a storage medium and an electronic device, which are used for at least solving the problems of high loss rate of message data and the like in the restarting process of the switch in the related technology.
According to an embodiment of the present application, there is provided a restarting method of a switch, including:
detecting a restart operation triggered on a target switch, wherein a flow transmission network comprises a plurality of switch groups, the switches in the same switch group are logically embodied as a single switch in the flow transmission network, each switch group comprises a plurality of switches, and each switch comprises the target switch;
switching the operation state of the target switch from the current operation state to a target port state in response to the restart operation, wherein the target port state is used for indicating that network equipment in the traffic transmission network is not allowed to send message data to the target switch, and the target switch in the target port state is allowed to complete the restart operation;
Stopping the target switch from realizing the port function of the message transmission port of the single switch in the target switch group under the condition that the target switch is restarted and is to be added to the target switch group where the target switch is located;
and controlling the target switch to realize the operation of the message transmission port of the single switch in the target switch unit according to the link configuration progress of the target switch added to the target switch unit, wherein the link configuration progress is used for indicating the link configuration stage completed in the process of adding the target switch to the target switch unit.
Optionally, the switching the operation state of the target switch from the current operation state to the target port state includes:
controlling the target switch to simultaneously close all data transmission ports on the target switch;
and under the condition that all the data transmission ports are closed, determining that the running state of the target switch is in the target port state.
Optionally, the controlling the target switch to simultaneously close all data transmission ports on the target switch includes:
Generating a first driving instruction, wherein the first driving instruction is used for indicating to simultaneously close all data transmission ports on the target switch;
and sending the first driving instruction to a first interactive interface deployed on a driving layer of the target switch, wherein the driving layer is used for responding to the first driving instruction transmitted on the first interactive interface to execute the operation of closing all data transmission ports on the target switch simultaneously.
Optionally, the generating the first driving instruction includes: searching a first identifier corresponding to the operation of simultaneously closing all data transmission ports on the target switch from the driving operation and identifiers with corresponding relations as the first driving instruction;
the sending the first driving instruction to the first interaction interface deployed on the driving layer of the target switch includes: and sending a first identifier to the first interactive interface, wherein the driving layer is used for executing the operation of closing all data transmission ports on the target switch at the same time under the condition that the first interactive interface is detected to receive the first identifier.
Optionally, the controlling the target switch to simultaneously close all data transmission ports on the target switch includes:
Generating a second driving instruction, wherein the second driving instruction is used for indicating the target switch to execute the restarting operation;
and sending the second driving instruction to a second interactive interface deployed on a driving layer of the target switch, wherein the driving layer is used for responding to the second driving instruction transmitted on the second interactive interface to execute the operation of closing all data transmission ports on the target switch simultaneously.
Optionally, the generating the second driving instruction includes: searching a second identifier corresponding to the restarting operation to be executed by the target switch from the driving operation and identifiers with the corresponding relation as the second driving instruction;
the sending the second driving instruction to the second interaction interface deployed on the driving layer of the target switch includes: and sending a second identifier to the second interactive interface, wherein the driving layer is used for executing the operation of closing all data transmission ports on the target switch at the same time under the condition that the second interactive interface is detected to receive the second identifier.
Optionally, the controlling the target switch to simultaneously close all data transmission ports on the target switch includes:
Invoking a restart file in response to the restart operation, wherein the restart file is used for recording a plurality of switch control actions of the target switch from detection of the restart operation to execution of the restart operation, the switch control actions are used for controlling the target switch to meet the condition of execution of the restart operation, and the switch control actions comprise a target restart action for controlling the target switch to simultaneously close all data transmission ports on the target switch;
and operating the restart file.
Optionally, the switching the operation state of the target switch from the current operation state to the target port state in response to the restart operation includes:
and responding to the restarting operation, detecting the switch type of each switch in the switch group, wherein the switch type comprises the following steps: a primary type and a backup type;
switching the operation state of the target switch from the current operation state to a target port state under the condition that the switch type of the target switch is the active type;
and executing the restarting operation directly on the target switch under the condition that the switch type of the target switch is the standby type.
Optionally, the controlling, according to the link configuration progress of the target switch joining to the target switch unit, the operation of the target switch to implement the message transmission port of the single switch in the target switch unit includes:
detecting the link configuration progress of the target exchanger added to the target exchanger group;
and under the condition that the link configuration progress is used for indicating the target switch to complete the configuration stage of the port function in the process of joining the target switch to the target switch group, restoring the port function of the message transmission port of the target switch for realizing the single switch in the target switch group.
Optionally, the detecting the link configuration progress of the target switch joining to the target switch group includes:
determining a configuration phase of the port function as a target configuration phase;
and detecting whether the link configuration progress reaches the target configuration stage.
Optionally, the determining the configuration phase of the port function as the target configuration phase includes: determining that the creation state of the message transmission port of the single switch is the creation completion state as the target configuration stage;
The detecting whether the link configuration progress reaches the target configuration stage, includes: and detecting whether the state identifier of the created state is a target state identifier corresponding to the created state.
Optionally, the detecting whether the link configuration progress reaches the target configuration stage, includes:
after stopping the target exchanger to realize the port function of the message transmission port of the single exchanger in the target exchanger group, starting timing;
and detecting whether the link configuration progress reaches the target configuration stage or not in the timing process and under the condition that the timing does not exceed the target time threshold.
Optionally, after the starting timing, the method further includes:
stopping detecting whether the link configuration progress reaches the target configuration stage when the timing exceeds the target time threshold;
and directly recovering the port function of the message transmission port of the single switch, which is realized by the target switch in the target switch group.
Optionally, before the starting timing, the method further includes:
determining the execution time of the link configuration progress reaching the configuration stage for completing the port function;
And determining the target time threshold according to the execution time, wherein the target time threshold is the time when the target switch can complete the configuration stage of the port function and the target switch can keep normal function.
Optionally, the detecting the link configuration progress of the target switch joining to the target switch group includes:
timing the stop time of the target switch for realizing the port function of the message transmission port of the single switch in the target switch group;
and under the condition that the stop time reaches a target duration, determining the link configuration progress for indicating that the target switch completes the configuration stage of the port function in the process of joining the target switch to the target switch group.
Optionally, the recovering the port function of the message transmission port of the single switch in the target switch unit by the target switch includes:
and converting the port running state of the message transmission port of the single switch, which is realized by the target switch in the target switch group, from a closing state to a starting state.
Optionally, the stopping the target switch from implementing, in the target switch group, a port function of a packet transmission port of the single switch includes:
after each link is established on the target switch, detecting the link attribute of the link;
and stopping the port function of the port of the link under the condition that the link attribute is used for indicating that the port of the link is the message transmission port of the single switch in the target switch group.
Optionally, after each link is established on the target switch, detecting a link attribute of the link includes: running a port establishment process on the target switch, wherein the port establishment process is used for re-adding the target switch to a target switch group where the target switch is located; after the port establishment process establishes each link on the target switch, detecting the link attribute of the link through the port establishment process;
and stopping the port function of the port of the link under the condition that the link attribute is used for indicating that the port of the link is the message transmission port for realizing the single switch in the target switch group, wherein the method comprises the following steps: and stopping the port function of the port of the link through the port establishment process under the condition that the port establishment process detects that the link attribute is used for indicating the port of the link to be the message transmission port for realizing the single switch in the target switch unit.
Optionally, the detecting a restart operation triggered on the target switch includes:
detecting a switch type to which each switch in the switch group belongs, wherein the switch type comprises: a primary type and a backup type;
determining the switch with the switch type belonging to the switch group as the active type as the target switch;
and detecting the restarting operation triggered on the target switch.
According to another embodiment of the present application, there is also provided a restarting device of a switch, including:
the system comprises a detection module, a control module and a control module, wherein the detection module is used for detecting a restarting operation triggered on a target switch, wherein a flow transmission network comprises a plurality of switch groups, the switches in the same switch group are logically embodied as a single switch in the flow transmission network, each switch group comprises a plurality of switches, and the plurality of switches comprise the target switch;
a switching module, configured to switch an operation state of the target switch from a current operation state to a target port state in response to the restart operation, where the target port state is configured to indicate that a network device in the traffic transport network is not allowed to send packet data to the target switch, and the target switch in the target port state is allowed to complete the restart operation;
The first stopping module is used for stopping the target switch from realizing the port function of the message transmission port of the single switch in the target switch group under the condition that the target switch is restarted and is to be added to the target switch group where the target switch is located;
and the control module is used for controlling the target switch to realize the operation of the message transmission port of the single switch in the target switch unit according to the link configuration progress of the target switch added to the target switch unit, wherein the link configuration progress is used for indicating the completed link configuration stage in the process of adding the target switch to the target switch unit.
According to a further embodiment of the present application, there is also provided a computer readable storage medium having stored therein a computer program, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
According to a further embodiment of the present application, there is also provided an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
In the embodiment of the present application, when a restart operation triggered on a target switch is detected, the restart operation of the target switch is not directly completed, but the operation state of the target switch is firstly switched from the current operation state to a target port state, where the target port state is used to indicate that a network device in a traffic transmission network is not allowed to send message data to the target switch, and the target switch in the target port state is allowed to complete the restart operation, so that it can be avoided that the sent message data caused by a mode that a plurality of physical ports on a main switch are successively closed in the related art may not reach the physical port, but the situation that the physical port is first closed occurs, so that message data loss is avoided, and in addition, under the condition that the target switch has completed restarting and is to be added to a target switch group where the target switch is located, the target switch is stopped to implement the port function of the message transmission port of a single switch in the target switch group; according to the link configuration progress of the target switch added to the target switch unit, the target switch is controlled to realize the operation of the message transmission port of the single switch in the target switch unit, wherein the link configuration progress is used for indicating the completed link configuration stage in the process of adding the target switch to the target switch unit, the target switch can be prevented from realizing the port function of the message transmission port of the single switch in the target switch unit in advance, so that the link configuration progress of the target switch unit does not meet the requirement of transmitting message data, and the message data is directly transmitted through the message transmission port to cause the loss of the message data. By adopting the technical scheme, the problems of higher loss rate of the message data in the restarting process of the switch and the like in the related technology are solved, and the technical effect of reducing the loss rate of the message data in the restarting process of the switch is realized.
Drawings
Fig. 1 is a hardware block diagram of a computer device of a restarting method of a switch according to an embodiment of the present application;
fig. 2 is a flowchart of a method of restarting a switch according to an embodiment of the present application;
fig. 3 is a schematic diagram of an MC-LAG traffic transmission network according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an MC-LAG member interface control mechanism according to an embodiment of the present application;
fig. 5 is a schematic diagram of a MC-LAG member interface control flow according to an embodiment of the present application;
fig. 6 is a block diagram of a restarting device of a switch according to an embodiment of the present application.
Detailed Description
Embodiments of the present application will be described in detail below with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the embodiments of the present application may be performed in a server device or similar computing device. Taking the example of running on a server device, fig. 1 is a block diagram of a hardware structure of a computer device of a restarting method of a switch according to an embodiment of the present application. As shown in fig. 1, the server device may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU, a programmable logic device FPGA, or the like processing means) and a memory 104 for storing data, wherein the server device may further include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those of ordinary skill in the art that the architecture shown in fig. 1 is merely illustrative and is not intended to limit the architecture of the server apparatus described above. For example, the server device may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a restarting method of a switch in the embodiment of the present application, and the processor 102 executes the computer program stored in the memory 104, thereby performing various functional applications and data processing, that is, implementing the method described above. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located with respect to the processor 102, which may be connected to the server device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of a server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
Nouns involved in the embodiments of the present application are explained as follows:
sonoc: software for Open Networking in the Cloud open source project in open cloud network field
OCP Open Compute Project open computing items
MC-LAG (MultiChassis Link Aggregation Group, cross-device Link aggregation group), a cross-device Link aggregation mechanism, is a technology based on a logical switch composed of multiple physical switches, and by aggregating multiple switches together to provide a function similar to a single multi-port logical connection, MC-LAG solves the problems of low utilization of redundant links and easy single point failure in a traditional STP (Spanning Tree Protocol ) network. The MC-LAG is regarded as a single logic processing unit by taking two physical switches as the single logic processing unit, can improve the reliability and fault tolerance of a network, improve the utilization rate of a link, unify a control plane and the like, and has advantages in various aspects, wherein in the aspects of improving the reliability and fault tolerance of the network, when one switch fails, the MC-LAG can automatically switch the flow to the other switch, thereby realizing quick recovery and reducing the network interruption time; in the aspect of improving the link utilization rate, the MC-LAG can simultaneously use a plurality of switches to provide service, single-point faults are avoided, so that the link utilization rate and the reliability of the whole network are improved, in the aspect of a unified control plane, the MC-LAG can regard two switches as a logic unit, and the two switches work cooperatively through the unified control plane, so that the management cost and the maintenance cost are reduced.
Packet loss: the term in network technology refers to the inability of data of one or more packets (packets) to reach a destination over the network.
In this embodiment, a method for restarting a switch is provided, and fig. 2 is a flowchart of a method for restarting a switch according to an embodiment of the present application, as shown in fig. 2, where the flowchart includes the following steps:
step S12, detecting a restarting operation triggered on a target switch, wherein a flow transmission network comprises a plurality of switch groups, the switches in the same switch group are logically embodied as a single switch in the flow transmission network, each switch group comprises a plurality of switches, and the plurality of switches comprise the target switch;
alternatively, in this embodiment, the traffic transmission network may be, but is not limited to, a network to which MC-LAG technology is applied, and fig. 3 is a schematic diagram of an MC-LAG traffic transmission network according to an embodiment of the present application, as shown in fig. 3, in the traffic transmission network to which MC-LAG is applied, where in a physical topology layer, the MC-LAG traffic transmission network includes two switch devices (device a and device B), where device a is a master switch, device B is a slave switch, and the master and slave devices are connected to one network device a downward, where information synchronization between device a and device B mainly depends on a link between the master and slave switches, including a pearlink link and a keep alive link, where when the device operates normally and the MC-LAG environment is successfully built, control information synchronization and traffic information transmission are performed through the link, and during this period mainly depends on a LACP protocol to perform state synchronization, and two lines connected to a downstream host can be regarded as an aggregate link through link aggregation, where two switches (device a and device B are equivalent to a logical device C) of the MC-LAG are seen as a logical topology device C. In this way, the requirements of providing redundancy backup, preventing disconnection, expanding bandwidth and the like are met.
In the MC-LAG traffic transmission network, a fault condition may occur in one of the two MC-LAG devices, and at this time, the faulty switch needs to be turned off and restarted. If the failed switch is a standby switch, the restarting effect is smaller, because the primary switch can maintain the original MAC table entry and continue forwarding; however, when the main switch is restarted, the MAC entries of the standby switch are obtained synchronously from the main switch, so that the restarting of the main switch may cause the change of the MAC entries in the standby switch, which directly causes the phenomenon that packet loss occurs in the forwarding of the traffic. Modern networks have fast transmission speed and high bandwidth, and once packet loss occurs, more serious network accidents occur.
Step S14, responding to the restarting operation, switching the operation state of the target switch from the current operation state to a target port state, wherein the target port state is used for indicating that network equipment in the traffic transmission network is not allowed to send message data to the target switch, and the target switch in the target port state is allowed to finish the restarting operation;
optionally, in this embodiment, the network device in the traffic transmission network identifies an operation state of the target switch, and if it is identified that the operation state of the target switch is a target port state, no message data is sent to the target switch;
Optionally, in this embodiment, the current operation state may be a non-target port state, and the network device in the traffic transmission network may send the message data to the target switch when identifying that the operation state of the target switch is the non-target port state
Step S16, stopping the target switch to realize the port function of the message transmission port of the single switch in the target switch group under the condition that the target switch is restarted and is to be added to the target switch group where the target switch is located;
optionally, in this embodiment, if the target switch implements a port function of a packet transmission port of the single switch in the target switch group, it indicates that the target switch forms a logically single switch with other switches in the target switch group.
Optionally, in this embodiment, after the restart of the main switch is completed in the above section 2, the software system application is restarted, and each dock (open source application container engine) and the process responsible for port configuration are sequentially started to complete the configuration and initialization of the ports. When the ICCP (Inter-Chassis Communication Protocol ) module process starts, the master switch will re-conduct LACP negotiation with the standby switch and establish a connection. In the related art, as the LACP negotiation stage is earlier, the flow forwarding of the MC-LAG member interface of the main switch is performed after the LACP negotiation is completed, however, the port configuration of the MC-LAG is likely to not be completed after the LACP negotiation is completed, and packet loss also occurs if the flow forwarding is performed at this time.
And S18, controlling the target switch to realize the operation of the message transmission port of the single switch in the target switch group according to the link configuration progress of the target switch added to the target switch group, wherein the link configuration progress is used for indicating the completed link configuration stage in the process of adding the target switch to the target switch group.
Optionally, in this embodiment, the foregoing mention that, in this application, by stopping the manner that the target switch implements the port function of the packet transmission port of the single switch in the target switch unit, LACP negotiation is avoided in advance, further, the operation of the target switch implementing the packet transmission port of the single switch in the target switch unit may be controlled according to the link configuration progress of the target switch joining to the target switch unit, and whether the target switch may implement the packet transmission port of the single switch in the target switch unit may be determined according to the link configuration progress of the current target switch joining to the target switch unit.
When the restarting operation triggered on the target switch is detected, the restarting operation of the target switch is not directly completed, but the operation state of the target switch is firstly switched from the current operation state to the target port state, wherein the target port state is used for indicating that network equipment in a traffic transmission network is not allowed to send message data to the target switch, the target switch in the target port state is allowed to complete the restarting operation, in this way, the condition that the sent message data possibly does not reach a physical port caused by a mode that a plurality of physical ports are successively closed on a main switch in the related art, but the physical port is closed first is avoided, so that the message data is prevented from being lost, and in addition, under the condition that the target switch is restarted and the target switch group where the target switch is to be newly added, the port function of the message transmission port of a single switch is realized in the target switch group by the target switch is stopped; according to the link configuration progress of the target switch added to the target switch unit, the target switch is controlled to realize the operation of the message transmission port of the single switch in the target switch unit, wherein the link configuration progress is used for indicating the completed link configuration stage in the process of adding the target switch to the target switch unit, the target switch can be prevented from realizing the port function of the message transmission port of the single switch in the target switch unit in advance, so that the link configuration progress of the target switch unit does not meet the requirement of transmitting message data, and the message data is directly transmitted through the message transmission port to cause the loss of the message data. By adopting the technical scheme, the problems of higher loss rate of the message data in the restarting process of the switch and the like in the related technology are solved, and the technical effect of reducing the loss rate of the message data in the restarting process of the switch is realized.
As an optional solution, the switching the operation state of the target switch from the current operation state to the target port state further includes:
s21, controlling the target switch to simultaneously close all data transmission ports on the target switch;
s22, under the condition that all the data transmission ports are closed, the running state of the target switch is determined to be in the target port state.
Optionally, in this embodiment, when the main switch is restarted and turned off, the physical ports on the main switch are all required to be turned off, however, because the turning-off modes of the physical ports on the main switch are sequentially turned off, in this turning-off process, the network device in the traffic transmission network may misunderstand that the physical ports with the back turning-off sequence are not turned off at present, and send the message data to the physical ports, however, actually, the physical ports that are turned off sequentially are not turned off yet, at this time, the sent message data may not be turned off yet, but the physical ports are turned off first, which is different from the case that the physical ports that are turned off sequentially in the related art are turned off, and this application controls the target switch to turn off all the data transmission ports on the target switch at the same time, and determines the running state that all the data transmission ports are turned off as the target port state.
As an alternative, the controlling the target switch to simultaneously close all data transmission ports on the target switch further includes:
s31, generating a first driving instruction, wherein the first driving instruction is used for indicating to simultaneously close all data transmission ports on the target switch;
s32, sending the first driving instruction to a first interactive interface deployed on a driving layer of the target switch, wherein the driving layer is used for responding to the first driving instruction transmitted on the first interactive interface to execute the operation of closing all data transmission ports on the target switch at the same time.
Optionally, in this embodiment, the closing of the physical port (corresponding to the data transmission port) of the target switch is mainly performed by the driving layer, and the closing of the physical port is performed by directly operating the register of the underlying hardware layer or directly operating the electrical layer through the driving layer. According to the method, the logic of the bottom layer is optimized firstly by the driving layer, and when the driving layer receives a reboot instruction (restarting instruction), all physical ports are closed simultaneously.
When the user issues a reboot instruction, the driver layer is informed that the driver layer is ready to execute a restarting operation at the moment, and the driver layer needs to close all physical ports at the same time. To ensure that the drive interaction is automatically completed. And the drive layer transmits an interactive interface, the upper layer program writes a 1 action to the interactive interface, and after receiving the drive instruction 1, the drive layer executes the operation of synchronously closing all physical ports. Meanwhile, in order to enable the process to be perfectly matched with the restarting process, the 1 action is written, the reboot file in the/usr/local/bin is directly loaded, the reboot file is an execution script of a reboot instruction, and corresponding process closing and exiting operations are executed by the execution script before shutdown, so that restarting is prepared.
As an alternative, the generating the first driving instruction includes: s41, searching a first identifier corresponding to the operation of simultaneously closing all data transmission ports on the target switch from the driving operation and identifiers with corresponding relations as the first driving instruction;
the sending the first driving instruction to the first interaction interface deployed on the driving layer of the target switch includes: and S42, sending a first identification to the first interactive interface, wherein the driving layer is used for executing the operation of closing all data transmission ports on the target switch simultaneously under the condition that the first interactive interface is detected to receive the first identification.
Alternatively, in this embodiment, the first identifier may be, but is not limited to be "1" above, and the first interaction interface may be, but is not limited to, an interaction interface that is transparent to the driving layer above.
As an alternative, the controlling the target switch to simultaneously close all data transmission ports on the target switch further includes:
s51, generating a second driving instruction, wherein the second driving instruction is used for indicating the target switch to execute the restarting operation;
And S52, sending the second driving instruction to a second interactive interface deployed on a driving layer of the target switch, wherein the driving layer is used for responding to the second driving instruction transmitted on the second interactive interface to execute the operation of closing all data transmission ports on the target switch at the same time.
Optionally, in this embodiment, S51 to S52 are different from S31 to S32 in that the first driving instruction is directly used to instruct to simultaneously close all data transmission ports on the target switch, while the second driving instruction is not directly used to instruct the target switch to simultaneously close all data transmission ports, but informs the driving layer that the current target switch is to perform the restart operation, and after the driving layer knows that the current target switch is to perform the restart operation, in order to cooperate with the target switch to perform the restart operation, the second driving instruction transmitted on the second interaction interface is responded to perform the operation of simultaneously closing all data transmission ports on the target switch.
As an alternative, the generating the second driving instruction further includes: s61, searching a second identifier corresponding to the restarting operation to be executed by the target switch from the driving operation and identifiers with the corresponding relation as the second driving instruction;
The sending the second driving instruction to the second interaction interface deployed on the driving layer of the target switch includes: and S62, sending a second identifier to the second interactive interface, wherein the driving layer is used for executing the operation of closing all data transmission ports on the target switch simultaneously under the condition that the second interactive interface is detected to receive the second identifier.
Alternatively, in the present embodiment, the implementation logic of S61 to S62 is similar to that of S41 to S42, and will not be described here.
As an alternative, the controlling the target switch to simultaneously close all data transmission ports on the target switch further includes:
s71, responding to the restarting operation, calling a restarting file, wherein the restarting file is used for recording a plurality of switch control actions of the target switch from the detection of the restarting operation to the execution of the restarting operation, the switch control actions are used for controlling the target switch to meet the condition of executing the restarting operation, and the switch control actions comprise target restarting actions for controlling the target switch to simultaneously close all data transmission ports on the target switch;
S72, running the restart file.
Optionally, in this embodiment, the restart file corresponds to the reboot file, where the reboot file records multiple switch control actions between the detection of the restart operation and the execution of the restart operation of the target switch, executes corresponding process closing and exiting operations, prepares for the restart, uses a first switch control action in the multiple switch control actions as the detection of the restart operation, and uses a last switch control action as the execution of the restart operation, where before the last switch control action, the method further includes a target restart action, where a target restart action acts to control the target switch to simultaneously close all data transmission ports on the target switch.
As an alternative, the switching the operation state of the target switch from the current operation state to the target port state in response to the restart operation further includes:
s81, responding to the restarting operation, detecting the switch type of each switch in the switch group, wherein the switch type comprises: a primary type and a backup type;
s82, when the switch type of the target switch is the main type, switching the running state of the target switch from the current running state to a target port state;
S83, executing the restarting operation directly on the target switch under the condition that the switch type of the target switch is the standby type.
Optionally, in this embodiment, in the MC-LAG traffic transmission network, a fault condition may be encountered in one of the two MC-LAG devices, and at this time, the failed switch needs to be turned off and restarted. If the failed switch is a standby switch, the restarting effect is smaller, because the primary switch can maintain the original MAC table entry and continue forwarding; however, when the main switch is restarted, the MAC entries of the standby switch are obtained synchronously from the main switch, so that the restarting of the main switch may cause the change of the MAC entries in the standby switch, which directly causes the phenomenon that packet loss occurs in the forwarding of the traffic. Modern networks have fast transmission speed and high bandwidth, and once packet loss occurs, more serious network accidents occur. Therefore, in response to the restart operation, in the process of switching the operation state of the target switch from the current operation state to the target port state, the switch type to which each switch in the switch group belongs is detected first, and in the case where the switch type to which the target switch belongs is the active type (i.e., the target switch is the primary switch), the operation state of the target switch is switched from the current operation state to the target port state, and in the case where the switch type to which the target switch belongs is the standby type (i.e., the target switch is the standby switch), since the restart effect is small when the above-mentioned failed switch is the standby switch, the restart operation can be performed directly on the target switch.
As an optional solution, the controlling, according to the link configuration progress of the target switch joining to the target switch unit, the operation of the target switch to implement the message transmission port of the single switch in the target switch unit further includes:
s91, detecting the link configuration progress of the target exchanger added to the target exchanger group;
s92, recovering the target switch to realize the port function of the message transmission port of the single switch in the target switch group under the condition that the link configuration progress is used for indicating that the target switch completes the configuration stage of the port function in the process of joining the target switch to the target switch group.
Optionally, in this embodiment, after the restart of the main switch is completed in the above section 2, the software system applications are restarted, and each dock (open source application container engine) and the process responsible for port configuration are sequentially started to complete the configuration and initialization of the ports. When the ICCP (Inter-Chassis Communication Protocol ) module process starts, the main switch will re-negotiate the LACP protocol with the standby switch and establish a connection. Because the LACP negotiation stage is earlier, the traffic forwarding of the MC-LAG member interface of the main switch can be performed after the LACP negotiation is completed, however, the port configuration of the MC-LAG is likely to not be completed after the LACP negotiation is completed, and packet loss can occur if traffic forwarding is performed. In the method, LACP negotiation is avoided in advance by stopping the target switch to realize the port function of the message transmission port of the single switch in the target switch unit, so that the condition that the link configuration progress of the target switch unit does not reach the requirement of transmitting message data yet, the message data is transmitted directly through the message transmission port, and the message data is lost is caused.
In order to ensure that after the main switch in the MC-LAG is restarted, renegotiation is carried out with the standby switch, and packet loss caused by out-of-step occurs, the following scheme is adopted for avoiding:
1. after restarting the main switch of the MC-LAG, adding a function code to the teammrd process, fig. 4 is a schematic diagram of an MC-LAG member interface control mechanism according to an embodiment of the present application, as shown in fig. 4, when a team link of the main switch is established, determining a link attribute of the team link by using an MC-LAG member interface and an aggregate link with a corresponding relationship recorded in a configDB (configuration database), and if the link attribute indicates that a port of the team link is an MC-LAG member interface, directly turning off the MC-LAG member interface shutdown, and stopping a port function of a port of the team link. the main purpose of the teammrd process is to perform creation and initialization of a team link group according to configuration information in a user configuration and configDB (configuration database), including creation and initialization of portchannels corresponding to MC-LAG member interfaces, where the MC-LAG member interfaces correspond to link aggregation groups portchannels, each PortChannel corresponds to a team link group, and creation of a team link is completed in the teammgr process.
2. The main purpose of dropping the MC-LAG member interface section is to avoid LACP negotiation in advance by a team link corresponding to the MC-LAG member interface section, and packet loss caused by the situation in the part 2 is caused, but the time of dropping the MC-LAG member interface section cannot last too long, otherwise the normal function of the target switch is affected. Setting the longest time for the MC-LAG member interface to fall can reach 300s, starting timing from the fall of the MC-LAG member interface to finish the fall of the section after the MC-LAG is in a creating finish state, if the MC-LAG is not in the creating finish, but the time for the fall of the MC-LAG member interface to fall can reach 300s, and teammrd can judge overtime, namely finishing all processes, finishing the fall of the section to the MC-LAG member interface, and turning on all MC-LAG member interface states.
3. The MC-LAG member interfaces are cut off, which means that the MC-LAG member interfaces do not carry out LACP protocol negotiation or do not succeed, so that negotiation is unsuccessful in MC-LAG control logic, at this time, all MC-LAG member interfaces of the main switch do not forward traffic (message data), and at this time, the traffic is still forwarded by the standby switch.
4. The MC-LAG member interface of the main switch is cut off, traffic forwarding is not performed, but other links of the main switch are still started normally, and particularly links where the peerlink link and the keepalive link are located still work normally. After the ICCP module of the main switch is normally started, the main switch and the standby switch normally negotiate through a peerlink link, prepare to build an MC-LAG environment, wait for the completion of the MC-LAG environment building, and write a target STATE identifier corresponding to the MC-LAG building STATE being the building completion STATE into a STATE_DB (STATE database) in host equipment. Meanwhile, a newly added function code in the teammrd process carries out overtime judgment and MC-LAG state identification judgment, if the MC-LAG state identification is a target state identification or the period of time that the MC-LAG member interface is dropped by the chut is more than 300s, all logic mechanisms of the function are exited, and the states of all MC-LAG member interfaces are up.
5. Through the mode, the purpose of avoiding packet loss can be achieved. However, a special case needs to be considered, and if someone modifies part of the configuration of the MC-LAG member interface, such as adding or deleting part of the MC-LAG member interface, in the first 300s after the restart of the main switch, the control logic needs to be ensured to be met for the newly added and changed MC-LAG member interface. In order to meet the requirements, a task process is newly added in the teammrd process and is mainly responsible for monitoring the result of user operation, the task process is mainly responsible for monitoring the list item of the MC-LAG member interface, if the newly added MC-LAG member interface exists in the waiting 300S, the state of the MC-LAG member interface is needed to be shed, the MC-LAG member interface is waited for being identified as a target state identification, or the MCLAC member interface is restarted after the link closing time reaches the target time (300S); otherwise, if someone removes the original MC-LAG member interface within 300s, because the teammrd process has already removed the MC-LAG member interface section from the beginning, after removal, the section of processing logic is not needed to be executed any more, and the MC-LAG member interface is directly up. The task mechanism is only validated and executed within 300 seconds of waiting, and after timeout, the logic code automatically ends and is not executed any more.
As an optional solution, the detecting the link configuration progress of the target switch joining to the target switch unit further includes:
s101, determining a configuration stage of the port function as a target configuration stage;
s102, detecting whether the link configuration progress reaches the target configuration stage.
Optionally, in this embodiment, a specific manner of detecting the link configuration progress of the target switch joining the target switch group is to detect whether the link configuration progress reaches the target configuration stage, and if the link configuration progress reaches the target configuration stage, it indicates that the target switch may implement, in the target switch group, a port function of a message transmission port of the single switch.
As an alternative, the determining the configuration phase of the port function as the target configuration phase further includes: s111, determining that the creation state of the message transmission port of the single switch is the creation completion state as the target configuration stage;
the detecting whether the link configuration progress reaches the target configuration stage, includes: s112, detecting whether the state identifier of the created state is a target state identifier corresponding to the created state.
Optionally, in this embodiment, the creation state of the message transmission port of the single switch may be, but not limited to, the above-mentioned MC-LAG state, and if the link configuration progress reaches the target configuration stage, the MC-LAG state is the created state.
Optionally, in this embodiment, in case that the MC-LAG state is a created state, the state identifier of the created state is a target state identifier corresponding to the created state.
As an alternative, the detecting whether the link configuration progress reaches the target configuration stage, further includes:
s121, after stopping the target exchanger to realize the port function of the message transmission port of the single exchanger in the target exchanger group, starting timing;
s122, detecting whether the link configuration progress reaches the target configuration stage or not in the timing process and under the condition that the timing does not exceed the target time threshold.
Optionally, in this embodiment, stopping the target switch from implementing the port function of the packet transmission port of the single switch in the target switch group is equivalent to dropping the MC-LAG member interface glut, and the target time threshold may be 300S.
As an alternative, after the starting timing, the method further includes:
s131, stopping detecting whether the link configuration progress reaches the target configuration stage or not under the condition that the timing exceeds the target time threshold;
s132, directly recovering the port function of the message transmission port of the single switch, which is realized in the target switch group, of the target switch.
Optionally, in this embodiment, under the condition that the timing exceeds the target time threshold, the teammrd process may determine that the time is out, that is, end all flows, end the glut to drop the MC-LAG member interface, up (open) all the states of the MC-LAG member interface, and directly restore the port function of the target switch to implement the message transmission port of the single switch in the target switch group.
As an alternative, before the starting timing, the method further includes:
s141, determining the execution time of the link configuration progress reaching the configuration stage for completing the port function;
s142, determining the target time threshold according to the execution time, wherein the target time threshold is the time when the target switch can complete the configuration stage of the port function and the target switch can keep normal functions.
Optionally, in this embodiment, the target time threshold is determined according to execution time of the link configuration progress reaching the configuration stage for completing the port function, where the target time threshold needs to be greater than time of the target switch capable of completing the configuration stage for the port function and less than time of the target switch capable of keeping normal functions, so as to avoid abnormal functions of the target switch caused by overlong time of the MC-LAG member interface shutdown.
As an optional solution, the detecting the link configuration progress of the target switch joining to the target switch unit further includes:
s151, timing the stop time of the target exchanger for realizing the port function of the message transmission port of the single exchanger in the target exchanger group;
and S152, determining the link configuration progress to indicate that the target switch completes the configuration stage of the port function in the process of joining the target switch to the target switch group under the condition that the stop time reaches the target duration.
Optionally, in this embodiment, the link configuration progress is determined only according to a stop time, where the link configuration progress is determined to indicate that the target switch completes a configuration stage of the port function in a process of joining the target switch to the target switch group when the stop time reaches a target duration, and the link configuration progress is determined to indicate that the target switch does not complete a configuration stage of the port function in a process of joining the target switch to the target switch group when the stop time does not reach a target duration.
As an optional solution, the recovering the port function of the message transmission port of the single switch implemented by the target switch in the target switch group further includes:
s161, converting the port running state of the message transmission port of the single switch, which is realized by the target switch in the target switch group, from a closed state to an started state.
Optionally, in this embodiment, the message transmission port may be, but is not limited to, the above-mentioned MC-LAG member interface, and the port operation state of the message transmission port is converted from the off state to the on state, which refers to converting the MC-LAG member interface from the shutdown state to the up state.
As an optional solution, stopping the target switch from implementing, in the target switch group, a port function of a packet transmission port of the single switch, further includes:
s171, after each link is established on the target switch, detecting the link attribute of the link;
and S172, stopping the port function of the port of the link under the condition that the link attribute is used for indicating that the port of the link is the message transmission port for realizing the single switch in the target switch group.
Optionally, in this embodiment, the link attribute of the team link may be determined from the MC-LAG member interface and the aggregate link with the correspondence described in the configDB (configuration database), where the link attribute is used to indicate that the port of the link is a message transmission port for implementing the single switch in the target switch group, and if the port of the link is the MC-LAG member interface, the MC-LAG member interface is dropped to stop the port function of the port of the link.
As an alternative, after each link is established on the target switch, detecting a link attribute of the link, and further including: s181, running a port establishment process on the target switch, wherein the port establishment process is used for re-adding the target switch to a target switch group where the target switch is located; after the port establishment process establishes each link on the target switch, detecting the link attribute of the link through the port establishment process;
and stopping the port function of the port of the link under the condition that the link attribute is used for indicating that the port of the link is the message transmission port for realizing the single switch in the target switch group, wherein the method comprises the following steps: s182, when the port establishment process detects that the link attribute is used for indicating that the port of the link is the message transmission port for realizing the single switch in the target switch unit, stopping the port function of the port of the link through the port establishment process.
Alternatively, in this embodiment, the port establishment process corresponds to the teammrd process described above.
As an alternative, the detecting the restart operation triggered on the target switch further includes:
s191, detecting the switch type of each switch in the switch group, wherein the switch type comprises: a primary type and a backup type;
s192, determining the switch with the switch type belonging to the switch group as the active type as the target switch;
s193, detecting the restarting operation triggered on the target switch.
Optionally, in this embodiment, the switch type may be detected first, and when the switch type of the target switch is detected to be the active type, the restart operation triggered on the target switch may be detected.
Optionally, in this embodiment, in order to better understand the process of controlling the MC-LAG member interface, the method for controlling the MC-LAG member interface is described below with reference to an optional embodiment, but is not limited to the technical solution of the embodiment of the present application.
In this embodiment, a restarting method of a switch is provided, and fig. 5 is a schematic diagram of a MC-LAG member interface control flow according to an embodiment of the present application, as shown in fig. 5, mainly including the following steps:
Step S501: the MC-LAG main switch is restarted, and the Teammgrd process is executed;
step S502-1: judging whether the time is overtime, judging whether the MC-LAG state is the established state or whether the period of time that the MC-LAG member interface is dropped by the chut is more than 300s; when the MC-LAG state is the established state or the period of time that the MC-LAG member interface is shed is more than 300s, the MC-LAG member interface is turned on; writing the STATE of the MC-LAG member interface into a STATE_DB (State database);
step S502-2: a team link is established, and whether PortChannel corresponding to the team link is an mcrag member interface is judged according to a CONFIG_DB (configuration database); under the condition that PortChannel corresponding to a team link is an mctag member interface, the Sut (closing) MC-LAG member interface is marked with an initialization time stamp, and the step S502-1 is skipped to judge whether the MC-LAG state is the established state or not, or whether the period of time that the MC-LAG member interface is dropped by the Sut is more than 300S; if PortChannel corresponding to the team link is not an mcrag member interface, the MC-LAG member interface is turned on; writing the STATE of the MC-LAG member interface into a STATE_DB (State database);
step S502-3: by monitoring the State_DB, judging whether the MLAG member interface has a change, whether the MLAG member interface is newly added or deleted, if the MLAG member interface is newly added, the Sout (Shut down) MC-LAG member interface, if the MLAG member interface is deleted, the up (open) MC-LAG member interface, and writing the State of the MC-LAG member interface into the State_DB (State database).
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method described in the embodiments of the present application.
In this embodiment, a restarting device of the switch is further provided, and the restarting device is used to implement the foregoing embodiments and preferred embodiments, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
Fig. 6 is a block diagram of a restarting device of a switch according to an embodiment of the present application; as shown in fig. 6, includes:
a detection module 602, configured to detect a restart operation triggered on a target switch, where a traffic transmission network includes a plurality of switch groups, switches in the same switch group are logically embodied as a single switch in the traffic transmission network, each switch group includes a plurality of switches, and the plurality of switches includes the target switch;
a switching module 604, configured to switch, in response to the restart operation, an operation state of the target switch from a current operation state to a target port state, where the target port state is used to indicate that the network device in the traffic transmission network is not allowed to send packet data to the target switch, and the target switch in the target port state is allowed to complete the restart operation;
a first stopping module 606, configured to stop the target switch from implementing a port function of a message transmission port of the single switch in the target switch group when the target switch has completed restarting and is to be rejoined to the target switch group where the target switch is located;
And the control module 608 is configured to control the target switch to implement operation of the message transmission port of the single switch in the target switch group according to a link configuration progress of the target switch added to the target switch group, where the link configuration progress is used to indicate a link configuration stage completed in a process of adding the target switch to the target switch group.
In an exemplary embodiment, the switching module includes:
the control unit is used for controlling the target switch to simultaneously close all data transmission ports on the target switch;
and the first determining unit is used for determining that the running state of the target switch is in the target port state under the condition that all the data transmission ports are closed.
In an exemplary embodiment, the control unit is further configured to:
generating a first driving instruction, wherein the first driving instruction is used for indicating to simultaneously close all data transmission ports on the target switch;
and sending the first driving instruction to a first interactive interface deployed on a driving layer of the target switch, wherein the driving layer is used for responding to the first driving instruction transmitted on the first interactive interface to execute the operation of closing all data transmission ports on the target switch simultaneously.
In an exemplary embodiment, the control unit is further configured to: searching a first identifier corresponding to the operation of simultaneously closing all data transmission ports on the target switch from the driving operation and identifiers with corresponding relations as the first driving instruction;
the control unit is further configured to: and sending a first identifier to the first interactive interface, wherein the driving layer is used for executing the operation of closing all data transmission ports on the target switch at the same time under the condition that the first interactive interface is detected to receive the first identifier.
In an exemplary embodiment, the control unit is further configured to:
generating a second driving instruction, wherein the second driving instruction is used for indicating the target switch to execute the restarting operation;
and sending the second driving instruction to a second interactive interface deployed on a driving layer of the target switch, wherein the driving layer is used for responding to the second driving instruction transmitted on the second interactive interface to execute the operation of closing all data transmission ports on the target switch simultaneously.
In an exemplary embodiment, the control unit is further configured to: searching a second identifier corresponding to the restarting operation to be executed by the target switch from the driving operation and identifiers with the corresponding relation as the second driving instruction;
The control unit is further configured to: and sending a second identifier to the second interactive interface, wherein the driving layer is used for executing the operation of closing all data transmission ports on the target switch at the same time under the condition that the second interactive interface is detected to receive the second identifier.
In an exemplary embodiment, the control unit is configured to:
invoking a restart file in response to the restart operation, wherein the restart file is used for recording a plurality of switch control actions of the target switch from detection of the restart operation to execution of the restart operation, the switch control actions are used for controlling the target switch to meet the condition of execution of the restart operation, and the switch control actions comprise a target restart action for controlling the target switch to simultaneously close all data transmission ports on the target switch;
and operating the restart file.
In an exemplary embodiment, the switching module includes:
the first detection unit is configured to respond to the restart operation, and detect a switch type to which each switch in the switch group belongs, where the switch type includes: a primary type and a backup type;
A switching unit, configured to switch an operation state of the target switch from a current operation state to a target port state when a switch type to which the target switch belongs is the active type;
and the execution unit is used for directly executing the restarting operation on the target switch under the condition that the switch type of the target switch is the standby type.
In one exemplary embodiment, the control module includes:
the second detection unit is used for detecting the link configuration progress of the target exchanger added to the target exchanger group;
and the recovery unit is used for recovering the port function of the message transmission port of the single switch in the target switch group under the condition that the link configuration progress is used for indicating the target switch to complete the configuration stage of the port function in the process of joining the target switch to the target switch group.
In an exemplary embodiment, the second detection unit is configured to:
determining a configuration phase of the port function as a target configuration phase;
and detecting whether the link configuration progress reaches the target configuration stage.
In an exemplary embodiment, the second detection unit is configured to: determining that the creation state of the message transmission port of the single switch is the creation completion state as the target configuration stage;
the second detection unit is used for: and detecting whether the state identifier of the created state is a target state identifier corresponding to the created state.
In an exemplary embodiment, the second detection unit is configured to:
after stopping the target exchanger to realize the port function of the message transmission port of the single exchanger in the target exchanger group, starting timing;
and detecting whether the link configuration progress reaches the target configuration stage or not in the timing process and under the condition that the timing does not exceed the target time threshold.
In an exemplary embodiment, the apparatus further comprises:
the second stopping module is used for stopping detecting whether the link configuration progress reaches the target configuration stage or not under the condition that the timing exceeds the target time threshold after the timing is started;
and the recovery module is used for directly recovering the port function of the message transmission port of the single switch, which is realized in the target switch group, of the target switch.
In an exemplary embodiment, before the starting timing, the apparatus further includes:
a first determining module, configured to determine an execution time of the link configuration progress reaching a configuration stage for completing the port function;
and the second determining module is used for determining the target time threshold according to the execution time, wherein the target time threshold is the time when the target switch can complete the configuration stage of the port function and the target switch can keep normal function.
In an exemplary embodiment, the second detection unit is configured to:
timing the stop time of the target switch for realizing the port function of the message transmission port of the single switch in the target switch group;
and under the condition that the stop time reaches a target duration, determining the link configuration progress for indicating that the target switch completes the configuration stage of the port function in the process of joining the target switch to the target switch group.
In an exemplary embodiment, the recovery unit is configured to:
and converting the port running state of the message transmission port of the single switch, which is realized by the target switch in the target switch group, from a closing state to a starting state.
In one exemplary embodiment, the first stopping module includes:
a third detecting unit, configured to detect a link attribute of each link after each link is established on the target switch;
and the stopping unit is used for stopping the port function of the port of the link under the condition that the link attribute is used for indicating the port of the link to be the message transmission port for realizing the single switch in the target switch group.
In an exemplary embodiment, the third detection unit is configured to: running a port establishment process on the target switch, wherein the port establishment process is used for re-adding the target switch to a target switch group where the target switch is located; after the port establishment process establishes each link on the target switch, detecting the link attribute of the link through the port establishment process;
the stopping unit is used for: and stopping the port function of the port of the link through the port establishment process under the condition that the port establishment process detects that the link attribute is used for indicating the port of the link to be the message transmission port for realizing the single switch in the target switch unit.
In one exemplary embodiment, the detection module includes:
a fourth detection unit, configured to detect a switch type to which each switch in the switch group belongs, where the switch type includes: a primary type and a backup type;
a second determining unit, configured to determine, as the target switch, a switch of which the switch type belongs to the switch group is the active type;
and a fifth detection unit, configured to detect the restart operation triggered on the target switch.
It should be noted that each of the above modules may be implemented by software or hardware, and for the latter, it may be implemented by, but not limited to: the modules are all located in the same processor; alternatively, the above modules may be located in different processors in any combination.
Embodiments of the present application also provide a computer readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
In one exemplary embodiment, the computer readable storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Embodiments of the present application also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
In an exemplary embodiment, the electronic apparatus may further include a transmission device connected to the processor, and an input/output device connected to the processor.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the application described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present application is not limited to any specific combination of hardware and software.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the same, but rather, various modifications and variations may be made by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application should be included in the protection scope of the present application.

Claims (18)

1. A method for restarting a switch, comprising:
detecting a restart operation triggered on a target switch, wherein a flow transmission network comprises a plurality of switch groups, the switches in the same switch group are logically embodied as a single switch in the flow transmission network, each switch group comprises a plurality of switches, and each switch comprises the target switch;
switching the operation state of the target switch from the current operation state to a target port state in response to the restart operation, wherein the target port state is used for indicating that network equipment in the traffic transmission network is not allowed to send message data to the target switch, and the target switch in the target port state is allowed to complete the restart operation;
Stopping the target switch from realizing the port function of the message transmission port of the single switch in the target switch group under the condition that the target switch is restarted and is to be added to the target switch group where the target switch is located;
controlling the target switch to realize the operation of the message transmission port of the single switch in the target switch unit according to the link configuration progress of the target switch added to the target switch unit, wherein the link configuration progress is used for indicating the link configuration stage completed in the process of adding the target switch to the target switch unit;
the switching the operation state of the target switch from the current operation state to the target port state includes: controlling the target switch to simultaneously close all data transmission ports on the target switch; under the condition that all the data transmission ports are closed, determining that the running state of the target switch is in the target port state;
the controlling the target switch to implement the operation of the message transmission port of the single switch in the target switch unit according to the link configuration progress of the target switch added to the target switch unit includes: detecting the link configuration progress of the target exchanger added to the target exchanger group; restoring the port function of the message transmission port of the single switch realized in the target switch group by the target switch under the condition that the link configuration progress is used for indicating the target switch to complete the configuration stage of the port function in the process of joining the target switch to the target switch group;
The detecting the link configuration progress of the target switch added to the target switch unit includes: determining a configuration phase of the port function as a target configuration phase; detecting whether the link configuration progress reaches the target configuration stage;
wherein the determining the configuration phase of the port function as the target configuration phase includes: determining that the creation state of the message transmission port of the single switch is the creation completion state as the target configuration stage; the detecting whether the link configuration progress reaches the target configuration stage, includes: and detecting whether the state identifier of the created state is a target state identifier corresponding to the created state.
2. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the controlling the target switch to simultaneously close all data transmission ports on the target switch includes:
generating a first driving instruction, wherein the first driving instruction is used for indicating to simultaneously close all data transmission ports on the target switch;
and sending the first driving instruction to a first interactive interface deployed on a driving layer of the target switch, wherein the driving layer is used for responding to the first driving instruction transmitted on the first interactive interface to execute the operation of closing all data transmission ports on the target switch simultaneously.
3. The method of claim 2, wherein the step of determining the position of the substrate comprises,
the generating a first driving instruction includes: searching a first identifier corresponding to the operation of simultaneously closing all data transmission ports on the target switch from the driving operation and identifiers with corresponding relations as the first driving instruction;
the sending the first driving instruction to the first interaction interface deployed on the driving layer of the target switch includes: and sending a first identifier to the first interactive interface, wherein the driving layer is used for executing the operation of closing all data transmission ports on the target switch at the same time under the condition that the first interactive interface is detected to receive the first identifier.
4. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the controlling the target switch to simultaneously close all data transmission ports on the target switch includes:
generating a second driving instruction, wherein the second driving instruction is used for indicating the target switch to execute the restarting operation;
and sending the second driving instruction to a second interactive interface deployed on a driving layer of the target switch, wherein the driving layer is used for responding to the second driving instruction transmitted on the second interactive interface to execute the operation of closing all data transmission ports on the target switch simultaneously.
5. The method of claim 4, wherein the step of determining the position of the first electrode is performed,
the generating a second driving instruction includes: searching a second identifier corresponding to the restarting operation to be executed by the target switch from the driving operation and identifiers with the corresponding relation as the second driving instruction;
the sending the second driving instruction to the second interaction interface deployed on the driving layer of the target switch includes: and sending a second identifier to the second interactive interface, wherein the driving layer is used for executing the operation of closing all data transmission ports on the target switch at the same time under the condition that the second interactive interface is detected to receive the second identifier.
6. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the controlling the target switch to simultaneously close all data transmission ports on the target switch includes:
invoking a restart file in response to the restart operation, wherein the restart file is used for recording a plurality of switch control actions of the target switch from detection of the restart operation to execution of the restart operation, the switch control actions are used for controlling the target switch to meet the condition of execution of the restart operation, and the switch control actions comprise a target restart action for controlling the target switch to simultaneously close all data transmission ports on the target switch;
And operating the restart file.
7. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the switching the operation state of the target switch from the current operation state to the target port state in response to the restarting operation includes:
and responding to the restarting operation, detecting the switch type of each switch in the switch group, wherein the switch type comprises the following steps: a primary type and a backup type;
switching the operation state of the target switch from the current operation state to a target port state under the condition that the switch type of the target switch is the active type;
and executing the restarting operation directly on the target switch under the condition that the switch type of the target switch is the standby type.
8. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the detecting whether the link configuration progress reaches the target configuration stage, includes:
after stopping the target exchanger to realize the port function of the message transmission port of the single exchanger in the target exchanger group, starting timing;
and detecting whether the link configuration progress reaches the target configuration stage or not in the timing process and under the condition that the timing does not exceed the target time threshold.
9. The method of claim 8, wherein the step of determining the position of the first electrode is performed,
after the starting timing, the method further comprises:
stopping detecting whether the link configuration progress reaches the target configuration stage when the timing exceeds the target time threshold;
and directly recovering the port function of the message transmission port of the single switch, which is realized by the target switch in the target switch group.
10. The method of claim 8, wherein the step of determining the position of the first electrode is performed,
before the starting timing, the method further comprises:
determining the execution time of the link configuration progress reaching the configuration stage for completing the port function;
and determining the target time threshold according to the execution time, wherein the target time threshold is the time when the target switch can complete the configuration stage of the port function and the target switch can keep normal function.
11. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the detecting the link configuration progress of the target switch joining the target switch group includes:
timing the stop time of the target switch for realizing the port function of the message transmission port of the single switch in the target switch group;
And under the condition that the stop time reaches a target duration, determining the link configuration progress for indicating that the target switch completes the configuration stage of the port function in the process of joining the target switch to the target switch group.
12. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the restoring the port function of the message transmission port of the single switch, which is realized by the target switch in the target switch group, includes:
and converting the port running state of the message transmission port of the single switch, which is realized by the target switch in the target switch group, from a closing state to a starting state.
13. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the stopping the target switch from realizing the port function of the message transmission port of the single switch in the target switch group comprises the following steps:
after each link is established on the target switch, detecting the link attribute of the link;
and stopping the port function of the port of the link under the condition that the link attribute is used for indicating that the port of the link is the message transmission port of the single switch in the target switch group.
14. The method of claim 13, wherein the step of determining the position of the probe is performed,
after each link is established on the target switch, detecting the link attribute of the link, including: running a port establishment process on the target switch, wherein the port establishment process is used for re-adding the target switch to a target switch group where the target switch is located; after the port establishment process establishes each link on the target switch, detecting the link attribute of the link through the port establishment process;
and stopping the port function of the port of the link under the condition that the link attribute is used for indicating that the port of the link is the message transmission port for realizing the single switch in the target switch group, wherein the method comprises the following steps: and stopping the port function of the port of the link through the port establishment process under the condition that the port establishment process detects that the link attribute is used for indicating the port of the link to be the message transmission port for realizing the single switch in the target switch unit.
15. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the detecting the restart operation triggered on the target switch includes:
Detecting a switch type to which each switch in the switch group belongs, wherein the switch type comprises: a primary type and a backup type;
determining the switch with the switch type belonging to the switch group as the active type as the target switch;
and detecting the restarting operation triggered on the target switch.
16. A restarting device of a switch is characterized in that,
comprising the following steps:
the system comprises a detection module, a control module and a control module, wherein the detection module is used for detecting a restarting operation triggered on a target switch, wherein a flow transmission network comprises a plurality of switch groups, the switches in the same switch group are logically embodied as a single switch in the flow transmission network, each switch group comprises a plurality of switches, and the plurality of switches comprise the target switch;
a switching module, configured to switch an operation state of the target switch from a current operation state to a target port state in response to the restart operation, where the target port state is configured to indicate that a network device in the traffic transport network is not allowed to send packet data to the target switch, and the target switch in the target port state is allowed to complete the restart operation;
The first stopping module is used for stopping the target switch from realizing the port function of the message transmission port of the single switch in the target switch group under the condition that the target switch is restarted and is to be added to the target switch group where the target switch is located;
the control module is used for controlling the target switch to realize the operation of the message transmission port of the single switch in the target switch unit according to the link configuration progress of the target switch added to the target switch unit, wherein the link configuration progress is used for indicating the completed link configuration stage in the process of adding the target switch to the target switch unit;
wherein, the switching module includes: the control unit is used for controlling the target switch to simultaneously close all data transmission ports on the target switch; a first determining unit, configured to determine that an operation state of the target switch is in the target port state if it is determined that all the data transmission ports are closed;
wherein, the control module includes: the second detection unit is used for detecting the link configuration progress of the target exchanger added to the target exchanger group; a restoring unit, configured to restore, when the link configuration progress is used to indicate that the target switch completes a configuration stage of the port function in a process that the target switch joins the target switch group, a port function of the message transmission port of the single switch implemented by the target switch in the target switch group;
Wherein, the second detecting element is used for: determining a configuration phase of the port function as a target configuration phase; detecting whether the link configuration progress reaches the target configuration stage;
wherein, the second detecting element is used for: determining that the creation state of the message transmission port of the single switch is the creation completion state as the target configuration stage; the second detection unit is used for: and detecting whether the state identifier of the created state is a target state identifier corresponding to the created state.
17. A computer-readable storage medium comprising,
the computer readable storage medium having stored therein a computer program, wherein the computer program when executed by a processor implements the steps of the method of any of claims 1 to 15.
18. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that,
the processor, when executing the computer program, implements the steps of the method of any one of claims 1 to 15.
CN202311803158.8A 2023-12-26 2023-12-26 Restarting method and device of switch, storage medium and electronic device Active CN117459482B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311803158.8A CN117459482B (en) 2023-12-26 2023-12-26 Restarting method and device of switch, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311803158.8A CN117459482B (en) 2023-12-26 2023-12-26 Restarting method and device of switch, storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN117459482A CN117459482A (en) 2024-01-26
CN117459482B true CN117459482B (en) 2024-03-22

Family

ID=89582231

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311803158.8A Active CN117459482B (en) 2023-12-26 2023-12-26 Restarting method and device of switch, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN117459482B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111343019A (en) * 2020-02-24 2020-06-26 深圳市信锐网科技术有限公司 Reconnection method, reconnection device and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140192635A1 (en) * 2013-01-04 2014-07-10 International Business Machines Corporation Start-up delay for event-driven virtual link aggregation
US11681519B2 (en) * 2019-10-14 2023-06-20 Hewlett Packard Enterprise Development Lp Software update on a network device forming a multi-chassis link aggregation group (MC-LAG)
US20230327981A1 (en) * 2022-04-12 2023-10-12 Hewlett Packard Enterprise Development Lp Efficient traffic redirection for an mclag for controlled unavailability events

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111343019A (en) * 2020-02-24 2020-06-26 深圳市信锐网科技术有限公司 Reconnection method, reconnection device and storage medium

Also Published As

Publication number Publication date
CN117459482A (en) 2024-01-26

Similar Documents

Publication Publication Date Title
US9021459B1 (en) High availability in-service software upgrade using virtual machine instances in dual control units of a network device
KR101099822B1 (en) Redundant routing capabilities for a network node cluster
US9378005B2 (en) Hitless software upgrades
JP4021841B2 (en) Control packet processing apparatus and method in spanning tree protocol
CN107911291B (en) VRRP router switching method, router, VRRP active-standby switch system and storage medium
US9602304B2 (en) Data transfer device system, network system, and method of changing configuration of network system
CN107612754B (en) Bidirectional forwarding link fault detection method and device and network node equipment
WO2015167597A1 (en) Data plane to forward traffic based on communications from a software defined networking (sdn) controller during control plane failure
CN102394914A (en) Cluster brain-split processing method and device
US11032129B2 (en) Information processing apparatus, network system, and computer-readable recording medium
CN110572318B (en) Main/standby switching method and router
CN112165429B (en) Link aggregation convergence method and device for distributed switching equipment
US20150103644A1 (en) Unconstrained supervisor switch upgrade
CN102244589B (en) Method and opposite terminal apparatus for processing link fault in virtual switch unit system
US8990619B1 (en) Method and systems to perform a rolling stack upgrade
CN117459482B (en) Restarting method and device of switch, storage medium and electronic device
JP4806382B2 (en) Redundant system
CN111224803B (en) Multi-master detection method in stacking system and stacking system
KR101628219B1 (en) Method and apparatus for operating controller of software defined network
CN113949623B (en) MLAG double-master exception repairing method and device, electronic equipment and storage medium
US20240129189A1 (en) In-service software upgrade in a virtual switching stack
US20230185567A1 (en) In-service software upgrade with active service monitoring
CN109245922B (en) Method and device for controlling restart of member equipment in virtualization system
CN109120425A (en) Method, equipment and the computer readable storage medium of stacking system outband management
CN113949623A (en) MLAG double-master abnormity repairing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant