cancel
Showing results for 
Search instead for 
Did you mean: 

Adding DASH to Windows PowerShell Applications

Ganesh_Kamath
3 0 4,029


DASH CLI 2.2 supports new options to enable developers to send request query in JSON format to DASH systems and get the output in JSON format. The output can be interpreted by any programming language supporting JSON format. The output JSON is modeled similar to Redfish Schema published by DMTF.

 

In typical usage, DASH CLI is launched with request JSON. DASH CLI processes the request and forms the response in JSON format. This response is sent back to the launching application.

 

JSON is supported by almost all modern programming languages. Hence it will be easier to add DASH capability into any application or tool with few simple steps. Since the application will be launching DASH CLI, the integration with the application is therefore ‘loosely coupled’. DASH communication, DASH standards compliance, DASH security & stability are encapsulated within DASH CLI. The calling application doesn’t have to know anything about DASH standard.

 

There are two new options in DASH CLI:

  • jdo option: With this flag, DASH request input is taken from command-line and output DASH response is written to console.
  • ji/jo option: With this flag, DASH request input is taken from file and output DASH response is written file.

jdo option is faster since it doesn’t involve any file operation.

 

Before starting

  • Download and install DASH CLI 2.2 version. In this blog, DASH CLI is installed in default path, “C:\Program Files (x86)\DASH CLI 2.2\”
  • Examples are illustrated with Notepad++ Editor. Any other IDE or editor can be used as well.
  • Refer DASH CLI Developer Guide, which is available in DASH CLI installation folder: “C:\Program Files (x86)\DASH CLI 2.2\docs\”, for JSON request & response formats for supported DASH profiles.
  • This blog provides the steps for Windows Power Shell.

 

JDO Flag usage

Using via direct command line

dashcli -jdo

When this command is run, DASH CLI waits for input in JSON format. Once the input is provided, it will be executed by DASH CLI and output of which is written back in JSON format, as shown in the screenshot below.

Image1_JDO.png

After printing the line, “Opening connection to 127.0.0.1:5900 for forwarding from 127.0.0.1:53604”, the command prompt Launches AMD VNC Viewer.

 

Image2_KVMViewer.png

Using JDO option on Windows PowerShell

 

The syntax for JI/JO option on Windows PowerShell is as follows:

 

type input_json.txt | .\dashcli.exe -jdo

 Image3_PowerShell_JDO.png

 

After printing the line, “Opening connection to 127.0.0.1:5900 for forwarding from 127.0.0.1:53400”, the PowerShell Launches AMD VNC Viewer.

 

Image4_PowerShell_JDO_KVMViewer.png

 

Once the viewer is closed, the success JSON is printed on the console.

Ji JO Flag usage

Using via direct command line

dashcli -ji input_json.txt -jo output_json.txt

Here, the file ‘input_json.txt’ has the DASH command in JSON format. DASH CLI executes this command and writes the output in JSON format to file specified by -jo option, which is output_json.txt. Usage is shown in the screenshot below.

Image5_JIJO.png

After printing the line, “Opening connection to 127.0.0.1:5900 for forwarding from 127.0.0.1:53670”, the Command Prompt Launches AMD VNC Viewer.

 

Image6_JIJO_KVMViewer.png

Using JI/JO option on Windows PowerShell

The syntax for JI/JO option on Windows PowerShell is as follows:

 

.\dashcli.exe -ji .\input_json.txt -jo .\output_json.txt

 

 Image7_PowerShell_JIJO.png

After printing the line, “Opening connection to 127.0.0.1:5900 for forwarding from 127.0.0.1:61991”, the PowerShell Launches AMD VNC Viewer.

 

Image8_PowerShell_JIJO_KVMViewer.png

 

Once the viewer is closed, the success JSON is printed on the console.

 

 

In this blog, ‘DASH Computer System Enumerate’ is illustrated. Similarly, other DASH profiles can be accessed by the application by framing the required JSON request. See the ‘DASH CLI Developer Guide’ for JSON format for other supported DASH profiles.

 

For any further query, drop a note below or contact via mail dashsupport@amd.com

 

Reference:

  • DASH CLI Developer Guide (Available in DASH CLI installation folder: “C:\Program Files (x86)\DASH CLI 2.2\docs\”)

 

Useful links:

Related Blogs:

About the Author
Providing solutions to DMTF DASH client manageability solutions