Giter VIP home page Giter VIP logo

netapp / ontap-rest-python Goto Github PK

View Code? Open in Web Editor NEW
60.0 24.0 41.0 74.92 MB

This repository contains sample code illustrating how to access the ONTAP REST API using Python. This Repository also contains ONTAPI Usage reporting code that helps to identify ONTAPI usage in your environment using ONTAP REST APIs.

License: BSD 3-Clause "New" or "Revised" License

Shell 100.00%
netapp ontap-rest-python netapp-lab netapprestapi pythonclientlibrary netappapi ontapautomation ontap netapp-automation netapp-ontap-cluster restapi netappontap netapp-public rest-api api python rest ontapi-usage-reporting-tool ontapi zapi

ontap-rest-python's Introduction

ONTAP-REST-Python Examples

NetApp® ONTAP® 9.6 and later versions include support for an expansive RESTful web services API. In comparison to an ONTAPI® application, the REST API offers a vastly simplified and workflow-driven user experience, allowing you to perform multiple operations on the storage objects with a single API. REST is the industry standard for API development and the ONTAP REST API provides a great opportunity to automate your storage deployments.

This repository contains sample scripts illustrating how to use the ONTAP REST API. You can access the API through the Python client library, which is preferable in most situations. If needed, you can also connect directly to the API using the native capabilities provided with Python. See the repository folder examples with two subfolders containing sample code by usage type. Also see the folder lod for instructions on using the NetApp Lab on Demand (LOD) to run the sample scripts.

Using the Python client library

The Python client library is a package you can use when writing scripts to access the ONTAP REST API. It provides support for several underlying services, including connection management, asynchronous request processing, and exception handling. By using the Python client library, you can quickly develop robust code to support the automation of your ONTAP deployments.

Before beginning, you need to install the package containing the library. For example:

pip install netapp-ontap

You should also review the PyPI netapp-ontap package web page for detailed system requirements and further instructions, as well as reference documentation for the library.

The repository folder examples/python_client_library contains sample scripts to access the ONTAP REST API through the Python client library. You need to run each of the scripts with the appropriate parameters. Use the help provided with each script to get started. For example:

python3 list_volume.py -h

Directly accessing the ONTAP REST API

The repository folder examples/rest_api contains sample scripts to directly access the ONTAP REST API using the requests library. You need to run each of the scripts with the appropriate parameters. Use the help provided with each script to get started. For example:

python3 create_volume.py -h

Running the sample scripts in the Lab on Demand

You can run the sample scripts in the NetApp Lab on Demand (LOD). The repository folder lod contains instructions as well as the initialization script needed to configure the LOD environment.

Support

Report any issues to: https://github.com/NetApp/ontap-rest-api/issues. For any questions or concerns, send an email to: [email protected], post on the community forums or connect with us through Slack.

To learn more about ONTAP REST APIs, visit https://devnet.netapp.com/restapi.php

ontap-rest-python's People

Contributors

bmrussell avatar dmp-netapp avatar jacobjohnanda avatar mahaganesan11 avatar noorbuchi avatar robertblackhart avatar simonschuang avatar unnatural940 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ontap-rest-python's Issues

Snapmirror relationship

Hello, palese is it possibile an example where I can specify source and destination cluster for snapmirror relationship?
The example you wrote cannot do it.

module 'base64' has no attribute 'encodestring' when running svm_operations.py

Encountered this error: Module 'base64' has no attribute 'encodestring' when running svm_operations.py

Located here:
ontap-rest-python/examples/rest_api/utils.py

I managed to get this fixed, but wanted to share my observation and ask you if the change I made is correct ?

[root@centos9 tmp]# python3.9 svm_operations.py -c x.x.x.x -u admin -p xxxx
Traceback (most recent call last):
File "/tmp/svm_operations.py", line 421, in
main()
File "/tmp/svm_operations.py", line 415, in main
headers = setup_connection(args.api_user, args.api_pass)
File "/tmp/utils.py", line 82, in setup_connection
base64string = base64.encodestring(
AttributeError: module 'base64' has no attribute 'encodestring'
[root@centos9 tmp]#

Googled, I found:
base64.encodestring() deprecated since Python 3.1. Use base64.encodebytes() instead.

I edited the utils.py file and change the code at Line: 82:

From,
base64string = base64.encodestring

To,
base64string = base64.encodebytes

It worked this time:
[root@centos9 tmp]# python3.9 svm_operations.py -c x.x.x.x -u admin -p xxxxx

Demonstrates SVM Operations using REST API:-

What SVM Operation would you like to do? [list/create/update/start/stop/delete] list

List of SVMs:-

svm_nfs

Wheel build is broken in a clean Python environment

Hi NetApp,

we need to build and compile from source and using netapp_ontap-9.14.1.0.tar.gz for that which fails with:

╭─ /tmp/netapp_original/netapp_ontap-9.14.1.0 
╰─$ python -m pip install --no-binary=":all:" --no-deps --compile --isolated --prefix=$PWD .
Processing /tmp/netapp_original/netapp_ontap-9.14.1.0
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      Traceback (most recent call last):
        File "/home/timotheus/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/timotheus/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/timotheus/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-1qdt_rr5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-1qdt_rr5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-1qdt_rr5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-1qdt_rr5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 9, in <module>
        File "/tmp/netapp_original/netapp_ontap-9.14.1.0/netapp_ontap/__init__.py", line 1889, in <module>
          from netapp_ontap.error import NetAppRestError
        File "/tmp/netapp_original/netapp_ontap-9.14.1.0/netapp_ontap/error.py", line 11, in <module>
          from netapp_ontap.response import NetAppResponse
        File "/tmp/netapp_original/netapp_ontap-9.14.1.0/netapp_ontap/response.py", line 8, in <module>
          import requests
      ModuleNotFoundError: No module named 'requests'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 23.3.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip

The setup.py defines correctly the needed build dependency with:

    install_requires=["marshmallow>=3.2.1", "requests>=2.26.0", "requests-toolbelt>=0.9.1", "urllib3>=1.26.7","certifi>=2022.12.7"],

but the build fails as it already needs requests during import netapp_ontap.

Here a simple workaround:

9d8
< import netapp_ontap
13c12
<     version=netapp_ontap.__version__,
---
>     version="9.14.1.0",
17c16
<     long_description=netapp_ontap.__doc__,
---
>     long_description="see netapp_ontap.__doc__",

Which results in a successful build without having requests installed beforehand.

Could you fix this on your side?

Regards
Timi

Python script for creating vserver cifs is missing some inputs?

Hi,

I am running the following vserver cifs create script from python scripts section. I noticed the script contains DNS inputs, but it's missing IP & routes.destination.address input strings to be able to setup CIFS through this script. Could you advise how could I add these bits into the script ?

root@centos9 /]# python3.9 svm_operations.py -c 192.168.0.xxx -u admin
Password:

Demonstrates SVM Operations using REST API:-

What SVM Operation would you like to do? [list/create/update/start/stop/delete] create
Enter the name of the SVM: smb3

Would you like to configure an Interface (y/n): n

Would you like to configure an NFS (y/n): n

Would you like to configure an CIFS (y/n): y
Enter the name of FQDN: smb3.test.com
Enter the User: administrator
Enter the password: xxxxxx
Enter the AD Name: WIN2K12R2

Would you like to configure an DNS (y/n): y
Enter the name of Domain: test.com
Enter the Server: 192.168.0.xx
{'name': 'smb3', 'language': 'c.utf_8', 'ipspace': {'name': 'Default'}, 'cifs': {'ad_domain': {'fqdn': 'smb3.test.com', 'password': 'xxxx', 'user': 'administrator'}, 'enabled': True, 'name': 'WIN2K12R2'}, 'dns': {'domains': ['test.com'], 'servers': ['192.168.0.xx']}}
{'error': {'message': 'When configuring a CIFS server on an SVM, "ip_interface.name", "dns.domains", "dns.servers" and "routes.destination.address" must be specified.', 'code': '13434895'}}
[root@centos9 /]#

Just continuing testing more sample scripts...some obstacles.

Hi,

Following 2 scripts gave me following errors:

[root@centos9 /]# python3.9 file_system_analytics.py --c x.x.x.x -u admin -p xxxxxx
Traceback (most recent call last):
File "//file_system_analytics.py", line 26, in
from utils import get_key_volumes, show_svm, show_volume
ImportError: cannot import name 'get_key_volumes' from 'utils' (/utils.py)

[root@centos9 /]# python3.9 nfs_setup.py -c x.x.x.x -u admin -p xxxxxx
Traceback (most recent call last):
File "//nfs_setup.py", line 26, in
from utils import setup_connection, get_size, get_key_svms, show_svm
ImportError: cannot import name 'get_key_svms' from 'utils' (/utils.py)

[root@centos9 /]# python3.9 cifs_setup.py -c x.x.x.x -u admin -p xxxxxx
Traceback (most recent call last):
File "//cifs_setup.py", line 160, in
main()
File "//cifs_setup.py", line 154, in main
headers = setup_connection(args.api_user, args.api_pass)
TypeError: setup_connection() missing 1 required positional argument: 'api_pass'

Thanks!

How can I list top 5 paths that a specific user consumes most for data storage?

Dear Sir/Madam,

We have would like to list out top 5 paths that a specific user consumes most for data storage to help user clean up their disk space.

It looks this might be the most relevant example script:
https://github.com/NetApp/ontap-rest-python/blob/master/examples/python_client_library/file_system_analytics.py

But just want to understand better how it works to solve our specific issue. I also appreciate it if you can add me to the slack channel as I noticed in other threads.

Thanks,

ImportError: cannot import name 'Argument' from 'utils' when running

Hi,

Sorry if it's a dumb question, I am new to python scripts. I am getting this errors when running sample scripts from repository.

ontap-rest-python/volume_operations.py at master · NetApp/ontap-rest-python · GitHub

Error:
File "//volume_operations.py", line 23, in
from utils import Argument, parse_args, setup_logging, setup_connection, get_size
ImportError: cannot import name 'Argument' from 'utils' (/usr/local/lib/python3.9/site-packages/utils/init.py)
[root@centos9 /]#

Many thanks!

Unable to use LocalCifsGroupMembers

Hello,

I try to use the LocalCifsGroupMembers class to associate local user(s) from an SVM to a local group (cifs workgroup).
Based on the documentation: https://library.netapp.com/ecmdocs/ECMLP2885777/html/resources/local_cifs_group_members.html#overview, I try to simply get information of members on my local group "cifs_group":

print(list(LocalCifsGroup.get_collection(fields="*", **{"svm.name": 'test_svm'})))
--> [LocalCifsGroup({'_links': {'self': {'href': 'xxxx'}}, 'name': 'SVM_TEST_01\\cifs_group', 'sid': 'S-1-5-21-1704451965-2597020852-3779635676-1001', 'svm': {'_links': {'self': {'href': 'xxxx'}}, 'name': 'test_svm', 'uuid': '60f0f740-cf56-11ee-a9e3-00a098a97a62'}})]

When I try to request the LocalCifsGroupMembers with group SID:
print(list(LocalCifsGroupMembers.get_collection("S-1-5-21-1704451965-2597020852-3779635676-1001")))

I got the following NetAppRestError:
Could not compute the location of the LocalCifsGroupMembers collection. Values for ['svm.uuid', 'local_cifs_group.sid'] are required. Caused by AttributeError("'LocalCifsGroupMembers' object has no attribute 'svm'")

I've tried to pass the SID from user in place of the group SID, the complete local group response object, svm.uuid and local_cifs_group.sid as parameters but I got always the same error....

Environment:
netapp-ontap 9.14.1.0
NetApp Release 9.11.1P12: Fri Sep 22 11:58:50 UTC 2023

Regards ^^

Using FileInfo does not work.

SCENARIO

Move a file from /alice/bob/bb.txt to /alice/bob/charlie/bb.txt using FileInfo

Docs and file_info.py line 972-985 suggest to rename a file as follows:

from netapp_ontap.host_connection import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo(
        "7da9eb81-6daa-4323-9eab-7bbce73da0f2", path="alice/bob/bb.txt"
    )
    resource.path = "alice/bob/charlie.txt"
    resource.patch()

EXPECTED BEHAVIOUR

File is renamed/ moved.

OBSERVED BEHAVIOUR

Caused by HTTPError('500 Server Error: Internal Server Error for url: https://server.domain:443/api/storage/volumes/7da9eb81-6daa-4323-9eab-7bbce73da0f2/files/%2Falice%2Fbob'): Failed to rename "/alice/bob" to 
"/alice/bob/charlie". Reason: Invalid argument

The library correctly identifies the change in path and forms the correct body for the patch but fails to append the file name to the URL. Resulting a REST call attempting to rename the parent directory of the file to the new filename and HTTP500 error.

ENVIRONMENT

netapp-ontap 9.13.1.0
Python 3.11.2

export policy on qtree broken with ontap 9.8

We have code that adds IP's to existing NFS export policies.

This has been running on ontap 9.7 with the 9.7 python library

We upgraded ontap to 9.8, and the API broke. We tried running it with the 9.7, 9.8.1 and 9.9 python libraries. Please take a look into why this API broke with the upgrade to OnTap 9.8

Code:
def getQtreeExportID(qtreeName):
print("Getting QTree Export Policy ID")
print("QTree Name: ", qtreeName)
qTreeList = list(Qtree.get_collection(fields="export_policy"))
for qTree in qTreeList:
if(qTree.name == qtreeName):
return qTree.export_policy.id

Output:
Getting QTree Export Policy ID
QTree Name: dev-qtree
Traceback (most recent call last):
File "./mount_nfs_v2.py", line 136, in
main(sys.argv[1:])
File "./mount_nfs_v2.py", line 129, in main
exportPolicyQtreeID = getQtreeExportID(qtreeName)
File "./mount_nfs_v2.py", line 32, in getQtreeExportID
return qTree.export_policy.id
File "/usr/local/lib/python3.6/site-packages/netapp_ontap/resource.py", line 195, in getattribute
) from None
AttributeError: The 'id' field has not been set on the ExportPolicy. Try refreshing the object by calling get().

QuotaReport from the python API takes a very (very) long time

Hi All,

I am using ontap-rest-python to query quota information from our NetAPP server.

I am basically just calling netapp_ontap.resources.QuotaReport.get_collection(type=type, max_records=500) with type=policy_usage and then type=users_quotas_users, and it takes about 0.1 seconds to read each quota record, which means that it will take me over an hour and a half to read the info for all our quotas.

Needless to say that the equivalent cli command, "volume quota report" takes only about 30 seconds to list all the quotas.

I googled up for similar issues and I can't find much. I did see somewhere that it was mentioned that the cause may be that the API actually queries the quota records one by one, so there are a lot of http requests being issues (and each as to be authenticated, etc.), but since I can no longer find that reference, I am not sure that this is the cause.

So is there something I can do to make the queries faster? Because otherwise this is really something you should fix

BR,

Oren

Python list_snapshots.py KeyError: 'records'

Hi,
I'm testing the use of the script list_snapshots.py in the LOD environment.
During the execution of the script, I have received this error:

[user@rhel1 rest_api]$ python list_snapshots.py -c cluster1.demo.netapp.com -v vol1_test2 -vs VS1 -u admin -p Netapp1!

