CN111585796A - Interface switching method, message transmission method and gateway equipment - Google Patents
Interface switching method, message transmission method and gateway equipment Download PDFInfo
- Publication number
- CN111585796A CN111585796A CN202010342825.7A CN202010342825A CN111585796A CN 111585796 A CN111585796 A CN 111585796A CN 202010342825 A CN202010342825 A CN 202010342825A CN 111585796 A CN111585796 A CN 111585796A
- Authority
- CN
- China
- Prior art keywords
- interface
- virtual interface
- virtual
- real
- private data
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 88
- 230000005540 biological transmission Effects 0.000 title claims abstract description 22
- 238000013507 mapping Methods 0.000 claims abstract description 62
- 230000002457 bidirectional effect Effects 0.000 claims description 18
- 238000010586 diagram Methods 0.000 description 30
- 238000012545 processing Methods 0.000 description 20
- 230000006870 function Effects 0.000 description 11
- 238000012986 modification Methods 0.000 description 9
- 230000004048 modification Effects 0.000 description 9
- 230000002159 abnormal effect Effects 0.000 description 6
- 238000004590 computer program Methods 0.000 description 6
- 230000000694 effects Effects 0.000 description 4
- 238000006243 chemical reaction Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000012790 confirmation Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/02—Details
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/66—Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
- H04L41/0813—Configuration setting characterised by the conditions triggering a change of settings
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The invention discloses an interface switching method, a message transmission method and gateway equipment, wherein the interface switching method is applied to the gateway equipment, and the gateway equipment comprises a real interface layer, a service layer and a virtual interface layer positioned between the real interface layer and the service layer; the virtual interface layer comprises at least two virtual interfaces corresponding to the services in the service layer, the gateway device is configured with a callable linked list, the linked list comprises a mapping relation between a real interface and the virtual interface, the virtual interface is configured with first private data of the mapped real interface, and the first private data comprises interface characteristic information of the corresponding real interface; the interface switching method comprises the following steps: determining a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching according to a received interface switching instruction; replacing the first private data currently configured by the target virtual interface with the determined first private data through the virtual interface layer; and updating the mapping relation contained in the linked list.
Description
Technical Field
The present invention relates to the field of communications technologies, and in particular, to an interface switching method, a packet transmission method, and a gateway device.
Background
With the rapid development of communication technology, the use of gateway devices is becoming more and more widespread. The gateway device carries multiple types of interfaces, thereby providing data conversion services among multiple networks.
In the related art, different types of physical interfaces in the gateway device correspond to different services, for example, a Wide Area Network (WAN) interface corresponds to a Dynamic host configuration Protocol Client (DHCP Client for short) and other services; local Area Network (LAN) interface corresponds to services such as loop detection, user terminal information detection, Dynamic Host Configuration Protocol server (DHCP server for short), and the like.
However, since the characteristics of different interfaces vary greatly, many services are associated with the interface type in addition to the necessary network information such as IP, routing, etc. Therefore, the type of the physical interface of the gateway device is generally fixed, and the switching of the interface is difficult to realize.
Disclosure of Invention
The invention provides an interface switching method, a message transmission method and gateway equipment, which are used for realizing interface switching of the gateway equipment.
In a first aspect, an embodiment of the present invention provides an interface switching method, which is applied to a gateway device, where the gateway device includes a real interface layer, a service layer, and a virtual interface layer located between the real interface layer and the service layer and located at the virtual interface layer; the virtual interface layer comprises at least two virtual interfaces corresponding to the services in the service layer, the gateway device is configured with a callable linked list, the linked list comprises a mapping relation between a real interface and the virtual interface, the virtual interface is configured with first private data of the mapped real interface, and the first private data comprises interface characteristic information of the corresponding real interface;
the method comprises the following steps:
determining a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching according to a received interface switching instruction;
replacing, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data; and updating the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface of the first private data and the target virtual interface needing interface switching.
According to the method, a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching are determined through a received interface switching instruction; and then the determined first private data is used for replacing the first private data currently configured by the target virtual interface by the virtual interface layer, so that the switching of the mapping relation of the virtual interface and the real interface is realized, and the switching of the interfaces is also realized. In the whole switching process, the corresponding relation between the virtual interface and the service is not changed, and the service layer cannot sense that the cut is switched, so that the service layer does not need to be concerned with the division of the real interface and the difference generated by different chip schemes, such as the difference between the interface name and the interface type, and further, the abnormal service function state and the modification of a large amount of code logics during cut switching can be avoided. The method also updates the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface and the target virtual interface of the first private data, and can accurately determine the mapped virtual interface after switching according to the updated linked list on the premise that the real interface is not configured with the relevant information of the mapped virtual interface.
In an optional embodiment, the mapping relationship between the real interface and the virtual interface is a mapping relationship between an interface identifier of the real interface and second private data of the virtual interface;
wherein the second private data includes attribute information of the corresponding virtual interface.
In the method, the linked list comprises the mapping relation between the interface identifier of the real interface and the attribute information of the corresponding virtual interface, and the real interface accurately determines the relevant attribute of the virtual interface mapped after switching through the linked list on the premise of not configuring the relevant attribute of the mapped virtual interface.
In an optional embodiment, the replacing, by the virtual interface layer, the first private data currently configured for the virtual interface with the determined first private data includes:
and replacing the first private data currently configured by the target virtual interface with the determined first private data based on the switching type of the interface switching through the virtual interface layer.
According to the method, private data replacement is carried out through the switching type based on interface switching, namely different switching types have different replacement methods, and further, interface switching is carried out adaptively according to different switching scenes.
In an optional embodiment, the handover type includes a bidirectional handover, and the target virtual interface includes a first virtual interface and a second virtual interface; the real interface mapped after the first virtual interface is switched is a first real interface; the real interface mapped after the second virtual interface is switched is a second real interface;
replacing, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data, including:
replacing, by the virtual interface layer, first private data currently configured for the first virtual interface with first private data for the first real interface; replacing the first private data currently configured by the second virtual interface with the first private data of the second real interface; or,
and if the first virtual interface is currently configured with the first private data of the second real interface and the second virtual interface is currently configured with the first private data of the first real interface, exchanging the first private data currently configured with the first virtual interface with the first private data currently configured with the second virtual interface through the virtual interface layer.
In the method, when bidirectional switching is performed, the virtual interface layer can determine the real interfaces respectively mapped after the two virtual interfaces are switched, and directly and respectively configure the private data of the mapped real interfaces for the two virtual interfaces, so that the current first private data can be accurately replaced by the private data of the real interfaces mapped after switching, and the bidirectional switching is completed; the virtual interface layer can also directly exchange the first private data mapped by the two virtual interfaces, thereby conveniently and quickly completing the bidirectional switching.
In an alternative embodiment, the handover type comprises a unidirectional handover;
replacing, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data, including:
searching a virtual interface of the first private data determined by configuration through the virtual interface layer;
and deleting the first private data currently configured by the target virtual interface through the virtual interface layer, and switching the searched first private data configured by the virtual interface to the target virtual interface.
In the method, the virtual interface layer is used for searching the virtual interface configured with the determined first private data, deleting the first private data currently configured with the target virtual interface, switching the searched first private data configured with the virtual interface to the target virtual interface, enabling the target virtual interface to be configured with the determined first private data, and enabling the searched virtual interface to be mapped to the empty-real interface, thereby realizing the unidirectional switching of the interface in the scenes that the real interface is damaged or the form of the real interface is changed, and the like.
In an optional embodiment, the virtual interface layer includes virtual interfaces divided into switchable virtual interfaces and non-switchable virtual interfaces:
the determining a target virtual interface needing interface switching according to the received interface switching instruction includes:
and determining a target virtual interface for interface switching from the switchable virtual interfaces according to the received interface switching instruction.
According to the method, the target virtual interface for interface switching is determined from the switchable virtual interfaces according to the received interface switching instruction, and the non-switchable virtual interface is not limited by the service corresponding to the switchable virtual interface, so that the message can be directly transmitted and received under the condition of not changing service configuration.
In an optional embodiment, the method further comprises:
and after the switching is finished, the virtual interface layer informs the service layer of the switchable virtual interface and the mapped real interface, and the non-switchable virtual interface and the mapped real interface.
In the method, after the switching is completed, the corresponding relation between the virtual interface and the mapped real interface is notified to the service layer through the virtual interface layer, so that the corresponding relation between the current virtual interface and the real interface can be obtained under the condition that the service layer has no corresponding relation with the real interface, and a user can obtain the corresponding relation through the service layer.
In a second aspect, an embodiment of the present invention provides a data transmission method, where the method is applied to a gateway device, where the gateway device includes a real interface layer, a service layer, and a virtual interface layer located between the real interface layer and the service layer; the virtual interface layer comprises at least two virtual interfaces corresponding to services in the service layer, the gateway device is configured with a callable linked list, the linked list comprises a mapping relation between a real interface and the virtual interfaces, the virtual interfaces are configured with first private data of the mapped real interfaces, and the first private data comprises interface characteristic information of the corresponding real interfaces, and the method comprises the following steps:
sending a first message to the virtual interface layer through the service layer; and
determining a target virtual interface corresponding to the received first message of the service layer through the virtual interface layer, and sending the first message to a mapped real interface according to first private data configured by the target virtual interface;
or,
determining a target real interface corresponding to a second message of the other port received through the real interface layer, and determining a virtual interface mapped by the target real interface according to the linked list so that the mapped virtual interface receives the second message; and
and sending the second message to a service layer through the virtual interface layer.
In the method, when the service layer sends the message to the real interface layer, the first message is directly sent to the virtual interface layer through the service layer; determining a corresponding virtual interface through a virtual interface layer, and sending a first message to a mapped real interface according to first private data configured by the virtual interface; when the real interface layer sends a message to the service layer, the real interface corresponding to the second message is determined through the real interface layer, and the mapped virtual interface is determined according to the linked list, so that the mapped virtual interface receives the second message; and sending the second message to the service layer through the virtual interface layer. No matter the service layer sends the message to the real interface layer or the real interface layer sends the message to the service layer, after the interface switching is carried out, the corresponding relation between the virtual interface and the service is not changed, the service layer cannot sense that the cut is switched, the service layer can directly send the message to the virtual interface layer or receive the message sent by the virtual interface layer, and therefore the abnormal service function state and the modification of a large number of code logics during the cut switching can be avoided.
In a third aspect, an embodiment of the present invention provides an interface switching device, where the gateway device includes a processor and at least two interfaces, where the processor performs interface switching through a virtual interface layer located between a real interface layer and a service layer, the virtual interface layer includes at least two virtual interfaces corresponding to services in the service layer, the gateway device is configured with a callable linked list, the linked list includes a mapping relationship between a real interface and a virtual interface, the virtual interface is configured with first private data of a mapped real interface, and the first private data includes interface characteristic information of a corresponding real interface;
the processor is specifically configured to, when performing interface switching through the virtual interface layer:
determining a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching according to a received interface switching instruction;
replacing, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data; and updating the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface of the first private data and the target virtual interface needing interface switching.
In an optional embodiment, the mapping relationship between the real interface and the virtual interface is a mapping relationship between an interface identifier of the real interface and second private data of the virtual interface;
wherein the second private data includes attribute information of the corresponding virtual interface.
In an optional embodiment, the replacing, by the virtual interface layer, the first private data currently configured for the virtual interface with the determined first private data includes:
and replacing the first private data currently configured by the target virtual interface with the determined first private data based on the switching type of the interface switching through the virtual interface layer.
In an optional embodiment, the handover type includes a bidirectional handover, and the target virtual interface includes a first virtual interface and a second virtual interface; the real interface mapped after the first virtual interface is switched is a first real interface; the real interface mapped after the second virtual interface is switched is a second real interface;
replacing, by the virtual interface layer based on the handover type of the interface handover, the first private data currently configured for the target virtual interface with the determined first private data, including:
replacing, by the virtual interface layer, first private data currently configured for the first virtual interface with first private data for the first real interface; replacing the first private data currently configured by the second virtual interface with the first private data of the second real interface; or,
and if the first virtual interface is currently configured with the first private data of the second real interface and the second virtual interface is currently configured with the first private data of the first real interface, exchanging the first private data currently configured with the first virtual interface with the first private data currently configured with the second virtual interface through the virtual interface layer.
In an alternative embodiment, the handover type comprises a unidirectional handover;
replacing, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data, including:
searching a virtual interface of the first private data determined by configuration through the virtual interface layer;
and deleting the first private data currently configured by the target virtual interface through the virtual interface layer, and switching the searched first private data configured by the virtual interface to the target virtual interface.
In an optional embodiment, the virtual interface layer includes virtual interfaces divided into switchable virtual interfaces and non-switchable virtual interfaces:
the determining a target virtual interface needing interface switching according to the received interface switching instruction includes:
and determining a target virtual interface for interface switching from the switchable virtual interfaces according to the received interface switching instruction.
In an optional implementation manner, when performing interface switching through the virtual interface layer, the processor is further configured to:
and after the switching is finished, the virtual interface layer informs the service layer of the switchable virtual interface and the mapped real interface, and the non-switchable virtual interface and the mapped real interface.
In a fourth aspect, an embodiment of the present invention further provides another gateway device, where the gateway includes a processor and at least two interfaces; the processor transmits messages through a real interface layer, a service layer and a virtual interface layer positioned between the real interface layer and the service layer, wherein the virtual interface layer comprises at least two virtual interfaces corresponding to services in the service layer, the gateway is configured with a linked list for the real interface to call, the linked list comprises a mapping relation between the real interface and the virtual interface, the virtual interface is configured with first private data of the mapped real interface, and the first private data comprises interface characteristic information of the corresponding real interface;
when the processor performs packet transmission through the real interface layer, the service layer, and the virtual interface layer, the processor is specifically configured to:
sending a first message to the virtual interface layer through the service layer; and
determining a target virtual interface corresponding to the received first message of the service layer through the virtual interface layer, and sending the first message to a mapped real interface according to first private data configured by the target virtual interface;
or,
determining a target real interface corresponding to a second message of the other port received through the real interface layer, and determining a virtual interface mapped by the target real interface according to the linked list so that the mapped virtual interface receives the second message; and
and sending the second message to a service layer through the virtual interface layer.
In a fifth aspect, an embodiment of the present invention provides an interface switching apparatus, where the apparatus includes: a determining module and a processing module;
the determining module is used for determining a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching according to a received interface switching instruction;
the processing module is used for replacing the first private data currently configured by the target virtual interface with the determined first private data through the virtual interface layer; and updating the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface of the first private data and the target virtual interface needing interface switching.
Optionally, the mapping relationship between the real interface and the virtual interface is a mapping relationship between an interface identifier of the real interface and second private data of the virtual interface;
wherein the second private data includes attribute information of the corresponding virtual interface.
Optionally, the replacing, by the processing module, the first private data currently configured by the virtual interface with the determined first private data through the virtual interface layer includes:
and replacing the first private data currently configured by the target virtual interface with the determined first private data based on the switching type of the interface switching through the virtual interface layer.
Optionally, the handover type includes bidirectional handover, and the target virtual interface includes a first virtual interface and a second virtual interface; the real interface mapped after the first virtual interface is switched is a first real interface; the real interface mapped after the second virtual interface is switched is a second real interface;
the processing module replaces, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data, including:
replacing, by the virtual interface layer, first private data currently configured for the first virtual interface with first private data for the first real interface; replacing the first private data currently configured by the second virtual interface with the first private data of the second real interface; or,
and if the first virtual interface is currently configured with the first private data of the second real interface and the second virtual interface is currently configured with the first private data of the first real interface, exchanging the first private data currently configured with the first virtual interface with the first private data currently configured with the second virtual interface through the virtual interface layer.
Optionally, the handover type comprises a unidirectional handover;
the processing module replaces, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data, including:
searching a virtual interface of the first private data determined by configuration through the virtual interface layer;
and deleting the first private data currently configured by the target virtual interface through the virtual interface layer, and switching the searched first private data configured by the virtual interface to the target virtual interface.
Optionally, the virtual interface included in the virtual interface layer is divided into a switchable virtual interface and a non-switchable virtual interface:
the determining module determines a target virtual interface needing interface switching according to the received interface switching instruction, and includes:
and determining a target virtual interface for interface switching from the switchable virtual interfaces according to the received interface switching instruction.
Optionally, after the switching is completed, the processing module notifies the service layer of the switchable virtual interface and the mapped real interface, and the non-switchable virtual interface and the mapped real interface through the virtual interface layer.
In a sixth aspect, an embodiment of the present invention provides a packet transmission apparatus, where the apparatus includes: the first processing module and the second processing module:
a first processing module, configured to send a first packet to the virtual interface layer through the service layer; and
determining a target virtual interface corresponding to the received first message of the service layer through the virtual interface layer, and sending the first message to a mapped real interface according to first private data configured by the target virtual interface;
the second processing module is used for determining a target real interface corresponding to a second message of the other port through the real interface layer, and determining a virtual interface mapped by the target real interface according to the linked list so that the mapped virtual interface receives the second message; and
and sending the second message to a service layer through the virtual interface layer.
In a seventh aspect, the present application also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of the first aspect.
In an eighth aspect, the present application further provides a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of the second aspect.
In addition, for technical effects brought by any one of the third, fifth, and seventh aspects, reference may be made to technical effects brought by different implementation manners in the first aspect, and details are not described here. The technical effects brought by any one implementation manner of the fourth, sixth, and eighth aspects may refer to the technical effects brought by different implementation manners of the second aspect, and are not described herein again.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise. In the drawings:
fig. 1 is a schematic service logic diagram of a gateway device according to an embodiment of the present invention;
fig. 2 is a schematic diagram of an interface switching method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a linked list according to an embodiment of the present invention;
fig. 4 is a schematic diagram of another interface switching method according to an embodiment of the present invention;
fig. 5 is a schematic diagram of another interface switching method according to an embodiment of the present invention;
fig. 6 is a schematic diagram of another interface switching method according to an embodiment of the present invention;
fig. 7 is a schematic diagram of another interface switching method according to an embodiment of the present invention;
fig. 8 is a schematic diagram of a mapping relationship provided in an embodiment of the present invention;
fig. 9a is a schematic diagram of a message transmission method according to an embodiment of the present invention;
fig. 9b is a schematic diagram of another packet transmission method according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of a gateway device according to an embodiment of the present invention;
fig. 11 is a schematic structural diagram of an interface switching apparatus according to an embodiment of the present invention;
fig. 12 is a schematic structural diagram of a message transmission apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. 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.
Some of the words that appear in the text are explained below:
1. the term "and/or" in the embodiments of the present invention describes an association relationship of associated objects, and indicates that three relationships may exist, for example, a and/or B may indicate: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
2. The gateway device in the embodiment of the present invention is a device that carries multiple types of interfaces, so as to provide data conversion service between multiple networks, and the gateway device may be mobile or fixed.
The application scenario described in the embodiment of the present invention is for more clearly illustrating the technical solution of the embodiment of the present invention, and does not form a limitation on the technical solution provided in the embodiment of the present invention, and it can be known by a person skilled in the art that with the occurrence of a new application scenario, the technical solution provided in the embodiment of the present invention is also applicable to similar technical problems. In the description of the present invention, the term "plurality" means two or more unless otherwise specified.
The gateway device carries multiple types of interfaces, thereby providing data conversion services among multiple networks. Different types of interfaces correspond to different services, for example, WAN interfaces correspond to WAN related services; the LAN interface corresponds to LAN related traffic. The gateway device comprises a real interface layer and a service layer, wherein the service layer sends messages to the real interface layer and can also receive messages sent by the real interface layer.
However, since the characteristics of different interfaces vary greatly, many services are associated with the interface type in addition to the necessary network information such as IP, routing, etc. Therefore, on the gateway device, the type of the physical interface is generally fixed, and the switching of the interface is difficult to realize.
In view of this, an embodiment of the present invention provides an interface switching method, a data transmission method, and a gateway device, where the interface switching method determines, through a received interface switching instruction, a target virtual interface that needs to be subjected to interface switching, and first private data of a real interface mapped by the target virtual interface after switching; and then the determined first private data is used for replacing the first private data currently configured by the target virtual interface by the virtual interface layer, so that the switching of the mapping relation of the virtual interface and the real interface is realized, and the switching of the interfaces is also realized. In the whole switching process, the corresponding relation between the virtual interface and the service is not changed, and the service layer cannot sense that the cut is switched, so that the service layer does not need to be concerned with the division of the real interface and the difference generated by different chip schemes, such as the difference between the interface name and the interface type, and further, the abnormal service function state and the modification of a large amount of code logics during cut switching can be avoided. The method also updates the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface and the target virtual interface of the first private data, and can accurately determine the mapped virtual interface after switching according to the updated linked list on the premise that the real interface is not configured with the relevant information of the mapped virtual interface.
Fig. 1 is a schematic Service logic diagram of a gateway device according to an embodiment of the present invention, as shown in fig. 1, a virtual interface layer is associated with a Service layer, that is, services such as LAN, WAN, security and Quality of Service (Qos), Application program (APP), and the like in the Service layer correspond to a virtual interface in the virtual interface layer. The real interface layer is associated with the physical layer, that is, information in the physical layer such as Direct Memory Access (DMA), Passive Optical Network (PON), wireless internet Wi-Fi, and the like corresponds to the real interface. When the interface is switched, the corresponding relation between the virtual interface and the service is not changed, and the service layer can not sense that the interface is switched, so that the service layer does not need to concern the division of the real interface and the difference generated by different chip schemes, such as the difference between the interface name and the interface type, and further, the abnormal service function state and the modification of a large amount of code logics during the notch switching can be avoided. As described above, the real interface is strongly related to the physical layer, and the interface switching is separated from the complex service logic through the virtual interface layer, and the service layer does not need to determine how the real interface is divided, and only needs to bind the virtual interface during initialization.
Fig. 2 is a schematic diagram of an interface switching method according to an embodiment of the present invention, where the method is applied to a virtual interface layer in a gateway device, and the virtual interface layer is located between a real interface layer and a service layer; the virtual interface layer includes at least two virtual interfaces corresponding to services in the service layer, the gateway device is configured with a callable linked list, the linked list includes a mapping relationship between a real interface and a virtual interface, the virtual interface is configured with first private data of a mapped real interface, the first private data includes interface characteristic information of a corresponding real interface, as shown in fig. 2, the method specifically includes the following steps:
step 201: according to the received interface switching instruction, determining a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching.
In this embodiment, the virtual interface is configured with the first private data of the mapped real interface, and when it is desired to implement the switching of the interfaces, the switching of the first private data needs to be implemented.
Illustratively, according to a received interface switching instruction, an interface identifier is carried in the instruction, and according to the interface identifier, it is determined whether the virtual interface identifier or the real interface identifier is determined, and then a target virtual interface that needs to be subjected to interface switching is determined, for example:
1) the number of the interface identifiers is two, one is determined to be a first virtual interface identifier and the other is determined to be a real interface identifier according to the interface identifiers, and the first virtual interface can be determined to be a target virtual interface through a virtual interface layer according to the first virtual interface identifier;
the real interface is strongly related to a chip and a Software Development Kit (sdk for short), and in order to not affect the use of the real interface, information related to a mapped virtual interface is not configured at the real interface, so that a target virtual interface cannot be found at the real interface, a linked list contains the mapping relation between the real interface and the virtual interface, and at the moment, a second virtual interface mapped by the real interface can be found according to the identification of the real interface by traversing the linked list, so that the second virtual interface is determined to be the target virtual interface;
2) the two interface identifications are determined to be virtual interface identifications according to the two interface identifications, and two target virtual interfaces are directly determined through a virtual interface layer according to the two virtual interface identifications;
3) and determining two interface identifications as real interface identifications according to the interface identifications, traversing the linked list according to the two real interface identifications, and finding virtual interfaces mapped by the two real interfaces respectively, wherein the two virtual interfaces are target virtual interfaces.
It is to be understood that the number of the interface identifiers may also be three or four, and only when the number of the interface identifiers is three or four, the target virtual interface confirmation still needs to be performed with reference to the above-mentioned exemplary implementation manner, so that the number of the interface identifiers is two in general. In some special application scenarios, for example, the virtual interface layer has only two virtual interfaces, and at this time, the interface identifier may also be one, and the target virtual interface can be determined by using the one interface identifier.
After the target virtual interface is determined, the first private data of the real interface mapped by the target virtual interface after switching needs to be further determined.
In addition, the interface characteristic information of the real interface includes, but is not limited to, one or more of the following: real interface identification, real interface pointer, status information, sending capability, etc.
Step 202: replacing the first private data currently configured by the target virtual interface with the determined first private data through a virtual interface layer; and updating the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface of the first private data and the target virtual interface needing interface switching.
As described above, in this embodiment, to implement the switching of the interfaces, the switching of the first private data is implemented; based on this, it is necessary to replace the current first private data with the determined first private data through the virtual interface layer.
Meanwhile, after the interface is switched, the mapping relationship between the virtual interface and the real interface is changed, and the mapping relationship is not the mapping relationship between the real interface and the virtual interface in the linked list, so that the linked list needs to be updated according to the determined real interface of the first private data and the target virtual interface needing to be switched.
By updating the mapping relation between the real interface and the virtual interface contained in the linked list, the virtual interface mapped after switching can be accurately determined according to the updated linked list on the premise that the real interface is not configured with the relevant information of the mapped virtual interface.
As described above, information related to the mapped virtual interface is not configured at the real interface, the real interface can only obtain the mapped virtual interface according to the linked list, and the real interface is difficult to obtain the information related to the mapped virtual interface in the process of sending data to the mapped virtual interface, and based on this, the linked list needs to include the information related to the virtual interface mapped by the real interface.
Optionally, the mapping relationship between the real interface and the virtual interface is a mapping relationship between an interface identifier of the real interface and second private data of the virtual interface;
wherein the second private data includes attribute information of the corresponding virtual interface.
Illustratively, the real interface layer can find the second private data corresponding to the identifier of the real interface by traversing the linked list, and can send data to the mapped virtual interface according to the attribute information of the virtual interface corresponding to the second private data.
In addition, the attribute information of the virtual interface includes, but is not limited to, any one or several items of virtual interface identification, virtual interface parameters, virtual interface address, and virtual interface packet receiving function.
It can be understood that, in order to maintain the consistency of the configuration information of the linked list and the virtual interface, and make the update of the linked list more convenient, the virtual interface can configure private data, the private data not only includes the first private data of the mapped real interface, but also includes the second private data of the virtual interface, the linked list is a set of private data formed by pointers, and after the replacement of the first private data is completed, the linked list is automatically updated.
Fig. 3 is a schematic diagram of a linked list according to an embodiment of the present invention, where as shown in fig. 3, the linked list includes a head portion and data elements, and in a possible implementation manner, the data elements are private data. When the linked list needs to be traversed, the head enters the linked list, and the corresponding private data is determined through the real interface identifier, so that the attribute information of the mapped virtual interface is obtained.
According to the method, a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching are determined through a received interface switching instruction; and then the determined first private data is used for replacing the first private data currently configured by the target virtual interface by the virtual interface layer, so that the switching of the mapping relation of the virtual interface and the real interface is realized, and the switching of the interfaces is also realized. In the whole switching process, the corresponding relation between the virtual interface and the service is not changed, and the service layer cannot sense that the cut is switched, so that the service layer does not need to be concerned with the division of the real interface and the difference generated by different chip schemes, such as the difference between the interface name and the interface type, and further, the abnormal service function state and the modification of a large amount of code logics during cut switching can be avoided. The method also updates the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface and the target virtual interface of the first private data, and can accurately determine the mapped virtual interface after switching according to the updated linked list on the premise that the real interface is not configured with the relevant information of the mapped virtual interface. In an optional implementation manner, the link list includes a mapping relationship between the interface identifier of the real interface and the attribute information of the corresponding virtual interface, and the real interface accurately determines the relevant attribute of the virtual interface mapped after switching through the link list on the premise that the real interface does not configure the relevant attribute of the mapped virtual interface.
In addition, when performing cut switching, there are many possible scenes, and if the same switching manner is adopted, it may be unreasonable to perform switching, fig. 4 is a schematic diagram of another interface switching method provided by the embodiment of the present invention, as shown in fig. 4, which specifically includes the following steps based on the embodiment of fig. 2:
step 401: according to the received interface switching instruction, determining a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching.
Step 401 is the same as the implementation of step 201, and is not described herein again.
Step 402: replacing the first private data currently configured by the target virtual interface with the determined first private data based on the switching type of the interface switching through the virtual interface layer; and updating the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface of the first private data and the target virtual interface needing interface switching.
As described above, there are many possible scenarios when performing the cut switching, and if the same switching manner is adopted, the switching may be unreasonable, and based on this, the virtual interface layer needs to perform the switching according to the switching type. The handover type includes, but is not limited to, a bidirectional handover and/or a unidirectional handover.
According to the method, private data replacement is carried out through the switching type based on interface switching, namely different switching types have different replacement methods, and further, interface switching is carried out adaptively according to different switching scenes.
Fig. 5 is a schematic diagram of another interface switching method according to an embodiment of the present invention, where in the embodiment, the switching type includes bidirectional switching, and the target virtual interface includes a first virtual interface and a second virtual interface; the real interface mapped after the first virtual interface is switched is a first real interface; the real interface mapped after the second virtual interface is switched is a second real interface, as shown in fig. 5, and the method specifically includes the following steps:
step 501: according to the received interface switching instruction, determining a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching.
Step 501 is the same as the implementation of step 201, and is not described herein again.
Step 502: replacing, by the virtual interface layer, first private data currently configured for the first virtual interface with first private data for the first real interface; and replacing the first private data currently configured by the second virtual interface with the first private data of the second real interface.
Illustratively, when capacity expansion of a link is required, bidirectional switching of interfaces is required, in an implementation manner, it may be determined that a first virtual interface is mapped after switching through a virtual interface layer, first private data of the first real interface is determined based on the first real interface, the first private data of the first virtual interface is replaced by the first private data of the first real interface, and the first private data of the second real interface is replaced by the first private data of the second virtual interface in the same manner.
Or
Step 503: and if the first virtual interface is currently configured with the first private data of the second real interface, the second virtual interface is currently configured with the first private data of the first real interface through the virtual interface layer, and the first private data currently configured with the first virtual interface and the first private data currently configured with the second virtual interface are exchanged.
For example, in an implementation manner, after it is determined that the handover type is bidirectional handover and the target virtual interface includes the first virtual interface and the second virtual interface, it can be determined that the first virtual interface and the second virtual interface are bidirectional handover, so that the first private data currently configured by the first virtual interface and the first private data currently configured by the second virtual interface can be directly exchanged through the virtual interface layer.
Through the steps, different modes can be adopted according to needs, and the two interfaces of the same type or the two interfaces of different types can be exchanged in a scene needing link capacity expansion.
Step 504: and updating the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface of the first private data and the target virtual interface needing interface switching.
For a specific implementation manner of step 504, reference may be made to the above-mentioned embodiments, which are not described herein again.
According to the scheme, when bidirectional switching is carried out, the real interfaces respectively mapped after the two virtual interfaces are switched can be determined, and the private data of the mapped real interfaces are directly and respectively configured for the two virtual interfaces, so that the current first private data can be accurately replaced by the private data of the mapped real interfaces after switching, and the bidirectional switching is completed; the first private data mapped by the two virtual interfaces can be directly exchanged, so that the bidirectional switching can be conveniently and quickly completed.
Fig. 6 is a schematic diagram of another interface switching method provided by an embodiment of the present invention, where in the embodiment, on the basis of the foregoing embodiment, the switching type includes unidirectional switching, and as shown in fig. 6, the method specifically includes the following steps:
step 601: according to the received interface switching instruction, determining a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching.
Step 601 is the same as the implementation of step 201, and is not described herein again.
Step 602: and searching a virtual interface of the first private data determined by the configuration through the virtual interface layer.
For example, in a scenario that the real interface is broken or the form of the real interface needs to be changed, for example, the real interface is used as a switch, the real interface is empty, and a unidirectional switch is required at this time.
When the unidirectional switching is performed, only one target virtual interface is provided, that is, only one virtual interface has the determined first private data, the virtual interface configured with the determined first private data is currently configured, and the empty real interface is mapped after the unidirectional switching, so that the first private data currently configured by the virtual interface needs to be deleted, and based on this, the virtual interface configured with the determined first private data needs to be searched first.
In this embodiment, a manner of searching for the virtual interface of the first private data determined by the configuration is not limited, for example, the virtual interface may be directly determined under the condition of obtaining the virtual interface identifier; in the case of obtaining the identifier of the real interface, the virtual interface may be determined by traversing the linked list, and details are not described here.
Step 603: and deleting the first private data currently configured by the target virtual interface through the virtual interface layer, and switching the searched first private data configured by the virtual interface to the target virtual interface.
For example, the empty real interface is mapped after the searched virtual interface is switched, and the first private data determined by the target virtual interface is the first private data currently configured to the searched virtual interface, the first private data currently configured to the target virtual interface may be deleted, and the first private data currently configured to the searched virtual interface is switched to the target virtual interface, and at this time, the first private data not configured to the searched virtual interface is not configured to the searched virtual interface, and is transferred to the target virtual interface.
In addition, before switching, the real interface is damaged or the form of the real interface is changed, and bidirectional switching is also carried out. Illustratively, the target virtual interface includes a third virtual interface and a fourth virtual interface; after the third virtual interface is switched, a third real interface is mapped, and a currently mapped real interface is a real interface; the second virtual interface is switched to be mapped to be an empty-real interface, the currently mapped third real interface does not execute the step 501 and the step 502 under the condition, but directly replaces the first private data currently configured by the third virtual interface with the first private data of the third real interface and replaces the first private data currently configured by the fourth virtual interface with the first private data of the empty-real interface; or directly exchanging the first private data currently configured by the two target virtual interfaces.
Step 604: and updating the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface of the first private data and the target virtual interface needing interface switching.
The specific implementation of step 604 can refer to the above embodiments, and is not described herein again.
According to the scheme, the virtual interface of the first private data determined by configuration is searched, the first private data currently configured by the target virtual interface is deleted, the searched first private data configured by the virtual interface is switched to the target virtual interface, the first private data determined by configuration of the target virtual interface is enabled to be configured, the searched virtual interface is enabled to be mapped to the empty-real interface, and therefore unidirectional switching of the interfaces is achieved in scenes that the real interface is damaged or the form of the real interface needs to be changed.
Fig. 7 is a schematic diagram of another interface switching method provided in an embodiment of the present invention, in which, based on the above embodiment, a virtual interface included in the virtual interface layer is divided into a switchable virtual interface and a non-switchable virtual interface, and as shown in fig. 7, the method specifically includes the following steps:
step 701: and determining a target virtual interface for interface switching from the switchable virtual interfaces according to the received interface switching instruction.
Because the switchable virtual interfaces are strongly bound to the corresponding services, some switchable virtual interfaces may be added to the bridge, or some firewall configurations may limit the forwarding of packets of the corresponding services. If there are other services except the corresponding service, bypassing the above-mentioned limitation to receive and send the message, all services need to be synchronized, the rule is temporarily closed, and the implementation process is complicated. In this embodiment, the switchable virtual interface and the non-switchable virtual interface are not limited, for example: the switchable virtual interface is a WAN virtual interface or a LAN virtual interface; the Virtual interface that is not switchable is a Virtual ethernet (Virtual ethernet, referred to as a "VETH") interface, and when detecting a WAN, the packet can be received and transmitted through the VETH interface without changing service configuration.
For example, the non-switchable virtual interface does not perform interface switching, so that the mapping relationship with the real interface is fixed, and the real interface is mapped with the switchable virtual interface, that is, one real interface is mapped with two virtual interfaces, and the real interface can switch the virtual interface actually used through the switch when actually receiving and transmitting a message.
Step 702: replacing the first private data currently configured by the target virtual interface with the determined first private data; and updating the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface of the first private data and the target virtual interface needing interface switching.
Optionally, the method further comprises:
step 703: and after the switching is finished, the switchable virtual interface and the mapped real interface, and the non-switchable virtual interface and the mapped real interface are notified to the service layer.
As described above, the virtual interface shields the service layer and the user from the real interface implementation related to the service, and after the switching is completed, the service layer is notified of the switchable virtual interface and the mapped real interface, and the non-switchable virtual interface and the mapped real interface, so that the user can know the corresponding relationship between the virtual interface and the real interface. In addition, because the mapping relationship between the virtual interface and the real interface which are not switchable is fixed, the mapping relationship between the virtual interface and the real interface which are not switchable can be preset in the service layer, and after the virtual interface layer is switched, the mapping relationship between the switchable virtual interface and the non-switchable virtual interface is only notified to the service layer, so that a user can also know the mapping relationship between the virtual interface and the real interface. Fig. 8 is a schematic diagram of a mapping relationship provided by an embodiment of the present invention, as shown in fig. 8, the switchable WAN virtual interface maps the non-switchable first VETH virtual interface, and the switchable LAN virtual interface maps the non-switchable second VETH virtual interface.
Fig. 9a is a schematic diagram of a message transmission method according to an embodiment of the present invention, and fig. 9b is a schematic diagram of another message transmission method according to an embodiment of the present invention, which are both applied to a gateway device, where the gateway device includes a real interface layer, a service layer, and a virtual interface layer located between the real interface layer and the service layer; the virtual interface layer includes at least two virtual interfaces corresponding to services in the service layer, the gateway device is configured with a callable linked list, the linked list includes a mapping relationship between a real interface and a virtual interface, the virtual interface is configured with first private data of a mapped real interface, the first private data includes interface characteristic information of a corresponding real interface, as shown in fig. 9a, the method includes the following steps:
step 901: and sending a first message to the virtual interface layer through the service layer.
Illustratively, the interface characteristic information of the real interface includes, but is not limited to, one or more of the following: real interface identification, real interface pointer, status information, sending capability, etc. For example:
the interface characteristic information of the real interface comprises state information, such as connection state, registration state and the like, and the mapped virtual interface can convert the state information into the state of the virtual interface and inform the state to the service layer, so that the service layer can judge whether the message can be sent or not according to the state of the virtual interface before sending.
Step 902: and determining a target virtual interface corresponding to the received first message of the service layer through the virtual interface layer, and sending the first message to a mapped real interface according to first private data configured by the target virtual interface.
Illustratively, the interface characteristic information of the real interface includes, but is not limited to, one or more of the following: real interface identification, real interface pointer, status information, sending capability, etc. For example:
the interface characteristic information of the real interface includes a sending capability, such as a Maximum Transmission Unit (MTU), and the mapped virtual interface may serve as an upper limit of its sending capability according to the sending capability, and transmit the packet without exceeding the upper limit of the sending capability. As shown in fig. 9b, the method comprises the steps of:
step 903: and determining target real interfaces corresponding to second messages of other ports through the real interface layer, and determining virtual interfaces mapped by the target real interfaces according to the linked list so that the mapped virtual interfaces receive the second messages.
Illustratively, the real interface layer determines a real interface for receiving the packet according to real interface parameters carried by the second packet of the other port, and determines a virtual interface mapped by the real interface through traversing a linked list, so that the mapped virtual interface receives the second packet.
Optionally, the mapping relationship between the real interface and the virtual interface is a mapping relationship between an interface identifier of the real interface and second private data of the virtual interface;
wherein the second private data includes attribute information of the corresponding virtual interface.
The attribute information of the virtual interface includes, but is not limited to, any one or several items of virtual interface identification, virtual interface parameters, virtual interface address, and virtual interface packet receiving function.
Illustratively, the real interface layer can find the second private data corresponding to the identifier of the real interface by traversing the linked list, and can send data to the mapped virtual interface according to the attribute information of the virtual interface corresponding to the second private data. For example: and traversing the linked list by the real interface, determining second private data of the mapped virtual interface, acquiring a virtual interface parameter and a virtual interface packet receiving function, modifying the real interface parameter in the second message into the mapped virtual interface parameter, and calling the packet receiving function of the virtual interface, so that the mapped virtual interface receives the second message.
Step 904: and sending the second message to a service layer through the virtual interface layer.
In the method, when the service layer sends the message to the real interface layer, the service layer directly sends the first message to the virtual interface layer; the virtual interface layer determines a corresponding virtual interface and sends a first message to the mapped real interface according to first private data configured by the virtual interface; when the real interface layer sends a message to the service layer, the real interface layer determines a real interface corresponding to the second message, and determines a mapped virtual interface according to the linked list so that the mapped virtual interface receives the second message; and the virtual interface layer sends the second message to the service layer. No matter the service layer sends the message to the real interface layer or the real interface layer sends the message to the service layer, after the interface switching is carried out, the corresponding relation between the virtual interface and the service is not changed, the service layer cannot sense that the cut is switched, the service layer can directly send the message to the virtual interface layer or receive the message sent by the virtual interface layer, and therefore the abnormal service function state and the modification of a large number of code logics during the cut switching can be avoided.
As shown in fig. 10, an embodiment of the present invention further provides a schematic structural diagram of a gateway device, where the gateway device 1000 includes: the gateway device 1000 is configured with a callable linked list, where the linked list includes a mapping relationship between a real interface and a virtual interface, the virtual interface is configured with first private data of a mapped real interface, and the first private data includes interface characteristic information of a corresponding real interface;
when the processor 1001 performs interface switching through the virtual interface layer, the interface switching is specifically configured to:
determining a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching according to a received interface switching instruction;
replacing, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data; and updating the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface of the first private data and the target virtual interface needing interface switching.
Optionally, the mapping relationship between the real interface and the virtual interface is a mapping relationship between an interface identifier of the real interface and second private data of the virtual interface;
wherein the second private data includes attribute information of the corresponding virtual interface.
Optionally, the replacing, by the virtual interface layer, the first private data currently configured by the virtual interface with the determined first private data includes:
and replacing the first private data currently configured by the target virtual interface with the determined first private data based on the switching type of the interface switching through the virtual interface layer.
Optionally, the handover type includes bidirectional handover, and the target virtual interface includes a first virtual interface and a second virtual interface; the real interface mapped after the first virtual interface is switched is a first real interface; the real interface mapped after the second virtual interface is switched is a second real interface;
replacing, by the virtual interface layer based on the handover type of the interface handover, the first private data currently configured for the target virtual interface with the determined first private data, including:
replacing, by the virtual interface layer, first private data currently configured for the first virtual interface with first private data for the first real interface; replacing the first private data currently configured by the second virtual interface with the first private data of the second real interface; or
And if the first virtual interface is currently configured with the first private data of the second real interface and the second virtual interface is currently configured with the first private data of the first real interface, exchanging the first private data currently configured with the first virtual interface with the first private data currently configured with the second virtual interface through the virtual interface layer.
Optionally, the handover type comprises a unidirectional handover;
replacing, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data, including:
searching a virtual interface of the first private data determined by configuration through the virtual interface layer;
and deleting the first private data currently configured by the target virtual interface through the virtual interface layer, and switching the searched first private data configured by the virtual interface to the target virtual interface.
Optionally, the virtual interface included in the virtual interface layer is divided into a switchable virtual interface and a non-switchable virtual interface:
the determining a target virtual interface needing interface switching according to the received interface switching instruction includes:
and determining a target virtual interface for interface switching from the switchable virtual interfaces according to the received interface switching instruction.
Optionally, the processor is further configured to, when performing interface switching through the virtual interface layer:
and after the switching is finished, the virtual interface layer informs the service layer of the switchable virtual interface and the mapped real interface, and the non-switchable virtual interface and the mapped real interface.
Since the device is the device in the interface switching method in the embodiment of the present invention, and the principle of the device to solve the problem is similar to that of the method, the implementation of the device may refer to the implementation of the method, and repeated details are not described again.
The embodiment of the invention also provides another gateway device, wherein the gateway comprises a processor and at least two interfaces; the processor transmits messages through a real interface layer, a service layer and a virtual interface layer positioned between the real interface layer and the service layer; the virtual interface layer comprises at least two virtual interfaces corresponding to services in the service layer, the gateway is configured with a linked list for the real interface to call, the linked list comprises a mapping relation between the real interface and the virtual interface, the virtual interface is configured with first private data of the mapped real interface, and the first private data comprises interface characteristic information of the corresponding real interface;
when the processor performs packet transmission through the real interface layer, the service layer, and the virtual interface layer, the processor is specifically configured to:
sending a first message to the virtual interface layer through the service layer; and
determining a target virtual interface corresponding to the received first message of the service layer through the virtual interface layer, and sending the first message to a mapped real interface according to first private data configured by the target virtual interface;
or
Determining a target real interface corresponding to a second message of the other port received through the real interface layer, and determining a virtual interface mapped by the target real interface according to the linked list so that the mapped virtual interface receives the second message; and
and sending the second message to a service layer through the virtual interface layer.
Since the device is the device in the message transmission method in the embodiment of the present invention, and the principle of the device for solving the problem is similar to that of the method, the implementation of the device may refer to the implementation of the method, and repeated details are not described again.
As shown in fig. 11, an embodiment of the present invention further provides a structural schematic diagram of an interface switching apparatus, where the interface switching apparatus 1100 includes: a determination module 1101 and a processing module 1102.
A determining module 1101, configured to determine, according to a received interface switching instruction, a target virtual interface that needs to be subjected to interface switching and first private data of a real interface mapped by the target virtual interface after the switching;
a processing module 1102, configured to replace, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data; and updating the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface of the first private data and the target virtual interface needing interface switching.
Optionally, the mapping relationship between the real interface and the virtual interface is a mapping relationship between an interface identifier of the real interface and second private data of the virtual interface;
wherein the second private data includes attribute information of the corresponding virtual interface.
Optionally, the replacing, by the processing module 1102, the first private data currently configured by the virtual interface with the determined first private data through the virtual interface layer includes:
and replacing the first private data currently configured by the target virtual interface with the determined first private data based on the switching type of the interface switching through the virtual interface layer.
Optionally, the handover type includes bidirectional handover, and the target virtual interface includes a first virtual interface and a second virtual interface; the real interface mapped after the first virtual interface is switched is a first real interface; the real interface mapped after the second virtual interface is switched is a second real interface;
the replacing, by the processing module 1102, the first private data currently configured by the target virtual interface with the determined first private data through the virtual interface layer includes:
replacing, by the virtual interface layer, first private data currently configured for the first virtual interface with first private data for the first real interface; replacing the first private data currently configured by the second virtual interface with the first private data of the second real interface; or
And if the first virtual interface is currently configured with the first private data of the second real interface and the second virtual interface is currently configured with the first private data of the first real interface, exchanging the first private data currently configured with the first virtual interface with the first private data currently configured with the second virtual interface through the virtual interface layer.
Optionally, the handover type comprises a unidirectional handover;
the replacing, by the processing module 1102, the first private data currently configured by the target virtual interface with the determined first private data through the virtual interface layer includes:
searching a virtual interface of the first private data determined by configuration through the virtual interface layer;
and deleting the first private data currently configured by the target virtual interface through the virtual interface layer, and switching the searched first private data configured by the virtual interface to the target virtual interface.
Optionally, the virtual interface included in the virtual interface layer is divided into a switchable virtual interface and a non-switchable virtual interface:
the determining module 1101 determines, according to the received interface switching instruction, a target virtual interface that needs to be subjected to interface switching, including:
and determining a target virtual interface for interface switching from the switchable virtual interfaces according to the received interface switching instruction.
Optionally, after the handover is completed, the processing module 1102 is further configured to notify the service layer of the switchable virtual interface and the mapped real interface, and the non-switchable virtual interface and the mapped real interface through the virtual interface layer.
As shown in fig. 12, an embodiment of the present invention further provides a schematic structural diagram of a message transmission apparatus, where the message transmission apparatus 1200 includes: a first process module 1201 and a second process module 1202.
A first processing module 1201, configured to send a first packet to the virtual interface layer through the service layer; and
determining a target virtual interface corresponding to the received first message of the service layer through the virtual interface layer, and sending the first message to a mapped real interface according to first private data configured by the target virtual interface;
a second processing module 1202, configured to determine, through the real interface layer, a target real interface corresponding to a second message received from another port, and determine, according to the linked list, a virtual interface mapped by the target real interface, so that the mapped virtual interface receives the second message; and
and sending the second message to a service layer through the virtual interface layer.
The embodiment of the present invention further provides a computer-readable non-volatile storage medium, which includes a program code, and when the program code runs on a computing terminal, the program code is configured to enable the computing terminal to execute the interface switching method or the message transmission step according to the embodiment of the present invention.
The present application is described above with reference to block diagrams and/or flowchart illustrations of methods, apparatus (systems) and/or computer program products according to embodiments of the application. It will be understood that one block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, and/or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer and/or other programmable data processing apparatus, create means for implementing the functions/acts specified in the block diagrams and/or flowchart block or blocks.
Accordingly, the subject application may also be embodied in hardware and/or in software (including firmware, resident software, micro-code, etc.). Furthermore, the present application may take the form of a computer program product on a computer-usable or computer-readable storage medium having computer-usable or computer-readable program code embodied in the medium for use by or in connection with an instruction execution system. In the context of this application, a computer-usable or computer-readable medium may be any medium that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
Claims (10)
1. The interface switching method is characterized by being applied to gateway equipment, wherein the gateway equipment comprises a real interface layer, a service layer and a virtual interface layer positioned between the real interface layer and the service layer; the virtual interface layer comprises at least two virtual interfaces corresponding to the services in the service layer, the gateway device is configured with a callable linked list, the linked list comprises a mapping relation between a real interface and the virtual interface, the virtual interface is configured with first private data of the mapped real interface, and the first private data comprises interface characteristic information of the corresponding real interface;
the method comprises the following steps:
determining a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching according to a received interface switching instruction;
replacing, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data; and updating the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface of the first private data and the target virtual interface needing interface switching.
2. The method according to claim 1, wherein the mapping relationship between the real interface and the virtual interface is a mapping relationship between an interface identifier of the real interface and second private data of the virtual interface;
wherein the second private data includes attribute information of the corresponding virtual interface.
3. The method of claim 1, wherein said replacing, by the virtual interface layer, the first private data of the virtual interface current configuration with the determined first private data comprises:
and replacing the first private data currently configured by the target virtual interface with the determined first private data based on the switching type of the interface switching through the virtual interface layer.
4. The method of claim 3, wherein the handover type comprises a bidirectional handover, the target virtual interface comprising a first virtual interface and a second virtual interface; the real interface mapped after the first virtual interface is switched is a first real interface; the real interface mapped after the second virtual interface is switched is a second real interface;
replacing, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data, including:
replacing, by the virtual interface layer, first private data currently configured for the first virtual interface with first private data for the first real interface; replacing the first private data currently configured by the second virtual interface with the first private data of the second real interface; or,
and if the first virtual interface is currently configured with the first private data of the second real interface and the second virtual interface is currently configured with the first private data of the first real interface, exchanging the first private data currently configured with the first virtual interface with the first private data currently configured with the second virtual interface through the virtual interface layer.
5. The method of claim 3, wherein the handover type comprises a unidirectional handover;
replacing, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data, including:
searching a virtual interface of the first private data determined by configuration through the virtual interface layer;
and deleting the first private data currently configured by the target virtual interface through the virtual interface layer, and switching the searched first private data configured by the virtual interface to the target virtual interface.
6. The method according to any of claims 1 to 5, wherein the virtual interface layer comprises virtual interfaces divided into switchable virtual interfaces and non-switchable virtual interfaces:
the determining a target virtual interface needing interface switching according to the received interface switching instruction includes:
and determining a target virtual interface for interface switching from the switchable virtual interfaces according to the received interface switching instruction.
7. The method of claim 6, wherein the method further comprises:
and after the switching is finished, the virtual interface layer informs the service layer of the switchable virtual interface and the mapped real interface, and the non-switchable virtual interface and the mapped real interface.
8. A message transmission method is characterized in that the method is applied to gateway equipment, and the gateway equipment comprises a real interface layer, a service layer and a virtual interface layer positioned between the real interface layer and the service layer; the virtual interface layer comprises at least two virtual interfaces corresponding to services in the service layer, the gateway device is configured with a callable linked list, the linked list comprises a mapping relation between a real interface and the virtual interfaces, the virtual interfaces are configured with first private data of the mapped real interfaces, and the first private data comprises interface characteristic information of the corresponding real interfaces, and the method comprises the following steps:
sending a first message to the virtual interface layer through the service layer; determining a target virtual interface corresponding to the received first message of the service layer through the virtual interface layer, and sending the first message to a mapped real interface according to first private data configured by the target virtual interface;
or,
determining a target real interface corresponding to a second message of the other port received through the real interface layer, and determining a virtual interface mapped by the target real interface according to the linked list so that the mapped virtual interface receives the second message; and sending the second message to a service layer through the virtual interface layer.
9. A gateway device, characterized in that the gateway device comprises a processor and at least two interfaces;
the processor performs interface switching through a virtual interface layer positioned between a real interface layer and a service layer, the virtual interface layer comprises at least two virtual interfaces corresponding to services in the service layer, the gateway device is configured with a callable linked list, the linked list comprises a mapping relation between the real interface and the virtual interface, the virtual interface is configured with first private data of the mapped real interface, and the first private data comprises interface characteristic information of the corresponding real interface;
the processor is specifically configured to, when performing interface switching through the virtual interface layer:
determining a target virtual interface needing interface switching and first private data of a real interface mapped by the target virtual interface after switching according to a received interface switching instruction;
replacing, by the virtual interface layer, the first private data currently configured for the target virtual interface with the determined first private data; and updating the mapping relation between the real interface and the virtual interface contained in the linked list according to the determined real interface of the first private data and the target virtual interface needing interface switching.
10. A gateway device, characterized in that the gateway comprises a processor and at least two interfaces; the processor transmits messages through a real interface layer, a service layer and a virtual interface layer positioned between the real interface layer and the service layer, wherein the virtual interface layer comprises at least two virtual interfaces corresponding to services in the service layer, the gateway is configured with a linked list for the real interface to call, the linked list comprises a mapping relation between the real interface and the virtual interface, the virtual interface is configured with first private data of the mapped real interface, and the first private data comprises interface characteristic information of the corresponding real interface;
when the processor performs packet transmission through the real interface layer, the service layer, and the virtual interface layer, the processor is specifically configured to:
sending a first message to the virtual interface layer through the service layer; determining a target virtual interface corresponding to the received first message of the service layer through the virtual interface layer, and sending the first message to a mapped real interface according to first private data configured by the target virtual interface;
or,
determining a target real interface corresponding to a second message of the other port received through the real interface layer, and determining a virtual interface mapped by the target real interface according to the linked list so that the mapped virtual interface receives the second message; and sending the second message to a service layer through the virtual interface layer.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010342825.7A CN111585796B (en) | 2020-04-27 | 2020-04-27 | Interface switching method, message transmission method and gateway equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010342825.7A CN111585796B (en) | 2020-04-27 | 2020-04-27 | Interface switching method, message transmission method and gateway equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111585796A true CN111585796A (en) | 2020-08-25 |
CN111585796B CN111585796B (en) | 2022-06-21 |
Family
ID=72125417
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010342825.7A Active CN111585796B (en) | 2020-04-27 | 2020-04-27 | Interface switching method, message transmission method and gateway equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111585796B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115842869A (en) * | 2022-11-23 | 2023-03-24 | 浙江省通信产业服务有限公司 | Digital village management method, device and control system based on Internet of things |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101179477A (en) * | 2006-11-10 | 2008-05-14 | 中国科学院声学研究所 | Method for implementing built-in router |
WO2009074080A1 (en) * | 2007-11-30 | 2009-06-18 | Huawei Technologies Co., Ltd. | Method, apparatus and system for virtual network configuration and partition switch |
CN103812746A (en) * | 2012-11-14 | 2014-05-21 | 深圳市共进电子股份有限公司 | Bridging device based on linux operation system and communication method thereof |
CN104094637A (en) * | 2012-12-31 | 2014-10-08 | 华为技术有限公司 | User equipment and method for heterogeneous network switch |
US20150257051A1 (en) * | 2014-03-07 | 2015-09-10 | Parallel Wireless, Inc. | Federated X2 Gateway |
CN107612702A (en) * | 2016-07-12 | 2018-01-19 | 中兴通讯股份有限公司 | A kind of method for configuring routers and device |
CN110190993A (en) * | 2019-05-22 | 2019-08-30 | 青岛海信宽带多媒体技术有限公司 | A kind of network equipment abnormality diagnostic method, device and computer equipment |
-
2020
- 2020-04-27 CN CN202010342825.7A patent/CN111585796B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101179477A (en) * | 2006-11-10 | 2008-05-14 | 中国科学院声学研究所 | Method for implementing built-in router |
WO2009074080A1 (en) * | 2007-11-30 | 2009-06-18 | Huawei Technologies Co., Ltd. | Method, apparatus and system for virtual network configuration and partition switch |
CN103812746A (en) * | 2012-11-14 | 2014-05-21 | 深圳市共进电子股份有限公司 | Bridging device based on linux operation system and communication method thereof |
CN104094637A (en) * | 2012-12-31 | 2014-10-08 | 华为技术有限公司 | User equipment and method for heterogeneous network switch |
US20150257051A1 (en) * | 2014-03-07 | 2015-09-10 | Parallel Wireless, Inc. | Federated X2 Gateway |
CN107612702A (en) * | 2016-07-12 | 2018-01-19 | 中兴通讯股份有限公司 | A kind of method for configuring routers and device |
CN110190993A (en) * | 2019-05-22 | 2019-08-30 | 青岛海信宽带多媒体技术有限公司 | A kind of network equipment abnormality diagnostic method, device and computer equipment |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115842869A (en) * | 2022-11-23 | 2023-03-24 | 浙江省通信产业服务有限公司 | Digital village management method, device and control system based on Internet of things |
Also Published As
Publication number | Publication date |
---|---|
CN111585796B (en) | 2022-06-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10958525B2 (en) | Network slice management method and apparatus | |
CN111031080B (en) | Message transmission method and device | |
US11894937B2 (en) | Local user plane function control | |
CN109361600B (en) | Method and equipment for acquiring path identifier | |
CN109768908B (en) | VXLAN configuration method, equipment and system | |
US11800587B2 (en) | Method for establishing subflow of multipath connection, apparatus, and system | |
US11134009B2 (en) | Packet processing method and apparatus | |
CN103262480B (en) | Method and the network equipment that a kind of Virtual Cluster is set up | |
US9755909B2 (en) | Method, device and system for controlling network path | |
WO2021147358A1 (en) | Network interface establishing method, apparatus, and system | |
JP2019519146A (en) | Routing establishment, packet transmission | |
US11929851B2 (en) | Gateway selection method, device, and system | |
CN107566277B (en) | Topology determining method, message response method, controller and switch | |
CN111585796B (en) | Interface switching method, message transmission method and gateway equipment | |
WO2016119269A1 (en) | Service data stream data packet processing method and device | |
CN113285877A (en) | Message forwarding control method and related device | |
EP1704696B1 (en) | Method and system for handling context of data packet flows | |
EP4395253A1 (en) | Routing method and apparatus, cloud resource registration method and apparatus, storage medium, and electronic apparatus | |
CN108259292B (en) | Method and device for establishing tunnel | |
CN105960780B (en) | A kind of cross-layer path establishment method and device | |
CN114866510B (en) | Cross-network and off-site interconnection communication method and system based on InfiniBand network | |
WO2023246118A1 (en) | Message forwarding method and apparatus, and storage medium and electronic apparatus | |
WO2024140314A1 (en) | User traffic redirection method and apparatus based on service aware network, and traffic engineering implementation method and apparatus based on service aware network | |
CN111371665B (en) | Routing restriction method and network equipment | |
CN115529114A (en) | Information transmission method and related equipment |
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 |