pyloxi: add loxi.version_names
diff --git a/py_gen/templates/toplevel_init.py b/py_gen/templates/toplevel_init.py
index 3151404..72f4c81 100644
--- a/py_gen/templates/toplevel_init.py
+++ b/py_gen/templates/toplevel_init.py
@@ -25,10 +25,13 @@
:: # EPL for the specific language governing permissions and limitations
:: # under the EPL.
::
+:: import of_g
:: include('_copyright.py')
:: include('_autogen.py')
+version_names = ${repr(of_g.param_version_names)}
+
def protocol(ver):
"""
Import and return the protocol module for the given wire version.
diff --git a/py_gen/tests/of10.py b/py_gen/tests/of10.py
index 86f9b2b..faa3a3e 100644
--- a/py_gen/tests/of10.py
+++ b/py_gen/tests/of10.py
@@ -36,6 +36,7 @@
def test_toplevel(self):
import loxi
self.assertTrue(hasattr(loxi, "ProtocolError"))
+ self.assertEquals(loxi.version_names[1], "1.0")
ofp = loxi.protocol(1)
self.assertEquals(ofp.OFP_VERSION, 1)
self.assertTrue(hasattr(ofp, "action"))
diff --git a/py_gen/tests/of11.py b/py_gen/tests/of11.py
index ebbfcd4..017043f 100644
--- a/py_gen/tests/of11.py
+++ b/py_gen/tests/of11.py
@@ -36,6 +36,7 @@
def test_toplevel(self):
import loxi
self.assertTrue(hasattr(loxi, "ProtocolError"))
+ self.assertEquals(loxi.version_names[2], "1.1")
ofp = loxi.protocol(2)
self.assertEquals(ofp.OFP_VERSION, 2)
self.assertTrue(hasattr(ofp, "action"))
diff --git a/py_gen/tests/of12.py b/py_gen/tests/of12.py
index ce7ffe1..9c55db2 100644
--- a/py_gen/tests/of12.py
+++ b/py_gen/tests/of12.py
@@ -36,6 +36,7 @@
def test_toplevel(self):
import loxi
self.assertTrue(hasattr(loxi, "ProtocolError"))
+ self.assertEquals(loxi.version_names[3], "1.2")
ofp = loxi.protocol(3)
self.assertEquals(ofp.OFP_VERSION, 3)
self.assertTrue(hasattr(ofp, "action"))
diff --git a/py_gen/tests/of13.py b/py_gen/tests/of13.py
index 3a534e1..638e61d 100644
--- a/py_gen/tests/of13.py
+++ b/py_gen/tests/of13.py
@@ -36,6 +36,7 @@
def test_toplevel(self):
import loxi
self.assertTrue(hasattr(loxi, "ProtocolError"))
+ self.assertEquals(loxi.version_names[4], "1.3")
ofp = loxi.protocol(4)
self.assertEquals(ofp.OFP_VERSION, 4)
self.assertTrue(hasattr(ofp, "action"))