UCSD - NetApp CLI Execution with variable dissection (Chopping)

Version 4
    Task NameNetapp cli execution with variable chopping



    Minimum UCSD version:

    CategoryCustom task
    User Inputs


    User OutputNetapp filer and cli command

    Instructions for Regular Workflow Use:

    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.





    A thank you goes out to: Abhilash Pujari


    The workflow:


    Screen Shot 2016-01-27 at 8.42.23 AM.png


    Previous output is input:

    Screen Shot 2016-01-27 at 8.42.11 AM.png


    Previous output is input in task:


    Screen Shot 2016-01-27 at 8.48.08 AM.png


    Example of variable disassembly:

    Screen Shot 2016-01-27 at 8.41.27 AM.png


    The workflow execution:



    Screen Shot 2016-01-27 at 8.41.39 AM.png


    The variable name:


    Screen Shot 2016-01-27 at 7.48.26 AM.png

    Other chopping options for the code (sort):


    var vss1 = selection.split("online");

    var vss = vss1.sort();



    Custom task to extract the SR information:





    // Auto generated to code invoke following task

    // Task Label:  Execute NetApp CLI

    // Task Name:  Execute NetApp CLI



    function Execute_NetApp_CLI_()


        var task = ctxt.createInnerTaskContext("Execute NetApp CLI ");



        // Input 'Filer Identity Name', mandatory=true, mappableTo=filerIdentity

        task.setInput("Filer Identity Name", input.filerName);



        // Input 'CLI Command', mandatory=false, mappableTo=gen_text_input

        task.setInput("CLI Command", input.inputCommand);



        // Input 'Expected Output', mandatory=false, mappableTo=gen_text_input

        task.setInput("Expected Output", input.expectedOutput);



        // Input 'Undo CLI Command', mandatory=false, mappableTo=gen_text_input

        task.setInput("Undo CLI Command", input.undoCLICommand);





        // Now execute the task. If the task fails, then it will throw an exception












    function getOutput(){

    var srId = ctxt.getSrId();

      //var srId = Integer.parseInt(input.SR_ID);

      //var severityLevels = input.SeverityLevels;

        logger.addInfo("SrId is:"+srId);

        var severityLevel = 1;

      var SRLogsList = getSRLogs(srId,severityLevel);

      if(SRLogsList == null || SRLogsList.isEmpty()){

      logger.addWarn("There is no SR LOGS.....");


      for(var i=0;i<SRLogsList.size();i++){

      var logEntry = SRLogsList.get(i);

      var sr_Id = logEntry.getSrId();

      var severity = logEntry.getSeverity();

      var message = logEntry.getMessage();


      var taskOutput = getRequiredOutputFromLoggerMessage(message);


      output.taskOutput = taskOutput;


      //logger.addInfo("SrId:"+sr_Id+"  severity:"+ severity+"   Message:"+message);



    function getSRLogs(srId,severityLevel){



      var entryList = SRLogUtil.getSRLogs(srId,severityLevel);

      return entryList;


    function getRequiredOutputFromLoggerMessage(outputFormat){

    //Here we can fetch the exact info from the output.

    return outputFormat;


    function main(){

    // Invoke the task




    logger.addInfo("Output of task is:"+output.taskOutput)


    // Invoke the main function