of14: Add to ofproto unit tests

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Simon Horman 2014-02-04 20:52:11 +09:00 committed by FUJITA Tomonori
parent 9e999fad23
commit 455249b1c1
124 changed files with 33956 additions and 4 deletions

View File

@ -2257,13 +2257,13 @@ class OFPQueueProp(OFPPropBase):
class OFPQueueStats(StringifyMixin):
def __init__(self, length=None, port_no=None, queue_id=None,
tx_type=None, tx_packets=None, tx_errors=None,
tx_bytes=None, tx_packets=None, tx_errors=None,
duration_sec=None, duration_nsec=None, properties=None):
super(OFPQueueStats, self).__init__()
self.length = length
self.port_no = port_no
self.queue_id = queue_id
self.tx_type = tx_type
self.tx_bytes = tx_bytes
self.tx_packets = tx_packets
self.tx_errors = tx_errors
self.duration_sec = duration_sec
@ -2272,7 +2272,7 @@ class OFPQueueStats(StringifyMixin):
@classmethod
def parser(cls, buf, offset):
(length, port_no, queue_id, tx_type, tx_packets, tx_errors,
(length, port_no, queue_id, tx_bytes, tx_packets, tx_errors,
duration_sec, duration_nsec) = struct.unpack_from(
ofproto.OFP_QUEUE_STATS_PACK_STR, buf, offset)
props = []
@ -2280,7 +2280,7 @@ class OFPQueueStats(StringifyMixin):
while rest:
p, rest = OFPQueueProp.parse(rest)
props.append(p)
stats = cls(length, port_no, queue_id, tx_type, tx_packets, tx_errors,
stats = cls(length, port_no, queue_id, tx_bytes, tx_packets, tx_errors,
duration_sec, duration_nsec, props)
return stats

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,15 @@
{
"OFPDescStatsReply": {
"body": {
"OFPDescStats": {
"dp_desc": "dp",
"hw_desc": "hw",
"mfr_desc": "mfr",
"serial_num": "serial",
"sw_desc": "sw"
}
},
"flags": 0,
"type": 0
}
}

View File

@ -0,0 +1,18 @@
{
"OFPPacketOut": {
"actions": [
{
"OFPActionOutput": {
"len": 16,
"max_len": 65535,
"port": 4294967292,
"type": 0
}
}
],
"actions_len": 16,
"buffer_id": 4294967295,
"data": "8guk0D9w8gukffjqCABFAABU+BoAAP8Br4sKAAABCgAAAggAAgj3YAAAMdYCAAAAAACrjS0xAAAAABAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vAAAAAAAAAAA=",
"in_port": 4294967293
}
}

View File

@ -0,0 +1,20 @@
{
"OFPHello": {
"elements": [
{
"OFPHelloElemVersionBitmap": {
"length": 8,
"type": 1,
"versions": [
1,
2,
3,
9,
10,
30
]
}
}
]
}
}

View File

@ -0,0 +1,18 @@
{
"OFPFlowStatsRequest": {
"cookie": 0,
"cookie_mask": 0,
"flags": 0,
"match": {
"OFPMatch": {
"length": 4,
"oxm_fields": [],
"type": 1
}
},
"out_group": 4294967295,
"out_port": 4294967295,
"table_id": 0,
"type": 1
}
}

View File

@ -0,0 +1,324 @@
{
"OFPFlowStatsReply": {
"body": [
{
"OFPFlowStats": {
"byte_count": 0,
"cookie": 0,
"duration_nsec": 115277000,
"duration_sec": 358,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"importance": 0,
"instructions": [],
"length": 56,
"match": {
"OFPMatch": {
"length": 4,
"oxm_fields": [],
"type": 1
}
},
"packet_count": 0,
"priority": 65535,
"table_id": 0
}
},
{
"OFPFlowStats": {
"byte_count": 0,
"cookie": 0,
"duration_nsec": 115055000,
"duration_sec": 358,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"importance": 0,
"instructions": [
{
"OFPInstructionActions": {
"actions": [
{
"OFPActionOutput": {
"len": 16,
"max_len": 0,
"port": 4294967290,
"type": 0
}
}
],
"len": 24,
"type": 4
}
}
],
"length": 88,
"match": {
"OFPMatch": {
"length": 10,
"oxm_fields": [
{
"OXMTlv": {
"field": "eth_type",
"mask": null,
"value": 2054
}
}
],
"type": 1
}
},
"packet_count": 0,
"priority": 65534,
"table_id": 0
}
},
{
"OFPFlowStats": {
"byte_count": 238,
"cookie": 0,
"duration_nsec": 511582000,
"duration_sec": 316220,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"importance": 0,
"instructions": [
{
"OFPInstructionGotoTable": {
"len": 8,
"table_id": 1,
"type": 1
}
}
],
"length": 80,
"match": {
"OFPMatch": {
"length": 22,
"oxm_fields": [
{
"OXMTlv": {
"field": "in_port",
"mask": null,
"value": 6
}
},
{
"OXMTlv": {
"field": "eth_src",
"mask": null,
"value": "f2:0b:a4:7d:f8:ea"
}
}
],
"type": 1
}
},
"packet_count": 3,
"priority": 123,
"table_id": 0
}
},
{
"OFPFlowStats": {
"byte_count": 98,
"cookie": 0,
"duration_nsec": 980901000,
"duration_sec": 313499,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"importance": 0,
"instructions": [
{
"OFPInstructionActions": {
"actions": [
{
"OFPActionSetField": {
"field": {
"OXMTlv": {
"field": "vlan_vid",
"mask": null,
"value": 258
}
}
}
},
{
"OFPActionCopyTtlOut": {
"len": 8,
"type": 11
}
},
{
"OFPActionCopyTtlIn": {
"len": 8,
"type": 12
}
},
{
"OFPActionCopyTtlIn": {
"len": 8,
"type": 12
}
},
{
"OFPActionPopPbb": {
"len": 8,
"type": 27
}
},
{
"OFPActionPushPbb": {
"ethertype": 4660,
"len": 8,
"type": 26
}
},
{
"OFPActionPopMpls": {
"ethertype": 39030,
"len": 8,
"type": 20
}
},
{
"OFPActionPushMpls": {
"ethertype": 34887,
"len": 8,
"type": 19
}
},
{
"OFPActionPopVlan": {
"len": 8,
"type": 18
}
},
{
"OFPActionPushVlan": {
"ethertype": 33024,
"len": 8,
"type": 17
}
},
{
"OFPActionDecMplsTtl": {
"len": 8,
"type": 16
}
},
{
"OFPActionSetMplsTtl": {
"len": 8,
"mpls_ttl": 10,
"type": 15
}
},
{
"OFPActionDecNwTtl": {
"len": 8,
"type": 24
}
},
{
"OFPActionSetNwTtl": {
"len": 8,
"nw_ttl": 10,
"type": 23
}
},
{
"OFPActionSetQueue": {
"len": 8,
"queue_id": 3,
"type": 21
}
},
{
"OFPActionGroup": {
"group_id": 99,
"len": 8,
"type": 22
}
},
{
"OFPActionOutput": {
"len": 16,
"max_len": 65535,
"port": 6,
"type": 0
}
}
],
"len": 160,
"type": 3
}
},
{
"OFPInstructionActions": {
"actions": [
{
"OFPActionSetField": {
"field": {
"OXMTlv": {
"field": "eth_src",
"mask": null,
"value": "01:02:03:04:05:06"
}
}
}
},
{
"OFPActionSetField": {
"field": {
"OXMTlv": {
"field": "pbb_uca",
"mask": null,
"value": 1
}
}
}
}
],
"len": 40,
"type": 4
}
},
{
"OFPInstructionActions": {
"actions": [
{
"OFPActionOutput": {
"len": 16,
"max_len": 65535,
"port": 4294967293,
"type": 0
}
}
],
"len": 24,
"type": 3
}
}
],
"length": 280,
"match": {
"OFPMatch": {
"length": 4,
"oxm_fields": [],
"type": 1
}
},
"packet_count": 1,
"priority": 0,
"table_id": 0
}
}
],
"flags": 0,
"type": 1
}
}

View File

@ -0,0 +1,5 @@
{
"OFPEchoRequest": {
"data": "aG9nZQ=="
}
}

View File

@ -0,0 +1,5 @@
{
"OFPEchoReply": {
"data": "aG9nZQ=="
}
}

View File

@ -0,0 +1,7 @@
{
"OFPErrorMsg": {
"code": 11,
"data": "ZnVnYWZ1Z2E=",
"type": 2
}
}

View File

@ -0,0 +1,7 @@
{
"OFPExperimenter": {
"data": "bmF6bw==",
"exp_type": 123456789,
"experimenter": 98765432
}
}

View File

@ -0,0 +1,3 @@
{
"OFPBarrierRequest": {}
}

View File

@ -0,0 +1,3 @@
{
"OFPBarrierReply": {}
}

View File

@ -0,0 +1,6 @@
{
"OFPRoleRequest": {
"generation_id": 17294086455919964160,
"role": 2
}
}

View File

@ -0,0 +1,188 @@
{
"OFPFlowMod": {
"buffer_id": 65535,
"command": 0,
"cookie": 0,
"cookie_mask": 0,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"importance": 0,
"instructions": [
{
"OFPInstructionActions": {
"actions": [
{
"OFPActionSetField": {
"field": {
"OXMTlv": {
"field": "vlan_vid",
"mask": null,
"value": 258
}
}
}
},
{
"OFPActionCopyTtlOut": {
"len": 8,
"type": 11
}
},
{
"OFPActionCopyTtlIn": {
"len": 8,
"type": 12
}
},
{
"OFPActionCopyTtlIn": {
"len": 8,
"type": 12
}
},
{
"OFPActionPopPbb": {
"len": 8,
"type": 27
}
},
{
"OFPActionPushPbb": {
"ethertype": 4660,
"len": 8,
"type": 26
}
},
{
"OFPActionPopMpls": {
"ethertype": 39030,
"len": 8,
"type": 20
}
},
{
"OFPActionPushMpls": {
"ethertype": 34887,
"len": 8,
"type": 19
}
},
{
"OFPActionPopVlan": {
"len": 8,
"type": 18
}
},
{
"OFPActionPushVlan": {
"ethertype": 33024,
"len": 8,
"type": 17
}
},
{
"OFPActionDecMplsTtl": {
"len": 8,
"type": 16
}
},
{
"OFPActionSetMplsTtl": {
"len": 8,
"mpls_ttl": 10,
"type": 15
}
},
{
"OFPActionDecNwTtl": {
"len": 8,
"type": 24
}
},
{
"OFPActionSetNwTtl": {
"len": 8,
"nw_ttl": 10,
"type": 23
}
},
{
"OFPActionSetQueue": {
"len": 8,
"queue_id": 3,
"type": 21
}
},
{
"OFPActionGroup": {
"group_id": 99,
"len": 8,
"type": 22
}
},
{
"OFPActionOutput": {
"len": 16,
"max_len": 65535,
"port": 6,
"type": 0
}
}
],
"len": 160,
"type": 3
}
},
{
"OFPInstructionActions": {
"actions": [
{
"OFPActionSetField": {
"field": {
"OXMTlv": {
"field": "eth_src",
"mask": null,
"value": "01:02:03:04:05:06"
}
}
}
},
{
"OFPActionSetField": {
"field": {
"OXMTlv": {
"field": "pbb_uca",
"mask": null,
"value": 1
}
}
}
}
],
"len": 40,
"type": 4
}
}
],
"match": {
"OFPMatch": {
"length": 14,
"oxm_fields": [
{
"OXMTlv": {
"field": "eth_dst",
"mask": null,
"value": "f2:0b:a4:7d:f8:ea"
}
}
],
"type": 1
}
},
"out_group": 4294967295,
"out_port": 4294967295,
"priority": 123,
"table_id": 1
}
}

View File

@ -0,0 +1,6 @@
{
"OFPRoleReply": {
"generation_id": 17294086455919964160,
"role": 3
}
}

View File

@ -0,0 +1,27 @@
{
"OFPGroupMod": {
"buckets": [
{
"OFPBucket": {
"actions": [
{
"OFPActionOutput": {
"len": 16,
"max_len": 65535,
"port": 2,
"type": 0
}
}
],
"len": 32,
"watch_group": 1,
"watch_port": 1,
"weight": 1
}
}
],
"command": 0,
"group_id": 1,
"type": 0
}
}

View File

@ -0,0 +1,17 @@
{
"OFPPortMod": {
"config": 0,
"hw_addr": "00:11:00:00:11:11",
"mask": 0,
"properties": [
{
"OFPPortModPropEthernet": {
"type": 0,
"length": 8,
"advertise": 4096
}
}
],
"port_no": 1
}
}

View File

@ -0,0 +1,6 @@
{
"OFPTableMod": {
"config": 0,
"table_id": 255
}
}

View File

@ -0,0 +1,6 @@
{
"OFPDescStatsRequest": {
"flags": 0,
"type": 0
}
}

View File

@ -0,0 +1,18 @@
{
"OFPAggregateStatsRequest": {
"cookie": 0,
"cookie_mask": 0,
"flags": 0,
"match": {
"OFPMatch": {
"length": 4,
"oxm_fields": [],
"type": 1
}
},
"out_group": 4294967295,
"out_port": 4294967295,
"table_id": 255,
"type": 2
}
}

View File

@ -0,0 +1,13 @@
{
"OFPAggregateStatsReply": {
"body": {
"OFPAggregateStats": {
"byte_count": 574,
"flow_count": 6,
"packet_count": 7
}
},
"flags": 0,
"type": 2
}
}

View File

@ -0,0 +1,6 @@
{
"OFPTableStatsRequest": {
"flags": 0,
"type": 3
}
}

View File

@ -0,0 +1,24 @@
{
"OFPTableStatsReply": {
"body": [
{
"OFPTableStats": {
"active_count": 4,
"lookup_count": 4,
"matched_count": 4,
"table_id": 0
}
},
{
"OFPTableStats": {
"active_count": 4,
"lookup_count": 4,
"matched_count": 4,
"table_id": 1
}
}
],
"flags": 0,
"type": 3
}
}

View File

@ -0,0 +1,7 @@
{
"OFPPortStatsRequest": {
"flags": 0,
"port_no": 4294967295,
"type": 4
}
}

View File

@ -0,0 +1,47 @@
{
"OFPFlowMod": {
"buffer_id": 65535,
"command": 0,
"cookie": 0,
"cookie_mask": 0,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"importance": 0,
"instructions": [
{
"OFPInstructionGotoTable": {
"len": 8,
"table_id": 1,
"type": 1
}
}
],
"match": {
"OFPMatch": {
"length": 22,
"oxm_fields": [
{
"OXMTlv": {
"field": "in_port",
"mask": null,
"value": 6
}
},
{
"OXMTlv": {
"field": "eth_src",
"mask": null,
"value": "f2:0b:a4:7d:f8:ea"
}
}
],
"type": 1
}
},
"out_group": 4294967295,
"out_port": 4294967295,
"priority": 123,
"table_id": 0
}
}

View File

@ -0,0 +1,64 @@
{
"OFPPortStatsReply": {
"body": [
{
"OFPPortStats": {
"duration_nsec": 0,
"duration_sec": 0,
"length": 120,
"port_no": 7,
"properties": [
{
"OFPPortStatsPropEthernet": {
"collisions": 0,
"length": 40,
"rx_crc_err": 0,
"rx_frame_err": 0,
"rx_over_err": 0,
"type": 0
}
}
],
"rx_bytes": 0,
"rx_dropped": 0,
"rx_errors": 0,
"rx_packets": 0,
"tx_bytes": 336,
"tx_dropped": 0,
"tx_errors": 0,
"tx_packets": 4
}
},
{
"OFPPortStats": {
"duration_nsec": 0,
"duration_sec": 0,
"length": 120,
"port_no": 6,
"properties": [
{
"OFPPortStatsPropEthernet": {
"collisions": 0,
"length": 40,
"rx_crc_err": 0,
"rx_frame_err": 0,
"rx_over_err": 0,
"type": 0
}
}
],
"rx_bytes": 336,
"rx_dropped": 0,
"rx_errors": 0,
"rx_packets": 4,
"tx_bytes": 336,
"tx_dropped": 0,
"tx_errors": 0,
"tx_packets": 4
}
}
],
"flags": 0,
"type": 4
}
}

View File

@ -0,0 +1,6 @@
{
"OFPGroupFeaturesStatsRequest": {
"flags": 0,
"type": 8
}
}

View File

@ -0,0 +1,24 @@
{
"OFPGroupFeaturesStatsReply": {
"body": {
"OFPGroupFeaturesStats": {
"actions": [
67082241,
67082241,
67082241,
67082241
],
"capabilities": 5,
"max_groups": [
16777216,
16777216,
16777216,
16777216
],
"types": 15
}
},
"flags": 0,
"type": 8
}
}

View File

@ -0,0 +1,6 @@
{
"OFPGroupDescStatsRequest": {
"flags": 0,
"type": 7
}
}

View File

@ -0,0 +1,35 @@
{
"OFPGroupDescStatsReply": {
"body": [
{
"OFPGroupDescStats": {
"buckets": [
{
"OFPBucket": {
"actions": [
{
"OFPActionOutput": {
"len": 16,
"max_len": 65535,
"port": 2,
"type": 0
}
}
],
"len": 32,
"watch_group": 1,
"watch_port": 1,
"weight": 1
}
}
],
"group_id": 1,
"length": 40,
"type": 0
}
}
],
"flags": 0,
"type": 7
}
}

View File

@ -0,0 +1,8 @@
{
"OFPQueueStatsRequest": {
"flags": 0,
"port_no": 4294967295,
"queue_id": 4294967295,
"type": 5
}
}

View File

@ -0,0 +1,47 @@
{
"OFPQueueStatsReply": {
"body": [
{
"OFPQueueStats": {
"duration_nsec": 0,
"duration_sec": 0,
"length": 48,
"port_no": 7,
"properties": [],
"queue_id": 1,
"tx_bytes": 0,
"tx_errors": 0,
"tx_packets": 0
}
},
{
"OFPQueueStats": {
"duration_nsec": 0,
"duration_sec": 0,
"length": 48,
"port_no": 6,
"properties": [],
"queue_id": 1,
"tx_bytes": 0,
"tx_errors": 0,
"tx_packets": 0
}
},
{
"OFPQueueStats": {
"duration_nsec": 0,
"duration_sec": 0,
"length": 48,
"port_no": 7,
"properties": [],
"queue_id": 2,
"tx_bytes": 0,
"tx_errors": 0,
"tx_packets": 0
}
}
],
"flags": 0,
"type": 5
}
}

View File

@ -0,0 +1,29 @@
{
"OFPPortStatus": {
"desc": {
"OFPPort": {
"config": 0,
"hw_addr": "f2:0b:a4:d0:3f:70",
"length": 72,
"name": "\u79c1\u306e\u30dd\u30fc\u30c8",
"port_no": 7,
"properties": [
{
"OFPPortDescPropEthernet": {
"length": 32,
"type": 0,
"advertised": 10240,
"curr": 10248,
"curr_speed": 5000,
"max_speed": 5000,
"peer": 10248,
"supported": 10248
}
}
],
"state": 4
}
},
"reason": 0
}
}

View File

@ -0,0 +1,29 @@
{
"OFPFlowRemoved": {
"byte_count": 86,
"cookie": 0,
"duration_nsec": 48825000,
"duration_sec": 3,
"hard_timeout": 0,
"idle_timeout": 3,
"match": {
"OFPMatch": {
"length": 14,
"oxm_fields": [
{
"OXMTlv": {
"field": "eth_dst",
"mask": null,
"value": "f2:0b:a4:7d:f8:ea"
}
}
],
"type": 1
}
},
"packet_count": 1,
"priority": 65535,
"reason": 0,
"table_id": 0
}
}

View File

@ -0,0 +1,8 @@
{
"OFPErrorExperimenterMsg": {
"data": "amlra2VuIGRhdGE=",
"exp_type": 60000,
"experimenter": 999999,
"type": 65535
}
}

View File

@ -0,0 +1,81 @@
{
"OFPPacketIn": {
"buffer_id": 2,
"cookie": 283686884868096,
"data": "////////8gukffjqCAYAAQgABgQAAfILpH346goAAAEAAAAAAAAKAAAD",
"match": {
"OFPMatch": {
"length": 80,
"oxm_fields": [
{
"OXMTlv": {
"field": "in_port",
"mask": null,
"value": 6
}
},
{
"OXMTlv": {
"field": "eth_type",
"mask": null,
"value": 2054
}
},
{
"OXMTlv": {
"field": "eth_dst",
"mask": null,
"value": "ff:ff:ff:ff:ff:ff"
}
},
{
"OXMTlv": {
"field": "eth_src",
"mask": null,
"value": "f2:0b:a4:7d:f8:ea"
}
},
{
"OXMTlv": {
"field": "arp_op",
"mask": null,
"value": 1
}
},
{
"OXMTlv": {
"field": "arp_spa",
"mask": null,
"value": "10.0.0.1"
}
},
{
"OXMTlv": {
"field": "arp_tpa",
"mask": null,
"value": "10.0.0.3"
}
},
{
"OXMTlv": {
"field": "arp_sha",
"mask": null,
"value": "f2:0b:a4:7d:f8:ea"
}
},
{
"OXMTlv": {
"field": "arp_tha",
"mask": null,
"value": "00:00:00:00:00:00"
}
}
],
"type": 1
}
},
"reason": 3,
"table_id": 1,
"total_len": 42
}
}

View File

@ -0,0 +1,3 @@
{
"OFPGetAsyncRequest": {}
}

View File

@ -0,0 +1,16 @@
{
"OFPGetAsyncReply": {
"flow_removed_mask": [
15,
3
],
"packet_in_mask": [
5,
1
],
"port_status_mask": [
7,
3
]
}
}

View File

@ -0,0 +1,16 @@
{
"OFPSetAsync": {
"flow_removed_mask": [
15,
3
],
"packet_in_mask": [
5,
1
],
"port_status_mask": [
7,
3
]
}
}

Some files were not shown because too many files have changed in this diff Show More