clicon/clixon

restconf

khromenokroman opened this issue · 2 comments

Hello, tell me when I send a get request, I get it like this.

curl -X GET http://111.11.111.11:8080/restconf/data/clixon-test:contexts/context=sample/router/static-routes -u 'sysadmin:$6$Edxj1MHJOWWrst2D$YTkLzv7EFQrSKeYWTq7BSw0Bu33qq5Teo/G.fMs2w0IcY0wwmLB25qVxa6/hHrSMhQvBrrfjaYIJ85d9D6zkj/'
{
   "clixon-test:static-routes": {
      "static": [
         {
            "ip": "0.0.0.0",
            "netmask": "0",
            "config": {
               "next-hop": [
                  {
                     "index": 1,
                     "config": {
                        "interface": "eth1",
                        "next-hop": "8.8.8.8",
                        "metric": 10
                     }
                  }
               ]
            }
         }
      ]
   }
}

And can I send a composite request if I need to, for example, filter by 2 fields, for example ip and netmask

something like that

curl -X GET 'http://example.com/api/data?month=3&year=2022'

now we have to use a hack. To receive everything and then process it on the client side, I would like to avoid this

curl -X GET "http://111.11.111.11:8080/restconf/data/clixon-test:contexts/context=sample/router/static-routes" -u 'sysadmin:$6$Edxj1MHJOWWrst2D$YTkLzv7EFQrSKeYWTq7BSw0Bu33qq5Teo/G.fMs2w0IcY0wwmLB25qVxa6/hHrSMhQvBrrfjaYIJ85d9D6zkj/' | jq '.["clixon-test:static-routes"].static[] | select(.ip == "desired_ip" and .netmask == "desired_netmask")'

Hello, tell me when I send a get request, I get it like this.

curl -X GET http://111.11.111.11:8080/restconf/data/clixon-test:contexts/context=sample/router/static-routes -u 'sysadmin:$6$Edxj1MHJOWWrst2D$YTkLzv7EFQrSKeYWTq7BSw0Bu33qq5Teo/G.fMs2w0IcY0wwmLB25qVxa6/hHrSMhQvBrrfjaYIJ85d9D6zkj/'
{
   "clixon-test:static-routes": {
      "static": [
         {
            "ip": "0.0.0.0",
            "netmask": "0",
            "config": {
               "next-hop": [
                  {
                     "index": 1,
                     "config": {
                        "interface": "eth1",
                        "next-hop": "8.8.8.8",
                        "metric": 10
                     }
                  }
               ]
            }
         }
      ]
   }
}

And can I send a composite request if I need to, for example, filter by 2 fields, for example ip and netmask

something like that

curl -X GET 'http://example.com/api/data?month=3&year=2022'

now we have to use a hack. To receive everything and then process it on the client side, I would like to avoid this

curl -X GET "http://111.11.111.11:8080/restconf/data/clixon-test:contexts/context=sample/router/static-routes" -u 'sysadmin:$6$Edxj1MHJOWWrst2D$YTkLzv7EFQrSKeYWTq7BSw0Bu33qq5Teo/G.fMs2w0IcY0wwmLB25qVxa6/hHrSMhQvBrrfjaYIJ85d9D6zkj/' | jq '.["clixon-test:static-routes"].static[] | select(.ip == "desired_ip" and .netmask == "desired_netmask")'

clixon supports https://datatracker.ietf.org/doc/html/rfc8040 ?

I figured it out thanks :)

curl -X GET "http://172.17.131.77:8080/restconf/data/clixon-ngfw:contexts/context=sample/router/static-routes/static=0.0.0.0,0" -u 'sysadmin:$6$Edxj1MHJOWWrst2D$YTkLzv7EFQrSKeYWTq7BSw0Bu33qq5Teo/G.fMs2w0IcY0wwmLB25qVxa6/hHrSMhQvBrrfjaYIJ85d9D6zkj/'