New Simulator plugin
0.9
With the simulation plugins it is possible to run the openhpi daemon locally without having hardware for it in the background.
Since the new simulation plugin gets its simulation data from a file instead of having it inside the code, the data can be changed without compiling the plugin afterwards.
In combination with the hpigensimdata
client you can generate your own simulation data based on a running system e.g. for demonstration purposes
- see also Simulation data.
The plugin is written in C++ and adapts the ipmidirect plugin for simulation purposes. Therefore you will find many conformities between both plugins.
Since it was tried not to introduce new libraries, the gnu lexical scanner was used for parsing the simulation data as it is used for the openhpid.conf file. A documentation of this scanner can be found at: http://library.gnome.org/devel/glib/stable/glib-Lexical-Scanner.html
Don't hit me, but the documention was not done by the openhpi
recommended tool. Instead of this doxygen
is used for this purpose. The doxygen configuration file Doxyfile
can be found in the main directory of the plugin. The documentation itself is in the file doc.html.tgz
. A good description of this tool can be found at: http://www.stack.nl/~dimitri/doxygen/index.html
As already mentioned the new simulator plugin is adapted from the ipmidirect plugin. Therefore many conformities can be found.
To make it easier to enhance the plugin in the following some call hierarchies are given.
The call hierarchy isn't as deep as for the ipmi plugin due to the missing micro controller classes (mc). But if you replace the communication layer of the ipmidirect plugin by the following simulation file handling, the call hierarchie is nearly the same:
As already mentioned the glib lexical scanner is used. All classes relevant for parsing the simulation data file start with NewSimulatorFilexxx (xxx is the component which should be parsed.). The rdr objects are generated by a fabric pattern. (To be correct for a real fabric pattern a interface class is missing including the switch - block for the RDR Types.)
The start point is
For each openhpi function alias oh_
... a NewSimulator... function is defined inside the new plugin loader block of new_sim.cpp. Inside these functions the relevant rdr object is taken (function VerifyAndEnterXXX) and the relevant method is called of the object.
In some cases some sub structures are needed (e.g. inventory areas and fields) In these cases first the relevant method of the RDR
object is called (e.g. NewSimulatorInventory). Inside this object the correct sub object is identified, which is common an array entry. The implementation of such "sub ojects" can be found in the ..._data files (e.g. new_sim_inventory_data.cpp).
The NewSimulator plugin reads at start a simulation file which includes the data to be simulated. The filename can be defined inside the plugin section of openhpid.conf. The default filename is simulation.data. The file can be found in the directory of the openhpid.conf file.
The file itself is read only one time during the discovery phase. This means that the daemon has to be restarted if changes were made and should take effect.
Small changes can be done easily in the file but if a whole system hardware should be simulated it is recommended to use the hpigensimdata
client which is described in Generating own simulation data.
To generate a simulation file including the data of an own system, it is recommended to use the client hpigensimdata
-f
<filename>
.
The content of <filename>
is in ascii and can be modified using a text editor of chose. But at changing the file you should be aware to set the parenthesis correctly and take the correct names of variables.
With the exception of config section and the token marks, all variable names are equivalent to the variables defined inside SafHpi.h
. The values of the unions and defines are put as integer or hex values inside the file to spare the decoding at startup of the daemon (and development efforts ;-)).
You can use this client also for dump a running system. But keep in mind that for reading e.g. the capability fields it is much easier to transfer also the values properly to text, which is not done by this client.
Generated on Mon Apr 26 14:36:47 2010 for New Simulator by
1.4.4