UCSD - Check Network Specific TCP Port on Host

Version 3
    Task NameTest is a host is listening on a specific port
    1. Tested on 6.0
    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.

    Thank you goes to:   Phani Penmethsa


    The workflow:


    Screen Shot 2016-12-07 at 9.43.50 AM.png


    Workflow Import:

    Screen Shot 2016-12-07 at 9.34.08 AM.png


    Workflow location:

    Screen Shot 2016-12-07 at 9.34.23 AM.png


    Input for custom task:

    Screen Shot 2016-12-07 at 9.35.23 AM.png


    Workflow run when Device is listening:

    Screen Shot 2016-12-07 at 9.36.30 AM.png


    Workflow run when Device is not listening:

    Screen Shot 2016-12-07 at 9.41.12 AM.png


    Screen Shot 2016-12-07 at 9.41.25 AM.png


    The custom task code:







    function isReachable(count)




                  var s = new Socket(input.ipAddress, input.tcpPort);


                  return true;

              } catch(e)


                    if (count == 0)


                          logger.addDebug("IP Address "+input.ipAddress +":"+ input.tcpPort + " not reachable");


                    return false;





    var start = System.currentTimeMillis();

    var stopTime = start + input.maxWaitSeconds * 1000;



    var count  = 0;

    while (System.currentTimeMillis() < stopTime)


           if (isReachable(count) === true)


                 logger.addInfo("Device is reachable");





           if (count === 3)


                 count = 0;








    ctxt.setFailed("Maximum wait time exceeded for device");