07-14-2015 08:54 PM
Is it possible to make external REST calls via perl jobs to return custom data? I would like to query our infrastructure management system for a subset of devices and push that data into Network Automation on a scheduled basis. I would also like to interact with Arista eAPI. Will this work? If not, is it on the roadmap? Also, any thoughts on adding support for python?
07-15-2015 06:14 AM
Yes. The sandbox has external access via NAT. You can access REST interfaces. You can also install additional Perl modules to enable access to SQL databases, etc.
The Arista eAPI is an HTTP-based API, so you can use it directly - except that you would need to have the credentials passed into the script which may not be feasible. There is a Perl example here: https://eos.arista.com/arista-eapi-101/
You'll have to discuss any roadmap plans with your account team, who can put you in touch with our product management. We can't discuss it here.
If you don't mind using the RESTful API directly (rather than through the object model in the Perl SDK), you can pass the DIS session ID and CLI connection ID parameters, along with DeviceID and whatever else you need, to a Python script from the Perl script.
01-15-2018 02:42 PM
You can use python with the following example to make a call to your assest system and Arista
# BEGIN-SCRIPT-BLOCK # # Script-Filter: # true # # END-SCRIPT-BLOCK import urllib.request import json, re with urllib.request.urlopen( "https://jsonplaceholder.typicode.com/users" ) as r: f = r.read().decode('utf-8') print(f) json_input = f decoded = json.loads(json_input) for j in decoded: print (j['username'], j['website'])