09-05-2017 03:05 PM - edited 03-01-2019 03:59 AM
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?
Solved! Go to Solution.
09-06-2017 12:17 AM
If you see the pushed config inside NSO when you show your service instances, your injection part is good, but the service broken.
09-06-2017 12:17 AM
If you see the pushed config inside NSO when you show your service instances, your injection part is good, but the service broken.
09-06-2017 06:34 AM
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!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide