CN110474955B - SDN controller state migration processing method and device - Google Patents

SDN controller state migration processing method and device Download PDF

Info

Publication number
CN110474955B
CN110474955B CN201910620558.2A CN201910620558A CN110474955B CN 110474955 B CN110474955 B CN 110474955B CN 201910620558 A CN201910620558 A CN 201910620558A CN 110474955 B CN110474955 B CN 110474955B
Authority
CN
China
Prior art keywords
state
sdn controller
sub
role
migrated
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
CN201910620558.2A
Other languages
Chinese (zh)
Other versions
CN110474955A (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.)
Ruijie Networks Co Ltd
Original Assignee
Ruijie Networks 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 Ruijie Networks Co Ltd filed Critical Ruijie Networks Co Ltd
Priority to CN201910620558.2A priority Critical patent/CN110474955B/en
Publication of CN110474955A publication Critical patent/CN110474955A/en
Application granted granted Critical
Publication of CN110474955B publication Critical patent/CN110474955B/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
    • H04L49/00Packet switching elements
    • H04L49/70Virtual switches
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/142Managing session states for stateless protocols; Signalling session states; State transitions; Keeping-state mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/148Migration or transfer of sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • H04L67/5682Policies or rules for updating, deleting or replacing the stored data

Abstract

The embodiment of the invention provides a method and a device for processing state migration of an SDN controller. The method comprises the following steps: splitting a detachable state in an SDN controller state machine based on an OpenFlow protocol into a starting sub-state and a finishing sub-state which correspond to each other; if the fact that the SDN controller meets preset conditions is judged and known, updating the current state of the SDN controller, wherein the preset conditions are that the current state of the SDN controller is a starting sub-state, and a to-be-transferred state is a corresponding completion sub-state; otherwise, caching the state to be migrated according to a preset rule. The embodiment of the invention ensures that the starting sub-state of a certain state can only be transferred to the corresponding finishing sub-state by splitting the state so as to solve the problem that the OpenFlow connection performance is influenced by the fact that the state machine cannot express the intermediate process of state transfer and the state transfer result needs to be synchronously waited by threads, and simultaneously solves the problem that the OpenFlow connection state cannot be lost by introducing a state cache mechanism.

Description

SDN controller state migration processing method and device
Technical Field
The embodiment of the invention relates to the technical field of communication, in particular to a method and a device for processing state migration of an SDN controller.
Background
As a new Network innovation architecture, the size, function, control power and flexibility of a Software Defined Network (SDN) are greatly improved compared to a conventional Network, the SDN supports rich physical and virtual Network element device types, and south-bound plug-in (SP) interfacing with Network element devices is also becoming richer and richer, such as an open flow Protocol (OpenFlow), a Network configuration Protocol (Netconf), a remote terminal Protocol (Telnet), a Secure Shell Protocol (SSH), a TR069 Protocol, and a Simple Network Management Protocol (SNMP), where the OpenFlow switch and the SDN controller establish a connection as follows:
first, an OpenFlow switch and an OpenFlow module in an SDN controller establish a TCP connection through a TCP three-way handshake. Then the OpenFlow switch and the SDN controller OpenFlow module perform OpenFlow protocol handshake, including: (1) the SDN controller OpenFlow module and the OpenFlow switch mutually send Hello messages to carry out version negotiation; (2) the SDN controller OpenFlow module sends a Feature request message to request the characteristics of an OpenFlow switch; (3) and the OpenFlow switch returns a Feature reply message to the controller. After the three procedures are completed, the OpenFlow protocol handshake is successful. And then, the SDN controller OpenFlow module performs role election, and elects a Master controller Master and a Slave controller Slave. Wherein, the process of electing Master includes: A. the role is sent to the OpenFlow switch. B. And informing the SDN controller device management module of online of the device. The process of electing the Slave comprises the following steps: the role is sent to the OpenFlow switch.
The disconnection between the OpenFlow switch and the SDN controller comprises the following steps: the method comprises two forms of OpenFlow switch disconnection and OpenFlow controller disconnection, wherein the OpenFlow switch disconnection process comprises the following steps: A. the OpenFlow switch initiates the disconnection of the TCP connection; B. and the SDN controller OpenFlow module detects that the TCP is disconnected, deletes the context information and informs the SDN controller device management module of the device offline. The process of disconnecting the OpenFlow connection by the SDN controller comprises the following steps: A. deleting OpenFlow switch information by the SDN controller equipment management module; B. and the SDN controller OpenFlow module disconnects the TCP connection and deletes the context information.
The above process is represented by a state transition diagram as shown in fig. 1, in which: the connected state Connect state represents a TCP handshake successful state and an OpenFlow protocol handshake successful state, the Slave state represents that the SDN controller elects the SDN device to become the Slave state, the Master state represents that the SDN controller elects the SDN device to become the Master state, and the Disconnected state represents a disconnection state of the SDN controller and the OpenFlow device.
However, the state transition diagram shown in fig. 1 does not indicate the intermediate process of the state, for example, from Connect state to Master state, the following two steps are required: A. sending the role to an OpenFlow switch; B. and informing the SDN controller device management module of online of the device. In the process of state transition, it is required to ensure that the state can be set as Master after the processing of the above two steps is completed, and meanwhile, the state cannot be interrupted by other events in the above two steps, that is, the state can be transferred to Disconnected or Slave only after the state becomes Master.
In order to solve the above problems, the prior art solutions are: and a single-thread synchronous waiting result mode is used, namely, all state transitions are processed through a single thread for the same equipment, and meanwhile, the state transition result is synchronously waited, and only after the state transition is finished, the thread carries out the processing of the next state transition. However, in the state migration process of the SDN controller based on the OpenFlow protocol, interaction with the OpenFlow device is required, for example, from a Connect state to a Master state, a role needs to be sent to the OpenFlow switch and a device needs to be waited to return, and a synchronous waiting result affects the performance of the SDN network.
Disclosure of Invention
Aiming at the defects in the prior art, the embodiment of the invention provides a method and a device for processing state migration of an SDN controller.
In a first aspect, an embodiment of the present invention provides a method for processing state migration of an SDN controller, where the method includes:
splitting a detachable state in an SDN controller state machine based on an OpenFlow protocol into a starting sub-state and a finishing sub-state which correspond to each other;
if the fact that the SDN controller meets preset conditions is judged and obtained, updating the current state of the SDN controller to be a to-be-transferred state, wherein the preset conditions are that the current state of the SDN controller is a starting sub-state, and the to-be-transferred state is a completion sub-state corresponding to the starting sub-state;
and if the SDN controller is judged to be not met with the preset conditions, caching the state to be migrated according to a preset rule.
As in the foregoing method, optionally, the splitting the separable state of the SDN controller state machine based on the OpenFlow protocol into a starting sub-state and a completing sub-state that correspond to each other includes:
splitting a connected state in an SDN controller state machine based on an OpenFlow protocol into a connecting sub-state and a connection completion sub-state, wherein the connecting sub-state represents that TCP protocol handshaking between the SDN controller and an OpenFlow switch is completed, and the connection completion sub-state represents that OpenFlow protocol handshaking between the SDN controller and the OpenFlow switch is completed;
correspondingly, if it is determined that the SDN controller does not satisfy the preset condition, caching the state to be migrated according to a preset rule, including:
if the current state of the SDN controller is the sub-state in connection and the state to be transferred is a disconnected state in the SDN controller state machine, caching the disconnected state;
otherwise, discarding the state to be migrated.
As above method, optionally, after updating the current state of the SDN controller, the method further includes:
if the cached connection disconnected state is judged to be known, updating the current state of the SDN controller to be the connection disconnected state;
otherwise, judging whether other starting sub-states except the sub-state in connection are cached or not;
and if so, updating the current state of the SDN controller to be the other starting sub-states.
The method as described above, optionally, further includes:
if the current state of the SDN controller is judged and known to be the completion sub-state and the state to be migrated is the disconnected state, updating the current state of the SDN controller to be the disconnected state;
otherwise, judging whether the state to be migrated is in other starting sub-states except the sub-state in connection;
and if so, updating the current state of the SDN controller to be the other starting sub-states, otherwise, discarding the state to be migrated.
As in the foregoing method, optionally, the splitting the detachable state of the SDN controller state machine based on the OpenFlow protocol into a starting sub-state and a completing sub-state that correspond to each other further includes:
splitting a controller role state in an SDN controller state machine based on an OpenFlow protocol into a role starting sub-state and a role completing sub-state, wherein the role starting sub-state represents that the SDN controller sends a role to be set to a corresponding OpenFlow switch, and the role completing sub-state represents that the SDN controller receives a completed result returned by the OpenFlow switch;
correspondingly, if it is determined that the SDN controller does not satisfy the preset condition, caching the state to be migrated according to a preset rule, including:
if the current state of the SDN controller is a role starting sub-state and the state to be migrated is a disconnected state in a state machine of the SDN controller, caching the disconnected state;
otherwise, if the state to be migrated is the role starting sub-state, caching the role starting sub-state,
otherwise, discarding the state to be migrated.
Optionally, as in the foregoing method, if the state to be migrated is a role starting substate, caching the role starting substate, where the caching includes:
if the state to be migrated is the same as the current state and is a role starting sub-state, judging whether other role starting sub-states are cached;
if the other role starting sub-states are cached, deleting the other role starting sub-states from the cache, and discarding the state to be migrated;
and if the other roles are not cached to start the sub-state, directly discarding the state to be migrated.
In a second aspect, an embodiment of the present invention provides an SDN controller state migration processing apparatus, including:
the split module is used for splitting a split state in an SDN controller state machine based on an OpenFlow protocol into a starting sub-state and a finishing sub-state which correspond to each other;
the updating module is used for updating the current state of the SDN controller into a to-be-migrated state if the SDN controller is judged to meet a preset condition, wherein the preset condition is that the current state of the SDN controller is a starting sub-state, and the to-be-migrated state is a completed sub-state corresponding to the starting sub-state;
and the cache module is used for caching the state to be migrated according to a preset rule if judging that the SDN controller does not meet the preset condition.
As with the above apparatus, optionally, the splitting module is specifically configured to:
splitting a connected state in an SDN controller state machine based on an OpenFlow protocol into a connecting sub-state and a connection completion sub-state, wherein the connecting sub-state represents that TCP protocol handshaking between the SDN controller and an OpenFlow switch is completed, and the connection completion sub-state represents that OpenFlow protocol handshaking between the SDN controller and the OpenFlow switch is completed;
correspondingly, the cache module is specifically configured to:
if the current state of the SDN controller is the sub-state under connection and the state to be migrated is a disconnected state in the SDN controller state machine, caching the disconnected state;
otherwise, discarding the state to be migrated.
As with the apparatus described above, optionally, the splitting module is specifically configured to:
splitting a controller role state in an SDN controller state machine based on an OpenFlow protocol into a role starting sub-state and a role completing sub-state, wherein the role starting sub-state represents that the SDN controller sends a role to be set to a corresponding OpenFlow switch, and the role completing sub-state represents that the SDN controller receives a completed result returned by the OpenFlow switch;
correspondingly, the cache module is specifically configured to:
if the current state of the SDN controller is a role starting sub-state and the state to be migrated is a disconnected state in an SDN controller state machine, caching the disconnected state;
otherwise, if the state to be migrated is the role starting sub-state, caching the role starting sub-state,
otherwise, discarding the state to be migrated.
As with the above apparatus, optionally, the cache module includes:
the judging unit is used for judging whether other role starting sub-states are cached or not if the state to be migrated is the current state and is the role starting sub-state;
a deleting unit, configured to delete the other role starting sub-state from the buffer if the other role starting sub-state is cached, and discard the to-be-migrated state;
and the discarding unit is used for directly discarding the state to be migrated if the other roles are not cached to start the sub-state.
According to the SDN controller state migration processing method provided by the embodiment of the invention, the state machine can represent the intermediate process of the state by splitting the state, the starting sub-state of a certain state can only be migrated to the corresponding finishing sub-state, the problem that the OpenFlow connection performance of the controller is influenced because the state machine cannot represent the intermediate process of state migration and the state migration result needs to be synchronously waited by a thread is solved, and meanwhile, the problem that the OpenFlow connection state cannot be lost is solved by introducing a state cache mechanism.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of state transition of an SDN controller based on an OpenFlow protocol in the prior art;
fig. 2 is a schematic flowchart of a state transition processing method for an SDN controller according to an embodiment of the present invention;
fig. 3 is a schematic diagram of connection state transition in the SDN controller state transition processing method according to the embodiment of the present invention;
fig. 4 is a schematic diagram of state transition of an SDN controller according to an embodiment of the present invention;
fig. 5 is a schematic diagram of Connected state migration in the SDN controller state migration processing method according to the embodiment of the present invention;
fig. 6 is a schematic diagram illustrating becoming master state migration in the SDN controller state migration processing method according to the embodiment of the present invention;
fig. 7 is a schematic diagram of state transition of a BeMaster in the SDN controller state transition processing method according to the embodiment of the present invention;
fig. 8 is a schematic diagram of becoming slave state transition in the SDN controller state transition processing method according to the embodiment of the present invention;
fig. 9 is a schematic diagram of state transition of a BeSlave in a SDN controller state transition processing method according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an SDN controller state migration processing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 2 is a schematic flow diagram of a state transition processing method of an SDN controller according to an embodiment of the present invention, and as shown in fig. 2, the method includes:
step S21, splitting a detachable state in an SDN controller state machine based on an OpenFlow protocol into a starting sub-state and a finishing sub-state which correspond to each other;
specifically, as shown in fig. 1, the states in the SDN controller state machine based on the OpenFlow protocol include: connected state Connect, connected Disconnected state Disconnected and role state, the role state includes Master controller state Master and Slave controller state Slave again, wherein, the state that has the intermediate process is removable state, includes: connected state Connect, Master status Master and Slave status Slave, etc. In these detachable states, all intermediate processes must be completed before migration into other states is possible. In order to solve the problem that a state machine cannot represent an intermediate process of state migration in the prior art, which results in that a thread is required to synchronously wait for a state migration result to affect the OpenFlow connection performance of an SDN controller, in an embodiment of the present invention, the SDN controller splits two sub-states based on each split state in the OpenFlow protocol state machine, where the split sub-states are a start sub-state and a finish sub-state corresponding to the state, respectively, where the start sub-state represents that an event corresponding to the state is triggered to occur, and the finish sub-state represents that an end event corresponding to the state is finished.
After the detachable state of the SDN controller is detached, the SDN controller can determine the current state and the state to be migrated of the SDN controller according to the corresponding trigger event.
Step 22, if it is determined that the SDN controller meets a preset condition, updating a current state of the SDN controller to be a to-be-migrated state, where the preset condition is that the current state of the SDN controller is a starting sub-state, and the to-be-migrated state is a completing sub-state corresponding to the starting sub-state;
step S23, if it is determined that the SDN controller does not satisfy the preset condition, caching the state to be migrated according to a preset rule.
In the state transition process, the state can be set to other states only after all steps in the state of the intermediate process are processed, and meanwhile, the steps cannot be interrupted by other events, so that the starting sub-state of each state can be set to be only transited to the corresponding completion sub-state. Specifically, when the SDN controller determines that the current state is a certain starting sub-state and the to-be-migrated state is a completing sub-state corresponding to the starting sub-state, updating the current state of the SDN controller, and setting the current state as the completing sub-state, otherwise, caching the to-be-migrated state by the SDN controller according to a preset rule.
For example, the current state of the SDN controller is a starting sub-state of a connected state, at which time the SDN controller has not established a complete connection with the OpenFlow switch yet and cannot migrate to other states. The migration to the connected state is possible only if the to-be-migrated state is a completed substate of the state. Meanwhile, in order to avoid state loss in the migration process, other states to be migrated are cached according to a preset rule, and the cached migration state is processed after the current state is updated to the corresponding completion sub-state.
According to the SDN controller state migration processing method provided by the embodiment of the invention, the state machine can represent the intermediate process of the state by splitting the state, the starting sub-state of a certain state can only be migrated to the corresponding finishing sub-state, the problem that the OpenFlow connection performance of the controller is affected by the fact that the state machine cannot represent the intermediate process of state migration and the state migration result needs to be synchronously waited by a thread is solved, and meanwhile, the problem that the OpenFlow connection state cannot be lost is solved by introducing a state cache mechanism.
On the basis of the foregoing embodiment, further splitting the detachable state of the SDN controller state machine based on the OpenFlow protocol into a starting sub-state and a completing sub-state corresponding to each other includes:
splitting a connected state in an SDN controller state machine based on an OpenFlow protocol into a connecting sub-state and a connection completion sub-state, wherein the connecting sub-state represents that TCP protocol handshaking between the SDN controller and an OpenFlow switch is completed, and the connection completion sub-state represents that OpenFlow protocol handshaking between the SDN controller and the OpenFlow switch is completed;
correspondingly, if it is determined that the SDN controller does not satisfy the preset condition, caching the state to be migrated according to a preset rule, including:
if the current state of the SDN controller is the sub-state in connection and the state to be transferred is a disconnected state in the SDN controller state machine, caching the disconnected state;
otherwise, discarding the state to be migrated.
Specifically, since the connected state Connect in the SDN controller includes: two steps of TCP protocol handshaking between the SDN controller and the OpenFlow switch and OpenFlow protocol handshaking between the SDN controller and the OpenFlow switch are performed, so that the Connected state can be split into a Connecting sub-state Connecting and a Connecting completed sub-state Connected, wherein the Connecting state represents that TCP protocol handshaking between the SDN controller and the OpenFlow switch is completed, and the Connected state represents that OpenFlow protocol handshaking between the SDN controller and the OpenFlow switch is completed.
After the Connect state is split into a Connecting state and a Connected state, when a TCP protocol handshake completion message between the SDN controller and an OpenFlow switch is received, the current state is determined to be the Connecting state, if the state to be migrated is the Connected state, the current state is updated to be the Connected state, if the state to be migrated is a Disconnected state in an SDN controller state machine, the Disconnected state is cached, and if the other states are discarded. The SDN controller is guaranteed to be migrated to other states only after the OpenFlow protocol handshaking between the SDN controller and the OpenFlow switch is completed, and the SDN network performance is improved.
For example, fig. 3 is a schematic diagram of a connection state transition in the SDN controller state transition processing method according to the embodiment of the present invention, and as shown in fig. 3, step S301 determines that a current state is a connection state; step S302, judging whether the state is transferred to a Connected state, if so, executing step S303, otherwise, jumping to step S304; step S303, setting the current state of the SDN controller to be a Connected state; step S304, judging whether the state is transited to the Disconnected state, if so, executing the step S305, otherwise, jumping to the step S306; step S305, caching the Disconnected state; step S306, discarding the state.
On the basis of the foregoing embodiments, further, after the updating the current state of the SDN controller, the method further includes:
if the cached disconnected connection state is judged and known, updating the current state of the SDN controller to be the disconnected connection state;
otherwise, judging whether other starting sub-states except the sub-state being connected are cached or not;
and if so, updating the current state of the SDN controller to be the other starting sub-states.
Specifically, after the current state of the SDN controller is updated, it is first determined whether a cached state exists, and if the cached state exists, the cached state is processed first and then the state to be migrated is processed, so that the state loss is avoided. Specifically, it is first determined whether a Disconnected state Disconnected is cached, and if yes, the current state of the SDN controller is updated to a Disconnected state. Otherwise, judging whether other starting sub-states except the Connecting state are cached, if so, updating the current state of the SDN controller to be the other starting sub-states, and migrating to the other states. In the embodiment of the invention, when the state is in the starting sub-state, if the state transition occurs at the moment, the state to be transitioned is cached, and the waiting state is switched to the corresponding finishing sub-state for processing, so that the state loss in the state transition process is avoided.
On the basis of the above embodiments, further, the method further includes:
if the current state of the SDN controller is judged and known to be the completion sub-state and the state to be transferred is the connection disconnected state, updating the current state of the SDN controller to be the connection disconnected state;
otherwise, judging whether the state to be migrated is in other starting sub-states except the sub-state in connection;
and if so, updating the current state of the SDN controller to be the other starting sub-states, and otherwise, discarding the state to be migrated.
Specifically, when the current state of the SDN controller is a completed sub-state, it indicates that a certain state is completed, and the SDN controller may be migrated to another state, and in all the states to be migrated, it is first determined whether the state to be migrated is a Disconnected state, if yes, the current state of the SDN controller is updated to be a Disconnected state, otherwise, it is determined whether the state to be migrated is another starting sub-state other than the Connecting state, if yes, the current state of the SDN controller is updated to be another starting sub-state, and otherwise, the state to be migrated is discarded. Because the SDN controller is already in the completed sub-state, which indicates that the SDN controller has at least established a connection with the OpenFlow switch, a Connecting state does not occur any more at this time, and because each detachable state must be migrated to the completed sub-state through the starting sub-state, it is only necessary to determine whether the state to be migrated is another starting sub-state subsequently, and if not, the state is directly discarded, thereby avoiding an intermediate process of losing the detachable state.
On the basis of the foregoing embodiments, further, the splitting the detachable state of the SDN controller state machine based on the OpenFlow protocol into a starting sub-state and a completing sub-state corresponding to each other further includes:
splitting a controller role state in an SDN controller state machine based on an OpenFlow protocol into a role starting sub-state and a role completing sub-state, wherein the role starting sub-state represents that the SDN controller sends a role to be set to a corresponding OpenFlow switch, and the role completing sub-state represents that the SDN controller receives a completed result returned by the OpenFlow switch;
correspondingly, if it is determined that the SDN controller does not satisfy the preset condition, caching the state to be migrated according to a preset rule, including:
if the current state of the SDN controller is a role starting sub-state and the state to be migrated is a disconnected state in a state machine of the SDN controller, caching the disconnected state;
otherwise, if the state to be migrated is the role starting sub-state, caching the role starting sub-state,
otherwise, discarding the state to be migrated.
Specifically, as shown in fig. 1, the controller role states in the SDN controller state machine based on the OpenFlow protocol include a Master controller state Master and a Slave controller state Slave, and the two controller role states may be split into a role starting sub-state and a role completing sub-state, where the role starting sub-state indicates that the SDN controller sends a role to be set to a corresponding OpenFlow switch, and the role completing sub-state indicates that the SDN controller receives a result that the OpenFlow switch returns a completed result. For example, the Master state is split into a main controller role starting sub-state BecomingMaster and a main controller role completing sub-state BecomingMaster, wherein the BecomingMaster state indicates that the SDN controller elects the device role as the Master, the Master role is sent to the corresponding OpenFlow switch, and the BeMaster state indicates that the SDN controller receives a completed result returned by the OpenFlow switch and informs the device of a state after the device is completed online. The Slave state is divided into a Slave controller role starting sub state BecomingSlave and a Slave master controller role finishing sub state BecomingSlave, wherein the BecomingSlave state indicates that the SDN controller elects a device role to be a Slave, the Slave role is sent to a corresponding OpenFlow switch, and the BeSlave state indicates that the SDN controller receives a state after the completion result is returned by the OpenFlow switch.
Fig. 4 is a schematic state transition diagram of an SDN controller according to an embodiment of the present invention, and as can be seen from comparison with fig. 1, according to the embodiment of the present invention, an original Connect state is split into a Connecting state and a Connected state, a Master state is split into a becoming Master state and a BeMaster state, and a Slave state is split into a becoming Slave state and a becoming Slave state, and the Connecting state is set to only be transitioned to the Connected state, the becoming Master state is only transitioned to the BeMaster state, and the becoming Slave state is only transitioned to the becoming Slave state, so that a state machine can represent an intermediate process of the detachable state, and integrity of the state is ensured. When the SDN controller state is in a Connecting state, a becoming slave state, or a becoming master state, if state transition occurs at this time, the state is cached, and a caching rule may be preset: the Connecting state caches a unconnected state, the BecomingSlave state caches a BecomingMaster state and a unconnected state, and the BecomingMaster state caches a BecomingSlave state and a unconnected state. And switching the waiting state to a Connected state, a BeSlave state and a BeMaster state, and then processing, wherein the thread does not need synchronous waiting in the switching process from the Connecting state to the Connected state, the switching process from the BecomingSlave state to the BeSlave state and the switching process from the BecomingMaster state to the BeMaster state, and the asynchronous waiting result in the state switching process is supported. When the current state of the SDN controller is a role starting sub-state and a to-be-migrated state is not a corresponding role completing sub-state, firstly judging that the to-be-migrated state is a Disconnected state, and if so, caching the Disconnected state; otherwise, continuously judging whether the state to be migrated is the role starting sub-state, if so, caching, and if not, for example, the role completing sub-state, discarding.
For example, if the current state is the becoming master state and the state to be migrated is the becoming slave state, the becoming slave state is buffered, and if the current state is the becoming master state and the state to be migrated is the becoming slave state, the becoming slave state is discarded.
On the basis of the foregoing embodiments, further, if the to-be-migrated state is a role start substate, caching the role start substate includes:
if the state to be migrated is the same as the current state and is a role starting sub-state, judging whether other role starting sub-states are cached or not;
if the other role starting sub-states are cached, deleting the other role starting sub-states from the cache, and discarding the state to be migrated;
and if the other roles are not cached to start the sub-state, directly discarding the state to be migrated.
Specifically, when the current state of the SDN controller is a role starting sub-state and the to-be-migrated state is not a corresponding role completion sub-state, the role starting sub-state is cached, if the to-be-migrated state is the same as the current state and is a certain role starting sub-state, it is determined whether other role starting sub-states are cached, if so, the other role starting sub-states are deleted, state merging is performed, and the speed of state migration processing is increased. Since the current state is the same as the state to be migrated, the state to be migrated also needs to be discarded after the state merging. And if the state to be migrated is the same as the current state, namely a certain role starting sub-state, and other role starting sub-states are not cached, directly discarding the state to be migrated.
For example, if the Disconnected state is cached in the becoming slave state, only the Disconnected state is processed, and if the becoming master state is cached and the state to be migrated is the becoming slave state, the becoming master state is deleted. And if the BecomingMaster state caches the Disconnected state, only processing the Disconnected state, and if the BecomingSlave state caches the BecomingSlave state and the state to be migrated is the BecomingMaster state, deleting the BecomingSlave state.
The following illustrates the migration process of each state.
Fig. 5 is a schematic diagram of Connected state transition in the SDN controller state transition processing method provided by the embodiment of the present invention, and as shown in fig. 5, the Connected state transition step includes:
step S501, determining that the current state is a Connected state;
step S502, judging whether the Disconnected state is cached, if yes, executing step S503, otherwise, jumping to step S504;
step S503, setting the current state as Disconnected state;
step S504, judge whether the state shifts to the Disconnected state, if it is to carry out step S505, otherwise jump to step S506;
step S505, setting the current state as Disconnected state;
step S506, judging whether the state is transited to the BecomingMaster state, if so, executing the step S507, otherwise, jumping to the step S508;
step S507, setting the current state as BecomingMaster state;
and step S508, judging whether the state is transited to the BecomingSlave state, if so, executing the step S509, otherwise, jumping to the step S510.
Step S509, setting the current state to be the becoming slave state;
step S510, discarding the state.
Fig. 6 is a schematic diagram of becoming master state transition in the SDN controller state transition processing method provided by the embodiment of the present invention, and as shown in fig. 6, the becoming master state transition step includes:
step S601, determining that the current state is a BecomingMaster state;
step S602, judging whether the state is transferred to the BeMaster state, if so, executing step S603, otherwise, jumping to step S604;
step S603, setting the current state as a BeMaster state;
step S604, judging whether the state is transited to the Disconnected state, if so, executing the step S605, otherwise, jumping to the step S606;
step S605, caching Disconnected state;
step S606, judging whether the state is transited to the BecomingSlave state, if so, executing the step S607, otherwise, jumping to the step S608;
step S607, caching BecomingSlave state;
step S608, judging whether the state is transferred to the BecomingMaster state, if so, executing the step S609, otherwise, jumping to the step S611;
step S609, judging whether the BecomingSlave state is cached, if so, executing the step S610, otherwise, jumping to the step S611;
step S610, carrying out state merging and deleting BecomingSlave state cache;
step S611, discard the state.
Fig. 7 is a schematic diagram of a BeMaster state migration in a state migration processing method for an SDN controller according to an embodiment of the present invention, and as shown in fig. 7, the step of the BeMaster state migration includes:
step S701, determining that the current state is a BeMaster state;
step S702, judging whether a cache state exists, if so, executing step S703, otherwise, jumping to step S704;
s703, changing the current state of the SDN controller into a cached state, namely, migrating the state of the SDN controller to the cached state;
step S704, judging whether the state is transited to the Disconnected state, if so, executing step S705, otherwise, jumping to step S706;
step S705, setting the current state as Disconnected state;
step S706, judging whether the state is transferred to the BecomingSlave state, if so, executing step S707, otherwise, jumping to step S708;
s707, setting the current state as a BecomingSlave state;
and S708, discarding the state.
Fig. 8 is a schematic diagram of becoming slave state transition in the SDN controller state transition processing method provided in the embodiment of the present invention, and as shown in fig. 8, the becoming slave state transition step includes:
step S801, determining that the current state is a BecomingSlave state;
step S802, judging whether the state is transferred to a BeSlave state, if so, executing the step S803, otherwise, jumping to the step S804;
step S803, setting the current state as a BeSlave state;
step S804, judging whether the state is transferred to the Disconnected state, if so, executing the step S805, otherwise, jumping to the step S806;
step S805, caching the Disconnected state;
step S806, judging whether the state is transited to the BecomingMaster state, if so, executing the step S807, otherwise, jumping to the step S808;
step S807, caching BecomingMaster state;
step S808, judging whether the state is transited to the BecomingSlave state, if so, executing step S809, otherwise, jumping to step S811;
step 809, judging whether the BecomingMaster state is cached, if so, executing step 810, otherwise, jumping to step 811;
step S810, carrying out state merging, and deleting BecomingMaster state cache;
step S811, discard state.
Fig. 9 is a schematic diagram of state migration of a bessel in the SDN controller state migration processing method provided in the embodiment of the present invention, and as shown in fig. 9, the step of state migration of the bessel includes:
step S901, determining that the current state is a BeSlave state;
step S902, judging whether a cache state exists, if so, executing step S903, otherwise, jumping to step S904;
step S903, updating the current state, and migrating the SDN controller state to a cache state;
step S904, judging whether the state is transited to the Disconnected state, if so, executing the step S905, otherwise, jumping to the step S906;
step S905, setting the current state as a Disconnected state;
step S906, judging whether the state is transferred to the BecomingMaster state, if so, executing step S907, otherwise, jumping to step S908;
s907, setting the current state as BecomingMaster state;
s908, discard state.
Based on the same inventive concept, an embodiment of the present invention further provides an SDN controller state migration processing apparatus, as shown in fig. 10, the apparatus includes: a splitting module 101, an updating module 102 and a caching module 103, wherein:
the splitting module 101 is configured to split a split state in an SDN controller state machine based on an OpenFlow protocol into a starting sub-state and a completing sub-state that correspond to each other; the updating module 102 is configured to update a current state of the SDN controller to be a to-be-migrated state if it is determined that the SDN controller meets a preset condition, where the preset condition is that the current state of the SDN controller is a starting sub-state, and the to-be-migrated state is a completing sub-state corresponding to the starting sub-state, and update the current state of the SDN controller; the caching module 103 is configured to cache the state to be migrated according to a preset rule if it is determined that the SDN controller does not meet the preset condition.
Optionally, the splitting module is specifically configured to:
splitting a connected state in an SDN controller state machine based on an OpenFlow protocol into a connecting sub-state and a connection completion sub-state, wherein the connecting sub-state represents that TCP protocol handshaking between the SDN controller and an OpenFlow switch is completed, and the connection completion sub-state represents that OpenFlow protocol handshaking between the SDN controller and the OpenFlow switch is completed;
correspondingly, the cache module is specifically configured to:
if the current state of the SDN controller is the sub-state in connection and the state to be transferred is a disconnected state in the SDN controller state machine, caching the disconnected state;
otherwise, discarding the state to be migrated.
Optionally, the splitting module is specifically configured to:
splitting a controller role state in an SDN controller state machine based on an OpenFlow protocol into a role starting sub-state and a role completing sub-state, wherein the role starting sub-state represents that the SDN controller sends a role to be set to a corresponding OpenFlow switch, and the role completing sub-state represents that the SDN controller receives a completed result returned by the OpenFlow switch;
correspondingly, the cache module is specifically configured to:
if the current state of the SDN controller is a role starting sub-state and the state to be migrated is a disconnected state in a state machine of the SDN controller, caching the disconnected state;
otherwise, if the state to be migrated is the role starting sub-state, caching the role starting sub-state,
otherwise, discarding the state to be migrated.
Optionally, the cache module includes:
the judging unit is used for judging whether other role starting sub-states are cached or not if the state to be migrated is the current state and is the role starting sub-state;
a deleting unit, configured to delete the other role starting sub-state from the buffer and discard the to-be-migrated state if the other role starting sub-state is cached;
and the discarding unit is used for directly discarding the state to be migrated if the other roles are not cached to start the sub-state. The apparatus provided in the embodiment of the present invention is configured to implement the method, and its functions specifically refer to the method embodiment, which is not described herein again.
The SDN controller state migration processing apparatus provided in the embodiment of the present invention enables a state machine to represent an intermediate process of a state by splitting the state, ensures that a starting sub-state of a certain state can only be migrated to a corresponding completing sub-state, solves a problem that an OpenFlow connection performance of a controller is affected by a state migration result that a thread is required to wait for state migration in synchronization because the state machine cannot represent the intermediate process of state migration, and solves a problem that an OpenFlow connection state cannot be lost by introducing a state cache mechanism.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The above-described embodiments of the apparatuses and the like are merely illustrative, where the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, and are not limited thereto; although embodiments of the present invention have been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (8)

