Software Development Kit (SDK) and API Discussions

Iterating over Events in DFM

TThaens24
2,862 Views

Hi all,

I'm running a OnCommand 5.1, and I'm using the nmsdk 5.0 (which is compatible with OnCommand 5.1 I was told), and I'm getting errors when trying to iter over the events.

I'm just doing a basic test:

Test.java

import com.netapp.nmsdk.client.ApiRunner;

import com.netapp.nmsdk.client.ApiTarget;

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

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

import com.netapp.nmsdk.dfm.api.event.*;

public class Test {

   private final static String DFMHOST    = "<my-IP>";

   private final static String USERNAME   = "<my-username>";

   private final static String PASSWORD   = "<my-password>";

   private final static Protocol PROTOCOL = Protocol.HTTP;

   public static void main(String[] args)

   {

       try

       {

          ApiRunner runner = new ApiRunner(ApiTarget.builder()

                .withHost(DFMHOST)

                .withUserName(USERNAME)

                .withPassword(PASSWORD)

                .withTargetType(TargetType.DFM)

                .useProtocol(PROTOCOL)

                .build());

           EventListIterStartRequest evtReq = new EventListIterStartRequest();

           Iterator<EventInfo> evtIter = runner.iterate(evtReq);

           EventInfo info = null;

           while(evtIter.hasNext())

           {

               info = evtIter.next();

           }

       }

       catch(Exception e)

       {

           e.printStackTrace();

           System.exit(1);

       }

   }

}

I also tried the same with hosts, aggregates, volumes, luns, and I had no issue there.

Here my compile.sh and run.sh scripts:

compile.sh

#!/bin/sh

LIB_PATH=../../lib/

RUNTIME_LIB=${LIB_PATH}/common/nmsdk-runtime-5.0.jar

API_LIB=${LIB_PATH}/DataFabric_Manager/dfm-api-5.0.jar:${LIB_PATH}/Data_ONTAP/ontap-api-8.1.jar

CLASSPATH=${RUNTIME_LIB}:${API_LIB}

echo Test..

/usr/java/jdk1.7.0_04/bin/javac -cp "${CLASSPATH}" Test.java

echo Done.

run.sh

#!/bin/sh

LIB_PATH=../../lib

RUNTIME_LIB=${LIB_PATH}/common/nmsdk-runtime-5.0.jar

GUAVA_LIB=${LIB_PATH}/external/guava-r08.jar

COMMONS_CODEC_LIB=${LIB_PATH}/external/commons-codec-1.4.jar

COMMONS_IO_LIB=${LIB_PATH}/external/commons-io-2.0.1.jar

COMMONS_LANG_LIB=${LIB_PATH}/external/commons-lang-2.6.jar

API_LIB=${LIB_PATH}/DataFabric_Manager/dfm-api-5.0.jar

CLASSPATH=bin:${RUNTIME_LIB}:${GUAVA_LIB}:${COMMONS_CODEC_LIB}:${COMMONS_IO_LIB}:${COMMONS_LANG_LIB}:${API_LIB}

#echo java -cp "${CLASSPATH}:." "$@"

/usr/java/jdk1.7.0_04/bin/java -cp "${CLASSPATH}:." Test "$@"

Here are the errors I'm getting:

com.netapp.nmsdk.ApiExecutionException: Invalid input value '0' for field is-deleted - does not conform to required format for boolean datatype

        at com.netapp.nmsdk.marshal.ApiReader.convertTextContentToPrimitiveObject(ApiReader.java:405)

        at com.netapp.nmsdk.marshal.ApiReader.readPrimitiveObject(ApiReader.java:237)

        at com.netapp.nmsdk.marshal.ApiReader.readFields(ApiReader.java:131)

        at com.netapp.nmsdk.marshal.ApiReader.readFields(ApiReader.java:95)

        at com.netapp.nmsdk.marshal.ApiReader.readTypedef(ApiReader.java:74)

        at com.netapp.nmsdk.marshal.ApiReader.readCollection(ApiReader.java:264)

        at com.netapp.nmsdk.marshal.ApiReader.readFields(ApiReader.java:146)

        at com.netapp.nmsdk.marshal.ApiReader.readResponse(ApiReader.java:342)

        at com.netapp.nmsdk.client.BeanXmlApiInvocation.createPassedResponse(BeanXmlApiInvocation.java:117)

        at com.netapp.nmsdk.client.BeanXmlApiInvocation.createPassedResponse(BeanXmlApiInvocation.java:70)

        at com.netapp.nmsdk.client.XmlApiInvocation.readResponse(XmlApiInvocation.java:197)

        at com.netapp.nmsdk.client.ApiInvocation.processResponse(ApiInvocation.java:218)

        at com.netapp.nmsdk.client.ApiInvocation.invoke(ApiInvocation.java:112)

        at com.netapp.nmsdk.client.XmlApiInvocation.invoke(XmlApiInvocation.java:40)

        at com.netapp.nmsdk.client.ApiRunner.run(ApiRunner.java:135)

        at com.netapp.nmsdk.client.ApiRunner.run(ApiRunner.java:105)

        at com.netapp.nmsdk.client.ApiIteratorSupport$StartNextEndStyleIterator.retrieveNextBatch(ApiIteratorSupport.java:240)

        at com.netapp.nmsdk.client.ApiIteratorSupport$ApiIterator.retrieveNextBatchIfNecessary(ApiIteratorSupport.java:125)

        at com.netapp.nmsdk.client.ApiIteratorSupport$ApiIterator.hasNext(ApiIteratorSupport.java:102)

        at Test.main(Test.java:44)

Any idea's on how to solve this?

Kind regards

2 REPLIES 2

aashray
2,862 Views

Hi,

I have looked into this and it looks like a bug in DFM.

I have filed a bug report with the DFM team for this.

I am currently trying to figure out a work around that you can use for now. Will let you know as soon as I have one.

Will let you know more about this once I hear from the DFM team.

Thanks and Regards

-Aashray

TThaens24
2,862 Views

Thanks, I would be nice to have this working.

Public