cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
356
Views
5
Helpful
2
Replies

The "directly-modified" show in the RESTCONF configration data

Chu Liang
Cisco Employee
Cisco Employee

GET http://127.0.0.1:8080/restconf/data/l2vpn-svc:;2vpm-svc/l2vpn-svc=poc01

I can see the operational data "modified" and "directly-modified" is shown in the output.

 

{
    "l2vpn-svc:l2vpn-svc": [
        {
            "vpn-id": "poc01",
            "modified": {
                "devices": [
                    "PE-1",
                    "PE-2",
                    "PE-3"
                ]
            },
            "directly-modified": {
                "devices": [
                    "PE-1",
                    "PE-2",
                    "PE-3"
                ]
            },
......

In my understanding, it should be fetched as the operations data, is it correct?

 

1 Accepted Solution

Accepted Solutions

Nabsch
Spotlight
Spotlight

You perfomed a GET Request without specifying the content so by the default it will use all. Here the explanation from RFC 8040.

 

 If this query parameter is not present, the default value is "all".
   This query parameter MUST be supported by the server.

So it will return all  nodes ( config data / state data ( which is operational data) ) 

 

all       | Return all descendant data nodes     

 

If you want you want to get only the configuration data nodes  you can add ?content=config at the end of the URL  ==> without modified, directly-modified,etc..

 

 

 config    | Return only configuration descendant data nodes    

By default a node it's considered as config node unless you specify a config false; in the yang. Link to RFC 

 

 

If you want to get only the instance without the configuration data nodes you can add ?content=nonconfig at the end of the URL.  ==> You will get for example   modified ,  directly-modified,log , etc.. 

 

 

nonconfig | Return only non-configuration descendant data nodes

 

 

 

Here example of payload that you will get

nabil@DESKTOP-8ECTID4:~$ curl -u admin:admin http://localhost:8080//restconf/data/l3vpn:vpn/l3vpn=aa -H "Content-Type: application/yang-data+json"
{
  "l3vpn:l3vpn": [
    {
      "name": "aa",
      "modified": {
        "devices": ["TEST-IOS-XR-3.01"]
      },
      "directly-modified": {
        "devices": ["TEST-IOS-XR-3.01"]
      },
      "device-list": ["TEST-IOS-XR-3.01"],
      "endpoint": [
        {
          "id": "A",
          "as-number": 64512,
          "ce": {
            "device": "TEST-IOS-XR-3.00",
            "link": {
              "ip-address": "2.3.4.5"
            }
          },
          "pe": {
            "device": "TEST-IOS-XR-3.01",
            "link": {
              "interface-name": "GigabitEthernet0/5/6",
              "ip-address": "1.2.3.4"
            }
          }
        }
      ]
    }
  ]
}
nabil@DESKTOP-8ECTID4:~$ curl -u admin:admin http://localhost:8080//restconf/data/l3vpn:vpn/l3vpn=aa?content=config -H "Content-Type: application/yang-data+json"
{
  "l3vpn:l3vpn": [
    {
      "name": "aa",
      "endpoint": [
        {
          "id": "A",
          "as-number": 64512,
          "ce": {
            "device": "TEST-IOS-XR-3.00",
            "link": {
              "ip-address": "2.3.4.5"
            }
          },
          "pe": {
            "device": "TEST-IOS-XR-3.01",
            "link": {
              "interface-name": "GigabitEthernet0/5/6",
              "ip-address": "1.2.3.4"
            }
          }
        }
      ]
    }
  ]
}
nabil@DESKTOP-8ECTID4:~$ curl -u admin:admin http://localhost:8080//restconf/data/l3vpn:vpn/l3vpn=aa?content=nonconfig -H "Content-Type: application/yang-data+json"
{
  "l3vpn:l3vpn": [
    {
      "name": "aa",
      "modified": {
        "devices": ["TEST-IOS-XR-3.01"]
      },
      "directly-modified": {
        "devices": ["TEST-IOS-XR-3.01"]
      },
      "device-list": ["TEST-IOS-XR-3.01"],
    }
  ]
}
nabil@DESKTOP-8ECTID4:~$ curl -u admin:admin http://localhost:8080//restconf/data/l3vpn:vpn/l3vpn=aa?content=all -H "Content-Type: application/yang-data+json"
{
  "l3vpn:l3vpn": [
    {
      "name": "aa",
      "modified": {
        "devices": ["TEST-IOS-XR-3.01"]
      },
      "directly-modified": {
        "devices": ["TEST-IOS-XR-3.01"]
      },
      "device-list": ["TEST-IOS-XR-3.01"],
      "endpoint": [
        {
          "id": "A",
          "as-number": 64512,
          "ce": {
            "device": "TEST-IOS-XR-3.00",
            "link": {
              "ip-address": "2.3.4.5"
            }
          },
          "pe": {
            "device": "TEST-IOS-XR-3.01",
            "link": {
              "interface-name": "GigabitEthernet0/5/6",
              "ip-address": "1.2.3.4"
            }
          }
        }
      ]
    }
  ]
}

 

 

 

View solution in original post

2 Replies 2

Nabsch
Spotlight
Spotlight

You perfomed a GET Request without specifying the content so by the default it will use all. Here the explanation from RFC 8040.

 

 If this query parameter is not present, the default value is "all".
   This query parameter MUST be supported by the server.

So it will return all  nodes ( config data / state data ( which is operational data) ) 

 

all       | Return all descendant data nodes     

 

If you want you want to get only the configuration data nodes  you can add ?content=config at the end of the URL  ==> without modified, directly-modified,etc..

 

 

 config    | Return only configuration descendant data nodes    

By default a node it's considered as config node unless you specify a config false; in the yang. Link to RFC 

 

 

If you want to get only the instance without the configuration data nodes you can add ?content=nonconfig at the end of the URL.  ==> You will get for example   modified ,  directly-modified,log , etc.. 

 

 

nonconfig | Return only non-configuration descendant data nodes

 

 

 

Here example of payload that you will get

nabil@DESKTOP-8ECTID4:~$ curl -u admin:admin http://localhost:8080//restconf/data/l3vpn:vpn/l3vpn=aa -H "Content-Type: application/yang-data+json"
{
  "l3vpn:l3vpn": [
    {
      "name": "aa",
      "modified": {
        "devices": ["TEST-IOS-XR-3.01"]
      },
      "directly-modified": {
        "devices": ["TEST-IOS-XR-3.01"]
      },
      "device-list": ["TEST-IOS-XR-3.01"],
      "endpoint": [
        {
          "id": "A",
          "as-number": 64512,
          "ce": {
            "device": "TEST-IOS-XR-3.00",
            "link": {
              "ip-address": "2.3.4.5"
            }
          },
          "pe": {
            "device": "TEST-IOS-XR-3.01",
            "link": {
              "interface-name": "GigabitEthernet0/5/6",
              "ip-address": "1.2.3.4"
            }
          }
        }
      ]
    }
  ]
}
nabil@DESKTOP-8ECTID4:~$ curl -u admin:admin http://localhost:8080//restconf/data/l3vpn:vpn/l3vpn=aa?content=config -H "Content-Type: application/yang-data+json"
{
  "l3vpn:l3vpn": [
    {
      "name": "aa",
      "endpoint": [
        {
          "id": "A",
          "as-number": 64512,
          "ce": {
            "device": "TEST-IOS-XR-3.00",
            "link": {
              "ip-address": "2.3.4.5"
            }
          },
          "pe": {
            "device": "TEST-IOS-XR-3.01",
            "link": {
              "interface-name": "GigabitEthernet0/5/6",
              "ip-address": "1.2.3.4"
            }
          }
        }
      ]
    }
  ]
}
nabil@DESKTOP-8ECTID4:~$ curl -u admin:admin http://localhost:8080//restconf/data/l3vpn:vpn/l3vpn=aa?content=nonconfig -H "Content-Type: application/yang-data+json"
{
  "l3vpn:l3vpn": [
    {
      "name": "aa",
      "modified": {
        "devices": ["TEST-IOS-XR-3.01"]
      },
      "directly-modified": {
        "devices": ["TEST-IOS-XR-3.01"]
      },
      "device-list": ["TEST-IOS-XR-3.01"],
    }
  ]
}
nabil@DESKTOP-8ECTID4:~$ curl -u admin:admin http://localhost:8080//restconf/data/l3vpn:vpn/l3vpn=aa?content=all -H "Content-Type: application/yang-data+json"
{
  "l3vpn:l3vpn": [
    {
      "name": "aa",
      "modified": {
        "devices": ["TEST-IOS-XR-3.01"]
      },
      "directly-modified": {
        "devices": ["TEST-IOS-XR-3.01"]
      },
      "device-list": ["TEST-IOS-XR-3.01"],
      "endpoint": [
        {
          "id": "A",
          "as-number": 64512,
          "ce": {
            "device": "TEST-IOS-XR-3.00",
            "link": {
              "ip-address": "2.3.4.5"
            }
          },
          "pe": {
            "device": "TEST-IOS-XR-3.01",
            "link": {
              "interface-name": "GigabitEthernet0/5/6",
              "ip-address": "1.2.3.4"
            }
          }
        }
      ]
    }
  ]
}

 

 

 

Thank you @Nabsch for the elaborate explanation!It's quite helpful!