py_gen: move ID classes into their own modules
diff --git a/lang_python.py b/lang_python.py
index f40cecc..9087b43 100644
--- a/lang_python.py
+++ b/lang_python.py
@@ -50,6 +50,8 @@
of12: ... # (code generation incomplete)
oxm.py # OXM classes
of13: ... # (code generation incomplete)
+ action_id.py # Action ID classes
+ instruction_id.py # Instruction ID classes
meter_band.py # Meter band classes
The user will add the pyloxi directory to PYTHONPATH. Then they can
@@ -83,7 +85,7 @@
1: ["action", "common", "const", "message", "util"],
2: ["action", "common", "const", "instruction", "message", "util"],
3: ["action", "common", "const", "instruction", "message", "oxm", "util"],
- 4: ["action", "common", "const", "instruction", "message", "meter_band", "oxm", "util"],
+ 4: ["action", "action_id", "common", "const", "instruction", "instruction_id", "message", "meter_band", "oxm", "util"],
}
def make_gen(name, version):
diff --git a/py_gen/codegen.py b/py_gen/codegen.py
index 2c4a135..de3fdba 100644
--- a/py_gen/codegen.py
+++ b/py_gen/codegen.py
@@ -40,8 +40,10 @@
roots = {
'of_header': 'message',
'of_action': 'action',
+ 'of_action_id': 'action_id',
'of_oxm': 'oxm',
'of_instruction': 'instruction',
+ 'of_instruction_id': 'instruction_id',
'of_meter_band': 'meter_band',
}
@@ -74,6 +76,11 @@
ofclasses=modules_by_version[version]['action'],
version=version)
+def generate_action_id(out, name, version):
+ util.render_template(out, 'module.py',
+ ofclasses=modules_by_version[version]['action_id'],
+ version=version)
+
def generate_oxm(out, name, version):
util.render_template(out, 'module.py',
ofclasses=modules_by_version[version]['oxm'],
@@ -94,6 +101,11 @@
ofclasses=modules_by_version[version]['instruction'],
version=version)
+def generate_instruction_id(out, name, version):
+ util.render_template(out, 'module.py',
+ ofclasses=modules_by_version[version]['instruction_id'],
+ version=version)
+
def generate_message(out, name, version):
util.render_template(out, 'module.py',
ofclasses=modules_by_version[version]['message'],
diff --git a/py_gen/templates/module.py b/py_gen/templates/module.py
index 252bf0d..30c45ad 100644
--- a/py_gen/templates/module.py
+++ b/py_gen/templates/module.py
@@ -43,6 +43,8 @@
import oxm
:: #endif
:: if version >= OFVersions.VERSION_1_3:
+import action_id
+import instruction_id
import meter_band
:: #endif
import util
diff --git a/py_gen/templates/util.py b/py_gen/templates/util.py
index 8ad246a..ed2698a 100644
--- a/py_gen/templates/util.py
+++ b/py_gen/templates/util.py
@@ -41,6 +41,8 @@
import oxm
:: #endif
:: if version >= OFVersions.VERSION_1_3:
+import action_id
+import instruction_id
import meter_band
:: #endif