1. A SDN controller state migration processing method is characterized by comprising the following steps:
splitting a detachable state in an SDN controller state machine based on an OpenFlow protocol into a starting sub-state and a finishing sub-state which correspond to each other;
if the fact that the SDN controller meets preset conditions is judged and obtained, updating the current state of the SDN controller to be a to-be-transferred state, wherein the preset conditions are that the current state of the SDN controller is a starting sub-state, and the to-be-transferred state is a completion sub-state corresponding to the starting sub-state;
if the fact that the SDN controller does not meet the preset conditions is judged and known, caching the state to be migrated according to preset rules;
the splitting of the split state of the SDN controller state machine based on the OpenFlow protocol into a starting sub-state and a completing sub-state that correspond to each other includes:
splitting a connected state in an SDN controller state machine based on an OpenFlow protocol into a connecting sub-state and a connection completion sub-state, wherein the connecting sub-state represents that TCP protocol handshaking between the SDN controller and an OpenFlow switch is completed, and the connection completion sub-state represents that OpenFlow protocol handshaking between the SDN controller and the OpenFlow switch is completed; correspondingly, if it is determined that the SDN controller does not satisfy the preset condition, caching the state to be migrated according to a preset rule, including:
if the current state of the SDN controller is the sub-state in connection and the state to be transferred is a disconnected state in the SDN controller state machine, caching the disconnected state;
otherwise, discarding the state to be migrated.
2. The method of claim 1, wherein after updating the current state of the SDN controller, further comprising:
if the cached connection disconnected state is judged to be known, updating the current state of the SDN controller to be the connection disconnected state;
otherwise, judging whether other starting sub-states except the sub-state being connected are cached or not;
and if so, updating the current state of the SDN controller to be the other starting sub-states.
3. The method of claim 2, further comprising:
if the current state of the SDN controller is judged and known to be the completion sub-state and the state to be transferred is the connection disconnected state, updating the current state of the SDN controller to be the connection disconnected state;
otherwise, judging whether the state to be migrated is in other starting sub-states except the sub-state in connection;
and if so, updating the current state of the SDN controller to be the other starting sub-states, otherwise, discarding the state to be migrated.
4. The method according to any one of claims 1 to 3, wherein the splitting the separable state of the SDN controller state machine based on the OpenFlow protocol into a pair of a start sub-state and a completion sub-state corresponding to each other, further comprises:
splitting a controller role state in an SDN controller state machine based on an OpenFlow protocol into a role starting sub-state and a role completing sub-state, wherein the role starting sub-state represents that the SDN controller sends a role to be set to a corresponding OpenFlow switch, and the role completing sub-state represents that the SDN controller receives a completed result returned by the OpenFlow switch;
correspondingly, if it is determined that the SDN controller does not satisfy the preset condition, caching the state to be migrated according to a preset rule, including:
if the current state of the SDN controller is a role starting sub-state and the state to be migrated is a disconnected state in an SDN controller state machine, caching the disconnected state;
otherwise, if the state to be migrated is the role starting sub-state, caching the role starting sub-state, otherwise, discarding the state to be migrated.
5. The method of claim 4, wherein if the to-be-migrated state is a role start substate, caching the role start substate, comprises:
if the state to be migrated is the same as the current state and is a role starting sub-state, judging whether other role starting sub-states are cached;
if the other role starting sub-state is cached, deleting the other role starting sub-state from the cache, and discarding the state to be migrated;
and if the other roles are not cached to start the sub-state, directly discarding the state to be migrated.
6. An SDN controller state migration processing apparatus, comprising:
the split module is used for splitting a split state in an SDN controller state machine based on an OpenFlow protocol into a starting sub-state and a finishing sub-state which correspond to each other;
the updating module is used for updating the current state of the SDN controller into a to-be-migrated state if the SDN controller is judged to meet a preset condition, wherein the preset condition is that the current state of the SDN controller is a starting sub-state, and the to-be-migrated state is a completed sub-state corresponding to the starting sub-state;
the cache module is used for caching the state to be migrated according to a preset rule if judging that the SDN controller does not meet the preset condition; wherein the splitting module is specifically configured to:
splitting a connected state in an SDN controller state machine based on an OpenFlow protocol into a connecting sub-state and a connection completion sub-state, wherein the connecting sub-state represents that TCP protocol handshaking between the SDN controller and an OpenFlow switch is completed, and the connection completion sub-state represents that OpenFlow protocol handshaking between the SDN controller and the OpenFlow switch is completed;
correspondingly, the cache module is specifically configured to:
if the current state of the SDN controller is the sub-state in connection and the state to be transferred is a disconnected state in the SDN controller state machine, caching the disconnected state;
otherwise, discarding the state to be migrated.
7. The apparatus of claim 6, wherein the splitting module is specifically configured to:
splitting a controller role state in an SDN controller state machine based on an OpenFlow protocol into a role starting sub-state and a role completing sub-state, wherein the role starting sub-state represents that the SDN controller sends a role to be set to a corresponding OpenFlow switch, and the role completing sub-state represents that the SDN controller receives a completed result returned by the OpenFlow switch;
correspondingly, the cache module is specifically configured to:
if the current state of the SDN controller is a role starting sub-state and the state to be migrated is a disconnected state in an SDN controller state machine, caching the disconnected state;
otherwise, if the state to be migrated is the role starting sub-state, caching the role starting sub-state, otherwise, discarding the state to be migrated.
8. The apparatus of claim 7, wherein the cache module comprises:
the judging unit is used for judging whether other role starting sub-states are cached or not if the state to be migrated is the current state and is the role starting sub-state;
a deleting unit, configured to delete the other role starting sub-state from the buffer if the other role starting sub-state is cached, and discard the to-be-migrated state;
and the discarding unit is used for directly discarding the state to be migrated if the other roles are not cached to start the sub-state.
CN201910620558.2A 2019-07-10 2019-07-10 SDN controller state migration processing method and device Active CN110474955B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910620558.2A CN110474955B (en) 2019-07-10 2019-07-10 SDN controller state migration processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910620558.2A CN110474955B (en) 2019-07-10 2019-07-10 SDN controller state migration processing method and device

Publications (2)

Publication Number Publication Date
CN110474955A CN110474955A (en) 2019-11-19
CN110474955B true CN110474955B (en) 2022-07-19

Family

ID=68507221

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910620558.2A Active CN110474955B (en) 2019-07-10 2019-07-10 SDN controller state migration processing method and device

Country Status (1)

Country Link
CN (1) CN110474955B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112099971B (en) * 2020-09-04 2022-10-25 紫光云(南京)数字技术有限公司 Method for smoothly upgrading SDN controller

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102467414A (en) * 2010-11-19 2012-05-23 阿里巴巴集团控股有限公司 State machine control method, device and state machine system
CN107124300A (en) * 2017-04-01 2017-09-01 西安交通大学 A kind of interchanger moving method in software defined network
CN108683696A (en) * 2018-03-27 2018-10-19 上海宽带技术及应用工程研究中心 Switch status management method and system in SDN controllers based on state machine

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9419874B2 (en) * 2014-03-27 2016-08-16 Nicira, Inc. Packet tracing in a software-defined networking environment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102467414A (en) * 2010-11-19 2012-05-23 阿里巴巴集团控股有限公司 State machine control method, device and state machine system
CN107124300A (en) * 2017-04-01 2017-09-01 西安交通大学 A kind of interchanger moving method in software defined network
CN108683696A (en) * 2018-03-27 2018-10-19 上海宽带技术及应用工程研究中心 Switch status management method and system in SDN controllers based on state machine

