cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
192
Views
0
Helpful
2
Replies
Highlighted
Beginner

SERVICE TEMPLATE PUSH

I've created a service template using REQUESTS as follows:

import requests

from requests.auth import HTTPBasicAuth

url = ('http://x.x.x.x:8080/api/running/services')

headers = {'Content-Type': 'application/vnd.yang.data+xml'}

content = open('af.xml', 'rb').read()

config = requests.post(url, headers=headers, auth=HTTPBasicAuth('admin', 'admin'), data=contents)

print config.txt

The XML payload file looks as follows:

<junosAF xmlns="http://com/example/junosAF">

  <device-name>WASHINGTON</device-name>

  <af_addr>x.x.x.x</af_addr>

  <af_int>ge-0/0/2</af_int>

</junosAF>

Note that the compiled template in NSO and YANG models align with this API.  When executing the API, it does push to NSO (version 4.4.2.1), however it does not then push to the device.  Is the format of this API correct?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Cisco Employee

If you see the pushed config inside NSO when you show your service instances, your injection part is good, but the service broken.

View solution in original post

2 REPLIES 2
Highlighted
Cisco Employee

If you see the pushed config inside NSO when you show your service instances, your injection part is good, but the service broken.

View solution in original post

Highlighted

You are correct!  I had a faulty variable in the XML that was slightly mis-named from the variable in the YANG model.  Once that was fixed, I note that I have to 1st SYNC with the edge device as a prerequisite to pushing out the Service Template.  It works well!

Many thanks again!