py_gen: adapt to of_g removal / new ir model
diff --git a/py_gen/templates/const.py b/py_gen/templates/const.py
index 4567d56..d1c00f9 100644
--- a/py_gen/templates/const.py
+++ b/py_gen/templates/const.py
@@ -24,6 +24,7 @@
:: # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
:: # EPL for the specific language governing permissions and limitations
:: # under the EPL.
+:: from loxi_globals import OFVersions
::
:: blacklisted_map_groups = ['macro_definitions']
:: blacklisted_map_idents = ['OFPFW_NW_DST_BITS', 'OFPFW_NW_SRC_BITS',
@@ -34,12 +35,12 @@
:: include('_autogen.py')
-OFP_VERSION = ${version}
+OFP_VERSION = ${version.wire_version}
:: for enum in sorted(enums, key=lambda enum: enum.name):
# Identifiers from group ${enum.name}
:: for (ident, value) in enum.values:
-:: if version == 1 and ident.startswith('OFPP_'):
+:: if version == OFVersions.VERSION_1_0 and ident.startswith('OFPP_'):
:: # HACK loxi converts these to 32-bit
${ident} = ${"%#x" % (value & 0xffff)}
:: else:
@@ -52,7 +53,7 @@
:: for (ident, value) in enum.values:
:: if ident in blacklisted_map_idents:
:: pass
-:: elif version == 1 and ident.startswith('OFPP_'):
+:: elif version == OFVersions.VERSION_1_0 and ident.startswith('OFPP_'):
:: # HACK loxi converts these to 32-bit
${"%#x" % (value & 0xffff)}: ${repr(ident)},
:: else: