Reply

External REST calls via Perl Job Scripting?

BSlappey
Techie
Posts: 1
3043     0

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?

 

Yes. The sandbox has external

Adviser
Posts: 357
3044     0

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.

 

John

Re: Yes. The sandbox has external

Moderator Dave_Signori
Moderator
Posts: 117
3044     0

Python support was added in 7.2.

@DaveSignori

Re: Yes. The sandbox has external

Adviser
Posts: 427
3044     0

You can use python with the following example to make a call to your assest system and Arista Smiley Happy

 

 

# 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'])
Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh
Showing results for 
Search instead for 
Do you mean 

Recommended for You