Introductory UCS Director REST API, Custom Tasks and Workflow Creation Part III Cisco DevNet Learning Labs

Overview

Cisco UCS Director is a complete, highly secure, end-to-end management, orchestration, and automation solution for a wide array of Cisco and non-Cisco data center infrastructure components, and for the industry's leading converged infrastructure solutions based on the Cisco UCS and Cisco Nexus platforms. For a complete list of supported infrastructure components and solutions, see the Cisco UCS Director Compatibility Matrix.

Cisco UCS Director is a 64-bit appliance that uses the following standard templates:

  • Open Virtualization Format (OVF) for VMware vSphere
  • Virtual Hard Disk (VHD) for Microsoft Hyper-V

Cisco UCS Director extends the unification of computing and network layers through Cisco UCS to provide you with comprehensive visibility and management of your data center infrastructure components. You can use Cisco UCS Director to configure, administer, and monitor supported Cisco and non-Cisco components. The tasks you can perform include the following:

  • Create, clone, and deploy service profiles and templates for all Cisco UCS servers and compute applications.
  • Monitor organizational usage, trends, and capacity across a converged infrastructure on a continuous basis.
  • Deploy and add capacity to converged infrastructures in a consistent, repeatable manner.
  • Manage, monitor, and report on data center components, such as Cisco UCS domains or Cisco Nexus network devices.
  • Extend virtual service catalogs to include services for your physical infrastructure.
  • Manage secure multi-tenant environments to accommodate virtualized workloads that run with non-virtualized workloads.

Objective

The objective of this introductory UCS Director REST API learning lab is to create a custom task that contains JavaScript, use the custom task in a workflow and execute the workflow from the UCS Director interface and from Postman using a UCS Director REST API call.

Completion time: 30 minutes

Prerequisites

Prior to starting this learning lab it would be helpful to understand UCS Director and the functionality that it provides.

An understanding of REST APIs and the utilization of Postman REST client, would also be helpful.

UCS Director REST API

Cisco UCS Director REST API is a language-independent interface that can be used by any program or script capable of making HTTP or HTTPS requests. Use the REST API when you want to invoke operations on Cisco UCS Director from a separate program or process.

Applications can use the REST API to do the following:

  • Retrieve Cisco UCS Director reports on physical and virtual devices, networks, appliances, groups and users, policies, resource accounting, funds, and other monitored entities within your Cisco UCS domains.
  • Invoke Cisco UCS Director Orchestrator workflow and task operations.
  • Invoke additional operations specific to Cisco UCS Director.

UCS Director REST API Documentation

There are several programmatic interfaces available for UCS Director this lab focuses on the REST API interface, download the Cisco UCS Director REST API Getting Started Guide for more detailed information.

When you're ready for the next level be sure to download the UCS Director REST API Cookbook

Exercise 1

Create a custom task.

  1. click on the "Policies" menu then click on "Orchestration". On the resulting screen click on the "Custom Workflow Tasks" tab if it is not already the current tab.

  2. click Add to add a custom workflow task. Enter the following information.

    • Task Name - SimpleCustomTask
    • Task Label - Demonstrate Custom Task
    • Register Under Category - TestingCustom Task

    Ensure Activate Task is checked. click Next



  3. click Add to add a custom task input. Enter the following information.

    • Input Field Name - firstInput
    • Input Field Label - Enter the first input
    • Input Field Type - Select Text
    • Map to Input Type - click Select... and in the pop up, search for “gen_text_input” and click Select

    click Submit







  4. Repeat the previous step with these values

    • Input Field Name - secondInput
    • Input Field Label - Enter the second input
    • Input Field Type - Select Text
    • Map to Input Type - click Select... and in the pop up, search for “gen_text_input” and click Select

    click Submit



  5. The resulting screen should look like the image below, click Next to continue...



  6. On the Custom Task Outputs screen click Add to add a custom task output. Enter the following information.

    • Output Field Name - firstOutput
    • Output Field Description - First Output
    • Output Field Type - click Select... and in the pop up, search for “gen_text_input” and click Select

    click Submit





  7. On the Controller screen click Next to continue...

  8. Enter the following script in the script Field

    //Use whenever inputs are associated with workflow context
    //var input1 = ctxt.getInput("firstInput");
    //var input2 = ctxt.getInput("secondInput");
    
    var input1 = input.firstInput;
    var input2 = input.secondInput;
    
    var outputMsg = "OUTPUT :" +input1 +" " +input2;
    output.firstOutput=outputMsg;
    



    click Submit to add the custom task.

    The task is added to the bottom of the list, either scroll to the bottom of the list or change the sort order of the ID column.



    This is the end of Exercise 1.