From 8d06c4a7edba89d8108c41e4d6e5f6f3ae9d453c Mon Sep 17 00:00:00 2001 From: "S. Jiang" <68374571+The-rambunctious-S@users.noreply.github.com> Date: Tue, 4 Aug 2020 17:02:07 +0800 Subject: [PATCH 1/2] Update README.md - Corrected a few grammatical errors. - Edited formatting. - Polished language to make the document more readable. --- README.md | 88 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index c502b70..a914f10 100644 --- a/README.md +++ b/README.md @@ -1,79 +1,81 @@ -# python-redfish-lenovo +# Python-redfish-Lenovo -Sample Python scripts for using the Redfish API on Lenovo servers -Description +## Introduction + +This project includes a set of sample Python scripts that utilize the Redfish API to manage Lenovo ThinkSystem servers. The scripts use the [DMTF python-redfish-library](https://github.com/DMTF/python-redfish-library). For more information on the Redfish API, visit [DMTF's Redfish Developer Hub](http://redfish.dmtf.org/) + ---------- -This project includes a set of sample Python scripts that utilize the Redfish API to manage Lenovo ThinkSystem servers. The scripts use the DMTF python-redfish-library +## Installation -For more information on the Redfish API, visit +* To install the python-redfish-library, follow these two steps: -Installing ----------- +1. Get the code from [python-redfish-library](https://github.com/DMTF/python-redfish-library). -* To install the python-redfish-library, get the code from , then: +2. Run the following command in your terminal: `python setup.py install` -* To install configparser: +* To install configparser, run the following command in your terminal: `pip install configparser` -Requirements ---------- -* python-redfish-library need to be installed +## Software requirements + + +* Python-redfish-library need to be installed. -Usage ---------- -A set of python examples is provided under the examples directory of this project. + +## Usage + +A set of python examples are provided under the examples directory of this project. * Common parameters configuration -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -You can use a configuration file to store common parameters for the Lenovo PowerShell Redfish Scripts, -such as the BMC IP address, user name, and password. Default configuration file is config.ini. -You can create your own configuration file and specify it using the "--config" option. -The scripts will load config.ini automatically if no configuration file is specified in command line. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* Using the python examples to get and set values -Simply run the python script to print out the values form the HTTP GET operation. +You can use a configuration file to store common parameters such as the BMC IP address, user name, and password for the Lenovo PowerShell Redfish Scripts. Default configuration file is *config.ini*. -This example prints the current system power state (such as On or Off) +You can also create your own configuration file and specify it using the *"--config"* option. The scripts will load *config.ini* automatically if no configuration file is specified in command line. - cd examples - python get_power_state.py -This example prints the system reset types that are supported by this server, then passes one of the values (ForceOff) to force the server to shutdown: +* Values viewing and setting - cd examples - python lenovo_get_reset_types.py - ['On', 'Nmi', 'GracefulShutdown', 'GracefulRestart', 'ForceOn', 'ForceOff', 'ForceRestart'] - - Python lenovo_set_reset_types.py ForceOff +Run the relevant python script to show values in the HTTP GET operation. Here are two examples: -Contributing ----------- +1. By running the following code, the terminal will show the current power state of the system (such as On or Off): +~~~~ +cd examples +python get_power_state.py +~~~~ + + +2. By running the following code, the terminal will show system reset types that are supported by your server, then passes one of the values (ForceOff) to force the server to shutdown: +~~~~ +cd examples +python lenovo_get_reset_types.py +['On', 'Nmi', 'GracefulShutdown', 'GracefulRestart', 'ForceOn', 'ForceOff', 'ForceRestart'] +Python lenovo_set_reset_types.py ForceOff +~~~~ + + +----------- +## Contributing 1. Fork it! 2. Create your feature branch: `git checkout -b my-new-feature` 3. Commit your changes: `git commit -am 'Add some feature'` 4. Push to the branch: `git push origin my-new-feature` 5. Submit a pull request :D -Copyright and License + --------------------- -Copyright 2019 Lenovo Corporation +## Copyright and License -Licensed under the Apache License, Version 2.0 (the "License"); you may -not use this file except in compliance with the License. You may obtain -a copy of the License at +Copyright 2019 Lenovo Corporation -http://www.apache.org/licenses/LICENSE-2.0 +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -License for the specific language governing permissions and limitations -under the License. +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. From 0990d6dd0dbc9d4170c2981f228fa6c8035483cd Mon Sep 17 00:00:00 2001 From: "S. Jiang" <68374571+The-rambunctious-S@users.noreply.github.com> Date: Tue, 4 Aug 2020 17:03:14 +0800 Subject: [PATCH 2/2] Update README.md One more grammatical error corrected. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a914f10..814cebc 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ This project includes a set of sample Python scripts that utilize the Redfish AP ## Software requirements -* Python-redfish-library need to be installed. +* Python-redfish-library needs to be installed. ----------