update pyloxi to c47bc6facb2869a7833b8694b7a20b3113284d94
diff --git a/src/python/loxi/of12/action.py b/src/python/loxi/of12/action.py
index f1f9272..9ae3d8f 100644
--- a/src/python/loxi/of12/action.py
+++ b/src/python/loxi/of12/action.py
@@ -11,6 +11,7 @@
import util
import loxi.generic_util
import loxi
+import oxm # for unpack
def unpack_list(reader):
def deserializer(reader, typ):
@@ -756,15 +757,17 @@
if field != None:
self.field = field
else:
- self.field = ''
+ self.field = None
return
def pack(self):
packed = []
packed.append(struct.pack("!H", self.type))
packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
- packed.append(self.field)
+ packed.append(self.field.pack())
length = sum([len(x) for x in packed])
+ packed.append(loxi.generic_util.pad_to(8, length))
+ length += len(packed[-1])
packed[1] = struct.pack("!H", length)
return ''.join(packed)
@@ -778,7 +781,8 @@
_type = reader.read("!H")[0]
assert(_type == 25)
_len = reader.read("!H")[0]
- obj.field = str(reader.read_all())
+ obj.field = oxm.unpack(reader)
+ reader.skip_align()
return obj
def __eq__(self, other):
diff --git a/src/python/loxi/of12/common.py b/src/python/loxi/of12/common.py
index f2d2493..698fe7a 100644
--- a/src/python/loxi/of12/common.py
+++ b/src/python/loxi/of12/common.py
@@ -706,7 +706,7 @@
packed.append(util.pack_list(self.oxm_list))
length = sum([len(x) for x in packed])
packed[1] = struct.pack("!H", length)
- packed.append('\x00' * ((length + 7)/8*8 - length))
+ packed.append(loxi.generic_util.pad_to(8, length))
return ''.join(packed)
@staticmethod
@@ -720,7 +720,7 @@
assert(_type == 1)
_length = reader.read("!H")[0]
obj.oxm_list = oxm.unpack_list(reader.slice(_length-4))
- reader.skip((_length + 7)/8*8 - _length)
+ reader.skip_align()
return obj
def __eq__(self, other):
diff --git a/src/python/loxi/of12/const.py b/src/python/loxi/of12/const.py
index 20f99bb..b654b1a 100644
--- a/src/python/loxi/of12/const.py
+++ b/src/python/loxi/of12/const.py
@@ -187,6 +187,15 @@
65535: 'OF_BSN_VPORT_Q_IN_Q_UNTAGGED',
}
+# Identifiers from group ofp_bsn_vport_status
+OF_BSN_VPORT_STATUS_OK = 0
+OF_BSN_VPORT_STATUS_FAILED = 1
+
+ofp_bsn_vport_status_map = {
+ 0: 'OF_BSN_VPORT_STATUS_OK',
+ 1: 'OF_BSN_VPORT_STATUS_FAILED',
+}
+
# Identifiers from group ofp_capabilities
OFPC_FLOW_STATS = 1
OFPC_TABLE_STATS = 2
diff --git a/src/python/loxi/of12/oxm.py b/src/python/loxi/of12/oxm.py
index f17151e..0fd7948 100644
--- a/src/python/loxi/of12/oxm.py
+++ b/src/python/loxi/of12/oxm.py
@@ -12,15 +12,16 @@
import loxi.generic_util
import loxi
+def unpack(reader):
+ type_len, = reader.peek('!L')
+ if type_len in parsers:
+ return parsers[type_len](reader)
+ else:
+ raise loxi.ProtocolError("unknown OXM cls=%#x type=%#x masked=%d len=%d (%#x)" % \
+ ((type_len >> 16) & 0xffff, (type_len >> 9) & 0x7f, (type_len >> 8) & 1, type_len & 0xff, type_len))
+
def unpack_list(reader):
- def deserializer(reader):
- type_len, = reader.peek('!L')
- if type_len in parsers:
- return parsers[type_len](reader)
- else:
- raise loxi.ProtocolError("unknown OXM cls=%#x type=%#x masked=%d len=%d (%#x)" % \
- ((type_len >> 16) & 0xffff, (type_len >> 9) & 0x7f, (type_len >> 8) & 1, type_len & 0xff, type_len))
- return loxi.generic_util.unpack_list(reader, deserializer)
+ return loxi.generic_util.unpack_list(reader, unpack)
class OXM(object):
type_len = None # override in subclass
@@ -1907,7 +1908,7 @@
with q.indent(2):
q.breakable()
q.text("value = ");
- q.text("%#x" % self.value)
+ q.text(util.pretty_ipv4(self.value))
q.breakable()
q.text('}')
@@ -1963,10 +1964,10 @@
with q.indent(2):
q.breakable()
q.text("value = ");
- q.text("%#x" % self.value)
+ q.text(util.pretty_ipv4(self.value))
q.text(","); q.breakable()
q.text("value_mask = ");
- q.text("%#x" % self.value_mask)
+ q.text(util.pretty_ipv4(self.value_mask))
q.breakable()
q.text('}')
@@ -2015,7 +2016,7 @@
with q.indent(2):
q.breakable()
q.text("value = ");
- q.text("%#x" % self.value)
+ q.text(util.pretty_ipv4(self.value))
q.breakable()
q.text('}')
@@ -2071,10 +2072,10 @@
with q.indent(2):
q.breakable()
q.text("value = ");
- q.text("%#x" % self.value)
+ q.text(util.pretty_ipv4(self.value))
q.text(","); q.breakable()
q.text("value_mask = ");
- q.text("%#x" % self.value_mask)
+ q.text(util.pretty_ipv4(self.value_mask))
q.breakable()
q.text('}')