Software Development Kit (SDK) and API Discussions

how to get information of Disks and Aggregates using ontap api 8.1 and nmsdk 5.1?

VISHWASTALULE
2,848 Views

I want to get information about disks and aggregates using api classes.

For getting information about aggregate I used AggrListInfoRequest class, but didn't get anything as a output?

here is my code:

import com.netapp.nmsdk.client.ApiRunner;

import com.netapp.nmsdk.client.ApiTarget;

import com.netapp.nmsdk.client.ApiTarget.Protocol;

import com.netapp.nmsdk.client.ApiTarget.TargetType;

import com.netapp.nmsdk.common.api.annotation.IterStartAPIRequest;

import com.netapp.nmsdk.common.api.annotation.IterStartAPIResponse;

import com.netapp.nmsdk.ontap.api.volume.DiskInfo;

import com.netapp.nmsdk.ontap.api.volume.VolumeInfo;

import com.netapp.nmsdk.ontap.api.volume.VolumeListInfoIterStartRequest;

//import com.netapp.nmsdk.dfm.api.lun.LunInfo;

import com.netapp.nmsdk.ontap.api.lun.*;

import com.netapp.nmsdk.ontap.api.aggr.*;

import com.netapp.nmsdk.ontap.api.disk.*;

import com.netapp.nmsdk.ontap.api.lun.LunListInfoRequest;

import java.util.Iterator;

import java.util.List;

public class RunStorage {

          /**

           * Constructor

           */

          public RunStorage() {

                    // TODO Auto-generated constructor stub

          }

 

          public void startStorage(){

                    //NaServer na;

 

                    System.out.println("in start storage class");

          }

 

          public static void main (String [] args){

                    //Attempt to connect to host and get basic info.

                    String myip= "192.xxx.xxx.xxx";

                    String url = "https://"+myip;

 

                    Protocol protocol = Protocol.INSECURE_HTTPS;

                    try {

                              System.out.println("url is .." + url);

                              ApiRunner apirunner = new ApiRunner(ApiTarget.builder()

                                        .withHost(myip)

                                        .withUserName("uname")

                                        .withPassword("pwd")

                                        .withTargetType(TargetType.FILER)

                                        .useProtocol(protocol)

                                        .build()

                              );

AggrListInfoRequest aggrReq = new AggrListInfoRequest();

//I get error in following line ..

Iterator <AggrInfo> aggrIter = apirunner.iterate(aggrReq,10);

}catch (Exception e) { }

How should I handle the request object to get information???

1 REPLY 1

zulanch
2,848 Views

You have the same problem here as in your other post. AggrListInfoRequest is not an iterator API, so you need to use ApiRunner.run() instead of ApiRunner.iterate().

-Ben

Public