cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1131
Views
1
Helpful
0
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee
Task NameNetApp Aggregate Percentage Used Report  (Checker)
Description
Prerequisites
  1. Tested on 5.3.1
CategoryWorkflow
ComponentsvSphere 5.x
User Inputs

Instructions for Regular Workflow Use:

  1. Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
  2. Unzip the file on your computer. Should end up with a .WFD file.
  3. Log in to UCS Director as a user that has "system-admin" privileges.
  4. Navigate to "Policies-->Orchestration" and click on "Import".
  5. Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
  6. Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
  7. Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
  8. Click "Submit".
  9. A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.

This custom workflow will extract the percentage used out if a NetApp aggregate to be used in the deployment of a NetApp LUN/Vol.

The workflow integrated as a compound workflow:

Screen Shot 2015-06-29 at 12.09.20 PM.png

The Run:

Screen Shot 2015-06-29 at 12.02.28 PM.png

The variable in the sub workflow:

Screen Shot 2015-06-26 at 8.19.41 AM.png

The variable coming from the compound workflow:

Screen Shot 2015-06-29 at 11.46.24 AM.png

The If Statement:

Screen Shot 2015-06-29 at 12.09.37 PM.png

Screen Shot 2015-06-29 at 12.10.00 PM.png

The workflow:

Screen Shot 2015-06-29 at 12.51.09 PM.png

Things that need to be changed in the workflow:

Screen Shot 2015-06-29 at 12.51.16 PM.png

The Report Screen that is used in this custom report:

Screen Shot 2015-06-23 at 11.09.42 AM.png

The java script:

importPackage(java.util);

importPackage(java.lang);

importPackage(java.io);

importPackage(com.cloupia.model.cEvent.notify);

importPackage(com.cloupia.model.cIM);

importPackage(com.cloupia.lib.util.mail);

importPackage(com.cloupia.fw.objstore);

importPackage(com.cloupia.lib.util.managedreports);

importPackage(com.cloupia.model.cIM);

importPackage(java.util);

importPackage(java.lang);

importPackage(java.io);

importPackage(com.cloupia.lib.util);

importPackage(com.cloupia.model.cIM);

importPackage(com.cloupia.service.cIM.inframgr);

importPackage(org.apache.commons.httpclient);

importPackage(org.apache.commons.httpclient.cookie);

importPackage(org.apache.commons.httpclient.methods);

importPackage(org.apache.commons.httpclient.auth);

importPackage(com.cloupia.model.cEvent.notify);

importPackage(com.cloupia.lib.util.mail);

importPackage(com.cloupia.fw.objstore);

importPackage(com.cloupia.lib.util.managedreports);

function getReport(reportContext, reportName)

{

     var report = null;

      try

      {

             report = ctxt.getAPI().getConfigTableReport(reportContext, reportName);

      } catch(e)

      {

      }

      if (report == null)

      {

             return ctxt.getAPI().getTabularReport(reportName, reportContext);

      } else

     {

           var source = report.getSourceReport();

           return ctxt.getAPI().getTabularReport(source, reportContext);

     }

}

function getReportView(reportContext, reportName)

{

      var report = getReport(reportContext, reportName);

     if (report == null)

     {

           logger.addError("No such report exists for the specified context "+reportName);

           return null;

     }

     return new TableView(report);

}

importPackage(java.lang);

importPackage(java.util);

importPackage(com.cloupia.model.cIM);

importPackage(com.cloupia.service.cIM.inframgr);

function getTabularReport(contextName , contextValue , reportId ){

try {

var tabularReport = ctxt.getAPI().userAPIGetTabularReport(contextName, contextValue,reportId);

return tabularReport;

} catch(e){

logger.addError("Error : "+e.message);

}

}

//var contextName = "445"; //param0

//var contextValue = "1;org-root;org-root/ls-UCSD_test1"; //param1

//var reportId = "VNICS-T50";//param2

//var report = getTabularReport(contextName , contextValue , reportId );

//var numRowsFound = report.getRowCount();

//logger.addInfo("Number of Rows found: " + numRowsFound);

var ContextSelector1 = input.ContextSelector;

var NonGlobalContextSelector1 = input.NonGlobalContextSelector;

var ReportLabel1 = input.ReportLabel;

var report = getTabularReport(ContextSelector1 , NonGlobalContextSelector1 , ReportLabel1 );

var SearchColumn1 = input.SearchColumn;

var SearchValue1 = input.SearchValue;

logger.addInfo("Looking for SearchValue1...............: " + SearchValue1);

var Column1 = input.col1

var Column2 = input.col2

var Column3 = input.col3

var Column4 = input.col4

var Column5 = input.col5

var Column6 = input.col6

var Column7 = input.col7

//var reportName  = "CONFIG_PER_CLOUD_VMWARE_RESOURCE_POOLS";

//var reportName  = ReportLabel1;

//var repContext  = util.createContext("global", null, null);

//var repContext  = util.createContext("cloud", CloudSelector1, null);

//var repContext  = util.createContext(ContextSelector1, NonGlobalContextSelector1, null);

