Rich Lane | a06d0c3 | 2013-03-25 08:52:03 -0700 | [diff] [blame] | 1 | |
| 2 | Here are a few notes about the LOXI processing flow. |
| 3 | |
| 4 | Currently there are two pieces of input for each version to be supported. |
| 5 | |
| 6 | (1) The original openflow.h header file. This is parsed to extract |
| 7 | identifiers such as #defines and enum definitions. These are in the |
| 8 | 'canonical' directory. |
| 9 | |
| 10 | (2) A specially processed list of structs derived from the original |
| 11 | openflow.h header file. These are the structs that represent the |
| 12 | protocol on the wire with the following minor modifications: |
| 13 | ** ofp_header structures instances are replaced by their contents |
| 14 | ** Arrays are replaced with the syntax 'data_type[length] idenitifier'. |
| 15 | ** Lists of objects are called out explicitly as 'list(data_type) identifier' |
| 16 | ** Match structures are renamed to be version specific |
| 17 | ** Each flavors of a flow modify (add, modify, modify strict, delete |
| 18 | and delete strict) are called out as different objects |
| 19 | ** Each action type (for instance) is called out as its own type. |
| 20 | |
| 21 | Copyright 2012, Big Switch Networks, Inc. |
| 22 | |
| 23 | Enumerations/defines give semantic values for two contexts: |
| 24 | |
| 25 | * Internal management of objects, for example, the particular values that |
| 26 | indicate a message is an Echo message or an action is an output action. |
| 27 | These values, like the wire format, are generally not of interest to |
| 28 | the users of LOXI. |
| 29 | |
| 30 | * External representation of information. These are values which users of |
| 31 | LOXI need to know about, at least through an identifier. Examples include |
| 32 | OFP_TCP_PORT, OFP_MAX_TABLE_NAME_LEN or OFPP_MAX. |
| 33 | |
| 34 | In general, processing proceeds by: |
| 35 | |
| 36 | (1) Extracting information from each version's input files. |
| 37 | |
| 38 | (2) Unifying the information across all versions, allowing the |
| 39 | identification of commonalities and differnces. |
| 40 | |
| 41 | (3) Calling the language specific generation routines for each |
| 42 | target file. The list of files to generate and the map from |
| 43 | file to generating function is given in the language specific |
| 44 | Python file such as lang_c.py at the top level. |
| 45 | |
| 46 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 47 | |
| 48 | The code layout is as follows (explanations below): |
| 49 | |
| 50 | BigCode/Modules/ |
| 51 | LoxiGen/ |
| 52 | Makefile |
| 53 | loxigen.py Entry point executable |
| 54 | of_g.py Global variables |
| 55 | lang_c.py, ... Language specific |
| 56 | loxi_front_end/ Python functions for processing input |
| 57 | loxi_utils/ General utility functions |
| 58 | canonical/ openflow.h header files |
| 59 | openflow.h-<of-version> |
| 60 | openflow_input/ pre-processed openflow.h input |
| 61 | structs-<of-version> |
| 62 | c_gen/ Python functions for C code generation |
| 63 | c_template/ Template including non-autogen files |
| 64 | utest/ Simple Python scripts to test functions |
| 65 | |
| 66 | For C code generation, the output is placed in the BigCode module format. |
| 67 | First, the C template directory is copied over to a target directory. |
| 68 | Then the automatically generated files are created and placed in the |
| 69 | proper locations in the target directory. Then the result is tarred |
| 70 | up for overlay onto another location. |
| 71 | |
| 72 | To test the code locally, the target file is untarred into a local |
| 73 | directory and a special make file (in c_gen/Makefile.local) is copied |
| 74 | into the local directory. |
| 75 | |
| 76 | |