Exemplo n.º 1
0
 def unpack(buf):
     obj = apply_actions()
     if type(buf) == loxi.generic_util.OFReader:
         reader = buf
     else:
         reader = loxi.generic_util.OFReader(buf)
     _type = reader.read("!H")[0]
     assert(_type == 4)
     _len = reader.read("!H")[0]
     reader.skip(4)
     obj.actions = action.unpack_list(reader)
     return obj
Exemplo n.º 2
0
 def unpack(buf):
     obj = apply_actions()
     if type(buf) == loxi.generic_util.OFReader:
         reader = buf
     else:
         reader = loxi.generic_util.OFReader(buf)
     _type = reader.read("!H")[0]
     assert (_type == 4)
     _len = reader.read("!H")[0]
     reader.skip(4)
     obj.actions = action.unpack_list(reader)
     return obj
Exemplo n.º 3
0
 def unpack(buf):
     obj = apply_actions()
     if type(buf) == loxi.generic_util.OFReader:
         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]
     reader.skip(4)
     obj.actions = action.unpack_list(reader)
     return obj
Exemplo n.º 4
0
 def unpack(buf):
     obj = apply_actions()
     if type(buf) == loxi.generic_util.OFReader:
         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]
     reader.skip(4)
     obj.actions = action.unpack_list(reader)
     return obj
Exemplo n.º 5
0
 def unpack(buf):
     assert(len(buf) >= 88) # Should be verified by caller
     obj = flow_stats_entry()
     _length = struct.unpack_from('!H', buf, 0)[0]
     assert(_length == len(buf))
     if _length < 88: raise loxi.ProtocolError("flow_stats_entry length is %d, should be at least 88" % _length)
     obj.table_id = struct.unpack_from('!B', buf, 2)[0]
     obj.pad = struct.unpack_from('!B', buf, 3)[0]
     obj.match = common.match.unpack(buffer(buf, 4))
     obj.duration_sec = struct.unpack_from('!L', buf, 44)[0]
     obj.duration_nsec = struct.unpack_from('!L', buf, 48)[0]
     obj.priority = struct.unpack_from('!H', buf, 52)[0]
     obj.idle_timeout = struct.unpack_from('!H', buf, 54)[0]
     obj.hard_timeout = struct.unpack_from('!H', buf, 56)[0]
     obj.pad2 = list(struct.unpack_from('!6B', buf, 58))
     obj.cookie = struct.unpack_from('!Q', buf, 64)[0]
     obj.packet_count = struct.unpack_from('!Q', buf, 72)[0]
     obj.byte_count = struct.unpack_from('!Q', buf, 80)[0]
     obj.actions = action.unpack_list(buffer(buf, 88))
     return obj
Exemplo n.º 6
0
 def unpack(buf):
     obj = flow_stats_entry()
     if type(buf) == loxi.generic_util.OFReader:
         reader = buf
     else:
         reader = loxi.generic_util.OFReader(buf)
     _length = reader.read("!H")[0]
     obj.table_id = reader.read("!B")[0]
     reader.skip(1)
     obj.match = common.match.unpack(reader)
     obj.duration_sec = reader.read("!L")[0]
     obj.duration_nsec = reader.read("!L")[0]
     obj.priority = reader.read("!H")[0]
     obj.idle_timeout = reader.read("!H")[0]
     obj.hard_timeout = reader.read("!H")[0]
     reader.skip(6)
     obj.cookie = reader.read("!Q")[0]
     obj.packet_count = reader.read("!Q")[0]
     obj.byte_count = reader.read("!Q")[0]
     obj.actions = action.unpack_list(reader)
     return obj
Exemplo n.º 7
0
 def unpack(buf):
     obj = flow_stats_entry()
     if type(buf) == loxi.generic_util.OFReader:
         reader = buf
     else:
         reader = loxi.generic_util.OFReader(buf)
     _length = reader.read('!H')[0]
     obj.table_id = reader.read('!B')[0]
     reader.skip(1)
     obj.match = common.match.unpack(reader)
     obj.duration_sec = reader.read('!L')[0]
     obj.duration_nsec = reader.read('!L')[0]
     obj.priority = reader.read('!H')[0]
     obj.idle_timeout = reader.read('!H')[0]
     obj.hard_timeout = reader.read('!H')[0]
     reader.skip(6)
     obj.cookie = reader.read('!Q')[0]
     obj.packet_count = reader.read('!Q')[0]
     obj.byte_count = reader.read('!Q')[0]
     obj.actions = action.unpack_list(reader)
     return obj