cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

168
Views
0
Helpful
5
Replies
khgrant
Cisco Employee

service action from REST

 

Hi NSO experts,

 

 

How do we run the service action from northbound?

 

What is the URL for the curl command via inputting file?

 

 

Below is how we run it on ncs_cli:

 

single service instance create:

 

admin@ncs> request siteswitch-multipoint-action create-siteswitch_multipoint_bridging siteswitch_multipoint { device ASR903-PRE1 interface-type GigabitEthernet interface-index 0/0/4 vlan-id 2000 description something }

 

 

multiple service instance create:

 

admin@ncs> request siteswitch-multipoint-action create-siteswitch_multipoint_bridging siteswitch_multipoint { device ASR903-PRE1 interface-type GigabitEthernet interface-index 0/0/4 vlan-id 2000 description something } siteswitch_multipoint { device ASR903-PRE1 interface-type GigabitEthernet interface-index 0/0/4 vlan-id 2001 description something } siteswitch_multipoint { device ASR903-PRE1 interface-type GigabitEthernet interface-index 0/0/4 vlan-id 2002 description something }

 

 

Regards,

 

-Fatih

 

5 REPLIES 5
khgrant
Cisco Employee

 

Hi Fatih,

 

 

This should be in the nso_northbound guide. Take a look, search for “_operations”.

 

 

It will be something like this:

 

  • Add the suffix to your URL where the action lives à URL/_operations/operationXYZ
  • HTTP Method: POST
  • Payload: <input>...</input>

  

 

Thanks,

 

  1. Bilal.

 

khgrant
Cisco Employee

 

Hi Bilal and experts,

 

 

We are still not able to get the URL:

 

our service action is having some more arguments. not sure how to construct:

 

 

[nso@RMTPSSO28 ~]$ curl -i -u admin:admin -X POST http://198.18.0.68:8080/api/running/services/siteswitch_multipoint_bridging/_operations/siteswitch-multipoint-action/create-siteswitch_multipoint_bridging -H "Content-Type: application/vnd.yang.data+xml"

 

HTTP/1.1 404 Not Found

 

Server:

 

Date: Mon, 18 Jan 2016 14:14:56 GMT

 

Cache-Control: private, no-cache, must-revalidate, proxy-revalidate

 

Content-Length: 193

 

Content-Type: text/xml

 

Vary: Accept-Encoding

 

Pragma: no-cache

 

 

 

<errors xmlns="http://tail-f.com/ns/tailf-rest-error">

 

  <error>

 

    <error-tag>unknown-element</error-tag>

 

    <error-message>wrong number of identifiers</error-message>

 

  </error>

 

</errors>

 

[nso@RMTPSSO28 ~]$

 

 

Do we need to set some configuration to make action available to REST?

 

 

Regards,

 

-Fatih

 

khgrant
Cisco Employee

 

Hi Fatih,

 

 

The URL doesn't seem right. The _operations is placed after the container that has the action.

 

 

Can you share your yang.

 

 

Also is your NSO instance accessible?

 

 

Does your action require an <input> payload?

 

  Thanks.

khgrant
Cisco Employee

 

Hi Bilal,

 

 

Attached are the yang model, action Java code and service RFS Java code.

 

The action requires a list of services.

 

Like below: (red is the input list, blue are the action commands)

 

multiple service instance create:

 

admin@ncs> request siteswitch-multipoint-action create-siteswitch_multipoint_bridging siteswitch_multipoint { device ASR903-PRE1 interface-type GigabitEthernet interface-index 0/0/4 vlan-id 2000 description something } siteswitch_multipoint { device ASR903-PRE1 interface-type GigabitEthernet interface-index 0/0/4 vlan-id 2001 description something } siteswitch_multipoint { device ASR903-PRE1 interface-type GigabitEthernet interface-index 0/0/4 vlan-id 2002 description something }

  

 

Regards,

 

-Fatih

 

khgrant
Cisco Employee

 

Hi Fatih,

 

 

It is "config false" data, so its not under the datastore /running, but under /operational

 

 

If you do a "GET" on the URI http://198.18.0.68:8080/api/operational/services/siteswitch_multipoint_bridging/

 

you should get the action URI in the response body.

 

Create
Recognize Your Peers
Content for Community-Ad