Skip to content

Commit

Permalink
Merge pull request #23 from DMTF/1.0.0-Tagging
Browse files Browse the repository at this point in the history
1.0.0 Versioning
  • Loading branch information
mraineri authored Feb 16, 2018
2 parents 39adfc0 + 3510b53 commit bba9d3b
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 50 deletions.
6 changes: 2 additions & 4 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Original Contribution:

* Kevin Midkiff - Intel Corporation
* John Leung - Intel Corporation
* Manasa Kalburgi - Intel Corporation
* Bartosz Furtak - Intel Corporation

# Other Key Contributions:

* George Clement - Intel Corporation
* João Monteiro Soares - Ericsson AB
* Fetahi Wuhib - Ericsson AB

append new contributions to the bottom


25 changes: 19 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@

# Change Log

## 2016-09-22 [0.9.0]
- Initial Release
## 2016-03-17
- Fixes to run with Python 3.5
## 2017-05-21
## [1.0.0] 2018-02-16
- Added fixes for running with Python 3.5
- Added browser feature so a human can more easily navigate the service
- Added Composition Service
- Fixed support for running under Linux
- Added code generators for dynamic files
- Fixed inconsistencies for handling URIs with trailing / characters
- Support for setting of Link object paths
- Made Manager and ComputerSystem dynamic
- Implemented wildcards replacement for subordinate resources
- Fixes for Cloud Foundry execution

## [0.9.3] 2017-05-21
- Change references from flask.ext.restful to flask_restful, since package is obsolete
- Add example files, eg_resource_api.py and eg_resource.py, showing how dynamic objects are coded.

## [0.9.2] 2017-03-17
- Fixes to run with Python 3.5

## [0.9.0] 2016-09-22
- Initial Release
91 changes: 52 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
Copyright 2016-2018 Distributed Management Task Force, Inc. All rights reserved.

# Redfish Interface Emulator

The Redfish Interface Emulator that can emulator a Redfish interface resources as static or dynamically.

Static emulator is accomplish by copy a Redfish mockup in a ./static directory.
Expand All @@ -8,23 +10,30 @@ Dynamic emulator is accomplished by creating the Python files. The code for an

The emulator is structure so it can be hosted on a standalone system or multiple instances in a Cloud Foundry. Note: the cloud foundry method has be successful within a company internal cloud foundry service. It has not be attempted on a public cloud foundry service.

This program is a python27 program.
## Installation and Invocation ##
### Standalone ###
This program is a python35 program.

## Installation and Invocation

### Standalone

The follow is used to install and execute on a standalone system

* Copy the entire directory tree onto the system of interest
* Install the Python packages listed in requirements.txt. The best way to install packages is dependent of your location's firewall and proxy configuration.
* Use pip
* Place the packages in ./dependencies and execute install.py
* Use pip
* Place the packages in ./dependencies and execute install.py
* From this directory, execute the command "python emulator.py"
### Cloud Foundry ###

### Cloud Foundry

The follow is used to invoke the emulator in a cloud foundry.

* Copy the entire directory tree onto the system from which the cloud foundry service is invoked
* From this directory, execute the command "cf push <name>".
* The invocation will cause the Cloud Foundry to install the packages form requirements.txt file and then execute the command in the Procfile file.
### Command Syntax ###
* From this directory, execute the command "cf push \<name\>".
* The invocation will cause the Cloud Foundry to install the packages form requirements.txt file and then execute the command in the Procfile file.

### Command Syntax

The emulator is invoke with the following command:

python emulator.py [-h] [-v] [-port PORT] [-debug]
Expand All @@ -33,61 +42,63 @@ The emulator is invoke with the following command:
-port -- specifies the port number to use
-debug -- enables debugging (needed to debug flask calls)

### Format of emulator_config.json ###
### Format of emulator_config.json

The emulator reads the emulator_config.json file to configure its behavior.

{
"MODE": "Local"
"HTTPS": "Disable",
"SPEC": "Redfish",
"HTTPS": "Disable",
"SPEC": "Redfish",
"TRAYS": [
"./Resources/Systems/1/index.json"
]
"POPULATE": "Emulator"
}

* The MODE property specifies port to use. If the value is 'Cloud', the port is assigned by
the cloud foundry. If the value is ‘Local’, the port is assigned the value of the port parameter is the command line or 5000, by default. (e.g. localhost:5000/redfish/v1)
* The MODE property specifies port to use. If the value is 'Cloud', the port is assigned by the cloud foundry. If the value is ‘Local’, the port is assigned the value of the port parameter is the command line or 5000, by default. (e.g. localhost:5000/redfish/v1)
* The HTTPS property specifies whether HTTP or HTTPS will used by the client
* The SPEC property specifies whether the computer system is represented as a Redfish ComputerSystem (SPEC = “Redfish”) or another schema.
* The TRAYS property specifies the path to the resources that will make up the initial resource pools. These simple resource pools are depleted as computer systems are composed. Multiple trays can be specified.
* The POPULATE property specifies the path to the file used by the INFRAGEN module to populate the Redfish Interface backend. If the file does not exist or if POPULATE is not defined, the emulator will start empty.

### Copying a mockup ###
### Copying a mockup

