WO2022253047A1 - 基于网络配置协议的查询信息的方法和装置 - Google Patents

基于网络配置协议的查询信息的方法和装置 Download PDF

Info

Publication number
WO2022253047A1
WO2022253047A1 PCT/CN2022/094685 CN2022094685W WO2022253047A1 WO 2022253047 A1 WO2022253047 A1 WO 2022253047A1 CN 2022094685 W CN2022094685 W CN 2022094685W WO 2022253047 A1 WO2022253047 A1 WO 2022253047A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
query
value
query result
content matching
Prior art date
Application number
PCT/CN2022/094685
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 华为技术有限公司
Publication of WO2022253047A1 publication Critical patent/WO2022253047A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9532Query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • 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/02Standardisation; Integration
    • H04L41/0213Standardised network management protocols, e.g. simple network management protocol [SNMP]

Definitions

  • the present application relates to the field of information infrastructure, and more specifically, to a method and device for querying information based on a network configuration protocol.
  • the Network Configuration Protocol is a network management protocol based on Extensible Markup Language (XML), which provides a programmable method for configuring and managing network devices. Users can set parameters, obtain parameter values, obtain statistical information, etc. through this protocol.
  • Network management devices can query device configuration data and status data through some query operations provided by the NETCONF protocol, so as to achieve the purpose of monitoring device data and managing devices. The network management device sends a query message to the device, and the device receives the query message, and filters the service data according to the query condition to obtain the query data. And feed back the query result to the network management device.
  • multi-subtree association filtering queries require tedious query interaction.
  • the embodiments of the present application provide a method and a related device for querying information based on NETCONF, which can reduce the number of query messages.
  • the embodiment of the present application provides a method for querying information based on NETCONF, the method includes:
  • the network device receives a query message from the query device, the query message includes a first selection node, a second selection node, and a first content matching node, and the value of the attribute included in the first content matching node is the value of the first selection node
  • the relative path the network device determines the query feedback according to the query message, and sends the query feedback to the query device, the query feedback includes the first query result and the second query result, and the first query result includes the first query result
  • the value of the selected node, the second query result includes the value of the second selected node.
  • the value of the first selection node also needs to be obtained through query.
  • the user can only construct a query message based on the known relative path of the value of the first selected node without knowing the value of the first selected node. Therefore, the above technical solution can use one query message to obtain the final query result. Therefore, using the above technical solution can effectively reduce the number of query messages and improve query efficiency.
  • the value of the second selected node is determined according to the value of the first selected node.
  • the attribute name of the first content matching node is a predefined comment
  • the data type of the comment is a character string
  • the second query result further includes a value corresponding to the first selected node.
  • the query feedback further includes a third query result, where the third query result includes values of sibling nodes corresponding to the second selected node and values of sibling nodes corresponding to the first selected node. The value of the sibling node.
  • the query message further includes a target content matching node, the value of the target content matching node is the target identifier to be queried, and the value of the first selected node is the same as the target content to be queried corresponding to the target ID.
  • the query feedback further includes a third query result, where the third query result includes a value of a sibling node corresponding to the second selected node.
  • an embodiment of the present application provides a network device, where the network device includes a unit for implementing the first aspect or any possible implementation manner of the first aspect.
  • an embodiment of the present application provides a network device, the network device includes a processor, the processor is configured to be coupled with a memory, and read and execute instructions and/or program codes in the memory to perform the first aspect or Any possible implementation of the first aspect.
  • an embodiment of the present application provides a chip system, the chip system includes a logic circuit, the logic circuit is used to couple with an input/output interface, and transmit data through the input/output interface to perform the first aspect or the first Any possible implementation of the aspect.
  • the embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores program codes, and when the computer storage medium is run on a computer, the computer executes the first aspect or the first aspect. any possible implementation of .
  • an embodiment of the present application provides a computer program product, the computer program product comprising: computer program code, when the computer program code is run on a computer, the computer is made to execute any of the first aspect or the first aspect.
  • a computer program product comprising: computer program code, when the computer program code is run on a computer, the computer is made to execute any of the first aspect or the first aspect.
  • FIG. 1 is a schematic tree structure diagram corresponding to Example 1 and Example 2.
  • Figure 2 is a schematic diagram of three trees.
  • Fig. 3 is a schematic flowchart of a method for querying information based on NETCONF according to an embodiment of the present application.
  • Fig. 4 is a structural diagram of a network device provided according to an embodiment of the present application.
  • At least one means one or more, and “multiple” means two or more.
  • “And/or” describes the association relationship of associated objects, indicating that there may be three types of relationships, for example, A and/or B, which can mean: A exists alone, A and B exist simultaneously, and B exists alone, where A, B can be singular or plural.
  • the character “/” generally indicates that the contextual objects are an “or” relationship.
  • “At least one of the following” or similar expressions refer to any combination of these items, including any combination of single or plural items.
  • At least one item (unit) of a, b or c can represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c can be single or multiple.
  • words such as “first” and “second” do not limit the quantity and execution order.
  • XML was designed to transmit and store data.
  • XML allows authors to define their own tags and their own document structure.
  • XML divides a document into parts and uses tags to identify these parts.
  • Each tag consists of an opening tag (such as ⁇ users>) and an ending tag (such as ⁇ /users>).
  • Each pair of tags and their content can be called an element.
  • Example 1 includes elements such as ⁇ top>, ⁇ users>, ⁇ user>, and ⁇ name>.
  • An element can have a value, for example, the value of ⁇ name> is Joey; it can also have sub-elements, for example, ⁇ user> has sub-elements ⁇ name>, ⁇ class> and ⁇ sex>; it can also have no value, such as ⁇ sex/>, This is called an empty element
  • Elements can also have attributes, which provide additional information about the element.
  • An attribute is a "name-value" pair, for example ⁇ class> has the attribute name and the attribute value is Harvards.
  • FIG. 1 is a schematic diagram of a tree structure corresponding to Example 1.
  • the tree structure shown in Figure 1 is a tree with a depth of 5.
  • the node ⁇ top> is the root node of Example 1, and its layer is 1.
  • the node ⁇ users> is a child node of the node ⁇ top>, and its level is 2.
  • the node ⁇ user> is a child node of the node ⁇ users>, and its level is 3.
  • the nodes ⁇ name>, ⁇ class> and ⁇ sex> are child nodes of the node ⁇ user>, and their level is 4.
  • Table 1 shows the remote procedure call (remote procedure call, PRC) and query scope supported by NETCONF.
  • filtering query can be divided into subtree filtering and XPath.
  • NETCONF uses this mechanism, which can adopt a simple and unified strategy to achieve selection without paying attention to the specific definition of the data model.
  • Each node specified in the subtree filter represents a filter.
  • the filter only selects the associated nodes in the basic data model of the specified database on the NETCONF server, and the nodes will be selected if they match the filtering rules and hierarchy.
  • the subtree filter components are shown in Table 2.
  • the content matching node and selection node are introduced below.
  • a leaf node containing simple content is called a "content matching node”. It is used to select some or all sibling nodes for filtered output, and it represents an exact match on the element content of a leaf node.
  • both ⁇ top> and ⁇ users> are containers; ⁇ user> is a list node (list); ⁇ name>, ⁇ class> and ⁇ sex> nodes are all leaf nodes (leaf), ⁇ name> and ⁇ class> are content matching nodes.
  • ⁇ name>, ⁇ class> and ⁇ sex> nodes are all leaf nodes (leaf)
  • ⁇ name> and ⁇ class> are content matching nodes.
  • empty leaf nodes can be declared with empty tags (eg, ⁇ foo/> ) or expressions with explicit start and end tags (eg, ⁇ foo> ⁇ /foo> ). Any whitespace characters in this form are ignored.
  • Example 2 the ⁇ top> node is the container node, ⁇ users> is the selection node, and only the "users" node conforms to the namespace "http://example.com/schema/1.2/config" and serves as the configuration database root directory The content that appears in the ⁇ top> element will be included in the filter and output.
  • Each node in the query message is a hierarchical tree relationship.
  • example 3 and example 7 are three query messages.
  • Example 4 is the query result of Example 3
  • Example 6 is the query result of Example 5
  • Example 8 is the query result of Example 7.
  • Example 3 is the query report for the value of the element out-if-name in the database named running of the yang model named ds in the namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-nmda" arts.
  • Example 3 if you need to query the value of the element out-if-name, you need to know the value of the element name and the namespace of the element all-sessions.
  • Example 5 is a query message to query the value of the element vrf-name in the database named running of the yang model named ds in the namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-nmda".
  • Example 5 As shown in Example 5, if you need to query the value of the element vrf-name, you need to know the value of the element name and the namespace of the element interfaces. The value of the element name in Example 5 is queried through the query message in Example 3.
  • Example 7 is a query message for querying the value of the element vrf_1 in the database named running of the yang model named ds in the namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-nmda".
  • Example 7 if you need to query the value of the element vrf_1, you need to know the value of the element name and the namespace of the element network-instance. The value of the element name in Example 7 is queried through the query message in Example 5.
  • Example 5 is a query message to query the value of the element vrf-name in the database named running of the yang model named ds in the namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-nmda".
  • Figure 2 shows a schematic diagram of three trees.
  • the tree 210 shown in FIG. 2 is the tree corresponding to the query message in Example 3, the tree 220 is the tree corresponding to the query message in Example 5, and the tree 230 is the tree corresponding to the query message in Example 7.
  • Tree 210 is a tree of depth three. As shown in FIG. 2 , the root node of the tree 210 is the node all-sessions, the node all-session is a child node of the node all-sessions, the node name and the node out-if-name are child nodes of the node all-session.
  • Tree 220 is also a tree of depth three. As shown in FIG. 2 , the root node of the tree 220 is the node interfaces, the node interface is a child node of the node interfaces, and the node name and the node vrf-name are child nodes of the node interface.
  • Tree 230 is a tree of depth four. As shown in Figure 2, the root node of the tree 230 is the node network-instance, the node instances is the child node of the node network-instance, the node instance is the child node of the node instances, the node name and the node sys-router-id are the nodes of the node instance child nodes.
  • a container node (container) or a list (list) node in a tree can be a subtree.
  • all-session in the tree 210 is a list node. All-session and all-session child nodes form a subtree 211 .
  • interface in tree 220 is a list node. The sub-nodes of the interface and the interface form the subtree 221.
  • instance in tree 230 is a list node. instance and its child nodes form a subtree 231 .
  • the query message corresponding to each subtree needs to be based on the query result of another subtree. Specifically, if you want to query the value of the element sys-router-id, you need to know the value of the element vrf-name; if you want to query the value of the element vrf-name, you need to know the value of the element out-if-name . Therefore, subtree 211 , subtree 221 and subtree 231 shown in FIG. 2 are interrelated.
  • a query that involves multiple interrelated subtrees and a query value ultimately has a definite query result (for example, the query value session_1 has a final query result of 10.0.0.1) can be called a multi-subtree association filtering query.
  • a list node defines a sequence of list entries, each entry is like a structure or a record instance, and is uniquely identified by the value of its key leaf node.
  • a list node can define multiple key leaf nodes, and may also contain a series of child nodes of any data type (including leaf nodes, list nodes, container nodes, etc.). In short, a list node has no value, contains related child nodes, has multiple instances, and has a key attribute (key) value.
  • ⁇ user> in Example 9 is a list node, which includes multiple instances, and each user is distinguished by ⁇ name>.
  • ⁇ name> is the key value of the list node.
  • multiple query messages need to be constructed. For example, in the example in Figure 2, three query packets need to be constructed to obtain the value of the element sys-router-id.
  • the embodiment of the present application provides a method for querying information, which can obtain the value of each element in multiple subtree association scenarios by constructing only one query message.
  • a dependent node also called a dependent element
  • a dependent node also called a dependent node
  • a dependent node also called a dependent node
  • the node vrf-name is the dependent node
  • the node sys-router-id is the dependent node.
  • you want to query the value of the node vrf-name you need to know the value of the node out-if-name.
  • the node out-if-name is the dependent node
  • the node vrf-name is the dependent node.
  • a dependent node corresponds to a dependent node. Still taking Fig. 2 as an example, the dependent node corresponding to the dependent node vrf-name is the node sys-router-id; the dependent node corresponding to the dependent node out-if-name is the node vrf-name.
  • the K trees can be called the first subtree, the second subtree, ..., the Kth subtree respectively, and K is a positive integer greater than or equal to 2.
  • a certain node in the kth subtree of the K subtrees is a dependent node of a certain node in the k+1th subtree, and k is a positive integer greater than or equal to 1 and less than or equal to K-1.
  • the node out-if-name in the subtree 211 in Fig. 2 is the dependent node of the node vrf-name in the subtree 221; the node vrf-name in the subtree 221 is the node in the subtree 231
  • the dependent node of the node sys-router-id. therefore.
  • K is equal to 3
  • subtree 211 may be called a first subtree
  • subtree 221 may be called a second subtree
  • subtree 231 may be called a third subtree.
  • the query message may include the relative path of the dependent node without including the value of the dependent node.
  • the query message may include K parts, the K parts correspond to the K subtrees one by one, and the mth part of the K parts includes a relative path of a dependent node, m is a positive integer greater than or equal to 2 and less than or equal to K.
  • the dependent node included in the mth part may be referred to as the dependent node m.
  • the mth part includes dependent nodes corresponding to dependent node m.
  • the dependent node m is an element in the m-1th part of the Kth part, which is a selection node.
  • the query message for querying the three subtrees may include three parts, wherein the second part includes the relative path of the value of the node out-if-name, and the third part includes the relative path of the value of the node vrf-name.
  • Value-relative paths for nodes can be implemented by introducing an annotation.
  • This annotation can add an attribute to the content matching node.
  • This attribute is used to carry the reference matching relationship of the nodes in the subtree filtering query.
  • the attribute value of this attribute represents a relative path to the value of a dependent node.
  • the value of the dependent node can be queried based on the attribute value of the attribute, and the value of the corresponding dependent node can be queried according to the value of the dependent node.
  • Example 10 is an example of that annotation.
  • Example 11 is an example of a query message used to query the three subtrees shown in FIG. 2 according to an embodiment of the present application.
  • the query operation ⁇ get-data> is taken as an example to describe the multi-subtree association filtering query as an example.
  • This application can also be applied to query operation ⁇ get> or query operation ⁇ get-config>.
  • Example 11 the first part of Example 11 includes:
  • the second part of Example 11 includes:
  • the third part of Example 11 includes:
  • Example 11 corresponds to the tree 210 in FIG. 2
  • the second part corresponds to the tree 220 in FIG. 2
  • the third part corresponds to the tree 230 in FIG. 2 .
  • the first part of Example 11 includes the node all-sessions namespace.
  • the second part of Example 11 includes the namespace of the node interfaces and the relative path of the value of the node out-if-name.
  • the node out-if-name is the dependent node of the node vrf-name.
  • the third part of Example 11 includes the namespace of the node network-instance and the relative path to the value of the node vrf-name.
  • the node vrf-name is the dependent node of the node sys-router-id.
  • Example 11 is the name space that defines the annotation path-ref.
  • Example 11 is the value of the node out-if-name relative path.
  • Example 11 is the relative path of the value of node vrf-name.
  • Example 11 includes three selection nodes and three content matching nodes.
  • the three selection nodes in Example 11 are: node ⁇ out-if-name/>, node ⁇ vrf-name/> and node ⁇ sys-router-id/>. For ease of description, these three selection nodes may be referred to as selection node 1, selection node 2, and selection node 3, respectively.
  • these three content matching nodes may be referred to as content matching node 1, content matching node 2, and content matching node 3, respectively.
  • Example 12 is the query result in response to Example 11.
  • Example 12 can also be divided into three parts,
  • the first part of Example 12 includes:
  • the second part of Example 12 includes:
  • the third part of Example 12 includes:
  • the first part of Example 12 includes the query result of the first part of Example 11, that is, selects the value eth1/1 of node 1; the second part of Example 12 includes the query result of the second part of Example 11, that is, selects the value vrf_1 of node 2; The third part of Example 12 includes the query result of the third part of Example 11, that is, the value 10.0.0.1 of node 3 is selected.
  • the second part of Example 12 also includes selecting the value of node 1; the third part of Example 12 also includes selecting the value of node 2.
  • Example 13 is an example of query packets used to query the three trees shown in FIG. 2 according to the embodiment of the present application.
  • Example 13 includes:
  • the second part of Example 13 includes:
  • the third part of Example 13 includes:
  • Example 13 corresponds to the tree 210 in FIG. 2
  • the second part corresponds to the tree 220 in FIG. 2
  • the third part corresponds to the tree 230 in FIG. 2 .
  • the first part of Example 13 includes the node all-sessions namespace.
  • the second part of Example 13 includes the namespace of the node interfaces and the value-relative path of the node out-if-name.
  • the node out-if-name is the dependent node of the node vrf-name.
  • the third part of Example 13 includes the namespace of the node network-instance and the relative path to the value of the node vrf-name.
  • the node vrf-name is the dependent node of the node sys-router-id.
  • xmlns:nc-ext urn:huawei:yang:huawei-ietf-netconf-ext" in Example 13 is the name space that defines the annotation path-ref.
  • Example 13 is the value of the node out-if-name relative path.
  • Example 13 is the relative path of the value of node vrf-name.
  • Example 13 includes three selection nodes and two content matching nodes.
  • the three selection nodes in Example 13 are: node ⁇ out-if-name/>, node ⁇ vrf-name/> and node ⁇ sys-router-id/>. For ease of description, these three selection nodes may be referred to as selection node 4, selection node 5, and selection node 6, respectively.
  • these two content matching nodes can be collectively referred to as content matching node 4 and content matching node 5 .
  • Example 14 is the query result in response to Example 13.
  • Example 14 can also be divided into three parts, the first part of Example 14 includes:
  • the second part of Example 14 includes:
  • the third part of Example 14 includes:
  • the first part of Example 14 includes the query results of the first part of Example 13, which selects the values eth1/1 and eth2/2 of node 4; the second part of Example 14 contains the query results of the second part of Example 13, which selects node 2 The values of vrf_1 and vrf_2; the third part of Example 14 includes the query results of the third part of Example 13, that is, the values 10.0.0.1 and 10.0.0.2 of the selected node 3.
  • Example 14 also includes target identifiers corresponding to the two values of selection node 4, session_1 and session_2, respectively.
  • the second part of example 14 also includes selecting the value of node 1, where eth1/1 corresponds to vrf_1 and eth2/2 corresponds to vrf_2; the third part of example 14 also includes selecting the value of node 2, where 10.0.0.1 corresponds to vrf_1 , 10.0.0.2 corresponds to vrf_2.
  • the node sys-router-id in the three subtrees shown in FIG. 2 does not have a corresponding dependent node. In other words, no other node's value needs to depend on the node's sys-router-id value.
  • a node without dependent nodes such as sys-router-id can be called the bottom-level node.
  • Example 11 and Example 13 both need to query the value of the bottom node, therefore, both query messages need to include the bottom node.
  • the embodiment of the present application may also be applied to a situation where the lowest-level node does not need to be queried. For example, only the value of the node vrf-name needs to be queried.
  • Example 15 is an example where only the value of the node vrf-name needs to be queried, and Example 16 is the query feedback corresponding to Example 15.
  • Example 15 includes:
  • the second part of Example 15 includes:
  • Example 15 only includes two parts, the first part of Example 15 is the same as the first part of Example 11; the second part of Example 15 is also the same as the second part of Example 11.
  • Example 15 includes two selection nodes and two content matching nodes.
  • the three selection nodes in Example 15 are: node ⁇ out-if-name/> and node ⁇ vrf-name/>. For ease of description, these three selection nodes may be referred to as selection node 7 and selection node 8 respectively.
  • these two content matching nodes may be referred to as content matching node 6 and content matching node 7 respectively.
  • Example 16 can also be divided into two parts, the first part of Example 16 includes:
  • the second part of Example 16 includes:
  • Example 16 is the same as the first part of Example 12, and the second part of Example 16 is the same as the second part of Example 12.
  • the first part of Example 16 includes the query result of the first part of Example 15, that is, the value eth1/1 of the selected node 7; the second part of Example 16 includes the query result of the second part of Example 15, that is, the value vrf_1 of the selected node 8.
  • Example 12 also includes selecting the value of node 7.
  • the sibling node of the selected node is also a key attribute (key).
  • Each list has a key value, which is used to distinguish it from other lists.
  • ⁇ name> of ⁇ all-session> is the key value
  • ⁇ name> of ⁇ interface> is the key value
  • ⁇ name> of ⁇ instance> is also the key value.
  • the previous query result (the value of the sibling node, such as out-if-name) is the key value of the next query node (such as: ⁇ name> of ⁇ interface>).
  • the key value of the next list is directly set as the relative path of the previous query result, so that multiple nodes can be connected in series to realize the associated query. Therefore, using the above technical solution, in the scenario of multi-subtree association filtering query, only one query message is needed to obtain the final query result, while in the traditional query scheme, each subtree needs one query message. It can be seen that the above technical solution can effectively reduce the number of query messages and improve query efficiency. Moreover, the above technical solution does not need to parse relevant fields from the intermediate query results to construct a new query message during the query process.
  • the above technical solution can query the query results of a specified node (such as example 11), and can also query the query results of multiple nodes (such as example 13).
  • the query results of multiple nodes also include all intermediate related data. In this way, it is more convenient for the user to obtain the association relationship between the nodes.
  • Fig. 3 is a schematic flowchart of a method for querying information based on NETCONF according to an embodiment of the present application.
  • the network device receives a query message from the query device, the query message includes a first selected node, a second selected node, and a first content matching node, and the value of an attribute included in the first content matching node is the first selected node The relative path of the value.
  • the network device determines query feedback according to the query message, where the query feedback includes a first query result and a second query result, the first query result includes the value of the first selected node, and the second query result includes the first query result 2 Select the value of the node.
  • the network device sends the query feedback to the query device.
  • the query device may be a computer device, such as a desktop computer, a notebook computer, a tablet computer, and the like.
  • the network device may be a server, switch, or router.
  • Table 3 shows the first selection node, the first content matching node and the second selection node in Example 11, Example 13 and Example 15.
  • Example 11 select node 1 Content Match Node 2 select node 2
  • Example 13 select node 4 Content Match Node 4 select node 5
  • Example 15 select node 7 Content Match Node 7 select node 8
  • the first selected node in Example 11 is selected node 1; the second selected node in Example 11 is selected node 2.
  • the first content matching node in Example 11 is content matching node 2.
  • the value of the attribute of content matching node 2 is a relative path to the value of selection node 1.
  • Example 12 is the query feedback of Example 11.
  • Example 12 includes the first query result and the second query result.
  • the first query result includes the value eth1/1 of the first selected node (that is, selected node 1)
  • the second query result includes the second Select the value vrf_1 of the node.
  • Example 12 is divided into three parts, the first part of Example 12 includes the first query result, that is, the value eth1/1 of the first selection node; the second part of Example 12 includes the second query result, that is, the second selection Node's value vrf_1.
  • Example 14 is the query feedback of Example 13.
  • Example 14 includes the first query result and the second query result.
  • the first query result includes the values eth1/1 and eth2/2 of the first selected node (that is, selected node 4), and the second query
  • the result includes the values vrf_1 and vrf_2 of the second selected node (ie selected node 5).
  • Example 14 is divided into three parts, the first part in Example 4 includes the first query result, that is, the values eth1/1 and eth2/2 of the first selected node; the second part of Example 14 includes the second query result , that is, the values vrf_1 and vrf_2 of the second selection node.
  • Example 16 is the query feedback of Example 15.
  • Example 16 includes the first query result and the second query result.
  • the first query result includes the value eth1/1 of the first selected node (that is, the selected node 7), and the second query result includes the second Select the value vrf_1 of the node (ie select node 8).
  • the value of the second selected node is determined according to the value of the first selected node.
  • the value of node 2 is selected based on the value of node 1; the value of node 3 is selected based on the value of node 2; the value of node 5 is selected based on the value of node 4; node 6 is selected
  • the value of is determined according to the value of the selected node 5; the value of the selected node 8 is determined according to the value of the selected node 7.
  • the name path-ref of the attribute of the first content matching node is a comment whose data type is a string (string) defined in Example 10.
  • the second selection node may also include the value of the first selection node.
  • the second part of Example 12 also includes the value eth1/1 of the first choice node; the second part of Example 14 also includes the values eth1/1 and eth2/2 of the first choice node; the second part of Example 16 also includes The value eth1/1 of the first choice node.
  • the query feedback may further include a third query result, where the third query result includes a value of a sibling node corresponding to the second selected node and a value of a sibling node corresponding to the first selected node.
  • the third query result in Example 14 includes values session_1 and session_2 of sibling nodes corresponding to selected node 4, where session_1 corresponds to eth1/1, and session_2 corresponds to eth2/2.
  • the third query result in Example 14 also includes values eth1/1 and eth2/2 of sibling nodes corresponding to selected node 5, where eth1/1 corresponds to vrf_1, and eth2/2 corresponds to vrf_2.
  • the query message further includes a target content matching node, the value of the target content matching node is the target ID to be queried, and the value of the first selection node corresponds to the target ID to be queried.
  • content matching node 1 in Example 11 is the target content matching node
  • content matching node 6 in Example 15 is the target content matching node.
  • the third query result may also include values of sibling nodes corresponding to the first selected node.
  • the third query results in Example 12 and Example 16 include the sibling node value session_1 corresponding to the first selected node.
  • the query message may also include a second content matching node, and the second content matching node includes a relative path to the value of the second selection node whose attribute value is.
  • the content matching node 3 in Example 11 is the second content matching node, and the value of the attribute included in the content matching node 3 is a relative path to the value of the selection node 2 .
  • the content matching node 5 in Example 13 is the second content matching node, and the value of the attribute included in the content matching node 5 is a relative path to the value of the selection node 5 .
  • Example 15 there is only the second selection node, and the second content matching node is not included.
  • the query message may also include a third selection node.
  • selection node 3 in Example 11 and selection node 6 in Example 13 are third selection nodes.
  • the query feedback may also include the value of the third selection node.
  • the query feedback in example 12 includes the value 10.0.0.1 for node 3;
  • example 14 includes the values 10.0.0.1 and 10.0.0.2 for node 6, where 10.0.0.1 corresponds to vrf_1 and 10.0.0.2 corresponds to vrf_2.
  • the query message may include N+1 selected nodes and N content matching nodes in total, and the first N selected nodes among the N+1 selected nodes match the N content
  • the nodes correspond one to one, and N is a positive integer greater than or equal to 1.
  • the attribute value of each content matching node among the N content matching nodes is a relative path to the value of the corresponding selection node.
  • Example 11 the value of N is 2.
  • the N selection nodes in Example 11 are selection node 1 and selection node 2, wherein the content matching node corresponding to selection node 1 is content matching node 2, and the content matching node corresponding to selection node 2 is content matching node 3.
  • the selected node of "+1" in "N+1" in Example 11 is selected node 3.
  • Example 13 the value of N is 2.
  • the N selection nodes in Example 11 are selection node 4 and selection node 5 respectively, wherein the content matching node corresponding to selection node 4 is content matching node 4 , and the content matching node corresponding to selection node 5 is content matching node 5 .
  • the selected node of "+1" in "N+1" in Example 13 is selected node 6.
  • Example 15 the value of N is 1.
  • the N selection nodes in Example 15 are selection nodes 7, wherein the content matching node corresponding to selection node 1 is content matching node 6, and the selection node of "+1" in "N+1" in Example 15 is selection node 7.
  • the query feedback corresponding to the query message including N+1 selection nodes and N content matching nodes includes the value of each selection node in the N+1 selection nodes.
  • the technical solution of the present application can reduce the number of query messages and improve query efficiency.
  • Fig. 4 is a structural diagram of a network device provided according to an embodiment of the present application.
  • the network device 400 shown in FIG. 4 includes a receiving unit 401 , a processing unit 402 and a sending unit 403 .
  • the network device 400 shown in FIG. 4 may be a network device such as a server, a switch, or a router, or may be a component (such as a chip, etc.) of the above-mentioned network device.
  • the receiving unit 401 is configured to receive a query message from a query device, the query message includes a first selection node, a second selection node, and a first content matching node, and the value of an attribute included in the first content matching node is the first A relative path to the value of the selected node.
  • the processing unit 402 is configured to determine query feedback according to the query message, the query feedback includes a first query result and a second query result, the first query result includes the value of the first selected node, and the second query result includes The value of this second choice node.
  • the sending unit 403 is configured to send the query feedback to the query device.
  • the receiving unit 401 and the sending unit 403 may be implemented by a transceiver, and the processing unit 402 may be implemented by a processor.
  • the processing unit 402 may be implemented by a processor.
  • the network device 400 may also be a chip.
  • the network device may be a field programmable gate array (field programmable gate array, FPGA), an application specific integrated circuit (ASIC), or a system chip (system on chip, SoC). It can be a central processor unit (CPU), a network processor (network processor, NP), a digital signal processing circuit (digital signal processor, DSP), or a microcontroller (micro controller unit) , MCU), can also be a programmable controller (programmable logic device, PLD), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or other integrated chips.
  • programmable controller programmable logic device, PLD
  • the receiving unit 401 and the sending unit 403 may be input and output circuits or communication interfaces, and the processing unit 402 may be a processor or an integrated circuit integrated on the chip.
  • the embodiment of the present application also provides a network device, the network device includes a processor, the processor is used to be coupled with the memory, read and execute the instructions and/or program codes in the memory, so as to implement any one of the above embodiments The method described in the example.
  • the embodiment of the present application also provides a chip system, the chip system includes a logic circuit, the logic circuit is used to couple with the input/output interface, and transmit data through the input/output interface, so as to execute any one of the above-mentioned embodiments the method described.
  • each step of the above-mentioned method can be completed by an integrated logic circuit of hardware in a processor or an instruction or program code in the form of software.
  • the steps of the methods disclosed in connection with the embodiments of the present application may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware. To avoid repetition, no detailed description is given here.
  • the processor in the embodiment of the present application may be an integrated circuit chip, which has a signal processing capability.
  • each step of the above-mentioned method embodiments may be implemented by an integrated logic circuit of hardware in a processor or instructions or program codes in the form of software.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware.
  • the memory in the embodiments of the present application may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories.
  • the non-volatile memory can be read-only memory (read-only memory, ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically programmable Erases programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • Volatile memory can be random access memory (RAM), which acts as external cache memory.
  • RAM random access memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous dynamic random access memory
  • SDRAM double data rate synchronous dynamic random access memory
  • ESDRAM enhanced synchronous dynamic random access memory
  • SLDRAM direct memory bus random access memory
  • direct rambus RAM direct rambus RAM
  • the present application also provides a computer program product, the computer program product including: computer program code, when the computer program code is run on the computer, the computer is made to execute any one of the above-mentioned embodiments Example method.
  • the present application also provides a computer-readable medium, the computer-readable medium stores program codes, and when the program codes are run on a computer, the computer is made to execute any one of the above-mentioned embodiments. Example method.
  • the present application further provides a system, which includes the aforementioned electronic device and the query device.
  • the query device sends query messages to the electronic device, and receives query feedback from the electronic device.
  • the disclosed systems, devices and methods may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions or program codes are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例提供一种基于网络配置协议的查询信息的方法和装置。该方法中,网络设备从查询设备接收查询报文,所述查询报文包括第一选择节点、第二选择节点和第一内容匹配节点,所述第一内容匹配节点包括的属性的值为第一选择节点的值的相对路径;所述网络设备根据所述查询报文确定查询反馈,并将所述查询反馈发送给所述查询设备,所述查询反馈包括第一查询结果和第二查询结果,所述第一查询结果包括第一选择节点的值,所述第二查询结果包括第二选择节点的值。上述技术方案可以有效减少查询第二选择节点的值所需的查询报文数量。

Description

基于网络配置协议的查询信息的方法和装置
本申请要求于2021年06月01日提交中国专利局、申请号为202110610448.5、申请名称为“基于网络配置协议的查询信息的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及信息基础领域,更具体地,涉及一种基于网络配置协议的查询信息的方法和装置。
背景技术
网络配置协议(network configuration protocol,NETCONF)是一种基于可扩展标记语言(Extensible Markup Language,XML)的网络管理协议,它提供了一种可编程的、对网络设备进行配置和管理的方法。用户可以通过该协议设置参数、获取参数值、获取统计信息等。网管设备可以通过NETCONF协议所提供一些查询操作来查询设备配置数据和状态数据,从而达到监控设备数据和管理设备的目的。网管设备向设备发送查询报文,设备接收查询报文,并根据查询条件对业务数据进行过滤得到查询数据。并将此查询结果反馈给网管设备。但是,多子树关联过滤查询需要繁琐的查询交互。
发明内容
本申请实施例提供一种基于NETCONF的查询信息的方法和相关装置,可以减少查询报文的数量。
第一方面,本申请实施例提供一种基于NETCONF的查询信息的方法,该方法包括:
网络设备从查询设备接收查询报文,该查询报文包括第一选择节点、第二选择节点和第一内容匹配节点,该第一内容匹配节点包括的属性的值为该第一选择节点的值的相对路径;该网络设备根据该查询报文确定查询反馈,并将该查询反馈发送给该查询设备,该查询反馈包括第一查询结果和第二查询结果,该第一查询结果包括该第一选择节点的值,该第二查询结果包括该第二选择节点的值。
第一选择节点的值也需要通过查询得到。而上述技术方案中,用户可以只根据已知的第一选择节点的值的相对路径构造一条查询报文,而不需要知道第一选择节点的值。因此,上述技术方案可以使用一条查询报文得到最终的查询结果。因此,利用上述技术方案可以有效减少查询报文的数量,提高查询效率。
结合第一方面,在一种可能的实现方式,该第二选择节点的值是根据该第一选择节点的值确定的。
结合第一方面,在一种可能的实现方式,该第一内容匹配节点的属性的名字是预先定义的注释,该注释的数据类型为字符串。
结合第一方面,在一种可能的实现方式,该第二查询结果还包括对应于该第一选择节点的值。
结合第一方面,在一种可能的实现方式,该查询反馈还包括第三查询结果,该第三查询结果包括与该第二选择节点对应的兄弟节点的值和与该第一选择节点对应的兄弟节点的值。
结合第一方面,在一种可能的实现方式,该查询报文还包括目标内容匹配节点,所目标内容匹配节点的值为待查询的目标标识,该第一选择节点的值与该待查询的目标标识对应。
结合第一方面,在一种可能的实现方式,该查询反馈还包括第三查询结果,该第三查询结果包括与该第二选择节点对应的兄弟节点的值。
第二方面,本申请实施例提供一种网络设备,该网络设备包括用于实现第一方面或第一方面的任一种可能的实现方式的单元。
第三方面,本申请实施例提供一种网络设备,该网络设备包括处理器,该处理器用于与存储器耦合,读取并执行该存储器中的指令和/或程序代码,以执行第一方面或第一方面的任一种可能的实现方式。
第四方面,本申请实施例提供一种芯片系统,该芯片系统包括逻辑电路,该逻辑电路用于与输入/输出接口耦合,通过该输入/输出接口传输数据,以执行第一方面或第一方面任一种可能的实现方式。
第五方面,本申请实施例提供一种计算机可读存储介质,该计算机可读存储介质存储有程序代码,当该计算机存储介质在计算机上运行时,使得计算机执行如第一方面或第一方面的任一种可能的实现方式。
第六方面,本申请实施例提供一种计算机程序产品,该计算机程序产品包括:计算机程序代码,当该计算机程序代码在计算机上运行时,使得该计算机执行如第一方面或第一方面的任一种可能的实现方式。
附图说明
图1是对应于示例1和示例2的树结构示意图。
图2是三个树的示意图。
图3是根据本申请实施例提供的一种基于NETCONF的查询信息的方法的示意性流程图。
图4是根据本申请实施例提供的一种网络设备的结构图。
具体实施方式
下面将结合附图,对本申请中的技术方案进行描述。
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下中的至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如, a,b或c中的至少一项(个),可以表示:a、b、c、a-b、a-c、b-c、或a-b-c,其中a、b、c可以是单个,也可以是多个。另外,在本申请的实施例中,“第一”、“第二”等字样并不对数量和执行次序进行限定。
需要说明的是,本申请中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
为了便于更好地理解本申请的技术方案,首先对本申请涉及到的一些概念进行简单介绍。
1,XML
XML被设计用来传输和存储数据。XML允许创作者定义自己的标签和自己的文档结构。XML将文档分成许多部件并用标记对这些部件加以标识。
示例1
Figure PCTCN2022094685-appb-000001
每一个标记由起始标记(如<users>)和结束标记(如</users>)组成。每一对标记及其内容可以称为一个元素(element)。示例1中包括元素<top>、<users>、<user>、<name>等元素。元素可以拥有值,例如<name>的值是Joey;也可以拥有子元素,例如<user>拥有子元素<name>、<class>和<sex>;也可以没有值,如<sex/>,这种情况称为空元素元素还可以拥有属性(attribute),属性提供关于元素的额外附加信息。属性是一个“名字-值”对,例如<class>拥有属性name,属性值是Harvards。
XML中元素的层次嵌套关系经常表达为一个树型结构。因此,元素也被称为节点。
图1是对应于示例1的树型结构示意图。
如图1所示的树型结构是一个深度为5的树。如图1所示,节点<top>是示例1的根节点,其所在的层为1。节点<users>是节点<top>的子节点,其所在的层为2。节点<user>是节点<users>的子节点,其所在的层为3。节点<name>、<class>和<sex>是节点<user>的子节点,其所在的层为4。
2,查询操作
表1示出了NETCONF支持查询的远程过程调用(remote procedure call,PRC)和查询范围。
表1
Figure PCTCN2022094685-appb-000002
上述三个查询操作都支持过滤查询,根据过滤器<filter>类型的取值不同,过滤查询可以分为子树过滤(subtree filtering)和XPath。
3,子树过滤
子树过滤有包含、精确匹配和选择三种过滤方式。NETCONF使用这种机制,可以采用简单、统一的策略实现选择,而不需要关注数据模型具体定义。
子树过滤中指定的每一个节点表示一个过滤器。过滤器只选择NETCONF服务器上指定数据库基础数据模型中有关联的节点,节点如果匹配到了过滤规则和层次结构就会被选中。子树过滤器组成部分如表2所示。
表2
Figure PCTCN2022094685-appb-000003
下面对内容匹配节点和选择节点进行介绍。
内容匹配节点:
一个包含简单内容的叶子节点被称为“内容匹配节点”。它用于选择部分或所有兄弟节点用于过滤后的输出,并且它表示叶子节点元素内容上的精确匹配。
在示例1中,<top>和<users>都是容器(container);<user>是列表节点(list);<name>、<class>和<sex>节点都是叶子节点(leaf),<name>和<class>是内容匹配节点。符合“http://example.com/schema/1.2/config”名字空间,并且元素层次结构能够匹配<name>且 值等于“Joey”,元素层次结构能够匹配<class>且值等于“college”的<sex>节点才会包含在过滤器输出中。
选择节点:
代表一个“显式选择”过滤器的基础数据模型。一组同级兄弟节点内若出现任何选择节点,将使得过滤器选择指定的子树,并且抑制基础数据模型中的整个兄弟节点集合的自动选择。过滤的表达方式,可以用空标签(例如,<foo/>)或具有显式开始和结束标签的表达(例如,<foo></foo>)来声明空叶节点。这种形式下任何空白字符都将被忽略。
示例2,
Figure PCTCN2022094685-appb-000004
在示例2中,<top>节点为容器节点,<users>为选择节点,只有“users”节点符合名字空间“http://example.com/schema/1.2/config”,并且作为配置数据库根目录的<top>元素中出现的内容,才会包含在过滤器中被输出。
4,多子树关联过滤查询
查询报文中的各个节点都是层次的树状关系。
例如,示例3,示例5和示例7是三个查询报文。示例4是示例3的查询结果,示例6是示例5的查询结果,示例8是示例7的查询结果。
示例3,
Figure PCTCN2022094685-appb-000005
示例3是查询名字空间"urn:ietf:params:xml:ns:yang:ietf-netconf-nmda"中名为ds的yang模型名为running的数据库中元素out-if-name的取值的查询报文。
如示例3所示,如果需要查询元素out-if-name的值,需要知道元素name的值以及元素all-sessions的名字空间。
示例4,
Figure PCTCN2022094685-appb-000006
Figure PCTCN2022094685-appb-000007
示例5
Figure PCTCN2022094685-appb-000008
示例5是查询名字空间"urn:ietf:params:xml:ns:yang:ietf-netconf-nmda"中名为ds的yang模型名为running的数据库中元素vrf-name的取值的查询报文。
如示例5所示,如果需要查询元素vrf-name的值,需要知道元素name的值以及元素interfaces的名字空间。示例5中元素name的值是通过示例3的查询报文查询到的。
示例6,
Figure PCTCN2022094685-appb-000009
示例7
Figure PCTCN2022094685-appb-000010
Figure PCTCN2022094685-appb-000011
示例7是查询名字空间"urn:ietf:params:xml:ns:yang:ietf-netconf-nmda"中名为ds的yang模型名为running的数据库中元素vrf_1的取值的查询报文。
如示例7所示,如果需要查询元素vrf_1的值,需要知道元素name的值以及元素network-instance的名字空间。示例7中元素name的值是通过示例5的查询报文查询到的。
示例8
Figure PCTCN2022094685-appb-000012
示例5是查询名字空间"urn:ietf:params:xml:ns:yang:ietf-netconf-nmda"中名为ds的yang模型名为running的数据库中元素vrf-name的取值的查询报文。
图2示出了三个树的示意图。如图2所示的树210是对应于示例3的查询报文的树,树220是对应于示例5的查询报文的树,树230是对应于示例7的查询报文的树。
树210是一个深度为3的树。如图2所示,树210的根节点是节点all-sessions,节点all-session是节点all-sessions的子节点,节点name和节点out-if-name是节点all-session的子节点。
树220也是一个深度为3的树。如图2所示,树220的根节点是节点interfaces,节点interface是节点interfaces的子节点,节点name和节点vrf-name是节点interface的子节点。
树230是一个深度为4的树。如图2所示,树230的根节点是节点network-instance,节点instances是节点network-instance的子节点,节点instance是节点instances的子节点,节点name和节点sys-router-id是节点instance的子节点。
一个树中的一个容器节点(container)或者一个列表(list)节点都可以是一颗子树。
还以图2为例,树210中的all-session是一个列表节点。all-session以及all-session的子节点组成子树211。树220中的interface是一个列表节点。interface以及interface的子 节点组成子树221。树230中的instance是一个列表节点。instance以及instance的子节点组成子树231。
如示例3至示例8以及图2所示,除第一颗子树(即子树211)以外,每颗子树对应的查询报文都需要基于另一颗子树的查询结果。具体地,如果希望查询元素sys-router-id的取值,那么需要知道元素vrf-name的取值;如果希望查询元素vrf-name的取值,那么需要知道元素out-if-name的取值。因此,图2所示的子树211、子树221和子树231是相互关联的。涉及多个互相关联的子树,且一个查询值最终有一个确定的查询结果(例如查询值session_1的最终查询结果为10.0.0.1)的查询可以称为多子树关联过滤查询。
5,列表节点
列表节点定义了列表条目序列,每个条目就像一个结构体或者一个记录实例,并由其关键叶节点的值唯一识别。列表节点可定义多个关键叶节点,也可能一系列包含任意数据类型(包括叶节点、列表节点、容器节点等)的子节点。简述之,列表节点无值,包含相关子节点,多实例,有一个关键属性(key)值。
示例9,
Figure PCTCN2022094685-appb-000013
示例9中的<user>就是列表节点,该列表节点包括多实例,通过<name>来区分开各个用户。<name>是列表节点的key值。
对于多个子树关联的场景中要想得到最后的查询结果,需要构造多个查询报文。例如,图2示例中需要构造三次查询报文才能得到元素sys-router-id的取值。
本申请实施例提供一种查询信息的方法,可以仅构造一个查询报文,就能得到多个子树关联场景中每个元素的值。
为了便于更好地描述本申请实施例,首先定义两个概念:被依赖节点(也可以称为被依赖元素)和依赖节点(也可以称为依赖节点)。如果查询节点a的值需要依赖节点b的值,那么节点a可以称为依赖节点,节点b可以称为被依赖节点。
例如,在图2所示的例子中,如果希望查询节点sys-router-id的取值,那么需要知道节点vrf-name的取值。在此情况下,节点vrf-name就是被依赖节点,节点sys-router-id是 依赖节点。如果希望查询节点vrf-name的取值,那么需要知道节点out-if-name的取值。在此情况下,节点out-if-name是被依赖节点,节点vrf-name是依赖节点。
一个被依赖节点与一个依赖节点相对应。还以图2为例,与被依赖节点vrf-name对应的依赖节点是节点sys-router-id;与被依赖节点out-if-name对应的依赖节点是节点vrf-name。
假设K个子树关联,该K个树可以分别称为第一子树、第二子树、…、第K子树,K为大于或等于2的正整数。该K个子树中的第k子树中的某个节点是第k+1子树中的某个节点的被依赖节点,k为大于或等于1且小于或等于K-1的正整数。
以图2为例,图2中的子树211中的节点out-if-name是子树221中的节点vrf-name的被依赖节点;子树221中的节点vrf-name是子树231中的节点sys-router-id的被依赖节点。因此。在图2中,K等于3,且,子树211可以称为第一子树,子树221可以称为第二子树,子树231可以称为第三子树。
本申请实施例中,查询报文中可以包括被依赖节点的相对路径而无需包括被依赖节点的值。对于K个子树关联的场景中,查询报文可以包括K个部分,该K个部分与该K个子树一一对应,该K个部分中的第m个部分包括一个被依赖节点的相对路径,m是大于或等于2且小于或等于K的正整数。第m个部分包括的被依赖节点可以称为被依赖节点m。第m个部分包括与被依赖节点m对应的依赖节点。被依赖节点m是第K个部分中的第m-1个部分中的一个元素,该元素是一个选择节点。
还以图2所示的三个子树为例。用于查询这三个子树的查询报文可以包括三个部分,其中,第二部分包括节点out-if-name的值的相对路径,第三部分包括节点vrf-name的值的相对路径。
节点的值相对路径可以通过引入一个注释(annotation)实现。该注释可以为内容匹配节点增加一个属性。该属性用于承载子树过滤查询中节点的引用匹配关系。该属性的属性值表示一个被依赖节点的值的相对路径。当该属性存在时,可以基于该属性的属性值查询到被依赖节点的值,并根据被依赖节点的值查询对应的依赖节点的值。
示例10是该注释的一个示例。
示例10,
Figure PCTCN2022094685-appb-000014
示例11是根据本申请实施例提供的用于查询如图2所示的三个子树的查询报文的示例。本申请实施例中是以查询操作<get-data>为例对多子树关联过滤查询为例进行描述的。本申请也可以应用于查询操作<get>或者查询操作<get-config>。
示例11,
Figure PCTCN2022094685-appb-000015
Figure PCTCN2022094685-appb-000016
其中,示例11的第一个部分包括:
Figure PCTCN2022094685-appb-000017
示例11的第二个部分包括:
Figure PCTCN2022094685-appb-000018
Figure PCTCN2022094685-appb-000019
示例11的第三个部分包括:
Figure PCTCN2022094685-appb-000020
可见,示例11的第一个部分对应的是图2中的树210,第二个部分对应的是图2中的树220,第三个部分对应的是图2中的树230。
示例11的第一个部分包括节点all-sessions的名字空间。
示例11的第二个部分包括节点interfaces的名字空间以及节点out-if-name的值的相对路径。节点out-if-name是节点vrf-name的被依赖节点。
示例11的第三个部分包括节点network-instance的名字空间以及节点vrf-name的值的相对路径。节点vrf-name是节点sys-router-id的被依赖节点。
示例11中的xmlns:nc-ext="urn:huawei:yang:huawei-ietf-netconf-ext"是定义了注释path-ref的名字空间。
示例11中的"../huawei-bfd:bfd/huawei-bfd:all-sessions/awei-bfd:all-session/huawei-bfd:out-if-name"是节点out-if-name的值的相对路径。
示例11中的"../huawei-ifm:ifm/huawei-ifm:interfaces/huawei-ifm:interface/huawei-ifm:vrf-name"是节点vrf-name的值的相对路径。
元素out-if-name的值的相对路径和节点vrf-name的值的相对路径中的符号“..”表示的是上层目录。
示例11中共包括三个选择节点和三个内容匹配节点。
示例11中的三个选择节点分别为:节点<out-if-name/>,节点<vrf-name/>和节点<sys-router-id/>。为了便于描述,可以将这三个选择节点分别称为选择节点1、选择节点2和选择节点3。
示例11中的三个内容匹配节点分别为:节点<name>session_1</name>,节点<name nc-ext:path-ref="../huawei-bfd:bfd/huawei-bfd:all-sessions/huawei-bfd:all-session/huawei-bfd:out-if-name"></name>和节点<name nc-ext:path-ref="../huawei-ifm:ifm/huawei-ifm:interfaces/huawei-ifm:interface/huawei-ifm:vrf-name"></name>。为了便于描述,可以将这三个内容匹配节点分别称为内容匹配节点1、内容匹配节点2 和内容匹配节点3。
示例12是响应于示例11的查询结果。
示例12,
Figure PCTCN2022094685-appb-000021
示例12也可以分为三部分,
示例12的第一部分包括:
Figure PCTCN2022094685-appb-000022
示例12的第二部分包括:
Figure PCTCN2022094685-appb-000023
Figure PCTCN2022094685-appb-000024
示例12的第三部分包括:
Figure PCTCN2022094685-appb-000025
示例12的第一部分包括示例11的第一部分的查询结果,即选择节点1的值eth1/1;示例12的第二部分包括示例11的第二部分的查询结果,即选择节点2的值vrf_1;示例12的第三部分包括示例11的第三部分的查询结果,即选择节点3的值10.0.0.1。
此外,示例12的第二部分还包括选择节点1的值;示例12的第三部分还包括选择节点2的值。
示例13是根据本申请实施例提供的用于查询如图2所示的三个树的查询报文的示例。
示例13,
Figure PCTCN2022094685-appb-000026
Figure PCTCN2022094685-appb-000027
其中,示例13的第一个部分包括:
Figure PCTCN2022094685-appb-000028
示例13的第二个部分包括:
Figure PCTCN2022094685-appb-000029
示例13的第三个部分包括:
Figure PCTCN2022094685-appb-000030
可见,示例13的第一个部分对应的是图2中的树210,第二个部分对应的是图2中的树220,第三个部分对应的是图2中的树230。
示例13的第一个部分包括节点all-sessions的名字空间。
示例13的第二个部分包括节点interfaces的名字空间以及节点out-if-name的值相对路径。节点out-if-name是节点vrf-name的被依赖节点。
示例13的第三个部分包括节点network-instance的名字空间以及节点vrf-name的值的相对路径。节点vrf-name是节点sys-router-id的被依赖节点。
示例13中的xmlns:nc-ext="urn:huawei:yang:huawei-ietf-netconf-ext"是定义了注释 path-ref的名字空间。
示例13中的"../huawei-bfd:bfd/huawei-bfd:all-sessions/huawei-bfd:all-session/huawei-bfd:out-if-name"是节点out-if-name的值的相对路径。
示例13中的"../huawei-ifm:ifm/huawei-ifm:interfaces/huawei-ifm:interface/huawei-ifm:vrf-name"是节点vrf-name的值的相对路径。
节点out-if-name的值的相对路径和节点vrf-name的值的相对路径中的符号“..”表示的是上层目录。
示例13中共包括三个选择节点和两个内容匹配节点。
示例13中的三个选择节点分别为:节点<out-if-name/>,节点<vrf-name/>和节点<sys-router-id/>。为了便于描述,可以将这三个选择节点分别称为选择节点4、选择节点5和选择节点6。
示例13中的两个内容匹配节点分别为:<name nc-ext:path-ref="../huawei-bfd:bfd/huawei-bfd:all-sessions/huawei-bfd:all-session/huawei-bfd:out-if-name"></name>和节点<name nc-ext:path-ref="../huawei-ifm:ifm/huawei-ifm:interfaces/huawei-ifm:interface/huawei-ifm:vrf-name"></name>。为了便于描述,可以将这两个内容匹配节点封称为内容匹配节点4和内容匹配节点5。
示例14是响应于示例13的查询结果。
示例14,
Figure PCTCN2022094685-appb-000031
Figure PCTCN2022094685-appb-000032
示例14也可以分为三部分,示例14的第一部分包括:
Figure PCTCN2022094685-appb-000033
示例14的第二部分包括:
Figure PCTCN2022094685-appb-000034
示例14的第三部分包括:
Figure PCTCN2022094685-appb-000035
示例14的第一部分包括示例13的第一部分的查询结果,即选择节点4的值eth1/1和eth2/2;示例14的第二部分包括示例13的第二部分的查询结果,即选择节点2的值vrf_1和vrf_2;示例14的第三部分包括示例13的第三部分的查询结果,即选择节点3的值10.0.0.1和10.0.0.2。
此外,示例14的第一部分还包括分别对应于选择节点4的两个值的目标标识,session_1和session_2。示例14的第二部分还包括选择节点1的值,其中eth1/1对应于vrf_1,eth2/2对应于vrf_2;示例14的第三部分还包括选择节点2的值,其中10.0.0.1对应于vrf_1,10.0.0.2对应于vrf_2。
如图2所示的三个子树中的节点sys-router-id没有一个对应的依赖节点。换句话说,没有其他节点的值需要依赖于节点sys-router-id的值。为了便于描述,可以称sys-router-id这种没有依赖节点的节点为最底层节点。
在示例11和示例13所示的查询报文都需要查询最底层节点的值,因此,这两个查询报文都需要包括最底层节点。
在另一些实施例中,本申请实施例也可以应用到不需要查询最底层节点的情况。例如,只需要查询到节点vrf-name的取值。示例15是只需要查询到节点vrf-name的取值的示例,示例16是对应于示例15的查询反馈。
示例15,
Figure PCTCN2022094685-appb-000036
Figure PCTCN2022094685-appb-000037
其中,示例15的第一个部分包括:
Figure PCTCN2022094685-appb-000038
示例15的第二个部分包括:
Figure PCTCN2022094685-appb-000039
可见,示例15只包括两部分,示例15的第一个部分与示例11的第一个部分相同;示例15的第二个部分也与示例11的第二个部分相同。
示例15中共包括两个选择节点和两个内容匹配节点。
示例15中的三个选择节点分别为:节点<out-if-name/>和节点<vrf-name/>。为了便于描述,可以将这三个选择节点分别称为选择节点7和选择节点8。
示例15中的两个内容匹配节点分别为:节点<name>session_1</name>和节点<name nc-ext:path-ref="../huawei-bfd:bfd/huawei-bfd:all-sessions/huawei-bfd:all-session/huawei-bfd:out-if-name"></name>。为了便于描述,可以将这两个内容匹配节点分别称为内容匹配节点6和内容匹配节点7。
示例16,
Figure PCTCN2022094685-appb-000040
Figure PCTCN2022094685-appb-000041
示例16也可以分为两个部分,示例16的第一个部分包括:
Figure PCTCN2022094685-appb-000042
示例16的第二个部分包括:
Figure PCTCN2022094685-appb-000043
可见,示例16的第一个部分与示例12的第一个部分相同,示例16的第二个部分与示例12的第二个部分相同。
示例16的第一部分包括示例15的第一部分的查询结果,即选择节点7的值eth1/1;示例16的第二部分包括示例15的第二部分的查询结果,即选择节点8的值vrf_1。
此外,示例12的第二部分还包括选择节点7的值。
选择节点的兄弟节点也是关键属性(key)。每条list有一个key值,用来区分于其他list。在示例11中,<all-session>的<name>是key值,<interface>的<name>是key值,<instance>的<name>也是key值。在定义模型的时候,已经定义了哪些节点具有key属性。因此,用户在查询时,已经知道哪些是节点是key,也就是知道了节点的key属性。
前一个查询结果(兄弟节点的值,如out-if-name)是下一个查询的节点的key值(如:<interface>的<name>)。上述技术方案将下一个list的key值直接设置为上一个查询结果的相对路径,这样多个节点串联起来,就可以实现关联查询了。因此,利用上述技术方案,在多子树关联过滤查询的场景下,只需要一条查询报文,就可以得到最终的查询结果,而传统的查询方案中每个子树都需要一条查询报文。可见,上述技术方案可以有效减少查询 报文的数量,提高查询效率。并且,上述技术方案在查询过程中不需要从中间的查询结果中解析相关字段构造新的查询报文。
此外,上述技术方案可以查询指定节点的查询结果(例如示例11),也可以查询多个节点的查询结果(例如示例13)。多个节点的查询结果中还包括中间相关的所有数据。这样,可以更便于用户获取节点间的关联关系。
图3是根据本申请实施例提供的一种基于NETCONF的查询信息的方法的示意性流程图。
301,网络设备从查询设备接收查询报文,该查询报文包括第一选择节点、第二选择节点和第一内容匹配节点,该第一内容匹配节点包括的属性的值为该第一选择节点的值的相对路径。
302,该网络设备根据该查询报文确定查询反馈,该查询反馈包括第一查询结果和第二查询结果,该第一查询结果包括该第一选择节点的值,该第二查询结果包括该第二选择节点的值。
303,该网络设备将该查询反馈发送给该查询设备。
该查询设备可以是一个计算机设备,例如台式计算机、笔记本电脑、平板电脑等。该网络设备可以是服务器、交换机或者路由器等。
表3示出了示例11、示例13和示例15中的第一选择节点、第一内容匹配节点和第二选择节点。
表3
示例 第一选择节点 第一内容匹配节点 第二选择节点
示例11 选择节点1 内容匹配节点2 选择节点2
示例13 选择节点4 内容匹配节点4 选择节点5
示例15 选择节点7 内容匹配节点7 选择节点8
如表3所示,示例11中的第一选择节点为选择节点1;示例11中的第二选择节点为选择节点2。示例11中的第一内容匹配节点为内容匹配节点2。内容匹配节点2的属性的值为选择节点1的值的相对路径。
示例12是示例11的查询反馈,示例12包括第一查询结果和第二查询结果,第一查询结果包括第一选择节点(即选择节点1)的值eth1/1,第二查询结果包括第二选择节点的值vrf_1。如上所述,示例12分为三个部分,示例12的第一部分包括第一查询结果,即第一选择节点的值eth1/1;示例12的第二部分包括第二查询结果,即第二选择节点的值vrf_1。
示例14是示例13的查询反馈,示例14包括第一查询结果和第二查询结果,第一查询结果包括第一选择节点(即选择节点4)的值eth1/1和eth2/2,第二查询结果包括第二选择节点(即选择节点5)的值vrf_1和vrf_2。如上所示,示例14分为三个部分,示例4中的第一部分包括第一查询结果,即第一选择节点的值eth1/1和eth2/2;示例14的第二部分包括第二查询结果,即第二选择节点的值vrf_1和vrf_2。
示例16是示例15的查询反馈,示例16包括第一查询结果和第二查询结果,第一查询结果包括第一选择节点(即选择节点7)的值eth1/1,第二查询结果包括第二选择节点(即选择节点8)的值vrf_1。
可选的,第二选择节点的值是根据第一选择节点的值确定的。
例如,选择节点2的值是根据选择节点1的值确定的;选择节点3的值是根据选择节点2的值确定的;选择节点5的值是根据选择节点4的值确定的;选择节点6的值是根据选择节点5的值确定的;选择节点8的值是根据选择节点7的值确定的。
第一内容匹配节点的属性的名字path-ref是示例10定义的一个数据类型为字符串(string)的注释。
可选的,第二选择节点还可以包括第一选择节点的值。
例如,示例12的第二部分还包括第一选择节点的值eth1/1;示例14的第二部分还包括第一选择节点的值eth1/1和eth2/2;示例16的第二部分还包括第一选择节点的值eth1/1。
可选的,查询反馈还可以包括第三查询结果,该第三查询结果包括与该第二选择节点对应的兄弟节点的值以及与该第一选择节点对应的兄弟节点的值。
例如,示例14中的第三查询结果包括与选择节点4对应的兄弟节点的值session_1和session_2,其中session_1对应于eth1/1,session_2对应于eth2/2。示例14中的第三查询结果还包括与选择节点5对应的兄弟节点的值eth1/1和eth2/2,其中eth1/1对应于vrf_1,eth2/2对应于vrf_2。
可选的,查询报文还包括目标内容匹配节点,该目标内容匹配节点的值为待查询的目标标识,该第一选择节点的值与该待查询的目标标识对应。
例如,示例11中的内容匹配节点1为该目标内容匹配节点;示例15中的内容匹配节点6为该目标内容匹配节点。
可选的,第三查询结果中还可以包括与第一选择节点对应的兄弟节点的值。
例如,示例12和示例16中的第三查询结果中包括第一选择节点对应的兄弟节点值session_1。
可选的,该查询报文还可以包括第二内容匹配节点,该第二内容匹配节点包括的属性的值为该第二选择节点的值的相对路径。
例如,示例11中的内容匹配节点3为该第二内容匹配节点,内容匹配节点3包括的属性的值为选择节点2的值的相对路径。
又如,示例13中的内容匹配节点5是该第二内容匹配节点,内容匹配节点5包括的属性的值为选择节点5的值的相对路径。
又如,示例15中只有第二选择节点,而不包括第二内容匹配节点。
可选的,该查询报文还可以包括第三选择节点。
例如,示例11中的选择节点3和示例13中的选择节点6是第三选择节点。
在查询报文包括第二内容匹配节点和第三选择节点的情况下,查询反馈还可以包括第三选择节点的值。例如,示例12中的查询反馈包括选择节点3的值10.0.0.1;示例14中包括选择节点6的值10.0.0.1和10.0.0.2,其中10.0.0.1对应于vrf_1,10.0.0.2对应于vrf_2。
本申请实施例提供的查询方法中,查询报文中总共可以包括N+1个选择节点以及N个内容匹配节点,该N+1个选择节点中的前N个选择节点与该N个内容匹配节点一一对应,N是大于或等于1的正整数。该N个内容匹配节点中的每个内容匹配节点的属性的值是对应的选择节点的值的相对路径。
例如,在示例11中,N的值为2。示例11中的N个选择节点为选择节点1和选择节 点2,其中与选择节点1对应的内容匹配节点为内容匹配节点2,与选择节点2对应的内容匹配节点为内容匹配节点3。示例11中“N+1”中“+1”的选择节点为选择节点3。
又如,在示例13中,N的值为2。示例11中的N个选择节点分别为选择节点4和选择节点5,其中与选择节点4对应的内容匹配节点为内容匹配节点4,与选择节点5对应的内容匹配节点为内容匹配节点5。示例13中“N+1”中“+1”的选择节点为选择节点6。
例如,在示例15中,N的值为1。示例15中的N个选择节点为选择节点7,其中与选择节点1对应的内容匹配节点为内容匹配节点6,示例15中“N+1”中“+1”的选择节点为选择节点7。
对应于包括N+1个选择节点以及N个内容匹配节点的查询报文的查询反馈包括了N+1个选择节点中的每个选择节点的值。
可以看出,利用本申请实施例提供的方法,在N+1个子树相互关联的情况下,可以只需要构造一次查询报文就可以查询到最终的查询结果,而如果使用传统的查询方法需要构造N个查询报文才能得到最终的查询结果。因此,本申请技术方案可以减少查询报文的数量,提高查询效率。
图4是根据本申请实施例提供的一种网络设备的结构图。如图4所示的网络设备400包括接收单元401、处理单元402和发送单元403。如图4所示的网络设备400可以是服务器、交换机、路由器等网络设备,也可以是上述网络设备中的部件(例如芯片等)。
接收单元401,用于从查询设备接收查询报文,该查询报文包括第一选择节点、第二选择节点和第一内容匹配节点,该第一内容匹配节点包括的属性的值为该第一选择节点的值的相对路径。
处理单元402,用于根据该查询报文确定查询反馈,该查询反馈包括第一查询结果和第二查询结果,该第一查询结果包括所述第一选择节点的值,该第二查询结果包括该第二选择节点的值。
发送单元403,用于将该查询反馈发送给该查询设备。
接收单元401和发送单元403可以由收发器实现,处理单元402可以由处理器实现。接收单元401、处理单元402和发送单元403的具体功能和有益效果,可以参考上述实施例,为了简洁,在此就不再赘述。
应理解,上述网络设备400也可以是一个芯片。例如,该网络设备可以是现场可编程门阵列(field programmable gate array,FPGA),可以是专用集成芯片(application specific integrated circuit,ASIC),还可以是系统芯片(system on chip,SoC),还可以是中央处理器(central processor unit,CPU),还可以是网络处理器(network processor,NP),还可以是数字信号处理电路(digital signal processor,DSP),还可以是微控制器(micro controller unit,MCU),还可以是可编程控制器(programmable logic device,PLD)、其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,或其他集成芯片。
若网络设备400为芯片,那么接收单元401和发送单元403可以是输入输出电路或通信接口,处理单元402可以是芯片上集成的处理器或者集成电路。
本申请实施例还提供一种网络设备,该网络设备包处理器,该处理器用于与存储器耦合,读取并执行该存储器中的指令和/或程序代码,以执行上述实施例中任一个实施例所述的方法。
本申请实施例还提供了一种芯片系统,该芯片系统包括逻辑电路,该逻辑电路用于与输入/输出接口耦合,通过该输入/输出接口传输数据,以执行上述实施例中任一个实施例所述的方法。
在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令或程序代码完成。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。为避免重复,这里不再详细描述。
应注意,本申请实施例中的处理器可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法实施例的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令或程序代码完成。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。
可以理解,本申请实施例中的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。应注意,本文描述的系统和方法的存储器旨在包括但不限于这些和任意其它适合类型的存储器。
根据本申请实施例提供的方法,本申请还提供一种计算机程序产品,该计算机程序产品包括:计算机程序代码,当该计算机程序代码在计算机上运行时,使得该计算机执行上述实施例中任意一个实施例的方法。
根据本申请实施例提供的方法,本申请还提供一种计算机可读介质,该计算机可读介质存储有程序代码,当该程序代码在计算机上运行时,使得该计算机执行上述实施例中任意一个实施例的方法。
根据本申请实施例提供的方法,本申请还提供一种系统,其包括前述的电子设备和查询设备。该查询设备向该电子设备发送查询报文,接收来自于该电子设备的查询反馈。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以 硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令或程序代码用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (16)

  1. 一种基于网络配置协议NETCONF的查询信息的方法,其特征在于,包括:
    网络设备从查询设备接收查询报文,所述查询报文包括第一选择节点、第二选择节点和第一内容匹配节点,所述第一内容匹配节点包括的属性的值为所述第一选择节点的值的相对路径;
    所述网络设备根据所述查询报文确定查询反馈,并将所述查询反馈发送给所述查询设备,所述查询反馈包括第一查询结果和第二查询结果,所述第一查询结果包括所述第一选择节点的值,所述第二查询结果包括所述第二选择节点的值。
  2. 如权利要求1所述的方法,其特征在于,所述第二选择节点的值是根据所述第一选择节点的值确定的。
  3. 如权利要求1或2所述的方法,其特征在于,所述第一内容匹配节点的属性的名字是预先定义的注释,所述注释的数据类型为字符串。
  4. 如权利要求1至3中任一项所述的方法,其特征在于,所述第二查询结果还包括对应于所述第一选择节点的值。
  5. 如权利要求1至3中任一项所述的方法,其特征在于,所述查询反馈还包括第三查询结果,所述第三查询结果包括与所述第二选择节点对应的兄弟节点的值和与所述第一选择节点对应的兄弟节点的值。
  6. 如权利要求1至4中任一项所述的方法,其特征在于,所述查询报文还包括目标内容匹配节点,所述目标内容匹配节点的值为待查询的目标标识,所述第一选择节点的值与所述待查询的目标标识对应。
  7. 如权利要求6所述的方法,其特征在于,所述查询反馈还包括第三查询结果,所述第三查询结果包括与所述第一选择节点对应的兄弟节点的值。
  8. 一种网络设备,其特征在于,包括:
    接收单元,用于从查询设备接收查询报文,所述查询报文包括第一选择节点、第二选择节点和第一内容匹配节点,所述第一内容匹配节点包括的属性的值为所述第一选择节点的值的相对路径;
    处理单元,用于根据所述查询报文确定查询反馈,所述查询反馈包括第一查询结果和第二查询结果,所述第一查询结果包括所述第一选择节点的值,所述第二查询结果包括所述第二选择节点的值;
    发送单元,用于将所述查询反馈发送给所述查询设备。
  9. 如权利要求8所述的网络设备,其特征在于,所述第二选择节点的值是根据所述第一选择节点的值确定的。
  10. 如权利要求8或9所述的网络设备,其特征在于,所述第一内容匹配节点的属性的名字是预先定义的注释,所述注释的数据类型为字符串。
  11. 如权利要求8至10中任一项所述的网络设备,其特征在于,所述第二查询结果还包括对应于所述第一选择节点的值。
  12. 如权利要求8至11中任一项所述的网络设备,其特征在于,所述查询反馈还包 括第三查询结果,所述第三查询结果包括与所述第二选择节点对应的兄弟节点的值和与所述第一选择节点对应的兄弟节点的值。
  13. 如权利要求8至11中任一项所述的网络设备,其特征在于,所述查询报文还包括目标内容匹配节点,所目标内容匹配节点的值为待查询的目标标识,所述第一选择节点的值与所述待查询的目标标识对应。
  14. 如权利要求13所述的网络设备,其特征在于,所述查询反馈还包括第三查询结果,所述第三查询结果包括与所述第一选择节点对应的兄弟节点的值。
  15. 一种网络设备,其特征在于,包括:处理器,所述处理器用于与存储器耦合,读取并执行所述存储器中的指令和/或程序代码,以执行如权利要求1-7中任一项所述的方法。
  16. 一种计算机可读介质,其特征在于,所述计算机可读介质存储有程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行如权利要求1-7中任一项所述的方法。
PCT/CN2022/094685 2021-06-01 2022-05-24 基于网络配置协议的查询信息的方法和装置 WO2022253047A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110610448.5A CN115495638A (zh) 2021-06-01 2021-06-01 基于网络配置协议的查询信息的方法和装置
CN202110610448.5 2021-06-01

Publications (1)

Publication Number Publication Date
WO2022253047A1 true WO2022253047A1 (zh) 2022-12-08

Family

ID=84323900

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/094685 WO2022253047A1 (zh) 2021-06-01 2022-05-24 基于网络配置协议的查询信息的方法和装置

Country Status (2)

Country Link
CN (1) CN115495638A (zh)
WO (1) WO2022253047A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070198479A1 (en) * 2006-02-16 2007-08-23 International Business Machines Corporation Streaming XPath algorithm for XPath expressions with predicates
CN103198133A (zh) * 2013-04-12 2013-07-10 同方知网(北京)技术有限公司 一种将XPath查询转换为树形数据结构的查询优化方法
CN103294821A (zh) * 2013-06-17 2013-09-11 北京工业大学 基于多层子查询结果分支树的xml数据查询结果访问方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070198479A1 (en) * 2006-02-16 2007-08-23 International Business Machines Corporation Streaming XPath algorithm for XPath expressions with predicates
CN103198133A (zh) * 2013-04-12 2013-07-10 同方知网(北京)技术有限公司 一种将XPath查询转换为树形数据结构的查询优化方法
CN103294821A (zh) * 2013-06-17 2013-09-11 北京工业大学 基于多层子查询结果分支树的xml数据查询结果访问方法

Also Published As

Publication number Publication date
CN115495638A (zh) 2022-12-20

Similar Documents

Publication Publication Date Title
KR102219730B1 (ko) 서비스 계층에 대한 액세스 제어 정책 동기화
US10834013B2 (en) Network slice management
US6317748B1 (en) Management information to object mapping and correlator
US11985023B2 (en) Supporting graphQL based queries on yang based configuration data models
US10476755B1 (en) Multi vendor device support in network management systems
WO2010034237A1 (zh) 模糊查询、查询结果处理和过滤条件处理的方法及设备
JP2019537775A (ja) 分散されたセマンティック記述子に対するセマンティッククエリ
WO2021179977A1 (zh) 报文处理方法和设备
WO2016201988A1 (zh) 配置数据推送方法及装置
WO2016107397A1 (en) System and method for model-based search and retrieval of networked data
WO2016110078A1 (zh) 数据获取方法及装置、存储介质
Graham et al. Web services resource properties 1.2 (WS-ResourceProperties)
US20180205790A1 (en) Distributed data structure in a software defined networking environment
US20230308348A1 (en) Server to support client data models from heterogeneous data sources
WO2022253047A1 (zh) 基于网络配置协议的查询信息的方法和装置
WO2016110070A1 (zh) 数据获取方法及装置、存储介质
TW200933406A (en) Data item interval indentifier lookup method and system
CN107025300B (zh) 一种数据查询的方法及装置
WO2019062850A1 (zh) 数据交互的方法、装置及设备
WO2023279848A1 (zh) 一种查询方法、装置及设备
EP4325791A1 (en) Configuration updating method and apparatus, and system and computer-readable storage medium
CN117971951B (zh) 面向异构注册表的数字对象元数据互操作方法、装置、设备和介质
WO2017004992A1 (zh) 一种配置网络处理器的方法和装置
KR100483283B1 (ko) 웹 기반의 지디엠오 정보 검색 시스템 및 방법
CN117290550A (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: 22815094

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: 22815094

Country of ref document: EP

Kind code of ref document: A1