Around the Storage Block
1825642 Members
4202 Online
109684 Solutions
New Article
StorageExperts

New standards-based automation with PowerShell using Redfish and Swordfish

Expand your ability to automate infrastructure management with Powershell scripts that HPE PowerShell-HPE20191223027_800_0_72_RGB.pngleverage new Redfish and Swordfish protocol commands and compliant equipment.

-By Chris Lionetti, Senior Technical Marketing Engineer, HPE

If you’re anything like I am, you manage your physical servers using a combination of Windows Admin Center (WAC) vendor specific extensions and vendor-specific PowerShell Modules for that particular brand and model of hardware. While this approach is feasible, it requires you to accomplish management task using different procedures and scripts depending on the vendors that exist in the infrastructure.

The DMTF and Storage Network Industry Association (SNIA) have solved this problem by creating a RestAPI based Redfish.Swordfishpng.pngprotocol called Redfish and Swordfish. The two organizations boast membership from all the major server, storage, and cloud vendors. (Check here to see complete membership roles for DMTF and SNIA.).

The Redfish Protocol is highly successful, and is currently enabled on most Server Vendors BMC Management Ports. To promote collaboration, the DMTF and SNIA both host a co-located interoperability lab, which contains hardware supplied by the membership. The Swordfish Protocol is built into some shipping hardware solutions, but is still growing in the market

With access to this set of equipment, it’s only natural to create a PowerShell Toolkit that talks to the various Redfish/Swordfish devices. This is the genesis of the SNIA Swordfish/Redfish PowerShell Toolkit. this tool was created to be vendor neutral as well as to be a learning tool for discovering the power of the Redfish Protocol. The entire toolkit was developed in the open on GitHub and all native PowerShell Code. Care was taken to ensure that it works on all vendors present in the lab, as well as including real world examples from those servers. Additionally it should work on PowerShell Core as well as PowerShell on Linux and Mac, as well as support for PowerShell 7.x.

Look were to download this PowerShell Toolkit: https://github.com/SNIA/Swordfish-Powershell-Toolkit

To connect to your servers Remote Management Port, all you will need is a valid username and password and the IP address or FQDN for the Management Port. With the module loaded, you can connect to it using the following Command:

HPE POWERSHELL 1.png

This will connect to the Redfish Service Root, which doesn’t require any sort of authentication but is required so that further commands know which target device to act upon. Now we must gather a proper authentication token so that we can delve deeper. Use the following command to gather this token, which will be used in all future commands.

HPE POWERSHELL2.png

Now that we are connected and authenticated, we can start gathering information regarding our physical server. The redfish model uses different classes such as Systems, Chassis, and Storage. Each of these will contain a Collection of Objects, such as Chassis1 or Chassis 2. In turn each of these will contain subsections for each of the types of items within them such as Power Supplies, Fans, or Drives. Here’s a simplified view of this model:

HPE POWERSHELL 3 AGAIN.png

Using simple commands, you can explore these simple objects, such as Get-RedfishSystem or Get-RedfishChassis. Each of these commands return a complex object. See the example output of Get-RedfishSystem. The object will contain the commonly expected key value pairs. In addition, some values will contain references to collections which may require an additional rest call to retrieve.

HPE POWERSHELL 4.png

In this example, I would need to do an additional rest call to retrieve the LogServices for this physical server, referenced by the Key names ‘@odata.id’.

There’s a command to do just that, which will accept the correct URL extension and retrieve the deeper information:

Get-RedfishByURL –URL ‘/redfish/v1/Systems/1/LogServices

In some cases, a separate command has been created that make gathering those well-known endpoints much easier, as you’ll see in the following screen image. Note that the Subcomponent list is validated so using Tab will fill them in for you.

HPE POWERSHELL 5.png

Now the first question that I am commonly asked: How is this different from the information you can gather from WSMAN?

Primarily you can gain a wealth of information that simply is only available in the hardware such as the Temperature of the Power Supplies. The exact Wattage being consumed at the time the Part Number for each DIMM or Processor in the server, etc. A large number of settings specific to the hardware and configuration can only be changed such as BIOS settings, Virtual Media, etc.

The following examples have been table formatted for clarity as many different key value pairs worth of information may exist for each installed object.

HPE POWERSHELL 6.pngHPE POWERSHELL 7.png

To find more detailed information on how the Redfish open standard works, and to delve into the details of the model, please take a look at the Redfish Open Schema Guide.

The next most common question is: If this is Redfish then what is Swordfish?

The best news here is that everything in Redfish is still valid, as Swordfish is an extension that supports storage such as SAN or even NVMeOF. To absorb the complexity of network attached storage the Swordfish model adds a number of new concepts from fabrics, storage pools, replication, and host-to-target mapping. The following illustrates the additions to the Redfish Model that Swordfish represents.

HPE POWERSHELL 8.pngTo find more detailed information on how the Swordfish open standard works and to delve into the details of the model, please take a look at the Swordfish Open Schema Guide.

Most commands are equally at home as both Redfish and Swordfish commands, such as Chassis or Session, aliases exist so that  Get-RedfishChassis and Get-SwordfishChassis are both the same command. Other commands such as Get-SwordfishFabric do not have a Redfish equivalent as they are specifically created in the Swordfish Protocol. Embedded help is included with each command.

In an effort to enforce good protocol compliance; we have also created tests for each command against all of the equipment in the SNIA Lab to ensure cross-platform functionality; The output from these test are included in the Examples folder that are vendor specific if that vendor has chosen to allow those results to be displayed.

The entire module is being developed in the open as a community project on Github, and we welcome users to download and use the module, but also to issue requests and bugs. If you fancy yourself a PowerShell coder, we also welcome submissions to help us finish the complete model by adding more commands to expose the features and functionality of the protocol. The Redfish/Swordfish RestAPIs are well documented and following the existing commands should be relatively simple.

See it in action

In this new demo video, I show you how this work. Check it out: https://www.youtube.com/watch?v=VTDYVgiePVw


Meet Chris Lionetti, Senior Technical Marketing Engineer, HPE

lionetti_photo.jpgChris is a veteran of the storage industry who has been building complex systems and SANs for over 25 years. Chris has long been actively involved with the Storage Network Industry Association (SNIA) and is currently the board vice-chair. He is also a reference architect on the HPE Storage team. Chris has previously worked as an engineer for HP, Dell, Microsoft, and NetApp. He participates in many technical working groups and holds nine patents on inventions related to data centers, networking, and data storage.


Storage Experts
Hewlett Packard Enterprise

twitter.com/HPE_Storage
linkedin.com/showcase/hpestorage/
hpe.com/storage

About the Author

StorageExperts

Our team of Hewlett Packard Enterprise storage experts helps you dive deep into relevant data storage and data protection topics.