cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1878
Views
10
Helpful
1
Replies

API: Callback from REST to RESTCONF

tsiemers1
Spotlight
Spotlight

Having trouble trying to translate this old rest API uri to use restconf now.

 

http://nsolab.com:8080/api/operational/engdb/aggSystems/3933/systemsAndRoutes/OMS?deep

CLI Command:

show engdb circuit 108243 mocn false sites 1709

Yang Snippet:

module engdb {

namespace "http://nsolab.com/nso/engdb";
prefix engdb;

import ietf-inet-types { prefix inet; }
import ietf-yang-types { prefix yang; }
import tailf-common { prefix tailf; }

container engdb {
  tailf:info "EngDB Data Provider displaying router details";

  config false;

  list aggSystems {
    tailf:callpoint "agg-dp";
    key queryDeviceID;

    leaf queryDeviceID {
      type uint32;
    }

    list systemsAndRoutes {
      key serviceType;
      leaf serviceType {
        type enumeration {
          enum OMS;
          enum CLTE;
        }
      }

      must serviceType = 'OMS' or serviceType = 'CLTE'"  {
        error-message "The service type must be set to OMS, or CLTE";
      }
    }
  }
}

I have tried the following and multiple variations with no success. I have changed the method to POST from GET

http://nsolab.com:8080/restconf/operations/engdb/aggSystems/3933/systemsAndRoutes/OMS

 

 

1 Accepted Solution

Accepted Solutions

gmuloche
Cisco Employee
Cisco Employee

Hello

 

in theory you should be able to do (caveat if you are using NSO 5 you will need to add the module names which I have added here):

 

http://nsolab.com:8080/restconf/data/engdb:engdb/aggSystems=3933/systemsAndRoutes=OMS

(note using GET operation)

 

example (I have hardcoded the answer and added some test leaf here):

CLI

admin@scratch# show engdb aggSystems 45
QUERY
DEVICE  SERVICE
ID      TYPE
-----------------
45      OMS
        CLTE

admin@scratch# show engdb aggSystems 45 systemsAndRoutes OMS
SERVICE
TYPE
---------
OMS

Curl

curl --location --request GET 'http://127.0.0.1:8080/restconf/data/engdb:engdb/aggSystems=3393' --header 'Authorization: Basic YWRtaW46YWRtaW4='

<aggSystems xmlns="http://nsolab.com/nso/engdb"  xmlns:engdb="http://nsolab.com/nso/engdb">
  <queryDeviceID>3393</queryDeviceID>
  <systemsAndRoutes>
    <serviceType>OMS</serviceType>
  </systemsAndRoutes>
  <systemsAndRoutes>
    <serviceType>CLTE</serviceType>
  </systemsAndRoutes>
</aggSystems>


curl --location --request GET 'http://127.0.0.1:8080/restconf/data/engdb:engdb/aggSystems=3393/systemsAndRoutes=OMS' --header 'Authorization: Basic YWRtaW46YWRtaW4='

<systemsAndRoutes xmlns="http://nsolab.com/nso/engdb"  xmlns:engdb="http://nsolab.com/nso/engdb">
  <serviceType>OMS</serviceType>
</systemsAndRoutes>

 

 

View solution in original post

1 Reply 1

gmuloche
Cisco Employee
Cisco Employee

Hello

 

in theory you should be able to do (caveat if you are using NSO 5 you will need to add the module names which I have added here):

 

http://nsolab.com:8080/restconf/data/engdb:engdb/aggSystems=3933/systemsAndRoutes=OMS

(note using GET operation)

 

example (I have hardcoded the answer and added some test leaf here):

CLI

admin@scratch# show engdb aggSystems 45
QUERY
DEVICE  SERVICE
ID      TYPE
-----------------
45      OMS
        CLTE

admin@scratch# show engdb aggSystems 45 systemsAndRoutes OMS
SERVICE
TYPE
---------
OMS

Curl

curl --location --request GET 'http://127.0.0.1:8080/restconf/data/engdb:engdb/aggSystems=3393' --header 'Authorization: Basic YWRtaW46YWRtaW4='

<aggSystems xmlns="http://nsolab.com/nso/engdb"  xmlns:engdb="http://nsolab.com/nso/engdb">
  <queryDeviceID>3393</queryDeviceID>
  <systemsAndRoutes>
    <serviceType>OMS</serviceType>
  </systemsAndRoutes>
  <systemsAndRoutes>
    <serviceType>CLTE</serviceType>
  </systemsAndRoutes>
</aggSystems>


curl --location --request GET 'http://127.0.0.1:8080/restconf/data/engdb:engdb/aggSystems=3393/systemsAndRoutes=OMS' --header 'Authorization: Basic YWRtaW46YWRtaW4='

<systemsAndRoutes xmlns="http://nsolab.com/nso/engdb"  xmlns:engdb="http://nsolab.com/nso/engdb">
  <serviceType>OMS</serviceType>
</systemsAndRoutes>

 

 

Polls
AI-powered tools for network troubleshooting are likely to be part of everyone’s workflow sooner or later. What is the single biggest challenge or concern you see with adopting these tools in your organization?