The location for the static mockup is in the directory ./api_emulator/redfish/static. The emulator comes with a copy of an earlier Redfish mockup. This can be replaced with any new mockup file.

If the new mockup has additional resources off the ServiceRoot, then small modifications need to be made in resource_emulator.py to adds these new resources.
### Creating dynamic resources ###

### Creating dynamic resources

Resources can be incremental recasted as dynamic, so one can straddle static vs dynamic emulation. The following outlines the overall process. More complete documentation is in a Word document in the ./doc directory. An example for the Chassis resource is included in the source code.

1. Create an API file (e.g. Chassis\_api.py)
* The file is placed in the ./api\_emulator/Redfish directory
* The file contain the behavior of each HTTP command, of interest
* The file contains the API for both the singleton resource and the collection resource (if collection exists)
* The file is placed in the ./api\_emulator/Redfish directory
* The file contain the behavior of each HTTP command, of interest
* The file contains the API for both the singleton resource and the collection resource (if collection exists)
2. Create a template file (e.g. Chassis.py)
* The file is placed in ./api\_emulator/Redfish/template directory
* The file should contain the same properties as the mockup file for the resource
* The file is placed in ./api\_emulator/Redfish/template directory
* The file should contain the same properties as the mockup file for the resource
3. Edit ./api\_emulator/resource\_emulator.py file
* Comment out the line which loads the static mockup for the Chassis resource
* Add the line to add the resource API defined in chassis_api.py
* Comment out the line which loads the static mockup for the Chassis resource
* Add the line to add the resource API defined in chassis_api.py

Code generators for the steps #1 (API file) and #2 (template file) exists in the ./codegen directory.

* Generate API file
* The following command generates an API file
* The HTTP commands implemented are GET, PATCH, POST and DELETE
* If the resource has subordinate resources that need to be instantiated when this resource is instantiated, that code will need to be manually added.
*
codegen_api Chassis <outputdir>
* The following command generates an API file
* The HTTP commands implemented are GET, PATCH, POST and DELETE
* If the resource has subordinate resources that need to be instantiated when this resource is instantiated, that code will need to be manually added.
* `codegen_api Chassis <outputdir>`

* Generate template file
* The following command generates a template file
* The file uses a index.json file located in the current working directory to drive the creation of the template. (TODO - add the filename as a command line parameter)
* The file contains a dictionary with the names of Redfish collections and there corresponding wildcard. This dictionary should be update the keep in sync with Redfish modeling.
*
codegen_template Chassis <outputdir>
* The following command generates a template file
* The file uses a index.json file located in the current working directory to drive the creation of the template. (TODO - add the filename as a command line parameter)
* The file contains a dictionary with the names of Redfish collections and there corresponding wildcard. This dictionary should be update the keep in sync with Redfish modeling.
* `codegen_template Chassis <outputdir>`

### INFRAGEN Module

Python module that can be used to populate the Redfish Interface backend with data (Chassi, Systems, Resource Blocks, Resources Zones, Processors, Memory, etc).

To use the module a JSON file needs to be in place describing the infrastructure (an example is provided in 'infragen/populate-config.json').
Expand All @@ -97,22 +108,24 @@ Moreover, the POPULATE property needs to be set in emulator-config.json. The POP
As part of INFRAGEN, generate_template.py can be used to help a user with the creation of JSON template according to a specific Redfish schema by guiding the user through the schema and asking for input values. This module runs independently of the populate function and from the emulator itself.

### Testing the Emulator

The command to test the emulator can executed against the emulator running locally or hosted in the cloud.

The following is the general command for running unit test.

python unittests.py <SPEC> "<PATH>"
(e.g python unittests.py Redfish "localhost:5000")
(e.g python unittests.py Redfish "localhost:5000")
<SPEC> should correspond to the value in emulator-config.json
<PATH> is the path to use for testing and should be enclosed in double-quotes

Once the command completes, inspect the log file which is produced, test-rsa-emulator.log.
Once the command completes, inspect the log file which is produced, "test-rsa-emulator.log".

### Browser feature - http://localhost:5000/browse.html

Feature added to make it easier to navigate/show the API.

Ability to compose and delete systems (Composition Service) is also included.
* Compose: when navigating the browser to /CompositionService/ResourceZones/<ZONE>/, a check box appears next to each Resource Block. The user shall select the Resource Blocks he wants to use to compose a system and then press the button "compose" on the top.
* Delete: navigate the browser to /Systems/<SYSTEM>/, if the system is of type "COMPOSED", a "delete" button appears. Just click and the composed system will be deleted.
* Compose: when navigating the browser to /CompositionService/ResourceZones/\<ZONE\>/, a check box appears next to each Resource Block. The user shall select the Resource Blocks he wants to use to compose a system and then press the button "compose" on the top.
* Delete: navigate the browser to /Systems/\<SYSTEM\>/, if the system is of type "COMPOSED", a "delete" button appears. Just click and the composed system will be deleted.

Screenshots of the browser available in /doc/browser-screenshots.pdf
Screenshots of the browser available in /doc/browser-screenshots.pdf
2 changes: 1 addition & 1 deletion api_emulator/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Interface-Emulator/LICENSE.md

__version__ = 'Alpha v1.2'
__version__ = '1.0.0'

0 comments on commit bba9d3b

Please sign in to comment.