
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 07-25-2018 11:15 AM
Task Name |
UCSD to ACI generic API example |
Description |
UCSD to ACI generic API example |
Prerequisites |
Validated on UCSD 6.6 |
Category |
Workflow Task |
Components |
|
User Inputs |
|
Output |
Result of operation |
Installation
- Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
- Unzip the file on your computer. Should end up with a .WFDX file.
- Log in to UCS Director as a user that has "system-admin" privileges.
- Navigate to "Policies-->Orchestration" and click on "Import".
- Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
- Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
- Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
- Click "Submit".
- 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.
Inspiration comes from Russ W.
The workflow:
Note the %5B and %5D square brackets:
After import of this workflow please re-select in both tasks your APIC account!
The Log with output:
Service Request ID: 4042
---------------------------------------------------
Workflow Inputs
--Admin Inputs--
--User Inputs--
--------------
Jul 25, 2018 18:00:38 UTC Request submitted
Jul 25, 2018 18:00:39 UTC Executing workflow item number 1
Jul 25, 2018 18:00:39 UTC Completed workflow item number 1, with status Completed
Jul 25, 2018 18:00:45 UTC Executing workflow item number 2
Jul 25, 2018 18:00:45 UTC Trigger context executeWorkFlowStep called
Jul 25, 2018 18:00:45 UTC Executing custom action APIC_LOGIN_AND_GET_COMMAND (Execute Generic API)
Jul 25, 2018 18:00:45 UTC Executing custom action APIC_LOGIN_AND_GET_COMMAND (Execute Generic API)
Jul 25, 2018 18:00:45 UTC Sending query to host/device 172.16.10.38:443
Jul 25, 2018 18:00:45 UTC Status Code = 200; Status Line=HTTP/1.1 200 OK
Jul 25, 2018 18:00:45 UTC Parsing output values from JSON response
Jul 25, 2018 18:00:45 UTC TOKEN ($.imdata[0].aaaLogin.attributes.token) = l+sPAAAAAAAAAAAAAAAAAF1uCbTj1hxmNQbeOjT8BFEljhnpU5QrIKls/AjysQESy81VGs9hTz6UzI//hiWUKNBbma/gM851WwDIliFUn6pLtmlSSvoAldxxtpiv4MLcEf+XGqh/1gcspwmcAYReDphL6UW1+oJZAcvlTqTrf4BjwsBuq2Fw8lrRl6xDhYEJU0REwKyInLjVfRyriZLYrA==
Jul 25, 2018 18:00:45 UTC Task #2 (APIC_LOGIN_AND_GET_COMMAND (Execute Generic API)) completed successfully in 0 seconds
Jul 25, 2018 18:00:45 UTC Input/Output values for Task #2 (APIC_LOGIN_AND_GET_COMMAND (Execute Generic API)):
Jul 25, 2018 18:00:45 UTC [Local Input: Account = MDM@CoreyACI]
Jul 25, 2018 18:00:45 UTC [Local Input: Port = 443]
Jul 25, 2018 18:00:45 UTC [Local Input: Protocol = HTTPS]
Jul 25, 2018 18:00:45 UTC [Local Input: Request Type = POST]
Jul 25, 2018 18:00:45 UTC [Local Input: HTTP Content Type = JSON]
Jul 25, 2018 18:00:45 UTC [Output: TOKEN = l+sPAAAAAAAAAAAAAAAAAF1uCbTj1hxmNQbeOjT8BFEljhnpU5QrIKls/AjysQESy81VGs9hTz6UzI//hiWUKNBbma/gM851WwDIliFUn6pLtmlSSvoAldxxtpiv4MLcEf+XGqh/1gcspwmcAYReDphL6UW1+oJZAcvlTqTrf4BjwsBuq2Fw8lrRl6xDhYEJU0REwKyInLjVfRyriZLYrA==]
Jul 25, 2018 18:00:45 UTC Completed workflow item number 2, with status Completed
Jul 25, 2018 18:00:51 UTC Executing workflow item number 3
Jul 25, 2018 18:00:51 UTC Trigger context executeWorkFlowStep called
Jul 25, 2018 18:00:51 UTC Executing custom action APIC_LOGIN_AND_GET_COMMAND (Execute Generic API)
Jul 25, 2018 18:00:51 UTC Executing custom action APIC_LOGIN_AND_GET_COMMAND (Execute Generic API)
Jul 25, 2018 18:00:51 UTC Sending query to host/device 172.16.10.38:443
Jul 25, 2018 18:00:51 UTC Status Code = 200; Status Line=HTTP/1.1 200 OK
Jul 25, 2018 18:00:51 UTC Task #3 (APIC_LOGIN_AND_GET_COMMAND (Execute Generic API)) completed successfully in 0 seconds
Jul 25, 2018 18:00:51 UTC Input/Output values for Task #3 (APIC_LOGIN_AND_GET_COMMAND (Execute Generic API)):
Jul 25, 2018 18:00:51 UTC [Local Input: Account = MDM@CoreyACI]
Jul 25, 2018 18:00:51 UTC [Local Input: Port = 443]
Jul 25, 2018 18:00:51 UTC [Local Input: Protocol = HTTPS]
Jul 25, 2018 18:00:51 UTC [Local Input: Request Type = GET]
Jul 25, 2018 18:00:51 UTC [Local Input: HTTP Content Type = JSON]
Jul 25, 2018 18:00:51 UTC [Template Input:Cookie = APIC-cookie=${APIC_LOGIN.TOKEN}]
Jul 25, 2018 18:00:51 UTC [Resolved Template Input: Cookie = APIC-cookie=l+sPAAAAAAAAAAAAAAAAAF1uCbTj1hxmNQbeOjT8BFEljhnpU5QrIKls/AjysQESy81VGs9hTz6UzI//hiWUKNBbma/gM851WwDIliFUn6pLtmlSSvoAldxxtpiv4MLcEf+XGqh/1gcspwmcAYReDphL6UW1+oJZAcvlTqTrf4BjwsBuq2Fw8lrRl6xDhYEJU0REwKyInLjVfRyriZLYrA==]
Jul 25, 2018 18:00:51 UTC [Local Input: Cookie = APIC-cookie=l+sPAAAAAAAAAAAAAAAAAF1uCbTj1hxmNQbeOjT8BFEljhnpU5QrIKls/AjysQESy81VGs9hTz6UzI//hiWUKNBbma/gM851WwDIliFUn6pLtmlSSvoAldxxtpiv4MLcEf+XGqh/1gcspwmcAYReDphL6UW1+oJZAcvlTqTrf4BjwsBuq2Fw8lrRl6xDhYEJU0REwKyInLjVfRyriZLYrA==]
Jul 25, 2018 18:00:51 UTC [Output: Response = {'totalCount':'1','imdata':[{'l1PhysIf':{'attributes':{'adminSt':'up','autoNeg':'on','brkoutMap':'none','bw':'0','childAction':'','delay':'1','descr':'','dn':'topology/pod-1/node-101/sys/phys-[eth1/22]','dot1qEtherType':'0x8100','ethpmCfgFailedBmp':'','ethpmCfgFailedTs':'00:00:00:00.000','ethpmCfgState':'0','fcotChannelNumber':'Channel32','fecMode':'inherit','id':'eth1/22','inhBw':'unspecified','isReflectiveRelayCfgSupported':'Supported','layer':'Layer2','lcOwn':'local','linkDebounce':'100','linkLog':'default','mdix':'auto','medium':'broadcast','modTs':'2018-07-09T19:01:16.094+00:00','mode':'trunk','monPolDn':'uni/infra/moninfra-default','mtu':'9000','name':'','pathSDescr':'','portT':'leaf','prioFlowCtrl':'auto','reflectiveRelayEn':'off','routerMac':'not-applicable','snmpTrapSt':'enable','spanMode':'not-a-span-dest','speed':'inherit','status':'','switchingSt':'disabled','trunkLog':'default','usage':'discovery'}}}]}]
Jul 25, 2018 18:00:51 UTC Completed workflow item number 3, with status Completed
Jul 25, 2018 18:00:54 UTC Executing workflow item number 4
Jul 25, 2018 18:00:54 UTC Completed workflow item number 4, with status Completed

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I'm getting the following error while parsing the token:
any ideas as to what this might be? (i've checked the output by making the task output the full response and it's definitely working, it has an "imdata" list and the token is there...)

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Do you get an Error with just a $ var?
Typically I get those sort of errors when I don't have my structure properly defined:

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
this happens with the workflow out-of-the-box... but yes, i get the same result with just '$'...

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I just ran the workflow and I get this return:
Nov 06, 2018 11:43:17 UTC TOKEN ($.imdata[0].aaaLogin.attributes.token) = WtMKAAAAAAAAAAAAAAAAAEZP0De9g+dKPB7ASjHnXB/iavBkYPN8JZ/InsRYlFzsoM5llpTdtvOWa634/dffG/BnKAAvghsNIDZlgF9b+865XfhND5jUwZ1nzhHf/LY2lr5Gcm6jQek2vwsVaN3QK1owjwfg7clRuUNBraAiZ1X6VZQv20kxxKqpVz6NqO8Ih8JJ6LbS8PK04aQBl7d9OA==
Nov 06, 2018 11:43:17 UTC Task #2 (APIC_LOGIN_AND_GET_COMMAND (Execute Generic API)) completed successfully in 0 seconds
Nov 06, 2018 11:43:17 UTC Input/Output values for Task #2 (APIC_LOGIN_AND_GET_COMMAND (Execute Generic API)):
Nov 06, 2018 11:43:17 UTC [Local Input: Account = MDM@CoreyACI]
you said in the first post you get the full result. What does that look like?

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
i cant copy it (it shows in the input/output tab of the service request), but here's a screenshot:
'$.imdata[0].aaaLogin.attributes.token' should work, however i'm getting the aforementioned java error. my colleague has since gotten it to work with an xml call instead of json, however we prefer working with json, so i'd still appreciate a fix/workaround...

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
screen shot did not post
my example did use JSON
We are on APIC version 4.01h
Sounds like something changed in the APIC response then.
I would open up a TAC case see what they come up with.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Here is a solution to the issue after an upgrade to 6.6.1.0
Looks like in unlucky circumstances an old jar file does not get deleted:
Generic API task failing after upgrade too 6.6.1.0
====================================================
[root@localhost lib]# cd /opt/infra/lib
[root@localhost lib]# ls -ltr /opt/infra/lib | grep -i jackson-core
-rw-rwxr--. 1 ucsdu ucsdg 280015 Jan 28 2018 jackson-core-2.8.0.jar
-rw-rwxr--. 1 ucsdu ucsdg 321590 Oct 10 19:20 jackson-core-2.9.5.jar
[root@localhost lib]#
[root@localhost lib]#
[root@localhost lib]#
[root@localhost lib]# pwd
/opt/infra/lib
[root@localhost lib]# rm jackson-core-2.8.0.jar
rm: remove regular file `jackson-core-2.8.0.jar'? y
[root@localhost lib]# su - shelladmin
Option 3
Option 4
Lots of Option 2's