Data ONTAP APIs sample codes

You can use Data ONTAP APIs retrieve information about various NetApp storage system features, such as qtrees, quotas, volumes, LUNs, Snapshot, SnapMirror, and so on.

The following list describes the sample codes that demonstrate the use of a few Data ONTAP APIs. The list also provides links to view those codes.

 

 

Sample code in languages...

Name

Description

C

Perl

Java

C#

VB.NET

PoweShell

Python

Ruby

FlexClone

This sample code demonstrates how to create a clone for a flexible volume. It estimates the size, splits the clone, and shows the status.

flexclone.c

view

flexclone.pl

view

flexclone.java

view

-

-

-

 

flexclone.py

view

flexclone.rb

view

Quota listing

This sample code demonstrates how to list the quota available on a storage system.

quotalist.c

view

quotalist.pl

view

quotalist.java

view

-

-

-

 

quotalist.py

view

quotalist.rb

view

Snapshot

This sample code shows how to manage Snapshot copies.

It demonstrates how to create a Snapshot copy, rename it, and delete it. The sample code also demonstrates how to get Snapshot copy lists and schedules.

snapman.c

view

snapman.pl

view

-

snapman.cs

view

snapman.vb

view

snapman.ps1

view

snapman.py

view

snapman.rb

view

SNMP

This sample code describes how to use the SNMP API. The following actions are performed with this sample code:

  • Adding new SNMP community

  • Deleting specific SNMP community

  • Deleting all SNMP communities

  • Disabling SNMP interface

  • Enabling SNMP interface

  • Obtaining SNMP get for specific OID

  • Obtaining SNMP getnext for specific OID

  • Getting SNMP Status

  • Disabling Traps

  • Enabling Trap

  • Adding Trap Host

  • Deleting Trap Host

snmp.c

view

snmp.pl

view

snmp.java

view

-

-

-

 

snmp.py

view

snmp.rb

view

Consistency Group

This sample code shows how to manage a consistency group, that is how to start and commit a consistency group.

cg_operation.c

view

cg_operation.pl

view

-

-

-

-

 

cg_operation.py

view

cg_operation.rb

view

Volume List

This sample code lists the volumes that are available on a storage system.

vollist.c

view

print_volume.pl

view

vollist.java

view

vollist.cs

view

vollist.vb

view

vollist.ps1

view

print_volume.py

view

print_volume.rb

view

MAC address List

This sample code shows a list of IP addresses and the corresponding MAC addresses.

getmac.c

view

-

-

-

-

-

 

 

-

Option List

This sample code shows a list of the options and demonstrates the use of the following functions:

  • Listing all the options

  • Getting the value of a particular option

  • Setting the value of a particular option

optmgmt.c

view

optmgmt.pl

view

optmgmt.java

view

optmgmt.cs

view

optmgmt.vb

view

optmgmt.ps1

view

optmgmt.py

view

optmgmt.rb

view

SnapMirror

This code demonstrates the management of SnapMirror operations.

sm.cpp

view

snapmirror.pl

view

snapmirror.java

view

-

-

-

snapmirror.py

view

 

snapmirror.rb

view

Symlink

This is a sample code for symbolic links from Windows. It demonstrates the use of the following functions:

  • Creating a symlinkfile-create-symlink

  • Reading the content of a symlinkfile-read-symlink

symlink.c

view

-

-

-

-

-

 

-

Volume Monitor

This sample code shows how to monitor a volume on a storage system.

-

monitor_volume.pl

view

-

-

-

-

monitor_volume.py

view

 

monitor_volume.rb

view

qtree

This sample code creates a qtree on a specified volume and adds a quota entry.

-

qtree_quota.pl

view

-

-

-

-

qtree_quota.py

view

 

qtree_quota.rb

view

vFiler

This sample code demonstrates how to create, destroy, and list vFiler units on the storage system.

vfiler.c

view

vfiler.pl

view

vfiler.java

view

-

-

-

vfiler.py

view

 

vfiler.rb

view

vFiler Tunnelling

This sample code demonstrates how to invoke Data ONTAP APIs on a vFiler through the physical storage system.

vfiler_tunnel.c

view

vfiler_tunnel.pl

view

vfiler_tunnel.java

view

vfiler_tunnel.cs

view

vfiler_tunnel.vb

view

vfiler_tunnel.ps1

view

vfiler_tunnel.py

view

 

vfiler_tunnel.rb

view

Unified Capacity Management

This sample code demonstrates the usage of Data ONTAP APIs for capacity management of NetApp storage systems.

It demonstrates the following function:

  • Calculating the total installed capacity of the systemraw-capacity

  • Calculating the total formatted capacity of the systemformatted-capacity

  • Calculating the total space reserved for the volume and the space used by nonreserved dataallocated-capacity

  • Calculating the total capacity available for user dataavailable-user-data-capacity

  • Calculating the usable space for provisioningprovisioning-capacity

  • Calculating the total capacity in RAID overhead and WAFL overheadraid-overhead and wafl-overhead

unified_capacity_mgmt.c

view

unified_capacity_mgmt.pl

view

-

-

-

-

 

unified_capacity_mgmt.py

view

unified_capacity_mgmt.rb

view

User administration

This sample code demonstrates how to add, modify. and list the user administration capabilities using Data ONTAP APIs

It demonstrates the following functions:

  • Adding a new user to a group with  defined capabilitiesuser-add

  • Modifying the user with allowed-capability and group-info valuesuser-modify

  • Listing the administrative users with allowed-capabilities and group-informationuser-list

  • Adding a new role with allowed capabilitiesrole-add

  • Modifying a user rolerole-modify

  • Listing information about all roles on the systemrole-list

  • Adding a new group with allowed capabilitiesgroup-add

  • Listing information about all the groups in the systemgroup-list

useradmin.c

view

-

-

-

-

-

-

-

Performance Operation

This sample code demonstrates the use of some of the perf family APIs. The sample code lists the system-wide performance objects, the counters for a given performance object, the object instances for a given object, and also provides values for counters of a given performance object.

perf_operation.c

view

perf_operation.pl

view

perf_operation.java

view

perf_operation.cs

view

perf_operation.vb

view

perf_operation.ps1

view

perf_operation.py

view

perf_operation.rb

view

NFS

This sample code demonstrates the use of some of the NFS family API. The sample code enables you to start, stop, and query the status of the NFS service. It also lists the current NFS export rules.

nfs.c

view

nfs.pl

view

nfs.java

view

nfs.cs

view

nfs.vb

view

nfs.ps1

view

nfs.py

view

nfs.rb

view

File SnapLock

This sample code demonstrates how to get the retention time and how to set the retention for SnapLock files.

file_snaplock.c

view

file_snaplock.pl

view

file_snaplock.java

view

-

-

-

file_snaplock.py

view

file_snaplock.rb

view

SAN Management

This sample code demonstrates the following functions:

  • Creating, deleting, and listing LUN clone

  • Mapping and unmapping LUNs

  • Creating, deleting, and listing igroups

  • Configuring FCP and iSCSI

san_mgmt.c

view

san_mgmt.pl

view

-

-

-

-

 

san_mgmt.py

view

 

san_mgmt.rb

view

 

Sample codes for Data ONTAP Cluster-Mode:

Name

Description

C

Perl

Java

C#

VB.NET

Python

Data ONTAP mode

This sample code finds out whether Data ONTAP is 7-Mode or Cluster-Mode

-

-

system_mode.java

view

-

-

system_mode.py

view

Volume list

This sample code lists the volumes that are available on a storage system .

vollist.c

view

vollist.pl

view

vollist.java

view

 vollist.cs

view

vollist.vb

view

-

Vserver

This sample code demonstrates how to manage a Vserver in Data ONTAP Cluster-Mode. It demonstrates the following functions:

  • Listing Vservers

  • Adding aggregates

  • Creating new volumes

  • Configure LIFs, NFS service, NIS domain and export rules for a Vserver

-

vserver.pl

view

vserver.java

view

-

-

-

Vserver list

This sample code demonstrates howto lists all or few Vservers on a Data ONTAP Cluster-Mode.

vserverlist.c

view

vserverlist.pl

view

vserverlist.java

view

vserverlist.cs

view

vserverlist.vb

view

-

Vserver tunneling

This sample code demonstrates how to use Vserver tunneling

-

-

vserver_tunnel.java

view

-

-

vserver_tunnel.py

view