pyloxi: move remaining basic serialization tests to datafiles
diff --git a/py_gen/tests/of10.py b/py_gen/tests/of10.py
index c91c7b3..e593e0f 100644
--- a/py_gen/tests/of10.py
+++ b/py_gen/tests/of10.py
@@ -158,7 +158,6 @@
def test_echo_request_equality(self):
msg = ofp.message.echo_request(xid=0x12345678, data="abc")
msg2 = ofp.message.echo_request(xid=0x12345678, data="abc")
- #msg2 = ofp.message.echo_request.unpack(msg.pack())
self.assertEquals(msg, msg2)
msg2.xid = 1
@@ -169,468 +168,10 @@
self.assertNotEquals(msg, msg2)
msg2.data = msg.data
- def test_flow_add(self):
- match = ofp.match()
- msg = ofp.message.flow_add(xid=1,
- match=match,
- cookie=1,
- idle_timeout=5,
- flags=ofp.OFPFF_CHECK_OVERLAP,
- actions=[
- ofp.action.output(port=1),
- ofp.action.output(port=2),
- ofp.action.output(port=ofp.OFPP_CONTROLLER,
- max_len=1024)])
- buf = msg.pack()
- msg2 = ofp.message.flow_add.unpack(buf)
- self.assertEquals(msg, msg2)
-
- def test_port_mod_pack(self):
- msg = ofp.message.port_mod(xid=2,
- port_no=ofp.OFPP_CONTROLLER,
- hw_addr=[1,2,3,4,5,6],
- config=0x90ABCDEF,
- mask=0xFF11FF11,
- advertise=0xCAFE6789)
- expected = "\x01\x0f\x00\x20\x00\x00\x00\x02\xff\xfd\x01\x02\x03\x04\x05\x06\x90\xab\xcd\xef\xff\x11\xff\x11\xca\xfe\x67\x89\x00\x00\x00\x00"
- self.assertEquals(expected, msg.pack())
-
- def test_desc_stats_reply_pack(self):
- msg = ofp.message.desc_stats_reply(xid=3,
- flags=ofp.OFPSF_REPLY_MORE,
- mfr_desc="The Indigo-2 Community",
- hw_desc="Unknown server",
- sw_desc="Indigo-2 LRI pre-release",
- serial_num="11235813213455",
- dp_desc="Indigo-2 LRI forwarding module")
- expected = ''.join([
- '\x01', '\x11', # version/type
- '\x04\x2c', # length
- '\x00\x00\x00\x03', # xid
- '\x00\x00', # stats_type
- '\x00\x01', # flags
- 'The Indigo-2 Community'.ljust(256, '\x00'), # mfr_desc
- 'Unknown server'.ljust(256, '\x00'), # hw_desc
- 'Indigo-2 LRI pre-release'.ljust(256, '\x00'), # sw_desc
- '11235813213455'.ljust(32, '\x00'), # serial_num
- 'Indigo-2 LRI forwarding module'.ljust(256, '\x00'), # dp_desc
- ])
- self.assertEquals(expected, msg.pack())
-
- def test_desc_stats_reply_unpack(self):
- buf = ''.join([
- '\x01', '\x11', # version/type
- '\x04\x2c', # length
- '\x00\x00\x00\x03', # xid
- '\x00\x00', # stats_type
- '\x00\x01', # flags
- 'The Indigo-2 Community'.ljust(256, '\x00'), # mfr_desc
- 'Unknown server'.ljust(256, '\x00'), # hw_desc
- 'Indigo-2 LRI pre-release'.ljust(256, '\x00'), # sw_desc
- '11235813213455'.ljust(32, '\x00'), # serial_num
- 'Indigo-2 LRI forwarding module'.ljust(256, '\x00'), # dp_desc
- ])
- msg = ofp.message.desc_stats_reply.unpack(buf)
- self.assertEquals('Indigo-2 LRI forwarding module', msg.dp_desc)
- self.assertEquals('11235813213455', msg.serial_num)
- self.assertEquals(ofp.OFPST_DESC, msg.stats_type)
- self.assertEquals(ofp.OFPSF_REPLY_MORE, msg.flags)
-
- def test_port_status_pack(self):
- desc = ofp.port_desc(port_no=ofp.OFPP_CONTROLLER,
- hw_addr=[1,2,3,4,5,6],
- name="foo",
- config=ofp.OFPPC_NO_FLOOD,
- state=ofp.OFPPS_STP_FORWARD,
- curr=ofp.OFPPF_10MB_HD,
- advertised=ofp.OFPPF_1GB_FD,
- supported=ofp.OFPPF_AUTONEG,
- peer=ofp.OFPPF_PAUSE_ASYM)
-
- msg = ofp.message.port_status(xid=4,
- reason=ofp.OFPPR_DELETE,
- desc=desc)
- expected = ''.join([
- '\x01', '\x0c', # version/type
- '\x00\x40', # length
- '\x00\x00\x00\x04', # xid
- '\x01', # reason
- '\x00\x00\x00\x00\x00\x00\x00' # pad
- '\xff\xfd', # desc.port_no
- '\x01\x02\x03\x04\x05\x06', # desc.hw_addr
- 'foo'.ljust(16, '\x00'), # desc.name
- '\x00\x00\x00\x10', # desc.config
- '\x00\x00\x02\x00', # desc.state
- '\x00\x00\x00\x01', # desc.curr
- '\x00\x00\x00\x20', # desc.advertised
- '\x00\x00\x02\x00', # desc.supported
- '\x00\x00\x08\x00', # desc.peer
- ])
- self.assertEquals(expected, msg.pack())
-
- def test_port_status_unpack(self):
- buf = ''.join([
- '\x01', '\x0c', # version/type
- '\x00\x40', # length
- '\x00\x00\x00\x04', # xid
- '\x01', # reason
- '\x00\x00\x00\x00\x00\x00\x00' # pad
- '\xff\xfd', # desc.port_no
- '\x01\x02\x03\x04\x05\x06', # desc.hw_addr
- 'foo'.ljust(16, '\x00'), # desc.name
- '\x00\x00\x00\x10', # desc.config
- '\x00\x00\x02\x00', # desc.state
- '\x00\x00\x00\x01', # desc.curr
- '\x00\x00\x00\x20', # desc.advertised
- '\x00\x00\x02\x00', # desc.supported
- '\x00\x00\x08\x00', # desc.peer
- ])
- msg = ofp.message.port_status.unpack(buf)
- self.assertEquals('foo', msg.desc.name)
- self.assertEquals(ofp.OFPPF_PAUSE_ASYM, msg.desc.peer)
-
- def test_port_stats_reply_pack(self):
- msg = ofp.message.port_stats_reply(xid=5, flags=0, entries=[
- ofp.port_stats_entry(port_no=1, rx_packets=56, collisions=5),
- ofp.port_stats_entry(port_no=ofp.OFPP_LOCAL, rx_packets=1, collisions=1)])
- expected = ''.join([
- '\x01', '\x11', # version/type
- '\x00\xdc', # length
- '\x00\x00\x00\x05', # xid
- '\x00\x04', # stats_type
- '\x00\x00', # flags
- '\x00\x01', # entries[0].port_no
- '\x00\x00\x00\x00\x00\x00' # entries[0].pad
- '\x00\x00\x00\x00\x00\x00\x00\x38', # entries[0].rx_packets
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].tx_packets
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].rx_bytes
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].tx_bytes
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].rx_dropped
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].tx_dropped
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].rx_errors
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].tx_errors
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].rx_frame_err
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].rx_over_err
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].rx_crc_err
- '\x00\x00\x00\x00\x00\x00\x00\x05', # entries[0].collisions
- '\xff\xfe', # entries[1].port_no
- '\x00\x00\x00\x00\x00\x00' # entries[1].pad
- '\x00\x00\x00\x00\x00\x00\x00\x01', # entries[1].rx_packets
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].tx_packets
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].rx_bytes
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].tx_bytes
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].rx_dropped
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].tx_dropped
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].rx_errors
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].tx_errors
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].rx_frame_err
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].rx_over_err
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].rx_crc_err
- '\x00\x00\x00\x00\x00\x00\x00\x01', # entries[1].collisions
- ])
- self.assertEquals(expected, msg.pack())
-
- def test_port_stats_reply_unpack(self):
- buf = ''.join([
- '\x01', '\x11', # version/type
- '\x00\xdc', # length
- '\x00\x00\x00\x05', # xid
- '\x00\x04', # stats_type
- '\x00\x00', # flags
- '\x00\x01', # entries[0].port_no
- '\x00\x00\x00\x00\x00\x00' # entries[0].pad
- '\x00\x00\x00\x00\x00\x00\x00\x38', # entries[0].rx_packets
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].tx_packets
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].rx_bytes
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].tx_bytes
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].rx_dropped
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].tx_dropped
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].rx_errors
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].tx_errors
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].rx_frame_err
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].rx_over_err
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[0].rx_crc_err
- '\x00\x00\x00\x00\x00\x00\x00\x05', # entries[0].collisions
- '\xff\xfe', # entries[1].port_no
- '\x00\x00\x00\x00\x00\x00' # entries[1].pad
- '\x00\x00\x00\x00\x00\x00\x00\x01', # entries[1].rx_packets
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].tx_packets
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].rx_bytes
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].tx_bytes
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].rx_dropped
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].tx_dropped
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].rx_errors
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].tx_errors
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].rx_frame_err
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].rx_over_err
- '\x00\x00\x00\x00\x00\x00\x00\x00', # entries[1].rx_crc_err
- '\x00\x00\x00\x00\x00\x00\x00\x01', # entries[1].collisions
- ])
- msg = ofp.message.port_stats_reply.unpack(buf)
- self.assertEquals(ofp.OFPST_PORT, msg.stats_type)
- self.assertEquals(2, len(msg.entries))
-
- sample_flow_stats_reply_buf = ''.join([
- '\x01', '\x11', # version/type
- '\x00\xe4', # length
- '\x00\x00\x00\x06', # xid
- '\x00\x01', # stats_type
- '\x00\x00', # flags
- '\x00\x68', # entries[0].length
- '\x03', # entries[0].table_id
- '\x00', # entries[0].pad
- '\x00\x3f\xff\xff', # entries[0].match.wildcards
- '\x00' * 36, # remaining match fields
- '\x00\x00\x00\x01', # entries[0].duration_sec
- '\x00\x00\x00\x02', # entries[0].duration_nsec
- '\x00\x64', # entries[0].priority
- '\x00\x05', # entries[0].idle_timeout
- '\x00\x0a', # entries[0].hard_timeout
- '\x00' * 6, # entries[0].pad2
- '\x01\x23\x45\x67\x89\xab\xcd\xef', # entries[0].cookie
- '\x00\x00\x00\x00\x00\x00\x00\x0a', # entries[0].packet_count
- '\x00\x00\x00\x00\x00\x00\x03\xe8', # entries[0].byte_count
- '\x00\x00', # entries[0].actions[0].type
- '\x00\x08', # entries[0].actions[0].len
- '\x00\x01', # entries[0].actions[0].port
- '\x00\x00', # entries[0].actions[0].max_len
- '\x00\x00', # entries[0].actions[1].type
- '\x00\x08', # entries[0].actions[1].len
- '\x00\x02', # entries[0].actions[1].port
- '\x00\x00', # entries[0].actions[1].max_len
- '\x00\x70', # entries[1].length
- '\x04', # entries[1].table_id
- '\x00', # entries[1].pad
- '\x00\x3f\xff\xff', # entries[1].match.wildcards
- '\x00' * 36, # remaining match fields
- '\x00\x00\x00\x01', # entries[1].duration_sec
- '\x00\x00\x00\x02', # entries[1].duration_nsec
- '\x00\x64', # entries[1].priority
- '\x00\x05', # entries[1].idle_timeout
- '\x00\x0a', # entries[1].hard_timeout
- '\x00' * 6, # entries[1].pad2
- '\x01\x23\x45\x67\x89\xab\xcd\xef', # entries[1].cookie
- '\x00\x00\x00\x00\x00\x00\x00\x0a', # entries[1].packet_count
- '\x00\x00\x00\x00\x00\x00\x03\xe8', # entries[1].byte_count
- '\x00\x00', # entries[1].actions[0].type
- '\x00\x08', # entries[1].actions[0].len
- '\x00\x01', # entries[1].actions[0].port
- '\x00\x00', # entries[1].actions[0].max_len
- '\x00\x00', # entries[1].actions[1].type
- '\x00\x08', # entries[1].actions[1].len
- '\x00\x02', # entries[1].actions[1].port
- '\x00\x00', # entries[1].actions[1].max_len
- '\x00\x00', # entries[1].actions[2].type
- '\x00\x08', # entries[1].actions[2].len
- '\x00\x03', # entries[1].actions[2].port
- '\x00\x00', # entries[1].actions[2].max_len
- ])
-
- def test_flow_stats_reply_pack(self):
- msg = ofp.message.flow_stats_reply(xid=6, flags=0, entries=[
- ofp.flow_stats_entry(table_id=3,
- match=ofp.match(),
- duration_sec=1,
- duration_nsec=2,
- priority=100,
- idle_timeout=5,
- hard_timeout=10,
- cookie=0x0123456789abcdef,
- packet_count=10,
- byte_count=1000,
- actions=[ofp.action.output(port=1),
- ofp.action.output(port=2)]),
- ofp.flow_stats_entry(table_id=4,
- match=ofp.match(),
- duration_sec=1,
- duration_nsec=2,
- priority=100,
- idle_timeout=5,
- hard_timeout=10,
- cookie=0x0123456789abcdef,
- packet_count=10,
- byte_count=1000,
- actions=[ofp.action.output(port=1),
- ofp.action.output(port=2),
- ofp.action.output(port=3)])])
- self.assertEquals(self.sample_flow_stats_reply_buf, msg.pack())
-
- def test_flow_stats_reply_unpack(self):
- msg = ofp.message.flow_stats_reply.unpack(self.sample_flow_stats_reply_buf)
- self.assertEquals(ofp.OFPST_FLOW, msg.stats_type)
- self.assertEquals(2, len(msg.entries))
- self.assertEquals(2, len(msg.entries[0].actions))
- self.assertEquals(3, len(msg.entries[1].actions))
-
- def test_flow_add_show(self):
- expected = """\
-flow_add {
- xid = None,
- match = match_v1 {
- wildcards = OFPFW_DL_SRC|OFPFW_DL_DST,
- in_port = 3,
- eth_src = 01:23:45:67:89:ab,
- eth_dst = cd:ef:01:23:45:67,
- vlan_vid = 0x0,
- vlan_pcp = 0x0,
- eth_type = 0x0,
- ip_dscp = 0x0,
- ip_proto = 0x0,
- ipv4_src = 192.168.3.127,
- ipv4_dst = 255.255.255.255,
- tcp_src = 0x0,
- tcp_dst = 0x0
- },
- cookie = 0x0,
- idle_timeout = 0x0,
- hard_timeout = 0x0,
- priority = 0x0,
- buffer_id = 0x0,
- out_port = 0,
- flags = 0x0,
- actions = [
- output { port = OFPP_FLOOD, max_len = 0x0 },
- nicira_dec_ttl { },
- bsn_set_tunnel_dst { dst = 0x0 }
- ]
-}"""
- msg = ofp.message.flow_add(
- match=ofp.match(
- wildcards=ofp.OFPFW_DL_SRC|ofp.OFPFW_DL_DST,
- in_port=3,
- ipv4_src=0xc0a8037f,
- ipv4_dst=0xffffffff,
- eth_src=[0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
- eth_dst=[0xcd, 0xef, 0x01, 0x23, 0x45, 0x67]),
- actions=[
- ofp.action.output(port=ofp.OFPP_FLOOD),
- ofp.action.nicira_dec_ttl(),
- ofp.action.bsn_set_tunnel_dst()])
- self.assertEquals(msg.show(), expected)
-
- sample_packet_out_buf = ''.join([
- '\x01', '\x0d', # version/type
- '\x00\x23', # length
- '\x12\x34\x56\x78', # xid
- '\xab\xcd\xef\x01', # buffer_id
- '\xff\xfe', # in_port
- '\x00\x10', # actions_len
- '\x00\x00', # actions[0].type
- '\x00\x08', # actions[0].len
- '\x00\x01', # actions[0].port
- '\x00\x00', # actions[0].max_len
- '\x00\x00', # actions[1].type
- '\x00\x08', # actions[1].len
- '\x00\x02', # actions[1].port
- '\x00\x00', # actions[1].max_len
- 'abc' # data
- ])
-
- def test_packet_out_pack(self):
- msg = ofp.message.packet_out(
- xid=0x12345678,
- buffer_id=0xabcdef01,
- in_port=ofp.OFPP_LOCAL,
- actions=[
- ofp.action.output(port=1),
- ofp.action.output(port=2)],
- data='abc')
- self.assertEquals(self.sample_packet_out_buf, msg.pack())
-
- def test_packet_out_unpack(self):
- msg = ofp.message.packet_out.unpack(self.sample_packet_out_buf)
- self.assertEquals(0x12345678, msg.xid)
- self.assertEquals(0xabcdef01, msg.buffer_id)
- self.assertEquals(ofp.OFPP_LOCAL, msg.in_port)
- self.assertEquals(2, len(msg.actions))
- self.assertEquals(1, msg.actions[0].port)
- self.assertEquals(2, msg.actions[1].port)
- self.assertEquals('abc', msg.data)
-
- sample_packet_in_buf = ''.join([
- '\x01', '\x0a', # version/type
- '\x00\x15', # length
- '\x12\x34\x56\x78', # xid
- '\xab\xcd\xef\x01', # buffer_id
- '\x00\x09', # total_len
- '\xff\xfe', # in_port
- '\x01', # reason
- '\x00', # pad
- 'abc', # data
- ])
-
- def test_packet_in_pack(self):
- msg = ofp.message.packet_in(
- xid=0x12345678,
- buffer_id=0xabcdef01,
- total_len=9,
- in_port=ofp.OFPP_LOCAL,
- reason=ofp.OFPR_ACTION,
- data='abc')
- self.assertEquals(self.sample_packet_in_buf, msg.pack())
-
- def test_packet_in_unpack(self):
- msg = ofp.message.packet_in.unpack(self.sample_packet_in_buf)
- self.assertEquals(0x12345678, msg.xid)
- self.assertEquals(0xabcdef01, msg.buffer_id)
- self.assertEquals(9, msg.total_len)
- self.assertEquals(ofp.OFPP_LOCAL, msg.in_port)
- self.assertEquals(ofp.OFPR_ACTION, msg.reason)
- self.assertEquals('abc', msg.data)
-
- sample_queue_get_config_reply_buf = ''.join([
- '\x01', '\x15', # version/type
- '\x00\x50', # length
- '\x12\x34\x56\x78', # xid
- '\xff\xfe', # port
- '\x00\x00\x00\x00\x00\x00', # pad
- '\x00\x00\x00\x01', # queues[0].queue_id
- '\x00\x18', # queues[0].len
- '\x00\x00', # queues[0].pad
- '\x00\x01', # queues[0].properties[0].type
- '\x00\x10', # queues[0].properties[0].length
- '\x00\x00\x00\x00', # queues[0].properties[0].pad
- '\x00\x05', # queues[0].properties[0].rate
- '\x00\x00\x00\x00\x00\x00', # queues[0].properties[0].pad2
- '\x00\x00\x00\x02', # queues[1].queue_id
- '\x00\x28', # queues[1].len
- '\x00\x00', # queues[1].pad
- '\x00\x01', # queues[1].properties[0].type
- '\x00\x10', # queues[1].properties[0].length
- '\x00\x00\x00\x00', # queues[1].properties[0].pad
- '\x00\x06', # queues[1].properties[0].rate
- '\x00\x00\x00\x00\x00\x00', # queues[1].properties[0].pad2
- '\x00\x01', # queues[1].properties[1].type
- '\x00\x10', # queues[1].properties[1].length
- '\x00\x00\x00\x00', # queues[1].properties[1].pad
- '\x00\x07', # queues[1].properties[1].rate
- '\x00\x00\x00\x00\x00\x00', # queues[1].properties[1].pad2
- ])
-
- def test_queue_get_config_reply_pack(self):
- msg = ofp.message.queue_get_config_reply(
- xid=0x12345678,
- port=ofp.OFPP_LOCAL,
- queues=[
- ofp.packet_queue(queue_id=1, properties=[
- ofp.queue_prop_min_rate(rate=5)]),
- ofp.packet_queue(queue_id=2, properties=[
- ofp.queue_prop_min_rate(rate=6),
- ofp.queue_prop_min_rate(rate=7)])])
- self.assertEquals(self.sample_queue_get_config_reply_buf, msg.pack())
-
- def test_queue_get_config_reply_unpack(self):
- msg = ofp.message.queue_get_config_reply.unpack(self.sample_queue_get_config_reply_buf)
- self.assertEquals(ofp.OFPP_LOCAL, msg.port)
- self.assertEquals(msg.queues[0].queue_id, 1)
- self.assertEquals(msg.queues[0].properties[0].rate, 5)
- self.assertEquals(msg.queues[1].queue_id, 2)
- self.assertEquals(msg.queues[1].properties[0].rate, 6)
- self.assertEquals(msg.queues[1].properties[1].rate, 7)
-
+# The majority of the serialization tests are created here using the files in
+# the test_data directory.
class TestDataFiles(unittest.TestCase):
pass
-
add_datafiles_tests(TestDataFiles, 'of10/', ofp)
class TestParse(unittest.TestCase):
diff --git a/test_data/of10/desc_stats_reply.data b/test_data/of10/desc_stats_reply.data
new file mode 100644
index 0000000..b4b3eb1
--- /dev/null
+++ b/test_data/of10/desc_stats_reply.data
@@ -0,0 +1,147 @@
+-- binary
+01 11 # version / type
+04 2c # length
+00 00 00 03 # xid
+00 00 # stats_type
+00 01 # flags
+54 68 65 20 49 6e 64 69 # mfr_desc
+67 6f 2d 32 20 43 6f 6d # ...
+6d 75 6e 69 74 79 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+55 6e 6b 6e 6f 77 6e 20 # hw_desc
+73 65 72 76 65 72 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+49 6e 64 69 67 6f 2d 32 # sw_desc
+20 4c 52 49 20 70 72 65 # ...
+2d 72 65 6c 65 61 73 65 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+31 31 32 33 35 38 31 33 # serial_num
+32 31 33 34 35 35 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+49 6e 64 69 67 6f 2d 32 # dp_desc
+20 4c 52 49 20 66 6f 72 # ...
+77 61 72 64 69 6e 67 20 # ...
+6d 6f 64 75 6c 65 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+-- python
+ofp.message.desc_stats_reply(
+ xid=3,
+ flags=ofp.OFPSF_REPLY_MORE,
+ mfr_desc="The Indigo-2 Community",
+ hw_desc="Unknown server",
+ sw_desc="Indigo-2 LRI pre-release",
+ serial_num="11235813213455",
+ dp_desc="Indigo-2 LRI forwarding module")
diff --git a/test_data/of10/flow_add.data b/test_data/of10/flow_add.data
new file mode 100644
index 0000000..9801a36
--- /dev/null
+++ b/test_data/of10/flow_add.data
@@ -0,0 +1,62 @@
+-- binary
+01 0e 00 70 12 34 56 78
+00 00 00 0c 00 03 01 23
+45 67 89 ab cd ef 01 23
+45 67 00 00 00 00 00 00
+00 00 00 00 c0 a8 03 7f
+ff ff ff ff 00 00 00 00
+00 00 00 00 00 00 00 00
+00 00 00 05 00 00 00 00
+00 00 00 00 00 00 00 02
+00 00 00 08 ff fb 00 00
+ff ff 00 10 00 00 23 20
+00 12 00 00 00 00 00 00
+ff ff 00 10 00 5c 16 c7
+00 00 00 02 00 00 00 00
+-- python
+ofp.message.flow_add(
+ xid=0x12345678,
+ match=ofp.match(
+ wildcards=ofp.OFPFW_DL_SRC|ofp.OFPFW_DL_DST,
+ in_port=3,
+ ipv4_src=0xc0a8037f,
+ ipv4_dst=0xffffffff,
+ eth_src=[0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
+ eth_dst=[0xcd, 0xef, 0x01, 0x23, 0x45, 0x67]),
+ idle_timeout=5,
+ flags=ofp.OFPFF_CHECK_OVERLAP,
+ actions=[
+ ofp.action.output(port=ofp.OFPP_FLOOD),
+ ofp.action.nicira_dec_ttl(),
+ ofp.action.bsn_set_tunnel_dst()])
+-- python pretty-printer
+flow_add {
+ xid = 0x12345678,
+ match = match_v1 {
+ wildcards = OFPFW_DL_SRC|OFPFW_DL_DST,
+ in_port = 3,
+ eth_src = 01:23:45:67:89:ab,
+ eth_dst = cd:ef:01:23:45:67,
+ vlan_vid = 0x0,
+ vlan_pcp = 0x0,
+ eth_type = 0x0,
+ ip_dscp = 0x0,
+ ip_proto = 0x0,
+ ipv4_src = 192.168.3.127,
+ ipv4_dst = 255.255.255.255,
+ tcp_src = 0x0,
+ tcp_dst = 0x0
+ },
+ cookie = 0x0,
+ idle_timeout = 0x5,
+ hard_timeout = 0x0,
+ priority = 0x0,
+ buffer_id = 0x0,
+ out_port = 0,
+ flags = 0x2,
+ actions = [
+ output { port = OFPP_FLOOD, max_len = 0x0 },
+ nicira_dec_ttl { },
+ bsn_set_tunnel_dst { dst = 0x0 }
+ ]
+}
diff --git a/test_data/of10/flow_stats_reply.data b/test_data/of10/flow_stats_reply.data
new file mode 100644
index 0000000..38db4d5
--- /dev/null
+++ b/test_data/of10/flow_stats_reply.data
@@ -0,0 +1,92 @@
+-- binary
+01 11 # version/type
+00 e4 # length
+00 00 00 06 # xid
+00 01 # stats_type
+00 00 # flags
+00 68 # entries[0].length
+03 # entries[0].table_id
+00 # entries[0].pad
+00 3f ff ff # entries[0].match.wildcards
+00 00 00 00 # remaining match fields
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 01 # entries[0].duration_sec
+00 00 00 02 # entries[0].duration_nsec
+00 64 # entries[0].priority
+00 05 # entries[0].idle_timeout
+00 0a # entries[0].hard_timeout
+00 00 00 00 00 00 # pad
+01 23 45 67 89 ab cd ef # entries[0].cookie
+00 00 00 00 00 00 00 0a # entries[0].packet_count
+00 00 00 00 00 00 03 e8 # entries[0].byte_count
+00 00 # entries[0].actions[0].type
+00 08 # entries[0].actions[0].len
+00 01 # entries[0].actions[0].port
+00 00 # entries[0].actions[0].max_len
+00 00 # entries[0].actions[1].type
+00 08 # entries[0].actions[1].len
+00 02 # entries[0].actions[1].port
+00 00 # entries[0].actions[1].max_len
+00 70 # entries[1].length
+04 # entries[1].table_id
+00 # entries[1].pad
+00 3f ff ff # entries[1].match.wildcards
+00 00 00 00 # remaining match fields
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 00 00 00 00 00 # ...
+00 00 00 01 # entries[1].duration_sec
+00 00 00 02 # entries[1].duration_nsec
+00 64 # entries[1].priority
+00 05 # entries[1].idle_timeout
+00 0a # entries[1].hard_timeout
+00 00 00 00 00 00 # pad
+01 23 45 67 89 ab cd ef # entries[1].cookie
+00 00 00 00 00 00 00 0a # entries[1].packet_count
+00 00 00 00 00 00 03 e8 # entries[1].byte_count
+00 00 # entries[1].actions[0].type
+00 08 # entries[1].actions[0].len
+00 01 # entries[1].actions[0].port
+00 00 # entries[1].actions[0].max_len
+00 00 # entries[1].actions[1].type
+00 08 # entries[1].actions[1].len
+00 02 # entries[1].actions[1].port
+00 00 # entries[1].actions[1].max_len
+00 00 # entries[1].actions[2].type
+00 08 # entries[1].actions[2].len
+00 03 # entries[1].actions[2].port
+00 00 # entries[1].actions[2].max_len
+-- python
+ofp.message.flow_stats_reply(
+ xid=6,
+ flags=0,
+ entries=[
+ ofp.flow_stats_entry(table_id=3,
+ match=ofp.match(),
+ duration_sec=1,
+ duration_nsec=2,
+ priority=100,
+ idle_timeout=5,
+ hard_timeout=10,
+ cookie=0x0123456789abcdef,
+ packet_count=10,
+ byte_count=1000,
+ actions=[ofp.action.output(port=1),
+ ofp.action.output(port=2)]),
+ ofp.flow_stats_entry(table_id=4,
+ match=ofp.match(),
+ duration_sec=1,
+ duration_nsec=2,
+ priority=100,
+ idle_timeout=5,
+ hard_timeout=10,
+ cookie=0x0123456789abcdef,
+ packet_count=10,
+ byte_count=1000,
+ actions=[ofp.action.output(port=1),
+ ofp.action.output(port=2),
+ ofp.action.output(port=3)])])
diff --git a/test_data/of10/packet_in.data b/test_data/of10/packet_in.data
new file mode 100644
index 0000000..f8d026b
--- /dev/null
+++ b/test_data/of10/packet_in.data
@@ -0,0 +1,18 @@
+-- binary
+01 0a # version / type
+00 15 # length
+12 34 56 78 # xid
+ab cd ef 01 # buffer_id
+00 09 # total_len
+ff fe # in_port
+01 # reason
+00 # pad
+61 62 63 # data
+-- python
+ofp.message.packet_in(
+ xid=0x12345678,
+ buffer_id=0xabcdef01,
+ total_len=9,
+ in_port=ofp.OFPP_LOCAL,
+ reason=ofp.OFPR_ACTION,
+ data='abc')
diff --git a/test_data/of10/packet_out.data b/test_data/of10/packet_out.data
new file mode 100644
index 0000000..a3892f6
--- /dev/null
+++ b/test_data/of10/packet_out.data
@@ -0,0 +1,25 @@
+-- binary
+01 0d # version/type
+00 23 # length
+12 34 56 78 # xid
+ab cd ef 01 # buffer_id
+ff fe # in_port
+00 10 # actions_len
+00 00 # actions[0].type
+00 08 # actions[0].len
+00 01 # actions[0].port
+00 00 # actions[0].max_len
+00 00 # actions[1].type
+00 08 # actions[1].len
+00 02 # actions[1].port
+00 00 # actions[1].max_len
+61 62 63 # data
+-- python
+ofp.message.packet_out(
+ xid=0x12345678,
+ buffer_id=0xabcdef01,
+ in_port=ofp.OFPP_LOCAL,
+ actions=[
+ ofp.action.output(port=1),
+ ofp.action.output(port=2)],
+ data='abc')
diff --git a/test_data/of10/port_mod.data b/test_data/of10/port_mod.data
new file mode 100644
index 0000000..972a4e8
--- /dev/null
+++ b/test_data/of10/port_mod.data
@@ -0,0 +1,18 @@
+-- binary
+01 0f # version/type
+00 20 # length
+00 00 00 02 # xid
+ff fd # port_no
+01 02 03 04 05 06 # hw_addr
+90 ab cd ef # config
+ff 11 ff 11 # mask
+ca fe 67 89 # advertise
+00 00 00 00 # pad
+-- python
+ofp.message.port_mod(
+ xid=2,
+ port_no=ofp.OFPP_CONTROLLER,
+ hw_addr=[1,2,3,4,5,6],
+ config=0x90ABCDEF,
+ mask=0xFF11FF11,
+ advertise=0xCAFE6789)
diff --git a/test_data/of10/port_stats_reply.data b/test_data/of10/port_stats_reply.data
new file mode 100644
index 0000000..45a3532
--- /dev/null
+++ b/test_data/of10/port_stats_reply.data
@@ -0,0 +1,39 @@
+-- binary
+01 11 # version/type
+00 dc # length
+00 00 00 05 # xid
+00 04 # stats_type
+00 00 # flags
+00 01 # entries[0].port_no
+00 00 00 00 00 00 # entries[0].pad
+00 00 00 00 00 00 00 38 # entries[0].rx_packets
+00 00 00 00 00 00 00 00 # entries[0].tx_packets
+00 00 00 00 00 00 00 00 # entries[0].rx_bytes
+00 00 00 00 00 00 00 00 # entries[0].tx_bytes
+00 00 00 00 00 00 00 00 # entries[0].rx_dropped
+00 00 00 00 00 00 00 00 # entries[0].tx_dropped
+00 00 00 00 00 00 00 00 # entries[0].rx_errors
+00 00 00 00 00 00 00 00 # entries[0].tx_errors
+00 00 00 00 00 00 00 00 # entries[0].rx_frame_err
+00 00 00 00 00 00 00 00 # entries[0].rx_over_err
+00 00 00 00 00 00 00 00 # entries[0].rx_crc_err
+00 00 00 00 00 00 00 05 # entries[0].collisions
+ff fe # entries[1].port_no
+00 00 00 00 00 00 # entries[1].pad
+00 00 00 00 00 00 00 01 # entries[1].rx_packets
+00 00 00 00 00 00 00 00 # entries[1].tx_packets
+00 00 00 00 00 00 00 00 # entries[1].rx_bytes
+00 00 00 00 00 00 00 00 # entries[1].tx_bytes
+00 00 00 00 00 00 00 00 # entries[1].rx_dropped
+00 00 00 00 00 00 00 00 # entries[1].tx_dropped
+00 00 00 00 00 00 00 00 # entries[1].rx_errors
+00 00 00 00 00 00 00 00 # entries[1].tx_errors
+00 00 00 00 00 00 00 00 # entries[1].rx_frame_err
+00 00 00 00 00 00 00 00 # entries[1].rx_over_err
+00 00 00 00 00 00 00 00 # entries[1].rx_crc_err
+00 00 00 00 00 00 00 01 # entries[1].collisions
+-- python
+ofp.message.port_stats_reply(
+ xid=5, flags=0, entries=[
+ ofp.port_stats_entry(port_no=1, rx_packets=56, collisions=5),
+ ofp.port_stats_entry(port_no=ofp.OFPP_LOCAL, rx_packets=1, collisions=1)])
diff --git a/test_data/of10/port_status.data b/test_data/of10/port_status.data
new file mode 100644
index 0000000..04da9fd
--- /dev/null
+++ b/test_data/of10/port_status.data
@@ -0,0 +1,30 @@
+-- binary
+01 0c # version / type
+00 40 # length
+00 00 00 04 # xid
+01 # reason
+00 00 00 00 00 00 00 # pad
+ff fd # desc.port_no
+01 02 03 04 05 06 # desc.hw_addr
+66 6f 6f 00 00 00 00 00 # desc.name
+00 00 00 00 00 00 00 00 # ...
+00 00 00 10 # desc.config
+00 00 02 00 # desc.state
+00 00 00 01 # desc.curr
+00 00 00 20 # desc.advertised
+00 00 02 00 # desc.supported
+00 00 08 00 # desc.peer
+-- python
+ofp.message.port_status(
+ xid=4,
+ reason=ofp.OFPPR_DELETE,
+ desc=ofp.port_desc(
+ port_no=ofp.OFPP_CONTROLLER,
+ hw_addr=[1,2,3,4,5,6],
+ name="foo",
+ config=ofp.OFPPC_NO_FLOOD,
+ state=ofp.OFPPS_STP_FORWARD,
+ curr=ofp.OFPPF_10MB_HD,
+ advertised=ofp.OFPPF_1GB_FD,
+ supported=ofp.OFPPF_AUTONEG,
+ peer=ofp.OFPPF_PAUSE_ASYM))
diff --git a/test_data/of10/queue_get_config_reply.data b/test_data/of10/queue_get_config_reply.data
new file mode 100644
index 0000000..5e3453d
--- /dev/null
+++ b/test_data/of10/queue_get_config_reply.data
@@ -0,0 +1,37 @@
+-- binary
+01 15 # version / type
+00 50 # length
+12 34 56 78 # xid
+ff fe # port
+00 00 00 00 00 00 # pad
+00 00 00 01 # queues[0].queue_id
+00 18 # queues[0].len
+00 00 # queues[0].pad
+00 01 # queues[0].properties[0].type
+00 10 # queues[0].properties[0].length
+00 00 00 00 # queues[0].properties[0].pad
+00 05 # queues[0].properties[0].rate
+00 00 00 00 00 00 # queues[0].properties[0].pad2
+00 00 00 02 # queues[1].queue_id
+00 28 # queues[1].len
+00 00 # queues[1].pad
+00 01 # queues[1].properties[0].type
+00 10 # queues[1].properties[0].length
+00 00 00 00 # queues[1].properties[0].pad
+00 06 # queues[1].properties[0].rate
+00 00 00 00 00 00 # queues[1].properties[0].pad2
+00 01 # queues[1].properties[1].type
+00 10 # queues[1].properties[1].length
+00 00 00 00 # queues[1].properties[1].pad
+00 07 # queues[1].properties[1].rate
+00 00 00 00 00 00 # queues[1].properties[1].pad2
+-- python
+ofp.message.queue_get_config_reply(
+ xid=0x12345678,
+ port=ofp.OFPP_LOCAL,
+ queues=[
+ ofp.packet_queue(queue_id=1, properties=[
+ ofp.queue_prop_min_rate(rate=5)]),
+ ofp.packet_queue(queue_id=2, properties=[
+ ofp.queue_prop_min_rate(rate=6),
+ ofp.queue_prop_min_rate(rate=7)])])