cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
486
Views
0
Helpful
2
Replies

SERVICE TEMPLATE PUSH

allenvose
Level 1
Level 1

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

Jan Lindblad
Cisco Employee
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

Jan Lindblad
Cisco Employee
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.

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!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: