UCSD Convert Variables from one type to another type (SP Identity to SP Name)

Version 5
    Task NameConverting Variables in UCSD
    Description
    Prerequisites
    1. Tested on 5.3
    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 examples shows ho to convert a generic Text to a VLAN ID variable.

     

     

    The custom task:

     

    Screen Shot 2015-05-18 at 1.38.27 PM.png

     

    The Generic Input Text:

     

    Screen Shot 2015-05-18 at 1.38.36 PM.png

     

    The VLAN ID output varaible:

     

    Screen Shot 2015-05-18 at 1.38.42 PM.png

     

     

     

    The Script in the Custom Task:

     

    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);

     

     

    var a1 = input.A;

    logger.addInfo("a1 ;  " + a1);

    output.A_Prime = a1;

     

     

    The use of the Custom task:

     

     

    The workflow:

     

    Screen Shot 2015-05-18 at 1.45.44 PM.png

     

    The input is generic text:

     

    Screen Shot 2015-05-18 at 1.46.17 PM.png

     

     

    Now using a task that has a VLAN ID as input the output of the custom task does show up:

     

    Screen Shot 2015-05-18 at 1.47.02 PM.png

     

    The workflow:

     

    Screen Shot 2015-05-18 at 1.50.12 PM.png

     

     

    The actual content of the variable may be another problem…

     

    So for example …

         If variable A has a content of A@B@C@D

         But variable B expects some format like D@B@A

         Then you would have to massage the input (A) to be of the expected format for variable (B).

     

    Tthere are usually two parts to this…

         1) Variable type

         2) Content of the variable..

     

    As to 1)

         https://communities.cisco.com/docs/DOC-56419

         #173

     

    As to 2)

         https://communities.cisco.com/docs/DOC-56419

         #229

         #282

         #123 (building of the vSwitch name buried in the code)