ONTAP Rest API Discussions

Getting All snapmirror relationships slowly from ONTAP API

Louis_Chang
2,086 Views

Hello, I am trying to use python script to get "all snapmirrror relationships" from ONTAP API, when I run the script that it's took very long time to finished(around 30-50 minutes ), but using "snapmirror show" via ssh that it's very quickly to finished job(around 3-5 seconds ).

 

Is anyone else has same problem?

 

====================================================================

SSH cmd example:

ssh admin@10.255.1.10 "snapmirror show"

 

====================================================================

python script code:

 

#!/usr/bin/python [2/148]
import requests
import json
import urllib3
urllib3.disable_warnings()

auth_user = "admin"
auth_pass = "12345678"
api_url="https://10.255.1.10/api/snapmirror/relationships/"

headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}

r = requests.get(api_url, auth=(auth_user,auth_pass), headers=headers, verify=False)

rs = r.json()

total = rs["records"]

for r in rs["records"]:
#print api_url + r["uuid"]
api_url_list = api_url + r["uuid"]
print api_url_list
r1 = requests.get(api_url_list, auth=(auth_user,auth_pass), headers=headers, verify=False)
rs1 = r1.json()
#print rs1
print rs1["source"]["path"]
print rs1["destination"]["path"]
print rs1["healthy"]
print "===================================="

3 REPLIES 3

GidonMarcus
2,069 Views

What ONTAP version you are on? I would open a support request as that doesn't seem right... 

Gidi Marcus (Linkedin) - Storage and Microsoft technologies consultant - Hydro IT LTD - UK

Louis_Chang
2,040 Views

My ONTAP OS is 9.7P9.

Louis_Chang
2,038 Views

My ONTAP OS is 9.7P9.

Public