CN111510336B - Network equipment state management method and device - Google Patents

Network equipment state management method and device Download PDF

Info

Publication number
CN111510336B
CN111510336B CN202010327743.5A CN202010327743A CN111510336B CN 111510336 B CN111510336 B CN 111510336B CN 202010327743 A CN202010327743 A CN 202010327743A CN 111510336 B CN111510336 B CN 111510336B
Authority
CN
China
Prior art keywords
state
vsm
equipment
slave
state machine
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
CN202010327743.5A
Other languages
Chinese (zh)
Other versions
CN111510336A (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.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies 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 Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN202010327743.5A priority Critical patent/CN111510336B/en
Publication of CN111510336A publication Critical patent/CN111510336A/en
Application granted granted Critical
Publication of CN111510336B publication Critical patent/CN111510336B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/04Network management architectures or arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/70Virtual switches

Abstract

The application provides a network equipment state management method and device. In this application, a network device is configured with a VSM state machine that has multiple states as follows: the VSM state machine comprises an initialization state, a connection waiting state, a VSM waiting state, a master device establishing state and a slave device establishing state, and the VSM can be established by adjusting various states of the VSM state machine according to certain rules. Compared with a method for configuring a plurality of interrelated state machines in network equipment to establish the VSM, the method provided by the application has the advantages that the required program structure is simpler, and the follow-up maintenance and expansion are easier.

Description

Network equipment state management method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for managing a status of a network device.
Background
A Virtual Switch Matrix (VSM) technology is a network device virtualization management technology for virtualizing a plurality of network devices into one logical device. Multiple network devices can be uniformly configured through the VSM technology, and device management and network management are effectively simplified.
When establishing a VSM, a network device needs to configure at least the following state machines: a topology collection state machine, a role election state machine, a single board reporting state machine and a cascade interface packet sending state machine. The topology collection state machine is used for sending a topology collection message to the opposite terminal equipment so as to obtain the VSM ID of the opposite terminal equipment; the role election state machine is used for electing the main equipment according to the VSM ID of the opposite-end equipment and the VSM ID of the equipment when receiving the VSM ID of the opposite-end equipment; the single board reporting state machine is used for reporting the specified equipment information of the equipment to an upper layer platform after the main equipment is selected; the cascade interface packet sending state machine is used for sending the equipment information to be synchronized of the equipment to the opposite terminal equipment after the main equipment is elected, and if the equipment is the main equipment, the cascade interface packet sending state machine is also used for sending configuration to the slave equipment.
It can be seen that, at present, the establishment of the VSM requires configuring a plurality of state machines on the network device, and there is a correlation between the state machines, which makes the program structure during actual configuration more complicated, and is not conducive to subsequent maintenance and development of new functions.
Disclosure of Invention
The application provides a network equipment state management method and device, which aim to realize VSM establishment by managing the state of a VSM state machine configured in network equipment.
The technical scheme provided by the application comprises the following steps:
in a first aspect, the present application provides a method for managing a status of a network device, where the method is applied to a network device, and the network device is configured with a VSM state machine; the method comprises the following steps:
when the VSM of the equipment is in an initialization state, if VSM state machine state information from opposite-end equipment is received, the VSM of the equipment is adjusted from the initialization state to a waiting connection state; when the VSM of the equipment is in an initialization state, sending the VSM state information of the equipment to opposite-end equipment, and adjusting the VSM of the equipment from the initialization state to a waiting connection state;
when the VSM of the equipment is in a waiting connection state, sending the VSM state information of the equipment to opposite-end equipment, and when main equipment notified by the opposite-end equipment is received, adjusting the VSM of the equipment from the waiting connection state to a VSM waiting to be established; when the VSM of the equipment is in a waiting connection state, if VSM state machine state information from opposite-end equipment is received, selecting main equipment according to the received VSM state machine state information and informing the main equipment to the opposite-end equipment, and adjusting the VSM of the equipment from the waiting connection state to a waiting connection state for establishing the VSM;
when the VSM state machine of the equipment is in a state of waiting for establishing the VSM, sending the information of the specified equipment to be synchronized on the equipment to opposite-end equipment, and when the equipment is elected as main equipment, adjusting the VSM state machine of the equipment from the state of waiting for establishing the VSM to the state of establishing the main equipment, and when the equipment is elected as slave equipment, adjusting the VSM state machine of the equipment from the state of waiting for establishing the VSM to the state of establishing the slave equipment;
when the VSM state machine of the equipment is in a master equipment establishing state, establishing VSM between the equipment and slave equipment according to the role of the master equipment; and when the VSM state machine of the equipment is in the slave equipment establishing state, establishing the VSM between the equipment and the master equipment according to the role of the slave equipment.
In a second aspect, the present application provides a network device status management apparatus, which is applied to a network device, where the network device is configured with a VSM state machine; the device includes:
a first state adjusting unit, configured to, when a VSM state machine of the device is in an initialization state, adjust the VSM state machine of the device from the initialization state to a connection waiting state if receiving VSM state machine state information from an opposite-end device; when the VSM of the equipment is in an initialization state, sending the VSM state information of the equipment to opposite-end equipment, and adjusting the VSM of the equipment from the initialization state to a waiting connection state;
a second state adjusting unit, configured to send, to an opposite device, VSM state machine state information of the device when the VSM state machine of the device is in a connection waiting state, and adjust, when receiving a main device notified by the opposite device, the VSM state machine of the device from the connection waiting state to a VSM waiting state; when the VSM of the equipment is in a waiting connection state, if VSM state machine state information from opposite-end equipment is received, selecting main equipment according to the received VSM state machine state information and informing the main equipment to the opposite-end equipment, and adjusting the VSM of the equipment from the waiting connection state to a waiting connection state for establishing the VSM;
a third state adjusting unit, configured to send, to an opposite device, information of a specified device to be synchronized on the device when a VSM state machine of the device is in a state of waiting for VSM establishment, and adjust, when the device is elected as a master device, a VSM state machine of the device from the state of waiting for VSM establishment to a master device establishment state, and when the device is elected as a slave device, adjust, to an slave device establishment state, a VSM state machine of the device from the state of waiting for VSM establishment;
the VSM establishing unit is used for establishing VSM between the equipment and the slave equipment according to the role of the master equipment when the VSM state machine of the equipment is in the master equipment establishing state; and when the VSM state machine of the equipment is in the slave equipment establishing state, establishing the VSM between the equipment and the master equipment according to the role of the slave equipment.
The VSM establishing method has the advantages that the VSM is configured on the network equipment, various states of the VSM are adjusted according to certain rules, the VSM can be established, and compared with a VSM establishing mode that a plurality of interrelated state machines are configured in the network equipment, the VSM establishing method is simpler in required program structure, easy to maintain and expand new functions, and maintenance and development cost can be effectively reduced.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic diagram of a state machine configuration in a network device according to the present application;
fig. 2 is a flowchart of a network device status management method provided in the present application;
FIG. 3 is a state transition diagram of a VSM state machine provided by an embodiment of the present application;
4A-4D are schematic diagrams of election master devices provided in accordance with embodiments of the present application;
fig. 5 is a structural diagram of a network device state management apparatus according to an embodiment of the present application;
fig. 6 is a structural diagram of another network device status management apparatus according to an embodiment of the present application;
fig. 7 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the description. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, the first information may also be referred to as second information, and similarly, the second information may also be referred to as first information, without departing from the scope of the present specification. The word "if," as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination," depending on the context.
The VSM technology is a technology for virtualizing a plurality of network devices as one logical device, and as one embodiment, the plurality of network devices are physically connected in a cascade manner. In one example, establishing a VSM requires configuring a plurality of state machines on a network device, and the plurality of state machines can be referred to in fig. 1, where fig. 1 is a schematic diagram illustrating a state machine configuration in a network device according to the present application. As shown in fig. 1, the plurality of state machines configured in the network device may include: a topology collection state machine 101, a role election state machine 102, a board reporting state machine 103, and a cascade interface packet sending state machine 104, and the functions of the above state machines are briefly described below by taking any network device configured with the above state machines as an example.
As an embodiment, the topology collection state machine 101 is configured to send a topology collection packet to a peer device to obtain a VSM ID of the peer device. Specifically, the topology collection state machine operates after a user starts a VSM function of the network device. The VSM ID is an identifier of the network device in the VSM, and in one embodiment, the VSM ID is assigned to the network device by a user after the VSM function of the network device is turned on.
When receiving a topology collection message sent by an opposite terminal device, as an embodiment, the device adds its own VSM ID to the topology collection message, and sends the topology collection message to the opposite terminal device to notify the opposite terminal device of its own VSM ID.
And a role election state machine 102, configured to perform role election according to the VSM IDs of the local device and the peer device after obtaining the VSM ID of the peer device, where a role includes a master device and a slave device. As an embodiment, the role election may include: and comparing the VSM ID values of the equipment and the opposite-end equipment, and electing the equipment with the smaller VSM ID value as the main equipment and the equipment with the larger VSM ID value as the auxiliary equipment.
And the single board reporting state machine 103 is used for reporting the specified device information of the device to an upper layer platform after the role election is completed. The specific device information here may include: single board presence information, port information, etc. In one embodiment, a user may obtain the specified device information of each network device in the VSM through the upper platform, and issue the configuration to each network device through the upper platform.
And the cascade connection port packet sending state machine 104 is configured to send the device information to be synchronized of the device to the peer device after the role election is completed, and if the device is the master device, the cascade connection port packet sending state machine is further configured to send the configuration information sent by the upper platform to the slave device after the device information is reported to the upper platform. The device information to be synchronized here may include: single board in-place information, port information, dynamic table entry, service capability, etc.
As can be seen from the above description, the VSM establishment in the above embodiments needs to be implemented by multiple state machines configured in the network device, and the state machines are associated with each other, so that the program structure is complex.
Therefore, the application provides a network device state management method, VSM establishment can be realized through one state machine configured on the network device, and a program structure can be effectively simplified. To make the objects, technical solutions and advantages of the present application more apparent, the present application will be described in detail with reference to the accompanying drawings and specific embodiments.
Referring to fig. 2, fig. 2 is a flowchart of a network device status management method provided in the present application. In one example, the method may be applied to a network device configured with a VSM state machine, which may include the following states, for one embodiment: an initialization state, a wait for connection state, a wait for VSM to establish state, a master device establishment state, and a slave device establishment state. As shown in fig. 2, the method may include the steps of:
step 201, when the VSM state machine of the device is in an initialization state, if receiving the state information of the VSM state machine from the opposite device, adjusting the VSM state machine of the device from the initialization state to a waiting connection state; and when the VSM of the equipment is in the initialization state, sending the VSM state information of the equipment to the opposite terminal equipment, and adjusting the VSM of the equipment from the initialization state to the connection waiting state.
As an example, the initialization state is a default state of the VSM state machine, indicating that the VSM state machine has not been started. The adjusting the VSM state machine of the device from the initialization state to the connection waiting state includes: the VSM state machine is started.
When the VSM state machine of the device is in the initialization state, before sending the state information of the VSM state machine of the device to the peer device, as an embodiment, the device may be cascaded with other network devices to establish the VSM, and the VSM function of the device may be started. Specifically, the cascade connection can be realized by a special cascade connection single board. As an embodiment, when detecting an UP event at a cascade port of the device, the port for cascade connection on the network device is recorded as the cascade port, and the state information of the VSM state machine of the device is sent to the opposite device through the cascade port.
In an embodiment, a certain time is required for triggering the UP event of the cascade port after the device is started, so that even if the device and the opposite device are started simultaneously, the UP event of the cascade port of the device and the UP event of the opposite device may not be synchronous but have a certain time difference. Therefore, when the UP event of the device cascade interface is detected, the VSM state machine state information of the device can be sent to the opposite device after the preset time. Specifically, the preset time may be in milliseconds.
In an example, when receiving the VSM state machine state information sent by the peer device, the VSM state machine state information of the device may be replied to the peer device. Here, as an embodiment, after receiving the VSM state machine state information sent by the peer device, the reply may send the VSM state machine state information of the device to the peer device. As another embodiment, the VSM state machine state information is sent in a message form, and when a message carrying the VSM state machine state information sent by an opposite-end device is received, the VSM state machine state information of the device may be filled in a specified field in the message, and the filled message is sent to the opposite-end device. Therefore, the device can also obtain the VSM state information replied by the opposite-end device by sending the VSM state information to the opposite-end device.
As an embodiment, if the VSM state information sent by the peer device is not received within a preset time after the device sends the VSM state information to the peer device, it indicates that the peer device does not exist currently, so that the VSM state machine of the device may be adjusted from the initialization state to the connection waiting state. As another embodiment, if the VSM state machine state information sent by the peer device is received within a preset time after the device sends the VSM state machine state information to the peer device, the VSM state machine of the device may be immediately adjusted from the initialization state to the connection waiting state, or may be adjusted from the initialization state to the connection waiting state after the preset time is reached. As an embodiment, when receiving VSM state machine state information sent by a peer device, the VSM state machine state information may be recorded.
Through the embodiment, the network device can determine whether the opposite-end device exists currently or not, and acquire the VSM state machine state information of the currently existing opposite-end device.
In some embodiments, the device may be cascaded with at least two network devices to establish a VSM system, and in order to determine a currently existing peer device and acquire VSM state machine state information of the currently existing peer device, as an embodiment, a VSM ID set may be preconfigured in the device, where the VSM ID set is a set of VSM IDs that may be allocated to the network devices, the device sends the VSM state machine state information using any VSM ID in the set, except for its own VSM ID, as a destination address, determines whether a peer device to which the VSM ID is allocated exists according to a situation of receiving a reply of the peer device, and acquires the VSM state machine state information of the currently existing peer device. As another embodiment, the VSM ID of the device may be used as a destination address to send VSM state machine state information to the peer device. When receiving VSM state machine state information of which the destination address from the opposite terminal device is not the VSM ID of the device, the device replies the VSM state machine state information of the device to the opposite terminal device, and forwards the VSM state machine state information according to the destination address of the received VSM state machine state information.
Step 202, when the VSM state machine of the device is in a waiting connection state, sending the state information of the VSM state machine of the device to the opposite device, and when receiving the main device notified by the opposite device, adjusting the VSM state machine of the device from the waiting connection state to a waiting connection state; when the VSM of the equipment is in a waiting connection state, if VSM state information from opposite-end equipment is received, selecting main equipment according to the received VSM state information, notifying the main equipment to the opposite-end equipment, and adjusting the VSM of the equipment from the waiting connection state to a VSM waiting to be established.
The wait for connection state is used to elect the master and slave devices and to connect the peer devices that may exist in the case of a single device. The single device condition here refers to a condition that no peer device exists for the device. Reasons for the single device case may include: the device is not cascaded with the opposite terminal device, the opposite terminal device does not start the VSM function, the cascade port of the opposite terminal device is in a DOWN state, the opposite terminal device fails, the opposite terminal device is restarted, and the like. As an embodiment, when the device is in a single device, the device may be elected as a master device, but the state of the VSM state machine of the device is not adjusted.
Before receiving the VSM state machine state information from the peer device, as an embodiment, the device sends the VSM state machine state information to the peer device at a certain time interval. Specifically, the VSM state machine state information may be sent to the peer device when it is detected that the device cascade interface is in the UP state.
In one example, the VSM state machine state information from the peer device in step 202 may include: the method comprises the steps of receiving state information of a VSM (virtual switch memory) state machine from opposite-end equipment when the VSM state machine of the equipment is in a connection waiting state, and receiving state information of the VSM state machine from the opposite-end equipment when the VSM state machine of the equipment is in an initialization state. As an embodiment, when the state machine of the device is in the connection waiting state, if the device records the VSM state machine state information of the peer device, it may be determined that the VSM state machine state information from the peer device is received when the VSM state machine of the device is in the initialization state.
In this step 202, if the VSM state machine state information from the peer device is received, the primary device is elected according to the received VSM state machine state information, and during specific implementation, the election of the primary device has a plurality of implementation manners, which will be described in the following examples and will not be described herein again. By electing the master device, it can be determined whether the role of the device is the master device or the slave device.
In one embodiment, advertising the elected master device to the slave devices may include: and sending the VSM ID of the main device to the opposite device. The VSM ID transmission method of the master device may include: filling VSM ID of the main device in the specified field in the received VSM state machine state information of the opposite terminal device, and returning the state information to the opposite terminal device; or, in the case that the received VSM state machine state information of the peer device includes the VSM ID of the peer device, the VSM ID of the peer device in the state information may be changed to the VSM ID of the primary device (which may not be changed if the peer device is elected as the primary device), and the state information is returned to the peer device; or, the VSM ID of the master device is added to other information than the received VSM state machine state information of the peer device, for example, to a message dedicated to notifying the elected master device, and the information is sent to the peer device.
In another embodiment, advertising the elected master device to the slave devices may further comprise: and sending the VSM ID of the master device and the VSM ID of the slave device to the opposite device.
As an embodiment, if a master device notified by a peer device is received, the device may determine a role of the device based on the notification.
As an embodiment, when the device is already elected as the master device in the case of a single device, if the elected master device receives notification from the peer device that the elected master device is not the device, or if the elected master device according to the received VSM state machine state information of the peer device is not the device, the device is switched from the master device to the slave device. Specifically, the device is restarted, and the role of the device is switched from the master device to the slave device.
After determining the primary device in the VSM, that is, determining the role of the device in this step 202, the VSM state machine of the device is adjusted from the connection waiting state to the VSM waiting state.
Step 203, when the VSM state machine of the device is in the state of waiting for establishing the VSM, sending the information of the specified device to be synchronized on the device to the opposite device, and when the device is elected as the master device, adjusting the VSM state machine of the device from the state of waiting for establishing the VSM to the state of establishing the master device, and when the device is elected as the slave device, adjusting the VSM state machine of the device from the state of waiting for establishing the VSM to the state of establishing the slave device.
In an example, the VSM waiting state is mainly used to establish a VSM channel between the device and the peer device, and send the information of the specified device to be synchronized on the device to the peer device through the VSM channel after the VSM channel is established. As an embodiment, the VSM channel is a data transmission channel, which can provide stable and reliable data transmission for upper layer protocols. As an embodiment, the specific device information to be synchronized may include: the single board has various information such as on-site information, service capability, port information, dynamic table entry and the like. If the device is a master device, some information recorded by the device for managing the VSM, such as port message statistical information, may not need to be synchronized to an opposite device.
In an example, when the VSM state machine of the present device is in a state of waiting for establishing the VSM, the device information to be reported may also be reported to the upper layer platform. In one embodiment, the upper platform provides visual device information, and a user can obtain the specified device information of each network device in the current VSM through the upper platform. In one embodiment, the upper layer platform also provides an operational management interface through which a user can manage each network device in the VSM, such as issuing a configuration to a specified network device. As an embodiment, the device information to be reported may be the same as the specified device information to be synchronized, or may be included in the specified device information to be synchronized, when reporting the device information to be reported to the upper platform, the master device may report the device information to be reported of itself and the device information to be reported in the specified device information synchronized by the slave device to the upper platform, and the slave device does not need to report again.
As an embodiment, after completing the synchronization and reporting of the information of the designated device, the VSM state machine of the device may be adjusted from the VSM establishment waiting state to the VSM establishment state. The VSM establishment state can be divided into a master equipment establishment state and a slave equipment establishment state according to different equipment roles, and the states are adjusted according to the roles of the equipment. Specifically, if it is determined that the device is the master device through the step 202, the VSM state machine of the device is adjusted to the master device establishment state; if it is determined that the device is the slave device in step 202, the VSM state machine of the device is adjusted to the slave device establishment state.
Step 204, when the VSM state machine of the equipment is in the master equipment establishing state, establishing VSM between the equipment and the slave equipment according to the role of the master equipment; and when the VSM state machine of the equipment is in the slave equipment establishing state, establishing the VSM between the equipment and the master equipment according to the role of the slave equipment.
In one example, the master setup state and the slave setup state in step 204 are both in a steady state. The VSM state machine of the device is in the master device setup state, which indicates that the device is currently the master device, and the VSM state machine of the device is in the slave device setup state, which indicates that the device is currently the slave device.
As an embodiment, when the VSM state machine of the device is in the master device setup state, the device is a controller of the entire VSM, and may receive the configuration issued by the upper platform and issue the received configuration to the designated network device. Specifically, the configuration may be issued through the VSM channel established in step 203.
As an embodiment, when the VSM state machine of the present device is in the slave device establishment state, the configuration issued by the master device is received. Specifically, the configuration issued by the master device may be received through the VSM channel established in step 203. After receiving the issued configuration, the configuration can be issued to the hardware chip of the device to enable the configuration to take effect, so that the device and the main device are virtualized into the same VSM logical device.
Thus, the flow shown in fig. 2 is completed.
In one example, the VSM state machine in the flow shown in FIG. 2 is a finite state machine. For one embodiment, the VSM state machine state information may include: the current state of the VSM state machine and the VSM ID.
As an embodiment, the network device in the flow shown in fig. 2 may be a box device or a box device.
The flow shown in fig. 2 may complete the VSM establishment through one state machine configured in the network device, and compared with the VSM establishment method in which a plurality of state machines are configured in the network device, the code structure required by the flow shown in fig. 2 is simpler and is easier to develop and maintain later.
In practical applications, a situation that a certain network device in the VSM cannot normally operate due to a failure or a restart may occur, and in order to timely detect and process such a situation, in an example, the VSM state machine configured in the network device may further include a slave device disconnection processing state and a slave switching state as a master state. This is explained in detail below with reference to fig. 3:
referring to fig. 3, fig. 3 is a state transition diagram of a VSM state machine according to an embodiment of the present application. As shown in fig. 3, the VSM state machine may also make the following state adjustments:
a, when the VSM state machine of the equipment is in a main equipment establishing state:
a1, when the VSM of the equipment is in a master equipment establishing state, if the abnormal operation of the slave equipment is detected, the VSM of the equipment is adjusted from the master equipment establishing state to a slave equipment disconnecting processing state.
In one example, the slave device operation exception herein may include: slave device failure, slave device reboot, etc. When detecting the operation abnormality of the slave device, as an embodiment, the detection may be performed through a heartbeat message, and specifically includes the following steps:
step a1, sending a heartbeat message to the slave equipment and starting timing.
As an embodiment, the heartbeat message in step a1 may be sent through a cascade interface.
And a2, if the message of the slave equipment responding to the heartbeat message is not received within the preset time, determining that the slave equipment is abnormal in operation.
It should be noted that the above-mentioned step of detecting the heartbeat message is only an example, and is not intended to limit the present application.
And A2, when the VSM state machine of the equipment is in the slave equipment disconnection processing state, logging out the specified equipment information of the slave equipment, and adjusting the VSM state machine of the equipment from the slave equipment disconnection processing state to the connection waiting state.
The slave device disconnection processing state is a state indicating that the present device handles an abnormality in the operation of the slave device as the master device. When the slave device is abnormally operated, the received message cannot be normally forwarded, and in order to maintain normal message forwarding, the information of the specified device of the slave device can be cancelled, so that the situations of packet loss and the like caused by forwarding the message to the slave device are avoided. In one embodiment, the specific device information may include single board presence information, port information, and the like. The logging out of the designated device information of the slave device may include: and logging out the specified device information of the slave device recorded by the device, and logging out the specified device information of the slave device to an upper layer platform.
After logging out the designated device information of the slave device, in one embodiment, the VSM state machine of the device is adjusted from the slave device disconnection processing state to the connection waiting state, so that the device can reestablish the VSM with the above slave device or other network devices whose operation is restored to normal.
In another embodiment, if the slave device still exists after the designated device information of the slave device is logged out, the VSM state machine of the present device may be adjusted from the slave device disconnection processing state to the master device establishment state. As an embodiment, if the device still records device information of the slave device, such as a VSM ID, it is determined that the slave device still exists currently.
B, when the VSM state machine of the equipment is in the slave equipment establishing state:
and B1, when the VSM of the equipment is in the slave equipment establishing state, if the abnormal operation of the master equipment is detected, the VSM of the equipment is adjusted from the slave equipment establishing state to the slave switching state.
As an embodiment, when the device is used as a slave device to detect that the master device is abnormally operated, the device may also perform detection through the heartbeat message, and the specific detection steps may refer to the above embodiments.
And B2, when the VSM of the equipment is in the slave switching to master state, switching the equipment from the slave equipment to the master equipment, logging out the specified equipment information of the original master equipment, and adjusting the VSM of the equipment from the slave switching to the master state to a waiting connection state.
In one embodiment, after the device is switched from the slave device to the master device, the control right of the VSM is taken over, and the VSM is used as the master device to perform operations such as receiving configuration and message forwarding issued by an upper platform. As an embodiment, after the device is switched from the slave device to the master device, the device logs out the designated device information of the original master device and logs out the designated device information of the original master device recorded by the device, and the VSM state machine of the device is adjusted from the slave-to-master state to the standby state.
In other embodiments, when the VSM state machine of the present device is in the slave device establishment state and detects that the master device is abnormally operated, if the present device further records device information of other slave devices, such as a VSM ID, the master device is reselected together with the slave device. If the equipment is selected as the main equipment, the VSM state machine of the equipment is adjusted from the slave equipment establishment state to the slave switching main state, the equipment is switched from the slave equipment to the main equipment, and after the appointed equipment information of the original main equipment is logged out, the VSM state machine of the equipment is adjusted from the slave switching main state to the main equipment establishment state.
In an example, when the VSM state machine of the present device is in the master device setup state, the slave device operation exception may further include: the slave device can still work normally, but the cascade link with the slave device fails. At this time, the slave device cannot receive the heartbeat message sent by the device through the cascade interface, and in this case, the slave device will adjust the VSM state machine to a connection waiting state, and perform role election again (for example, in the case of a single device, elects itself as a master device), thereby forming a new VSM system. Since the new VSM system has the same configuration as the original VSM system in terms of MAC address, IP address, etc., a MAC address conflict or an IP address conflict may be caused, resulting in network abnormality.
The situation that the original VSM system is split into two VSM systems due to the inter-device cascade link failure is recorded as VSM split. In order to avoid VSM splitting, as an embodiment, when the VSM state machine of the device is in the master device setup state, the device may further send a split detection message to the slave device. Specifically, the split detection message may be sent through a port other than the cascade port.
As an embodiment, when the VSM state machine of the present device is in the slave device establishment state, if the heartbeat message sent by the master device is not received, but the split detection message sent by the master device is received, the present device is set to the silent mode. In the silent mode, the indication device does not perform any operations such as message forwarding, learning and the like, and by setting the device as the silent mode, the VSM split caused by re-role election of the device can be effectively avoided. As another embodiment, when the VSM state machine of the present device is in the slave device establishment state, if the split detection packet sent by the master device is received and it is detected that the cascade interface of the present device is in the DOWN state, the present device is set to the silent mode.
This completes the description of fig. 3.
Through the state adjustment of the VSM state machine shown in fig. 3, the device can detect the abnormal operation of the peer device in time and perform corresponding processing.
The process of electing the master device according to the received VSM state machine state information in step 202 is described below with reference to fig. 4A-4D:
in one example, VSM state machine state information includes: the VSM state machine current state and the VSM ID. When the main device is elected, the states of the VSM state machines of the device and the peer device may be compared, and when the states of the VSM state machines of the device and the peer device are consistent, the values of the VSM IDs of the device and the peer device are compared, and the main device is determined according to the comparison result. The following describes in detail various situations that may exist:
it should be noted that, for convenience of description, the following description is based on a case that the device (network device a) only has one peer device (network device B), and the current state of the VSM state machine of the device when receiving the state information of the VSM state machine of the peer device is recorded as the state of the device; and recording the state of the VSM contained in the received VSM state machine state information of the opposite terminal equipment as the state of the opposite terminal equipment.
Referring to fig. 4A, if the state of the peer device is the initialization state and the state of the device is also the initialization state, the VSM ID of the peer device and the VSM ID of the device are compared, and the master device is determined according to the comparison result.
As an example, determining the master device according to the comparison of the magnitudes of the VSM ID values may include: and selecting the equipment with the smaller VSM ID value as the main equipment, or selecting the equipment with the larger VSM ID value as the main equipment.
Referring to fig. 4B, if the state of the peer device is the connection waiting state and the state of the device is also the connection waiting state, the VSM ID of the peer device and the VSM ID of the device are compared, and the master device is determined according to the comparison result.
Referring to fig. 4C, if the state of the peer device is the connection waiting state and the state of the device is the initialization state, the peer device is directly elected as the master device.
Referring to fig. 4D, if the state of the peer device is the initialization state and the state of the device is the connection waiting state, the device is directly elected as the master device.
In some embodiments, the peer device may be a network device that is cascaded with the device and starts a VSM function after the device has completed the election of the master device, and therefore, the state of the peer device may be an initialization state or a connection waiting state, and the state of the device may be a VSM waiting state to be established, a master device establishing state, a slave device disconnection processing state, or a slave switching state to be a master state. In this case, the device may still maintain the election result completed before, and notify the peer device of the primary device elected before.
This completes the description of how the master device is elected based on the received VSM state machine state information in step 202. It should be noted that the above embodiments are only examples, and in practical implementation, the master device may also be selected by other means, such as simply selecting the master device according to the VSM ID value of the network device, which is not described in detail herein.
The method provided by the present application is described above, and it should be noted that the state names of the VSM state machines used in the description of the method provided by the present application are only for convenience of description, and in practical applications, other state names may be used to represent the states of the VSM state machines.
The following describes the apparatus provided in the present application:
referring to fig. 5, fig. 5 is a structural diagram of a network device status management apparatus according to an embodiment of the present application. As shown in fig. 5, the apparatus includes a first adjusting unit 501, a second adjusting unit 502, a third adjusting unit 503, and a VSM establishing unit 504.
In an example, the first state adjusting unit 501 is configured to, when a VSM state machine of the present device is in an initialization state, if receiving VSM state machine state information from an opposite-end device, adjust the VSM state machine of the present device from the initialization state to a connection waiting state; when the VSM of the equipment is in an initialization state, sending the VSM state information of the equipment to opposite-end equipment, and adjusting the VSM of the equipment from the initialization state to a connection waiting state;
a second state adjusting unit 502, configured to send, to an opposite device, VSM state machine state information of the device when the VSM state machine of the device is in a connection waiting state, and adjust, when receiving a main device notified by the opposite device, the VSM state machine of the device from the connection waiting state to a VSM waiting state; when the VSM of the equipment is in a waiting connection state, if VSM state machine state information notified by opposite-end equipment is received, selecting main equipment according to the received VSM state machine state information and notifying the main equipment to the opposite-end equipment, and adjusting the VSM of the equipment from the waiting connection state to a waiting connection state for establishing the VSM;
a third state adjustment unit 503, configured to send, to an opposite device, specified device information to be synchronized on the device when a VSM state machine of the device is in a state of waiting for VSM establishment, and adjust, when the device is elected as a master device, the VSM state machine of the device from the state of waiting for VSM establishment to a master device establishment state, and when the device is elected as a slave device, adjust the VSM state machine of the device from the state of waiting for VSM establishment to a slave device establishment state;
a VSM establishing unit 504, configured to establish a VSM between the device and the slave device according to a role of the master device when the VSM state machine of the device is in the master device establishing state; and when the VSM state machine of the equipment is in the slave equipment establishing state, establishing the VSM between the equipment and the master equipment according to the role of the slave equipment.
As an embodiment, the network device state management apparatus provided in the present application may further include other units, such as a unit for detecting whether an abnormal operation occurs in the peer device. Referring to fig. 6, fig. 6 is a structural diagram of another network device status management apparatus according to an embodiment of the present application. As shown in fig. 6, as an embodiment, the apparatus further includes:
a fourth state adjustment unit 505, configured to, when the VSM state machine of the present device is in the master device setup state, if it is detected that the slave device runs abnormally, adjust the VSM state machine of the present device from the master device setup state to the slave device disconnection processing state;
a fifth state adjustment unit 506, configured to, when the VSM state machine of the present apparatus is in the slave apparatus disconnection processing state, log out the specified apparatus information of the slave apparatus with abnormal operation, and adjust the VSM state machine of the present apparatus from the slave apparatus disconnection processing state to the connection waiting state.
As an embodiment, the apparatus further comprises:
a sixth state adjusting unit 507, configured to, when the VSM state machine of the present device is in the slave device establishment state, if it is detected that the master device is abnormal in operation, adjust the VSM state machine of the present device from the slave device establishment state to the slave switching state;
a seventh state adjusting unit 508, configured to switch the slave device to the master device when the VSM state machine of the device is in the slave-to-master state, log out the specified device information of the original master device, and adjust the VSM state machine of the device from the slave-to-master state to the connection waiting state.
As an embodiment, the VSM state machine state information includes: the VSM state machine current state and the VSM ID.
As an embodiment, the second state adjustment unit elects the master device according to the received VSM state machine state information, including:
if the received current state of the VSM of the opposite-end equipment is consistent with the state of the VSM of the equipment when the VSM state information of the opposite-end equipment is received, comparing the VSM ID of the opposite-end equipment with the VSM ID of the equipment, and determining the main equipment according to the comparison result;
if the received current state of the VSM of the opposite-end equipment is an initialization state and the VSM state machine of the opposite-end equipment is received, the VSM of the equipment is in a waiting connection state, and the equipment is elected to be main equipment;
and if the received current state of the VSM of the opposite-end equipment is a waiting connection state and the VSM state machine of the opposite-end equipment is in an initialization state when the state information of the VSM state machine of the opposite-end equipment is received, electing the opposite-end equipment as the main equipment.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described apparatus embodiments are merely illustrative, and the components shown as modules may or may not be physical modules, may be located in one place, or may be distributed over a plurality of network modules. The modules can be selected according to actual needs to achieve the purpose of the scheme in the specification. One of ordinary skill in the art can understand and implement it without inventive effort.
Referring to fig. 7, fig. 7 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present disclosure. The electronic device may include a processor 701, a memory 702, and a communication bus 703. The processor 701 and the memory 702 communicate with each other via a communication bus 703. Wherein, the memory 702 stores a computer program; the processor 701 may perform the network device state management method described above by executing the program stored on the memory 702.
The memory 702 referred to herein may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the memory 702 may be: RAM (random Access Memory), volatile Memory, non-volatile Memory, flash Memory, a storage drive (e.g., a hard drive), a solid state drive, any type of storage disk (e.g., an optical disk, a dvd, etc.), or similar storage medium, or a combination thereof.
An embodiment of the present application further provides a machine-readable storage medium, such as the memory 702 in fig. 7, storing a computer program, where the computer program is executable by the processor 701 in the electronic device shown in fig. 7 to implement the network device status management method described above.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art to which the present application pertains. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (6)

1. A network equipment state management method is characterized in that the method is applied to network equipment, and the network equipment is provided with a VSM state machine; the method comprises the following steps:
when the VSM of the equipment is in an initialization state, if VSM state machine state information from opposite-end equipment is received, the VSM of the equipment is adjusted from the initialization state to a waiting connection state; when the VSM of the equipment is in an initialization state, sending the VSM state information of the equipment to opposite-end equipment, and adjusting the VSM of the equipment from the initialization state to a waiting connection state;
when the VSM of the equipment is in a waiting connection state, sending the VSM state information of the equipment to opposite-end equipment, and when main equipment notified by the opposite-end equipment is received, adjusting the VSM of the equipment from the waiting connection state to a waiting VSM state; when the VSM of the equipment is in a waiting connection state, if VSM state machine state information from opposite-end equipment is received, selecting main equipment according to the received VSM state machine state information and informing the main equipment to the opposite-end equipment, and adjusting the VSM of the equipment from the waiting connection state to a waiting connection state for establishing the VSM;
when the VSM state machine of the equipment is in a state of waiting for establishing the VSM, sending the information of the specified equipment to be synchronized on the equipment to opposite-end equipment, and when the equipment is elected as main equipment, adjusting the VSM state machine of the equipment from the state of waiting for establishing the VSM to the state of establishing the main equipment, and when the equipment is elected as slave equipment, adjusting the VSM state machine of the equipment from the state of waiting for establishing the VSM to the state of establishing the slave equipment;
when the VSM state machine of the equipment is in a master equipment establishing state, establishing VSM between the equipment and slave equipment according to the role of the master equipment; when the VSM state machine of the equipment is in a slave equipment establishing state, establishing VSM between the equipment and the master equipment according to the role of the slave equipment;
the VSM state machine state information includes: the current state of the VSM state machine and the VSM ID;
the election master device according to the received VSM state machine state information includes:
if the received current state of the VSM of the opposite-end equipment is consistent with the state of the VSM of the equipment when the state information of the VSM of the opposite-end equipment is received, comparing the VSM ID of the opposite-end equipment with the VSM ID of the equipment, and determining the main equipment according to the comparison result;
if the current state of the received VSM of the opposite-end equipment is an initialization state and the VSM of the opposite-end equipment is received, the VSM of the equipment is in a waiting connection state, and the equipment is elected to be main equipment;
and if the current state of the received VSM of the opposite-end equipment is a waiting connection state and the VSM state machine of the opposite-end equipment is in an initialization state when the VSM state machine of the equipment is received, selecting the opposite-end equipment as the main equipment.
2. The method of claim 1, further comprising:
when the VSM of the equipment is in the master equipment establishing state, if the abnormal operation of the slave equipment is detected, the VSM of the equipment is adjusted from the master equipment establishing state to the slave equipment disconnection processing state;
when the VSM state machine of the equipment is in the slave equipment disconnection processing state, the specified equipment information of the slave equipment is logged out, and the VSM state machine of the equipment is adjusted from the slave equipment disconnection processing state to the connection waiting state.
3. The method of claim 1, further comprising:
when the VSM of the equipment is in the slave equipment establishing state, if the abnormal operation of the master equipment is detected, the VSM of the equipment is adjusted from the slave equipment establishing state to the slave switching state;
when the VSM state machine of the equipment is in the slave switching to master state, the equipment is switched from the slave equipment to the master equipment, the designated equipment information of the original master equipment is logged out, and the VSM state machine of the equipment is adjusted from the slave switching to the master state to be in the waiting connection state.
4. The device is characterized in that the device is applied to network equipment, and the network equipment is provided with a VSM state machine; the device comprises:
a first state adjusting unit, configured to, when a VSM state machine of the device is in an initialization state, adjust the VSM state machine of the device from the initialization state to a connection waiting state if receiving VSM state machine state information from an opposite-end device; when the VSM of the equipment is in an initialization state, sending the VSM state information of the equipment to opposite-end equipment, and adjusting the VSM of the equipment from the initialization state to a waiting connection state;
a second state adjusting unit, configured to send, to an opposite device, VSM state machine state information of the device when the VSM state machine of the device is in a connection waiting state, and adjust, when receiving a main device notified by the opposite device, the VSM state machine of the device from the connection waiting state to a VSM waiting state; when the VSM of the equipment is in a waiting connection state, if VSM state machine state information from opposite-end equipment is received, selecting main equipment according to the received VSM state machine state information and informing the main equipment to the opposite-end equipment, and adjusting the VSM of the equipment from the waiting connection state to a waiting connection state for establishing the VSM;
a third state adjusting unit, configured to send information of a specified device to be synchronized on the device to an opposite device when a VSM state machine of the device is in a state of waiting for VSM establishment, adjust the VSM state machine of the device from the state of waiting for VSM establishment to a state of establishing a master device when the device is elected as a master device, and adjust the VSM state machine of the device from the state of waiting for VSM establishment to a state of establishing a slave device when the device is elected as a slave device;
the VSM establishing unit is used for establishing VSM between the equipment and the slave equipment according to the role of the master equipment when the VSM state machine of the equipment is in the master equipment establishing state; when the VSM state machine of the equipment is in a slave equipment establishing state, establishing VSM between the equipment and the master equipment according to the role of the slave equipment;
the VSM state machine state information includes: the current state of the VSM state machine and the VSM ID;
the second state adjustment unit elects the main device according to the received VSM state machine state information, and the second state adjustment unit comprises:
if the received current state of the VSM of the opposite-end equipment is consistent with the state of the VSM of the equipment when the state information of the VSM of the opposite-end equipment is received, comparing the VSM ID of the opposite-end equipment with the VSM ID of the equipment, and determining the main equipment according to the comparison result;
if the current state of the received VSM of the opposite-end equipment is an initialization state and the VSM of the opposite-end equipment is received, the VSM of the equipment is in a waiting connection state, and the equipment is elected to be main equipment;
and if the received current state of the VSM of the opposite-end equipment is a waiting connection state and the VSM of the opposite-end equipment is in an initialization state when the state information of the VSM of the opposite-end equipment is received, electing the opposite-end equipment as the main equipment.
5. The apparatus of claim 4, further comprising:
a fourth state adjusting unit, configured to, when the VSM state machine of the present device is in the master device setup state, adjust the VSM state machine of the present device from the master device setup state to the slave device disconnection processing state if it is detected that the slave device is abnormally operated;
and the fifth state adjusting unit is used for logging out the specified equipment information of the slave equipment with abnormal operation when the VSM state machine of the equipment is in the slave equipment disconnection processing state, and adjusting the VSM state machine of the equipment from the slave equipment disconnection processing state to the connection waiting state.
6. The apparatus of claim 4, further comprising:
a sixth state adjusting unit, configured to, when the VSM state machine of the present device is in the slave device establishment state, adjust the VSM state machine of the present device from the slave device establishment state to the slave switching state if it is detected that the master device is abnormally operated;
and a seventh state adjusting unit, configured to switch the slave device to the master device when the VSM state machine of the device is in the slave-to-master state, log out the specified device information of the original master device, and adjust the VSM state machine of the device from the slave-to-master state to the connection waiting state.
CN202010327743.5A 2020-04-23 2020-04-23 Network equipment state management method and device Active CN111510336B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010327743.5A CN111510336B (en) 2020-04-23 2020-04-23 Network equipment state management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010327743.5A CN111510336B (en) 2020-04-23 2020-04-23 Network equipment state management method and device

Publications (2)

Publication Number Publication Date
CN111510336A CN111510336A (en) 2020-08-07
CN111510336B true CN111510336B (en) 2022-11-25

Family

ID=71874593

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010327743.5A Active CN111510336B (en) 2020-04-23 2020-04-23 Network equipment state management method and device

Country Status (1)

Country Link
CN (1) CN111510336B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114168094A (en) * 2021-11-24 2022-03-11 深圳康佳电子科技有限公司 Miracast message processing method, device and equipment based on inheritable state machine

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7274703B2 (en) * 2002-03-11 2007-09-25 3Com Corporation Stackable network units with resiliency facility
TW200412132A (en) * 2002-12-31 2004-07-01 Syncomm Technology Corp Data link control state machine
CN103401754B (en) * 2013-07-30 2017-03-08 杭州华三通信技术有限公司 A kind of stacking link establishing method, equipment and system
CN110890989A (en) * 2019-12-03 2020-03-17 杭州迪普科技股份有限公司 Channel connection method and device

Also Published As

Publication number Publication date
CN111510336A (en) 2020-08-07

Similar Documents

Publication Publication Date Title
CN106330475B (en) Method and device for managing main and standby nodes in communication system and high-availability cluster
CN105607590B (en) Method and apparatus to provide redundancy in a process control system
US9189349B2 (en) Distributed blade server system, management server and switching method
WO2016150066A1 (en) Master node election method and apparatus, and storage system
CN102257759B (en) Master-standby switching method, system control unit and communication system
CN102244669B (en) Software upgrading method in stacking equipment and stacking equipment
EP3316555B1 (en) Mac address synchronization method, device and system
CN101594383B (en) Method for monitoring service and status of controllers of double-controller storage system
US10037253B2 (en) Fault handling methods in a home service system, and associated household appliances and servers
CN111585835B (en) Control method and device for out-of-band management system and storage medium
CN111510336B (en) Network equipment state management method and device
CN114244736A (en) Multi-master detection method, equipment and medium based on stacking environment
CN112737844A (en) Method and device for switching between main and standby in redundant system
CN104052799A (en) Method for achieving high availability storage through resource rings
CN114124803B (en) Device management method and device, electronic device and storage medium
JP4806382B2 (en) Redundant system
JP2004032452A (en) System changing method and system of cluster-configured machines
CN102546313B (en) Multi-activation detection method and multi-activation detection device
CN113794765A (en) Gate load balancing method and device based on file transmission
CN111211927B (en) Resource synchronization method and device
CN114978871A (en) Node switching method and node switching device of service system and electronic equipment
CN114422335A (en) Communication method, communication device, server and storage medium
CN113890880A (en) Method, system, equipment and storage medium for data synchronization among multiple nodes
CN107547257B (en) Server cluster implementation method and device
CN115250232B (en) Configuration method and device of main management port 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