gakamath

Adding DASH to Windows PowerShell Applications

Blog Post created by gakamath Employee on Oct 3, 2019


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.

 

JDO option seen on Command Prompt

 

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.

 

KVM Viewer showing BIOS screen

 

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

 JDO command on Windows Power Shell

 

 

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.

 

KVM Viewer launched via Powershell JDO command

 

 

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.

 

JIJO option seen on Command Prompt

 

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.

 

KVM Viewer showing BIOS screen

 

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

 

 JIJO command on Windows Power Shell

 

 

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.

 

KVM Viewer launched via Powershell JIJO command

 

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:

Outcomes