Traceback (most recent call last):
File "list_snapshots.py", line 138, in
disp_snaps(
File "list_snapshots.py", line 75, in disp_snaps
snaps = tmp['records']
KeyError: 'records'

I know little about Python, please can you help me?

Thanks in advance.
Giacomo

Size field not available in Snapshot

I want to collect the list of snapshot along with its size. But under this api /api/storage/volumes/{volume.uuid}/snapshots, I couldn't find the size of the snapshot. Is there any other api to get the size?

issue with 9.8 Rest API when trying to configure SP IP address

Hi,
When trying to configure cluster using rest API in same cluster config call trying to configure SP ip Address getting error
when trying to configure with below IP
IP Address: 10.120.15.106
Netmask: 255.255.254.0
GW: 10.120.14.1

Failed to create node sp network with error: The gateway is not in the same subnet defined by IP address and subnet mask/prefix length.: Failed to create node sp network with error: The gateway is not in the same subnet defined by IP address and subnet mask/prefix length.

Unnecessary get() call in aggregate example

https://github.com/NetApp/ONTAP-REST-API/blob/8bbc8e4a0dcf19bbe41d998c271802ac08795381/ONTAP_REST_API_Python_Client_Library/list_aggregates_pcl.py#L29-L31

The get call on this line is unnecessary. The line should be deleted. The name field already comes back in the get_collection() call. If you wanted to print some other field that didn't come back by default, then you would just add it to the call: get_collection(fields="state")

The same is true in the Volume list example

Sample scripts not working in python3.9 (AttributeError: module 'base64' has no attribute 'encodestring')

Hi,
I tried to use the sample scripts on a new system that was updated with the actual python version 3.9. Here the scripts get the following error.
File "/Users/skellner/OneDrive - NetApp Inc/Repositories/ontap-rest-python/examples/rest_api/create_volume.py", line 153, in
base64string = base64.encodestring(
AttributeError: module 'base64' has no attribute 'encodestring'

With python 3.8 it still works but gets a warning:
./create_volume.py:153: DeprecationWarning: encodestring() is a deprecated alias since 3.1, use encodebytes()
base64string = base64.encodestring(

NTFS permissions through API

Hi,

We’re trying to build some automation, to offload the creation of volumes/shares to superusers, but we’re stuck at permissions.
Setting some standard AD groups in file-level permission seems impossible with the API, only share permissions can be set as far as I can see.

Also setting up audit on the CIFS share don’t seem possible.

We’re trying to replicate something like this, were using with the powershell toolkit:
#set ntfs permission on folder
$acl = Get-Acl \$net_svm$net_vol_share_name
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("DOMAIN\Netapp_SAN_Full_Administrator","FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")
$acl.SetAccessRule($AccessRule)
$acl | Set-Acl \$net_svm$net_vol_share_name

#remove ACL permission
$acl = Get-Acl \\$net_svm\$net_vol_share_name
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("Everyone","FullControl", "ContainerInherit, ObjectInherit", "None", "Allow") 
$acl.RemoveAccessRule($AccessRule)
$acl | Set-Acl \\$net_svm\$net_vol_share_name

AND audit:

  #Set Audit Permissions
  $AuditUser = "Everyone"
  $AuditRules = "ReadData,Delete,CreateFiles,DeleteSubdirectoriesAndFiles,ChangePermissions,Takeownership"
  $InheritType = "ContainerInherit,ObjectInherit"
  $AuditType = "Success,Failure"
  $AccessRule = New-Object System.Security.AccessControl.FileSystemAuditRule($AuditUser,$AuditRules,$InheritType,"None",$AuditType)

  $ACL = Get-Acl \\$net_svm\$net_vol_share_name
  $ACL.SetAuditRule($AccessRule)
  #Write-Host "Processing >",$TargetFolder
  $ACL | Set-Acl \\$net_svm\$net_vol_share_name

Is it possible to do this with the API or ontap-rest-python ?

Getting a single LUN mapping

Hi,

I am trying to retrieve a a LUN mapping resource for a single specific LUN.

get() on a LunMap with a filter which should only match a single entry results in an error:

mapresource = LunMap({'igroup.name': 'myig', 'lun.uuid': '8f27a86c-8c79-4d94-ab22-e86868954d5c'})
mrs = mapresource.get()
NetAppRestError: Received more than one record in the response LunMap.

And get_collection() results in a large amount of unrelated mappings:

mapresource = LunMap({'igroup.name': my'ig', 'lun.uuid': '8f27a86c-8c79-4d94-ab22-e86868954d5c'})
mrs = mapresource.get_collection()
print(len(list(mrs)))
41

Same results if using lun.name or even logical_unit_number:

mapresource = LunMap({'igroup.name': 'myig', 'lun.name': '/vol/lun_kvm_system/lun901'})
mrs = mapresource.get_collection()
print(len(list(mrs)))
41

mapresource = LunMap({'igroup.name': 'myig', 'logical_unit_number': '901'})
mrs = mapresource.get_collection()
print(len(list(mrs)))
41

I would expect to retrieve only one mapping result if a distinct filter is specified. Am I missing something?

Edit: this is against ONTAP 9.9 with the libraries netapp-lib 2021.6.25 and netapp-ontap 9.13.1.0.

Using cert security and "rest-role" am unable to manage Luns

After contacting NetApp technical support I was referred here.

Trying to do:

for i in Lun.get_collection( fields = 'lun_maps' ):

fails with:

netapp_ontap.error.NetAppRestError:  Caused by HTTPError('401 Client Error: Unauthorized for url: https://filer:443/api/storage/luns?fields=lun_maps',)

I have experience with the NetApp Manageability SDK, and in that it is possible to set a "vserver" for the queries. Is that possible with ontap-rest-python?

How is it possible to bind a cert user to a role that is only applied to a vserver?

It also appears I can only join the slack channel by invitation.

thanks,

-greg

syntax error in python_client_library list_volume.py

sh-4.4# ./list_volume.py -c cluster -u admin
Traceback (most recent call last):
File "./list_volume.py", line 24, in
from utils import Argument, parse_args, setup_logging, setup_connection
File "/repositories/ontap-rest-python/examples/python_client_library/utils.py", line 460
print("\033[%sB" % (self._lines_drawn - 1)).
^
SyntaxError: invalid syntax

the dot in the last line has to be removed

apache_scraper.py - add caller IP and user to report

The apache log scraper is great for customers that slowly want to transition from ZAPI to REST over a longer time period. They can use the date filter and run the report every once in a while, to make sure that there are no ZAPI calls left, and identify calls that fell through the cracks.

In the case of a larger customer with a bigger storage footprint and a lot of distributed automation, there could be a possibility of older scripts still being executed on an admin machine (e.g. self-made executables to provision volumes & shares).

To better identify those ZAPI calls, it would be great to add the caller IP and user to the report.
The data is already available in the apache logs.

I have created a version of the script that includes that. (may not be 100% perfect due to insufficient python/regex skills).
apache_scraper_incl_user_sourceip.txt

'failed to set field "ip_interfaces[0].location.broadcast_domain.name" to "Default_ckjfbvsnkfdjasbdkfsndlfe_cbekjrvckujeakbxjwc"'

Hi,

Encountered following error while running function 'create' under svm_operations.py. Rest all functions (list/update/start/stop/delete) working as expected.

Here, I am trying to create a SVM for NFS protocol.

[root@centos9 /]# python3.9 svm_operations.py -c 192.168.0.120 -u admin
Password:

Demonstrates SVM Operations using REST API:-

What SVM Operation would you like to do? [list/create/update/start/stop/delete] create
Enter the name of the SVM: nfs

Would you like to configure an Interface (y/n): y
Enter the name of Management LIF: nfs_mgmt
Enter the IP address: 192.168.0.40
Enter the NetMask: 255.255.255.0

List of Nodes:-

Node Name :- ontap991-01
Node UUID :- eb0b8287-5848-11ec-b300-000c2951836a
Enter the Home Node: ontap991-01
Enter the UUID: eb0b8287-5848-11ec-b300-000c2951836a

Would you like to configure an NFS (y/n): y
Would you like to configure an CIFS (y/n): n
Would you like to configure an DNS (y/n): n
{'name': 'nfs', 'language': 'c.utf_8', 'ipspace': {'name': 'Default'}, 'ip_interfaces': [{'ip': {'address': '192.168.0.40', 'netmask': '255.255.255.0'}, 'location': {'broadcast_domain': {'name': 'Default_ckjfbvsnkfdjasbdkfsndlfe_cbekjrvckujeakbxjwc'}, 'home_node': {'name': 'ontap991-01', 'uuid': 'eb0b8287-5848-11ec-b300-000c2951836a'}}, 'name': 'nfs_mgmt', 'service_policy': 'default-data-files'}], 'nfs': {'enabled': True}}
{'error': {'message': 'failed to set field "ip_interfaces[0].location.broadcast_domain.name" to "Default_ckjfbvsnkfdjasbdkfsndlfe_cbekjrvckujeakbxjwc"', 'code': '2', 'target': 'ip_interfaces[0].location.broadcast_domain.name'}}
[root@centos9 /]#

Could you help me resolving this error ?

Many thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.