changes from loxigen e8e6401509
diff --git a/src/python/loxi/of12/instruction.py b/src/python/loxi/of12/instruction.py
index 52ee289..961f3c6 100644
--- a/src/python/loxi/of12/instruction.py
+++ b/src/python/loxi/of12/instruction.py
@@ -1,6 +1,7 @@
# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
# Copyright (c) 2011, 2012 Open Networking Foundation
# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+# See the file LICENSE.pyloxi which should have been included in the source distribution
# Automatically generated by LOXI from template instruction.py
# Do not modify
@@ -24,7 +25,7 @@
pass
class apply_actions(Instruction):
- type = const.OFPIT_APPLY_ACTIONS
+ type = 4
def __init__(self, actions=None):
if actions != None:
@@ -38,7 +39,7 @@
packed.append(struct.pack("!H", self.type))
packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
packed.append('\x00' * 4)
- packed.append("".join([x.pack() for x in self.actions]))
+ packed.append(util.pack_list(self.actions))
length = sum([len(x) for x in packed])
packed[1] = struct.pack("!H", length)
return ''.join(packed)
@@ -50,9 +51,9 @@
reader = buf
else:
reader = loxi.generic_util.OFReader(buf)
- _type = reader.read('!H')[0]
- assert(_type == const.OFPIT_APPLY_ACTIONS)
- _len = reader.read('!H')[0]
+ _type = reader.read("!H")[0]
+ assert(_type == 4)
+ _len = reader.read("!H")[0]
reader.skip(4)
obj.actions = action.unpack_list(reader)
return obj
@@ -80,7 +81,7 @@
q.text('}')
class clear_actions(Instruction):
- type = const.OFPIT_CLEAR_ACTIONS
+ type = 5
def __init__(self):
return
@@ -101,9 +102,9 @@
reader = buf
else:
reader = loxi.generic_util.OFReader(buf)
- _type = reader.read('!H')[0]
- assert(_type == const.OFPIT_CLEAR_ACTIONS)
- _len = reader.read('!H')[0]
+ _type = reader.read("!H")[0]
+ assert(_type == 5)
+ _len = reader.read("!H")[0]
reader.skip(4)
return obj
@@ -127,7 +128,7 @@
q.text('}')
class experimenter(Instruction):
- type = const.OFPIT_EXPERIMENTER
+ type = 65535
def __init__(self, experimenter=None, data=None):
if experimenter != None:
@@ -137,7 +138,7 @@
if data != None:
self.data = data
else:
- self.data = ""
+ self.data = ''
return
def pack(self):
@@ -157,10 +158,10 @@
reader = buf
else:
reader = loxi.generic_util.OFReader(buf)
- _type = reader.read('!H')[0]
- assert(_type == const.OFPIT_EXPERIMENTER)
- _len = reader.read('!H')[0]
- obj.experimenter = reader.read('!L')[0]
+ _type = reader.read("!H")[0]
+ assert(_type == 65535)
+ _len = reader.read("!H")[0]
+ obj.experimenter = reader.read("!L")[0]
obj.data = str(reader.read_all())
return obj
@@ -191,7 +192,7 @@
q.text('}')
class goto_table(Instruction):
- type = const.OFPIT_GOTO_TABLE
+ type = 1
def __init__(self, table_id=None):
if table_id != None:
@@ -217,10 +218,10 @@
reader = buf
else:
reader = loxi.generic_util.OFReader(buf)
- _type = reader.read('!H')[0]
- assert(_type == const.OFPIT_GOTO_TABLE)
- _len = reader.read('!H')[0]
- obj.table_id = reader.read('!B')[0]
+ _type = reader.read("!H")[0]
+ assert(_type == 1)
+ _len = reader.read("!H")[0]
+ obj.table_id = reader.read("!B")[0]
reader.skip(3)
return obj
@@ -247,7 +248,7 @@
q.text('}')
class write_actions(Instruction):
- type = const.OFPIT_WRITE_ACTIONS
+ type = 3
def __init__(self, actions=None):
if actions != None:
@@ -261,7 +262,7 @@
packed.append(struct.pack("!H", self.type))
packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
packed.append('\x00' * 4)
- packed.append("".join([x.pack() for x in self.actions]))
+ packed.append(util.pack_list(self.actions))
length = sum([len(x) for x in packed])
packed[1] = struct.pack("!H", length)
return ''.join(packed)
@@ -273,9 +274,9 @@
reader = buf
else:
reader = loxi.generic_util.OFReader(buf)
- _type = reader.read('!H')[0]
- assert(_type == const.OFPIT_WRITE_ACTIONS)
- _len = reader.read('!H')[0]
+ _type = reader.read("!H")[0]
+ assert(_type == 3)
+ _len = reader.read("!H")[0]
reader.skip(4)
obj.actions = action.unpack_list(reader)
return obj
@@ -303,7 +304,7 @@
q.text('}')
class write_metadata(Instruction):
- type = const.OFPIT_WRITE_METADATA
+ type = 2
def __init__(self, metadata=None, metadata_mask=None):
if metadata != None:
@@ -334,12 +335,12 @@
reader = buf
else:
reader = loxi.generic_util.OFReader(buf)
- _type = reader.read('!H')[0]
- assert(_type == const.OFPIT_WRITE_METADATA)
- _len = reader.read('!H')[0]
+ _type = reader.read("!H")[0]
+ assert(_type == 2)
+ _len = reader.read("!H")[0]
reader.skip(4)
- obj.metadata = reader.read('!Q')[0]
- obj.metadata_mask = reader.read('!Q')[0]
+ obj.metadata = reader.read("!Q")[0]
+ obj.metadata_mask = reader.read("!Q")[0]
return obj
def __eq__(self, other):
@@ -370,10 +371,10 @@
parsers = {
+ const.OFPIT_GOTO_TABLE : goto_table.unpack,
+ const.OFPIT_WRITE_METADATA : write_metadata.unpack,
+ const.OFPIT_WRITE_ACTIONS : write_actions.unpack,
const.OFPIT_APPLY_ACTIONS : apply_actions.unpack,
const.OFPIT_CLEAR_ACTIONS : clear_actions.unpack,
const.OFPIT_EXPERIMENTER : experimenter.unpack,
- const.OFPIT_GOTO_TABLE : goto_table.unpack,
- const.OFPIT_WRITE_ACTIONS : write_actions.unpack,
- const.OFPIT_WRITE_METADATA : write_metadata.unpack,
}