Methods and devices for mapping southbound configurations to northbound interfaces in ODL controller clusters
By generating configuration key-value strings in the ODL controller cluster and passing them using the yang model, combined with distributed database listening, the problem of the correspondence between southbound configuration and northbound interface is solved, improving the efficiency of automated testing and development, and realizing efficient configuration management and error diagnosis.
Patent Information
- Application Number
- CN202210851919.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-20
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2042-07-20
AI Technical Summary
In the OpenDayLight (ODL) controller cluster, the mapping between southbound configuration and northbound business interfaces is difficult to achieve, resulting in low efficiency of automated testing and development, and manual operation is prone to errors, especially in multi-threaded and multi-JVM environments where it is difficult to distinguish configuration relationships.
By generating configuration key-value strings in the virtual machine, and using the yang model to progressively pass and look up the configuration database, the mapping between southbound configuration and northbound RESTful API interface is achieved. A cross-JVM pseudo-synchronization mechanism and distributed database listening are adopted to ensure accurate mapping and synchronous transmission of configuration commands.
It improves the correspondence efficiency between southbound configuration and northbound interface in the ODL controller cluster, enhances the efficiency of automated testing and development, strengthens error diagnosis capabilities, and achieves high robustness and scalability.
Smart Images

Figure CN115220870B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software-defined networking technology, and in particular to a method and device for mapping southbound configuration and northbound interface in an ODL controller cluster. Background Technology
[0002] OpenDayLight (ODL) is an open-source, microservice-based SDN controller contributed by numerous networking vendors. It supports network protocols such as OpenFlow, SNMP, NETCONF, OVSDB, BGP, and LISP, and boasts excellent programmability. It uses OSGi Karaf as its underlying service module implementation, exposing module interfaces through the MD-SAL and yang models. This model embeds LevelDB and includes an Akka Cluster-based cluster communication solution, offering rich functionality and out-of-the-box usability. In SDN controller implementation, mapping southbound configurations to northbound service interfaces is essential. This exposes the underlying network status to operators (network engineers), provides details of controller operation, enables security auditing, and diagnoses controller failures. It also provides developers and testers with a way to obtain operational feedback without relying on logs, facilitating integrated automated testing.
[0003] While leveraging the modular capabilities provided by ODL, establishing a mapping between southbound configurations and northbound service interfaces is not straightforward. Therefore, in most real-world scenarios, operators and testers are forced to abandon automated testing and instead manually trigger southbound configurations through service operations, then manually check the configuration distribution status on the switch. When problems arise, they rely on ODL logs for location and resolution. In simple SDN controllers that do not employ the ODL framework, this issue can be resolved using thread ID identification: binding the RESTful interface thread ID to the thread ID of the service actually distributing the configuration to provide a mapping.
[0004] When southbound configuration and northbound business interfaces cannot be implemented programmatically, testers and operators must manually operate and estimate the correspondence: operating the RESTful interface and checking the distributed switch configuration in the logs or checking the distributed configuration on the switch. The drawbacks are obvious: human error is prone to occur, and this correspondence is heavily dependent on timing. If someone else triggers the distribution of switch configuration while operating the RESTful interface, it becomes difficult to distinguish the correspondence between the southbound configuration and the northbound business interface. Therefore, this manual approach severely impacts development efficiency and delivery capabilities. While thread IDs can resolve the correspondence in simple SDN controller implementations, this is not feasible in the ODL framework: in an ODL cluster, the northbound RESTful interface and the MD-SAL service layer are decoupled, meaning they may not execute on the same thread or even on a separate JavaVirtualMachine / JVM. Therefore, this solution is impractical in real-world operation. Summary of the Invention
[0005] This application provides a method and device for mapping southbound configuration to northbound interface in an ODL controller cluster, in order to solve the technical problem of difficulty in troubleshooting configuration and traffic during existing service deployment and maintenance.
[0006] On one hand, this application provides a method for mapping southbound configuration to northbound interface in an ODL controller cluster. The method includes: obtaining a configuration command generated after the southbound configuration is issued in a virtual machine; storing the configuration command in a configuration database and generating a configuration key-value string corresponding to the configuration command; passing the configuration key-value string upwards through RPC in the virtual machine's yang model until it reaches the logical layer of the northbound RESTful API interface; after obtaining the configuration key-value string at the logical layer of the northbound RESTful API interface, searching the configuration database through the configuration key-value string to obtain the southbound configuration, thereby realizing the mapping between the southbound configuration and the northbound RESTful API interface.
[0007] In one or more embodiments of this application specification, after obtaining the configuration command generated after the southbound configuration is issued in the virtual machine, the method further includes: constructing a configuration command set through the configuration command; wherein the configuration command set is used to indicate the set of commands issued to a switch; and storing the configuration command set in a memory-based or distributed configuration database to generate the configuration key-value string of type String.
[0008] In one or more embodiments of this application specification, the configuration key-value string is passed upwards step by step through the RPC in the virtual machine yang model, specifically including: adding a String left node in the yang model; and passing the configuration key-value string upwards step by step through the String left node.
[0009] In one or more embodiments of this application specification, the configuration key-value string is passed upwards step by step through the RPC in the virtual machine yang model, and further includes: after receiving the configuration key-value string, each module in the virtual machine searches the configuration database through the configuration key-value string to obtain the southbound configuration.
[0010] In one or more embodiments of this application specification, after searching the configuration database using the configuration key-value string, the method further includes: deleting the cache of the configuration database using the LRU algorithm to avoid cache explosion caused by multiple calls to the configuration database.
[0011] In one or more embodiments of this application specification, after obtaining the configuration command generated after the southbound configuration is issued in the virtual machine, the method further includes: determining that the virtual machine contains a listening module; processing the configuration command in the listening module; after successful processing, writing the configuration command into the OpenDayLight distributed database; the first virtual machine queries the OpenDayLight distributed database to obtain the configuration command, thereby realizing the correspondence between the southbound configuration and the northbound RESTful API interface; wherein, the northbound RESTful API interface is located within the first virtual machine.
[0012] In one or more embodiments of this application specification, after the configuration command is processed in the listening module, the method further includes: determining that the listening module failed to process the configuration command; serializing the failed virtual machine Java stack through the OpenDayLight distributed database and synchronizing the processing result to the first virtual machine; after the first virtual machine is synchronized, constructing an error stack and throwing the error stack to the northbound RESTful thread.
[0013] In one or more embodiments of this application specification, the method further includes: actively clearing the data in the OpenDayLight distributed database.
[0014] In one or more embodiments of this application specification, after implementing the correspondence between the southbound configuration and the northbound RESTful API interface, the method further includes: grouping and displaying the configuration commands by switch; or, displaying the configuration commands by service in a tree structure.
[0015] On the other hand, embodiments of this application also provide a device for corresponding southbound configuration and northbound interface in an ODL controller cluster. The device includes: a processor; and a memory storing executable instructions, which, when executed, cause the processor to perform the method for corresponding southbound configuration and northbound interface in an ODL controller cluster as described above.
[0016] This application provides a method and device for mapping southbound configurations and northbound interfaces in an ODL controller cluster. Utilizing the OpenDayLight framework, it offers a robust and scalable mapping relationship between southbound configurations and northbound business interfaces that meets business needs. By flexibly modifying the OpenDayLight cluster database listening mechanism, it achieves cross-Java Virtual Machine northbound / south communication in the cluster while maintaining event-based business processing flow, rather than using RPC. Ultimately, it meets the needs of operators, developers, and testers, improving automation levels and error diagnosis capabilities, and enhancing development and operational efficiency. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0018] Figure 1 A flowchart illustrating a method for mapping southbound configuration and northbound interface in an ODL controller cluster, provided as an embodiment of this application;
[0019] Figure 2 A flowchart illustrating the correspondence between southbound configuration and northbound interface in an ODL controller cluster under an application scenario provided in this application embodiment;
[0020] Figure 3 This is a diagram showing the corresponding device structure of the southbound configuration and northbound interface in an ODL controller cluster, as provided in an embodiment of this application. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0022] The technical solutions proposed in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0023] Figure 1 This document provides a flowchart illustrating a method for mapping southbound configuration and northbound interfaces in an ODL controller cluster, as illustrated in an embodiment of this application. Figure 1 As shown, the corresponding method in the embodiments of this application includes at least the following execution steps:
[0024] Step 101: Obtain the configuration command.
[0025] In one example of this application, after the southbound configuration is issued, that is, after the virtual machine issues the configuration information to the switch, some commands are obtained. These commands generally refer to the working instructions of the switch. For ease of description, the commands obtained after the aforementioned configuration is issued are referred to as configuration commands in this embodiment of the application.
[0026] In addition, obtaining configuration commands refers to collecting or recording these commands obtained after the configuration is issued, so as to be used later.
[0027] Step 102: Generate configuration string.
[0028] After obtaining the configuration commands, these commands can be stored in a memory-based or distributed configuration database. To facilitate retrieval of these commands in the database, a unique key-value string (key) is generated, which is the configuration key-value string in this embodiment. The purpose of this string is to allow retrieval of the aforementioned configuration commands in the configuration database.
[0029] Step 103: Pass the configuration key-value string upwards in the virtual machine.
[0030] Passing upwards refers to passing the aforementioned configuration key-value string step by step upwards in the virtual machine, that is, passing it layer by layer from south to north, so as to pass the configuration key-value string to the northernmost interface.
[0031] Step 104: Retrieve the southbound configuration by searching the configuration database using the configuration key-value string.
[0032] As previously explained, configuration key-value strings can be used to look up configuration databases. Therefore, after obtaining the configuration key-value string from the northbound interface, this string can be used to search the configuration database and find the configuration command corresponding to the string. This achieves the correspondence between the southbound configuration and the northbound interface.
[0033] To describe the corresponding methods in the embodiments of this application in more detail, the following is in conjunction with the appendix. Figure 2 Further explanation is needed. Figure 2 This document presents a flowchart illustrating the mapping method between southbound configuration and northbound interface in an ODL controller cluster, as provided in an embodiment of this application. Figure 2 As shown,
[0034] The corresponding methods in the embodiments of this application mainly rely on the data structures and calling hierarchy, such as... Figure 2 As shown on the left, `record` and `cacheData` are used to maintain a memory-based or distributed configuration database. As shown in the OneJVM section on the right, after the southbound configuration is distributed, some commands (i.e., the aforementioned configuration commands) are received. These commands are stored in this configuration database, resulting in a string key (i.e., the aforementioned configuration key-value string). When this string is returned to the upper layer via RPC in the Yang model, it carries this configuration key-value string key. The upper layer then searches this configuration database and retrieves the configuration command based on the configuration key-value string key, progressively passing it upwards until it reaches the logic layer of the RESTful API interface. Additionally, Figure 2 The `cacheDataQueue` in the code can be used to implement LRU cache deletion, preventing the memory configuration database cache from exploding due to multiple calls. For existing business logic, the only adaptation needed is to change the return value of each main business method to return a `List`. <id>Each ID represents a set of commands issued to a switch. These commands are then saved to the configuration database to obtain a String key. The Yang model in the virtual machine is modified by adding a String leaf node, which enables configuration commands to be passed between different modules of the virtual machine and finally reach the northbound RESTful API interface, thus realizing the correspondence between the southbound configuration and the northbound RESTful API interface.
[0035] Furthermore, some services are triggered by listening, such as... Figure 2 As shown in the lower left, the northbound RESTful API interface triggers a database write. To achieve northbound / northbound correspondence, a "cross-JVM pseudo-synchronization" scheme is implemented. JVM1 waits for the JVM2 listener to trigger business logic due to data changes. JVM2, like the One JVM above, distributes configurations through its yang model and configuration database, and processes the configuration at the top level of the listener. If processing is successful, the configuration command is written to the OpenDaylight distributed database. JVM1 polls this OpenDaylight distributed database, retrieves the data, and returns directly, ultimately achieving northbound / northbound correspondence. If it fails, the failed JVM2 Java stack is serialized through the OpenDaylight distributed database, and the serialization result is passed to JVM1. Then, JVM1 constructs an error stack and throws it to the northbound RESTful thread, making it appear as if the business logic is executed on JVM1.
[0036] It's important to note that regardless of whether the aforementioned configuration process succeeds or fails, the data in the OpenDaylight distributed database must be actively cleared (unlike the RPC solution, which requires an implementation to be called, the implementation here has already been invoked by the listener; since the listener is used in many applications, it cannot be directly deleted and replaced with a synchronous RPC call). Cross-JVM north-south communication here is not limited to the case of two virtual machines; within a single JVM, any application using a listener to distribute configurations can use this process.
[0037] Finally, the northbound RESTful API interface received the distributed configurations, but these configurations were disorganized and could be grouped and displayed by switch. However, it would be better to represent them by business function using a tree structure. Therefore, when collecting the distributed switch configurations during southbound configuration, each configuration was identified by an ID structure. For business functions that iterate through switches using a for loop, the loopId field stores the hashCode of the element in the for element in elements and the hashCode of elements, thus collapsing commands from different switches within the same for loop and achieving a tree structure.
[0038] Furthermore, for the same configuration issued by different switches, inclusion and equality checks are performed. If they are equal, multiple lists are added. <id>It is folded into a single ID to provide users with the most concise and meaningful representation of switch configuration.
[0039] This completes the process of mapping the southbound configuration to the northbound interface in the ODL controller cluster.
[0040] The above are method embodiments in this application. Based on the same inventive concept, this application also provides a corresponding device for southbound configuration and northbound interface in an ODL controller cluster, the structure of which is as follows: Figure 3 As shown.
[0041] Figure 3 This is a diagram illustrating the corresponding device structure of the southbound configuration and northbound interface in an ODL controller cluster, as provided in an embodiment of this application. Figure 3 As shown, the device includes a processor and a memory storing executable instructions that, when executed, cause the processor to perform:
[0042] The system retrieves the configuration command generated after the southbound configuration is issued in the virtual machine; stores the configuration command in the configuration database and generates a configuration key-value string corresponding to the configuration command; the configuration key-value string is passed upwards step by step through the RPC in the virtual machine's yang model until it reaches the logical layer of the northbound RESTful API interface; after the logical layer of the northbound RESTful API interface obtains the configuration key-value string, it searches the configuration database through the configuration key-value string to obtain the southbound configuration, thereby realizing the correspondence between the southbound configuration and the northbound RESTful API interface.
[0043] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0044] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0045] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.< / id> < / id>
Claims
1. A method for mapping southbound configurations to northbound interfaces in an ODL controller cluster, characterized in that, The method includes: Obtain the configuration commands generated after the southbound configuration is issued in the virtual machine; The configuration command is stored in the configuration database, and a configuration key-value string corresponding to the configuration command is generated; The configuration key-value string is passed upwards step by step through the RPC in the virtual machine yang model until it is passed to the logical layer of the northbound RESTful API interface; After obtaining the configuration key-value string in the logical layer of the northbound RESTful API interface, the configuration database is searched through the configuration key-value string to obtain the southbound configuration, thereby realizing the correspondence between the southbound configuration and the northbound RESTful API interface. Then, the configuration commands are grouped and displayed by switch, or the configuration commands are displayed by business in a tree structure. After obtaining the configuration command generated after the southbound configuration is issued in the virtual machine, the method further includes: determining that the virtual machine contains a listening module, processing the configuration command in the listening module, and writing the configuration command into the OpenDaylight distributed database after successful processing. The first virtual machine queries the OpenDaylight distributed database to obtain the configuration command, realizing the correspondence between the southbound configuration and the northbound RESTful API interface; wherein, the northbound RESTful API interface is located in the first virtual machine; if the listening module fails to process the configuration command, the failed virtual machine Java stack is serialized through the OpenDaylight distributed database, and the processing result is synchronized to the first virtual machine. After the first virtual machine completes the synchronization, an error stack is constructed and the error stack is thrown to the northbound RESTful thread.
2. The method for corresponding southbound configurations and northbound interfaces in an ODL controller cluster according to claim 1, characterized in that, After obtaining the configuration command generated after the southbound configuration is issued in the virtual machine, the method further includes: The configuration command set is constructed using the configuration commands; wherein, the configuration command set is used to indicate the set of commands issued to a switch; The set of configuration commands is stored in a memory-based or distributed configuration database to generate the configuration key-value string of type String.
3. The method for corresponding southbound configurations and northbound interfaces in an ODL controller cluster according to claim 1, characterized in that, The configuration key-value string is passed up the hierarchy step by step through the RPC in the virtual machine yang model, specifically including: Add a String left node to the yang model; The configuration key-value string is passed up the chain step by step through the String left node.
4. The method for corresponding southbound configurations and northbound interfaces in an ODL controller cluster according to claim 1, characterized in that, The process of passing the configuration key-value string upwards through the RPC in the virtual machine yang model also includes: After receiving the configuration key-value string, each module in the virtual machine searches the configuration database using the configuration key-value string to obtain the southbound configuration.
5. The method for corresponding southbound configurations and northbound interfaces in an ODL controller cluster according to claim 4, characterized in that, After searching the configuration database using the configuration key-value string, the method further includes: The configuration database cache is deleted using the LRU algorithm to avoid cache explosion caused by multiple calls to the configuration database.
6. The method for corresponding southbound configurations and northbound interfaces in an ODL controller cluster according to claim 1, characterized in that, The method further includes: Actively clear the data in the OpenDayLight distributed database.
7. The corresponding devices in the southbound configuration and northbound interface of the ODL controller cluster are characterized in that, The device includes: processor; And a memory storing executable instructions that, when executed, cause the processor to perform the method of corresponding southbound configuration and northbound interface in an ODL controller cluster as described in any one of claims 1-6.
Citation Information
Patent Citations
Data storage method and device used for test interface
CN107092535A
Network controller framework and data processing method
CN112838940A