Subject: [Teas] Query on multiple-inheritance models

From: Xufeng Liu <[email-masked]>
Date: Tue, 28 Jul 2020 11:51:45 -0400

During our regular YANG TE Model Design Discussion meeting, we received a
question about how to do queries on the data of the models with multiple
inheritances. This email is an attempt to show such a query with XPath by
an example.

The statement is that a query is as easy on a multiple-inheritance model as
on a linearly-augmented model.

As an example, the module ietf-sr-mpls-topology described in
draft-ietf-teas-yang-sr-te-topo is used. An SR MPLS TE topology instance
can be configured by using multiple inheritances from both
ietf-l3-unicast-topology and ietf-te-topology. Attached are two
configuration instances of SR MPLS topology, one of which is non-TE with
network-id "sr-topo-example" (that is the data example in Appendix B of
draft-ietf-teas-yang-sr-te-topo), and the other of which is TE enabled with
network-id "sr-te-topo-example". Both instances will co-exist in the
datastore if both JSON files are sent to the server.

To query on the information of the SR MPLS TE instance
"sr-te-topo-example", the following XPath can be used:

/networks/network[network-types/l3t:l3-unicast-topology/srmt:sr-mpls][network-types/tet:te-topology]

To retrieve the information for node "D1" of the instance
"sr-te-topo-example", the following XPath can be used:

xget
/networks/network[network-types/l3t:l3-unicast-topology/srmt:sr-mpls][network-types/tet:te-topology]/node[node-id='D1'

The server will reply with the following data:

{
  "ietf-network:networks": {
    "network": [
      {
        "network-id":"sr-te-topo-example",
        "node": [
          {
            "node-id":"D1",
            "ietf-l3-unicast-topology:l3-node-attributes": {
              "router-id": [
                "203.0.113.1"
              ],
              "prefix": [
                {
                  "prefix":"203.0.113.1/32",
                  "ietf-sr-mpls-topology:sr-mpls": {
                    "start-sid":101,
                    "range":1,
                    "is-local":false,
                    "is-node":true
                  }
                }
              ],
              "ietf-sr-mpls-topology:sr-mpls": {
                "srgb": [
                  {
                    "lower-bound":16000,
                    "upper-bound":23999
                  }
                ],
                "srlb": [
                  {
                    "lower-bound":15000,
                    "upper-bound":15999
                  }
                ]
              }
            },
            "ietf-te-topology:te": {
              "te-node-attributes": {
                "admin-status":"up",
                "connectivity-matrices": {
                },
                "domain-id":1001,
                "is-abstract":[null],
                "signaling-address": [
                  "203.0.113.1"
                ]
              }
            },
            "ietf-te-topology:te-node-id":"203.0.113.1",
            "ietf-network-topology:termination-point": [
              {
                "tp-id":"1-0-1",
                "ietf-l3-unicast-topology:l3-termination-point-attributes":
{
                  "unnumbered-id":101
                }
              },
              {
                "tp-id":"1-2-1",
                "ietf-l3-unicast-topology:l3-termination-point-attributes":
{
                  "unnumbered-id":121
                }
              },
              {
                "tp-id":"1-3-1",
                "ietf-l3-unicast-topology:l3-termination-point-attributes":
{
                  "unnumbered-id":131
                }
              }
            ]
          }
        ]
      }
    ]
  }
}

Thanks,
- Xufeng