2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2024-12-25 12:41:45 +00:00
6 Redfish_support
xuweibj edited this page 2018-05-31 10:26:08 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Mini design of Redfish support

Background

To support Redfish interface for hardware control.

Node definition

Add new mgt type redfish. Definition: mgt=redfish

Table

Use the same table with openbmc, “#node,bmc,consport,taggedvlan,username,password,comments,disable".

Plugin file

/opt/xcat/lib/perl/xCAT_plugin/redfish.pm

/opt/xcat/lib/perl/xCAT/AGENT.pm (move agent related part from /opt/xcat/lib/perl/xCAT/OPENBMC.pm here)

Python file (take rpower as example)

/opt/xcat/lib/python/agent/xcatagent/redfish.py

/opt/xcat/lib/python/agent/hwctl/executor/redfish_power.py

/opt/xcat/lib/python/agent/hwctl/redfish_client.py

The implementation details (take rpower as example)

The main code logic:

  1. redfish.pm
  • Handle xcat command. (rpower on)
  • Check command and node definition error.
  • Collect all nodes bmc, bmcip, bmcusername, bmcpassword
  • Call AGENT.pm to call python agent
  1. AGENT.pm
  • Collect xcat attributes xcatdebugmode, verbose,cwd, envs
  • Start agent.py and build socket with python part
  • Send all information (nodes and xcat attributes) to python part
  • Receive socket message from python part and print out
  1. redfish.py
  • Receive all info from perl part
  • Parse and check args
  • Deal with command, call corresponding task RedfishPowerTask and method to deal with subcommand
  1. redfish_power.py
  • Send request and receive response data by calling redfish_client.py
  • Deal with response data to send message back to perl
  1. redfish_client.py
  • Do real work of send request and receive response by requests method
  • Deal with response, check error and raise error

RedfishPowerTask is sub class of ParallelNodesCommand, call gevent to deal with command for each node at the same time.