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

135
Views
1
Helpful
1
Replies
khgrant
Cisco Employee

how to update a running service via rest

 

Hi Team,

 

 

Could use some expertise in how to use REST API to update an existing service. Thanks, JA

 

 

I assumed that I could update a running service by using PATCH vs. POST. However I get the following error:

 

 

 

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

 

    <error>

 

        <error-tag>malformed-message</error-tag>

 

        <error-urlpath>/api/running/services</error-urlpath>

 

        <error-message>missing element: services in /ncs:services</error-message>

 

    </error>

 

</errors>

 

 

I am sending the below XML config (I just provided a snippet as it is long)  to the following URL:

 

 

http://10.84.46.61:8080/api/running/services

 

 

<vpc-mme-sae-gw xmlns="http://com/example/vpcmmesaegw">

 

    <deployment-name>vpc_di_MME</deployment-name>

 

    <esc-device>ESC0</esc-device>

 

    <tenant>mano</tenant>

 

    <num-of-cards>4</num-of-cards>

 

    <servicenet-vlsm>24</servicenet-vlsm>

 

    <service-gw-type>MME</service-gw-type>

 

    <vnfr>

 

…………..

 

1 REPLY 1
khgrant
Cisco Employee

 

JA,

 

 

PATCH:

 

Updates an existing resource. (If you are updating a list instance, the key(s)

 

must be in the URI).

 

 

So for l3vpn-subscribe service instance google-12345-001-123:

 

 

$ curl -X PATCH -i -v -H "Content-Type: application/vnd.yang.data+json" -u admin:admin --data "@l3vpnPatch.json" http://127.0.0.1:8080/api/running/services/l3vpn-subscribe/google-12345-001-123

 

 

Patch data:

 

 

$ cat l3vpnPatch.json

 

{

 

    "l3vpn-subscribe:l3vpn-subscribe":

 

    {

 

    "customer": {

 

      "short-name": "CUST-111",

 

      "customer-id": “111"

 

    }

 

    }

 

}

 

 

Before:

 

admin@ncs% show services l3vpn-subscribe google-12345-001-123 customer

 

short-name  CUST-1;

 

customer-id 001;

 

[ok][2016-10-11 22:22:47]

 

 

After:

 

[edit]

 

admin@ncs%

 

System message at 2016-10-11 22:23:13...

 

Commit performed by admin via http using rest.

 

admin@ncs% show services l3vpn-subscribe google-12345-001-123 customer

 

short-name  CUST-111;

 

customer-id 111;

 

[ok][2016-10-11 22:23:20]

 

 

-Larry

 

Create
Recognize Your Peers
Content for Community-Ad