WO2020199423A1 - Yang模型配置界面的自动化构建方法及系统 - Google Patents

Yang模型配置界面的自动化构建方法及系统 Download PDF

Info

Publication number
WO2020199423A1
WO2020199423A1 PCT/CN2019/096669 CN2019096669W WO2020199423A1 WO 2020199423 A1 WO2020199423 A1 WO 2020199423A1 CN 2019096669 W CN2019096669 W CN 2019096669W WO 2020199423 A1 WO2020199423 A1 WO 2020199423A1
Authority
WO
WIPO (PCT)
Prior art keywords
yang
yaml
control program
model
sdn controller
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2019/096669
Other languages
English (en)
French (fr)
Inventor
姚旭旭
冯丽
刘羿
孙天颖
陈赟昌
汪俊芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fiberhome Telecommunication Technologies Co Ltd
Wuhan Fiberhome Technical Services Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies Co Ltd
Wuhan Fiberhome Technical Services Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fiberhome Telecommunication Technologies Co Ltd, Wuhan Fiberhome Technical Services Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Publication of WO2020199423A1 publication Critical patent/WO2020199423A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Definitions

  • the invention relates to the field of SDN controllers, in particular to a method and system for automatically constructing a YANG model configuration interface.
  • SDN Software Defined Network
  • SDN is a new type of network architecture. By separating the control plane and the forwarding plane of the network, the control function is extracted from the network nodes, and the network behavior can be controlled in a programmable way. Dynamic and controllable network architecture.
  • the SDN controller is the core control layer application of the software-defined network. As shown in Figure 1, in the SDN network, upwards, the SDN controller uses an open software interface to connect to an external control program; downwards, an open hardware interface to connect to a switch to achieve control plane functions. In the SDN controller, from top to bottom, it is divided into a northbound interface layer, a core processing layer, and a southbound interface layer. The SDN controller receives the request to control the switch from the control program, and sends the request to the switch using a certain protocol, such as NETCONF, through the modules that work together at each layer. The switch reports the message about the success or failure of the configuration, and then Return to the control program from bottom to top, and the one-time control function is fully realized.
  • NETCONF a protocol
  • the NETCONF protocol is divided into the transport layer, the RPC layer, the operation layer and the content layer.
  • the content layer is the only layer that is not standardized. So a new modeling language YANG was produced. Its goal is to perform operations on the NETCONF data model and Modeling, covering the operation layer and content layer of the NETCONF protocol.
  • the YANG model describes the hierarchical nesting structure of the data model and the data type of each attribute through the tree structure definition.
  • the inventor found that there are at least the following problems in the prior art: due to the lack of versatility of the YANG model configuration interface and API interface, long development cycle, API solidification, etc., when the YANG model is issued in the traditional way
  • control programs and SDN controllers customized YANG model configuration interfaces and API interfaces need to be developed. Once a new YANG model is added, the control program and SDN controller need to be re-developed.
  • the purpose of the present invention is to overcome the shortcomings of the aforementioned background technology and provide a method and system for automatically constructing a YANG model configuration interface, which can realize zero development of an SDN controller and control program when a YANG model is added.
  • the first aspect provides an automated construction method for the YANG model configuration interface, which includes the following steps:
  • the SDN controller converts the YANG model into YAML format model description information according to the preset mapping rules between the YANG model and the YAML format;
  • the SDN controller responds to the model description information query request from the control program, and sends the model description information in YAML format to the control program;
  • the control program parses the model description information in YAML format according to preset rules, and automatically constructs the YANG model configuration interface;
  • the control program generates configuration information according to the data input on the YANG model configuration interface, and sends the configuration information through the SDN controller.
  • the embodiment of the present invention can automatically generate a YANG model configuration interface.
  • a YANG model is newly added, the SDN controller and control program do not need to be coded.
  • the SDN controller converts the YANG model into the YAML format model description information according to the preset mapping rule between the YANG model and the YAML format, including:
  • YANG model nodes Based on the connotation consistency between YANG model nodes and YAML nodes, YANG model nodes with the same meaning are converted into YAML nodes equally.
  • converting a YANG model into model description information in YAML format includes the following steps:
  • the SDN controller reads the YANG file, and uses a recursive traversal method to identify keywords in the YANG file;
  • the SDN controller responds to a model description information query request from a control program, and sends the model description information in YAML format to the control program, including The following steps:
  • the control program sends a request for querying model description information in YAML format to the SDN controller by means of http request;
  • the northbound interface of the SDN controller receives the query request of the control program, locates and reads the YAML file according to the query request, encapsulates the YAML file into data in the http protocol format, and returns the data in the http protocol format to the control program.
  • control program parses the model description information in YAML format according to preset rules, and automatically constructs the YANG model configuration interface, which specifically includes the following steps:
  • the control program is based on the consistency of the YAML node and the graphical interface element description model of the control program, and converts the YAML node into the control program graphical interface.
  • control program If it is an object node, the control program generates a tree node, which can be expanded, and the expanded node types include object nodes, array nodes, and basic data types;
  • control program If it is an array node, the control program generates a tree node, which can be expanded and supports adding and deleting child nodes. All child nodes have the same data structure, and the child nodes are object nodes or basic types of data;
  • control program If it is a leaf node, the control program generates controls with user editing functions, including: text boxes, radio buttons, and drop-down boxes.
  • control program generates configuration information according to the data input on the YANG model configuration interface, and sends the configuration information through the SDN controller, including the following steps:
  • Assemble the verified data into YAML format configuration information send an http request to the northbound interface of the SDN controller, and send the configuration information through the SDN controller.
  • sending configuration information through the SDN controller includes the following steps:
  • the control program sends a request for issuing configuration information to the SDN controller
  • the SDN controller converts the YAML format configuration information sent by the control program into an XML format, and delivers the XML format configuration information to the corresponding device through the NETCONF channel in the southbound interface.
  • the YANG model configuration interface displays the hierarchical relationship of YANG data in an expandable nested tree structure.
  • the nodes in the tree structure support an editing function.
  • the second aspect is to provide an automated construction system for the YANG model configuration interface
  • the system includes an SDN controller and a control program.
  • the SDN controller includes:
  • the YANG parsing module is used to: convert the YANG model into YAML format model description information according to the preset mapping rules between the YANG model and the YAML format;
  • the northbound interface is used to respond to the model description information query request from the control program, and send the model description information in YAML format to the control program;
  • Control procedures include:
  • the interface building module is used to parse the model description information in YAML format according to preset rules and automatically construct the YANG model configuration interface;
  • the configuration information generation module is used to generate configuration information according to the data input on the YANG model configuration interface, and send the configuration information through the SDN controller.
  • the YANG parsing module of the SDN controller is used for:
  • YANG model nodes Based on the connotation consistency between YANG model nodes and YAML nodes, YANG model nodes with the same meaning are converted into YAML nodes equally.
  • the YANG analysis module of the SDN controller is specifically configured to:
  • the YANG parsing module of the SDN controller reads the YANG file, and uses a recursive traversal method to identify keywords in the YANG file;
  • control program includes a query module, which is used to: send a request for querying model description information in YAML format to the SDN controller in an http request mode;
  • the northbound interface of the SDN controller is used to: receive the request from the query module of the control program, locate and read the YAML file according to the request, encapsulate the YAML file into data in the http protocol format, and convert the data in the http protocol format The data is returned to the query module of the control program.
  • the interface building module of the control program is specifically used for:
  • the control program is based on the consistency of the YAML node and the graphical interface element description model of the control program, and converts the YAML node into the control program graphical interface.
  • control program If it is an object node, the control program generates a tree node, which can be expanded, and the expanded node types include object nodes, array nodes, and basic data types;
  • control program If it is an array node, the control program generates a tree node, which can be expanded and supports adding and deleting child nodes. All child nodes have the same data structure, and the child nodes are object nodes or basic types of data;
  • control program If it is a leaf node, the control program generates controls with user editing functions, including: text boxes, radio buttons, and drop-down boxes.
  • the configuration information generation module of the control program includes:
  • the check sub-module is used to check the data entered on the YANG model configuration interface
  • Assembling sub-module which is used to: assemble the verified data into YAML format configuration information
  • the configuration issuing sub-module is used to: send an http request to the northbound interface of the SDN controller, and call the SDN controller to issue configuration information in YAML format.
  • the SDN controller further includes:
  • the YAML to XML module is used to: convert the YAML format configuration information sent by the configuration distribution sub-module of the control program into XML format;
  • the southbound interface is used to: send configuration information in XML format to the corresponding device through the NETCONF channel.
  • the YANG model configuration interface displays the hierarchical relationship of YANG data in an expandable nested tree structure.
  • the nodes in the tree structure support an editing function.
  • the SDN controller in the present invention compiles the YANG model, generates model description information in YAML format, and automatically generates the configuration interface of the control program based on the model description information provided by the SDN controller, without coding at all.
  • the SDN controller provides a general northbound interface for the control program to obtain model information and issue configuration information. This method has great versatility. When a YANG model is added, the YANG configuration interface is automatically constructed, with fewer APIs and versatility. When the YANG model is added, the SDN controller and control program can be developed at zero.
  • Figure 1 is a schematic diagram of the structure of the SDN network model
  • Figure 2 is an overall work flow chart in an embodiment of the present invention.
  • Figure 3 is a flowchart of YANG analysis in an embodiment of the present invention.
  • FIG. 4 is a flowchart of a northbound interface query model in an embodiment of the present invention.
  • Figure 5 is a flow chart of the YANG configuration interface constructed by the control program in an embodiment of the present invention.
  • Figure 6 is a flow chart of the YANG configuration information issued by the control program in an embodiment of the present invention.
  • Fig. 7 is a flowchart of the northbound interface issuing YANG configuration information in an embodiment of the present invention.
  • the embodiment of the present invention provides a method for automatically constructing a YANG model configuration interface, which includes the following steps:
  • the SDN controller converts the YANG model into model description information in YAML format according to the preset mapping rules between the YANG model and the YAML format, and the model description information is a YAML file;
  • the SDN controller responds to the model description information query request from the control program, and sends the model description information in YAML format to the control program;
  • the control program parses the model description information in YAML format according to preset rules, and automatically constructs the YANG model configuration interface;
  • the control program generates configuration information according to the data input on the YANG model configuration interface, and sends the configuration information through the SDN controller.
  • the SDN controller converts the YANG model into the YAML format model description information according to the preset mapping rule between the YANG model and the YAML format, including:
  • YANG model nodes Based on the connotation consistency between YANG model nodes and YAML nodes, YANG model nodes with the same meaning are converted into YAML nodes equally.
  • converting the YANG model into model description information in YAML format includes the following steps:
  • the SDN controller reads the YANG file, and uses a recursive traversal method to identify keywords in the YANG file;
  • the SDN controller responds to the model description information query request from the control program and sends the model description information in the YAML format to the control program, including the following steps:
  • the control program sends a request for querying model description information in YAML format to the SDN controller by means of http request;
  • the northbound interface of the SDN controller receives the query request of the control program, locates and reads the YAML file according to the query request, encapsulates the YAML file into data in the http protocol format, and returns the data in the http protocol format to the control program.
  • control program parses the model description information in YAML format according to preset rules and automatically constructs the YANG model configuration interface, which specifically includes the following steps:
  • the control program is based on the consistency of the YAML node and the graphical interface element description model of the control program, and converts the YAML node into the control program graphical interface.
  • control program If it is an object node, the control program generates a tree node, which can be expanded, and the expanded node types include object nodes, array nodes, and basic data types;
  • control program If it is an array node, the control program generates a tree node, which can be expanded and supports adding and deleting child nodes. All child nodes have the same data structure, and the child nodes are object nodes or basic types of data;
  • control program If it is a leaf node, the control program generates controls with user editing functions, including: text boxes, radio buttons, and drop-down boxes.
  • control program generates configuration information according to the data input on the YANG model configuration interface, and sends the configuration information through the SDN controller, including the following steps:
  • Assemble the verified data into YAML format configuration information send an http request to the northbound interface of the SDN controller, and send the configuration information through the SDN controller.
  • sending the configuration information through the SDN controller includes the following steps:
  • the control program sends a request for issuing configuration information to the SDN controller
  • the SDN controller converts the YAML format configuration information sent by the control program into an XML format, and delivers the XML format configuration information to the corresponding device through the NETCONF channel in the southbound interface.
  • the YANG model configuration interface displays the hierarchical relationship of YANG data in an expandable nested tree structure.
  • the nodes in the tree structure support editing functions.
  • the embodiment of the present invention can automatically generate a YANG model configuration interface.
  • a YANG model is newly added, the SDN controller and control program do not need to be coded.
  • the API has strong versatility.
  • the SDN controller only needs to provide a limited number of APIs, which has great versatility and supports all YANG models.
  • the embodiment of the present invention also provides an automated construction system for a YANG model configuration interface.
  • the system includes an SDN controller and a control program.
  • the SDN controller includes:
  • the YANG parsing module is used to: convert the YANG model into YAML format model description information according to the preset mapping rules between the YANG model and the YAML format;
  • the northbound interface is used to respond to the model description information query request from the control program, and send the model description information in YAML format to the control program;
  • Control procedures include:
  • the interface building module is used to parse the model description information in YAML format according to preset rules and automatically construct the YANG model configuration interface;
  • the configuration information generation module is used to generate configuration information according to the data input on the YANG model configuration interface, and send the configuration information through the SDN controller.
  • the YANG analysis module of the SDN controller is used for:
  • YANG model nodes Based on the connotation consistency between YANG model nodes and YAML nodes, YANG model nodes with the same meaning are converted into YAML nodes equally.
  • the YANG analysis module of the SDN controller is specifically used for:
  • the YANG parsing module of the SDN controller reads the YANG file, and uses a recursive traversal method to identify keywords in the YANG file;
  • control program includes a query module, which is used to: send a request for querying model description information in YAML format to the SDN controller in an http request mode;
  • the northbound interface of the SDN controller is used to: receive the request from the query module of the control program, locate and read the YAML file according to the request, encapsulate the YAML file into data in the http protocol format, and convert the data in the http protocol format The data is returned to the query module of the control program.
  • the interface building module of the control program is specifically used for:
  • the control program is based on the consistency of the YAML node and the graphical interface element description model of the control program, and converts the YAML node into the control program graphical interface.
  • control program If it is an object node, the control program generates a tree node, which can be expanded, and the expanded node types include object nodes, array nodes, and basic data types;
  • control program If it is an array node, the control program generates a tree node, which can be expanded and supports adding and deleting child nodes. All child nodes have the same data structure, and the child nodes are object nodes or basic types of data;
  • control program If it is a leaf node, the control program generates controls with user editing functions, including: text boxes, radio buttons, and drop-down boxes.
  • the configuration information generating module of the control program includes:
  • the check sub-module is used to check the data entered on the YANG model configuration interface
  • Assembling sub-module which is used to: assemble the verified data into YAML format configuration information
  • the configuration issuing sub-module is used to: send an http request to the northbound interface of the SDN controller, and call the SDN controller to issue configuration information in YAML format.
  • the SDN controller further includes:
  • the YAML to XML module is used to: convert the YAML format configuration information sent by the configuration distribution sub-module of the control program into XML format;
  • the southbound interface is used to: send configuration information in XML format to the corresponding device through the NETCONF channel.
  • the YANG model configuration interface displays the hierarchical relationship of YANG data in an expandable nested tree structure.
  • the nodes in the tree structure support editing functions.
  • the SDN controller includes a northbound interface, a YANG parsing module, a YAML to XML module, and a southbound interface.
  • the northbound interface provides a calling interface for the control program, and realizes functions such as YANG model query and YANG model configuration information delivery.
  • the YANG parsing module completes the reading of the YANG file, verifying the correctness of the YANG file dependency, parsing the YANG syntax, and generating the model description file in YAML format.
  • YAML format is an intuitive data serialization format that can be recognized by a computer. It is a programming language that is highly readable and easy to be read by humans, and is easy to interact with scripting languages to express data sequences. It is a data description language similar to XML, a subset of the standard general-purpose markup language, and its syntax is much simpler than XML.
  • the SDN controller After the SDN controller receives the configuration information in YAML format sent by the control program, the YAML to XML module converts the configuration information in YAML format into XML format, and delivers it to the device through the NETCONF channel in the southbound interface.
  • the control program is a user application (APP), which presents a GUI interface.
  • APP user application
  • main functions of the control program are:
  • the SDN controller reads the YANG file, verifies the correctness of the YANG file machine dependency; parses the YANG file grammar, extracts model information, and converts the YANG model into YAML format model description information.
  • the YANG parsing module converts the YANG model into model description information in YAML format, it needs to formulate corresponding mapping rules.
  • mapping rules between the YANG model and the YAML format model description information are shown in Table 1.
  • the mapping rules are formulated based on the consistency of the connotation between the YANG model node and the YAML node, that is, the meaning of the model object described by the YANG model node and the YAML node is In the same way, YANG model nodes with the same meaning are converted into YAML nodes.
  • container container node
  • list list node
  • Leaf node Leaf node
  • object node object node
  • array array node
  • decimal64 64-bit decimal number node
  • string string type node
  • enumeration enumeration type node
  • the container is the container node, which is used to group related nodes into a subtree subtree.
  • the container node has only child nodes and no value.
  • a container can contain any number and any type of child nodes, including leaf node leaf, list node list, and container node container.
  • List is a list node, which defines a series of list items. All list items are instances of the same structure, which is an important difference between a list node and a container node.
  • a list node can contain any number and any type of child nodes, including leaf node leaf, list node list, and container node container.
  • Leaf is a leaf node, which contains basic types of data like integer or string. It has exactly one value of a specific type and has no child nodes.
  • mapping rules in Table 1 The specific implementation process of the mapping rules in Table 1 is as follows:
  • the YANG parsing module reads the YANG file and uses a recursive traversal method to identify the keywords in the YANG file;
  • the node When a container node is encountered, the node is converted into an object node in the YAML file;
  • the data type of the leaf node is further analyzed.
  • the built-in data types of the YANG model generally include: int8, int16, int32, int64, decimal64, string, enumeration, boolean, these data types will eventually be mapped to int8, int16, int32, int64, decimal64, string, bool, enumeration in the YAML file .
  • YANG can use "typedef" declarations to define derived types from basic types.
  • the custom type declared by "typedef" in YANG is derived from the basic type data, so when it is converted to the type in YAML, the mapping rules are the same as the basic type data.
  • the YANG parsing module completely escapes the model information defined by YANG into model description information in YAML format. The data type, data constraint rules and other information are completely preserved, and there will be no semantic loss.
  • the northbound interface of the SDN controller is the entry module for the control program to access the controller, which mainly provides functions such as model query and YANG model configuration information delivery.
  • the northbound interface of the SDN controller When the northbound interface of the SDN controller receives the query model request from the control program, it locates the specific YAML file according to the query conditions;
  • the SDN controller reads the content of the YAML file and encapsulates it into the http protocol format
  • the northbound interface of the SDN controller returns the data to the control program.
  • control program parses the model description information in YAML format according to preset rules, and the process of automatically constructing the YANG configuration interface is as follows:
  • the control program initiates a query model request to the SDN controller by means of http request, and the control program queries the model description information by calling the northbound interface of the SDN controller;
  • the control program obtains the model description information defined in YAML format returned by the SDN controller;
  • the control program parses the model description information according to preset rules, and automatically constructs the YANG model configuration interface.
  • the YANG model configuration interface displays the hierarchical relationship of YANG data in a tree structure.
  • the nodes in the tree structure support editing functions to complete the addition, deletion, modification, and query functions of the YANG model.
  • the YAML model description information carries data verification rules. These rules will also be fully expressed in the control program.
  • the validity and legality of the data need to be verified.
  • the interface elements of the control program are generated based on YAML and follow the GUI (Graphical User Interface) generation rules in Table 2.
  • the GUI generation rules in Table 2 define the mapping rule from the YANG model to the interface.
  • the essence of the mapping rule is based on the consistency of the expressive ability of the YANG model node, YAML node, and control program graphical interface element description model, which will have the same connotation
  • the nodes in the network are converted peer-to-peer, so that the YANG model can be translated into YAML and control program graphical interfaces without loss.
  • the mapping rule from the YANG model to the interface is the core rule that can realize the automatic construction of the interface in the embodiment of the present invention, and is the basis for the transformation from model abstraction to graphical user interface visualization.
  • the control program Based on the GUI generation rules in Table 2, the control program generates corresponding GUI elements by parsing YAML data nodes, and presents to the user a nested tree structure that can be expanded.
  • the generation process of the control program interface includes the following steps:
  • control program If it is an object node, the control program generates a tree node, which can be expanded and can contain any type of node, such as object, array, and basic data types;
  • control program If it is an array node, the control program generates a tree node, which can be expanded and supports adding and deleting child nodes. All child nodes have the same data structure, and the child nodes can be object or basic type data;
  • the control program If it is a leaf node, that is, basic type data, it cannot be expanded further, and the leaf node can be edited. According to different basic types of data, the control program generates controls with user editing functions such as text boxes, radio buttons, drop-down boxes, etc.;
  • the data verification rule is not a visual interface element. It is included as a hidden attribute in the above-mentioned components to verify the data entered by the user.
  • the user needs to fill in the configuration information in the YANG configuration interface
  • the data is verified. During the filling process and before the configuration is issued, the control program needs to verify the validity of the data.
  • the verification rule comes from the verification rule in the YANG file. This verification rule In the YANG model analysis stage, it is converted into the data verification rules in the YAML file without loss;
  • control program After the data is verified correctly, the control program assembles the YANG configuration information into a YAML format, sends an http request to the northbound interface of the SDN controller, calls the YANG configuration information delivery interface of the SDN controller, and delivers the configuration information.
  • the northbound interface of the SDN controller receives a YANG model request from the control program
  • the YAML to XML module of the SDN controller converts the received configuration information in YAML format into an XML format that can be recognized by the device;
  • the southbound interface of the SDN controller calls the NETCONF channel to deliver the configuration information in XML format to the corresponding device.
  • the new YANG model only needs to be added to the SDN controller.
  • the control program can generate a configuration interface and send data.
  • the control program and the SDN controller have almost no coding, so the development cycle can be shortened.
  • embodiments of the present application also provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, all or part of the method steps of the above method are implemented.
  • the present invention implements all or part of the processes in the above method, and can also be completed by instructing relevant hardware by a computer program.
  • the computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can be implemented. The steps of each method embodiment described above.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate forms.
  • Computer-readable media may include: any entity or device capable of carrying computer program code, recording media, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access Memory (RAM, Access Memory), electric carrier signal, telecommunications signal, software distribution medium, etc.
  • computer-readable media can be appropriately added or deleted according to the requirements of the legislation and patent practice in the jurisdiction.
  • computer-readable media does not include Electric carrier signal and telecommunications signal.
  • the embodiments of the present application also provide an electronic device, including a memory and a processor, and a computer program running on the processor is stored in the memory.
  • a computer program running on the processor is stored in the memory.
  • the processor executes the computer program, all method steps or steps in the above method are implemented. Some method steps.
  • the so-called processor can be a central processing unit (CPU), other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuits, ASICs). ), ready-made programmable gate array (Field-Programmable Gate Array, F PGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor, or the processor may also be any conventional processor, etc.
  • the processor is the control center of the computer device, and various interfaces and lines are used to connect various parts of the entire computer device.
  • the memory may be used to store computer programs and/or modules, and the processor implements various functions of the computer device by running or executing the computer programs and/or modules stored in the memory and calling data stored in the memory.
  • the memory may mainly include a storage program area and a storage data area, where the storage program area can store an operating system and at least one application program required by at least one function (such as sound playback function, image playback function, etc.); the storage data area can store Use the created data (such as audio data, video data, etc.).
  • the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disks, memory, plug-in hard disks, smart memory cards (Smart Memory Card, SMC), and Secure Digital (SD) Card, Flash Card, at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
  • non-volatile memory such as hard disks, memory, plug-in hard disks, smart memory cards (Smart Memory Card, SMC), and Secure Digital (SD) Card, Flash Card, at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
  • the embodiments of the present invention can be provided as methods, systems, servers, or computer program products. Therefore, the present invention may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, optical storage, etc.) containing computer-usable program codes.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

一种YANG模型配置界面的自动化构建方法及系统,涉及SDN控制器领域。该方法包括以下步骤:SDN控制器根据预设的YANG模型与YAML格式之间的映射规则,将YANG模型转换为YAML格式的模型描述信息;SDN控制器响应来自控制程序的模型描述信息查询请求,将所述YAML格式的模型描述信息发送至所述控制程序;控制程序根据预设的规则解析YAML格式的模型描述信息,自动构建YANG模型配置界面。该方法能够实现新增YANG模型时,SDN控制器和控制程序零开发。

Description

YANG模型配置界面的自动化构建方法及系统 技术领域
本发明涉及SDN控制器领域,具体是涉及一种YANG模型配置界面的自动化构建方法及系统。
背景技术
SDN(Software Defined Network,软件定义网络)是一种新型的网络体系结构,通过将网络的控制平面和转发平面分离,将控制功能从网络节点中抽取出来,以可编程的方式控制网络行为,构建动态的、可控的网络体系结构。
SDN控制器即软件定义网络的核心控制层应用程序。参见图1所示,在SDN网络中,向上,SDN控制器以开放软件接口对接外部控制程序;向下,以开放硬件接口对接交换机,实现控制平面功能。在SDN控制器中,从上到下依次分为北向接口层、核心处理层、南向接口层。SDN控制器从控制程序接收控制交换机的请求,经由这些各层协同工作的模块,将请求以某种协议,例如:NETCONF,下发给交换机,交换机上报有关配置成功或失败的消息后,再从下至上返回给控制程序,一次控制功能即完整实现。
NETCONF协议分为传输层、RPC层、操作层和内容层,其中,内容层是唯一没有标准化的层,于是一种新的建模语言YANG产生了,它的目标是对NETCONF数据模型、操作进行建模,覆盖NETCONF协议的操作层和内容层。YANG模型通过树状结构定义描述了数据模型的层级嵌套结构以及各属性的数据类型。
在实现本发明的过程中,发明人发现现有技术中至少存在如下问题:由于YANG模型配置界面和API接口不具备通用性、开发周期长、API固化等原因,采用传统方式下发YANG模型时,针对不同的YANG模型,控制程序和SDN控制器需要开发定制化的YANG模型配置界面及API接口。一旦有新的YANG模型加入,控制程序和SDN控制器需要重新开发。
发明内容
本发明的目的是为了克服上述背景技术的不足,提供一种YANG模型配置界面的自动化构建方法及系统,能够实现新增YANG模型时,SDN控制器和控制程序零开发。
第一方面,提供一种YANG模型配置界面的自动化构建方法,包括以下步骤:
SDN控制器根据预设的YANG模型与YAML格式之间的映射规则,将YANG模型转换为YAML格式的模型描述信息;
SDN控制器响应来自控制程序的模型描述信息查询请求,将所述YAML格式的模型描述信息发送至所述控制程序;
控制程序根据预设的规则解析YAML格式的模型描述信息,自动构建YANG模型配置界面;
控制程序根据所述YANG模型配置界面上输入的数据生成配置信息,通过SDN控制器下发配置信息。
本发明实施例能够自动生成YANG模型配置界面,新增YANG模型时,SDN控制器和控制程序无需编码。
根据第一方面,在第一方面的第一种可能的实现方式中,SDN控制器根据预设的YANG模型与YAML格式之间的映射规则,将YANG模型转换为YAML格式的模型描述信息包括:
基于YANG模型节点和YAML节点的内涵一致性,将具有相同含义的YANG模型节点对等地转换为YAML节点。
根据第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,将YANG模型转换为YAML格式的模型描述信息,包括如下步骤:
所述SDN控制器读取YANG文件,采用递归遍历的方式,识别YANG文件中的关键字;
将YANG文件中的容器节点转化为YAML文件中的对象节点;
将YANG文件中的列表节点转化为YAML文件中的数组节点;
解析YANG文件中叶子节点的数据类型,并转化为YAML文件的相应数据类型。
根据第一方面,在第一方面的第三种可能的实现方式中,SDN控制器响应来自控制程序的模型描述信息查询请求,将所述YAML格式的模型描述信息发送至所述控制程序,包括以下步骤:
控制程序以http请求方式,向SDN控制器发送查询YAML格式的模型描述信息的请求;
SDN控制器的北向接口接收控制程序的查询请求,根据查询请求定位并读取YAML文件,将所述YAML文件封装成http协议格式的数据,并将http协议格式的数据返回给控制程序。
根据第一方面,在第一方面的第四种可能的实现方式中,控制程序根据预设的规则解析YAML格式的模型描述信息,自动构建YANG模型配置界面,具体包括以下步骤:
控制程序基于YAML节点、控制程序图形界面元素描述模型的一致性,将YAML节点对等地转换为控制程序图形界面;
如果是对象节点,控制程序生成树状节点,该树状节点可展开, 展开后的节点类型包括对象节点、数组节点、基本数据类型;
如果是数组节点,控制程序生成树状节点,该树状节点可展开,并支持增删子节点,所有子节点具备相同数据结构,子节点为对象节点或者基本类型数据;
如果是叶子节点,控制程序生成具备用户编辑功能的控件,包括:文本框、单选框、下拉框。
根据第一方面,在第一方面的第五种可能的实现方式中,控制程序根据所述YANG模型配置界面上输入的数据生成配置信息,通过SDN控制器下发配置信息,包括以下步骤;
对YANG模型配置界面上输入的数据进行校验;
将通过校验的数据组装成YAML格式的配置信息,向SDN控制器的北向接口发送http请求,通过SDN控制器下发配置信息。
根据第一方面的第五种可能的实现方式,在第一方面的第六种可能的实现方式中,通过SDN控制器下发配置信息,包括以下步骤:
控制程序向SDN控制器发送下发配置信息的请求;
SDN控制器将控制程序发送的YAML格式的配置信息转化为XML格式,通过南向接口中的NETCONF通道,将XML格式的配置信息下发到对应的设备。
根据第一方面,在第一方面的第七种可能的实现方式中,所述YANG模型配置界面以可展开的嵌套的树状结构展示YANG数据的层次关系。
根据第一方面的第七种可能的实现方式,在第一方面的第八种可能的实现方式中,所述树状结构中的节点支持编辑功能。
第二方面,提供一种YANG模型配置界面的自动化构建系统,
该系统包括SDN控制器和控制程序,其中,SDN控制器包括:
YANG解析模块,用于:根据预设的YANG模型与YAML格式之间的映射规则,将YANG模型转换为YAML格式的模型描述信息;
北向接口,用于:响应来自控制程序的模型描述信息查询请求,将所述YAML格式的模型描述信息发送至所述控制程序;
控制程序包括:
界面构建模块,用于:根据预设的规则解析YAML格式的模型描述信息,自动构建YANG模型配置界面;
配置信息生成模块,用于:根据所述YANG模型配置界面上输入的数据生成配置信息,并通过SDN控制器下发配置信息。
根据第二方面,在第二方面的第一种可能的实现方式中,所述SDN控制器的YANG解析模块用于:
基于YANG模型节点和YAML节点的内涵一致性,将具有相同含义的YANG模型节点对等地转换为YAML节点。
根据第二方面的第一种可能的实现方式,在第二方面的第二种可能的实现方式中,所述SDN控制器的YANG解析模块具体用于:
所述SDN控制器的YANG解析模块读取YANG文件,采用递归遍历的方式,识别YANG文件中的关键字;
将YANG文件中的容器节点转化为YAML文件中的对象节点;
将YANG文件中的列表节点转化为YAML文件中的数组节点;
解析YANG文件中叶子节点的数据类型,并转化为YAML文件的相应数据类型。
根据第二方面,在第二方面的第三种可能的实现方式中,控制程序包括查询模块,其用于:以http请求方式,向SDN控制器发送查询YAML格式的模型描述信息的请求;
SDN控制器的北向接口用于:接收控制程序的查询模块发来的 请求,根据所述请求定位并读取YAML文件,将所述YAML文件封装成http协议格式的数据,并将http协议格式的数据返回给控制程序的查询模块。
根据第二方面,在第二方面的第四种可能的实现方式中,控制程序的界面构建模块具体用于:
控制程序基于YAML节点、控制程序图形界面元素描述模型的一致性,将YAML节点对等地转换为控制程序图形界面;
如果是对象节点,控制程序生成树状节点,该树状节点可展开,展开后的节点类型包括对象节点、数组节点、基本数据类型;
如果是数组节点,控制程序生成树状节点,该树状节点可展开,并支持增删子节点,所有子节点具备相同数据结构,子节点为对象节点或者基本类型数据;
如果是叶子节点,控制程序生成具备用户编辑功能的控件,包括:文本框、单选框、下拉框。
根据第二方面,在第二方面的第五种可能的实现方式中,控制程序的配置信息生成模块包括:
校验子模块,其用于:对YANG模型配置界面上输入的数据进行校验;
组装子模块,其用于:将通过校验的数据组装成YAML格式的配置信息;
配置下发子模块,其用于:向SDN控制器的北向接口发送http请求,调用SDN控制器下发YAML格式的配置信息。
根据第二方面的第五种可能的实现方式,在第二方面的第六种可能的实现方式中,SDN控制器还包括:
YAML转XML模块,用于:将控制程序的配置下发子模块发送 的YAML格式的配置信息转化为XML格式;
南向接口,用于:通过NETCONF通道,将XML格式的配置信息下发到对应的设备。
根据第二方面,在第二方面的第七种可能的实现方式中,所述YANG模型配置界面以可展开的嵌套的树状结构展示YANG数据的层次关系。
根据第二方面的第七种可能的实现方式,在第二方面的第八种可能的实现方式中,所述树状结构中的节点支持编辑功能。
与现有技术相比,本发明的优点如下:
本发明中的SDN控制器编译YANG模型,生成YAML格式的模型描述信息,基于SDN控制器提供的模型描述信息自动生成控制程序的配置界面,完全不需要编码。SDN控制器提供通用的北向接口,供控制程序获取模型信息和下发配置信息。这种方式具备很大的通用性,新增YANG模型时,YANG配置界面自动构建、API少而且具备通用性,能够实现新增YANG模型时,SDN控制器和控制程序零开发。
附图说明
图1是SDN网络模型的结构示意图;
图2是本发明实施例中的整体工作流程图;
图3是本发明实施例中YANG解析的流程图;
图4是本发明实施例中北向接口查询模型的流程图;
图5是本发明实施例中控制程序构建YANG配置界面的流程图;
图6是本发明实施例中控制程序下发YANG配置信息的流程图;
图7是本发明实施例中北向接口下发YANG配置信息的流程图。
具体实施方式
现在将详细参照本发明的具体实施例,在附图中例示了本发明的例子。尽管将结合具体实施例描述本发明,但将理解,不是想要将本发明限于所述的实施例。相反,想要覆盖由所附权利要求限定的在本发明的精神和范围内包括的变更、修改和等价物。应注意,这里描述的方法步骤都可以由任何功能块或功能布置来实现,且任何功能块或功能布置可被实现为物理实体或逻辑实体、或者两者的组合。
本发明实施例提供一种YANG模型配置界面的自动化构建方法,包括以下步骤:
SDN控制器根据预设的YANG模型与YAML格式之间的映射规则,将YANG模型转换为YAML格式的模型描述信息,所述模型描述信息即为YAML文件;
SDN控制器响应来自控制程序的模型描述信息查询请求,将所述YAML格式的模型描述信息发送至所述控制程序;
控制程序根据预设的规则解析YAML格式的模型描述信息,自动构建YANG模型配置界面;
控制程序根据所述YANG模型配置界面上输入的数据生成配置信息,通过SDN控制器下发配置信息。
优选的,SDN控制器根据预设的YANG模型与YAML格式之间的映射规则,将YANG模型转换为YAML格式的模型描述信息包括:
基于YANG模型节点和YAML节点的内涵一致性,将具有相同含义的YANG模型节点对等地转换为YAML节点。
优选的,将YANG模型转换为YAML格式的模型描述信息,包括如下步骤:
所述SDN控制器读取YANG文件,采用递归遍历的方式,识别 YANG文件中的关键字;
将YANG文件中的容器节点转化为YAML文件中的对象节点;
将YANG文件中的列表节点转化为YAML文件中的数组节点;
解析YANG文件中叶子节点的数据类型,并转化为YAML文件的相应数据类型。
优选的,SDN控制器响应来自控制程序的模型描述信息查询请求,将所述YAML格式的模型描述信息发送至所述控制程序,包括以下步骤:
控制程序以http请求方式,向SDN控制器发送查询YAML格式的模型描述信息的请求;
SDN控制器的北向接口接收控制程序的查询请求,根据查询请求定位并读取YAML文件,将所述YAML文件封装成http协议格式的数据,并将http协议格式的数据返回给控制程序。
优选的,控制程序根据预设的规则解析YAML格式的模型描述信息,自动构建YANG模型配置界面,具体包括以下步骤:
控制程序基于YAML节点、控制程序图形界面元素描述模型的一致性,将YAML节点对等地转换为控制程序图形界面;
如果是对象节点,控制程序生成树状节点,该树状节点可展开,展开后的节点类型包括对象节点、数组节点、基本数据类型;
如果是数组节点,控制程序生成树状节点,该树状节点可展开,并支持增删子节点,所有子节点具备相同数据结构,子节点为对象节点或者基本类型数据;
如果是叶子节点,控制程序生成具备用户编辑功能的控件,包括:文本框、单选框、下拉框。
优选的,控制程序根据所述YANG模型配置界面上输入的数据 生成配置信息,通过SDN控制器下发配置信息,包括以下步骤;
对YANG模型配置界面上输入的数据进行校验;
将通过校验的数据组装成YAML格式的配置信息,向SDN控制器的北向接口发送http请求,通过SDN控制器下发配置信息。
优选的,通过SDN控制器下发配置信息,包括以下步骤:
控制程序向SDN控制器发送下发配置信息的请求;
SDN控制器将控制程序发送的YAML格式的配置信息转化为XML格式,通过南向接口中的NETCONF通道,将XML格式的配置信息下发到对应的设备。
优选的,所述YANG模型配置界面以可展开的嵌套的树状结构展示YANG数据的层次关系。
优选的,所述树状结构中的节点支持编辑功能。
本发明实施例能够自动生成YANG模型配置界面,新增YANG模型时,SDN控制器和控制程序无需编码。
API通用性强,SDN控制器只需要提供有限的几个API,具备极大的通用性,支持所有YANG模型下发。
本发明实施例还提供一种YANG模型配置界面的自动化构建系统,该系统包括SDN控制器和控制程序,其中,SDN控制器包括:
YANG解析模块,用于:根据预设的YANG模型与YAML格式之间的映射规则,将YANG模型转换为YAML格式的模型描述信息;
北向接口,用于:响应来自控制程序的模型描述信息查询请求,将所述YAML格式的模型描述信息发送至所述控制程序;
控制程序包括:
界面构建模块,用于:根据预设的规则解析YAML格式的模型描述信息,自动构建YANG模型配置界面;
配置信息生成模块,用于:根据所述YANG模型配置界面上输入的数据生成配置信息,并通过SDN控制器下发配置信息。
优选的,所述SDN控制器的YANG解析模块用于:
基于YANG模型节点和YAML节点的内涵一致性,将具有相同含义的YANG模型节点对等地转换为YAML节点。
优选的,所述SDN控制器的YANG解析模块具体用于:
所述SDN控制器的YANG解析模块读取YANG文件,采用递归遍历的方式,识别YANG文件中的关键字;
将YANG文件中的容器节点转化为YAML文件中的对象节点;
将YANG文件中的列表节点转化为YAML文件中的数组节点;
解析YANG文件中叶子节点的数据类型,并转化为YAML文件的相应数据类型。
优选的,控制程序包括查询模块,其用于:以http请求方式,向SDN控制器发送查询YAML格式的模型描述信息的请求;
SDN控制器的北向接口用于:接收控制程序的查询模块发来的请求,根据所述请求定位并读取YAML文件,将所述YAML文件封装成http协议格式的数据,并将http协议格式的数据返回给控制程序的查询模块。
优选的,控制程序的界面构建模块具体用于:
控制程序基于YAML节点、控制程序图形界面元素描述模型的一致性,将YAML节点对等地转换为控制程序图形界面;
如果是对象节点,控制程序生成树状节点,该树状节点可展开,展开后的节点类型包括对象节点、数组节点、基本数据类型;
如果是数组节点,控制程序生成树状节点,该树状节点可展开,并支持增删子节点,所有子节点具备相同数据结构,子节点为对象节 点或者基本类型数据;
如果是叶子节点,控制程序生成具备用户编辑功能的控件,包括:文本框、单选框、下拉框。
优选的,控制程序的配置信息生成模块包括:
校验子模块,其用于:对YANG模型配置界面上输入的数据进行校验;
组装子模块,其用于:将通过校验的数据组装成YAML格式的配置信息;
配置下发子模块,其用于:向SDN控制器的北向接口发送http请求,调用SDN控制器下发YAML格式的配置信息。
优选的,SDN控制器还包括:
YAML转XML模块,用于:将控制程序的配置下发子模块发送的YAML格式的配置信息转化为XML格式;
南向接口,用于:通过NETCONF通道,将XML格式的配置信息下发到对应的设备。
优选的,所述YANG模型配置界面以可展开的嵌套的树状结构展示YANG数据的层次关系。
优选的,所述树状结构中的节点支持编辑功能。
为了使本领域技术人员更好地理解本发明,下面结合附图和具体实施方式对本发明作进一步详细说明。
注意:接下来要介绍的示例仅是一个具体的例子,而不作为限制本发明的实施例必须为如下具体的步骤、数值、条件、数据、顺序等等。本领域技术人员可以通过阅读本说明书来运用本发明的构思来构造本说明书中未提到的更多实施例。
参见图2所示,SDN控制器包括北向接口、YANG解析模块、 YAML转XML模块、南向接口。
北向接口为控制程序提供调用接口,实现YANG模型查询、YANG模型配置信息下发等功能。
YANG解析模块完成YANG文件读取、校验YANG文件依赖关系的正确性、解析YANG语法、生成YAML格式的模型描述文件。
YANG文件之所以要解析成YAML文件,是因为YAML格式的数据对用户更加友好,更容易处理,在进行数据交互、控制程序界面构建时更加有利。YAML格式是一种直观的能够被电脑识别的数据序列化格式,是一个可读性高并且容易被人类阅读,容易和脚本语言交互,用来表达资料序列的编程语言。它是类似于标准通用标记语言的子集XML的数据描述语言,语法比XML简单很多。
SDN控制器收到控制程序发送的YAML格式的配置信息后,YAML转XML模块将YAML格式的配置信息转为XML格式,并通过南向接口中的NETCONF通道下发到设备上。
控制程序是用户应用程序(APP),呈现GUI界面。在本发明实施例中,控制程序的主要功能有:
1.调用北向接口查询模型描述信息;
2.根据预设的规则解析YAML格式的模型描述信息,自动构建YANG模型配置界面,以树状结构展示YANG数据的层次关系,树状结构中的节点支持编辑功能。
3.根据YAML模型定义的数据约束规则,对用户输入的数据进行校验,例如:有效范围、默认值、字符长度、正则匹配等。
参见图3所示,YANG解析模块的处理流程如下:
SDN控制器读取YANG文件,校验YANG文件机依赖关系的正确性;解析YANG文件语法,提取模型信息;将YANG模型转换为 YAML格式的模型描述信息。
YANG文件及依赖关系的校验原则如下:
1.文件格式是不是YANG类型;
2.所依赖的文件是不是存在;
3.文件版本号是不是正确,是否一致;
4.文件之间是否产生了循环依赖。
YANG解析模块将YANG模型转换为YAML格式的模型描述信息时,需要制定相应的映射规则。
YANG模型与YAML格式的模型描述信息的映射规则如表1所示,该映射规则的制定原则是基于YANG模型节点和YAML节点的内涵一致性,即YANG模型节点和YAML节点描述的模型对象含义是一样的,将具有相同含义的YANG模型节点对等的转换为YAML节点。
表1、YANG模型节点和YAML节点的映射规则
Figure PCTCN2019096669-appb-000001
其中,YANG节点的中文解释如下:
container:容器节点;
list:列表节点;
leaf:叶子节点。
YAML节点的中文解释如下:
object:对象节点;
array:数组节点;
int8:8位整型节点;
int16:16位整型节点;
int32:32位整型节点;
int64:64位整型节点;
decimal64:64位十进制数节点;
string:字符串型节点;
enumeration:枚举型节点;
bool:布尔型节点。
在YANG文件中,container即容器节点,用来将相关的节点归总到一个子树subtree中,container节点只有子节点,没有值。container可以包含任何数量、任何类型的子节点,包括叶子节点leaf、列表节点list、容器节点container。
list是列表节点,定义了一系列的列表项。所有列表项都是相同结构的实例,这是list节点和container节点的重要区别。一个list节点能够包含任意数量、任意类型的子节点,包括叶子节点leaf、列表节点list、容器节点container。
leaf是叶子节点,包含了像integer或者string这样的基本类型数据。它有且仅有一个特定类型的值,而且没有子节点。
表1中映射规则的具体实现过程如下:
YANG解析模块读取YANG文件,采用递归遍历的方式,识别YANG文件中的关键字;
遇到container节点,将该节点转化为YAML文件中的object节点;
遇到list节点,将该节点转化为YAML文件中的array节点;
遇到leaf节点,进一步解析该leaf节点的数据类型。
YANG模型内置数据类型一般有:int8、int16、int32、int64、decimal64、string、enumeration、boolean,这些数据类型最终会映射到YAML文件中的int8、int16、int32、int64、decimal64、string、bool、enumeration。
另外,YANG能够使用“typedef”声明从基本类型中定义派生类型。YANG中使用“typedef”声明的自定义类型,由于是派生自基本类型数据,所以在转为YAML中的类型时,映射规则同基本类型数据一致。YANG解析模块基于上述映射规则,将YANG定义的模型信息,完整转义成YAML格式的模型描述信息,数据类型、数据约束规则等信息完整保留,不会出现语义缺失。
SDN控制器的北向接口是控制程序访问控制器的入口模块,主要提供模型查询、YANG模型配置信息下发等功能。
参见图4所示,SDN控制器的北向接口查询模型的流程如下:
SDN控制器的北向接口收到来自控制程序的查询模型请求时,根据查询条件,定位到具体的YAML文件;
SDN控制器读取YAML文件内容,封装成http协议格式;
SDN控制器的北向接口将数据返回给控制程序。
参见图5所示,控制程序根据预设的规则解析YAML格式的模型描述信息,自动构建YANG配置界面的流程如下:
控制程序以http请求方式,向SDN控制器发起查询模型请求,控制程序通过调用SDN控制器的北向接口查询模型描述信息;
控制程序获取到SDN控制器返回的以YAML格式进行定义的模型描述信息;
控制程序根据预设的规则解析模型描述信息,并自动构建YANG模型配置界面。
由于界面是自动构建的,完全不需要人工干预和重复开发,极大的节省人力和时间投入。
YANG模型配置界面以树状结构展示YANG数据的层次关系,树状结构中的节点支持编辑功能,完成YANG模型的增、删、改、查功能。
另外,YAML模型描述信息中携带了数据校验规则,这些规则在控制程序中也会被完整表达,当用户在输入YANG配置信息时,需要校验数据的有效性、合法性。
控制程序的界面元素是基于YAML生成的,遵循表2中的GUI(Graphical User Interface,图形用户界面)生成规则。
表2、GUI生成规则
Figure PCTCN2019096669-appb-000002
表2中的GUI生成规则定义了YANG模型到界面的映射规则,该映射规则的实质是基于YANG模型节点、YAML节点、控制程序图形界面元素描述模型的表达能力上的一致性,将具有相同内涵的节点进行对等转换,使YANG模型可以被无损的翻译成YAML、控制程序图形界面。
YANG模型到界面的映射规则是本发明实施例能够实现界面自动构建的核心规则,是模型抽象化到图形用户界面具象化的转换基 础。控制程序基于表2的GUI生成规则,通过解析YAML的数据节点,生成相应的GUI元素,呈现给用户的就是一个可以展开的嵌套的树状结构。
控制程序界面的生成过程包括以下步骤:
1.如果是object节点,控制程序生成树状节点,该节点可以展开,展开之后能够包含任意类型节点,如:object、array、基本数据类型;
2.如果是array节点,控制程序生成树状节点,该节点可以展开,并支持增删子节点,所有子节点具备相同数据结构,子节点可以是object或者基本类型数据;
3.如果是叶子节点,即基本类型数据,不能进一步展开,叶子节点可以进行编辑。根据不同的基本类型数据,控制程序生成具备用户编辑功能的控件如:文本框、单选框、下拉框等;
4.数据校验规则不是可视化的界面元素,作为隐藏属性包含在上述组件内,对用户输入的数据进行校验。
参见图6所示,控制程序下发YANG配置信息的流程如下:
用户需要在YANG配置界面填好配置信息;
对数据进行校验,在填写的过程中,以及下发配置前,控制程序都需要对数据的合法性进行校验,该校验规则来自于YANG文件中的校验规则,这一校验规则在YANG模型解析阶段被无损的转换为YAML文件中的数据校验规则;
在数据校验无误后,控制程序将YANG配置信息组装成YAML格式,向SDN控制器的北向接口发送http请求,调用SDN控制器的YANG配置信息下发接口,将配置信息进行下发。
参见图7所示,SDN控制器下发YANG配置信息的流程如下:
SDN控制器的北向接口收到来自控制程序的下发YANG模型请 求;
SDN控制器的YAML转XML模块将收到的YAML格式的配置信息转化为设备能够识别的XML格式;
SDN控制器的南向接口调用NETCONF通道,将XML格式的配置信息下发到对应的设备。
新的YANG模型只需要加入SDN控制器,经过解析,控制程序就能生成配置界面,进行数据下发,控制程序和SDN控制器几乎没有编码量,因此能够缩短开发周期。
基于同一发明构思,本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述方法的所有方法步骤或部分方法步骤。
本发明实现上述方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,计算机程序包括计算机程序代码,计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。计算机可读介质可以包括:能够携带计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Ra ndom Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。
基于同一发明构思,本申请实施例还提供一种电子设备,包括存储器和处理器,存储器上储存有在处理器上运行的计算机程序,处理 器执行计算机程序时实现上述方法中的所有方法步骤或部分方法步骤。
所称处理器可以是中央处理单元(Central Processing Unit,CP U),还可以是其他通用处理器、数字信号处理器(Digital Signal Pr ocessor,DSP)、专用集成电路(Application Specific Integrated Circ uit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,F PGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,处理器是计算机装置的控制中心,利用各种接口和线路连接整个计算机装置的各个部分。
存储器可用于存储计算机程序和/或模块,处理器通过运行或执行存储在存储器内的计算机程序和/或模块,以及调用存储在存储器内的数据,实现计算机装置的各种功能。存储器可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(例如声音播放功能、图像播放功能等);存储数据区可存储根据手机的使用所创建的数据(例如音频数据、视频数据等)。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart M edia Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Fl ash Card)、至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、服务器或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机 可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、服务器和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (10)

  1. 一种YANG模型配置界面的自动化构建方法,其特征在于,包括以下步骤:
    SDN控制器根据预设的YANG模型与YAML格式之间的映射规则,将YANG模型转换为YAML格式的模型描述信息;
    SDN控制器响应来自控制程序的模型查询请求,将所述YAML格式的模型描述信息发送至所述控制程序;
    控制程序根据预设的规则解析YAML格式的模型描述信息,自动构建YANG模型配置界面。
  2. 如权利要求1所述的方法,其特征在于:
    SDN控制器根据预设的YANG模型与YAML格式之间的映射规则,将YANG模型转换为YAML格式的模型描述信息包括:
    基于YANG模型节点和YAML节点的内涵一致性,将具有相同含义的YANG模型节点对等地转换为YAML节点。
  3. 如权利要求2所述的方法,其特征在于:
    将YANG模型转换为YAML格式的模型描述信息,包括如下步骤:
    所述SDN控制器读取YANG文件,采用递归遍历的方式,识别YANG文件中的关键字;
    将YANG文件中的容器节点转化为YAML文件中的对象节点;
    将YANG文件中的列表节点转化为YAML文件中的数组节点;
    解析YANG文件中叶子节点的数据类型,并转化为YAML文件的相应数据类型。
  4. 如权利要求1所述的方法,其特征在于:
    控制程序根据预设的规则解析YAML格式的模型描述信息,自 动构建YANG模型配置界面,具体包括以下步骤:
    控制程序基于YAML节点、控制程序图形界面元素描述模型的一致性,将YAML节点对等地转换为控制程序图形界面;
    如果是对象节点,控制程序生成树状节点,该树状节点可展开,展开后的节点类型包括对象节点、数组节点、基本数据类型;
    如果是数组节点,控制程序生成树状节点,该树状节点可展开,并支持增删子节点,所有子节点具备相同数据结构,子节点为对象节点或者基本类型数据;
    如果是叶子节点,控制程序生成具备用户编辑功能的控件,包括:文本框、单选框、下拉框。
  5. 如权利要求1所述的方法,其特征在于:
    控制程序根据所述YANG模型配置界面上输入的数据生成配置信息,通过SDN控制器下发配置信息,包括以下步骤;
    对YANG模型配置界面上输入的数据进行校验;
    将通过校验的数据组装成YAML格式的配置信息,向SDN控制器的北向接口发送http请求,通过SDN控制器下发配置信息。
  6. 如权利要求5所述的方法,其特征在于:
    通过SDN控制器下发配置信息,包括以下步骤:
    控制程序向SDN控制器发送下发配置信息的请求;
    SDN控制器将控制程序发送的YAML格式的配置信息转化为XML格式,通过南向接口中的NETCONF通道,将XML格式的配置信息下发到对应的设备。
  7. 一种YANG模型配置界面的自动化构建系统,其特征在于:
    该系统包括SDN控制器和控制程序,其中,SDN控制器包括:
    YANG解析模块,用于:根据预设的YANG模型与YAML格式 之间的映射规则,将YANG模型转换为YAML格式的模型描述信息;
    北向接口,用于:响应来自控制程序的模型描述信息查询请求,将所述YAML格式的模型描述信息发送至所述控制程序;
    控制程序包括:
    界面构建模块,用于:根据预设的规则解析YAML格式的模型描述信息,自动构建YANG模型配置界面。
  8. 如权利要求7所述的系统,其特征在于:
    所述SDN控制器的YANG解析模块用于:
    基于YANG模型节点和YAML节点的内涵一致性,将具有相同含义的YANG模型节点对等地转换为YAML节点。
  9. 如权利要求7所述的系统,其特征在于:
    控制程序包括查询模块,其用于:以http请求方式,向SDN控制器发送查询YAML格式的模型描述信息的请求;
    SDN控制器的北向接口用于:接收控制程序的查询模块发来的请求,根据所述请求定位并读取YAML文件,将所述YAML文件封装成http协议格式的数据,并将http协议格式的数据返回给控制程序的查询模块。
  10. 如权利要求9所述的系统,其特征在于:
    SDN控制器还包括:
    YAML转XML模块,用于:将控制程序的配置下发子模块发送的YAML格式的配置信息转化为XML格式;
    南向接口,用于:通过NETCONF通道,将XML格式的配置信息下发到对应的设备。
PCT/CN2019/096669 2019-03-29 2019-07-19 Yang模型配置界面的自动化构建方法及系统 Ceased WO2020199423A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910252147.2A CN110007924A (zh) 2019-03-29 2019-03-29 Yang模型配置界面的自动化构建方法及系统
CN201910252147.2 2019-03-29

Publications (1)

Publication Number Publication Date
WO2020199423A1 true WO2020199423A1 (zh) 2020-10-08

Family

ID=67168966

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/096669 Ceased WO2020199423A1 (zh) 2019-03-29 2019-07-19 Yang模型配置界面的自动化构建方法及系统

Country Status (2)

Country Link
CN (1) CN110007924A (zh)
WO (1) WO2020199423A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117411782A (zh) * 2022-07-08 2024-01-16 中国移动通信集团设计院有限公司 基于Yang模型的网络设备配置方法、装置

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110007924A (zh) * 2019-03-29 2019-07-12 烽火通信科技股份有限公司 Yang模型配置界面的自动化构建方法及系统
CN112865999B (zh) * 2019-11-28 2022-08-09 华为技术有限公司 信息处理方法及相关设备
CN111124548B (zh) * 2019-12-31 2023-10-27 科大国创软件股份有限公司 一种基于yaml文件的规则解析方法及系统
CN111625226B (zh) * 2020-05-29 2023-05-16 北京无线电测量研究所 一种基于原型的人机交互设计实现方法及系统
CN112069788B (zh) * 2020-09-10 2024-11-22 杭州安恒信息技术股份有限公司 一种yaml文件解析方法、装置、设备及存储介质
CN113300888B (zh) * 2021-05-21 2022-07-22 刘超 一种yang模型浏览器及客户端设备
CN114167805A (zh) * 2021-11-23 2022-03-11 长园运泰利视觉科技(珠海)有限公司 一种可编程的plc监控系统
CN114968360B (zh) * 2022-06-02 2026-02-03 杭州东方通信软件技术有限公司 一种基于api控制器的指令下发方法
CN116582446B (zh) * 2023-06-08 2025-08-12 中国联合网络通信集团有限公司 Sdn的模型映射方法、装置、设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103281197A (zh) * 2013-04-08 2013-09-04 浙江工商大学 一种基于NETCONF的ForCES配置方法
US20150347620A1 (en) * 2014-05-30 2015-12-03 International Business Machines Corporation Generating a mapping rule for converting relational data into rdf format data
CN106559251A (zh) * 2015-09-30 2017-04-05 中兴通讯股份有限公司 一种基于yang模型的编译方法、及对应的接口、组件和系统
CN108055143A (zh) * 2017-09-30 2018-05-18 广州西麦科技股份有限公司 一种SDN-Hub的配置方法和系统
CN109246161A (zh) * 2017-07-10 2019-01-18 中国电信股份有限公司 控制器的调度方法、装置和计算机可读存储介质
CN110007924A (zh) * 2019-03-29 2019-07-12 烽火通信科技股份有限公司 Yang模型配置界面的自动化构建方法及系统

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9436443B2 (en) * 2014-08-28 2016-09-06 At&T Intellectual Property I, L.P. Software defined network controller
CN106789225A (zh) * 2016-12-13 2017-05-31 广州唯品会信息科技有限公司 一种界面操作端口映射配置的方法及装置
CN108334387B (zh) * 2017-01-20 2021-03-16 阿里巴巴集团控股有限公司 动态界面渲染方法及装置
WO2018169294A1 (ko) * 2017-03-13 2018-09-20 성균관대학교 산학협력단 I2nsf 네트워크 보안 능력에 직면한 인터페이스 yang 데이터 모델
CN107315768A (zh) * 2017-05-17 2017-11-03 上海交通大学 基于异构信息模型映射的配网信息交互方法及系统
CN108920376A (zh) * 2018-07-13 2018-11-30 北京京东金融科技控股有限公司 应用程序的测试方法、装置及介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103281197A (zh) * 2013-04-08 2013-09-04 浙江工商大学 一种基于NETCONF的ForCES配置方法
US20150347620A1 (en) * 2014-05-30 2015-12-03 International Business Machines Corporation Generating a mapping rule for converting relational data into rdf format data
CN106559251A (zh) * 2015-09-30 2017-04-05 中兴通讯股份有限公司 一种基于yang模型的编译方法、及对应的接口、组件和系统
CN109246161A (zh) * 2017-07-10 2019-01-18 中国电信股份有限公司 控制器的调度方法、装置和计算机可读存储介质
CN108055143A (zh) * 2017-09-30 2018-05-18 广州西麦科技股份有限公司 一种SDN-Hub的配置方法和系统
CN110007924A (zh) * 2019-03-29 2019-07-12 烽火通信科技股份有限公司 Yang模型配置界面的自动化构建方法及系统

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117411782A (zh) * 2022-07-08 2024-01-16 中国移动通信集团设计院有限公司 基于Yang模型的网络设备配置方法、装置

Also Published As

Publication number Publication date
CN110007924A (zh) 2019-07-12

Similar Documents

Publication Publication Date Title
WO2020199423A1 (zh) Yang模型配置界面的自动化构建方法及系统
CN111666526B (zh) 页面生成方法、装置、设备及存储介质
CN110889270B (zh) 一种表单页面文档生成方法、表单页面渲染方法及装置
CN106648662B (zh) 基于工程造价计算描述语言bcl的报表生成装置及生成方法
US20160092502A1 (en) Graphical modeling of database query statements
CN104020994B (zh) 基于流系统的流过程定义装置和流过程定义方法
CN110244941B (zh) 任务开发方法、装置、电子设备及计算机可读存储介质
CN106569801A (zh) 一种基于复杂参数的组态化显控系统
KR20090013243A (ko) 워드 프로세서 문서의 원시 xml에서 비원시 xml을 지원하는 시스템 및 방법
CN106293664A (zh) 代码生成方法及装置
CN112988752B (zh) 资源管理方法、装置、存储介质及电子设备
JP6479184B2 (ja) コンピュータ実行可能なモデルリバースエンジニアリング方法及び装置
CN113986241B (zh) 一种基于知识图谱的业务规则的配置方法以及装置
CN103902269B (zh) 一种通过xml文件生成mib文件的系统及方法
CN111158687B (zh) Java插件的界面生成方法、装置、计算机设备和存储介质
CN108664546B (zh) Xml数据结构转换方法和装置
CN111782675B (zh) 生成数据库脚本的方法、装置及计算机可读存储介质
CN116204168A (zh) 一种低代码应用快速构建方法
CN114625349A (zh) 前端页面生成方法、装置、终端设备及存储介质
CN115794063A (zh) 三维模型的处理方法、装置和电子设备
CN104267966A (zh) 软件的程序代码的生成方法及装置
CN106681727A (zh) Modelica外部函数图形化编辑系统及其实现方法
CN114721713A (zh) 基于注解的数据处理方法、计算机设备以及可读存储介质
CN105278928A (zh) Ivr对外接口配置方法及装置
CN115934064A (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: 19923042

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19923042

Country of ref document: EP

Kind code of ref document: A1