//var report = getReportView(repContext, reportName);

var Foundit = 0;

var numRowsFound = report.getRowCount();

logger.addInfo("Number of Rows found: " + numRowsFound);

//for (var i=0; i<report.rowCount(); i++)

for (var i=0; i<report.getRowCount(); i++)

{

   if ( Foundit === 0 )  // Looking for the first occurance of search

   {

      var tokens;

      var array1 = new ArrayList();

      var row = report.getRow(i);

      var line = new String(row);

      logger.addInfo("row : " + row);

      var tokens = line.split(",");

      if(tokens != null && tokens.length > 0){

             array1.add(tokens);

      }

      var ListSize = array1.size();

      logger.addInfo("ListSize : " + ListSize);

      var details = array1.iterator();

      while(details.hasNext()){

  var arr = details.next();

  logger.addInfo("A0 : "+arr[0]);

  logger.addInfo("A1 : "+arr[1]);

  logger.addInfo("A2 : "+arr[2]);

  logger.addInfo("A3 : "+arr[3]);

  logger.addInfo("A4 : "+arr[4]);

  logger.addInfo("A5 : "+arr[5]);

  logger.addInfo("A6 : "+arr[6]);

  logger.addInfo("A7 : "+arr[7]);

  logger.addInfo("A8 : "+arr[8]);

  logger.addInfo("A9 : "+arr[9]);

  logger.addInfo("A10 : "+arr[10]);

  logger.addInfo("A11 : "+arr[11]);

  logger.addInfo("A12 : "+arr[12]);

  logger.addInfo("A13 : "+arr[13]);

  logger.addInfo("A14 : "+arr[14]);

  logger.addInfo("A15 : "+arr[15]);

  logger.addInfo("A16 : "+arr[16]);

  logger.addInfo("A17 : "+arr[17]);

       }

//     var col1 = report.getColumnValue(i, Column1);

//     var col2 = report.getColumnValue(i, Column2);

//      var col3 = report.getColumnValue(i, Column3);

//      var col4 = report.getColumnValue(i, Column4);

//      var col5 = report.getColumnValue(i, Column5);

//      var col6 = report.getColumnValue(i, Column6);

//      var col7 = report.getColumnValue(i, Column7);

      //var Result1 = report.getReport().getRows()[i].getCells()[3].getValue();

      logger.addInfo("-------------------------------------");

      logger.addInfo("Iteration : " + i  );

      logger.addInfo("-------------------------------------");

//      logger.addInfo("Col1 : " + col1);

//      logger.addInfo("Col2 : " + col2);

//      logger.addInfo("Col3 : " + col3);

//      logger.addInfo("Col4 : " + col4);

//      logger.addInfo("Col5 : " + col5);

//      logger.addInfo("Col6 : " + col6);

//      logger.addInfo("Col7 : " + col7);

//SearchColumn1

logger.addInfo("SearchColumn1........ : " + SearchColumn1);

        var SC1 = arr[SearchColumn1];

        var SC2 = " " + SearchColumn1 + "=" + SearchValue1;

        logger.addInfo("SC1...............: >" + SC1 + "<");

        logger.addInfo("SC2...............: >" + SC2 + "<");

logger.addInfo("SC1...............: >" + String(SC1).valueOf() + "<");

logger.addInfo("SC2...............: >" + String(SC2).valueOf() + "<");

var SC3 = SC1.split("=",2);

logger.addInfo("SC3*...............: >" + SC3[0] + "<");

logger.addInfo("SC3*...............: >" + SC3[1] + "<");

logger.addInfo("SC3*...............: >" + String(SC3[1]).valueOf() + "<");

var SC4 = SC2.split("=",2);

logger.addInfo("SC4*...............: >" + SC4[0] + "<");

logger.addInfo("SC4*...............: >" + SC4[1] + "<");

logger.addInfo("SC4*...............: >" + String(SC4[1]).valueOf() + "<");

//if ( SC1 == SC2 )

//      if ( new String(SC2).valueOf() == new String(SC1).valueOf() )

      if ( new String(SC4[1]).valueOf() == new String(SC3[1]).valueOf() )

      {

         logger.addInfo("Found..............: " + SC2);

         output.ReturnStatus = 0;

         output.c1 = arr[1];

         output.c2 = arr[2];

         output.c3 = arr[3];

         output.c4 = arr[4];

         output.c5 = arr[5];

         output.c6 = arr[6];

         output.c7 = arr[7];

         output.c8 = arr[8];

         output.c9 = arr[9];

         output.c10 = arr[10];

         output.c11 = arr[11];

         var a1 = arr[11].split("=");

         output.c12 = a1[1];

         Foundit = 1;

      }

      else

      {

         logger.addInfo("No match...............");

         output.ReturnStatus = 1;

      }

   }

}

Side Note when comparing Global Variables and task output:

     Variable format:

          ${custom_Custom_SSH_Command_Task_v1_3421.STD_OUT} >= CriticalDiskUsage


ifthenelseexampleswrong1.png


iftheelseexampleswrong2.png

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links