NetApp Storage Device

SMI-S Support

Initially, EMC is the leading market player providing remote infrastructure management devices. Later, NetApp came up with an idea to solve scratch level problems with storage devices. As the trend goes on, with the initiation of SNIA organization, Storage Management Initiative Specification (SMI-S) which provides vendor neutral platform to manage storage devices.

Procedure to manage NetApp storage device using SMI-S:

We need to install SMI-S Provider before we move on. We query this SMI-S Provider to get the data from the storage device. When we query the SMI-S Provider, it communicates with the storage device and gets required data for us. To query the SMI-S Provider we need to prepare Java Beans.

Questions been asked:

Is there any way to directly get Java Beans to support SMI-S for NetApp Storage Device?
How to query Google first to get the necessary help?
Answer is, looks like there are some handful resources but nothing of them makes me feel great.
Here is my effort to make this article a feel good factor for everyone.

Research and Development: (RnD)

I don’t think installing SMI-S Provider is a big deal. Just double click on the respective .exe file. Now, go to the installation directory and search for the zip folder named agent_mof.  Extract it and go through the files content to analyze the device. You will find the .mof files there. You can generate beans from these .mof files.

Related Terminology: If you don’t want just skip it and directly enter into program

Cloud Service Provider (CSP):

Cloud Service Provider offers software or storage services. Those services are made available using public or private cloud.

Remote Infrastructure Management (RIM):

Remote Infrastructure Management is managing small to big devices remotely. It allows IT teams concentrate on strategic goals rather than managing IT operations

Storage Device:

As the name suggests, Storage Device is nothing but an equipment capable of storing huge information in it.

MOF File:

Managed Object Format file is the description for Java classes and instances. It is format Unicode or UTF-8.

Take for example, MOF File named ontap_battery.mof

Java Code to prepare Java class for this MOF file:

package moftobean.netapp;
import java.util.HashMap;
import java.util.StringTokenizer;

public class JavaBeanMOF {
  * @param args
 public static void main(String[] args) {
 try {
  int i;
  FileOutputStream fout = null;
  File f2;
  File f = new File("D:/SVNSTSWorkspace/NetApp Bean Generator/src/moftobean/netapp/ontap_battery.mof");
  // folder name that the bean files will reside in a package
  String namespace = "netapp"; 
  FileReader fin = new FileReader(f);
  BufferedReader bin = new BufferedReader(fin);
  String line = null;
  HashMap <string string=""> map = new HashMap<string string="">();
  while((line = bin.readLine()) != null) { 
   if(line.trim().startsWith("class")) {
    if(map.get(line) == null) {
     map.put(line, line);
     String cname = line.split(" ")[1];
     String name = "D:/SVNSTSWorkspace/NetApp Bean Generator/src/moftobean/netapp/" + cname + ".java";
     String packagePath = "package moftobean." + namespace + ";\n\n";
     f2 = new File(name);
     fout = new FileOutputStream(f2);
     i = 0;
     if(line.contains(":")) {
      //separate’s tokens based on space and colon
      StringTokenizer st = new StringTokenizer(line,"[ :]");  
      String[] tokenlist = new String[st.countTokens()];
      while (st.hasMoreTokens()) {
       tokenlist[i] = st.nextToken();
      String str1;
      if(tokenlist[1].startsWith("ONTAP_") || tokenlist[3].startsWith("CIM_")) {
      str1 = "public "+tokenlist[0]+" "+tokenlist[1]+" "+"extends"+" "+tokenlist[2]+" {";
   if(line.trim().endsWith(";") &amp;&amp; !line.trim().startsWith("}")) {
    String[] tokens = line.trim().split(" ");
    if(tokens.length == 2) {
     for(String token: tokens) {
      if(token.trim().equalsIgnoreCase("string")) {
       line = "String ";
      } else if(token.trim().equalsIgnoreCase("uint16")) {
       line = "UnsignedInteger16 " ;
      // continue if you have more variable types in MOF file
      if(token.trim().endsWith(";")) {
       line = line+token;
    fout.write((line + "\n").getBytes());
   if(line.trim().startsWith("}") &amp;&amp; line.trim().endsWith(";")) {
    fout.write(("}" + "\n").getBytes());

 } catch(Exception e) { e.printStackTrace(); }

Output: Two Java files are generated with the respective names.

package moftobean.netapp;

public class ONTAP_Battery extends CIM_Battery {
String SystemCreationClassName;
String SystemName;
String CreationClassName;
String DeviceID;
String Description;
String ElementName;
UnsignedInteger16 BatteryStatus;

package moftobean.netapp;

public class ONTAP_StorageSystemBattery extends CIM_SystemDevice {
      ONTAP_StorageSystem REF GroupComponent;
      ONTAP_Battery REF PartComponent;

Now, using the output files you can generate bean(setters and getters) using eclipse IDE.

The generated output files shows errors. No need worry about them. Just create CIM_SystemDevice and CIM_Battery as empty. They need to be there because “ONTAP_” classes extends “CIM_”

And add cim-2.0.0.jar to the class path to resolve data type support errors.

This code is confined to the ONTAP_Battery.mof. Had to change to support all other .mof files if needed.

Variables uint6, string are same as UnsignedInteger16, String variables in Java language. Googling will get you complete list of mapping between CIM Element and Java Element. You will find them in oracle site.

MOF file is not provided here due to some reasons. You can work through the example as MOF files can be found in any windows system. Just type ext:mof in your search box.

In the above program, namespace variable value is initialized as netapp. For the NetApp Device, the namespace for the SMI-S provider is root/ontap. For your information ONTAP is the operating system name for the NetApp device. 


Post a Comment