Also Published As

Publication number Publication date
CN110474955A (en) 2019-11-19

Similar Documents

Publication Publication Date Title
CN113382026B (en) Data processing method, device, related equipment and storage medium
CN101471940B (en) Method, system and device for synchronizing BGP route
CN110474955B (en) SDN controller state migration processing method and device
WO2017124791A1 (en) Link detecting method and device
WO2011110135A2 (en) Master-standby switching method, system control unit and communication system
JP2015133538A (en) Data transfer unit system, network system and changing method of network system configuration
WO2008064600A1 (en) Method, server and system of virtual role's controlling
WO2011063725A1 (en) Method and system for active-standby synchronization
CN106254251A (en) A kind of RI-Pro method and device
WO2017215408A1 (en) Session switching control method and apparatus and access point device
CN111343019A (en) Reconnection method, reconnection device and storage medium
CN107645394A (en) A kind of exchange configuration method in SDN
WO2016110084A1 (en) Method, device and system for precision time protocol time synchronization in aggregation network
CN110661884A (en) Switching system and method of cloud desktop and local desktop
JP2002044180A (en) Communication system
WO2021203920A1 (en) Network connection method and device for training participant end of common training model
CN111181766B (en) Redundant FC network system and method for realizing dynamic configuration of switch
CN111934912B (en) Hot standby redundancy system of double-host isolation gateway and control method
CN106161243B (en) State reporting control method and device
EP3051804A1 (en) Processing method and device for end point information exchange, and telepresence end point
JP6541490B2 (en) Relay system and switch device
JP2008278208A (en) Visual communication server and communication system
JP2018107744A (en) Communication node, communication system, communication method, and program
CN110120889A (en) Data processing method, equipment and computer storage medium
JP3604380B2 (en) Data relay method, data relay device, and data relay system using the device

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