WO2014198064A1 - 一种处理报文的方法和转发器 - Google Patents

一种处理报文的方法和转发器 Download PDF

Info

Publication number
WO2014198064A1
WO2014198064A1 PCT/CN2013/077259 CN2013077259W WO2014198064A1 WO 2014198064 A1 WO2014198064 A1 WO 2014198064A1 CN 2013077259 W CN2013077259 W CN 2013077259W WO 2014198064 A1 WO2014198064 A1 WO 2014198064A1
Authority
WO
WIPO (PCT)
Prior art keywords
context
message
flow
correspondence
identifiers
Prior art date
Application number
PCT/CN2013/077259
Other languages
English (en)
French (fr)
Inventor
谭仕勇
倪慧
蔡慧
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2013/077259 priority Critical patent/WO2014198064A1/zh
Priority to EP13887011.8A priority patent/EP2996292B1/en
Priority to CN201380073126.5A priority patent/CN105009529B/zh
Priority to CN201811277361.5A priority patent/CN109218111B/zh
Priority to JP2016518818A priority patent/JP6752141B2/ja
Publication of WO2014198064A1 publication Critical patent/WO2014198064A1/zh
Priority to US14/966,307 priority patent/US9998364B2/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/38Flow based routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/64Hybrid switching systems
    • H04L12/6418Hybrid transport
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0806Configuration setting for initial configuration or provisioning, e.g. plug-and-play
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0893Assignment of logical groups to network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0895Configuration of virtualised networks or elements, e.g. virtualised network function or OpenFlow elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Definitions

  • Embodiments of the present invention relate to the field of communications technologies, and, more particularly, to a method and a forwarder for processing a message. Background technique
  • the software-defined network (English definition: Software Defined Network, English abbreviation: SDN) is to transform the traditional closed network into an open environment, just like a computer can also be programmed.
  • OpenFlow technology is a way to implement SDN. OpenFlow technology was first proposed by Stanford University, based on the existing transmission control protocol (English full name: Transmission Control Protocol, English abbreviation: TCP) / Internet Protocol (English full name: Internet Protocol, English abbreviation: IP) technical conditions, innovative The concept of network interconnection solves various bottlenecks that the current network faces in the face of new services.
  • OpenFlow converts the packet forwarding process that was originally implemented by a single network element into an OpenFlow repeater and controller, thereby realizing the separation of data forwarding and service control.
  • the controller controls the flow table in the OpenFlow forwarder through the standard interface of the OpenFlow protocol, thereby implementing centralized control of the entire network.
  • the flow table consists of a number of flow entries, each of which is a message processing rule. After receiving a packet, the forwarder can query the flow entry to obtain the action to be performed.
  • the forwarder may include multiple flow tables, and the controller delivers flow entries for a service flow to one or more flow tables of the forwarder.
  • Each OpenFlow flow entry consists of flow information (eg, flow match field), counters, and actions. See Table 1 below for details:
  • the flow matching field in Table 1 is the matching information composed of multiple domains, which is the identifier of the flow entry, and can be used to define the flow.
  • An example of a stream matching domain is shown in Table 2, which consists of ten domains.
  • Table 2 The counters in Table 1 are used to count the flow-related data, and the counters can be individually set according to each flow table, each stream, or each port.
  • the actions in Table 1 indicate the types of actions that should be performed on messages that match the flow entry, such as forwarding, discard, and so on.
  • the types of actions currently defined in the Openflo w protocol include:
  • Output Forwards packets from a specific port; Set-Queue: Forwards packets through a specific forwarding queue.
  • Group Converging multiple streams into one action processing
  • Push-Tag/Pop-Tag encapsulation, decapsulation
  • Change-TTL Modify the TTL field.
  • active mode the controller sends the flow table information collected by the controller to the forwarder.
  • the forwarder can forward the flow table directly according to the flow table.
  • passive mode the forwarder does not find a matching flow entry after receiving a packet.
  • the packet is forwarded to the controller, and the controller decides how to process the packet and delivers the corresponding flow entry to the forwarder.
  • the embodiment of the invention provides a method and a forwarder for processing a message in an SDN, which is used to reduce redundant information stored in the forwarder and improve the processing capability of the forwarder.
  • the first aspect provides a method for processing a message in an SDN, where the method is performed by a forwarder, and specifically includes: receiving an input message;
  • the method further includes: determining, according to the first correspondence, a context identifier set corresponding to the flow to which the input packet belongs, Whether there is a context identifier set corresponding to the stream to which the input message belongs in the first correspondence relationship;
  • the method further includes:
  • the context installation message includes part or all of the context identifiers in the set of context identifiers, and a context corresponding to some or all of the context identifiers in the set of context identifiers;
  • a transponder for use in an SDN, comprising a receiver, a processor and a memory:
  • the memory is configured to store a first correspondence between the stream and the set of context identifiers, and a second correspondence between the context identifier and the context; the set of context identifiers corresponding to each stream in the first correspondence includes At least one context identifier;
  • the receiver is configured to receive an input message
  • the processor is configured to determine, according to the input message, a flow to which the input message belongs; determine, according to the first correspondence stored in the memory, a context identifier set corresponding to the flow to which the input message belongs; The second correspondence stored by the memory determines a context corresponding to the set of context identifiers; and according to the set of context identifiers The input message is processed in the context of the application.
  • the forwarder further includes a transmitter
  • the processor is further configured to: determine, according to the first correspondence that is stored by the memory Before the context identifier set corresponding to the flow to which the input packet belongs, determining whether there is a context identifier set corresponding to the flow to which the input message belongs in the first correspondence relationship; if yes, according to the first Corresponding relationship determining a set of context identifiers corresponding to the flow to which the input message belongs; if not, notifying the sender to send a flow rule request message to the controller, where the flow rule request message includes the report of the input message Head or content;
  • the receiver is further configured to receive a flow rule installation message sent by the controller, where the flow rule installation message includes a context identifier set corresponding to the flow of the input message;
  • the processor is further configured to add, in the first correspondence, information about a flow to which the input message belongs, and a set of context identifiers corresponding to the flow of the input message.
  • the processor is further configured to determine, according to the second correspondence of the memory storage Before the context corresponding to the context identifier set corresponding to the flow to which the input packet belongs, determining whether the second correspondence has a context corresponding to the context identifier set corresponding to the flow to which the input packet belongs; if yes, The second correspondence stored in the memory determines a context corresponding to the set of context identifiers; if some or all of the context identifiers in the set of context identifiers do not have a corresponding context, the transmitter is notified;
  • the sender is configured to send a context request message to the controller, where the context request message includes part or all of the context identifiers in the context identifier set corresponding to the stream to which the input message belongs;
  • the receiver is further configured to receive a context installation message sent by the controller, where the context installation message includes the part or all of the context identifier in the context identifier set, and the foregoing in the context identifier set Part or all of the context identifies the corresponding context;
  • the processor is further configured to: add, in the second correspondence, the part or all of the context identifiers in the set of context identifiers, and corresponding to the part or all of the context identifiers in the set of context identifiers Context.
  • the third aspect provides another method for processing a message in an SDN, where the method is performed by a forwarder, and specifically includes: receiving an input message;
  • the method further includes:
  • the context installation message includes some or all of the context identifiers in the set of context identifiers, and a context corresponding to some or all of the context identifiers in the set of context identifiers;
  • another transponder including an interface, a processor, and a memory;
  • the memory is configured to store a first correspondence between the stream and the set of context identifiers, and a second correspondence between the context identifier and the context; the set of context identifiers corresponding to each stream in the first correspondence includes At least one context identifier;
  • the interface is configured to receive an input message
  • the processor is configured to determine, by the first corresponding relationship stored in the memory, whether there is a context identifier set corresponding to the flow to which the input message belongs; if yes, determining the input report according to the first correspondence relationship The set of context identifiers corresponding to the stream to which the text belongs; if not, the interface is notified;
  • the interface is configured to send a flow rule request message to the controller after receiving the notification sent by the processor, where the flow rule request message includes a header or content of the input message;
  • the interface is further configured to receive a flow rule installation message sent by the controller, where the flow rule installation message includes a context identifier set corresponding to the flow of the input message;
  • the processor is further configured to determine a context corresponding to the context identifier set according to the second correspondence stored in the memory; and process the input packet according to a context corresponding to the context identifier set.
  • the processor is further configured to: determine, according to a second correspondence that is stored in the memory, corresponding to a flow to which the input packet belongs Before the context corresponding to the context identifier set, determining whether the second correspondence has a context corresponding to the context identifier set corresponding to the flow to which the input packet belongs; if yes, determining, according to the second correspondence stored in the memory
  • the context identifier corresponds to a context; if some or all of the context identifiers in the context identifier set do not have a corresponding context, the sender is notified;
  • the transmitter is further configured to send a context request message to the controller after receiving the notification of the processor, where the context request message includes a part of a context identifier set corresponding to the flow to which the input packet belongs Or all contextual identifiers;
  • the receiver is further configured to receive a context installation message sent by the controller, where the context installation message includes the part or all of the context identifier in the context identifier set, and the foregoing in the context identifier set Part or all of the context identifies the corresponding context;
  • the processor is further configured to: add, in the second correspondence, the part or all of the context identifiers in the set of context identifiers, and corresponding to the part or all of the context identifiers in the set of context identifiers Context.
  • the flow in the embodiment of the present invention corresponds to the set of context identifiers, and there is no direct association between the flow and the context.
  • the context does not need to be saved multiple times.
  • the embodiments of the present invention will greatly improve the storage capacity and processing capability of the repeater.
  • FIG. 1 is a schematic structural diagram of an SDN according to an embodiment of the present disclosure
  • FIG. 2 is a schematic structural diagram of a repeater according to an embodiment of the present invention.
  • FIG. 3 is a schematic flowchart of a method for processing a packet by a repeater according to an embodiment of the present disclosure
  • FIG. 4 is a schematic flowchart of a method for processing an input packet by an OpenFlow forwarder according to an embodiment of the present invention
  • FIG. 5 is a schematic flowchart of a method for installing a flow or context of a repeater according to an embodiment of the present invention
  • FIG. 6 is a schematic flowchart of a method for negotiating a repeater and a controller according to an embodiment of the present invention
  • FIG. 6b is a schematic flowchart of another method for negotiating a repeater and a controller according to an embodiment of the present invention
  • a schematic diagram of the method flow of the context corresponding to the CID provided by an embodiment of the present invention
  • FIG. 1 is a schematic structural diagram of an SDN, and at least the repeater 14 and the controller 12 are included in the SDN.
  • the repeater 14 is responsible for forwarding the data layer; the controller 12 is responsible for centralized control of the network to implement the functions of the control layer.
  • the repeater 14 communicates with the controller 12 via a control protocol.
  • a repeater can be connected to one or more other transponders, or to one or more entities that send/receive messages (e.g., fixed terminals, mobile terminals, personal computers, etc.).
  • Transponder 14 communicates with controller 12 or other network entity via interface 1402.
  • the interface 1402 is configured to receive messages, information, messages, or data from the controller 12 or other network entities, or to send messages, messages, messages, or data to the self-controller 12 or other network entity.
  • the processor 1404 can perform some corresponding processing on the messages, information, messages, or data received by the interface 1402.
  • Memory 1406 can be used to store information about the stream and the context.
  • the memory 1406 can also be used to store other information, for example, to store messages, information, messages or data received by the receiver 2002, or to store the processing results of the processor 1404, and the like.
  • the information about the stream and the context stored in the memory 1406 further includes: a first corresponding relationship between the set of the stream and the context identifier (English Identifier, CID), and a second correspondence between the CID and the context.
  • the first correspondence between the stream and the CID set is hereinafter referred to as a flow table, and the name "flow table" is not used to limit the storage form of the first correspondence, because the memory 1406 stores the first correspondence. It may be in the form of a table or in another form, such as a form in which a certain memory unit is mapped to another one or more memory cells.
  • Table 3 is a schematic structural diagram of a flow table according to an embodiment of the present invention.
  • the flow table shown in Table 3 is different from the prior art flow table shown in Table 1.
  • Each flow in the prior art flow table is directly associated with an Action, and each of the flow tables in the embodiment of the present invention
  • a stream is associated with a CID and there is no direct connection to the context.
  • the correspondence between the information of each flow in the flow table (for example, the flow matching domain) and the CID set can be referred to as a flow entry, as shown in Table 3.
  • the stream matching field is used to identify the stream, and the stream matching field includes information needed to identify the stream to which the packet belongs.
  • the structure may include any combination of different tuples shown in Table 2, and may also include other content, for example: Multi-protocol label switching (English full name: Multiprotocol Label Switching, English abbreviation: MPLS) identification, differential service code point (English full name: differentiated services code point, English abbreviation: DSCP) code, transport layer protocol type, universal routing encapsulation protocol identifier (English full name: Generic Routing Encapsulation Identifier, English abbreviation: GRE ID), tunnel endpoint identification of GPRS tunneling protocol ( English full name: tunnel endpoint identifier of GPRS tunneling protocol, English abbreviation: GTP TEID), etc., or use packet offset value, matching length and so on.
  • Multi-protocol label switching English full name: Multiprotocol Label Switching, English abbreviation: MPLS
  • differential service code point English full name: differentiated services code point, English abbreviation: DSCP
  • transport layer protocol type transport layer protocol type
  • Each stream in Table 3 corresponds to a CID set, and each CID set includes at least one CID.
  • CID is used to uniquely identify a context. It can be expressed in many different forms. For example, it can be any character, number, letter, number plus letter, or number plus other characters. In addition to this, the CID can also be used to indicate the type of context.
  • the second correspondence between the CID and the context is also stored in the memory 1406.
  • the second correspondence between the CID and the context is hereinafter referred to as a context list.
  • the name is not used.
  • the storage form of the second correspondence is limited, because the memory 1406 may be in the form of a table when storing the second correspondence, or may be in other forms, such as a certain storage unit and another storage unit or storage units.
  • Table 4 is a schematic structural diagram of a context list in the embodiment of the present invention. Each CID in Table 4 corresponds to a context.
  • the context includes the information needed to perform some sort of processing on the message.
  • the action of the prior art includes the type of the action (Action Type).
  • the forwarder can know the type of the corresponding context through the CID. Therefore, information such as Action Type is no longer included in the context.
  • the context type indicated by the CID includes other types of actions (such as forwarding packets, discarding packets, etc.), and may include other types, so that the repeater can Enter the message for more processing.
  • the type of the context may also include bandwidth control, deep packet inspection (DPI), online charging, offline charging, firewall processing, network address translation (NAT), lawful interception, message reorganization.
  • DPI deep packet inspection
  • NAT network address translation
  • the context of the bandwidth control type may include the maximum allowed bandwidth size, the guaranteed bandwidth size, the forwarding priority, and the like
  • the offline charging type context may include an offline charging group.
  • the context of the route forwarding type may include a forwarding port number, a source MAC address, or a destination MAC address.
  • the forwarder only needs to save the CID corresponding to the context in the CID set corresponding to each stream in the flow table, and the context only needs to be saved in the correspondence between the CID and the context.
  • the transponder can save more storage space, and the saved storage space can make the transponder store more contexts. Therefore, under the same conditions as the prior art, in the embodiment of the present invention, The forwarder can store more contexts, and the processing of the message can also support more context types.
  • the context processing performed on the message in the embodiment of the present invention can be used to implement processing logic that is more complicated than the existing Action.
  • the OpenFlow forwarder only processes the current packet when the action is executed, and the forwarder does not maintain the state of the processed packet. Therefore, the action can only be used to perform statelessness on a single packet. Stateless handling, and it is impossible to stateally process subsequent messages based on the processing results of previous packets of a certain flow. The processing results of previous messages are necessary for some complex processing behaviors, such as message order preservation, DPI, virus detection, and so on. Therefore, in view of the limitations of the current action design, the OpenFlow transponder in the prior art is only suitable for performing relatively simple actions on the message, and cannot be implemented for complicated actions.
  • the forwarder in the embodiment of the present invention can save the state after the packet is processed by the context processing unit, so that the packet can be processed more complicatedly.
  • interface 1402 of repeater 14 can include a receiver 14022 for receiving incoming messages.
  • the input message may be sent by another transponder or by another entity (eg, computer, mobile terminal, fixed terminal, etc.).
  • the processor 1404 is configured to determine a flow to which the input message belongs; for example, determining a flow to which the input message belongs according to a header or content of the input message.
  • the processor 1404 is further configured to determine, according to the first correspondence stored by the memory 1406, a CID set corresponding to the flow to which the input message belongs; determine, according to the storage 1406, the second correspondence, determine a context corresponding to the CID set, and according to The context corresponding to the CID set processes the input message.
  • the processor 1404 processes the input message to obtain a context processing result.
  • the interface 1402 of the repeater 14 can also include a transmitter 14024.
  • the transmitter 14024 is configured to send the context processing result obtained by the processor 1404 to the input message to the controller 12.
  • the controller 12 can determine whether it is necessary to continue processing the input message according to the context processing result, and if necessary, the newly determined stream and the newly determined CID for the input message.
  • the set is sent to the repeater 14.
  • the receiver 14022 in the repeater 14 can also be configured to receive the stream newly determined by the controller 12 for the input message and the newly determined set of context identifiers, so as to notify the processor 1404 according to the context pair corresponding to the newly determined context identifier set.
  • the input message is further processed. Normally, the CID set corresponding to most of the streams has been saved in the memory 1406 before the input message is received.
  • the repeater 14 can acquire the CID set corresponding to the stream of the input message from the controller 12. .
  • the processor 1404 may be further configured to: determine whether the first correspondence has a flow corresponding to the input message Corresponding CID set, if any, the processor 1404 determines, according to the first correspondence, a CID set corresponding to the flow to which the input message belongs; if not, the processor 1404 notifies the sender 14024 to send a send flow rule request message.
  • the flow rule request message includes a message header or content of the input message;
  • the receiver 14022 is further configured to receive a flow rule installation message sent by the controller 12, where the flow rule installation message includes a CID set corresponding to the flow of the input message. Thereafter, the processor 1404 may determine a context corresponding to the CID set according to the storage 1406 storing the second correspondence, and process the input packet according to the context corresponding to the CID set.
  • the processor 1404 may further add, in the first correspondence, information about a flow to which the input message belongs, and a CID set corresponding to the flow of the input message.
  • the controller sends the action in the flow rule installation message to the controller.
  • the Action contains many processing parameters, in order to meet the requirements of transmitting various types of Actions, the flow rule installation message needs to be designed to be long, but the flow rule installation message is designed too long and the transmission time is prolonged, and the message is affected. Processing efficiency.
  • the problem can be solved by the example provided by the present invention.
  • the controller receives the flow rule request message from the forwarder, the controller only needs to send the CID set corresponding to the flow of the input message to the repeater through the flow rule installation message.
  • the forwarder If the forwarder has stored the context corresponding to the CID set, the forwarder only needs to find the corresponding context according to each CID in the CID set. Since the space occupied by the CID set is small, the flow rule installation message for transmitting the CID set does not need to be designed too long, so the time taken for the transport stream rule to install the message is also shortened, and the efficiency of the forwarder processing the message can also be obtained. The degree of improvement.
  • the controller 12 may also send the context corresponding to the CID set to the repeater 14 along with the CID set.
  • the flow rule installation message sent by the controller 12 may further include a context corresponding to the CID set.
  • the format of the flow rule installation message can be as follows:
  • the processor 1404 finds that some or all of the CIDs in the CID set and the context corresponding to the part or all CIDs are not saved in the second correspondence, the process is processed.
  • the device 1404 adds the partial or full CID and the context corresponding to the partial or full CID.
  • most of the CID and CID corresponding contexts have been saved in the second correspondence stored in the memory 1406 before the input message is received.
  • the context corresponding to one or several CIDs cannot be found.
  • the repeater 14 can obtain the input from the controller 12.
  • the context corresponding to the CID is if the processor 1404 finds that some or all of the CIDs in the CID set and the context corresponding to the part or all CIDs are not saved in the second correspondence.
  • the processor 1404 may further determine whether the second correspondence has a flow corresponding to the input message. Corresponding context of the corresponding CID set; if yes, determining a context corresponding to the CID set according to the storage 1406 storing the second correspondence; if some or all of the CIDs in the CID set do not have a corresponding context, then notifying
  • the sender 14024 sends a context request message to the controller 12, where the context request message includes some or all of the CIDs in the CID set corresponding to the stream to which the input message belongs.
  • the receiver 14022 is further configured to receive a context installation message sent by the controller 12, where the context installation message includes some or all CIDs in the CID set, and a context corresponding to some or all CIDs in the CID set. .
  • the processor 1408 is further configured to add, in the second correspondence, a part or all CIDs in the CID set, and a context corresponding to the part or all CIDs.
  • the forwarder After the forwarder processes the packet, it will get various processing results. For some processing results, the forwarder needs to report it to the controller. For example, the relevant information obtained by lawful interception, or the result obtained after executing the NAT service, and the like. For some results, the repeater may need to perform further processing.
  • the processing result obtained by the processor 1408 in the repeater 14 after processing the input message may be a new generation. Message. The processing of the newly generated message by the repeater 14 is similar to the processing of the input message, and will not be described in detail herein.
  • the OpenFlow action only specifies what kind of processing is performed on the current packet, and the packet forwarding result is not maintained by the forwarder. Therefore, it is required to perform the processing based on the previous processing of the packet. In the next processing, the action in the prior art cannot be realized.
  • the first correspondence described in the above example may be stored in the memory 1406 by the technician when the transponder 14 is initially set, or may be sent by the controller 12 to the forwarding after the repeater 14 establishes a connection with the controller 12.
  • the receiver 14022 may receive the flow rule installation message sent by the controller 12 before receiving the input message, where the flow rule installation message includes information of part or all of the flow supported by the repeater 14, and A set of CIDs corresponding to some or all of the streams supported by the repeater 14.
  • the receiver 14022 notifies the memory 1406 to store information of some or all of the streams supported by the repeater 14 and a set of CIDs corresponding to some or all of the streams supported by the repeater 14 to be correspondingly formed to form a first correspondence. relationship.
  • the second correspondence described in the above example may be stored by the technician in the memory 1406 when the repeater 14 is initially set, or the repeater 14 may be connected to the controller 12 by the controller 12.
  • the receiver 14022 may receive the context installation message sent by the controller 12 before receiving the input message, where the context installation message includes some or all of the CIDs supported by the repeater 14, and The context corresponding to some or all of the CIDs supported by the repeater 14; the receiver 14022 notifying the memory 1406 of some or all of the CIDs supported by the repeater 14 and corresponding to some or all of the CIDs supported by the repeater 14. Context - correspondingly saved to form a second correspondence.
  • the repeater 14 may first negotiate with the controller 12 to learn the processing capabilities of the peer and the context.
  • the transmitter 14024 in the repeater 14 sends a capability negotiation request message to the controller 12, the capability negotiation request message including the context capability list supported by the repeater to enable the controller 12 to support the repeater 14. Part or all of the context is sent to the repeater 14; the receiver 14022 receives the negotiation response message sent by the controller 12, and the negotiation response message may include a context capability list supported by the controller 12, so that the repeater 14 is based on The list of capabilities supported by the controller 12 requests the controller for some or all of the context that the controller can support. The foregoing negotiation between the forwarder 14 and the controller 12 may also be initiated by the controller 12.
  • the receiver 14022 in the repeater 14 receives the capability negotiation request message sent by the controller 12, and the capability negotiation request message includes The list of context capabilities supported by the controller 12 is such that the repeater 14 requests the controller 12 for some or all of the context that the controller can support based on the list of capabilities supported by the controller 12; the transmitter 14024 in the repeater 14 controls The device 12 sends a negotiation response message, which may include a context capability list supported by the repeater 14 to enable the controller 12 to send some or all of the contexts that the repeater can support to the repeater 14.
  • the controller 12 may manage the first correspondence or the second correspondence stored in the memory 1406 of the repeater 14, for example, querying, modifying, or deleting information in the first correspondence or the second correspondence.
  • the controller 12 wants to query the CID set corresponding to a certain flow, the controller 12 sends a flow rule query request message to the repeater 14, and the receiver 14022 in the repeater 14 receives the flow rule query sent by the controller 12.
  • a request message the query request message includes information of the flow to be queried; the processor 1406 finds a CID set corresponding to the to-be-queried flow according to the first correspondence, and notifies the sender 14024 to send a flow rule query response message to The controller
  • the flow rule query response message includes information about the flow to be queried, and a CID set corresponding to the flow to be queried. For another example, if the controller 12 is to query the context corresponding to one or several CIDs, the controller 12 sends a context query request message to the repeater 14, and the receiver 14022 in the repeater 14 receives the notification sent by the controller 12.
  • a context query request message the query request message includes a CID to be queried; the CID to be queried may be one or more; the processor 1404 finds a context corresponding to the CID to be queried according to the second correspondence, and notifies the sender
  • the 14024 sends a context query response message to the controller, where the query response message includes a context corresponding to the CID to be queried.
  • the query response message may further include the CID to be queried.
  • the controller 12 wants to modify the CID set corresponding to a certain flow
  • the controller 12 sends a flow modification message to the repeater 14, and the receiver 14022 in the repeater 14 receives the flow rule sent by the controller 12.
  • Modifying the message, the flow modification message includes information of the flow to be modified, and a new CID set corresponding to the flow to be modified; the receiver 14022 notifies the processor 1404 to treat the to-be-received in the first correspondence
  • the set of CIDs corresponding to the modified stream is modified to the new set of CIDs.
  • the receiver 14022 receives the flow rule modification message sent by the controller 12, and the information about the flow to be modified included in the flow rule modification message is: a flow with a source IP address of 10.88.85.55 and a destination IP address of 10.88.80.56.
  • the new CID set corresponding to the stream to be modified is CID1, CID2, and CID5.
  • the CID set corresponding to the flow whose source IP address is 10.88.85.55 and the destination IP address is 10.88.80.56 is: CID1, CID2, CID3 c
  • the notification processor 1404 modifies the CID set corresponding to the stream whose source IP address is 10.88.85.55 and whose destination IP address is 10.88.80.56 to CID1, CID2, and CID5.
  • the controller 12 wants to modify the context corresponding to one or several CIDs, the controller 12 sends a context modification message to the repeater 14, and the receiver 14022 of the repeater 14 receives the notification sent by the controller 12.
  • a context modification message where the context modification message includes a CID to be modified, and the identifier of the context to be modified corresponds to
  • the new context of the receiver 14022 notifies the processor 1404 to modify the context corresponding to the CID to be modified into the new context in the second correspondence.
  • the context corresponding to the CID1 is Contextla. If the context modification message received by the receiver 14022 includes the CID1 and the new context Contextlb corresponding to the CID1, the notification processor 1404 modifies the context corresponding to the CID1 in the second correspondence. For Contextlb.
  • the controller 12 wants to delete the information of a certain stream, the controller 12 sends a stream deletion message to the repeater 14, and the receiver 14022 in the repeater 14 receives the stream deletion message sent by the controller 12, and the stream is deleted.
  • the message includes information of the stream to be deleted; the receiver 14022 notifies the processor 1404 to delete the information of the stream to be deleted and the CID set corresponding to the stream to be deleted from the first correspondence.
  • the processor 1404 may further delete part or all of the CIDs corresponding to the deleted flows from the second corresponding relationship, and A context corresponding to some or all of the CIDs corresponding to the deleted stream.
  • the processor 1404 deletes the information of the stream 1 from the first correspondence, the processor 1404 finds that the CID2 only corresponds to the stream 1, and the processor 1404 can also delete the context corresponding to the CID2 from the second correspondence.
  • CID1 not only corresponds to stream 1, but also corresponds to stream 2, so processor 1404 does not delete the context corresponding to CID1.
  • processor 1404 finds that CID1 does not correspond to other streams, and deletes the context corresponding to CID1 from the second correspondence.
  • the processor 1404 may further notify the sender 14024 to report the information of the deleted stream or the CID corresponding to the deleted context to the controller 12.
  • the controller 12 wants to delete a certain context
  • the controller 12 sends a context delete message to the repeater 14, and the receiver 14022 in the repeater 14 is configured to receive the context delete message sent by the controller 12, the context.
  • the deletion message includes at least one context identifier to be deleted; the receiver 14022 is configured to notify the processor 1404 to delete the at least one CID to be deleted from the second correspondence, and corresponding to the at least one CID to be deleted. Context.
  • the processor 1404 may further modify the first correspondence after deleting a certain context in the second correspondence, for example, the processor 1404 deletes the deleted relationship in the first correspondence.
  • the CID corresponding to the context is not limited to the context.
  • the deletion of the context may cause the processor 1404 to have a problem in processing the stream corresponding to the CID of the context. Therefore, after the processor 1404 deletes the CID corresponding to the deleted context in the first correspondence, the processor 1404 may also be in the first In a correspondence, information of a stream corresponding to the deleted CID is deleted.
  • the processor 1404 deletes the context corresponding to the CID1 from the second correspondence stored in the memory 1406, the processor 1404 finds that the stream corresponding to the CID1 has the stream 1 and the stream 2, and the processor 1404 may also be in the first correspondence. Delete the information of stream 1 and the information of stream 2. Moreover, the processor 1404 can also delete the CID set corresponding to the stream 1 and the stream 2, respectively.
  • the processor 1404 may further notify the sender 14024 to report the CID corresponding to the deleted context or the information of the deleted stream to the controller 12.
  • the first correspondence relationship and the second correspondence relationship held on the repeater 14 can be effectively managed by the example controller 12 provided by the present invention described above. After the transponder provided by the embodiment of the present invention is introduced, the method provided by the embodiment of the present invention will be introduced through some examples.
  • FIG. 3 is a schematic flowchart of a method for processing a packet by a repeater according to an embodiment of the present disclosure, which is specifically as follows: Step 302: A repeater receives an input packet;
  • the incoming message may be sent by another transponder or by another entity (eg, computer, mobile terminal, fixed terminal, etc.).
  • entity eg, computer, mobile terminal, fixed terminal, etc.
  • Step 304 The forwarder determines, according to the input message, the flow to which the input packet belongs.
  • the forwarder can determine the flow to which the input message belongs according to the header or content of the input message.
  • the stream to which the input message belongs can be one or more.
  • the header of the input message is as follows:
  • PORT2 where MAC1 is the MAC source address of the message; MAC2 is the MAC destination address of the message; ⁇ - ⁇ ; 0 ⁇ 800;) indicates that the network layer protocol of the packet is IPv4, IP1 is the IP source address of the packet; IP2 is the IP destination address of the packet; TCP-TYPE indicates that the transport layer protocol of the packet is TCP, and PORT1 is the report. The source TCP port number of the text, and PORT2 is the destination TCP port number of the packet.
  • the input packet belongs to a flow whose MAC source address is MAC1 and whose MAC destination address is MAC2; or the input packet belongs to the IP source address as IP1 and IP source.
  • the address is IP2 and so on.
  • Step 306 The forwarder determines, according to the first correspondence between the flow and the CID, a CID set corresponding to the flow to which the input packet belongs; the CID set corresponding to each flow in the first correspondence includes at least one CID;
  • the flow table includes flow entries as shown in Table 5, and the first column in Table 5 represents the flow.
  • the matching field, the second column represents the set of CIDs that match the stream matching domain.
  • the forwarder matches the packet header of the input packet with the flow matching field in the flow table 5, and finds the flow to which the input packet belongs.
  • the MAC source address is MAC1, and the MAC destination address is MAC2.
  • the corresponding CID set is CID set 1.
  • the forwarder selects the flow entry with the highest priority as the flow table matching the input packet according to the priority of the flow entry. item.
  • Step 308 The repeater determines, according to the second correspondence between the CID and the context, a context corresponding to the CID set corresponding to the flow to which the input packet belongs;
  • the CID set corresponding to the first stream to which the input message belongs is CID set 1. If there is only one CID numbered 5 in the CID set 1, the forwarder can find the corresponding one according to the CID numbered 5.
  • the context is: outport: 1
  • Step 310 The repeater processes the input message according to the context determined in step 308.
  • the forwarder forwards the input packet to the port.
  • the repeater can store more contexts, and the processing of the packet can support More types, which increase the ability of the repeater to process messages.
  • the method described in the foregoing embodiment is also applicable to the case where there are multiple flows to which the message belongs. For example, when the forwarder determines in step 304 that the input message belongs to the flow, the forwarder may also perform the step 310 after performing the step 310. Going to step 306, the CID set corresponding to the other stream to which the input message belongs is determined according to another flow table. For example, assuming that another flow table in the forwarder includes a flow entry as shown in Table 7, the first column of Table 7 represents the flow matching domain, and the second column represents the CID set that matches the flow matching domain.
  • the forwarder matches the header of the input packet with the stream matching field in the flow table 7 in the forwarder, and finds that the other stream to which the input packet belongs (the IP source address is IP1, and the IP destination address is IP2)
  • the CID collection is CID collection 2.
  • the forwarder can process the input message according to the CID corresponding to the CID set 2.
  • the repeater is based on the multiple CID pairs.
  • the input message is processed according to the at least two contexts.
  • a sequence number is set for each CID in the CID set corresponding to each stream.
  • the CID set corresponding to the stream to which the input message belongs is CID1-CID5, and the numbers corresponding to CID1-CID5 are as shown in the second column of Table 8 below.
  • the forwarder performs the processing according to the second column according to the context corresponding to CID1-CID5. Since CID3 and CID4 have the same sequence number, the forwarder will simultaneously input the report according to the context corresponding to CID3 and CID4. The text is processed.
  • each CID in the CID set corresponding to each stream has a default sorting order, and some CIDs may be associated with other CIDs. For example, enter the CID corresponding to the stream to which the packet belongs.
  • the collection is as shown in Table 9, the first column indicates the order in which the CIDs are arranged, and the second column indicates the association relationship between each CID and other CIDs.
  • the forwarder processes the input message according to CID1-CID5
  • the CID associated with other CIDs is processed according to the order of CIDs in the first column of Table 9. Since CID3 and CID4 are associated in the second column, the forwarder will process the incoming message according to the context corresponding to CID3 and CID4.
  • the execution order of the CID set corresponding to each stream and each CID in the CID set can be represented by two lists.
  • the CID set corresponding to the flow to which the input message belongs is shown in Table 10 below.
  • Table 10 is used to indicate the default order of CID from top to bottom
  • Table 11 is used to indicate the relationship between CIDs.
  • the forwarder performs the processing on the input packets according to the context corresponding to the CIDs.
  • the exchange processes the input messages according to the default order of the CIDs shown in Table 10.
  • the repeater can only be executed sequentially according to the order of the actions corresponding to the flow of the input message.
  • the association between the serial number of the CID or the CID is introduced, so that the context corresponding to the partial CID can be processed in parallel, thereby improving the efficiency of the forwarder processing the message.
  • step 310 the forwarder processes the input message to obtain a context processing result.
  • the repeater may perform the following steps:
  • Step 312 The repeater sends the context processing result to the controller.
  • the forwarder sends the context processing result to the controller through an event escalation message.
  • context processing results such as whether the packet forwarding is successful, the charging result after online charging of the input packet, the result obtained by performing DPI on the input packet, and the like.
  • the forwarder may perform DPI on the input message by using the event report message.
  • the event report message includes an event that needs to be reported (for example, a P2P message is detected)
  • event report message may further include part or all of the input message, and/or the result of the context execution (for example, detailed information obtained after performing DPI on the input message).
  • the controller may determine, according to the context processing result, whether the input message needs to be processed, and if necessary, send the newly determined flow of the input message and the newly determined CID set to the forwarder.
  • the transponder is caused to process the input message according to the newly determined stream and the newly determined CID set. For example, after receiving the event report message, the controller finds that the context processing result contained in the event report message is "Input message forwarding succeeded", and the controller can perform no processing. For example, after the event is sent to the controller by the event reporting message, the event that needs to be reported and some or all of the input message are sent to the controller, and the controller finds that the input message needs to be processed, and then sends a new flow entry to the forwarding. And the transponder processes the input packet according to the new flow entry, where the new flow entry includes a flow matching domain newly determined for the input packet and a newly determined CID set.
  • the forwarder Before receiving an input message, the forwarder has already saved the CID set corresponding to the flow to which the message belongs. However, occasionally, the forwarder may not find the CID set corresponding to the flow of the input message in the first correspondence. At this time, the forwarder can obtain the CID set corresponding to the flow of the input message from the controller. Referring to FIG. 3, in another example of the present invention, the forwarder may further include:
  • Step 305a determining whether there is a CID set corresponding to the stream to which the input message belongs in the first correspondence relationship; if yes, performing the above steps 306-310; if not, performing the following steps 305b-305d;
  • Step 305b buffer the input message into the buffer, and send a flow rule request message to the controller, where the flow rule
  • the forwarder sends a packet report (Packet_In) message to the controller to request to obtain the CID set corresponding to the input message, and the input contained in the Packet_In message.
  • the Packet_In message may also carry information (for example, Buffer_ID) of the buffer in which the input packet is buffered, and the reason for the report (for example, the reason is "no matching flow entry in the flow table").
  • Step 305c Receive a flow rule installation message sent by the controller, where the flow rule installation message includes a CID set corresponding to the flow of the input message;
  • the controller determines, according to the packet header or content of the input message in the flow rule request message, that the CID set corresponding to the flow to which the input message belongs includes seven CIDs, specifically as follows:
  • the controller sends the CID set corresponding to the flow to which the input packet belongs to the forwarder by using the flow rule installation message.
  • the controller can send the CID set corresponding to the flow to which the input message belongs to the forwarder through a flow rule installation message.
  • the format of the flow rule installation message is as follows:
  • the controller may send the CID set corresponding to the flow to which the input packet belongs to the forwarder by using multiple flow rule installation messages, for example:
  • ⁇ Stream rule installation message 1>: ⁇ Stream information, ⁇ CID1, CID2, CID3, CID4 > ⁇
  • the flow rule installation message sent by the controller may also include the execution order of each CID, for example:
  • ⁇ flow rule installation message>: ⁇ stream information, ⁇ (CID 1 , 1), (CID2, 2), (CID3, 3), (CID4, 4), (CID5, 4), (CID6, 4) , (CID7, 5)> ⁇ It can be seen from the execution order of each CID above that CID4, CID5 and CID6 need to be executed simultaneously.
  • the format of the flow rule installation message is only an example. In actual application, the format may be other formats.
  • the CID set corresponding to the flow to which the input message belongs is represented by a CID list, as long as the input can be implemented.
  • the CID set corresponding to the stream of the text is sent to the repeater.
  • the controller After receiving the flow rule request message sent by the forwarder, the controller inputs the message according to the flow rule request message.
  • the header or content of the packet determines that the flow to which the input packet belongs is a flow corresponding to the BFD/LLDP protocol, and the controller determines the CID set corresponding to the flow corresponding to the BFD/LLDP protocol.
  • the corresponding CID set may include only the following CIDs:
  • the controller sends the CID set corresponding to the flow to which the input packet belongs to the forwarder through the flow rule installation message.
  • the format of the flow rule installation message is as follows:
  • the controller After receiving the flow rule installation message, the controller performs BFD/LLDP protocol processing on the input packet, for example, updating the protocol state machine.
  • the controller may send the CID set corresponding to each flow to the forwarder through multiple flow rule installation messages, so that the forwarder saves the CID set corresponding to each flow in different In the flow table.
  • the flow rule installation message may be a Flow_Mod message
  • the flow information may be a flow match field.
  • the controller carries the flow match field 1 and the CID list 1 corresponding to the flow match field 1 in the first Flow_Mod message sent to the repeater, and the flow match field 2 and the flow in the second Flow_Mod message sent to the repeater.
  • Match field2 corresponds to CID list2.
  • the controller may further carry information of the flow table (for example, the ID of the flow table (table id)) in each Flow_Mod message, so that the forwarder sends the CID corresponding to the Flow match field and the Flow match field carried in each Flow_Mod message.
  • the collection is added to the corresponding flow table.
  • Flow_Mod message may carry further information for indicating the flow of the processing sequence table.
  • the first Flow_Mod message includes an indication information (such as "Goto-table 2".
  • the forwarder When the forwarder receives the first Flow_Mod message, it will find the corresponding CID listl according to Flow match field 1 in tablel, and according to CID listl The corresponding context processes the input message. After that, the forwarder also needs to match the input message according to table2, find the corresponding CID list2, and process the input message according to the context corresponding to CID list2.
  • Step 305d Add, in the first correspondence, information about a flow to which the input message belongs, and a CID set corresponding to the flow to which the input message belongs.
  • step 305d is optional, and the step 305d may be performed after the step 305c or after the step 306.
  • the controller sends the action to the controller in the flow rule installation message.
  • the Action contains many processing parameters, in order to meet the requirements of transmitting various types of Actions, the flow rule installation message needs to be designed to be long, but the flow rule installation message is designed too long and the transmission time is prolonged, and the message is affected. Processing efficiency.
  • the problem can be solved by the example provided by the present invention.
  • the controller receives the flow rule request message from the repeater, the controller only needs to input the message. The corresponding CID set of the flow is sent to the repeater through the flow rule installation message.
  • the forwarder If the forwarder has stored the context corresponding to the CID set, the forwarder only needs to find the corresponding context according to each CID in the CID set. Yes. Since the space occupied by the CID set is small, the flow rule installation message for transmitting the CID set does not need to be designed too long, so the time taken for the transport stream rule to install the message is also shortened, and the efficiency of the forwarder processing the message can also be obtained. The degree of improvement.
  • the controller may also send the context corresponding to the CID set to the repeater along with the CID set.
  • the flow rule installation message sent by the controller in the foregoing step 305c may further include
  • the forwarder After receiving the flow rule installation message, the forwarder finds that part or all of the CIDs in the CID set and the context corresponding to the part or all CIDs are not saved in the second correspondence; In the correspondence, the part or all of the CID and the context corresponding to the part or all of the CID are added. In general, most of the CID and CID contexts have been saved in the second correspondence of the forwarder before the input message is received. However, there may be cases where the forwarder cannot find a context corresponding to one or several CIDs in the second correspondence, and the forwarder can obtain the context corresponding to the one or several CIDs from the controller. See picture
  • the repeater may perform the following steps before performing step 308:
  • Step 307a determining, in the second correspondence, whether there is a context corresponding to the CID set corresponding to the flow to which the input message belongs; if yes, executing step 308; if there is no part or all CIDs in the CID set, executing The following steps 307b-307d;
  • Step 307b Send a context request message to the controller, where the context request message includes some or all CIDs in the CID set;
  • Step 307c Receive a context installation message sent by the controller, where the context installation message includes some or all CIDs in the CID set, and a context corresponding to some or all CIDs in the CID set.
  • the context installation message may further include a CID other than the CID set and a context corresponding to the other CID.
  • Step 307d In the second correspondence, add each CID in the context installation message and a context corresponding to each CID in the context installation message.
  • step 307d is optional, and step 307d may be performed after step 307c, or may be after step 308. carried out.
  • the embodiment of the present invention further provides an implementation solution, in which the forwarder can follow the flow in the prior art for the Actions existing in the prior art. Process it.
  • an Action for example, Handle_Context
  • an Action for example, Handle_Context
  • Step 402 The OpenFlowSwitch receives the input packet.
  • Step 404 The OpenFlow Switch determines, according to the packet, the flow to which the packet belongs.
  • Step 406 The OpenFlow Switch determines whether there is an action corresponding to the flow to which the input message belongs in the flow table, and if yes, performs a corresponding action; if not, step 408 is performed;
  • Step 408 Cache the input message into the buffer, and send a Packet_In message to the OpenFlow controller to request the action corresponding to the input message.
  • the Packet_In message carries some or all of the contents of the input message.
  • the Packet_In message can also carry information about the buffer of the buffered input message (for example, Buffer_ID) and the reason for the report (for example, the reason is "no matching flow table entry in the flow table").
  • Step 410 The OpenFlow Controller determines, according to the information in the Packet_In message, the action corresponding to the input message and the CID set corresponding to the flow to which the input message belongs, and correspondingly flows the input message stream by using a flow rule installation (eg, Flow_Mod) message.
  • the CID set corresponding to the action and the flow to which the input message belongs is sent to the OpenFlow Switch.
  • the corresponding action of the input message may be a standard action defined in the OpenFlow protocol, or may be a new action for instructing the forwarder to perform context processing on the flow to which the message belongs, such as a Handle_Context action.
  • the action corresponding to the input message is the standard action defined in the OpenFlow protocol
  • the parameters corresponding to the standard action need to be carried in the Packet_In message, and the CID set is not included.
  • the action corresponding to the flow to which the input message belongs includes an action for instructing the forwarder to perform context processing on the flow to which the message belongs
  • the CID set corresponding to the flow to which the input message belongs needs to be carried as the action parameter in the flow rule installation message. in.
  • the Flow_Mod message may include a Flow match field corresponding to the flow to which the input message belongs, and an action list corresponding to the flow matching information, including one or more actions (such as Set-fieild, Output, etc.).
  • the action corresponding to the flow matching domain may further include a Handle Context action, and the parameter of the Handle_Context action is a CID set corresponding to the flow to which the input message belongs. Its One implementation format is as follows:
  • the OpenFlow Controller may send the Flow entry corresponding to each flow to the OpenFlow Switch through multiple Flow_Mod messages, so that the OpenFlow Switch saves the Flow entry corresponding to each flow in different flows.
  • Each of the flow entries optionally includes parameters of the Handle_Context action and the Handle_Context action (eg, a CID collection).
  • the first Flow_Mod message sent by the OpenFlow Controller to the OpenFlow Switch carries the flow match field 1 and the action list corresponding to the flow match field 1; the second Flow_Mod message sent to the OpenFlow Switch carries the flow match field 2, and the flow match The action list corresponding to field2.
  • the Handle_Context action type and the Handle_Context action parameter are optionally included.
  • the OpenFlow Controller may also carry the flow table information (for example, the ID of the flow table) in each Flow_Mod message, so that the OpenFlow Switch adds the information of the flow carried in each Flow_Mod message and the CID set corresponding to the flow to the corresponding flow.
  • the flow table information for example, the ID of the flow table
  • the OpenFlow Switch adds the information of the flow carried in each Flow_Mod message and the CID set corresponding to the flow to the corresponding flow.
  • the Flow_Mod message may also carry information indicating the processing order of the flow table.
  • the first Flow_Mod message includes an indication (such as "Goto-table 2").
  • the OpenFlow Switch finds the corresponding action list according to the flow match field 1 in the table1, and processes the input message according to the action corresponding to the flow match field 1.
  • the forwarder obtains the CID set corresponding to the flow to which the input message belongs according to the parameter of the Handle_Context action (for example, CID listl), and finds the context corresponding to the CID list1 in the second correspondence according to the CID list1. Further, the input message is processed according to the context corresponding to the CID list1.
  • the input message needs to be matched according to table2, the corresponding action list is found, and the input message is processed according to the action list.
  • Step 412 After receiving the flow rule installation message, the OpenFlow Switch adds the information of the flow to which the input message belongs, and the CID set corresponding to the flow of the input message to the corresponding first correspondence.
  • Step 412 is optional. Step 412 may be performed after step 410, or may be performed after step 414.
  • Step 414 The OpenFlow Switch extracts the buffered packet from the buffer corresponding to the Buffer_ID, and the OpenFlow Switch processes the input packet according to the action corresponding to the flow to which the input packet belongs.
  • the action corresponding to the flow to which the input packet belongs is Handle_Context
  • the processing of the input message by the forwarder is similar to that of step 406 to step 410, and will not be described in detail herein.
  • the actions may be included in the Apply-Actions structure of the Flow_mod message, or may be included in the Write-Actions structure.
  • the forwarder After the forwarder processes the packet, it will get various processing results. For some processing results, the forwarder needs to report it to the controller. For example, the relevant information obtained by lawful interception, or the result obtained after executing the NAT service, and the like. For some results, the repeater may need to perform further processing.
  • the processing result obtained by the repeater after processing the input message may be a newly generated message.
  • the transponder processes the input message by listening to the input message. Since the interception result often needs to be forwarded to a specific network entity, the repeater needs to encapsulate the intercepted result (for example, the content of the input message) to obtain a newly generated message. After the forwarder obtains the newly generated packet, the processing of the newly generated packet is the same as the processing of the input packet, that is, the processing similar to the above step 302-step 312 is performed on the newly generated packet.
  • the OpenFlow action only specifies what kind of processing is performed on the current packet, and the packet forwarding result is not maintained by the forwarder. Therefore, it is required to perform the processing based on the previous processing of the packet. In the next processing, the Action in the prior art is impossible to implement.
  • the first correspondence described in the above example may be stored in the repeater by the technician when initial setting of the repeater, or may be sent by the controller to the repeater after establishing a connection with the controller, for example.
  • the forwarder may receive the flow rule installation message sent by the controller, as shown in step 502, before receiving the input message, where the flow rule installation message includes information of part or all of the flow supported by the forwarder. And a set of CIDs corresponding to some or all of the streams supported by the repeater;
  • the controller may send the information of the stream supported by the repeater and the set of CID corresponding to the stream supported by the forwarder to the repeater through one or more flow rule installation messages.
  • the repeater saves the information of part or all of the streams supported by the repeater and the set of CIDs corresponding to some or all of the streams supported by the repeater in a one-to-one correspondence to form a first correspondence.
  • the second correspondence described in the above example may be stored in the repeater by the technician when initial setting of the repeater, or may be sent by the controller to the repeater after establishing a connection with the controller, for example. See Figure 5 Before receiving the input message, the forwarder may receive the context installation message sent by the controller, as shown in step 504, where the context installation message includes part or all of the CID supported by the repeater, and the forwarder supports The context corresponding to some or all of the CIDs;
  • the controller can send the multiple contexts to the repeater through a context installation message, and also send the message to the repeater through multiple context installation messages.
  • Each context installation message may include one or more CIDs and a context corresponding to the one or more CIDs.
  • the repeater saves part or all of the CIDs supported by the repeater and the contexts corresponding to some or all of the CIDs supported by the repeater in a one-to-one correspondence to form a second correspondence.
  • the repeater before the repeater communicates with the controller, the repeater can first negotiate with the controller to learn the processing power of the peer and the context.
  • Figure 6a shows the case where the forwarder initiates negotiation first, including the following steps:
  • Step a602 The forwarder sends a capability negotiation request message to the controller, where the capability negotiation request message includes a context capability list supported by the forwarder, so that the controller sends some or all contexts that the forwarder can support to the forwarding.
  • the capability negotiation request message includes a context capability list supported by the forwarder, so that the controller sends some or all contexts that the forwarder can support to the forwarding.
  • the controller may actively send some or all of the contexts that the forwarder can support to the forwarder; or after receiving the flow rule request message, the context request message sent by the forwarder, Some or all of the supported contexts are sent to the repeater.
  • Step a604 The repeater receives the negotiation response message sent by the controller, where the negotiation response message may include a context capability list supported by the controller, so that the repeater according to the following capability list supported by the controller Part or all of the context that the controller can support is requested from the controller.
  • the foregoing negotiation between the forwarder and the controller may also be initiated by the controller.
  • the method includes the following steps:
  • Step b602 The forwarder receives a capability negotiation request message sent by the controller, where the capability negotiation request message includes a context capability list supported by the controller, so that the forwarder according to the following capability list supported by the controller The controller requests part or all of the context that the controller can support;
  • the controller may actively send some or all of the contexts that the forwarder can support to the forwarder; or after receiving the flow rule request message, the context request message sent by the forwarder, Some or all of the supported contexts are sent to the repeater.
  • Step b604 The forwarder sends a negotiation response message to the controller, where the negotiation response message may include forwarding A list of context capabilities supported by the device to cause the controller to send some or all of the context that the repeater can support to the repeater.
  • the controller may manage the first correspondence or the second correspondence stored in the forwarder. For example, as shown in FIG. 7, the controller may query, modify, or modify information in the first correspondence or the second correspondence. Delete and so on. The following will be explained by some examples. It should be noted that these examples are relatively independent and do not affect each other.
  • Example 1 if the controller wants to query the CID set corresponding to a certain flow, the controller sends a flow rule query request message as shown in step 702 to the forwarder, and the forwarder performs the following steps:
  • Example 2 If the controller is to query the context corresponding to one or several CIDs, the controller sends a context query request message as shown in step 802 to the repeater, and the repeater performs the following steps:
  • the CID to be queried may be one or more.
  • the context corresponding to the CID to be queried is found in the second corresponding relationship, and the context query response message is sent to the controller, where the query response message includes the context corresponding to the CID to be queried.
  • the query response message may further include the CID to be queried.
  • Example 3 If the controller wants to modify the CID set corresponding to a certain flow, the controller sends a flow rule modification message as shown in step 902 to the forwarder, and the forwarder performs the following steps:
  • the CID set corresponding to the flow to be modified is modified into the new CID set in the first correspondence.
  • the forwarder receives the flow rule modification message sent by the controller, and the information of the flow to be modified included in the flow rule modification message is: a flow with a source IP address of 10.88.85.55 and a destination IP address of 10.88.80.56, to be
  • the new CID set corresponding to the modified stream is CID1, CID2, and CID5.
  • the CID set corresponding to the source IP address of 10.88.85.55 and the destination IP address of 10.88.80.56 is: CID1, CID2, and CID3.
  • the forwarder After receiving the flow modification message, the forwarder changes the CID set corresponding to the stream whose source IP address is 10.88.85.55 and whose destination IP address is 10.88.80.56 to CID1, CID2, and CID5.
  • the controller wants to modify the context corresponding to one or several CIDs, the controller sends a context modification message as shown in step 1002 to the repeater, and the repeater performs the following steps:
  • the context corresponding to the CID to be modified is modified into the new context in the second correspondence.
  • the context corresponding to CID1 is Contextla. If the context modification message received by the forwarder includes CID1 and the new context Contextlb corresponding to CID1, the forwarder changes the context ⁇ corresponding to CID1 to Context in the second correspondence. Lb. Example 5: If the controller wants to delete the information of a certain flow, the controller sends a flow deletion message as shown in step 1102 to the repeater, and the forwarder performs the following steps:
  • Step deleting information of the to-be-deleted stream and a CID set corresponding to the to-be-deleted stream from the first correspondence.
  • the forwarder may further delete part or all of the CIDs corresponding to the deleted flows from the second corresponding relationship, and The context corresponding to some or all of the CIDs corresponding to the deleted stream.
  • the forwarder After the forwarder deletes the information of the flow 1 from the first correspondence, the forwarder finds that the CID2 only corresponds to the flow 1, and the forwarder can also delete the context corresponding to the CID2 from the second corresponding relationship.
  • CID1 not only corresponds to stream 1, but also corresponds to stream 2, so the forwarder does not delete the context corresponding to CID1.
  • the repeater finds that CID1 does not correspond to other streams, and deletes the context corresponding to CID1 from the second correspondence.
  • the forwarder may also report the information of the deleted stream or the CID corresponding to the deleted context to the controller.
  • Example 6 if the controller wants to delete a context, the controller sends a context deletion as shown in step 1202.
  • the forwarder receives the context delete message sent by the controller, and the context delete message includes at least one context identifier to be deleted; the forwarder deletes the at least one CID to be deleted from the second correspondence And a context corresponding to the at least one CID to be deleted.
  • the forwarder may further modify the first corresponding relationship after deleting a certain context in the second corresponding relationship.
  • the controller may further perform the following steps:
  • the CID corresponding to the deleted context is deleted.
  • the deletion of the context may cause the forwarder to have a problem in processing the flow corresponding to the CID of the context. Therefore, after the forwarder deletes the CID corresponding to the deleted context in the first correspondence, the In a correspondence, information of a stream corresponding to the deleted CID is deleted.
  • the forwarder deletes the context corresponding to CID1 from the second correspondence, the forwarder finds that the flow corresponding to CID1 has flow 1 and flow 2, and the repeater further deletes the information of flow 1 and the flow 2 in the first corresponding relationship. information. Moreover, the repeater can further delete the CID set corresponding to stream 1 and stream 2, respectively.
  • the forwarder may report the CID corresponding to the deleted context or the information of the deleted flow to the controller.
  • the controller can effectively manage the first correspondence and the second correspondence stored on the forwarder.
  • any of the above method embodiments may be implemented by some or all of the components of the repeater shown in FIG. 2.
  • the present invention can be implemented by hardware, or can be implemented by means of software and a necessary general hardware platform. Based on such understanding, the technology of the present invention.
  • the solution may be embodied in the form of a computer program product, which may be stored in a non-volatile storage medium (which may be a read-only optical disk, a USB flash drive, a mobile hard disk, etc.), including a plurality of instructions for causing a computer
  • the device (which may be a personal computer, a receiving end, or a network device, etc.) performs the methods described in various embodiments of the present invention.

Abstract

本发明的实施例提供了一种在软件定义网络(Software-Defined Network)中处理报文的方法,所述方法由转发器执行,所述方法包括:接收输入报文;根据所述输入报文确定所述输入报文所属的流;根据流与上下文标识集合之间的第一对应关系确定所述输入报文所属的流对应的上下文标识集合;所述第一对应关系中每个流对应的上下文标识集合包括至少一个上下文标识;根据上下文标识与上下文之间的第二对应关系确定与所述上下文标识集合相对应的上下文;根据所述上下文标识集合对应的上下文对所述输入报文进行处理。本发明实施例中的流与上下文不是直接关联的,当有多个流共用一个上下文时,这个上下文也不需要被保存多遍,在与现有技术相同的硬件没下,本发明的实施例将使得转发器的存储能力和处理能力大大提高。

Description

一种处理报文的方法和转发器
技术领域
本发明实施例涉及通信技术领域, 并且更具体地, 涉及一种处理报文的方法和转发器。 背景技术
软件定义网络 (英文全称: Software Defined Network, 英文简称: SDN)是想把传统封闭的 网络转变成一个开放式的环境, 就像电脑一样也可以实现编程。 OpenFlow技术是实现 SDN 的一种方式。 OpenFlow技术最早由斯坦福大学提出,旨在基于现有传输控制协议(英文全称: Transmission Control Protocol, 英文简称: TCP) /网际协议 (英文全称: Internet Protocol, 英 文简称: IP) 技术条件, 以创新的网络互联理念解决当前网络面对新业务产生的种种瓶颈。 OpenFlow将原来完全由单一网元实现的报文转发处理过程转化为由 OpenFlow转发器和控制 器来共同完成, 从而实现了数据转发和业务控制的分离。 控制器通过 OpenFlow协议这个标 准接口对 OpenFlow转发器中的流表进行控制, 从而实现对整个网络进行集中控制。
OpenFlow转发器中最重要的組成部分之一就是流表, 流表由很多个流表项組成, 每个流 表项就是一个报文处理规则。 转发器收到一个报文后可以通过查询流表项来获得需执行的动 作。 转发器可以包括多个流表, 控制器为转发器的一个或多个流表下发针对某业务流的流表 项。
每个 OpenFlow流表项由流的信息 (如, 流匹配域 (flow match field) )、 计数器和动作 (Action) 組成, 具体参见如下表 1所示:
表 1
流匹配域 计数器 动作
其中,表 1中流匹配域是由多个域組成的匹配信息,是流表项的标识,可以用来定义流。 表 2所示的为流匹配域的一个例子, 该流匹配域由十个域組成。
表 2
Figure imgf000003_0001
表 1中的计数器是用来对流量相关的数据进行计数的, 计数器可以根据每张流表、 每个 流或每个端口等进行单独设置。
表 1中的动作标明了对与该流表项相匹配的报文应该执行的动作类型, 例如转发、 丟弃 等动作类型。 目前 Openflo w协议中定义的动作类型包括:
Output: 从特定端口转发报文; Set-Queue: 通过特定转发队列转发报文;
Drop : 丟弃报文;
Group : 将多个流汇聚到一个动作处理;
Push-Tag/Pop-Tag: 封装、 解封装;
Set-Field: 修改报文头;
Change-TTL: 修改 TTL域。
目前流表的动作模式有两种: 主动模式和被动模式。 主动模式下, 控制器将自己收集的 流表信息主动下发给转发器, 随后转发器可以直接根据流表进行转发; 被动模式是指转发器 收到一个报文后没有找到匹配的流表项记录时, 将该报文转发给控制器, 由控制器决策该如 何处理, 并下发相应的流表项给转发器。
由于现有技术的流表中, 流与动作是直接关联的, 当某些流对应的动作是相同时, 针对 每个流都需要在流表项中保存相应的动作, 由此导致转发器中存储的信息出现大量的冗余, 并且維护起来也非常困难。 例如, 当对某一个动作进行修改时, 则需要对相关的流表项都进 行修改。 发明内容
本发明实施例提供了一种在 SDN中处理报文的方法和转发器,用以减少转发器中存储的 冗余信息, 提高转发器对报文的处理能力。
第一方面, 提供了一种在 SDN中处理报文的方法, 该方法由转发器执行, 具体包括: 接收输入报文;
根据所述输入报文确定所述输入报文所属的流;
根据流与上下文标识集合之间的第一对应关系确定所述输入报文所属的流对应的上下文 标识集合; 所述第一对应关系中每个流对应的上下文标识集合包括至少一个上下文标识; 根据上下文标识与上下文之间的第二对应关系确定与所述上下文标识集合相对应的上下 文;
根据所述上下文标识集合对应的上下文对所述输入报文进行处理。
结合第一方面, 在第一方面的第一种可能的实现方式中, 所述方法还包括: 根据所述第 一对应关系确定所述输入报文所属的流对应的上下文标识集合之前, 判断所述第一对应关系 中有没有与所述输入报文所属的流相对应的上下文标识集合;
如果有,
则执行所述根据所述第一对应关系确定所述输入报文所属的流对应的上下文标识集合的 步骤;
如果没有, 则执行如下步骤:
发送流规则请求消息给控制器, 所述流规则请求消息中包括所述输入报文的报文头或内 容;
接收所述控制器发送的流规则安装消息, 所述流规则安装消息中包括所述输入报文的流 对应的上下文标识集合;
在所述第一对应关系中添加所述输入报文的所属的流的信息, 以及与所述输入报文的流 相对应的上下文标识集合。
结合第一方面或第一方面第一种可能的实现方式, 在第一方面的第二种可能的实现方式 中, 所述方法还包括:
根据上下文标识与上下文之间的第二对应关系确定与所述上下文标识集合相对应的上下 文之前, 判断所述第二对应关系中有没有与所述上下文标识集合相对应的上下文;
如果有,
则执行所述根据所述第二对应关系确定所述上下文标识集合对应的上下文的步骤; 如果所述上下文集合中的部分或全部上下文标识没有对应的上下文, 则执行如下步骤: 发送上下文请求消息给所述控制器, 所述上下文请求消息中包括所述上下文标识集合中 的所述部分或全部上下文标识;
接收所述控制器发送的上下文安装消息, 所述上下文安装消息中包括所述上下文标识集 合中的部分或全部上下文标识、 以及与所述上下文标识集合中的部分或全部上下文标识相对 应的上下文;
在所述第二对应关系中, 添加所述上下文标识集合中的部分或全部上下文标识、 以及与 所述上下文标识集合中的部分或全部上下文标识相对应的上下文。
第二方面, 提供了一种在 SDN中使用的转发器, 包括一个接收器, 一个处理器和一个存 储器:
所述存储器, 用于存储流与与上下文标识集合之间的第一对应关系, 以及上下文标识与 上下文之间的第二对应关系; 所述第一对应关系中每个流对应的上下文标识集合包括至少一 个上下文标识;
所述接收器, 用于接收输入报文;
所述处理器, 用于根据所述输入报文确定所述输入报文所属的流; 根据所述存储器存储 的的第一对应关系确定所述输入报文所属的流对应的上下文标识集合; 根据所述存储器存储 的第二对应关系确定与所述上下文标识集合相对应的上下文; 并根据所述上下文标识集合对 应的上下文对所述输入报文进行处理。
结合第二方面,在第二方面的第一种可能的实现方式中,所述转发器还包括一个发送器; 所述处理器还用于: 根据所述存储器存储的所述第一对应关系确定所述输入报文所属的 流对应的上下文标识集合之前, 判断所述第一对应关系中有没有与所述输入报文所属的流相 对应的上下文标识集合; 如果有, 则根据所述第一对应关系确定所述输入报文所属的流对应 的上下文标识集合; 如果没有, 则通知所述发送器发送流规则请求消息给控制器, 所述流规 则请求消息中包括所述输入报文的报文头或内容;
所述接收器, 还用于用于接收所述控制器发送的流规则安装消息, 所述流规则安装消息 中包括所述输入报文的流对应的上下文标识集合;
所述处理器, 还用于在所述第一对应关系中添加所述输入报文的所属的流的信息, 以及 与所述输入报文的流相对应的上下文标识集合。
结合第二方面或第二方面第一种可能的实现方式, 在第二方面的第二种可能的实现方式 中, 所述处理器, 还用于根据所述存储器存储的第二对应关系确定与所述输入报文所属的流 对应的上下文标识集合相对应的上下文之前, 判断第二对应关系中有没有与输入报文所属的 流对应的上下文标识集合相对应的上下文; 如果有, 则根据所述存储器存储的第二对应关系 确定与所述上下文标识集合相对应的上下文; 如果所述上下文标识集合中的部分或全部上下 文标识没有对应的上下文, 则通知所述发送器;
所述发送器用于发送上下文请求消息给所述控制器, 所述上下文请求消息中包括所述输 入报文所属的流对应的上下文标识集合中的部分或全部上下文标识;
所述接收器, 还用于接收所述控制器发送的上下文安装消息, 所述上下文安装消息中包 括所述上下文标识集合中的所述部分或全部上下文标识、 以及与上下文标识集合中的所述部 分或全部上下文标识相对应的上下文;
所述处理器还用于, 在所述第二对应关系中, 添加所述上下文标识集合中的所述部分或 全部上下文标识、 以及与上下文标识集合中的所述部分或全部上下文标识相对应的上下文。
第三方面,提供了另外一种在 SDN中处理报文的方法,该方法由转发器执行,具体包括: 接收输入报文;
根据所述输入报文确定所述输入报文所属的流;
判断流与上下文标识集合之间的第一对应关系中有没有与所述输入报文所属的流相对 应的上下文标识集合; 如果有, 则根据所述第一对应关系确定所述输入报文所属的流对应的 上下文标识集合; 如果没有, 则发送流规则请求消息给控制器, 所述流规则请求消息中包括 所述输入报文的报文头或内容; 接收所述控制器发送的流规则安装消息, 所述流规则安装消 息中包括所述输入报文的流对应的上下文标识集合;
根据上下文标识与上下文之间的第二对应关系确定与所述上下文标识集合相对应的上 下文;
根据所述上下文标识集合对应的上下文对所述输入报文进行处理。
结合第三方面, 在第三方面的第一种可能的实现方式中, 所述方法还包括:
根据上下文标识与上下文之间的第二对应关系确定与所述上下文标识集合相对应的上 下文之前, 判断所述第二对应关系中有没有与所述上下文标识集合相对应的上下文;
如果有,
则执行所述根据所述第二对应关系确定所述上下文标识集合对应的上下文的步骤; 如果所述上下文集合中的部分或全部上下文标识没有对应的上下文, 则执行如下步骤: 发送上下文请求消息给所述控制器,所述上下文请求消息中包括所述上下文标识集合中 的所述部分或全部上下文标识;
接收所述控制器发送的上下文安装消息,所述上下文安装消息中包括所述上下文标识集 合中的部分或全部上下文标识、 以及与所述上下文标识集合中的部分或全部上下文标识相对 应的上下文;
在所述第二对应关系中, 添加所述上下文标识集合中的部分或全部上下文标识、 以及与 所述上下文标识集合中的部分或全部上下文标识相对应的上下文。
第四方面, 提供了另外一种转发器, 包括接口, 处理器和存储器;
所述存储器, 用于存储流与与上下文标识集合之间的第一对应关系, 以及上下文标识与 上下文之间的第二对应关系; 所述第一对应关系中每个流对应的上下文标识集合包括至少一 个上下文标识;
所述接口, 用于接收输入报文;
所述处理器用于判断所述存储器存储的第一对应关系中有没有与所述输入报文所属的 流相对应的上下文标识集合; 如果有, 则根据所述第一对应关系确定所述输入报文所属的流 对应的上下文标识集合; 如果没有, 则通知所述接口;
所述接口用于在收到处理器发送的通知后发送流规则请求消息给控制器, 所述流规则请 求消息中包括所述输入报文的报文头或内容;
所述接口, 还用于接收所述控制器发送的流规则安装消息, 所述流规则安装消息中包括 所述输入报文的流对应的上下文标识集合;
所述处理器, 还用于根据所述存储器存储的第二对应关系确定与所述上下文标识集合相 对应的上下文; 并根据所述上下文标识集合对应的上下文对所述输入报文进行处理。 结合第四方面, 在第四方面的第一种可能的实现方式中, 所述处理器还用于, 在根据所 述存储器存储的第二对应关系确定与所述输入报文所属的流对应的上下文标识集合相对应的 上下文之前, 判断第二对应关系中有没有与输入报文所属的流对应的上下文标识集合相对应 的上下文; 如果有, 则根据所述存储器存储的第二对应关系确定与所述上下文标识集合相对 应的上下文; 如果所述上下文标识集合中的部分或全部上下文标识没有对应的上下文, 则通 知所述发送器;
所述发送器还用于在收到所述处理器的通知后发送上下文请求消息给所述控制器, 所述 上下文请求消息中包括所述输入报文所属的流对应的上下文标识集合中的部分或全部上下文 标识;
所述接收器, 还用于接收所述控制器发送的上下文安装消息, 所述上下文安装消息中包 括所述上下文标识集合中的所述部分或全部上下文标识、 以及与上下文标识集合中的所述部 分或全部上下文标识相对应的上下文;
所述处理器还用于, 在所述第二对应关系中, 添加所述上下文标识集合中的所述部分或 全部上下文标识、 以及与上下文标识集合中的所述部分或全部上下文标识相对应的上下文。
本发明实施例中的流是与上下文标识的集合相对应的, 流与上下文之间没有直接关联, 当有多个流共用一个上下文时, 这个上下文也不需要被保存多遍, 在与现有技术相同的硬件 条件下, 本发明的实施例将使得转发器的存储能力和处理能力大大提高。 附图说明
为了更清楚地说明本发明实施例的技术方案, 下面将对实施例或现有技术描述中所需要 使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明的一些实施例, 对 于本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他 的附图。
图 1为本发明实施例提供的一种 SDN的架构示意图;
图 2为本发明实施例提供的一种转发器的組成示意图;
图 3为本发明实施例提供的一种转发器处理报文的方法流程示意图;
图 4为本发明实施例提供的一种 OpenFlow转发器处理输入报文的方法流程示意图; 图 5为本发明实施例提供的一种转发器安装流或上下文的方法流程示意图;
图 6a为本发明实施例提供的一种转发器与控制器进行协商的方法流程示意图; 图 6b为本发明实施例提供的另一种转发器与控制器进行协商的方法流程示意图; 图 7为本发明实施例提供的一种控制器查询、 修改或刪除流的信息、 流对应的 CID集合 或 CID对应的上下文的方法流程示意图。 具体实施方式
下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描 述, 显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于本发明中的 实施例, 本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例, 都属 于本发明保护的范围。
图 1为 SDN的结构示意图, SDN中至少包括转发器 14和控制器 12。 转发器 14负责数 据层的转发; 控制器 12负责对网络进行集中控制, 实现控制层的功能。 转发器 14与控制器 12之间通过控制协议进行通信。一个转发器可以与一个或多个其它的转发器相连, 也可以与 一个或多个发送 /接收报文的实体 (例如, 固定终端、 移动终端、 个人电脑等) 相连。
图 2为转发器的組成示意图, 转发器 14包括接口 1402, 处理器 1404和存储器 1406。 转 发器 14通过接口 1402与控制器 12或其它网络实体之间进行通信。 接口 1402用于接收来自 控制器 12或其它网络实体的消息、 信息、 报文或数据等; 或用于向自控制器 12或其它网络 实体发送消息、 信息、 报文或数据等。 处理器 1404可以对接口 1402接收到的消息、 信息、 报文或数据等进行一些相应的处理。存储器 1406可以用于存储流与上下文的信息。除此之外, 存储器 1406还可以用于存储其它信息, 例如, 用于存储接收器 2002接收到的消息、 信息、 报文或数据, 或存储处理器 1404的处理结果等。 存储器 1406中存储的流与上下文的信息又 包括: 流与上下文标识 (英文全称: Context Identifier, 英文简称: CID) 集合之间的第一对 应关系, 以及 CID与上下文之间的第二对应关系。
为了方便描述, 下面将流与 CID集合之间的第一对应关系称为流表, "流表 "这个名称并 不用于限制第一对应关系的存储形式,因为存储器 1406在存储第一对应关系时可以是通过表 的形式、 也可以是通过其它的形式, 例如某个存储单元与另外的一个或多个存储单元相映射 的形式。
存储器 1406中可以存储一个或多个流表。表 3为本发明实施例中一种流表的结构示意图。 表 3所示的流表与表 1所示的现有技术的流表不同,现有技术的流表中每个流是直接与 Action 相关联的,而本发明实施例的流表中每个流与 CID相关联,其与上下文之间没有直接的联系。
流表中每个流的信息 (如, 流匹配域) 与 CID集合之间的对应关系都可以称为一个流表 项,如表 3所示。流匹配域是用来识别流的,流匹配域包含识别报文所属的流所需要的信息, 其结构中可以包括表 2所示的不同元組的任意組合, 也可以包括其他内容, 例如: 多协议标 记交换 (英文全称: Multiprotocol Label Switching, 英文简称: MPLS) 标识、 差分服务码点 (英文全称: differentiated services code point, 英文简称: DSCP) 码、 传输层协议类型、 通 用路由封装协议标识(英文全称: Generic Routing Encapsulation Identifier,英文简称: GRE ID)、 GPRS 隧道协议的隧道端点标识(英文全称: tunnel endpoint identifier of GPRS tunneling protocol, 英文简称: GTP TEID)等, 或采用报文偏移值、 匹配长度等組成。
表 3中的每个流与一个 CID集合相对应, 每个 CID集合中包括至少一个 CID。 CID用于 唯一标识一个上下文, 其表现形式可以有很多种, 例如, 可以为任意进制的字符、 数字、 字 母、数字加上字母、或数字加上其它字符等。除此之外, CID还可以用于指示上下文的类型。
表 3
Figure imgf000010_0001
除了上述流表外, 存储器 1406中还保存了 CID与上下文之间的第二对应关系, 为了方 便描述, 下面将 CID与上下文之间的第二对应关系称为上下文列表, 同样, 此名称并不用于 限制第二对应关系的存储形式,因为存储器 1406在存储第二对应关系时可以是通过表的形式、 也可以是通过其它的形式, 例如某个存储单元与另外的一个或多个存储单元相映射的形式。
表 4为本发明实施例中一种上下文列表的结构示意图。 表 4中的每个 CID都对应了一个 上下文。 上下文包括对报文进行某种处理所需要的信息。
现有技术的 Action 中除了包括需要对报文进行处理的信息外, 还包括了报文的类型 (Action Type) , 而在本发明实施例中, 转发器通过 CID 已经可以知道相应上下文的类型, 因此上下文中不会再包括类似 Action Type这样的信息。上下文的类型有很多种, 本发明实施 中 CID指示的上下文类型除了包括现有技术的 action类型 (如转发报文、 丟弃报文等) 夕卜, 还可以包括其它类型, 使得转发器可以对输入报文进行更多样的处理。 例如, 上下文的类型 还可以包括带宽控制、 深度解析 (Deep Packet Inspection, DPI) , 在线计费、 离线计费、 防火 墙处理、 网络地址转换 (Network Address Translation, NAT;)、 合法监听、 报文重組、 链路检测 (如基于双向转发检测协议 (Bidirectional Forwarding Detection Protocol, BFDP)、 链路层发现 协议 (Link Layer Discovery Protocol, LLDP)等进行检测)、 等等。 不同的上下文类型又对应着 不同的上下文, 例如, 带宽控制类型的上下文可以包括允许的最大带宽大小、 保证的带宽大 小、 转发的优先级等; 离线计费类型的上下文可以包括离线计费組的組标识, 计费信息上报 的间隔等;而路由转发类型的上下文可以包括转发端口号、源 MAC地址或目的 MAC地址等。 表 4
Figure imgf000011_0001
如果需要根据相同的上下文对不同的流进行处理, 那么在流表中被重复保存的只有该上 下文对应的 CID,该上下文并不需要被重复保存。例如,转发器只需要将该上下文对应的 CID 保存在流表中每个流对应的 CID集合中就可以了,而该上下文只需在 CID与上下文的对应关 系中被保存一遍。 通过此种方式可以为转发器节省更多的存储空间, 而节省下来的存储空间 又可以让转发器存储更多的上下文, 因此, 在与现有技术相同的条件下, 本发明实施例中的 转发器可以存储更多的上下文, 对报文的处理也可以支持更多的上下文类型。
另外, 本发明实施例中对报文执行的上下文处理可以用来实现比现有的 Action更为复杂 的处理逻辑。 现有技术中, OpenFlow转发器在执行 action时仅仅是对当前报文进行处理, 转 发器不会对已处理的报文进行状态的維护, 因此 action只能用于对单个报文进行无状态的处 理 (stateless handling), 而无法根据某个流以前的报文的处理结果对后续报文进行有状态的处 理。 而以前的报文的处理结果对于某些复杂处理行为, 例如报文保序、 DPI、 病毒检测等是必 须的。 因此, 鉴于目前 action设计的局限性, 现有技术中的 OpenFlow转发器只适用于对报 文执行比较简单的动作, 对于复杂的动作, 还无法实现。 本发明实施例中的转发器通过上下 文处理单元, 可以对报文处理后的状态进行保存, 从而可以对报文进行更为复杂的处理。
为了方便理解, 下面将通过具体的例子对本发明提供的转发器进行阐述。
例如, 参见图 2所示, 转发器 14的接口 1402可以包括一个接收器 14022, 用于接收到 输入报文。 该输入报文可以是另外一个转发器发送的, 也可以是其它实体 (例如, 计算机、 移动终端、 固定终端等) 发送的。
处理器 1404用于确定所述输入报文所属的流; 例如, 根据输入报文的报文头或内容确定 所述输入报文所属的流。
处理器 1404还用于根据存储器 1406存储的第一对应关系确定所述输入报文所属的流对 应的 CID集合; 根据存储器 1406存储第二对应关系确定与所述 CID集合相对应的上下文, 并根据所述 CID集合对应的上下文对所述输入报文进行处理。 处理器 1404对输入报文进行处理后会得到一个上下文处理结果。在另外一个例子中, 参 见图 2所示, 转发器 14的接口 1402还可以包括一个发送器 14024。 所述发送器 14024用于 将所述处理器 1404对输入报文进行处理后得到的上下文处理结果发送给控制器 12。
接控制器 12收到发送器 14024发送的上下文处理结果后可以根据上下文处理结果确定是 否需要继续对输入报文进行处理, 如果需要, 将为所述输入报文新确定的流和新确定的 CID 集合发送给转发器 14。 转发器 14中的接收器 14022还可以用于接收控制器 12为输入报文新 确定的流和新确定的上下文标识集合,以便通知处理器 1404根据所述新确定的上下文标识集 合对应的上下文对所述输入报文进行进一步的处理。 正常情况下, 在收到输入报文之前, 存储器 1406中已经保存了大部分的流对应的 CID集 合。但是偶尔也会出现在存储器 1406存储的第一对应关系中找不到输入报文的流对应的 CID 集合的情况, 此时转发器 14可以从控制器 12获取输入报文的流对应的 CID集合。 在本发明 的另外一个例子中, 当处理器 1404确定所述输入报文所属的流之后, 处理器 1404还可以用 于: 判断第一对应关系中有没有与所述输入报文所属的流相对应的 CID集合, 如果有, 则处 理器 1404根据所述第一对应关系确定所述输入报文所属的流对应的 CID集合; 如果没有, 则处理器 1404通知发送器 14024发送发送流规则请求消息给控制器 12, 所述流规则请求消 息中包括所述输入报文的报文头或内容;
所述接收器 14022进一步用于接收所述控制器 12发送的流规则安装消息, 所述流规则安 装消息中包括所述输入报文的流对应的 CID集合。 之后, 处理器 1404可以根据存储器 1406 存储第二对应关系确定与所述 CID集合相对应的上下文,并根据所述 CID集合对应的上下文 对所述输入报文进行处理。
可选地, 所述处理器 1404还可以在所述第一对应关系中添加所述输入报文的所属的流的 信息, 以及与所述输入报文的流相对应的 CID集合。
现有技术中, 每当转发器向控制器请求输入报文的流对应的 Action 时, 控制器都会将 Action携带在流规则安装消息中发送给控制器。 由于 Action包含的处理参数较多, 为了满足 传输各种类型 Action的要求, 流规则安装消息需要设计得比较长, 但流规则安装消息设计得 太长又会导致传输时间延长, 并且影响了报文的处理效率。 通过本发明提供的例子正好可以 解决这个问题, 当控制器收到来自转发器的流规则请求消息时, 控制器只需要将输入报文的 流对应的 CID集合通过流规则安装消息发送给转发器,如果转发器已经存储了该 CID集合对 应的上下文, 则转发器只需要根据 CID集合中的每个 CID找到相应的上下文就可以了。 由于 CID集合占用的空间很小, 传输 CID集合的流规则安装消息不需要设计得太长, 由此传输流 规则安装消息所用的时间也会变短, 转发器处理报文的效率也能够得到一定程度的提高。 当然, 除了上述例子描述的方法外, 控制器 12还可以将 CID集合对应的上下文与 CID 集合一起发给转发器 14。 例如, 控制器 12发送的流规则安装消息中还可以包括与所述 CID 集合相对应的上下文。 在这种情况下, 流规则安装消息的格式可以如下:
<流规则安装消息>:={流的信
息, CIDl,CID2,CID3>,[CIDl,Contextl],[CID2,Context2],[CID3,Context3]}
接收器 14022收到所述流规则安装消息后,如果处理器 1404发现第二对应关系中没有保 存所述 CID集合中的部分或全部 CID、 以及与该部分或全部 CID相对应的上下文; 则处理器 1404在第二对应关系中,添加该部分或全部 CID、以及与该部分或全部 CID相对应的上下文。 同理, 正常情况下, 在收到输入报文之前, 存储器 1406存储的第二对应关系中已经保存 了大部分 CID和 CID对应的上下文。 但是偶尔也会出现在存储器 1406存储的第二对应关系 中找不到某个或某几个 CID对应的上下文的情况, 此时转发器 14可以从控制器 12获取输入 该某个或某几个 CID对应的上下文。 例如, 在另外一个例子中, 处理器 1404在根据存储器 1406存储的第二对应关系确定与所述 CID集合相对应的上下文之前,还可以判断第二对应关 系中有没有与输入报文所属的流对应的 CID集合相对应的上下文;如果有,则根据存储器 1406 存储第二对应关系确定与所述 CID集合相对应的上下文;如果所述 CID集合中的部分或全部 CID没有对应的上下文, 则通知发送器 14024发送上下文请求消息给控制器 12, 所述上下文 请求消息中包括所述输入报文所属的流对应的 CID集合中的部分或全部 CID。
所述接收器 14022还用于接收控制器 12发送的上下文安装消息, 所述上下文安装消息中 包括所述 CID集合中的部分或全部 CID,以及所述 CID集合中的部分或全部 CID对应的上下 文。
可选地, 所述处理器 1408还可以用于在所述第二对应关系中, 添加所述 CID集合中部分 或全部 CID、 以及与所述部分或全部 CID相对应的上下文。
转发器对报文进行处理后会得到各种处理结果, 对于某些处理结果转发器需要上报给控 制器。例如,合法监听得到的相关信息,或执行 NAT服务后得到的结果等等。对于某些结果, 转发器可能需要执行进一步地处理, 例如, 在本发明另外一个例子中, 转发器 14中的处理器 1408在对输入报文进行处理后得到的处理结果有可能是一个新生成的报文。 转发器 14对新 生成的报文的处理和对输入报文的处理类似, 在此不再详述。
现有技术中, OpenFlow的 action仅仅规定了对当前报文进行何种处理, 对报文的处理 结果转发器是不会維护的, 因此, 对于需要基于上一次对报文的处理结果来执行下一次的处 理时, 现有技术中的 action是无法实现的。 上述例子中描述的第一对应关系可以是技术人员在对转发器 14进行初始设置时存储在 存储器 1406中的,也可以是转发器 14在与控制器 12建立连接后由控制器 12发送给转发器 14 的,例如,接收器 14022在接收输入报文之前,可以先接收控制器 12发送的流规则安装消息, 所述流规则安装消息中包括转发器 14支持的部分或全部流的信息、 以及与所述转发器 14支 持的部分或全部流相对应的 CID集合。 接收器 14022通知存储器 1406将所述转发器 14支持 的部分或全部流的信息、 以及与所述转发器 14支持的部分或全部流相对应的 CID集合—— 对应地保存, 以形成第一对应关系。 同理,上述例子中描述的第二对应关系可以是技术人员在对转发器 14进行初始设置时存 储在存储器 1406中的, 也可以是转发器 14在与控制器 12建立连接后由控制器 12发送给转 发器 14的, 例如, 接收器 14022在接收输入报文之前, 可以先接收控制器 12发送的上下文 安装消息, 所述上下文安装消息中包括转发器 14 支持的部分或全部 CID、 以及所述转发器 14支持的部分或全部 CID对应的上下文;接收器 14022通知存储器 1406将所述转发器 14支 持的部分或全部 CID、 以及与所述转发器 14支持的部分或全部上 CID相对应的上下文—— 对应地保存, 以形成第二对应关系。 在另外一个例子中, 在转发器 14与控制器 12通信之前, 转发器 14可以先与控制器 12 进行协商, 以获知对端对流和上下文的处理能力。 例如, 转发器 14中的发送器 14024向控制 器 12发送能力协商请求消息,该能力协商请求消息中包括所述转发器支持的上下文能力列表 以使所述控制器 12将转发器 14能够支持的部分或全部上下文发送给转发器 14 ;接收器 14022 接收所述控制器 12发送的协商应答消息, 所述协商应答消息中可以包括控制器 12支持的上 下文能力列表, 以使所述转发器 14根据所述控制器 12支持的下文能力列表向所述控制器请 求控制器能够支持的部分或全部上下文。 上述转发器 14与控制器 12之前的协商也可以是由控制器 12主动发起的, 例如, 转发 器 14中的接收器 14022接收控制器 12发送的能力协商请求消息, 该能力协商请求消息中包 括控制器 12支持的上下文能力列表,以使转发器 14根据所述控制器 12支持的下文能力列表 向控制器 12请求控制器能够支持的部分或全部上下文; 转发器 14中的发送器 14024向控制 器 12发送协商应答消息, 所述协商应答消息中可以包括转发器 14支持的上下文能力列表, 以使所述控制器 12将转发器能够支持的部分或全部上下文发送给转发器 14。 控制器 12可以对转发器 14的存储器 1406中存储的第一对应关系或第二对应关系进行管 理, 例如, 对第一对应关系或第二对应关系中的信息进行查询、 修改或刪除等。
例如, 如果控制器 12要查询某个流对应的 CID集合, 则控制器 12会发送一个流规则查 询请求消息给转发器 14, 转发器 14中的接收器 14022接收控制器 12发送的流规则查询请求 消息, 所述查询请求消息中包括待查询的流的信息; 处理器 1406根据所述第一对应关系找到 所述待查询流对应的 CID集合, 并通知发送器 14024发送流规则查询应答消息给所述控制器
12,所述流规则查询应答消息中包括所述待查询的流的信息,以及所述待查询的流对应的 CID 集合。 又例如, 如果控制器 12要查询某个或某几个 CID对应的上下文, 则控制器 12会发送一 个上下文查询请求消息给转发器 14, 转发器 14中的接收器 14022接收控制器 12发送的上下 文查询请求消息,所述查询请求消息中包括待查询的 CID ;待查询的 CID可以是一个或多个; 处理器 1404根据第二对应关系找到的待查询的 CID对应的上下文, 并通知发送器 14024发 送上下文查询应答消息给所述控制器, 该查询应答消息中包括待查询的 CID对应的上下文。 可选地, 上述查询应答消息中还可以包括所述待查询的 CID。 又例如, 如果控制器 12要修改某个流对应的 CID集合, 则控制器 12会发送一个流修改 消息给转发器 14, 转发器 14中的接收器 14022接收所述控制器 12发送的流规则修改消息, 所述流修改消息中包括待修改的流的信息, 以及所述待修改的流对应的新的 CID集合; 接收 器 14022通知处理器 1404在所述第一对应关系中将所述待修改的流对应的 CID集合修改为 所述新的 CID集合。 例如, 接收器 14022收到控制器 12发送的流规则修改消息, 该流规则 修改消息中包括的待修改的流的信息为:源 IP地址为 10.88.85.55、 目的 IP地址为 10.88.80.56 的流, 待修改的流对应的新的 CID集合为 CID1、 CID2、 CID5。 假设在第一对应关系中, 源 IP 地址为 10.88.85.55、 目的 IP 地址为 10.88.80.56 的流原本对应的 CID 集合为: CIDl,CID2,CID3 c 则接收器 14022收到上述流修改消息后, 通知处理器 1404将源 IP地址为 10.88.85.55、 目的 IP地址为 10.88.80.56的流对应的 CID集合修改为 CID1、 CID2、 CID5。 又例如, 如果控制器 12要修改某个或某几个 CID对应的上下文, 则控制器 12会发送一 个上下文修改消息给转发器 14, 转发器 14的接收器 14022接收所述控制器 12发送的上下文 修改消息, 所述上下文修改消息中包括待修改的 CID, 以及所述待修改的上下文的标识对应 的新的上下文; 接收器 14022通知处理器 1404在所述第二对应关系中将所述待修改的 CID 对应的上下文修改为所述新的上下文。 例如, CID1 原本对应的上下文为 Contextla, 如果接 收器 14022收到的上下文修改消息中包括 CID1、 以及 CID1对应的新的上下文 Contextlb, 则 通知处理器 1404在第二对应关系中将 CID1对应的上下文修改为 Contextlb。 又例如, 如果控制器 12要刪除某个流的信息, 控制器 12会发送一个流刪除消息给转发 器 14, 转发器 14中的接收器 14022接收控制器 12发送的流刪除消息, 该流刪除消息中包括 待刪除流的信息;接收器 14022通知处理器 1404从第一对应关系中刪除所述待刪除的流的信 息、 以及与所述待刪除的流对应的 CID集合。
可选地, 如果被刪除的流对应的部分或全部 CID没有对应其它的流, 则处理器 1404还可 以从所述第二对应关系中刪除所述被刪除的流对应的部分或全部 CID、 以及与所述被刪除的 流对应的部分或全部 CID相对应的上下文。
例如,假设流 1对应的 CID集合包括 CID1、CID2 ;流 2对应的 CID集合包括 CID1、CID3。 当处理器 1404从第一对应关系中刪除了流 1的信息后, 处理器 1404发现 CID2只与流 1对 应, 则处理器 1404还可以从第二对应关系中刪除 CID2对应的上下文。 而 CID1不仅与流 1 对应,其还与流 2对应, 因此处理器 1404不会刪除 CID1对应的上下文。
假设流 2的信息也被刪除后, 处理器 1404发现 CID1没有对应其它流了, 则从第二对应 关系中刪除 CID1对应的上下文。
可选地, 处理器 1404还可以通知发送器 14024将被刪除的流的信息或被刪除的上下文对 应的 CID上报给控制器 12。 又例如, 如果控制器 12要刪除某个上下文, 控制器 12会发送一个上下文刪除消息给转 发器 14, 转发器 14中的接收器 14022用于接收控制器 12发送的上下文刪除消息, 所述上下 文刪除消息中包括至少一个待刪除的上下文标识;接收器 14022用于通知处理器 1404从第二 对应关系中, 刪除所述至少一个待刪除的 CID、 以及与所述至少一个待刪除的 CID相对应的 上下文。
可选地, 处理器 1404在刪除第二对应关系中的某个上下文后还可以对第一对应关系进行 相应地修改, 例如, 处理器 1404 在第一对应关系中, 刪除与所述已经刪除的上下文对应的 CID。
上下文的刪除可能会导致处理器 1404在处理该上下文的 CID对应的流时出现问题,因此, 处理器 1404在第一对应关系中刪除与已经刪除的上下文对应的 CID之后, 还可以在所述第 一对应关系中, 刪除与所述被刪除的 CID相对应的流的信息。
例如,假设流 1对应的 CID集合包括 CID1、CID2 ;流 2对应的 CID集合包括 CID1、CID3。 当处理器 1404从存储器 1406存储的第二对应关系中刪除了 CID1对应的上下文后, 处理器 1404发现与 CID1对应的流有流 1和流 2, 则处理器 1404还可以在第一对应关系中刪除流 1 的信息和流 2的信息。 并且, 处理器 1404还可以刪除分别与流 1和流 2对应 CID集合。
可选地,处理器 1404还可以通知发送器 14024将被刪除的上下文对应的 CID或被刪除的 流的信息上报给控制器 12。
通过上述本发明提供的例子控制器 12可以对转发器 14上保存的第一对应关系和第二对 应关系进行有效的管理。 在介绍完了本发明实施例提供的转发器后, 下面将通过一些例子, 对本发明实施例提供 的方法进行介绍。
图 3为本发明实施例提供的一种转发器处理报文的方法流程示意图, 具体如下: 步骤 302: 转发器接收输入报文;
该输入报文可以是另外一个转发器发送的, 也可以是其它实体 (例如, 计算机、 移动终 端、 固定终端等) 发送的。
步骤 304 : 转发器根据输入报文确定该输入报文所属的流;
转发器可以根据输入报文的报文头或内容确定该输入报文所属的流。 输入报文所属的流 可以是一个也可以是多个。
例如, 转发器接收输入报文后, 输入报文的报文头如下:
MACl|MAC2|IP-TYPE(0x0800)|IPl|IP2|TCP-TYPE(6)|PORTl|PORT2, 其中 MAC1为报文 的 MAC源地址; MAC2为报文的 MAC 目的地址; ΙΡ-ΤΥΡΕ<;0Χ800;)表示报文的网络层协议 为 IPv4协议, IP1为报文的 IP源地址; IP2为报文的 IP目的地址; TCP-TYPE )表示报文的 传输层协议为 TCP协议, PORT1为报文的源 TCP端口号, PORT2为报文的目的 TCP端口号。
通过输入报文的报文头的部分或全部内容就可以确定该输入报文是属于哪个流的。 以上 面的报文头为例, 根据上述报文头就可确定该输入报文属于 MAC源地址为 MAC1、 MAC目 的地址为 MAC2的流; 或者该输入报文属于 IP源地址为 IP1、 IP源地址为 IP2的流等等。
步骤 306 : 转发器根据流与 CID之间的第一对应关系确定输入报文所属的流对应的 CID 集合; 第一对应关系中每个流对应的 CID集合包括至少一个 CID ;
假设转发器中只有一个流表, 该流表中包括如表 5所示的流表项, 表 5的第一列表示流 匹配域, 第二列表示与该流匹配域相匹配的 CID集合。
表 5
Figure imgf000018_0001
转发器将输入报文的报文头与流表 5 中的流匹配域进行匹配, 发现该输入报文所属的流
(MAC源地址为 MAC1、 MAC目的地址为 MAC2的流) 对应的 CID集合为 CID集合 1。
当输入报文的报文头能够匹配到流表中的多个流表项时, 转发器根据流表项的优先级选 择优先级最高的流表项作为与该输入报文相匹配的流表项。
步骤 308 : 转发器根据 CID与上下文之间的第二对应关系确定与输入报文所属的流对应 的 CID集合相对应的上下文;
例如, 假设上述 CID集合 1中只包括一个 CID, 例如 CID=5。 转发器中保存的 CID与上 下文之间的第二对应关系如下表 6所示:
表 6
Figure imgf000018_0002
根据上面的描述, 输入报文所属的第一个流对应的 CID集合为 CID集合 1, 假设 CID集 合 1中只有一个编号为 5的 CID,则转发器根据编号为 5的 CID可以找到其对应的上下文为: outport: 1
步骤 310: 转发器根据步骤 308确定出的上下文对输入报文进行处理。
例如, 编号为 5的 CID对应的 Context为: outport: l, 则转发器将该输入报文转发到端口
1。
通过上述实施例描述的方法, 转发器可以存储更多的上下文, 其对报文的处理可以支持 更多种类型, 由此提高了转发器处理报文的能力。 上述实施例描述的方法还适输入报文所属的流有多个的情况, 例如, 当转发器在步骤 304 中确定输入报文所属的流两个时, 转发器在执行完步骤 310后还可以跳转到步骤 306, 根据 另外一个流表来确定输入报文所属的另外一个流对应的 CID集合。 例如, 假设转发器中另外 一个流表中包括如表 7所示的流表项, 表 7的第一列表示流匹配域, 第二列表示与该流匹配 域相匹配的 CID集合。
表 7
Src-IP=IPl,dst-IP=IP2 CID集合 2
转发器将输入报文的头与转发器中的流表 7中的流匹配域进行匹配, 发现该输入报文所 属的另外一个流(IP源地址为 IP1、 IP目的地址为 IP2的流)对应的 CID集合为 CID集合 2。 之后, 转发器可以根据 CID集合 2对应的 CID对输入报文进行处理。
如果输入报文所属的流对应的 CID集合中包括多个 CID 则转发器在根据该多个 CID对
Figure imgf000019_0001
据该至少两个上下文对输入报文进行处理。
上下文的执行顺序可以通过如下三种方式来表示。
( 1 ) 在第一对应关系中, 对每个流对应的 CID集合中的每个 CID都设置一个序号。 例 如, 输入报文所属的流对应的 CID集合为 CID1-CID5 , CID1-CID5对应的序号分别如下表 8 的第二列所示。 转发器在根据 CID1-CID5对应的上下文对输入报文进行处理时会按照第二列 的顺序进行, 由于 CID3和 CID4具有相同的序号, 则转发器会同时根据 CID3和 CID4对应 的上下文对输入报文进行处理。
表 8
Figure imgf000019_0002
(2) 在第一对应关系中, 对每个流对应的 CID集合中的每个 CID都有一个默认的排列 顺序, 部分 CID都可能与其它的 CID之间有关联关系。 例如, 输入报文所属的流对应的 CID 集合如下表 9所示, 第一列表示 CID的排列顺序, 第二列表示每个 CID与其它 CID的关联 关系。 当转发器根据 CID1-CID5对输入报文进行处理时, 对于没有与其他 CID关联的 CID 则按照表 9第一列中 CID的排列顺序进行处理。 由于第二列中指示了 CID3和 CID4是相关 联的, 则转发器会同时根据 CID3和 CID4对应的上下文对输入报文进行处理。
表 9
Figure imgf000020_0001
(3 ) 在第一对应关系中, 对每个流对应的 CID集合以及 CID集合中每个 CID的执行顺 序可以通过两个列表来表示。 例如, 输入报文所属的流对应的 CID集合如下表 10所示, 表 10从上到下用于指示 CID默认的排列顺序, 表 11用于指示 CID之间的关联关系。 对于在表 11中记录了有关联关系的 CID,转发器在根据这些 CID对应的上下文对对输入报文进行处理 会同时进行。 对于表 11中没有记录关联关系的 CID, 交换会按照表 10所示的 CID的默认的 排列顺序来对输入报文进行处理。
表 10
CID1
CID2
CID3
CID4
CID5
表 11
CID2, CID3 , CID4
现有技术中, 转发器只能按照输入报文的流对应的 Action的排列顺序来顺序执行。 而本 发明的实施例中, 由于引入了 CID的序列号或 CID之间的关联关系, 使得部分 CID对应的 上下文可以被并行处理, 由此提高了转发器处理报文的效率。
但在实际应用中, 并不是所有的上下文类型都是可以被并行处理的, 只有在某两个或某 几个上下文的处理结果之间不会相互影响情况下,这某两个或某几个上下文才能被并行处理。 例如, 防火墙处理和转发这两种上下文类型就不能被并行处理, 因为这两种上下文的处理结 果会互相影响, 因此转发器必须先对输入数据进行防火墙处理, 然后再转发; 或者先对输入 报文进行转发, 然后再进行防火墙处理。 而合法监听和转发就可以被并行处理。 可以并行处 理的例子还有很多, 在此不——列举。 步骤 310 中, 转发器对输入报文进行处理后会得到一个上下文处理结果。 可选地, 在另 外一个例子中, 转发器还可以执行如下步骤:
步骤 312 : 转发器将上下文处理结果发送给控制器。
转发器通过一个事件上报消息将上下文处理结果发送给控制器。 上下文处理结果可有很 多种, 例如报文转发是否成功、 对输入报文进行在线计费后的计费结果、 通过对输入报文进 行 DPI后得到的结果等等。
例如, 假设转发器在步骤 310中对输入报文执行的上下文处理为对输入报文进行 DPI, 那么, 在步骤 312中, 转发器可以通过事件上报消息将对输入报文进行 DPI后得到的结果发 送给控制器, 该事件上报消息中包括需要上报的事件 (如, 检测到了 P2P 报文
(P2P DTECTED) )。除此之外,该事件上报消息中还可以包括输入报文的部分或全部内容、 和 /或上下文执行的结果 (如, 对输入报文进行 DPI后获得的详细信息) 等。
控制器收到事件上报消息后可以根据上下文处理结果确定是否需要继续对输入报文进行 处理, 如果需要, 则将为所述输入报文新确定的流和新确定的 CID集合发送给转发器, 以使 转发器根据该新确定的流和新确定的 CID集合对所述输入报文进行处理。 例如, 控制器收到 事件上报消息后, 发现事件上报消息中包含的上下文处理结果为 "输入报文转发成功", 则控 制器可以不进行任何处理。 又例如, 转发器通过事件上报消息将需要上报的事件以及输入报 文的部分或全部内容发送给控制器后, 控制器发现需要继续对输入报文进行处理, 则发送新 的流表项到转发器, 以使转发器根据该新的流表项对输入报文进行处理, 所述新的流表项中 包括为输入报文新确定的流匹配域及新确定的 CID集合。
一般情况下, 在收到输入报文之前, 转发器中就已经保存了该报文所属的流对应的 CID 集合。 但是偶尔也会出现转发器在第一对应关系中找不到输入报文的流对应的 CID集合的情 况, 此时转发器可以从控制器获取输入报文的流对应的 CID集合。 参见图 3所示, 在本发明 的另外一个例子中, 转发器在执行步骤 306之前, 还可以包括:
步骤 305a:判断第一对应关系中有没有与输入报文所属的流相对应的 CID集合;如果有, 则执行上述步骤 306-310 ; 如果没有, 则执行如下步骤 305b-305d;
步骤 305b : 将输入报文緩存到緩冲区中, 并发送流规则请求消息给控制器, 所述流规则 例如, 当转发器与控制器之间采用 OpenFlow协议进行通信时, 转发器会发送一个报文上 报 (Packet_In) 消息给控制器以请求获取输入报文对应的 CID集合, 该 Packet_In消息中包 含的输入报文的报文头或输入报文的部分或全部内容。 除此之外, Packet_In消息中还可以携 带緩存输入报文的緩冲区的信息 (如, Buffer_ID)、 以及上报的原因 (如, 原因为 "流表中无 匹配的流表项") 等。
步骤 305c: 接收所述控制器发送的流规则安装消息, 所述流规则安装消息中包括所述输 入报文的流对应的 CID集合;
例如, 控制器收到转发器发送的流规则请求消息后, 根据流规则请求消息中输入报文的 报文头或内容确定该输入报文所属的流对应的 CID集合中包括 7个 CID, 具体如下:
CID1 最大 2Mbps带宽控制
CID2 报文重組
CID3 DPI
CID4 病毒防火墙检测
CID5 报文緩存
CID6 合法监听
CID7 转发到端口 1
控制器通过流规则安装消息将输入报文所属的流对应的 CID集合发送给转发器, 例如, 控制器可以通过一条流规则安装消息将输入报文所属的流对应的 CID集合发送给转发器, 流 规则安装消息的格式如下:
<流规则安装消息 >:={流的信息, <CID1,CID2,CID3,CID4,CID5,CID6,CID7 >}
可选的, 控制器也可以通过多条流规则安装消息将输入报文所属的流对应的 CID集合发 送给转发器, 例如:
<流规则安装消息 1>:={流的信息, <CID1,CID2,CID3,CID4 >}
<流规则安装消息 2>:={流的信息, <CID5,CID6,CID7 >}可选地,控制器发送的流规则安装 消息中还可以包括每个 CID的执行顺序,例如:
< 流 规 则 安 装 消 息 >:={ 流 的 信 息 , <(CID 1 , 1),(CID2,2),(CID3,3),(CID4,4),(CID5,4),(CID6,4),(CID7,5)>}通过上面每个 CID的执行 顺序可以看出, CID4、 CID5和 CID6需要被同时执行。 上述流规则安装消息的格式只是一种 例子, 在实际应用时可以为其它格式, 例如, 将输入报文所属的流对应的 CID集合用一个 CID 列表 (list) 来表示, 只要能够实现将输入报文的流对应的 CID集合发送给转发器即可。
又例如, 控制器收到转发器发送的流规则请求消息后, 根据流规则请求消息中输入报文 的报文头或内容确定该输入报文所属的流为 BFD/LLDP 协议对应的流, 控制器确定与 BFD/LLDP协议对应的流相对应的 CID集合。 对应的 CID集合中可以仅包括如下 CID :
CID8 BFD/LLDP协议处理
控制器通过流规则安装消息将输入报文所属的流对应的 CID集合发送给转发器, 例如, 流规则安装消息的格式如下:
<流规则安装消息>:={流的信息, <CID8>}
控制器收到上述流规则安装消息后只对输入报文执行 BFD/LLDP协议处理, 例如更新协 议状态机等。 当输入报文所属的流有多个时, 控制器可以通过多条流规则安装消息将每个流 对应的 CID集合发送给转发器, 以使转发器将每个流对应的 CID集合保存在不同的流表中。
例如, 当转发器与控制器之间采用 OpenFlow协议进行通信时, 上述流规则安装消息可以 为 Flow_Mod消息, 上述流的信息可以是流匹配域 (Flow match field)。 假设输入报文对应的 流有两个, 每个流对应的流匹配域分别为 Flow match field 1和 Flow match field2。控制器在发 送给转发器的第一条 Flow_Mod消息中携带 Flow match field 1, 以及 Flow match field 1对应的 CID list 1;在发送给转发器的第二条 Flow_Mod消息中携带 Flow match field2,以及 Flow match field2对应的 CID list2。 控制器还可以在每条 Flow_Mod消息中携带流表的信息 (如, 流表的 ID (table id) ),以使转发器将每个 Flow_Mod消息中携带的 Flow match field和 Flow match field 对应的 CID集合添加到相应的流表中。 例如, 第一条 Flow_Mod消息中包括 table id=l, 第二 条 Flow_Mod消息中包括 table id=2 ) 0 此外, Flow_Mod消息中还可以携带用于指示流表处理 顺序的信息。 例如, 第一条 Flow_Mod消息中包括一个指示信息 (如 " Goto-table 2)。 当转发 器收到第一条 Flow_Mod消息后会根据 tablel中 Flow match field 1找到对应的 CID listl , 并 根据 CID listl对应的上下文对输入报文进行处理, 之后, 转发器还需要根据 table2对输入报 文进行匹配, 找到相应的 CID list2, 并根据 CID list2对应的上下文对输入报文进行处理。
步骤 305d: 在所述第一对应关系中添加所述输入报文所属的流的信息, 以及与所述输入 报文所属的流相对应的 CID集合。
上述步骤 305d为可选的, 步骤 305d可以在步骤 305c之后执行, 也可以在步骤 306之后 执行。
现有技术中, 每当转发器向控制器请求输入报文所属的流对应的 Action时, 控制器都会 将 Action携带在流规则安装消息中发送给控制器。 由于 Action包含的处理参数较多, 为了满 足传输各种类型 Action的要求, 流规则安装消息需要设计得比较长, 但流规则安装消息设计 得太长又会导致传输时间延长, 并且影响了报文的处理效率。 通过本发明提供的例子正好可 以解决这个问题, 当控制器收到来自转发器的流规则请求消息时, 控制器只需要将输入报文 的流对应的 CID集合通过流规则安装消息发送给转发器就可以了, 如果转发器已经存储了该 CID集合对应的上下文,则转发器只需要根据 CID集合中的每个 CID找到相应的上下文就可 以了。 由于 CID集合占用的空间很小, 传输 CID集合的流规则安装消息不需要设计得太长, 由此传输流规则安装消息所用的时间也会变短, 转发器处理报文的效率也能够得到一定程度 的提高。
当然, 除了上述例子描述的方法外, 控制器还可以将 CID集合对应的上下文与 CID集合 一起发给转发器。例如, 上述步骤 305c中控制器发送的流规则安装消息中还可以包括与所述
CID集合相对应的上下文。 在这种情况下, 流规则安装消息的格式可以如下:
<流规则安装消息>:={流的信
息, <CIDl,CID2,CID3>,[CIDl,Contextl],[CID2,Context2],[CID3,Context3]}
转发器收到所述流规则安装消息后, 如果发现第二对应关系中没有保存所述 CID集合中 的部分或全部 CID、以及与该部分或全部 CID相对应的上下文;则转发器在第二对应关系中, 添加该部分或全部 CID、 以及与该部分或全部 CID相对应的上下文。 一般情况下, 在收到输入报文之前, 转发器的第二对应关系中已经保存了大部分 CID和 CID对应的上下文。 但也可能会出现转发器在第二对应关系中找不到某个或某几个 CID对应 的上下文的情况, 此时转发器可以从控制器获取该某个或某几个 CID对应的上下文。 参见图
3所示, 在另外一个例子中, 转发器在执行步骤 308之前还可以执行如下步骤:
步骤 307a: 判断第二对应关系中有没有与输入报文所属的流对应的 CID集合相对应的上 下文; 如果有, 则执行步骤 308 ; 如果没有所述 CID集合中的部分或全部 CID, 则执行如下 步骤 307b-307d;
步骤 307b: 发送上下文请求消息给所述控制器, 所述上下文请求消息中包括所述 CID集 合中的部分或全部 CID ;
步骤 307c:接收所述控制器发送的上下文安装消息,所述上下文安装消息中包括所述 CID 集合中的部分或全部 CID、 以及与所述 CID集合中部分或全部 CID相对应的上下文;
可选地, 所述上下文安装消息中还可以包括除所述 CID集合之外的其它 CID以及与所述 其它 CID对应的上下文。
步骤 307d: 在所述第二对应关系中, 添加所述上下文安装消息中的每个 CID、 以及与所 述上下文安装消息中每个 CID相对应的上下文。
上述步骤 307d为可选的, 步骤 307d可以在步骤 307c之后执行, 也可以在步骤 308之后 执行。 为了与现有技术中的 OpenFlow协议兼容, 本发明的实施例还提供了另外一种实现方案, 在该方案中, 对于现有技术中已有的 Action, 转发器可以按照现有技术中的流程进行处理。 除了现有技术中已有的 Action外, 本实施例中还新定义了一个用于指示转发器对报文所属的 流进行上下文处理的 Action (例如, Handle_Context)。 参见图 4所示, 本发明实施例的方法 如下:
步骤 402: OpenFlowSwitch接收输入报文;
步骤 404: OpenFlow Switch根据报文确定报文所属的流;
步骤 406 : OpenFlow Switch判断流表中有没有与输入报文所属的流相对应的动作, 如果 有, 则执行对应的动作; 如果没有, 则执行步骤 408 ;
步骤 408 : 将输入报文緩存到緩冲区中, 并发送 Packet_In消息给 OpenFlow控制器以请 求获取输入报文对应的动作。
上述 Packet_In消息中携带了输入报文的部分或全部内容。除此之外, Packet_In消息中还 可以携带緩存输入报文的緩冲区的信息 (如, Buffer_ID)、 以及上报的原因 (如, 原因为 "流 表中无匹配的流表项") 等。
步骤 410 : OpenFlow Controller根据 Packet_In消息中的信息确定该输入报文对应的动作 及输入报文所属的流对应的 CID 集合, 并通过流规则安装 (如, Flow_Mod) 消息将该输入 报文流对应的动作及输入报文所属的流对应的 CID集合发送给 OpenFlow Switch。 输入报文 对应的动作可以为 OpenFlow协议中定义的标准动作, 也可以为新增的用于指示转发器对报 文所属的流进行上下文处理的动作, 如 Handle_Context 动作。 当输入报文对应的动作为 OpenFlow协议中定义的标准动作时, Packet_In 消息中只需要携带标准动作对应的参数就可 以了, 其中不包括 CID集合。 当输入报文所属的流对应的动作包括用于指示转发器对报文所 属的流进行上下文处理的动作时, 输入报文所属的流对应的 CID集合需要作为动作的参数携 带在流规则安装消息中。 通过此方案, 可以以兼容 Openflow协议现有动作的方式, 实现现有 Openflow动作与上下文处理的共存。
例如, 上述 Flow_Mod消息中可以包括输入报文所属的流对应的 Flow match field, 以及 与该流匹配信息相对应的动作列表, 其中包括一个或多个动作 (如 Set-fieild、 Output等)。 如 果需要根据某些上下文对输入报文进行处理, 则流匹配域对应的动作中还可以包括 Handle Context动作, Handle_Context动作的参数为输入报文所属的流对应的 CID集合。 其 一种实现格式如下:
Flow_Mod:= {match field, Instructions(action list)}
当输入报文所属的流有多个时, OpenFlow Controller可以通过多条 Flow_Mod消息将每个 流对应的 Flow entry发送给 OpenFlow Switch, 以使 OpenFlow Switch将每个流对应的 Flow entry保存在不同的流表中。 其中每个 flow entry 可选地包括上述 Handle_Context 动作及 Handle_Context动作的参数 (如, CID集合)。
例如, 假设输入报文对应的流有两个, 两个流对应的流匹配域分别为 Flow match field 1 和 Flow match fieW2。 OpenFlow Controller在发送给 OpenFlow Switch的第一条 Flow_Mod消 息中携带 Flow match field 1 , 以及 Flow match field 1对应的动作列表; 在发送给 OpenFlow Switch的第二条 Flow_Mod消息中携带 Flow match field2, 以及 Flow match field2对应的动作 列表。 上述两条消息的动作列表中, 除 OpenFlow 已定义的动作类型及其参数外, 根据上下 文处理的需求, 可选地包括 Handle_Context动作类型及 Handle_Context动作的参数(如, CID 集合)。
OpenFlow Controller还可以在每条 Flow_Mod消息中携带流表的信息 (如, 流表的 ID ), 以使 OpenFlow Switch将每个 Flow_Mod消息中携带的流的信息和流对应的 CID集合添加到 相应的流表中。 例如, 第一条 Flow_Mod消息中包括 table id= 1, 第二条 Flow_Mod消息中包 括 table id=2
此外, Flow_Mod 消息中还可以携带用于指示流表处理顺序的信息。 例如, 第一条 Flow_Mod消息中包括一个指示信息 (如 " Goto-table 2" )。 当 OpenFlow Switch收到第一条 Flow Mod消息后根据 tablel中的 Flow match field 1找到相应的动作列表,并根据 Flow match field 1 对应的动作对输入报文进行处理。 如果其中包括 Handle_Context动作, 则转发器根据 Handle_Context动作的参数获取输入报文所属的流对应的 CID集合 (如, CID listl ) , 并根据 CID listl在第二对应关系中找到与 CID listl对应的上下文, 进而根据 CID listl对应的上下文 对输入报文进行处理。 完成上述 tablel的流规则处理后, 还需要根据 table2对输入报文进行 匹配, 找到相应的动作列表, 并根据该动作列表对输入报文进行处理。
步骤 412 : OpenFlow Switch收到流规则安装消息后将输入报文的所属的流的信息, 以及 与所述输入报文的流相对应的 CID集合添加到相应的第一对应关系中。
上述步骤 412为可选的, 步骤 412可以在步骤 410后执行, 也可以在步骤 414后执行。 步骤 414 : OpenFlow Switch从 Buffer_ID 对应的緩冲区中取出緩存的报文, OpenFlow Switch根据输入报文所属的流对应的动作对输入报文进行处理。 当输入报文所属的流对应的动作是 Handle_Context时, 转发器对输入报文的处理与步骤 406-步骤 410相似, 在此不再详述。
在上述基于 OpenFlow的实现中, 所述动作可以包括在 Flow_mod消息的 Apply- Actions 结构中, 也可以包括在 Write-Actions 结构中。 本领域的技术人员可以理解, 以上只是以 OpenFlow协议为例来进行说明, 转发器与控制器之间也可以采用其它的协议进行通信。 转发器对报文进行处理后会得到各种处理结果, 对于某些处理结果转发器需要上报给控 制器。例如,合法监听得到的相关信息,或执行 NAT服务后得到的结果等等。对于某些结果, 转发器可能需要执行进一步地处理, 在本发明另外一个例子中, 转发器在对输入报文进行处 理后得到的处理结果有可能是一个新生成的报文。
例如, 转发器对输入报文的处理是对输入报文进行监听。 由于监听结果往往需要转发给 特定网络实体, 因此转发器需要对监听到的结果 (如, 输入报文的内容) 进行封装从而得到 一个新生成的报文。 转发器获取新生成的报文后, 对新生成的报文的处理和对输入报文的处 理一样, 即对新生成的报文执行类似上述步骤 302-步骤 312的处理。
现有技术中, OpenFlow的 action仅仅规定了对当前报文进行何种处理, 对报文的处理结 果转发器是不会維护的, 因此, 对于需要基于上一次对报文的处理结果来执行下一次的处理 时, 现有技术中的 Action是无法实现的。
上述例子中描述的第一对应关系可以是技术人员在对转发器进行初始设置时存储在转发 器中的, 也可以是转发器在与控制器建立连接后由控制器发送给转发器的, 例如, 参见图 5 所示,转发器在接收输入报文之前可以接收控制器发送的如步骤 502所示的流规则安装消息, 所述流规则安装消息中包括转发器支持的部分或全部流的信息、 以及与所述转发器支持的部 分或全部流相对应的 CID集合;
例如, 控制器可以通过一条或多条流规则安装消息将转发器支持的流的信息、 以及转发 器支持的流对应的 CID集合发送给转发器。
转发器将所述转发器支持的部分或全部流的信息、 以及与所述转发器支持的部分或全部 流相对应的 CID集合一一对应地保存, 以形成第一对应关系。
上述例子中描述的第二对应关系可以是技术人员在对转发器进行初始设置时存储在转发 器中的, 也可以是转发器在与控制器建立连接后由控制器发送给转发器的, 例如参见图 5所 示, 转发器在接收输入报文之前,可以接收控制器发送的如步骤 504所示的上下文安装消息, 所述上下文安装消息中包括转发器支持的部分或全部 CID、 以及所述转发器支持的部分或全 部 CID对应的上下文;
当控制器需要将多个上下文发送给转发器时, 控制器可以将该多个上下文通过一个上下 文安装消息发送给转发器, 也通过多个上下文安装消息发送给转发器。 每个上下文安装消息 中可以包括一个或多个 CID以及该一个或多个 CID对应的上下文。
转发器将所述转发器支持的部分或全部 CID、 以及与所述转发器支持的部分或全部上 CID相对应的上下文一一对应地保存, 以形成第二对应关系。
在另外一个例子中, 在转发器与控制器通信之前, 转发器可以先与控制器进行协商, 以 获知对端对流和上下文的处理能力。 例如, 图 6a所示为转发器先发起协商的情况,具体包括 如下步骤:
步骤 a602:转发器向控制器发送能力协商请求消息, 该能力协商请求消息中包括所述转 发器支持的上下文能力列表, 以使所述控制器将转发器能够支持的部分或全部上下文发送给 转发器;
可选地, 上述控制器可以主动将转发器能够支持的部分或全部上下文发送给转发器; 也 可以是收到所述转发器发送的流规则请求消息活上下文请求消息后, 再将转发器能够支持的 部分或全部上下文发送给转发器。
步骤 a604:所述转发器接收所述控制器发送的协商应答消息, 所述协商应答消息中可以 包括控制器支持的上下文能力列表, 以使所述转发器根据所述控制器支持的下文能力列表向 所述控制器请求控制器能够支持的部分或全部上下文。 上述转发器与控制器之前的协商也可以是由控制器主动发起的, 例如, 参见图 6b所示, 具体包括如下步骤:
步骤 b602:转发器接收控制器发送的能力协商请求消息, 该能力协商请求消息中包括所 述控制器支持的上下文能力列表, 以使所述转发器根据所述控制器支持的下文能力列表向所 述控制器请求控制器能够支持的部分或全部上下文;
可选地, 上述控制器可以主动将转发器能够支持的部分或全部上下文发送给转发器; 也 可以是收到所述转发器发送的流规则请求消息活上下文请求消息后, 再将转发器能够支持的 部分或全部上下文发送给转发器。
步骤 b604:所述转发器向控制器发送协商应答消息, 所述协商应答消息中可以包括转发 器支持的上下文能力列表, 以使所述控制器将转发器能够支持的部分或全部上下文发送给转 发器。
控制器可以对转发器中存储的第一对应关系或第二对应关系进行管理, 例如, 参见图 7 所示, 控制器可以对第一对应关系或第二对应关系中的信息进行查询、 修改或刪除等。 下面 将通过一些例子来进行说明, 需要说明的是, 这些例子都是相对独立的, 它们之间不会互相 影响。
例子 1, 如果控制器要查询某个流对应的 CID集合, 则控制器会发送一个如步骤 702所 示的流规则查询请求消息给转发器, 转发器则执行如下步骤:
接收所述控制器发送的流规则查询请求消息, 所述查询请求消息中包括待查询的流的信 息; 根据所述第一对应关系找到所述待查询流对应的 CID集合, 发送如步骤 704所示的流规 则查询应答消息给所述控制器, 所述流规则查询应答消息中包括所述待查询的流的信息, 以 及所述待查询的流对应的 CID集合。
例子 2, 如果控制器要查询某个或某几个 CID对应的上下文, 则控制器会发送一个如步 骤 802所示的上下文查询请求消息给转发器, 转发器则执行如下步骤:
接收所述控制器发送的上下文查询请求消息, 所述查询请求消息中包括待查询的 CID; 待查询的 CID可以是一个或多个。
根据第二对应关系找到的待查询的 CID对应的上下文, 并发送如步骤 804所示的上下文 查询应答消息给所述控制器, 该查询应答消息中包括待查询的 CID对应的上下文。
可选地, 上述查询应答消息中还可以包括所述待查询的 CID。
例子 3, 如果控制器要修改某个流对应的 CID集合, 则控制器会发送一个如步骤 902所 示的流规则修改消息给转发器, 转发器则执行如下步骤:
接收所述控制器发送的流规则修改消息, 所述流修改消息中包括待修改的流的信息, 以 及所述待修改的流对应的新的 CID集合;
收到所述流规则修改消息后, 在所述第一对应关系中将所述待修改的流对应的 CID集合 修改为所述新的 CID集合。
例如, 转发器收到控制器发送的流规则修改消息, 该流规则修改消息中包括的待修改的 流的信息为: 源 IP地址为 10.88.85.55、 目的 IP地址为 10.88.80.56的流, 待修改的流对应的 新的 CID集合为 CID1、 CID2、 CID5。 假设在第一对应关系中, 源 IP地址为 10.88.85.55、 目的 IP地址为 10.88.80.56的流原本 对应的 CID集合为: CID1、 CID2、 CID3。 则转发器收到上述流修改消息后, 将源 IP地址为 10.88.85.55、 目的 IP地址为 10.88.80.56的流对应的 CID集合修改为 CID1、 CID2、 CID5。 例子 4, 如果控制器要修改某个或某几个 CID对应的上下文, 则控制器会发送一个如步 骤 1002所示的上下文修改消息给转发器, 转发器则执行如下步骤:
接收所述控制器发送的上下文修改消息, 所述上下文修改消息中包括待修改的 CID, 以 及所述待修改的上下文的标识对应的新的上下文;
收到所述上下文修改消息后, 在所述第二对应关系中将所述待修改的 CID对应的上下文 修改为所述新的上下文。
例如, CID1 原本对应的上下文为 Contextla, 如果转发器收到的上下文修改消息中包括 CID1、 以及 CID1对应的新的上下文 Contextlb, 则转发器在第二对应关系中将 CID1对应的 上下文 ί 改为 Context lb。 例子 5, 如果控制器要刪除某个流的信息, 控制器会发送如步骤 1102所示的流刪除消息 给转发器, 转发器则执行如下步骤:
接收控制器发送的流刪除消息, 该流刪除消息中包括待刪除流的信息;
步从第一对应关系中刪除所述待刪除的流的信息、 以及与所述待刪除的流对应的 CID集 合。
可选地, 如果被刪除的流对应的部分或全部 CID没有对应其它的流, 则转发器还可以从 所述第二对应关系中刪除所述被刪除的流对应的部分或全部 CID、 以及与所述被刪除的流对 应的部分或全部 CID相对应的上下文。
例如,假设流 1对应的 CID集合包括 CID1、CID2 ;流 2对应的 CID集合包括 CID1、CID3。 当转发器从第一对应关系中刪除了流 1的信息后, 转发器发现 CID2只与流 1对应, 则转发 器还可以从第二对应关系中刪除 CID2对应的上下文。 而 CID1不仅与流 1对应,其还与流 2 对应, 因此转发器不会刪除 CID1对应的上下文。
假设流 2的信息也被刪除后, 转发器发现 CID1没有对应其它流了, 则从第二对应关系中 刪除 CID1对应的上下文。
可选地,转发器还可以将被刪除的流的信息或被刪除的上下文对应的 CID上报给控制器。 例子 6, 如果控制器要刪除某个上下文, 控制器会发送如步骤 1202所示的一个上下文刪 除消息给转发器, 转发器接收控制器发送的上下文刪除消息, 所述上下文刪除消息中包括至 少一个待刪除的上下文标识; 转发器从第二对应关系中, 刪除所述至少一个待刪除的 CID、 以及与所述至少一个待刪除的 CID相对应的上下文。
可选地, 转发器在刪除第二对应关系中的某个上下文后还可以对第一对应关系进行相应 地修改, 例如, 控制器还可以执行如下步骤:
在第一对应关系中, 刪除与所述已经刪除的上下文对应的 CID。
上下文的刪除可能会导致转发器在处理该上下文的 CID对应的流时出现问题, 因此, 转 发器在第一对应关系中刪除与所述已经刪除的上下文对应的 CID之后, 还可以在所述第一对 应关系中, 刪除与所述被刪除的 CID相对应的流的信息。
例如,假设流 1对应的 CID集合包括 CID1、CID2 ;流 2对应的 CID集合包括 CID1、CID3。 当转发器从第二对应关系中刪除了 CID1对应的上下文后,转发器发现与 CID1对应的流有流 1和流 2, 转发器进一步在第一对应关系中刪除流 1的信息和流 2的信息。 并且, 转发器可以 进一步刪除分别与流 1和流 2对应 CID集合。
可选地,转发器还可以将被刪除的上下文对应的 CID或被刪除的流的信息上报给控制器。 通过上述本发明提供的例子, 控制器可以对转发器上保存的第一对应关系和第二对应关 系进行有效的管理。
上述任意一个方法实施例都可以由图 2所示的转发器中的部分或全部組成部分来实现。 通过以上的实施方式的描述, 本领域的技术人员可以清楚地了解到本发明可以通过硬件 实现, 也可以可借助软件和必要的通用硬件平台的方式来实现, 基于这样的理解, 本发明的 技术方案可以以计算机程序产品的形式体现出来, 该计算机程序产品可以存储在一个非易失 性存储介质 (可以是只读光盘、 U盘、 移动硬盘等) 中, 包括若干指令用以使得一台计算机 设备 (可以是个人计算机、 接收端或者网络设备等) 执行本发明各个实施例所描述的方法。
以上对本发明所跟踪会话同步方法以及实现该方法的跟踪会话同步装置进行了详细介绍。 对于本领域的一般技术人员, 依据本发明实施例的思想, 在具体实施方式及应用范围上均会 有改变之处, 本说明书内容不应理解为对本发明的限制。

Claims

权 利 要 求 书
1、 一种在软件定义网络 (Software-Defined Network) 中处理报文的方法, 其特征在于, 所述 方法由转发器执行, 所述方法包括:
接收输入报文;
根据所述输入报文确定所述输入报文所属的流;
根据流与上下文标识集合之间的第一对应关系确定所述输入报文所属的流对应的上下文 标识集合; 所述第一对应关系中每个流对应的上下文标识集合包括至少一个上下文标识; 根据上下文标识与上下文之间的第二对应关系确定与所述上下文标识集合相对应的上下 文;
根据所述上下文标识集合对应的上下文对所述输入报文进行处理。
2、 根据权利要求 1所述的方法, 其特征在于, 所述根据所述输入报文确定所述输入报文所属 的流包括:
根据所述输入报文的报文头或内容确定所述输入报文所属的流。
3、 根据权利要求 1或 2所述的方法, 其特征在于, 根据所述第一对应关系确定所述输入报文 所属的流对应的上下文标识集合之前, 所述方法进一步包括:
判断所述第一对应关系中有没有与所述输入报文所属的流相对应的上下文标识集合; 如果有,
则执行所述根据所述第一对应关系确定所述输入报文所属的流对应的上下文标识集合的 步骤;
如果没有, 则执行如下步骤:
发送流规则请求消息给控制器, 所述流规则请求消息中包括所述输入报文的报文头或内 容;
接收所述控制器发送的流规则安装消息, 所述流规则安装消息中包括所述输入报文的流 对应的上下文标识集合;
在所述第一对应关系中添加所述输入报文的所属的流的信息, 以及与所述输入报文的流 相对应的上下文标识集合。
4、 根据权利要求 3所述的方法, 其特征在于,
所述控制器发送的流规则安装消息中进一步包括与所述上下文标识集合相对应的上下文; 所述转发器收到所述流规则安装消息后, 如果发现所述第二对应关系中没有保存所述上 下文标识集合中的部分或全部上下文标识、 以及与所述上下文标识集合中部分或全部上下文 标识相对应的上下文, 则在所述第二对应关系中, 添加所述上下文标识集合中的部分或全部 上下文标识、 以及与所述上下文标识集合中部分或全部上下文标识相对应的上下文。
5、 根据权利要求 1或 2所述的方法, 其特征在于, 根据上下文标识与上下文之间的第二对应 关系确定与所述上下文标识集合相对应的上下文之前, 所述方法进一步包括:
判断所述第二对应关系中有没有与所述上下文标识集合相对应的上下文;
如果有,
则执行所述根据所述第二对应关系确定所述上下文标识集合对应的上下文的步骤; 如果所述上下文集合中的部分或全部上下文标识没有对应的上下文, 则执行如下步骤: 发送上下文请求消息给所述控制器, 所述上下文请求消息中包括所述上下文标识集合中 的所述部分或全部上下文标识;
接收所述控制器发送的上下文安装消息, 所述上下文安装消息中包括所述上下文标识集 合中的部分或全部上下文标识、 以及与所述上下文标识集合中的部分或全部上下文标识相对 应的上下文;
在所述第二对应关系中, 添加所述上下文标识集合中的部分或全部上下文标识、 以及与 所述上下文标识集合中的部分或全部上下文标识相对应的上下文。
6、 根据权利要求 1-5任意一项所述的方法, 其特征在于, 当所述上下文标识集合中包括多个 上下文标识时, 所述根据与所述上下文标识集合对应的上下文对所述输入报文进行处理时按 照预设的上下文顺序进行。
7、 根据权利要求 6所述的方法, 其特征在于, 如果所述预设的上下文顺序中包括至少两个上 下文的顺序相同的情况, 则所述转发器同时根据所述至少两个上下文对所述输入报文进行处 理。
8、 根据权利要求 1-7任意一项所述的方法, 其特征在于, 所述方法还包括:
接收控制器发送的流刪除消息, 所述流刪除消息中包括待刪除流的信息;
从所述第一对应关系中刪除所述待刪除的流的信息、 以及与所述待刪除的流对应的上下 文标识集合。
9、 根据权利要求 8所述的方法, 其特征在于, 如果所述被刪除的流对应的部分或全部上下文 标识没有对应其它流, 则所述方法还包括:
从所述第二对应关系中刪除所述被刪除的流对应的部分或全部上下文标识、以及与所述被 刪除的流对应的部分或全部上下文标识相对应的上下文。
10、 根据权利要求 1-7任意一项所述的方法, 其特征在于, 所述方法还包括:
接收控制器发送的上下文刪除消息, 所述上下文刪除消息中包括至少一个待刪除的上下 标识;
从所述第二对应关系中, 刪除所述至少一个待刪除的上下文标识、 以及与所述至少一个 待刪除的上下文标识相对应的上下文。
11、 根据权利要求 10所述的方法, 其特征在于, 所述刪除所述至少一个待刪除的上下文标识 相对应的上下文之后还包括:
在所述第一对应关系中, 刪除与所述已经刪除的上下文对应的上下文标识。
12、 根据权利要求 11所述的方法, 其特征在于, 在所述第一对应关系中刪除与所述已经刪除 的上下文对应的上下文标识之后还包括:
在所述第一对应关系中, 刪除与所述已经刪除的上下文标识相对应的流的信息。
13、 根据权利要求 1-12任意一项所述的方法, 其特征在于, 所述方法还包括:
对所述输入报文进行处理后得到上下文处理结果。
14、 根据权利要求 13所述的方法, 其特征在于, 所述方法还包括:
将所述上下文处理结果发送给控制器。
15、 根据权利要求 14所述的方法, 其特征在于, 所述方法还包括:
接收所述控制器为所述输入报文新确定的流和新确定的上下文标识集合,以便根据所述新 确定的上下文标识集合对应的上下文对所述输入报文进行进一步的处理。
16、 根据权利要求 13所述的方法, 其特征在于, 如果所述上下文处理结果为一个新生成的报 文, 则所述方法还包括:
根据新生成的报文确定所述新生成的报文所属的流;
根据所述第一对应关系确定与所述新生成的报文所属的流相对应的新的上下文标识集合; 根据所述第二对应关系确定与所述新的上下文标识集合相对应的上下文;
根据所述新的上下文标识集合对应的上下文对所述新生成的报文进行处理。
17、 根据权利要求 1-16任意一项所述的方法, 其特征在于, 所述方法还包括:
所述输入报文的流对应的上下文标识集合中的部分或全部上下文标识还对应其它流。
18、 根据权利要求 1-16任意一项所述的方法, 其特征在于, 所述上下文标识还用于指示每个 上下文的上下文类型, 所述上下文类型中不包括动作类型。
19、 一种在在软件定义网络 (Software-Defined Network) 中使用的转发器, 其特征在于, 所 述转发器包括一个接口, 一个处理器和一个存储器:
所述存储器, 用于存储流与与上下文标识集合之间的第一对应关系, 以及上下文标识与 上下文之间的第二对应关系; 所述第一对应关系中每个流对应的上下文标识集合包括至少一 个上下文标识;
所述接口, 用于接收输入报文;
所述处理器, 用于根据所述输入报文确定所述输入报文所属的流; 根据所述存储器存储 的第一对应关系确定所述输入报文所属的流对应的上下文标识集合; 根据所述存储器存储的 第二对应关系确定与所述上下文标识集合相对应的上下文; 并根据所述上下文标识集合对应 的上下文对所述输入报文进行处理。
20、 根据权利要求 19所述的转发器, 其特征在于, 所述处理器用于根据所述输入报文确定所 述输入报文所属的流具体为:
所述处理器用于根据所述输入报文的报文头或内容确定所述输入报文对应的流。
21、 根据权利要求 19或 20所述的转发器, 其特征在于, 所述接口包括一个接收器和一个发 送器; 所述接口, 用于接收输入报文具体为:
所述接口中的接收器用于接收所述输入报文。
22、 根据权利要求 21所述的转发器, 其特征在于, 所述处理器还用于: 根据所述存储器存储 的所述第一对应关系确定所述输入报文所属的流对应的上下文标识集合之前, 判断所述第一 对应关系中有没有与所述输入报文所属的流相对应的上下文标识集合; 如果有, 则根据所述 第一对应关系确定所述输入报文所属的流对应的上下文标识集合; 如果没有, 则通知所述发 送器;
所述发送器用于在收到所述处理器的通知后发送流规则请求消息给控制器, 所述流规则 请求消息中包括所述输入报文的报文头或内容;
所述接收器, 还用于接收所述控制器发送的流规则安装消息, 所述流规则安装消息中包 括所述输入报文的流对应的上下文标识集合;
所述处理器, 还用于在所述第一对应关系中添加所述输入报文的所属的流的信息, 以及 与所述输入报文的流相对应的上下文标识集合。
23、 根据权利要求 21所述的转发器, 其特征在于, 所述处理器, 还用于根据所述存储器存储 的第二对应关系确定与所述输入报文所属的流对应的上下文标识集合相对应的上下文之前, 判断第二对应关系中有没有与输入报文所属的流对应的上下文标识集合相对应的上下文; 如 果有, 则根据所述存储器存储的第二对应关系确定与所述上下文标识集合相对应的上下文; 如果所述上下文标识集合中的部分或全部上下文标识没有对应的上下文,则通知所述发送器; 所述发送器用于发送上下文请求消息给所述控制器, 所述上下文请求消息中包括所述输 入报文所属的流对应的上下文标识集合中的部分或全部上下文标识;
所述接收器, 还用于接收所述控制器发送的上下文安装消息, 所述上下文安装消息中包 括所述上下文标识集合中的所述部分或全部上下文标识、 以及与上下文标识集合中的所述部 分或全部上下文标识相对应的上下文;
所述处理器还用于, 在所述第二对应关系中, 添加所述上下文标识集合中的所述部分或 全部上下文标识、 以及与上下文标识集合中的所述部分或全部上下文标识相对应的上下文。
24、根据权利要求 19或 20所述的转发器,其特征在于,如果所述输入报文所属的流有多个, 所述处理器用于根据流与上下文标识之间的第一对应关系确定所述输入报文所属的流对应的 上下文标识集合具体为:
所述处理器用于根据所述第一对应关系依次获取所述输入报文所属的每个流对应的上下 文标识集合。
25、 根据权利要求 19或 20所述的转发器, 其特征在于, 当所述上下文标识集合中包括多个 上下文标识时, 则所述处理器用于根据所述上下文标识集合相对应的上下文对所述输入报文 进行处理时按照预设的上下文顺序进行。
26、 根据权利要求 25所述的转发器, 其特征在于, 如果所述预设的上下文顺序中包括至少两 个上下文的顺序相同的情况, 则所述处理器还用于同时根据所述至少两个上下文对所述输入 报文进行处理。
27、 根据权利要求 19-26任意一项所述的转发器, 其特征在于, 所述
接收器, 还用于接收控制器发送的流刪除消息, 所述流刪除消息中包括待刪除的流的信 息;
所述处理器, 还用于从所述第一对应关系中刪除所述待刪除的流的信息、 以及与所述待 刪除的流对应的上下文标识集合。
28、 根据权利要求 27所述的转发器, 其特征在于, 所述处理器还用于, 如果发现所述被刪除 的流对应的部分或全部上下文标识没有对应其它流, 则从所述第二对应关系中刪除所述被刪 除的流对应的部分或全部上下文标识、 以及与所述被刪除的流对应的部分或全部上下文标识 相对应的上下文。
29、 根据权利要求 21-28任意一项所述的转发器, 其特征在于, 所述处理器还用于:
获取对所述输入报文进行处理后得到的上下文处理结果。
30、 根据权利要求 29所述的转发器, 其特征在于, 所述
发送器, 用于通过上报消息将所述处理器获取的上下文处理结果发送给控制器。
31、 根据权利要求 30所述的转发器, 其特征在于, 所述接收器还用于, 接收所述控制器为所 述输入报文新确定的流和新确定的上下文标识集合, 以便通知所述处理器根据所述新确定的 上下文标识集合对应的上下文对所述输入报文进行进一步的处理。
32、 根据权利要求 29所述的转发器, 其特征在于, 所述处理器还用于:
如果所述上下文处理结果为一个新生成的报文, 则根据新生成的报文确定所述新生成的 报文所属的流;
根据所述第一对应关系确定所述新生成的报文所属的流对应的新的上下文标识集合; 根据所述第二对应关系确定与所述新的上下文标识相对应的上下文;
根据所述新的上下文标识对应的上下文对所述新生成的报文进行处理。
33、 一种在软件定义网络 (Software-Defined Network) 中处理报文的方法, 其特征在于, 所 述方法由转发器执行, 所述方法包括:
接收输入报文;
根据所述输入报文确定所述输入报文所属的流;
判断流与上下文标识集合之间的第一对应关系中有没有与所述输入报文所属的流相对应 的上下文标识集合; 如果有, 则根据所述第一对应关系确定所述输入报文所属的流对应的上 下文标识集合; 如果没有, 则发送流规则请求消息给控制器, 所述流规则请求消息中包括所 述输入报文的报文头或内容; 接收所述控制器发送的流规则安装消息, 所述流规则安装消息 中包括所述输入报文的流对应的上下文标识集合;
根据上下文标识与上下文之间的第二对应关系确定与所述上下文标识集合相对应的上下 文;
根据所述上下文标识集合对应的上下文对所述输入报文进行处理。
34、 根据权利要求 33所述的方法, 其特征在于, 所述根据所述输入报文确定所述输入报文所 属的流包括:
根据所述输入报文的报文头或内容确定所述输入报文所属的流。
35、 根据权利要求 33所述的方法, 其特征在于, 所述方法还包括: 接收到所述控制器发送的 流规则安装消息之后, 在所述第一对应关系中添加所述输入报文的所属的流的信息, 以及与 所述输入报文的流相对应的上下文标识集合。
36、 根据权利要求 33-35任意一项所述的方法, 其特征在于, 所述控制器发送的流规则安装 消息中进一步包括与所述上下文标识集合相对应的上下文;
所述转发器收到所述流规则安装消息后, 如果发现所述第二对应关系中没有保存所述上 下文标识集合中的部分或全部上下文标识、 以及与所述上下文标识集合中部分或全部上下文 标识相对应的上下文, 则在所述第二对应关系中, 添加所述上下文标识集合中的部分或全部 上下文标识、 以及与所述上下文标识集合中部分或全部上下文标识相对应的上下文。
37、 根据权利要求 33-35任意一项所述的方法, 其特征在于, 根据上下文标识与上下文之间 的第二对应关系确定与所述上下文标识集合相对应的上下文之前, 所述方法进一步包括: 判断所述第二对应关系中有没有与所述上下文标识集合相对应的上下文;
如果有,
则执行所述根据所述第二对应关系确定所述上下文标识集合对应的上下文的步骤; 如果所述上下文集合中的部分或全部上下文标识没有对应的上下文, 则执行如下步骤: 发送上下文请求消息给所述控制器, 所述上下文请求消息中包括所述上下文标识集合中 的所述部分或全部上下文标识;
接收所述控制器发送的上下文安装消息, 所述上下文安装消息中包括所述上下文标识集 合中的部分或全部上下文标识、 以及与所述上下文标识集合中的部分或全部上下文标识相对 应的上下文;
在所述第二对应关系中, 添加所述上下文标识集合中的部分或全部上下文标识、 以及与 所述上下文标识集合中的部分或全部上下文标识相对应的上下文。
38、 根据权利要求 33-37任意一项所述的方法, 其特征在于, 所述方法还包括: 当所述上下 文标识集合中包括多个上下文标识时, 所述根据与所述上下文标识集合对应的上下文对所述 输入报文进行处理时按照预设的上下文顺序进行。
39、 根据权利要求 38所述的方法, 其特征在于, 所述方法还包括: 如果所述预设的上下文顺 序中包括至少两个上下文的顺序相同的情况, 则所述转发器同时根据所述至少两个上下文对 所述输入报文进行处理。
40、 根据权利要求 33-39任意一项所述的方法, 其特征在于, 所述方法还包括其特征在于 所述方法还包括:
对所述输入报文进行处理后得到上下文处理结果。
41、 根据权利要求 40所述的方法, 其特征在于, 所述方法还包括:
将所述上下文处理结果发送给控制器。
42、 根据权利要求 40所述的方法, 其特征在于, 如果所述上下文处理结果为一个新生成的报 文, 则所述方法还包括:
根据新生成的报文确定所述新生成的报文所属的流;
根据所述第一对应关系确定与所述新生成的报文所属的流相对应的新的上下文标识集合; 根据所述第二对应关系确定与所述新的上下文标识集合相对应的上下文;
根据所述新的上下文标识集合对应的上下文对所述新生成的报文进行处理。
43、 根据权利要求 33-42任意一项所述的方法, 其特征在于, 所述方法还包括:
所述输入报文的流对应的上下文标识集合中的部分或全部上下文标识还对应其它流。
44、 根据权利要求 33-42任意一项所述的方法, 其特征在于, 所述上下文标识还用于指示每 个上下文的上下文类型, 所述上下文类型中不包括动作类型。
45、 一种在在软件定义网络 (Software-Defined Network) 中使用的转发器, 其特征在于, 所 述转发器包括接口, 处理器和存储器;
所述存储器, 用于存储流与与上下文标识集合之间的第一对应关系, 以及上下文标识与 上下文之间的第二对应关系; 所述第一对应关系中每个流对应的上下文标识集合包括至少一 个上下文标识;
所述接口, 用于接收输入报文;
所述处理器用于判断所述存储器存储的第一对应关系中有没有与所述输入报文所属的 流相对应的上下文标识集合; 如果有, 则根据所述第一对应关系确定所述输入报文所属的流 对应的上下文标识集合; 如果没有, 则通知所述接口;
所述接口用于在收到处理器发送的通知后发送流规则请求消息给控制器, 所述流规则请 求消息中包括所述输入报文的报文头或内容;
所述接口, 还用于接收所述控制器发送的流规则安装消息, 所述流规则安装消息中包括 所述输入报文的流对应的上下文标识集合;
所述处理器, 还用于根据所述存储器存储的第二对应关系确定与所述上下文标识集合相 对应的上下文; 并根据所述上下文标识集合对应的上下文对所述输入报文进行处理。
46、根据权利要求 45所述的转发器,其特征在于,所述接口包括接收器和发送器;所述接口 用于接收输入报文具体为: 所述接口中的接收器用于接收输入报文。
47、 根据权利要求 46所述的转发器, 其特征在于, 所述处理器还用于, 在根据所述存储器存 储的第二对应关系确定与所述输入报文所属的流对应的上下文标识集合相对应的上下文之前 判断第二对应关系中有没有与输入报文所属的流对应的上下文标识集合相对应的上下文; 如 果有, 则根据所述存储器存储的第二对应关系确定与所述上下文标识集合相对应的上下文; 如果所述上下文标识集合中的部分或全部上下文标识没有对应的上下文,则通知所述发送器; 所述发送器还用于在收到所述处理器的通知后发送上下文请求消息给所述控制器, 所述 上下文请求消息中包括所述输入报文所属的流对应的上下文标识集合中的部分或全部上下文 标识;
所述接收器, 还用于接收所述控制器发送的上下文安装消息, 所述上下文安装消息中包 括所述上下文标识集合中的所述部分或全部上下文标识、 以及与上下文标识集合中的所述部 分或全部上下文标识相对应的上下文;
所述处理器还用于, 在所述第二对应关系中, 添加所述上下文标识集合中的所述部分或 全部上下文标识、 以及与上下文标识集合中的所述部分或全部上下文标识相对应的上下文。
48、 根据权利要求 45或 46所述的转发器, 其特征在于, 当所述上下文标识集合中包括多个 上下文标识时, 所述处理器用于根据所述上下文标识集合相对应的上下文对所述输入报文进 行处理时按照预设的上下文顺序进行。
49、 根据权利要求 48所述的转发器, 其特征在于, 如果所述预设的上下文顺序中包括至少两 个上下文的顺序相同的情况, 则所述处理器还用于同时根据所述至少两个上下文对所述输入 报文进行处理。
50、 根据权利要求 46-49任意一项所述的转发器, 其特征在于, 所述接收器, 还用于接收控 制器发送的流刪除消息, 所述流刪除消息中包括待刪除的流的信息;
所述处理器, 还用于从所述第一对应关系中刪除所述待刪除的流的信息、 以及与所述待 刪除的流对应的上下文标识集合。
51、 根据权利要求 50所述的转发器, 其特征在于, 所述处理器还用于, 如果发现所述被刪除 的流对应的部分或全部上下文标识没有对应其它流, 则从所述第二对应关系中刪除所述被刪 除的流对应的部分或全部上下文标识、 以及与所述被刪除的流对应的部分或全部上下文标识 相对应的上下文。
52、 根据权利要求 46-51任意一项所述的转发器, 其特征在于, 所述处理器还用于,
获取对所述输入报文进行处理后得到的上下文处理结果。
53、 根据权利要求 52所述的转发器, 其特征在于, 所述发送器, 用于通过上报消息将所述处 理器获取的上下文处理结果发送给控制器。
54、 根据权利要求 53所述的转发器, 其特征在于, 所述接收器还用于, 接收所述控制器为所 述输入报文新确定的流和新确定的上下文标识集合, 以便通知所述处理器根据所述新确定的 上下文标识集合对应的上下文对所述输入报文进行进一步的处理。
55、 根据权利要求 52所述的转发器, 其特征在于, 所述处理器还用于:
如果所述上下文处理结果为一个新生成的报文, 则根据新生成的报文确定所述新生成的 报文所属的流;
根据所述第一对应关系确定所述新生成的报文所属的流对应的新的上下文标识集合; 根据所述第二对应关系确定与所述新的上下文标识相对应的上下文;
根据所述新的上下文标识对应的上下文对所述新生成的报文进行处理。
PCT/CN2013/077259 2013-06-14 2013-06-14 一种处理报文的方法和转发器 WO2014198064A1 (zh)

Priority Applications (6)

Application Number Priority Date Filing Date Title
PCT/CN2013/077259 WO2014198064A1 (zh) 2013-06-14 2013-06-14 一种处理报文的方法和转发器
EP13887011.8A EP2996292B1 (en) 2013-06-14 2013-06-14 Method for processing message and forwarder
CN201380073126.5A CN105009529B (zh) 2013-06-14 2013-06-14 一种处理报文的方法和转发器
CN201811277361.5A CN109218111B (zh) 2013-06-14 2013-06-14 一种处理报文的方法和转发器
JP2016518818A JP6752141B2 (ja) 2013-06-14 2013-06-14 パケットを処理するための方法およびフォワーダ
US14/966,307 US9998364B2 (en) 2013-06-14 2015-12-11 Method for processing packet and forwarder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/077259 WO2014198064A1 (zh) 2013-06-14 2013-06-14 一种处理报文的方法和转发器

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/966,307 Continuation US9998364B2 (en) 2013-06-14 2015-12-11 Method for processing packet and forwarder

Publications (1)

Publication Number Publication Date
WO2014198064A1 true WO2014198064A1 (zh) 2014-12-18

Family

ID=52021588

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/077259 WO2014198064A1 (zh) 2013-06-14 2013-06-14 一种处理报文的方法和转发器

Country Status (5)

Country Link
US (1) US9998364B2 (zh)
EP (1) EP2996292B1 (zh)
JP (1) JP6752141B2 (zh)
CN (2) CN105009529B (zh)
WO (1) WO2014198064A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150139238A1 (en) * 2013-11-18 2015-05-21 Telefonaktiebolaget L M Ericsson (Publ) Multi-tenant isolation in a cloud environment using software defined networking

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014000266A1 (zh) 2012-06-29 2014-01-03 华为技术有限公司 信息处理方法、转发面设备和控制面设备
EP3091708B1 (en) 2014-01-28 2019-01-23 Huawei Technologies Co., Ltd. Processing rule modification method and apparatus
EP3148134B1 (en) * 2014-06-18 2020-02-26 Huawei Technologies Co., Ltd. Method and device for controlling service data flow
US9743367B2 (en) * 2014-09-18 2017-08-22 Lenovo Enterprise Solutions (Singapore) Pte. Ltd. Link layer discovery protocol (LLDP) on multiple nodes of a distributed fabric
US20180048593A1 (en) * 2015-02-17 2018-02-15 Hewlett Packard Enterprise Development Lp Flow entry generating and packet processing based on flow entry
CN109379286B (zh) * 2018-12-25 2020-12-01 中国科学院沈阳自动化研究所 一种基于Handle标识的数据转发系统
CN113938405B (zh) * 2020-07-10 2023-03-28 北京华为数字技术有限公司 一种数据处理的方法、装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102946325A (zh) * 2012-11-14 2013-02-27 中兴通讯股份有限公司 一种基于软件定义网络的网络诊断方法、系统及设备
CN103051557A (zh) * 2012-12-27 2013-04-17 华为技术有限公司 数据流处理方法及系统、控制器、交换设备
US8448238B1 (en) * 2013-01-23 2013-05-21 Sideband Networks, Inc. Network security as a service using virtual secure channels

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7391865B2 (en) * 1999-09-20 2008-06-24 Security First Corporation Secure data parser method and system
US20050094670A1 (en) * 2003-08-20 2005-05-05 Samsung Electronics Co., Ltd. Method for acquiring header compression context in user equipment for receiving packet data service
DE602004023338D1 (de) * 2004-12-21 2009-11-05 Ericsson Telefon Ab L M Anordnung und verfahren in bezug auf den fluss von paketen in kommunikationssystemen
CN101552747B (zh) * 2008-04-02 2012-05-30 华为技术有限公司 路由管理方法、装置和系统
US8780721B2 (en) 2009-10-06 2014-07-15 Nec Corporation Network system, controller, method, and program
CN102045327B (zh) * 2009-10-09 2013-11-27 杭州华三通信技术有限公司 防范cc攻击的方法和设备
US8750164B2 (en) * 2010-07-06 2014-06-10 Nicira, Inc. Hierarchical managed switch architecture
EP2452250B1 (en) * 2010-07-08 2015-09-09 Nec Corporation Method of supporting power control in a communication network
CA2814072A1 (en) * 2010-10-15 2012-04-19 Nec Corporation Switch system, and monitoring centralized control method
JP5754506B2 (ja) * 2011-06-16 2015-07-29 日本電気株式会社 通信システム、コントローラ、スイッチ、ストレージ管理装置、及び通信方法
US9191290B2 (en) * 2011-06-20 2015-11-17 Telefonaktiebolaget L M Ericsson (Publ) Methods and devices for monitoring a data path
KR101887581B1 (ko) * 2011-12-26 2018-08-14 한국전자통신연구원 플로우 기반의 패킷 전송 장치 및 그것의 패킷 처리 방법
US8997223B2 (en) * 2013-01-30 2015-03-31 Palo Alto Networks, Inc. Event aggregation in a distributed processor system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102946325A (zh) * 2012-11-14 2013-02-27 中兴通讯股份有限公司 一种基于软件定义网络的网络诊断方法、系统及设备
CN103051557A (zh) * 2012-12-27 2013-04-17 华为技术有限公司 数据流处理方法及系统、控制器、交换设备
US8448238B1 (en) * 2013-01-23 2013-05-21 Sideband Networks, Inc. Network security as a service using virtual secure channels

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP2996292A4 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150139238A1 (en) * 2013-11-18 2015-05-21 Telefonaktiebolaget L M Ericsson (Publ) Multi-tenant isolation in a cloud environment using software defined networking
US9912582B2 (en) * 2013-11-18 2018-03-06 Telefonaktiebolaget Lm Ericsson (Publ) Multi-tenant isolation in a cloud environment using software defined networking

Also Published As

Publication number Publication date
EP2996292A1 (en) 2016-03-16
US20160099868A1 (en) 2016-04-07
EP2996292A4 (en) 2016-06-22
CN105009529B (zh) 2018-11-16
US9998364B2 (en) 2018-06-12
JP2016524412A (ja) 2016-08-12
JP6752141B2 (ja) 2020-09-09
CN109218111A (zh) 2019-01-15
CN109218111B (zh) 2021-10-15
EP2996292B1 (en) 2020-08-05
CN105009529A (zh) 2015-10-28

Similar Documents

Publication Publication Date Title
WO2014198064A1 (zh) 一种处理报文的方法和转发器
US20220078114A1 (en) Method and Apparatus for Providing Service for Traffic Flow
JP5621778B2 (ja) コンテンツベーススイッチシステム、及びコンテンツベーススイッチ方法
WO2019184752A1 (zh) 网络设备的管理方法、装置及系统
US20140098669A1 (en) Method and apparatus for accelerating forwarding in software-defined networks
WO2011087085A1 (ja) 計算機、ネットワーク接続切替え方法およびプログラム
US10361954B2 (en) Method and apparatus for processing modified packet
US20120327811A1 (en) Virtual network connection method, network system, and network device
WO2017107814A1 (zh) 一种传播QoS策略的方法、装置及系统
WO2021047515A1 (zh) 一种服务路由方法及装置
WO2020168854A1 (zh) 一种evpn组播方法、装置及系统
WO2017198131A1 (zh) 用于重定向数据流的方法和系统、网络设备和控制设备
WO2020043200A1 (zh) 建立快速转发表
JP5725236B2 (ja) 通信システム、ノード、パケット転送方法およびプログラム
JP6480452B2 (ja) パケット処理方法および装置
WO2019196914A1 (zh) 一种发现转发路径的方法及其相关设备
JPWO2014104277A1 (ja) 制御装置、通信システム、通信ノードの制御方法及びプログラム
CN110381007B (zh) Tcp加速方法及装置
WO2014067055A1 (zh) 流表刷新的方法及装置
WO2014183579A1 (zh) 控制数据转发的方法及逻辑交换机
US11799779B1 (en) Session-based packet capture
WO2016197832A1 (zh) 报文处理方法、设备和系统
JP2020065264A (ja) パケットを処理するための方法およびフォワーダ
WO2013091191A1 (zh) 数据分流方法和装置
WO2023231438A1 (zh) 报文发送的方法、网络设备及系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13887011

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2013887011

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2016518818

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE