cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1072
Views
0
Helpful
0
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee
Task Name

Add - Subtract - Multiply - Divide

Description

Prerequisites
  1. Tested on 5.4
CategoryWorkflow
ComponentsvSphere 5.x
User Inputse-mail address
Outpute-mail with counter

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 .WFDX file resides. Choose the .WFDX 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 task will take 2 numbers and add or subtract or multiply or divide them.

The workflow:

Screen Shot 2015-11-25 at 7.31.52 AM.png

Workflow Execution:

Screen Shot 2015-11-25 at 7.37.43 AM.png

Custom LOV for this workflow for drop down:

Screen Shot 2015-11-25 at 7.38.23 AM.png

The custom task code:

importPackage(java.io);

importPackage(java.util);

importPackage(com.cisco.cuic.api.client);

importPackage(com.cisco.cuic.api.models);

output.Result = -9999999;

if (input.Operator == '1') {output.Result = ( parseInt(input.Input1) +  parseInt(input.Input2) ); }

if (input.Operator == '2') {output.Result = ( parseInt(input.Input1) -  parseInt(input.Input2) ); }

if (input.Operator == '3') {output.Result = ( parseInt(input.Input1) *  parseInt(input.Input2) ); }

if (input.Operator == '4') {output.Result = ( parseInt(input.Input1) /  parseInt(input.Input2) ); }

Division Run:

Service Request ID: 5921

Workflow Inputs:

- A

- Operator

- B

Nov 25, 2015 13:17:17 UTC Request submitted

Nov 25, 2015 13:17:23 UTC Executing workflow item number 1

Nov 25, 2015 13:17:23 UTC Completed workflow item number 0, with status Completed

Nov 25, 2015 13:17:28 UTC Executing workflow item number 2

Nov 25, 2015 13:17:28 UTC Trigger context executeWorkFlowStep called

Nov 25, 2015 13:17:28 UTC Executing custom action PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)

Nov 25, 2015 13:17:28 UTC Executing custom action PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)

Nov 25, 2015 13:17:28 UTC Executing custom script for PlusMinusMulitplyDivide

Nov 25, 2015 13:17:30 UTC Processing output: Result

Nov 25, 2015 13:17:31 UTC Task #1 (PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)) completed successfully in 3 seconds

Nov 25, 2015 13:17:31 UTC Input/Output values for Task #1 (PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)):

Nov 25, 2015 13:17:31 UTC [Mapped Input: Input1 = 355]

Nov 25, 2015 13:17:31 UTC [Mapped Input: Operator = 4]

Nov 25, 2015 13:17:31 UTC [Mapped Input: Input2 = 113]

Nov 25, 2015 13:17:31 UTC [Output: Result = 3.1415929203539825]

Nov 25, 2015 13:17:31 UTC Completed workflow item number 1, with status Completed

The addition run:

Service Request ID: 5918

Workflow Inputs:

- A

- Operator

- B

Nov 25, 2015 13:13:48 UTC Request submitted

Nov 25, 2015 13:13:48 UTC Executing workflow item number 1

Nov 25, 2015 13:13:48 UTC Completed workflow item number 0, with status Completed

Nov 25, 2015 13:13:55 UTC Executing workflow item number 2

Nov 25, 2015 13:13:55 UTC Trigger context executeWorkFlowStep called

Nov 25, 2015 13:13:55 UTC Executing custom action PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)

Nov 25, 2015 13:13:55 UTC Executing custom action PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)

Nov 25, 2015 13:13:55 UTC Executing custom script for PlusMinusMulitplyDivide

Nov 25, 2015 13:13:58 UTC Processing output: Result

Nov 25, 2015 13:13:59 UTC Task #1 (PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)) completed successfully in 3 seconds

Nov 25, 2015 13:13:59 UTC Input/Output values for Task #1 (PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)):

Nov 25, 2015 13:13:59 UTC [Mapped Input: Input1 = 10]

Nov 25, 2015 13:13:59 UTC [Mapped Input: Operator = 1]

Nov 25, 2015 13:13:59 UTC [Mapped Input: Input2 = 10]

Nov 25, 2015 13:13:59 UTC [Output: Result = 20]

Nov 25, 2015 13:13:59 UTC Completed workflow item number 1, with status Completed

Nov 25, 2015 13:14:02 UTC Executing workflow item number 3

Nov 25, 2015 13:14:02 UTC Completed workflow item number 2, with status Completed

The Subtract run:

Service Request ID: 5919

Workflow Inputs:

- A

- Operator

- B

Nov 25, 2015 13:14:22 UTC Request submitted

Nov 25, 2015 13:14:25 UTC Executing workflow item number 1

Nov 25, 2015 13:14:25 UTC Completed workflow item number 0, with status Completed

Nov 25, 2015 13:14:29 UTC Executing workflow item number 2

Nov 25, 2015 13:14:29 UTC Trigger context executeWorkFlowStep called

Nov 25, 2015 13:14:29 UTC Executing custom action PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)

Nov 25, 2015 13:14:29 UTC Executing custom action PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)

Nov 25, 2015 13:14:29 UTC Executing custom script for PlusMinusMulitplyDivide

Nov 25, 2015 13:14:32 UTC Processing output: Result

Nov 25, 2015 13:14:33 UTC Task #1 (PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)) completed successfully in 3 seconds

Nov 25, 2015 13:14:33 UTC Input/Output values for Task #1 (PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)):

Nov 25, 2015 13:14:33 UTC [Mapped Input: Input1 = 10]

Nov 25, 2015 13:14:33 UTC [Mapped Input: Operator = 2]

Nov 25, 2015 13:14:33 UTC [Mapped Input: Input2 = 9]

The multiply run:

Service Request ID: 5920

Workflow Inputs:

- A

- Operator

- B

Nov 25, 2015 13:15:00 UTC Request submitted

Nov 25, 2015 13:15:05 UTC Executing workflow item number 1

Nov 25, 2015 13:15:05 UTC Completed workflow item number 0, with status Completed

Nov 25, 2015 13:15:12 UTC Executing workflow item number 2

Nov 25, 2015 13:15:12 UTC Trigger context executeWorkFlowStep called

Nov 25, 2015 13:15:12 UTC Executing custom action PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)

Nov 25, 2015 13:15:12 UTC Executing custom action PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)

Nov 25, 2015 13:15:12 UTC Executing custom script for PlusMinusMulitplyDivide

Nov 25, 2015 13:15:15 UTC Processing output: Result

Nov 25, 2015 13:15:16 UTC Task #1 (PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)) completed successfully in 3 seconds

Nov 25, 2015 13:15:16 UTC Input/Output values for Task #1 (PlusMinusMultiplyDivide (custom_PlusMinusMulitplyDivide)):

Nov 25, 2015 13:15:16 UTC [Mapped Input: Input1 = 5]

Nov 25, 2015 13:15:16 UTC [Mapped Input: Operator = 3]

Nov 25, 2015 13:15:16 UTC [Mapped Input: Input2 = 5]

Nov 25, 2015 13:15:16 UTC [Output: Result = 25]

Nov 25, 2015 13:15:16 UTC Completed workflow item number 1, with status Completed

Nov 25, 2015 13:15:17 UTC Executing workflow item number 3

Nov 25, 2015 13:15:17 UTC Completed workflow item number 2, with status Completed

Nov 25, 2015 13:14:33 UTC [Output: Result = 1]

Nov 25, 2015 13:14:33 UTC Completed workflow item number 1, with status Completed

Nov 25, 2015 13:14:36 UTC Executing workflow item number 3

Nov 25, 2015 13:14:36 UTC Completed workflow item number 2, with status Completed

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